diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/ops/no_op.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/ops/no_op.h new file mode 100644 index 0000000000000000000000000000000000000000..4a45f4c44b52dc5519538c861651db5a0cc98abb --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/ops/no_op.h @@ -0,0 +1,41 @@ +// This file is MACHINE GENERATED! Do not edit. + +#ifndef TENSORFLOW_CC_OPS_NO_OP_H_ +#define TENSORFLOW_CC_OPS_NO_OP_H_ + +// This file is MACHINE GENERATED! Do not edit. + +#include "tensorflow/cc/framework/ops.h" +#include "tensorflow/cc/framework/scope.h" +#include "tensorflow/core/framework/tensor.h" +#include "tensorflow/core/framework/tensor_shape.h" +#include "tensorflow/core/framework/types.h" +#include "tensorflow/core/lib/gtl/array_slice.h" + +namespace tensorflow { +namespace ops { + +/// @defgroup no_op No Op +/// @{ + +/// Does nothing. Only useful as a placeholder for control edges. +/// +/// Args: +/// * scope: A Scope object +/// +/// Returns: +/// * the created `Operation` +class NoOp { + public: + NoOp(const ::tensorflow::Scope& scope); + operator ::tensorflow::Operation() const { return operation; } + + Operation operation; +}; + +/// @} + +} // namespace ops +} // namespace tensorflow + +#endif // TENSORFLOW_CC_OPS_NO_OP_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/ops/no_op_internal.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/ops/no_op_internal.h new file mode 100644 index 0000000000000000000000000000000000000000..1a3a6854efeb2d6323b94c1a60e54ced76990307 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/ops/no_op_internal.h @@ -0,0 +1,28 @@ +// This file is MACHINE GENERATED! Do not edit. + +#ifndef TENSORFLOW_CC_OPS_NO_OP_INTERNAL_H_ +#define TENSORFLOW_CC_OPS_NO_OP_INTERNAL_H_ + +// This file is MACHINE GENERATED! Do not edit. + +#include "tensorflow/cc/framework/ops.h" +#include "tensorflow/cc/framework/scope.h" +#include "tensorflow/core/framework/tensor.h" +#include "tensorflow/core/framework/tensor_shape.h" +#include "tensorflow/core/framework/types.h" +#include "tensorflow/core/lib/gtl/array_slice.h" + +namespace tensorflow { +namespace ops { +namespace internal { +// NOTE: This namespace has internal TensorFlow details that +// are not part of TensorFlow's public API. + +/// @defgroup no_op_internal No Op Internal +/// @{ + +} // namespace internal +} // namespace ops +} // namespace tensorflow + +#endif // TENSORFLOW_CC_OPS_NO_OP_INTERNAL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/ops/parsing_ops.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/ops/parsing_ops.h new file mode 100644 index 0000000000000000000000000000000000000000..67597f9168d756ea54c96635a68cc94cc1fef6bd --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/ops/parsing_ops.h @@ -0,0 +1,1285 @@ +// This file is MACHINE GENERATED! Do not edit. + +#ifndef TENSORFLOW_CC_OPS_PARSING_OPS_H_ +#define TENSORFLOW_CC_OPS_PARSING_OPS_H_ + +// This file is MACHINE GENERATED! Do not edit. + +#include "tensorflow/cc/framework/ops.h" +#include "tensorflow/cc/framework/scope.h" +#include "tensorflow/core/framework/tensor.h" +#include "tensorflow/core/framework/tensor_shape.h" +#include "tensorflow/core/framework/types.h" +#include "tensorflow/core/lib/gtl/array_slice.h" + +namespace tensorflow { +namespace ops { + +/// @defgroup parsing_ops Parsing Ops +/// @{ + +/// Convert CSV records to tensors. Each column maps to one tensor. +/// +/// RFC 4180 format is expected for the CSV records. +/// (https://tools.ietf.org/html/rfc4180) +/// Note that we allow leading and trailing spaces with int or float field. +/// +/// Args: +/// * scope: A Scope object +/// * records: Each string is a record/row in the csv and all records should have +/// the same format. +/// * record_defaults: One tensor per column of the input record, with either a +/// scalar default value for that column or an empty vector if the column is +/// required. +/// +/// Optional attributes (see `Attrs`): +/// * field_delim: char delimiter to separate fields in a record. +/// * use_quote_delim: If false, treats double quotation marks as regular +/// characters inside of the string fields (ignoring RFC 4180, Section 2, +/// Bullet 5). +/// * na_value: Additional string to recognize as NA/NaN. +/// +/// Returns: +/// * `OutputList`: Each tensor will have the same shape as records. +class DecodeCSV { + public: + /// Optional attribute setters for DecodeCSV + struct Attrs { + /// char delimiter to separate fields in a record. + /// + /// Defaults to "," + TF_MUST_USE_RESULT Attrs FieldDelim(StringPiece x) { + Attrs ret = *this; + ret.field_delim_ = x; + return ret; + } + + /// If false, treats double quotation marks as regular + /// characters inside of the string fields (ignoring RFC 4180, Section 2, + /// Bullet 5). + /// + /// Defaults to true + TF_MUST_USE_RESULT Attrs UseQuoteDelim(bool x) { + Attrs ret = *this; + ret.use_quote_delim_ = x; + return ret; + } + + /// Additional string to recognize as NA/NaN. + /// + /// Defaults to "" + TF_MUST_USE_RESULT Attrs NaValue(StringPiece x) { + Attrs ret = *this; + ret.na_value_ = x; + return ret; + } + + /// Defaults to [] + TF_MUST_USE_RESULT Attrs SelectCols(const gtl::ArraySlice& x) { + Attrs ret = *this; + ret.select_cols_ = x; + return ret; + } + + StringPiece field_delim_ = ","; + bool use_quote_delim_ = true; + StringPiece na_value_ = ""; + gtl::ArraySlice select_cols_ = {}; + }; + DecodeCSV(const ::tensorflow::Scope& scope, ::tensorflow::Input records, + ::tensorflow::InputList record_defaults); + DecodeCSV(const ::tensorflow::Scope& scope, ::tensorflow::Input records, + ::tensorflow::InputList record_defaults, const DecodeCSV::Attrs& + attrs); + ::tensorflow::Output operator[](size_t index) const { return output[index]; } + + + static Attrs FieldDelim(StringPiece x) { + return Attrs().FieldDelim(x); + } + static Attrs UseQuoteDelim(bool x) { + return Attrs().UseQuoteDelim(x); + } + static Attrs NaValue(StringPiece x) { + return Attrs().NaValue(x); + } + static Attrs SelectCols(const gtl::ArraySlice& x) { + return Attrs().SelectCols(x); + } + + Operation operation; + ::tensorflow::OutputList output; +}; + +/// Decompress strings. +/// +/// This op decompresses each element of the `bytes` input `Tensor`, which +/// is assumed to be compressed using the given `compression_type`. +/// +/// The `output` is a string `Tensor` of the same shape as `bytes`, +/// each element containing the decompressed data from the corresponding +/// element in `bytes`. +/// +/// Args: +/// * scope: A Scope object +/// * bytes: A Tensor of string which is compressed. +/// +/// Optional attributes (see `Attrs`): +/// * compression_type: A scalar containing either (i) the empty string (no +/// compression), (ii) "ZLIB", or (iii) "GZIP". +/// +/// Returns: +/// * `Output`: A Tensor with the same shape as input `bytes`, uncompressed +/// from bytes. +class DecodeCompressed { + public: + /// Optional attribute setters for DecodeCompressed + struct Attrs { + /// A scalar containing either (i) the empty string (no + /// compression), (ii) "ZLIB", or (iii) "GZIP". + /// + /// Defaults to "" + TF_MUST_USE_RESULT Attrs CompressionType(StringPiece x) { + Attrs ret = *this; + ret.compression_type_ = x; + return ret; + } + + StringPiece compression_type_ = ""; + }; + DecodeCompressed(const ::tensorflow::Scope& scope, ::tensorflow::Input bytes); + DecodeCompressed(const ::tensorflow::Scope& scope, ::tensorflow::Input bytes, + const DecodeCompressed::Attrs& attrs); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + static Attrs CompressionType(StringPiece x) { + return Attrs().CompressionType(x); + } + + Operation operation; + ::tensorflow::Output output; +}; + +/// Convert JSON-encoded Example records to binary protocol buffer strings. +/// +/// +/// Note: This is **not** a general purpose JSON parsing op. +/// +/// This op converts JSON-serialized +/// `tf.train.Example` (created with `json_format.MessageToJson`, following the +/// [standard JSON mapping](https://developers.google.com/protocol-buffers/docs/proto3#json)) +/// to a binary-serialized `tf.train.Example` (equivalent to +/// `Example.SerializeToString()`) suitable for conversion to tensors with +/// `tf.io.parse_example`. +/// +/// Args: +/// * scope: A Scope object +/// * json_examples: Each string is a JSON object serialized according to the JSON +/// mapping of the Example proto. +/// +/// Returns: +/// * `Output`: Each string is a binary Example protocol buffer corresponding +/// to the respective element of `json_examples`. +class DecodeJSONExample { + public: + DecodeJSONExample(const ::tensorflow::Scope& scope, ::tensorflow::Input + json_examples); + operator ::tensorflow::Output() const { return binary_examples; } + operator ::tensorflow::Input() const { return binary_examples; } + ::tensorflow::Node* node() const { return binary_examples.node(); } + + Operation operation; + ::tensorflow::Output binary_examples; +}; + +/// Reinterpret the bytes of a string as a vector of numbers. +/// +/// Args: +/// * scope: A Scope object +/// * input_bytes: Tensor of string to be decoded. +/// * fixed_length: Length in bytes for each element of the decoded output. Must be a multiple +/// of the size of the output type. +/// +/// Optional attributes (see `Attrs`): +/// * little_endian: Whether the input `input_bytes` is in little-endian order. Ignored for +/// `out_type` values that are stored in a single byte, like `uint8` +/// +/// Returns: +/// * `Output`: A Tensor with one more dimension than the input `bytes`. The added dimension +/// will have size equal to the length of the elements of `bytes` divided by the +/// number of bytes to represent `out_type`. +class DecodePaddedRaw { + public: + /// Optional attribute setters for DecodePaddedRaw + struct Attrs { + /// Whether the input `input_bytes` is in little-endian order. Ignored for + /// `out_type` values that are stored in a single byte, like `uint8` + /// + /// Defaults to true + TF_MUST_USE_RESULT Attrs LittleEndian(bool x) { + Attrs ret = *this; + ret.little_endian_ = x; + return ret; + } + + bool little_endian_ = true; + }; + DecodePaddedRaw(const ::tensorflow::Scope& scope, ::tensorflow::Input + input_bytes, ::tensorflow::Input fixed_length, DataType + out_type); + DecodePaddedRaw(const ::tensorflow::Scope& scope, ::tensorflow::Input + input_bytes, ::tensorflow::Input fixed_length, DataType + out_type, const DecodePaddedRaw::Attrs& attrs); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + static Attrs LittleEndian(bool x) { + return Attrs().LittleEndian(x); + } + + Operation operation; + ::tensorflow::Output output; +}; + +/// Reinterpret the bytes of a string as a vector of numbers. +/// +/// Args: +/// * scope: A Scope object +/// * bytes: All the elements must have the same length. +/// +/// Optional attributes (see `Attrs`): +/// * little_endian: Whether the input `bytes` are in little-endian order. +/// Ignored for `out_type` values that are stored in a single byte like +/// `uint8`. +/// +/// Returns: +/// * `Output`: A Tensor with one more dimension than the input `bytes`. The +/// added dimension will have size equal to the length of the elements +/// of `bytes` divided by the number of bytes to represent `out_type`. +class DecodeRaw { + public: + /// Optional attribute setters for DecodeRaw + struct Attrs { + /// Whether the input `bytes` are in little-endian order. + /// Ignored for `out_type` values that are stored in a single byte like + /// `uint8`. + /// + /// Defaults to true + TF_MUST_USE_RESULT Attrs LittleEndian(bool x) { + Attrs ret = *this; + ret.little_endian_ = x; + return ret; + } + + bool little_endian_ = true; + }; + DecodeRaw(const ::tensorflow::Scope& scope, ::tensorflow::Input bytes, DataType + out_type); + DecodeRaw(const ::tensorflow::Scope& scope, ::tensorflow::Input bytes, DataType + out_type, const DecodeRaw::Attrs& attrs); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + static Attrs LittleEndian(bool x) { + return Attrs().LittleEndian(x); + } + + Operation operation; + ::tensorflow::Output output; +}; + +/// Transforms a vector of brain.Example protos (as strings) into typed tensors. +/// +/// Args: +/// * scope: A Scope object +/// * serialized: A vector containing a batch of binary serialized Example protos. +/// * names: A vector containing the names of the serialized protos. +/// May contain, for example, table key (descriptive) names for the +/// corresponding serialized protos. These are purely useful for debugging +/// purposes, and the presence of values here has no effect on the output. +/// May also be an empty vector if no names are available. +/// If non-empty, this vector must be the same length as "serialized". +/// * sparse_keys: A list of Nsparse string Tensors (scalars). +/// The keys expected in the Examples' features associated with sparse values. +/// * dense_keys: A list of Ndense string Tensors (scalars). +/// The keys expected in the Examples' features associated with dense values. +/// * dense_defaults: A list of Ndense Tensors (some may be empty). +/// dense_defaults[j] provides default values +/// when the example's feature_map lacks dense_key[j]. If an empty Tensor is +/// provided for dense_defaults[j], then the Feature dense_keys[j] is required. +/// The input type is inferred from dense_defaults[j], even when it's empty. +/// If dense_defaults[j] is not empty, and dense_shapes[j] is fully defined, +/// then the shape of dense_defaults[j] must match that of dense_shapes[j]. +/// If dense_shapes[j] has an undefined major dimension (variable strides dense +/// feature), dense_defaults[j] must contain a single element: +/// the padding element. +/// * sparse_types: A list of Nsparse types; the data types of data in each Feature +/// given in sparse_keys. +/// Currently the ParseExample supports DT_FLOAT (FloatList), +/// DT_INT64 (Int64List), and DT_STRING (BytesList). +/// * dense_shapes: A list of Ndense shapes; the shapes of data in each Feature +/// given in dense_keys. +/// The number of elements in the Feature corresponding to dense_key[j] +/// must always equal dense_shapes[j].NumEntries(). +/// If dense_shapes[j] == (D0, D1, ..., DN) then the shape of output +/// Tensor dense_values[j] will be (|serialized|, D0, D1, ..., DN): +/// The dense outputs are just the inputs row-stacked by batch. +/// This works for dense_shapes[j] = (-1, D1, ..., DN). In this case +/// the shape of the output Tensor dense_values[j] will be +/// (|serialized|, M, D1, .., DN), where M is the maximum number of blocks +/// of elements of length D1 * .... * DN, across all minibatch entries +/// in the input. Any minibatch entry with less than M blocks of elements of +/// length D1 * ... * DN will be padded with the corresponding default_value +/// scalar element along the second dimension. +/// +/// Returns: +/// * `OutputList` sparse_indices +/// * `OutputList` sparse_values +/// * `OutputList` sparse_shapes +/// * `OutputList` dense_values +class ParseExample { + public: + ParseExample(const ::tensorflow::Scope& scope, ::tensorflow::Input serialized, + ::tensorflow::Input names, ::tensorflow::InputList sparse_keys, + ::tensorflow::InputList dense_keys, ::tensorflow::InputList + dense_defaults, const DataTypeSlice& sparse_types, const + gtl::ArraySlice& dense_shapes); + + Operation operation; + ::tensorflow::OutputList sparse_indices; + ::tensorflow::OutputList sparse_values; + ::tensorflow::OutputList sparse_shapes; + ::tensorflow::OutputList dense_values; +}; + +/// Transforms a vector of tf.Example protos (as strings) into typed tensors. +/// +/// Args: +/// * scope: A Scope object +/// * serialized: A scalar or vector containing binary serialized Example protos. +/// * names: A tensor containing the names of the serialized protos. +/// Corresponds 1:1 with the `serialized` tensor. +/// May contain, for example, table key (descriptive) names for the +/// corresponding serialized protos. These are purely useful for debugging +/// purposes, and the presence of values here has no effect on the output. +/// May also be an empty vector if no names are available. +/// If non-empty, this tensor must have the same shape as "serialized". +/// * sparse_keys: Vector of strings. +/// The keys expected in the Examples' features associated with sparse values. +/// * dense_keys: Vector of strings. +/// The keys expected in the Examples' features associated with dense values. +/// * ragged_keys: Vector of strings. +/// The keys expected in the Examples' features associated with ragged values. +/// * dense_defaults: A list of Tensors (some may be empty). Corresponds 1:1 with `dense_keys`. +/// dense_defaults[j] provides default values +/// when the example's feature_map lacks dense_key[j]. If an empty Tensor is +/// provided for dense_defaults[j], then the Feature dense_keys[j] is required. +/// The input type is inferred from dense_defaults[j], even when it's empty. +/// If dense_defaults[j] is not empty, and dense_shapes[j] is fully defined, +/// then the shape of dense_defaults[j] must match that of dense_shapes[j]. +/// If dense_shapes[j] has an undefined major dimension (variable strides dense +/// feature), dense_defaults[j] must contain a single element: +/// the padding element. +/// * num_sparse: The number of sparse keys. +/// * sparse_types: A list of `num_sparse` types; the data types of data in each Feature +/// given in sparse_keys. +/// Currently the ParseExample supports DT_FLOAT (FloatList), +/// DT_INT64 (Int64List), and DT_STRING (BytesList). +/// * ragged_value_types: A list of `num_ragged` types; the data types of data in each Feature +/// given in ragged_keys (where `num_ragged = sparse_keys.size()`). +/// Currently the ParseExample supports DT_FLOAT (FloatList), +/// DT_INT64 (Int64List), and DT_STRING (BytesList). +/// * ragged_split_types: A list of `num_ragged` types; the data types of row_splits in each Feature +/// given in ragged_keys (where `num_ragged = sparse_keys.size()`). +/// May be DT_INT32 or DT_INT64. +/// * dense_shapes: A list of `num_dense` shapes; the shapes of data in each Feature +/// given in dense_keys (where `num_dense = dense_keys.size()`). +/// The number of elements in the Feature corresponding to dense_key[j] +/// must always equal dense_shapes[j].NumEntries(). +/// If dense_shapes[j] == (D0, D1, ..., DN) then the shape of output +/// Tensor dense_values[j] will be (|serialized|, D0, D1, ..., DN): +/// The dense outputs are just the inputs row-stacked by batch. +/// This works for dense_shapes[j] = (-1, D1, ..., DN). In this case +/// the shape of the output Tensor dense_values[j] will be +/// (|serialized|, M, D1, .., DN), where M is the maximum number of blocks +/// of elements of length D1 * .... * DN, across all minibatch entries +/// in the input. Any minibatch entry with less than M blocks of elements of +/// length D1 * ... * DN will be padded with the corresponding default_value +/// scalar element along the second dimension. +/// +/// Returns: +/// * `OutputList` sparse_indices +/// * `OutputList` sparse_values +/// * `OutputList` sparse_shapes +/// * `OutputList` dense_values +/// * `OutputList` ragged_values +/// * `OutputList` ragged_row_splits +class ParseExampleV2 { + public: + ParseExampleV2(const ::tensorflow::Scope& scope, ::tensorflow::Input + serialized, ::tensorflow::Input names, ::tensorflow::Input + sparse_keys, ::tensorflow::Input dense_keys, ::tensorflow::Input + ragged_keys, ::tensorflow::InputList dense_defaults, int64 + num_sparse, const DataTypeSlice& sparse_types, const + DataTypeSlice& ragged_value_types, const DataTypeSlice& + ragged_split_types, const gtl::ArraySlice& + dense_shapes); + + Operation operation; + ::tensorflow::OutputList sparse_indices; + ::tensorflow::OutputList sparse_values; + ::tensorflow::OutputList sparse_shapes; + ::tensorflow::OutputList dense_values; + ::tensorflow::OutputList ragged_values; + ::tensorflow::OutputList ragged_row_splits; +}; + +/// Transforms a vector of brain.SequenceExample protos (as strings) into typed tensors. +/// +/// Args: +/// * scope: A Scope object +/// * serialized: A vector containing binary serialized SequenceExample protos. +/// * debug_name: A vector containing the names of the serialized protos. +/// May contain, for example, table key (descriptive) name for the +/// corresponding serialized proto. This is purely useful for debugging +/// purposes, and the presence of values here has no effect on the output. +/// May also be an empty vector if no name is available. +/// * context_dense_defaults: A list of Ncontext_dense Tensors (some may be empty). +/// context_dense_defaults[j] provides default values +/// when the SequenceExample's context map lacks context_dense_key[j]. +/// If an empty Tensor is provided for context_dense_defaults[j], +/// then the Feature context_dense_keys[j] is required. +/// The input type is inferred from context_dense_defaults[j], even when it's +/// empty. If context_dense_defaults[j] is not empty, its shape must match +/// context_dense_shapes[j]. +/// * feature_list_dense_missing_assumed_empty: A vector listing the +/// FeatureList keys which may be missing from the SequenceExamples. If the +/// associated FeatureList is missing, it is treated as empty. By default, +/// any FeatureList not listed in this vector must exist in the SequenceExamples. +/// * context_sparse_keys: A list of Ncontext_sparse string Tensors (scalars). +/// The keys expected in the Examples' features associated with context_sparse +/// values. +/// * context_dense_keys: A list of Ncontext_dense string Tensors (scalars). +/// The keys expected in the SequenceExamples' context features associated with +/// dense values. +/// * feature_list_sparse_keys: A list of Nfeature_list_sparse string Tensors +/// (scalars). The keys expected in the FeatureLists associated with sparse +/// values. +/// * feature_list_dense_keys: A list of Nfeature_list_dense string Tensors (scalars). +/// The keys expected in the SequenceExamples' feature_lists associated +/// with lists of dense values. +/// +/// Optional attributes (see `Attrs`): +/// * context_sparse_types: A list of Ncontext_sparse types; the data types of data in +/// each context Feature given in context_sparse_keys. +/// Currently the ParseSingleSequenceExample supports DT_FLOAT (FloatList), +/// DT_INT64 (Int64List), and DT_STRING (BytesList). +/// * context_dense_shapes: A list of Ncontext_dense shapes; the shapes of data in +/// each context Feature given in context_dense_keys. +/// The number of elements in the Feature corresponding to context_dense_key[j] +/// must always equal context_dense_shapes[j].NumEntries(). +/// The shape of context_dense_values[j] will match context_dense_shapes[j]. +/// * feature_list_sparse_types: A list of Nfeature_list_sparse types; the data types +/// of data in each FeatureList given in feature_list_sparse_keys. +/// Currently the ParseSingleSequenceExample supports DT_FLOAT (FloatList), +/// DT_INT64 (Int64List), and DT_STRING (BytesList). +/// * feature_list_dense_shapes: A list of Nfeature_list_dense shapes; the shapes of +/// data in each FeatureList given in feature_list_dense_keys. +/// The shape of each Feature in the FeatureList corresponding to +/// feature_list_dense_key[j] must always equal +/// feature_list_dense_shapes[j].NumEntries(). +/// +/// Returns: +/// * `OutputList` context_sparse_indices +/// * `OutputList` context_sparse_values +/// * `OutputList` context_sparse_shapes +/// * `OutputList` context_dense_values +/// * `OutputList` feature_list_sparse_indices +/// * `OutputList` feature_list_sparse_values +/// * `OutputList` feature_list_sparse_shapes +/// * `OutputList` feature_list_dense_values +/// * `OutputList` feature_list_dense_lengths +class ParseSequenceExample { + public: + /// Optional attribute setters for ParseSequenceExample + struct Attrs { + /// Defaults to 0 + TF_MUST_USE_RESULT Attrs NcontextSparse(int64 x) { + Attrs ret = *this; + ret.Ncontext_sparse_ = x; + return ret; + } + + /// Defaults to 0 + TF_MUST_USE_RESULT Attrs NcontextDense(int64 x) { + Attrs ret = *this; + ret.Ncontext_dense_ = x; + return ret; + } + + /// Defaults to 0 + TF_MUST_USE_RESULT Attrs NfeatureListSparse(int64 x) { + Attrs ret = *this; + ret.Nfeature_list_sparse_ = x; + return ret; + } + + /// Defaults to 0 + TF_MUST_USE_RESULT Attrs NfeatureListDense(int64 x) { + Attrs ret = *this; + ret.Nfeature_list_dense_ = x; + return ret; + } + + /// A list of Ncontext_sparse types; the data types of data in + /// each context Feature given in context_sparse_keys. + /// Currently the ParseSingleSequenceExample supports DT_FLOAT (FloatList), + /// DT_INT64 (Int64List), and DT_STRING (BytesList). + /// + /// Defaults to [] + TF_MUST_USE_RESULT Attrs ContextSparseTypes(const DataTypeSlice& x) { + Attrs ret = *this; + ret.context_sparse_types_ = x; + return ret; + } + + /// Defaults to [] + TF_MUST_USE_RESULT Attrs FeatureListDenseTypes(const DataTypeSlice& x) { + Attrs ret = *this; + ret.feature_list_dense_types_ = x; + return ret; + } + + /// A list of Ncontext_dense shapes; the shapes of data in + /// each context Feature given in context_dense_keys. + /// The number of elements in the Feature corresponding to context_dense_key[j] + /// must always equal context_dense_shapes[j].NumEntries(). + /// The shape of context_dense_values[j] will match context_dense_shapes[j]. + /// + /// Defaults to [] + TF_MUST_USE_RESULT Attrs ContextDenseShapes(const gtl::ArraySlice& x) { + Attrs ret = *this; + ret.context_dense_shapes_ = x; + return ret; + } + + /// A list of Nfeature_list_sparse types; the data types + /// of data in each FeatureList given in feature_list_sparse_keys. + /// Currently the ParseSingleSequenceExample supports DT_FLOAT (FloatList), + /// DT_INT64 (Int64List), and DT_STRING (BytesList). + /// + /// Defaults to [] + TF_MUST_USE_RESULT Attrs FeatureListSparseTypes(const DataTypeSlice& x) { + Attrs ret = *this; + ret.feature_list_sparse_types_ = x; + return ret; + } + + /// A list of Nfeature_list_dense shapes; the shapes of + /// data in each FeatureList given in feature_list_dense_keys. + /// The shape of each Feature in the FeatureList corresponding to + /// feature_list_dense_key[j] must always equal + /// feature_list_dense_shapes[j].NumEntries(). + /// + /// Defaults to [] + TF_MUST_USE_RESULT Attrs FeatureListDenseShapes(const gtl::ArraySlice& x) { + Attrs ret = *this; + ret.feature_list_dense_shapes_ = x; + return ret; + } + + int64 Ncontext_sparse_ = 0; + int64 Ncontext_dense_ = 0; + int64 Nfeature_list_sparse_ = 0; + int64 Nfeature_list_dense_ = 0; + DataTypeSlice context_sparse_types_ = {}; + DataTypeSlice feature_list_dense_types_ = {}; + gtl::ArraySlice context_dense_shapes_ = {}; + DataTypeSlice feature_list_sparse_types_ = {}; + gtl::ArraySlice feature_list_dense_shapes_ = {}; + }; + ParseSequenceExample(const ::tensorflow::Scope& scope, ::tensorflow::Input + serialized, ::tensorflow::Input debug_name, + ::tensorflow::InputList context_dense_defaults, const + gtl::ArraySlice<::tensorflow::tstring>& + feature_list_dense_missing_assumed_empty, const + gtl::ArraySlice<::tensorflow::tstring>& + context_sparse_keys, const + gtl::ArraySlice<::tensorflow::tstring>& + context_dense_keys, const + gtl::ArraySlice<::tensorflow::tstring>& + feature_list_sparse_keys, const + gtl::ArraySlice<::tensorflow::tstring>& + feature_list_dense_keys); + ParseSequenceExample(const ::tensorflow::Scope& scope, ::tensorflow::Input + serialized, ::tensorflow::Input debug_name, + ::tensorflow::InputList context_dense_defaults, const + gtl::ArraySlice<::tensorflow::tstring>& + feature_list_dense_missing_assumed_empty, const + gtl::ArraySlice<::tensorflow::tstring>& + context_sparse_keys, const + gtl::ArraySlice<::tensorflow::tstring>& + context_dense_keys, const + gtl::ArraySlice<::tensorflow::tstring>& + feature_list_sparse_keys, const + gtl::ArraySlice<::tensorflow::tstring>& + feature_list_dense_keys, const + ParseSequenceExample::Attrs& attrs); + + static Attrs NcontextSparse(int64 x) { + return Attrs().NcontextSparse(x); + } + static Attrs NcontextDense(int64 x) { + return Attrs().NcontextDense(x); + } + static Attrs NfeatureListSparse(int64 x) { + return Attrs().NfeatureListSparse(x); + } + static Attrs NfeatureListDense(int64 x) { + return Attrs().NfeatureListDense(x); + } + static Attrs ContextSparseTypes(const DataTypeSlice& x) { + return Attrs().ContextSparseTypes(x); + } + static Attrs FeatureListDenseTypes(const DataTypeSlice& x) { + return Attrs().FeatureListDenseTypes(x); + } + static Attrs ContextDenseShapes(const gtl::ArraySlice& x) { + return Attrs().ContextDenseShapes(x); + } + static Attrs FeatureListSparseTypes(const DataTypeSlice& x) { + return Attrs().FeatureListSparseTypes(x); + } + static Attrs FeatureListDenseShapes(const gtl::ArraySlice& x) { + return Attrs().FeatureListDenseShapes(x); + } + + Operation operation; + ::tensorflow::OutputList context_sparse_indices; + ::tensorflow::OutputList context_sparse_values; + ::tensorflow::OutputList context_sparse_shapes; + ::tensorflow::OutputList context_dense_values; + ::tensorflow::OutputList feature_list_sparse_indices; + ::tensorflow::OutputList feature_list_sparse_values; + ::tensorflow::OutputList feature_list_sparse_shapes; + ::tensorflow::OutputList feature_list_dense_values; + ::tensorflow::OutputList feature_list_dense_lengths; +}; + +/// Transforms a vector of tf.io.SequenceExample protos (as strings) into +/// typed tensors. +/// +/// Args: +/// * scope: A Scope object +/// * serialized: A scalar or vector containing binary serialized SequenceExample protos. +/// * debug_name: A scalar or vector containing the names of the serialized protos. +/// May contain, for example, table key (descriptive) name for the +/// corresponding serialized proto. This is purely useful for debugging +/// purposes, and the presence of values here has no effect on the output. +/// May also be an empty vector if no name is available. +/// * context_sparse_keys: The keys expected in the Examples' features associated with context_sparse +/// values. +/// * context_dense_keys: The keys expected in the SequenceExamples' context features associated with +/// dense values. +/// * context_ragged_keys: The keys expected in the Examples' features associated with context_ragged +/// values. +/// * feature_list_sparse_keys: The keys expected in the FeatureLists associated with sparse values. +/// * feature_list_dense_keys: The keys expected in the SequenceExamples' feature_lists associated +/// with lists of dense values. +/// * feature_list_ragged_keys: The keys expected in the FeatureLists associated with ragged values. +/// * feature_list_dense_missing_assumed_empty: A vector corresponding 1:1 with feature_list_dense_keys, indicating which +/// features may be missing from the SequenceExamples. If the associated +/// FeatureList is missing, it is treated as empty. +/// * context_dense_defaults: A list of Ncontext_dense Tensors (some may be empty). +/// context_dense_defaults[j] provides default values +/// when the SequenceExample's context map lacks context_dense_key[j]. +/// If an empty Tensor is provided for context_dense_defaults[j], +/// then the Feature context_dense_keys[j] is required. +/// The input type is inferred from context_dense_defaults[j], even when it's +/// empty. If context_dense_defaults[j] is not empty, its shape must match +/// context_dense_shapes[j]. +/// +/// Optional attributes (see `Attrs`): +/// * context_sparse_types: A list of Ncontext_sparse types; the data types of data in +/// each context Feature given in context_sparse_keys. +/// Currently the ParseSingleSequenceExample supports DT_FLOAT (FloatList), +/// DT_INT64 (Int64List), and DT_STRING (BytesList). +/// * context_ragged_value_types: RaggedTensor.value dtypes for the ragged context features. +/// * context_ragged_split_types: RaggedTensor.row_split dtypes for the ragged context features. +/// * context_dense_shapes: A list of Ncontext_dense shapes; the shapes of data in +/// each context Feature given in context_dense_keys. +/// The number of elements in the Feature corresponding to context_dense_key[j] +/// must always equal context_dense_shapes[j].NumEntries(). +/// The shape of context_dense_values[j] will match context_dense_shapes[j]. +/// * feature_list_sparse_types: A list of Nfeature_list_sparse types; the data types +/// of data in each FeatureList given in feature_list_sparse_keys. +/// Currently the ParseSingleSequenceExample supports DT_FLOAT (FloatList), +/// DT_INT64 (Int64List), and DT_STRING (BytesList). +/// * feature_list_ragged_value_types: RaggedTensor.value dtypes for the ragged FeatureList features. +/// * feature_list_ragged_split_types: RaggedTensor.row_split dtypes for the ragged FeatureList features. +/// * feature_list_dense_shapes: A list of Nfeature_list_dense shapes; the shapes of +/// data in each FeatureList given in feature_list_dense_keys. +/// The shape of each Feature in the FeatureList corresponding to +/// feature_list_dense_key[j] must always equal +/// feature_list_dense_shapes[j].NumEntries(). +/// +/// Returns: +/// * `OutputList` context_sparse_indices +/// * `OutputList` context_sparse_values +/// * `OutputList` context_sparse_shapes +/// * `OutputList` context_dense_values +/// * `OutputList` context_ragged_values +/// * `OutputList` context_ragged_row_splits +/// * `OutputList` feature_list_sparse_indices +/// * `OutputList` feature_list_sparse_values +/// * `OutputList` feature_list_sparse_shapes +/// * `OutputList` feature_list_dense_values +/// * `OutputList` feature_list_dense_lengths +/// * `OutputList` feature_list_ragged_values +/// * `OutputList` feature_list_ragged_outer_splits +/// * `OutputList` feature_list_ragged_inner_splits +class ParseSequenceExampleV2 { + public: + /// Optional attribute setters for ParseSequenceExampleV2 + struct Attrs { + /// Defaults to 0 + TF_MUST_USE_RESULT Attrs NcontextSparse(int64 x) { + Attrs ret = *this; + ret.Ncontext_sparse_ = x; + return ret; + } + + /// A list of Ncontext_sparse types; the data types of data in + /// each context Feature given in context_sparse_keys. + /// Currently the ParseSingleSequenceExample supports DT_FLOAT (FloatList), + /// DT_INT64 (Int64List), and DT_STRING (BytesList). + /// + /// Defaults to [] + TF_MUST_USE_RESULT Attrs ContextSparseTypes(const DataTypeSlice& x) { + Attrs ret = *this; + ret.context_sparse_types_ = x; + return ret; + } + + /// RaggedTensor.value dtypes for the ragged context features. + /// + /// Defaults to [] + TF_MUST_USE_RESULT Attrs ContextRaggedValueTypes(const DataTypeSlice& x) { + Attrs ret = *this; + ret.context_ragged_value_types_ = x; + return ret; + } + + /// RaggedTensor.row_split dtypes for the ragged context features. + /// + /// Defaults to [] + TF_MUST_USE_RESULT Attrs ContextRaggedSplitTypes(const DataTypeSlice& x) { + Attrs ret = *this; + ret.context_ragged_split_types_ = x; + return ret; + } + + /// A list of Ncontext_dense shapes; the shapes of data in + /// each context Feature given in context_dense_keys. + /// The number of elements in the Feature corresponding to context_dense_key[j] + /// must always equal context_dense_shapes[j].NumEntries(). + /// The shape of context_dense_values[j] will match context_dense_shapes[j]. + /// + /// Defaults to [] + TF_MUST_USE_RESULT Attrs ContextDenseShapes(const gtl::ArraySlice& x) { + Attrs ret = *this; + ret.context_dense_shapes_ = x; + return ret; + } + + /// Defaults to 0 + TF_MUST_USE_RESULT Attrs NfeatureListSparse(int64 x) { + Attrs ret = *this; + ret.Nfeature_list_sparse_ = x; + return ret; + } + + /// Defaults to 0 + TF_MUST_USE_RESULT Attrs NfeatureListDense(int64 x) { + Attrs ret = *this; + ret.Nfeature_list_dense_ = x; + return ret; + } + + /// Defaults to [] + TF_MUST_USE_RESULT Attrs FeatureListDenseTypes(const DataTypeSlice& x) { + Attrs ret = *this; + ret.feature_list_dense_types_ = x; + return ret; + } + + /// A list of Nfeature_list_sparse types; the data types + /// of data in each FeatureList given in feature_list_sparse_keys. + /// Currently the ParseSingleSequenceExample supports DT_FLOAT (FloatList), + /// DT_INT64 (Int64List), and DT_STRING (BytesList). + /// + /// Defaults to [] + TF_MUST_USE_RESULT Attrs FeatureListSparseTypes(const DataTypeSlice& x) { + Attrs ret = *this; + ret.feature_list_sparse_types_ = x; + return ret; + } + + /// RaggedTensor.value dtypes for the ragged FeatureList features. + /// + /// Defaults to [] + TF_MUST_USE_RESULT Attrs FeatureListRaggedValueTypes(const DataTypeSlice& x) { + Attrs ret = *this; + ret.feature_list_ragged_value_types_ = x; + return ret; + } + + /// RaggedTensor.row_split dtypes for the ragged FeatureList features. + /// + /// Defaults to [] + TF_MUST_USE_RESULT Attrs FeatureListRaggedSplitTypes(const DataTypeSlice& x) { + Attrs ret = *this; + ret.feature_list_ragged_split_types_ = x; + return ret; + } + + /// A list of Nfeature_list_dense shapes; the shapes of + /// data in each FeatureList given in feature_list_dense_keys. + /// The shape of each Feature in the FeatureList corresponding to + /// feature_list_dense_key[j] must always equal + /// feature_list_dense_shapes[j].NumEntries(). + /// + /// Defaults to [] + TF_MUST_USE_RESULT Attrs FeatureListDenseShapes(const gtl::ArraySlice& x) { + Attrs ret = *this; + ret.feature_list_dense_shapes_ = x; + return ret; + } + + int64 Ncontext_sparse_ = 0; + DataTypeSlice context_sparse_types_ = {}; + DataTypeSlice context_ragged_value_types_ = {}; + DataTypeSlice context_ragged_split_types_ = {}; + gtl::ArraySlice context_dense_shapes_ = {}; + int64 Nfeature_list_sparse_ = 0; + int64 Nfeature_list_dense_ = 0; + DataTypeSlice feature_list_dense_types_ = {}; + DataTypeSlice feature_list_sparse_types_ = {}; + DataTypeSlice feature_list_ragged_value_types_ = {}; + DataTypeSlice feature_list_ragged_split_types_ = {}; + gtl::ArraySlice feature_list_dense_shapes_ = {}; + }; + ParseSequenceExampleV2(const ::tensorflow::Scope& scope, ::tensorflow::Input + serialized, ::tensorflow::Input debug_name, + ::tensorflow::Input context_sparse_keys, + ::tensorflow::Input context_dense_keys, + ::tensorflow::Input context_ragged_keys, + ::tensorflow::Input feature_list_sparse_keys, + ::tensorflow::Input feature_list_dense_keys, + ::tensorflow::Input feature_list_ragged_keys, + ::tensorflow::Input + feature_list_dense_missing_assumed_empty, + ::tensorflow::InputList context_dense_defaults); + ParseSequenceExampleV2(const ::tensorflow::Scope& scope, ::tensorflow::Input + serialized, ::tensorflow::Input debug_name, + ::tensorflow::Input context_sparse_keys, + ::tensorflow::Input context_dense_keys, + ::tensorflow::Input context_ragged_keys, + ::tensorflow::Input feature_list_sparse_keys, + ::tensorflow::Input feature_list_dense_keys, + ::tensorflow::Input feature_list_ragged_keys, + ::tensorflow::Input + feature_list_dense_missing_assumed_empty, + ::tensorflow::InputList context_dense_defaults, const + ParseSequenceExampleV2::Attrs& attrs); + + static Attrs NcontextSparse(int64 x) { + return Attrs().NcontextSparse(x); + } + static Attrs ContextSparseTypes(const DataTypeSlice& x) { + return Attrs().ContextSparseTypes(x); + } + static Attrs ContextRaggedValueTypes(const DataTypeSlice& x) { + return Attrs().ContextRaggedValueTypes(x); + } + static Attrs ContextRaggedSplitTypes(const DataTypeSlice& x) { + return Attrs().ContextRaggedSplitTypes(x); + } + static Attrs ContextDenseShapes(const gtl::ArraySlice& x) { + return Attrs().ContextDenseShapes(x); + } + static Attrs NfeatureListSparse(int64 x) { + return Attrs().NfeatureListSparse(x); + } + static Attrs NfeatureListDense(int64 x) { + return Attrs().NfeatureListDense(x); + } + static Attrs FeatureListDenseTypes(const DataTypeSlice& x) { + return Attrs().FeatureListDenseTypes(x); + } + static Attrs FeatureListSparseTypes(const DataTypeSlice& x) { + return Attrs().FeatureListSparseTypes(x); + } + static Attrs FeatureListRaggedValueTypes(const DataTypeSlice& x) { + return Attrs().FeatureListRaggedValueTypes(x); + } + static Attrs FeatureListRaggedSplitTypes(const DataTypeSlice& x) { + return Attrs().FeatureListRaggedSplitTypes(x); + } + static Attrs FeatureListDenseShapes(const gtl::ArraySlice& x) { + return Attrs().FeatureListDenseShapes(x); + } + + Operation operation; + ::tensorflow::OutputList context_sparse_indices; + ::tensorflow::OutputList context_sparse_values; + ::tensorflow::OutputList context_sparse_shapes; + ::tensorflow::OutputList context_dense_values; + ::tensorflow::OutputList context_ragged_values; + ::tensorflow::OutputList context_ragged_row_splits; + ::tensorflow::OutputList feature_list_sparse_indices; + ::tensorflow::OutputList feature_list_sparse_values; + ::tensorflow::OutputList feature_list_sparse_shapes; + ::tensorflow::OutputList feature_list_dense_values; + ::tensorflow::OutputList feature_list_dense_lengths; + ::tensorflow::OutputList feature_list_ragged_values; + ::tensorflow::OutputList feature_list_ragged_outer_splits; + ::tensorflow::OutputList feature_list_ragged_inner_splits; +}; + +/// Transforms a tf.Example proto (as a string) into typed tensors. +/// +/// Args: +/// * scope: A Scope object +/// * serialized: A vector containing a batch of binary serialized Example protos. +/// * dense_defaults: A list of Tensors (some may be empty), whose length matches +/// the length of `dense_keys`. dense_defaults[j] provides default values +/// when the example's feature_map lacks dense_key[j]. If an empty Tensor is +/// provided for dense_defaults[j], then the Feature dense_keys[j] is required. +/// The input type is inferred from dense_defaults[j], even when it's empty. +/// If dense_defaults[j] is not empty, and dense_shapes[j] is fully defined, +/// then the shape of dense_defaults[j] must match that of dense_shapes[j]. +/// If dense_shapes[j] has an undefined major dimension (variable strides dense +/// feature), dense_defaults[j] must contain a single element: +/// the padding element. +/// * num_sparse: The number of sparse features to be parsed from the example. This +/// must match the lengths of `sparse_keys` and `sparse_types`. +/// * sparse_keys: A list of `num_sparse` strings. +/// The keys expected in the Examples' features associated with sparse values. +/// * dense_keys: The keys expected in the Examples' features associated with dense +/// values. +/// * sparse_types: A list of `num_sparse` types; the data types of data in each +/// Feature given in sparse_keys. +/// Currently the ParseSingleExample op supports DT_FLOAT (FloatList), +/// DT_INT64 (Int64List), and DT_STRING (BytesList). +/// * dense_shapes: The shapes of data in each Feature given in dense_keys. +/// The length of this list must match the length of `dense_keys`. The +/// number of elements in the Feature corresponding to dense_key[j] must +/// always equal dense_shapes[j].NumEntries(). If dense_shapes[j] == +/// (D0, D1, ..., DN) then the shape of output Tensor dense_values[j] +/// will be (D0, D1, ..., DN): In the case dense_shapes[j] = (-1, D1, +/// ..., DN), the shape of the output Tensor dense_values[j] will be (M, +/// D1, .., DN), where M is the number of blocks of elements of length +/// D1 * .... * DN, in the input. +/// +/// Returns: +/// * `OutputList` sparse_indices +/// * `OutputList` sparse_values +/// * `OutputList` sparse_shapes +/// * `OutputList` dense_values +class ParseSingleExample { + public: + ParseSingleExample(const ::tensorflow::Scope& scope, ::tensorflow::Input + serialized, ::tensorflow::InputList dense_defaults, int64 + num_sparse, const gtl::ArraySlice<::tensorflow::tstring>& + sparse_keys, const gtl::ArraySlice<::tensorflow::tstring>& + dense_keys, const DataTypeSlice& sparse_types, const + gtl::ArraySlice& dense_shapes); + + Operation operation; + ::tensorflow::OutputList sparse_indices; + ::tensorflow::OutputList sparse_values; + ::tensorflow::OutputList sparse_shapes; + ::tensorflow::OutputList dense_values; +}; + +/// Transforms a scalar brain.SequenceExample proto (as strings) into typed tensors. +/// +/// Args: +/// * scope: A Scope object +/// * serialized: A scalar containing a binary serialized SequenceExample proto. +/// * feature_list_dense_missing_assumed_empty: A vector listing the +/// FeatureList keys which may be missing from the SequenceExample. If the +/// associated FeatureList is missing, it is treated as empty. By default, +/// any FeatureList not listed in this vector must exist in the SequenceExample. +/// * context_sparse_keys: A list of Ncontext_sparse string Tensors (scalars). +/// The keys expected in the Examples' features associated with context_sparse +/// values. +/// * context_dense_keys: A list of Ncontext_dense string Tensors (scalars). +/// The keys expected in the SequenceExamples' context features associated with +/// dense values. +/// * feature_list_sparse_keys: A list of Nfeature_list_sparse string Tensors +/// (scalars). The keys expected in the FeatureLists associated with sparse +/// values. +/// * feature_list_dense_keys: A list of Nfeature_list_dense string Tensors (scalars). +/// The keys expected in the SequenceExamples' feature_lists associated +/// with lists of dense values. +/// * context_dense_defaults: A list of Ncontext_dense Tensors (some may be empty). +/// context_dense_defaults[j] provides default values +/// when the SequenceExample's context map lacks context_dense_key[j]. +/// If an empty Tensor is provided for context_dense_defaults[j], +/// then the Feature context_dense_keys[j] is required. +/// The input type is inferred from context_dense_defaults[j], even when it's +/// empty. If context_dense_defaults[j] is not empty, its shape must match +/// context_dense_shapes[j]. +/// * debug_name: A scalar containing the name of the serialized proto. +/// May contain, for example, table key (descriptive) name for the +/// corresponding serialized proto. This is purely useful for debugging +/// purposes, and the presence of values here has no effect on the output. +/// May also be an empty scalar if no name is available. +/// +/// Optional attributes (see `Attrs`): +/// * context_sparse_types: A list of Ncontext_sparse types; the data types of data in +/// each context Feature given in context_sparse_keys. +/// Currently the ParseSingleSequenceExample supports DT_FLOAT (FloatList), +/// DT_INT64 (Int64List), and DT_STRING (BytesList). +/// * context_dense_shapes: A list of Ncontext_dense shapes; the shapes of data in +/// each context Feature given in context_dense_keys. +/// The number of elements in the Feature corresponding to context_dense_key[j] +/// must always equal context_dense_shapes[j].NumEntries(). +/// The shape of context_dense_values[j] will match context_dense_shapes[j]. +/// * feature_list_sparse_types: A list of Nfeature_list_sparse types; the data types +/// of data in each FeatureList given in feature_list_sparse_keys. +/// Currently the ParseSingleSequenceExample supports DT_FLOAT (FloatList), +/// DT_INT64 (Int64List), and DT_STRING (BytesList). +/// * feature_list_dense_shapes: A list of Nfeature_list_dense shapes; the shapes of +/// data in each FeatureList given in feature_list_dense_keys. +/// The shape of each Feature in the FeatureList corresponding to +/// feature_list_dense_key[j] must always equal +/// feature_list_dense_shapes[j].NumEntries(). +/// +/// Returns: +/// * `OutputList` context_sparse_indices +/// * `OutputList` context_sparse_values +/// * `OutputList` context_sparse_shapes +/// * `OutputList` context_dense_values +/// * `OutputList` feature_list_sparse_indices +/// * `OutputList` feature_list_sparse_values +/// * `OutputList` feature_list_sparse_shapes +/// * `OutputList` feature_list_dense_values +class ParseSingleSequenceExample { + public: + /// Optional attribute setters for ParseSingleSequenceExample + struct Attrs { + /// A list of Ncontext_sparse types; the data types of data in + /// each context Feature given in context_sparse_keys. + /// Currently the ParseSingleSequenceExample supports DT_FLOAT (FloatList), + /// DT_INT64 (Int64List), and DT_STRING (BytesList). + /// + /// Defaults to [] + TF_MUST_USE_RESULT Attrs ContextSparseTypes(const DataTypeSlice& x) { + Attrs ret = *this; + ret.context_sparse_types_ = x; + return ret; + } + + /// Defaults to [] + TF_MUST_USE_RESULT Attrs FeatureListDenseTypes(const DataTypeSlice& x) { + Attrs ret = *this; + ret.feature_list_dense_types_ = x; + return ret; + } + + /// A list of Ncontext_dense shapes; the shapes of data in + /// each context Feature given in context_dense_keys. + /// The number of elements in the Feature corresponding to context_dense_key[j] + /// must always equal context_dense_shapes[j].NumEntries(). + /// The shape of context_dense_values[j] will match context_dense_shapes[j]. + /// + /// Defaults to [] + TF_MUST_USE_RESULT Attrs ContextDenseShapes(const gtl::ArraySlice& x) { + Attrs ret = *this; + ret.context_dense_shapes_ = x; + return ret; + } + + /// A list of Nfeature_list_sparse types; the data types + /// of data in each FeatureList given in feature_list_sparse_keys. + /// Currently the ParseSingleSequenceExample supports DT_FLOAT (FloatList), + /// DT_INT64 (Int64List), and DT_STRING (BytesList). + /// + /// Defaults to [] + TF_MUST_USE_RESULT Attrs FeatureListSparseTypes(const DataTypeSlice& x) { + Attrs ret = *this; + ret.feature_list_sparse_types_ = x; + return ret; + } + + /// A list of Nfeature_list_dense shapes; the shapes of + /// data in each FeatureList given in feature_list_dense_keys. + /// The shape of each Feature in the FeatureList corresponding to + /// feature_list_dense_key[j] must always equal + /// feature_list_dense_shapes[j].NumEntries(). + /// + /// Defaults to [] + TF_MUST_USE_RESULT Attrs FeatureListDenseShapes(const gtl::ArraySlice& x) { + Attrs ret = *this; + ret.feature_list_dense_shapes_ = x; + return ret; + } + + DataTypeSlice context_sparse_types_ = {}; + DataTypeSlice feature_list_dense_types_ = {}; + gtl::ArraySlice context_dense_shapes_ = {}; + DataTypeSlice feature_list_sparse_types_ = {}; + gtl::ArraySlice feature_list_dense_shapes_ = {}; + }; + ParseSingleSequenceExample(const ::tensorflow::Scope& scope, + ::tensorflow::Input serialized, ::tensorflow::Input + feature_list_dense_missing_assumed_empty, + ::tensorflow::InputList context_sparse_keys, + ::tensorflow::InputList context_dense_keys, + ::tensorflow::InputList feature_list_sparse_keys, + ::tensorflow::InputList feature_list_dense_keys, + ::tensorflow::InputList context_dense_defaults, + ::tensorflow::Input debug_name); + ParseSingleSequenceExample(const ::tensorflow::Scope& scope, + ::tensorflow::Input serialized, ::tensorflow::Input + feature_list_dense_missing_assumed_empty, + ::tensorflow::InputList context_sparse_keys, + ::tensorflow::InputList context_dense_keys, + ::tensorflow::InputList feature_list_sparse_keys, + ::tensorflow::InputList feature_list_dense_keys, + ::tensorflow::InputList context_dense_defaults, + ::tensorflow::Input debug_name, const + ParseSingleSequenceExample::Attrs& attrs); + + static Attrs ContextSparseTypes(const DataTypeSlice& x) { + return Attrs().ContextSparseTypes(x); + } + static Attrs FeatureListDenseTypes(const DataTypeSlice& x) { + return Attrs().FeatureListDenseTypes(x); + } + static Attrs ContextDenseShapes(const gtl::ArraySlice& x) { + return Attrs().ContextDenseShapes(x); + } + static Attrs FeatureListSparseTypes(const DataTypeSlice& x) { + return Attrs().FeatureListSparseTypes(x); + } + static Attrs FeatureListDenseShapes(const gtl::ArraySlice& x) { + return Attrs().FeatureListDenseShapes(x); + } + + Operation operation; + ::tensorflow::OutputList context_sparse_indices; + ::tensorflow::OutputList context_sparse_values; + ::tensorflow::OutputList context_sparse_shapes; + ::tensorflow::OutputList context_dense_values; + ::tensorflow::OutputList feature_list_sparse_indices; + ::tensorflow::OutputList feature_list_sparse_values; + ::tensorflow::OutputList feature_list_sparse_shapes; + ::tensorflow::OutputList feature_list_dense_values; +}; + +/// Transforms a serialized tensorflow.TensorProto proto into a Tensor. +/// +/// Args: +/// * scope: A Scope object +/// * serialized: A scalar string containing a serialized TensorProto proto. +/// * out_type: The type of the serialized tensor. The provided type must match the +/// type of the serialized tensor and no implicit conversion will take place. +/// +/// Returns: +/// * `Output`: A Tensor of type `out_type`. +class ParseTensor { + public: + ParseTensor(const ::tensorflow::Scope& scope, ::tensorflow::Input serialized, + DataType out_type); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + Operation operation; + ::tensorflow::Output output; +}; + +/// Transforms a Tensor into a serialized TensorProto proto. +/// +/// Args: +/// * scope: A Scope object +/// * tensor: A Tensor of type `T`. +/// +/// Returns: +/// * `Output`: A serialized TensorProto proto of the input tensor. +class SerializeTensor { + public: + SerializeTensor(const ::tensorflow::Scope& scope, ::tensorflow::Input tensor); + operator ::tensorflow::Output() const { return serialized; } + operator ::tensorflow::Input() const { return serialized; } + ::tensorflow::Node* node() const { return serialized.node(); } + + Operation operation; + ::tensorflow::Output serialized; +}; + +/// Converts each string in the input Tensor to the specified numeric type. +/// +/// (Note that int32 overflow results in an error while float overflow +/// results in a rounded value.) +/// +/// Example: +/// +/// >>> strings = ["5.0", "3.0", "7.0"] +/// >>> tf.strings.to_number(strings) +/// +/// +/// +/// Args: +/// * scope: A Scope object +/// +/// Optional attributes (see `Attrs`): +/// * out_type: The numeric type to interpret each string in `string_tensor` as. +/// +/// Returns: +/// * `Output`: A Tensor of the same shape as the input `string_tensor`. +class StringToNumber { + public: + /// Optional attribute setters for StringToNumber + struct Attrs { + /// The numeric type to interpret each string in `string_tensor` as. + /// + /// Defaults to DT_FLOAT + TF_MUST_USE_RESULT Attrs OutType(DataType x) { + Attrs ret = *this; + ret.out_type_ = x; + return ret; + } + + DataType out_type_ = DT_FLOAT; + }; + StringToNumber(const ::tensorflow::Scope& scope, ::tensorflow::Input + string_tensor); + StringToNumber(const ::tensorflow::Scope& scope, ::tensorflow::Input + string_tensor, const StringToNumber::Attrs& attrs); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + static Attrs OutType(DataType x) { + return Attrs().OutType(x); + } + + Operation operation; + ::tensorflow::Output output; +}; + +/// @} + +} // namespace ops +} // namespace tensorflow + +#endif // TENSORFLOW_CC_OPS_PARSING_OPS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/ops/parsing_ops_internal.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/ops/parsing_ops_internal.h new file mode 100644 index 0000000000000000000000000000000000000000..c400b81c5464956f5513ab966b276854d4b720b9 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/ops/parsing_ops_internal.h @@ -0,0 +1,28 @@ +// This file is MACHINE GENERATED! Do not edit. + +#ifndef TENSORFLOW_CC_OPS_PARSING_OPS_INTERNAL_H_ +#define TENSORFLOW_CC_OPS_PARSING_OPS_INTERNAL_H_ + +// This file is MACHINE GENERATED! Do not edit. + +#include "tensorflow/cc/framework/ops.h" +#include "tensorflow/cc/framework/scope.h" +#include "tensorflow/core/framework/tensor.h" +#include "tensorflow/core/framework/tensor_shape.h" +#include "tensorflow/core/framework/types.h" +#include "tensorflow/core/lib/gtl/array_slice.h" + +namespace tensorflow { +namespace ops { +namespace internal { +// NOTE: This namespace has internal TensorFlow details that +// are not part of TensorFlow's public API. + +/// @defgroup parsing_ops_internal Parsing Ops Internal +/// @{ + +} // namespace internal +} // namespace ops +} // namespace tensorflow + +#endif // TENSORFLOW_CC_OPS_PARSING_OPS_INTERNAL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/ops/random_ops.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/ops/random_ops.h new file mode 100644 index 0000000000000000000000000000000000000000..b1391a9fe51b8c79d4b82c5666c6103642603490 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/ops/random_ops.h @@ -0,0 +1,663 @@ +// This file is MACHINE GENERATED! Do not edit. + +#ifndef TENSORFLOW_CC_OPS_RANDOM_OPS_H_ +#define TENSORFLOW_CC_OPS_RANDOM_OPS_H_ + +// This file is MACHINE GENERATED! Do not edit. + +#include "tensorflow/cc/framework/ops.h" +#include "tensorflow/cc/framework/scope.h" +#include "tensorflow/core/framework/tensor.h" +#include "tensorflow/core/framework/tensor_shape.h" +#include "tensorflow/core/framework/types.h" +#include "tensorflow/core/lib/gtl/array_slice.h" + +namespace tensorflow { +namespace ops { + +/// @defgroup random_ops Random Ops +/// @{ + +/// Draws samples from a multinomial distribution. +/// +/// Args: +/// * scope: A Scope object +/// * logits: 2-D Tensor with shape `[batch_size, num_classes]`. Each slice `[i, :]` +/// represents the unnormalized log probabilities for all classes. +/// * num_samples: 0-D. Number of independent samples to draw for each row slice. +/// +/// Optional attributes (see `Attrs`): +/// * seed: If either seed or seed2 is set to be non-zero, the internal random number +/// generator is seeded by the given seed. Otherwise, a random seed is used. +/// * seed2: A second seed to avoid seed collision. +/// +/// Returns: +/// * `Output`: 2-D Tensor with shape `[batch_size, num_samples]`. Each slice `[i, :]` +/// contains the drawn class labels with range `[0, num_classes)`. +class Multinomial { + public: + /// Optional attribute setters for Multinomial + struct Attrs { + /// If either seed or seed2 is set to be non-zero, the internal random number + /// generator is seeded by the given seed. Otherwise, a random seed is used. + /// + /// Defaults to 0 + TF_MUST_USE_RESULT Attrs Seed(int64 x) { + Attrs ret = *this; + ret.seed_ = x; + return ret; + } + + /// A second seed to avoid seed collision. + /// + /// Defaults to 0 + TF_MUST_USE_RESULT Attrs Seed2(int64 x) { + Attrs ret = *this; + ret.seed2_ = x; + return ret; + } + + /// Defaults to DT_INT64 + TF_MUST_USE_RESULT Attrs OutputDtype(DataType x) { + Attrs ret = *this; + ret.output_dtype_ = x; + return ret; + } + + int64 seed_ = 0; + int64 seed2_ = 0; + DataType output_dtype_ = DT_INT64; + }; + Multinomial(const ::tensorflow::Scope& scope, ::tensorflow::Input logits, + ::tensorflow::Input num_samples); + Multinomial(const ::tensorflow::Scope& scope, ::tensorflow::Input logits, + ::tensorflow::Input num_samples, const Multinomial::Attrs& attrs); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + static Attrs Seed(int64 x) { + return Attrs().Seed(x); + } + static Attrs Seed2(int64 x) { + return Attrs().Seed2(x); + } + static Attrs OutputDtype(DataType x) { + return Attrs().OutputDtype(x); + } + + Operation operation; + ::tensorflow::Output output; +}; + +/// Outputs random values from a normal distribution. The parameters may each be a +/// +/// scalar which applies to the entire output, or a vector of length shape[0] which +/// stores the parameters for each batch. +/// +/// Args: +/// * scope: A Scope object +/// * shape: The shape of the output tensor. Batches are indexed by the 0th dimension. +/// * means: The mean parameter of each batch. +/// * stdevs: The standard deviation parameter of each batch. Must be greater than 0. +/// * minvals: The minimum cutoff. May be -infinity. +/// * maxvals: The maximum cutoff. May be +infinity, and must be more than the minval +/// for each batch. +/// +/// Optional attributes (see `Attrs`): +/// * seed: If either `seed` or `seed2` are set to be non-zero, the random number +/// generator is seeded by the given seed. Otherwise, it is seeded by a +/// random seed. +/// * seed2: A second seed to avoid seed collision. +/// +/// Returns: +/// * `Output`: A matrix of shape num_batches x samples_per_batch, filled with random +/// truncated normal values using the parameters for each row. +class ParameterizedTruncatedNormal { + public: + /// Optional attribute setters for ParameterizedTruncatedNormal + struct Attrs { + /// If either `seed` or `seed2` are set to be non-zero, the random number + /// generator is seeded by the given seed. Otherwise, it is seeded by a + /// random seed. + /// + /// Defaults to 0 + TF_MUST_USE_RESULT Attrs Seed(int64 x) { + Attrs ret = *this; + ret.seed_ = x; + return ret; + } + + /// A second seed to avoid seed collision. + /// + /// Defaults to 0 + TF_MUST_USE_RESULT Attrs Seed2(int64 x) { + Attrs ret = *this; + ret.seed2_ = x; + return ret; + } + + int64 seed_ = 0; + int64 seed2_ = 0; + }; + ParameterizedTruncatedNormal(const ::tensorflow::Scope& scope, + ::tensorflow::Input shape, ::tensorflow::Input + means, ::tensorflow::Input stdevs, + ::tensorflow::Input minvals, ::tensorflow::Input + maxvals); + ParameterizedTruncatedNormal(const ::tensorflow::Scope& scope, + ::tensorflow::Input shape, ::tensorflow::Input + means, ::tensorflow::Input stdevs, + ::tensorflow::Input minvals, ::tensorflow::Input + maxvals, const + ParameterizedTruncatedNormal::Attrs& attrs); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + static Attrs Seed(int64 x) { + return Attrs().Seed(x); + } + static Attrs Seed2(int64 x) { + return Attrs().Seed2(x); + } + + Operation operation; + ::tensorflow::Output output; +}; + +/// Outputs random values from the Gamma distribution(s) described by alpha. +/// +/// This op uses the algorithm by Marsaglia et al. to acquire samples via +/// transformation-rejection from pairs of uniform and normal random variables. +/// See http://dl.acm.org/citation.cfm?id=358414 +/// +/// Args: +/// * scope: A Scope object +/// * shape: 1-D integer tensor. Shape of independent samples to draw from each +/// distribution described by the shape parameters given in alpha. +/// * alpha: A tensor in which each scalar is a "shape" parameter describing the +/// associated gamma distribution. +/// +/// Optional attributes (see `Attrs`): +/// * seed: If either `seed` or `seed2` are set to be non-zero, the random number +/// generator is seeded by the given seed. Otherwise, it is seeded by a +/// random seed. +/// * seed2: A second seed to avoid seed collision. +/// +/// Returns: +/// * `Output`: A tensor with shape `shape + shape(alpha)`. Each slice +/// `[:, ..., :, i0, i1, ...iN]` contains the samples drawn for +/// `alpha[i0, i1, ...iN]`. The dtype of the output matches the dtype of alpha. +class RandomGamma { + public: + /// Optional attribute setters for RandomGamma + struct Attrs { + /// If either `seed` or `seed2` are set to be non-zero, the random number + /// generator is seeded by the given seed. Otherwise, it is seeded by a + /// random seed. + /// + /// Defaults to 0 + TF_MUST_USE_RESULT Attrs Seed(int64 x) { + Attrs ret = *this; + ret.seed_ = x; + return ret; + } + + /// A second seed to avoid seed collision. + /// + /// Defaults to 0 + TF_MUST_USE_RESULT Attrs Seed2(int64 x) { + Attrs ret = *this; + ret.seed2_ = x; + return ret; + } + + int64 seed_ = 0; + int64 seed2_ = 0; + }; + RandomGamma(const ::tensorflow::Scope& scope, ::tensorflow::Input shape, + ::tensorflow::Input alpha); + RandomGamma(const ::tensorflow::Scope& scope, ::tensorflow::Input shape, + ::tensorflow::Input alpha, const RandomGamma::Attrs& attrs); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + static Attrs Seed(int64 x) { + return Attrs().Seed(x); + } + static Attrs Seed2(int64 x) { + return Attrs().Seed2(x); + } + + Operation operation; + ::tensorflow::Output output; +}; + +/// Outputs random values from the Poisson distribution(s) described by rate. +/// +/// This op uses two algorithms, depending on rate. If rate >= 10, then +/// the algorithm by Hormann is used to acquire samples via +/// transformation-rejection. +/// See http://www.sciencedirect.com/science/article/pii/0167668793909974. +/// +/// Otherwise, Knuth's algorithm is used to acquire samples via multiplying uniform +/// random variables. +/// See Donald E. Knuth (1969). Seminumerical Algorithms. The Art of Computer +/// Programming, Volume 2. Addison Wesley +/// +/// Args: +/// * scope: A Scope object +/// * shape: 1-D integer tensor. Shape of independent samples to draw from each +/// distribution described by the shape parameters given in rate. +/// * rate: A tensor in which each scalar is a "rate" parameter describing the +/// associated poisson distribution. +/// +/// Optional attributes (see `Attrs`): +/// * seed: If either `seed` or `seed2` are set to be non-zero, the random number +/// generator is seeded by the given seed. Otherwise, it is seeded by a +/// random seed. +/// * seed2: A second seed to avoid seed collision. +/// +/// Returns: +/// * `Output`: A tensor with shape `shape + shape(rate)`. Each slice +/// `[:, ..., :, i0, i1, ...iN]` contains the samples drawn for +/// `rate[i0, i1, ...iN]`. +class RandomPoissonV2 { + public: + /// Optional attribute setters for RandomPoissonV2 + struct Attrs { + /// If either `seed` or `seed2` are set to be non-zero, the random number + /// generator is seeded by the given seed. Otherwise, it is seeded by a + /// random seed. + /// + /// Defaults to 0 + TF_MUST_USE_RESULT Attrs Seed(int64 x) { + Attrs ret = *this; + ret.seed_ = x; + return ret; + } + + /// A second seed to avoid seed collision. + /// + /// Defaults to 0 + TF_MUST_USE_RESULT Attrs Seed2(int64 x) { + Attrs ret = *this; + ret.seed2_ = x; + return ret; + } + + /// Defaults to DT_INT64 + TF_MUST_USE_RESULT Attrs Dtype(DataType x) { + Attrs ret = *this; + ret.dtype_ = x; + return ret; + } + + int64 seed_ = 0; + int64 seed2_ = 0; + DataType dtype_ = DT_INT64; + }; + RandomPoissonV2(const ::tensorflow::Scope& scope, ::tensorflow::Input shape, + ::tensorflow::Input rate); + RandomPoissonV2(const ::tensorflow::Scope& scope, ::tensorflow::Input shape, + ::tensorflow::Input rate, const RandomPoissonV2::Attrs& attrs); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + static Attrs Seed(int64 x) { + return Attrs().Seed(x); + } + static Attrs Seed2(int64 x) { + return Attrs().Seed2(x); + } + static Attrs Dtype(DataType x) { + return Attrs().Dtype(x); + } + + Operation operation; + ::tensorflow::Output output; +}; + +/// Randomly shuffles a tensor along its first dimension. +/// +/// The tensor is shuffled along dimension 0, such that each `value[j]` is mapped +/// to one and only one `output[i]`. For example, a mapping that might occur for a +/// 3x2 tensor is: +/// +/// ``` +/// [[1, 2], [[5, 6], +/// [3, 4], ==> [1, 2], +/// [5, 6]] [3, 4]] +/// ``` +/// +/// Args: +/// * scope: A Scope object +/// * value: The tensor to be shuffled. +/// +/// Optional attributes (see `Attrs`): +/// * seed: If either `seed` or `seed2` are set to be non-zero, the random number +/// generator is seeded by the given seed. Otherwise, it is seeded by a +/// random seed. +/// * seed2: A second seed to avoid seed collision. +/// +/// Returns: +/// * `Output`: A tensor of same shape and type as `value`, shuffled along its first +/// dimension. +class RandomShuffle { + public: + /// Optional attribute setters for RandomShuffle + struct Attrs { + /// If either `seed` or `seed2` are set to be non-zero, the random number + /// generator is seeded by the given seed. Otherwise, it is seeded by a + /// random seed. + /// + /// Defaults to 0 + TF_MUST_USE_RESULT Attrs Seed(int64 x) { + Attrs ret = *this; + ret.seed_ = x; + return ret; + } + + /// A second seed to avoid seed collision. + /// + /// Defaults to 0 + TF_MUST_USE_RESULT Attrs Seed2(int64 x) { + Attrs ret = *this; + ret.seed2_ = x; + return ret; + } + + int64 seed_ = 0; + int64 seed2_ = 0; + }; + RandomShuffle(const ::tensorflow::Scope& scope, ::tensorflow::Input value); + RandomShuffle(const ::tensorflow::Scope& scope, ::tensorflow::Input value, + const RandomShuffle::Attrs& attrs); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + static Attrs Seed(int64 x) { + return Attrs().Seed(x); + } + static Attrs Seed2(int64 x) { + return Attrs().Seed2(x); + } + + Operation operation; + ::tensorflow::Output output; +}; + +/// Outputs random values from a normal distribution. +/// +/// The generated values will have mean 0 and standard deviation 1. +/// +/// Args: +/// * scope: A Scope object +/// * shape: The shape of the output tensor. +/// * dtype: The type of the output. +/// +/// Optional attributes (see `Attrs`): +/// * seed: If either `seed` or `seed2` are set to be non-zero, the random number +/// generator is seeded by the given seed. Otherwise, it is seeded by a +/// random seed. +/// * seed2: A second seed to avoid seed collision. +/// +/// Returns: +/// * `Output`: A tensor of the specified shape filled with random normal values. +class RandomNormal { + public: + /// Optional attribute setters for RandomNormal + struct Attrs { + /// If either `seed` or `seed2` are set to be non-zero, the random number + /// generator is seeded by the given seed. Otherwise, it is seeded by a + /// random seed. + /// + /// Defaults to 0 + TF_MUST_USE_RESULT Attrs Seed(int64 x) { + Attrs ret = *this; + ret.seed_ = x; + return ret; + } + + /// A second seed to avoid seed collision. + /// + /// Defaults to 0 + TF_MUST_USE_RESULT Attrs Seed2(int64 x) { + Attrs ret = *this; + ret.seed2_ = x; + return ret; + } + + int64 seed_ = 0; + int64 seed2_ = 0; + }; + RandomNormal(const ::tensorflow::Scope& scope, ::tensorflow::Input shape, + DataType dtype); + RandomNormal(const ::tensorflow::Scope& scope, ::tensorflow::Input shape, + DataType dtype, const RandomNormal::Attrs& attrs); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + static Attrs Seed(int64 x) { + return Attrs().Seed(x); + } + static Attrs Seed2(int64 x) { + return Attrs().Seed2(x); + } + + Operation operation; + ::tensorflow::Output output; +}; + +/// Outputs random values from a uniform distribution. +/// +/// The generated values follow a uniform distribution in the range `[0, 1)`. The +/// lower bound 0 is included in the range, while the upper bound 1 is excluded. +/// +/// Args: +/// * scope: A Scope object +/// * shape: The shape of the output tensor. +/// * dtype: The type of the output. +/// +/// Optional attributes (see `Attrs`): +/// * seed: If either `seed` or `seed2` are set to be non-zero, the random number +/// generator is seeded by the given seed. Otherwise, it is seeded by a +/// random seed. +/// * seed2: A second seed to avoid seed collision. +/// +/// Returns: +/// * `Output`: A tensor of the specified shape filled with uniform random values. +class RandomUniform { + public: + /// Optional attribute setters for RandomUniform + struct Attrs { + /// If either `seed` or `seed2` are set to be non-zero, the random number + /// generator is seeded by the given seed. Otherwise, it is seeded by a + /// random seed. + /// + /// Defaults to 0 + TF_MUST_USE_RESULT Attrs Seed(int64 x) { + Attrs ret = *this; + ret.seed_ = x; + return ret; + } + + /// A second seed to avoid seed collision. + /// + /// Defaults to 0 + TF_MUST_USE_RESULT Attrs Seed2(int64 x) { + Attrs ret = *this; + ret.seed2_ = x; + return ret; + } + + int64 seed_ = 0; + int64 seed2_ = 0; + }; + RandomUniform(const ::tensorflow::Scope& scope, ::tensorflow::Input shape, + DataType dtype); + RandomUniform(const ::tensorflow::Scope& scope, ::tensorflow::Input shape, + DataType dtype, const RandomUniform::Attrs& attrs); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + static Attrs Seed(int64 x) { + return Attrs().Seed(x); + } + static Attrs Seed2(int64 x) { + return Attrs().Seed2(x); + } + + Operation operation; + ::tensorflow::Output output; +}; + +/// Outputs random integers from a uniform distribution. +/// +/// The generated values are uniform integers in the range `[minval, maxval)`. +/// The lower bound `minval` is included in the range, while the upper bound +/// `maxval` is excluded. +/// +/// The random integers are slightly biased unless `maxval - minval` is an exact +/// power of two. The bias is small for values of `maxval - minval` significantly +/// smaller than the range of the output (either `2^32` or `2^64`). +/// +/// Args: +/// * scope: A Scope object +/// * shape: The shape of the output tensor. +/// * minval: 0-D. Inclusive lower bound on the generated integers. +/// * maxval: 0-D. Exclusive upper bound on the generated integers. +/// +/// Optional attributes (see `Attrs`): +/// * seed: If either `seed` or `seed2` are set to be non-zero, the random number +/// generator is seeded by the given seed. Otherwise, it is seeded by a +/// random seed. +/// * seed2: A second seed to avoid seed collision. +/// +/// Returns: +/// * `Output`: A tensor of the specified shape filled with uniform random integers. +class RandomUniformInt { + public: + /// Optional attribute setters for RandomUniformInt + struct Attrs { + /// If either `seed` or `seed2` are set to be non-zero, the random number + /// generator is seeded by the given seed. Otherwise, it is seeded by a + /// random seed. + /// + /// Defaults to 0 + TF_MUST_USE_RESULT Attrs Seed(int64 x) { + Attrs ret = *this; + ret.seed_ = x; + return ret; + } + + /// A second seed to avoid seed collision. + /// + /// Defaults to 0 + TF_MUST_USE_RESULT Attrs Seed2(int64 x) { + Attrs ret = *this; + ret.seed2_ = x; + return ret; + } + + int64 seed_ = 0; + int64 seed2_ = 0; + }; + RandomUniformInt(const ::tensorflow::Scope& scope, ::tensorflow::Input shape, + ::tensorflow::Input minval, ::tensorflow::Input maxval); + RandomUniformInt(const ::tensorflow::Scope& scope, ::tensorflow::Input shape, + ::tensorflow::Input minval, ::tensorflow::Input maxval, const + RandomUniformInt::Attrs& attrs); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + static Attrs Seed(int64 x) { + return Attrs().Seed(x); + } + static Attrs Seed2(int64 x) { + return Attrs().Seed2(x); + } + + Operation operation; + ::tensorflow::Output output; +}; + +/// Outputs random values from a truncated normal distribution. +/// +/// The generated values follow a normal distribution with mean 0 and standard +/// deviation 1, except that values whose magnitude is more than 2 standard +/// deviations from the mean are dropped and re-picked. +/// +/// Args: +/// * scope: A Scope object +/// * shape: The shape of the output tensor. +/// * dtype: The type of the output. +/// +/// Optional attributes (see `Attrs`): +/// * seed: If either `seed` or `seed2` are set to be non-zero, the random number +/// generator is seeded by the given seed. Otherwise, it is seeded by a +/// random seed. +/// * seed2: A second seed to avoid seed collision. +/// +/// Returns: +/// * `Output`: A tensor of the specified shape filled with random truncated normal +/// values. +class TruncatedNormal { + public: + /// Optional attribute setters for TruncatedNormal + struct Attrs { + /// If either `seed` or `seed2` are set to be non-zero, the random number + /// generator is seeded by the given seed. Otherwise, it is seeded by a + /// random seed. + /// + /// Defaults to 0 + TF_MUST_USE_RESULT Attrs Seed(int64 x) { + Attrs ret = *this; + ret.seed_ = x; + return ret; + } + + /// A second seed to avoid seed collision. + /// + /// Defaults to 0 + TF_MUST_USE_RESULT Attrs Seed2(int64 x) { + Attrs ret = *this; + ret.seed2_ = x; + return ret; + } + + int64 seed_ = 0; + int64 seed2_ = 0; + }; + TruncatedNormal(const ::tensorflow::Scope& scope, ::tensorflow::Input shape, + DataType dtype); + TruncatedNormal(const ::tensorflow::Scope& scope, ::tensorflow::Input shape, + DataType dtype, const TruncatedNormal::Attrs& attrs); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + static Attrs Seed(int64 x) { + return Attrs().Seed(x); + } + static Attrs Seed2(int64 x) { + return Attrs().Seed2(x); + } + + Operation operation; + ::tensorflow::Output output; +}; + +/// @} + +} // namespace ops +} // namespace tensorflow + +#endif // TENSORFLOW_CC_OPS_RANDOM_OPS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/ops/random_ops_internal.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/ops/random_ops_internal.h new file mode 100644 index 0000000000000000000000000000000000000000..069c779a04fa4d142db0e0e1217126b540acb95b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/ops/random_ops_internal.h @@ -0,0 +1,47 @@ +// This file is MACHINE GENERATED! Do not edit. + +#ifndef TENSORFLOW_CC_OPS_RANDOM_OPS_INTERNAL_H_ +#define TENSORFLOW_CC_OPS_RANDOM_OPS_INTERNAL_H_ + +// This file is MACHINE GENERATED! Do not edit. + +#include "tensorflow/cc/framework/ops.h" +#include "tensorflow/cc/framework/scope.h" +#include "tensorflow/core/framework/tensor.h" +#include "tensorflow/core/framework/tensor_shape.h" +#include "tensorflow/core/framework/types.h" +#include "tensorflow/core/lib/gtl/array_slice.h" + +namespace tensorflow { +namespace ops { +namespace internal { +// NOTE: This namespace has internal TensorFlow details that +// are not part of TensorFlow's public API. + +/// @defgroup random_ops_internal Random Ops Internal +/// @{ + +/// Computes the derivative of a Gamma random sample w.r.t. `alpha`. +/// +/// Args: +/// * scope: A Scope object +/// +/// Returns: +/// * `Output`: The output tensor. +class RandomGammaGrad { + public: + RandomGammaGrad(const ::tensorflow::Scope& scope, ::tensorflow::Input alpha, + ::tensorflow::Input sample); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + Operation operation; + ::tensorflow::Output output; +}; + +} // namespace internal +} // namespace ops +} // namespace tensorflow + +#endif // TENSORFLOW_CC_OPS_RANDOM_OPS_INTERNAL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/ops/resource_variable_ops.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/ops/resource_variable_ops.h new file mode 100644 index 0000000000000000000000000000000000000000..86cd60688b1bc69690227eaeda1c04ac7315939f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/ops/resource_variable_ops.h @@ -0,0 +1,587 @@ +// This file is MACHINE GENERATED! Do not edit. + +#ifndef TENSORFLOW_CC_OPS_RESOURCE_VARIABLE_OPS_H_ +#define TENSORFLOW_CC_OPS_RESOURCE_VARIABLE_OPS_H_ + +// This file is MACHINE GENERATED! Do not edit. + +#include "tensorflow/cc/framework/ops.h" +#include "tensorflow/cc/framework/scope.h" +#include "tensorflow/core/framework/tensor.h" +#include "tensorflow/core/framework/tensor_shape.h" +#include "tensorflow/core/framework/types.h" +#include "tensorflow/core/lib/gtl/array_slice.h" + +namespace tensorflow { +namespace ops { + +/// @defgroup resource_variable_ops Resource Variable Ops +/// @{ + +/// TODO: add doc. +/// +/// Args: +/// * scope: A Scope object +/// +/// Returns: +/// * the created `Operation` +class AssignAddVariableOp { + public: + AssignAddVariableOp(const ::tensorflow::Scope& scope, ::tensorflow::Input + resource, ::tensorflow::Input value); + operator ::tensorflow::Operation() const { return operation; } + + Operation operation; +}; + +/// TODO: add doc. +/// +/// Args: +/// * scope: A Scope object +/// +/// Returns: +/// * the created `Operation` +class AssignSubVariableOp { + public: + AssignSubVariableOp(const ::tensorflow::Scope& scope, ::tensorflow::Input + resource, ::tensorflow::Input value); + operator ::tensorflow::Operation() const { return operation; } + + Operation operation; +}; + +/// TODO: add doc. +/// +/// Args: +/// * scope: A Scope object +/// +/// Returns: +/// * the created `Operation` +class AssignVariableOp { + public: + /// Optional attribute setters for AssignVariableOp + struct Attrs { + /// Defaults to false + TF_MUST_USE_RESULT Attrs ValidateShape(bool x) { + Attrs ret = *this; + ret.validate_shape_ = x; + return ret; + } + + bool validate_shape_ = false; + }; + AssignVariableOp(const ::tensorflow::Scope& scope, ::tensorflow::Input + resource, ::tensorflow::Input value); + AssignVariableOp(const ::tensorflow::Scope& scope, ::tensorflow::Input + resource, ::tensorflow::Input value, const + AssignVariableOp::Attrs& attrs); + operator ::tensorflow::Operation() const { return operation; } + + static Attrs ValidateShape(bool x) { + return Attrs().ValidateShape(x); + } + + Operation operation; +}; + +/// TODO: add doc. +/// +/// Args: +/// * scope: A Scope object +/// +/// Returns: +/// * the created `Operation` +class ConsumeMutexLock { + public: + ConsumeMutexLock(const ::tensorflow::Scope& scope, ::tensorflow::Input + mutex_lock); + operator ::tensorflow::Operation() const { return operation; } + + Operation operation; +}; + +/// TODO: add doc. +/// +/// Args: +/// * scope: A Scope object +/// +/// Returns: +/// * the created `Operation` +class DestroyResourceOp { + public: + /// Optional attribute setters for DestroyResourceOp + struct Attrs { + /// Defaults to true + TF_MUST_USE_RESULT Attrs IgnoreLookupError(bool x) { + Attrs ret = *this; + ret.ignore_lookup_error_ = x; + return ret; + } + + bool ignore_lookup_error_ = true; + }; + DestroyResourceOp(const ::tensorflow::Scope& scope, ::tensorflow::Input + resource); + DestroyResourceOp(const ::tensorflow::Scope& scope, ::tensorflow::Input + resource, const DestroyResourceOp::Attrs& attrs); + operator ::tensorflow::Operation() const { return operation; } + + static Attrs IgnoreLookupError(bool x) { + return Attrs().IgnoreLookupError(x); + } + + Operation operation; +}; + +/// TODO: add doc. +/// +/// Args: +/// * scope: A Scope object +/// +/// Returns: +/// * the created `Operation` +class DisableCopyOnRead { + public: + DisableCopyOnRead(const ::tensorflow::Scope& scope, ::tensorflow::Input + resource); + operator ::tensorflow::Operation() const { return operation; } + + Operation operation; +}; + +/// TODO: add doc. +/// +/// Args: +/// * scope: A Scope object +/// +/// Returns: +/// * `Output`: The mutex_lock tensor. +class MutexLock { + public: + MutexLock(const ::tensorflow::Scope& scope, ::tensorflow::Input mutex); + operator ::tensorflow::Output() const { return mutex_lock; } + operator ::tensorflow::Input() const { return mutex_lock; } + ::tensorflow::Node* node() const { return mutex_lock.node(); } + + Operation operation; + ::tensorflow::Output mutex_lock; +}; + +/// TODO: add doc. +/// +/// Args: +/// * scope: A Scope object +/// +/// Returns: +/// * `Output`: The resource tensor. +class MutexV2 { + public: + /// Optional attribute setters for MutexV2 + struct Attrs { + /// Defaults to "" + TF_MUST_USE_RESULT Attrs Container(StringPiece x) { + Attrs ret = *this; + ret.container_ = x; + return ret; + } + + /// Defaults to "" + TF_MUST_USE_RESULT Attrs SharedName(StringPiece x) { + Attrs ret = *this; + ret.shared_name_ = x; + return ret; + } + + StringPiece container_ = ""; + StringPiece shared_name_ = ""; + }; + MutexV2(const ::tensorflow::Scope& scope); + MutexV2(const ::tensorflow::Scope& scope, const MutexV2::Attrs& attrs); + operator ::tensorflow::Output() const { return resource; } + operator ::tensorflow::Input() const { return resource; } + ::tensorflow::Node* node() const { return resource.node(); } + + static Attrs Container(StringPiece x) { + return Attrs().Container(x); + } + static Attrs SharedName(StringPiece x) { + return Attrs().SharedName(x); + } + + Operation operation; + ::tensorflow::Output resource; +}; + +/// TODO: add doc. +/// +/// Args: +/// * scope: A Scope object +/// +/// Returns: +/// * `Output`: The value tensor. +class ReadVariableOp { + public: + ReadVariableOp(const ::tensorflow::Scope& scope, ::tensorflow::Input resource, + DataType dtype); + operator ::tensorflow::Output() const { return value; } + operator ::tensorflow::Input() const { return value; } + ::tensorflow::Node* node() const { return value.node(); } + + Operation operation; + ::tensorflow::Output value; +}; + +/// TODO: add doc. +/// +/// Args: +/// * scope: A Scope object +/// +/// Returns: +/// * `Output`: The output tensor. +class ResourceGather { + public: + /// Optional attribute setters for ResourceGather + struct Attrs { + /// Defaults to 0 + TF_MUST_USE_RESULT Attrs BatchDims(int64 x) { + Attrs ret = *this; + ret.batch_dims_ = x; + return ret; + } + + /// Defaults to true + TF_MUST_USE_RESULT Attrs ValidateIndices(bool x) { + Attrs ret = *this; + ret.validate_indices_ = x; + return ret; + } + + int64 batch_dims_ = 0; + bool validate_indices_ = true; + }; + ResourceGather(const ::tensorflow::Scope& scope, ::tensorflow::Input resource, + ::tensorflow::Input indices, DataType dtype); + ResourceGather(const ::tensorflow::Scope& scope, ::tensorflow::Input resource, + ::tensorflow::Input indices, DataType dtype, const + ResourceGather::Attrs& attrs); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + static Attrs BatchDims(int64 x) { + return Attrs().BatchDims(x); + } + static Attrs ValidateIndices(bool x) { + return Attrs().ValidateIndices(x); + } + + Operation operation; + ::tensorflow::Output output; +}; + +/// TODO: add doc. +/// +/// Args: +/// * scope: A Scope object +/// +/// Returns: +/// * `Output`: The output tensor. +class ResourceGatherNd { + public: + ResourceGatherNd(const ::tensorflow::Scope& scope, ::tensorflow::Input + resource, ::tensorflow::Input indices, DataType dtype); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + Operation operation; + ::tensorflow::Output output; +}; + +/// TODO: add doc. +/// +/// Args: +/// * scope: A Scope object +/// +/// Returns: +/// * the created `Operation` +class ResourceScatterAdd { + public: + ResourceScatterAdd(const ::tensorflow::Scope& scope, ::tensorflow::Input + resource, ::tensorflow::Input indices, ::tensorflow::Input + updates); + operator ::tensorflow::Operation() const { return operation; } + + Operation operation; +}; + +/// TODO: add doc. +/// +/// Args: +/// * scope: A Scope object +/// +/// Returns: +/// * the created `Operation` +class ResourceScatterDiv { + public: + ResourceScatterDiv(const ::tensorflow::Scope& scope, ::tensorflow::Input + resource, ::tensorflow::Input indices, ::tensorflow::Input + updates); + operator ::tensorflow::Operation() const { return operation; } + + Operation operation; +}; + +/// TODO: add doc. +/// +/// Args: +/// * scope: A Scope object +/// +/// Returns: +/// * the created `Operation` +class ResourceScatterMax { + public: + ResourceScatterMax(const ::tensorflow::Scope& scope, ::tensorflow::Input + resource, ::tensorflow::Input indices, ::tensorflow::Input + updates); + operator ::tensorflow::Operation() const { return operation; } + + Operation operation; +}; + +/// TODO: add doc. +/// +/// Args: +/// * scope: A Scope object +/// +/// Returns: +/// * the created `Operation` +class ResourceScatterMin { + public: + ResourceScatterMin(const ::tensorflow::Scope& scope, ::tensorflow::Input + resource, ::tensorflow::Input indices, ::tensorflow::Input + updates); + operator ::tensorflow::Operation() const { return operation; } + + Operation operation; +}; + +/// TODO: add doc. +/// +/// Args: +/// * scope: A Scope object +/// +/// Returns: +/// * the created `Operation` +class ResourceScatterMul { + public: + ResourceScatterMul(const ::tensorflow::Scope& scope, ::tensorflow::Input + resource, ::tensorflow::Input indices, ::tensorflow::Input + updates); + operator ::tensorflow::Operation() const { return operation; } + + Operation operation; +}; + +/// TODO: add doc. +/// +/// Args: +/// * scope: A Scope object +/// +/// Returns: +/// * the created `Operation` +class ResourceScatterSub { + public: + ResourceScatterSub(const ::tensorflow::Scope& scope, ::tensorflow::Input + resource, ::tensorflow::Input indices, ::tensorflow::Input + updates); + operator ::tensorflow::Operation() const { return operation; } + + Operation operation; +}; + +/// TODO: add doc. +/// +/// Args: +/// * scope: A Scope object +/// +/// Returns: +/// * the created `Operation` +class ResourceScatterUpdate { + public: + ResourceScatterUpdate(const ::tensorflow::Scope& scope, ::tensorflow::Input + resource, ::tensorflow::Input indices, + ::tensorflow::Input updates); + operator ::tensorflow::Operation() const { return operation; } + + Operation operation; +}; + +/// TODO: add doc. +/// +/// Args: +/// * scope: A Scope object +/// +/// Returns: +/// * `Output`: The resource tensor. +class VarHandleOp { + public: + /// Optional attribute setters for VarHandleOp + struct Attrs { + /// Defaults to "" + TF_MUST_USE_RESULT Attrs Container(StringPiece x) { + Attrs ret = *this; + ret.container_ = x; + return ret; + } + + /// Defaults to "" + TF_MUST_USE_RESULT Attrs SharedName(StringPiece x) { + Attrs ret = *this; + ret.shared_name_ = x; + return ret; + } + + /// Defaults to "" + TF_MUST_USE_RESULT Attrs DebugName(StringPiece x) { + Attrs ret = *this; + ret.debug_name_ = x; + return ret; + } + + /// Defaults to [] + TF_MUST_USE_RESULT Attrs AllowedDevices(const gtl::ArraySlice<::tensorflow::tstring>& x) { + Attrs ret = *this; + ret.allowed_devices_ = x; + return ret; + } + + StringPiece container_ = ""; + StringPiece shared_name_ = ""; + StringPiece debug_name_ = ""; + gtl::ArraySlice<::tensorflow::tstring> allowed_devices_ = {}; + }; + VarHandleOp(const ::tensorflow::Scope& scope, DataType dtype, + PartialTensorShape shape); + VarHandleOp(const ::tensorflow::Scope& scope, DataType dtype, + PartialTensorShape shape, const VarHandleOp::Attrs& attrs); + operator ::tensorflow::Output() const { return resource; } + operator ::tensorflow::Input() const { return resource; } + ::tensorflow::Node* node() const { return resource.node(); } + + static Attrs Container(StringPiece x) { + return Attrs().Container(x); + } + static Attrs SharedName(StringPiece x) { + return Attrs().SharedName(x); + } + static Attrs DebugName(StringPiece x) { + return Attrs().DebugName(x); + } + static Attrs AllowedDevices(const gtl::ArraySlice<::tensorflow::tstring>& x) { + return Attrs().AllowedDevices(x); + } + + Operation operation; + ::tensorflow::Output resource; +}; + +/// TODO: add doc. +/// +/// Args: +/// * scope: A Scope object +/// +/// Returns: +/// * `Output`: The is_initialized tensor. +class VarIsInitializedOp { + public: + VarIsInitializedOp(const ::tensorflow::Scope& scope, ::tensorflow::Input + resource); + operator ::tensorflow::Output() const { return is_initialized; } + operator ::tensorflow::Input() const { return is_initialized; } + ::tensorflow::Node* node() const { return is_initialized.node(); } + + Operation operation; + ::tensorflow::Output is_initialized; +}; + +/// TODO: add doc. +/// +/// Args: +/// * scope: A Scope object +/// +/// Returns: +/// * `Output`: The output tensor. +class VariableShape { + public: + /// Optional attribute setters for VariableShape + struct Attrs { + /// Defaults to DT_INT32 + TF_MUST_USE_RESULT Attrs OutType(DataType x) { + Attrs ret = *this; + ret.out_type_ = x; + return ret; + } + + DataType out_type_ = DT_INT32; + }; + VariableShape(const ::tensorflow::Scope& scope, ::tensorflow::Input input); + VariableShape(const ::tensorflow::Scope& scope, ::tensorflow::Input input, + const VariableShape::Attrs& attrs); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + static Attrs OutType(DataType x) { + return Attrs().OutType(x); + } + + Operation operation; + ::tensorflow::Output output; +}; + +/// TODO: add doc. +/// +/// Args: +/// * scope: A Scope object +/// +/// Returns: +/// * `OutputList`: The values tensor. +class _ReadVariablesOp { + public: + _ReadVariablesOp(const ::tensorflow::Scope& scope, ::tensorflow::InputList + resources, const DataTypeSlice& dtypes); + ::tensorflow::Output operator[](size_t index) const { return values[index]; } + + + Operation operation; + ::tensorflow::OutputList values; +}; + +/// TODO: add doc. +/// +/// Args: +/// * scope: A Scope object +/// +/// Returns: +/// * `OutputList`: The resources tensor. +class _VarHandlesOp { + public: + _VarHandlesOp(const ::tensorflow::Scope& scope, const + gtl::ArraySlice<::tensorflow::tstring>& containers, const + gtl::ArraySlice<::tensorflow::tstring>& shared_names, int64 N, + const DataTypeSlice& dtypes, const + gtl::ArraySlice& shapes); + ::tensorflow::Output operator[](size_t index) const { return resources[index]; } + + + Operation operation; + ::tensorflow::OutputList resources; +}; + +/// @} + +} // namespace ops +} // namespace tensorflow + +#endif // TENSORFLOW_CC_OPS_RESOURCE_VARIABLE_OPS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/ops/sparse_ops.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/ops/sparse_ops.h new file mode 100644 index 0000000000000000000000000000000000000000..17883a8c37bb4b315f2ab1ea943153383991c012 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/ops/sparse_ops.h @@ -0,0 +1,1814 @@ +// This file is MACHINE GENERATED! Do not edit. + +#ifndef TENSORFLOW_CC_OPS_SPARSE_OPS_H_ +#define TENSORFLOW_CC_OPS_SPARSE_OPS_H_ + +// This file is MACHINE GENERATED! Do not edit. + +#include "tensorflow/cc/framework/ops.h" +#include "tensorflow/cc/framework/scope.h" +#include "tensorflow/core/framework/tensor.h" +#include "tensorflow/core/framework/tensor_shape.h" +#include "tensorflow/core/framework/types.h" +#include "tensorflow/core/lib/gtl/array_slice.h" + +namespace tensorflow { +namespace ops { + +/// @defgroup sparse_ops Sparse Ops +/// @{ + +/// Add an `N`-minibatch `SparseTensor` to a `SparseTensorsMap`, return `N` handles. +/// +/// A `SparseTensor` of rank `R` is represented by three tensors: `sparse_indices`, +/// `sparse_values`, and `sparse_shape`, where +/// +/// ```sparse_indices.shape[1] == sparse_shape.shape[0] == R``` +/// +/// An `N`-minibatch of `SparseTensor` objects is represented as a `SparseTensor` +/// having a first `sparse_indices` column taking values between `[0, N)`, where +/// the minibatch size `N == sparse_shape[0]`. +/// +/// The input `SparseTensor` must have rank `R` greater than 1, and the first +/// dimension is treated as the minibatch dimension. Elements of the `SparseTensor` +/// must be sorted in increasing order of this first dimension. The stored +/// `SparseTensor` objects pointed to by each row of the output `sparse_handles` +/// will have rank `R-1`. +/// +/// The `SparseTensor` values can then be read out as part of a minibatch by passing +/// the given keys as vector elements to `TakeManySparseFromTensorsMap`. To ensure +/// the correct `SparseTensorsMap` is accessed, ensure that the same +/// `container` and `shared_name` are passed to that Op. If no `shared_name` +/// is provided here, instead use the *name* of the Operation created by calling +/// `AddManySparseToTensorsMap` as the `shared_name` passed to +/// `TakeManySparseFromTensorsMap`. Ensure the Operations are colocated. +/// +/// Args: +/// * scope: A Scope object +/// * sparse_indices: 2-D. The `indices` of the minibatch `SparseTensor`. +/// `sparse_indices[:, 0]` must be ordered values in `[0, N)`. +/// * sparse_values: 1-D. The `values` of the minibatch `SparseTensor`. +/// * sparse_shape: 1-D. The `shape` of the minibatch `SparseTensor`. +/// The minibatch size `N == sparse_shape[0]`. +/// +/// Optional attributes (see `Attrs`): +/// * container: The container name for the `SparseTensorsMap` created by this op. +/// * shared_name: The shared name for the `SparseTensorsMap` created by this op. +/// If blank, the new Operation's unique name is used. +/// +/// Returns: +/// * `Output`: 1-D. The handles of the `SparseTensor` now stored in the +/// `SparseTensorsMap`. Shape: `[N]`. +class AddManySparseToTensorsMap { + public: + /// Optional attribute setters for AddManySparseToTensorsMap + struct Attrs { + /// The container name for the `SparseTensorsMap` created by this op. + /// + /// Defaults to "" + TF_MUST_USE_RESULT Attrs Container(StringPiece x) { + Attrs ret = *this; + ret.container_ = x; + return ret; + } + + /// The shared name for the `SparseTensorsMap` created by this op. + /// If blank, the new Operation's unique name is used. + /// + /// Defaults to "" + TF_MUST_USE_RESULT Attrs SharedName(StringPiece x) { + Attrs ret = *this; + ret.shared_name_ = x; + return ret; + } + + StringPiece container_ = ""; + StringPiece shared_name_ = ""; + }; + AddManySparseToTensorsMap(const ::tensorflow::Scope& scope, ::tensorflow::Input + sparse_indices, ::tensorflow::Input sparse_values, + ::tensorflow::Input sparse_shape); + AddManySparseToTensorsMap(const ::tensorflow::Scope& scope, ::tensorflow::Input + sparse_indices, ::tensorflow::Input sparse_values, + ::tensorflow::Input sparse_shape, const + AddManySparseToTensorsMap::Attrs& attrs); + operator ::tensorflow::Output() const { return sparse_handles; } + operator ::tensorflow::Input() const { return sparse_handles; } + ::tensorflow::Node* node() const { return sparse_handles.node(); } + + static Attrs Container(StringPiece x) { + return Attrs().Container(x); + } + static Attrs SharedName(StringPiece x) { + return Attrs().SharedName(x); + } + + Operation operation; + ::tensorflow::Output sparse_handles; +}; + +/// Add a `SparseTensor` to a `SparseTensorsMap` return its handle. +/// +/// A `SparseTensor` is represented by three tensors: `sparse_indices`, +/// `sparse_values`, and `sparse_shape`. +/// +/// This operator takes the given `SparseTensor` and adds it to a container +/// object (a `SparseTensorsMap`). A unique key within this container is generated +/// in the form of an `int64`, and this is the value that is returned. +/// +/// The `SparseTensor` can then be read out as part of a minibatch by passing +/// the key as a vector element to `TakeManySparseFromTensorsMap`. To ensure +/// the correct `SparseTensorsMap` is accessed, ensure that the same +/// `container` and `shared_name` are passed to that Op. If no `shared_name` +/// is provided here, instead use the *name* of the Operation created by calling +/// `AddSparseToTensorsMap` as the `shared_name` passed to +/// `TakeManySparseFromTensorsMap`. Ensure the Operations are colocated. +/// +/// Args: +/// * scope: A Scope object +/// * sparse_indices: 2-D. The `indices` of the `SparseTensor`. +/// * sparse_values: 1-D. The `values` of the `SparseTensor`. +/// * sparse_shape: 1-D. The `shape` of the `SparseTensor`. +/// +/// Optional attributes (see `Attrs`): +/// * container: The container name for the `SparseTensorsMap` created by this op. +/// * shared_name: The shared name for the `SparseTensorsMap` created by this op. +/// If blank, the new Operation's unique name is used. +/// +/// Returns: +/// * `Output`: 0-D. The handle of the `SparseTensor` now stored in the +/// `SparseTensorsMap`. +class AddSparseToTensorsMap { + public: + /// Optional attribute setters for AddSparseToTensorsMap + struct Attrs { + /// The container name for the `SparseTensorsMap` created by this op. + /// + /// Defaults to "" + TF_MUST_USE_RESULT Attrs Container(StringPiece x) { + Attrs ret = *this; + ret.container_ = x; + return ret; + } + + /// The shared name for the `SparseTensorsMap` created by this op. + /// If blank, the new Operation's unique name is used. + /// + /// Defaults to "" + TF_MUST_USE_RESULT Attrs SharedName(StringPiece x) { + Attrs ret = *this; + ret.shared_name_ = x; + return ret; + } + + StringPiece container_ = ""; + StringPiece shared_name_ = ""; + }; + AddSparseToTensorsMap(const ::tensorflow::Scope& scope, ::tensorflow::Input + sparse_indices, ::tensorflow::Input sparse_values, + ::tensorflow::Input sparse_shape); + AddSparseToTensorsMap(const ::tensorflow::Scope& scope, ::tensorflow::Input + sparse_indices, ::tensorflow::Input sparse_values, + ::tensorflow::Input sparse_shape, const + AddSparseToTensorsMap::Attrs& attrs); + operator ::tensorflow::Output() const { return sparse_handle; } + operator ::tensorflow::Input() const { return sparse_handle; } + ::tensorflow::Node* node() const { return sparse_handle.node(); } + + static Attrs Container(StringPiece x) { + return Attrs().Container(x); + } + static Attrs SharedName(StringPiece x) { + return Attrs().SharedName(x); + } + + Operation operation; + ::tensorflow::Output sparse_handle; +}; + +/// Deserialize and concatenate `SparseTensors` from a serialized minibatch. +/// +/// The input `serialized_sparse` must be a string matrix of shape `[N x 3]` where +/// `N` is the minibatch size and the rows correspond to packed outputs of +/// `SerializeSparse`. The ranks of the original `SparseTensor` objects +/// must all match. When the final `SparseTensor` is created, it has rank one +/// higher than the ranks of the incoming `SparseTensor` objects +/// (they have been concatenated along a new row dimension). +/// +/// The output `SparseTensor` object's shape values for all dimensions but the +/// first are the max across the input `SparseTensor` objects' shape values +/// for the corresponding dimensions. Its first shape value is `N`, the minibatch +/// size. +/// +/// The input `SparseTensor` objects' indices are assumed ordered in +/// standard lexicographic order. If this is not the case, after this +/// step run `SparseReorder` to restore index ordering. +/// +/// For example, if the serialized input is a `[2 x 3]` matrix representing two +/// original `SparseTensor` objects: +/// +/// index = [ 0] +/// [10] +/// [20] +/// values = [1, 2, 3] +/// shape = [50] +/// +/// and +/// +/// index = [ 2] +/// [10] +/// values = [4, 5] +/// shape = [30] +/// +/// then the final deserialized `SparseTensor` will be: +/// +/// index = [0 0] +/// [0 10] +/// [0 20] +/// [1 2] +/// [1 10] +/// values = [1, 2, 3, 4, 5] +/// shape = [2 50] +/// +/// Args: +/// * scope: A Scope object +/// * serialized_sparse: 2-D, The `N` serialized `SparseTensor` objects. +/// Must have 3 columns. +/// * dtype: The `dtype` of the serialized `SparseTensor` objects. +/// +/// Returns: +/// * `Output` sparse_indices +/// * `Output` sparse_values +/// * `Output` sparse_shape +class DeserializeManySparse { + public: + DeserializeManySparse(const ::tensorflow::Scope& scope, ::tensorflow::Input + serialized_sparse, DataType dtype); + + Operation operation; + ::tensorflow::Output sparse_indices; + ::tensorflow::Output sparse_values; + ::tensorflow::Output sparse_shape; +}; + +/// Deserialize `SparseTensor` objects. +/// +/// The input `serialized_sparse` must have the shape `[?, ?, ..., ?, 3]` where +/// the last dimension stores serialized `SparseTensor` objects and the other N +/// dimensions (N >= 0) correspond to a batch. The ranks of the original +/// `SparseTensor` objects must all match. When the final `SparseTensor` is +/// created, its rank is the rank of the incoming `SparseTensor` objects plus N; +/// the sparse tensors have been concatenated along new dimensions, one for each +/// batch. +/// +/// The output `SparseTensor` object's shape values for the original dimensions +/// are the max across the input `SparseTensor` objects' shape values for the +/// corresponding dimensions. The new dimensions match the size of the batch. +/// +/// The input `SparseTensor` objects' indices are assumed ordered in +/// standard lexicographic order. If this is not the case, after this +/// step run `SparseReorder` to restore index ordering. +/// +/// For example, if the serialized input is a `[2 x 3]` matrix representing two +/// original `SparseTensor` objects: +/// +/// index = [ 0] +/// [10] +/// [20] +/// values = [1, 2, 3] +/// shape = [50] +/// +/// and +/// +/// index = [ 2] +/// [10] +/// values = [4, 5] +/// shape = [30] +/// +/// then the final deserialized `SparseTensor` will be: +/// +/// index = [0 0] +/// [0 10] +/// [0 20] +/// [1 2] +/// [1 10] +/// values = [1, 2, 3, 4, 5] +/// shape = [2 50] +/// +/// Args: +/// * scope: A Scope object +/// * serialized_sparse: The serialized `SparseTensor` objects. The last dimension +/// must have 3 columns. +/// * dtype: The `dtype` of the serialized `SparseTensor` objects. +/// +/// Returns: +/// * `Output` sparse_indices +/// * `Output` sparse_values +/// * `Output` sparse_shape +class DeserializeSparse { + public: + DeserializeSparse(const ::tensorflow::Scope& scope, ::tensorflow::Input + serialized_sparse, DataType dtype); + + Operation operation; + ::tensorflow::Output sparse_indices; + ::tensorflow::Output sparse_values; + ::tensorflow::Output sparse_shape; +}; + +/// Serialize an `N`-minibatch `SparseTensor` into an `[N, 3]` `Tensor` object. +/// +/// The `SparseTensor` must have rank `R` greater than 1, and the first dimension +/// is treated as the minibatch dimension. Elements of the `SparseTensor` +/// must be sorted in increasing order of this first dimension. The serialized +/// `SparseTensor` objects going into each row of `serialized_sparse` will have +/// rank `R-1`. +/// +/// The minibatch size `N` is extracted from `sparse_shape[0]`. +/// +/// Args: +/// * scope: A Scope object +/// * sparse_indices: 2-D. The `indices` of the minibatch `SparseTensor`. +/// * sparse_values: 1-D. The `values` of the minibatch `SparseTensor`. +/// * sparse_shape: 1-D. The `shape` of the minibatch `SparseTensor`. +/// +/// Optional attributes (see `Attrs`): +/// * out_type: The `dtype` to use for serialization; the supported types are `string` +/// (default) and `variant`. +/// +/// Returns: +/// * `Output`: The serialized_sparse tensor. +class SerializeManySparse { + public: + /// Optional attribute setters for SerializeManySparse + struct Attrs { + /// The `dtype` to use for serialization; the supported types are `string` + /// (default) and `variant`. + /// + /// Defaults to DT_STRING + TF_MUST_USE_RESULT Attrs OutType(DataType x) { + Attrs ret = *this; + ret.out_type_ = x; + return ret; + } + + DataType out_type_ = DT_STRING; + }; + SerializeManySparse(const ::tensorflow::Scope& scope, ::tensorflow::Input + sparse_indices, ::tensorflow::Input sparse_values, + ::tensorflow::Input sparse_shape); + SerializeManySparse(const ::tensorflow::Scope& scope, ::tensorflow::Input + sparse_indices, ::tensorflow::Input sparse_values, + ::tensorflow::Input sparse_shape, const + SerializeManySparse::Attrs& attrs); + operator ::tensorflow::Output() const { return serialized_sparse; } + operator ::tensorflow::Input() const { return serialized_sparse; } + ::tensorflow::Node* node() const { return serialized_sparse.node(); } + + static Attrs OutType(DataType x) { + return Attrs().OutType(x); + } + + Operation operation; + ::tensorflow::Output serialized_sparse; +}; + +/// Serialize a `SparseTensor` into a `[3]` `Tensor` object. +/// +/// Args: +/// * scope: A Scope object +/// * sparse_indices: 2-D. The `indices` of the `SparseTensor`. +/// * sparse_values: 1-D. The `values` of the `SparseTensor`. +/// * sparse_shape: 1-D. The `shape` of the `SparseTensor`. +/// +/// Optional attributes (see `Attrs`): +/// * out_type: The `dtype` to use for serialization; the supported types are `string` +/// (default) and `variant`. +/// +/// Returns: +/// * `Output`: The serialized_sparse tensor. +class SerializeSparse { + public: + /// Optional attribute setters for SerializeSparse + struct Attrs { + /// The `dtype` to use for serialization; the supported types are `string` + /// (default) and `variant`. + /// + /// Defaults to DT_STRING + TF_MUST_USE_RESULT Attrs OutType(DataType x) { + Attrs ret = *this; + ret.out_type_ = x; + return ret; + } + + DataType out_type_ = DT_STRING; + }; + SerializeSparse(const ::tensorflow::Scope& scope, ::tensorflow::Input + sparse_indices, ::tensorflow::Input sparse_values, + ::tensorflow::Input sparse_shape); + SerializeSparse(const ::tensorflow::Scope& scope, ::tensorflow::Input + sparse_indices, ::tensorflow::Input sparse_values, + ::tensorflow::Input sparse_shape, const SerializeSparse::Attrs& + attrs); + operator ::tensorflow::Output() const { return serialized_sparse; } + operator ::tensorflow::Input() const { return serialized_sparse; } + ::tensorflow::Node* node() const { return serialized_sparse.node(); } + + static Attrs OutType(DataType x) { + return Attrs().OutType(x); + } + + Operation operation; + ::tensorflow::Output serialized_sparse; +}; + +/// Adds two `SparseTensor` objects to produce another `SparseTensor`. +/// +/// The input `SparseTensor` objects' indices are assumed ordered in standard +/// lexicographic order. If this is not the case, before this step run +/// `SparseReorder` to restore index ordering. +/// +/// By default, if two values sum to zero at some index, the output `SparseTensor` +/// would still include that particular location in its index, storing a zero in the +/// corresponding value slot. To override this, callers can specify `thresh`, +/// indicating that if the sum has a magnitude strictly smaller than `thresh`, its +/// corresponding value and index would then not be included. In particular, +/// `thresh == 0` (default) means everything is kept and actual thresholding happens +/// only for a positive value. +/// +/// In the following shapes, `nnz` is the count after taking `thresh` into account. +/// +/// Args: +/// * scope: A Scope object +/// * a_indices: 2-D. The `indices` of the first `SparseTensor`, size `[nnz, ndims]` Matrix. +/// * a_values: 1-D. The `values` of the first `SparseTensor`, size `[nnz]` Vector. +/// * a_shape: 1-D. The `shape` of the first `SparseTensor`, size `[ndims]` Vector. +/// * b_indices: 2-D. The `indices` of the second `SparseTensor`, size `[nnz, ndims]` Matrix. +/// * b_values: 1-D. The `values` of the second `SparseTensor`, size `[nnz]` Vector. +/// * b_shape: 1-D. The `shape` of the second `SparseTensor`, size `[ndims]` Vector. +/// * thresh: 0-D. The magnitude threshold that determines if an output value/index +/// pair takes space. +/// +/// Returns: +/// * `Output` sum_indices +/// * `Output` sum_values +/// * `Output` sum_shape +class SparseAdd { + public: + SparseAdd(const ::tensorflow::Scope& scope, ::tensorflow::Input a_indices, + ::tensorflow::Input a_values, ::tensorflow::Input a_shape, + ::tensorflow::Input b_indices, ::tensorflow::Input b_values, + ::tensorflow::Input b_shape, ::tensorflow::Input thresh); + + Operation operation; + ::tensorflow::Output sum_indices; + ::tensorflow::Output sum_values; + ::tensorflow::Output sum_shape; +}; + +/// The gradient operator for the SparseAdd op. +/// +/// The SparseAdd op calculates A + B, where A, B, and the sum are all represented +/// as `SparseTensor` objects. This op takes in the upstream gradient w.r.t. +/// non-empty values of the sum, and outputs the gradients w.r.t. the non-empty +/// values of A and B. +/// +/// Args: +/// * scope: A Scope object +/// * backprop_val_grad: 1-D with shape `[nnz(sum)]`. The gradient with respect to +/// the non-empty values of the sum. +/// * a_indices: 2-D. The `indices` of the `SparseTensor` A, size `[nnz(A), ndims]`. +/// * b_indices: 2-D. The `indices` of the `SparseTensor` B, size `[nnz(B), ndims]`. +/// * sum_indices: 2-D. The `indices` of the sum `SparseTensor`, size +/// `[nnz(sum), ndims]`. +/// +/// Returns: +/// * `Output` a_val_grad: 1-D with shape `[nnz(A)]`. The gradient with respect to the +/// non-empty values of A. +/// * `Output` b_val_grad: 1-D with shape `[nnz(B)]`. The gradient with respect to the +/// non-empty values of B. +class SparseAddGrad { + public: + SparseAddGrad(const ::tensorflow::Scope& scope, ::tensorflow::Input + backprop_val_grad, ::tensorflow::Input a_indices, + ::tensorflow::Input b_indices, ::tensorflow::Input sum_indices); + + Operation operation; + ::tensorflow::Output a_val_grad; + ::tensorflow::Output b_val_grad; +}; + +/// Concatenates a list of `SparseTensor` along the specified dimension. +/// +/// Concatenation is with respect to the dense versions of these sparse tensors. +/// It is assumed that each input is a `SparseTensor` whose elements are ordered +/// along increasing dimension number. +/// +/// All inputs' shapes must match, except for the concat dimension. The +/// `indices`, `values`, and `shapes` lists must have the same length. +/// +/// The output shape is identical to the inputs', except along the concat +/// dimension, where it is the sum of the inputs' sizes along that dimension. +/// +/// The output elements will be resorted to preserve the sort order along +/// increasing dimension number. +/// +/// This op runs in `O(M log M)` time, where `M` is the total number of non-empty +/// values across all inputs. This is due to the need for an internal sort in +/// order to concatenate efficiently across an arbitrary dimension. +/// +/// For example, if `concat_dim = 1` and the inputs are +/// +/// sp_inputs[0]: shape = [2, 3] +/// [0, 2]: "a" +/// [1, 0]: "b" +/// [1, 1]: "c" +/// +/// sp_inputs[1]: shape = [2, 4] +/// [0, 1]: "d" +/// [0, 2]: "e" +/// +/// then the output will be +/// +/// shape = [2, 7] +/// [0, 2]: "a" +/// [0, 4]: "d" +/// [0, 5]: "e" +/// [1, 0]: "b" +/// [1, 1]: "c" +/// +/// Graphically this is equivalent to doing +/// +/// [ a] concat [ d e ] = [ a d e ] +/// [b c ] [ ] [b c ] +/// +/// Args: +/// * scope: A Scope object +/// * indices: 2-D. Indices of each input `SparseTensor`. +/// * values: 1-D. Non-empty values of each `SparseTensor`. +/// * shapes: 1-D. Shapes of each `SparseTensor`. +/// * concat_dim: Dimension to concatenate along. Must be in range [-rank, rank), +/// where rank is the number of dimensions in each input `SparseTensor`. +/// +/// Returns: +/// * `Output` output_indices: 2-D. Indices of the concatenated `SparseTensor`. +/// * `Output` output_values: 1-D. Non-empty values of the concatenated `SparseTensor`. +/// * `Output` output_shape: 1-D. Shape of the concatenated `SparseTensor`. +class SparseConcat { + public: + SparseConcat(const ::tensorflow::Scope& scope, ::tensorflow::InputList indices, + ::tensorflow::InputList values, ::tensorflow::InputList shapes, + int64 concat_dim); + + Operation operation; + ::tensorflow::Output output_indices; + ::tensorflow::Output output_values; + ::tensorflow::Output output_shape; +}; + +/// Generates sparse cross from a list of sparse and dense tensors. +/// +/// The op takes two lists, one of 2D `SparseTensor` and one of 2D `Tensor`, each +/// representing features of one feature column. It outputs a 2D `SparseTensor` with +/// the batchwise crosses of these features. +/// +/// For example, if the inputs are +/// +/// inputs[0]: SparseTensor with shape = [2, 2] +/// [0, 0]: "a" +/// [1, 0]: "b" +/// [1, 1]: "c" +/// +/// inputs[1]: SparseTensor with shape = [2, 1] +/// [0, 0]: "d" +/// [1, 0]: "e" +/// +/// inputs[2]: Tensor [["f"], ["g"]] +/// +/// then the output will be +/// +/// shape = [2, 2] +/// [0, 0]: "a_X_d_X_f" +/// [1, 0]: "b_X_e_X_g" +/// [1, 1]: "c_X_e_X_g" +/// +/// if hashed_output=true then the output will be +/// +/// shape = [2, 2] +/// [0, 0]: FingerprintCat64( +/// Fingerprint64("f"), FingerprintCat64( +/// Fingerprint64("d"), Fingerprint64("a"))) +/// [1, 0]: FingerprintCat64( +/// Fingerprint64("g"), FingerprintCat64( +/// Fingerprint64("e"), Fingerprint64("b"))) +/// [1, 1]: FingerprintCat64( +/// Fingerprint64("g"), FingerprintCat64( +/// Fingerprint64("e"), Fingerprint64("c"))) +/// +/// Args: +/// * scope: A Scope object +/// * indices: 2-D. Indices of each input `SparseTensor`. +/// * values: 1-D. values of each `SparseTensor`. +/// * shapes: 1-D. Shapes of each `SparseTensor`. +/// * dense_inputs: 2-D. Columns represented by dense `Tensor`. +/// * hashed_output: If true, returns the hash of the cross instead of the string. +/// This will allow us avoiding string manipulations. +/// * num_buckets: It is used if hashed_output is true. +/// output = hashed_value%num_buckets if num_buckets > 0 else hashed_value. +/// * hash_key: Specify the hash_key that will be used by the `FingerprintCat64` +/// function to combine the crosses fingerprints. +/// +/// Returns: +/// * `Output` output_indices: 2-D. Indices of the concatenated `SparseTensor`. +/// * `Output` output_values: 1-D. Non-empty values of the concatenated or hashed +/// `SparseTensor`. +/// * `Output` output_shape: 1-D. Shape of the concatenated `SparseTensor`. +class SparseCross { + public: + SparseCross(const ::tensorflow::Scope& scope, ::tensorflow::InputList indices, + ::tensorflow::InputList values, ::tensorflow::InputList shapes, + ::tensorflow::InputList dense_inputs, bool hashed_output, int64 + num_buckets, int64 hash_key, DataType out_type, DataType + internal_type); + + Operation operation; + ::tensorflow::Output output_indices; + ::tensorflow::Output output_values; + ::tensorflow::Output output_shape; +}; + +/// Generates sparse cross from a list of sparse and dense tensors. +/// +/// The op takes two lists, one of 2D `SparseTensor` and one of 2D `Tensor`, each +/// representing features of one feature column. It outputs a 2D `SparseTensor` with +/// the batchwise crosses of these features. +/// +/// For example, if the inputs are +/// +/// inputs[0]: SparseTensor with shape = [2, 2] +/// [0, 0]: "a" +/// [1, 0]: "b" +/// [1, 1]: "c" +/// +/// inputs[1]: SparseTensor with shape = [2, 1] +/// [0, 0]: "d" +/// [1, 0]: "e" +/// +/// inputs[2]: Tensor [["f"], ["g"]] +/// +/// then the output will be +/// +/// shape = [2, 2] +/// [0, 0]: "a_X_d_X_f" +/// [1, 0]: "b_X_e_X_g" +/// [1, 1]: "c_X_e_X_g" +/// +/// if hashed_output=true then the output will be +/// +/// shape = [2, 2] +/// [0, 0]: FingerprintCat64( +/// Fingerprint64("f"), FingerprintCat64( +/// Fingerprint64("d"), Fingerprint64("a"))) +/// [1, 0]: FingerprintCat64( +/// Fingerprint64("g"), FingerprintCat64( +/// Fingerprint64("e"), Fingerprint64("b"))) +/// [1, 1]: FingerprintCat64( +/// Fingerprint64("g"), FingerprintCat64( +/// Fingerprint64("e"), Fingerprint64("c"))) +/// +/// Args: +/// * scope: A Scope object +/// * indices: 2-D. Indices of each input `SparseTensor`. +/// * values: 1-D. values of each `SparseTensor`. +/// * shapes: 1-D. Shapes of each `SparseTensor`. +/// * dense_inputs: 2-D. Columns represented by dense `Tensor`. +/// * num_buckets: It is used if hashed_output is true. +/// output = hashed_value%num_buckets if num_buckets > 0 else hashed_value. +/// * strong_hash: boolean, if true, siphash with salt will be used instead of farmhash. +/// * salt: Specify the salt that will be used by the siphash function. +/// +/// Returns: +/// * `Output` output_indices: 2-D. Indices of the concatenated `SparseTensor`. +/// * `Output` output_values: 1-D. Non-empty values of the concatenated or hashed +/// `SparseTensor`. +/// * `Output` output_shape: 1-D. Shape of the concatenated `SparseTensor`. +class SparseCrossHashed { + public: + SparseCrossHashed(const ::tensorflow::Scope& scope, ::tensorflow::InputList + indices, ::tensorflow::InputList values, + ::tensorflow::InputList shapes, ::tensorflow::InputList + dense_inputs, ::tensorflow::Input num_buckets, + ::tensorflow::Input strong_hash, ::tensorflow::Input salt); + + Operation operation; + ::tensorflow::Output output_indices; + ::tensorflow::Output output_values; + ::tensorflow::Output output_shape; +}; + +/// Generates sparse cross from a list of sparse and dense tensors. +/// +/// The op takes two lists, one of 2D `SparseTensor` and one of 2D `Tensor`, each +/// representing features of one feature column. It outputs a 2D `SparseTensor` with +/// the batchwise crosses of these features. +/// +/// For example, if the inputs are +/// +/// inputs[0]: SparseTensor with shape = [2, 2] +/// [0, 0]: "a" +/// [1, 0]: "b" +/// [1, 1]: "c" +/// +/// inputs[1]: SparseTensor with shape = [2, 1] +/// [0, 0]: "d" +/// [1, 0]: "e" +/// +/// inputs[2]: Tensor [["f"], ["g"]] +/// +/// then the output will be +/// +/// shape = [2, 2] +/// [0, 0]: "a_X_d_X_f" +/// [1, 0]: "b_X_e_X_g" +/// [1, 1]: "c_X_e_X_g" +/// +/// if hashed_output=true then the output will be +/// +/// shape = [2, 2] +/// [0, 0]: FingerprintCat64( +/// Fingerprint64("f"), FingerprintCat64( +/// Fingerprint64("d"), Fingerprint64("a"))) +/// [1, 0]: FingerprintCat64( +/// Fingerprint64("g"), FingerprintCat64( +/// Fingerprint64("e"), Fingerprint64("b"))) +/// [1, 1]: FingerprintCat64( +/// Fingerprint64("g"), FingerprintCat64( +/// Fingerprint64("e"), Fingerprint64("c"))) +/// +/// Args: +/// * scope: A Scope object +/// * indices: 2-D. Indices of each input `SparseTensor`. +/// * values: 1-D. values of each `SparseTensor`. +/// * shapes: 1-D. Shapes of each `SparseTensor`. +/// * dense_inputs: 2-D. Columns represented by dense `Tensor`. +/// * sep: string used when joining a list of string inputs, can be used as separator later. +/// +/// Returns: +/// * `Output` output_indices: 2-D. Indices of the concatenated `SparseTensor`. +/// * `Output` output_values: 1-D. Non-empty values of the concatenated or hashed +/// `SparseTensor`. +/// * `Output` output_shape: 1-D. Shape of the concatenated `SparseTensor`. +class SparseCrossV2 { + public: + SparseCrossV2(const ::tensorflow::Scope& scope, ::tensorflow::InputList + indices, ::tensorflow::InputList values, ::tensorflow::InputList + shapes, ::tensorflow::InputList dense_inputs, ::tensorflow::Input + sep); + + Operation operation; + ::tensorflow::Output output_indices; + ::tensorflow::Output output_values; + ::tensorflow::Output output_shape; +}; + +/// Adds up a SparseTensor and a dense Tensor, using these special rules: +/// +/// (1) Broadcasts the dense side to have the same shape as the sparse side, if +/// eligible; +/// (2) Then, only the dense values pointed to by the indices of the SparseTensor +/// participate in the cwise addition. +/// +/// By these rules, the result is a logical SparseTensor with exactly the same +/// indices and shape, but possibly with different non-zero values. The output of +/// this Op is the resultant non-zero values. +/// +/// Args: +/// * scope: A Scope object +/// * sp_indices: 2-D. `N x R` matrix with the indices of non-empty values in a +/// SparseTensor, possibly not in canonical ordering. +/// * sp_values: 1-D. `N` non-empty values corresponding to `sp_indices`. +/// * sp_shape: 1-D. Shape of the input SparseTensor. +/// * dense: `R`-D. The dense Tensor operand. +/// +/// Returns: +/// * `Output`: 1-D. The `N` values that are operated on. +class SparseDenseCwiseAdd { + public: + SparseDenseCwiseAdd(const ::tensorflow::Scope& scope, ::tensorflow::Input + sp_indices, ::tensorflow::Input sp_values, + ::tensorflow::Input sp_shape, ::tensorflow::Input dense); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + Operation operation; + ::tensorflow::Output output; +}; + +/// Component-wise divides a SparseTensor by a dense Tensor. +/// +/// *Limitation*: this Op only broadcasts the dense side to the sparse side, but not +/// the other direction. +/// +/// Args: +/// * scope: A Scope object +/// * sp_indices: 2-D. `N x R` matrix with the indices of non-empty values in a +/// SparseTensor, possibly not in canonical ordering. +/// * sp_values: 1-D. `N` non-empty values corresponding to `sp_indices`. +/// * sp_shape: 1-D. Shape of the input SparseTensor. +/// * dense: `R`-D. The dense Tensor operand. +/// +/// Returns: +/// * `Output`: 1-D. The `N` values that are operated on. +class SparseDenseCwiseDiv { + public: + SparseDenseCwiseDiv(const ::tensorflow::Scope& scope, ::tensorflow::Input + sp_indices, ::tensorflow::Input sp_values, + ::tensorflow::Input sp_shape, ::tensorflow::Input dense); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + Operation operation; + ::tensorflow::Output output; +}; + +/// Component-wise multiplies a SparseTensor by a dense Tensor. +/// +/// The output locations corresponding to the implicitly zero elements in the sparse +/// tensor will be zero (i.e., will not take up storage space), regardless of the +/// contents of the dense tensor (even if it's +/-INF and that INF*0 == NaN). +/// +/// *Limitation*: this Op only broadcasts the dense side to the sparse side, but not +/// the other direction. +/// +/// Args: +/// * scope: A Scope object +/// * sp_indices: 2-D. `N x R` matrix with the indices of non-empty values in a +/// SparseTensor, possibly not in canonical ordering. +/// * sp_values: 1-D. `N` non-empty values corresponding to `sp_indices`. +/// * sp_shape: 1-D. Shape of the input SparseTensor. +/// * dense: `R`-D. The dense Tensor operand. +/// +/// Returns: +/// * `Output`: 1-D. The `N` values that are operated on. +class SparseDenseCwiseMul { + public: + SparseDenseCwiseMul(const ::tensorflow::Scope& scope, ::tensorflow::Input + sp_indices, ::tensorflow::Input sp_values, + ::tensorflow::Input sp_shape, ::tensorflow::Input dense); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + Operation operation; + ::tensorflow::Output output; +}; + +/// Fills empty rows in the input 2-D `SparseTensor` with a default value. +/// +/// The input `SparseTensor` is represented via the tuple of inputs +/// (`indices`, `values`, `dense_shape`). The output `SparseTensor` has the +/// same `dense_shape` but with indices `output_indices` and values +/// `output_values`. +/// +/// This op inserts a single entry for every row that doesn't have any values. +/// The index is created as `[row, 0, ..., 0]` and the inserted value +/// is `default_value`. +/// +/// For example, suppose `sp_input` has shape `[5, 6]` and non-empty values: +/// +/// [0, 1]: a +/// [0, 3]: b +/// [2, 0]: c +/// [3, 1]: d +/// +/// Rows 1 and 4 are empty, so the output will be of shape `[5, 6]` with values: +/// +/// [0, 1]: a +/// [0, 3]: b +/// [1, 0]: default_value +/// [2, 0]: c +/// [3, 1]: d +/// [4, 0]: default_value +/// +/// The output `SparseTensor` will be in row-major order and will have the +/// same shape as the input. +/// +/// This op also returns an indicator vector shaped `[dense_shape[0]]` such that +/// +/// empty_row_indicator[i] = True iff row i was an empty row. +/// +/// And a reverse index map vector shaped `[indices.shape[0]]` that is used during +/// backpropagation, +/// +/// reverse_index_map[j] = out_j s.t. indices[j, :] == output_indices[out_j, :] +/// +/// Args: +/// * scope: A Scope object +/// * indices: 2-D. the indices of the sparse tensor. +/// * values: 1-D. the values of the sparse tensor. +/// * dense_shape: 1-D. the shape of the sparse tensor. +/// * default_value: 0-D. default value to insert into location `[row, 0, ..., 0]` +/// for rows missing from the input sparse tensor. +/// output indices: 2-D. the indices of the filled sparse tensor. +/// +/// Returns: +/// * `Output` output_indices +/// * `Output` output_values: 1-D. the values of the filled sparse tensor. +/// * `Output` empty_row_indicator: 1-D. whether the dense row was missing in the +/// input sparse tensor. +/// * `Output` reverse_index_map: 1-D. a map from the input indices to the output indices. +class SparseFillEmptyRows { + public: + SparseFillEmptyRows(const ::tensorflow::Scope& scope, ::tensorflow::Input + indices, ::tensorflow::Input values, ::tensorflow::Input + dense_shape, ::tensorflow::Input default_value); + + Operation operation; + ::tensorflow::Output output_indices; + ::tensorflow::Output output_values; + ::tensorflow::Output empty_row_indicator; + ::tensorflow::Output reverse_index_map; +}; + +/// The gradient of SparseFillEmptyRows. +/// +/// Takes vectors reverse_index_map, shaped `[N]`, and grad_values, +/// shaped `[N_full]`, where `N_full >= N` and copies data into either +/// `d_values` or `d_default_value`. Here `d_values` is shaped `[N]` and +/// `d_default_value` is a scalar. +/// +/// d_values[j] = grad_values[reverse_index_map[j]] +/// d_default_value = sum_{k : 0 .. N_full - 1} ( +/// grad_values[k] * 1{k not in reverse_index_map}) +/// +/// Args: +/// * scope: A Scope object +/// * reverse_index_map: 1-D. The reverse index map from SparseFillEmptyRows. +/// * grad_values: 1-D. The gradients from backprop. +/// +/// Returns: +/// * `Output` d_values: 1-D. The backprop into values. +/// * `Output` d_default_value: 0-D. The backprop into default_value. +class SparseFillEmptyRowsGrad { + public: + SparseFillEmptyRowsGrad(const ::tensorflow::Scope& scope, ::tensorflow::Input + reverse_index_map, ::tensorflow::Input grad_values); + + Operation operation; + ::tensorflow::Output d_values; + ::tensorflow::Output d_default_value; +}; + +/// Computes the max of elements across dimensions of a SparseTensor. +/// +/// This Op takes a SparseTensor and is the sparse counterpart to +/// `tf.reduce_max()`. In particular, this Op also returns a dense `Tensor` +/// instead of a sparse one. +/// +/// Reduces `sp_input` along the dimensions given in `reduction_axes`. Unless +/// `keep_dims` is true, the rank of the tensor is reduced by 1 for each entry in +/// `reduction_axes`. If `keep_dims` is true, the reduced dimensions are retained +/// with length 1. +/// +/// If `reduction_axes` has no entries, all dimensions are reduced, and a tensor +/// with a single element is returned. Additionally, the axes can be negative, +/// which are interpreted according to the indexing rules in Python. +/// +/// Args: +/// * scope: A Scope object +/// * input_indices: 2-D. `N x R` matrix with the indices of non-empty values in a +/// SparseTensor, possibly not in canonical ordering. +/// * input_values: 1-D. `N` non-empty values corresponding to `input_indices`. +/// * input_shape: 1-D. Shape of the input SparseTensor. +/// * reduction_axes: 1-D. Length-`K` vector containing the reduction axes. +/// +/// Optional attributes (see `Attrs`): +/// * keep_dims: If true, retain reduced dimensions with length 1. +/// +/// Returns: +/// * `Output`: `R-K`-D. The reduced Tensor. +class SparseReduceMax { + public: + /// Optional attribute setters for SparseReduceMax + struct Attrs { + /// If true, retain reduced dimensions with length 1. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs KeepDims(bool x) { + Attrs ret = *this; + ret.keep_dims_ = x; + return ret; + } + + bool keep_dims_ = false; + }; + SparseReduceMax(const ::tensorflow::Scope& scope, ::tensorflow::Input + input_indices, ::tensorflow::Input input_values, + ::tensorflow::Input input_shape, ::tensorflow::Input + reduction_axes); + SparseReduceMax(const ::tensorflow::Scope& scope, ::tensorflow::Input + input_indices, ::tensorflow::Input input_values, + ::tensorflow::Input input_shape, ::tensorflow::Input + reduction_axes, const SparseReduceMax::Attrs& attrs); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + static Attrs KeepDims(bool x) { + return Attrs().KeepDims(x); + } + + Operation operation; + ::tensorflow::Output output; +}; + +/// Computes the max of elements across dimensions of a SparseTensor. +/// +/// This Op takes a SparseTensor and is the sparse counterpart to +/// `tf.reduce_max()`. In contrast to SparseReduceMax, this Op returns a +/// SparseTensor. +/// +/// Reduces `sp_input` along the dimensions given in `reduction_axes`. Unless +/// `keep_dims` is true, the rank of the tensor is reduced by 1 for each entry in +/// `reduction_axes`. If `keep_dims` is true, the reduced dimensions are retained +/// with length 1. +/// +/// If `reduction_axes` has no entries, all dimensions are reduced, and a tensor +/// with a single element is returned. Additionally, the axes can be negative, +/// which are interpreted according to the indexing rules in Python. +/// +/// Args: +/// * scope: A Scope object +/// * input_indices: 2-D. `N x R` matrix with the indices of non-empty values in a +/// SparseTensor, possibly not in canonical ordering. +/// * input_values: 1-D. `N` non-empty values corresponding to `input_indices`. +/// * input_shape: 1-D. Shape of the input SparseTensor. +/// * reduction_axes: 1-D. Length-`K` vector containing the reduction axes. +/// +/// Optional attributes (see `Attrs`): +/// * keep_dims: If true, retain reduced dimensions with length 1. +/// +/// Returns: +/// * `Output` output_indices +/// * `Output` output_values +/// * `Output` output_shape +class SparseReduceMaxSparse { + public: + /// Optional attribute setters for SparseReduceMaxSparse + struct Attrs { + /// If true, retain reduced dimensions with length 1. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs KeepDims(bool x) { + Attrs ret = *this; + ret.keep_dims_ = x; + return ret; + } + + bool keep_dims_ = false; + }; + SparseReduceMaxSparse(const ::tensorflow::Scope& scope, ::tensorflow::Input + input_indices, ::tensorflow::Input input_values, + ::tensorflow::Input input_shape, ::tensorflow::Input + reduction_axes); + SparseReduceMaxSparse(const ::tensorflow::Scope& scope, ::tensorflow::Input + input_indices, ::tensorflow::Input input_values, + ::tensorflow::Input input_shape, ::tensorflow::Input + reduction_axes, const SparseReduceMaxSparse::Attrs& + attrs); + + static Attrs KeepDims(bool x) { + return Attrs().KeepDims(x); + } + + Operation operation; + ::tensorflow::Output output_indices; + ::tensorflow::Output output_values; + ::tensorflow::Output output_shape; +}; + +/// Computes the sum of elements across dimensions of a SparseTensor. +/// +/// This Op takes a SparseTensor and is the sparse counterpart to +/// `tf.reduce_sum()`. In particular, this Op also returns a dense `Tensor` +/// instead of a sparse one. +/// +/// Reduces `sp_input` along the dimensions given in `reduction_axes`. Unless +/// `keep_dims` is true, the rank of the tensor is reduced by 1 for each entry in +/// `reduction_axes`. If `keep_dims` is true, the reduced dimensions are retained +/// with length 1. +/// +/// If `reduction_axes` has no entries, all dimensions are reduced, and a tensor +/// with a single element is returned. Additionally, the axes can be negative, +/// which are interpreted according to the indexing rules in Python. +/// +/// Args: +/// * scope: A Scope object +/// * input_indices: 2-D. `N x R` matrix with the indices of non-empty values in a +/// SparseTensor, possibly not in canonical ordering. +/// * input_values: 1-D. `N` non-empty values corresponding to `input_indices`. +/// * input_shape: 1-D. Shape of the input SparseTensor. +/// * reduction_axes: 1-D. Length-`K` vector containing the reduction axes. +/// +/// Optional attributes (see `Attrs`): +/// * keep_dims: If true, retain reduced dimensions with length 1. +/// +/// Returns: +/// * `Output`: `R-K`-D. The reduced Tensor. +class SparseReduceSum { + public: + /// Optional attribute setters for SparseReduceSum + struct Attrs { + /// If true, retain reduced dimensions with length 1. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs KeepDims(bool x) { + Attrs ret = *this; + ret.keep_dims_ = x; + return ret; + } + + bool keep_dims_ = false; + }; + SparseReduceSum(const ::tensorflow::Scope& scope, ::tensorflow::Input + input_indices, ::tensorflow::Input input_values, + ::tensorflow::Input input_shape, ::tensorflow::Input + reduction_axes); + SparseReduceSum(const ::tensorflow::Scope& scope, ::tensorflow::Input + input_indices, ::tensorflow::Input input_values, + ::tensorflow::Input input_shape, ::tensorflow::Input + reduction_axes, const SparseReduceSum::Attrs& attrs); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + static Attrs KeepDims(bool x) { + return Attrs().KeepDims(x); + } + + Operation operation; + ::tensorflow::Output output; +}; + +/// Computes the sum of elements across dimensions of a SparseTensor. +/// +/// This Op takes a SparseTensor and is the sparse counterpart to +/// `tf.reduce_sum()`. In contrast to SparseReduceSum, this Op returns a +/// SparseTensor. +/// +/// Reduces `sp_input` along the dimensions given in `reduction_axes`. Unless +/// `keep_dims` is true, the rank of the tensor is reduced by 1 for each entry in +/// `reduction_axes`. If `keep_dims` is true, the reduced dimensions are retained +/// with length 1. +/// +/// If `reduction_axes` has no entries, all dimensions are reduced, and a tensor +/// with a single element is returned. Additionally, the axes can be negative, +/// which are interpreted according to the indexing rules in Python. +/// +/// Args: +/// * scope: A Scope object +/// * input_indices: 2-D. `N x R` matrix with the indices of non-empty values in a +/// SparseTensor, possibly not in canonical ordering. +/// * input_values: 1-D. `N` non-empty values corresponding to `input_indices`. +/// * input_shape: 1-D. Shape of the input SparseTensor. +/// * reduction_axes: 1-D. Length-`K` vector containing the reduction axes. +/// +/// Optional attributes (see `Attrs`): +/// * keep_dims: If true, retain reduced dimensions with length 1. +/// +/// Returns: +/// * `Output` output_indices +/// * `Output` output_values +/// * `Output` output_shape +class SparseReduceSumSparse { + public: + /// Optional attribute setters for SparseReduceSumSparse + struct Attrs { + /// If true, retain reduced dimensions with length 1. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs KeepDims(bool x) { + Attrs ret = *this; + ret.keep_dims_ = x; + return ret; + } + + bool keep_dims_ = false; + }; + SparseReduceSumSparse(const ::tensorflow::Scope& scope, ::tensorflow::Input + input_indices, ::tensorflow::Input input_values, + ::tensorflow::Input input_shape, ::tensorflow::Input + reduction_axes); + SparseReduceSumSparse(const ::tensorflow::Scope& scope, ::tensorflow::Input + input_indices, ::tensorflow::Input input_values, + ::tensorflow::Input input_shape, ::tensorflow::Input + reduction_axes, const SparseReduceSumSparse::Attrs& + attrs); + + static Attrs KeepDims(bool x) { + return Attrs().KeepDims(x); + } + + Operation operation; + ::tensorflow::Output output_indices; + ::tensorflow::Output output_values; + ::tensorflow::Output output_shape; +}; + +/// Reorders a SparseTensor into the canonical, row-major ordering. +/// +/// Note that by convention, all sparse ops preserve the canonical ordering along +/// increasing dimension number. The only time ordering can be violated is during +/// manual manipulation of the indices and values vectors to add entries. +/// +/// Reordering does not affect the shape of the SparseTensor. +/// +/// If the tensor has rank `R` and `N` non-empty values, `input_indices` has +/// shape `[N, R]`, input_values has length `N`, and input_shape has length `R`. +/// +/// Args: +/// * scope: A Scope object +/// * input_indices: 2-D. `N x R` matrix with the indices of non-empty values in a +/// SparseTensor, possibly not in canonical ordering. +/// * input_values: 1-D. `N` non-empty values corresponding to `input_indices`. +/// * input_shape: 1-D. Shape of the input SparseTensor. +/// +/// Returns: +/// * `Output` output_indices: 2-D. `N x R` matrix with the same indices as input_indices, but +/// in canonical row-major ordering. +/// * `Output` output_values: 1-D. `N` non-empty values corresponding to `output_indices`. +class SparseReorder { + public: + SparseReorder(const ::tensorflow::Scope& scope, ::tensorflow::Input + input_indices, ::tensorflow::Input input_values, + ::tensorflow::Input input_shape); + + Operation operation; + ::tensorflow::Output output_indices; + ::tensorflow::Output output_values; +}; + +/// Reshapes a SparseTensor to represent values in a new dense shape. +/// +/// This operation has the same semantics as reshape on the represented dense +/// tensor. The `input_indices` are recomputed based on the requested `new_shape`. +/// +/// If one component of `new_shape` is the special value -1, the size of that +/// dimension is computed so that the total dense size remains constant. At +/// most one component of `new_shape` can be -1. The number of dense elements +/// implied by `new_shape` must be the same as the number of dense elements +/// originally implied by `input_shape`. +/// +/// Reshaping does not affect the order of values in the SparseTensor. +/// +/// If the input tensor has rank `R_in` and `N` non-empty values, and `new_shape` +/// has length `R_out`, then `input_indices` has shape `[N, R_in]`, +/// `input_shape` has length `R_in`, `output_indices` has shape `[N, R_out]`, and +/// `output_shape` has length `R_out`. +/// +/// Args: +/// * scope: A Scope object +/// * input_indices: 2-D. `N x R_in` matrix with the indices of non-empty values in a +/// SparseTensor. +/// * input_shape: 1-D. `R_in` vector with the input SparseTensor's dense shape. +/// * new_shape: 1-D. `R_out` vector with the requested new dense shape. +/// +/// Returns: +/// * `Output` output_indices: 2-D. `N x R_out` matrix with the updated indices of non-empty +/// values in the output SparseTensor. +/// * `Output` output_shape: 1-D. `R_out` vector with the full dense shape of the output +/// SparseTensor. This is the same as `new_shape` but with any -1 dimensions +/// filled in. +class SparseReshape { + public: + SparseReshape(const ::tensorflow::Scope& scope, ::tensorflow::Input + input_indices, ::tensorflow::Input input_shape, + ::tensorflow::Input new_shape); + + Operation operation; + ::tensorflow::Output output_indices; + ::tensorflow::Output output_shape; +}; + +/// Slice a `SparseTensor` based on the `start` and `size`. +/// +/// For example, if the input is +/// +/// input_tensor = shape = [2, 7] +/// [ a d e ] +/// [b c ] +/// +/// Graphically the output tensors are: +/// +/// sparse_slice([0, 0], [2, 4]) = shape = [2, 4] +/// [ a ] +/// [b c ] +/// +/// sparse_slice([0, 4], [2, 3]) = shape = [2, 3] +/// [ d e ] +/// [ ] +/// +/// Args: +/// * scope: A Scope object +/// * indices: 2-D tensor represents the indices of the sparse tensor. +/// * values: 1-D tensor represents the values of the sparse tensor. +/// * shape: 1-D. tensor represents the shape of the sparse tensor. +/// * start: 1-D. tensor represents the start of the slice. +/// * size: 1-D. tensor represents the size of the slice. +/// output indices: A list of 1-D tensors represents the indices of the output +/// sparse tensors. +/// +/// Returns: +/// * `Output` output_indices +/// * `Output` output_values: A list of 1-D tensors represents the values of the output sparse +/// tensors. +/// * `Output` output_shape: A list of 1-D tensors represents the shape of the output sparse +/// tensors. +class SparseSlice { + public: + SparseSlice(const ::tensorflow::Scope& scope, ::tensorflow::Input indices, + ::tensorflow::Input values, ::tensorflow::Input shape, + ::tensorflow::Input start, ::tensorflow::Input size); + + Operation operation; + ::tensorflow::Output output_indices; + ::tensorflow::Output output_values; + ::tensorflow::Output output_shape; +}; + +/// The gradient operator for the SparseSlice op. +/// +/// This op takes in the upstream gradient w.r.t. non-empty values of +/// the sliced `SparseTensor`, and outputs the gradients w.r.t. +/// the non-empty values of input `SparseTensor`. +/// +/// Args: +/// * scope: A Scope object +/// * backprop_val_grad: 1-D. The gradient with respect to +/// the non-empty values of the sliced `SparseTensor`. +/// * input_indices: 2-D. The `indices` of the input `SparseTensor`. +/// * input_start: 1-D. tensor represents the start of the slice. +/// * output_indices: 2-D. The `indices` of the sliced `SparseTensor`. +/// +/// Returns: +/// * `Output`: 1-D. The gradient with respect to the non-empty values of input `SparseTensor`. +class SparseSliceGrad { + public: + SparseSliceGrad(const ::tensorflow::Scope& scope, ::tensorflow::Input + backprop_val_grad, ::tensorflow::Input input_indices, + ::tensorflow::Input input_start, ::tensorflow::Input + output_indices); + operator ::tensorflow::Output() const { return val_grad; } + operator ::tensorflow::Input() const { return val_grad; } + ::tensorflow::Node* node() const { return val_grad.node(); } + + Operation operation; + ::tensorflow::Output val_grad; +}; + +/// Applies softmax to a batched N-D `SparseTensor`. +/// +/// The inputs represent an N-D SparseTensor with logical shape `[..., B, C]` +/// (where `N >= 2`), and with indices sorted in the canonical lexicographic order. +/// +/// This op is equivalent to applying the normal `tf.nn.softmax()` to each innermost +/// logical submatrix with shape `[B, C]`, but with the catch that *the implicitly +/// zero elements do not participate*. Specifically, the algorithm is equivalent +/// to the following: +/// +/// (1) Applies `tf.nn.softmax()` to a densified view of each innermost submatrix +/// with shape `[B, C]`, along the size-C dimension; +/// (2) Masks out the original implicitly-zero locations; +/// (3) Renormalizes the remaining elements. +/// +/// Hence, the `SparseTensor` result has exactly the same non-zero indices and +/// shape. +/// +/// Args: +/// * scope: A Scope object +/// * sp_indices: 2-D. `NNZ x R` matrix with the indices of non-empty values in a +/// SparseTensor, in canonical ordering. +/// * sp_values: 1-D. `NNZ` non-empty values corresponding to `sp_indices`. +/// * sp_shape: 1-D. Shape of the input SparseTensor. +/// +/// Returns: +/// * `Output`: 1-D. The `NNZ` values for the result `SparseTensor`. +class SparseSoftmax { + public: + SparseSoftmax(const ::tensorflow::Scope& scope, ::tensorflow::Input sp_indices, + ::tensorflow::Input sp_values, ::tensorflow::Input sp_shape); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + Operation operation; + ::tensorflow::Output output; +}; + +/// Returns the element-wise max of two SparseTensors. +/// +/// Assumes the two SparseTensors have the same shape, i.e., no broadcasting. +/// +/// Args: +/// * scope: A Scope object +/// * a_indices: 2-D. `N x R` matrix with the indices of non-empty values in a +/// SparseTensor, in the canonical lexicographic ordering. +/// * a_values: 1-D. `N` non-empty values corresponding to `a_indices`. +/// * a_shape: 1-D. Shape of the input SparseTensor. +/// * b_indices: counterpart to `a_indices` for the other operand. +/// * b_values: counterpart to `a_values` for the other operand; must be of the same dtype. +/// * b_shape: counterpart to `a_shape` for the other operand; the two shapes must be equal. +/// +/// Returns: +/// * `Output` output_indices: 2-D. The indices of the output SparseTensor. +/// * `Output` output_values: 1-D. The values of the output SparseTensor. +class SparseSparseMaximum { + public: + SparseSparseMaximum(const ::tensorflow::Scope& scope, ::tensorflow::Input + a_indices, ::tensorflow::Input a_values, + ::tensorflow::Input a_shape, ::tensorflow::Input b_indices, + ::tensorflow::Input b_values, ::tensorflow::Input b_shape); + + Operation operation; + ::tensorflow::Output output_indices; + ::tensorflow::Output output_values; +}; + +/// Returns the element-wise min of two SparseTensors. +/// +/// Assumes the two SparseTensors have the same shape, i.e., no broadcasting. +/// +/// Args: +/// * scope: A Scope object +/// * a_indices: 2-D. `N x R` matrix with the indices of non-empty values in a +/// SparseTensor, in the canonical lexicographic ordering. +/// * a_values: 1-D. `N` non-empty values corresponding to `a_indices`. +/// * a_shape: 1-D. Shape of the input SparseTensor. +/// * b_indices: counterpart to `a_indices` for the other operand. +/// * b_values: counterpart to `a_values` for the other operand; must be of the same dtype. +/// * b_shape: counterpart to `a_shape` for the other operand; the two shapes must be equal. +/// +/// Returns: +/// * `Output` output_indices: 2-D. The indices of the output SparseTensor. +/// * `Output` output_values: 1-D. The values of the output SparseTensor. +class SparseSparseMinimum { + public: + SparseSparseMinimum(const ::tensorflow::Scope& scope, ::tensorflow::Input + a_indices, ::tensorflow::Input a_values, + ::tensorflow::Input a_shape, ::tensorflow::Input b_indices, + ::tensorflow::Input b_values, ::tensorflow::Input b_shape); + + Operation operation; + ::tensorflow::Output output_indices; + ::tensorflow::Output output_values; +}; + +/// Split a `SparseTensor` into `num_split` tensors along one dimension. +/// +/// If the `shape[split_dim]` is not an integer multiple of `num_split`. Slices +/// `[0 : shape[split_dim] % num_split]` gets one extra dimension. +/// For example, if `split_dim = 1` and `num_split = 2` and the input is +/// +/// input_tensor = shape = [2, 7] +/// [ a d e ] +/// [b c ] +/// +/// Graphically the output tensors are: +/// +/// output_tensor[0] = shape = [2, 4] +/// [ a ] +/// [b c ] +/// +/// output_tensor[1] = shape = [2, 3] +/// [ d e ] +/// [ ] +/// +/// Args: +/// * scope: A Scope object +/// * split_dim: 0-D. The dimension along which to split. Must be in the range +/// `[0, rank(shape))`. +/// * indices: 2-D tensor represents the indices of the sparse tensor. +/// * values: 1-D tensor represents the values of the sparse tensor. +/// * shape: 1-D. tensor represents the shape of the sparse tensor. +/// output indices: A list of 1-D tensors represents the indices of the output +/// sparse tensors. +/// * num_split: The number of ways to split. +/// +/// Returns: +/// * `OutputList` output_indices +/// * `OutputList` output_values: A list of 1-D tensors represents the values of the output sparse +/// tensors. +/// * `OutputList` output_shape: A list of 1-D tensors represents the shape of the output sparse +/// tensors. +class SparseSplit { + public: + SparseSplit(const ::tensorflow::Scope& scope, ::tensorflow::Input split_dim, + ::tensorflow::Input indices, ::tensorflow::Input values, + ::tensorflow::Input shape, int64 num_split); + + Operation operation; + ::tensorflow::OutputList output_indices; + ::tensorflow::OutputList output_values; + ::tensorflow::OutputList output_shape; +}; + +/// Adds up a `SparseTensor` and a dense `Tensor`, producing a dense `Tensor`. +/// +/// This Op does not require `a_indices` be sorted in standard lexicographic order. +/// +/// Args: +/// * scope: A Scope object +/// * a_indices: 2-D. The `indices` of the `SparseTensor`, with shape `[nnz, ndims]`. +/// * a_values: 1-D. The `values` of the `SparseTensor`, with shape `[nnz]`. +/// * a_shape: 1-D. The `shape` of the `SparseTensor`, with shape `[ndims]`. +/// * b: `ndims`-D Tensor. With shape `a_shape`. +/// +/// Returns: +/// * `Output`: The output tensor. +class SparseTensorDenseAdd { + public: + SparseTensorDenseAdd(const ::tensorflow::Scope& scope, ::tensorflow::Input + a_indices, ::tensorflow::Input a_values, + ::tensorflow::Input a_shape, ::tensorflow::Input b); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + Operation operation; + ::tensorflow::Output output; +}; + +/// Multiply SparseTensor (of rank 2) "A" by dense matrix "B". +/// +/// No validity checking is performed on the indices of A. However, the following +/// input format is recommended for optimal behavior: +/// +/// if adjoint_a == false: +/// A should be sorted in lexicographically increasing order. Use SparseReorder +/// if you're not sure. +/// if adjoint_a == true: +/// A should be sorted in order of increasing dimension 1 (i.e., "column major" +/// order instead of "row major" order). +/// +/// Args: +/// * scope: A Scope object +/// * a_indices: 2-D. The `indices` of the `SparseTensor`, size `[nnz, 2]` Matrix. +/// * a_values: 1-D. The `values` of the `SparseTensor`, size `[nnz]` Vector. +/// * a_shape: 1-D. The `shape` of the `SparseTensor`, size `[2]` Vector. +/// * b: 2-D. A dense Matrix. +/// +/// Optional attributes (see `Attrs`): +/// * adjoint_a: Use the adjoint of A in the matrix multiply. If A is complex, this +/// is transpose(conj(A)). Otherwise it's transpose(A). +/// * adjoint_b: Use the adjoint of B in the matrix multiply. If B is complex, this +/// is transpose(conj(B)). Otherwise it's transpose(B). +/// +/// Returns: +/// * `Output`: The product tensor. +class SparseTensorDenseMatMul { + public: + /// Optional attribute setters for SparseTensorDenseMatMul + struct Attrs { + /// Use the adjoint of A in the matrix multiply. If A is complex, this + /// is transpose(conj(A)). Otherwise it's transpose(A). + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs AdjointA(bool x) { + Attrs ret = *this; + ret.adjoint_a_ = x; + return ret; + } + + /// Use the adjoint of B in the matrix multiply. If B is complex, this + /// is transpose(conj(B)). Otherwise it's transpose(B). + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs AdjointB(bool x) { + Attrs ret = *this; + ret.adjoint_b_ = x; + return ret; + } + + bool adjoint_a_ = false; + bool adjoint_b_ = false; + }; + SparseTensorDenseMatMul(const ::tensorflow::Scope& scope, ::tensorflow::Input + a_indices, ::tensorflow::Input a_values, + ::tensorflow::Input a_shape, ::tensorflow::Input b); + SparseTensorDenseMatMul(const ::tensorflow::Scope& scope, ::tensorflow::Input + a_indices, ::tensorflow::Input a_values, + ::tensorflow::Input a_shape, ::tensorflow::Input b, + const SparseTensorDenseMatMul::Attrs& attrs); + operator ::tensorflow::Output() const { return product; } + operator ::tensorflow::Input() const { return product; } + ::tensorflow::Node* node() const { return product.node(); } + + static Attrs AdjointA(bool x) { + return Attrs().AdjointA(x); + } + static Attrs AdjointB(bool x) { + return Attrs().AdjointB(x); + } + + Operation operation; + ::tensorflow::Output product; +}; + +/// Converts a sparse representation into a dense tensor. +/// +/// Builds an array `dense` with shape `output_shape` such that +/// +/// ``` +/// # If sparse_indices is scalar +/// dense[i] = (i == sparse_indices ? sparse_values : default_value) +/// +/// # If sparse_indices is a vector, then for each i +/// dense[sparse_indices[i]] = sparse_values[i] +/// +/// # If sparse_indices is an n by d matrix, then for each i in [0, n) +/// dense[sparse_indices[i][0], ..., sparse_indices[i][d-1]] = sparse_values[i] +/// ``` +/// +/// All other values in `dense` are set to `default_value`. If `sparse_values` is a +/// scalar, all sparse indices are set to this single value. +/// +/// Indices should be sorted in lexicographic order, and indices must not +/// contain any repeats. If `validate_indices` is true, these properties +/// are checked during execution. +/// +/// Args: +/// * scope: A Scope object +/// * sparse_indices: 0-D, 1-D, or 2-D. `sparse_indices[i]` contains the complete +/// index where `sparse_values[i]` will be placed. +/// * output_shape: 1-D. Shape of the dense output tensor. +/// * sparse_values: 1-D. Values corresponding to each row of `sparse_indices`, +/// or a scalar value to be used for all sparse indices. +/// * default_value: Scalar value to set for indices not specified in +/// `sparse_indices`. +/// +/// Optional attributes (see `Attrs`): +/// * validate_indices: If true, indices are checked to make sure they are sorted in +/// lexicographic order and that there are no repeats. +/// +/// Returns: +/// * `Output`: Dense output tensor of shape `output_shape`. +class SparseToDense { + public: + /// Optional attribute setters for SparseToDense + struct Attrs { + /// If true, indices are checked to make sure they are sorted in + /// lexicographic order and that there are no repeats. + /// + /// Defaults to true + TF_MUST_USE_RESULT Attrs ValidateIndices(bool x) { + Attrs ret = *this; + ret.validate_indices_ = x; + return ret; + } + + bool validate_indices_ = true; + }; + SparseToDense(const ::tensorflow::Scope& scope, ::tensorflow::Input + sparse_indices, ::tensorflow::Input output_shape, + ::tensorflow::Input sparse_values, ::tensorflow::Input + default_value); + SparseToDense(const ::tensorflow::Scope& scope, ::tensorflow::Input + sparse_indices, ::tensorflow::Input output_shape, + ::tensorflow::Input sparse_values, ::tensorflow::Input + default_value, const SparseToDense::Attrs& attrs); + operator ::tensorflow::Output() const { return dense; } + operator ::tensorflow::Input() const { return dense; } + ::tensorflow::Node* node() const { return dense.node(); } + + static Attrs ValidateIndices(bool x) { + return Attrs().ValidateIndices(x); + } + + Operation operation; + ::tensorflow::Output dense; +}; + +/// Read `SparseTensors` from a `SparseTensorsMap` and concatenate them. +/// +/// The input `sparse_handles` must be an `int64` matrix of shape `[N, 1]` where +/// `N` is the minibatch size and the rows correspond to the output handles of +/// `AddSparseToTensorsMap` or `AddManySparseToTensorsMap`. The ranks of the +/// original `SparseTensor` objects that went into the given input ops must all +/// match. When the final `SparseTensor` is created, it has rank one +/// higher than the ranks of the incoming `SparseTensor` objects +/// (they have been concatenated along a new row dimension on the left). +/// +/// The output `SparseTensor` object's shape values for all dimensions but the +/// first are the max across the input `SparseTensor` objects' shape values +/// for the corresponding dimensions. Its first shape value is `N`, the minibatch +/// size. +/// +/// The input `SparseTensor` objects' indices are assumed ordered in +/// standard lexicographic order. If this is not the case, after this +/// step run `SparseReorder` to restore index ordering. +/// +/// For example, if the handles represent an input, which is a `[2, 3]` matrix +/// representing two original `SparseTensor` objects: +/// +/// ``` +/// index = [ 0] +/// [10] +/// [20] +/// values = [1, 2, 3] +/// shape = [50] +/// ``` +/// +/// and +/// +/// ``` +/// index = [ 2] +/// [10] +/// values = [4, 5] +/// shape = [30] +/// ``` +/// +/// then the final `SparseTensor` will be: +/// +/// ``` +/// index = [0 0] +/// [0 10] +/// [0 20] +/// [1 2] +/// [1 10] +/// values = [1, 2, 3, 4, 5] +/// shape = [2 50] +/// ``` +/// +/// Args: +/// * scope: A Scope object +/// * sparse_handles: 1-D, The `N` serialized `SparseTensor` objects. +/// Shape: `[N]`. +/// * dtype: The `dtype` of the `SparseTensor` objects stored in the +/// `SparseTensorsMap`. +/// +/// Optional attributes (see `Attrs`): +/// * container: The container name for the `SparseTensorsMap` read by this op. +/// * shared_name: The shared name for the `SparseTensorsMap` read by this op. +/// It should not be blank; rather the `shared_name` or unique Operation name +/// of the Op that created the original `SparseTensorsMap` should be used. +/// +/// Returns: +/// * `Output` sparse_indices: 2-D. The `indices` of the minibatch `SparseTensor`. +/// * `Output` sparse_values: 1-D. The `values` of the minibatch `SparseTensor`. +/// * `Output` sparse_shape: 1-D. The `shape` of the minibatch `SparseTensor`. +class TakeManySparseFromTensorsMap { + public: + /// Optional attribute setters for TakeManySparseFromTensorsMap + struct Attrs { + /// The container name for the `SparseTensorsMap` read by this op. + /// + /// Defaults to "" + TF_MUST_USE_RESULT Attrs Container(StringPiece x) { + Attrs ret = *this; + ret.container_ = x; + return ret; + } + + /// The shared name for the `SparseTensorsMap` read by this op. + /// It should not be blank; rather the `shared_name` or unique Operation name + /// of the Op that created the original `SparseTensorsMap` should be used. + /// + /// Defaults to "" + TF_MUST_USE_RESULT Attrs SharedName(StringPiece x) { + Attrs ret = *this; + ret.shared_name_ = x; + return ret; + } + + StringPiece container_ = ""; + StringPiece shared_name_ = ""; + }; + TakeManySparseFromTensorsMap(const ::tensorflow::Scope& scope, + ::tensorflow::Input sparse_handles, DataType + dtype); + TakeManySparseFromTensorsMap(const ::tensorflow::Scope& scope, + ::tensorflow::Input sparse_handles, DataType + dtype, const TakeManySparseFromTensorsMap::Attrs& + attrs); + + static Attrs Container(StringPiece x) { + return Attrs().Container(x); + } + static Attrs SharedName(StringPiece x) { + return Attrs().SharedName(x); + } + + Operation operation; + ::tensorflow::Output sparse_indices; + ::tensorflow::Output sparse_values; + ::tensorflow::Output sparse_shape; +}; + +/// @} + +} // namespace ops +} // namespace tensorflow + +#endif // TENSORFLOW_CC_OPS_SPARSE_OPS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/ops/sparse_ops_internal.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/ops/sparse_ops_internal.h new file mode 100644 index 0000000000000000000000000000000000000000..0015a85c5e60d47f8dcc670d0a1e016f002df180 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/ops/sparse_ops_internal.h @@ -0,0 +1,28 @@ +// This file is MACHINE GENERATED! Do not edit. + +#ifndef TENSORFLOW_CC_OPS_SPARSE_OPS_INTERNAL_H_ +#define TENSORFLOW_CC_OPS_SPARSE_OPS_INTERNAL_H_ + +// This file is MACHINE GENERATED! Do not edit. + +#include "tensorflow/cc/framework/ops.h" +#include "tensorflow/cc/framework/scope.h" +#include "tensorflow/core/framework/tensor.h" +#include "tensorflow/core/framework/tensor_shape.h" +#include "tensorflow/core/framework/types.h" +#include "tensorflow/core/lib/gtl/array_slice.h" + +namespace tensorflow { +namespace ops { +namespace internal { +// NOTE: This namespace has internal TensorFlow details that +// are not part of TensorFlow's public API. + +/// @defgroup sparse_ops_internal Sparse Ops Internal +/// @{ + +} // namespace internal +} // namespace ops +} // namespace tensorflow + +#endif // TENSORFLOW_CC_OPS_SPARSE_OPS_INTERNAL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/ops/standard_ops.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/ops/standard_ops.h new file mode 100644 index 0000000000000000000000000000000000000000..98f53010ecf78f769c7d89d6aafc48fdb772f42e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/ops/standard_ops.h @@ -0,0 +1,40 @@ +/* Copyright 2016 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_CC_OPS_STANDARD_OPS_H_ +#define TENSORFLOW_CC_OPS_STANDARD_OPS_H_ + +#include "tensorflow/cc/ops/array_ops.h" +#include "tensorflow/cc/ops/candidate_sampling_ops.h" +#include "tensorflow/cc/ops/const_op.h" +#include "tensorflow/cc/ops/control_flow_ops.h" +#include "tensorflow/cc/ops/data_flow_ops.h" +#include "tensorflow/cc/ops/image_ops.h" +#include "tensorflow/cc/ops/io_ops.h" +#include "tensorflow/cc/ops/linalg_ops.h" +#include "tensorflow/cc/ops/logging_ops.h" +#include "tensorflow/cc/ops/lookup_ops.h" +#include "tensorflow/cc/ops/math_ops.h" +#include "tensorflow/cc/ops/nn_ops.h" +#include "tensorflow/cc/ops/no_op.h" +#include "tensorflow/cc/ops/parsing_ops.h" +#include "tensorflow/cc/ops/random_ops.h" +#include "tensorflow/cc/ops/sparse_ops.h" +#include "tensorflow/cc/ops/state_ops.h" +#include "tensorflow/cc/ops/string_ops.h" +#include "tensorflow/cc/ops/training_ops.h" +#include "tensorflow/cc/ops/user_ops.h" + +#endif // TENSORFLOW_CC_OPS_STANDARD_OPS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/ops/state_ops.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/ops/state_ops.h new file mode 100644 index 0000000000000000000000000000000000000000..afdaec124e57e24d1d6703fed25c8d57a75eeca8 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/ops/state_ops.h @@ -0,0 +1,1519 @@ +// This file is MACHINE GENERATED! Do not edit. + +#ifndef TENSORFLOW_CC_OPS_STATE_OPS_H_ +#define TENSORFLOW_CC_OPS_STATE_OPS_H_ + +// This file is MACHINE GENERATED! Do not edit. + +#include "tensorflow/cc/framework/ops.h" +#include "tensorflow/cc/framework/scope.h" +#include "tensorflow/core/framework/tensor.h" +#include "tensorflow/core/framework/tensor_shape.h" +#include "tensorflow/core/framework/types.h" +#include "tensorflow/core/lib/gtl/array_slice.h" + +namespace tensorflow { +namespace ops { + +/// @defgroup state_ops State Ops +/// @{ + +/// Update 'ref' by assigning 'value' to it. +/// +/// This operation outputs "ref" after the assignment is done. +/// This makes it easier to chain operations that need to use the reset value. +/// +/// Args: +/// * scope: A Scope object +/// * ref: Should be from a `Variable` node. May be uninitialized. +/// * value: The value to be assigned to the variable. +/// +/// Optional attributes (see `Attrs`): +/// * validate_shape: If true, the operation will validate that the shape +/// of 'value' matches the shape of the Tensor being assigned to. If false, +/// 'ref' will take on the shape of 'value'. +/// * use_locking: If True, the assignment will be protected by a lock; +/// otherwise the behavior is undefined, but may exhibit less contention. +/// +/// Returns: +/// * `Output`: = Same as "ref". Returned as a convenience for operations that want +/// to use the new value after the variable has been reset. +class Assign { + public: + /// Optional attribute setters for Assign + struct Attrs { + /// If true, the operation will validate that the shape + /// of 'value' matches the shape of the Tensor being assigned to. If false, + /// 'ref' will take on the shape of 'value'. + /// + /// Defaults to true + TF_MUST_USE_RESULT Attrs ValidateShape(bool x) { + Attrs ret = *this; + ret.validate_shape_ = x; + return ret; + } + + /// If True, the assignment will be protected by a lock; + /// otherwise the behavior is undefined, but may exhibit less contention. + /// + /// Defaults to true + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + bool validate_shape_ = true; + bool use_locking_ = true; + }; + Assign(const ::tensorflow::Scope& scope, ::tensorflow::Input ref, + ::tensorflow::Input value); + Assign(const ::tensorflow::Scope& scope, ::tensorflow::Input ref, + ::tensorflow::Input value, const Assign::Attrs& attrs); + operator ::tensorflow::Output() const { return output_ref; } + operator ::tensorflow::Input() const { return output_ref; } + ::tensorflow::Node* node() const { return output_ref.node(); } + + static Attrs ValidateShape(bool x) { + return Attrs().ValidateShape(x); + } + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + + Operation operation; + ::tensorflow::Output output_ref; +}; + +/// Update 'ref' by adding 'value' to it. +/// +/// This operation outputs "ref" after the update is done. +/// This makes it easier to chain operations that need to use the reset value. +/// +/// Args: +/// * scope: A Scope object +/// * ref: Should be from a `Variable` node. +/// * value: The value to be added to the variable. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If True, the addition will be protected by a lock; +/// otherwise the behavior is undefined, but may exhibit less contention. +/// +/// Returns: +/// * `Output`: = Same as "ref". Returned as a convenience for operations that want +/// to use the new value after the variable has been updated. +class AssignAdd { + public: + /// Optional attribute setters for AssignAdd + struct Attrs { + /// If True, the addition will be protected by a lock; + /// otherwise the behavior is undefined, but may exhibit less contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + bool use_locking_ = false; + }; + AssignAdd(const ::tensorflow::Scope& scope, ::tensorflow::Input ref, + ::tensorflow::Input value); + AssignAdd(const ::tensorflow::Scope& scope, ::tensorflow::Input ref, + ::tensorflow::Input value, const AssignAdd::Attrs& attrs); + operator ::tensorflow::Output() const { return output_ref; } + operator ::tensorflow::Input() const { return output_ref; } + ::tensorflow::Node* node() const { return output_ref.node(); } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + + Operation operation; + ::tensorflow::Output output_ref; +}; + +/// Update 'ref' by subtracting 'value' from it. +/// +/// This operation outputs "ref" after the update is done. +/// This makes it easier to chain operations that need to use the reset value. +/// +/// Args: +/// * scope: A Scope object +/// * ref: Should be from a `Variable` node. +/// * value: The value to be subtracted to the variable. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If True, the subtraction will be protected by a lock; +/// otherwise the behavior is undefined, but may exhibit less contention. +/// +/// Returns: +/// * `Output`: = Same as "ref". Returned as a convenience for operations that want +/// to use the new value after the variable has been updated. +class AssignSub { + public: + /// Optional attribute setters for AssignSub + struct Attrs { + /// If True, the subtraction will be protected by a lock; + /// otherwise the behavior is undefined, but may exhibit less contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + bool use_locking_ = false; + }; + AssignSub(const ::tensorflow::Scope& scope, ::tensorflow::Input ref, + ::tensorflow::Input value); + AssignSub(const ::tensorflow::Scope& scope, ::tensorflow::Input ref, + ::tensorflow::Input value, const AssignSub::Attrs& attrs); + operator ::tensorflow::Output() const { return output_ref; } + operator ::tensorflow::Input() const { return output_ref; } + ::tensorflow::Node* node() const { return output_ref.node(); } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + + Operation operation; + ::tensorflow::Output output_ref; +}; + +/// Increments 'ref' until it reaches 'limit'. +/// +/// Args: +/// * scope: A Scope object +/// * ref: Should be from a scalar `Variable` node. +/// * limit: If incrementing ref would bring it above limit, instead generates an +/// 'OutOfRange' error. +/// +/// Returns: +/// * `Output`: A copy of the input before increment. If nothing else modifies the +/// input, the values produced will all be distinct. +class CountUpTo { + public: + CountUpTo(const ::tensorflow::Scope& scope, ::tensorflow::Input ref, int64 + limit); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + Operation operation; + ::tensorflow::Output output; +}; + +/// Destroys the temporary variable and returns its final value. +/// +/// Sets output to the value of the Tensor pointed to by 'ref', then destroys +/// the temporary variable called 'var_name'. +/// All other uses of 'ref' *must* have executed before this op. +/// This is typically achieved by chaining the ref through each assign op, or by +/// using control dependencies. +/// +/// Outputs the final value of the tensor pointed to by 'ref'. +/// +/// Args: +/// * scope: A Scope object +/// * ref: A reference to the temporary variable tensor. +/// * var_name: Name of the temporary variable, usually the name of the matching +/// 'TemporaryVariable' op. +/// +/// Returns: +/// * `Output`: The value tensor. +class DestroyTemporaryVariable { + public: + DestroyTemporaryVariable(const ::tensorflow::Scope& scope, ::tensorflow::Input + ref, StringPiece var_name); + operator ::tensorflow::Output() const { return value; } + operator ::tensorflow::Input() const { return value; } + ::tensorflow::Node* node() const { return value.node(); } + + Operation operation; + ::tensorflow::Output value; +}; + +/// Checks whether a tensor has been initialized. +/// +/// Outputs boolean scalar indicating whether the tensor has been initialized. +/// +/// Args: +/// * scope: A Scope object +/// * ref: Should be from a `Variable` node. May be uninitialized. +/// +/// Returns: +/// * `Output`: The is_initialized tensor. +class IsVariableInitialized { + public: + IsVariableInitialized(const ::tensorflow::Scope& scope, ::tensorflow::Input + ref); + operator ::tensorflow::Output() const { return is_initialized; } + operator ::tensorflow::Input() const { return is_initialized; } + ::tensorflow::Node* node() const { return is_initialized.node(); } + + Operation operation; + ::tensorflow::Output is_initialized; +}; + +/// Increments variable pointed to by 'resource' until it reaches 'limit'. +/// +/// Args: +/// * scope: A Scope object +/// * resource: Should be from a scalar `Variable` node. +/// * limit: If incrementing ref would bring it above limit, instead generates an +/// 'OutOfRange' error. +/// +/// Returns: +/// * `Output`: A copy of the input before increment. If nothing else modifies the +/// input, the values produced will all be distinct. +class ResourceCountUpTo { + public: + ResourceCountUpTo(const ::tensorflow::Scope& scope, ::tensorflow::Input + resource, int64 limit, DataType T); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + Operation operation; + ::tensorflow::Output output; +}; + +/// Applies sparse addition to individual values or slices in a Variable. +/// +/// `ref` is a `Tensor` with rank `P` and `indices` is a `Tensor` of rank `Q`. +/// +/// `indices` must be integer tensor, containing indices into `ref`. +/// It must be shape `[d_0, ..., d_{Q-2}, K]` where `0 < K <= P`. +/// +/// The innermost dimension of `indices` (with length `K`) corresponds to +/// indices into elements (if `K = P`) or slices (if `K < P`) along the `K`th +/// dimension of `ref`. +/// +/// `updates` is `Tensor` of rank `Q-1+P-K` with shape: +/// +/// ``` +/// [d_0, ..., d_{Q-2}, ref.shape[K], ..., ref.shape[P-1]] +/// ``` +/// +/// For example, say we want to add 4 scattered elements to a rank-1 tensor to +/// 8 elements. In Python, that addition would look like this: +/// +/// ```python +/// ref = tf.Variable([1, 2, 3, 4, 5, 6, 7, 8], use_resource=True) +/// indices = tf.constant([[4], [3], [1], [7]]) +/// updates = tf.constant([9, 10, 11, 12]) +/// add = tf.scatter_nd_add(ref, indices, updates) +/// with tf.Session() as sess: +/// print sess.run(add) +/// ``` +/// +/// The resulting update to ref would look like this: +/// +/// [1, 13, 3, 14, 14, 6, 7, 20] +/// +/// See `tf.scatter_nd` for more details about how to make updates to +/// slices. +/// +/// Args: +/// * scope: A Scope object +/// * ref: A resource handle. Must be from a VarHandleOp. +/// * indices: A Tensor. Must be one of the following types: int32, int64. +/// A tensor of indices into ref. +/// * updates: A Tensor. Must have the same type as ref. A tensor of +/// values to add to ref. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: An optional bool. Defaults to True. If True, the assignment will +/// be protected by a lock; otherwise the behavior is undefined, +/// but may exhibit less contention. +/// +/// Returns: +/// * the created `Operation` +class ResourceScatterNdAdd { + public: + /// Optional attribute setters for ResourceScatterNdAdd + struct Attrs { + /// An optional bool. Defaults to True. If True, the assignment will + /// be protected by a lock; otherwise the behavior is undefined, + /// but may exhibit less contention. + /// + /// Defaults to true + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + bool use_locking_ = true; + }; + ResourceScatterNdAdd(const ::tensorflow::Scope& scope, ::tensorflow::Input ref, + ::tensorflow::Input indices, ::tensorflow::Input updates); + ResourceScatterNdAdd(const ::tensorflow::Scope& scope, ::tensorflow::Input ref, + ::tensorflow::Input indices, ::tensorflow::Input updates, + const ResourceScatterNdAdd::Attrs& attrs); + operator ::tensorflow::Operation() const { return operation; } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + + Operation operation; +}; + +/// TODO: add doc. +/// +/// Args: +/// * scope: A Scope object +/// * ref: A resource handle. Must be from a VarHandleOp. +/// * indices: A Tensor. Must be one of the following types: int32, int64. +/// A tensor of indices into ref. +/// * updates: A Tensor. Must have the same type as ref. A tensor of +/// values whose element wise max is taken with ref +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: An optional bool. Defaults to True. If True, the assignment will +/// be protected by a lock; otherwise the behavior is undefined, +/// but may exhibit less contention. +/// +/// Returns: +/// * the created `Operation` +class ResourceScatterNdMax { + public: + /// Optional attribute setters for ResourceScatterNdMax + struct Attrs { + /// An optional bool. Defaults to True. If True, the assignment will + /// be protected by a lock; otherwise the behavior is undefined, + /// but may exhibit less contention. + /// + /// Defaults to true + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + bool use_locking_ = true; + }; + ResourceScatterNdMax(const ::tensorflow::Scope& scope, ::tensorflow::Input ref, + ::tensorflow::Input indices, ::tensorflow::Input updates); + ResourceScatterNdMax(const ::tensorflow::Scope& scope, ::tensorflow::Input ref, + ::tensorflow::Input indices, ::tensorflow::Input updates, + const ResourceScatterNdMax::Attrs& attrs); + operator ::tensorflow::Operation() const { return operation; } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + + Operation operation; +}; + +/// TODO: add doc. +/// +/// Args: +/// * scope: A Scope object +/// * ref: A resource handle. Must be from a VarHandleOp. +/// * indices: A Tensor. Must be one of the following types: int32, int64. +/// A tensor of indices into ref. +/// * updates: A Tensor. Must have the same type as ref. A tensor of +/// values whose element wise min is taken with ref. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: An optional bool. Defaults to True. If True, the assignment will +/// be protected by a lock; otherwise the behavior is undefined, +/// but may exhibit less contention. +/// +/// Returns: +/// * the created `Operation` +class ResourceScatterNdMin { + public: + /// Optional attribute setters for ResourceScatterNdMin + struct Attrs { + /// An optional bool. Defaults to True. If True, the assignment will + /// be protected by a lock; otherwise the behavior is undefined, + /// but may exhibit less contention. + /// + /// Defaults to true + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + bool use_locking_ = true; + }; + ResourceScatterNdMin(const ::tensorflow::Scope& scope, ::tensorflow::Input ref, + ::tensorflow::Input indices, ::tensorflow::Input updates); + ResourceScatterNdMin(const ::tensorflow::Scope& scope, ::tensorflow::Input ref, + ::tensorflow::Input indices, ::tensorflow::Input updates, + const ResourceScatterNdMin::Attrs& attrs); + operator ::tensorflow::Operation() const { return operation; } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + + Operation operation; +}; + +/// Applies sparse subtraction to individual values or slices in a Variable. +/// +/// `ref` is a `Tensor` with rank `P` and `indices` is a `Tensor` of rank `Q`. +/// +/// `indices` must be integer tensor, containing indices into `ref`. +/// It must be shape `[d_0, ..., d_{Q-2}, K]` where `0 < K <= P`. +/// +/// The innermost dimension of `indices` (with length `K`) corresponds to +/// indices into elements (if `K = P`) or slices (if `K < P`) along the `K`th +/// dimension of `ref`. +/// +/// `updates` is `Tensor` of rank `Q-1+P-K` with shape: +/// +/// ``` +/// [d_0, ..., d_{Q-2}, ref.shape[K], ..., ref.shape[P-1]] +/// ``` +/// +/// For example, say we want to subtract 4 scattered elements from a rank-1 tensor +/// with 8 elements. In Python, that subtraction would look like this: +/// +/// ```python +/// ref = tf.Variable([1, 2, 3, 4, 5, 6, 7, 8], use_resource=True) +/// indices = tf.constant([[4], [3], [1], [7]]) +/// updates = tf.constant([9, 10, 11, 12]) +/// sub = tf.scatter_nd_sub(ref, indices, updates) +/// with tf.Session() as sess: +/// print sess.run(sub) +/// ``` +/// +/// The resulting update to ref would look like this: +/// +/// [1, -9, 3, -6, -4, 6, 7, -4] +/// +/// See `tf.scatter_nd` for more details about how to make updates to +/// slices. +/// +/// Args: +/// * scope: A Scope object +/// * ref: A resource handle. Must be from a VarHandleOp. +/// * indices: A Tensor. Must be one of the following types: int32, int64. +/// A tensor of indices into ref. +/// * updates: A Tensor. Must have the same type as ref. A tensor of +/// values to add to ref. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: An optional bool. Defaults to True. If True, the assignment will +/// be protected by a lock; otherwise the behavior is undefined, +/// but may exhibit less contention. +/// +/// Returns: +/// * the created `Operation` +class ResourceScatterNdSub { + public: + /// Optional attribute setters for ResourceScatterNdSub + struct Attrs { + /// An optional bool. Defaults to True. If True, the assignment will + /// be protected by a lock; otherwise the behavior is undefined, + /// but may exhibit less contention. + /// + /// Defaults to true + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + bool use_locking_ = true; + }; + ResourceScatterNdSub(const ::tensorflow::Scope& scope, ::tensorflow::Input ref, + ::tensorflow::Input indices, ::tensorflow::Input updates); + ResourceScatterNdSub(const ::tensorflow::Scope& scope, ::tensorflow::Input ref, + ::tensorflow::Input indices, ::tensorflow::Input updates, + const ResourceScatterNdSub::Attrs& attrs); + operator ::tensorflow::Operation() const { return operation; } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + + Operation operation; +}; + +/// Applies sparse `updates` to individual values or slices within a given +/// +/// variable according to `indices`. +/// +/// `ref` is a `Tensor` with rank `P` and `indices` is a `Tensor` of rank `Q`. +/// +/// `indices` must be integer tensor, containing indices into `ref`. +/// It must be shape `[d_0, ..., d_{Q-2}, K]` where `0 < K <= P`. +/// +/// The innermost dimension of `indices` (with length `K`) corresponds to +/// indices into elements (if `K = P`) or slices (if `K < P`) along the `K`th +/// dimension of `ref`. +/// +/// `updates` is `Tensor` of rank `Q-1+P-K` with shape: +/// +/// ``` +/// [d_0, ..., d_{Q-2}, ref.shape[K], ..., ref.shape[P-1]]. +/// ``` +/// +/// For example, say we want to update 4 scattered elements to a rank-1 tensor to +/// 8 elements. In Python, that update would look like this: +/// +/// ```python +/// ref = tf.Variable([1, 2, 3, 4, 5, 6, 7, 8]) +/// indices = tf.constant([[4], [3], [1] ,[7]]) +/// updates = tf.constant([9, 10, 11, 12]) +/// update = tf.scatter_nd_update(ref, indices, updates) +/// with tf.Session() as sess: +/// print sess.run(update) +/// ``` +/// +/// The resulting update to ref would look like this: +/// +/// [1, 11, 3, 10, 9, 6, 7, 12] +/// +/// See `tf.scatter_nd` for more details about how to make updates to +/// slices. +/// +/// Args: +/// * scope: A Scope object +/// * ref: A resource handle. Must be from a VarHandleOp. +/// * indices: A Tensor. Must be one of the following types: int32, int64. +/// A tensor of indices into ref. +/// * updates: A Tensor. Must have the same type as ref. A tensor of updated +/// values to add to ref. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: An optional bool. Defaults to True. If True, the assignment will +/// be protected by a lock; otherwise the behavior is undefined, +/// but may exhibit less contention. +/// +/// Returns: +/// * the created `Operation` +class ResourceScatterNdUpdate { + public: + /// Optional attribute setters for ResourceScatterNdUpdate + struct Attrs { + /// An optional bool. Defaults to True. If True, the assignment will + /// be protected by a lock; otherwise the behavior is undefined, + /// but may exhibit less contention. + /// + /// Defaults to true + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + bool use_locking_ = true; + }; + ResourceScatterNdUpdate(const ::tensorflow::Scope& scope, ::tensorflow::Input + ref, ::tensorflow::Input indices, ::tensorflow::Input + updates); + ResourceScatterNdUpdate(const ::tensorflow::Scope& scope, ::tensorflow::Input + ref, ::tensorflow::Input indices, ::tensorflow::Input + updates, const ResourceScatterNdUpdate::Attrs& attrs); + operator ::tensorflow::Operation() const { return operation; } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + + Operation operation; +}; + +/// Adds sparse updates to a variable reference. +/// +/// This operation computes +/// +/// # Scalar indices +/// ref[indices, ...] += updates[...] +/// +/// # Vector indices (for each i) +/// ref[indices[i], ...] += updates[i, ...] +/// +/// # High rank indices (for each i, ..., j) +/// ref[indices[i, ..., j], ...] += updates[i, ..., j, ...] +/// +/// This operation outputs `ref` after the update is done. +/// This makes it easier to chain operations that need to use the reset value. +/// +/// Duplicate entries are handled correctly: if multiple `indices` reference +/// the same location, their contributions add. +/// +/// Requires `updates.shape = indices.shape + ref.shape[1:]` or `updates.shape = []`. +/// +///
+/// +///
+/// +/// Args: +/// * scope: A Scope object +/// * ref: Should be from a `Variable` node. +/// * indices: A tensor of indices into the first dimension of `ref`. +/// * updates: A tensor of updated values to add to `ref`. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If True, the addition will be protected by a lock; +/// otherwise the behavior is undefined, but may exhibit less contention. +/// +/// Returns: +/// * `Output`: = Same as `ref`. Returned as a convenience for operations that want +/// to use the updated values after the update is done. +class ScatterAdd { + public: + /// Optional attribute setters for ScatterAdd + struct Attrs { + /// If True, the addition will be protected by a lock; + /// otherwise the behavior is undefined, but may exhibit less contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + bool use_locking_ = false; + }; + ScatterAdd(const ::tensorflow::Scope& scope, ::tensorflow::Input ref, + ::tensorflow::Input indices, ::tensorflow::Input updates); + ScatterAdd(const ::tensorflow::Scope& scope, ::tensorflow::Input ref, + ::tensorflow::Input indices, ::tensorflow::Input updates, const + ScatterAdd::Attrs& attrs); + operator ::tensorflow::Output() const { return output_ref; } + operator ::tensorflow::Input() const { return output_ref; } + ::tensorflow::Node* node() const { return output_ref.node(); } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + + Operation operation; + ::tensorflow::Output output_ref; +}; + +/// Divides a variable reference by sparse updates. +/// +/// This operation computes +/// +/// ```python +/// # Scalar indices +/// ref[indices, ...] /= updates[...] +/// +/// # Vector indices (for each i) +/// ref[indices[i], ...] /= updates[i, ...] +/// +/// # High rank indices (for each i, ..., j) +/// ref[indices[i, ..., j], ...] /= updates[i, ..., j, ...] +/// ``` +/// +/// This operation outputs `ref` after the update is done. +/// This makes it easier to chain operations that need to use the reset value. +/// +/// Duplicate entries are handled correctly: if multiple `indices` reference +/// the same location, their contributions divide. +/// +/// Requires `updates.shape = indices.shape + ref.shape[1:]` or `updates.shape = []`. +/// +/// Args: +/// * scope: A Scope object +/// * ref: Should be from a `Variable` node. +/// * indices: A tensor of indices into the first dimension of `ref`. +/// * updates: A tensor of values that `ref` is divided by. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If True, the operation will be protected by a lock; +/// otherwise the behavior is undefined, but may exhibit less contention. +/// +/// Returns: +/// * `Output`: = Same as `ref`. Returned as a convenience for operations that want +/// to use the updated values after the update is done. +class ScatterDiv { + public: + /// Optional attribute setters for ScatterDiv + struct Attrs { + /// If True, the operation will be protected by a lock; + /// otherwise the behavior is undefined, but may exhibit less contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + bool use_locking_ = false; + }; + ScatterDiv(const ::tensorflow::Scope& scope, ::tensorflow::Input ref, + ::tensorflow::Input indices, ::tensorflow::Input updates); + ScatterDiv(const ::tensorflow::Scope& scope, ::tensorflow::Input ref, + ::tensorflow::Input indices, ::tensorflow::Input updates, const + ScatterDiv::Attrs& attrs); + operator ::tensorflow::Output() const { return output_ref; } + operator ::tensorflow::Input() const { return output_ref; } + ::tensorflow::Node* node() const { return output_ref.node(); } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + + Operation operation; + ::tensorflow::Output output_ref; +}; + +/// Reduces sparse updates into a variable reference using the `max` operation. +/// +/// This operation computes +/// +/// # Scalar indices +/// ref[indices, ...] = max(ref[indices, ...], updates[...]) +/// +/// # Vector indices (for each i) +/// ref[indices[i], ...] = max(ref[indices[i], ...], updates[i, ...]) +/// +/// # High rank indices (for each i, ..., j) +/// ref[indices[i, ..., j], ...] = max(ref[indices[i, ..., j], ...], updates[i, ..., j, ...]) +/// +/// This operation outputs `ref` after the update is done. +/// This makes it easier to chain operations that need to use the reset value. +/// +/// Duplicate entries are handled correctly: if multiple `indices` reference +/// the same location, their contributions combine. +/// +/// Requires `updates.shape = indices.shape + ref.shape[1:]` or `updates.shape = []`. +/// +///
+/// +///
+/// +/// Args: +/// * scope: A Scope object +/// * ref: Should be from a `Variable` node. +/// * indices: A tensor of indices into the first dimension of `ref`. +/// * updates: A tensor of updated values to reduce into `ref`. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If True, the update will be protected by a lock; +/// otherwise the behavior is undefined, but may exhibit less contention. +/// +/// Returns: +/// * `Output`: = Same as `ref`. Returned as a convenience for operations that want +/// to use the updated values after the update is done. +class ScatterMax { + public: + /// Optional attribute setters for ScatterMax + struct Attrs { + /// If True, the update will be protected by a lock; + /// otherwise the behavior is undefined, but may exhibit less contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + bool use_locking_ = false; + }; + ScatterMax(const ::tensorflow::Scope& scope, ::tensorflow::Input ref, + ::tensorflow::Input indices, ::tensorflow::Input updates); + ScatterMax(const ::tensorflow::Scope& scope, ::tensorflow::Input ref, + ::tensorflow::Input indices, ::tensorflow::Input updates, const + ScatterMax::Attrs& attrs); + operator ::tensorflow::Output() const { return output_ref; } + operator ::tensorflow::Input() const { return output_ref; } + ::tensorflow::Node* node() const { return output_ref.node(); } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + + Operation operation; + ::tensorflow::Output output_ref; +}; + +/// Reduces sparse updates into a variable reference using the `min` operation. +/// +/// This operation computes +/// +/// # Scalar indices +/// ref[indices, ...] = min(ref[indices, ...], updates[...]) +/// +/// # Vector indices (for each i) +/// ref[indices[i], ...] = min(ref[indices[i], ...], updates[i, ...]) +/// +/// # High rank indices (for each i, ..., j) +/// ref[indices[i, ..., j], ...] = min(ref[indices[i, ..., j], ...], updates[i, ..., j, ...]) +/// +/// This operation outputs `ref` after the update is done. +/// This makes it easier to chain operations that need to use the reset value. +/// +/// Duplicate entries are handled correctly: if multiple `indices` reference +/// the same location, their contributions combine. +/// +/// Requires `updates.shape = indices.shape + ref.shape[1:]` or `updates.shape = []`. +/// +///
+/// +///
+/// +/// Args: +/// * scope: A Scope object +/// * ref: Should be from a `Variable` node. +/// * indices: A tensor of indices into the first dimension of `ref`. +/// * updates: A tensor of updated values to reduce into `ref`. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If True, the update will be protected by a lock; +/// otherwise the behavior is undefined, but may exhibit less contention. +/// +/// Returns: +/// * `Output`: = Same as `ref`. Returned as a convenience for operations that want +/// to use the updated values after the update is done. +class ScatterMin { + public: + /// Optional attribute setters for ScatterMin + struct Attrs { + /// If True, the update will be protected by a lock; + /// otherwise the behavior is undefined, but may exhibit less contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + bool use_locking_ = false; + }; + ScatterMin(const ::tensorflow::Scope& scope, ::tensorflow::Input ref, + ::tensorflow::Input indices, ::tensorflow::Input updates); + ScatterMin(const ::tensorflow::Scope& scope, ::tensorflow::Input ref, + ::tensorflow::Input indices, ::tensorflow::Input updates, const + ScatterMin::Attrs& attrs); + operator ::tensorflow::Output() const { return output_ref; } + operator ::tensorflow::Input() const { return output_ref; } + ::tensorflow::Node* node() const { return output_ref.node(); } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + + Operation operation; + ::tensorflow::Output output_ref; +}; + +/// Multiplies sparse updates into a variable reference. +/// +/// This operation computes +/// +/// ```python +/// # Scalar indices +/// ref[indices, ...] *= updates[...] +/// +/// # Vector indices (for each i) +/// ref[indices[i], ...] *= updates[i, ...] +/// +/// # High rank indices (for each i, ..., j) +/// ref[indices[i, ..., j], ...] *= updates[i, ..., j, ...] +/// ``` +/// +/// This operation outputs `ref` after the update is done. +/// This makes it easier to chain operations that need to use the reset value. +/// +/// Duplicate entries are handled correctly: if multiple `indices` reference +/// the same location, their contributions multiply. +/// +/// Requires `updates.shape = indices.shape + ref.shape[1:]` or `updates.shape = []`. +/// +/// Args: +/// * scope: A Scope object +/// * ref: Should be from a `Variable` node. +/// * indices: A tensor of indices into the first dimension of `ref`. +/// * updates: A tensor of updated values to multiply to `ref`. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If True, the operation will be protected by a lock; +/// otherwise the behavior is undefined, but may exhibit less contention. +/// +/// Returns: +/// * `Output`: = Same as `ref`. Returned as a convenience for operations that want +/// to use the updated values after the update is done. +class ScatterMul { + public: + /// Optional attribute setters for ScatterMul + struct Attrs { + /// If True, the operation will be protected by a lock; + /// otherwise the behavior is undefined, but may exhibit less contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + bool use_locking_ = false; + }; + ScatterMul(const ::tensorflow::Scope& scope, ::tensorflow::Input ref, + ::tensorflow::Input indices, ::tensorflow::Input updates); + ScatterMul(const ::tensorflow::Scope& scope, ::tensorflow::Input ref, + ::tensorflow::Input indices, ::tensorflow::Input updates, const + ScatterMul::Attrs& attrs); + operator ::tensorflow::Output() const { return output_ref; } + operator ::tensorflow::Input() const { return output_ref; } + ::tensorflow::Node* node() const { return output_ref.node(); } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + + Operation operation; + ::tensorflow::Output output_ref; +}; + +/// Applies sparse addition to individual values or slices in a Variable. +/// +/// `ref` is a `Tensor` with rank `P` and `indices` is a `Tensor` of rank `Q`. +/// +/// `indices` must be integer tensor, containing indices into `ref`. +/// It must be shape `[d_0, ..., d_{Q-2}, K]` where `0 < K <= P`. +/// +/// The innermost dimension of `indices` (with length `K`) corresponds to +/// indices into elements (if `K = P`) or slices (if `K < P`) along the `K`th +/// dimension of `ref`. +/// +/// `updates` is `Tensor` of rank `Q-1+P-K` with shape: +/// +/// ``` +/// [d_0, ..., d_{Q-2}, ref.shape[K], ..., ref.shape[P-1]] +/// ``` +/// +/// For example, say we want to add 4 scattered elements to a rank-1 tensor to +/// 8 elements. In Python, that addition would look like this: +/// +/// ```python +/// ref = tf.Variable([1, 2, 3, 4, 5, 6, 7, 8]) +/// indices = tf.constant([[4], [3], [1], [7]]) +/// updates = tf.constant([9, 10, 11, 12]) +/// add = tf.scatter_nd_add(ref, indices, updates) +/// with tf.Session() as sess: +/// print sess.run(add) +/// ``` +/// +/// The resulting update to ref would look like this: +/// +/// [1, 13, 3, 14, 14, 6, 7, 20] +/// +/// See `tf.scatter_nd` for more details about how to make updates to +/// slices. +/// +/// Args: +/// * scope: A Scope object +/// * ref: A mutable Tensor. Should be from a Variable node. +/// * indices: A Tensor. Must be one of the following types: int32, int64. +/// A tensor of indices into ref. +/// * updates: A Tensor. Must have the same type as ref. A tensor of updated values +/// to add to ref. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: An optional bool. Defaults to True. If True, the assignment will +/// be protected by a lock; otherwise the behavior is undefined, +/// but may exhibit less contention. +/// +/// Returns: +/// * `Output`: Same as ref. Returned as a convenience for operations that want +/// to use the updated values after the update is done. +class ScatterNdAdd { + public: + /// Optional attribute setters for ScatterNdAdd + struct Attrs { + /// An optional bool. Defaults to True. If True, the assignment will + /// be protected by a lock; otherwise the behavior is undefined, + /// but may exhibit less contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + bool use_locking_ = false; + }; + ScatterNdAdd(const ::tensorflow::Scope& scope, ::tensorflow::Input ref, + ::tensorflow::Input indices, ::tensorflow::Input updates); + ScatterNdAdd(const ::tensorflow::Scope& scope, ::tensorflow::Input ref, + ::tensorflow::Input indices, ::tensorflow::Input updates, const + ScatterNdAdd::Attrs& attrs); + operator ::tensorflow::Output() const { return output_ref; } + operator ::tensorflow::Input() const { return output_ref; } + ::tensorflow::Node* node() const { return output_ref.node(); } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + + Operation operation; + ::tensorflow::Output output_ref; +}; + +/// Applies sparse subtraction to individual values or slices in a Variable. +/// +/// within a given variable according to `indices`. +/// +/// `ref` is a `Tensor` with rank `P` and `indices` is a `Tensor` of rank `Q`. +/// +/// `indices` must be integer tensor, containing indices into `ref`. +/// It must be shape `[d_0, ..., d_{Q-2}, K]` where `0 < K <= P`. +/// +/// The innermost dimension of `indices` (with length `K`) corresponds to +/// indices into elements (if `K = P`) or slices (if `K < P`) along the `K`th +/// dimension of `ref`. +/// +/// `updates` is `Tensor` of rank `Q-1+P-K` with shape: +/// +/// ``` +/// [d_0, ..., d_{Q-2}, ref.shape[K], ..., ref.shape[P-1]] +/// ``` +/// +/// For example, say we want to subtract 4 scattered elements from a rank-1 tensor +/// with 8 elements. In Python, that subtraction would look like this: +/// +/// ```python +/// ref = tf.Variable([1, 2, 3, 4, 5, 6, 7, 8]) +/// indices = tf.constant([[4], [3], [1], [7]]) +/// updates = tf.constant([9, 10, 11, 12]) +/// sub = tf.scatter_nd_sub(ref, indices, updates) +/// with tf.Session() as sess: +/// print sess.run(sub) +/// ``` +/// +/// The resulting update to ref would look like this: +/// +/// [1, -9, 3, -6, -4, 6, 7, -4] +/// +/// See `tf.scatter_nd` for more details about how to make updates to +/// slices. +/// +/// Args: +/// * scope: A Scope object +/// * ref: A mutable Tensor. Should be from a Variable node. +/// * indices: A Tensor. Must be one of the following types: int32, int64. +/// A tensor of indices into ref. +/// * updates: A Tensor. Must have the same type as ref. A tensor of updated values +/// to subtract from ref. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: An optional bool. Defaults to True. If True, the assignment will +/// be protected by a lock; otherwise the behavior is undefined, +/// but may exhibit less contention. +/// +/// Returns: +/// * `Output`: Same as ref. Returned as a convenience for operations that want +/// to use the updated values after the update is done. +class ScatterNdSub { + public: + /// Optional attribute setters for ScatterNdSub + struct Attrs { + /// An optional bool. Defaults to True. If True, the assignment will + /// be protected by a lock; otherwise the behavior is undefined, + /// but may exhibit less contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + bool use_locking_ = false; + }; + ScatterNdSub(const ::tensorflow::Scope& scope, ::tensorflow::Input ref, + ::tensorflow::Input indices, ::tensorflow::Input updates); + ScatterNdSub(const ::tensorflow::Scope& scope, ::tensorflow::Input ref, + ::tensorflow::Input indices, ::tensorflow::Input updates, const + ScatterNdSub::Attrs& attrs); + operator ::tensorflow::Output() const { return output_ref; } + operator ::tensorflow::Input() const { return output_ref; } + ::tensorflow::Node* node() const { return output_ref.node(); } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + + Operation operation; + ::tensorflow::Output output_ref; +}; + +/// Applies sparse `updates` to individual values or slices within a given +/// +/// variable according to `indices`. +/// +/// `ref` is a `Tensor` with rank `P` and `indices` is a `Tensor` of rank `Q`. +/// +/// `indices` must be integer tensor, containing indices into `ref`. +/// It must be shape \\([d_0, ..., d_{Q-2}, K]\\) where `0 < K <= P`. +/// +/// The innermost dimension of `indices` (with length `K`) corresponds to +/// indices into elements (if `K = P`) or slices (if `K < P`) along the `K`th +/// dimension of `ref`. +/// +/// `updates` is `Tensor` of rank `Q-1+P-K` with shape: +/// +/// $$[d_0, ..., d_{Q-2}, ref.shape[K], ..., ref.shape[P-1]].$$ +/// +/// For example, say we want to update 4 scattered elements to a rank-1 tensor to +/// 8 elements. In Python, that update would look like this: +/// +/// ```python +/// ref = tf.Variable([1, 2, 3, 4, 5, 6, 7, 8]) +/// indices = tf.constant([[4], [3], [1] ,[7]]) +/// updates = tf.constant([9, 10, 11, 12]) +/// update = tf.scatter_nd_update(ref, indices, updates) +/// with tf.Session() as sess: +/// print sess.run(update) +/// ``` +/// +/// The resulting update to ref would look like this: +/// +/// [1, 11, 3, 10, 9, 6, 7, 12] +/// +/// See `tf.scatter_nd` for more details about how to make updates to +/// slices. +/// +/// See also `tf.scatter_update` and `tf.batch_scatter_update`. +/// +/// Args: +/// * scope: A Scope object +/// * ref: A mutable Tensor. Should be from a Variable node. +/// * indices: A Tensor. Must be one of the following types: int32, int64. +/// A tensor of indices into ref. +/// * updates: A Tensor. Must have the same type as ref. A tensor of updated +/// values to add to ref. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: An optional bool. Defaults to True. If True, the assignment will +/// be protected by a lock; otherwise the behavior is undefined, +/// but may exhibit less contention. +/// +/// Returns: +/// * `Output`: Same as ref. Returned as a convenience for operations that want to +/// use the updated values after the update is done. +class ScatterNdUpdate { + public: + /// Optional attribute setters for ScatterNdUpdate + struct Attrs { + /// An optional bool. Defaults to True. If True, the assignment will + /// be protected by a lock; otherwise the behavior is undefined, + /// but may exhibit less contention. + /// + /// Defaults to true + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + bool use_locking_ = true; + }; + ScatterNdUpdate(const ::tensorflow::Scope& scope, ::tensorflow::Input ref, + ::tensorflow::Input indices, ::tensorflow::Input updates); + ScatterNdUpdate(const ::tensorflow::Scope& scope, ::tensorflow::Input ref, + ::tensorflow::Input indices, ::tensorflow::Input updates, const + ScatterNdUpdate::Attrs& attrs); + operator ::tensorflow::Output() const { return output_ref; } + operator ::tensorflow::Input() const { return output_ref; } + ::tensorflow::Node* node() const { return output_ref.node(); } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + + Operation operation; + ::tensorflow::Output output_ref; +}; + +/// Subtracts sparse updates to a variable reference. +/// +/// ```python +/// # Scalar indices +/// ref[indices, ...] -= updates[...] +/// +/// # Vector indices (for each i) +/// ref[indices[i], ...] -= updates[i, ...] +/// +/// # High rank indices (for each i, ..., j) +/// ref[indices[i, ..., j], ...] -= updates[i, ..., j, ...] +/// ``` +/// +/// This operation outputs `ref` after the update is done. +/// This makes it easier to chain operations that need to use the reset value. +/// +/// Duplicate entries are handled correctly: if multiple `indices` reference +/// the same location, their (negated) contributions add. +/// +/// Requires `updates.shape = indices.shape + ref.shape[1:]` or `updates.shape = []`. +/// +///
+/// +///
+/// +/// Args: +/// * scope: A Scope object +/// * ref: Should be from a `Variable` node. +/// * indices: A tensor of indices into the first dimension of `ref`. +/// * updates: A tensor of updated values to subtract from `ref`. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If True, the subtraction will be protected by a lock; +/// otherwise the behavior is undefined, but may exhibit less contention. +/// +/// Returns: +/// * `Output`: = Same as `ref`. Returned as a convenience for operations that want +/// to use the updated values after the update is done. +class ScatterSub { + public: + /// Optional attribute setters for ScatterSub + struct Attrs { + /// If True, the subtraction will be protected by a lock; + /// otherwise the behavior is undefined, but may exhibit less contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + bool use_locking_ = false; + }; + ScatterSub(const ::tensorflow::Scope& scope, ::tensorflow::Input ref, + ::tensorflow::Input indices, ::tensorflow::Input updates); + ScatterSub(const ::tensorflow::Scope& scope, ::tensorflow::Input ref, + ::tensorflow::Input indices, ::tensorflow::Input updates, const + ScatterSub::Attrs& attrs); + operator ::tensorflow::Output() const { return output_ref; } + operator ::tensorflow::Input() const { return output_ref; } + ::tensorflow::Node* node() const { return output_ref.node(); } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + + Operation operation; + ::tensorflow::Output output_ref; +}; + +/// Applies sparse updates to a variable reference. +/// +/// This operation computes +/// +/// ```python +/// # Scalar indices +/// ref[indices, ...] = updates[...] +/// +/// # Vector indices (for each i) +/// ref[indices[i], ...] = updates[i, ...] +/// +/// # High rank indices (for each i, ..., j) +/// ref[indices[i, ..., j], ...] = updates[i, ..., j, ...] +/// ``` +/// +/// This operation outputs `ref` after the update is done. +/// This makes it easier to chain operations that need to use the reset value. +/// +/// If values in `ref` is to be updated more than once, because there are +/// duplicate entries in `indices`, the order at which the updates happen +/// for each value is undefined. +/// +/// Requires `updates.shape = indices.shape + ref.shape[1:]` or `updates.shape = []`. +/// +///
+/// +///
+/// +/// See also `tf.batch_scatter_update` and `tf.scatter_nd_update`. +/// +/// Args: +/// * scope: A Scope object +/// * ref: Should be from a `Variable` node. +/// * indices: A tensor of indices into the first dimension of `ref`. +/// * updates: A tensor of updated values to store in `ref`. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If True, the assignment will be protected by a lock; +/// otherwise the behavior is undefined, but may exhibit less contention. +/// +/// Returns: +/// * `Output`: = Same as `ref`. Returned as a convenience for operations that want +/// to use the updated values after the update is done. +class ScatterUpdate { + public: + /// Optional attribute setters for ScatterUpdate + struct Attrs { + /// If True, the assignment will be protected by a lock; + /// otherwise the behavior is undefined, but may exhibit less contention. + /// + /// Defaults to true + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + bool use_locking_ = true; + }; + ScatterUpdate(const ::tensorflow::Scope& scope, ::tensorflow::Input ref, + ::tensorflow::Input indices, ::tensorflow::Input updates); + ScatterUpdate(const ::tensorflow::Scope& scope, ::tensorflow::Input ref, + ::tensorflow::Input indices, ::tensorflow::Input updates, const + ScatterUpdate::Attrs& attrs); + operator ::tensorflow::Output() const { return output_ref; } + operator ::tensorflow::Input() const { return output_ref; } + ::tensorflow::Node* node() const { return output_ref.node(); } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + + Operation operation; + ::tensorflow::Output output_ref; +}; + +/// Returns a tensor that may be mutated, but only persists within a single step. +/// +/// This is an experimental op for internal use only and it is possible to use this +/// op in unsafe ways. DO NOT USE unless you fully understand the risks. +/// +/// It is the caller's responsibility to ensure that 'ref' is eventually passed to a +/// matching 'DestroyTemporaryVariable' op after all other uses have completed. +/// +/// Outputs a ref to the tensor state so it may be read or modified. +/// +/// E.g. +/// var = state_ops._temporary_variable([1, 2], types.float_) +/// var_name = var.op.name +/// var = state_ops.assign(var, [[4.0, 5.0]]) +/// var = state_ops.assign_add(var, [[6.0, 7.0]]) +/// final = state_ops._destroy_temporary_variable(var, var_name=var_name) +/// +/// Args: +/// * scope: A Scope object +/// * shape: The shape of the variable tensor. +/// * dtype: The type of elements in the variable tensor. +/// +/// Optional attributes (see `Attrs`): +/// * var_name: Overrides the name used for the temporary variable resource. Default +/// value is the name of the 'TemporaryVariable' op (which is guaranteed unique). +/// +/// Returns: +/// * `Output`: A reference to the variable tensor. +class TemporaryVariable { + public: + /// Optional attribute setters for TemporaryVariable + struct Attrs { + /// Overrides the name used for the temporary variable resource. Default + /// value is the name of the 'TemporaryVariable' op (which is guaranteed unique). + /// + /// Defaults to "" + TF_MUST_USE_RESULT Attrs VarName(StringPiece x) { + Attrs ret = *this; + ret.var_name_ = x; + return ret; + } + + StringPiece var_name_ = ""; + }; + TemporaryVariable(const ::tensorflow::Scope& scope, PartialTensorShape shape, + DataType dtype); + TemporaryVariable(const ::tensorflow::Scope& scope, PartialTensorShape shape, + DataType dtype, const TemporaryVariable::Attrs& attrs); + operator ::tensorflow::Output() const { return ref; } + operator ::tensorflow::Input() const { return ref; } + ::tensorflow::Node* node() const { return ref.node(); } + + static Attrs VarName(StringPiece x) { + return Attrs().VarName(x); + } + + Operation operation; + ::tensorflow::Output ref; +}; + +/// Holds state in the form of a tensor that persists across steps. +/// +/// Outputs a ref to the tensor state so it may be read or modified. +/// TODO(zhifengc/mrry): Adds a pointer to a more detail document +/// about sharing states in tensorflow. +/// +/// Args: +/// * scope: A Scope object +/// * shape: The shape of the variable tensor. +/// * dtype: The type of elements in the variable tensor. +/// +/// Optional attributes (see `Attrs`): +/// * container: If non-empty, this variable is placed in the given container. +/// Otherwise, a default container is used. +/// * shared_name: If non-empty, this variable is named in the given bucket +/// with this shared_name. Otherwise, the node name is used instead. +/// +/// Returns: +/// * `Output`: A reference to the variable tensor. +class Variable { + public: + /// Optional attribute setters for Variable + struct Attrs { + /// If non-empty, this variable is placed in the given container. + /// Otherwise, a default container is used. + /// + /// Defaults to "" + TF_MUST_USE_RESULT Attrs Container(StringPiece x) { + Attrs ret = *this; + ret.container_ = x; + return ret; + } + + /// If non-empty, this variable is named in the given bucket + /// with this shared_name. Otherwise, the node name is used instead. + /// + /// Defaults to "" + TF_MUST_USE_RESULT Attrs SharedName(StringPiece x) { + Attrs ret = *this; + ret.shared_name_ = x; + return ret; + } + + StringPiece container_ = ""; + StringPiece shared_name_ = ""; + }; + Variable(const ::tensorflow::Scope& scope, PartialTensorShape shape, DataType + dtype); + Variable(const ::tensorflow::Scope& scope, PartialTensorShape shape, DataType + dtype, const Variable::Attrs& attrs); + operator ::tensorflow::Output() const { return ref; } + operator ::tensorflow::Input() const { return ref; } + ::tensorflow::Node* node() const { return ref.node(); } + + static Attrs Container(StringPiece x) { + return Attrs().Container(x); + } + static Attrs SharedName(StringPiece x) { + return Attrs().SharedName(x); + } + + Operation operation; + ::tensorflow::Output ref; +}; + +/// @} + +} // namespace ops +} // namespace tensorflow + +#endif // TENSORFLOW_CC_OPS_STATE_OPS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/ops/state_ops_internal.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/ops/state_ops_internal.h new file mode 100644 index 0000000000000000000000000000000000000000..648c89f67b48dc1e2cfc4ac78a566eed51039b2e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/ops/state_ops_internal.h @@ -0,0 +1,132 @@ +// This file is MACHINE GENERATED! Do not edit. + +#ifndef TENSORFLOW_CC_OPS_STATE_OPS_INTERNAL_H_ +#define TENSORFLOW_CC_OPS_STATE_OPS_INTERNAL_H_ + +// This file is MACHINE GENERATED! Do not edit. + +#include "tensorflow/cc/framework/ops.h" +#include "tensorflow/cc/framework/scope.h" +#include "tensorflow/core/framework/tensor.h" +#include "tensorflow/core/framework/tensor_shape.h" +#include "tensorflow/core/framework/types.h" +#include "tensorflow/core/lib/gtl/array_slice.h" + +namespace tensorflow { +namespace ops { +namespace internal { +// NOTE: This namespace has internal TensorFlow details that +// are not part of TensorFlow's public API. + +/// @defgroup state_ops_internal State Ops Internal +/// @{ + +/// Computes element-wise maximum. +/// +/// Args: +/// * scope: A Scope object +/// * ref: A mutable Tensor. Should be from a Variable node. +/// * indices: A Tensor. Must be one of the following types: int32, int64. +/// A tensor of indices into ref. +/// * updates: A Tensor. Must have the same type as ref. A tensor of updated values +/// to add to ref. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: An optional bool. Defaults to True. If True, the assignment will +/// be protected by a lock; otherwise the behavior is undefined, +/// but may exhibit less contention. +/// +/// Returns: +/// * `Output`: Same as ref. Returned as a convenience for operations that want +/// to use the updated values after the update is done. +class ScatterNdMax { + public: + /// Optional attribute setters for ScatterNdMax + struct Attrs { + /// An optional bool. Defaults to True. If True, the assignment will + /// be protected by a lock; otherwise the behavior is undefined, + /// but may exhibit less contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + bool use_locking_ = false; + }; + ScatterNdMax(const ::tensorflow::Scope& scope, ::tensorflow::Input ref, + ::tensorflow::Input indices, ::tensorflow::Input updates); + ScatterNdMax(const ::tensorflow::Scope& scope, ::tensorflow::Input ref, + ::tensorflow::Input indices, ::tensorflow::Input updates, const + ScatterNdMax::Attrs& attrs); + operator ::tensorflow::Output() const { return output_ref; } + operator ::tensorflow::Input() const { return output_ref; } + ::tensorflow::Node* node() const { return output_ref.node(); } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + + Operation operation; + ::tensorflow::Output output_ref; +}; + +/// Computes element-wise minimum. +/// +/// Args: +/// * scope: A Scope object +/// * ref: A mutable Tensor. Should be from a Variable node. +/// * indices: A Tensor. Must be one of the following types: int32, int64. +/// A tensor of indices into ref. +/// * updates: A Tensor. Must have the same type as ref. A tensor of updated values +/// to add to ref. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: An optional bool. Defaults to True. If True, the assignment will +/// be protected by a lock; otherwise the behavior is undefined, +/// but may exhibit less contention. +/// +/// Returns: +/// * `Output`: Same as ref. Returned as a convenience for operations that want +/// to use the updated values after the update is done. +class ScatterNdMin { + public: + /// Optional attribute setters for ScatterNdMin + struct Attrs { + /// An optional bool. Defaults to True. If True, the assignment will + /// be protected by a lock; otherwise the behavior is undefined, + /// but may exhibit less contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + bool use_locking_ = false; + }; + ScatterNdMin(const ::tensorflow::Scope& scope, ::tensorflow::Input ref, + ::tensorflow::Input indices, ::tensorflow::Input updates); + ScatterNdMin(const ::tensorflow::Scope& scope, ::tensorflow::Input ref, + ::tensorflow::Input indices, ::tensorflow::Input updates, const + ScatterNdMin::Attrs& attrs); + operator ::tensorflow::Output() const { return output_ref; } + operator ::tensorflow::Input() const { return output_ref; } + ::tensorflow::Node* node() const { return output_ref.node(); } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + + Operation operation; + ::tensorflow::Output output_ref; +}; + +} // namespace internal +} // namespace ops +} // namespace tensorflow + +#endif // TENSORFLOW_CC_OPS_STATE_OPS_INTERNAL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/ops/string_ops.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/ops/string_ops.h new file mode 100644 index 0000000000000000000000000000000000000000..f9319497043e94770af41b8de5b1ad231d378325 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/ops/string_ops.h @@ -0,0 +1,1284 @@ +// This file is MACHINE GENERATED! Do not edit. + +#ifndef TENSORFLOW_CC_OPS_STRING_OPS_H_ +#define TENSORFLOW_CC_OPS_STRING_OPS_H_ + +// This file is MACHINE GENERATED! Do not edit. + +#include "tensorflow/cc/framework/ops.h" +#include "tensorflow/cc/framework/scope.h" +#include "tensorflow/core/framework/tensor.h" +#include "tensorflow/core/framework/tensor_shape.h" +#include "tensorflow/core/framework/types.h" +#include "tensorflow/core/lib/gtl/array_slice.h" + +namespace tensorflow { +namespace ops { + +/// @defgroup string_ops String Ops +/// @{ + +/// Converts each entry in the given tensor to strings. +/// +/// Supports many numeric types and boolean. +/// +/// For Unicode, see the +/// [https://www.tensorflow.org/tutorials/representation/unicode](Working with Unicode text) +/// tutorial. +/// +/// Examples: +/// +/// >>> tf.strings.as_string([3, 2]) +/// +/// >>> tf.strings.as_string([3.1415926, 2.71828], precision=2).numpy() +/// array([b'3.14', b'2.72'], dtype=object) +/// +/// Args: +/// * scope: A Scope object +/// +/// Optional attributes (see `Attrs`): +/// * precision: The post-decimal precision to use for floating point numbers. +/// Only used if precision > -1. +/// * scientific: Use scientific notation for floating point numbers. +/// * shortest: Use shortest representation (either scientific or standard) for +/// floating point numbers. +/// * width: Pad pre-decimal numbers to this width. +/// Applies to both floating point and integer numbers. +/// Only used if width > -1. +/// * fill: The value to pad if width > -1. If empty, pads with spaces. +/// Another typical value is '0'. String cannot be longer than 1 character. +/// +/// Returns: +/// * `Output`: The output tensor. +class AsString { + public: + /// Optional attribute setters for AsString + struct Attrs { + /// The post-decimal precision to use for floating point numbers. + /// Only used if precision > -1. + /// + /// Defaults to -1 + TF_MUST_USE_RESULT Attrs Precision(int64 x) { + Attrs ret = *this; + ret.precision_ = x; + return ret; + } + + /// Use scientific notation for floating point numbers. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs Scientific(bool x) { + Attrs ret = *this; + ret.scientific_ = x; + return ret; + } + + /// Use shortest representation (either scientific or standard) for + /// floating point numbers. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs Shortest(bool x) { + Attrs ret = *this; + ret.shortest_ = x; + return ret; + } + + /// Pad pre-decimal numbers to this width. + /// Applies to both floating point and integer numbers. + /// Only used if width > -1. + /// + /// Defaults to -1 + TF_MUST_USE_RESULT Attrs Width(int64 x) { + Attrs ret = *this; + ret.width_ = x; + return ret; + } + + /// The value to pad if width > -1. If empty, pads with spaces. + /// Another typical value is '0'. String cannot be longer than 1 character. + /// + /// Defaults to "" + TF_MUST_USE_RESULT Attrs Fill(StringPiece x) { + Attrs ret = *this; + ret.fill_ = x; + return ret; + } + + int64 precision_ = -1; + bool scientific_ = false; + bool shortest_ = false; + int64 width_ = -1; + StringPiece fill_ = ""; + }; + AsString(const ::tensorflow::Scope& scope, ::tensorflow::Input input); + AsString(const ::tensorflow::Scope& scope, ::tensorflow::Input input, const + AsString::Attrs& attrs); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + static Attrs Precision(int64 x) { + return Attrs().Precision(x); + } + static Attrs Scientific(bool x) { + return Attrs().Scientific(x); + } + static Attrs Shortest(bool x) { + return Attrs().Shortest(x); + } + static Attrs Width(int64 x) { + return Attrs().Width(x); + } + static Attrs Fill(StringPiece x) { + return Attrs().Fill(x); + } + + Operation operation; + ::tensorflow::Output output; +}; + +/// Decode web-safe base64-encoded strings. +/// +/// Input may or may not have padding at the end. See +/// [EncodeBase64](https://www.tensorflow.org/api_docs/python/tf/io/encode_base64) +/// for padding. Web-safe means that input must use - and _ instead of + and /. +/// +/// Args: +/// * scope: A Scope object +/// * input: Base64 strings to decode. +/// +/// Returns: +/// * `Output`: Decoded strings. +class DecodeBase64 { + public: + DecodeBase64(const ::tensorflow::Scope& scope, ::tensorflow::Input input); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + Operation operation; + ::tensorflow::Output output; +}; + +/// Encode strings into web-safe base64 format. +/// +/// Refer to [this article](https://en.wikipedia.org/wiki/Base64) for more information on +/// base64 format. Base64 strings may have padding with '=' at the +/// end so that the encoded has length multiple of 4. See Padding section of the +/// link above. +/// +/// Web-safe means that the encoder uses - and _ instead of + and /. +/// +/// Args: +/// * scope: A Scope object +/// * input: Strings to be encoded. +/// +/// Optional attributes (see `Attrs`): +/// * pad: Bool whether padding is applied at the ends. +/// +/// Returns: +/// * `Output`: Input strings encoded in base64. +class EncodeBase64 { + public: + /// Optional attribute setters for EncodeBase64 + struct Attrs { + /// Bool whether padding is applied at the ends. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs Pad(bool x) { + Attrs ret = *this; + ret.pad_ = x; + return ret; + } + + bool pad_ = false; + }; + EncodeBase64(const ::tensorflow::Scope& scope, ::tensorflow::Input input); + EncodeBase64(const ::tensorflow::Scope& scope, ::tensorflow::Input input, const + EncodeBase64::Attrs& attrs); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + static Attrs Pad(bool x) { + return Attrs().Pad(x); + } + + Operation operation; + ::tensorflow::Output output; +}; + +/// Joins a string Tensor across the given dimensions. +/// +/// Computes the string join across dimensions in the given string Tensor of shape +/// `[\\(d_0, d_1, ..., d_{n-1}\\)]`. Returns a new Tensor created by joining the input +/// strings with the given separator (default: empty string). Negative indices are +/// counted backwards from the end, with `-1` being equivalent to `n - 1`. If +/// indices are not specified, joins across all dimensions beginning from `n - 1` +/// through `0`. +/// +/// For example: +/// +/// ```python +/// # tensor `a` is [["a", "b"], ["c", "d"]] +/// tf.reduce_join(a, 0) ==> ["ac", "bd"] +/// tf.reduce_join(a, 1) ==> ["ab", "cd"] +/// tf.reduce_join(a, -2) = tf.reduce_join(a, 0) ==> ["ac", "bd"] +/// tf.reduce_join(a, -1) = tf.reduce_join(a, 1) ==> ["ab", "cd"] +/// tf.reduce_join(a, 0, keep_dims=True) ==> [["ac", "bd"]] +/// tf.reduce_join(a, 1, keep_dims=True) ==> [["ab"], ["cd"]] +/// tf.reduce_join(a, 0, separator=".") ==> ["a.c", "b.d"] +/// tf.reduce_join(a, [0, 1]) ==> "acbd" +/// tf.reduce_join(a, [1, 0]) ==> "abcd" +/// tf.reduce_join(a, []) ==> [["a", "b"], ["c", "d"]] +/// tf.reduce_join(a) = tf.reduce_join(a, [1, 0]) ==> "abcd" +/// ``` +/// +/// Args: +/// * scope: A Scope object +/// * inputs: The input to be joined. All reduced indices must have non-zero size. +/// * reduction_indices: The dimensions to reduce over. Dimensions are reduced in the +/// order specified. Omitting `reduction_indices` is equivalent to passing +/// `[n-1, n-2, ..., 0]`. Negative indices from `-n` to `-1` are supported. +/// +/// Optional attributes (see `Attrs`): +/// * keep_dims: If `True`, retain reduced dimensions with length `1`. +/// * separator: The separator to use when joining. +/// +/// Returns: +/// * `Output`: Has shape equal to that of the input with reduced dimensions removed or +/// set to `1` depending on `keep_dims`. +class ReduceJoin { + public: + /// Optional attribute setters for ReduceJoin + struct Attrs { + /// If `True`, retain reduced dimensions with length `1`. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs KeepDims(bool x) { + Attrs ret = *this; + ret.keep_dims_ = x; + return ret; + } + + /// The separator to use when joining. + /// + /// Defaults to "" + TF_MUST_USE_RESULT Attrs Separator(StringPiece x) { + Attrs ret = *this; + ret.separator_ = x; + return ret; + } + + bool keep_dims_ = false; + StringPiece separator_ = ""; + }; + ReduceJoin(const ::tensorflow::Scope& scope, ::tensorflow::Input inputs, + ::tensorflow::Input reduction_indices); + ReduceJoin(const ::tensorflow::Scope& scope, ::tensorflow::Input inputs, + ::tensorflow::Input reduction_indices, const ReduceJoin::Attrs& + attrs); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + static Attrs KeepDims(bool x) { + return Attrs().KeepDims(x); + } + static Attrs Separator(StringPiece x) { + return Attrs().Separator(x); + } + + Operation operation; + ::tensorflow::Output output; +}; + +/// Check if the input matches the regex pattern. +/// +/// The input is a string tensor of any shape. The pattern is a scalar +/// string tensor which is applied to every element of the input tensor. +/// The boolean values (True or False) of the output tensor indicate +/// if the input matches the regex pattern provided. +/// +/// The pattern follows the re2 syntax (https://github.com/google/re2/wiki/Syntax) +/// +/// Examples: +/// +/// >>> tf.strings.regex_full_match(["TF lib", "lib TF"], ".*lib$") +/// +/// >>> tf.strings.regex_full_match(["TF lib", "lib TF"], ".*TF$") +/// +/// +/// Args: +/// * scope: A Scope object +/// * input: A string tensor of the text to be processed. +/// * pattern: A scalar string tensor containing the regular expression to match the input. +/// +/// Returns: +/// * `Output`: A bool tensor with the same shape as `input`. +class RegexFullMatch { + public: + RegexFullMatch(const ::tensorflow::Scope& scope, ::tensorflow::Input input, + ::tensorflow::Input pattern); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + Operation operation; + ::tensorflow::Output output; +}; + +/// Replaces matches of the `pattern` regular expression in `input` with the +/// replacement string provided in `rewrite`. +/// +/// It follows the re2 syntax (https://github.com/google/re2/wiki/Syntax) +/// +/// Args: +/// * scope: A Scope object +/// * input: The text to be processed. +/// * pattern: The regular expression to be matched in the `input` strings. +/// * rewrite: The rewrite string to be substituted for the `pattern` expression where it is +/// matched in the `input` strings. +/// +/// Optional attributes (see `Attrs`): +/// * replace_global: If True, the replacement is global (that is, all matches of the `pattern` regular +/// expression in each input string are rewritten), otherwise the `rewrite` +/// substitution is only made for the first `pattern` match. +/// +/// Returns: +/// * `Output`: The text after applying pattern match and rewrite substitution. +class RegexReplace { + public: + /// Optional attribute setters for RegexReplace + struct Attrs { + /// If True, the replacement is global (that is, all matches of the `pattern` regular + /// expression in each input string are rewritten), otherwise the `rewrite` + /// substitution is only made for the first `pattern` match. + /// + /// Defaults to true + TF_MUST_USE_RESULT Attrs ReplaceGlobal(bool x) { + Attrs ret = *this; + ret.replace_global_ = x; + return ret; + } + + bool replace_global_ = true; + }; + RegexReplace(const ::tensorflow::Scope& scope, ::tensorflow::Input input, + ::tensorflow::Input pattern, ::tensorflow::Input rewrite); + RegexReplace(const ::tensorflow::Scope& scope, ::tensorflow::Input input, + ::tensorflow::Input pattern, ::tensorflow::Input rewrite, const + RegexReplace::Attrs& attrs); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + static Attrs ReplaceGlobal(bool x) { + return Attrs().ReplaceGlobal(x); + } + + Operation operation; + ::tensorflow::Output output; +}; + +/// Formats a string template using a list of tensors. +/// +/// Formats a string template using a list of tensors, pretty-printing tensor summaries. +/// +/// Args: +/// * scope: A Scope object +/// * inputs: The list of tensors to format into the placeholder string. +/// +/// Optional attributes (see `Attrs`): +/// * template_: A string, the template to format tensor summaries into. +/// * placeholder: A string, at each placeholder in the template a subsequent tensor summary will be inserted. +/// * summarize: When formatting the tensor summaries print the first and last summarize entries of each tensor dimension. +/// +/// Returns: +/// * `Output`: = The resulting string scalar. +class StringFormat { + public: + /// Optional attribute setters for StringFormat + struct Attrs { + /// A string, the template to format tensor summaries into. + /// + /// Defaults to "%s" + TF_MUST_USE_RESULT Attrs Template(StringPiece x) { + Attrs ret = *this; + ret.template_ = x; + return ret; + } + + /// A string, at each placeholder in the template a subsequent tensor summary will be inserted. + /// + /// Defaults to "%s" + TF_MUST_USE_RESULT Attrs Placeholder(StringPiece x) { + Attrs ret = *this; + ret.placeholder_ = x; + return ret; + } + + /// When formatting the tensor summaries print the first and last summarize entries of each tensor dimension. + /// + /// Defaults to 3 + TF_MUST_USE_RESULT Attrs Summarize(int64 x) { + Attrs ret = *this; + ret.summarize_ = x; + return ret; + } + + StringPiece template_ = "%s"; + StringPiece placeholder_ = "%s"; + int64 summarize_ = 3; + }; + StringFormat(const ::tensorflow::Scope& scope, ::tensorflow::InputList inputs); + StringFormat(const ::tensorflow::Scope& scope, ::tensorflow::InputList inputs, + const StringFormat::Attrs& attrs); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + static Attrs Template(StringPiece x) { + return Attrs().Template(x); + } + static Attrs Placeholder(StringPiece x) { + return Attrs().Placeholder(x); + } + static Attrs Summarize(int64 x) { + return Attrs().Summarize(x); + } + + Operation operation; + ::tensorflow::Output output; +}; + +/// Joins the strings in the given list of string tensors into one tensor; +/// +/// with the given separator (default is an empty separator). +/// +/// Examples: +/// +/// >>> s = ["hello", "world", "tensorflow"] +/// >>> tf.strings.join(s, " ") +/// +/// +/// Args: +/// * scope: A Scope object +/// * inputs: A list of string tensors. The tensors must all have the same shape, +/// or be scalars. Scalars may be mixed in; these will be broadcast to the shape +/// of non-scalar inputs. +/// +/// Optional attributes (see `Attrs`): +/// * separator: string, an optional join separator. +/// +/// Returns: +/// * `Output`: The output tensor. +class StringJoin { + public: + /// Optional attribute setters for StringJoin + struct Attrs { + /// string, an optional join separator. + /// + /// Defaults to "" + TF_MUST_USE_RESULT Attrs Separator(StringPiece x) { + Attrs ret = *this; + ret.separator_ = x; + return ret; + } + + StringPiece separator_ = ""; + }; + StringJoin(const ::tensorflow::Scope& scope, ::tensorflow::InputList inputs); + StringJoin(const ::tensorflow::Scope& scope, ::tensorflow::InputList inputs, + const StringJoin::Attrs& attrs); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + static Attrs Separator(StringPiece x) { + return Attrs().Separator(x); + } + + Operation operation; + ::tensorflow::Output output; +}; + +/// String lengths of `input`. +/// +/// Computes the length of each string given in the input tensor. +/// +/// >>> strings = tf.constant(['Hello','TensorFlow', '\U0001F642']) +/// >>> tf.strings.length(strings).numpy() # default counts bytes +/// array([ 5, 10, 4], dtype=int32) +/// >>> tf.strings.length(strings, unit="UTF8_CHAR").numpy() +/// array([ 5, 10, 1], dtype=int32) +/// +/// +/// Args: +/// * scope: A Scope object +/// * input: The strings for which to compute the length for each element. +/// +/// Optional attributes (see `Attrs`): +/// * unit: The unit that is counted to compute string length. One of: `"BYTE"` (for +/// the number of bytes in each string) or `"UTF8_CHAR"` (for the number of UTF-8 +/// encoded Unicode code points in each string). Results are undefined +/// if `unit=UTF8_CHAR` and the `input` strings do not contain structurally +/// valid UTF-8. +/// +/// Returns: +/// * `Output`: Integer tensor that has the same shape as `input`. The output contains the +/// element-wise string lengths of `input`. +class StringLength { + public: + /// Optional attribute setters for StringLength + struct Attrs { + /// The unit that is counted to compute string length. One of: `"BYTE"` (for + /// the number of bytes in each string) or `"UTF8_CHAR"` (for the number of UTF-8 + /// encoded Unicode code points in each string). Results are undefined + /// if `unit=UTF8_CHAR` and the `input` strings do not contain structurally + /// valid UTF-8. + /// + /// Defaults to "BYTE" + TF_MUST_USE_RESULT Attrs Unit(StringPiece x) { + Attrs ret = *this; + ret.unit_ = x; + return ret; + } + + StringPiece unit_ = "BYTE"; + }; + StringLength(const ::tensorflow::Scope& scope, ::tensorflow::Input input); + StringLength(const ::tensorflow::Scope& scope, ::tensorflow::Input input, const + StringLength::Attrs& attrs); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + static Attrs Unit(StringPiece x) { + return Attrs().Unit(x); + } + + Operation operation; + ::tensorflow::Output output; +}; + +/// Converts all uppercase characters into their respective lowercase replacements. +/// +/// Example: +/// +/// >>> tf.strings.lower("CamelCase string and ALL CAPS") +/// +/// +/// +/// Args: +/// * scope: A Scope object +/// * input: The input to be lower-cased. +/// +/// Optional attributes (see `Attrs`): +/// * encoding: Character encoding of `input`. Allowed values are '' and 'utf-8'. +/// Value '' is interpreted as ASCII. +/// +/// Returns: +/// * `Output`: The output tensor. +class StringLower { + public: + /// Optional attribute setters for StringLower + struct Attrs { + /// Character encoding of `input`. Allowed values are '' and 'utf-8'. + /// Value '' is interpreted as ASCII. + /// + /// Defaults to "" + TF_MUST_USE_RESULT Attrs Encoding(StringPiece x) { + Attrs ret = *this; + ret.encoding_ = x; + return ret; + } + + StringPiece encoding_ = ""; + }; + StringLower(const ::tensorflow::Scope& scope, ::tensorflow::Input input); + StringLower(const ::tensorflow::Scope& scope, ::tensorflow::Input input, const + StringLower::Attrs& attrs); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + static Attrs Encoding(StringPiece x) { + return Attrs().Encoding(x); + } + + Operation operation; + ::tensorflow::Output output; +}; + +/// Creates ngrams from ragged string data. +/// +/// This op accepts a ragged tensor with 1 ragged dimension containing only +/// strings and outputs a ragged tensor with 1 ragged dimension containing ngrams +/// of that string, joined along the innermost axis. +/// +/// Args: +/// * scope: A Scope object +/// * data: The values tensor of the ragged string tensor to make ngrams out of. Must be a +/// 1D string tensor. +/// * data_splits: The splits tensor of the ragged string tensor to make ngrams out of. +/// * separator: The string to append between elements of the token. Use "" for no separator. +/// * ngram_widths: The sizes of the ngrams to create. +/// * left_pad: The string to use to pad the left side of the ngram sequence. Only used if +/// pad_width != 0. +/// * right_pad: The string to use to pad the right side of the ngram sequence. Only used if +/// pad_width != 0. +/// * pad_width: The number of padding elements to add to each side of each +/// sequence. Note that padding will never be greater than 'ngram_widths'-1 +/// regardless of this value. If `pad_width=-1`, then add `max(ngram_widths)-1` +/// elements. +/// +/// Returns: +/// * `Output` ngrams: The values tensor of the output ngrams ragged tensor. +/// * `Output` ngrams_splits: The splits tensor of the output ngrams ragged tensor. +class StringNGrams { + public: + StringNGrams(const ::tensorflow::Scope& scope, ::tensorflow::Input data, + ::tensorflow::Input data_splits, StringPiece separator, const + gtl::ArraySlice& ngram_widths, StringPiece left_pad, + StringPiece right_pad, int64 pad_width, bool + preserve_short_sequences); + + Operation operation; + ::tensorflow::Output ngrams; + ::tensorflow::Output ngrams_splits; +}; + +/// Split elements of `input` based on `delimiter` into a `SparseTensor`. +/// +/// Let N be the size of source (typically N will be the batch size). Split each +/// element of `input` based on `delimiter` and return a `SparseTensor` +/// containing the splitted tokens. Empty tokens are ignored. +/// +/// `delimiter` can be empty, or a string of split characters. If `delimiter` is an +/// empty string, each element of `input` is split into individual single-byte +/// character strings, including splitting of UTF-8 multibyte sequences. Otherwise +/// every character of `delimiter` is a potential split point. +/// +/// For example: +/// N = 2, input[0] is 'hello world' and input[1] is 'a b c', then the output +/// will be +/// +/// indices = [0, 0; +/// 0, 1; +/// 1, 0; +/// 1, 1; +/// 1, 2] +/// shape = [2, 3] +/// values = ['hello', 'world', 'a', 'b', 'c'] +/// +/// Args: +/// * scope: A Scope object +/// * input: 1-D. Strings to split. +/// * delimiter: 0-D. Delimiter characters (bytes), or empty string. +/// +/// Optional attributes (see `Attrs`): +/// * skip_empty: A `bool`. If `True`, skip the empty strings from the result. +/// +/// Returns: +/// * `Output` indices: A dense matrix of int64 representing the indices of the sparse tensor. +/// * `Output` values: A vector of strings corresponding to the splited values. +/// * `Output` shape: a length-2 vector of int64 representing the shape of the sparse +/// tensor, where the first value is N and the second value is the maximum number +/// of tokens in a single input entry. +class StringSplit { + public: + /// Optional attribute setters for StringSplit + struct Attrs { + /// A `bool`. If `True`, skip the empty strings from the result. + /// + /// Defaults to true + TF_MUST_USE_RESULT Attrs SkipEmpty(bool x) { + Attrs ret = *this; + ret.skip_empty_ = x; + return ret; + } + + bool skip_empty_ = true; + }; + StringSplit(const ::tensorflow::Scope& scope, ::tensorflow::Input input, + ::tensorflow::Input delimiter); + StringSplit(const ::tensorflow::Scope& scope, ::tensorflow::Input input, + ::tensorflow::Input delimiter, const StringSplit::Attrs& attrs); + + static Attrs SkipEmpty(bool x) { + return Attrs().SkipEmpty(x); + } + + Operation operation; + ::tensorflow::Output indices; + ::tensorflow::Output values; + ::tensorflow::Output shape; +}; + +/// Split elements of `source` based on `sep` into a `SparseTensor`. +/// +/// Let N be the size of source (typically N will be the batch size). Split each +/// element of `source` based on `sep` and return a `SparseTensor` +/// containing the split tokens. Empty tokens are ignored. +/// +/// For example, N = 2, source[0] is 'hello world' and source[1] is 'a b c', +/// then the output will be +/// ``` +/// st.indices = [0, 0; +/// 0, 1; +/// 1, 0; +/// 1, 1; +/// 1, 2] +/// st.shape = [2, 3] +/// st.values = ['hello', 'world', 'a', 'b', 'c'] +/// ``` +/// +/// If `sep` is given, consecutive delimiters are not grouped together and are +/// deemed to delimit empty strings. For example, source of `"1<>2<><>3"` and +/// sep of `"<>"` returns `["1", "2", "", "3"]`. If `sep` is None or an empty +/// string, consecutive whitespace are regarded as a single separator, and the +/// result will contain no empty strings at the startor end if the string has +/// leading or trailing whitespace. +/// +/// Note that the above mentioned behavior matches python's str.split. +/// +/// Args: +/// * scope: A Scope object +/// * input: `1-D` string `Tensor`, the strings to split. +/// * sep: `0-D` string `Tensor`, the delimiter character. +/// +/// Optional attributes (see `Attrs`): +/// * maxsplit: An `int`. If `maxsplit > 0`, limit of the split of the result. +/// +/// Returns: +/// * `Output` indices +/// * `Output` values +/// * `Output` shape +class StringSplitV2 { + public: + /// Optional attribute setters for StringSplitV2 + struct Attrs { + /// An `int`. If `maxsplit > 0`, limit of the split of the result. + /// + /// Defaults to -1 + TF_MUST_USE_RESULT Attrs Maxsplit(int64 x) { + Attrs ret = *this; + ret.maxsplit_ = x; + return ret; + } + + int64 maxsplit_ = -1; + }; + StringSplitV2(const ::tensorflow::Scope& scope, ::tensorflow::Input input, + ::tensorflow::Input sep); + StringSplitV2(const ::tensorflow::Scope& scope, ::tensorflow::Input input, + ::tensorflow::Input sep, const StringSplitV2::Attrs& attrs); + + static Attrs Maxsplit(int64 x) { + return Attrs().Maxsplit(x); + } + + Operation operation; + ::tensorflow::Output indices; + ::tensorflow::Output values; + ::tensorflow::Output shape; +}; + +/// Strip leading and trailing whitespaces from the Tensor. +/// +/// Examples: +/// +/// >>> tf.strings.strip(["\nTensorFlow", " The python library "]).numpy() +/// array([b'TensorFlow', b'The python library'], dtype=object) +/// +/// Args: +/// * scope: A Scope object +/// * input: A string `Tensor` of any shape. +/// +/// Returns: +/// * `Output`: A string `Tensor` of the same shape as the input. +class StringStrip { + public: + StringStrip(const ::tensorflow::Scope& scope, ::tensorflow::Input input); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + Operation operation; + ::tensorflow::Output output; +}; + +/// Converts each string in the input Tensor to its hash mod by a number of buckets. +/// +/// The hash function is deterministic on the content of the string within the +/// process. +/// +/// Note that the hash function may change from time to time. +/// This functionality will be deprecated and it's recommended to use +/// `tf.string_to_hash_bucket_fast()` or `tf.string_to_hash_bucket_strong()`. +/// +/// Args: +/// * scope: A Scope object +/// * num_buckets: The number of buckets. +/// +/// Returns: +/// * `Output`: A Tensor of the same shape as the input `string_tensor`. +class StringToHashBucket { + public: + StringToHashBucket(const ::tensorflow::Scope& scope, ::tensorflow::Input + string_tensor, int64 num_buckets); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + Operation operation; + ::tensorflow::Output output; +}; + +/// Converts each string in the input Tensor to its hash mod by a number of buckets. +/// +/// The hash function is deterministic on the content of the string within the +/// process and will never change. However, it is not suitable for cryptography. +/// This function may be used when CPU time is scarce and inputs are trusted or +/// unimportant. There is a risk of adversaries constructing inputs that all hash +/// to the same bucket. To prevent this problem, use a strong hash function with +/// `tf.string_to_hash_bucket_strong`. +/// +/// Examples: +/// +/// >>> tf.strings.to_hash_bucket_fast(["Hello", "TensorFlow", "2.x"], 3).numpy() +/// array([0, 2, 2]) +/// +/// Args: +/// * scope: A Scope object +/// * input: The strings to assign a hash bucket. +/// * num_buckets: The number of buckets. +/// +/// Returns: +/// * `Output`: A Tensor of the same shape as the input `string_tensor`. +class StringToHashBucketFast { + public: + StringToHashBucketFast(const ::tensorflow::Scope& scope, ::tensorflow::Input + input, int64 num_buckets); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + Operation operation; + ::tensorflow::Output output; +}; + +/// Converts each string in the input Tensor to its hash mod by a number of buckets. +/// +/// The hash function is deterministic on the content of the string within the +/// process. The hash function is a keyed hash function, where attribute `key` +/// defines the key of the hash function. `key` is an array of 2 elements. +/// +/// A strong hash is important when inputs may be malicious, e.g. URLs with +/// additional components. Adversaries could try to make their inputs hash to the +/// same bucket for a denial-of-service attack or to skew the results. A strong +/// hash can be used to make it difficult to find inputs with a skewed hash value +/// distribution over buckets. This requires that the hash function is +/// seeded by a high-entropy (random) "key" unknown to the adversary. +/// +/// The additional robustness comes at a cost of roughly 4x higher compute +/// time than `tf.string_to_hash_bucket_fast`. +/// +/// Examples: +/// +/// >>> tf.strings.to_hash_bucket_strong(["Hello", "TF"], 3, [1, 2]).numpy() +/// array([2, 0]) +/// +/// Args: +/// * scope: A Scope object +/// * input: The strings to assign a hash bucket. +/// * num_buckets: The number of buckets. +/// * key: The key used to seed the hash function, passed as a list of two uint64 +/// elements. +/// +/// Returns: +/// * `Output`: A Tensor of the same shape as the input `string_tensor`. +class StringToHashBucketStrong { + public: + StringToHashBucketStrong(const ::tensorflow::Scope& scope, ::tensorflow::Input + input, int64 num_buckets, const gtl::ArraySlice& + key); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + Operation operation; + ::tensorflow::Output output; +}; + +/// Converts all lowercase characters into their respective uppercase replacements. +/// +/// Example: +/// +/// >>> tf.strings.upper("CamelCase string and ALL CAPS") +/// +/// +/// +/// Args: +/// * scope: A Scope object +/// * input: The input to be upper-cased. +/// +/// Optional attributes (see `Attrs`): +/// * encoding: Character encoding of `input`. Allowed values are '' and 'utf-8'. +/// Value '' is interpreted as ASCII. +/// +/// Returns: +/// * `Output`: The output tensor. +class StringUpper { + public: + /// Optional attribute setters for StringUpper + struct Attrs { + /// Character encoding of `input`. Allowed values are '' and 'utf-8'. + /// Value '' is interpreted as ASCII. + /// + /// Defaults to "" + TF_MUST_USE_RESULT Attrs Encoding(StringPiece x) { + Attrs ret = *this; + ret.encoding_ = x; + return ret; + } + + StringPiece encoding_ = ""; + }; + StringUpper(const ::tensorflow::Scope& scope, ::tensorflow::Input input); + StringUpper(const ::tensorflow::Scope& scope, ::tensorflow::Input input, const + StringUpper::Attrs& attrs); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + static Attrs Encoding(StringPiece x) { + return Attrs().Encoding(x); + } + + Operation operation; + ::tensorflow::Output output; +}; + +/// Return substrings from `Tensor` of strings. +/// +/// For each string in the input `Tensor`, creates a substring starting at index +/// `pos` with a total length of `len`. +/// +/// If `len` defines a substring that would extend beyond the length of the input +/// string, or if `len` is negative, then as many characters as possible are used. +/// +/// A negative `pos` indicates distance within the string backwards from the end. +/// +/// If `pos` specifies an index which is out of range for any of the input strings, +/// then an `InvalidArgumentError` is thrown. +/// +/// `pos` and `len` must have the same shape, otherwise a `ValueError` is thrown on +/// Op creation. +/// +/// *NOTE*: `Substr` supports broadcasting up to two dimensions. More about +/// broadcasting +/// [here](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html) +/// +/// --- +/// +/// Examples +/// +/// Using scalar `pos` and `len`: +/// +/// ```python +/// input = [b'Hello', b'World'] +/// position = 1 +/// length = 3 +/// +/// output = [b'ell', b'orl'] +/// ``` +/// +/// Using `pos` and `len` with same shape as `input`: +/// +/// ```python +/// input = [[b'ten', b'eleven', b'twelve'], +/// [b'thirteen', b'fourteen', b'fifteen'], +/// [b'sixteen', b'seventeen', b'eighteen']] +/// position = [[1, 2, 3], +/// [1, 2, 3], +/// [1, 2, 3]] +/// length = [[2, 3, 4], +/// [4, 3, 2], +/// [5, 5, 5]] +/// +/// output = [[b'en', b'eve', b'lve'], +/// [b'hirt', b'urt', b'te'], +/// [b'ixtee', b'vente', b'hteen']] +/// ``` +/// +/// Broadcasting `pos` and `len` onto `input`: +/// +/// ``` +/// input = [[b'ten', b'eleven', b'twelve'], +/// [b'thirteen', b'fourteen', b'fifteen'], +/// [b'sixteen', b'seventeen', b'eighteen'], +/// [b'nineteen', b'twenty', b'twentyone']] +/// position = [1, 2, 3] +/// length = [1, 2, 3] +/// +/// output = [[b'e', b'ev', b'lve'], +/// [b'h', b'ur', b'tee'], +/// [b'i', b've', b'hte'], +/// [b'i', b'en', b'nty']] +/// ``` +/// +/// Broadcasting `input` onto `pos` and `len`: +/// +/// ``` +/// input = b'thirteen' +/// position = [1, 5, 7] +/// length = [3, 2, 1] +/// +/// output = [b'hir', b'ee', b'n'] +/// ``` +/// +/// Raises: +/// +/// * `ValueError`: If the first argument cannot be converted to a +/// Tensor of `dtype string`. +/// * `InvalidArgumentError`: If indices are out of range. +/// * `ValueError`: If `pos` and `len` are not the same shape. +/// +/// +/// Args: +/// * scope: A Scope object +/// * input: Tensor of strings +/// * pos: Scalar defining the position of first character in each substring +/// * len: Scalar defining the number of characters to include in each substring +/// +/// Optional attributes (see `Attrs`): +/// * unit: The unit that is used to create the substring. One of: `"BYTE"` (for +/// defining position and length by bytes) or `"UTF8_CHAR"` (for the UTF-8 +/// encoded Unicode code points). The default is `"BYTE"`. Results are undefined if +/// `unit=UTF8_CHAR` and the `input` strings do not contain structurally valid +/// UTF-8. +/// +/// Returns: +/// * `Output`: Tensor of substrings +class Substr { + public: + /// Optional attribute setters for Substr + struct Attrs { + /// The unit that is used to create the substring. One of: `"BYTE"` (for + /// defining position and length by bytes) or `"UTF8_CHAR"` (for the UTF-8 + /// encoded Unicode code points). The default is `"BYTE"`. Results are undefined if + /// `unit=UTF8_CHAR` and the `input` strings do not contain structurally valid + /// UTF-8. + /// + /// Defaults to "BYTE" + TF_MUST_USE_RESULT Attrs Unit(StringPiece x) { + Attrs ret = *this; + ret.unit_ = x; + return ret; + } + + StringPiece unit_ = "BYTE"; + }; + Substr(const ::tensorflow::Scope& scope, ::tensorflow::Input input, + ::tensorflow::Input pos, ::tensorflow::Input len); + Substr(const ::tensorflow::Scope& scope, ::tensorflow::Input input, + ::tensorflow::Input pos, ::tensorflow::Input len, const Substr::Attrs& + attrs); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + static Attrs Unit(StringPiece x) { + return Attrs().Unit(x); + } + + Operation operation; + ::tensorflow::Output output; +}; + +/// Determine the script codes of a given tensor of Unicode integer code points. +/// +/// This operation converts Unicode code points to script codes corresponding to +/// each code point. Script codes correspond to International Components for +/// Unicode (ICU) UScriptCode values. +/// +/// See +/// [ICU project docs](http://icu-project.org/apiref/icu4c/uscript_8h.html) +/// for more details on script codes. +/// +/// For an example, see the unicode strings guide on [unicode scripts] +/// (https://www.tensorflow.org/tutorials/load_data/unicode#representing_unicode). +/// +/// Returns -1 (USCRIPT_INVALID_CODE) for invalid codepoints. Output shape will +/// match input shape. +/// +/// Examples: +/// +/// >>> tf.strings.unicode_script([1, 31, 38]) +/// +/// +/// Args: +/// * scope: A Scope object +/// * input: A Tensor of int32 Unicode code points. +/// +/// Returns: +/// * `Output`: A Tensor of int32 script codes corresponding to each input code point. +class UnicodeScript { + public: + UnicodeScript(const ::tensorflow::Scope& scope, ::tensorflow::Input input); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + Operation operation; + ::tensorflow::Output output; +}; + +/// Transcode the input text from a source encoding to a destination encoding. +/// +/// The input is a string tensor of any shape. The output is a string tensor of +/// the same shape containing the transcoded strings. Output strings are always +/// valid unicode. If the input contains invalid encoding positions, the +/// `errors` attribute sets the policy for how to deal with them. If the default +/// error-handling policy is used, invalid formatting will be substituted in the +/// output by the `replacement_char`. If the errors policy is to `ignore`, any +/// invalid encoding positions in the input are skipped and not included in the +/// output. If it set to `strict` then any invalid formatting will result in an +/// InvalidArgument error. +/// +/// This operation can be used with `output_encoding = input_encoding` to enforce +/// correct formatting for inputs even if they are already in the desired encoding. +/// +/// If the input is prefixed by a Byte Order Mark needed to determine encoding +/// (e.g. if the encoding is UTF-16 and the BOM indicates big-endian), then that +/// BOM will be consumed and not emitted into the output. If the input encoding +/// is marked with an explicit endianness (e.g. UTF-16-BE), then the BOM is +/// interpreted as a non-breaking-space and is preserved in the output (including +/// always for UTF-8). +/// +/// The end result is that if the input is marked as an explicit endianness the +/// transcoding is faithful to all codepoints in the source. If it is not marked +/// with an explicit endianness, the BOM is not considered part of the string itself +/// but as metadata, and so is not preserved in the output. +/// +/// Examples: +/// +/// >>> tf.strings.unicode_transcode(["Hello", "TensorFlow", "2.x"], "UTF-8", "UTF-16-BE") +/// +/// >>> tf.strings.unicode_transcode(["A", "B", "C"], "US ASCII", "UTF-8").numpy() +/// array([b'A', b'B', b'C'], dtype=object) +/// +/// Args: +/// * scope: A Scope object +/// * input: The text to be processed. Can have any shape. +/// * input_encoding: Text encoding of the input strings. This is any of the encodings supported +/// by ICU ucnv algorithmic converters. Examples: `"UTF-16", "US ASCII", "UTF-8"`. +/// * output_encoding: The unicode encoding to use in the output. Must be one of +/// `"UTF-8", "UTF-16-BE", "UTF-32-BE"`. Multi-byte encodings will be big-endian. +/// +/// Optional attributes (see `Attrs`): +/// * errors: Error handling policy when there is invalid formatting found in the input. +/// The value of 'strict' will cause the operation to produce a InvalidArgument +/// error on any invalid input formatting. A value of 'replace' (the default) will +/// cause the operation to replace any invalid formatting in the input with the +/// `replacement_char` codepoint. A value of 'ignore' will cause the operation to +/// skip any invalid formatting in the input and produce no corresponding output +/// character. +/// * replacement_char: The replacement character codepoint to be used in place of any invalid +/// formatting in the input when `errors='replace'`. Any valid unicode codepoint may +/// be used. The default value is the default unicode replacement character is +/// 0xFFFD or U+65533.) +/// +/// Note that for UTF-8, passing a replacement character expressible in 1 byte, such +/// as ' ', will preserve string alignment to the source since invalid bytes will be +/// replaced with a 1-byte replacement. For UTF-16-BE and UTF-16-LE, any 1 or 2 byte +/// replacement character will preserve byte alignment to the source. +/// * replace_control_characters: Whether to replace the C0 control characters (00-1F) with the +/// `replacement_char`. Default is false. +/// +/// Returns: +/// * `Output`: A string tensor containing unicode text encoded using `output_encoding`. +class UnicodeTranscode { + public: + /// Optional attribute setters for UnicodeTranscode + struct Attrs { + /// Error handling policy when there is invalid formatting found in the input. + /// The value of 'strict' will cause the operation to produce a InvalidArgument + /// error on any invalid input formatting. A value of 'replace' (the default) will + /// cause the operation to replace any invalid formatting in the input with the + /// `replacement_char` codepoint. A value of 'ignore' will cause the operation to + /// skip any invalid formatting in the input and produce no corresponding output + /// character. + /// + /// Defaults to "replace" + TF_MUST_USE_RESULT Attrs Errors(StringPiece x) { + Attrs ret = *this; + ret.errors_ = x; + return ret; + } + + /// The replacement character codepoint to be used in place of any invalid + /// formatting in the input when `errors='replace'`. Any valid unicode codepoint may + /// be used. The default value is the default unicode replacement character is + /// 0xFFFD or U+65533.) + /// + /// Note that for UTF-8, passing a replacement character expressible in 1 byte, such + /// as ' ', will preserve string alignment to the source since invalid bytes will be + /// replaced with a 1-byte replacement. For UTF-16-BE and UTF-16-LE, any 1 or 2 byte + /// replacement character will preserve byte alignment to the source. + /// + /// Defaults to 65533 + TF_MUST_USE_RESULT Attrs ReplacementChar(int64 x) { + Attrs ret = *this; + ret.replacement_char_ = x; + return ret; + } + + /// Whether to replace the C0 control characters (00-1F) with the + /// `replacement_char`. Default is false. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs ReplaceControlCharacters(bool x) { + Attrs ret = *this; + ret.replace_control_characters_ = x; + return ret; + } + + StringPiece errors_ = "replace"; + int64 replacement_char_ = 65533; + bool replace_control_characters_ = false; + }; + UnicodeTranscode(const ::tensorflow::Scope& scope, ::tensorflow::Input input, + StringPiece input_encoding, StringPiece output_encoding); + UnicodeTranscode(const ::tensorflow::Scope& scope, ::tensorflow::Input input, + StringPiece input_encoding, StringPiece output_encoding, const + UnicodeTranscode::Attrs& attrs); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + static Attrs Errors(StringPiece x) { + return Attrs().Errors(x); + } + static Attrs ReplacementChar(int64 x) { + return Attrs().ReplacementChar(x); + } + static Attrs ReplaceControlCharacters(bool x) { + return Attrs().ReplaceControlCharacters(x); + } + + Operation operation; + ::tensorflow::Output output; +}; + +/// @} + +} // namespace ops +} // namespace tensorflow + +#endif // TENSORFLOW_CC_OPS_STRING_OPS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/ops/string_ops_internal.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/ops/string_ops_internal.h new file mode 100644 index 0000000000000000000000000000000000000000..34689bac3db98cfeb7703308d09c4242be034935 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/ops/string_ops_internal.h @@ -0,0 +1,483 @@ +// This file is MACHINE GENERATED! Do not edit. + +#ifndef TENSORFLOW_CC_OPS_STRING_OPS_INTERNAL_H_ +#define TENSORFLOW_CC_OPS_STRING_OPS_INTERNAL_H_ + +// This file is MACHINE GENERATED! Do not edit. + +#include "tensorflow/cc/framework/ops.h" +#include "tensorflow/cc/framework/scope.h" +#include "tensorflow/core/framework/tensor.h" +#include "tensorflow/core/framework/tensor_shape.h" +#include "tensorflow/core/framework/types.h" +#include "tensorflow/core/lib/gtl/array_slice.h" + +namespace tensorflow { +namespace ops { +namespace internal { +// NOTE: This namespace has internal TensorFlow details that +// are not part of TensorFlow's public API. + +/// @defgroup string_ops_internal String Ops Internal +/// @{ + +/// Check if the input matches the regex pattern. +/// +/// The input is a string tensor of any shape. The pattern is the +/// regular expression to be matched with every element of the input tensor. +/// The boolean values (True or False) of the output tensor indicate +/// if the input matches the regex pattern provided. +/// +/// The pattern follows the re2 syntax (https://github.com/google/re2/wiki/Syntax) +/// +/// Args: +/// * scope: A Scope object +/// * input: A string tensor of the text to be processed. +/// * pattern: The regular expression to match the input. +/// +/// Returns: +/// * `Output`: A bool tensor with the same shape as `input`. +class StaticRegexFullMatch { + public: + StaticRegexFullMatch(const ::tensorflow::Scope& scope, ::tensorflow::Input + input, StringPiece pattern); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + Operation operation; + ::tensorflow::Output output; +}; + +/// Replaces the match of pattern in input with rewrite. +/// +/// It follows the re2 syntax (https://github.com/google/re2/wiki/Syntax) +/// +/// Args: +/// * scope: A Scope object +/// * input: The text to be processed. +/// * pattern: The regular expression to match the input. +/// * rewrite: The rewrite to be applied to the matched expression. +/// +/// Optional attributes (see `Attrs`): +/// * replace_global: If True, the replacement is global, otherwise the replacement +/// is done only on the first match. +/// +/// Returns: +/// * `Output`: The text after applying pattern and rewrite. +class StaticRegexReplace { + public: + /// Optional attribute setters for StaticRegexReplace + struct Attrs { + /// If True, the replacement is global, otherwise the replacement + /// is done only on the first match. + /// + /// Defaults to true + TF_MUST_USE_RESULT Attrs ReplaceGlobal(bool x) { + Attrs ret = *this; + ret.replace_global_ = x; + return ret; + } + + bool replace_global_ = true; + }; + StaticRegexReplace(const ::tensorflow::Scope& scope, ::tensorflow::Input input, + StringPiece pattern, StringPiece rewrite); + StaticRegexReplace(const ::tensorflow::Scope& scope, ::tensorflow::Input input, + StringPiece pattern, StringPiece rewrite, const + StaticRegexReplace::Attrs& attrs); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + static Attrs ReplaceGlobal(bool x) { + return Attrs().ReplaceGlobal(x); + } + + Operation operation; + ::tensorflow::Output output; +}; + +/// Decodes each string in `input` into a sequence of Unicode code points. +/// +/// The character codepoints for all strings are returned using a single vector +/// `char_values`, with strings expanded to characters in row-major order. +/// +/// The `row_splits` tensor indicates where the codepoints for +/// each input string begin and end within the `char_values` tensor. +/// In particular, the values for the `i`th +/// string (in row-major order) are stored in the slice +/// `[row_splits[i]:row_splits[i+1]]`. Thus: +/// +/// * `char_values[row_splits[i]+j]` is the Unicode codepoint for the `j`th +/// character in the `i`th string (in row-major order). +/// * `row_splits[i+1] - row_splits[i]` is the number of characters in the `i`th +/// string (in row-major order). +/// +/// Args: +/// * scope: A Scope object +/// * input: The text to be decoded. Can have any shape. Note that the output is flattened +/// to a vector of char values. +/// * input_encoding: Text encoding of the input strings. This is any of the encodings supported +/// by ICU ucnv algorithmic converters. Examples: `"UTF-16", "US ASCII", "UTF-8"`. +/// +/// Optional attributes (see `Attrs`): +/// * errors: Error handling policy when there is invalid formatting found in the input. +/// The value of 'strict' will cause the operation to produce a InvalidArgument +/// error on any invalid input formatting. A value of 'replace' (the default) will +/// cause the operation to replace any invalid formatting in the input with the +/// `replacement_char` codepoint. A value of 'ignore' will cause the operation to +/// skip any invalid formatting in the input and produce no corresponding output +/// character. +/// * replacement_char: The replacement character codepoint to be used in place of any invalid +/// formatting in the input when `errors='replace'`. Any valid unicode codepoint may +/// be used. The default value is the default unicode replacement character is +/// 0xFFFD or U+65533.) +/// * replace_control_characters: Whether to replace the C0 control characters (00-1F) with the +/// `replacement_char`. Default is false. +/// +/// Returns: +/// * `Output` row_splits: A 1D int32 tensor containing the row splits. +/// * `Output` char_values: A 1D int32 Tensor containing the decoded codepoints. +class UnicodeDecode { + public: + /// Optional attribute setters for UnicodeDecode + struct Attrs { + /// Error handling policy when there is invalid formatting found in the input. + /// The value of 'strict' will cause the operation to produce a InvalidArgument + /// error on any invalid input formatting. A value of 'replace' (the default) will + /// cause the operation to replace any invalid formatting in the input with the + /// `replacement_char` codepoint. A value of 'ignore' will cause the operation to + /// skip any invalid formatting in the input and produce no corresponding output + /// character. + /// + /// Defaults to "replace" + TF_MUST_USE_RESULT Attrs Errors(StringPiece x) { + Attrs ret = *this; + ret.errors_ = x; + return ret; + } + + /// The replacement character codepoint to be used in place of any invalid + /// formatting in the input when `errors='replace'`. Any valid unicode codepoint may + /// be used. The default value is the default unicode replacement character is + /// 0xFFFD or U+65533.) + /// + /// Defaults to 65533 + TF_MUST_USE_RESULT Attrs ReplacementChar(int64 x) { + Attrs ret = *this; + ret.replacement_char_ = x; + return ret; + } + + /// Whether to replace the C0 control characters (00-1F) with the + /// `replacement_char`. Default is false. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs ReplaceControlCharacters(bool x) { + Attrs ret = *this; + ret.replace_control_characters_ = x; + return ret; + } + + /// Defaults to DT_INT64 + TF_MUST_USE_RESULT Attrs Tsplits(DataType x) { + Attrs ret = *this; + ret.Tsplits_ = x; + return ret; + } + + StringPiece errors_ = "replace"; + int64 replacement_char_ = 65533; + bool replace_control_characters_ = false; + DataType Tsplits_ = DT_INT64; + }; + UnicodeDecode(const ::tensorflow::Scope& scope, ::tensorflow::Input input, + StringPiece input_encoding); + UnicodeDecode(const ::tensorflow::Scope& scope, ::tensorflow::Input input, + StringPiece input_encoding, const UnicodeDecode::Attrs& attrs); + + static Attrs Errors(StringPiece x) { + return Attrs().Errors(x); + } + static Attrs ReplacementChar(int64 x) { + return Attrs().ReplacementChar(x); + } + static Attrs ReplaceControlCharacters(bool x) { + return Attrs().ReplaceControlCharacters(x); + } + static Attrs Tsplits(DataType x) { + return Attrs().Tsplits(x); + } + + Operation operation; + ::tensorflow::Output row_splits; + ::tensorflow::Output char_values; +}; + +/// Decodes each string in `input` into a sequence of Unicode code points. +/// +/// The character codepoints for all strings are returned using a single vector +/// `char_values`, with strings expanded to characters in row-major order. +/// Similarly, the character start byte offsets are returned using a single vector +/// `char_to_byte_starts`, with strings expanded in row-major order. +/// +/// The `row_splits` tensor indicates where the codepoints and start offsets for +/// each input string begin and end within the `char_values` and +/// `char_to_byte_starts` tensors. In particular, the values for the `i`th +/// string (in row-major order) are stored in the slice +/// `[row_splits[i]:row_splits[i+1]]`. Thus: +/// +/// * `char_values[row_splits[i]+j]` is the Unicode codepoint for the `j`th +/// character in the `i`th string (in row-major order). +/// * `char_to_bytes_starts[row_splits[i]+j]` is the start byte offset for the `j`th +/// character in the `i`th string (in row-major order). +/// * `row_splits[i+1] - row_splits[i]` is the number of characters in the `i`th +/// string (in row-major order). +/// +/// Args: +/// * scope: A Scope object +/// * input: The text to be decoded. Can have any shape. Note that the output is flattened +/// to a vector of char values. +/// * input_encoding: Text encoding of the input strings. This is any of the encodings supported +/// by ICU ucnv algorithmic converters. Examples: `"UTF-16", "US ASCII", "UTF-8"`. +/// +/// Optional attributes (see `Attrs`): +/// * errors: Error handling policy when there is invalid formatting found in the input. +/// The value of 'strict' will cause the operation to produce a InvalidArgument +/// error on any invalid input formatting. A value of 'replace' (the default) will +/// cause the operation to replace any invalid formatting in the input with the +/// `replacement_char` codepoint. A value of 'ignore' will cause the operation to +/// skip any invalid formatting in the input and produce no corresponding output +/// character. +/// * replacement_char: The replacement character codepoint to be used in place of any invalid +/// formatting in the input when `errors='replace'`. Any valid unicode codepoint may +/// be used. The default value is the default unicode replacement character is +/// 0xFFFD or U+65533.) +/// * replace_control_characters: Whether to replace the C0 control characters (00-1F) with the +/// `replacement_char`. Default is false. +/// +/// Returns: +/// * `Output` row_splits: A 1D int32 tensor containing the row splits. +/// * `Output` char_values: A 1D int32 Tensor containing the decoded codepoints. +/// * `Output` char_to_byte_starts: A 1D int32 Tensor containing the byte index in the input string where each +/// character in `char_values` starts. +class UnicodeDecodeWithOffsets { + public: + /// Optional attribute setters for UnicodeDecodeWithOffsets + struct Attrs { + /// Error handling policy when there is invalid formatting found in the input. + /// The value of 'strict' will cause the operation to produce a InvalidArgument + /// error on any invalid input formatting. A value of 'replace' (the default) will + /// cause the operation to replace any invalid formatting in the input with the + /// `replacement_char` codepoint. A value of 'ignore' will cause the operation to + /// skip any invalid formatting in the input and produce no corresponding output + /// character. + /// + /// Defaults to "replace" + TF_MUST_USE_RESULT Attrs Errors(StringPiece x) { + Attrs ret = *this; + ret.errors_ = x; + return ret; + } + + /// The replacement character codepoint to be used in place of any invalid + /// formatting in the input when `errors='replace'`. Any valid unicode codepoint may + /// be used. The default value is the default unicode replacement character is + /// 0xFFFD or U+65533.) + /// + /// Defaults to 65533 + TF_MUST_USE_RESULT Attrs ReplacementChar(int64 x) { + Attrs ret = *this; + ret.replacement_char_ = x; + return ret; + } + + /// Whether to replace the C0 control characters (00-1F) with the + /// `replacement_char`. Default is false. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs ReplaceControlCharacters(bool x) { + Attrs ret = *this; + ret.replace_control_characters_ = x; + return ret; + } + + /// Defaults to DT_INT64 + TF_MUST_USE_RESULT Attrs Tsplits(DataType x) { + Attrs ret = *this; + ret.Tsplits_ = x; + return ret; + } + + StringPiece errors_ = "replace"; + int64 replacement_char_ = 65533; + bool replace_control_characters_ = false; + DataType Tsplits_ = DT_INT64; + }; + UnicodeDecodeWithOffsets(const ::tensorflow::Scope& scope, ::tensorflow::Input + input, StringPiece input_encoding); + UnicodeDecodeWithOffsets(const ::tensorflow::Scope& scope, ::tensorflow::Input + input, StringPiece input_encoding, const + UnicodeDecodeWithOffsets::Attrs& attrs); + + static Attrs Errors(StringPiece x) { + return Attrs().Errors(x); + } + static Attrs ReplacementChar(int64 x) { + return Attrs().ReplacementChar(x); + } + static Attrs ReplaceControlCharacters(bool x) { + return Attrs().ReplaceControlCharacters(x); + } + static Attrs Tsplits(DataType x) { + return Attrs().Tsplits(x); + } + + Operation operation; + ::tensorflow::Output row_splits; + ::tensorflow::Output char_values; + ::tensorflow::Output char_to_byte_starts; +}; + +/// Encode a tensor of ints into unicode strings. +/// +/// Returns a vector of strings, where `output[i]` is constructed by encoding the +/// Unicode codepoints in `input_values[input_splits[i]:input_splits[i+1]]` +/// using `output_encoding`. +/// +/// --- +/// +/// Example: +/// +/// ``` +/// input_values = [72, 101, 108, 108, 111, 87, 111, 114, 108, 100] +/// input_splits = [0, 5, 10] +/// output_encoding = 'UTF-8' +/// +/// output = ['Hello', 'World'] +/// ``` +/// +/// Args: +/// * scope: A Scope object +/// * input_values: A 1D tensor containing the unicode codepoints that should be encoded. +/// * input_splits: A 1D tensor specifying how the unicode codepoints should be split into strings. +/// In particular, `output[i]` is constructed by encoding the codepoints in the +/// slice `input_values[input_splits[i]:input_splits[i+1]]`. +/// * output_encoding: Unicode encoding of the output strings. Valid encodings are: `"UTF-8", +/// "UTF-16-BE", and "UTF-32-BE"`. +/// +/// Optional attributes (see `Attrs`): +/// * errors: Error handling policy when there is invalid formatting found in the input. +/// The value of 'strict' will cause the operation to produce a InvalidArgument +/// error on any invalid input formatting. A value of 'replace' (the default) will +/// cause the operation to replace any invalid formatting in the input with the +/// `replacement_char` codepoint. A value of 'ignore' will cause the operation to +/// skip any invalid formatting in the input and produce no corresponding output +/// character. +/// * replacement_char: The replacement character codepoint to be used in place of any invalid +/// formatting in the input when `errors='replace'`. Any valid unicode codepoint may +/// be used. The default value is the default unicode replacement character is +/// 0xFFFD (U+65533). +/// +/// Returns: +/// * `Output`: The 1-D Tensor of strings encoded from the provided unicode codepoints. +class UnicodeEncode { + public: + /// Optional attribute setters for UnicodeEncode + struct Attrs { + /// Error handling policy when there is invalid formatting found in the input. + /// The value of 'strict' will cause the operation to produce a InvalidArgument + /// error on any invalid input formatting. A value of 'replace' (the default) will + /// cause the operation to replace any invalid formatting in the input with the + /// `replacement_char` codepoint. A value of 'ignore' will cause the operation to + /// skip any invalid formatting in the input and produce no corresponding output + /// character. + /// + /// Defaults to "replace" + TF_MUST_USE_RESULT Attrs Errors(StringPiece x) { + Attrs ret = *this; + ret.errors_ = x; + return ret; + } + + /// The replacement character codepoint to be used in place of any invalid + /// formatting in the input when `errors='replace'`. Any valid unicode codepoint may + /// be used. The default value is the default unicode replacement character is + /// 0xFFFD (U+65533). + /// + /// Defaults to 65533 + TF_MUST_USE_RESULT Attrs ReplacementChar(int64 x) { + Attrs ret = *this; + ret.replacement_char_ = x; + return ret; + } + + StringPiece errors_ = "replace"; + int64 replacement_char_ = 65533; + }; + UnicodeEncode(const ::tensorflow::Scope& scope, ::tensorflow::Input + input_values, ::tensorflow::Input input_splits, StringPiece + output_encoding); + UnicodeEncode(const ::tensorflow::Scope& scope, ::tensorflow::Input + input_values, ::tensorflow::Input input_splits, StringPiece + output_encoding, const UnicodeEncode::Attrs& attrs); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + static Attrs Errors(StringPiece x) { + return Attrs().Errors(x); + } + static Attrs ReplacementChar(int64 x) { + return Attrs().ReplacementChar(x); + } + + Operation operation; + ::tensorflow::Output output; +}; + +/// TODO: add doc. +/// +/// Args: +/// * scope: A Scope object +/// +/// Returns: +/// * `Output`: The output tensor. +class UnsortedSegmentJoin { + public: + /// Optional attribute setters for UnsortedSegmentJoin + struct Attrs { + /// Defaults to "" + TF_MUST_USE_RESULT Attrs Separator(StringPiece x) { + Attrs ret = *this; + ret.separator_ = x; + return ret; + } + + StringPiece separator_ = ""; + }; + UnsortedSegmentJoin(const ::tensorflow::Scope& scope, ::tensorflow::Input + inputs, ::tensorflow::Input segment_ids, + ::tensorflow::Input num_segments); + UnsortedSegmentJoin(const ::tensorflow::Scope& scope, ::tensorflow::Input + inputs, ::tensorflow::Input segment_ids, + ::tensorflow::Input num_segments, const + UnsortedSegmentJoin::Attrs& attrs); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + static Attrs Separator(StringPiece x) { + return Attrs().Separator(x); + } + + Operation operation; + ::tensorflow::Output output; +}; + +} // namespace internal +} // namespace ops +} // namespace tensorflow + +#endif // TENSORFLOW_CC_OPS_STRING_OPS_INTERNAL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/ops/training_ops.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/ops/training_ops.h new file mode 100644 index 0000000000000000000000000000000000000000..5ceb30ee289f1a3eaea56be14f7ae33ed26cca59 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/ops/training_ops.h @@ -0,0 +1,3495 @@ +// This file is MACHINE GENERATED! Do not edit. + +#ifndef TENSORFLOW_CC_OPS_TRAINING_OPS_H_ +#define TENSORFLOW_CC_OPS_TRAINING_OPS_H_ + +// This file is MACHINE GENERATED! Do not edit. + +#include "tensorflow/cc/framework/ops.h" +#include "tensorflow/cc/framework/scope.h" +#include "tensorflow/core/framework/tensor.h" +#include "tensorflow/core/framework/tensor_shape.h" +#include "tensorflow/core/framework/types.h" +#include "tensorflow/core/lib/gtl/array_slice.h" + +namespace tensorflow { +namespace ops { + +/// @defgroup training_ops Training Ops +/// @{ + +/// Update '*var' according to the adadelta scheme. +/// +/// accum = rho() * accum + (1 - rho()) * grad.square(); +/// update = (update_accum + epsilon).sqrt() * (accum + epsilon()).rsqrt() * grad; +/// update_accum = rho() * update_accum + (1 - rho()) * update.square(); +/// var -= update; +/// +/// Args: +/// * scope: A Scope object +/// * var: Should be from a Variable(). +/// * accum: Should be from a Variable(). +/// * accum_update: Should be from a Variable(). +/// * lr: Scaling factor. Must be a scalar. +/// * rho: Decay factor. Must be a scalar. +/// * epsilon: Constant factor. Must be a scalar. +/// * grad: The gradient. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If True, updating of the var, accum and update_accum tensors will be protected by +/// a lock; otherwise the behavior is undefined, but may exhibit less contention. +/// +/// Returns: +/// * `Output`: Same as "var". +class ApplyAdadelta { + public: + /// Optional attribute setters for ApplyAdadelta + struct Attrs { + /// If True, updating of the var, accum and update_accum tensors will be protected by + /// a lock; otherwise the behavior is undefined, but may exhibit less contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + bool use_locking_ = false; + }; + ApplyAdadelta(const ::tensorflow::Scope& scope, ::tensorflow::Input var, + ::tensorflow::Input accum, ::tensorflow::Input accum_update, + ::tensorflow::Input lr, ::tensorflow::Input rho, + ::tensorflow::Input epsilon, ::tensorflow::Input grad); + ApplyAdadelta(const ::tensorflow::Scope& scope, ::tensorflow::Input var, + ::tensorflow::Input accum, ::tensorflow::Input accum_update, + ::tensorflow::Input lr, ::tensorflow::Input rho, + ::tensorflow::Input epsilon, ::tensorflow::Input grad, const + ApplyAdadelta::Attrs& attrs); + operator ::tensorflow::Output() const { return out; } + operator ::tensorflow::Input() const { return out; } + ::tensorflow::Node* node() const { return out.node(); } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + + Operation operation; + ::tensorflow::Output out; +}; + +/// Update '*var' according to the adagrad scheme. +/// +/// accum += grad * grad +/// var -= lr * grad * (1 / sqrt(accum)) +/// +/// Args: +/// * scope: A Scope object +/// * var: Should be from a Variable(). +/// * accum: Should be from a Variable(). +/// * lr: Scaling factor. Must be a scalar. +/// * grad: The gradient. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If `True`, updating of the var and accum tensors will be protected +/// by a lock; otherwise the behavior is undefined, but may exhibit less +/// contention. +/// +/// Returns: +/// * `Output`: Same as "var". +class ApplyAdagrad { + public: + /// Optional attribute setters for ApplyAdagrad + struct Attrs { + /// If `True`, updating of the var and accum tensors will be protected + /// by a lock; otherwise the behavior is undefined, but may exhibit less + /// contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + /// Defaults to true + TF_MUST_USE_RESULT Attrs UpdateSlots(bool x) { + Attrs ret = *this; + ret.update_slots_ = x; + return ret; + } + + bool use_locking_ = false; + bool update_slots_ = true; + }; + ApplyAdagrad(const ::tensorflow::Scope& scope, ::tensorflow::Input var, + ::tensorflow::Input accum, ::tensorflow::Input lr, + ::tensorflow::Input grad); + ApplyAdagrad(const ::tensorflow::Scope& scope, ::tensorflow::Input var, + ::tensorflow::Input accum, ::tensorflow::Input lr, + ::tensorflow::Input grad, const ApplyAdagrad::Attrs& attrs); + operator ::tensorflow::Output() const { return out; } + operator ::tensorflow::Input() const { return out; } + ::tensorflow::Node* node() const { return out.node(); } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + static Attrs UpdateSlots(bool x) { + return Attrs().UpdateSlots(x); + } + + Operation operation; + ::tensorflow::Output out; +}; + +/// Update '*var' according to the proximal adagrad scheme. +/// +/// Args: +/// * scope: A Scope object +/// * var: Should be from a Variable(). +/// * gradient_accumulator: Should be from a Variable(). +/// * gradient_squared_accumulator: Should be from a Variable(). +/// * grad: The gradient. +/// * lr: Scaling factor. Must be a scalar. +/// * l1: L1 regularization. Must be a scalar. +/// * l2: L2 regularization. Must be a scalar. +/// * global_step: Training step number. Must be a scalar. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If True, updating of the var and accum tensors will be protected by +/// a lock; otherwise the behavior is undefined, but may exhibit less contention. +/// +/// Returns: +/// * `Output`: Same as "var". +class ApplyAdagradDA { + public: + /// Optional attribute setters for ApplyAdagradDA + struct Attrs { + /// If True, updating of the var and accum tensors will be protected by + /// a lock; otherwise the behavior is undefined, but may exhibit less contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + bool use_locking_ = false; + }; + ApplyAdagradDA(const ::tensorflow::Scope& scope, ::tensorflow::Input var, + ::tensorflow::Input gradient_accumulator, ::tensorflow::Input + gradient_squared_accumulator, ::tensorflow::Input grad, + ::tensorflow::Input lr, ::tensorflow::Input l1, + ::tensorflow::Input l2, ::tensorflow::Input global_step); + ApplyAdagradDA(const ::tensorflow::Scope& scope, ::tensorflow::Input var, + ::tensorflow::Input gradient_accumulator, ::tensorflow::Input + gradient_squared_accumulator, ::tensorflow::Input grad, + ::tensorflow::Input lr, ::tensorflow::Input l1, + ::tensorflow::Input l2, ::tensorflow::Input global_step, const + ApplyAdagradDA::Attrs& attrs); + operator ::tensorflow::Output() const { return out; } + operator ::tensorflow::Input() const { return out; } + ::tensorflow::Node* node() const { return out.node(); } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + + Operation operation; + ::tensorflow::Output out; +}; + +/// Update '*var' according to the Adam algorithm. +/// +/// $$\text{lr}_t := \mathrm{lr} \cdot \frac{\sqrt{1 - \beta_2^t}}{1 - \beta_1^t}$$ +/// $$m_t := \beta_1 \cdot m_{t-1} + (1 - \beta_1) \cdot g$$ +/// $$v_t := \beta_2 \cdot v_{t-1} + (1 - \beta_2) \cdot g^2$$ +/// $$\text{var} := \begin{cases} \text{var} - (m_t \beta_1 + g \cdot (1 - \beta_1))\cdot\text{lr}_t/(\sqrt{v_t} + \epsilon), &\text{if use_nesterov}\\\\ \text{var} - m_t \cdot \text{lr}_t /(\sqrt{v_t} + \epsilon), &\text{otherwise} \end{cases}$$ +/// +/// Args: +/// * scope: A Scope object +/// * var: Should be from a Variable(). +/// * m: Should be from a Variable(). +/// * v: Should be from a Variable(). +/// * beta1_power: Must be a scalar. +/// * beta2_power: Must be a scalar. +/// * lr: Scaling factor. Must be a scalar. +/// * beta1: Momentum factor. Must be a scalar. +/// * beta2: Momentum factor. Must be a scalar. +/// * epsilon: Ridge term. Must be a scalar. +/// * grad: The gradient. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If `True`, updating of the var, m, and v tensors will be protected +/// by a lock; otherwise the behavior is undefined, but may exhibit less +/// contention. +/// * use_nesterov: If `True`, uses the nesterov update. +/// +/// Returns: +/// * `Output`: Same as "var". +class ApplyAdam { + public: + /// Optional attribute setters for ApplyAdam + struct Attrs { + /// If `True`, updating of the var, m, and v tensors will be protected + /// by a lock; otherwise the behavior is undefined, but may exhibit less + /// contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + /// If `True`, uses the nesterov update. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseNesterov(bool x) { + Attrs ret = *this; + ret.use_nesterov_ = x; + return ret; + } + + bool use_locking_ = false; + bool use_nesterov_ = false; + }; + ApplyAdam(const ::tensorflow::Scope& scope, ::tensorflow::Input var, + ::tensorflow::Input m, ::tensorflow::Input v, ::tensorflow::Input + beta1_power, ::tensorflow::Input beta2_power, ::tensorflow::Input lr, + ::tensorflow::Input beta1, ::tensorflow::Input beta2, + ::tensorflow::Input epsilon, ::tensorflow::Input grad); + ApplyAdam(const ::tensorflow::Scope& scope, ::tensorflow::Input var, + ::tensorflow::Input m, ::tensorflow::Input v, ::tensorflow::Input + beta1_power, ::tensorflow::Input beta2_power, ::tensorflow::Input lr, + ::tensorflow::Input beta1, ::tensorflow::Input beta2, + ::tensorflow::Input epsilon, ::tensorflow::Input grad, const + ApplyAdam::Attrs& attrs); + operator ::tensorflow::Output() const { return out; } + operator ::tensorflow::Input() const { return out; } + ::tensorflow::Node* node() const { return out.node(); } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + static Attrs UseNesterov(bool x) { + return Attrs().UseNesterov(x); + } + + Operation operation; + ::tensorflow::Output out; +}; + +/// Update '*var' according to the AddSign update. +/// +/// m_t <- beta1 * m_{t-1} + (1 - beta1) * g +/// update <- (alpha + sign_decay * sign(g) *sign(m)) * g +/// variable <- variable - lr_t * update +/// +/// Args: +/// * scope: A Scope object +/// * var: Should be from a Variable(). +/// * m: Should be from a Variable(). +/// * lr: Scaling factor. Must be a scalar. +/// * alpha: Must be a scalar. +/// * sign_decay: Must be a scalar. +/// * beta: Must be a scalar. +/// * grad: The gradient. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If `True`, updating of the var and m tensors is +/// protected by a lock; otherwise the behavior is undefined, but may exhibit less +/// contention. +/// +/// Returns: +/// * `Output`: Same as "var". +class ApplyAddSign { + public: + /// Optional attribute setters for ApplyAddSign + struct Attrs { + /// If `True`, updating of the var and m tensors is + /// protected by a lock; otherwise the behavior is undefined, but may exhibit less + /// contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + bool use_locking_ = false; + }; + ApplyAddSign(const ::tensorflow::Scope& scope, ::tensorflow::Input var, + ::tensorflow::Input m, ::tensorflow::Input lr, ::tensorflow::Input + alpha, ::tensorflow::Input sign_decay, ::tensorflow::Input beta, + ::tensorflow::Input grad); + ApplyAddSign(const ::tensorflow::Scope& scope, ::tensorflow::Input var, + ::tensorflow::Input m, ::tensorflow::Input lr, ::tensorflow::Input + alpha, ::tensorflow::Input sign_decay, ::tensorflow::Input beta, + ::tensorflow::Input grad, const ApplyAddSign::Attrs& attrs); + operator ::tensorflow::Output() const { return out; } + operator ::tensorflow::Input() const { return out; } + ::tensorflow::Node* node() const { return out.node(); } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + + Operation operation; + ::tensorflow::Output out; +}; + +/// Update '*var' according to the centered RMSProp algorithm. +/// +/// The centered RMSProp algorithm uses an estimate of the centered second moment +/// (i.e., the variance) for normalization, as opposed to regular RMSProp, which +/// uses the (uncentered) second moment. This often helps with training, but is +/// slightly more expensive in terms of computation and memory. +/// +/// Note that in dense implementation of this algorithm, mg, ms, and mom will +/// update even if the grad is zero, but in this sparse implementation, mg, ms, +/// and mom will not update in iterations during which the grad is zero. +/// +/// mean_square = decay * mean_square + (1-decay) * gradient ** 2 +/// mean_grad = decay * mean_grad + (1-decay) * gradient +/// +/// Delta = learning_rate * gradient / sqrt(mean_square + epsilon - mean_grad ** 2) +/// +/// mg <- rho * mg_{t-1} + (1-rho) * grad +/// ms <- rho * ms_{t-1} + (1-rho) * grad * grad +/// mom <- momentum * mom_{t-1} + lr * grad / sqrt(ms - mg * mg + epsilon) +/// var <- var - mom +/// +/// Args: +/// * scope: A Scope object +/// * var: Should be from a Variable(). +/// * mg: Should be from a Variable(). +/// * ms: Should be from a Variable(). +/// * mom: Should be from a Variable(). +/// * lr: Scaling factor. Must be a scalar. +/// * rho: Decay rate. Must be a scalar. +/// * momentum: Momentum Scale. Must be a scalar. +/// * epsilon: Ridge term. Must be a scalar. +/// * grad: The gradient. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If `True`, updating of the var, mg, ms, and mom tensors is +/// protected by a lock; otherwise the behavior is undefined, but may exhibit less +/// contention. +/// +/// Returns: +/// * `Output`: Same as "var". +class ApplyCenteredRMSProp { + public: + /// Optional attribute setters for ApplyCenteredRMSProp + struct Attrs { + /// If `True`, updating of the var, mg, ms, and mom tensors is + /// protected by a lock; otherwise the behavior is undefined, but may exhibit less + /// contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + bool use_locking_ = false; + }; + ApplyCenteredRMSProp(const ::tensorflow::Scope& scope, ::tensorflow::Input var, + ::tensorflow::Input mg, ::tensorflow::Input ms, + ::tensorflow::Input mom, ::tensorflow::Input lr, + ::tensorflow::Input rho, ::tensorflow::Input momentum, + ::tensorflow::Input epsilon, ::tensorflow::Input grad); + ApplyCenteredRMSProp(const ::tensorflow::Scope& scope, ::tensorflow::Input var, + ::tensorflow::Input mg, ::tensorflow::Input ms, + ::tensorflow::Input mom, ::tensorflow::Input lr, + ::tensorflow::Input rho, ::tensorflow::Input momentum, + ::tensorflow::Input epsilon, ::tensorflow::Input grad, + const ApplyCenteredRMSProp::Attrs& attrs); + operator ::tensorflow::Output() const { return out; } + operator ::tensorflow::Input() const { return out; } + ::tensorflow::Node* node() const { return out.node(); } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + + Operation operation; + ::tensorflow::Output out; +}; + +/// Update '*var' according to the Ftrl-proximal scheme. +/// +/// accum_new = accum + grad * grad +/// linear += grad - (accum_new^(-lr_power) - accum^(-lr_power)) / lr * var +/// quadratic = 1.0 / (accum_new^(lr_power) * lr) + 2 * l2 +/// var = (sign(linear) * l1 - linear) / quadratic if |linear| > l1 else 0.0 +/// accum = accum_new +/// +/// Args: +/// * scope: A Scope object +/// * var: Should be from a Variable(). +/// * accum: Should be from a Variable(). +/// * linear: Should be from a Variable(). +/// * grad: The gradient. +/// * lr: Scaling factor. Must be a scalar. +/// * l1: L1 regularization. Must be a scalar. +/// * l2: L2 regularization. Must be a scalar. +/// * lr_power: Scaling factor. Must be a scalar. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If `True`, updating of the var and accum tensors will be protected +/// by a lock; otherwise the behavior is undefined, but may exhibit less +/// contention. +/// +/// Returns: +/// * `Output`: Same as "var". +class ApplyFtrl { + public: + /// Optional attribute setters for ApplyFtrl + struct Attrs { + /// If `True`, updating of the var and accum tensors will be protected + /// by a lock; otherwise the behavior is undefined, but may exhibit less + /// contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + /// Defaults to false + TF_MUST_USE_RESULT Attrs MultiplyLinearByLr(bool x) { + Attrs ret = *this; + ret.multiply_linear_by_lr_ = x; + return ret; + } + + bool use_locking_ = false; + bool multiply_linear_by_lr_ = false; + }; + ApplyFtrl(const ::tensorflow::Scope& scope, ::tensorflow::Input var, + ::tensorflow::Input accum, ::tensorflow::Input linear, + ::tensorflow::Input grad, ::tensorflow::Input lr, ::tensorflow::Input + l1, ::tensorflow::Input l2, ::tensorflow::Input lr_power); + ApplyFtrl(const ::tensorflow::Scope& scope, ::tensorflow::Input var, + ::tensorflow::Input accum, ::tensorflow::Input linear, + ::tensorflow::Input grad, ::tensorflow::Input lr, ::tensorflow::Input + l1, ::tensorflow::Input l2, ::tensorflow::Input lr_power, const + ApplyFtrl::Attrs& attrs); + operator ::tensorflow::Output() const { return out; } + operator ::tensorflow::Input() const { return out; } + ::tensorflow::Node* node() const { return out.node(); } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + static Attrs MultiplyLinearByLr(bool x) { + return Attrs().MultiplyLinearByLr(x); + } + + Operation operation; + ::tensorflow::Output out; +}; + +/// Update '*var' according to the Ftrl-proximal scheme. +/// +/// grad_with_shrinkage = grad + 2 * l2_shrinkage * var +/// accum_new = accum + grad * grad +/// linear += grad_with_shrinkage - +/// (accum_new^(-lr_power) - accum^(-lr_power)) / lr * var +/// quadratic = 1.0 / (accum_new^(lr_power) * lr) + 2 * l2 +/// var = (sign(linear) * l1 - linear) / quadratic if |linear| > l1 else 0.0 +/// accum = accum_new +/// +/// Args: +/// * scope: A Scope object +/// * var: Should be from a Variable(). +/// * accum: Should be from a Variable(). +/// * linear: Should be from a Variable(). +/// * grad: The gradient. +/// * lr: Scaling factor. Must be a scalar. +/// * l1: L1 regularization. Must be a scalar. +/// * l2: L2 shrinkage regularization. Must be a scalar. +/// * lr_power: Scaling factor. Must be a scalar. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If `True`, updating of the var and accum tensors will be protected +/// by a lock; otherwise the behavior is undefined, but may exhibit less +/// contention. +/// +/// Returns: +/// * `Output`: Same as "var". +class ApplyFtrlV2 { + public: + /// Optional attribute setters for ApplyFtrlV2 + struct Attrs { + /// If `True`, updating of the var and accum tensors will be protected + /// by a lock; otherwise the behavior is undefined, but may exhibit less + /// contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + /// Defaults to false + TF_MUST_USE_RESULT Attrs MultiplyLinearByLr(bool x) { + Attrs ret = *this; + ret.multiply_linear_by_lr_ = x; + return ret; + } + + bool use_locking_ = false; + bool multiply_linear_by_lr_ = false; + }; + ApplyFtrlV2(const ::tensorflow::Scope& scope, ::tensorflow::Input var, + ::tensorflow::Input accum, ::tensorflow::Input linear, + ::tensorflow::Input grad, ::tensorflow::Input lr, + ::tensorflow::Input l1, ::tensorflow::Input l2, ::tensorflow::Input + l2_shrinkage, ::tensorflow::Input lr_power); + ApplyFtrlV2(const ::tensorflow::Scope& scope, ::tensorflow::Input var, + ::tensorflow::Input accum, ::tensorflow::Input linear, + ::tensorflow::Input grad, ::tensorflow::Input lr, + ::tensorflow::Input l1, ::tensorflow::Input l2, ::tensorflow::Input + l2_shrinkage, ::tensorflow::Input lr_power, const + ApplyFtrlV2::Attrs& attrs); + operator ::tensorflow::Output() const { return out; } + operator ::tensorflow::Input() const { return out; } + ::tensorflow::Node* node() const { return out.node(); } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + static Attrs MultiplyLinearByLr(bool x) { + return Attrs().MultiplyLinearByLr(x); + } + + Operation operation; + ::tensorflow::Output out; +}; + +/// Update '*var' by subtracting 'alpha' * 'delta' from it. +/// +/// Args: +/// * scope: A Scope object +/// * var: Should be from a Variable(). +/// * alpha: Scaling factor. Must be a scalar. +/// * delta: The change. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If `True`, the subtraction will be protected by a lock; +/// otherwise the behavior is undefined, but may exhibit less contention. +/// +/// Returns: +/// * `Output`: Same as "var". +class ApplyGradientDescent { + public: + /// Optional attribute setters for ApplyGradientDescent + struct Attrs { + /// If `True`, the subtraction will be protected by a lock; + /// otherwise the behavior is undefined, but may exhibit less contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + bool use_locking_ = false; + }; + ApplyGradientDescent(const ::tensorflow::Scope& scope, ::tensorflow::Input var, + ::tensorflow::Input alpha, ::tensorflow::Input delta); + ApplyGradientDescent(const ::tensorflow::Scope& scope, ::tensorflow::Input var, + ::tensorflow::Input alpha, ::tensorflow::Input delta, + const ApplyGradientDescent::Attrs& attrs); + operator ::tensorflow::Output() const { return out; } + operator ::tensorflow::Input() const { return out; } + ::tensorflow::Node* node() const { return out.node(); } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + + Operation operation; + ::tensorflow::Output out; +}; + +/// Update '*var' according to the momentum scheme. +/// +/// Set use_nesterov = True if you want to use Nesterov momentum. +/// +/// accum = accum * momentum + grad +/// var -= lr * accum +/// +/// Args: +/// * scope: A Scope object +/// * var: Should be from a Variable(). +/// * accum: Should be from a Variable(). +/// * lr: Scaling factor. Must be a scalar. +/// * grad: The gradient. +/// * momentum: Momentum. Must be a scalar. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If `True`, updating of the var and accum tensors will be protected +/// by a lock; otherwise the behavior is undefined, but may exhibit less +/// contention. +/// * use_nesterov: If `True`, the tensor passed to compute grad will be +/// var - lr * momentum * accum, so in the end, the var you get is actually +/// var - lr * momentum * accum. +/// +/// Returns: +/// * `Output`: Same as "var". +class ApplyMomentum { + public: + /// Optional attribute setters for ApplyMomentum + struct Attrs { + /// If `True`, updating of the var and accum tensors will be protected + /// by a lock; otherwise the behavior is undefined, but may exhibit less + /// contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + /// If `True`, the tensor passed to compute grad will be + /// var - lr * momentum * accum, so in the end, the var you get is actually + /// var - lr * momentum * accum. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseNesterov(bool x) { + Attrs ret = *this; + ret.use_nesterov_ = x; + return ret; + } + + bool use_locking_ = false; + bool use_nesterov_ = false; + }; + ApplyMomentum(const ::tensorflow::Scope& scope, ::tensorflow::Input var, + ::tensorflow::Input accum, ::tensorflow::Input lr, + ::tensorflow::Input grad, ::tensorflow::Input momentum); + ApplyMomentum(const ::tensorflow::Scope& scope, ::tensorflow::Input var, + ::tensorflow::Input accum, ::tensorflow::Input lr, + ::tensorflow::Input grad, ::tensorflow::Input momentum, const + ApplyMomentum::Attrs& attrs); + operator ::tensorflow::Output() const { return out; } + operator ::tensorflow::Input() const { return out; } + ::tensorflow::Node* node() const { return out.node(); } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + static Attrs UseNesterov(bool x) { + return Attrs().UseNesterov(x); + } + + Operation operation; + ::tensorflow::Output out; +}; + +/// Update '*var' according to the AddSign update. +/// +/// m_t <- beta1 * m_{t-1} + (1 - beta1) * g +/// update <- exp(logbase * sign_decay * sign(g) * sign(m_t)) * g +/// variable <- variable - lr_t * update +/// +/// Args: +/// * scope: A Scope object +/// * var: Should be from a Variable(). +/// * m: Should be from a Variable(). +/// * lr: Scaling factor. Must be a scalar. +/// * logbase: Must be a scalar. +/// * sign_decay: Must be a scalar. +/// * beta: Must be a scalar. +/// * grad: The gradient. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If `True`, updating of the var and m tensors is +/// protected by a lock; otherwise the behavior is undefined, but may exhibit less +/// contention. +/// +/// Returns: +/// * `Output`: Same as "var". +class ApplyPowerSign { + public: + /// Optional attribute setters for ApplyPowerSign + struct Attrs { + /// If `True`, updating of the var and m tensors is + /// protected by a lock; otherwise the behavior is undefined, but may exhibit less + /// contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + bool use_locking_ = false; + }; + ApplyPowerSign(const ::tensorflow::Scope& scope, ::tensorflow::Input var, + ::tensorflow::Input m, ::tensorflow::Input lr, + ::tensorflow::Input logbase, ::tensorflow::Input sign_decay, + ::tensorflow::Input beta, ::tensorflow::Input grad); + ApplyPowerSign(const ::tensorflow::Scope& scope, ::tensorflow::Input var, + ::tensorflow::Input m, ::tensorflow::Input lr, + ::tensorflow::Input logbase, ::tensorflow::Input sign_decay, + ::tensorflow::Input beta, ::tensorflow::Input grad, const + ApplyPowerSign::Attrs& attrs); + operator ::tensorflow::Output() const { return out; } + operator ::tensorflow::Input() const { return out; } + ::tensorflow::Node* node() const { return out.node(); } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + + Operation operation; + ::tensorflow::Output out; +}; + +/// Update '*var' and '*accum' according to FOBOS with Adagrad learning rate. +/// +/// accum += grad * grad +/// prox_v = var - lr * grad * (1 / sqrt(accum)) +/// var = sign(prox_v)/(1+lr*l2) * max{|prox_v|-lr*l1,0} +/// +/// Args: +/// * scope: A Scope object +/// * var: Should be from a Variable(). +/// * accum: Should be from a Variable(). +/// * lr: Scaling factor. Must be a scalar. +/// * l1: L1 regularization. Must be a scalar. +/// * l2: L2 regularization. Must be a scalar. +/// * grad: The gradient. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If True, updating of the var and accum tensors will be protected by +/// a lock; otherwise the behavior is undefined, but may exhibit less contention. +/// +/// Returns: +/// * `Output`: Same as "var". +class ApplyProximalAdagrad { + public: + /// Optional attribute setters for ApplyProximalAdagrad + struct Attrs { + /// If True, updating of the var and accum tensors will be protected by + /// a lock; otherwise the behavior is undefined, but may exhibit less contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + bool use_locking_ = false; + }; + ApplyProximalAdagrad(const ::tensorflow::Scope& scope, ::tensorflow::Input var, + ::tensorflow::Input accum, ::tensorflow::Input lr, + ::tensorflow::Input l1, ::tensorflow::Input l2, + ::tensorflow::Input grad); + ApplyProximalAdagrad(const ::tensorflow::Scope& scope, ::tensorflow::Input var, + ::tensorflow::Input accum, ::tensorflow::Input lr, + ::tensorflow::Input l1, ::tensorflow::Input l2, + ::tensorflow::Input grad, const + ApplyProximalAdagrad::Attrs& attrs); + operator ::tensorflow::Output() const { return out; } + operator ::tensorflow::Input() const { return out; } + ::tensorflow::Node* node() const { return out.node(); } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + + Operation operation; + ::tensorflow::Output out; +}; + +/// Update '*var' as FOBOS algorithm with fixed learning rate. +/// +/// prox_v = var - alpha * delta +/// var = sign(prox_v)/(1+alpha*l2) * max{|prox_v|-alpha*l1,0} +/// +/// Args: +/// * scope: A Scope object +/// * var: Should be from a Variable(). +/// * alpha: Scaling factor. Must be a scalar. +/// * l1: L1 regularization. Must be a scalar. +/// * l2: L2 regularization. Must be a scalar. +/// * delta: The change. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If True, the subtraction will be protected by a lock; +/// otherwise the behavior is undefined, but may exhibit less contention. +/// +/// Returns: +/// * `Output`: Same as "var". +class ApplyProximalGradientDescent { + public: + /// Optional attribute setters for ApplyProximalGradientDescent + struct Attrs { + /// If True, the subtraction will be protected by a lock; + /// otherwise the behavior is undefined, but may exhibit less contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + bool use_locking_ = false; + }; + ApplyProximalGradientDescent(const ::tensorflow::Scope& scope, + ::tensorflow::Input var, ::tensorflow::Input + alpha, ::tensorflow::Input l1, ::tensorflow::Input + l2, ::tensorflow::Input delta); + ApplyProximalGradientDescent(const ::tensorflow::Scope& scope, + ::tensorflow::Input var, ::tensorflow::Input + alpha, ::tensorflow::Input l1, ::tensorflow::Input + l2, ::tensorflow::Input delta, const + ApplyProximalGradientDescent::Attrs& attrs); + operator ::tensorflow::Output() const { return out; } + operator ::tensorflow::Input() const { return out; } + ::tensorflow::Node* node() const { return out.node(); } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + + Operation operation; + ::tensorflow::Output out; +}; + +/// Update '*var' according to the RMSProp algorithm. +/// +/// Note that in dense implementation of this algorithm, ms and mom will +/// update even if the grad is zero, but in this sparse implementation, ms +/// and mom will not update in iterations during which the grad is zero. +/// +/// mean_square = decay * mean_square + (1-decay) * gradient ** 2 +/// Delta = learning_rate * gradient / sqrt(mean_square + epsilon) +/// +/// ms <- rho * ms_{t-1} + (1-rho) * grad * grad +/// mom <- momentum * mom_{t-1} + lr * grad / sqrt(ms + epsilon) +/// var <- var - mom +/// +/// Args: +/// * scope: A Scope object +/// * var: Should be from a Variable(). +/// * ms: Should be from a Variable(). +/// * mom: Should be from a Variable(). +/// * lr: Scaling factor. Must be a scalar. +/// * rho: Decay rate. Must be a scalar. +/// * epsilon: Ridge term. Must be a scalar. +/// * grad: The gradient. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If `True`, updating of the var, ms, and mom tensors is protected +/// by a lock; otherwise the behavior is undefined, but may exhibit less +/// contention. +/// +/// Returns: +/// * `Output`: Same as "var". +class ApplyRMSProp { + public: + /// Optional attribute setters for ApplyRMSProp + struct Attrs { + /// If `True`, updating of the var, ms, and mom tensors is protected + /// by a lock; otherwise the behavior is undefined, but may exhibit less + /// contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + bool use_locking_ = false; + }; + ApplyRMSProp(const ::tensorflow::Scope& scope, ::tensorflow::Input var, + ::tensorflow::Input ms, ::tensorflow::Input mom, + ::tensorflow::Input lr, ::tensorflow::Input rho, + ::tensorflow::Input momentum, ::tensorflow::Input epsilon, + ::tensorflow::Input grad); + ApplyRMSProp(const ::tensorflow::Scope& scope, ::tensorflow::Input var, + ::tensorflow::Input ms, ::tensorflow::Input mom, + ::tensorflow::Input lr, ::tensorflow::Input rho, + ::tensorflow::Input momentum, ::tensorflow::Input epsilon, + ::tensorflow::Input grad, const ApplyRMSProp::Attrs& attrs); + operator ::tensorflow::Output() const { return out; } + operator ::tensorflow::Input() const { return out; } + ::tensorflow::Node* node() const { return out.node(); } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + + Operation operation; + ::tensorflow::Output out; +}; + +/// Update '*var' according to the adadelta scheme. +/// +/// accum = rho() * accum + (1 - rho()) * grad.square(); +/// update = (update_accum + epsilon).sqrt() * (accum + epsilon()).rsqrt() * grad; +/// update_accum = rho() * update_accum + (1 - rho()) * update.square(); +/// var -= update; +/// +/// Args: +/// * scope: A Scope object +/// * var: Should be from a Variable(). +/// * accum: Should be from a Variable(). +/// * accum_update: Should be from a Variable(). +/// * lr: Scaling factor. Must be a scalar. +/// * rho: Decay factor. Must be a scalar. +/// * epsilon: Constant factor. Must be a scalar. +/// * grad: The gradient. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If True, updating of the var, accum and update_accum tensors will be protected by +/// a lock; otherwise the behavior is undefined, but may exhibit less contention. +/// +/// Returns: +/// * the created `Operation` +class ResourceApplyAdadelta { + public: + /// Optional attribute setters for ResourceApplyAdadelta + struct Attrs { + /// If True, updating of the var, accum and update_accum tensors will be protected by + /// a lock; otherwise the behavior is undefined, but may exhibit less contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + bool use_locking_ = false; + }; + ResourceApplyAdadelta(const ::tensorflow::Scope& scope, ::tensorflow::Input + var, ::tensorflow::Input accum, ::tensorflow::Input + accum_update, ::tensorflow::Input lr, ::tensorflow::Input + rho, ::tensorflow::Input epsilon, ::tensorflow::Input + grad); + ResourceApplyAdadelta(const ::tensorflow::Scope& scope, ::tensorflow::Input + var, ::tensorflow::Input accum, ::tensorflow::Input + accum_update, ::tensorflow::Input lr, ::tensorflow::Input + rho, ::tensorflow::Input epsilon, ::tensorflow::Input + grad, const ResourceApplyAdadelta::Attrs& attrs); + operator ::tensorflow::Operation() const { return operation; } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + + Operation operation; +}; + +/// Update '*var' according to the adagrad scheme. +/// +/// accum += grad * grad +/// var -= lr * grad * (1 / sqrt(accum)) +/// +/// Args: +/// * scope: A Scope object +/// * var: Should be from a Variable(). +/// * accum: Should be from a Variable(). +/// * lr: Scaling factor. Must be a scalar. +/// * grad: The gradient. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If `True`, updating of the var and accum tensors will be protected +/// by a lock; otherwise the behavior is undefined, but may exhibit less +/// contention. +/// +/// Returns: +/// * the created `Operation` +class ResourceApplyAdagrad { + public: + /// Optional attribute setters for ResourceApplyAdagrad + struct Attrs { + /// If `True`, updating of the var and accum tensors will be protected + /// by a lock; otherwise the behavior is undefined, but may exhibit less + /// contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + /// Defaults to true + TF_MUST_USE_RESULT Attrs UpdateSlots(bool x) { + Attrs ret = *this; + ret.update_slots_ = x; + return ret; + } + + bool use_locking_ = false; + bool update_slots_ = true; + }; + ResourceApplyAdagrad(const ::tensorflow::Scope& scope, ::tensorflow::Input var, + ::tensorflow::Input accum, ::tensorflow::Input lr, + ::tensorflow::Input grad); + ResourceApplyAdagrad(const ::tensorflow::Scope& scope, ::tensorflow::Input var, + ::tensorflow::Input accum, ::tensorflow::Input lr, + ::tensorflow::Input grad, const + ResourceApplyAdagrad::Attrs& attrs); + operator ::tensorflow::Operation() const { return operation; } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + static Attrs UpdateSlots(bool x) { + return Attrs().UpdateSlots(x); + } + + Operation operation; +}; + +/// Update '*var' according to the proximal adagrad scheme. +/// +/// Args: +/// * scope: A Scope object +/// * var: Should be from a Variable(). +/// * gradient_accumulator: Should be from a Variable(). +/// * gradient_squared_accumulator: Should be from a Variable(). +/// * grad: The gradient. +/// * lr: Scaling factor. Must be a scalar. +/// * l1: L1 regularization. Must be a scalar. +/// * l2: L2 regularization. Must be a scalar. +/// * global_step: Training step number. Must be a scalar. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If True, updating of the var and accum tensors will be protected by +/// a lock; otherwise the behavior is undefined, but may exhibit less contention. +/// +/// Returns: +/// * the created `Operation` +class ResourceApplyAdagradDA { + public: + /// Optional attribute setters for ResourceApplyAdagradDA + struct Attrs { + /// If True, updating of the var and accum tensors will be protected by + /// a lock; otherwise the behavior is undefined, but may exhibit less contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + bool use_locking_ = false; + }; + ResourceApplyAdagradDA(const ::tensorflow::Scope& scope, ::tensorflow::Input + var, ::tensorflow::Input gradient_accumulator, + ::tensorflow::Input gradient_squared_accumulator, + ::tensorflow::Input grad, ::tensorflow::Input lr, + ::tensorflow::Input l1, ::tensorflow::Input l2, + ::tensorflow::Input global_step); + ResourceApplyAdagradDA(const ::tensorflow::Scope& scope, ::tensorflow::Input + var, ::tensorflow::Input gradient_accumulator, + ::tensorflow::Input gradient_squared_accumulator, + ::tensorflow::Input grad, ::tensorflow::Input lr, + ::tensorflow::Input l1, ::tensorflow::Input l2, + ::tensorflow::Input global_step, const + ResourceApplyAdagradDA::Attrs& attrs); + operator ::tensorflow::Operation() const { return operation; } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + + Operation operation; +}; + +/// Update '*var' according to the Adam algorithm. +/// +/// $$\text{lr}_t := \mathrm{lr} \cdot \frac{\sqrt{1 - \beta_2^t}}{1 - \beta_1^t}$$ +/// $$m_t := \beta_1 \cdot m_{t-1} + (1 - \beta_1) \cdot g$$ +/// $$v_t := \beta_2 \cdot v_{t-1} + (1 - \beta_2) \cdot g^2$$ +/// $$\text{var} := \begin{cases} \text{var} - (m_t \beta_1 + g \cdot (1 - \beta_1))\cdot\text{lr}_t/(\sqrt{v_t} + \epsilon), &\text{if use_nesterov}\\\\ \text{var} - m_t \cdot \text{lr}_t /(\sqrt{v_t} + \epsilon), &\text{otherwise} \end{cases}$$ +/// +/// Args: +/// * scope: A Scope object +/// * var: Should be from a Variable(). +/// * m: Should be from a Variable(). +/// * v: Should be from a Variable(). +/// * beta1_power: Must be a scalar. +/// * beta2_power: Must be a scalar. +/// * lr: Scaling factor. Must be a scalar. +/// * beta1: Momentum factor. Must be a scalar. +/// * beta2: Momentum factor. Must be a scalar. +/// * epsilon: Ridge term. Must be a scalar. +/// * grad: The gradient. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If `True`, updating of the var, m, and v tensors will be protected +/// by a lock; otherwise the behavior is undefined, but may exhibit less +/// contention. +/// * use_nesterov: If `True`, uses the nesterov update. +/// +/// Returns: +/// * the created `Operation` +class ResourceApplyAdam { + public: + /// Optional attribute setters for ResourceApplyAdam + struct Attrs { + /// If `True`, updating of the var, m, and v tensors will be protected + /// by a lock; otherwise the behavior is undefined, but may exhibit less + /// contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + /// If `True`, uses the nesterov update. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseNesterov(bool x) { + Attrs ret = *this; + ret.use_nesterov_ = x; + return ret; + } + + bool use_locking_ = false; + bool use_nesterov_ = false; + }; + ResourceApplyAdam(const ::tensorflow::Scope& scope, ::tensorflow::Input var, + ::tensorflow::Input m, ::tensorflow::Input v, + ::tensorflow::Input beta1_power, ::tensorflow::Input + beta2_power, ::tensorflow::Input lr, ::tensorflow::Input + beta1, ::tensorflow::Input beta2, ::tensorflow::Input + epsilon, ::tensorflow::Input grad); + ResourceApplyAdam(const ::tensorflow::Scope& scope, ::tensorflow::Input var, + ::tensorflow::Input m, ::tensorflow::Input v, + ::tensorflow::Input beta1_power, ::tensorflow::Input + beta2_power, ::tensorflow::Input lr, ::tensorflow::Input + beta1, ::tensorflow::Input beta2, ::tensorflow::Input + epsilon, ::tensorflow::Input grad, const + ResourceApplyAdam::Attrs& attrs); + operator ::tensorflow::Operation() const { return operation; } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + static Attrs UseNesterov(bool x) { + return Attrs().UseNesterov(x); + } + + Operation operation; +}; + +/// Update '*var' according to the Adam algorithm. +/// +/// $$\text{lr}_t := \mathrm{learning_rate} * \sqrt{1 - \beta_2^t} / (1 - \beta_1^t)$$ +/// $$m_t := \beta_1 * m_{t-1} + (1 - \beta_1) * g$$ +/// $$v_t := \beta_2 * v_{t-1} + (1 - \beta_2) * g * g$$ +/// $$\hat{v}_t := max{\hat{v}_{t-1}, v_t}$$ +/// $$\text{variable} := \text{variable} - \text{lr}_t * m_t / (\sqrt{\hat{v}_t} + \epsilon)$$ +/// +/// Args: +/// * scope: A Scope object +/// * var: Should be from a Variable(). +/// * m: Should be from a Variable(). +/// * v: Should be from a Variable(). +/// * vhat: Should be from a Variable(). +/// * beta1_power: Must be a scalar. +/// * beta2_power: Must be a scalar. +/// * lr: Scaling factor. Must be a scalar. +/// * beta1: Momentum factor. Must be a scalar. +/// * beta2: Momentum factor. Must be a scalar. +/// * epsilon: Ridge term. Must be a scalar. +/// * grad: The gradient. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If `True`, updating of the var, m, and v tensors will be protected +/// by a lock; otherwise the behavior is undefined, but may exhibit less +/// contention. +/// +/// Returns: +/// * the created `Operation` +class ResourceApplyAdamWithAmsgrad { + public: + /// Optional attribute setters for ResourceApplyAdamWithAmsgrad + struct Attrs { + /// If `True`, updating of the var, m, and v tensors will be protected + /// by a lock; otherwise the behavior is undefined, but may exhibit less + /// contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + bool use_locking_ = false; + }; + ResourceApplyAdamWithAmsgrad(const ::tensorflow::Scope& scope, + ::tensorflow::Input var, ::tensorflow::Input m, + ::tensorflow::Input v, ::tensorflow::Input vhat, + ::tensorflow::Input beta1_power, + ::tensorflow::Input beta2_power, + ::tensorflow::Input lr, ::tensorflow::Input beta1, + ::tensorflow::Input beta2, ::tensorflow::Input + epsilon, ::tensorflow::Input grad); + ResourceApplyAdamWithAmsgrad(const ::tensorflow::Scope& scope, + ::tensorflow::Input var, ::tensorflow::Input m, + ::tensorflow::Input v, ::tensorflow::Input vhat, + ::tensorflow::Input beta1_power, + ::tensorflow::Input beta2_power, + ::tensorflow::Input lr, ::tensorflow::Input beta1, + ::tensorflow::Input beta2, ::tensorflow::Input + epsilon, ::tensorflow::Input grad, const + ResourceApplyAdamWithAmsgrad::Attrs& attrs); + operator ::tensorflow::Operation() const { return operation; } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + + Operation operation; +}; + +/// Update '*var' according to the AddSign update. +/// +/// m_t <- beta1 * m_{t-1} + (1 - beta1) * g +/// update <- (alpha + sign_decay * sign(g) *sign(m)) * g +/// variable <- variable - lr_t * update +/// +/// Args: +/// * scope: A Scope object +/// * var: Should be from a Variable(). +/// * m: Should be from a Variable(). +/// * lr: Scaling factor. Must be a scalar. +/// * alpha: Must be a scalar. +/// * sign_decay: Must be a scalar. +/// * beta: Must be a scalar. +/// * grad: The gradient. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If `True`, updating of the var and m tensors is +/// protected by a lock; otherwise the behavior is undefined, but may exhibit less +/// contention. +/// +/// Returns: +/// * the created `Operation` +class ResourceApplyAddSign { + public: + /// Optional attribute setters for ResourceApplyAddSign + struct Attrs { + /// If `True`, updating of the var and m tensors is + /// protected by a lock; otherwise the behavior is undefined, but may exhibit less + /// contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + bool use_locking_ = false; + }; + ResourceApplyAddSign(const ::tensorflow::Scope& scope, ::tensorflow::Input var, + ::tensorflow::Input m, ::tensorflow::Input lr, + ::tensorflow::Input alpha, ::tensorflow::Input sign_decay, + ::tensorflow::Input beta, ::tensorflow::Input grad); + ResourceApplyAddSign(const ::tensorflow::Scope& scope, ::tensorflow::Input var, + ::tensorflow::Input m, ::tensorflow::Input lr, + ::tensorflow::Input alpha, ::tensorflow::Input sign_decay, + ::tensorflow::Input beta, ::tensorflow::Input grad, const + ResourceApplyAddSign::Attrs& attrs); + operator ::tensorflow::Operation() const { return operation; } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + + Operation operation; +}; + +/// Update '*var' according to the centered RMSProp algorithm. +/// +/// The centered RMSProp algorithm uses an estimate of the centered second moment +/// (i.e., the variance) for normalization, as opposed to regular RMSProp, which +/// uses the (uncentered) second moment. This often helps with training, but is +/// slightly more expensive in terms of computation and memory. +/// +/// Note that in dense implementation of this algorithm, mg, ms, and mom will +/// update even if the grad is zero, but in this sparse implementation, mg, ms, +/// and mom will not update in iterations during which the grad is zero. +/// +/// mean_square = decay * mean_square + (1-decay) * gradient ** 2 +/// mean_grad = decay * mean_grad + (1-decay) * gradient +/// +/// Delta = learning_rate * gradient / sqrt(mean_square + epsilon - mean_grad ** 2) +/// +/// mg <- rho * mg_{t-1} + (1-rho) * grad +/// ms <- rho * ms_{t-1} + (1-rho) * grad * grad +/// mom <- momentum * mom_{t-1} + lr * grad / sqrt(ms - mg * mg + epsilon) +/// var <- var - mom +/// +/// Args: +/// * scope: A Scope object +/// * var: Should be from a Variable(). +/// * mg: Should be from a Variable(). +/// * ms: Should be from a Variable(). +/// * mom: Should be from a Variable(). +/// * lr: Scaling factor. Must be a scalar. +/// * rho: Decay rate. Must be a scalar. +/// * momentum: Momentum Scale. Must be a scalar. +/// * epsilon: Ridge term. Must be a scalar. +/// * grad: The gradient. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If `True`, updating of the var, mg, ms, and mom tensors is +/// protected by a lock; otherwise the behavior is undefined, but may exhibit less +/// contention. +/// +/// Returns: +/// * the created `Operation` +class ResourceApplyCenteredRMSProp { + public: + /// Optional attribute setters for ResourceApplyCenteredRMSProp + struct Attrs { + /// If `True`, updating of the var, mg, ms, and mom tensors is + /// protected by a lock; otherwise the behavior is undefined, but may exhibit less + /// contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + bool use_locking_ = false; + }; + ResourceApplyCenteredRMSProp(const ::tensorflow::Scope& scope, + ::tensorflow::Input var, ::tensorflow::Input mg, + ::tensorflow::Input ms, ::tensorflow::Input mom, + ::tensorflow::Input lr, ::tensorflow::Input rho, + ::tensorflow::Input momentum, ::tensorflow::Input + epsilon, ::tensorflow::Input grad); + ResourceApplyCenteredRMSProp(const ::tensorflow::Scope& scope, + ::tensorflow::Input var, ::tensorflow::Input mg, + ::tensorflow::Input ms, ::tensorflow::Input mom, + ::tensorflow::Input lr, ::tensorflow::Input rho, + ::tensorflow::Input momentum, ::tensorflow::Input + epsilon, ::tensorflow::Input grad, const + ResourceApplyCenteredRMSProp::Attrs& attrs); + operator ::tensorflow::Operation() const { return operation; } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + + Operation operation; +}; + +/// Update '*var' according to the Ftrl-proximal scheme. +/// +/// accum_new = accum + grad * grad +/// linear += grad - (accum_new^(-lr_power) - accum^(-lr_power)) / lr * var +/// quadratic = 1.0 / (accum_new^(lr_power) * lr) + 2 * l2 +/// var = (sign(linear) * l1 - linear) / quadratic if |linear| > l1 else 0.0 +/// accum = accum_new +/// +/// Args: +/// * scope: A Scope object +/// * var: Should be from a Variable(). +/// * accum: Should be from a Variable(). +/// * linear: Should be from a Variable(). +/// * grad: The gradient. +/// * lr: Scaling factor. Must be a scalar. +/// * l1: L1 regularization. Must be a scalar. +/// * l2: L2 regularization. Must be a scalar. +/// * lr_power: Scaling factor. Must be a scalar. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If `True`, updating of the var and accum tensors will be protected +/// by a lock; otherwise the behavior is undefined, but may exhibit less +/// contention. +/// +/// Returns: +/// * the created `Operation` +class ResourceApplyFtrl { + public: + /// Optional attribute setters for ResourceApplyFtrl + struct Attrs { + /// If `True`, updating of the var and accum tensors will be protected + /// by a lock; otherwise the behavior is undefined, but may exhibit less + /// contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + /// Defaults to false + TF_MUST_USE_RESULT Attrs MultiplyLinearByLr(bool x) { + Attrs ret = *this; + ret.multiply_linear_by_lr_ = x; + return ret; + } + + bool use_locking_ = false; + bool multiply_linear_by_lr_ = false; + }; + ResourceApplyFtrl(const ::tensorflow::Scope& scope, ::tensorflow::Input var, + ::tensorflow::Input accum, ::tensorflow::Input linear, + ::tensorflow::Input grad, ::tensorflow::Input lr, + ::tensorflow::Input l1, ::tensorflow::Input l2, + ::tensorflow::Input lr_power); + ResourceApplyFtrl(const ::tensorflow::Scope& scope, ::tensorflow::Input var, + ::tensorflow::Input accum, ::tensorflow::Input linear, + ::tensorflow::Input grad, ::tensorflow::Input lr, + ::tensorflow::Input l1, ::tensorflow::Input l2, + ::tensorflow::Input lr_power, const ResourceApplyFtrl::Attrs& + attrs); + operator ::tensorflow::Operation() const { return operation; } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + static Attrs MultiplyLinearByLr(bool x) { + return Attrs().MultiplyLinearByLr(x); + } + + Operation operation; +}; + +/// Update '*var' according to the Ftrl-proximal scheme. +/// +/// accum_new = accum + grad * grad +/// grad_with_shrinkage = grad + 2 * l2_shrinkage * var +/// linear += grad_with_shrinkage + +/// (accum_new^(-lr_power) - accum^(-lr_power)) / lr * var +/// quadratic = 1.0 / (accum_new^(lr_power) * lr) + 2 * l2 +/// var = (sign(linear) * l1 - linear) / quadratic if |linear| > l1 else 0.0 +/// accum = accum_new +/// +/// Args: +/// * scope: A Scope object +/// * var: Should be from a Variable(). +/// * accum: Should be from a Variable(). +/// * linear: Should be from a Variable(). +/// * grad: The gradient. +/// * lr: Scaling factor. Must be a scalar. +/// * l1: L1 regularization. Must be a scalar. +/// * l2: L2 shrinkage regularization. Must be a scalar. +/// * lr_power: Scaling factor. Must be a scalar. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If `True`, updating of the var and accum tensors will be protected +/// by a lock; otherwise the behavior is undefined, but may exhibit less +/// contention. +/// +/// Returns: +/// * the created `Operation` +class ResourceApplyFtrlV2 { + public: + /// Optional attribute setters for ResourceApplyFtrlV2 + struct Attrs { + /// If `True`, updating of the var and accum tensors will be protected + /// by a lock; otherwise the behavior is undefined, but may exhibit less + /// contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + /// Defaults to false + TF_MUST_USE_RESULT Attrs MultiplyLinearByLr(bool x) { + Attrs ret = *this; + ret.multiply_linear_by_lr_ = x; + return ret; + } + + bool use_locking_ = false; + bool multiply_linear_by_lr_ = false; + }; + ResourceApplyFtrlV2(const ::tensorflow::Scope& scope, ::tensorflow::Input var, + ::tensorflow::Input accum, ::tensorflow::Input linear, + ::tensorflow::Input grad, ::tensorflow::Input lr, + ::tensorflow::Input l1, ::tensorflow::Input l2, + ::tensorflow::Input l2_shrinkage, ::tensorflow::Input + lr_power); + ResourceApplyFtrlV2(const ::tensorflow::Scope& scope, ::tensorflow::Input var, + ::tensorflow::Input accum, ::tensorflow::Input linear, + ::tensorflow::Input grad, ::tensorflow::Input lr, + ::tensorflow::Input l1, ::tensorflow::Input l2, + ::tensorflow::Input l2_shrinkage, ::tensorflow::Input + lr_power, const ResourceApplyFtrlV2::Attrs& attrs); + operator ::tensorflow::Operation() const { return operation; } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + static Attrs MultiplyLinearByLr(bool x) { + return Attrs().MultiplyLinearByLr(x); + } + + Operation operation; +}; + +/// Update '*var' by subtracting 'alpha' * 'delta' from it. +/// +/// Args: +/// * scope: A Scope object +/// * var: Should be from a Variable(). +/// * alpha: Scaling factor. Must be a scalar. +/// * delta: The change. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If `True`, the subtraction will be protected by a lock; +/// otherwise the behavior is undefined, but may exhibit less contention. +/// +/// Returns: +/// * the created `Operation` +class ResourceApplyGradientDescent { + public: + /// Optional attribute setters for ResourceApplyGradientDescent + struct Attrs { + /// If `True`, the subtraction will be protected by a lock; + /// otherwise the behavior is undefined, but may exhibit less contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + bool use_locking_ = false; + }; + ResourceApplyGradientDescent(const ::tensorflow::Scope& scope, + ::tensorflow::Input var, ::tensorflow::Input + alpha, ::tensorflow::Input delta); + ResourceApplyGradientDescent(const ::tensorflow::Scope& scope, + ::tensorflow::Input var, ::tensorflow::Input + alpha, ::tensorflow::Input delta, const + ResourceApplyGradientDescent::Attrs& attrs); + operator ::tensorflow::Operation() const { return operation; } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + + Operation operation; +}; + +/// Update '*var' according to the momentum scheme. +/// +/// Set use_nesterov = True if you want to use Nesterov momentum. +/// +/// accum = accum * momentum - lr * grad +/// var += accum +/// +/// Args: +/// * scope: A Scope object +/// * var: Should be from a Variable(). +/// * accum: Should be from a Variable(). +/// * lr: Scaling factor. Must be a scalar. +/// * grad: The gradient. +/// * momentum: Momentum. Must be a scalar. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If `True`, updating of the var and accum tensors will be protected +/// by a lock; otherwise the behavior is undefined, but may exhibit less +/// contention. +/// * use_nesterov: If `True`, the tensor passed to compute grad will be +/// var + momentum * accum, so in the end, the var you get is actually +/// var + momentum * accum. +/// +/// Returns: +/// * the created `Operation` +class ResourceApplyKerasMomentum { + public: + /// Optional attribute setters for ResourceApplyKerasMomentum + struct Attrs { + /// If `True`, updating of the var and accum tensors will be protected + /// by a lock; otherwise the behavior is undefined, but may exhibit less + /// contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + /// If `True`, the tensor passed to compute grad will be + /// var + momentum * accum, so in the end, the var you get is actually + /// var + momentum * accum. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseNesterov(bool x) { + Attrs ret = *this; + ret.use_nesterov_ = x; + return ret; + } + + bool use_locking_ = false; + bool use_nesterov_ = false; + }; + ResourceApplyKerasMomentum(const ::tensorflow::Scope& scope, + ::tensorflow::Input var, ::tensorflow::Input accum, + ::tensorflow::Input lr, ::tensorflow::Input grad, + ::tensorflow::Input momentum); + ResourceApplyKerasMomentum(const ::tensorflow::Scope& scope, + ::tensorflow::Input var, ::tensorflow::Input accum, + ::tensorflow::Input lr, ::tensorflow::Input grad, + ::tensorflow::Input momentum, const + ResourceApplyKerasMomentum::Attrs& attrs); + operator ::tensorflow::Operation() const { return operation; } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + static Attrs UseNesterov(bool x) { + return Attrs().UseNesterov(x); + } + + Operation operation; +}; + +/// Update '*var' according to the momentum scheme. +/// +/// Set use_nesterov = True if you want to use Nesterov momentum. +/// +/// accum = accum * momentum + grad +/// var -= lr * accum +/// +/// Args: +/// * scope: A Scope object +/// * var: Should be from a Variable(). +/// * accum: Should be from a Variable(). +/// * lr: Scaling factor. Must be a scalar. +/// * grad: The gradient. +/// * momentum: Momentum. Must be a scalar. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If `True`, updating of the var and accum tensors will be protected +/// by a lock; otherwise the behavior is undefined, but may exhibit less +/// contention. +/// * use_nesterov: If `True`, the tensor passed to compute grad will be +/// var - lr * momentum * accum, so in the end, the var you get is actually +/// var - lr * momentum * accum. +/// +/// Returns: +/// * the created `Operation` +class ResourceApplyMomentum { + public: + /// Optional attribute setters for ResourceApplyMomentum + struct Attrs { + /// If `True`, updating of the var and accum tensors will be protected + /// by a lock; otherwise the behavior is undefined, but may exhibit less + /// contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + /// If `True`, the tensor passed to compute grad will be + /// var - lr * momentum * accum, so in the end, the var you get is actually + /// var - lr * momentum * accum. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseNesterov(bool x) { + Attrs ret = *this; + ret.use_nesterov_ = x; + return ret; + } + + bool use_locking_ = false; + bool use_nesterov_ = false; + }; + ResourceApplyMomentum(const ::tensorflow::Scope& scope, ::tensorflow::Input + var, ::tensorflow::Input accum, ::tensorflow::Input lr, + ::tensorflow::Input grad, ::tensorflow::Input momentum); + ResourceApplyMomentum(const ::tensorflow::Scope& scope, ::tensorflow::Input + var, ::tensorflow::Input accum, ::tensorflow::Input lr, + ::tensorflow::Input grad, ::tensorflow::Input momentum, + const ResourceApplyMomentum::Attrs& attrs); + operator ::tensorflow::Operation() const { return operation; } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + static Attrs UseNesterov(bool x) { + return Attrs().UseNesterov(x); + } + + Operation operation; +}; + +/// Update '*var' according to the AddSign update. +/// +/// m_t <- beta1 * m_{t-1} + (1 - beta1) * g +/// update <- exp(logbase * sign_decay * sign(g) * sign(m_t)) * g +/// variable <- variable - lr_t * update +/// +/// Args: +/// * scope: A Scope object +/// * var: Should be from a Variable(). +/// * m: Should be from a Variable(). +/// * lr: Scaling factor. Must be a scalar. +/// * logbase: Must be a scalar. +/// * sign_decay: Must be a scalar. +/// * beta: Must be a scalar. +/// * grad: The gradient. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If `True`, updating of the var and m tensors is +/// protected by a lock; otherwise the behavior is undefined, but may exhibit less +/// contention. +/// +/// Returns: +/// * the created `Operation` +class ResourceApplyPowerSign { + public: + /// Optional attribute setters for ResourceApplyPowerSign + struct Attrs { + /// If `True`, updating of the var and m tensors is + /// protected by a lock; otherwise the behavior is undefined, but may exhibit less + /// contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + bool use_locking_ = false; + }; + ResourceApplyPowerSign(const ::tensorflow::Scope& scope, ::tensorflow::Input + var, ::tensorflow::Input m, ::tensorflow::Input lr, + ::tensorflow::Input logbase, ::tensorflow::Input + sign_decay, ::tensorflow::Input beta, + ::tensorflow::Input grad); + ResourceApplyPowerSign(const ::tensorflow::Scope& scope, ::tensorflow::Input + var, ::tensorflow::Input m, ::tensorflow::Input lr, + ::tensorflow::Input logbase, ::tensorflow::Input + sign_decay, ::tensorflow::Input beta, + ::tensorflow::Input grad, const + ResourceApplyPowerSign::Attrs& attrs); + operator ::tensorflow::Operation() const { return operation; } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + + Operation operation; +}; + +/// Update '*var' and '*accum' according to FOBOS with Adagrad learning rate. +/// +/// accum += grad * grad +/// prox_v = var - lr * grad * (1 / sqrt(accum)) +/// var = sign(prox_v)/(1+lr*l2) * max{|prox_v|-lr*l1,0} +/// +/// Args: +/// * scope: A Scope object +/// * var: Should be from a Variable(). +/// * accum: Should be from a Variable(). +/// * lr: Scaling factor. Must be a scalar. +/// * l1: L1 regularization. Must be a scalar. +/// * l2: L2 regularization. Must be a scalar. +/// * grad: The gradient. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If True, updating of the var and accum tensors will be protected by +/// a lock; otherwise the behavior is undefined, but may exhibit less contention. +/// +/// Returns: +/// * the created `Operation` +class ResourceApplyProximalAdagrad { + public: + /// Optional attribute setters for ResourceApplyProximalAdagrad + struct Attrs { + /// If True, updating of the var and accum tensors will be protected by + /// a lock; otherwise the behavior is undefined, but may exhibit less contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + bool use_locking_ = false; + }; + ResourceApplyProximalAdagrad(const ::tensorflow::Scope& scope, + ::tensorflow::Input var, ::tensorflow::Input + accum, ::tensorflow::Input lr, ::tensorflow::Input + l1, ::tensorflow::Input l2, ::tensorflow::Input + grad); + ResourceApplyProximalAdagrad(const ::tensorflow::Scope& scope, + ::tensorflow::Input var, ::tensorflow::Input + accum, ::tensorflow::Input lr, ::tensorflow::Input + l1, ::tensorflow::Input l2, ::tensorflow::Input + grad, const ResourceApplyProximalAdagrad::Attrs& + attrs); + operator ::tensorflow::Operation() const { return operation; } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + + Operation operation; +}; + +/// Update '*var' as FOBOS algorithm with fixed learning rate. +/// +/// prox_v = var - alpha * delta +/// var = sign(prox_v)/(1+alpha*l2) * max{|prox_v|-alpha*l1,0} +/// +/// Args: +/// * scope: A Scope object +/// * var: Should be from a Variable(). +/// * alpha: Scaling factor. Must be a scalar. +/// * l1: L1 regularization. Must be a scalar. +/// * l2: L2 regularization. Must be a scalar. +/// * delta: The change. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If True, the subtraction will be protected by a lock; +/// otherwise the behavior is undefined, but may exhibit less contention. +/// +/// Returns: +/// * the created `Operation` +class ResourceApplyProximalGradientDescent { + public: + /// Optional attribute setters for ResourceApplyProximalGradientDescent + struct Attrs { + /// If True, the subtraction will be protected by a lock; + /// otherwise the behavior is undefined, but may exhibit less contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + bool use_locking_ = false; + }; + ResourceApplyProximalGradientDescent(const ::tensorflow::Scope& scope, + ::tensorflow::Input var, + ::tensorflow::Input alpha, + ::tensorflow::Input l1, + ::tensorflow::Input l2, + ::tensorflow::Input delta); + ResourceApplyProximalGradientDescent(const ::tensorflow::Scope& scope, + ::tensorflow::Input var, + ::tensorflow::Input alpha, + ::tensorflow::Input l1, + ::tensorflow::Input l2, + ::tensorflow::Input delta, const + ResourceApplyProximalGradientDescent::Attrs& + attrs); + operator ::tensorflow::Operation() const { return operation; } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + + Operation operation; +}; + +/// Update '*var' according to the RMSProp algorithm. +/// +/// Note that in dense implementation of this algorithm, ms and mom will +/// update even if the grad is zero, but in this sparse implementation, ms +/// and mom will not update in iterations during which the grad is zero. +/// +/// mean_square = decay * mean_square + (1-decay) * gradient ** 2 +/// Delta = learning_rate * gradient / sqrt(mean_square + epsilon) +/// +/// ms <- rho * ms_{t-1} + (1-rho) * grad * grad +/// mom <- momentum * mom_{t-1} + lr * grad / sqrt(ms + epsilon) +/// var <- var - mom +/// +/// Args: +/// * scope: A Scope object +/// * var: Should be from a Variable(). +/// * ms: Should be from a Variable(). +/// * mom: Should be from a Variable(). +/// * lr: Scaling factor. Must be a scalar. +/// * rho: Decay rate. Must be a scalar. +/// * epsilon: Ridge term. Must be a scalar. +/// * grad: The gradient. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If `True`, updating of the var, ms, and mom tensors is protected +/// by a lock; otherwise the behavior is undefined, but may exhibit less +/// contention. +/// +/// Returns: +/// * the created `Operation` +class ResourceApplyRMSProp { + public: + /// Optional attribute setters for ResourceApplyRMSProp + struct Attrs { + /// If `True`, updating of the var, ms, and mom tensors is protected + /// by a lock; otherwise the behavior is undefined, but may exhibit less + /// contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + bool use_locking_ = false; + }; + ResourceApplyRMSProp(const ::tensorflow::Scope& scope, ::tensorflow::Input var, + ::tensorflow::Input ms, ::tensorflow::Input mom, + ::tensorflow::Input lr, ::tensorflow::Input rho, + ::tensorflow::Input momentum, ::tensorflow::Input epsilon, + ::tensorflow::Input grad); + ResourceApplyRMSProp(const ::tensorflow::Scope& scope, ::tensorflow::Input var, + ::tensorflow::Input ms, ::tensorflow::Input mom, + ::tensorflow::Input lr, ::tensorflow::Input rho, + ::tensorflow::Input momentum, ::tensorflow::Input epsilon, + ::tensorflow::Input grad, const + ResourceApplyRMSProp::Attrs& attrs); + operator ::tensorflow::Operation() const { return operation; } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + + Operation operation; +}; + +/// var: Should be from a Variable(). +/// +/// Args: +/// * scope: A Scope object +/// * accum: Should be from a Variable(). +/// * accum_update: : Should be from a Variable(). +/// * lr: Learning rate. Must be a scalar. +/// * rho: Decay factor. Must be a scalar. +/// * epsilon: Constant factor. Must be a scalar. +/// * grad: The gradient. +/// * indices: A vector of indices into the first dimension of var and accum. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If True, updating of the var and accum tensors will be protected by +/// a lock; otherwise the behavior is undefined, but may exhibit less contention. +/// +/// Returns: +/// * the created `Operation` +class ResourceSparseApplyAdadelta { + public: + /// Optional attribute setters for ResourceSparseApplyAdadelta + struct Attrs { + /// If True, updating of the var and accum tensors will be protected by + /// a lock; otherwise the behavior is undefined, but may exhibit less contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + bool use_locking_ = false; + }; + ResourceSparseApplyAdadelta(const ::tensorflow::Scope& scope, + ::tensorflow::Input var, ::tensorflow::Input accum, + ::tensorflow::Input accum_update, + ::tensorflow::Input lr, ::tensorflow::Input rho, + ::tensorflow::Input epsilon, ::tensorflow::Input + grad, ::tensorflow::Input indices); + ResourceSparseApplyAdadelta(const ::tensorflow::Scope& scope, + ::tensorflow::Input var, ::tensorflow::Input accum, + ::tensorflow::Input accum_update, + ::tensorflow::Input lr, ::tensorflow::Input rho, + ::tensorflow::Input epsilon, ::tensorflow::Input + grad, ::tensorflow::Input indices, const + ResourceSparseApplyAdadelta::Attrs& attrs); + operator ::tensorflow::Operation() const { return operation; } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + + Operation operation; +}; + +/// Update relevant entries in '*var' and '*accum' according to the adagrad scheme. +/// +/// That is for rows we have grad for, we update var and accum as follows: +/// accum += grad * grad +/// var -= lr * grad * (1 / sqrt(accum)) +/// +/// Args: +/// * scope: A Scope object +/// * var: Should be from a Variable(). +/// * accum: Should be from a Variable(). +/// * lr: Learning rate. Must be a scalar. +/// * grad: The gradient. +/// * indices: A vector of indices into the first dimension of var and accum. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If `True`, updating of the var and accum tensors will be protected +/// by a lock; otherwise the behavior is undefined, but may exhibit less +/// contention. +/// +/// Returns: +/// * the created `Operation` +class ResourceSparseApplyAdagrad { + public: + /// Optional attribute setters for ResourceSparseApplyAdagrad + struct Attrs { + /// If `True`, updating of the var and accum tensors will be protected + /// by a lock; otherwise the behavior is undefined, but may exhibit less + /// contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + /// Defaults to true + TF_MUST_USE_RESULT Attrs UpdateSlots(bool x) { + Attrs ret = *this; + ret.update_slots_ = x; + return ret; + } + + bool use_locking_ = false; + bool update_slots_ = true; + }; + ResourceSparseApplyAdagrad(const ::tensorflow::Scope& scope, + ::tensorflow::Input var, ::tensorflow::Input accum, + ::tensorflow::Input lr, ::tensorflow::Input grad, + ::tensorflow::Input indices); + ResourceSparseApplyAdagrad(const ::tensorflow::Scope& scope, + ::tensorflow::Input var, ::tensorflow::Input accum, + ::tensorflow::Input lr, ::tensorflow::Input grad, + ::tensorflow::Input indices, const + ResourceSparseApplyAdagrad::Attrs& attrs); + operator ::tensorflow::Operation() const { return operation; } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + static Attrs UpdateSlots(bool x) { + return Attrs().UpdateSlots(x); + } + + Operation operation; +}; + +/// Update entries in '*var' and '*accum' according to the proximal adagrad scheme. +/// +/// Args: +/// * scope: A Scope object +/// * var: Should be from a Variable(). +/// * gradient_accumulator: Should be from a Variable(). +/// * gradient_squared_accumulator: Should be from a Variable(). +/// * grad: The gradient. +/// * indices: A vector of indices into the first dimension of var and accum. +/// * lr: Learning rate. Must be a scalar. +/// * l1: L1 regularization. Must be a scalar. +/// * l2: L2 regularization. Must be a scalar. +/// * global_step: Training step number. Must be a scalar. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If True, updating of the var and accum tensors will be protected by +/// a lock; otherwise the behavior is undefined, but may exhibit less contention. +/// +/// Returns: +/// * the created `Operation` +class ResourceSparseApplyAdagradDA { + public: + /// Optional attribute setters for ResourceSparseApplyAdagradDA + struct Attrs { + /// If True, updating of the var and accum tensors will be protected by + /// a lock; otherwise the behavior is undefined, but may exhibit less contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + bool use_locking_ = false; + }; + ResourceSparseApplyAdagradDA(const ::tensorflow::Scope& scope, + ::tensorflow::Input var, ::tensorflow::Input + gradient_accumulator, ::tensorflow::Input + gradient_squared_accumulator, ::tensorflow::Input + grad, ::tensorflow::Input indices, + ::tensorflow::Input lr, ::tensorflow::Input l1, + ::tensorflow::Input l2, ::tensorflow::Input + global_step); + ResourceSparseApplyAdagradDA(const ::tensorflow::Scope& scope, + ::tensorflow::Input var, ::tensorflow::Input + gradient_accumulator, ::tensorflow::Input + gradient_squared_accumulator, ::tensorflow::Input + grad, ::tensorflow::Input indices, + ::tensorflow::Input lr, ::tensorflow::Input l1, + ::tensorflow::Input l2, ::tensorflow::Input + global_step, const + ResourceSparseApplyAdagradDA::Attrs& attrs); + operator ::tensorflow::Operation() const { return operation; } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + + Operation operation; +}; + +/// Update '*var' according to the centered RMSProp algorithm. +/// +/// The centered RMSProp algorithm uses an estimate of the centered second moment +/// (i.e., the variance) for normalization, as opposed to regular RMSProp, which +/// uses the (uncentered) second moment. This often helps with training, but is +/// slightly more expensive in terms of computation and memory. +/// +/// Note that in dense implementation of this algorithm, mg, ms, and mom will +/// update even if the grad is zero, but in this sparse implementation, mg, ms, +/// and mom will not update in iterations during which the grad is zero. +/// +/// mean_square = decay * mean_square + (1-decay) * gradient ** 2 +/// mean_grad = decay * mean_grad + (1-decay) * gradient +/// Delta = learning_rate * gradient / sqrt(mean_square + epsilon - mean_grad ** 2) +/// +/// ms <- rho * ms_{t-1} + (1-rho) * grad * grad +/// mom <- momentum * mom_{t-1} + lr * grad / sqrt(ms + epsilon) +/// var <- var - mom +/// +/// Args: +/// * scope: A Scope object +/// * var: Should be from a Variable(). +/// * mg: Should be from a Variable(). +/// * ms: Should be from a Variable(). +/// * mom: Should be from a Variable(). +/// * lr: Scaling factor. Must be a scalar. +/// * rho: Decay rate. Must be a scalar. +/// * epsilon: Ridge term. Must be a scalar. +/// * grad: The gradient. +/// * indices: A vector of indices into the first dimension of var, ms and mom. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If `True`, updating of the var, mg, ms, and mom tensors is +/// protected by a lock; otherwise the behavior is undefined, but may exhibit less +/// contention. +/// +/// Returns: +/// * the created `Operation` +class ResourceSparseApplyCenteredRMSProp { + public: + /// Optional attribute setters for ResourceSparseApplyCenteredRMSProp + struct Attrs { + /// If `True`, updating of the var, mg, ms, and mom tensors is + /// protected by a lock; otherwise the behavior is undefined, but may exhibit less + /// contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + bool use_locking_ = false; + }; + ResourceSparseApplyCenteredRMSProp(const ::tensorflow::Scope& scope, + ::tensorflow::Input var, ::tensorflow::Input + mg, ::tensorflow::Input ms, + ::tensorflow::Input mom, ::tensorflow::Input + lr, ::tensorflow::Input rho, + ::tensorflow::Input momentum, + ::tensorflow::Input epsilon, + ::tensorflow::Input grad, + ::tensorflow::Input indices); + ResourceSparseApplyCenteredRMSProp(const ::tensorflow::Scope& scope, + ::tensorflow::Input var, ::tensorflow::Input + mg, ::tensorflow::Input ms, + ::tensorflow::Input mom, ::tensorflow::Input + lr, ::tensorflow::Input rho, + ::tensorflow::Input momentum, + ::tensorflow::Input epsilon, + ::tensorflow::Input grad, + ::tensorflow::Input indices, const + ResourceSparseApplyCenteredRMSProp::Attrs& + attrs); + operator ::tensorflow::Operation() const { return operation; } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + + Operation operation; +}; + +/// Update relevant entries in '*var' according to the Ftrl-proximal scheme. +/// +/// That is for rows we have grad for, we update var, accum and linear as follows: +/// accum_new = accum + grad * grad +/// linear += grad - (accum_new^(-lr_power) - accum^(-lr_power)) / lr * var +/// quadratic = 1.0 / (accum_new^(lr_power) * lr) + 2 * l2 +/// var = (sign(linear) * l1 - linear) / quadratic if |linear| > l1 else 0.0 +/// accum = accum_new +/// +/// Args: +/// * scope: A Scope object +/// * var: Should be from a Variable(). +/// * accum: Should be from a Variable(). +/// * linear: Should be from a Variable(). +/// * grad: The gradient. +/// * indices: A vector of indices into the first dimension of var and accum. +/// * lr: Scaling factor. Must be a scalar. +/// * l1: L1 regularization. Must be a scalar. +/// * l2: L2 regularization. Must be a scalar. +/// * lr_power: Scaling factor. Must be a scalar. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If `True`, updating of the var and accum tensors will be protected +/// by a lock; otherwise the behavior is undefined, but may exhibit less +/// contention. +/// +/// Returns: +/// * the created `Operation` +class ResourceSparseApplyFtrl { + public: + /// Optional attribute setters for ResourceSparseApplyFtrl + struct Attrs { + /// If `True`, updating of the var and accum tensors will be protected + /// by a lock; otherwise the behavior is undefined, but may exhibit less + /// contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + /// Defaults to false + TF_MUST_USE_RESULT Attrs MultiplyLinearByLr(bool x) { + Attrs ret = *this; + ret.multiply_linear_by_lr_ = x; + return ret; + } + + bool use_locking_ = false; + bool multiply_linear_by_lr_ = false; + }; + ResourceSparseApplyFtrl(const ::tensorflow::Scope& scope, ::tensorflow::Input + var, ::tensorflow::Input accum, ::tensorflow::Input + linear, ::tensorflow::Input grad, ::tensorflow::Input + indices, ::tensorflow::Input lr, ::tensorflow::Input + l1, ::tensorflow::Input l2, ::tensorflow::Input + lr_power); + ResourceSparseApplyFtrl(const ::tensorflow::Scope& scope, ::tensorflow::Input + var, ::tensorflow::Input accum, ::tensorflow::Input + linear, ::tensorflow::Input grad, ::tensorflow::Input + indices, ::tensorflow::Input lr, ::tensorflow::Input + l1, ::tensorflow::Input l2, ::tensorflow::Input + lr_power, const ResourceSparseApplyFtrl::Attrs& attrs); + operator ::tensorflow::Operation() const { return operation; } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + static Attrs MultiplyLinearByLr(bool x) { + return Attrs().MultiplyLinearByLr(x); + } + + Operation operation; +}; + +/// Update relevant entries in '*var' according to the Ftrl-proximal scheme. +/// +/// That is for rows we have grad for, we update var, accum and linear as follows: +/// grad_with_shrinkage = grad + 2 * l2_shrinkage * var +/// accum_new = accum + grad_with_shrinkage * grad_with_shrinkage +/// linear += grad_with_shrinkage + +/// (accum_new^(-lr_power) - accum^(-lr_power)) / lr * var +/// quadratic = 1.0 / (accum_new^(lr_power) * lr) + 2 * l2 +/// var = (sign(linear) * l1 - linear) / quadratic if |linear| > l1 else 0.0 +/// accum = accum_new +/// +/// Args: +/// * scope: A Scope object +/// * var: Should be from a Variable(). +/// * accum: Should be from a Variable(). +/// * linear: Should be from a Variable(). +/// * grad: The gradient. +/// * indices: A vector of indices into the first dimension of var and accum. +/// * lr: Scaling factor. Must be a scalar. +/// * l1: L1 regularization. Must be a scalar. +/// * l2: L2 shrinkage regularization. Must be a scalar. +/// * lr_power: Scaling factor. Must be a scalar. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If `True`, updating of the var and accum tensors will be protected +/// by a lock; otherwise the behavior is undefined, but may exhibit less +/// contention. +/// +/// Returns: +/// * the created `Operation` +class ResourceSparseApplyFtrlV2 { + public: + /// Optional attribute setters for ResourceSparseApplyFtrlV2 + struct Attrs { + /// If `True`, updating of the var and accum tensors will be protected + /// by a lock; otherwise the behavior is undefined, but may exhibit less + /// contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + /// Defaults to false + TF_MUST_USE_RESULT Attrs MultiplyLinearByLr(bool x) { + Attrs ret = *this; + ret.multiply_linear_by_lr_ = x; + return ret; + } + + bool use_locking_ = false; + bool multiply_linear_by_lr_ = false; + }; + ResourceSparseApplyFtrlV2(const ::tensorflow::Scope& scope, ::tensorflow::Input + var, ::tensorflow::Input accum, ::tensorflow::Input + linear, ::tensorflow::Input grad, ::tensorflow::Input + indices, ::tensorflow::Input lr, ::tensorflow::Input + l1, ::tensorflow::Input l2, ::tensorflow::Input + l2_shrinkage, ::tensorflow::Input lr_power); + ResourceSparseApplyFtrlV2(const ::tensorflow::Scope& scope, ::tensorflow::Input + var, ::tensorflow::Input accum, ::tensorflow::Input + linear, ::tensorflow::Input grad, ::tensorflow::Input + indices, ::tensorflow::Input lr, ::tensorflow::Input + l1, ::tensorflow::Input l2, ::tensorflow::Input + l2_shrinkage, ::tensorflow::Input lr_power, const + ResourceSparseApplyFtrlV2::Attrs& attrs); + operator ::tensorflow::Operation() const { return operation; } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + static Attrs MultiplyLinearByLr(bool x) { + return Attrs().MultiplyLinearByLr(x); + } + + Operation operation; +}; + +/// Update relevant entries in '*var' and '*accum' according to the momentum scheme. +/// +/// Set use_nesterov = True if you want to use Nesterov momentum. +/// +/// That is for rows we have grad for, we update var and accum as follows: +/// +/// accum = accum * momentum - lr * grad +/// var += accum +/// +/// Args: +/// * scope: A Scope object +/// * var: Should be from a Variable(). +/// * accum: Should be from a Variable(). +/// * lr: Learning rate. Must be a scalar. +/// * grad: The gradient. +/// * indices: A vector of indices into the first dimension of var and accum. +/// * momentum: Momentum. Must be a scalar. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If `True`, updating of the var and accum tensors will be protected +/// by a lock; otherwise the behavior is undefined, but may exhibit less +/// contention. +/// * use_nesterov: If `True`, the tensor passed to compute grad will be +/// var + momentum * accum, so in the end, the var you get is actually +/// var + momentum * accum. +/// +/// Returns: +/// * the created `Operation` +class ResourceSparseApplyKerasMomentum { + public: + /// Optional attribute setters for ResourceSparseApplyKerasMomentum + struct Attrs { + /// If `True`, updating of the var and accum tensors will be protected + /// by a lock; otherwise the behavior is undefined, but may exhibit less + /// contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + /// If `True`, the tensor passed to compute grad will be + /// var + momentum * accum, so in the end, the var you get is actually + /// var + momentum * accum. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseNesterov(bool x) { + Attrs ret = *this; + ret.use_nesterov_ = x; + return ret; + } + + bool use_locking_ = false; + bool use_nesterov_ = false; + }; + ResourceSparseApplyKerasMomentum(const ::tensorflow::Scope& scope, + ::tensorflow::Input var, ::tensorflow::Input + accum, ::tensorflow::Input lr, + ::tensorflow::Input grad, ::tensorflow::Input + indices, ::tensorflow::Input momentum); + ResourceSparseApplyKerasMomentum(const ::tensorflow::Scope& scope, + ::tensorflow::Input var, ::tensorflow::Input + accum, ::tensorflow::Input lr, + ::tensorflow::Input grad, ::tensorflow::Input + indices, ::tensorflow::Input momentum, const + ResourceSparseApplyKerasMomentum::Attrs& + attrs); + operator ::tensorflow::Operation() const { return operation; } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + static Attrs UseNesterov(bool x) { + return Attrs().UseNesterov(x); + } + + Operation operation; +}; + +/// Update relevant entries in '*var' and '*accum' according to the momentum scheme. +/// +/// Set use_nesterov = True if you want to use Nesterov momentum. +/// +/// That is for rows we have grad for, we update var and accum as follows: +/// +/// accum = accum * momentum + grad +/// var -= lr * accum +/// +/// Args: +/// * scope: A Scope object +/// * var: Should be from a Variable(). +/// * accum: Should be from a Variable(). +/// * lr: Learning rate. Must be a scalar. +/// * grad: The gradient. +/// * indices: A vector of indices into the first dimension of var and accum. +/// * momentum: Momentum. Must be a scalar. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If `True`, updating of the var and accum tensors will be protected +/// by a lock; otherwise the behavior is undefined, but may exhibit less +/// contention. +/// * use_nesterov: If `True`, the tensor passed to compute grad will be +/// var - lr * momentum * accum, so in the end, the var you get is actually +/// var - lr * momentum * accum. +/// +/// Returns: +/// * the created `Operation` +class ResourceSparseApplyMomentum { + public: + /// Optional attribute setters for ResourceSparseApplyMomentum + struct Attrs { + /// If `True`, updating of the var and accum tensors will be protected + /// by a lock; otherwise the behavior is undefined, but may exhibit less + /// contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + /// If `True`, the tensor passed to compute grad will be + /// var - lr * momentum * accum, so in the end, the var you get is actually + /// var - lr * momentum * accum. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseNesterov(bool x) { + Attrs ret = *this; + ret.use_nesterov_ = x; + return ret; + } + + bool use_locking_ = false; + bool use_nesterov_ = false; + }; + ResourceSparseApplyMomentum(const ::tensorflow::Scope& scope, + ::tensorflow::Input var, ::tensorflow::Input accum, + ::tensorflow::Input lr, ::tensorflow::Input grad, + ::tensorflow::Input indices, ::tensorflow::Input + momentum); + ResourceSparseApplyMomentum(const ::tensorflow::Scope& scope, + ::tensorflow::Input var, ::tensorflow::Input accum, + ::tensorflow::Input lr, ::tensorflow::Input grad, + ::tensorflow::Input indices, ::tensorflow::Input + momentum, const ResourceSparseApplyMomentum::Attrs& + attrs); + operator ::tensorflow::Operation() const { return operation; } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + static Attrs UseNesterov(bool x) { + return Attrs().UseNesterov(x); + } + + Operation operation; +}; + +/// Sparse update entries in '*var' and '*accum' according to FOBOS algorithm. +/// +/// That is for rows we have grad for, we update var and accum as follows: +/// accum += grad * grad +/// prox_v = var +/// prox_v -= lr * grad * (1 / sqrt(accum)) +/// var = sign(prox_v)/(1+lr*l2) * max{|prox_v|-lr*l1,0} +/// +/// Args: +/// * scope: A Scope object +/// * var: Should be from a Variable(). +/// * accum: Should be from a Variable(). +/// * lr: Learning rate. Must be a scalar. +/// * l1: L1 regularization. Must be a scalar. +/// * l2: L2 regularization. Must be a scalar. +/// * grad: The gradient. +/// * indices: A vector of indices into the first dimension of var and accum. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If True, updating of the var and accum tensors will be protected by +/// a lock; otherwise the behavior is undefined, but may exhibit less contention. +/// +/// Returns: +/// * the created `Operation` +class ResourceSparseApplyProximalAdagrad { + public: + /// Optional attribute setters for ResourceSparseApplyProximalAdagrad + struct Attrs { + /// If True, updating of the var and accum tensors will be protected by + /// a lock; otherwise the behavior is undefined, but may exhibit less contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + bool use_locking_ = false; + }; + ResourceSparseApplyProximalAdagrad(const ::tensorflow::Scope& scope, + ::tensorflow::Input var, ::tensorflow::Input + accum, ::tensorflow::Input lr, + ::tensorflow::Input l1, ::tensorflow::Input + l2, ::tensorflow::Input grad, + ::tensorflow::Input indices); + ResourceSparseApplyProximalAdagrad(const ::tensorflow::Scope& scope, + ::tensorflow::Input var, ::tensorflow::Input + accum, ::tensorflow::Input lr, + ::tensorflow::Input l1, ::tensorflow::Input + l2, ::tensorflow::Input grad, + ::tensorflow::Input indices, const + ResourceSparseApplyProximalAdagrad::Attrs& + attrs); + operator ::tensorflow::Operation() const { return operation; } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + + Operation operation; +}; + +/// Sparse update '*var' as FOBOS algorithm with fixed learning rate. +/// +/// That is for rows we have grad for, we update var as follows: +/// prox_v = var - alpha * grad +/// var = sign(prox_v)/(1+alpha*l2) * max{|prox_v|-alpha*l1,0} +/// +/// Args: +/// * scope: A Scope object +/// * var: Should be from a Variable(). +/// * alpha: Scaling factor. Must be a scalar. +/// * l1: L1 regularization. Must be a scalar. +/// * l2: L2 regularization. Must be a scalar. +/// * grad: The gradient. +/// * indices: A vector of indices into the first dimension of var and accum. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If True, the subtraction will be protected by a lock; +/// otherwise the behavior is undefined, but may exhibit less contention. +/// +/// Returns: +/// * the created `Operation` +class ResourceSparseApplyProximalGradientDescent { + public: + /// Optional attribute setters for ResourceSparseApplyProximalGradientDescent + struct Attrs { + /// If True, the subtraction will be protected by a lock; + /// otherwise the behavior is undefined, but may exhibit less contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + bool use_locking_ = false; + }; + ResourceSparseApplyProximalGradientDescent(const ::tensorflow::Scope& scope, + ::tensorflow::Input var, + ::tensorflow::Input alpha, + ::tensorflow::Input l1, + ::tensorflow::Input l2, + ::tensorflow::Input grad, + ::tensorflow::Input indices); + ResourceSparseApplyProximalGradientDescent(const ::tensorflow::Scope& scope, + ::tensorflow::Input var, + ::tensorflow::Input alpha, + ::tensorflow::Input l1, + ::tensorflow::Input l2, + ::tensorflow::Input grad, + ::tensorflow::Input indices, const + ResourceSparseApplyProximalGradientDescent::Attrs& + attrs); + operator ::tensorflow::Operation() const { return operation; } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + + Operation operation; +}; + +/// Update '*var' according to the RMSProp algorithm. +/// +/// Note that in dense implementation of this algorithm, ms and mom will +/// update even if the grad is zero, but in this sparse implementation, ms +/// and mom will not update in iterations during which the grad is zero. +/// +/// mean_square = decay * mean_square + (1-decay) * gradient ** 2 +/// Delta = learning_rate * gradient / sqrt(mean_square + epsilon) +/// +/// ms <- rho * ms_{t-1} + (1-rho) * grad * grad +/// mom <- momentum * mom_{t-1} + lr * grad / sqrt(ms + epsilon) +/// var <- var - mom +/// +/// Args: +/// * scope: A Scope object +/// * var: Should be from a Variable(). +/// * ms: Should be from a Variable(). +/// * mom: Should be from a Variable(). +/// * lr: Scaling factor. Must be a scalar. +/// * rho: Decay rate. Must be a scalar. +/// * epsilon: Ridge term. Must be a scalar. +/// * grad: The gradient. +/// * indices: A vector of indices into the first dimension of var, ms and mom. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If `True`, updating of the var, ms, and mom tensors is protected +/// by a lock; otherwise the behavior is undefined, but may exhibit less +/// contention. +/// +/// Returns: +/// * the created `Operation` +class ResourceSparseApplyRMSProp { + public: + /// Optional attribute setters for ResourceSparseApplyRMSProp + struct Attrs { + /// If `True`, updating of the var, ms, and mom tensors is protected + /// by a lock; otherwise the behavior is undefined, but may exhibit less + /// contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + bool use_locking_ = false; + }; + ResourceSparseApplyRMSProp(const ::tensorflow::Scope& scope, + ::tensorflow::Input var, ::tensorflow::Input ms, + ::tensorflow::Input mom, ::tensorflow::Input lr, + ::tensorflow::Input rho, ::tensorflow::Input + momentum, ::tensorflow::Input epsilon, + ::tensorflow::Input grad, ::tensorflow::Input + indices); + ResourceSparseApplyRMSProp(const ::tensorflow::Scope& scope, + ::tensorflow::Input var, ::tensorflow::Input ms, + ::tensorflow::Input mom, ::tensorflow::Input lr, + ::tensorflow::Input rho, ::tensorflow::Input + momentum, ::tensorflow::Input epsilon, + ::tensorflow::Input grad, ::tensorflow::Input + indices, const ResourceSparseApplyRMSProp::Attrs& + attrs); + operator ::tensorflow::Operation() const { return operation; } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + + Operation operation; +}; + +/// var: Should be from a Variable(). +/// +/// Args: +/// * scope: A Scope object +/// * accum: Should be from a Variable(). +/// * accum_update: : Should be from a Variable(). +/// * lr: Learning rate. Must be a scalar. +/// * rho: Decay factor. Must be a scalar. +/// * epsilon: Constant factor. Must be a scalar. +/// * grad: The gradient. +/// * indices: A vector of indices into the first dimension of var and accum. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If True, updating of the var and accum tensors will be protected by +/// a lock; otherwise the behavior is undefined, but may exhibit less contention. +/// +/// Returns: +/// * `Output`: Same as "var". +class SparseApplyAdadelta { + public: + /// Optional attribute setters for SparseApplyAdadelta + struct Attrs { + /// If True, updating of the var and accum tensors will be protected by + /// a lock; otherwise the behavior is undefined, but may exhibit less contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + bool use_locking_ = false; + }; + SparseApplyAdadelta(const ::tensorflow::Scope& scope, ::tensorflow::Input var, + ::tensorflow::Input accum, ::tensorflow::Input + accum_update, ::tensorflow::Input lr, ::tensorflow::Input + rho, ::tensorflow::Input epsilon, ::tensorflow::Input grad, + ::tensorflow::Input indices); + SparseApplyAdadelta(const ::tensorflow::Scope& scope, ::tensorflow::Input var, + ::tensorflow::Input accum, ::tensorflow::Input + accum_update, ::tensorflow::Input lr, ::tensorflow::Input + rho, ::tensorflow::Input epsilon, ::tensorflow::Input grad, + ::tensorflow::Input indices, const + SparseApplyAdadelta::Attrs& attrs); + operator ::tensorflow::Output() const { return out; } + operator ::tensorflow::Input() const { return out; } + ::tensorflow::Node* node() const { return out.node(); } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + + Operation operation; + ::tensorflow::Output out; +}; + +/// Update relevant entries in '*var' and '*accum' according to the adagrad scheme. +/// +/// That is for rows we have grad for, we update var and accum as follows: +/// $$accum += grad * grad$$ +/// $$var -= lr * grad * (1 / sqrt(accum))$$ +/// +/// Args: +/// * scope: A Scope object +/// * var: Should be from a Variable(). +/// * accum: Should be from a Variable(). +/// * lr: Learning rate. Must be a scalar. +/// * grad: The gradient. +/// * indices: A vector of indices into the first dimension of var and accum. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If `True`, updating of the var and accum tensors will be protected +/// by a lock; otherwise the behavior is undefined, but may exhibit less +/// contention. +/// +/// Returns: +/// * `Output`: Same as "var". +class SparseApplyAdagrad { + public: + /// Optional attribute setters for SparseApplyAdagrad + struct Attrs { + /// If `True`, updating of the var and accum tensors will be protected + /// by a lock; otherwise the behavior is undefined, but may exhibit less + /// contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + /// Defaults to true + TF_MUST_USE_RESULT Attrs UpdateSlots(bool x) { + Attrs ret = *this; + ret.update_slots_ = x; + return ret; + } + + bool use_locking_ = false; + bool update_slots_ = true; + }; + SparseApplyAdagrad(const ::tensorflow::Scope& scope, ::tensorflow::Input var, + ::tensorflow::Input accum, ::tensorflow::Input lr, + ::tensorflow::Input grad, ::tensorflow::Input indices); + SparseApplyAdagrad(const ::tensorflow::Scope& scope, ::tensorflow::Input var, + ::tensorflow::Input accum, ::tensorflow::Input lr, + ::tensorflow::Input grad, ::tensorflow::Input indices, const + SparseApplyAdagrad::Attrs& attrs); + operator ::tensorflow::Output() const { return out; } + operator ::tensorflow::Input() const { return out; } + ::tensorflow::Node* node() const { return out.node(); } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + static Attrs UpdateSlots(bool x) { + return Attrs().UpdateSlots(x); + } + + Operation operation; + ::tensorflow::Output out; +}; + +/// Update entries in '*var' and '*accum' according to the proximal adagrad scheme. +/// +/// Args: +/// * scope: A Scope object +/// * var: Should be from a Variable(). +/// * gradient_accumulator: Should be from a Variable(). +/// * gradient_squared_accumulator: Should be from a Variable(). +/// * grad: The gradient. +/// * indices: A vector of indices into the first dimension of var and accum. +/// * lr: Learning rate. Must be a scalar. +/// * l1: L1 regularization. Must be a scalar. +/// * l2: L2 regularization. Must be a scalar. +/// * global_step: Training step number. Must be a scalar. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If True, updating of the var and accum tensors will be protected by +/// a lock; otherwise the behavior is undefined, but may exhibit less contention. +/// +/// Returns: +/// * `Output`: Same as "var". +class SparseApplyAdagradDA { + public: + /// Optional attribute setters for SparseApplyAdagradDA + struct Attrs { + /// If True, updating of the var and accum tensors will be protected by + /// a lock; otherwise the behavior is undefined, but may exhibit less contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + bool use_locking_ = false; + }; + SparseApplyAdagradDA(const ::tensorflow::Scope& scope, ::tensorflow::Input var, + ::tensorflow::Input gradient_accumulator, + ::tensorflow::Input gradient_squared_accumulator, + ::tensorflow::Input grad, ::tensorflow::Input indices, + ::tensorflow::Input lr, ::tensorflow::Input l1, + ::tensorflow::Input l2, ::tensorflow::Input global_step); + SparseApplyAdagradDA(const ::tensorflow::Scope& scope, ::tensorflow::Input var, + ::tensorflow::Input gradient_accumulator, + ::tensorflow::Input gradient_squared_accumulator, + ::tensorflow::Input grad, ::tensorflow::Input indices, + ::tensorflow::Input lr, ::tensorflow::Input l1, + ::tensorflow::Input l2, ::tensorflow::Input global_step, + const SparseApplyAdagradDA::Attrs& attrs); + operator ::tensorflow::Output() const { return out; } + operator ::tensorflow::Input() const { return out; } + ::tensorflow::Node* node() const { return out.node(); } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + + Operation operation; + ::tensorflow::Output out; +}; + +/// Update '*var' according to the centered RMSProp algorithm. +/// +/// The centered RMSProp algorithm uses an estimate of the centered second moment +/// (i.e., the variance) for normalization, as opposed to regular RMSProp, which +/// uses the (uncentered) second moment. This often helps with training, but is +/// slightly more expensive in terms of computation and memory. +/// +/// Note that in dense implementation of this algorithm, mg, ms, and mom will +/// update even if the grad is zero, but in this sparse implementation, mg, ms, +/// and mom will not update in iterations during which the grad is zero. +/// +/// mean_square = decay * mean_square + (1-decay) * gradient ** 2 +/// mean_grad = decay * mean_grad + (1-decay) * gradient +/// Delta = learning_rate * gradient / sqrt(mean_square + epsilon - mean_grad ** 2) +/// +/// $$ms <- rho * ms_{t-1} + (1-rho) * grad * grad$$ +/// $$mom <- momentum * mom_{t-1} + lr * grad / sqrt(ms + epsilon)$$ +/// $$var <- var - mom$$ +/// +/// Args: +/// * scope: A Scope object +/// * var: Should be from a Variable(). +/// * mg: Should be from a Variable(). +/// * ms: Should be from a Variable(). +/// * mom: Should be from a Variable(). +/// * lr: Scaling factor. Must be a scalar. +/// * rho: Decay rate. Must be a scalar. +/// * epsilon: Ridge term. Must be a scalar. +/// * grad: The gradient. +/// * indices: A vector of indices into the first dimension of var, ms and mom. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If `True`, updating of the var, mg, ms, and mom tensors is +/// protected by a lock; otherwise the behavior is undefined, but may exhibit less +/// contention. +/// +/// Returns: +/// * `Output`: Same as "var". +class SparseApplyCenteredRMSProp { + public: + /// Optional attribute setters for SparseApplyCenteredRMSProp + struct Attrs { + /// If `True`, updating of the var, mg, ms, and mom tensors is + /// protected by a lock; otherwise the behavior is undefined, but may exhibit less + /// contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + bool use_locking_ = false; + }; + SparseApplyCenteredRMSProp(const ::tensorflow::Scope& scope, + ::tensorflow::Input var, ::tensorflow::Input mg, + ::tensorflow::Input ms, ::tensorflow::Input mom, + ::tensorflow::Input lr, ::tensorflow::Input rho, + ::tensorflow::Input momentum, ::tensorflow::Input + epsilon, ::tensorflow::Input grad, + ::tensorflow::Input indices); + SparseApplyCenteredRMSProp(const ::tensorflow::Scope& scope, + ::tensorflow::Input var, ::tensorflow::Input mg, + ::tensorflow::Input ms, ::tensorflow::Input mom, + ::tensorflow::Input lr, ::tensorflow::Input rho, + ::tensorflow::Input momentum, ::tensorflow::Input + epsilon, ::tensorflow::Input grad, + ::tensorflow::Input indices, const + SparseApplyCenteredRMSProp::Attrs& attrs); + operator ::tensorflow::Output() const { return out; } + operator ::tensorflow::Input() const { return out; } + ::tensorflow::Node* node() const { return out.node(); } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + + Operation operation; + ::tensorflow::Output out; +}; + +/// Update relevant entries in '*var' according to the Ftrl-proximal scheme. +/// +/// That is for rows we have grad for, we update var, accum and linear as follows: +/// $$accum_new = accum + grad * grad$$ +/// $$linear += grad + (accum_{new}^{-lr_{power}} - accum^{-lr_{power}} / lr * var$$ +/// $$quadratic = 1.0 / (accum_{new}^{lr_{power}} * lr) + 2 * l2$$ +/// $$var = (sign(linear) * l1 - linear) / quadratic\ if\ |linear| > l1\ else\ 0.0$$ +/// $$accum = accum_{new}$$ +/// +/// Args: +/// * scope: A Scope object +/// * var: Should be from a Variable(). +/// * accum: Should be from a Variable(). +/// * linear: Should be from a Variable(). +/// * grad: The gradient. +/// * indices: A vector of indices into the first dimension of var and accum. +/// * lr: Scaling factor. Must be a scalar. +/// * l1: L1 regularization. Must be a scalar. +/// * l2: L2 regularization. Must be a scalar. +/// * lr_power: Scaling factor. Must be a scalar. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If `True`, updating of the var and accum tensors will be protected +/// by a lock; otherwise the behavior is undefined, but may exhibit less +/// contention. +/// +/// Returns: +/// * `Output`: Same as "var". +class SparseApplyFtrl { + public: + /// Optional attribute setters for SparseApplyFtrl + struct Attrs { + /// If `True`, updating of the var and accum tensors will be protected + /// by a lock; otherwise the behavior is undefined, but may exhibit less + /// contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + /// Defaults to false + TF_MUST_USE_RESULT Attrs MultiplyLinearByLr(bool x) { + Attrs ret = *this; + ret.multiply_linear_by_lr_ = x; + return ret; + } + + bool use_locking_ = false; + bool multiply_linear_by_lr_ = false; + }; + SparseApplyFtrl(const ::tensorflow::Scope& scope, ::tensorflow::Input var, + ::tensorflow::Input accum, ::tensorflow::Input linear, + ::tensorflow::Input grad, ::tensorflow::Input indices, + ::tensorflow::Input lr, ::tensorflow::Input l1, + ::tensorflow::Input l2, ::tensorflow::Input lr_power); + SparseApplyFtrl(const ::tensorflow::Scope& scope, ::tensorflow::Input var, + ::tensorflow::Input accum, ::tensorflow::Input linear, + ::tensorflow::Input grad, ::tensorflow::Input indices, + ::tensorflow::Input lr, ::tensorflow::Input l1, + ::tensorflow::Input l2, ::tensorflow::Input lr_power, const + SparseApplyFtrl::Attrs& attrs); + operator ::tensorflow::Output() const { return out; } + operator ::tensorflow::Input() const { return out; } + ::tensorflow::Node* node() const { return out.node(); } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + static Attrs MultiplyLinearByLr(bool x) { + return Attrs().MultiplyLinearByLr(x); + } + + Operation operation; + ::tensorflow::Output out; +}; + +/// Update relevant entries in '*var' according to the Ftrl-proximal scheme. +/// +/// That is for rows we have grad for, we update var, accum and linear as follows: +/// grad_with_shrinkage = grad + 2 * l2_shrinkage * var +/// accum_new = accum + grad * grad +/// linear += grad_with_shrinkage - +/// (accum_new^(-lr_power) - accum^(-lr_power)) / lr * var +/// quadratic = 1.0 / (accum_new^(lr_power) * lr) + 2 * l2 +/// var = (sign(linear) * l1 - linear) / quadratic if |linear| > l1 else 0.0 +/// accum = accum_new +/// +/// Args: +/// * scope: A Scope object +/// * var: Should be from a Variable(). +/// * accum: Should be from a Variable(). +/// * linear: Should be from a Variable(). +/// * grad: The gradient. +/// * indices: A vector of indices into the first dimension of var and accum. +/// * lr: Scaling factor. Must be a scalar. +/// * l1: L1 regularization. Must be a scalar. +/// * l2: L2 shrinkage regularization. Must be a scalar. +/// * lr_power: Scaling factor. Must be a scalar. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If `True`, updating of the var and accum tensors will be protected +/// by a lock; otherwise the behavior is undefined, but may exhibit less +/// contention. +/// +/// Returns: +/// * `Output`: Same as "var". +class SparseApplyFtrlV2 { + public: + /// Optional attribute setters for SparseApplyFtrlV2 + struct Attrs { + /// If `True`, updating of the var and accum tensors will be protected + /// by a lock; otherwise the behavior is undefined, but may exhibit less + /// contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + /// Defaults to false + TF_MUST_USE_RESULT Attrs MultiplyLinearByLr(bool x) { + Attrs ret = *this; + ret.multiply_linear_by_lr_ = x; + return ret; + } + + bool use_locking_ = false; + bool multiply_linear_by_lr_ = false; + }; + SparseApplyFtrlV2(const ::tensorflow::Scope& scope, ::tensorflow::Input var, + ::tensorflow::Input accum, ::tensorflow::Input linear, + ::tensorflow::Input grad, ::tensorflow::Input indices, + ::tensorflow::Input lr, ::tensorflow::Input l1, + ::tensorflow::Input l2, ::tensorflow::Input l2_shrinkage, + ::tensorflow::Input lr_power); + SparseApplyFtrlV2(const ::tensorflow::Scope& scope, ::tensorflow::Input var, + ::tensorflow::Input accum, ::tensorflow::Input linear, + ::tensorflow::Input grad, ::tensorflow::Input indices, + ::tensorflow::Input lr, ::tensorflow::Input l1, + ::tensorflow::Input l2, ::tensorflow::Input l2_shrinkage, + ::tensorflow::Input lr_power, const SparseApplyFtrlV2::Attrs& + attrs); + operator ::tensorflow::Output() const { return out; } + operator ::tensorflow::Input() const { return out; } + ::tensorflow::Node* node() const { return out.node(); } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + static Attrs MultiplyLinearByLr(bool x) { + return Attrs().MultiplyLinearByLr(x); + } + + Operation operation; + ::tensorflow::Output out; +}; + +/// Update relevant entries in '*var' and '*accum' according to the momentum scheme. +/// +/// Set use_nesterov = True if you want to use Nesterov momentum. +/// +/// That is for rows we have grad for, we update var and accum as follows: +/// +/// $$accum = accum * momentum + grad$$ +/// $$var -= lr * accum$$ +/// +/// Args: +/// * scope: A Scope object +/// * var: Should be from a Variable(). +/// * accum: Should be from a Variable(). +/// * lr: Learning rate. Must be a scalar. +/// * grad: The gradient. +/// * indices: A vector of indices into the first dimension of var and accum. +/// * momentum: Momentum. Must be a scalar. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If `True`, updating of the var and accum tensors will be protected +/// by a lock; otherwise the behavior is undefined, but may exhibit less +/// contention. +/// * use_nesterov: If `True`, the tensor passed to compute grad will be +/// var - lr * momentum * accum, so in the end, the var you get is actually +/// var - lr * momentum * accum. +/// +/// Returns: +/// * `Output`: Same as "var". +class SparseApplyMomentum { + public: + /// Optional attribute setters for SparseApplyMomentum + struct Attrs { + /// If `True`, updating of the var and accum tensors will be protected + /// by a lock; otherwise the behavior is undefined, but may exhibit less + /// contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + /// If `True`, the tensor passed to compute grad will be + /// var - lr * momentum * accum, so in the end, the var you get is actually + /// var - lr * momentum * accum. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseNesterov(bool x) { + Attrs ret = *this; + ret.use_nesterov_ = x; + return ret; + } + + bool use_locking_ = false; + bool use_nesterov_ = false; + }; + SparseApplyMomentum(const ::tensorflow::Scope& scope, ::tensorflow::Input var, + ::tensorflow::Input accum, ::tensorflow::Input lr, + ::tensorflow::Input grad, ::tensorflow::Input indices, + ::tensorflow::Input momentum); + SparseApplyMomentum(const ::tensorflow::Scope& scope, ::tensorflow::Input var, + ::tensorflow::Input accum, ::tensorflow::Input lr, + ::tensorflow::Input grad, ::tensorflow::Input indices, + ::tensorflow::Input momentum, const + SparseApplyMomentum::Attrs& attrs); + operator ::tensorflow::Output() const { return out; } + operator ::tensorflow::Input() const { return out; } + ::tensorflow::Node* node() const { return out.node(); } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + static Attrs UseNesterov(bool x) { + return Attrs().UseNesterov(x); + } + + Operation operation; + ::tensorflow::Output out; +}; + +/// Sparse update entries in '*var' and '*accum' according to FOBOS algorithm. +/// +/// That is for rows we have grad for, we update var and accum as follows: +/// $$accum += grad * grad$$ +/// $$prox_v = var$$ +/// $$prox_v -= lr * grad * (1 / sqrt(accum))$$ +/// $$var = sign(prox_v)/(1+lr*l2) * max{|prox_v|-lr*l1,0}$$ +/// +/// Args: +/// * scope: A Scope object +/// * var: Should be from a Variable(). +/// * accum: Should be from a Variable(). +/// * lr: Learning rate. Must be a scalar. +/// * l1: L1 regularization. Must be a scalar. +/// * l2: L2 regularization. Must be a scalar. +/// * grad: The gradient. +/// * indices: A vector of indices into the first dimension of var and accum. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If True, updating of the var and accum tensors will be protected by +/// a lock; otherwise the behavior is undefined, but may exhibit less contention. +/// +/// Returns: +/// * `Output`: Same as "var". +class SparseApplyProximalAdagrad { + public: + /// Optional attribute setters for SparseApplyProximalAdagrad + struct Attrs { + /// If True, updating of the var and accum tensors will be protected by + /// a lock; otherwise the behavior is undefined, but may exhibit less contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + bool use_locking_ = false; + }; + SparseApplyProximalAdagrad(const ::tensorflow::Scope& scope, + ::tensorflow::Input var, ::tensorflow::Input accum, + ::tensorflow::Input lr, ::tensorflow::Input l1, + ::tensorflow::Input l2, ::tensorflow::Input grad, + ::tensorflow::Input indices); + SparseApplyProximalAdagrad(const ::tensorflow::Scope& scope, + ::tensorflow::Input var, ::tensorflow::Input accum, + ::tensorflow::Input lr, ::tensorflow::Input l1, + ::tensorflow::Input l2, ::tensorflow::Input grad, + ::tensorflow::Input indices, const + SparseApplyProximalAdagrad::Attrs& attrs); + operator ::tensorflow::Output() const { return out; } + operator ::tensorflow::Input() const { return out; } + ::tensorflow::Node* node() const { return out.node(); } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + + Operation operation; + ::tensorflow::Output out; +}; + +/// Sparse update '*var' as FOBOS algorithm with fixed learning rate. +/// +/// That is for rows we have grad for, we update var as follows: +/// $$prox_v = var - alpha * grad$$ +/// $$var = sign(prox_v)/(1+alpha*l2) * max{|prox_v|-alpha*l1,0}$$ +/// +/// Args: +/// * scope: A Scope object +/// * var: Should be from a Variable(). +/// * alpha: Scaling factor. Must be a scalar. +/// * l1: L1 regularization. Must be a scalar. +/// * l2: L2 regularization. Must be a scalar. +/// * grad: The gradient. +/// * indices: A vector of indices into the first dimension of var and accum. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If True, the subtraction will be protected by a lock; +/// otherwise the behavior is undefined, but may exhibit less contention. +/// +/// Returns: +/// * `Output`: Same as "var". +class SparseApplyProximalGradientDescent { + public: + /// Optional attribute setters for SparseApplyProximalGradientDescent + struct Attrs { + /// If True, the subtraction will be protected by a lock; + /// otherwise the behavior is undefined, but may exhibit less contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + bool use_locking_ = false; + }; + SparseApplyProximalGradientDescent(const ::tensorflow::Scope& scope, + ::tensorflow::Input var, ::tensorflow::Input + alpha, ::tensorflow::Input l1, + ::tensorflow::Input l2, ::tensorflow::Input + grad, ::tensorflow::Input indices); + SparseApplyProximalGradientDescent(const ::tensorflow::Scope& scope, + ::tensorflow::Input var, ::tensorflow::Input + alpha, ::tensorflow::Input l1, + ::tensorflow::Input l2, ::tensorflow::Input + grad, ::tensorflow::Input indices, const + SparseApplyProximalGradientDescent::Attrs& + attrs); + operator ::tensorflow::Output() const { return out; } + operator ::tensorflow::Input() const { return out; } + ::tensorflow::Node* node() const { return out.node(); } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + + Operation operation; + ::tensorflow::Output out; +}; + +/// Update '*var' according to the RMSProp algorithm. +/// +/// Note that in dense implementation of this algorithm, ms and mom will +/// update even if the grad is zero, but in this sparse implementation, ms +/// and mom will not update in iterations during which the grad is zero. +/// +/// mean_square = decay * mean_square + (1-decay) * gradient ** 2 +/// Delta = learning_rate * gradient / sqrt(mean_square + epsilon) +/// +/// $$ms <- rho * ms_{t-1} + (1-rho) * grad * grad$$ +/// $$mom <- momentum * mom_{t-1} + lr * grad / sqrt(ms + epsilon)$$ +/// $$var <- var - mom$$ +/// +/// Args: +/// * scope: A Scope object +/// * var: Should be from a Variable(). +/// * ms: Should be from a Variable(). +/// * mom: Should be from a Variable(). +/// * lr: Scaling factor. Must be a scalar. +/// * rho: Decay rate. Must be a scalar. +/// * epsilon: Ridge term. Must be a scalar. +/// * grad: The gradient. +/// * indices: A vector of indices into the first dimension of var, ms and mom. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If `True`, updating of the var, ms, and mom tensors is protected +/// by a lock; otherwise the behavior is undefined, but may exhibit less +/// contention. +/// +/// Returns: +/// * `Output`: Same as "var". +class SparseApplyRMSProp { + public: + /// Optional attribute setters for SparseApplyRMSProp + struct Attrs { + /// If `True`, updating of the var, ms, and mom tensors is protected + /// by a lock; otherwise the behavior is undefined, but may exhibit less + /// contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + bool use_locking_ = false; + }; + SparseApplyRMSProp(const ::tensorflow::Scope& scope, ::tensorflow::Input var, + ::tensorflow::Input ms, ::tensorflow::Input mom, + ::tensorflow::Input lr, ::tensorflow::Input rho, + ::tensorflow::Input momentum, ::tensorflow::Input epsilon, + ::tensorflow::Input grad, ::tensorflow::Input indices); + SparseApplyRMSProp(const ::tensorflow::Scope& scope, ::tensorflow::Input var, + ::tensorflow::Input ms, ::tensorflow::Input mom, + ::tensorflow::Input lr, ::tensorflow::Input rho, + ::tensorflow::Input momentum, ::tensorflow::Input epsilon, + ::tensorflow::Input grad, ::tensorflow::Input indices, const + SparseApplyRMSProp::Attrs& attrs); + operator ::tensorflow::Output() const { return out; } + operator ::tensorflow::Input() const { return out; } + ::tensorflow::Node* node() const { return out.node(); } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + + Operation operation; + ::tensorflow::Output out; +}; + +/// @} + +} // namespace ops +} // namespace tensorflow + +#endif // TENSORFLOW_CC_OPS_TRAINING_OPS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/ops/training_ops_internal.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/ops/training_ops_internal.h new file mode 100644 index 0000000000000000000000000000000000000000..2d241d3ade486d187ad4acba1fd934ed1c38be17 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/ops/training_ops_internal.h @@ -0,0 +1,426 @@ +// This file is MACHINE GENERATED! Do not edit. + +#ifndef TENSORFLOW_CC_OPS_TRAINING_OPS_INTERNAL_H_ +#define TENSORFLOW_CC_OPS_TRAINING_OPS_INTERNAL_H_ + +// This file is MACHINE GENERATED! Do not edit. + +#include "tensorflow/cc/framework/ops.h" +#include "tensorflow/cc/framework/scope.h" +#include "tensorflow/core/framework/tensor.h" +#include "tensorflow/core/framework/tensor_shape.h" +#include "tensorflow/core/framework/types.h" +#include "tensorflow/core/lib/gtl/array_slice.h" + +namespace tensorflow { +namespace ops { +namespace internal { +// NOTE: This namespace has internal TensorFlow details that +// are not part of TensorFlow's public API. + +/// @defgroup training_ops_internal Training Ops Internal +/// @{ + +/// Update '*var' according to the AdaMax algorithm. +/// +/// m_t <- beta1 * m_{t-1} + (1 - beta1) * g +/// v_t <- max(beta2 * v_{t-1}, abs(g)) +/// variable <- variable - learning_rate / (1 - beta1^t) * m_t / (v_t + epsilon) +/// +/// Args: +/// * scope: A Scope object +/// * var: Should be from a Variable(). +/// * m: Should be from a Variable(). +/// * v: Should be from a Variable(). +/// * beta1_power: Must be a scalar. +/// * lr: Scaling factor. Must be a scalar. +/// * beta1: Momentum factor. Must be a scalar. +/// * beta2: Momentum factor. Must be a scalar. +/// * epsilon: Ridge term. Must be a scalar. +/// * grad: The gradient. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If `True`, updating of the var, m, and v tensors will be protected +/// by a lock; otherwise the behavior is undefined, but may exhibit less +/// contention. +/// +/// Returns: +/// * `Output`: Same as "var". +class ApplyAdaMax { + public: + /// Optional attribute setters for ApplyAdaMax + struct Attrs { + /// If `True`, updating of the var, m, and v tensors will be protected + /// by a lock; otherwise the behavior is undefined, but may exhibit less + /// contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + bool use_locking_ = false; + }; + ApplyAdaMax(const ::tensorflow::Scope& scope, ::tensorflow::Input var, + ::tensorflow::Input m, ::tensorflow::Input v, ::tensorflow::Input + beta1_power, ::tensorflow::Input lr, ::tensorflow::Input beta1, + ::tensorflow::Input beta2, ::tensorflow::Input epsilon, + ::tensorflow::Input grad); + ApplyAdaMax(const ::tensorflow::Scope& scope, ::tensorflow::Input var, + ::tensorflow::Input m, ::tensorflow::Input v, ::tensorflow::Input + beta1_power, ::tensorflow::Input lr, ::tensorflow::Input beta1, + ::tensorflow::Input beta2, ::tensorflow::Input epsilon, + ::tensorflow::Input grad, const ApplyAdaMax::Attrs& attrs); + operator ::tensorflow::Output() const { return out; } + operator ::tensorflow::Input() const { return out; } + ::tensorflow::Node* node() const { return out.node(); } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + + Operation operation; + ::tensorflow::Output out; +}; + +/// Update '*var' according to the adagrad scheme. +/// +/// accum += grad * grad +/// var -= lr * grad * (1 / sqrt(accum)) +/// +/// Args: +/// * scope: A Scope object +/// * var: Should be from a Variable(). +/// * accum: Should be from a Variable(). +/// * lr: Scaling factor. Must be a scalar. +/// * epsilon: Constant factor. Must be a scalar. +/// * grad: The gradient. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If `True`, updating of the var and accum tensors will be protected +/// by a lock; otherwise the behavior is undefined, but may exhibit less +/// contention. +/// +/// Returns: +/// * `Output`: Same as "var". +class ApplyAdagradV2 { + public: + /// Optional attribute setters for ApplyAdagradV2 + struct Attrs { + /// If `True`, updating of the var and accum tensors will be protected + /// by a lock; otherwise the behavior is undefined, but may exhibit less + /// contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + /// Defaults to true + TF_MUST_USE_RESULT Attrs UpdateSlots(bool x) { + Attrs ret = *this; + ret.update_slots_ = x; + return ret; + } + + bool use_locking_ = false; + bool update_slots_ = true; + }; + ApplyAdagradV2(const ::tensorflow::Scope& scope, ::tensorflow::Input var, + ::tensorflow::Input accum, ::tensorflow::Input lr, + ::tensorflow::Input epsilon, ::tensorflow::Input grad); + ApplyAdagradV2(const ::tensorflow::Scope& scope, ::tensorflow::Input var, + ::tensorflow::Input accum, ::tensorflow::Input lr, + ::tensorflow::Input epsilon, ::tensorflow::Input grad, const + ApplyAdagradV2::Attrs& attrs); + operator ::tensorflow::Output() const { return out; } + operator ::tensorflow::Input() const { return out; } + ::tensorflow::Node* node() const { return out.node(); } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + static Attrs UpdateSlots(bool x) { + return Attrs().UpdateSlots(x); + } + + Operation operation; + ::tensorflow::Output out; +}; + +/// Update '*var' according to the AdaMax algorithm. +/// +/// m_t <- beta1 * m_{t-1} + (1 - beta1) * g +/// v_t <- max(beta2 * v_{t-1}, abs(g)) +/// variable <- variable - learning_rate / (1 - beta1^t) * m_t / (v_t + epsilon) +/// +/// Args: +/// * scope: A Scope object +/// * var: Should be from a Variable(). +/// * m: Should be from a Variable(). +/// * v: Should be from a Variable(). +/// * beta1_power: Must be a scalar. +/// * lr: Scaling factor. Must be a scalar. +/// * beta1: Momentum factor. Must be a scalar. +/// * beta2: Momentum factor. Must be a scalar. +/// * epsilon: Ridge term. Must be a scalar. +/// * grad: The gradient. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If `True`, updating of the var, m, and v tensors will be protected +/// by a lock; otherwise the behavior is undefined, but may exhibit less +/// contention. +/// +/// Returns: +/// * the created `Operation` +class ResourceApplyAdaMax { + public: + /// Optional attribute setters for ResourceApplyAdaMax + struct Attrs { + /// If `True`, updating of the var, m, and v tensors will be protected + /// by a lock; otherwise the behavior is undefined, but may exhibit less + /// contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + bool use_locking_ = false; + }; + ResourceApplyAdaMax(const ::tensorflow::Scope& scope, ::tensorflow::Input var, + ::tensorflow::Input m, ::tensorflow::Input v, + ::tensorflow::Input beta1_power, ::tensorflow::Input lr, + ::tensorflow::Input beta1, ::tensorflow::Input beta2, + ::tensorflow::Input epsilon, ::tensorflow::Input grad); + ResourceApplyAdaMax(const ::tensorflow::Scope& scope, ::tensorflow::Input var, + ::tensorflow::Input m, ::tensorflow::Input v, + ::tensorflow::Input beta1_power, ::tensorflow::Input lr, + ::tensorflow::Input beta1, ::tensorflow::Input beta2, + ::tensorflow::Input epsilon, ::tensorflow::Input grad, + const ResourceApplyAdaMax::Attrs& attrs); + operator ::tensorflow::Operation() const { return operation; } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + + Operation operation; +}; + +/// Update '*var' according to the adagrad scheme. +/// +/// accum += grad * grad +/// var -= lr * grad * (1 / (sqrt(accum) + epsilon)) +/// +/// Args: +/// * scope: A Scope object +/// * var: Should be from a Variable(). +/// * accum: Should be from a Variable(). +/// * lr: Scaling factor. Must be a scalar. +/// * epsilon: Constant factor. Must be a scalar. +/// * grad: The gradient. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If `True`, updating of the var and accum tensors will be protected +/// by a lock; otherwise the behavior is undefined, but may exhibit less +/// contention. +/// +/// Returns: +/// * the created `Operation` +class ResourceApplyAdagradV2 { + public: + /// Optional attribute setters for ResourceApplyAdagradV2 + struct Attrs { + /// If `True`, updating of the var and accum tensors will be protected + /// by a lock; otherwise the behavior is undefined, but may exhibit less + /// contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + /// Defaults to true + TF_MUST_USE_RESULT Attrs UpdateSlots(bool x) { + Attrs ret = *this; + ret.update_slots_ = x; + return ret; + } + + bool use_locking_ = false; + bool update_slots_ = true; + }; + ResourceApplyAdagradV2(const ::tensorflow::Scope& scope, ::tensorflow::Input + var, ::tensorflow::Input accum, ::tensorflow::Input lr, + ::tensorflow::Input epsilon, ::tensorflow::Input grad); + ResourceApplyAdagradV2(const ::tensorflow::Scope& scope, ::tensorflow::Input + var, ::tensorflow::Input accum, ::tensorflow::Input lr, + ::tensorflow::Input epsilon, ::tensorflow::Input grad, + const ResourceApplyAdagradV2::Attrs& attrs); + operator ::tensorflow::Operation() const { return operation; } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + static Attrs UpdateSlots(bool x) { + return Attrs().UpdateSlots(x); + } + + Operation operation; +}; + +/// Update relevant entries in '*var' and '*accum' according to the adagrad scheme. +/// +/// That is for rows we have grad for, we update var and accum as follows: +/// accum += grad * grad +/// var -= lr * grad * (1 / sqrt(accum)) +/// +/// Args: +/// * scope: A Scope object +/// * var: Should be from a Variable(). +/// * accum: Should be from a Variable(). +/// * lr: Learning rate. Must be a scalar. +/// * epsilon: Constant factor. Must be a scalar. +/// * grad: The gradient. +/// * indices: A vector of indices into the first dimension of var and accum. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If `True`, updating of the var and accum tensors will be protected +/// by a lock; otherwise the behavior is undefined, but may exhibit less +/// contention. +/// +/// Returns: +/// * the created `Operation` +class ResourceSparseApplyAdagradV2 { + public: + /// Optional attribute setters for ResourceSparseApplyAdagradV2 + struct Attrs { + /// If `True`, updating of the var and accum tensors will be protected + /// by a lock; otherwise the behavior is undefined, but may exhibit less + /// contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + /// Defaults to true + TF_MUST_USE_RESULT Attrs UpdateSlots(bool x) { + Attrs ret = *this; + ret.update_slots_ = x; + return ret; + } + + bool use_locking_ = false; + bool update_slots_ = true; + }; + ResourceSparseApplyAdagradV2(const ::tensorflow::Scope& scope, + ::tensorflow::Input var, ::tensorflow::Input + accum, ::tensorflow::Input lr, ::tensorflow::Input + epsilon, ::tensorflow::Input grad, + ::tensorflow::Input indices); + ResourceSparseApplyAdagradV2(const ::tensorflow::Scope& scope, + ::tensorflow::Input var, ::tensorflow::Input + accum, ::tensorflow::Input lr, ::tensorflow::Input + epsilon, ::tensorflow::Input grad, + ::tensorflow::Input indices, const + ResourceSparseApplyAdagradV2::Attrs& attrs); + operator ::tensorflow::Operation() const { return operation; } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + static Attrs UpdateSlots(bool x) { + return Attrs().UpdateSlots(x); + } + + Operation operation; +}; + +/// Update relevant entries in '*var' and '*accum' according to the adagrad scheme. +/// +/// That is for rows we have grad for, we update var and accum as follows: +/// $$accum += grad * grad$$ +/// $$var -= lr * grad * (1 / sqrt(accum))$$ +/// +/// Args: +/// * scope: A Scope object +/// * var: Should be from a Variable(). +/// * accum: Should be from a Variable(). +/// * lr: Learning rate. Must be a scalar. +/// * epsilon: Constant factor. Must be a scalar. +/// * grad: The gradient. +/// * indices: A vector of indices into the first dimension of var and accum. +/// +/// Optional attributes (see `Attrs`): +/// * use_locking: If `True`, updating of the var and accum tensors will be protected +/// by a lock; otherwise the behavior is undefined, but may exhibit less +/// contention. +/// +/// Returns: +/// * `Output`: Same as "var". +class SparseApplyAdagradV2 { + public: + /// Optional attribute setters for SparseApplyAdagradV2 + struct Attrs { + /// If `True`, updating of the var and accum tensors will be protected + /// by a lock; otherwise the behavior is undefined, but may exhibit less + /// contention. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs UseLocking(bool x) { + Attrs ret = *this; + ret.use_locking_ = x; + return ret; + } + + /// Defaults to true + TF_MUST_USE_RESULT Attrs UpdateSlots(bool x) { + Attrs ret = *this; + ret.update_slots_ = x; + return ret; + } + + bool use_locking_ = false; + bool update_slots_ = true; + }; + SparseApplyAdagradV2(const ::tensorflow::Scope& scope, ::tensorflow::Input var, + ::tensorflow::Input accum, ::tensorflow::Input lr, + ::tensorflow::Input epsilon, ::tensorflow::Input grad, + ::tensorflow::Input indices); + SparseApplyAdagradV2(const ::tensorflow::Scope& scope, ::tensorflow::Input var, + ::tensorflow::Input accum, ::tensorflow::Input lr, + ::tensorflow::Input epsilon, ::tensorflow::Input grad, + ::tensorflow::Input indices, const + SparseApplyAdagradV2::Attrs& attrs); + operator ::tensorflow::Output() const { return out; } + operator ::tensorflow::Input() const { return out; } + ::tensorflow::Node* node() const { return out.node(); } + + static Attrs UseLocking(bool x) { + return Attrs().UseLocking(x); + } + static Attrs UpdateSlots(bool x) { + return Attrs().UpdateSlots(x); + } + + Operation operation; + ::tensorflow::Output out; +}; + +} // namespace internal +} // namespace ops +} // namespace tensorflow + +#endif // TENSORFLOW_CC_OPS_TRAINING_OPS_INTERNAL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/ops/user_ops.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/ops/user_ops.h new file mode 100644 index 0000000000000000000000000000000000000000..00888ab9d7ac43dd0d5de37c3965b6e3ebfb5fc5 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/ops/user_ops.h @@ -0,0 +1,44 @@ +// This file is MACHINE GENERATED! Do not edit. + +#ifndef TENSORFLOW_CC_OPS_USER_OPS_H_ +#define TENSORFLOW_CC_OPS_USER_OPS_H_ + +// This file is MACHINE GENERATED! Do not edit. + +#include "tensorflow/cc/framework/ops.h" +#include "tensorflow/cc/framework/scope.h" +#include "tensorflow/core/framework/tensor.h" +#include "tensorflow/core/framework/tensor_shape.h" +#include "tensorflow/core/framework/types.h" +#include "tensorflow/core/lib/gtl/array_slice.h" + +namespace tensorflow { +namespace ops { + +/// @defgroup user_ops User Ops +/// @{ + +/// Output a fact about factorials. +/// +/// Args: +/// * scope: A Scope object +/// +/// Returns: +/// * `Output`: The fact tensor. +class Fact { + public: + Fact(const ::tensorflow::Scope& scope); + operator ::tensorflow::Output() const { return fact; } + operator ::tensorflow::Input() const { return fact; } + ::tensorflow::Node* node() const { return fact.node(); } + + Operation operation; + ::tensorflow::Output fact; +}; + +/// @} + +} // namespace ops +} // namespace tensorflow + +#endif // TENSORFLOW_CC_OPS_USER_OPS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/ops/user_ops_internal.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/ops/user_ops_internal.h new file mode 100644 index 0000000000000000000000000000000000000000..784254dd4cca0a911cb7c842839e62c7a3afad1c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/ops/user_ops_internal.h @@ -0,0 +1,28 @@ +// This file is MACHINE GENERATED! Do not edit. + +#ifndef TENSORFLOW_CC_OPS_USER_OPS_INTERNAL_H_ +#define TENSORFLOW_CC_OPS_USER_OPS_INTERNAL_H_ + +// This file is MACHINE GENERATED! Do not edit. + +#include "tensorflow/cc/framework/ops.h" +#include "tensorflow/cc/framework/scope.h" +#include "tensorflow/core/framework/tensor.h" +#include "tensorflow/core/framework/tensor_shape.h" +#include "tensorflow/core/framework/types.h" +#include "tensorflow/core/lib/gtl/array_slice.h" + +namespace tensorflow { +namespace ops { +namespace internal { +// NOTE: This namespace has internal TensorFlow details that +// are not part of TensorFlow's public API. + +/// @defgroup user_ops_internal User Ops Internal +/// @{ + +} // namespace internal +} // namespace ops +} // namespace tensorflow + +#endif // TENSORFLOW_CC_OPS_USER_OPS_INTERNAL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/ops/while_loop.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/ops/while_loop.h new file mode 100644 index 0000000000000000000000000000000000000000..6dbf1d23dbaf4f1525dd7fa02941f67ecf6c793f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/ops/while_loop.h @@ -0,0 +1,77 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_CC_OPS_WHILE_LOOP_H_ +#define TENSORFLOW_CC_OPS_WHILE_LOOP_H_ + +#include +#include + +#include "tensorflow/cc/framework/ops.h" +#include "tensorflow/cc/framework/scope.h" + +namespace tensorflow { +namespace ops { + +// Function that takes cond graph inputs and returns cond graph boolean output. +// 'output' need not be set if an error is returned. +typedef std::function& inputs, + Output* output)> + CondGraphBuilderFn; + +// Function that takes body graph inputs and returns body graph outputs. +// 'outputs' need not be populated if an error is returned. +typedef std::function& inputs, + std::vector* outputs)> + BodyGraphBuilderFn; + +// Constructs a while loop. +// +// Arguments: +// * scope: used to construct the while loop. +// * inputs: the initial values of the loop variables. Must be non-empty. +// * cond: a function that builds the condition graph of the loop. Takes the +// current loop variables as inputs and returns a scalar boolean Output +// indicating whether the loop should continue. +// * body: a function that builds the body graph of the loop. Takes the current +// loop variables as inputs and returns the updated loop variables. +// * frame_name: the frame name to use for this while loop. This should be a +// unique name. This will be used as a prefix for created operations. +// * outputs: output param that returns final loop variable outputs in non-error +// case. Must be non-null and empty. +// * create_while_ctx: if true, a WhileContext is created and populated for this +// loop. See core/graph/while_context.h for more details on +// WhileContexts. This is set to false for loops used as part of gradient +// computations, since they're part of the gradient for a loop in the +// forward-pass. +// TODO(skyewm): revisit this. Should we create WhileContexts for all loops, +// even if we don't need them? +// * cond_output: if non-null, the output of the predicate is returned. This +// will always be a LoopCond node. +// +// Returns an error if the while loop could not be fully constructed. +// +// TODO(skyewm): clean up partially-constructed loop in error case +// TODO(skyewm): create public interface to this method +Status BuildWhileLoop(const Scope& scope, const std::vector& inputs, + const CondGraphBuilderFn& cond, + const BodyGraphBuilderFn& body, const string& frame_name, + OutputList* outputs, bool create_while_ctx = true, + Output* cond_output = nullptr); + +} // namespace ops +} // namespace tensorflow + +#endif // TENSORFLOW_CC_OPS_WHILE_LOOP_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/saved_model/bundle_v2.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/saved_model/bundle_v2.h new file mode 100644 index 0000000000000000000000000000000000000000..e199bd1cc5dc7d269e06fd1d61870b4200cf7878 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/saved_model/bundle_v2.h @@ -0,0 +1,89 @@ +/* Copyright 2016 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +// Helpers for loading the persistent representation of a SavedModelV2. +// Please note that this is depended on by code that does not make use of +// the full runtime and its dependencies should be restricted. + +#ifndef TENSORFLOW_CC_SAVED_MODEL_BUNDLE_V2_H_ +#define TENSORFLOW_CC_SAVED_MODEL_BUNDLE_V2_H_ + +#include +#include +#include + +#include "absl/container/flat_hash_set.h" +#include "tensorflow/core/framework/graph_debug_info.pb.h" +#include "tensorflow/core/lib/core/status.h" +#include "tensorflow/core/protobuf/meta_graph.pb.h" +#include "tensorflow/core/protobuf/saved_object_graph.pb.h" +#include "tensorflow/core/protobuf/trackable_object_graph.pb.h" +#include "tensorflow/core/util/tensor_bundle/tensor_bundle.h" + +namespace tensorflow { + +/// Represents a version 2 SavedModel that is loaded from storage (but not yet +/// loaded into an executable in-memory representation). +class SavedModelV2Bundle { + public: + using RestoreObjectsCallback = + std::function; + + /// Loads persistent representations for a SavedModelV2 from the specified + /// export directory. + static Status Load(const std::string& export_dir, SavedModelV2Bundle* bundle); + + /// MetaGraphDef from the loaded SavedModel. + MetaGraphDef& meta_graph_def() { return meta_graph_def_; } + + /// SavedObjectGraph from the MetaGraphDef. + const SavedObjectGraph& saved_object_graph() { + return meta_graph_def().object_graph_def(); + } + + /// TrackableObjectGraph loaded from the variable_reader() checkpoint. + TrackableObjectGraph& trackable_object_graph() { + return trackable_object_graph_; + } + + /// BundleReader for accessing the variables bundle. + BundleReader* variable_reader() { return variable_reader_.get(); } + + /// The GraphDebugInfo (or nullptr if none). + GraphDebugInfo* debug_info() { return debug_info_.get(); } + + /// Restores objects, invoking the callback with the node id in the + /// saved_object_graph() and the corresponding TrackableObject from the + /// trackable_object_graph(). The callback may use the variable_reader() but + /// must not modify the underlying saved_object_graph(). + Status VisitObjectsToRestore(RestoreObjectsCallback callback); + + private: + Status RecurseObjectsToRestore( + const SavedObject* saved_object, int saved_object_node_id, + const TrackableObjectGraph::TrackableObject* trackable_object, + std::string object_name, + absl::flat_hash_set* seen_trackable_node_ids, + RestoreObjectsCallback callback); + + MetaGraphDef meta_graph_def_; + TrackableObjectGraph trackable_object_graph_; + std::unique_ptr variable_reader_; + std::unique_ptr debug_info_; +}; + +} // namespace tensorflow + +#endif // TENSORFLOW_CC_SAVED_MODEL_BUNDLE_V2_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/saved_model/constants.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/saved_model/constants.h new file mode 100644 index 0000000000000000000000000000000000000000..e8a267e32801eb12bb33f967fdac96b052ac7998 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/saved_model/constants.h @@ -0,0 +1,82 @@ +/* Copyright 2016 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_CC_SAVED_MODEL_CONSTANTS_H_ +#define TENSORFLOW_CC_SAVED_MODEL_CONSTANTS_H_ + +namespace tensorflow { + +// SavedModel assets directory. +inline constexpr char kSavedModelAssetsDirectory[] = "assets"; + +// SavedModel assets.extra directory. +inline constexpr char kSavedModelAssetsExtraDirectory[] = "assets.extra"; + +// SavedModel assets key for graph collection-def. +inline constexpr char kSavedModelAssetsKey[] = "saved_model_assets"; + +/// SavedModel legacy init op collection key. Used in v1 SavedModels. +inline constexpr char kSavedModelLegacyInitOpKey[] = "legacy_init_op"; + +/// SavedModel main op collection key. Used in v1 SavedModels. +inline constexpr char kSavedModelMainOpKey[] = "saved_model_main_op"; + +// CollectionDef key for the SavedModel train op. +// Not exported while export_all_saved_models is experimental. +inline constexpr char kSavedModelTrainOpKey[] = "saved_model_train_op"; + +// Schema version for SavedModel. +inline constexpr int kSavedModelSchemaVersion = 1; + +// SavedModel proto filename prefix. +inline constexpr char kSavedModelFilenamePrefix[] = "saved_model"; +// SavedModel proto filename. +inline constexpr char kSavedModelFilenamePb[] = "saved_model.pb"; + +// SavedModel chunked proto filename. +inline constexpr char kSavedModelFilenameCpb[] = "saved_model.cpb"; + +// SavedModel text format proto filename. +inline constexpr char kSavedModelFilenamePbTxt[] = "saved_model.pbtxt"; + +// Subdirectory where debugging related files are written. +inline constexpr char kSavedModelDebugDirectory[] = "debug"; + +// File name for GraphDebugInfo protocol buffer which corresponds to the +// SavedModel. +inline constexpr char kSavedModelDebugInfoFilenamePb[] = + "saved_model_debug_info.pb"; + +// Directory in which to save the SavedModel variables. +inline constexpr char kSavedModelVariablesDirectory[] = "variables"; + +// SavedModel variables filename. +inline constexpr char kSavedModelVariablesFilename[] = "variables"; + +// SavedModel SignatureDef keys for the initialization and train ops. Used in +// V2 SavedModels. +inline constexpr char kSavedModelInitOpSignatureKey[] = "__saved_model_init_op"; +inline constexpr char kSavedModelTrainOpSignatureKey[] = + "__saved_model_train_op"; + +// Key in the TensorBundle for the object graph proto. +inline constexpr char kObjectGraphProtoKey[] = "_CHECKPOINTABLE_OBJECT_GRAPH"; + +// Filename for the FingerprintDef protocol buffer. +inline constexpr char kFingerprintFilenamePb[] = "fingerprint.pb"; + +} // namespace tensorflow + +#endif // TENSORFLOW_CC_SAVED_MODEL_CONSTANTS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/saved_model/fingerprinting.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/saved_model/fingerprinting.h new file mode 100644 index 0000000000000000000000000000000000000000..2b232481e16d5b0becbc639fcf5cb4c02307547a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/saved_model/fingerprinting.h @@ -0,0 +1,47 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_CC_SAVED_MODEL_FINGERPRINTING_H_ +#define TENSORFLOW_CC_SAVED_MODEL_FINGERPRINTING_H_ + +#include + +#include "absl/status/statusor.h" +#include "absl/strings/string_view.h" +#include "tensorflow/core/protobuf/fingerprint.pb.h" + +namespace tensorflow::saved_model::fingerprinting { + +// Creates a FingerprintDef proto from a SavedModel (regular or chunked) and the +// checkpoint meta file (.index) in `export_dir`. +absl::StatusOr CreateFingerprintDef( + absl::string_view export_dir); + +// Loads the `fingerprint.pb` from `export_dir`, returns an error if there is +// none. +absl::StatusOr ReadSavedModelFingerprint( + absl::string_view export_dir); + +// Canonical fingerprinting ID for a SavedModel. +std::string Singleprint(uint64_t graph_def_program_hash, + uint64_t signature_def_hash, + uint64_t saved_object_graph_hash, + uint64_t checkpoint_hash); +std::string Singleprint(const FingerprintDef& fingerprint); +absl::StatusOr Singleprint(absl::string_view export_dir); + +} // namespace tensorflow::saved_model::fingerprinting + +#endif // TENSORFLOW_CC_SAVED_MODEL_FINGERPRINTING_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/saved_model/loader.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/saved_model/loader.h new file mode 100644 index 0000000000000000000000000000000000000000..f2d318a25b7274950d87c0f5cc42d3b876b0a1ef --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/saved_model/loader.h @@ -0,0 +1,147 @@ +/* Copyright 2016 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +/// SavedModel loading functions and SavedModelBundle struct. + +#ifndef TENSORFLOW_CC_SAVED_MODEL_LOADER_H_ +#define TENSORFLOW_CC_SAVED_MODEL_LOADER_H_ + +#include +#include + +#include "tensorflow/core/framework/graph_debug_info.pb.h" +#include "tensorflow/core/lib/core/status.h" +#include "tensorflow/core/protobuf/meta_graph.pb.h" +#include "tensorflow/core/public/session.h" + +namespace tensorflow { + +/// Represents a SavedModel that is loaded from storage. +class SavedModelBundleInterface { + public: + virtual ~SavedModelBundleInterface(); + + /// Returns the TensorFlow Session that can be used to interact with the + /// SavedModel. + virtual Session* GetSession() const = 0; + + /// Returns a map from signature name to SignatureDef for all signatures in + /// in the SavedModel. + virtual const protobuf::Map& GetSignatures() const = 0; +}; + +/// SavedModel representation once the SavedModel is loaded from storage. +/// +/// NOTE: Prefer to use SavedModelBundleLite in new code, as it consumes less +/// RAM. +struct SavedModelBundle : public SavedModelBundleInterface { + /// A TensorFlow Session does not Close itself on destruction. To avoid + /// resource leaks, we explicitly call Close on Sessions that we create. + ~SavedModelBundle() override { + if (session) { + session->Close().IgnoreError(); + } + } + + SavedModelBundle() = default; + + Session* GetSession() const override { return session.get(); } + const protobuf::Map& GetSignatures() const override { + return meta_graph_def.signature_def(); + } + + std::unique_ptr session; + MetaGraphDef meta_graph_def; + std::unique_ptr debug_info; +}; + +// A version of SavedModelBundle that avoids storing a potentially large +// MetaGraphDef. Prefer to use SavedModelBundleLite in new code. +class SavedModelBundleLite : public SavedModelBundleInterface { + public: + SavedModelBundleLite() = default; + SavedModelBundleLite(SavedModelBundleLite&& other) = default; + SavedModelBundleLite& operator=(SavedModelBundleLite&& other) = default; + + SavedModelBundleLite(std::unique_ptr session, + protobuf::Map signatures) + : session_(std::move(session)), signatures_(std::move(signatures)) {} + + /// A TensorFlow Session does not Close itself on destruction. To avoid + /// resource leaks, we explicitly call Close on Sessions that we create. + ~SavedModelBundleLite() override { + if (session_) { + session_->Close().IgnoreError(); + } + } + + Session* GetSession() const override { return session_.get(); } + const protobuf::Map& GetSignatures() const override { + return signatures_; + } + + private: + std::unique_ptr session_; + protobuf::Map signatures_; +}; + +// Restore variable and resources in the SavedModel export dir for the +// indicated metagraph. +// The recommended way to load a saved model is to call LoadSavedModel, +// which provides an already initialized Metagraph, Session, and DebugInfo. +Status RestoreSession(const RunOptions& run_options, + const MetaGraphDef& meta_graph, const string& export_dir, + std::unique_ptr* session); + +// Initialize a session which wraps this metagraph. +// The recommended way to load a saved model is to call LoadSavedModel, +// which provides an already initialized Metagraph, Session, and DebugInfo. +Status LoadMetagraphIntoSession(const SessionOptions& session_options, + const MetaGraphDef& meta_graph, + std::unique_ptr* session); + +/// Loads a SavedModel from the specified export directory. The MetaGraphDef +/// to be loaded is identified by the supplied tags, corresponding exactly to +/// the set of tags used at SavedModel build time. Stores a SavedModel bundle in +/// *bundle with a session and the requested MetaGraphDef, if found. +/// +/// NOTE: Prefer the overload that takes a SavedModelBundleLite* in new code. +Status LoadSavedModel(const SessionOptions& session_options, + const RunOptions& run_options, const string& export_dir, + const std::unordered_set& tags, + SavedModelBundle* const bundle); + +/// Loads a SavedModel from the specified export directory. The MetaGraphDef +/// to be loaded is identified by the supplied tags, corresponding exactly to +/// the set of tags used at SavedModel build time. Stores a SavedModel bundle +/// in *bundle with a session created from the requested MetaGraphDef if found. +/// +/// This overload creates a SavedModelBundleLite, which consumes less RAM than +/// an equivalent SavedModelBundle. +Status LoadSavedModel(const SessionOptions& session_options, + const RunOptions& run_options, const string& export_dir, + const std::unordered_set& tags, + SavedModelBundleLite* const bundle); + +/// Checks whether the provided directory could contain a SavedModel. Note that +/// the method does not load any data by itself. If the method returns `false`, +/// the export directory definitely does not contain a SavedModel. If the method +/// returns `true`, the export directory may contain a SavedModel but provides +/// no guarantee that it can be loaded. +bool MaybeSavedModelDirectory(const std::string& export_dir); + +} // namespace tensorflow + +#endif // TENSORFLOW_CC_SAVED_MODEL_LOADER_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/saved_model/loader_util.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/saved_model/loader_util.h new file mode 100644 index 0000000000000000000000000000000000000000..e5f36976162dcc6fd74690249df6792694b93675 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/saved_model/loader_util.h @@ -0,0 +1,39 @@ +/* Copyright 2016 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_CC_SAVED_MODEL_LOADER_UTIL_H_ +#define TENSORFLOW_CC_SAVED_MODEL_LOADER_UTIL_H_ + +#include + +#include "tensorflow/core/lib/core/status.h" +#include "tensorflow/core/protobuf/meta_graph.pb.h" + +namespace tensorflow { +namespace internal { + +// A SavedModel may store the name of the initialization op to run in the +// in the SignatureDef (v2) or a collection (v1). If an init_op collection +// exists, then the collection must contain exactly one op. +Status GetInitOp(const string& export_dir, const MetaGraphDef& meta_graph_def, + string* init_op_name); + +Status GetAssetFileDefs(const MetaGraphDef& meta_graph_def, + std::vector* asset_file_defs); + +} // namespace internal +} // namespace tensorflow + +#endif // TENSORFLOW_CC_SAVED_MODEL_LOADER_UTIL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/saved_model/metrics.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/saved_model/metrics.h new file mode 100644 index 0000000000000000000000000000000000000000..21461206f76956c2ae31630281631728e9abb7b3 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/saved_model/metrics.h @@ -0,0 +1,133 @@ +/* Copyright 2021 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ +// APIs for accessing SavedModel and checkpoint metric objects. +// +// In order to collect the data from these metrics, please add the metrics to +// the provided monitoring platform. Unless configured with a user-specified +// monitoring platform, the data is not collected in OSS. + +#ifndef TENSORFLOW_CC_SAVED_MODEL_METRICS_H_ +#define TENSORFLOW_CC_SAVED_MODEL_METRICS_H_ + +#include +#include +#include + +#include "absl/status/statusor.h" +#include "absl/strings/string_view.h" +#include "tensorflow/core/lib/monitoring/counter.h" +#include "tensorflow/core/lib/monitoring/gauge.h" +#include "tensorflow/core/lib/monitoring/sampler.h" +#include "tensorflow/core/protobuf/fingerprint.pb.h" + +namespace tensorflow { +namespace metrics { + +const char kFingerprintFound[] = "FOUND"; +const char kFingerprintNotFound[] = "NOT_FOUND"; +const char kFingerprintError[] = "ERROR"; + +// Returns "/tensorflow/core/saved_model/write/count" cell. This metric +// has 1 field "write_version", which is equal to the +// `tensorflow::libexport::GetWriteVersion` of the protobuf and should be +// incremented when a SavedModel has been successfully written. +monitoring::CounterCell& SavedModelWriteCount(absl::string_view write_version); + +// Returns "/tensorflow/core/saved_model/read/count" cell. This metric +// has 1 field "write_version", which is equal to the +// `tensorflow::libexport::GetWriteVersion` of the protobuf, and should be +// incremented when a SavedModel has been successfully read. +monitoring::CounterCell& SavedModelReadCount(absl::string_view write_version); + +// Returns "/tensorflow/core/saved_model/write/api" cell. This metric has 1 +// field "api_label" which corresponds to a SavedModel write API. The cell for +// `foo` should be incremented when the write API `foo` is called. +monitoring::CounterCell& SavedModelWriteApi(absl::string_view api_label); + +// Returns "/tensorflow/core/saved_model/read/api" cell. This metric has 1 +// field "api_label" which corresponds to a SavedModel read API. The cell for +// `foo` should be incremented when the read API `foo` is called. +monitoring::CounterCell& SavedModelReadApi(absl::string_view api_label); + +// Returns "/tensorflow/core/saved_model/write/fingerprint" cell, which contains +// the saved_model_checksum of the SM's fingerprint when it is exported. +monitoring::GaugeCell& SavedModelWriteFingerprint(); + +// Returns "/tensorflow/core/saved_model/write/path" cell, which contains +// the saved_model_path of the SM when it is exported. +monitoring::GaugeCell& SavedModelWritePath(); + +// Returns "/tensorflow/core/saved_model/write/path_and_fingerprint" cell, which +// contains the path (saved_model_path) and fingerprint (concatenation of +// graph_def_program_hash, signature_def_hash, saved_object_graph_hash, +// and checkpoint_hash) of the SavedModel when it is exported. +monitoring::GaugeCell& SavedModelWritePathAndSingleprint(); + +// Returns "/tensorflow/core/saved_model/read/fingerprint" cell, wich contains +// the saved_model_checksum of the SM's fingerprint when it is imported. +monitoring::GaugeCell& SavedModelReadFingerprint(); + +// Returns "/tensorflow/core/saved_model/read/path" cell, wich contains +// the saved_model_path of the SM when it is imported. +monitoring::GaugeCell& SavedModelReadPath(); + +// Returns "/tensorflow/core/saved_model/read/path_and_fingerprint" cell, which +// contains the path (saved_model_path) and singleprint (concatenation of +// graph_def_program_hash, signature_def_hash, saved_object_graph_hash, +// and checkpoint_hash) of the SavedModel when it is imported. +monitoring::GaugeCell& SavedModelReadPathAndSingleprint(); + +// Returns the fingerprint as a Json string. +std::string MakeFingerprintJson(FingerprintDef fingerprint_def); + +// Returns canonical string concatenation of path and singleprint. +absl::StatusOr MakeSavedModelPathAndSingleprint( + std::string path, std::string singleprint); + +// Returns path and singleprint as a pair, parsed canonically from the string +// metric. +absl::StatusOr> +ParseSavedModelPathAndSingleprint(std::string path_and_singleprint); + +// Returns string status indicating whether or not the fingerprint.pb file was +// found when loading the SavedModel. +monitoring::GaugeCell& SavedModelFoundFingerprintOnLoad(); + +// Returns "/tensorflow/core/checkpoint/read/read_durations" cell belonging to +// field `api_label`. +monitoring::SamplerCell& CheckpointReadDuration(absl::string_view api_label); + +// Returns "/tensorflow/core/checkpoint/write/write_durations" cell belonging to +// field `api_label`. +monitoring::SamplerCell& CheckpointWriteDuration(absl::string_view api_label); + +// Returns "/tensorflow/core/checkpoint/write/async_write_durations" cell +// belonging to field `api_label`. +monitoring::SamplerCell& AsyncCheckpointWriteDuration( + absl::string_view api_label); + +// Returns "/tensorflow/core/checkpoint/write/training_time_saved" cell +// belonging to field `api_label`. +monitoring::CounterCell& TrainingTimeSaved(absl::string_view api_label); + +// Returns "/tensorflow/core/checkpoint/write/checkpoint_size" cell +// belonging to field (`api_label`, `filesize`). +monitoring::CounterCell& CheckpointSize(absl::string_view api_label, + int64_t filesize); + +} // namespace metrics +} // namespace tensorflow + +#endif // TENSORFLOW_CC_SAVED_MODEL_METRICS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/saved_model/reader.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/saved_model/reader.h new file mode 100644 index 0000000000000000000000000000000000000000..e82bd449c598ffea02e8fa04de8e32b01c2e9cd7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/saved_model/reader.h @@ -0,0 +1,49 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +/// Functions to read the SavedModel proto, or parts of it. + +#ifndef TENSORFLOW_CC_SAVED_MODEL_READER_H_ +#define TENSORFLOW_CC_SAVED_MODEL_READER_H_ + +#include +#include +#include + +#include "tensorflow/core/framework/graph_debug_info.pb.h" +#include "tensorflow/core/lib/core/status.h" +#include "tensorflow/core/protobuf/meta_graph.pb.h" +#include "tensorflow/core/protobuf/saved_model.pb.h" + +namespace tensorflow { +Status ReadSavedModel(absl::string_view export_dir, + SavedModel* saved_model_proto); + +// Reads the SavedModel proto from saved_model.pb(txt) in the given directory, +// finds the MetaGraphDef that matches the given set of tags and writes it to +// the `meta_graph_def` parameter. Returns a failure status when the SavedModel +// file does not exist or no MetaGraphDef matches the tags. +Status ReadMetaGraphDefFromSavedModel(const string& export_dir, + const std::unordered_set& tags, + MetaGraphDef* meta_graph_def); + +// Store debug info from the SavedModel export dir. +Status ReadSavedModelDebugInfoIfPresent( + const string& export_dir, + std::unique_ptr* debug_info_proto); + +} // namespace tensorflow + +#endif // TENSORFLOW_CC_SAVED_MODEL_READER_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/saved_model/util.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/saved_model/util.h new file mode 100644 index 0000000000000000000000000000000000000000..aacf6c2bcb5c9ee1ec2cfa165c74b92de34fc917 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/saved_model/util.h @@ -0,0 +1,56 @@ +/* Copyright 2021 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ +#ifndef TENSORFLOW_CC_SAVED_MODEL_UTIL_H_ +#define TENSORFLOW_CC_SAVED_MODEL_UTIL_H_ + +#include +#include +#include +#include + +#include "tensorflow/core/framework/tensor.h" +#include "tensorflow/core/framework/tensor.pb.h" +#include "tensorflow/core/platform/status.h" +#include "tensorflow/core/protobuf/meta_graph.pb.h" +#include "tensorflow/core/protobuf/saved_model.pb.h" + +namespace tensorflow { +namespace saved_model { + +// Utility functions for SavedModel reading and writing. + +// Returns "WriteVersion" ("1" or "2") of the SavedModel protobuf. If the +// protobuf has exactly one MetaGraphDef, which contains a SavedObjectGraph, it +// is version 2. Else, the protobuf is version 1. +// +// NOTE: The "WriteVersion" does *not* equal the major version of TF. +std::string GetWriteVersion(const SavedModel& saved_model); + +// Get view of string keys of a map. +std::set GetMapKeys( + const ::google::protobuf::Map& map); + +// Get the default input value from signature if it's missing in the request +// inputs. If `is_alias` is set to true, the keys of the `request_inputs` are +// alias names rather than the feed names in the graph. +Status GetInputValues( + const SignatureDef& signature, + const ::google::protobuf::Map& request_inputs, + std::vector>& inputs); + +} // namespace saved_model +} // namespace tensorflow + +#endif // TENSORFLOW_CC_SAVED_MODEL_UTIL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/tools/freeze_saved_model.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/tools/freeze_saved_model.h new file mode 100644 index 0000000000000000000000000000000000000000..b10f29805a4515f9d49426cc41e0d375cd32b072 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/tools/freeze_saved_model.h @@ -0,0 +1,43 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ +#ifndef TENSORFLOW_CC_TOOLS_FREEZE_SAVED_MODEL_H_ +#define TENSORFLOW_CC_TOOLS_FREEZE_SAVED_MODEL_H_ + +#include + +#include "tensorflow/cc/saved_model/loader.h" +#include "tensorflow/core/framework/graph.pb.h" +#include "tensorflow/core/lib/core/status.h" + +namespace tensorflow { + +// Returns a frozen GraphDef, input tensors, and output tensors from the loaded +// SavedModelBundle. +// `inputs` and `outputs` consist of the union of all inputs and outputs in the +// SignatureDefs in the SavedModelBundle. +// FreezeSavedModel sets `frozen_graph_def` to a GraphDef of all nodes needed by +// `outputs`. All variables in the supplied SavedModelBundle are converted to +// constants, set to the value of the variables, by running the restored Session +// in the SavedModelBundle. +// WARNING: Only the variable checkpoints will be reflected in the frozen +// graph_def. All saved_model assets will be ignored. +Status FreezeSavedModel(const SavedModelBundle& saved_model_bundle, + GraphDef* frozen_graph_def, + std::unordered_set* inputs, + std::unordered_set* outputs); + +} // namespace tensorflow + +#endif // TENSORFLOW_CC_TOOLS_FREEZE_SAVED_MODEL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/training/coordinator.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/training/coordinator.h new file mode 100644 index 0000000000000000000000000000000000000000..016b27101b9fd12b4412ac695bb5d90f666ff02b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/training/coordinator.h @@ -0,0 +1,132 @@ +/* Copyright 2016 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_CC_TRAINING_COORDINATOR_H_ +#define TENSORFLOW_CC_TRAINING_COORDINATOR_H_ + +#include +#include +#include +#include + +#include "tensorflow/core/framework/cost_graph.pb.h" +#include "tensorflow/core/lib/core/status.h" +#include "tensorflow/core/platform/macros.h" +#include "tensorflow/core/platform/mutex.h" +#include "tensorflow/core/protobuf/config.pb.h" +#include "tensorflow/core/protobuf/error_codes.pb.h" + +namespace tensorflow { + +/// The abstract interface for runners which must implement the Join and the +/// IsRunning function. +class RunnerInterface { + public: + virtual ~RunnerInterface() {} + virtual Status Join() = 0; + virtual Status ExportCostGraph(CostGraphDef* cost_graph) const { + return Status(absl::StatusCode::kInvalidArgument, + "No cost model to export."); + } + /// Returns true iff the runner is running, i.e. if it is trying to populate + /// its queue. + virtual bool IsRunning() const = 0; +}; + +/// Coordinator class manages the termination of a collection of QueueRunners. +/// Without a coordinator, QueueRunners have to be joined in a specific order; +/// otherwise the QueueRunner::Join() could sometimes hang. The +/// Coordinator::RequestStop() plays the key role which notifies all running +/// threads under a coordinator to stop. This function could be called by any +/// thread or any client. +/// Usage, in the client: +/// Coordinator coord; +/// std::unique_ptr qr(&coord, ...); +/// qr.Start(session); +/// coord.RegisterRunner(std::move(qr)); +/// /// do some work +/// TF_CHECK_OK(coord.Join()); +/// In each thread of QueueRunner, the coordinator needs to be used as: +/// void Run() { +/// while (!coord->ShouldStop()) { +/// /// do some work +/// if (error) { +/// coord->RequestStop(); +/// coord->ReportStatus(error_status); +/// } +/// } +/// } +class Coordinator { + public: + Coordinator(); + + /// Constructor with a list of error codes which would not be taken as errors + /// in status reporting. + Coordinator(const std::vector& clean_stop_errors); + + /// In the destructor, RequestStop() and Join() would be called. + ~Coordinator(); + + /// Registers a runner, i.e. a unit of running threads which is usually a + /// QueueRunner. It takes the ownership of runner to avoid lifecycle-related + /// problems. Note, the coordinator would not start these threads; they are + /// supposed to be in running state when they are registered here. + Status RegisterRunner(std::unique_ptr runner); + + /// Returns true iff all the registered runners have been stopped. + bool AllRunnersStopped(); + + /// Requests all running threads to stop. + Status RequestStop(); + + /// Returns true if its RequestStop() has been called. + bool ShouldStop(); + + /// Joins all threads, returns OK or the first reported and unexpected status. + Status Join(); + + /// Reports status to the coordinator. This is usually called by threads. + void ReportStatus(const Status& status); + + /// Returns the latest status. + Status GetStatus(); + + /// Returns immediately if the coordinator is stopped or blocks until + /// RequestStop() is called. + void WaitForStop(); + + // Returns the cost graph from stored run metadata in registered runners. + Status ExportCostGraph(CostGraphDef* cost_graph) const; + + private: + std::unordered_set clean_stop_errors_; + condition_variable wait_for_stop_; + + mutex mu_; + bool should_stop_ TF_GUARDED_BY(mu_); + + mutex status_lock_; + Status status_ TF_GUARDED_BY(status_lock_); + + mutable mutex runners_lock_; + std::vector> runners_ + TF_GUARDED_BY(runners_lock_); + + TF_DISALLOW_COPY_AND_ASSIGN(Coordinator); +}; + +} // namespace tensorflow + +#endif // TENSORFLOW_CC_TRAINING_COORDINATOR_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/training/queue_runner.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/training/queue_runner.h new file mode 100644 index 0000000000000000000000000000000000000000..65cf27f4316416601d6eb837b85a39d74631b62e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/cc/training/queue_runner.h @@ -0,0 +1,140 @@ +/* Copyright 2016 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_CC_TRAINING_QUEUE_RUNNER_H_ +#define TENSORFLOW_CC_TRAINING_QUEUE_RUNNER_H_ + +#include +#include +#include +#include + +#include "tensorflow/cc/training/coordinator.h" +#include "tensorflow/core/lib/core/status.h" +#include "tensorflow/core/lib/core/threadpool.h" +#include "tensorflow/core/platform/blocking_counter.h" +#include "tensorflow/core/platform/mutex.h" +#include "tensorflow/core/protobuf/config.pb.h" +#include "tensorflow/core/protobuf/error_codes.pb.h" +#include "tensorflow/core/protobuf/queue_runner.pb.h" +#include "tensorflow/core/public/session.h" + +namespace tensorflow { + +/// QueueRunner class imitates the behavior of the python version of QueueRunner +/// which creates a thread for each enqueue op, runs close op on completion. +class QueueRunner : public RunnerInterface { + public: + /// Creates a new QueueRunner from proto. + // TODO(yuefengz): we may want to initialize from queues and ops in the + // future. + static Status New(const QueueRunnerDef& queue_runner_def, + std::unique_ptr* result); + + /// Creates a new QueueRunner with a coordinator, see coordinator.h for usage. + static Status New(const QueueRunnerDef& queue_runner_def, Coordinator* coord, + std::unique_ptr* result); + + /// Adds a callback that the queue runner will call when it detects an error. + void AddErrorCallback(const std::function& cb); + + /// Delete the previously registered callbacks. + void ClearErrorCallbacks(); + + /// The destructor would join all the threads. + ~QueueRunner(); + + /// Starts the queue runner with the given session. + Status Start(Session* sess); + + /// Starts the queue runner with the given session and sets the run arguments + /// for sess->Run. It also collects and stores the cost model. + Status StartAndCollectCostGraph(Session* sess, + const RunOptions& run_options = RunOptions()); + + /// Starts the queue runner with the given session, and wait for up to the + /// specified time (in milliseconds) for the queues to start to fill up. + Status Start(Session* sess, int wait_for_ms); + Status StartAndCollectCostGraph(Session* session, int wait_for_ms, + const RunOptions& run_options = RunOptions()); + + /// Requests to stop and runs the cancel op. It would be called in a separate + /// thread when coordinator is set. If there is no coordinator it should be + /// called before calling Join. + void Stop(Session* sess); + + /// Joins all the threads. Returns okay if all threads run successfully; + /// otherwise returns the first captured failure status. + Status Join() final; + + /// Returns the latest status. + Status GetStatus(); + + // Returns the stored cost model. + Status ExportCostGraph(CostGraphDef* cost_graph) const override; + + private: + QueueRunner() : coord_(nullptr), stopped_(false), cg_mu_(nullptr) {} + + // Initializes the instance with the QueueRunnerDef proto. + Status Init(const QueueRunnerDef& queue_runner_def); + + // The Run function for each thread. + void Run(Session* sess, const string& enqueue_op); + + // Updates the internal status; it only keeps OK or the first unexpected error + // status. + void UpdateStatus(const Status& status); + + bool IsQueueClosed(Status status) const { + return queue_closed_exception_types_.count( + static_cast(status.code())) > 0; + } + + bool IsRunning() const override { return !stopped_; } + + void SetRunArgumentsAndCostGraph(const RunOptions& run_options); + + Status RealRun(Session* sess, const string& op, bool update_costs); + + string queue_name_; + std::vector enqueue_op_names_; + string close_op_name_; + string cancel_op_name_; + // code::Code casted to int to avoid a hash function. + std::unordered_set queue_closed_exception_types_; + + std::unique_ptr thread_pool_; + mutex mu_; + int runs_ = 0; + Status status_ TF_GUARDED_BY(mu_); + Status enqueue_status_ TF_GUARDED_BY(mu_); + std::unique_ptr counter_; + + Coordinator* coord_; + + std::atomic stopped_; + + mutex cb_mu_; + std::vector> callbacks_; + + mutable std::unique_ptr cg_mu_; + std::unique_ptr cost_graph_ TF_GUARDED_BY(cg_mu_); + RunOptions run_options_; +}; + +} // namespace tensorflow + +#endif // TENSORFLOW_CC_TRAINING_QUEUE_RUNNER_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/build_xla_ops_pass.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/build_xla_ops_pass.h new file mode 100644 index 0000000000000000000000000000000000000000..1bc2e0b332290f1fff47fe5d0da5bf53a3fb228f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/build_xla_ops_pass.h @@ -0,0 +1,45 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_JIT_BUILD_XLA_OPS_PASS_H_ +#define TENSORFLOW_COMPILER_JIT_BUILD_XLA_OPS_PASS_H_ + +#include "absl/types/optional.h" +#include "tensorflow/core/common_runtime/optimization_registry.h" +#include "tensorflow/core/lib/core/status.h" + +namespace tensorflow { + +// Replaces TF function calls marked with `_XlaCompiledKernel` with _XlaCompile +// and _XlaRun nodes (which compile and launch, respectively, the corresponding +// HLO module). +class BuildXlaOpsPass : public GraphOptimizationPass { + public: + // If enable_lazy_compilation is not nullopt then *enable_lazy_compilation + // overrides --tf_xla_enable_lazy_compilation flag in deciding whether lazy + // compilation is enabled. + explicit BuildXlaOpsPass( + std::optional enable_lazy_compilation = std::nullopt) + : enable_lazy_compilation_(enable_lazy_compilation) {} + + Status Run(const GraphOptimizationPassOptions& options) override; + + private: + std::optional enable_lazy_compilation_; +}; + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_JIT_BUILD_XLA_OPS_PASS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/clone_constants_for_better_clustering.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/clone_constants_for_better_clustering.h new file mode 100644 index 0000000000000000000000000000000000000000..19e6c49ec445385233cfe4026cf0e44faac81190 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/clone_constants_for_better_clustering.h @@ -0,0 +1,62 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_JIT_CLONE_CONSTANTS_FOR_BETTER_CLUSTERING_H_ +#define TENSORFLOW_COMPILER_JIT_CLONE_CONSTANTS_FOR_BETTER_CLUSTERING_H_ + +#include "absl/container/flat_hash_set.h" +#include "tensorflow/core/common_runtime/optimization_registry.h" + +namespace tensorflow { +// Clones small host constants in the graph to make it easier to form larger +// clusters. +// +// This helps us in two ways: +// +// - It reduces dependencies between clusters. Let's say a constant C is used +// by nodes X and Y. If X and Y are put in different clusters (for whatever +// reason) Y's cluster now has to wait for all the operations in X's cluster +// to finish before it starts running. +// +// - It lets us create bigger clusters in multi-GPU benchmarks. Consider the +// following graph: +// +// digraph { +// Const -> GPU_1 +// Const -> GPU_0_Y +// GPU_0_X -> GPU_0_Y +// } +// +// We'd cluster Const and GPU_1 together (and place it on GPU_1), and this +// will block us from clustering GPU_0_X and GPU_0_Y together since that +// would increase the amount of work on GPU 0 waiting on work on GPU 1. +// However, cloning Const into two copies, one for GPU_0_Y and one for GPU_1 +// will let us create one cluster containing {Const/copy_0, GPU_1} and +// another containing {Const/copy_1, GPU_0_X, GPU_0_Y}. +// +// We only clone small host constants now to avoid increasing memory consumption +// too much. Moreover, in practice the constants we have to duplicate are +// things like the `perm` input to `Transpose` and the `size` input to `Slice` +// which tend to be small anyway. + +class CloneConstantsForBetterClusteringPass : public GraphOptimizationPass { + public: + CloneConstantsForBetterClusteringPass() = default; + + Status Run(const GraphOptimizationPassOptions& options) override; +}; +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_JIT_CLONE_CONSTANTS_FOR_BETTER_CLUSTERING_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/cluster_scoping_pass.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/cluster_scoping_pass.h new file mode 100644 index 0000000000000000000000000000000000000000..9651c3f878cfc64c827c3215337da0e003ab3866 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/cluster_scoping_pass.h @@ -0,0 +1,38 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_JIT_CLUSTER_SCOPING_PASS_H_ +#define TENSORFLOW_COMPILER_JIT_CLUSTER_SCOPING_PASS_H_ + +#include "tensorflow/core/common_runtime/optimization_registry.h" + +namespace tensorflow { + +// This pass adds scopes to nodes in the _XlaInternalScope attribute to guide +// the later clustering passes. A major reason to do this is to prevent the +// clustering from losing critical parallelism in the Tensorflow graph, which +// can incur great performance degradation. +// +// This pass must be run before MarkForCompilationPass, as it stores the +// scoping information that MarkForCompilationPass will need to respect for +// clustering decision. +class ClusterScopingPass : public GraphOptimizationPass { + public: + Status Run(const GraphOptimizationPassOptions& options) override; +}; + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_JIT_CLUSTER_SCOPING_PASS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/compilability_check_util.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/compilability_check_util.h new file mode 100644 index 0000000000000000000000000000000000000000..1a05b69d5756b4066e2d8b6d14427c2cbffde60e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/compilability_check_util.h @@ -0,0 +1,338 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_JIT_COMPILABILITY_CHECK_UTIL_H_ +#define TENSORFLOW_COMPILER_JIT_COMPILABILITY_CHECK_UTIL_H_ + +#include + +#include "absl/algorithm/container.h" +#include "absl/strings/string_view.h" +#include "absl/types/optional.h" +#include "tensorflow/compiler/jit/defs.h" +#include "tensorflow/compiler/jit/device_util.h" +#include "tensorflow/compiler/jit/flags.h" +#include "tensorflow/compiler/jit/resource_operation_safety_analysis.h" +#include "tensorflow/compiler/tf2xla/const_analysis.h" +#include "tensorflow/compiler/tf2xla/resource_operation_table.h" +#include "tensorflow/compiler/tf2xla/xla_op_registry.h" +#include "xla/service/graphcycles/graphcycles.h" +#include "xla/statusor.h" +#include "xla/union_find.h" +#include "xla/util.h" +#include "tensorflow/core/common_runtime/function.h" +#include "tensorflow/core/common_runtime/graph_constructor.h" +#include "tensorflow/core/framework/attr_value.pb.h" +#include "tensorflow/core/framework/bounds_check.h" +#include "tensorflow/core/framework/function.h" +#include "tensorflow/core/framework/graph_def_util.h" +#include "tensorflow/core/framework/memory_types.h" +#include "tensorflow/core/framework/node_def.pb.h" +#include "tensorflow/core/framework/op_kernel.h" +#include "tensorflow/core/framework/types.h" +#include "tensorflow/core/framework/types.pb.h" +#include "tensorflow/core/graph/algorithm.h" +#include "tensorflow/core/graph/control_flow.h" +#include "tensorflow/core/graph/graph.h" +#include "tensorflow/core/lib/gtl/cleanup.h" +#include "tensorflow/core/lib/strings/stringprintf.h" +#include "tensorflow/core/public/version.h" +#include "tensorflow/core/util/dump_graph.h" + +namespace tensorflow { +// Checks whether a TF node can be compiled or not. "Recursive" as in for call +// and functional while nodes it recursively checks whether the callee functions +// can be compiled. +class RecursiveCompilabilityChecker { + public: + // Contains node name and function name. If the node is not inside a function + // body, function name is an empty string. + struct StackFrame { + std::string name; + std::string function_name; + std::shared_ptr stack_trace; + }; + + // Contains information about uncompilable node inside a function body. + struct UncompilableNodeInfo { + std::string name; + // A list representing a stacktrace from the highest level node in + // increasing call depth to immediate node that fails the + // compilability checker. + std::vector stack_trace; + std::string uncompilable_reason; + }; + + // Aggregates information about what kinds of ops are allowed. + struct OperationFilter { // TODO(lzr): Add AllowEverything() helper. + // Whether resource variable ops are allowed are allowed in callees. We do + // not allow resource variable ops in called functions (either as direct TF + // calls or as higher order control flow ops) because we do not yet model + // their memory effects in jit/resource_operation_safety_analysis. + bool allow_resource_ops_in_called_functions = false; + + // Whether Stack operations are allowed. We avoid auto-clustering Stack + // operations in general because we do not support snapshotting them. + // + // TODO(b/112837194): This restriction can be lifted with some work. + bool allow_stack_ops = false; + + // Whether TensorArray operations are allowed. We avoid auto-clustering + // TensorArray operations in general because we do not support snapshotting + // them. + // + // TODO(b/112837194): This restriction can be lifted with some work. + bool allow_tensor_array_ops = false; + + // Whether stateful RNG ops are allowed. XLA's RNG does not have the same + // seeding behavior as TensorFlow's RNG (b/34749654). So we avoid + // auto-clustering stateful RNG ops. + bool allow_stateful_rng_ops = false; + + // TODO(b/118970344): Whether ControlTrigger ops are allowed. It is unsound + // to cluster ControlTrigger because of how we use deadness analysis. + bool allow_control_trigger = false; + + // Whether it is okay to "cluster" Assert and CheckNumerics by simply + // removing them (they're not removed during clustering, but their + // XlaOpKernel is a no-op kernel). We avoid auto-clustering these ops so + // that the user is not surprised when XLA is implicitly enabled. If the + // user explicitly specifies to use XLA, it is fine to resort to a dummy + // implementation. Currently Assert and CheckNumerics ops have dummy XLA + // implementations. + bool allow_eliding_assert_and_checknumerics_ops = false; + + // Whether ops that produce or consume DT_VARIANT values are allowed. We + // don't auto-cluster these ops because we don't yet support live-in or + // live-out DT_VARIANT values. + bool allow_ops_producing_or_consuming_variant = false; + + // Whether ops known to be slow on XLA-GPU should be considered compilable. + bool allow_slow_ops = false; + + // Whether ops known to have numerical accuracy issues should be considered + // compilable.. + bool allow_inaccurate_ops = false; + + // Require the function to be always compilable, regardless whether some + // control flow branches might be dead for a given input. + bool require_always_compilable = false; + + // Whether string constants are compilable. + bool allow_string_consts = true; + + // Whether to allow the compilation of CollectiveReduceV2Op. + bool allow_collective_reduce_v2 = true; + + // Whether to allow the compilation of WhereOp. + bool allow_where_op = true; + + // Whether to allow the compilation of UniqueOp. Compilation of the UniqueOp + // generates output with bounded dynamic shape that may cause failures with + // auto clustering. + // TODO(b/209813421): Enable tf.unique during + // autoclustering once all failures are rfixed. + bool allow_unique_op = true; + + // Whether ops that are marked as outside compiled are always considered + // compilable. + // TODO(b/191502757): Make this behavior true by default and remove this + // option once inference converter supports outside compilation. + bool allow_outside_compiled = false; + }; + + RecursiveCompilabilityChecker(OperationFilter op_filter, + DeviceType jit_device_type) + : op_filter_(std::move(op_filter)), + jit_device_type_(std::move(jit_device_type)) {} + + using UncompilableNodesMap = + std::map>>; + + // Returns a map where the key is the function identifier(short debug + // string) of the function encapsulating the uncompilable nodes, and the + // value is a pair of NameAttrList of the function and a vector of + // uncompilable node info. When uncompilable node is not inside any + // function call nodes, then key is a ShortDebugString() of an empty + // NameAttrList. + // + // Also, when `node` is inside a function body, users can set + // `node_stack_trace` to provide an additional context for `node`'s + // placement within the outer most graph. + UncompilableNodesMap FindUncompilableNodes( + const Node& node, FunctionLibraryRuntime* lib_runtime, + const std::vector* node_stack_trace = nullptr) const; + + // Returns true if `node` can be compiled by XLA. + bool IsCompilableNode(const Node& node, + FunctionLibraryRuntime* lib_runtime) const { + std::vector stack_trace; + stack_trace.emplace_back(StackFrameView{node.name(), ""}); + return IsCompilableNode(node, lib_runtime, &stack_trace); + } + + // Returns true if XLA supports this Op, but we don't want to cluster it (ie: + // due to performance or correctness concerns). + bool OpIsInaccurate(const Node& node) const; + bool OpIsSlow(const Node& node) const; + + private: + struct StackFrameView { + absl::string_view name; + absl::string_view function_name; + std::shared_ptr stack_trace; + }; + + bool IsCompilableNode( + const Node& node, FunctionLibraryRuntime* lib_runtime, + std::vector* stack_trace, + NameAttrList* encapsulating_function = nullptr, + UncompilableNodesMap* uncompilable_nodes = nullptr) const; + bool IsCompilableCall( + const NodeDef& call_def, FunctionLibraryRuntime* lib_runtime, + std::vector* stack_trace, + NameAttrList* encapsulating_function = nullptr, + UncompilableNodesMap* uncompilable_nodes = nullptr) const; + bool IsCompilableIf(const Node& if_node, FunctionLibraryRuntime* lib_runtime, + std::vector* stack_trace, + NameAttrList* encapsulating_function, + UncompilableNodesMap* uncompilable_nodes) const; + bool IsCompilableWhile(const Node& while_node, + FunctionLibraryRuntime* lib_runtime, + std::vector* stack_trace, + NameAttrList* encapsulating_function, + UncompilableNodesMap* uncompilable_nodes) const; + + // Tests whether 'case_node' is compilable. Every operator in all branches + // must be compilable. + bool IsCompilableCase(const Node& case_node, + FunctionLibraryRuntime* lib_runtime, + std::vector* stack_trace, + NameAttrList* encapsulating_function, + UncompilableNodesMap* uncompilable_nodes) const; + + // Returns compilability of node def retrieved from `node`'s attribute with + // name `attr_name`. + bool ExtractNodeDefAndCheckCompilability( + const Node& node, const std::string& attr_name, + const std::string& call_name, NameAttrList* encapsulating_function, + FunctionLibraryRuntime* lib_runtime, + std::vector* stack_trace, + UncompilableNodesMap* uncompilable_nodes) const; + + bool IsStackOp(const Node& node) const { + const XlaResourceOpInfo* op_info = + GetResourceOpInfoForOp(node.type_string()); + return op_info && op_info->resource_kind() == XlaResourceKind::kStack; + } + + bool IsTensorArrayOp(const Node& node) const { + const XlaResourceOpInfo* op_info = + GetResourceOpInfoForOp(node.type_string()); + return op_info && op_info->resource_kind() == XlaResourceKind::kTensorArray; + } + + bool IsAssertOrCheckNumerics(absl::string_view op_name) const { + return op_name == "Assert" || op_name == "CheckNumerics"; + } + + bool IsStatefulRandomOp(absl::string_view op_name) const { + return op_name == "RandomUniform" || op_name == "RandomShuffle" || + op_name == "RandomUniformInt" || op_name == "RandomStandardNormal" || + op_name == "TruncatedNormal" || op_name == "Multinomial"; + } + + bool OpProducesOrConsumesVariant(const Node& node) const { + auto is_variant = [](DataType dtype) { return dtype == DT_VARIANT; }; + return absl::c_any_of(node.input_types(), is_variant) || + absl::c_any_of(node.output_types(), is_variant); + } + + bool HasXLAKernel(const Node& node, + string* uncompilable_reason = nullptr) const; + + static void MaybeMarkUncompilableNode( + const absl::string_view reason, + const std::vector& stack_trace, + NameAttrList* encapsulating_function, + UncompilableNodesMap* uncompilable_nodes_map); + + // Make sure we don't recurse infinitely on recursive functions. + const size_t kMaxRecursionDepth = 50; + + const OperationFilter op_filter_; + const DeviceType jit_device_type_; +}; + +RecursiveCompilabilityChecker::OperationFilter CreateOperationFilter( + const XlaOpRegistry::DeviceRegistration& registration); + +// Given a FunctionLibraryRuntime and a `function`, returns this function's body +// in `fbody` as well as the indices of its constant and resource arguments. +// `fbody` is owned by `flr`. +// `constant_arg_indices` and `resource_arg_indices` should be empty vector. +// They are sorted in ascending order on this function's return. +Status GetBodyAndConstantsAndResources(FunctionLibraryRuntime* flr, + const NameAttrList& function, + const FunctionBody** fbody, + std::vector* constant_arg_indices, + std::vector* resource_arg_indices); + +// Given a NodeDef `node_def` returns true iff `node_def` has kXlaCompileAttr +// set. +bool CanCreateXlaKernel(const NodeDef& node_def); + +// Returns memory types for the input. +// `constant_arg_indices` and `resource_arg_indices` are sorted arrays of +// indices corresponding to constant and resource arguments respectively. +// +// One might wonder, about the case where a compile-time constant argument +// (which must be in host memory) is also used as an input into an op, +// e.g. `Add`, that expects its inputs in device memory. Here is how it +// works now. +// First, what do we mean by "op expects an input in XYZ memory"? +// There are two types of "ops" here: the tf2xla kernel and the HLO +// computation it builds. The tf2xla kernel needs to retrieve the actual +// numeric value of the compile-time constant tensors, so it really expects +// them to be on in host memory. However, for other inputs, it refers to them +// using xla::ComputationDataHandle, which is just a symbolic handle that +// xla::ComputationBuilder assigns. How does this handle gets assigned for +// constant arguments? Even constant arguments get an _Arg node in the graph +// instantiated for Function compilation. The tf2xla kernel for constant _Arg +// nodes takes the constant value, converts it to XlaLiteral, and feeds it +// to xla::ComputationBuilder.ConstantLiteral, which returns the handle. This +// constant XlaLiteral is included in the HLO graph, and subsequently, in +// the actual executable, which is copied to the device before being +// executed. Thus, when this executable runs, the constant is available in +// device memory. +tensorflow::MemoryTypeVector GetInputMemoryTypes( + const tensorflow::FunctionBody* fbody, + absl::Span constant_arg_indices, + absl::Span resource_arg_indices); + +// Returns output memory types. +// +// XlaLaunch kernel keeps all outputs (including constants, which it copies), +// in device memory except for resources. +tensorflow::MemoryTypeVector GetOutputMemoryTypes( + const tensorflow::FunctionBody* fbody); + +// Check whether graph can trigger XLA compilation. +bool CanTriggerXlaCompilation(const GraphDef& graph); + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_JIT_COMPILABILITY_CHECK_UTIL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/deadness_analysis.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/deadness_analysis.h new file mode 100644 index 0000000000000000000000000000000000000000..72b446f165a6e9fc15ea8c61e2ebeaec92c62db0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/deadness_analysis.h @@ -0,0 +1,99 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_JIT_DEADNESS_ANALYSIS_H_ +#define TENSORFLOW_COMPILER_JIT_DEADNESS_ANALYSIS_H_ + +#include "tensorflow/core/graph/graph.h" + +namespace tensorflow { + +// This analyzes a TensorFlow graph to identify nodes which may have partially +// dead inputs (i.e. these nodes may have some dead inputs and some alive +// inputs). +// +// For example, the ADD node in the following graph +// +// V0 PRED0 V1 PRED1 +// | | | | +// v v v v +// SWITCH SWITCH +// | | +// +---+ + ---+ +// | | +// v v +// ADD +// +// can have its inputs independently dead or alive based on the runtime values +// of PRED0 and PRED1. +// +// It is tempting to call this a liveness analysis but I avoided that because +// "liveness" already has other connotations. +class DeadnessAnalysis { + public: + // An opaque representation of a predicate. DeadnessPredicate + // instances that compare equal via operator== represent predicates + // that always evaluate to the same value. + struct DeadnessPredicate { + public: + DeadnessPredicate(const DeadnessPredicate&) = default; + DeadnessPredicate(DeadnessPredicate&&) = default; + + DeadnessPredicate& operator=(const DeadnessPredicate&) = default; + DeadnessPredicate& operator=(DeadnessPredicate&&) = default; + + bool operator==(const DeadnessPredicate& other) const { + return other.pred_ == pred_; + } + + bool operator!=(const DeadnessPredicate& other) const { + return other.pred_ != pred_; + } + + private: + explicit DeadnessPredicate(void* pred) : pred_(pred) {} + + // This is really a Predicate*, but we don't want to expose that + // implementation detail to our clients. `pred_` has pointer equality so we + // can just compare the pointer in operator== and operator!=. + void* pred_; + + friend class DeadnessAnalysis; + }; + + virtual tsl::StatusOr GetPredicateFor(Node* n, + int oidx) const = 0; + + // Prints out the internal state of this instance. For debugging purposes + // only. + virtual void Print() const = 0; + virtual ~DeadnessAnalysis(); + + string DebugString(DeadnessPredicate predicate) const; + + // Run the deadness analysis over `graph` and returns an error or a populated + // instance of DeadnessAnalysis in `result`. + static Status Run(const Graph& graph, + std::unique_ptr* result); + + protected: + static DeadnessPredicate MakeDeadnessPredicate(void* pred) { + return DeadnessPredicate(pred); + } +}; + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_JIT_DEADNESS_ANALYSIS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/deadness_analysis_internal.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/deadness_analysis_internal.h new file mode 100644 index 0000000000000000000000000000000000000000..b2f0e72bc14ae6b42d4a4a07216011cf9c14ff3f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/deadness_analysis_internal.h @@ -0,0 +1,34 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_JIT_DEADNESS_ANALYSIS_INTERNAL_H_ +#define TENSORFLOW_COMPILER_JIT_DEADNESS_ANALYSIS_INTERNAL_H_ + +#include "absl/container/flat_hash_map.h" +#include "tensorflow/core/graph/tensor_id.h" + +namespace tensorflow { +namespace deadness_analysis_internal { + +// Returns a map describing the predicate each Tensor was mapped to. For +// testing purposes only. +using PredicateMapTy = absl::flat_hash_map; +Status ComputePredicates(const Graph& graph, PredicateMapTy* out_predicate_map, + bool enable_optimistic = true); + +} // namespace deadness_analysis_internal +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_JIT_DEADNESS_ANALYSIS_INTERNAL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/defs.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/defs.h new file mode 100644 index 0000000000000000000000000000000000000000..58bd4bdd10748d688cd7fbbfb80abaad9c7eb7e6 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/defs.h @@ -0,0 +1,49 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +// Provides definitions needed for use of the TensorFlow XLA +// device. + +#ifndef TENSORFLOW_COMPILER_JIT_DEFS_H_ +#define TENSORFLOW_COMPILER_JIT_DEFS_H_ + +namespace tensorflow { + +// Name of attribute used to tag operators for compilation with XLA + +// Implies must-compile semantics: either it will be compiled +// with XLA, or an error will be thrown. +extern const char* const kXlaMustCompileAttr; // "_XlaMustCompile" + +// Implies auto-clustering: tagged nodes will be clustered and compiled with XLA +// on a best-effort basis. +extern const char* const kXlaCompileAttr; // "_XlaCompile" + +// Implies auto-clustering within the given scope. +extern const char* const kXlaScopeAttr; // "_XlaScope" +extern const char* const kXlaInternalScopeAttr; // "_XlaInternalScope" + +// The id of the compiled cluster. +extern const char* const kXlaClusterIdAttr; // "_xla_compile_id" + +[[deprecated("XLA:CPU/GPU devices are deprecated")]] void +RequestXlaDevicesCreation(); + +[[deprecated("XLA:CPU/GPU devices are deprecated")]] bool +XlaDevicesCreationRequired(); + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_JIT_DEFS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/device_compilation_cache.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/device_compilation_cache.h new file mode 100644 index 0000000000000000000000000000000000000000..06ec9572580958602d4d57f1d3c7ebee399df0b4 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/device_compilation_cache.h @@ -0,0 +1,257 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_JIT_DEVICE_COMPILATION_CACHE_H_ +#define TENSORFLOW_COMPILER_JIT_DEVICE_COMPILATION_CACHE_H_ + +#include +#include +#include +#include +#include +#include + +#include "absl/strings/str_cat.h" +#include "tensorflow/compiler/jit/device_compilation_cluster_signature.h" +#include "tensorflow/compiler/jit/xla_compile_util.h" +#include "tensorflow/compiler/tf2xla/xla_compiler.h" +#include "xla/client/local_client.h" +#include "xla/pjrt/pjrt_client.h" +#include "tensorflow/core/platform/mutex.h" + +namespace tensorflow { +namespace device_compilation_cache_internal { +template +int64_t ExecutableSize(const ExecutableType* executable) { + return 0; +} + +template <> +inline int64_t ExecutableSize( + const xla::LocalExecutable* executable) { + if (executable != nullptr && executable->executable() != nullptr) { + return executable->executable()->SizeOfGeneratedCodeInBytes(); + } + + return 0; +} + +template <> +inline int64_t ExecutableSize( + const xla::PjRtLoadedExecutable* executable) { + if (executable != nullptr) { + return executable->SizeOfGeneratedCodeInBytes(); + } + + return 0; +} +} // namespace device_compilation_cache_internal + +// Cache to store compiled HLO, executables and related metadata keyed by +// `DeviceCompilationClusterSignature`. The cache owns the stored +// CompilationResults and Executables. +// Currently no cache eviction policy is implemented and the cache grows without +// bound. +template +class DeviceCompilationCache { + public: + DeviceCompilationCache() = default; + ~DeviceCompilationCache() = default; + + using Key = DeviceCompilationClusterSignature; + struct Value { + DeviceCompileState compile_state = DeviceCompileState::kUncompiled; + Status compilation_status; + int64_t request_count = 0; + const XlaCompiler::CompilationResult* compilation_result = nullptr; + ExecutableType* executable = nullptr; + }; + + // Returns std::nullopt if value for the supplied key is not found. If a value + // is found, `request_count` is incremented before returning the value. + std::optional Lookup(const Key& key) const; + + // Inserts an empty value if value is not found and returns it. If a value is + // found, `request_count` is incremented before returning the value. + Value LookupOrCreate(const Key& key); + + // Caches `compile_state`, `compilation_status`, `compilation_result` and + // `executable` and associates them with the provided `key`. Takes ownership + // of `compilation_result` and `executable`. Does not increment the + // corresponding `request_count`. Only arguments that are not std::nullopt are + // updated in the cache. + void Store(const Key& key, std::optional compile_state, + std::optional compilation_status, + std::optional> + compilation_result, + std::optional> executable); + + std::string DebugString() const; + + private: + // The value associated with a cache entry. + struct Entry { + mutable mutex mu; + + // The current compilation state for this entry. + DeviceCompileState compile_state TF_GUARDED_BY(mu) = + DeviceCompileState::kUncompiled; + + // The number of times a compilation with this signature has been requested. + int64_t request_count TF_GUARDED_BY(mu) = 0; + + // Did compilation succeed? + Status compilation_status TF_GUARDED_BY(mu); + + // Output of the XlaCompiler. + std::unique_ptr compilation_result + TF_GUARDED_BY(mu); + + // The XLA executable compiled from . May be null if no + // executable has been built. + std::unique_ptr executable TF_GUARDED_BY(mu); + + std::string DebugString() const { + mutex_lock lock(mu); + + int64_t executable_size = + device_compilation_cache_internal::ExecutableSize( + executable.get()); + + int64_t hlo_module_size = 0; + if (compilation_result != nullptr && + compilation_result->computation != nullptr) { + hlo_module_size = + compilation_result->computation->proto().ByteSizeLong(); + } + + return absl::StrCat( + "{compile_state: ", compile_state, ", request_count: ", request_count, + ", compilation_status: ", compilation_status.ToString(), + ", compilation_result?: ", compilation_result != nullptr, + ", hlo_module_size: ", hlo_module_size, " bytes", + ", executable?: ", executable != nullptr, + ", executable_size: ", executable_size, " bytes}"); + } + }; + + mutable mutex compile_cache_mu_; + absl::flat_hash_map, Key::Hash> cache_ + TF_GUARDED_BY(compile_cache_mu_); + + TF_DISALLOW_COPY_AND_ASSIGN(DeviceCompilationCache); +}; + +template +std::optional::Value> +DeviceCompilationCache::Lookup(const Key& key) const { + // The outer lock protects the existence of the cache entry. It does not + // protect the contents of the cache entry. + Entry* entry; + { + mutex_lock lock(compile_cache_mu_); + // Find cache entry. + auto it = cache_.find(key); + if (it == cache_.cend()) { + return std::nullopt; + } + + entry = it->second.get(); + } + + mutex_lock lock(entry->mu); + Value value = {/*compile_state=*/entry->compile_state, + /*compilation_status=*/entry->compilation_status, + /*request_count=*/++entry->request_count, + /*compilation_result=*/entry->compilation_result.get(), + /*executable=*/entry->executable.get()}; + return value; +} + +template +typename DeviceCompilationCache::Value +DeviceCompilationCache::LookupOrCreate(const Key& key) { + // The outer lock protects the existence of the cache entry. It does not + // protect the contents of the cache entry. + Entry* entry; + { + mutex_lock lock(compile_cache_mu_); + // Emplace empty cache entry if not found. + auto it = cache_.emplace(key, std::make_unique()).first; + entry = it->second.get(); + } + + mutex_lock lock(entry->mu); + Value value = {/*compile_state=*/entry->compile_state, + /*compilation_status=*/entry->compilation_status, + /*request_count=*/++entry->request_count, + /*compilation_result=*/entry->compilation_result.get(), + /*executable=*/entry->executable.get()}; + return value; +} + +template +void DeviceCompilationCache::Store( + const Key& key, std::optional compile_state, + std::optional compilation_status, + std::optional> + compilation_result, + std::optional> executable) { + Entry* entry; + { + mutex_lock lock(compile_cache_mu_); + // Emplace empty cache entry if not found. + auto it = cache_.emplace(key, std::make_unique()).first; + entry = it->second.get(); + } + + { + mutex_lock lock(entry->mu); + if (compile_state.has_value()) { + entry->compile_state = *compile_state; + } + if (compilation_status.has_value()) { + entry->compilation_status = *compilation_status; + } + if (compilation_result.has_value()) { + entry->compilation_result = std::move(*compilation_result); + } + if (executable.has_value()) { + entry->executable = std::move(*executable); + } + } + + VLOG(4) << "Added/updated cache entry: key=" << key.HumanString() + << ", entry=" << entry->DebugString(); +} + +template +std::string DeviceCompilationCache::DebugString() const { + std::string s = "DeviceCompilationCache {\n"; + { + mutex_lock lock(compile_cache_mu_); + for (const auto& [key, entry] : cache_) { + absl::StrAppend(&s, key.HumanString(), " : ", entry->DebugString(), + ",\n"); + } + } + absl::StrAppend(&s, "}"); + + return s; +} + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_JIT_DEVICE_COMPILATION_CACHE_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/device_compilation_cluster_signature.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/device_compilation_cluster_signature.h new file mode 100644 index 0000000000000000000000000000000000000000..76a8daa0d95ab420a7c1ad0a955c7b2ec63e6d77 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/device_compilation_cluster_signature.h @@ -0,0 +1,56 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_JIT_DEVICE_COMPILATION_CLUSTER_SIGNATURE_H_ +#define TENSORFLOW_COMPILER_JIT_DEVICE_COMPILATION_CLUSTER_SIGNATURE_H_ + +#include +#include + +#include "tensorflow/compiler/tf2xla/xla_compiler.h" + +namespace tensorflow { + +// Describes the types, shapes and any compile-time constant arguments +// to a kernel. Key that uniquely identifies a compilation output. +struct DeviceCompilationClusterSignature { + // Name of the cluster, built from the function name and it's attributes. + string name; + + // List of args (either as a TensorTypeAndShape or as a Tensor value) + // for compile-time constant arguments to the compilation, ordered by + // argument number. Tensors must be in host memory. + using TensorTypeAndShape = + std::pair>; + absl::InlinedVector, 8> args; + + bool operator==(const DeviceCompilationClusterSignature& other) const; + + struct Hash { + uint64 operator()(const DeviceCompilationClusterSignature& signature) const; + }; + + // Returns a human-readable description of the signature. + string HumanString() const; + + // Builds the signature for a compilation. + static StatusOr Build( + const NameAttrList& function, + absl::Span args); +}; + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_JIT_DEVICE_COMPILATION_CLUSTER_SIGNATURE_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/device_compilation_profiler.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/device_compilation_profiler.h new file mode 100644 index 0000000000000000000000000000000000000000..6bb856f2507acd77a097e6276bf03c43590b40b3 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/device_compilation_profiler.h @@ -0,0 +1,100 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_JIT_DEVICE_COMPILATION_PROFILER_H_ +#define TENSORFLOW_COMPILER_JIT_DEVICE_COMPILATION_PROFILER_H_ + +#include +#include + +#include "tensorflow/compiler/jit/xla_compile_util.h" +#include "tensorflow/core/framework/attr_value.pb.h" + +namespace tensorflow { + +// Tracks statistics for device compilation and uses these to determine whether +// the given cluster should be compiled or not. +class DeviceCompilationProfiler : public ResourceBase { + public: + DeviceCompilationProfiler() = default; + ~DeviceCompilationProfiler() override; + + struct ClusterCompileStats { + // Number of times the cluster has been (re-)compiled. + int64_t compile_count = 0; + + // The number of times this cluster has been executed. + int64_t execution_count = 0; + + // Cumulative time spent compiling the cluster. + int64_t cumulative_compile_time_us = 0; + + // True if we have decided that this cluster is too dynamic (i.e. its shapes + // change too frequently) to profitably JIT compile. Once a cluster is + // tagged megamorphic, it stays megamorphic forever. + bool is_megamorphic = false; + + std::string DebugString() const { + return absl::StrCat( + "DeviceCompilationProfiler::ClusterCompileStats {compile_count=", + compile_count, ", execution_count=", execution_count, + ", cumulative_compile_time_us=", cumulative_compile_time_us, + ", is_megamorphic=", is_megamorphic, "}"); + } + }; + + // Returns the compilation statistics for the given cluster. + StatusOr GetCompileStats( + const NameAttrList& function) const; + + // Determines whether the cluster should be compiled. Creates and inserts an + // entry into stats (also calls `RegisterExecution`) for `function` if it + // doesn't already exist. + virtual bool ShouldCompileCluster(const NameAttrList& function, + DeviceCompileMode compile_mode, + int64_t current_request_count); + + // Registers a cluster execution. Increments the execution count for the given + // cluster and also determines whether the cluster has gone megamorphic (and + // sets the megamorphic bit accordingly). + void RegisterExecution(const NameAttrList& function); + + // Registers a cluster compilation. Increments the compilation count and + // accumulates the compile time for the given cluster. Also broadcasts an + // XlaJitCompilationActivity. + virtual Status RegisterCompilation(const NameAttrList& function, + int64_t compile_time_us, + bool used_persistent_cache); + + void IncrementOngoingAsyncCompilations(); + void DecrementOngoingAsyncCompilations(); + int64_t GetNumOngoingAsyncCompilations() const; + std::string DebugString() const override; + + private: + mutable mutex mu_; + + // Maps cluster names to compilation statistics for said cluster. + absl::flat_hash_map cluster_compile_stats_ + TF_GUARDED_BY(mu_); + + int64_t num_ongoing_compilations_ TF_GUARDED_BY(mu_) = 0; + + TF_DISALLOW_COPY_AND_ASSIGN(DeviceCompilationProfiler); +}; + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_JIT_DEVICE_COMPILATION_PROFILER_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/device_compiler.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/device_compiler.h new file mode 100644 index 0000000000000000000000000000000000000000..611dc9b09edda7e939711326eeadf74d1387538c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/device_compiler.h @@ -0,0 +1,500 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_JIT_DEVICE_COMPILER_H_ +#define TENSORFLOW_COMPILER_JIT_DEVICE_COMPILER_H_ + +#include +#include +#include +#include +#include +#include +#include + +#include "absl/base/call_once.h" +#include "absl/container/flat_hash_map.h" +#include "absl/types/optional.h" +#include "absl/types/span.h" +#include "tensorflow/compiler/jit/device_compilation_cache.h" +#include "tensorflow/compiler/jit/device_compilation_cluster_signature.h" +#include "tensorflow/compiler/jit/device_compilation_profiler.h" +#include "tensorflow/compiler/jit/device_compiler_client.h" +#include "tensorflow/compiler/jit/device_executable_persistor.h" +#include "tensorflow/compiler/jit/flags.h" +#include "tensorflow/compiler/jit/tf_graph_to_hlo_compiler.h" +#include "tensorflow/compiler/jit/xla_compile_util.h" +#include "tensorflow/compiler/tf2xla/xla_compiler.h" +#include "xla/client/local_client.h" +#include "tensorflow/core/framework/op_kernel.h" +#include "tensorflow/core/lib/core/threadpool.h" +#include "tensorflow/core/platform/mutex.h" +#include "tensorflow/core/platform/thread_annotations.h" + +namespace tensorflow { + +// Compiles/lowers a given Tensorflow graph/function/cluster into a compiled XLA +// compilation (HLO) using the XlaCompiler and compiles the resulting +// XlaCompilationResult into an `ExecutableType` (eg. xla::LocalExecutable) by +// calling `ClientType` (eg. xla::LocalClient). +// +// Caches the compiled XlaCompilationResult and Executable using a +// DeviceCompilationCache. Compilation is done only when there's a cache miss. +// +// Uses the DeviceExecutablePersistor class for persistence and tries to load a +// serialized executable from disk upon a request for compilation. If the +// appropriate executable isn't found on disk, compiles the given Tensorflow +// function/graph/cluster into an XlaCompilationResult (HLO) and +// `ExecutableType` and tries saving/persisting the compiled HLO and executable +// to disk. +// +// Since XLA computations must have static shapes, DeviceCompiler generates a +// new XLA computation for each new set of input shapes. +// TODO(b/255826209): De-templatize once we've moved to Device API completely. +template +class DeviceCompiler : public ResourceBase { + public: + DeviceCompiler( + std::unique_ptr> + persistor, + std::unique_ptr> + compiler_client); + ~DeviceCompiler() override; + + enum class CompileScope { + kOp, + kFunction, + }; + + // Compiles a function into a XlaCompiler::CompilationResult that can be used + // to execute an XLA Computation. Compilation results are cached. Compilation + // is skipped if there is a cache hit. `function` is the name of a Tensorflow + // function to compile. `args` is a description of the arguments to the + // computation. + // + // `compile_mode` controls the behavior of the compilation cache on a cache + // miss. If `compile_mode` is `kLazy` then, based on some profitability + // heuristics, the compilation cache may decide not to compile the cluster at + // this time. In this case it returns null into both `out_compilation_result` + // and `out_executable`. If `compile_mode` is `kStrict` then the compilation + // cache always attempts the compilation on a cache miss. If compilation mode + // is 'kAsync' compilation of the cluster happens in the background while the + // fallback path executes. + // + // The result of compilation is written to `*out_compilation_result`, which + // must be non-null. If `out_executable` is non-null, also builds an + // `ExecutableType` and sets `out_executable` to point to it. The + // resulting executable pointer may be null if the computation has no + // non-constant outputs. + Status CompileIfNeeded( + const XlaCompiler::Options& options, const NameAttrList& function, + const std::vector& args, + const XlaCompiler::CompileOptions& compile_options, + DeviceCompileMode compile_mode, DeviceCompilationProfiler* profiler, + const XlaCompiler::CompilationResult** out_compilation_result, + ExecutableType** out_executable); + + // As above, but for a single op. + Status CompileSingleOpIfNeeded( + const XlaCompiler::Options& options, + const std::vector& args, + const XlaCompiler::CompileOptions& compile_options, OpKernelContext* ctx, + DeviceCompilationProfiler* profiler, + const XlaCompiler::CompilationResult** out_compilation_result, + ExecutableType** out_executable); + + ClientType* client() const { return compiler_client_->client(); } + const DeviceType& device_type() const { return persistor_->device_type(); } + DeviceCompilationCache* cache() { return cache_.get(); } + DeviceExecutablePersistor* persistor() { + return persistor_.get(); + } + DeviceCompilerClient* compiler_client() { + return compiler_client_.get(); + } + + string DebugString() const override; + + private: + // Common implementation of Compile and CompileSingleOp. The `OpKernelContext` + // parameter is always null for the former. + Status CompileImpl( + const XlaCompiler::CompileOptions& compile_options, + const XlaCompiler::Options& options, const NameAttrList& function, + const std::vector& args, CompileScope scope, + DeviceCompileMode compile_mode, OpKernelContext* ctx, + DeviceCompilationProfiler* profiler, + const XlaCompiler::CompilationResult** out_compilation_result, + ExecutableType** out_executable); + + StatusOr::Value> + CompileStrict( + const DeviceCompilationClusterSignature& sig, + const XlaCompiler::CompileOptions& compile_options, + const XlaCompiler::Options& options, + const std::vector& args, + const NameAttrList& function, + typename DeviceCompilationCache::Value cache_value, + CompileScope scope, OpKernelContext* ctx, + DeviceCompilationProfiler* profiler, mutex* mu) + TF_EXCLUSIVE_LOCKS_REQUIRED(*mu); + + Status CompileAsynchronous(const DeviceCompilationClusterSignature& sig, + const XlaCompiler::CompileOptions& compile_options, + const XlaCompiler::Options& options, + const std::vector& args, + const NameAttrList& function, CompileScope scope, + OpKernelContext* ctx, + DeviceCompilationProfiler* profiler); + + std::unique_ptr> + persistor_; + std::unique_ptr> + compiler_client_; + std::unique_ptr> cache_; + + // Pool of threads for asynchronous compilations. + std::unique_ptr async_compiler_threads_; + + mutex cluster_mutexes_mu_; + absl::flat_hash_map, + DeviceCompilationClusterSignature::Hash> + cluster_mutexes_ TF_GUARDED_BY(cluster_mutexes_mu_); + + TF_DISALLOW_COPY_AND_ASSIGN(DeviceCompiler); +}; + +namespace device_compiler_internal { +// Print something that users can search for to definitively ascertain that XLA +// was used for their TF model. +// Prints only once to avoid spamming LOG(INFO). +inline void LogOnceXlaCompiledFirstCluster() { + static absl::once_flag log_once; + absl::call_once(log_once, [] { + LOG(INFO) << "Compiled cluster using XLA! This line is logged at most " + "once for the lifetime of the process."; + }); +} + +template +inline Status EligibleToPersist(DeviceCompileState compile_state, + const ExecutableType* executable) { + if (compile_state != DeviceCompileState::kCompiled) { + return errors::FailedPrecondition( + "Cache entry to serialize is not compiled."); + } + if (executable == nullptr) { + return errors::FailedPrecondition( + "LocalExecutable not found for cache entry to serialize."); + } + return OkStatus(); +} +} // namespace device_compiler_internal + +template +DeviceCompiler::DeviceCompiler( + std::unique_ptr> + persistor, + std::unique_ptr> + compiler_client) + : persistor_(std::move(persistor)), + compiler_client_(std::move(compiler_client)) { + cache_ = std::make_unique>(); + async_compiler_threads_ = std::make_unique( + tensorflow::Env::Default(), "async_compiler_threads", + kNumAsyncDeviceCompilerThreads); +} + +template +DeviceCompiler::~DeviceCompiler() { + // Since programs are owned by the cache, ensure any use of our programs have + // completed by waiting for all stream executors to complete. + compiler_client_->WaitForProgramsToFinish(); + // Wait for all outstanding compilations to finish. + // Resetting the pointer explicitly in the top level destructor. + // Without this, the pointer would be reset when the AsyncCompilationState + // is destructed, which is dependent on the order of the members in the + // DeviceCompiler class, which is error prone if the order changes. + async_compiler_threads_.reset(); + // TODO(b/110813685): Think about the program ownership model. Programs are + // currently owned by the compilation cache which means we must wait for + // program completion in the destructor. There are multiple compilation caches + // around, which complicates things a little. Perhaps having programs be + // shared_ptrs (an invasive change) would make the model easier to reason + // about? +} + +template +string DeviceCompiler::DebugString() const { + return "DeviceCompiler"; +} + +template +Status DeviceCompiler::CompileIfNeeded( + const XlaCompiler::Options& options, const NameAttrList& function, + const std::vector& args, + const XlaCompiler::CompileOptions& compile_options, + DeviceCompileMode compile_mode, DeviceCompilationProfiler* profiler, + const XlaCompiler::CompilationResult** out_compilation_result, + ExecutableType** out_executable) { + return CompileImpl(compile_options, options, function, args, + CompileScope::kFunction, compile_mode, /*ctx=*/nullptr, + profiler, out_compilation_result, out_executable); +} + +template +Status DeviceCompiler::CompileSingleOpIfNeeded( + const XlaCompiler::Options& options, + const std::vector& args, + const XlaCompiler::CompileOptions& compile_options, OpKernelContext* ctx, + DeviceCompilationProfiler* profiler, + const XlaCompiler::CompilationResult** out_compilation_result, + ExecutableType** out_executable) { + const NodeDef& def = ctx->op_kernel().def(); + NameAttrList name; + name.set_name(def.op()); + *name.mutable_attr() = def.attr(); + // Remove the "_class" attribute from the attribute set used to create the + // compilation cache key. This attribute is information for the colocator + // and causes false uniqueness between nodes. + name.mutable_attr()->erase("_class"); + return CompileImpl(compile_options, options, name, args, CompileScope::kOp, + DeviceCompileMode::kStrict, ctx, profiler, + out_compilation_result, out_executable); +} + +template +StatusOr::Value> +DeviceCompiler::CompileStrict( + const DeviceCompilationClusterSignature& sig, + const XlaCompiler::CompileOptions& compile_options, + const XlaCompiler::Options& options, + const std::vector& args, + const NameAttrList& function, + typename DeviceCompilationCache::Value cache_value, + CompileScope scope, OpKernelContext* ctx, + DeviceCompilationProfiler* profiler, mutex* mu) { + tensorflow::Env* env = tensorflow::Env::Default(); + const uint64 compile_start_us = env->NowMicros(); + + TfGraphToHloCompiler compiler(options); + cache_value.compile_state = DeviceCompileState::kCompiled; + + std::unique_ptr out_executable; + auto out_compilation_result = + std::make_unique(); + + if (scope == CompileScope::kOp) { + cache_value.compilation_status = compiler.CompileSingleOp( + compile_options, ctx, args, out_compilation_result.get()); + } else { + CHECK(scope == CompileScope::kFunction); // Crash OK + cache_value.compilation_status = compiler.Compile( + compile_options, function, args, out_compilation_result.get()); + } + TF_RETURN_IF_ERROR(cache_value.compilation_status); + TF_RET_CHECK(cache_value.executable == nullptr); + TF_RET_CHECK(out_compilation_result->computation != nullptr); + + auto loaded_executable = persistor_->TryToLoadExecutable( + DeviceCompilationClusterSignature::Hash()(sig), sig.HumanString(), + options, *out_compilation_result, compiler_client_.get()); + + if (loaded_executable.has_value()) { + cache_value.compilation_status = loaded_executable->status(); + if (loaded_executable->ok()) { + out_executable = *std::move(*loaded_executable); + } + } else { + auto built_executable = + compiler_client_->BuildExecutable(options, *out_compilation_result); + TF_RETURN_IF_ERROR(built_executable.status()); + out_executable = *std::move(built_executable); + + TF_RETURN_IF_ERROR( + device_compiler_internal::EligibleToPersist( + cache_value.compile_state, out_executable.get())); + TF_RETURN_IF_ERROR(persistor_->TryToPersistExecutable( + DeviceCompilationClusterSignature::Hash()(sig), sig.HumanString(), + options, *out_compilation_result, *out_executable, + compiler_client_.get())); + } + + cache_value.compilation_result = out_compilation_result.get(); + cache_value.executable = out_executable.get(); + cache_->Store(sig, cache_value.compile_state, cache_value.compilation_status, + std::move(out_compilation_result), std::move(out_executable)); + + const uint64 compile_end_us = env->NowMicros(); + const uint64 compile_time_us = compile_end_us - compile_start_us; + + device_compiler_internal::LogOnceXlaCompiledFirstCluster(); + TF_RETURN_IF_ERROR(profiler->RegisterCompilation( + function, compile_time_us, loaded_executable.has_value())); + return cache_value; +} + +template +Status DeviceCompiler::CompileAsynchronous( + const DeviceCompilationClusterSignature& signature, + const XlaCompiler::CompileOptions& compile_options, + const XlaCompiler::Options& options, + const std::vector& args, + const NameAttrList& function, CompileScope scope, OpKernelContext* ctx, + DeviceCompilationProfiler* profiler) { + // Explicitly capture all required data by value for async compilation. + // Update compilation state in cache. + cache_->Store(signature, DeviceCompileState::kCompiling, std::nullopt, + std::nullopt, std::nullopt); + profiler->IncrementOngoingAsyncCompilations(); + // Don't move the above code into the thread function as it synchronously + // updates the async compilation state! + + // When the ThreadPool for the compilation cache is destroyed, it waits for + // compilations to have finished. This means that both 'entry' and 'this' will + // be alive for the duration of the compilation. + // !!Pay attention when additional variables must be captured by this lambda!! + // All values are captured by value. Make sure that all pointer values (like + // entry) do not get freed until the lambda has finished. + const std::string& function_name = function.name(); + async_compiler_threads_->Schedule([=] { + VLOG(2) << "Starting asynchronous compilation of cluster " << function_name + << '.'; + // We don't need to lock mu, but do it anyway to satisfy thread safety + // analysis. + mutex mu; + mutex_lock lock(mu); + auto cache_value = typename DeviceCompilationCache::Value(); + auto s = CompileStrict(signature, compile_options, options, args, function, + cache_value, scope, ctx, profiler, &mu); + VLOG(2) << "Finished asynchronous compililation of cluster " + << function_name << '.'; + profiler->DecrementOngoingAsyncCompilations(); + // Update compilation status in cache. + if (!s.ok()) { + cache_->Store(signature, std::nullopt, s.status(), std::nullopt, + std::nullopt); + } + }); + return OkStatus(); +} + +template +Status DeviceCompiler::CompileImpl( + const XlaCompiler::CompileOptions& compile_options, + const XlaCompiler::Options& options, const NameAttrList& function, + const std::vector& args, CompileScope scope, + DeviceCompileMode compile_mode, OpKernelContext* ctx, + DeviceCompilationProfiler* profiler, + const XlaCompiler::CompilationResult** out_compilation_result, + ExecutableType** out_executable) { + DCHECK_NE(out_executable, nullptr); + VLOG(2) << "DeviceCompiler::Compile " << DebugString(); + + if (VLOG_IS_ON(2)) { + VLOG(2) << "num_inputs=" << args.size(); + for (int i = 0, end = args.size(); i < end; i++) { + VLOG(3) << i << ": " << args[i].HumanString(); + } + } + TF_ASSIGN_OR_RETURN(auto signature, + DeviceCompilationClusterSignature::Build(function, args)); + + // The outer lock protects the existence of the mutex in the map. + mutex* cluster_mutex; + { + mutex_lock lock(cluster_mutexes_mu_); + auto it = + cluster_mutexes_.emplace(signature, std::make_unique()).first; + cluster_mutex = it->second.get(); + } + + profiler->RegisterExecution(function); + + string human_signature; + if (VLOG_IS_ON(2)) { + human_signature = VLOG_IS_ON(3) ? signature.HumanString() : function.name(); + VLOG(2) << "DeviceCompilationClusterSignature: " << human_signature; + } + + // Acquire the cache entry lock and compile, if necessary. + // TODO(phawkins): this locking will need to be restructured when we implement + // cache eviction. + mutex_lock cluster_compile_lock(*cluster_mutex); + auto cache_value = cache_->LookupOrCreate(signature); + + int64_t current_request_count = cache_value.request_count; + VLOG(2) << "Compilation cache entry hit: " + << static_cast(cache_value.compile_state) + << " signature: " << human_signature << " with request count " + << current_request_count; + + DeviceCompileState state = cache_value.compile_state; + *out_compilation_result = nullptr; + *out_executable = nullptr; + + // Check if the requested entry is uncompiled and return an error if + // compilation is disabled. This will raise an error for kLazy even if we have + // not yet hit the compilation threshold and no compilation happens this + // round. This is to avoid non-determanism of when compilation is disallowed, + // for example by changing the threshold. + if (state == DeviceCompileState::kUncompiled && FailOnXlaCompilation()) { + VLOG(1) << "XLA compilation disabled: " << function.name() << "\n" + << absl::StrJoin( + args, "\n", + [](std::string* out, const XlaCompiler::Argument& arg) { + absl::StrAppend(out, " arg: ", arg.HumanString()); + }); + + return errors::Internal("XLA compilation disabled"); + } + + if (state == DeviceCompileState::kUncompiled) { + XLA_SCOPED_LOGGING_TIMER("Compilation of XLA executable"); + if (!profiler->ShouldCompileCluster(function, compile_mode, + current_request_count)) { + VLOG(2) << "Not compiling for signature: " << human_signature; + return OkStatus(); + } else if (compile_mode == DeviceCompileMode::kAsync) { + VLOG(2) << "Queueing asynchronous compilation for signature: " + << human_signature; + TF_RETURN_IF_ERROR(CompileAsynchronous(signature, compile_options, + options, args, function, scope, + ctx, profiler)); + return OkStatus(); + } else { + VLOG(2) << "Instantly compiling for signature: " << human_signature; + TF_ASSIGN_OR_RETURN( + cache_value, + CompileStrict(signature, compile_options, options, args, function, + cache_value, scope, ctx, profiler, cluster_mutex)); + } + } else if (state == DeviceCompileState::kCompiling) { + VLOG(2) << "Ongoing asynchronous compilation for signature: " + << human_signature; + return OkStatus(); + } else if (state == DeviceCompileState::kCompiled) { + VLOG(2) << "Already Compiled for signature: " << human_signature; + } + + TF_RETURN_IF_ERROR(cache_value.compilation_status); + *out_compilation_result = cache_value.compilation_result; + *out_executable = cache_value.executable; + return OkStatus(); +} + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_JIT_DEVICE_COMPILER_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/device_compiler_client.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/device_compiler_client.h new file mode 100644 index 0000000000000000000000000000000000000000..1f24091fd295ba434675386b111294a1dff1f0a8 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/device_compiler_client.h @@ -0,0 +1,75 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_JIT_DEVICE_COMPILER_CLIENT_H_ +#define TENSORFLOW_COMPILER_JIT_DEVICE_COMPILER_CLIENT_H_ + +#include +#include +#include + +#include "tensorflow/compiler/tf2xla/xla_compiler.h" +#include "xla/client/executable_build_options.h" + +namespace tensorflow { + +template +class DeviceCompilerClient { + public: + DeviceCompilerClient() = default; + virtual ~DeviceCompilerClient() = default; + + // Compiles `result` (HLO) to an `ExecutableType` using `ClientType` and + // returns it. + virtual StatusOr> BuildExecutable( + const XlaCompiler::Options& options, + const XlaCompiler::CompilationResult& result) = 0; + + // Serializes an available `executable` to string using `ClientType` and + // returns it. + virtual StatusOr SerializeExecutable( + const ExecutableType& executable) = 0; + + // Compiles `result` (HLO) to a serializable executable (eg. + // xla::AotCompilationResult) using `ClientType`, serializes it to string and + // returns it. + virtual StatusOr BuildSerializedExecutable( + const XlaCompiler::Options& options, + const XlaCompiler::CompilationResult& result) = 0; + + // Loads `serialized_executable` into an `ExecutableType` using `ClientType`. + virtual StatusOr> LoadExecutable( + const XlaCompiler::Options& options, + const XlaCompiler::CompilationResult& result, + const std::string& serialized_executable) = 0; + + // Waits for the underlying `ClientType` backend's programs to finish + // executing before returning. + virtual void WaitForProgramsToFinish() = 0; + + virtual ClientType* client() const = 0; + + private: + TF_DISALLOW_COPY_AND_ASSIGN(DeviceCompilerClient); +}; + +// Generates the ExecutableBuildOptions for compilation from HLO to +// executable. +xla::ExecutableBuildOptions GetExecutableBuildOptions( + const XlaCompiler::Options& options, + const XlaCompiler::CompilationResult& result, int default_device_ordinal); +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_JIT_DEVICE_COMPILER_CLIENT_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/device_executable_persistor.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/device_executable_persistor.h new file mode 100644 index 0000000000000000000000000000000000000000..a38be5b5d86ca9c27c469aed16a34e7eca01986a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/device_executable_persistor.h @@ -0,0 +1,408 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_JIT_DEVICE_EXECUTABLE_PERSISTOR_H_ +#define TENSORFLOW_COMPILER_JIT_DEVICE_EXECUTABLE_PERSISTOR_H_ + +#include +#include + +#include "absl/log/log.h" +#include "tensorflow/compiler/jit/xla_compilation_cache.pb.h" +#include "tensorflow/compiler/jit/xla_device_compiler_client.h" +#include "tensorflow/compiler/tf2xla/xla_compiler.h" +#include "xla/pjrt/pjrt_client.h" +#include "xla/service/hlo.pb.h" +#include "xla/util.h" +#include "tensorflow/core/framework/device.h" +#include "tensorflow/core/lib/strings/proto_serialization.h" +#include "tensorflow/core/platform/path.h" +#include "tensorflow/core/platform/status.h" +#include "tensorflow/core/platform/statusor.h" +#include "tsl/platform/statusor.h" + +namespace tensorflow { + +// Offers a way to persist and/or load compiled `ExecutableType`s along with the +// corresponding HLO (`CompilationResult`) to/from `persistent_cache_directory` +// (if one was provided during construction) on disk using `ClientType`. +template +class DeviceExecutablePersistor { + public: + // Configuration for setting up persistence (directory, filename prefix, etc). + struct Config { + Config() = default; + explicit Config(absl::string_view persistent_cache_directory, + bool disable_strict_signature_checks, + absl::string_view persistence_prefix, + bool persistent_cache_directory_read_only) + : persistent_cache_directory(persistent_cache_directory), + disable_strict_signature_checks(disable_strict_signature_checks), + persistence_prefix(persistence_prefix), + persistent_cache_directory_read_only( + persistent_cache_directory_read_only) {} + + explicit Config(absl::string_view persistent_cache_directory, + bool disable_strict_signature_checks, + absl::string_view persistence_prefix) + : persistent_cache_directory(persistent_cache_directory), + disable_strict_signature_checks(disable_strict_signature_checks), + persistence_prefix(persistence_prefix) {} + + // If non-empty, JIT-compiled executables are saved to and loaded from the + // specified file system directory path. + std::string persistent_cache_directory; + + // Disable strict signature checks for entries loaded into the cache from + // external sources. + bool disable_strict_signature_checks = false; + + // The cache persistence prefix to use if serializing/deserialzing entries. + std::string persistence_prefix; + + // Cache is read-only if set to true. + bool persistent_cache_directory_read_only = false; + }; + + DeviceExecutablePersistor(const Config& config, + const DeviceType& device_type); + virtual ~DeviceExecutablePersistor() = default; + + // Returns std::nullopt if persistence is not enabled (i.e. + // `persistent_cache_directory_` is empty) or if the serialized entry is not + // found on disk. Otherwise, loads and returns the serialized executable + // (or returns a status). + // TODO(b/255826209): Take in Signature instead of hash and string once cache + // is refactored. + std::optional>> TryToLoadExecutable( + uint64 signature_hash, const std::string& signature_str, + const XlaCompiler::Options& options, + const XlaCompiler::CompilationResult& compilation_result, + DeviceCompilerClient* client) const; + + // Tries to serialize an already built `executable` and persist it on disk. If + // unable to do so, tries to build a serialized executable using the AOT + // pipeline and persists that to disk. + // TODO(b/255826209): Take in Signature instead hash and string once cache + // is refactored. + virtual Status TryToPersistExecutable( + uint64 signature_hash, const std::string& signature_str, + const XlaCompiler::Options& options, + const XlaCompiler::CompilationResult& compilation_result, + const ExecutableType& executable, + DeviceCompilerClient* client) const; + + const DeviceType& device_type() const { return device_type_; } + const std::string& persistence_prefix() const { return persistence_prefix_; } + const std::string& persistent_cache_directory() const { + return persistent_cache_directory_; + } + + private: + // Returns a cache key proto that identifies an entry in the compilation + // cache. + XlaSerializedCacheKey BuildSerializedCacheKey( + uint64 signature_hash, const xla::HloModuleProto& hlo_module) const; + + XlaSerializedCacheKey BuildSerializedCacheKey( + uint64 signature_hash, const xla::HloModuleProto& hlo_module, + bool compiled_using_pjrt) const; + + // Serializes the signature and its corresponding entry to a proto message. + StatusOr SerializeEntry( + uint64 signature_hash, const XlaCompiler::Options& options, + const XlaCompiler::CompilationResult& compilation_result, + const ExecutableType& executable, + DeviceCompilerClient* compiler_client) const; + + // Saves the cache entry in the file directory supplied during the + // construction of this class. Overwrites existing entries. + Status SaveSerializedEntry(const XlaSerializedCacheEntry& entry) const; + + // Tries to read a cache entry given a `key` by searching the file directory + // supplied during the construction of this class. Returns std::nullopt if no + // cache entry is found. + StatusOr> TryToReadSerializedEntry( + const XlaSerializedCacheKey& key) const; + + // Checks if the loaded `entry` matches the expected `key` and `hlo_module`. + Status VerifyLoadedCacheEntry(const XlaSerializedCacheKey& key, + const xla::HloModuleProto& hlo_module, + const XlaSerializedCacheEntry& entry) const; + + std::string XlaSerializedCacheKeyToString( + const XlaSerializedCacheKey& key) const; + std::string GetFilePath(const XlaSerializedCacheKey& key) const; + + const DeviceType device_type_; + const bool disable_strict_signature_checks_; + const std::string persistence_prefix_; + + // If non-empty, JIT-compiled executables are saved to and loaded from the + // specified file system directory path. + const std::string persistent_cache_directory_; + + // Cache is read-only if set to true. + const bool persistent_cache_directory_read_only_; + + TF_DISALLOW_COPY_AND_ASSIGN(DeviceExecutablePersistor); +}; + +template +DeviceExecutablePersistor:: + DeviceExecutablePersistor(const Config& config, + const DeviceType& device_type) + : device_type_(device_type), + disable_strict_signature_checks_(config.disable_strict_signature_checks), + persistence_prefix_(config.persistence_prefix), + persistent_cache_directory_(config.persistent_cache_directory), + persistent_cache_directory_read_only_( + config.persistent_cache_directory_read_only) {} + +template +std::string DeviceExecutablePersistor:: + XlaSerializedCacheKeyToString(const XlaSerializedCacheKey& key) const { + static constexpr char kXlaSerializedCacheKeySeparator[] = "__"; + return absl::StrCat( + key.prefix(), key.prefix().empty() ? "" : kXlaSerializedCacheKeySeparator, + key.signature_fingerprint(), kXlaSerializedCacheKeySeparator, + key.cluster_fingerprint(), kXlaSerializedCacheKeySeparator, + key.device_type(), + key.compiled_using_pjrt() + ? absl::StrCat(kXlaSerializedCacheKeySeparator, "pjrt") + : ""); +} + +template +std::string DeviceExecutablePersistor::GetFilePath( + const XlaSerializedCacheKey& key) const { + const std::string file_name = + absl::StrCat(XlaSerializedCacheKeyToString(key), ".pb"); + return io::JoinPath(persistent_cache_directory_, file_name); +} + +template +XlaSerializedCacheKey +DeviceExecutablePersistor::BuildSerializedCacheKey( + uint64 signature_hash, const xla::HloModuleProto& hlo_module, + bool compiled_using_pjrt) const { + XlaSerializedCacheKey key; + key.set_signature_fingerprint(signature_hash); + key.set_cluster_fingerprint(DeterministicProtoHash64(hlo_module)); + key.set_device_type(device_type().type_string()); + key.set_prefix(persistence_prefix()); + key.set_compiled_using_pjrt(compiled_using_pjrt); + return key; +} + +template +XlaSerializedCacheKey +DeviceExecutablePersistor::BuildSerializedCacheKey( + uint64 signature_hash, const xla::HloModuleProto& hlo_module) const { + return BuildSerializedCacheKey(signature_hash, hlo_module, false); +} + +// This template specialization sets compiled_using_prjt to true in the cache +// key when the template arguments are PjRtLoadedExecutable and PjRtClient. +template <> +inline XlaSerializedCacheKey +DeviceExecutablePersistor:: + BuildSerializedCacheKey(uint64 signature_hash, + const xla::HloModuleProto& hlo_module) const { + return BuildSerializedCacheKey(signature_hash, hlo_module, true); +} + +template +StatusOr> +DeviceExecutablePersistor::TryToReadSerializedEntry( + const XlaSerializedCacheKey& key) const { + Env* env = Env::Default(); + const std::string file_path = GetFilePath(key); + if (!env->FileExists(file_path).ok()) { + return StatusOr>(std::nullopt); + } + + XlaSerializedCacheEntry entry; + TF_RETURN_IF_ERROR(ReadTextOrBinaryProto(env, file_path, &entry)); + return std::optional(entry); +} + +template +Status +DeviceExecutablePersistor::VerifyLoadedCacheEntry( + const XlaSerializedCacheKey& key, const xla::HloModuleProto& hlo_module, + const XlaSerializedCacheEntry& entry) const { + XLA_SCOPED_LOGGING_TIMER(absl::StrCat("Verifying loaded cache entry: ", + hlo_module.entry_computation_name())); + + if (!AreSerializedProtosEqual(key, entry.key())) { + VLOG(2) << "Serialized cache key does not match:\n" + << "got:\n" + << entry.key().DebugString() << "\nexpected:\n" + << key.DebugString() << "\n"; + return errors::InvalidArgument("Serialized cache key does not match."); + } + + // Perform a stricter (slower) check of the snapshot to verify that they + // match exactly. + if (!disable_strict_signature_checks_) { + if (!AreSerializedProtosEqual(hlo_module, entry.hlo_module())) { + VLOG(2) << "HLOs do not match:\n" + << "got:\n" + << hlo_module.DebugString() << "\nexpected:\n" + << entry.hlo_module().DebugString() << "\n"; + return errors::InvalidArgument("Serialized HLO does not match."); + } + } + + if (entry.executable().empty()) { + return errors::InvalidArgument("No binary found in serialized entry."); + } + return OkStatus(); +} + +template +Status +DeviceExecutablePersistor::SaveSerializedEntry( + const XlaSerializedCacheEntry& entry) const { + Env* env = Env::Default(); + TF_RETURN_IF_ERROR(env->RecursivelyCreateDir(persistent_cache_directory_)); + + // The cache on the filesystem can be read while we're writing out the proto. + // To prevent reads of partially-written files, we write the proto to a temp + // file, then move it into place once we're done writing. And we warn the + // user if these moves are not known to be atomic. + bool has_atomic_move = false; + env->HasAtomicMove(persistent_cache_directory_, &has_atomic_move) + .IgnoreError(); + if (!has_atomic_move) { + LOG_EVERY_POW_2(WARNING) + << "Filesystem for XLA persistent cache at " + << persistent_cache_directory_ + << " does not support atomic moves. Therefore the persistent cache is " + "racy if you have multiple XLA compilations occurring " + "simultaneously! You have been warned. :)"; + } + + // Write to temp location, then when that completes, atomically move into the + // final location. + std::string temp_path = io::JoinPath( + persistent_cache_directory_, XlaSerializedCacheKeyToString(entry.key())); + if (!env->CreateUniqueFileName(&temp_path, ".pb.tmp")) { + return absl::UnavailableError(absl::StrCat( + "Could not create a unique file inside ", persistent_cache_directory_)); + } + TF_RETURN_IF_ERROR(WriteBinaryProto(env, temp_path, entry)); + return env->RenameFile(temp_path, GetFilePath(entry.key())); +} + +template +StatusOr +DeviceExecutablePersistor::SerializeEntry( + uint64 signature_hash, const XlaCompiler::Options& options, + const XlaCompiler::CompilationResult& compilation_result, + const ExecutableType& executable, + DeviceCompilerClient* compiler_client) const { + XlaSerializedCacheEntry serialized_entry; + const xla::HloModuleProto& hlo_module = + compilation_result.computation->proto(); + *serialized_entry.mutable_key() = + BuildSerializedCacheKey(signature_hash, hlo_module); + *serialized_entry.mutable_hlo_module() = hlo_module; + + // XLA compiler supports exporting executables as an AOT compilation result + // to avoid running potentially expensive compilation pipeline twice. + // Check if XLA compiler can export available executable. + if (auto serialized_executable = + compiler_client->SerializeExecutable(executable); + serialized_executable.ok()) { + serialized_entry.set_executable(std::move(*serialized_executable)); + return serialized_entry; + } else if (serialized_executable.status().code() == error::UNIMPLEMENTED) { + VLOG(1) << "Executable export is not implemented"; + } else { + return serialized_executable.status(); + } + + TF_ASSIGN_OR_RETURN( + auto serialized_executable, + compiler_client->BuildSerializedExecutable(options, compilation_result)); + serialized_entry.set_executable(std::move(serialized_executable)); + return serialized_entry; +} + +template +std::optional>> +DeviceExecutablePersistor::TryToLoadExecutable( + uint64 signature_hash, const std::string& signature_str, + const XlaCompiler::Options& options, + const XlaCompiler::CompilationResult& compilation_result, + DeviceCompilerClient* compiler_client) const { + if (persistent_cache_directory_.empty()) { + return std::nullopt; + } + + const xla::HloModuleProto& hlo_module = + compilation_result.computation->proto(); + + XlaSerializedCacheKey cache_key = + BuildSerializedCacheKey(signature_hash, hlo_module); + + std::optional serialized_entry; + { + XLA_SCOPED_LOGGING_TIMER( + absl::StrCat("Try loading serialized cache entry:", signature_str)); + TF_ASSIGN_OR_RETURN(serialized_entry, TryToReadSerializedEntry(cache_key)); + } + + if (!serialized_entry.has_value()) { + return std::nullopt; + } + + TF_RETURN_IF_ERROR( + VerifyLoadedCacheEntry(cache_key, hlo_module, *serialized_entry)); + + VLOG(1) << "Loading cached entry for: " << signature_str; + return compiler_client->LoadExecutable(options, compilation_result, + serialized_entry->executable()); +} + +template +Status +DeviceExecutablePersistor::TryToPersistExecutable( + uint64 signature_hash, const std::string& signature_str, + const XlaCompiler::Options& options, + const XlaCompiler::CompilationResult& compilation_result, + const ExecutableType& executable, + DeviceCompilerClient* client) const { + if (persistent_cache_directory_.empty() || + persistent_cache_directory_read_only_) { + VLOG(1) << "Not persisting executable. No `persistent_cache_directory` " + "provided or cache is read-only."; + return OkStatus(); + } + + XLA_SCOPED_LOGGING_TIMER( + absl::StrCat("Serializing and saving cache entry: ", signature_str)); + TF_ASSIGN_OR_RETURN(XlaSerializedCacheEntry serialized_entry, + SerializeEntry(signature_hash, options, + compilation_result, executable, client)); + TF_RETURN_IF_ERROR(SaveSerializedEntry(std::move(serialized_entry))); + return OkStatus(); +} + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_JIT_DEVICE_EXECUTABLE_PERSISTOR_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/device_util.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/device_util.h new file mode 100644 index 0000000000000000000000000000000000000000..90852c096f899719f8a77d97663dd956d5442031 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/device_util.h @@ -0,0 +1,213 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_JIT_DEVICE_UTIL_H_ +#define TENSORFLOW_COMPILER_JIT_DEVICE_UTIL_H_ + +#include +#include + +#include "absl/container/flat_hash_map.h" +#include "absl/strings/string_view.h" +#include "absl/types/span.h" +#include "tensorflow/compiler/tf2xla/xla_op_registry.h" +#include "xla/status_macros.h" +#include "xla/statusor.h" +#include "tensorflow/core/framework/types.h" + +namespace tensorflow { +namespace jit { +class DeviceInfoCache; +class DeviceSet; + +// Instances of DeviceId represent TensorFlow devices as integers. +// +// This helps avoid having to manipulate device names as strings when +// auto-clustering. +class DeviceId { + public: + DeviceId(DeviceId&&) = default; + DeviceId(const DeviceId&) = default; + DeviceId& operator=(const DeviceId&) = default; + + bool operator==(const DeviceId& other) const { return id() == other.id(); } + bool operator!=(const DeviceId& other) const { return !(*this == other); } + + private: + int id_; + + explicit DeviceId(int id) : id_(id) {} + + int id() const { return id_; } + + friend class DeviceInfoCache; + friend class DeviceSet; +}; + +// A set of DeviceIds, represented as a bitmap. +class DeviceSet { + public: + void Insert(DeviceId device_id); + void UnionWith(const DeviceSet& other); + bool IsEmpty() const; + + // Calls `func` on each DeviceId in the set. Stops iterating early if `func` + // return false. + // + // TODO(sanjoy): Change this to take a typed std::function if that's + // performance neutral. + template + void ForEach(FnTy func) const { + // This is really a poor man's iterator, we should consider writing a proper + // iterator if this ends up being used widely. + for (int word_index = 0, end = storage_.size(); word_index < end; + word_index++) { + uint64 word = storage_[word_index]; + while (word != 0) { + uint64 only_lowest_bit_set = word & -word; + // The number of trailing zeros in a non-zero word is the index of the + // least significant 1. + int bit_index = ctz_uint64(word); + if (!func(DeviceId(word_index * kWordSize + bit_index))) { + return; + } + word ^= only_lowest_bit_set; + } + } + } + + private: + static int ctz_uint64(uint64 x) { + DCHECK_NE(x, 0); +#ifdef __GNUC__ + return __builtin_ctzl(x); +#else + int result = 0u; + while ((x & 1u) == 0u) { + x >>= 1; + ++result; + } + return result; +#endif + } + + absl::InlinedVector storage_; + + const int kWordSize = 64; +}; + +// Caches some miscellaneous information about TF devices. Thread compatible. +class DeviceInfoCache { + public: + bool IsGpu(DeviceId device) const { return is_gpu_[device.id()]; } + bool IsCpu(DeviceId device) const { return is_cpu_[device.id()]; } + + absl::string_view GetNameFor(DeviceId device) const { + return names_[device.id()]; + } + + StatusOr GetIdFor(absl::string_view name); + + using DeviceRegistration = const XlaOpRegistry::DeviceRegistration; + + DeviceRegistration* GetCompilationDevice(DeviceId device) const { + return id_to_compilation_device_[device.id()]; + } + + StatusOr GetCompilationDevice(absl::string_view name) { + TF_ASSIGN_OR_RETURN(DeviceId device_id, GetIdFor(name)); + return GetCompilationDevice(device_id); + } + + const DeviceType& GetDeviceTypeFor(DeviceId device) const { + return *id_to_device_type_[device.id()]; + } + + using DeviceTypeConstRef = std::reference_wrapper; + + StatusOr GetDeviceTypeFor(absl::string_view device_name) { + TF_ASSIGN_OR_RETURN(DeviceId device_id, GetIdFor(device_name)); + return std::cref(*id_to_device_type_[device_id.id()]); + } + + string DebugString(const DeviceSet& device_set) const; + + private: + absl::flat_hash_map name_to_id_; + + // These fields are populated for a device in GetIdFor, *before* we give out a + // DeviceId. + std::vector + id_to_compilation_device_; + std::vector> id_to_device_type_; + std::vector names_; + std::vector is_cpu_; + std::vector is_gpu_; +}; + +} // namespace jit + +// Returns the DeviceType corresponding to 'device'. +Status DeviceNameToDeviceType(const string& device, DeviceType* device_type); + +// Picks the device for which XLA should compile a cluster that contains +// operations placed in devices in `devices`. For instance a cluster that +// contains operations solely placed on the CPU will be compiled into a CPU +// executable by XLA, whereas a cluster that contains operations placed on the +// CPU and also operations placed on the GPU will be compiled into a GPU +// executable. +// +// Returns a non-OK Status if no unambiguous choice of device exists. +// +// We choose the device using the following rules: +// +// - It is an error for `device_names` to contain more than one device of the +// same type. +// - GPU is preferred over CPU. +// - If `allow_mixing_unknown_and_cpu` is true then unknown devices are +// preferred over CPU. +// - XLA devices count as "unrecognized devices". +// +// This set of rules above implicitly assume that XLA:GPU can compile all +// operations in the cluster that XLA:CPU can compile, and if +// `allow_mixing_unknown_and_cpu` then the unrecognized device can also compile +// all operations in the cluster that XLA:CPU can compile. +// +// We provide the `allow_mixing_unknown_and_cpu` knob so that we can do both of +// the following things: +// +// - Let MarkForCompilationPass not inject CPU-placed operations into clusters +// that will run on unknown devices (because the unknown XLA backend may not +// support every operation supported by CPU). +// - Let BuildXlaOpsPass successfully infer a compilation device for a cluster +// that contains nodes placed on both the CPU and on unknown devices. In this +// case it is the responsibility of the optimization pass that injected the +// CPU nodes into the cluster to ensure that these nodes can be compiled by +// the unknown XLA backend. +StatusOr PickDeviceForXla( + const jit::DeviceInfoCache& device_info_cache, + const jit::DeviceSet& devices, bool allow_mixing_unknown_and_cpu); + +// This is like `PickDeviceForXla` except that it returns nullopt (instead of a +// non-OK Status) if no unambiguous choice of device exists. +// +// We return a failing Status for errors unrelated to the device choice +// algorithm itself. +StatusOr> MaybePickDeviceForXla( + const jit::DeviceInfoCache& device_info_cache, + const jit::DeviceSet& devices, bool allow_mixing_unknown_and_cpu); +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_JIT_DEVICE_UTIL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/encapsulate_subgraphs_pass.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/encapsulate_subgraphs_pass.h new file mode 100644 index 0000000000000000000000000000000000000000..6ff0180a3a1c2cf9865cc1ba9622222e7db7eddc --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/encapsulate_subgraphs_pass.h @@ -0,0 +1,108 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +// An optimization pass that groups nodes marked with a common +// kXlaClusterAttr into functions, and replaces the original nodes by +// calls. The calls are annotated with kXlaCompiledKernelAttr. + +#ifndef TENSORFLOW_COMPILER_JIT_ENCAPSULATE_SUBGRAPHS_PASS_H_ +#define TENSORFLOW_COMPILER_JIT_ENCAPSULATE_SUBGRAPHS_PASS_H_ + +#include "tensorflow/core/common_runtime/optimization_registry.h" +#include "tensorflow/core/framework/function.h" +#include "tensorflow/core/graph/graph.h" +#include "tensorflow/core/lib/core/status.h" + +namespace tensorflow { + +// EncapsulateSubgraphs pass takes all the nodes with the same cluster ID +// (derived from kXlaClusterAttr=ID (kXlaClusterAttr) attribute), puts them into +// a TF function, and replaces the subgraph in the main graph with a call to +// that TF function annotated with kXlaCompiledKernelAttr (_XlaCompiledKernel). +class EncapsulateSubgraphsPass : public GraphOptimizationPass { + public: + Status Run(const GraphOptimizationPassOptions& options) override; +}; + +// A rewriting function to apply to each subgraph during encapsulation. +// 'arg_source_tensors' are the tensors corresponding to the arguments in the +// original source graph (*not* 'graph'). +// +// 'graph' is the subgraph. The rewriting may renumber the inputs and outputs; +// 'input_permutation' is a mapping from old argument numbers to new argument +// numbers, whereas 'output_permutation' is the same for outputs. Both +// 'input_permutation' and 'output_permutation' are initialized to the identity +// permutation. 'nodedef' is the NodeDef for the call to the function under +// construction, provided to allow additional attributes to be set. +// The rewrite may also change the NodeDef's operator name, and that +// name will be used as the name of the generated function. +typedef std::function& arg_source_tensors, + std::unique_ptr* graph, std::vector* input_permutation, + std::vector* output_permutation, NodeDef* node_def)> + RewriteSubgraphFn; + +// Transformation that finds subgraphs whose nodes are marked with +// 'group_attribute', splits those subgraphs into functions, and replaces +// the originals with function calls. +// +// 'group_attribute' must be a string valued-attribute that names the new +// functions to introduce. +// +// If 'rewrite_subgraph_fn' is set, it is applied to each subgraph before +// function conversion. +// +// If 'reuse_existing_functions' is set, use an existing function with the +// same name, if any. +// +// TODO(phawkins): currently, some information in control edges +// is not preserved. Suppose you have A and B in the main +// graph, C and D in a subgraph. B and C have control deps from A, D has control +// dep from B. Originally D must run after C, post-transformation this +// dependency is lost. +Status EncapsulateSubgraphsInFunctions( + string group_attribute, const Graph& graph_in, + const RewriteSubgraphFn& rewrite_subgraph_fn, bool reuse_existing_functions, + std::unique_ptr* graph_out, FunctionLibraryDefinition* library); + +// The attribute that marks function calls produced by the encapsulate +// subgraphs pass and that should in turn be compiled via XlaLaunch operators. +extern const char* const kXlaCompiledKernelAttr; + +// Does `node` have the kXlaCompiledKernelAttr attribute? +bool IsXlaCompiledKernel(const Node& node); + +// Functions produced by the EncapsulateSubgraphs pass have their arguments in +// the order: +// 1) compile-time constant arguments, in host memory, +// 2) other arguments, in device memory. +// 3) resource variable arguments, in host memory. Note that only the resource +// Tensor itself is in host memory; the underlying value may be in device +// memory. +// The functions are annotated with the following attributes that describe how +// many constant and resource arguments there are: + +// Name of the attribute containing the number of constant arguments. +extern const char* const kXlaNumConstantArgsAttr; + +// Name of the attribute containing the number of resource variable arguments. +extern const char* const kXlaNumResourceArgsAttr; + +// Name of the attribute defining whether the cluster has reference variables. +extern const char* const kXlaHasReferenceVarsAttr; + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_JIT_ENCAPSULATE_SUBGRAPHS_PASS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/encapsulate_util.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/encapsulate_util.h new file mode 100644 index 0000000000000000000000000000000000000000..304e317ee2521df6a359fc9e139fefa6b72f21ba --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/encapsulate_util.h @@ -0,0 +1,154 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +// This file contains some utility functions for encapsulating XLA computation +// in host graph and encapsulating outside compilation in XLA computation. + +#ifndef TENSORFLOW_COMPILER_JIT_ENCAPSULATE_UTIL_H_ +#define TENSORFLOW_COMPILER_JIT_ENCAPSULATE_UTIL_H_ + +#include "absl/container/flat_hash_map.h" +#include "tensorflow/core/graph/graph.h" + +namespace tensorflow { + +// Attribute marking output tensor shapes inferred by XLA. Attribute value is +// a list of PartialTensorShape objects. +extern const char kXlaInferredShapesAttrName[]; + +// Infers output shapes for all nodes in graph `g`. The output shapes will be +// stored in node attribute `kXlaInferredShapesAttrName`. +// +// We have to perform shape inference before encapsulation because after +// encapsulation, some nodes will be encapsulated into function call, and shape +// inference does not handle function call at the moment. +Status PerformStaticShapeInferenceBeforeEncapsulation(Graph* g); + +// Attribute indicating that some ops in this node's XLA computation has control +// dependency on this node. Attribute value will always be "true". +extern const char kXlaConnectedToXlaComputationAttrName[]; + +// Attribute indicating that this node has control dependency on some ops in +// this node's XLA computation. Attribute value will always be "true". +extern const char kXlaConnectedFromXlaComputationAttrName[]; + +// Attribute indicating that this is an Placeholder node added to act as a +// temporary input node for an outside compilation node. Attribute value will be +// string (original input node name). +extern const char kOutsideCompilationOriginalNodeAttrName[]; + +// Attribute indicating that this is an Placeholder node added to act as a +// temporary input node for an outside compilation node. Attribute value will be +// int (src_output for original edge). +extern const char kOutsideCompilationSrcOutputAttrName[]; + +// Attribute indicating that this node has control dependencies on some other +// nodes within the same XLA cluster. Attribute value will be a list of string +// (node names). +extern const char kXlaControlDependenciesWithinXlaClusterAttrName[]; + +// Attribute indicating that this node is an outside compilation node which is +// lifted out of If/While/function node. Attribute value will always be boolean +// value "true". +extern const char kXlaIsLiftedArgAttrName[]; + +// Attribute indicating that this node is a Placeholder node for an _Arg node +// lifted out of If/While/function node. Attribute value will be a string, which +// is the outside compilation cluster name sending the lifted arg node to host. +extern const char kXlaLiftedArgOutsideCompilationAttrName[]; + +// Attribute indicating that this is an IdentityN node receiving inputs for a +// outside compilation Placeholder node (the original outside compilation node +// is moved out of TPU computation, and we left a Placeholder node there). +// Attribute value will be a string, which is the outside compilation cluster +// name for the outside compilation Placeholder node. +extern const char kXlaOutsideCompilationInputsAttrName[]; + +// Attribute indicating that this is a Placeholder node for an _Arg node used in +// outside compilation. We should not move this node out of XLA computation. +// Attribute value will always be boolean value "true". +extern const char kXlaIsPlaceholderForArg[]; + +// Information for XLA computation. +struct XlaClusterInfo { + // Add an explicitly-defined default constructor for this class. + // + // The compiler may delete the default constructor here because + // host_compute_core is a const member whose type (std::map) doesn't + // necessarily have a user provided constructor -- while libc++ and + // libstdc++ 4.8 provide a user defined default constructor, libstdc++ at + // least >= 7.3 does not. See also c++11 [class.ctor] p5. + // + // TODO(klimek): In c++17 we'll be able to initialize host_compute_core + // without losing aggregate initialization, which allows us to get rid of + // the constructor definitions again. + XlaClusterInfo() {} + XlaClusterInfo(const string& cluster_name, + const NameAttrList& func_name_attrs, Node* node, + const std::map& host_compute_core) + : cluster_name(cluster_name), + func_name_attrs(func_name_attrs), + node(node), + host_compute_core(host_compute_core) {} + // XLA cluster name. It might be different from `func_name`. + const string cluster_name; + // Name and attributes of XLA computation function. + const NameAttrList func_name_attrs; + // The XLA computation node in the graph. + Node* node; + // A mapping from outside compilation cluster name to its device assignment. + const std::map host_compute_core; +}; + +// Finds dependencies between outside compilation clusters, including both data +// dependencies and control dependencies. cluster_deps maps the name name of an +// outside compilation cluster to a set of names of outside compilation clusters +// that it depends on. +tsl::StatusOr>>> +OutsideCompilationClusterDependencies( + const Graph* g, const string& outside_compilation_attr_name); + +// Preprocesses edges within the same XLA cluster. It will perform the following +// operations in order: +// +// 0. Remove edges from source node to outside compilation nodes, and edges +// from outside compilation nodes to sink node. +// 1a. For edges between different outside compilation clusters, remove the edge +// and add attr "kXlaControlDependenciesWithinXlaClusterAttrName = src node +// name" to dst node. +// 1b. For control edges between outside compilation and its XLA computation, +// add attr "kXlaConnected{From, To}XlaComputationAttrName = true" to the +// outside compilation node. +// 2. For data edges between different outside compilations, remove the edge +// and create a Placeholder node as dst node's input. +Status PreprocessEdgesBetweenOutsideCompilations( + Graph* g, const string& outside_compilation_attr_name); + +// Postprocesses edges within the same XLA cluster. This function reverts what +// `PreprocessEdgesBetweenOutsideCompilations` did. It will perform the +// following operations in order: +// +// 1. Remove Placeholder nodes between different outside compilations (created +// in `PreprocessEdgesBetweenOutsideCompilations` step 2). +// 2a. Reconnect control edges between different outside compilations (marked by +// `PreprocessEdgesBetweenOutsideCompilations` step 1a). +// Notice that control edges marked by +// `PreprocessEdgesBetweenOutsideCompilations` step 1b are not handled here. +// They are handled in `RewriteOutsideCompilationSubgraphFn`. +Status PostprocessEdgesBetweenOutsideCompilations( + Graph* g, const string& outside_compilation_attr_name); +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_JIT_ENCAPSULATE_UTIL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/encapsulate_xla_computations_pass.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/encapsulate_xla_computations_pass.h new file mode 100644 index 0000000000000000000000000000000000000000..e4ae139121abe53ce3e15ba8f0671d0c34feea85 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/encapsulate_xla_computations_pass.h @@ -0,0 +1,84 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ==============================================================================*/ +// Rewrites computations generated by the xla.compile() Python code into +// XlaLaunch nodes. +// +// xla.compile() does two main things: +// a) marks operators that make up an XLA computation with the attribute +// _xla_compile_id=XYZ, where XYZ is a unique key. +// b) adds XlaClusterOutput nodes to represent outputs of the computation. +// These nodes are not marked with the _xla_compile_id attribute. + +#ifndef TENSORFLOW_COMPILER_JIT_ENCAPSULATE_XLA_COMPUTATIONS_PASS_H_ +#define TENSORFLOW_COMPILER_JIT_ENCAPSULATE_XLA_COMPUTATIONS_PASS_H_ + +#include +#include + +#include "tensorflow/core/common_runtime/optimization_registry.h" +#include "tensorflow/core/graph/graph.h" +#include "tensorflow/core/platform/env.h" +#include "tensorflow/core/platform/statusor.h" + +namespace tensorflow { + +// Encapsulates nodes marked with the _xla_compile_id attribute into +// XlaLaunch operators. +class EncapsulateXlaComputationsPass : public GraphOptimizationPass { + public: + Status Run(const GraphOptimizationPassOptions& options) override; + + // The following methods are public only for unit tests. + + // This pass has two stages: + // a) first, we call EncapsulateSubgraphsPass to encapsulate all nodes + // marked with the same _xla_compile_id attribute into functions. These + // functions contain the computations to be passed to XlaLaunch. During + // encapsulation, we sort the arguments into the order expected by + // XlaLaunch. + static Status Encapsulate(std::unique_ptr* graph, + FunctionLibraryDefinition* flib_def); + + // b) we rewrite the function calls generated in phase (a) into XlaLaunch + // operators. We also convert the XlaClusterOutput output nodes of the + // function call into the outputs of the XlaLaunch operator. + static Status BuildXlaLaunchOps(Graph* graph); + + struct XlaFunctionInfo { + int variable_start_index = -1; + std::string function_name; + }; + + // We need to introduce this version to adapt to the output of gpu inference + // converter. The single argument overload version calls this function. + // + // When add_edges_to_output_of_downstream_nodes is true, the output edges of + // the xla_launch_node's immediate downstream nodes would be attached to the + // generated xla node. For example, if the original graph is + // StatefulPartitionedCall{_xla_compile_id=1} -> XlaClusterOutput -> NodeA + // The output graph of this function would look like the following when + // add_edges_to_output_of_downstream_nodes is true: + // XlaLaunch -> NodeA + static Status BuildXlaLaunchOps( + Graph* graph, + const std::function(const Node&)>& is_xla_launch_node, + const std::function(const Node&)>& + get_xla_function_info, + bool add_edges_to_output_of_downstream_nodes); +}; + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_JIT_ENCAPSULATE_XLA_COMPUTATIONS_PASS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/extract_outside_compilation_pass.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/extract_outside_compilation_pass.h new file mode 100644 index 0000000000000000000000000000000000000000..cdf2acca9f386ae35be8dbbecccd1336031f958b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/extract_outside_compilation_pass.h @@ -0,0 +1,111 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_JIT_EXTRACT_OUTSIDE_COMPILATION_PASS_H_ +#define TENSORFLOW_COMPILER_JIT_EXTRACT_OUTSIDE_COMPILATION_PASS_H_ + +#include "absl/types/optional.h" +#include "tensorflow/compiler/jit/encapsulate_util.h" +#include "xla/status_macros.h" +#include "tensorflow/core/graph/graph.h" + +namespace tensorflow { + +// Rewrite function for outside compilation subgraphs. It will perform the +// following steps: +// +// 1. Add a XLA computation key placeholder node (it will be used as input for +// XlaRecvAtHost and XlaSendFromHost); +// 2. Replace all _Arg nodes with one single XlaRecvAtHost node; +// 3. Replace all _Retval nodes with one single XlaSendFromHost node; +// 4. Mark all nodes except key placeholder with attr `xla_cluster_attr_name` +// and `outside_compilation_attr_name`; +// 5. For nodes marked with attr kXlaConnectedToXlaComputationAttrName, add a +// control edge from the node to XlaSendFromHost; for nodes marked with attr +// kXlaConnectedFromXlaComputationAttrName, add a control edge from +// XlaRecvAtHost node to the node; +// 6. Try pruning XlaRecvAtHost/XlaSendFromHost/key placeholder node. +// 7. Add necessary attributes to `node_def`, so we can replace it with a +// XlaHostCompute node later. If all input shapes for XlaSendFromHost are +// known, "shapes" attr will be set to the list of input shapes; otherwise +// "shape_inference_graph" attr will be set to shape inference function name. +class RewriteOutsideCompilationSubgraphFn { + public: + RewriteOutsideCompilationSubgraphFn( + const string& xla_cluster_attr_name, + const string& outside_compilation_attr_name, + const string& xla_cluster_name, const string& new_function_name) + : xla_cluster_attr_name_(xla_cluster_attr_name), + outside_compilation_attr_name_(outside_compilation_attr_name), + xla_cluster_name_(xla_cluster_name), + new_function_name_(new_function_name) {} + + Status operator()(const std::vector&, + std::unique_ptr* graph, + std::vector* input_permutation, + std::vector* output_permutation, NodeDef* node_def); + + private: + string xla_cluster_attr_name_; + string outside_compilation_attr_name_; + string xla_cluster_name_; + string new_function_name_; +}; + +// For an XLA computation function, replace all outside compilations with +// XlaHostCompute nodes. Each outside compilation subgraph will be rewritten by +// `RewriteOutsideCompilationSubgraphFn`, and they will be merged into one +// single host side graph (`host_graph`). +// +// xla_cluster_attr_name and outside_compilation_attr_name: attr name for XLA +// computation and outside compilation. Required for +// `RewriteOutsideCompilationSubgraphFn`. +// xla_cluster_name: XLA cluster name for this XLA computation. We need it +// because XLA cluster name might be different from `func_name`. +// func_name_attrs: they will be used to instantiate the XLA computation func. +// new_func_name: new function name for rewritten XLA computation func. +// host_compute_core: mapping from outside compilation cluster name to XLA +// device assignment. +// fld: FunctionLibraryDefinition object. +// host_graph: Graph object to store host side graph for all outside +// compilations within this XLA computation func. If there is no outside +// compilation, it will be empty. +// shape_inference_graphs: a list of outside compilation shape inference +// function names. These functions need to be rewritten later. +// has_outside_compilation: a bool indicating whether this function has any +// outside compilation nodes. +Status ExtractOutsideCompilationForFunction( + const string& xla_cluster_attr_name, + const string& outside_compilation_attr_name, const string& xla_cluster_name, + const NameAttrList& func_name_attrs, const string& new_func_name, + const string& host_graph_func_name, + const std::map& host_compute_core, FunctionLibraryRuntime* flr, + FunctionLibraryDefinition* fld, std::vector* shape_inference_graphs, + bool* has_outside_compilation); + +// Rewrites XLA computation in `clusters` to replace outside compilation nodes +// with XlaHostCompute, and moves those outside compilations into `g`. If shapes +// of outside compilation outputs cannot be determined now, we will store shape +// inference graph into `fld`. +Status ExtractOutsideCompilation( + const string& xla_cluster_attr_name, + const string& outside_compilation_attr_name, + const std::unordered_map& clusters, Graph* g, + FunctionLibraryRuntime* flr, FunctionLibraryDefinition* fld, + bool* modified); + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_JIT_EXTRACT_OUTSIDE_COMPILATION_PASS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/flags.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/flags.h new file mode 100644 index 0000000000000000000000000000000000000000..04a15136d43072a742327ccd021d3d2e50ea1a14 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/flags.h @@ -0,0 +1,357 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_JIT_FLAGS_H_ +#define TENSORFLOW_COMPILER_JIT_FLAGS_H_ + +#include +#include +#include +#include + +#include "absl/container/flat_hash_set.h" +#include "absl/types/optional.h" +#include "tensorflow/core/framework/types.h" +#include "tensorflow/core/platform/types.h" +#include "tensorflow/core/protobuf/config.pb.h" +#include "tensorflow/core/util/command_line_flags.h" + +namespace tensorflow { + +struct XlaAutoJitFlag { + // Control compilation of operators into XLA computations on CPU and GPU + // devices. 0 = use ConfigProto setting; -1 = off; 1 = on for things very + // likely to be improved; 2 = on for everything. + // + // If all non-CPU ops in the graph being optimized are placed on a single GPU + // and there is at least one node placed on that GPU then + // `optimization_level_single_gpu` applies. Otherwise + // `optimization_level_general` applies. + // + // Experimental. + int32 optimization_level_single_gpu; + int32 optimization_level_general; +}; + +// Sets the xla_auto_jit_flag based on the given flag string. Supported syntax +// is: +// : sets general and single_gpu setting to the provided number. +// single-gpu(): sets the single_gpu setting to the provided number. +bool SetXlaAutoJitFlagFromFlagString(const string& value); + +// Flags associated with the XLA bridge's mark_for_compilation_pass module. +struct MarkForCompilationPassFlags { + XlaAutoJitFlag xla_auto_jit_flag; + + // Minimum number of operators in an XLA compilation. Ignored for operators + // placed on an XLA device or operators explicitly marked for compilation. + int32 tf_xla_min_cluster_size; + + // Maximum number of operators in an XLA compilation. + int32 tf_xla_max_cluster_size; + + // If non-empty, limit XLA clustering to the following TF operations. + string tf_xla_ops_to_cluster; + + // If non-empty, remove following operations from XLA clustering excludelist. + string tf_xla_cluster_exclude_ops; + + // Dump graphs during XLA compilation. + bool tf_xla_clustering_debug; + + // Enables global JIT compilation for CPU via SessionOptions. + bool tf_xla_cpu_global_jit; + + // "Compiler fuel" for clustering. Only this many ops will be marked as + // eligible for clustering. + int64_t tf_xla_clustering_fuel; + + // If tf_xla_disable_deadness_safety_checks_for_debugging is set to true then + // we do not do deadness related safety checks. This is unsound in general, + // but can be used as a debugging aid. + bool tf_xla_disable_deadness_safety_checks_for_debugging; + + // If tf_xla_disable_resource_variable_safety_checks_for_debugging is set to + // true then we do not do safety checks to preserve TensorFlow's resource + // variable concurrency semantics. This is unsound in general, but can be + // used as a debugging aid. + bool tf_xla_disable_resource_variable_safety_checks_for_debugging; + + // If true names of clustered operations will be computed deterministically + // so that they remain stable from run to run of auto clusteing. + bool tf_xla_deterministic_cluster_names; + + // If non-empty, JIT-compiled executables are saved to and loaded from the + // specified file system directory path. + std::string tf_xla_persistent_cache_directory; + + // If non-empty, the persistent cache will only be used for the specified + // devices (comma separated). Each device type should be able to be converted + // to `DeviceType`. + std::string tf_xla_persistent_cache_device_types; + + bool tf_xla_persistent_cache_read_only; + + // If true, entries loaded into the XLA compile cache will not have their + // signatures checked strictly. This should generally not be disabled except + // for debugging. Defaults to false. + bool tf_xla_disable_strict_signature_checks; + + // Specifies the persistance cache prefix. Default is "xla_compile_cache" + string tf_xla_persistent_cache_prefix; +}; + +// Flags associated with XLA Sparse Core. +struct XlaSparseCoreFlags { + // Max level of division to split input data into minibatches. + int tf_xla_sparse_core_minibatch_max_division_level; + + // Disable table stacking for all the tables passed to the SparseCore + // mid level API. + bool tf_xla_sparse_core_disable_table_stacking; + + // If non-zero, limits the size of the activations for a given table to + // be below these many bytes. + int64_t tf_xla_sparse_core_stacking_mem_limit_bytes; + + // If non-zero, limits the size of any table shard to be below these + // many bytes. + int64_t tf_xla_sparse_core_stacking_table_shard_limit_bytes; +}; + +// Flags associated with the XLA bridge's xla_device module. +struct XlaDeviceFlags { + // Switch the CPU device into "on-demand" mode, where instead of + // auto-clustering ops are compiled one by one just-in-time. + // Enabling this mode by a legacy flag is a temporary mechanism. When this + // feature is battle-tested, we will switch this to be a session option. + bool tf_xla_compile_on_demand; + + // Enables "XLA" devices if this flag is set. + bool tf_xla_enable_xla_devices; +}; + +// Flags common to the _Xla* ops and their kernels. +struct XlaOpsCommonFlags { + // If true, _XlaCompile always refuses to compile the cluster, which means the + // XLA clusters always run in the TF executor. Defaults to false. + bool tf_xla_always_defer_compilation; + // If true, _XlaCompile compiles the cluster asynchronously with respect to + // the main execution. The fallback path is taken while compilation happens. + bool tf_xla_async_compilation; + + class PjRtForSingleDeviceCompilationRollout { + public: + // Allow using Device API (PjRt) for `device_type` in the XlaLaunch op. + // Please note that `enabled_for_xla_launch_` needs to be true in addition + // to the `device_type` being allowed in order to use the Device API for + // single device compilation and execution in the XlaLaunch op. + void AllowForDeviceInXlaLaunch(const DeviceType& device_type) { + xla_launch_allowed_devices_.insert(device_type.type_string()); + } + + bool IsEnabledInXlaLaunchForDevice(const DeviceType& device_type) const { + if (!enabled_for_gpu_ && device_type.type_string() == "GPU") return false; + return enabled_for_all_ || + (enabled_for_xla_launch_ && + xla_launch_allowed_devices_.contains(device_type.type_string())); + } + + // Allow using Device API (PjRt) for `device_type` in the XlaCompileOnDemand + // op. Please note that `enabled_for_compile_on_demand_` needs to be true in + // addition to the `device_type` being allowed in order to use the Device + // API for single device compilation and execution in the XlaCompileOnDemand + // op. + void AllowForDeviceInXlaCompileOnDemand(const DeviceType& device_type) { + xla_compile_on_demand_allowed_devices_.insert(device_type.type_string()); + } + + bool IsEnabledInXlaCompileOnDemandForDevice( + const DeviceType& device_type) const { + if (!enabled_for_gpu_ && device_type.type_string() == "GPU") return false; + return enabled_for_all_ || + (enabled_for_compile_on_demand_ && + xla_compile_on_demand_allowed_devices_.contains( + device_type.type_string())); + } + + // Allow using Device API (PjRt) for `device_type` in the XlaCompile and + // XlaRun ops. Please note that `enabled_for_compile_and_run_` needs to be + // true in addition to the `device_type` being allowed in order to use the + // Device API for single device compilation and execution in the XlaCompile + // and XlaRun ops. + void AllowForDeviceInXlaCompileAndRun(const DeviceType& device_type) { + xla_compile_and_run_allowed_devices_.insert(device_type.type_string()); + } + + bool IsEnabledInXlaCompileAndRunForDevice( + const DeviceType& device_type) const { + if (!enabled_for_gpu_ && device_type.type_string() == "GPU") return false; + return enabled_for_all_ || (enabled_for_compile_and_run_ && + xla_compile_and_run_allowed_devices_.contains( + device_type.type_string())); + } + + bool IsEnabledForGpu() const { return enabled_for_gpu_; } + + // If true, uses Device API (PjRt) for single device compilation and + // execution of functions marked for JIT compilation i.e. jit_compile=True. + // Defaults to false. + bool enabled_for_xla_launch_; + + // If true, uses Device API (PjRt) for compiling and executing ops one by + // one in "on-demand" mode. Defaults to false. + bool enabled_for_compile_on_demand_; + + // If true, uses Device API (PjRt) for compilation and execution when + // auto-clustering is enabled. Defaults to false. + bool enabled_for_compile_and_run_; + + // If true, uses Device API (PjRt) for compilation and execution everywhere + // i.e. for functions marked for JIT compilation, for ops in "on-demand" + // mode and auto-clustering. Defaults to false. + // + // Note that this flag can be overridden by device flag like + // `enabled_for_gpu_` below. + bool enabled_for_all_; + + // If true, enable Device API (PjRt) for TF GPU device. This is a helper + // flag so that individual tests can turn on PjRt for GPU specifically. + // Once the rollout to GPU is complete, this flag can be deprecated. + bool enabled_for_gpu_; + + private: + // Devices for which using Device API (PjRt) is allowed in the XlaLaunch op. + // This can only be modified programmatically. + absl::flat_hash_set xla_launch_allowed_devices_; + // Devices for which using Device API (PjRt) is allowed in the + // XlaCompileOnDemand op. This can only be modified programmatically. + absl::flat_hash_set xla_compile_on_demand_allowed_devices_; + // Devices for which using Device API (PjRt) is allowed in the + // XlaCompile and XlaRun ops. This can only be modified programmatically. + absl::flat_hash_set xla_compile_and_run_allowed_devices_; + } tf_xla_use_device_api; +}; + +// Flags for the XlaCallModule kernel. +struct XlaCallModuleFlags { + // Used by XlaCallModuleOp to specify safety checks to disable. + absl::flat_hash_set disabled_checks; +}; + +// Flags for the build_xla_ops pass. +struct BuildXlaOpsPassFlags { + // Enables lazy compilation for TF/XLA (only when auto-clustering) if true. + // Defaults to true. + bool tf_xla_enable_lazy_compilation; + + // If true then insert Print nodes to print out values produced by XLA + // clusters. Useful for debugging. + bool tf_xla_print_cluster_outputs; + + // If true, insert CheckNumerics nodes for every floating point typed input to + // an XLA cluster. + bool tf_xla_check_cluster_input_numerics; + + // If true, insert CheckNumerics nodes for every floating point typed output + // from an XLA cluster. + bool tf_xla_check_cluster_output_numerics; + + // Disables all constant folding. The primary use for this is for testing to + // guarantee that tests are run on XLA and not on TF's CPU implementation. + bool tf_xla_disable_constant_folding; + + // Disables full embedding pipelining when true. Instead, strict SparseCore + // TensorCore sequencing will be used. + bool tf_xla_disable_full_embedding_pipelining; + + // Force the WhileOps in embedding_pipelining and embedding_sequencing to use + // this many parallel_iterations + int tf_xla_embedding_parallel_iterations; +}; + +// Flags for common MLIR configurations. +struct MlirCommonFlags { + ConfigProto::Experimental::MlirBridgeRollout tf_mlir_enable_mlir_bridge; + + bool tf_mlir_enable_merge_control_flow_pass; + bool tf_mlir_enable_convert_control_to_data_outputs_pass; + bool tf_mlir_enable_strict_clusters; + bool tf_mlir_enable_generic_outside_compilation; + bool tf_mlir_enable_tpu_variable_runtime_reformatting_pass; +}; + +// Flags for the JitRt pipeline -- see tf_jitrt_pipeline.h for details. +struct JitRtFlags { + bool always_specialize; + bool cost_driven_async_parallel_for; + + // Enables tracking of the "live" JitRt queries to, on a crash, identify the + // "query of death". See TfJitRtQueryOfDeathLogger. + bool log_query_of_death; + + // Enable vectorization, which requires tiling and peeling on different ops. + bool vectorize; + + // Enables crash reproducer for JitRt MLIR pass manager. + bool enable_crash_reproducer; +}; + +// Return a pointer to the DumpGraphFlags struct; +// repeated calls return the same pointer. +// This should be called only after Flags::Parse() has returned. + +// Getters for flags structs defined above. The first call to any of these +// parses TF_XLA_FLAGS for all of them. Those functions which return a pointer +// always return the same pointer. +MarkForCompilationPassFlags* GetMarkForCompilationPassFlags(); +BuildXlaOpsPassFlags* GetBuildXlaOpsPassFlags(); +XlaSparseCoreFlags* GetXlaSparseCoreFlags(); +XlaDeviceFlags* GetXlaDeviceFlags(); +XlaOpsCommonFlags* GetXlaOpsCommonFlags(); +XlaCallModuleFlags* GetXlaCallModuleFlags(); + +MlirCommonFlags* GetMlirCommonFlags(); + +void ResetJitCompilerFlags(); + +const JitRtFlags& GetJitRtFlags(); + +// Returns the effective MLIR bridge rollout state based on the flags and the +// optional configuration. +ConfigProto::Experimental::MlirBridgeRollout GetMlirBridgeRolloutState( + std::optional config_proto); + +// Appends the flag definitions associated with +// MarkForCompilationPassFlags/DumpGraphFlags to `flag_list`. +// +// Has the side-effect of parsing TF_XLA_FLAGS if that hasn't happened yet. +void AppendMarkForCompilationPassFlags( + std::vector* flag_list); + +// Disables XLA compilation, forces it to return an error message instead. Can +// be used by a server to ensure that JIT compilation is opt-in. +void DisableXlaCompilation(); + +// Enables XLA compilation. Can be used with `DisableXlaCompilation` to +// enable/disable JIT compilation at different stages. +void EnableXlaCompilation(); + +// Returns `false` unless `DisableXlaCompilation` was called. +bool FailOnXlaCompilation(); + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_JIT_FLAGS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/force_xla_constants_on_host_pass.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/force_xla_constants_on_host_pass.h new file mode 100644 index 0000000000000000000000000000000000000000..d7aaf02a3d2aac8d4ff18e78554dc68c4d3d8f5d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/force_xla_constants_on_host_pass.h @@ -0,0 +1,36 @@ +/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_JIT_FORCE_XLA_CONSTANTS_ON_HOST_PASS_H_ +#define TENSORFLOW_COMPILER_JIT_FORCE_XLA_CONSTANTS_ON_HOST_PASS_H_ + +#include "absl/container/flat_hash_set.h" +#include "tensorflow/compiler/jit/compilability_check_util.h" +#include "tensorflow/core/common_runtime/optimization_registry.h" + +namespace tensorflow { + +// An optimization pass which marks the constants which have to be resolved for +// XLA compilation with `_input_hostmem`. +class ForceXlaConstantsOnHostPass : public GraphOptimizationPass { + public: + ForceXlaConstantsOnHostPass() = default; + + Status Run(const GraphOptimizationPassOptions& options) override; +}; + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_JIT_FORCE_XLA_CONSTANTS_ON_HOST_PASS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/increase_dynamism_for_auto_jit_pass.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/increase_dynamism_for_auto_jit_pass.h new file mode 100644 index 0000000000000000000000000000000000000000..818ca948d64b0353b08f393c3bd7d874c9b2480b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/increase_dynamism_for_auto_jit_pass.h @@ -0,0 +1,57 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_JIT_INCREASE_DYNAMISM_FOR_AUTO_JIT_PASS_H_ +#define TENSORFLOW_COMPILER_JIT_INCREASE_DYNAMISM_FOR_AUTO_JIT_PASS_H_ + +#include "tensorflow/core/common_runtime/optimization_registry.h" + +namespace tensorflow { + +// Increases the amount of "dynamism" representable by XLA clusters by rewriting +// the TensorFlow graph. This pass does the following rewrites: +// +// Slice +// ----- +// +// Slice(op, begin, size ) => +// Slice(op, begin, actual_size(op.shape(), size, begin)); +// _XlaCompileTimeConstantInputs={2} +// +// where +// +// actual_size(op_shape, size, begin)[i] = +// size[i] == -1 ? (op_shape[i] - size[i]) +// : size[i] +// +// This pass, combined with jit/partially_decluster_pass, reduces the number of +// unnecessary cluster recompilations in some common cases. After the rewrite +// shown above jit/partially_decluster_pass extracts the actual_size(...) +// computation to outside the XLA cluster, causing the cluster to be versioned +// only on the actual size of the XlaDynamicSlice. This avoids recompilation +// due to superficial changes that don't affect tensor shapes. +// +// Future Work TODO(b/111210515) +// ----------------------------- +// +// In the future we will also translate StridedSlice and Pad a similar way. +class IncreaseDynamismForAutoJitPass : public GraphOptimizationPass { + public: + Status Run(const GraphOptimizationPassOptions& options) override; +}; + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_JIT_INCREASE_DYNAMISM_FOR_AUTO_JIT_PASS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/kernels/xla_ops.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/kernels/xla_ops.h new file mode 100644 index 0000000000000000000000000000000000000000..4f2cac6cc74c7b913d6bd3574609f119f44fde28 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/kernels/xla_ops.h @@ -0,0 +1,139 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_JIT_KERNELS_XLA_OPS_H_ +#define TENSORFLOW_COMPILER_JIT_KERNELS_XLA_OPS_H_ + +#include + +#include "tensorflow/compiler/jit/device_compiler.h" +#include "tensorflow/compiler/jit/xla_device.h" +#include "tensorflow/compiler/jit/xla_launch_util.h" +#include "tensorflow/compiler/jit/xla_platform_info.h" +#include "xla/stream_executor/tf_allocator_adapter.h" +#include "tensorflow/core/framework/allocator.h" +#include "tensorflow/core/framework/op.h" +#include "tensorflow/core/framework/op_kernel.h" +#include "tensorflow/core/framework/tensor.h" +#include "tensorflow/core/platform/macros.h" +#include "tensorflow/core/util/stream_executor_util.h" + +namespace tensorflow { + + +// XlaLocalLaunchBase is almost the same as XlaLocalLaunchOp. +// The only difference is that it does not require arguments to follow +// the "constants, then regular args, then resources" order. +// It takes vectors of constant and resource arguments explicitly. +// It does not have corresponding OpDef because it is never present +// in the GraphDef. +// Currently, it is used by eager runtime. FunctionLibraryRuntime creates +// this kernel when asked to create a kernel for an XLA-compiled function. +// +// `has_ref_vars`: whether the input computation can have reference variables. +// TODO(cheshire): instead derive this information from the input graph. +class XlaLocalLaunchBase : public AsyncOpKernel { + public: + XlaLocalLaunchBase(OpKernelConstruction* ctx, + const std::vector& constants, + const std::vector& resources, + const NameAttrList& function, bool has_ref_vars); + XlaLocalLaunchBase(const XlaLocalLaunchBase&) = delete; + XlaLocalLaunchBase& operator=(const XlaLocalLaunchBase&) = delete; + ~XlaLocalLaunchBase() override = default; + + void ComputeAsync(OpKernelContext* ctx, DoneCallback done) override; + + protected: + // Indexes of compile-time constant inputs + const std::vector constants_; + // Indexes of resource inputs + const std::vector resources_; + + const NameAttrList function_; + const XlaPlatformInfo platform_info_; + + bool has_ref_vars_; +}; + +// XlaLocalLaunchOp is used to replace a region of the TensorFlow graph +// which will be compiled and executed using XLA. The XlaLocalLaunchOp is +// responsible for handling interactions with the TensorFlow executor. +// Once all inputs are present, and their shapes are known, the op can +// use a 'DeviceCompiler' to compile and execute code which is specific +// to the shapes of input Tensors. +// XlaLocalLaunchOp uses xla::LocalClient::Compile() and +// xla::LocalExecutable::Run(), and passes arguments into/out of XLA in device +// memory. +class XlaLocalLaunchOp : public XlaLocalLaunchBase { + public: + explicit XlaLocalLaunchOp(OpKernelConstruction* ctx); + ~XlaLocalLaunchOp() override; + + private: + TF_DISALLOW_COPY_AND_ASSIGN(XlaLocalLaunchOp); +}; + +class XlaCompileOp : public OpKernel { + public: + explicit XlaCompileOp(OpKernelConstruction* ctx); + + void Compute(OpKernelContext* ctx) override; + + private: + // Indexes of compile-time constant inputs + const std::vector constants_; + // Indexes of resource inputs + const std::vector resources_; + + const NameAttrList function_; + + XlaPlatformInfo platform_info_; + + const bool must_compile_; + + // Whether the graph has TF reference variables. + const bool has_ref_vars_; + + // cannot_compile_cluster_ is set to true if XLA returns an Unimplemented + // error when compiling the cluster this _XlaCompile is supposed to compile. + // If `cannot_compile_cluster_` is true then we avoid compiling this cluster + // on any future calls to _XlaCompile. + bool cannot_compile_cluster_ TF_GUARDED_BY(cannot_compile_cluster_mu_) = + false; + + mutex cannot_compile_cluster_mu_; +}; + +class XlaRunOp : public OpKernel { + public: + explicit XlaRunOp(OpKernelConstruction* ctx); + + void Compute(OpKernelContext* ctx) override; + + private: + const XlaPlatformInfo platform_info_; +}; + +class XlaMergeOp : public OpKernel { + public: + explicit XlaMergeOp(OpKernelConstruction* ctx); + + void Compute(OpKernelContext* ctx) override; +}; + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_JIT_KERNELS_XLA_OPS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/mark_for_compilation_pass.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/mark_for_compilation_pass.h new file mode 100644 index 0000000000000000000000000000000000000000..eb198502d76a973c5241dcc481ac27d3047cf273 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/mark_for_compilation_pass.h @@ -0,0 +1,63 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +// An optimization passes that marks nodes that are to be compiled with +// attribute kXlaClusterAttr. Nodes with the same cluster ID will be compiled +// together. + +#ifndef TENSORFLOW_COMPILER_JIT_MARK_FOR_COMPILATION_PASS_H_ +#define TENSORFLOW_COMPILER_JIT_MARK_FOR_COMPILATION_PASS_H_ + +#include "absl/container/flat_hash_set.h" +#include "tensorflow/compiler/jit/compilability_check_util.h" +#include "tensorflow/core/common_runtime/optimization_registry.h" + +namespace tensorflow { + +// The attribute that marks nodes to be grouped into functions by the +// encapsulate subgraphs pass. +extern const char* const kXlaClusterAttr; + +// Marks a subset of nodes in the graph which are to be clustered +// with an attribute _XlaCluster= so they are picked up by the +// EncapsulateSubgraphsPass. +class MarkForCompilationPass : public GraphOptimizationPass { + public: + MarkForCompilationPass() = default; + + Status Run(const GraphOptimizationPassOptions& options) override; + + private: + Status RunForTest(const GraphOptimizationPassOptions& options, + bool disable_deadness_analysis, + bool deterministic_cluster_names); + + friend class MarkForCompilationPassTestHelper; +}; + +absl::flat_hash_map>* GetAllowlistTable(); + +namespace testing { +// DO NOT USE IN PRODUCTION. +// +// Resets some internal state to let us write reliable unit tests. +void ResetClusterSequenceNumber(); + +// Return a list of operation that we choose not to put into the allowlist. +absl::flat_hash_set GetKnownXLAAllowlistOp(); +} // namespace testing +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_JIT_MARK_FOR_COMPILATION_PASS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/mark_for_compilation_pass_test_helper.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/mark_for_compilation_pass_test_helper.h new file mode 100644 index 0000000000000000000000000000000000000000..327d2eb84509890427ce5851610d9ee71ca6d6eb --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/mark_for_compilation_pass_test_helper.h @@ -0,0 +1,85 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_JIT_MARK_FOR_COMPILATION_PASS_TEST_HELPER_H_ +#define TENSORFLOW_COMPILER_JIT_MARK_FOR_COMPILATION_PASS_TEST_HELPER_H_ + +#include +#include +#include + +#include "tensorflow/compiler/jit/mark_for_compilation_pass.h" + +namespace tensorflow { +class MarkForCompilationPassTestHelper { + public: + struct Options { + bool enable_global_jit; + bool disable_deadness_analysis; + bool enable_cluster_scoping; + bool deterministic_cluster_names; + std::string session_name; // ConfigProto.Experimental.SessionMetadata.name + + Options() + : enable_global_jit(true), + disable_deadness_analysis(true), + enable_cluster_scoping(true), + deterministic_cluster_names(false) {} + + Options WithNoGlobalJit() { + Options copy = *this; + copy.enable_global_jit = false; + return copy; + } + + Options WithDeadnessAnalysis() { + Options copy = *this; + copy.disable_deadness_analysis = false; + return copy; + } + + Options WithNoClusterScoping() { + Options copy = *this; + copy.enable_cluster_scoping = false; + return copy; + } + + Options WithDeterministicClusterNames() { + Options copy = *this; + copy.deterministic_cluster_names = true; + return copy; + } + + Options WithSessionName(std::string name) { + Options copy = *this; + copy.session_name = std::move(name); + return copy; + } + }; + + // Runs the MarkForCompilation pass on `graph` after assigning all nodes in + // `graph` to the CPU device. To make testing easier, ignores device + // registration and _XlaCompile attributes. + static Status MarkForCompilation(std::unique_ptr* graph, + FunctionLibraryDefinition* flib_def, + Options options = Options()); + + // Like `MarkForCompilation` but creates `flib_def` from the op registry. + static Status MarkForCompilation(std::unique_ptr* graph, + Options options = Options()); +}; +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_JIT_MARK_FOR_COMPILATION_PASS_TEST_HELPER_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/partially_decluster_pass.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/partially_decluster_pass.h new file mode 100644 index 0000000000000000000000000000000000000000..cfc4ddb5630bec91d6942c983ce1efae3a735c43 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/partially_decluster_pass.h @@ -0,0 +1,35 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_JIT_PARTIALLY_DECLUSTER_PASS_H_ +#define TENSORFLOW_COMPILER_JIT_PARTIALLY_DECLUSTER_PASS_H_ + +#include "tensorflow/core/common_runtime/optimization_registry.h" + +namespace tensorflow { + +// Clones or moves nodes from within a cluster to outside the cluster if +// profitable. There are two reasons why we do this: +// +// - Reducing device-to-host copies. +// - Reducing the number of XLA recompilations. +class PartiallyDeclusterPass : public GraphOptimizationPass { + public: + Status Run(const GraphOptimizationPassOptions& options) override; +}; + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_JIT_PARTIALLY_DECLUSTER_PASS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/pjrt_base_device.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/pjrt_base_device.h new file mode 100644 index 0000000000000000000000000000000000000000..26c8f88efab54f9542c2c5e60209a3b724845d99 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/pjrt_base_device.h @@ -0,0 +1,111 @@ +/* Copyright 2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_JIT_PJRT_BASE_DEVICE_H_ +#define TENSORFLOW_COMPILER_JIT_PJRT_BASE_DEVICE_H_ + +#include +#include +#include + +#include "tensorflow/compiler/tf2xla/layout_util.h" +#include "tensorflow/core/common_runtime/local_device.h" +#include "tensorflow/core/framework/device_base.h" + +namespace tensorflow { + +// tensorflow::PjRtBaseDevice replaces the deprecated tensorflow::XlaDevice. +// This accelerator agnostic device is mainly used to store metadata. +class PjRtBaseDevice : public LocalDevice { + public: + // Stores metadata about the PjRtBaseDevice. + class Metadata { + public: + Metadata(const DeviceType& jit_device_type, + std::vector + shape_determination_fns) + : jit_device_type_(jit_device_type), + shape_determination_fns_(std::move(shape_determination_fns)) {} + + // The index of the device on this host. + int device_ordinal() const; + + const DeviceType& jit_device_type() const { return jit_device_type_; } + const XlaShapeLayoutHelpers::ShapeDeterminationFns& + default_shape_determination_fns() const { + return shape_determination_fns_.at(0); + } + + const XlaShapeLayoutHelpers::ShapeDeterminationFns& + shape_determination_fns_at(int i) const { + return shape_determination_fns_[i]; + } + + private: + const DeviceType jit_device_type_; + std::vector + shape_determination_fns_; + + TF_DISALLOW_COPY_AND_ASSIGN(Metadata); + }; + + struct Options { + // The device name's prefix (e.g., "/task:7") + std::string device_name_prefix; + + // The name of the device (e.g., "TPU") + std::string device_name; + + // The index of the device. + int device_ordinal = -1; + + // The name of the compilation device, also referred to as jit_device_type. + // (e.g., "XLA_CPU_JIT"); + std::string compilation_device_name; + + // A vector of ShapeDeterminationFn (i.e., a bundle of LayoutSelectionFn, + // ShapeRepresentationFn). Each bundle describes how the on-host shapes of + // a) argument and return value, for entry computations b) variables, for + // all computations, should be represented in XLA. Parameters/return values + // will be shaped according to the function pair, and reshaped back to/from + // their declared shapes for computations. Must be non-empty. + std::vector + shape_determination_fns; + + Options(std::string device_name_prefix, std::string device_name, + int device_ordinal, std::string compilation_device_name, + std::vector + shape_determination_fns) + : device_name_prefix(device_name_prefix), + device_name(device_name), + device_ordinal(device_ordinal), + compilation_device_name(compilation_device_name), + shape_determination_fns(shape_determination_fns) {} + }; + + // Creates a new PJRT base device. + PjRtBaseDevice(const SessionOptions& session_options, const Options& options); + + static StatusOr GetMetadataFromDevice( + DeviceBase* device); + + private: + // The metadata of this PjRtBaseDevice. + const Metadata metadata_; +}; + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_JIT_PJRT_BASE_DEVICE_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/pjrt_compile_util.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/pjrt_compile_util.h new file mode 100644 index 0000000000000000000000000000000000000000..d3ba6b7e2d0208c87649ed1cba9b493a31a5ce6b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/pjrt_compile_util.h @@ -0,0 +1,60 @@ +/* Copyright 2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ +#ifndef TENSORFLOW_COMPILER_JIT_PJRT_COMPILE_UTIL_H_ +#define TENSORFLOW_COMPILER_JIT_PJRT_COMPILE_UTIL_H_ + +#include "tensorflow/compiler/jit/xla_compile_util.h" +#include "tensorflow/compiler/jit/xla_platform_info.h" +#include "tensorflow/compiler/tf2xla/xla_compiler.h" +#include "xla/pjrt/pjrt_client.h" +#include "tensorflow/core/framework/device_base.h" +#include "tensorflow/core/framework/op_kernel.h" +#include "tensorflow/core/framework/resource_mgr.h" +#include "tensorflow/core/platform/status.h" + +namespace tensorflow { + +// Compiles a `function` to PjRtLoadedExecutable `executable` with `ctx`. +// The compilation result is output in `compilation_result`. The PJRT client +// used for compilation is output in `client`. The PJRT executable is output in +// `executable`. +Status CompileToPjRtLoadedExecutable( + const OpKernelContext& ctx, const XlaPlatformInfo& platform_info, + const NameAttrList& function, + const std::vector& args, + DeviceCompileMode compile_mode, bool has_ref_vars, + bool may_alias_resource_update, + const XlaCompiler::CompilationResult** compilation_result, + xla::PjRtClient** client, xla::PjRtLoadedExecutable** executable); + +// Similar to the above function but it does not take a OpKernelContext. +// Instead, it takes the following arguments that are obtained from +// OpKernelContext in the above function. +// - `device`: the device used to compile the function. +// - `rm`: the resource manager for DeviceCompiler to store JIT-compiled XLA +// computation. +// - `flr`: the FunctionLibraryRuntime for the `function`. +Status CompileToPjRtLoadedExecutable( + const DeviceBase* device, const XlaPlatformInfo& platform_info, + const NameAttrList& function, + const std::vector& args, + DeviceCompileMode compile_mode, bool has_ref_vars, + bool may_alias_resource_update, FunctionLibraryRuntime* flr, + ResourceMgr* rm, const XlaCompiler::CompilationResult** compilation_result, + xla::PjRtClient** client, xla::PjRtLoadedExecutable** executable); + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_JIT_PJRT_COMPILE_UTIL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/pjrt_device_compiler_client.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/pjrt_device_compiler_client.h new file mode 100644 index 0000000000000000000000000000000000000000..2e46cdd81842e8f586920d7304ca1bfd558750dd --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/pjrt_device_compiler_client.h @@ -0,0 +1,79 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_JIT_PJRT_DEVICE_COMPILER_CLIENT_H_ +#define TENSORFLOW_COMPILER_JIT_PJRT_DEVICE_COMPILER_CLIENT_H_ + +#include +#include +#include + +#include "tensorflow/compiler/jit/device_compiler_client.h" +#include "xla/pjrt/pjrt_client.h" + +namespace tensorflow { + +// Calls into PjRtClient to provide functionality for building, serializing and +// loading PjRtLoadedExecutables. +class PjRtDeviceCompilerClient + : public DeviceCompilerClient { + public: + explicit PjRtDeviceCompilerClient(xla::PjRtClient* client) + : client_(client) {} + + StatusOr> BuildExecutable( + const XlaCompiler::Options& options, + const XlaCompiler::CompilationResult& result) override; + + // Returns a platform-specific serialization of `executable`. The + // serialization is not guaranteed to be stable over time. `executable` must + // have been produced by this client. + StatusOr SerializeExecutable( + const xla::PjRtLoadedExecutable& executable) override; + + // PjRt doesn't support AOT compilation yet. Builds a PjRtLoadedExecutable and + // serializes it to string. + StatusOr BuildSerializedExecutable( + const XlaCompiler::Options& options, + const XlaCompiler::CompilationResult& result) override; + + // Deserializes a serialized executable as produced by + // PjRtExecutable::SerializeExecutable(). `serialized_executable` must have + // been produced by a compiler of the same platform and version as this one. + // + // PjRt doesn't support AOT compilation yet. Loading a serialized executable + // is currently only implemented for TfrtTpuPjrtClient and hence, this + // function doesn't use PjRtClient::LoadSerializedExecutable() and uses + // PjRtClient::DeserializeExecutable() instead. + StatusOr> LoadExecutable( + const XlaCompiler::Options& options, + const XlaCompiler::CompilationResult& result, + const std::string& serialized_executable) override; + + // No-op. PJRT uses futures and waiting for programs to finish isn't + // necessary. + void WaitForProgramsToFinish() override; + + xla::PjRtClient* client() const override { return client_; } + + private: + xla::PjRtClient* const client_; + + TF_DISALLOW_COPY_AND_ASSIGN(PjRtDeviceCompilerClient); +}; + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_JIT_PJRT_DEVICE_COMPILER_CLIENT_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/pjrt_device_context.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/pjrt_device_context.h new file mode 100644 index 0000000000000000000000000000000000000000..7637d396bd07064261d904ae3d97f46a2bf66c87 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/pjrt_device_context.h @@ -0,0 +1,64 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_JIT_PJRT_DEVICE_CONTEXT_H_ +#define TENSORFLOW_COMPILER_JIT_PJRT_DEVICE_CONTEXT_H_ + +#include + +#include "tensorflow/compiler/tf2xla/layout_util.h" +#include "tensorflow/core/framework/device_base.h" +#include "tensorflow/core/platform/status.h" + +namespace tensorflow { + +// Helper class for managing data transfers between host and accelerator +// devices using PjRt. +class PjRtDeviceContext : public DeviceContext { + public: + explicit PjRtDeviceContext( + XlaShapeLayoutHelpers::ShapeDeterminationFns shape_determination_fns, + bool use_pjrt_tensor_buffer = false) + : shape_determination_fns_(std::move(shape_determination_fns)), + use_pjrt_tensor_buffer_(use_pjrt_tensor_buffer) {} + + void CopyCPUTensorToDevice(const Tensor* cpu_tensor, Device* device, + Tensor* device_tensor, StatusCallback done, + bool sync_dst_compute) const override; + void CopyDeviceTensorToCPU(const Tensor* device_tensor, + absl::string_view tensor_name, Device* device, + Tensor* cpu_tensor, StatusCallback done) override; + void CopyTensorInSameDevice(const Tensor* input_tensor, Device* device, + Tensor* output_tensor, + StatusCallback done) const override; + + bool use_pjrt_tensor_buffer() const { return use_pjrt_tensor_buffer_; } + + private: + XlaShapeLayoutHelpers::ShapeDeterminationFns shape_determination_fns_; + // Note: we currently assume the PjRtBuffer is a PjRtStreamExecutorBuffer. + bool use_pjrt_tensor_buffer_; +}; + +void PjRtDeviceToDeviceCopy(DeviceContext* send_dev_context, + DeviceContext* recv_dev_context, Device* src, + Device* dst, AllocatorAttributes src_alloc_attr, + AllocatorAttributes dst_alloc_attr, + const Tensor* input, Tensor* output, + int dev_to_dev_stream_index, StatusCallback done); + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_JIT_PJRT_DEVICE_CONTEXT_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/pjrt_tensor_buffer.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/pjrt_tensor_buffer.h new file mode 100644 index 0000000000000000000000000000000000000000..0dd496c9ae02c7e2bef8448bcfabe34d674c5111 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/pjrt_tensor_buffer.h @@ -0,0 +1,57 @@ +/* Copyright 2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_JIT_PJRT_TENSOR_BUFFER_H_ +#define TENSORFLOW_COMPILER_JIT_PJRT_TENSOR_BUFFER_H_ + +#include +#include + +#include "xla/pjrt/pjrt_client.h" +#include "tensorflow/core/framework/allocation_description.pb.h" +#include "tensorflow/core/framework/tensor.h" + +namespace tensorflow { + +// PjRtTensorBuffer is derived from TensorBuffer, which holds a device memory +// pointer so that legacy TF kernel can access it directly. PjRtTensorBuffer +// also owns a PjRtBuffer for XLA kernel's usage. +class PjRtTensorBuffer : public TensorBuffer { + public: + PjRtTensorBuffer(const void* ptr, size_t expected_size, + std::unique_ptr pjrt_buffer) + : TensorBuffer(const_cast(ptr)), + expected_size_(expected_size), + pjrt_buffer_(std::move(pjrt_buffer)) {} + + size_t size() const override { return expected_size_; } + + TensorBuffer* root_buffer() override { return this; } + + xla::PjRtBuffer* pjrt_buffer() const { return pjrt_buffer_.get(); } + + // TODO(b/288965065): Implement this. + void FillAllocationDescription(AllocationDescription* proto) const override { + proto->set_requested_bytes(static_cast(expected_size_)); + } + + private: + size_t expected_size_; + std::unique_ptr pjrt_buffer_; +}; + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_JIT_PJRT_TENSOR_BUFFER_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/pjrt_tensor_buffer_util.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/pjrt_tensor_buffer_util.h new file mode 100644 index 0000000000000000000000000000000000000000..f73834b54ff1e4262292b5c88d55a38ce3845d09 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/pjrt_tensor_buffer_util.h @@ -0,0 +1,56 @@ +/* Copyright 2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_JIT_PJRT_TENSOR_BUFFER_UTIL_H_ +#define TENSORFLOW_COMPILER_JIT_PJRT_TENSOR_BUFFER_UTIL_H_ + +#include + +#include "absl/status/statusor.h" +#include "tensorflow/compiler/jit/pjrt_tensor_buffer.h" +#include "xla/pjrt/pjrt_client.h" +#include "tensorflow/core/framework/tensor.h" +#include "tensorflow/core/framework/tensor_shape.h" + +namespace tensorflow { + +// Takes the device memory pointer from the PjRtBuffer and create a Tensor that +// contains a PjRtTensorBuffer. The PjRtTensorBuffer holds the pointer to the +// device memory. It also owns the PjRtBuffer. +// +// TODO(b/289001822): Create a unit test to cover this function. +absl::StatusOr MakeTensorFromPjRtBuffer( + DataType dtype, const TensorShape& shape, + std::unique_ptr pjrt_buffer); + +// For TensorFlow internal use only. +class PjRtTensorBufferUtil { + public: + // Takes the device memory pointer from the PjRtBuffer and create a + // PjRtTensorBuffer. The PjRtTensorBuffer holds the pointer to the device + // memory. It also owns the PjRtBuffer. If output_tensor does not use + // PjRtTensorBuffer and the opaque device memory is the same, update the + // output_tensor->buf_ so that the same device memory will not be double-free. + // Otherwise a new Tensor will be created with the PjRtTensorBuffer. + // + // TODO(b/289001822): Create a unit test to cover this function. + static absl::Status UpdateOrMakeTensorWithPjRtBuffer( + DataType dtype, const TensorShape& shape, + std::unique_ptr pjrt_buffer, Tensor* output_tensor); +}; + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_JIT_PJRT_TENSOR_BUFFER_UTIL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/report_clustering_info_pass.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/report_clustering_info_pass.h new file mode 100644 index 0000000000000000000000000000000000000000..97471cff134aecf63584c2b4bd954eb60505c7e9 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/report_clustering_info_pass.h @@ -0,0 +1,32 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_JIT_REPORT_CLUSTERING_INFO_PASS_H_ +#define TENSORFLOW_COMPILER_JIT_REPORT_CLUSTERING_INFO_PASS_H_ + +#include "tensorflow/core/common_runtime/optimization_registry.h" + +namespace tensorflow { + +// This is not really an optimization pass. It does not change the graph in any +// way; instead it computes a summary of the XLA clusters in the graph and +// broadcasts it via xla_activity_listener. +class ReportClusteringInfoPass : public GraphOptimizationPass { + public: + Status Run(const GraphOptimizationPassOptions& options) override; +}; +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_JIT_REPORT_CLUSTERING_INFO_PASS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/resource_operation_safety_analysis.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/resource_operation_safety_analysis.h new file mode 100644 index 0000000000000000000000000000000000000000..436c4be0f35c0aed66aaf15a8795f9fe15ea18e8 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/resource_operation_safety_analysis.h @@ -0,0 +1,68 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_JIT_RESOURCE_OPERATION_SAFETY_ANALYSIS_H_ +#define TENSORFLOW_COMPILER_JIT_RESOURCE_OPERATION_SAFETY_ANALYSIS_H_ + +#include "xla/service/graphcycles/graphcycles.h" +#include "tensorflow/core/framework/function.h" +#include "tensorflow/core/graph/graph.h" + +namespace tensorflow { +// An XLA cluster hoists all resource reads to be beginning of the cluster +// execution and all the resource writes to the end. This means it cannot +// enforce arbitrary ordering dependencies (via control or data edges) between +// resource operations. Since all resource reads happen before all resource +// writes, edges constraining resource writes to happen before resource reads +// are problematic. This analysis returns the set of pairs of resource +// operations that cannot be put in the same cluster because XLA cannot respect +// the dependencies between them in the TensorFlow program. +// +// The restrictions are not transitive: it is fine to put A and C in the same +// cluster even if the returned set contains (A,B) and (B,C). +// +// In other words, if these pairs are seen as edges in an undirected graph of +// the nodes in `g` then auto-clustering is at least as constrained as the graph +// coloring problem on this graph. +// +// +// For instance if we auto-cluster all operations in this TensorFlow graph: +// +// AssignVariablepOp0 -> AssignVariableOp1 +// | +// v +// ReadVariableOp0 -> ReadVariableOp1 +// +// we will lose the AssignVariablepOp1 -> ReadVariableOp0. The ReadVariableOp0 +// -> ReadVariableOp1 and AssignVariableOp0 -> AssignVariableOp1 edges will be +// respected by XlaLaunchOp though because all reads happen before all writes +// with that limited clustering.. +// +// +// NB! The result computed by this analysis assumes that we don't auto-cluster +// back-edges (i.e. the edges from NextIteration to Merge). +// +// NB! The result computed by this analysis assumes that we don't auto-cluster +// functional control flow nodes containing resource operations. +// +// If `resource_ops_to_ignore` is set then nodes for which it returns true are +// ignored (we pretend these nodes are not resource operations). +Status ComputeIncompatibleResourceOperationPairs( + const Graph& g, const FunctionLibraryDefinition* flib_def, + const std::function& resource_ops_to_ignore, + std::vector>* result); +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_JIT_RESOURCE_OPERATION_SAFETY_ANALYSIS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/shape_inference.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/shape_inference.h new file mode 100644 index 0000000000000000000000000000000000000000..48a9cfd79d849728ffded21b4de1cb5405c24838 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/shape_inference.h @@ -0,0 +1,54 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_JIT_SHAPE_INFERENCE_H_ +#define TENSORFLOW_COMPILER_JIT_SHAPE_INFERENCE_H_ + +#include +#include + +#include "xla/statusor.h" +#include "tensorflow/core/common_runtime/optimization_registry.h" +#include "tensorflow/core/common_runtime/shape_refiner.h" +#include "tensorflow/core/lib/core/status.h" + +namespace tensorflow { + +struct InferredShape { + // Shape of the argument tensor. + PartialTensorShape shape; + + // If the argument is a resource variable, the type and shape of the + // variable's value. + DataType handle_type = DT_INVALID; + PartialTensorShape handle_shape; +}; +typedef std::unordered_map> GraphShapeInfo; + +// Infer shapes for all Tensors in a graph, and save them in a map. The vector +// for a Node contains the information about each of its outputs. +// TODO(phawkins): this code does not infer accurate shapes for cyclic graphs. +Status InferShapes(Graph* graph, const std::map& arg_shapes, + const tensorflow::FunctionLibraryDefinition* fnlib_def, + GraphShapeInfo* shape_info); + +// Merges two InferredShapes. Return an error if the two shapes cannot be +// merged. +StatusOr MergeInferredShapes(const InferredShape& a, + const InferredShape& b); + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_JIT_SHAPE_INFERENCE_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/shape_inference_helpers.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/shape_inference_helpers.h new file mode 100644 index 0000000000000000000000000000000000000000..2f053c9a45dd47ca1b056634d2248d6181e77d68 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/shape_inference_helpers.h @@ -0,0 +1,65 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_JIT_SHAPE_INFERENCE_HELPERS_H_ +#define TENSORFLOW_COMPILER_JIT_SHAPE_INFERENCE_HELPERS_H_ + +#include + +#include "tensorflow/core/graph/graph.h" + +namespace tensorflow { + +// Helper class to temporarily remove, then replace, the back edges in a +// graph. Simple algorithms for shape inference don't work with cycles, and this +// class can be used to remove cycles before running inference and replace them +// after. Correct usage requires exactly one call to Remove(), followed by any +// number of calls to RemovedEdges() and at most one call to Replace(). The call +// to Replace() is optional if the graph will be discarded without being +// executed, e.g., if it is being used purely for a shape inference pass. +class BackEdgeHelper { + public: + struct BackEdge { + const Edge* edge; + Node* src; + int src_output; + Node* dst; + int dst_input; + }; + + BackEdgeHelper() = default; + // Disallows copy and assign. + BackEdgeHelper(const BackEdgeHelper& other) = delete; + BackEdgeHelper& operator=(const BackEdgeHelper& other) = delete; + + // Temporarily removes all the back edges in graph. + Status Remove(Graph* graph); + + // Gets the list of removed edges. + const std::vector& RemovedEdges() const; + + // Replaces the back edges removed by a prior call to Remove. + Status Replace(); + + private: + Graph* graph_ = nullptr; // not owned + std::vector back_edges_; + // Set once Replace has been called. + bool replaced_ = false; +}; + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_JIT_SHAPE_INFERENCE_HELPERS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/tf_graph_to_hlo_compiler.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/tf_graph_to_hlo_compiler.h new file mode 100644 index 0000000000000000000000000000000000000000..c927a90486b88eaea92faa078b9351232f29c6a3 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/tf_graph_to_hlo_compiler.h @@ -0,0 +1,59 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_JIT_TF_GRAPH_TO_HLO_COMPILER_H_ +#define TENSORFLOW_COMPILER_JIT_TF_GRAPH_TO_HLO_COMPILER_H_ + +#include +#include + +#include "tensorflow/compiler/jit/tf_to_hlo_compiler.h" +#include "tensorflow/compiler/tf2xla/xla_compiler.h" +#include "tensorflow/compiler/tf2xla/xla_helpers.h" + +namespace tensorflow { + +class TfGraphToHloCompiler : public TfToHloCompiler { + public: + TfGraphToHloCompiler() = delete; + + explicit TfGraphToHloCompiler(const XlaCompiler::Options& options) + : xla_compiler_(options) {} + + // Compiles a Tensorflow `function` into an HloModuleProto stored in the + // XlaCompilationResult pointed to by `result` by calling + // XlaCompiler::CompileFunction. + Status Compile(const XlaCompiler::CompileOptions& options, + const NameAttrList& function, + absl::Span args, + XlaCompilationResult* result) override; + + // Compiles a Tensorflow single op into an HloModuleProto stored in the + // XlaCompilationResult pointed to by `result` by calling + // XlaCompiler::CompileSingleOp. + Status CompileSingleOp(const XlaCompiler::CompileOptions& options, + const OpKernelContext* ctx, + absl::Span args, + XlaCompilationResult* result) override; + + private: + XlaCompiler xla_compiler_; + + TF_DISALLOW_COPY_AND_ASSIGN(TfGraphToHloCompiler); +}; + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_JIT_TF_GRAPH_TO_HLO_COMPILER_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/tf_to_hlo_compiler.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/tf_to_hlo_compiler.h new file mode 100644 index 0000000000000000000000000000000000000000..cf6245639f270f1a437ccf313c72f6c2f31e1747 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/tf_to_hlo_compiler.h @@ -0,0 +1,52 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_JIT_TF_TO_HLO_COMPILER_H_ +#define TENSORFLOW_COMPILER_JIT_TF_TO_HLO_COMPILER_H_ + +#include +#include + +#include "tensorflow/compiler/tf2xla/xla_compiler.h" +#include "tensorflow/core/framework/op_kernel.h" + +namespace tensorflow { + +class TfToHloCompiler { + public: + TfToHloCompiler() = default; + virtual ~TfToHloCompiler() = default; + + // Compiles a Tensorflow `function` to an HloModuleProto stored in the + // XlaCompilationResult pointed to by `result`. + virtual Status Compile(const XlaCompiler::CompileOptions& options, + const NameAttrList& function, + absl::Span args, + XlaCompilationResult* result) = 0; + + // Compiles a Tensorflow single op to an HloModuleProto stored in the + // XlaCompilationResult pointed to by `result`. + virtual Status CompileSingleOp(const XlaCompiler::CompileOptions& options, + const OpKernelContext* ctx, + absl::Span args, + XlaCompilationResult* result) = 0; + + private: + TF_DISALLOW_COPY_AND_ASSIGN(TfToHloCompiler); +}; + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_JIT_TF_TO_HLO_COMPILER_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/variable_info.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/variable_info.h new file mode 100644 index 0000000000000000000000000000000000000000..9294c5e48ad8e73ea8db0f954a1d29a5789ff0de --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/variable_info.h @@ -0,0 +1,95 @@ +/* Copyright 2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_JIT_VARIABLE_INFO_H_ +#define TENSORFLOW_COMPILER_JIT_VARIABLE_INFO_H_ + +#include +#include +#include +#include + +#include "tensorflow/core/framework/resource_var.h" +#include "tensorflow/core/framework/tensor.h" +#include "tensorflow/core/lib/core/status.h" +#include "tensorflow/core/platform/thread_annotations.h" + +namespace tensorflow { + +// Information about the state of a variable passed as input to the _XlaCompile +// and _XlaRun operators. Unlocks the resource variable and decrements its +// refcount on destruction. +class VariableInfo { + public: + explicit VariableInfo(int index, absl::string_view name, Var* var, + const std::optional& + definition_stack_trace = std::nullopt); + VariableInfo(VariableInfo&& other); + + VariableInfo& operator=(VariableInfo&& other); + + VariableInfo(const VariableInfo&) = delete; + VariableInfo& operator=(const VariableInfo&) = delete; + + // The index of the DT_RESOURCE input to the _XlaCompile/_XlaRun operator. + // Note that the indices can be different between _XlaCompile and _XlaRun. + int index() const { return index_; } + + // A pointer to the resource variable. May be null if this VariableInfo is + // "empty", i.e. it does not track a resource variable. + Var* var() const { return var_; } + + // Returns the variable name. + absl::string_view name() const { return name_; } + + // Returns true if the resource variable lock was successfully acquired by + // this thread. + bool lock_held() const { return lock_held_; } + void set_lock_held() { lock_held_ = true; } + + // Returns true if the resource variable reader lock was successfully acquired + // by this thread. + bool shared_lock_held() const { return shared_lock_held_; } + void set_shared_lock_held() { shared_lock_held_ = true; } + + bool read_only() const { return read_only_; } + void set_read_only() { read_only_ = true; } + + const std::optional& definition_stack_trace() const { + return definition_stack_trace_; + } + + ~VariableInfo(); + + private: + int index_; + std::string name_; + Var* var_; + std::optional definition_stack_trace_; + + // We can't use a optional here because it confuses the compiler's + // thread safety analysis. Instead we use a boolean flag and release the lock + // in the VariableInfo destructor. + bool lock_held_ = false; + bool shared_lock_held_ = false; + + // Whether this variable is going to be mutated. Left false if the caller + // doesn't provide this information. + bool read_only_ = false; +}; + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_JIT_VARIABLE_INFO_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/variable_info_util.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/variable_info_util.h new file mode 100644 index 0000000000000000000000000000000000000000..386a4f3755633c71fab8fb098bd78e1b550cf597 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/variable_info_util.h @@ -0,0 +1,93 @@ +/* Copyright 2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_JIT_VARIABLE_INFO_UTIL_H_ +#define TENSORFLOW_COMPILER_JIT_VARIABLE_INFO_UTIL_H_ + +#include +#include +#include +#include + +#include "tensorflow/compiler/jit/variable_info.h" +#include "tensorflow/core/framework/resource_mgr.h" +#include "tensorflow/core/framework/tensor.h" +#include "tensorflow/core/lib/core/status.h" +#include "tensorflow/core/platform/thread_annotations.h" + +namespace tensorflow { + +// Snapshot of resource variables for a TF kernel invocation, mapping from +// parameter number to values at execution time. If the resource variable is not +// initialized, the value will not be present. +using ResourceVarsSnapshot = absl::flat_hash_map>; + +// Takes a snapshot of the values of resource variable arguments, whose indices +// are specified in `variable_indices` argument. We snapshot tensors that back +// resource variables since concurrent updates may modify the shape, and it is +// important that the shapes used for compilation match the true shapes of the +// buffers. +// +// We snapshot the entire set of resource variables as one atomic operation. +// This models Read->* dependencies between resource variable operations. See +// jit/resource_operation_safety_analysis for details. +Status SnapshotResourceVariables(OpKernelContext* ctx, + absl::Span variable_indices, + absl::Span variable_infos, + ResourceVarsSnapshot* result); + +// Acquires the mutexes for all the variables in `variables` using a +// deadlock-safe protocol (acquire the mutexes in increasing-address order). +// +// `variables` is allowed to contain instances that don't track a resource +// variable (i.e. variables[i].var() can be null for some i). +// +// If the variable is read_only(), only acquires reader locks. +Status LockVariables(absl::Span variables) + TF_EXCLUSIVE_LOCK_FUNCTION(); +Status LockVariables(absl::Span variables) + TF_EXCLUSIVE_LOCK_FUNCTION(); + +// Returns a vector of VariableInfo instances for the resource variable inputs, +// given that *all* inputs are in `inputs`. The input indices for the resource +// variable inputs are in `variable_indices`. +// +// When using the VariableInfos generated by this version, all variables would +// be writer-locked. +Status GetVariableInfosFromInputs(ResourceMgr* rm, DeviceBase* dev, + absl::Span inputs, + absl::Span variable_indices, + std::vector* result); + +// variables_updated is a set containing the indices of the variables that are +// going to be mutated. If variables_updated is empty, then in LockVariables all +// variables would only be reader-locked. If variables_updated is null, then we +// consider this information unknown and will acquire writer-lock for all +// variables. +Status GetVariableInfosFromInputs(ResourceMgr* rm, DeviceBase* dev, + absl::Span inputs, + absl::Span variable_indices, + const std::set* variables_updated, + std::vector* result); + +std::vector GetResourceVariableIndicesFromContext(OpKernelContext* ctx); + +Status CreateVariableInfoLookup( + absl::Span variable_args, + absl::flat_hash_map& variable_info_lookup); + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_JIT_VARIABLE_INFO_UTIL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/xla_activity.pb.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/xla_activity.pb.h new file mode 100644 index 0000000000000000000000000000000000000000..1bb27a2ad7c64421e72964608e1ff2c0c9e70cee --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/xla_activity.pb.h @@ -0,0 +1,1928 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tensorflow/compiler/jit/xla_activity.proto + +#ifndef GOOGLE_PROTOBUF_INCLUDED_tensorflow_2fcompiler_2fjit_2fxla_5factivity_2eproto +#define GOOGLE_PROTOBUF_INCLUDED_tensorflow_2fcompiler_2fjit_2fxla_5factivity_2eproto + +#include +#include + +#include +#if PROTOBUF_VERSION < 3021000 +#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 3021009 < 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 // IWYU pragma: export +#include // IWYU pragma: export +#include +#include +#include "tensorflow/core/protobuf/config.pb.h" +// @@protoc_insertion_point(includes) +#include +#define PROTOBUF_INTERNAL_EXPORT_tensorflow_2fcompiler_2fjit_2fxla_5factivity_2eproto +PROTOBUF_NAMESPACE_OPEN +namespace internal { +class AnyMetadata; +} // namespace internal +PROTOBUF_NAMESPACE_CLOSE + +// Internal implementation detail -- do not use these members. +struct TableStruct_tensorflow_2fcompiler_2fjit_2fxla_5factivity_2eproto { + static const uint32_t offsets[]; +}; +extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_tensorflow_2fcompiler_2fjit_2fxla_5factivity_2eproto; +namespace tensorflow { +class XlaAutoClusteringActivity; +struct XlaAutoClusteringActivityDefaultTypeInternal; +extern XlaAutoClusteringActivityDefaultTypeInternal _XlaAutoClusteringActivity_default_instance_; +class XlaAutoClusteringSummary; +struct XlaAutoClusteringSummaryDefaultTypeInternal; +extern XlaAutoClusteringSummaryDefaultTypeInternal _XlaAutoClusteringSummary_default_instance_; +class XlaAutoClusteringSummary_Cluster; +struct XlaAutoClusteringSummary_ClusterDefaultTypeInternal; +extern XlaAutoClusteringSummary_ClusterDefaultTypeInternal _XlaAutoClusteringSummary_Cluster_default_instance_; +class XlaAutoClusteringSummary_OpAndCount; +struct XlaAutoClusteringSummary_OpAndCountDefaultTypeInternal; +extern XlaAutoClusteringSummary_OpAndCountDefaultTypeInternal _XlaAutoClusteringSummary_OpAndCount_default_instance_; +class XlaJitCompilationActivity; +struct XlaJitCompilationActivityDefaultTypeInternal; +extern XlaJitCompilationActivityDefaultTypeInternal _XlaJitCompilationActivity_default_instance_; +class XlaOptimizationRemark; +struct XlaOptimizationRemarkDefaultTypeInternal; +extern XlaOptimizationRemarkDefaultTypeInternal _XlaOptimizationRemark_default_instance_; +} // namespace tensorflow +PROTOBUF_NAMESPACE_OPEN +template<> ::tensorflow::XlaAutoClusteringActivity* Arena::CreateMaybeMessage<::tensorflow::XlaAutoClusteringActivity>(Arena*); +template<> ::tensorflow::XlaAutoClusteringSummary* Arena::CreateMaybeMessage<::tensorflow::XlaAutoClusteringSummary>(Arena*); +template<> ::tensorflow::XlaAutoClusteringSummary_Cluster* Arena::CreateMaybeMessage<::tensorflow::XlaAutoClusteringSummary_Cluster>(Arena*); +template<> ::tensorflow::XlaAutoClusteringSummary_OpAndCount* Arena::CreateMaybeMessage<::tensorflow::XlaAutoClusteringSummary_OpAndCount>(Arena*); +template<> ::tensorflow::XlaJitCompilationActivity* Arena::CreateMaybeMessage<::tensorflow::XlaJitCompilationActivity>(Arena*); +template<> ::tensorflow::XlaOptimizationRemark* Arena::CreateMaybeMessage<::tensorflow::XlaOptimizationRemark>(Arena*); +PROTOBUF_NAMESPACE_CLOSE +namespace tensorflow { + +enum XlaOptimizationRemark_Warning : int { + XlaOptimizationRemark_Warning_NONE = 0, + XlaOptimizationRemark_Warning_INACCURATE_OPERATION = 1, + XlaOptimizationRemark_Warning_SLOW_OPERATION = 2, + XlaOptimizationRemark_Warning_UNIMPLEMENTED_OPERATION = 3, + XlaOptimizationRemark_Warning_SLOW_IMAGE_RESIZE_DIMENSIONS = 4, + XlaOptimizationRemark_Warning_MEGAMORPHIC_FUNCTION = 5, + XlaOptimizationRemark_Warning_XlaOptimizationRemark_Warning_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits::min(), + XlaOptimizationRemark_Warning_XlaOptimizationRemark_Warning_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits::max() +}; +bool XlaOptimizationRemark_Warning_IsValid(int value); +constexpr XlaOptimizationRemark_Warning XlaOptimizationRemark_Warning_Warning_MIN = XlaOptimizationRemark_Warning_NONE; +constexpr XlaOptimizationRemark_Warning XlaOptimizationRemark_Warning_Warning_MAX = XlaOptimizationRemark_Warning_MEGAMORPHIC_FUNCTION; +constexpr int XlaOptimizationRemark_Warning_Warning_ARRAYSIZE = XlaOptimizationRemark_Warning_Warning_MAX + 1; + +const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* XlaOptimizationRemark_Warning_descriptor(); +template +inline const std::string& XlaOptimizationRemark_Warning_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function XlaOptimizationRemark_Warning_Name."); + return ::PROTOBUF_NAMESPACE_ID::internal::NameOfEnum( + XlaOptimizationRemark_Warning_descriptor(), enum_t_value); +} +inline bool XlaOptimizationRemark_Warning_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, XlaOptimizationRemark_Warning* value) { + return ::PROTOBUF_NAMESPACE_ID::internal::ParseNamedEnum( + XlaOptimizationRemark_Warning_descriptor(), name, value); +} +// =================================================================== + +class XlaAutoClusteringSummary_OpAndCount final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:tensorflow.XlaAutoClusteringSummary.OpAndCount) */ { + public: + inline XlaAutoClusteringSummary_OpAndCount() : XlaAutoClusteringSummary_OpAndCount(nullptr) {} + ~XlaAutoClusteringSummary_OpAndCount() override; + explicit PROTOBUF_CONSTEXPR XlaAutoClusteringSummary_OpAndCount(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + XlaAutoClusteringSummary_OpAndCount(const XlaAutoClusteringSummary_OpAndCount& from); + XlaAutoClusteringSummary_OpAndCount(XlaAutoClusteringSummary_OpAndCount&& from) noexcept + : XlaAutoClusteringSummary_OpAndCount() { + *this = ::std::move(from); + } + + inline XlaAutoClusteringSummary_OpAndCount& operator=(const XlaAutoClusteringSummary_OpAndCount& from) { + CopyFrom(from); + return *this; + } + inline XlaAutoClusteringSummary_OpAndCount& operator=(XlaAutoClusteringSummary_OpAndCount&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const XlaAutoClusteringSummary_OpAndCount& default_instance() { + return *internal_default_instance(); + } + static inline const XlaAutoClusteringSummary_OpAndCount* internal_default_instance() { + return reinterpret_cast( + &_XlaAutoClusteringSummary_OpAndCount_default_instance_); + } + static constexpr int kIndexInFileMessages = + 0; + + friend void swap(XlaAutoClusteringSummary_OpAndCount& a, XlaAutoClusteringSummary_OpAndCount& b) { + a.Swap(&b); + } + inline void Swap(XlaAutoClusteringSummary_OpAndCount* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(XlaAutoClusteringSummary_OpAndCount* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + XlaAutoClusteringSummary_OpAndCount* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const XlaAutoClusteringSummary_OpAndCount& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom( const XlaAutoClusteringSummary_OpAndCount& from) { + XlaAutoClusteringSummary_OpAndCount::MergeImpl(*this, from); + } + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); + public: + 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(XlaAutoClusteringSummary_OpAndCount* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "tensorflow.XlaAutoClusteringSummary.OpAndCount"; + } + protected: + explicit XlaAutoClusteringSummary_OpAndCount(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kOpFieldNumber = 1, + kCountFieldNumber = 2, + }; + // string op = 1; + void clear_op(); + const std::string& op() const; + template + void set_op(ArgT0&& arg0, ArgT... args); + std::string* mutable_op(); + PROTOBUF_NODISCARD std::string* release_op(); + void set_allocated_op(std::string* op); + private: + const std::string& _internal_op() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_op(const std::string& value); + std::string* _internal_mutable_op(); + public: + + // int32 count = 2; + void clear_count(); + int32_t count() const; + void set_count(int32_t value); + private: + int32_t _internal_count() const; + void _internal_set_count(int32_t value); + public: + + // @@protoc_insertion_point(class_scope:tensorflow.XlaAutoClusteringSummary.OpAndCount) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr op_; + int32_t count_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_tensorflow_2fcompiler_2fjit_2fxla_5factivity_2eproto; +}; +// ------------------------------------------------------------------- + +class XlaAutoClusteringSummary_Cluster final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:tensorflow.XlaAutoClusteringSummary.Cluster) */ { + public: + inline XlaAutoClusteringSummary_Cluster() : XlaAutoClusteringSummary_Cluster(nullptr) {} + ~XlaAutoClusteringSummary_Cluster() override; + explicit PROTOBUF_CONSTEXPR XlaAutoClusteringSummary_Cluster(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + XlaAutoClusteringSummary_Cluster(const XlaAutoClusteringSummary_Cluster& from); + XlaAutoClusteringSummary_Cluster(XlaAutoClusteringSummary_Cluster&& from) noexcept + : XlaAutoClusteringSummary_Cluster() { + *this = ::std::move(from); + } + + inline XlaAutoClusteringSummary_Cluster& operator=(const XlaAutoClusteringSummary_Cluster& from) { + CopyFrom(from); + return *this; + } + inline XlaAutoClusteringSummary_Cluster& operator=(XlaAutoClusteringSummary_Cluster&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const XlaAutoClusteringSummary_Cluster& default_instance() { + return *internal_default_instance(); + } + static inline const XlaAutoClusteringSummary_Cluster* internal_default_instance() { + return reinterpret_cast( + &_XlaAutoClusteringSummary_Cluster_default_instance_); + } + static constexpr int kIndexInFileMessages = + 1; + + friend void swap(XlaAutoClusteringSummary_Cluster& a, XlaAutoClusteringSummary_Cluster& b) { + a.Swap(&b); + } + inline void Swap(XlaAutoClusteringSummary_Cluster* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(XlaAutoClusteringSummary_Cluster* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + XlaAutoClusteringSummary_Cluster* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const XlaAutoClusteringSummary_Cluster& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom( const XlaAutoClusteringSummary_Cluster& from) { + XlaAutoClusteringSummary_Cluster::MergeImpl(*this, from); + } + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); + public: + 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(XlaAutoClusteringSummary_Cluster* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "tensorflow.XlaAutoClusteringSummary.Cluster"; + } + protected: + explicit XlaAutoClusteringSummary_Cluster(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kOpHistogramFieldNumber = 3, + kNameFieldNumber = 1, + kSizeFieldNumber = 2, + }; + // repeated .tensorflow.XlaAutoClusteringSummary.OpAndCount op_histogram = 3; + int op_histogram_size() const; + private: + int _internal_op_histogram_size() const; + public: + void clear_op_histogram(); + ::tensorflow::XlaAutoClusteringSummary_OpAndCount* mutable_op_histogram(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::tensorflow::XlaAutoClusteringSummary_OpAndCount >* + mutable_op_histogram(); + private: + const ::tensorflow::XlaAutoClusteringSummary_OpAndCount& _internal_op_histogram(int index) const; + ::tensorflow::XlaAutoClusteringSummary_OpAndCount* _internal_add_op_histogram(); + public: + const ::tensorflow::XlaAutoClusteringSummary_OpAndCount& op_histogram(int index) const; + ::tensorflow::XlaAutoClusteringSummary_OpAndCount* add_op_histogram(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::tensorflow::XlaAutoClusteringSummary_OpAndCount >& + op_histogram() const; + + // string name = 1; + void clear_name(); + const std::string& name() const; + template + void set_name(ArgT0&& arg0, ArgT... args); + std::string* mutable_name(); + PROTOBUF_NODISCARD std::string* release_name(); + void set_allocated_name(std::string* name); + private: + const std::string& _internal_name() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_name(const std::string& value); + std::string* _internal_mutable_name(); + public: + + // int32 size = 2; + void clear_size(); + int32_t size() const; + void set_size(int32_t value); + private: + int32_t _internal_size() const; + void _internal_set_size(int32_t value); + public: + + // @@protoc_insertion_point(class_scope:tensorflow.XlaAutoClusteringSummary.Cluster) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::tensorflow::XlaAutoClusteringSummary_OpAndCount > op_histogram_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_; + int32_t size_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_tensorflow_2fcompiler_2fjit_2fxla_5factivity_2eproto; +}; +// ------------------------------------------------------------------- + +class XlaAutoClusteringSummary final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:tensorflow.XlaAutoClusteringSummary) */ { + public: + inline XlaAutoClusteringSummary() : XlaAutoClusteringSummary(nullptr) {} + ~XlaAutoClusteringSummary() override; + explicit PROTOBUF_CONSTEXPR XlaAutoClusteringSummary(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + XlaAutoClusteringSummary(const XlaAutoClusteringSummary& from); + XlaAutoClusteringSummary(XlaAutoClusteringSummary&& from) noexcept + : XlaAutoClusteringSummary() { + *this = ::std::move(from); + } + + inline XlaAutoClusteringSummary& operator=(const XlaAutoClusteringSummary& from) { + CopyFrom(from); + return *this; + } + inline XlaAutoClusteringSummary& operator=(XlaAutoClusteringSummary&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const XlaAutoClusteringSummary& default_instance() { + return *internal_default_instance(); + } + static inline const XlaAutoClusteringSummary* internal_default_instance() { + return reinterpret_cast( + &_XlaAutoClusteringSummary_default_instance_); + } + static constexpr int kIndexInFileMessages = + 2; + + friend void swap(XlaAutoClusteringSummary& a, XlaAutoClusteringSummary& b) { + a.Swap(&b); + } + inline void Swap(XlaAutoClusteringSummary* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(XlaAutoClusteringSummary* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + XlaAutoClusteringSummary* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const XlaAutoClusteringSummary& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom( const XlaAutoClusteringSummary& from) { + XlaAutoClusteringSummary::MergeImpl(*this, from); + } + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); + public: + 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(XlaAutoClusteringSummary* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "tensorflow.XlaAutoClusteringSummary"; + } + protected: + explicit XlaAutoClusteringSummary(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + typedef XlaAutoClusteringSummary_OpAndCount OpAndCount; + typedef XlaAutoClusteringSummary_Cluster Cluster; + + // accessors ------------------------------------------------------- + + enum : int { + kClustersFieldNumber = 3, + kUnclusteredOpHistogramFieldNumber = 4, + kUnclusteredNodeCountFieldNumber = 1, + kClusteredNodeCountFieldNumber = 2, + }; + // repeated .tensorflow.XlaAutoClusteringSummary.Cluster clusters = 3; + int clusters_size() const; + private: + int _internal_clusters_size() const; + public: + void clear_clusters(); + ::tensorflow::XlaAutoClusteringSummary_Cluster* mutable_clusters(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::tensorflow::XlaAutoClusteringSummary_Cluster >* + mutable_clusters(); + private: + const ::tensorflow::XlaAutoClusteringSummary_Cluster& _internal_clusters(int index) const; + ::tensorflow::XlaAutoClusteringSummary_Cluster* _internal_add_clusters(); + public: + const ::tensorflow::XlaAutoClusteringSummary_Cluster& clusters(int index) const; + ::tensorflow::XlaAutoClusteringSummary_Cluster* add_clusters(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::tensorflow::XlaAutoClusteringSummary_Cluster >& + clusters() const; + + // repeated .tensorflow.XlaAutoClusteringSummary.OpAndCount unclustered_op_histogram = 4; + int unclustered_op_histogram_size() const; + private: + int _internal_unclustered_op_histogram_size() const; + public: + void clear_unclustered_op_histogram(); + ::tensorflow::XlaAutoClusteringSummary_OpAndCount* mutable_unclustered_op_histogram(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::tensorflow::XlaAutoClusteringSummary_OpAndCount >* + mutable_unclustered_op_histogram(); + private: + const ::tensorflow::XlaAutoClusteringSummary_OpAndCount& _internal_unclustered_op_histogram(int index) const; + ::tensorflow::XlaAutoClusteringSummary_OpAndCount* _internal_add_unclustered_op_histogram(); + public: + const ::tensorflow::XlaAutoClusteringSummary_OpAndCount& unclustered_op_histogram(int index) const; + ::tensorflow::XlaAutoClusteringSummary_OpAndCount* add_unclustered_op_histogram(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::tensorflow::XlaAutoClusteringSummary_OpAndCount >& + unclustered_op_histogram() const; + + // int32 unclustered_node_count = 1; + void clear_unclustered_node_count(); + int32_t unclustered_node_count() const; + void set_unclustered_node_count(int32_t value); + private: + int32_t _internal_unclustered_node_count() const; + void _internal_set_unclustered_node_count(int32_t value); + public: + + // int32 clustered_node_count = 2; + void clear_clustered_node_count(); + int32_t clustered_node_count() const; + void set_clustered_node_count(int32_t value); + private: + int32_t _internal_clustered_node_count() const; + void _internal_set_clustered_node_count(int32_t value); + public: + + // @@protoc_insertion_point(class_scope:tensorflow.XlaAutoClusteringSummary) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::tensorflow::XlaAutoClusteringSummary_Cluster > clusters_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::tensorflow::XlaAutoClusteringSummary_OpAndCount > unclustered_op_histogram_; + int32_t unclustered_node_count_; + int32_t clustered_node_count_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_tensorflow_2fcompiler_2fjit_2fxla_5factivity_2eproto; +}; +// ------------------------------------------------------------------- + +class XlaAutoClusteringActivity final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:tensorflow.XlaAutoClusteringActivity) */ { + public: + inline XlaAutoClusteringActivity() : XlaAutoClusteringActivity(nullptr) {} + ~XlaAutoClusteringActivity() override; + explicit PROTOBUF_CONSTEXPR XlaAutoClusteringActivity(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + XlaAutoClusteringActivity(const XlaAutoClusteringActivity& from); + XlaAutoClusteringActivity(XlaAutoClusteringActivity&& from) noexcept + : XlaAutoClusteringActivity() { + *this = ::std::move(from); + } + + inline XlaAutoClusteringActivity& operator=(const XlaAutoClusteringActivity& from) { + CopyFrom(from); + return *this; + } + inline XlaAutoClusteringActivity& operator=(XlaAutoClusteringActivity&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const XlaAutoClusteringActivity& default_instance() { + return *internal_default_instance(); + } + static inline const XlaAutoClusteringActivity* internal_default_instance() { + return reinterpret_cast( + &_XlaAutoClusteringActivity_default_instance_); + } + static constexpr int kIndexInFileMessages = + 3; + + friend void swap(XlaAutoClusteringActivity& a, XlaAutoClusteringActivity& b) { + a.Swap(&b); + } + inline void Swap(XlaAutoClusteringActivity* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(XlaAutoClusteringActivity* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + XlaAutoClusteringActivity* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const XlaAutoClusteringActivity& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom( const XlaAutoClusteringActivity& from) { + XlaAutoClusteringActivity::MergeImpl(*this, from); + } + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); + public: + 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(XlaAutoClusteringActivity* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "tensorflow.XlaAutoClusteringActivity"; + } + protected: + explicit XlaAutoClusteringActivity(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kSummaryFieldNumber = 3, + kGlobalJitLevelFieldNumber = 1, + kCpuGlobalJitEnabledFieldNumber = 2, + }; + // .tensorflow.XlaAutoClusteringSummary summary = 3; + bool has_summary() const; + private: + bool _internal_has_summary() const; + public: + void clear_summary(); + const ::tensorflow::XlaAutoClusteringSummary& summary() const; + PROTOBUF_NODISCARD ::tensorflow::XlaAutoClusteringSummary* release_summary(); + ::tensorflow::XlaAutoClusteringSummary* mutable_summary(); + void set_allocated_summary(::tensorflow::XlaAutoClusteringSummary* summary); + private: + const ::tensorflow::XlaAutoClusteringSummary& _internal_summary() const; + ::tensorflow::XlaAutoClusteringSummary* _internal_mutable_summary(); + public: + void unsafe_arena_set_allocated_summary( + ::tensorflow::XlaAutoClusteringSummary* summary); + ::tensorflow::XlaAutoClusteringSummary* unsafe_arena_release_summary(); + + // .tensorflow.OptimizerOptions.GlobalJitLevel global_jit_level = 1; + void clear_global_jit_level(); + ::tensorflow::OptimizerOptions_GlobalJitLevel global_jit_level() const; + void set_global_jit_level(::tensorflow::OptimizerOptions_GlobalJitLevel value); + private: + ::tensorflow::OptimizerOptions_GlobalJitLevel _internal_global_jit_level() const; + void _internal_set_global_jit_level(::tensorflow::OptimizerOptions_GlobalJitLevel value); + public: + + // bool cpu_global_jit_enabled = 2; + void clear_cpu_global_jit_enabled(); + bool cpu_global_jit_enabled() const; + void set_cpu_global_jit_enabled(bool value); + private: + bool _internal_cpu_global_jit_enabled() const; + void _internal_set_cpu_global_jit_enabled(bool value); + public: + + // @@protoc_insertion_point(class_scope:tensorflow.XlaAutoClusteringActivity) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + ::tensorflow::XlaAutoClusteringSummary* summary_; + int global_jit_level_; + bool cpu_global_jit_enabled_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_tensorflow_2fcompiler_2fjit_2fxla_5factivity_2eproto; +}; +// ------------------------------------------------------------------- + +class XlaJitCompilationActivity final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:tensorflow.XlaJitCompilationActivity) */ { + public: + inline XlaJitCompilationActivity() : XlaJitCompilationActivity(nullptr) {} + ~XlaJitCompilationActivity() override; + explicit PROTOBUF_CONSTEXPR XlaJitCompilationActivity(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + XlaJitCompilationActivity(const XlaJitCompilationActivity& from); + XlaJitCompilationActivity(XlaJitCompilationActivity&& from) noexcept + : XlaJitCompilationActivity() { + *this = ::std::move(from); + } + + inline XlaJitCompilationActivity& operator=(const XlaJitCompilationActivity& from) { + CopyFrom(from); + return *this; + } + inline XlaJitCompilationActivity& operator=(XlaJitCompilationActivity&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const XlaJitCompilationActivity& default_instance() { + return *internal_default_instance(); + } + static inline const XlaJitCompilationActivity* internal_default_instance() { + return reinterpret_cast( + &_XlaJitCompilationActivity_default_instance_); + } + static constexpr int kIndexInFileMessages = + 4; + + friend void swap(XlaJitCompilationActivity& a, XlaJitCompilationActivity& b) { + a.Swap(&b); + } + inline void Swap(XlaJitCompilationActivity* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(XlaJitCompilationActivity* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + XlaJitCompilationActivity* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const XlaJitCompilationActivity& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom( const XlaJitCompilationActivity& from) { + XlaJitCompilationActivity::MergeImpl(*this, from); + } + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); + public: + 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(XlaJitCompilationActivity* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "tensorflow.XlaJitCompilationActivity"; + } + protected: + explicit XlaJitCompilationActivity(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kClusterNameFieldNumber = 1, + kCompileTimeUsFieldNumber = 3, + kCompileCountFieldNumber = 2, + kUsedPersistentCacheFieldNumber = 5, + kCumulativeCompileTimeUsFieldNumber = 4, + }; + // string cluster_name = 1; + void clear_cluster_name(); + const std::string& cluster_name() const; + template + void set_cluster_name(ArgT0&& arg0, ArgT... args); + std::string* mutable_cluster_name(); + PROTOBUF_NODISCARD std::string* release_cluster_name(); + void set_allocated_cluster_name(std::string* cluster_name); + private: + const std::string& _internal_cluster_name() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_cluster_name(const std::string& value); + std::string* _internal_mutable_cluster_name(); + public: + + // int64 compile_time_us = 3; + void clear_compile_time_us(); + int64_t compile_time_us() const; + void set_compile_time_us(int64_t value); + private: + int64_t _internal_compile_time_us() const; + void _internal_set_compile_time_us(int64_t value); + public: + + // int32 compile_count = 2; + void clear_compile_count(); + int32_t compile_count() const; + void set_compile_count(int32_t value); + private: + int32_t _internal_compile_count() const; + void _internal_set_compile_count(int32_t value); + public: + + // bool used_persistent_cache = 5; + void clear_used_persistent_cache(); + bool used_persistent_cache() const; + void set_used_persistent_cache(bool value); + private: + bool _internal_used_persistent_cache() const; + void _internal_set_used_persistent_cache(bool value); + public: + + // int64 cumulative_compile_time_us = 4; + void clear_cumulative_compile_time_us(); + int64_t cumulative_compile_time_us() const; + void set_cumulative_compile_time_us(int64_t value); + private: + int64_t _internal_cumulative_compile_time_us() const; + void _internal_set_cumulative_compile_time_us(int64_t value); + public: + + // @@protoc_insertion_point(class_scope:tensorflow.XlaJitCompilationActivity) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr cluster_name_; + int64_t compile_time_us_; + int32_t compile_count_; + bool used_persistent_cache_; + int64_t cumulative_compile_time_us_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_tensorflow_2fcompiler_2fjit_2fxla_5factivity_2eproto; +}; +// ------------------------------------------------------------------- + +class XlaOptimizationRemark final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:tensorflow.XlaOptimizationRemark) */ { + public: + inline XlaOptimizationRemark() : XlaOptimizationRemark(nullptr) {} + ~XlaOptimizationRemark() override; + explicit PROTOBUF_CONSTEXPR XlaOptimizationRemark(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + XlaOptimizationRemark(const XlaOptimizationRemark& from); + XlaOptimizationRemark(XlaOptimizationRemark&& from) noexcept + : XlaOptimizationRemark() { + *this = ::std::move(from); + } + + inline XlaOptimizationRemark& operator=(const XlaOptimizationRemark& from) { + CopyFrom(from); + return *this; + } + inline XlaOptimizationRemark& operator=(XlaOptimizationRemark&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const XlaOptimizationRemark& default_instance() { + return *internal_default_instance(); + } + static inline const XlaOptimizationRemark* internal_default_instance() { + return reinterpret_cast( + &_XlaOptimizationRemark_default_instance_); + } + static constexpr int kIndexInFileMessages = + 5; + + friend void swap(XlaOptimizationRemark& a, XlaOptimizationRemark& b) { + a.Swap(&b); + } + inline void Swap(XlaOptimizationRemark* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(XlaOptimizationRemark* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + XlaOptimizationRemark* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const XlaOptimizationRemark& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom( const XlaOptimizationRemark& from) { + XlaOptimizationRemark::MergeImpl(*this, from); + } + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); + public: + 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(XlaOptimizationRemark* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "tensorflow.XlaOptimizationRemark"; + } + protected: + explicit XlaOptimizationRemark(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + typedef XlaOptimizationRemark_Warning Warning; + static constexpr Warning NONE = + XlaOptimizationRemark_Warning_NONE; + static constexpr Warning INACCURATE_OPERATION = + XlaOptimizationRemark_Warning_INACCURATE_OPERATION; + static constexpr Warning SLOW_OPERATION = + XlaOptimizationRemark_Warning_SLOW_OPERATION; + static constexpr Warning UNIMPLEMENTED_OPERATION = + XlaOptimizationRemark_Warning_UNIMPLEMENTED_OPERATION; + static constexpr Warning SLOW_IMAGE_RESIZE_DIMENSIONS = + XlaOptimizationRemark_Warning_SLOW_IMAGE_RESIZE_DIMENSIONS; + static constexpr Warning MEGAMORPHIC_FUNCTION = + XlaOptimizationRemark_Warning_MEGAMORPHIC_FUNCTION; + static inline bool Warning_IsValid(int value) { + return XlaOptimizationRemark_Warning_IsValid(value); + } + static constexpr Warning Warning_MIN = + XlaOptimizationRemark_Warning_Warning_MIN; + static constexpr Warning Warning_MAX = + XlaOptimizationRemark_Warning_Warning_MAX; + static constexpr int Warning_ARRAYSIZE = + XlaOptimizationRemark_Warning_Warning_ARRAYSIZE; + static inline const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* + Warning_descriptor() { + return XlaOptimizationRemark_Warning_descriptor(); + } + template + static inline const std::string& Warning_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function Warning_Name."); + return XlaOptimizationRemark_Warning_Name(enum_t_value); + } + static inline bool Warning_Parse(::PROTOBUF_NAMESPACE_ID::ConstStringParam name, + Warning* value) { + return XlaOptimizationRemark_Warning_Parse(name, value); + } + + // accessors ------------------------------------------------------- + + enum : int { + kDebugInformationFieldNumber = 2, + kWarningFieldNumber = 1, + }; + // string debug_information = 2; + void clear_debug_information(); + const std::string& debug_information() const; + template + void set_debug_information(ArgT0&& arg0, ArgT... args); + std::string* mutable_debug_information(); + PROTOBUF_NODISCARD std::string* release_debug_information(); + void set_allocated_debug_information(std::string* debug_information); + private: + const std::string& _internal_debug_information() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_debug_information(const std::string& value); + std::string* _internal_mutable_debug_information(); + public: + + // .tensorflow.XlaOptimizationRemark.Warning warning = 1; + void clear_warning(); + ::tensorflow::XlaOptimizationRemark_Warning warning() const; + void set_warning(::tensorflow::XlaOptimizationRemark_Warning value); + private: + ::tensorflow::XlaOptimizationRemark_Warning _internal_warning() const; + void _internal_set_warning(::tensorflow::XlaOptimizationRemark_Warning value); + public: + + // @@protoc_insertion_point(class_scope:tensorflow.XlaOptimizationRemark) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr debug_information_; + int warning_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_tensorflow_2fcompiler_2fjit_2fxla_5factivity_2eproto; +}; +// =================================================================== + + +// =================================================================== + +#ifdef __GNUC__ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wstrict-aliasing" +#endif // __GNUC__ +// XlaAutoClusteringSummary_OpAndCount + +// string op = 1; +inline void XlaAutoClusteringSummary_OpAndCount::clear_op() { + _impl_.op_.ClearToEmpty(); +} +inline const std::string& XlaAutoClusteringSummary_OpAndCount::op() const { + // @@protoc_insertion_point(field_get:tensorflow.XlaAutoClusteringSummary.OpAndCount.op) + return _internal_op(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void XlaAutoClusteringSummary_OpAndCount::set_op(ArgT0&& arg0, ArgT... args) { + + _impl_.op_.Set(static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:tensorflow.XlaAutoClusteringSummary.OpAndCount.op) +} +inline std::string* XlaAutoClusteringSummary_OpAndCount::mutable_op() { + std::string* _s = _internal_mutable_op(); + // @@protoc_insertion_point(field_mutable:tensorflow.XlaAutoClusteringSummary.OpAndCount.op) + return _s; +} +inline const std::string& XlaAutoClusteringSummary_OpAndCount::_internal_op() const { + return _impl_.op_.Get(); +} +inline void XlaAutoClusteringSummary_OpAndCount::_internal_set_op(const std::string& value) { + + _impl_.op_.Set(value, GetArenaForAllocation()); +} +inline std::string* XlaAutoClusteringSummary_OpAndCount::_internal_mutable_op() { + + return _impl_.op_.Mutable(GetArenaForAllocation()); +} +inline std::string* XlaAutoClusteringSummary_OpAndCount::release_op() { + // @@protoc_insertion_point(field_release:tensorflow.XlaAutoClusteringSummary.OpAndCount.op) + return _impl_.op_.Release(); +} +inline void XlaAutoClusteringSummary_OpAndCount::set_allocated_op(std::string* op) { + if (op != nullptr) { + + } else { + + } + _impl_.op_.SetAllocated(op, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.op_.IsDefault()) { + _impl_.op_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:tensorflow.XlaAutoClusteringSummary.OpAndCount.op) +} + +// int32 count = 2; +inline void XlaAutoClusteringSummary_OpAndCount::clear_count() { + _impl_.count_ = 0; +} +inline int32_t XlaAutoClusteringSummary_OpAndCount::_internal_count() const { + return _impl_.count_; +} +inline int32_t XlaAutoClusteringSummary_OpAndCount::count() const { + // @@protoc_insertion_point(field_get:tensorflow.XlaAutoClusteringSummary.OpAndCount.count) + return _internal_count(); +} +inline void XlaAutoClusteringSummary_OpAndCount::_internal_set_count(int32_t value) { + + _impl_.count_ = value; +} +inline void XlaAutoClusteringSummary_OpAndCount::set_count(int32_t value) { + _internal_set_count(value); + // @@protoc_insertion_point(field_set:tensorflow.XlaAutoClusteringSummary.OpAndCount.count) +} + +// ------------------------------------------------------------------- + +// XlaAutoClusteringSummary_Cluster + +// string name = 1; +inline void XlaAutoClusteringSummary_Cluster::clear_name() { + _impl_.name_.ClearToEmpty(); +} +inline const std::string& XlaAutoClusteringSummary_Cluster::name() const { + // @@protoc_insertion_point(field_get:tensorflow.XlaAutoClusteringSummary.Cluster.name) + return _internal_name(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void XlaAutoClusteringSummary_Cluster::set_name(ArgT0&& arg0, ArgT... args) { + + _impl_.name_.Set(static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:tensorflow.XlaAutoClusteringSummary.Cluster.name) +} +inline std::string* XlaAutoClusteringSummary_Cluster::mutable_name() { + std::string* _s = _internal_mutable_name(); + // @@protoc_insertion_point(field_mutable:tensorflow.XlaAutoClusteringSummary.Cluster.name) + return _s; +} +inline const std::string& XlaAutoClusteringSummary_Cluster::_internal_name() const { + return _impl_.name_.Get(); +} +inline void XlaAutoClusteringSummary_Cluster::_internal_set_name(const std::string& value) { + + _impl_.name_.Set(value, GetArenaForAllocation()); +} +inline std::string* XlaAutoClusteringSummary_Cluster::_internal_mutable_name() { + + return _impl_.name_.Mutable(GetArenaForAllocation()); +} +inline std::string* XlaAutoClusteringSummary_Cluster::release_name() { + // @@protoc_insertion_point(field_release:tensorflow.XlaAutoClusteringSummary.Cluster.name) + return _impl_.name_.Release(); +} +inline void XlaAutoClusteringSummary_Cluster::set_allocated_name(std::string* name) { + if (name != nullptr) { + + } else { + + } + _impl_.name_.SetAllocated(name, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.name_.IsDefault()) { + _impl_.name_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:tensorflow.XlaAutoClusteringSummary.Cluster.name) +} + +// int32 size = 2; +inline void XlaAutoClusteringSummary_Cluster::clear_size() { + _impl_.size_ = 0; +} +inline int32_t XlaAutoClusteringSummary_Cluster::_internal_size() const { + return _impl_.size_; +} +inline int32_t XlaAutoClusteringSummary_Cluster::size() const { + // @@protoc_insertion_point(field_get:tensorflow.XlaAutoClusteringSummary.Cluster.size) + return _internal_size(); +} +inline void XlaAutoClusteringSummary_Cluster::_internal_set_size(int32_t value) { + + _impl_.size_ = value; +} +inline void XlaAutoClusteringSummary_Cluster::set_size(int32_t value) { + _internal_set_size(value); + // @@protoc_insertion_point(field_set:tensorflow.XlaAutoClusteringSummary.Cluster.size) +} + +// repeated .tensorflow.XlaAutoClusteringSummary.OpAndCount op_histogram = 3; +inline int XlaAutoClusteringSummary_Cluster::_internal_op_histogram_size() const { + return _impl_.op_histogram_.size(); +} +inline int XlaAutoClusteringSummary_Cluster::op_histogram_size() const { + return _internal_op_histogram_size(); +} +inline void XlaAutoClusteringSummary_Cluster::clear_op_histogram() { + _impl_.op_histogram_.Clear(); +} +inline ::tensorflow::XlaAutoClusteringSummary_OpAndCount* XlaAutoClusteringSummary_Cluster::mutable_op_histogram(int index) { + // @@protoc_insertion_point(field_mutable:tensorflow.XlaAutoClusteringSummary.Cluster.op_histogram) + return _impl_.op_histogram_.Mutable(index); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::tensorflow::XlaAutoClusteringSummary_OpAndCount >* +XlaAutoClusteringSummary_Cluster::mutable_op_histogram() { + // @@protoc_insertion_point(field_mutable_list:tensorflow.XlaAutoClusteringSummary.Cluster.op_histogram) + return &_impl_.op_histogram_; +} +inline const ::tensorflow::XlaAutoClusteringSummary_OpAndCount& XlaAutoClusteringSummary_Cluster::_internal_op_histogram(int index) const { + return _impl_.op_histogram_.Get(index); +} +inline const ::tensorflow::XlaAutoClusteringSummary_OpAndCount& XlaAutoClusteringSummary_Cluster::op_histogram(int index) const { + // @@protoc_insertion_point(field_get:tensorflow.XlaAutoClusteringSummary.Cluster.op_histogram) + return _internal_op_histogram(index); +} +inline ::tensorflow::XlaAutoClusteringSummary_OpAndCount* XlaAutoClusteringSummary_Cluster::_internal_add_op_histogram() { + return _impl_.op_histogram_.Add(); +} +inline ::tensorflow::XlaAutoClusteringSummary_OpAndCount* XlaAutoClusteringSummary_Cluster::add_op_histogram() { + ::tensorflow::XlaAutoClusteringSummary_OpAndCount* _add = _internal_add_op_histogram(); + // @@protoc_insertion_point(field_add:tensorflow.XlaAutoClusteringSummary.Cluster.op_histogram) + return _add; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::tensorflow::XlaAutoClusteringSummary_OpAndCount >& +XlaAutoClusteringSummary_Cluster::op_histogram() const { + // @@protoc_insertion_point(field_list:tensorflow.XlaAutoClusteringSummary.Cluster.op_histogram) + return _impl_.op_histogram_; +} + +// ------------------------------------------------------------------- + +// XlaAutoClusteringSummary + +// int32 unclustered_node_count = 1; +inline void XlaAutoClusteringSummary::clear_unclustered_node_count() { + _impl_.unclustered_node_count_ = 0; +} +inline int32_t XlaAutoClusteringSummary::_internal_unclustered_node_count() const { + return _impl_.unclustered_node_count_; +} +inline int32_t XlaAutoClusteringSummary::unclustered_node_count() const { + // @@protoc_insertion_point(field_get:tensorflow.XlaAutoClusteringSummary.unclustered_node_count) + return _internal_unclustered_node_count(); +} +inline void XlaAutoClusteringSummary::_internal_set_unclustered_node_count(int32_t value) { + + _impl_.unclustered_node_count_ = value; +} +inline void XlaAutoClusteringSummary::set_unclustered_node_count(int32_t value) { + _internal_set_unclustered_node_count(value); + // @@protoc_insertion_point(field_set:tensorflow.XlaAutoClusteringSummary.unclustered_node_count) +} + +// int32 clustered_node_count = 2; +inline void XlaAutoClusteringSummary::clear_clustered_node_count() { + _impl_.clustered_node_count_ = 0; +} +inline int32_t XlaAutoClusteringSummary::_internal_clustered_node_count() const { + return _impl_.clustered_node_count_; +} +inline int32_t XlaAutoClusteringSummary::clustered_node_count() const { + // @@protoc_insertion_point(field_get:tensorflow.XlaAutoClusteringSummary.clustered_node_count) + return _internal_clustered_node_count(); +} +inline void XlaAutoClusteringSummary::_internal_set_clustered_node_count(int32_t value) { + + _impl_.clustered_node_count_ = value; +} +inline void XlaAutoClusteringSummary::set_clustered_node_count(int32_t value) { + _internal_set_clustered_node_count(value); + // @@protoc_insertion_point(field_set:tensorflow.XlaAutoClusteringSummary.clustered_node_count) +} + +// repeated .tensorflow.XlaAutoClusteringSummary.Cluster clusters = 3; +inline int XlaAutoClusteringSummary::_internal_clusters_size() const { + return _impl_.clusters_.size(); +} +inline int XlaAutoClusteringSummary::clusters_size() const { + return _internal_clusters_size(); +} +inline void XlaAutoClusteringSummary::clear_clusters() { + _impl_.clusters_.Clear(); +} +inline ::tensorflow::XlaAutoClusteringSummary_Cluster* XlaAutoClusteringSummary::mutable_clusters(int index) { + // @@protoc_insertion_point(field_mutable:tensorflow.XlaAutoClusteringSummary.clusters) + return _impl_.clusters_.Mutable(index); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::tensorflow::XlaAutoClusteringSummary_Cluster >* +XlaAutoClusteringSummary::mutable_clusters() { + // @@protoc_insertion_point(field_mutable_list:tensorflow.XlaAutoClusteringSummary.clusters) + return &_impl_.clusters_; +} +inline const ::tensorflow::XlaAutoClusteringSummary_Cluster& XlaAutoClusteringSummary::_internal_clusters(int index) const { + return _impl_.clusters_.Get(index); +} +inline const ::tensorflow::XlaAutoClusteringSummary_Cluster& XlaAutoClusteringSummary::clusters(int index) const { + // @@protoc_insertion_point(field_get:tensorflow.XlaAutoClusteringSummary.clusters) + return _internal_clusters(index); +} +inline ::tensorflow::XlaAutoClusteringSummary_Cluster* XlaAutoClusteringSummary::_internal_add_clusters() { + return _impl_.clusters_.Add(); +} +inline ::tensorflow::XlaAutoClusteringSummary_Cluster* XlaAutoClusteringSummary::add_clusters() { + ::tensorflow::XlaAutoClusteringSummary_Cluster* _add = _internal_add_clusters(); + // @@protoc_insertion_point(field_add:tensorflow.XlaAutoClusteringSummary.clusters) + return _add; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::tensorflow::XlaAutoClusteringSummary_Cluster >& +XlaAutoClusteringSummary::clusters() const { + // @@protoc_insertion_point(field_list:tensorflow.XlaAutoClusteringSummary.clusters) + return _impl_.clusters_; +} + +// repeated .tensorflow.XlaAutoClusteringSummary.OpAndCount unclustered_op_histogram = 4; +inline int XlaAutoClusteringSummary::_internal_unclustered_op_histogram_size() const { + return _impl_.unclustered_op_histogram_.size(); +} +inline int XlaAutoClusteringSummary::unclustered_op_histogram_size() const { + return _internal_unclustered_op_histogram_size(); +} +inline void XlaAutoClusteringSummary::clear_unclustered_op_histogram() { + _impl_.unclustered_op_histogram_.Clear(); +} +inline ::tensorflow::XlaAutoClusteringSummary_OpAndCount* XlaAutoClusteringSummary::mutable_unclustered_op_histogram(int index) { + // @@protoc_insertion_point(field_mutable:tensorflow.XlaAutoClusteringSummary.unclustered_op_histogram) + return _impl_.unclustered_op_histogram_.Mutable(index); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::tensorflow::XlaAutoClusteringSummary_OpAndCount >* +XlaAutoClusteringSummary::mutable_unclustered_op_histogram() { + // @@protoc_insertion_point(field_mutable_list:tensorflow.XlaAutoClusteringSummary.unclustered_op_histogram) + return &_impl_.unclustered_op_histogram_; +} +inline const ::tensorflow::XlaAutoClusteringSummary_OpAndCount& XlaAutoClusteringSummary::_internal_unclustered_op_histogram(int index) const { + return _impl_.unclustered_op_histogram_.Get(index); +} +inline const ::tensorflow::XlaAutoClusteringSummary_OpAndCount& XlaAutoClusteringSummary::unclustered_op_histogram(int index) const { + // @@protoc_insertion_point(field_get:tensorflow.XlaAutoClusteringSummary.unclustered_op_histogram) + return _internal_unclustered_op_histogram(index); +} +inline ::tensorflow::XlaAutoClusteringSummary_OpAndCount* XlaAutoClusteringSummary::_internal_add_unclustered_op_histogram() { + return _impl_.unclustered_op_histogram_.Add(); +} +inline ::tensorflow::XlaAutoClusteringSummary_OpAndCount* XlaAutoClusteringSummary::add_unclustered_op_histogram() { + ::tensorflow::XlaAutoClusteringSummary_OpAndCount* _add = _internal_add_unclustered_op_histogram(); + // @@protoc_insertion_point(field_add:tensorflow.XlaAutoClusteringSummary.unclustered_op_histogram) + return _add; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::tensorflow::XlaAutoClusteringSummary_OpAndCount >& +XlaAutoClusteringSummary::unclustered_op_histogram() const { + // @@protoc_insertion_point(field_list:tensorflow.XlaAutoClusteringSummary.unclustered_op_histogram) + return _impl_.unclustered_op_histogram_; +} + +// ------------------------------------------------------------------- + +// XlaAutoClusteringActivity + +// .tensorflow.OptimizerOptions.GlobalJitLevel global_jit_level = 1; +inline void XlaAutoClusteringActivity::clear_global_jit_level() { + _impl_.global_jit_level_ = 0; +} +inline ::tensorflow::OptimizerOptions_GlobalJitLevel XlaAutoClusteringActivity::_internal_global_jit_level() const { + return static_cast< ::tensorflow::OptimizerOptions_GlobalJitLevel >(_impl_.global_jit_level_); +} +inline ::tensorflow::OptimizerOptions_GlobalJitLevel XlaAutoClusteringActivity::global_jit_level() const { + // @@protoc_insertion_point(field_get:tensorflow.XlaAutoClusteringActivity.global_jit_level) + return _internal_global_jit_level(); +} +inline void XlaAutoClusteringActivity::_internal_set_global_jit_level(::tensorflow::OptimizerOptions_GlobalJitLevel value) { + + _impl_.global_jit_level_ = value; +} +inline void XlaAutoClusteringActivity::set_global_jit_level(::tensorflow::OptimizerOptions_GlobalJitLevel value) { + _internal_set_global_jit_level(value); + // @@protoc_insertion_point(field_set:tensorflow.XlaAutoClusteringActivity.global_jit_level) +} + +// bool cpu_global_jit_enabled = 2; +inline void XlaAutoClusteringActivity::clear_cpu_global_jit_enabled() { + _impl_.cpu_global_jit_enabled_ = false; +} +inline bool XlaAutoClusteringActivity::_internal_cpu_global_jit_enabled() const { + return _impl_.cpu_global_jit_enabled_; +} +inline bool XlaAutoClusteringActivity::cpu_global_jit_enabled() const { + // @@protoc_insertion_point(field_get:tensorflow.XlaAutoClusteringActivity.cpu_global_jit_enabled) + return _internal_cpu_global_jit_enabled(); +} +inline void XlaAutoClusteringActivity::_internal_set_cpu_global_jit_enabled(bool value) { + + _impl_.cpu_global_jit_enabled_ = value; +} +inline void XlaAutoClusteringActivity::set_cpu_global_jit_enabled(bool value) { + _internal_set_cpu_global_jit_enabled(value); + // @@protoc_insertion_point(field_set:tensorflow.XlaAutoClusteringActivity.cpu_global_jit_enabled) +} + +// .tensorflow.XlaAutoClusteringSummary summary = 3; +inline bool XlaAutoClusteringActivity::_internal_has_summary() const { + return this != internal_default_instance() && _impl_.summary_ != nullptr; +} +inline bool XlaAutoClusteringActivity::has_summary() const { + return _internal_has_summary(); +} +inline void XlaAutoClusteringActivity::clear_summary() { + if (GetArenaForAllocation() == nullptr && _impl_.summary_ != nullptr) { + delete _impl_.summary_; + } + _impl_.summary_ = nullptr; +} +inline const ::tensorflow::XlaAutoClusteringSummary& XlaAutoClusteringActivity::_internal_summary() const { + const ::tensorflow::XlaAutoClusteringSummary* p = _impl_.summary_; + return p != nullptr ? *p : reinterpret_cast( + ::tensorflow::_XlaAutoClusteringSummary_default_instance_); +} +inline const ::tensorflow::XlaAutoClusteringSummary& XlaAutoClusteringActivity::summary() const { + // @@protoc_insertion_point(field_get:tensorflow.XlaAutoClusteringActivity.summary) + return _internal_summary(); +} +inline void XlaAutoClusteringActivity::unsafe_arena_set_allocated_summary( + ::tensorflow::XlaAutoClusteringSummary* summary) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.summary_); + } + _impl_.summary_ = summary; + if (summary) { + + } else { + + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.XlaAutoClusteringActivity.summary) +} +inline ::tensorflow::XlaAutoClusteringSummary* XlaAutoClusteringActivity::release_summary() { + + ::tensorflow::XlaAutoClusteringSummary* temp = _impl_.summary_; + _impl_.summary_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::tensorflow::XlaAutoClusteringSummary* XlaAutoClusteringActivity::unsafe_arena_release_summary() { + // @@protoc_insertion_point(field_release:tensorflow.XlaAutoClusteringActivity.summary) + + ::tensorflow::XlaAutoClusteringSummary* temp = _impl_.summary_; + _impl_.summary_ = nullptr; + return temp; +} +inline ::tensorflow::XlaAutoClusteringSummary* XlaAutoClusteringActivity::_internal_mutable_summary() { + + if (_impl_.summary_ == nullptr) { + auto* p = CreateMaybeMessage<::tensorflow::XlaAutoClusteringSummary>(GetArenaForAllocation()); + _impl_.summary_ = p; + } + return _impl_.summary_; +} +inline ::tensorflow::XlaAutoClusteringSummary* XlaAutoClusteringActivity::mutable_summary() { + ::tensorflow::XlaAutoClusteringSummary* _msg = _internal_mutable_summary(); + // @@protoc_insertion_point(field_mutable:tensorflow.XlaAutoClusteringActivity.summary) + return _msg; +} +inline void XlaAutoClusteringActivity::set_allocated_summary(::tensorflow::XlaAutoClusteringSummary* summary) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete _impl_.summary_; + } + if (summary) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(summary); + if (message_arena != submessage_arena) { + summary = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, summary, submessage_arena); + } + + } else { + + } + _impl_.summary_ = summary; + // @@protoc_insertion_point(field_set_allocated:tensorflow.XlaAutoClusteringActivity.summary) +} + +// ------------------------------------------------------------------- + +// XlaJitCompilationActivity + +// string cluster_name = 1; +inline void XlaJitCompilationActivity::clear_cluster_name() { + _impl_.cluster_name_.ClearToEmpty(); +} +inline const std::string& XlaJitCompilationActivity::cluster_name() const { + // @@protoc_insertion_point(field_get:tensorflow.XlaJitCompilationActivity.cluster_name) + return _internal_cluster_name(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void XlaJitCompilationActivity::set_cluster_name(ArgT0&& arg0, ArgT... args) { + + _impl_.cluster_name_.Set(static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:tensorflow.XlaJitCompilationActivity.cluster_name) +} +inline std::string* XlaJitCompilationActivity::mutable_cluster_name() { + std::string* _s = _internal_mutable_cluster_name(); + // @@protoc_insertion_point(field_mutable:tensorflow.XlaJitCompilationActivity.cluster_name) + return _s; +} +inline const std::string& XlaJitCompilationActivity::_internal_cluster_name() const { + return _impl_.cluster_name_.Get(); +} +inline void XlaJitCompilationActivity::_internal_set_cluster_name(const std::string& value) { + + _impl_.cluster_name_.Set(value, GetArenaForAllocation()); +} +inline std::string* XlaJitCompilationActivity::_internal_mutable_cluster_name() { + + return _impl_.cluster_name_.Mutable(GetArenaForAllocation()); +} +inline std::string* XlaJitCompilationActivity::release_cluster_name() { + // @@protoc_insertion_point(field_release:tensorflow.XlaJitCompilationActivity.cluster_name) + return _impl_.cluster_name_.Release(); +} +inline void XlaJitCompilationActivity::set_allocated_cluster_name(std::string* cluster_name) { + if (cluster_name != nullptr) { + + } else { + + } + _impl_.cluster_name_.SetAllocated(cluster_name, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.cluster_name_.IsDefault()) { + _impl_.cluster_name_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:tensorflow.XlaJitCompilationActivity.cluster_name) +} + +// int32 compile_count = 2; +inline void XlaJitCompilationActivity::clear_compile_count() { + _impl_.compile_count_ = 0; +} +inline int32_t XlaJitCompilationActivity::_internal_compile_count() const { + return _impl_.compile_count_; +} +inline int32_t XlaJitCompilationActivity::compile_count() const { + // @@protoc_insertion_point(field_get:tensorflow.XlaJitCompilationActivity.compile_count) + return _internal_compile_count(); +} +inline void XlaJitCompilationActivity::_internal_set_compile_count(int32_t value) { + + _impl_.compile_count_ = value; +} +inline void XlaJitCompilationActivity::set_compile_count(int32_t value) { + _internal_set_compile_count(value); + // @@protoc_insertion_point(field_set:tensorflow.XlaJitCompilationActivity.compile_count) +} + +// int64 compile_time_us = 3; +inline void XlaJitCompilationActivity::clear_compile_time_us() { + _impl_.compile_time_us_ = int64_t{0}; +} +inline int64_t XlaJitCompilationActivity::_internal_compile_time_us() const { + return _impl_.compile_time_us_; +} +inline int64_t XlaJitCompilationActivity::compile_time_us() const { + // @@protoc_insertion_point(field_get:tensorflow.XlaJitCompilationActivity.compile_time_us) + return _internal_compile_time_us(); +} +inline void XlaJitCompilationActivity::_internal_set_compile_time_us(int64_t value) { + + _impl_.compile_time_us_ = value; +} +inline void XlaJitCompilationActivity::set_compile_time_us(int64_t value) { + _internal_set_compile_time_us(value); + // @@protoc_insertion_point(field_set:tensorflow.XlaJitCompilationActivity.compile_time_us) +} + +// int64 cumulative_compile_time_us = 4; +inline void XlaJitCompilationActivity::clear_cumulative_compile_time_us() { + _impl_.cumulative_compile_time_us_ = int64_t{0}; +} +inline int64_t XlaJitCompilationActivity::_internal_cumulative_compile_time_us() const { + return _impl_.cumulative_compile_time_us_; +} +inline int64_t XlaJitCompilationActivity::cumulative_compile_time_us() const { + // @@protoc_insertion_point(field_get:tensorflow.XlaJitCompilationActivity.cumulative_compile_time_us) + return _internal_cumulative_compile_time_us(); +} +inline void XlaJitCompilationActivity::_internal_set_cumulative_compile_time_us(int64_t value) { + + _impl_.cumulative_compile_time_us_ = value; +} +inline void XlaJitCompilationActivity::set_cumulative_compile_time_us(int64_t value) { + _internal_set_cumulative_compile_time_us(value); + // @@protoc_insertion_point(field_set:tensorflow.XlaJitCompilationActivity.cumulative_compile_time_us) +} + +// bool used_persistent_cache = 5; +inline void XlaJitCompilationActivity::clear_used_persistent_cache() { + _impl_.used_persistent_cache_ = false; +} +inline bool XlaJitCompilationActivity::_internal_used_persistent_cache() const { + return _impl_.used_persistent_cache_; +} +inline bool XlaJitCompilationActivity::used_persistent_cache() const { + // @@protoc_insertion_point(field_get:tensorflow.XlaJitCompilationActivity.used_persistent_cache) + return _internal_used_persistent_cache(); +} +inline void XlaJitCompilationActivity::_internal_set_used_persistent_cache(bool value) { + + _impl_.used_persistent_cache_ = value; +} +inline void XlaJitCompilationActivity::set_used_persistent_cache(bool value) { + _internal_set_used_persistent_cache(value); + // @@protoc_insertion_point(field_set:tensorflow.XlaJitCompilationActivity.used_persistent_cache) +} + +// ------------------------------------------------------------------- + +// XlaOptimizationRemark + +// .tensorflow.XlaOptimizationRemark.Warning warning = 1; +inline void XlaOptimizationRemark::clear_warning() { + _impl_.warning_ = 0; +} +inline ::tensorflow::XlaOptimizationRemark_Warning XlaOptimizationRemark::_internal_warning() const { + return static_cast< ::tensorflow::XlaOptimizationRemark_Warning >(_impl_.warning_); +} +inline ::tensorflow::XlaOptimizationRemark_Warning XlaOptimizationRemark::warning() const { + // @@protoc_insertion_point(field_get:tensorflow.XlaOptimizationRemark.warning) + return _internal_warning(); +} +inline void XlaOptimizationRemark::_internal_set_warning(::tensorflow::XlaOptimizationRemark_Warning value) { + + _impl_.warning_ = value; +} +inline void XlaOptimizationRemark::set_warning(::tensorflow::XlaOptimizationRemark_Warning value) { + _internal_set_warning(value); + // @@protoc_insertion_point(field_set:tensorflow.XlaOptimizationRemark.warning) +} + +// string debug_information = 2; +inline void XlaOptimizationRemark::clear_debug_information() { + _impl_.debug_information_.ClearToEmpty(); +} +inline const std::string& XlaOptimizationRemark::debug_information() const { + // @@protoc_insertion_point(field_get:tensorflow.XlaOptimizationRemark.debug_information) + return _internal_debug_information(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void XlaOptimizationRemark::set_debug_information(ArgT0&& arg0, ArgT... args) { + + _impl_.debug_information_.Set(static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:tensorflow.XlaOptimizationRemark.debug_information) +} +inline std::string* XlaOptimizationRemark::mutable_debug_information() { + std::string* _s = _internal_mutable_debug_information(); + // @@protoc_insertion_point(field_mutable:tensorflow.XlaOptimizationRemark.debug_information) + return _s; +} +inline const std::string& XlaOptimizationRemark::_internal_debug_information() const { + return _impl_.debug_information_.Get(); +} +inline void XlaOptimizationRemark::_internal_set_debug_information(const std::string& value) { + + _impl_.debug_information_.Set(value, GetArenaForAllocation()); +} +inline std::string* XlaOptimizationRemark::_internal_mutable_debug_information() { + + return _impl_.debug_information_.Mutable(GetArenaForAllocation()); +} +inline std::string* XlaOptimizationRemark::release_debug_information() { + // @@protoc_insertion_point(field_release:tensorflow.XlaOptimizationRemark.debug_information) + return _impl_.debug_information_.Release(); +} +inline void XlaOptimizationRemark::set_allocated_debug_information(std::string* debug_information) { + if (debug_information != nullptr) { + + } else { + + } + _impl_.debug_information_.SetAllocated(debug_information, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.debug_information_.IsDefault()) { + _impl_.debug_information_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:tensorflow.XlaOptimizationRemark.debug_information) +} + +#ifdef __GNUC__ + #pragma GCC diagnostic pop +#endif // __GNUC__ +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + + +// @@protoc_insertion_point(namespace_scope) + +} // namespace tensorflow + +PROTOBUF_NAMESPACE_OPEN + +template <> struct is_proto_enum< ::tensorflow::XlaOptimizationRemark_Warning> : ::std::true_type {}; +template <> +inline const EnumDescriptor* GetEnumDescriptor< ::tensorflow::XlaOptimizationRemark_Warning>() { + return ::tensorflow::XlaOptimizationRemark_Warning_descriptor(); +} + +PROTOBUF_NAMESPACE_CLOSE + +// @@protoc_insertion_point(global_scope) + +#include +#endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_tensorflow_2fcompiler_2fjit_2fxla_5factivity_2eproto diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/xla_activity_listener.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/xla_activity_listener.h new file mode 100644 index 0000000000000000000000000000000000000000..05328c896d34f48bc64a8abd8d754073d13563be --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/xla_activity_listener.h @@ -0,0 +1,73 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ +#ifndef TENSORFLOW_COMPILER_JIT_XLA_ACTIVITY_LISTENER_H_ +#define TENSORFLOW_COMPILER_JIT_XLA_ACTIVITY_LISTENER_H_ + +#include + +#include "tensorflow/compiler/jit/xla_activity.pb.h" +#include "tensorflow/core/lib/core/status.h" + +namespace tensorflow { +// Broadcast `auto_clustering_activity` to all the registered listeners. +Status BroadcastXlaActivity(XlaAutoClusteringActivity auto_clustering_activity); + +// Broadcast `jit_compilation_activity` to all the registered listeners. +Status BroadcastXlaActivity(XlaJitCompilationActivity jit_compilation_activity); + +// Broadcast `jit_compilation_activity` to all the registered listeners. +Status BroadcastOptimizationRemark(XlaOptimizationRemark optimization_remark); + +// LINT.IfChange +// Called after TensorFlow realizes possible lost performance. The parameters in +// this should match all of the values in the XlaOptimizationRemark proto. +Status BroadcastOptimizationRemark( + XlaOptimizationRemark::Warning optimization_warning, + string debug_information); + +// LINT.ThenChange(//tensorflow/compiler/jit/xla_activity.proto) + +// Various components of the system can subclass XlaActivityListener to +// notifications on auto-clustering and JIT compilation events. +// +// Subclasses of XlaActivityListener must be thread safe. +class XlaActivityListener { + public: + // Called after TensorFlow auto-clusters a graph. + virtual Status Listen( + const XlaAutoClusteringActivity& auto_clustering_activity) = 0; + + // Called after TensorFlow JIT compiles an XLA cluster. + virtual Status Listen( + const XlaJitCompilationActivity& jit_compilation_activity) = 0; + + // Called after TensorFlow realizes possible lost performance. + virtual Status Listen(const XlaOptimizationRemark& optimization_remark) = 0; + + // Called at program exit in best-effort manner to give listeners a chance to + // flush their state. + // + // Default implementation is a no-op. + virtual void Flush(); + + virtual ~XlaActivityListener(); +}; + +// Registers an `XlaActivityListener`, which will be invoked on all subsequent +// `BroadcastXlaActivity` calls. +void RegisterXlaActivityListener(std::unique_ptr listener); +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_JIT_XLA_ACTIVITY_LISTENER_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/xla_cluster_util.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/xla_cluster_util.h new file mode 100644 index 0000000000000000000000000000000000000000..22dd2662b79984fcaff529e6a64895b076c7984f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/xla_cluster_util.h @@ -0,0 +1,113 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +// Contains utilities for clustering compilable graph nodes via XLA. + +#ifndef TENSORFLOW_COMPILER_JIT_XLA_CLUSTER_UTIL_H_ +#define TENSORFLOW_COMPILER_JIT_XLA_CLUSTER_UTIL_H_ + +#include + +#include "absl/container/flat_hash_map.h" +#include "absl/container/flat_hash_set.h" +#include "absl/types/optional.h" +#include "tensorflow/compiler/jit/xla_activity.pb.h" +#include "xla/service/graphcycles/graphcycles.h" +#include "xla/statusor.h" +#include "tensorflow/core/common_runtime/optimization_registry.h" +#include "tensorflow/core/graph/algorithm.h" + +namespace tensorflow { + +// The attribute that marks nodes to be grouped into functions by the +// encapsulate subgraphs pass. +extern const char* const kXlaClusterAttr; + +// The attribute that marks certain inputs to a Node as required to be a +// constant at compile time. If this attribute is present then the +// CompileTimeConstantInput information in the corresponding XlaOpKernel is +// ignored. +// +// The value for this attribute, if present, has to be a list of strings naming +// the inputs to the node that must be constant. +extern const char* const kXlaCompileTimeConstantInputsAttr; + +using OrderedNodeSet = std::set; + +// Returns true if `node` has a ref tensor input that it forwards to its output. +bool HasForwardedRefInput(const Node& node); + +// Creates a graph representation to enable cycle detection when clustering. +// This representation handles loops in graph by disconnecting each loop from +// the enclosing graph. +// +// Returns true for success and false for valid graphs that we can't handle yet +// (b/127521408). +StatusOr CreateCycleDetectionGraph(const Graph* graph, + GraphCycles* cycles); + +// Returns the XLA cluster in which `node` is placed if it is in an XLA cluster, +// otherwise returns nullopt. +std::optional GetXlaClusterForNode(const Node& node); + +// Removes `node_def` its XLA cluster (by clearing its _XlaCluster attribute). +void RemoveFromXlaCluster(NodeDef* node_def); + +// Removes `node` its XLA cluster (by clearing its _XlaCluster attribute). +void RemoveFromXlaCluster(Node* node); + +// Returns true if `node` has a DT_RESOURCE typed input or output. +bool HasResourceInputOrOutput(const Node& node); + +// Determines the global jit level based on GraphOptimizationPassOptions, +// --tf_xla_auto_jit and whether the graph is a single GPU graph. +OptimizerOptions::GlobalJitLevel GetGlobalJitLevelForGraph( + const GraphOptimizationPassOptions& options); + +// Returns true if `g` is a single-GPU graph. A single-GPU graph uses exactly +// one GPU (and any number of CPUs). +bool IsSingleGpuGraph(const Graph& g); + +// Returns true if it is possible (but not guaranteed) that `n` calls a +// function. +bool MayCallFunction(const Node& n, const FunctionLibraryDefinition* flib_def); + +// Returns true if `node` an operator that consumes only the shape of its input, +// not the data itself. +bool IsShapeConsumerOp(const Node& node); + +// Computes a clustering summary for `graph`. See documentation on +// `XlaAutoClusteringSummary` for details. +XlaAutoClusteringSummary GetXlaAutoClusteringSummary(const Graph& graph); + +// Returns the set of nodes that have a path to or from nodes that may have ref +// variables as input or output. +// +// We assume each node has a trivial path to itself so the returned set includes +// all of the nodes that have ref variables as input or output. +StatusOr> GetNodesRelatedToRefVariables( + const Graph& graph, FunctionLibraryRuntime* lib_runtime); + +// Deterministically serialized the graph to a byte string. +StatusOr SerializeGraphDeterministic(const Graph& graph); + +// Computes a fingerprint of the given `graph`. The fingerprint can use used to +// check if two graphs are likely the same but should not be relied on +// determining if the graphs are identical. +StatusOr FingerprintGraph(const Graph& graph); + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_JIT_XLA_CLUSTER_UTIL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/xla_compilation_cache.pb.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/xla_compilation_cache.pb.h new file mode 100644 index 0000000000000000000000000000000000000000..0d3e68ae99f135f5252be862f1360b65e9281e05 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/xla_compilation_cache.pb.h @@ -0,0 +1,870 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tensorflow/compiler/jit/xla_compilation_cache.proto + +#ifndef GOOGLE_PROTOBUF_INCLUDED_tensorflow_2fcompiler_2fjit_2fxla_5fcompilation_5fcache_2eproto +#define GOOGLE_PROTOBUF_INCLUDED_tensorflow_2fcompiler_2fjit_2fxla_5fcompilation_5fcache_2eproto + +#include +#include + +#include +#if PROTOBUF_VERSION < 3021000 +#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 3021009 < 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 // IWYU pragma: export +#include // IWYU pragma: export +#include +#include "xla/service/hlo.pb.h" +// @@protoc_insertion_point(includes) +#include +#define PROTOBUF_INTERNAL_EXPORT_tensorflow_2fcompiler_2fjit_2fxla_5fcompilation_5fcache_2eproto +PROTOBUF_NAMESPACE_OPEN +namespace internal { +class AnyMetadata; +} // namespace internal +PROTOBUF_NAMESPACE_CLOSE + +// Internal implementation detail -- do not use these members. +struct TableStruct_tensorflow_2fcompiler_2fjit_2fxla_5fcompilation_5fcache_2eproto { + static const uint32_t offsets[]; +}; +extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_tensorflow_2fcompiler_2fjit_2fxla_5fcompilation_5fcache_2eproto; +namespace tensorflow { +class XlaSerializedCacheEntry; +struct XlaSerializedCacheEntryDefaultTypeInternal; +extern XlaSerializedCacheEntryDefaultTypeInternal _XlaSerializedCacheEntry_default_instance_; +class XlaSerializedCacheKey; +struct XlaSerializedCacheKeyDefaultTypeInternal; +extern XlaSerializedCacheKeyDefaultTypeInternal _XlaSerializedCacheKey_default_instance_; +} // namespace tensorflow +PROTOBUF_NAMESPACE_OPEN +template<> ::tensorflow::XlaSerializedCacheEntry* Arena::CreateMaybeMessage<::tensorflow::XlaSerializedCacheEntry>(Arena*); +template<> ::tensorflow::XlaSerializedCacheKey* Arena::CreateMaybeMessage<::tensorflow::XlaSerializedCacheKey>(Arena*); +PROTOBUF_NAMESPACE_CLOSE +namespace tensorflow { + +// =================================================================== + +class XlaSerializedCacheKey final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:tensorflow.XlaSerializedCacheKey) */ { + public: + inline XlaSerializedCacheKey() : XlaSerializedCacheKey(nullptr) {} + ~XlaSerializedCacheKey() override; + explicit PROTOBUF_CONSTEXPR XlaSerializedCacheKey(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + XlaSerializedCacheKey(const XlaSerializedCacheKey& from); + XlaSerializedCacheKey(XlaSerializedCacheKey&& from) noexcept + : XlaSerializedCacheKey() { + *this = ::std::move(from); + } + + inline XlaSerializedCacheKey& operator=(const XlaSerializedCacheKey& from) { + CopyFrom(from); + return *this; + } + inline XlaSerializedCacheKey& operator=(XlaSerializedCacheKey&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const XlaSerializedCacheKey& default_instance() { + return *internal_default_instance(); + } + static inline const XlaSerializedCacheKey* internal_default_instance() { + return reinterpret_cast( + &_XlaSerializedCacheKey_default_instance_); + } + static constexpr int kIndexInFileMessages = + 0; + + friend void swap(XlaSerializedCacheKey& a, XlaSerializedCacheKey& b) { + a.Swap(&b); + } + inline void Swap(XlaSerializedCacheKey* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(XlaSerializedCacheKey* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + XlaSerializedCacheKey* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const XlaSerializedCacheKey& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom( const XlaSerializedCacheKey& from) { + XlaSerializedCacheKey::MergeImpl(*this, from); + } + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); + public: + 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(XlaSerializedCacheKey* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "tensorflow.XlaSerializedCacheKey"; + } + protected: + explicit XlaSerializedCacheKey(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kDeviceTypeFieldNumber = 3, + kPrefixFieldNumber = 4, + kSignatureFingerprintFieldNumber = 1, + kClusterFingerprintFieldNumber = 2, + kCompiledUsingPjrtFieldNumber = 5, + }; + // string device_type = 3; + void clear_device_type(); + const std::string& device_type() const; + template + void set_device_type(ArgT0&& arg0, ArgT... args); + std::string* mutable_device_type(); + PROTOBUF_NODISCARD std::string* release_device_type(); + void set_allocated_device_type(std::string* device_type); + private: + const std::string& _internal_device_type() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_device_type(const std::string& value); + std::string* _internal_mutable_device_type(); + public: + + // string prefix = 4; + void clear_prefix(); + const std::string& prefix() const; + template + void set_prefix(ArgT0&& arg0, ArgT... args); + std::string* mutable_prefix(); + PROTOBUF_NODISCARD std::string* release_prefix(); + void set_allocated_prefix(std::string* prefix); + private: + const std::string& _internal_prefix() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_prefix(const std::string& value); + std::string* _internal_mutable_prefix(); + public: + + // uint64 signature_fingerprint = 1; + void clear_signature_fingerprint(); + uint64_t signature_fingerprint() const; + void set_signature_fingerprint(uint64_t value); + private: + uint64_t _internal_signature_fingerprint() const; + void _internal_set_signature_fingerprint(uint64_t value); + public: + + // uint64 cluster_fingerprint = 2; + void clear_cluster_fingerprint(); + uint64_t cluster_fingerprint() const; + void set_cluster_fingerprint(uint64_t value); + private: + uint64_t _internal_cluster_fingerprint() const; + void _internal_set_cluster_fingerprint(uint64_t value); + public: + + // bool compiled_using_pjrt = 5; + void clear_compiled_using_pjrt(); + bool compiled_using_pjrt() const; + void set_compiled_using_pjrt(bool value); + private: + bool _internal_compiled_using_pjrt() const; + void _internal_set_compiled_using_pjrt(bool value); + public: + + // @@protoc_insertion_point(class_scope:tensorflow.XlaSerializedCacheKey) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr device_type_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr prefix_; + uint64_t signature_fingerprint_; + uint64_t cluster_fingerprint_; + bool compiled_using_pjrt_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_tensorflow_2fcompiler_2fjit_2fxla_5fcompilation_5fcache_2eproto; +}; +// ------------------------------------------------------------------- + +class XlaSerializedCacheEntry final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:tensorflow.XlaSerializedCacheEntry) */ { + public: + inline XlaSerializedCacheEntry() : XlaSerializedCacheEntry(nullptr) {} + ~XlaSerializedCacheEntry() override; + explicit PROTOBUF_CONSTEXPR XlaSerializedCacheEntry(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + XlaSerializedCacheEntry(const XlaSerializedCacheEntry& from); + XlaSerializedCacheEntry(XlaSerializedCacheEntry&& from) noexcept + : XlaSerializedCacheEntry() { + *this = ::std::move(from); + } + + inline XlaSerializedCacheEntry& operator=(const XlaSerializedCacheEntry& from) { + CopyFrom(from); + return *this; + } + inline XlaSerializedCacheEntry& operator=(XlaSerializedCacheEntry&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const XlaSerializedCacheEntry& default_instance() { + return *internal_default_instance(); + } + static inline const XlaSerializedCacheEntry* internal_default_instance() { + return reinterpret_cast( + &_XlaSerializedCacheEntry_default_instance_); + } + static constexpr int kIndexInFileMessages = + 1; + + friend void swap(XlaSerializedCacheEntry& a, XlaSerializedCacheEntry& b) { + a.Swap(&b); + } + inline void Swap(XlaSerializedCacheEntry* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(XlaSerializedCacheEntry* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + XlaSerializedCacheEntry* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const XlaSerializedCacheEntry& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom( const XlaSerializedCacheEntry& from) { + XlaSerializedCacheEntry::MergeImpl(*this, from); + } + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); + public: + 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(XlaSerializedCacheEntry* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "tensorflow.XlaSerializedCacheEntry"; + } + protected: + explicit XlaSerializedCacheEntry(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kExecutableFieldNumber = 3, + kKeyFieldNumber = 1, + kHloModuleFieldNumber = 2, + }; + // bytes executable = 3; + void clear_executable(); + const std::string& executable() const; + template + void set_executable(ArgT0&& arg0, ArgT... args); + std::string* mutable_executable(); + PROTOBUF_NODISCARD std::string* release_executable(); + void set_allocated_executable(std::string* executable); + private: + const std::string& _internal_executable() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_executable(const std::string& value); + std::string* _internal_mutable_executable(); + public: + + // .tensorflow.XlaSerializedCacheKey key = 1; + bool has_key() const; + private: + bool _internal_has_key() const; + public: + void clear_key(); + const ::tensorflow::XlaSerializedCacheKey& key() const; + PROTOBUF_NODISCARD ::tensorflow::XlaSerializedCacheKey* release_key(); + ::tensorflow::XlaSerializedCacheKey* mutable_key(); + void set_allocated_key(::tensorflow::XlaSerializedCacheKey* key); + private: + const ::tensorflow::XlaSerializedCacheKey& _internal_key() const; + ::tensorflow::XlaSerializedCacheKey* _internal_mutable_key(); + public: + void unsafe_arena_set_allocated_key( + ::tensorflow::XlaSerializedCacheKey* key); + ::tensorflow::XlaSerializedCacheKey* unsafe_arena_release_key(); + + // .xla.HloModuleProto hlo_module = 2; + bool has_hlo_module() const; + private: + bool _internal_has_hlo_module() const; + public: + void clear_hlo_module(); + const ::xla::HloModuleProto& hlo_module() const; + PROTOBUF_NODISCARD ::xla::HloModuleProto* release_hlo_module(); + ::xla::HloModuleProto* mutable_hlo_module(); + void set_allocated_hlo_module(::xla::HloModuleProto* hlo_module); + private: + const ::xla::HloModuleProto& _internal_hlo_module() const; + ::xla::HloModuleProto* _internal_mutable_hlo_module(); + public: + void unsafe_arena_set_allocated_hlo_module( + ::xla::HloModuleProto* hlo_module); + ::xla::HloModuleProto* unsafe_arena_release_hlo_module(); + + // @@protoc_insertion_point(class_scope:tensorflow.XlaSerializedCacheEntry) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr executable_; + ::tensorflow::XlaSerializedCacheKey* key_; + ::xla::HloModuleProto* hlo_module_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_tensorflow_2fcompiler_2fjit_2fxla_5fcompilation_5fcache_2eproto; +}; +// =================================================================== + + +// =================================================================== + +#ifdef __GNUC__ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wstrict-aliasing" +#endif // __GNUC__ +// XlaSerializedCacheKey + +// uint64 signature_fingerprint = 1; +inline void XlaSerializedCacheKey::clear_signature_fingerprint() { + _impl_.signature_fingerprint_ = uint64_t{0u}; +} +inline uint64_t XlaSerializedCacheKey::_internal_signature_fingerprint() const { + return _impl_.signature_fingerprint_; +} +inline uint64_t XlaSerializedCacheKey::signature_fingerprint() const { + // @@protoc_insertion_point(field_get:tensorflow.XlaSerializedCacheKey.signature_fingerprint) + return _internal_signature_fingerprint(); +} +inline void XlaSerializedCacheKey::_internal_set_signature_fingerprint(uint64_t value) { + + _impl_.signature_fingerprint_ = value; +} +inline void XlaSerializedCacheKey::set_signature_fingerprint(uint64_t value) { + _internal_set_signature_fingerprint(value); + // @@protoc_insertion_point(field_set:tensorflow.XlaSerializedCacheKey.signature_fingerprint) +} + +// uint64 cluster_fingerprint = 2; +inline void XlaSerializedCacheKey::clear_cluster_fingerprint() { + _impl_.cluster_fingerprint_ = uint64_t{0u}; +} +inline uint64_t XlaSerializedCacheKey::_internal_cluster_fingerprint() const { + return _impl_.cluster_fingerprint_; +} +inline uint64_t XlaSerializedCacheKey::cluster_fingerprint() const { + // @@protoc_insertion_point(field_get:tensorflow.XlaSerializedCacheKey.cluster_fingerprint) + return _internal_cluster_fingerprint(); +} +inline void XlaSerializedCacheKey::_internal_set_cluster_fingerprint(uint64_t value) { + + _impl_.cluster_fingerprint_ = value; +} +inline void XlaSerializedCacheKey::set_cluster_fingerprint(uint64_t value) { + _internal_set_cluster_fingerprint(value); + // @@protoc_insertion_point(field_set:tensorflow.XlaSerializedCacheKey.cluster_fingerprint) +} + +// string device_type = 3; +inline void XlaSerializedCacheKey::clear_device_type() { + _impl_.device_type_.ClearToEmpty(); +} +inline const std::string& XlaSerializedCacheKey::device_type() const { + // @@protoc_insertion_point(field_get:tensorflow.XlaSerializedCacheKey.device_type) + return _internal_device_type(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void XlaSerializedCacheKey::set_device_type(ArgT0&& arg0, ArgT... args) { + + _impl_.device_type_.Set(static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:tensorflow.XlaSerializedCacheKey.device_type) +} +inline std::string* XlaSerializedCacheKey::mutable_device_type() { + std::string* _s = _internal_mutable_device_type(); + // @@protoc_insertion_point(field_mutable:tensorflow.XlaSerializedCacheKey.device_type) + return _s; +} +inline const std::string& XlaSerializedCacheKey::_internal_device_type() const { + return _impl_.device_type_.Get(); +} +inline void XlaSerializedCacheKey::_internal_set_device_type(const std::string& value) { + + _impl_.device_type_.Set(value, GetArenaForAllocation()); +} +inline std::string* XlaSerializedCacheKey::_internal_mutable_device_type() { + + return _impl_.device_type_.Mutable(GetArenaForAllocation()); +} +inline std::string* XlaSerializedCacheKey::release_device_type() { + // @@protoc_insertion_point(field_release:tensorflow.XlaSerializedCacheKey.device_type) + return _impl_.device_type_.Release(); +} +inline void XlaSerializedCacheKey::set_allocated_device_type(std::string* device_type) { + if (device_type != nullptr) { + + } else { + + } + _impl_.device_type_.SetAllocated(device_type, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.device_type_.IsDefault()) { + _impl_.device_type_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:tensorflow.XlaSerializedCacheKey.device_type) +} + +// string prefix = 4; +inline void XlaSerializedCacheKey::clear_prefix() { + _impl_.prefix_.ClearToEmpty(); +} +inline const std::string& XlaSerializedCacheKey::prefix() const { + // @@protoc_insertion_point(field_get:tensorflow.XlaSerializedCacheKey.prefix) + return _internal_prefix(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void XlaSerializedCacheKey::set_prefix(ArgT0&& arg0, ArgT... args) { + + _impl_.prefix_.Set(static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:tensorflow.XlaSerializedCacheKey.prefix) +} +inline std::string* XlaSerializedCacheKey::mutable_prefix() { + std::string* _s = _internal_mutable_prefix(); + // @@protoc_insertion_point(field_mutable:tensorflow.XlaSerializedCacheKey.prefix) + return _s; +} +inline const std::string& XlaSerializedCacheKey::_internal_prefix() const { + return _impl_.prefix_.Get(); +} +inline void XlaSerializedCacheKey::_internal_set_prefix(const std::string& value) { + + _impl_.prefix_.Set(value, GetArenaForAllocation()); +} +inline std::string* XlaSerializedCacheKey::_internal_mutable_prefix() { + + return _impl_.prefix_.Mutable(GetArenaForAllocation()); +} +inline std::string* XlaSerializedCacheKey::release_prefix() { + // @@protoc_insertion_point(field_release:tensorflow.XlaSerializedCacheKey.prefix) + return _impl_.prefix_.Release(); +} +inline void XlaSerializedCacheKey::set_allocated_prefix(std::string* prefix) { + if (prefix != nullptr) { + + } else { + + } + _impl_.prefix_.SetAllocated(prefix, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.prefix_.IsDefault()) { + _impl_.prefix_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:tensorflow.XlaSerializedCacheKey.prefix) +} + +// bool compiled_using_pjrt = 5; +inline void XlaSerializedCacheKey::clear_compiled_using_pjrt() { + _impl_.compiled_using_pjrt_ = false; +} +inline bool XlaSerializedCacheKey::_internal_compiled_using_pjrt() const { + return _impl_.compiled_using_pjrt_; +} +inline bool XlaSerializedCacheKey::compiled_using_pjrt() const { + // @@protoc_insertion_point(field_get:tensorflow.XlaSerializedCacheKey.compiled_using_pjrt) + return _internal_compiled_using_pjrt(); +} +inline void XlaSerializedCacheKey::_internal_set_compiled_using_pjrt(bool value) { + + _impl_.compiled_using_pjrt_ = value; +} +inline void XlaSerializedCacheKey::set_compiled_using_pjrt(bool value) { + _internal_set_compiled_using_pjrt(value); + // @@protoc_insertion_point(field_set:tensorflow.XlaSerializedCacheKey.compiled_using_pjrt) +} + +// ------------------------------------------------------------------- + +// XlaSerializedCacheEntry + +// .tensorflow.XlaSerializedCacheKey key = 1; +inline bool XlaSerializedCacheEntry::_internal_has_key() const { + return this != internal_default_instance() && _impl_.key_ != nullptr; +} +inline bool XlaSerializedCacheEntry::has_key() const { + return _internal_has_key(); +} +inline void XlaSerializedCacheEntry::clear_key() { + if (GetArenaForAllocation() == nullptr && _impl_.key_ != nullptr) { + delete _impl_.key_; + } + _impl_.key_ = nullptr; +} +inline const ::tensorflow::XlaSerializedCacheKey& XlaSerializedCacheEntry::_internal_key() const { + const ::tensorflow::XlaSerializedCacheKey* p = _impl_.key_; + return p != nullptr ? *p : reinterpret_cast( + ::tensorflow::_XlaSerializedCacheKey_default_instance_); +} +inline const ::tensorflow::XlaSerializedCacheKey& XlaSerializedCacheEntry::key() const { + // @@protoc_insertion_point(field_get:tensorflow.XlaSerializedCacheEntry.key) + return _internal_key(); +} +inline void XlaSerializedCacheEntry::unsafe_arena_set_allocated_key( + ::tensorflow::XlaSerializedCacheKey* key) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.key_); + } + _impl_.key_ = key; + if (key) { + + } else { + + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.XlaSerializedCacheEntry.key) +} +inline ::tensorflow::XlaSerializedCacheKey* XlaSerializedCacheEntry::release_key() { + + ::tensorflow::XlaSerializedCacheKey* temp = _impl_.key_; + _impl_.key_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::tensorflow::XlaSerializedCacheKey* XlaSerializedCacheEntry::unsafe_arena_release_key() { + // @@protoc_insertion_point(field_release:tensorflow.XlaSerializedCacheEntry.key) + + ::tensorflow::XlaSerializedCacheKey* temp = _impl_.key_; + _impl_.key_ = nullptr; + return temp; +} +inline ::tensorflow::XlaSerializedCacheKey* XlaSerializedCacheEntry::_internal_mutable_key() { + + if (_impl_.key_ == nullptr) { + auto* p = CreateMaybeMessage<::tensorflow::XlaSerializedCacheKey>(GetArenaForAllocation()); + _impl_.key_ = p; + } + return _impl_.key_; +} +inline ::tensorflow::XlaSerializedCacheKey* XlaSerializedCacheEntry::mutable_key() { + ::tensorflow::XlaSerializedCacheKey* _msg = _internal_mutable_key(); + // @@protoc_insertion_point(field_mutable:tensorflow.XlaSerializedCacheEntry.key) + return _msg; +} +inline void XlaSerializedCacheEntry::set_allocated_key(::tensorflow::XlaSerializedCacheKey* key) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete _impl_.key_; + } + if (key) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(key); + if (message_arena != submessage_arena) { + key = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, key, submessage_arena); + } + + } else { + + } + _impl_.key_ = key; + // @@protoc_insertion_point(field_set_allocated:tensorflow.XlaSerializedCacheEntry.key) +} + +// .xla.HloModuleProto hlo_module = 2; +inline bool XlaSerializedCacheEntry::_internal_has_hlo_module() const { + return this != internal_default_instance() && _impl_.hlo_module_ != nullptr; +} +inline bool XlaSerializedCacheEntry::has_hlo_module() const { + return _internal_has_hlo_module(); +} +inline const ::xla::HloModuleProto& XlaSerializedCacheEntry::_internal_hlo_module() const { + const ::xla::HloModuleProto* p = _impl_.hlo_module_; + return p != nullptr ? *p : reinterpret_cast( + ::xla::_HloModuleProto_default_instance_); +} +inline const ::xla::HloModuleProto& XlaSerializedCacheEntry::hlo_module() const { + // @@protoc_insertion_point(field_get:tensorflow.XlaSerializedCacheEntry.hlo_module) + return _internal_hlo_module(); +} +inline void XlaSerializedCacheEntry::unsafe_arena_set_allocated_hlo_module( + ::xla::HloModuleProto* hlo_module) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.hlo_module_); + } + _impl_.hlo_module_ = hlo_module; + if (hlo_module) { + + } else { + + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.XlaSerializedCacheEntry.hlo_module) +} +inline ::xla::HloModuleProto* XlaSerializedCacheEntry::release_hlo_module() { + + ::xla::HloModuleProto* temp = _impl_.hlo_module_; + _impl_.hlo_module_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::xla::HloModuleProto* XlaSerializedCacheEntry::unsafe_arena_release_hlo_module() { + // @@protoc_insertion_point(field_release:tensorflow.XlaSerializedCacheEntry.hlo_module) + + ::xla::HloModuleProto* temp = _impl_.hlo_module_; + _impl_.hlo_module_ = nullptr; + return temp; +} +inline ::xla::HloModuleProto* XlaSerializedCacheEntry::_internal_mutable_hlo_module() { + + if (_impl_.hlo_module_ == nullptr) { + auto* p = CreateMaybeMessage<::xla::HloModuleProto>(GetArenaForAllocation()); + _impl_.hlo_module_ = p; + } + return _impl_.hlo_module_; +} +inline ::xla::HloModuleProto* XlaSerializedCacheEntry::mutable_hlo_module() { + ::xla::HloModuleProto* _msg = _internal_mutable_hlo_module(); + // @@protoc_insertion_point(field_mutable:tensorflow.XlaSerializedCacheEntry.hlo_module) + return _msg; +} +inline void XlaSerializedCacheEntry::set_allocated_hlo_module(::xla::HloModuleProto* hlo_module) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete reinterpret_cast< ::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.hlo_module_); + } + if (hlo_module) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena( + reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(hlo_module)); + if (message_arena != submessage_arena) { + hlo_module = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, hlo_module, submessage_arena); + } + + } else { + + } + _impl_.hlo_module_ = hlo_module; + // @@protoc_insertion_point(field_set_allocated:tensorflow.XlaSerializedCacheEntry.hlo_module) +} + +// bytes executable = 3; +inline void XlaSerializedCacheEntry::clear_executable() { + _impl_.executable_.ClearToEmpty(); +} +inline const std::string& XlaSerializedCacheEntry::executable() const { + // @@protoc_insertion_point(field_get:tensorflow.XlaSerializedCacheEntry.executable) + return _internal_executable(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void XlaSerializedCacheEntry::set_executable(ArgT0&& arg0, ArgT... args) { + + _impl_.executable_.SetBytes(static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:tensorflow.XlaSerializedCacheEntry.executable) +} +inline std::string* XlaSerializedCacheEntry::mutable_executable() { + std::string* _s = _internal_mutable_executable(); + // @@protoc_insertion_point(field_mutable:tensorflow.XlaSerializedCacheEntry.executable) + return _s; +} +inline const std::string& XlaSerializedCacheEntry::_internal_executable() const { + return _impl_.executable_.Get(); +} +inline void XlaSerializedCacheEntry::_internal_set_executable(const std::string& value) { + + _impl_.executable_.Set(value, GetArenaForAllocation()); +} +inline std::string* XlaSerializedCacheEntry::_internal_mutable_executable() { + + return _impl_.executable_.Mutable(GetArenaForAllocation()); +} +inline std::string* XlaSerializedCacheEntry::release_executable() { + // @@protoc_insertion_point(field_release:tensorflow.XlaSerializedCacheEntry.executable) + return _impl_.executable_.Release(); +} +inline void XlaSerializedCacheEntry::set_allocated_executable(std::string* executable) { + if (executable != nullptr) { + + } else { + + } + _impl_.executable_.SetAllocated(executable, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.executable_.IsDefault()) { + _impl_.executable_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:tensorflow.XlaSerializedCacheEntry.executable) +} + +#ifdef __GNUC__ + #pragma GCC diagnostic pop +#endif // __GNUC__ +// ------------------------------------------------------------------- + + +// @@protoc_insertion_point(namespace_scope) + +} // namespace tensorflow + +// @@protoc_insertion_point(global_scope) + +#include +#endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_tensorflow_2fcompiler_2fjit_2fxla_5fcompilation_5fcache_2eproto diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/xla_compile_on_demand_op.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/xla_compile_on_demand_op.h new file mode 100644 index 0000000000000000000000000000000000000000..d8dead2737d7943aa1cf2ffcfa7cdb4d7a11589c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/xla_compile_on_demand_op.h @@ -0,0 +1,77 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +// The XlaCompileOnDemandOp is an OpKernel that, when its Compute method is +// called, will generate an xla::Computation and run it asynchronously. + +#ifndef TENSORFLOW_COMPILER_JIT_XLA_COMPILE_ON_DEMAND_OP_H_ +#define TENSORFLOW_COMPILER_JIT_XLA_COMPILE_ON_DEMAND_OP_H_ + +#include + +#include "tensorflow/compiler/jit/device_compilation_profiler.h" +#include "tensorflow/compiler/jit/variable_info.h" +#include "tensorflow/compiler/jit/variable_info_util.h" +#include "tensorflow/compiler/jit/xla_launch_util.h" +#include "tensorflow/compiler/jit/xla_platform_info.h" +#include "tensorflow/compiler/tf2xla/xla_compiler.h" +#include "xla/client/local_client.h" +#include "xla/pjrt/pjrt_client.h" +#include "tensorflow/core/framework/function.h" +#include "tensorflow/core/framework/tensor.h" +#include "tensorflow/core/framework/types.h" +#include "tensorflow/core/lib/core/status.h" + +namespace tensorflow { + +// An OpKernel that compiles an op to an XLA computation and runs it. Unlike +// XlaLaunch this doesn't rely on any rewrites of the graphdef - it will run a +// vanilla TensorFlow op as long as the bridge supports it. +class XlaCompileOnDemandOp : public OpKernel { + public: + explicit XlaCompileOnDemandOp(OpKernelConstruction* ctx) + : OpKernel(ctx), + platform_info_(XlaPlatformInfoFromDevice(ctx->device())) {} + void Compute(OpKernelContext* ctx) override; + + private: + Status Compile(const std::vector& args, + OpKernelContext* ctx, + DeviceCompiler** + xla_device_compiler, + DeviceCompilationProfiler** profiler, + const XlaCompiler::CompilationResult** result, + xla::LocalExecutable** executable); + + Status Compile(const std::vector& args, + OpKernelContext* ctx, + DeviceCompiler** + pjrt_device_compiler, + DeviceCompilationProfiler** profiler, + const XlaCompiler::CompilationResult** result, + xla::PjRtLoadedExecutable** executable); + + Status Run(const ResourceVarsSnapshot& variable_args, + const XlaCompiler::CompilationResult* result, + const DeviceCompiler* + xla_device_compiler, + xla::LocalExecutable* executable, OpKernelContext* ctx); + + const XlaPlatformInfo platform_info_; +}; + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_JIT_XLA_COMPILE_ON_DEMAND_OP_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/xla_compile_util.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/xla_compile_util.h new file mode 100644 index 0000000000000000000000000000000000000000..5fa1b40f821c48e8e2985897e7e506d2ac0a8d8c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/xla_compile_util.h @@ -0,0 +1,67 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_JIT_XLA_COMPILE_UTIL_H_ +#define TENSORFLOW_COMPILER_JIT_XLA_COMPILE_UTIL_H_ + +#include +#include + +#include "tensorflow/compiler/tf2xla/xla_argument.h" +#include "tensorflow/core/graph/graph.h" + +namespace tensorflow { +// The number of compiler threads to use for asynchronous device compilation. +inline constexpr int64_t kNumAsyncDeviceCompilerThreads = 10; + +enum class DeviceCompileMode { + kLazy, + kStrict, + kAsync, +}; + +enum class DeviceCompileState { + kUncompiled, + kCompiling, + kCompiled, +}; + +// Creates a single-node graph using the specified `node_def` as the only op +// apart from the arg and retval nodes corresponding to `args` and +// `result_types` respectively. +StatusOr> CreateSingleOpGraph( + const NodeDef& node_def, absl::Span args, + absl::Span result_types); + +// Checks if single device compilation and execution with PJRT is enabled for +// `device_type` in either the XlaLaunch op or the XlaCompileOnDemand op. +bool UsePjRtForSingleDeviceCompilation(const DeviceType& device_type); + +// Gets the resource name of the PjRt DeviceCompiler for `device_type`. +std::string GetPjRtDeviceCompilerResourceName(const DeviceType& device_type); + +// Gets the resource name of the DeviceCompilationProfiler for `device_type` +// when PjRt is used for compilation and execution. +std::string GetPjRtDeviceCompilationProfilerResourceName( + const DeviceType& device_type); + +// Gets the ResourceMgr where the DeviceCompiler is/should be stored for the +// given `device_type`. +StatusOr GetResourceMgrForDeviceCompiler( + const OpKernelContext& ctx, const DeviceType& device_type); + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_JIT_XLA_COMPILE_UTIL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/xla_compiler_options_util.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/xla_compiler_options_util.h new file mode 100644 index 0000000000000000000000000000000000000000..f11129266e3b87293e880d382906e3961512b527 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/xla_compiler_options_util.h @@ -0,0 +1,56 @@ +/* Copyright 2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_JIT_XLA_COMPILER_OPTIONS_UTIL_H_ +#define TENSORFLOW_COMPILER_JIT_XLA_COMPILER_OPTIONS_UTIL_H_ + +#include "tensorflow/compiler/jit/device_compiler.h" +#include "tensorflow/compiler/jit/xla_platform_info.h" +#include "tensorflow/compiler/tf2xla/xla_compiler.h" +#include "xla/client/local_client.h" +#include "xla/pjrt/pjrt_client.h" + +namespace tensorflow { + +// Returns created options for the XLA compiler. +XlaCompiler::Options GenerateCompilerOptions( + const DeviceCompiler& + xla_device_compiler, + const FunctionLibraryRuntime& function_library, DeviceBase* device, + se::Stream* stream, const XlaPlatformInfo& platform_info, + bool has_ref_vars); + +// Returns created options for XLA compiler when TFRT-TPU is used. +XlaCompiler::Options GenerateCompilerOptionsForTfrtTpu( + const DeviceCompiler& + xla_device_compiler, + const FunctionLibraryRuntime& function_library); + +// Returns created options for XLA compiler when PjRt (Device API) is used for +// compilation and execution. +// TODO(b/255826209): Remove default arg once PjRtCompileOnDemand op is deleted. +XlaCompiler::Options GenerateCompilerOptionsForPjRt( + const FunctionLibraryRuntime& function_library, + const DeviceBase* device_base, const XlaPlatformInfo& platform_info, + const DeviceCompiler* + pjrt_device_compiler = nullptr); + +// Returns created CompileOptions for XLA compiler. +XlaCompiler::CompileOptions GenerateCompileOptions( + bool has_ref_vars, bool may_alias_resource_update); + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_JIT_XLA_COMPILER_OPTIONS_UTIL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/xla_device.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/xla_device.h new file mode 100644 index 0000000000000000000000000000000000000000..e5f42cba7b44ed89d528d71d069c6a39727b4e4d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/xla_device.h @@ -0,0 +1,318 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +// The XlaDevice executes a TensorFlow graph using the XLA linear algebra +// runtime. +// +// Operators assigned to an XlaDevice are compiled into XLA computations. +// Tensors on an XlaDevice are thin wrappers around XLA ScopedShapedBuffers. +// +// XlaDevice is instantiated separately for each XLA backend (e.g., CPU or GPU), +// under different names (e.g., XLA_CPU or XLA_GPU). + +#ifndef TENSORFLOW_COMPILER_JIT_XLA_DEVICE_H_ +#define TENSORFLOW_COMPILER_JIT_XLA_DEVICE_H_ +#include + +#include "absl/types/optional.h" +#include "tensorflow/compiler/jit/xla_tensor.h" +#include "tensorflow/compiler/tf2xla/layout_util.h" +#include "tensorflow/compiler/tf2xla/xla_compiler.h" +#include "tensorflow/compiler/tf2xla/xla_op_registry.h" +#include "xla/client/local_client.h" +#include "tensorflow/core/common_runtime/device_factory.h" +#include "tensorflow/core/common_runtime/local_device.h" +#include "tensorflow/core/framework/allocator.h" +#include "tensorflow/core/framework/device_base.h" +#include "tensorflow/core/framework/node_def_builder.h" +#include "tensorflow/core/framework/op_kernel.h" +#include "tensorflow/core/framework/resource_mgr.h" +#include "tensorflow/core/framework/tensor.h" +#include "tensorflow/core/framework/types.h" +#include "tensorflow/core/lib/core/status.h" +#include "tensorflow/core/platform/mutex.h" +#include "tensorflow/core/platform/stream_executor_no_cuda.h" +#include "tensorflow/core/tfrt/common/async_value_tensor.h" + +namespace tensorflow { + +class XlaDevice : public LocalDevice { + public: + // Given a tensor, sets `xla::Shape*` the shape of tensor's representation + // on device, fully padded. On error, the contents of `xla::Shape*` + // are undefined. + typedef std::function PaddedShapeFn; + + // Wrapper class to store metadata about the XlaDevice, where it can be + // retrieved e.g., when lazily creating the XlaCompilationCache device. + class Metadata { + public: + Metadata(int device_ordinal, se::Platform* platform, + const DeviceType& device_type, + std::vector + shape_determination_fns, + PaddedShapeFn padded_shape_fn, bool use_multiple_streams); + + // The index of the device on this host. + int device_ordinal() const; + + se::Platform* platform() const; + xla::LocalClient* client() const; + const DeviceType& jit_device_type() const; + const XlaShapeLayoutHelpers::ShapeDeterminationFns& + default_shape_determination_fns() const { + return shape_determination_fns_.at(0); + } + const PaddedShapeFn& padded_shape_fn() const { return padded_shape_fn_; } + + bool UseMultipleStreams() const { return use_multiple_streams_; } + + private: + const int device_ordinal_; + const DeviceType device_type_; + se::Platform* platform_; // Not owned. + std::vector + shape_determination_fns_; + PaddedShapeFn padded_shape_fn_; + const bool use_multiple_streams_; + + TF_DISALLOW_COPY_AND_ASSIGN(Metadata); + }; + + // Sets `*metadata` to the XlaDevice Metadata in the XLA device used by `ctx`. + static Status GetMetadata(OpKernelContext* ctx, const Metadata** metadata); + + // Sets `*metadata` to the XlaDevice Metadata in the XLA device used by `ctx`. + static Status GetMetadata(OpKernelConstruction* ctx, + const Metadata** metadata); + + // Sets `*metadata` to the XlaDevice Metadata in the XLA device used by + // `device`. + static Status GetMetadataFromDevice(DeviceBase* device, + const XlaDevice::Metadata** metadata); + + struct Options { + // The StreamExecutor platform. Not owned. Must be non-null. + se::Platform* platform = nullptr; + + // The device name's prefix (e.g., "/task:7") + string device_name_prefix; + + // The name of the XLA device (e.g., "XLA_CPU") + string device_name; + + // The number of the device. + int device_ordinal = -1; + + // The name of the compilation device (e.g., "XLA_CPU_JIT"); + string compilation_device_name; + + // If 'use_multiple_streams' is true, we create separate streams for + // compute, host-to-device, and device-to-host communication. + bool use_multiple_streams = false; + + // If true, the XLA devices with the same device ordinal will share the same + // compute stream. Otherwise each XLA device will having their own compute + // streams. + bool use_global_compute_stream = false; + + // A vector of ShapeDeterminationFn (i.e., a bundle of LayoutSelectionFn, + // ShapeRepresentationFn). Each bundle describes how the on-host shapes of + // a) argument and return value, for entry computations b) variables, for + // all computations, should be represented in XLA. Parameters/return values + // will be shaped according to the function pair, and reshaped back to/from + // their declared shapes for computations. Must be non-empty. + std::vector + shape_determination_fns; + + // If padded_shape_fn is empty, a default implementation that returns + // the logical on-device shape without padding is used. + PaddedShapeFn padded_shape_fn; + + // Set of devices to use. This controls which of the devices on the given + // platform will have resources allocated. For GPUs this will be + // filled from visible_gpu_devices list from session configuration. + std::optional> allowed_devices; + }; + + // Creates a new XLA Device. + XlaDevice(const SessionOptions& session_options, const Options& options); + ~XlaDevice() override; + + Allocator* GetAllocator(AllocatorAttributes attr) override + TF_LOCKS_EXCLUDED(mu_); + void Compute(OpKernel* op_kernel, OpKernelContext* context) override; + void ComputeAsync(AsyncOpKernel* op_kernel, OpKernelContext* context, + AsyncOpKernel::DoneCallback done) override; + Status Sync() override; + void Sync(const DoneCallback& done) override; + + Status TryGetDeviceContext(DeviceContext** out_context) override + TF_LOCKS_EXCLUDED(mu_); + + Status MakeTensorFromProto(const TensorProto& tensor_proto, + const AllocatorAttributes alloc_attrs, + Tensor* tensor) override TF_LOCKS_EXCLUDED(mu_); + + Status MakeTensorFromProto(DeviceContext* device_context, + const TensorProto& tensor_proto, + const AllocatorAttributes alloc_attrs, + Tensor* tensor); + + const Metadata& metadata() { return xla_metadata_; } + + // Ensures the DeviceContext associated with this XlaDevice is created and + // valid (i.e. all streams are ok). If any state is not valid, a new + // DeviceContext will be created. + // + // TODO(b/111859745): The Eager context needs to call this method to recover + // from failures. + Status EnsureDeviceContextOk() TF_LOCKS_EXCLUDED(mu_); + + // Two convenient methods to get the underlying device context. + // Get the default device context, created by the first + // shape_representation_fn. + StatusOr GetDeviceContextDefault(); + // Get the device context given the index. + StatusOr GetDeviceContextWithIndex(int index); + + // Instructs this XlaDevice to set a AcceleratorDeviceInfo, which holds extra + // information for GPU and TPU devices. + Status UseAcceleratorDeviceInfo() TF_LOCKS_EXCLUDED(mu_); + + // Instructs this XlaDevice to return 'sync_on_completion' for + // AllowsSyncOnCompletion(). + void SetAllowsSyncOnCompletion(bool sync_on_completion) + TF_LOCKS_EXCLUDED(mu_); + bool AllowsSyncOnCompletion() const override TF_LOCKS_EXCLUDED(mu_); + + // Installs an error handling callback when RefreshStatus sees !status.ok(). + void SetHandleDeviceErrorCallback(std::function callback); + + Status RefreshStatus() override TF_LOCKS_EXCLUDED(mu_); + + private: + StatusOr GetOrCreateClient() const; + Allocator* GetAllocatorLocked(AllocatorAttributes attr) + TF_EXCLUSIVE_LOCKS_REQUIRED(mu_); + Status EnsureStreamOkLocked(xla::Backend* backend, const string& name, + std::shared_ptr* stream, + bool* stream_was_changed) + TF_EXCLUSIVE_LOCKS_REQUIRED(mu_); + + // Return a vector of device context, ordered by the sequence in the given + // shape_representation_fns. + StatusOr> GetDeviceContextLocked() + TF_EXCLUSIVE_LOCKS_REQUIRED(mu_); + + // Handles error when RefreshStatus sees !status.ok(). + Status HandleDeviceError(); + + mutable mutex mu_; + // The metadata of this XlaDevice. + const Metadata xla_metadata_; + // Which hardware device in the client's platform this XlaDevice controls. + const int device_ordinal_; + // The name/type of this XlaDevice. eg. "XLA_GPU". + const DeviceType device_name_; + // The name of the device that is used to compile Ops for this XlaDevice. + const DeviceType jit_device_name_; + // The platform for this device. + se::Platform* const platform_; // Not owned. + // Intra-op threads to spawn (from SessionOptions). + const int intra_op_parallelism_threads_; + // Memory allocator associated with this device. + Allocator* xla_allocator_ TF_GUARDED_BY(mu_) = nullptr; // Not owned. + std::unique_ptr pjrt_allocator_ TF_GUARDED_BY(mu_); + + // Stream associated with this device. Operations enqueued on this + // stream are executed on the device. Operations include data + // copying back and forth between CPU and the device, and + // computations enqueued by XLA. + std::shared_ptr stream_ TF_GUARDED_BY(mu_); + // If false, only stream_ is valid and all computation and transfers use + // stream_. If true, computation is performed by stream_ and transfers are + // performed by host_to_device/device_to_device stream or borrowing a stream + // for each device to host transfer. + const bool use_multiple_streams_; + // If use_multiple_streams_, host to device transfers are performed using this + // stream. + std::shared_ptr host_to_device_stream_ TF_GUARDED_BY(mu_); + // If use_multiple_streams_, transfers between different devices are performed + // using these streams. + std::vector> device_to_device_streams_ + TF_GUARDED_BY(mu_); + + // See comments in options. + std::vector + shape_determination_fns_; + + // A list of the device context accessed by all users of the XlaDevice, set by + // calls to EnsureDeviceContextOk. The number of device conetexts is based on + // the number of shape representation functions in XlaDevice::Options. If + // accelerator_device_info_ is non-null, this pointer is also filled in to + // that struct. DeviceContext is a ref-counted object. + std::vector device_contexts_ TF_GUARDED_BY(mu_); + + // Holds extra information for GPU and TPU devices, e.g. the device context. + bool use_accelerator_device_info_ TF_GUARDED_BY(mu_) = false; + std::unique_ptr accelerator_device_info_ + TF_GUARDED_BY(mu_); + + // Thread pool used for running closures + std::unique_ptr thread_pool_; + + // True if the device allows XlaDevice::Sync to be called on completion + // regardless of status. + bool sync_on_completion_ TF_GUARDED_BY(mu_) = true; + + // A callback that will be invoked when RefreshStatus sees a status error. + std::function device_error_callback_ TF_GUARDED_BY(mu_); + + // Set of devices to use. This controls which of the devices on the given + // platform will have resources allocated. For GPUs this will be + // filled from visible_gpu_devices list from session configuration. + std::optional> allowed_devices_; + + const bool use_global_compute_stream_; + + // A static vector with device_ordinal as its index, describing the global + // compute streams used in each XLA device. It is only used if + // `use_global_compute_stream` in `XlaDevice::Options` is set to true. + static mutex global_mu_; + static std::vector>* global_compute_streams_ + TF_GUARDED_BY(global_mu_); +}; + +// Builds OpKernel registrations on 'device' for the JIT operators +// registered on 'jit_device'. Returns ownership of a XlaDeviceOpRegistrations +// object that encapsulates the kernel registrations. +struct XlaDeviceOpRegistrations { + std::vector> + op_kernel_registrars; +}; + +XlaDeviceOpRegistrations* RegisterXlaDeviceKernels( + const char* device, const char* jit_device, + OpKernel* (*factory)(OpKernelConstruction*), StringPiece kernel_class_name); + +XlaDeviceOpRegistrations* RegisterXlaDeviceKernels(const char* device, + const char* jit_device); + +Status DefaultPaddedShapeFn(const Tensor& tensor, xla::Shape* shape); + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_JIT_XLA_DEVICE_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/xla_device_compiler_client.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/xla_device_compiler_client.h new file mode 100644 index 0000000000000000000000000000000000000000..20aab4193c33878ceea1cdd11e283f3b550dd6d5 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/xla_device_compiler_client.h @@ -0,0 +1,68 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_JIT_XLA_DEVICE_COMPILER_CLIENT_H_ +#define TENSORFLOW_COMPILER_JIT_XLA_DEVICE_COMPILER_CLIENT_H_ + +#include +#include +#include + +#include "tensorflow/compiler/jit/device_compiler_client.h" +#include "xla/client/local_client.h" + +namespace tensorflow { + +class XlaDeviceCompilerClient + : public DeviceCompilerClient { + public: + explicit XlaDeviceCompilerClient(xla::LocalClient* client) + : client_(client) {} + + StatusOr> BuildExecutable( + const XlaCompiler::Options& options, + const XlaCompiler::CompilationResult& result) override; + + // Returns a serialized AOT result obtained by exporting the available + // `executable` using the XlaCompiler. + StatusOr SerializeExecutable( + const xla::LocalExecutable& executable) override; + + // Returns a serialized AOT result obtained by compiling `result` into an AOT + // result. + StatusOr BuildSerializedExecutable( + const XlaCompiler::Options& options, + const XlaCompiler::CompilationResult& result) override; + + // Loads a serialized AOT result (`serialized_executable`) into an + // xla::LocalExecutable and returns it. + StatusOr> LoadExecutable( + const XlaCompiler::Options& options, + const XlaCompiler::CompilationResult& result, + const std::string& serialized_executable) override; + + void WaitForProgramsToFinish() override; + + xla::LocalClient* client() const override { return client_; } + + private: + xla::LocalClient* const client_; + + TF_DISALLOW_COPY_AND_ASSIGN(XlaDeviceCompilerClient); +}; + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_JIT_XLA_DEVICE_COMPILER_CLIENT_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/xla_device_context.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/xla_device_context.h new file mode 100644 index 0000000000000000000000000000000000000000..a0c72517cd5ebe6422ef717b5dacb5564e5a6671 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/xla_device_context.h @@ -0,0 +1,128 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_JIT_XLA_DEVICE_CONTEXT_H_ +#define TENSORFLOW_COMPILER_JIT_XLA_DEVICE_CONTEXT_H_ + +#include + +#include "absl/synchronization/mutex.h" +#include "tensorflow/compiler/jit/xla_tensor.h" +#include "tensorflow/compiler/tf2xla/layout_util.h" +#include "tensorflow/compiler/tf2xla/xla_compiler.h" +#include "xla/client/global_data.h" +#include "xla/client/local_client.h" +#include "tensorflow/core/framework/allocator.h" +#include "tensorflow/core/framework/device_base.h" +#include "tensorflow/core/lib/core/status.h" + +namespace tensorflow { + +// The allocator used for Tensors assigned to the XLA device. The allocator +// ignores the alignment and size of the request and always returns a new, +// empty, XlaTensor. +class XlaDeviceAllocator : public Allocator { + public: + XlaDeviceAllocator(se::StreamExecutor* stream_executor); + ~XlaDeviceAllocator() override; + + string Name() override; + + void* AllocateRaw(size_t alignment, size_t num_bytes) override; + void DeallocateRaw(void* ptr) override; + std::optional GetStats() override; + bool ClearStats() override; + + private: + // The stream executor of the device. + se::StreamExecutor* stream_executor_; +}; + +// Helper class for managing data transfers between host and XLA devices. +class XlaDeviceContext : public DeviceContext { + public: + explicit XlaDeviceContext( + std::shared_ptr compute_stream, + std::shared_ptr host_to_device_stream, + std::shared_ptr device_to_host_stream, + std::vector> device_to_device_streams, + xla::LocalClient* client, + XlaShapeLayoutHelpers::ShapeDeterminationFns shape_determination_fns, + thread::ThreadPool* thread_pool); + + void CopyCPUTensorToDevice(const Tensor* cpu_tensor, Device* device, + Tensor* device_tensor, StatusCallback done, + bool sync_dst_compute) const override; + void CopyDeviceTensorToCPU(const Tensor* device_tensor, + absl::string_view tensor_name, Device* device, + Tensor* cpu_tensor, StatusCallback done) override; + void CopyTensorInSameDevice(const Tensor* input_tensor, Device* device, + Tensor* output_tensor, + StatusCallback done) const override; + + xla::LocalClient* client() const { return client_; } + se::Stream* stream() const override { return stream_.get(); } + se::Stream* host_to_device_stream() const { + return host_to_device_stream_.get(); + } + se::Stream* device_to_device_stream(int index) const { + return device_to_device_streams_.at(index).get(); + } + xla::TransferManager* transfer_manager() const { return transfer_manager_; } + const XlaShapeLayoutHelpers::ShapeDeterminationFns& shape_determination_fns() + const { + return shape_determination_fns_; + } + + // Returns a device-to-device stream, in round-robin fashion. + se::Stream* GetDeviceToDeviceStream(); + + Status ThenExecute(Device* device, stream_executor::Stream* stream, + std::function func) override; + + private: + bool UseMultipleStreams() const { return stream_ != host_to_device_stream_; } + + // The main compute stream of the device, used to synchronize the transfer + // streams if they are set. + std::shared_ptr stream_; + // The stream to use for transferring data from host to device. Can be + // idential to stream_, but must not be nullptr. + std::shared_ptr host_to_device_stream_; + // The stream to use for transferring data from device to host. Can be + // idential to stream_. If nullptr, borrow a stream from backend for each + // transfer request to support out-of-order requests. + std::shared_ptr device_to_host_stream_; + // Streams to use for transferring data directly between different devices, + // e.g., over NVLINK. + std::vector> device_to_device_streams_; + + // For the underlying memory allocator and XLA's TransferManager. + xla::LocalClient* client_; + // Transfer manager, for marshalling data to and from the device. + xla::TransferManager* transfer_manager_; + + XlaShapeLayoutHelpers::ShapeDeterminationFns shape_determination_fns_; + + // Thread pool used for running closures + thread::ThreadPool* thread_pool_; + + absl::Mutex mu_; + int next_stream_ TF_GUARDED_BY(mu_) = 0; +}; + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_JIT_XLA_DEVICE_CONTEXT_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/xla_device_ops.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/xla_device_ops.h new file mode 100644 index 0000000000000000000000000000000000000000..fdb284460514e2739f38e812f008716cd30c17a9 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/xla_device_ops.h @@ -0,0 +1,256 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +// Common kernel registrations for XLA devices. + +#ifndef TENSORFLOW_COMPILER_JIT_XLA_DEVICE_OPS_H_ +#define TENSORFLOW_COMPILER_JIT_XLA_DEVICE_OPS_H_ + +#include "tensorflow/core/framework/op_kernel.h" +#include "tensorflow/core/framework/resource_mgr.h" +#include "tensorflow/core/kernels/constant_op.h" +#include "tensorflow/core/kernels/data/finalize_dataset_op.h" +#include "tensorflow/core/kernels/data/generator_dataset_op.h" +#include "tensorflow/core/kernels/data/iterator_ops.h" +#include "tensorflow/core/kernels/data/optional_ops.h" +#include "tensorflow/core/kernels/data/options_dataset_op.h" +#include "tensorflow/core/kernels/data/prefetch_dataset_op.h" +#include "tensorflow/core/kernels/fifo_queue.h" +#include "tensorflow/core/kernels/function_ops.h" +#include "tensorflow/core/kernels/identity_op.h" +#include "tensorflow/core/kernels/resource_variable_ops.h" +#include "tensorflow/core/kernels/shape_ops.h" +#include "tensorflow/core/kernels/variable_ops.h" + +namespace tensorflow { + +// Dummy OpKernel, used for kernels assigned to an XLA device that should be +// compiled. Should never be called at runtime since such ops should be +// rewritten to a XlaLaunch op. If it is called, it means the placer placed an +// operator on an XLA device but the compiler did not compile it. +class XlaDeviceDummyOp : public OpKernel { + public: + explicit XlaDeviceDummyOp(OpKernelConstruction* ctx); + void Compute(OpKernelContext* ctx) override; +}; + +class XlaAssignVariableOp : public OpKernel { + public: + explicit XlaAssignVariableOp(OpKernelConstruction* c); + void Compute(OpKernelContext* context) override; + + private: + DataType dtype_; +}; + +#define REGISTER_XLA_LAUNCH_KERNEL(DEVICE, KERNEL, TYPES) \ + REGISTER_KERNEL_BUILDER(Name("XlaLaunch") \ + .Device(DEVICE) \ + .HostMemory("constants") \ + .HostMemory("resources"), \ + KERNEL); + +#define REGISTER_XLA_COMPILE_KERNEL(DEVICE, KERNEL, TYPES) \ + REGISTER_KERNEL_BUILDER(Name("_XlaCompile") \ + .Device(DEVICE) \ + .HostMemory("constants") \ + .HostMemory("key") \ + .HostMemory("compilation_successful") \ + .HostMemory("resources"), \ + KERNEL); + +#define REGISTER_XLA_RUN_KERNEL(DEVICE, KERNEL, TYPES) \ + REGISTER_KERNEL_BUILDER(Name("_XlaRun").Device(DEVICE), KERNEL); + +#define REGISTER_XLA_DEVICE_KERNELS(DEVICE, TYPES) \ + REGISTER_KERNEL_BUILDER( \ + Name("Const").Device(DEVICE).TypeConstraint("dtype", TYPES), \ + ConstantOp); \ + REGISTER_KERNEL_BUILDER( \ + Name("Identity").Device(DEVICE).TypeConstraint("T", TYPES), IdentityOp); \ + \ + REGISTER_KERNEL_BUILDER( \ + Name("VarHandleOp").Device(DEVICE).HostMemory("resource"), VarHandleOp); \ + REGISTER_KERNEL_BUILDER( \ + Name("_VarHandlesOp").Device(DEVICE).HostMemory("resources"), \ + ResourceHandlesOp); \ + REGISTER_KERNEL_BUILDER( \ + Name("ReadVariableOp").Device(DEVICE).HostMemory("resource"), \ + ReadVariableOp); \ + REGISTER_KERNEL_BUILDER( \ + Name("_ReadVariablesOp").Device(DEVICE).HostMemory("resources"), \ + ReadVariablesOp); \ + REGISTER_KERNEL_BUILDER( \ + Name("DestroyResourceOp").Device(DEVICE).HostMemory("resource"), \ + DestroyResourceOp); \ + REGISTER_KERNEL_BUILDER(Name("Shape") \ + .Device(DEVICE) \ + .HostMemory("output") \ + .TypeConstraint("out_type") \ + .TypeConstraint("T", TYPES), \ + ShapeOp); \ + REGISTER_KERNEL_BUILDER(Name("Shape") \ + .Device(DEVICE) \ + .HostMemory("output") \ + .TypeConstraint("out_type") \ + .TypeConstraint("T", TYPES), \ + ShapeOp); \ + REGISTER_KERNEL_BUILDER(Name("ShapeN") \ + .Device(DEVICE) \ + .HostMemory("output") \ + .TypeConstraint("out_type") \ + .TypeConstraint("T", TYPES), \ + ShapeNOp); \ + REGISTER_KERNEL_BUILDER(Name("ShapeN") \ + .Device(DEVICE) \ + .HostMemory("output") \ + .TypeConstraint("out_type") \ + .TypeConstraint("T", TYPES), \ + ShapeNOp); \ + REGISTER_KERNEL_BUILDER(Name("VariableShape") \ + .Device(DEVICE) \ + .TypeConstraint("out_type") \ + .HostMemory("output") \ + .HostMemory("input"), \ + VariableShapeOp); \ + REGISTER_KERNEL_BUILDER(Name("VariableShape") \ + .Device(DEVICE) \ + .TypeConstraint("out_type") \ + .HostMemory("output") \ + .HostMemory("input"), \ + VariableShapeOp); \ + REGISTER_KERNEL_BUILDER(Name("Size") \ + .Device(DEVICE) \ + .HostMemory("output") \ + .TypeConstraint("out_type") \ + .TypeConstraint("T", TYPES), \ + SizeOp); \ + REGISTER_KERNEL_BUILDER(Name("Size") \ + .Device(DEVICE) \ + .HostMemory("output") \ + .TypeConstraint("out_type") \ + .TypeConstraint("T", TYPES), \ + SizeOp); \ + REGISTER_KERNEL_BUILDER( \ + Name("Rank").Device(DEVICE).HostMemory("output").TypeConstraint("T", \ + TYPES), \ + RankOp); \ + REGISTER_KERNEL_BUILDER( \ + Name("AssignVariableOp").Device(DEVICE).HostMemory("resource"), \ + XlaAssignVariableOp); \ + \ + REGISTER_KERNEL_BUILDER( \ + Name("FIFOQueueV2").Device(DEVICE).HostMemory("handle"), FIFOQueueOp); \ + \ + REGISTER_KERNEL_BUILDER( \ + Name(kArgOp).Device(DEVICE).TypeConstraint("T", TYPES), ArgOp); \ + REGISTER_KERNEL_BUILDER(Name(kArgOp) \ + .Device(DEVICE) \ + .HostMemory("output") \ + .TypeConstraint("T"), \ + ArgOp); \ + REGISTER_KERNEL_BUILDER( \ + Name(kArgOp).Device(DEVICE).TypeConstraint("T"), ArgOp); \ + \ + REGISTER_KERNEL_BUILDER( \ + Name(kRetOp).Device(DEVICE).TypeConstraint("T", TYPES), RetvalOp); \ + REGISTER_KERNEL_BUILDER(Name(kRetOp) \ + .Device(DEVICE) \ + .TypeConstraint("T") \ + .HostMemory("input"), \ + RetvalOp); \ + REGISTER_KERNEL_BUILDER( \ + Name(kDeviceRetOp).Device(DEVICE).TypeConstraint("T"), RetvalOp); \ + \ + REGISTER_KERNEL_BUILDER( \ + Name("RemoteCall").Device(DEVICE).HostMemory("target"), RemoteCallOp); \ + \ + REGISTER_KERNEL_BUILDER( \ + Name("GeneratorDataset").Device(DEVICE).HostMemory("handle"), \ + data::GeneratorDatasetOp); \ + REGISTER_KERNEL_BUILDER(Name("PrefetchDataset") \ + .Device(DEVICE) \ + .HostMemory("buffer_size") \ + .HostMemory("input_dataset") \ + .HostMemory("handle"), \ + data::PrefetchDatasetOp); \ + REGISTER_KERNEL_BUILDER(Name("OptionsDataset") \ + .Device(DEVICE) \ + .HostMemory("input_dataset") \ + .HostMemory("handle"), \ + data::OptionsDatasetOp); \ + REGISTER_KERNEL_BUILDER(Name("FinalizeDataset") \ + .Device(DEVICE) \ + .HostMemory("input_dataset") \ + .HostMemory("handle"), \ + data::FinalizeDatasetOp); \ + \ + REGISTER_KERNEL_BUILDER(Name("IteratorV2").Device(DEVICE), \ + data::IteratorHandleOp); \ + REGISTER_KERNEL_BUILDER( \ + Name("MakeIterator").Device(DEVICE).HostMemory("dataset"), \ + data::MakeIteratorOp); \ + REGISTER_KERNEL_BUILDER(Name("AnonymousIterator").Device(DEVICE), \ + data::AnonymousIteratorHandleOp); \ + REGISTER_KERNEL_BUILDER(Name("AnonymousIteratorV2").Device(DEVICE), \ + data::AnonymousIteratorHandleOp); \ + REGISTER_KERNEL_BUILDER(Name("AnonymousIteratorV3").Device(DEVICE), \ + data::AnonymousIteratorHandleOp); \ + REGISTER_KERNEL_BUILDER(Name("DeleteIterator").Device(DEVICE), \ + data::DeleteIteratorOp); \ + REGISTER_KERNEL_BUILDER(Name("IteratorGetNext").Device(DEVICE), \ + data::IteratorGetNextOp); \ + REGISTER_KERNEL_BUILDER(Name("IteratorGetNextAsOptional").Device(DEVICE), \ + data::IteratorGetNextAsOptionalOp); \ + REGISTER_KERNEL_BUILDER(Name("IteratorGetNextSync").Device(DEVICE), \ + data::IteratorGetNextOp); \ + REGISTER_KERNEL_BUILDER(Name("IteratorToStringHandle") \ + .Device(DEVICE) \ + .HostMemory("string_handle"), \ + data::IteratorToStringHandleOp); \ + REGISTER_KERNEL_BUILDER(Name("IteratorFromStringHandleV2") \ + .Device(DEVICE) \ + .HostMemory("string_handle"), \ + data::IteratorFromStringHandleOp); \ + REGISTER_KERNEL_BUILDER(Name("OptionalNone").Device(DEVICE), \ + data::OptionalNoneOp); \ + REGISTER_KERNEL_BUILDER(Name("OptionalFromValue").Device(DEVICE), \ + data::OptionalFromValueOp); \ + REGISTER_KERNEL_BUILDER( \ + Name("OptionalHasValue").Device(DEVICE).HostMemory("has_value"), \ + data::OptionalHasValueOp); \ + REGISTER_KERNEL_BUILDER(Name("OptionalGetValue").Device(DEVICE), \ + data::OptionalGetValueOp); \ + REGISTER_KERNEL_BUILDER(Name(FunctionLibraryDefinition::kArgOp) \ + .Device(DEVICE) \ + .HostMemory("output") \ + .TypeConstraint("T"), \ + ArgOp); \ + REGISTER_KERNEL_BUILDER(Name(FunctionLibraryDefinition::kRetOp) \ + .Device(DEVICE) \ + .TypeConstraint("T") \ + .HostMemory("input"), \ + RetvalOp); + +// TODO(b/118881356): currently we do not register the QueueEnqueueMany, +// QueueDequeueMany, or QueueDequeueUpTo kernels because they attempt to read +// and write the tensors they access in order to concatenate them into a batch. +// We would need either to call out to an XLA computation to perform the +// concatenation, or we would need to refactor those kernels so the splitting +// or merging is done in a separate operator that can be compiled. + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_JIT_XLA_DEVICE_OPS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/xla_host_recv_device_context.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/xla_host_recv_device_context.h new file mode 100644 index 0000000000000000000000000000000000000000..83e6e17d67f83dcb68c67e1bec8dfcac6bec5d03 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/xla_host_recv_device_context.h @@ -0,0 +1,92 @@ +/* Copyright 2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ +#ifndef TENSORFLOW_COMPILER_JIT_XLA_HOST_RECV_DEVICE_CONTEXT_H_ +#define TENSORFLOW_COMPILER_JIT_XLA_HOST_RECV_DEVICE_CONTEXT_H_ + +#include "xla/shape.h" +#include "xla/stream_executor/device_memory.h" +#include "xla/stream_executor/stream.h" +#include "tensorflow/core/framework/device_base.h" +#include "tfrt/concurrency/async_value_ref.h" // from @tf_runtime + +namespace tensorflow { + +// XlaHostRecvDeviceContext is a DeviceContext that is intended to be +// used to transfer from device->host using Rendezvous. It transfers the +// content of `device_memory_base` with `shape` using `stream`. Only +// `CopyDeviceTensorToCPU` method is implemented. The `done_event` is marked as +// Concrete once transfer is completed. +// +// Example usage: +// +// Device device; +// stream_executor::Stream stream(executor); +// Tensor device_tensor(device_allocator, DT_FLOAT, TensorShape({2, 2})); +// se::DeviceMemoryBase gpu_dst{device_tensor.data(), 4 * sizeof(float)}; +// xla::Shape shape(xla::F32, {2, 2}, {}, {}) +// tsl::AsyncValueRef done_event = +// tsl::MakeConstructedAsyncValueRef(stream.parent()); +// done_event->Init(); +// Tensor dest_cpu_tensor; +// +// XlaHostRecvDeviceContext device_context(&stream, gpu_dst, +// shape, done_event); +// device_context.CopyDeviceTensorToCPUSync( +// &device_tensor, "", &device, &dest_cpu_tensor); + +class XlaHostRecvDeviceContext : public DeviceContext { + public: + XlaHostRecvDeviceContext(se::Stream* stream, + const se::DeviceMemoryBase& device_memory_base, + const xla::Shape& shape, + tsl::AsyncValueRef& done_event) + : stream_(stream), + device_memory_base_(device_memory_base), + shape_(shape), + done_event_(done_event) {} + + void CopyCPUTensorToDevice(const Tensor* cpu_tensor, Device* device, + Tensor* device_tensor, StatusCallback done, + bool sync_dst_compute) const override { + done(errors::Internal("host->device copy not implemented.")); + } + + // Copies `device_memory_base_` with `shape_` into `cpu_tensor`. + // `device_tensor` is unused. + void CopyDeviceTensorToCPU(const Tensor* device_tensor, + StringPiece tensor_name, Device* device, + Tensor* cpu_tensor, StatusCallback done) override; + + void CopyTensorInSameDevice(const Tensor* input_tensor, Device* device, + Tensor* output_tensor, + StatusCallback done) const override { + done(errors::Internal("device->device copy not implemented.")); + } + + private: + se::Stream* stream_; // Not owned. + // This is copied rather than a reference or pointer since its lifetime + // is not guaranteed to outlast the original object. Object slicing is + // not an issue here since only DeviceMemoryBase methods/members are used. + const se::DeviceMemoryBase device_memory_base_; + const xla::Shape shape_; + tsl::AsyncValueRef done_event_; + + TF_DISALLOW_COPY_AND_ASSIGN(XlaHostRecvDeviceContext); +}; + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_JIT_XLA_HOST_RECV_DEVICE_CONTEXT_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/xla_host_send_device_context.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/xla_host_send_device_context.h new file mode 100644 index 0000000000000000000000000000000000000000..88c1324a84bbbc0363fc57debbef207b490950e8 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/xla_host_send_device_context.h @@ -0,0 +1,89 @@ +/* Copyright 2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ +#ifndef TENSORFLOW_COMPILER_JIT_XLA_HOST_SEND_DEVICE_CONTEXT_H_ +#define TENSORFLOW_COMPILER_JIT_XLA_HOST_SEND_DEVICE_CONTEXT_H_ + +#include "xla/shape.h" +#include "xla/stream_executor/device_memory.h" +#include "xla/stream_executor/stream.h" +#include "tensorflow/core/framework/device_base.h" +#include "tfrt/concurrency/async_value_ref.h" // from @tf_runtime + +namespace tensorflow { + +// XlaHostSendDeviceContext is a DeviceContext that is intended to be +// used to transfer from host->device using Rendezvous. It transfers the +// content of `device_memory_base` with `shape` using `stream`. Only +// `CopyCPUTensorToDevice` method is implemented. The `done_event` is marked as +// Concrete once transfer is completed. +// +// Example usage: +// +// Device device; +// stream_executor::Stream stream(executor); +// Tensor cpu_tensor(host_allocator, DT_FLOAT, TensorShape({2, 2})); +// Tensor device_tensor(device_allocator, DT_FLOAT, TensorShape({2, 2})); +// se::DeviceMemoryBase gpu_dst{device_tensor.data(), 4 * sizeof(float)}; +// xla::Shape shape(xla::F32, {2, 2}, {}, {}) +// tsl::AsyncValueRef done_event = +// tsl::MakeConstructedAsyncValueRef(stream.parent()); +// done_event->Init(); +// +// XlaHostSendDeviceContext device_context(&stream, &gpu_dst, +// shape, done_event); +// device_context.CopyCPUTensorToDeviceSync( +// &cpu_tensor, &device, &device_tensor); + +class XlaHostSendDeviceContext : public DeviceContext { + public: + XlaHostSendDeviceContext(se::Stream* stream, + se::DeviceMemoryBase* device_memory_base, + const xla::Shape& shape, + tsl::AsyncValueRef& done_event) + : stream_(stream), + device_memory_base_(device_memory_base), + shape_(shape), + done_event_(done_event) {} + + // Copies 'cpu_tensor' to `device_memory_base_` with `shape_`. + // `device_tensor` is unused. + void CopyCPUTensorToDevice(const Tensor* cpu_tensor, Device* device, + Tensor* device_tensor, StatusCallback done, + bool sync_dst_compute) const override; + + void CopyDeviceTensorToCPU(const Tensor* device_tensor, + StringPiece tensor_name, Device* device, + Tensor* cpu_tensor, StatusCallback done) override { + done(errors::Internal("host->device copy not implemented.")); + } + + void CopyTensorInSameDevice(const Tensor* input_tensor, Device* device, + Tensor* output_tensor, + StatusCallback done) const override { + done(errors::Internal("device->device copy not implemented.")); + } + + private: + se::Stream* stream_; // Not owned. + se::DeviceMemoryBase* device_memory_base_; // Not owned. + const xla::Shape shape_; + tsl::AsyncValueRef done_event_; + + TF_DISALLOW_COPY_AND_ASSIGN(XlaHostSendDeviceContext); +}; + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_JIT_XLA_HOST_SEND_DEVICE_CONTEXT_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/xla_kernel_creator.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/xla_kernel_creator.h new file mode 100644 index 0000000000000000000000000000000000000000..843a21acd19176bc3c86ec368129cc3ebffd70f5 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/xla_kernel_creator.h @@ -0,0 +1,49 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ +#ifndef TENSORFLOW_COMPILER_JIT_XLA_KERNEL_CREATOR_H_ +#define TENSORFLOW_COMPILER_JIT_XLA_KERNEL_CREATOR_H_ + +#include + +#include "tensorflow/core/framework/function.h" +#include "tensorflow/core/framework/node_def.pb.h" +#include "tensorflow/core/framework/node_properties.h" +#include "tensorflow/core/lib/core/status.h" + +namespace tensorflow { + +class FunctionLibraryRuntime; +class OpKernel; + +class XlaKernelCreator : public CustomKernelCreator { + public: + // Given a NodeDef 'node_def' and the function library runtime 'flr', returns + // true if 'node_def' is a call to a compilable function defined in 'flr', + // with the kXlaCompileAttr set. + bool CanCreateKernel( + const FunctionLibraryRuntime& flr, + const std::shared_ptr& props) const override; + + // Given a supported NodeDef, returns a XlaLaunchOp that computes the node. + Status CreateKernel(FunctionLibraryRuntime* flr, + const std::shared_ptr& props, + std::unique_ptr* kernel) const override; +}; + +bool RegisterLaunchOpCreator(); + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_JIT_XLA_KERNEL_CREATOR_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/xla_launch_util.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/xla_launch_util.h new file mode 100644 index 0000000000000000000000000000000000000000..97e26307bafdedc0af6808c262a15e4110537bfe --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/xla_launch_util.h @@ -0,0 +1,266 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +// Contains utilities for launching compiled XLA kernels for a KernelContext. + +#ifndef TENSORFLOW_COMPILER_JIT_XLA_LAUNCH_UTIL_H_ +#define TENSORFLOW_COMPILER_JIT_XLA_LAUNCH_UTIL_H_ + +#include +#include +#include +#include + +#include "tensorflow/compiler/jit/variable_info.h" +#include "tensorflow/compiler/jit/xla_tensor.h" +#include "tensorflow/compiler/tf2xla/xla_compiler.h" +#include "xla/client/local_client.h" +#include "xla/pjrt/pjrt_client.h" +#include "xla/service/shaped_buffer.h" +#include "xla/stream_executor/device_memory_allocator.h" +#include "tensorflow/core/framework/allocation_description.pb.h" +#include "tensorflow/core/framework/tensor.h" +#include "tensorflow/core/lib/core/status.h" +#include "tensorflow/core/platform/thread_annotations.h" + +namespace tensorflow { + +// Creates a list of updated resource variables. +StatusOr> GatherVariableInfo( + OpKernelContext* ctx, + const XlaCompiler::CompilationResult& compilation_result, + int missing_ctx_input_prefix); + +// Returns pointers to inputs stored in `ctx`. +std::vector InputsFromContext(OpKernelContext* ctx); + +StatusOr> GetConstantInputIndicesFromContext( + OpKernelContext* ctx); + +Status SetOutputForConstant( + OpKernelContext* ctx, bool requires_copy_to_device, + const XlaCompiler::CompilationResult* compilation_result, int output_num); + +// Converts input tensors and variables which are parameters of the +// XlaComputation into PjRtBuffers to be fed as input to the +// PjRtLoadedExecutable. +// +// Assumes that the first `num_missing_prefix_ctx_inputs` inputs to the +// compilation_result are missing in `inputs` and adjusts indexing into `inputs` +// accordingly. +// `input_mapping` is a vector that maps from the parameters of the +// XlaComputation to their original argument positions. This can be sourced from +// `XlaCompiler::CompilationResult::input_mapping`. +// `variable_snapshots` is a map of {index of the input to the +// compilation_result -> underlying Tensor the variable is/was pointing to (i.e. +// the value of the variable at the time of lowering/compilation)}. +// +// The obtained PjRtBuffers are populated to `args` vector. +// `non_donatable_input_indices` will also be set, which contains the indices of +// the input that should not be donated to output. +// +// There can be three types of input: 1. Tensor with PjRtTensorBuffer; 2. +// Tensor with AsyncValueTensor; 3. Tensor with raw device mem pointer. +// For case 3, we need to create a PjRtBuffer from the raw device mem pointer, +// and we need to ensure the PjRtBuffer persists till XLA computation is +// complete. Therefore we put the newly created PjRtBuffer into `owned_args`. +// Caller is responsible to ensure `owned_args` lives till the end of XLA +// computation. +Status PreparePjRtExecutableArguments( + int num_missing_prefix_ctx_inputs, const std::vector& input_mapping, + const std::vector& inputs, + const absl::flat_hash_map& variable_snapshots, + xla::PjRtClient* pjrt_client, xla::PjRtDevice* pjrt_device, + bool use_pjrt_tensor_buffer, std::vector* args, + std::vector>* owned_args, + absl::flat_hash_set* non_donatable_input_indices); + +// Populates the OpKernelContext outputs with the outputs of the +// PjRtLoadedExecutable. Requires the `compilation_result` used to build the +// PjRtLoadedExecutable. +// This function only looks at variables that were updated, so `variables` can +// either be all the variables or only the ones that were updated. +// Assumes that the first `num_missing_prefix_ctx_inputs` inputs to the +// compilation_result are missing in `inputs` and adjusts indexing into `inputs` +// accordingly. +Status PopulateCtxOutputsFromPjRtExecutableOutputs( + int num_missing_prefix_ctx_inputs, const std::vector& inputs, + const std::vector& variables, + const XlaCompiler::CompilationResult& compilation_result, + bool use_pjrt_tensor_buffer, + std::vector>& executable_outputs, + OpKernelContext* ctx); + +// Returns the options used for executing a PjRtLoadedExecutable. +xla::ExecuteOptions GetPjRtExecuteOptions( + const DeviceType& device_type, + absl::flat_hash_set non_donatable_input_indices); + +// Returns the device ordinal from the parsed name of the device. +int GetDeviceOrdinal(const DeviceBase* device); + +// Returns the device type from the OpKernelContext. +DeviceType GetDeviceType(OpKernelContext* ctx); + +// Runs `executable` and populates the outputs in `ctx`. `inputs` and +// `variables` are the input arguments to the computation, usually read from the +// OpKernelContext, `ctx`. Requires the device-appropriate `pjrt_client` and the +// `compilation_result` used to build the `executable`. +Status RunPjRtExecutable( + const std::vector& inputs, + const std::vector& variables, + const XlaCompiler::CompilationResult& compilation_result, + xla::PjRtClient* pjrt_client, xla::PjRtLoadedExecutable* executable, + OpKernelContext* ctx); + +// Same as the above function but takes in `updated_variables` and +// `variable_snapshots` which is a map of {index of the input to the +// compilation_result -> underlying Tensor the variable is/was pointing to +// (i.e. the value of the variable at the time of lowering/compilation)}. +// Assumes that the first `num_missing_prefix_ctx_inputs` inputs to the +// compilation_result are missing in `inputs` and adjusts indexing into `inputs` +// accordingly. +Status RunPjRtExecutable( + int num_missing_prefix_ctx_inputs, const std::vector& inputs, + const absl::flat_hash_map& variable_snapshots, + const std::vector& updated_variables, + const XlaCompiler::CompilationResult& compilation_result, + xla::PjRtClient* pjrt_client, xla::PjRtLoadedExecutable* executable, + OpKernelContext* ctx); + +// Similar to the above function but it does not take an OpKernelContext, and +// it returns the output in PjRtBuffers, instead of populating results into +// OpKernelContext. +StatusOr>> RunPjRtExecutable( + int num_missing_prefix_ctx_inputs, const std::vector& inputs, + const absl::flat_hash_map& variable_snapshots, + const std::vector& updated_variables, + const DeviceType& device_type, bool use_pjrt_tensor_buffer, + const XlaCompiler::CompilationResult& compilation_result, + xla::PjRtDevice* device, xla::PjRtClient* pjrt_client, + xla::PjRtLoadedExecutable* executable); + +// Helper class to perform the marshalling of TensorFlow inputs and outputs to +// ShapedBuffers suitable for passing to an XLA computation. +class XlaComputationLaunchContext { + public: + // Create a new launch context. 'allocate_xla_tensors' is true if allocated + // output tensors and variables are always XlaTensors. If false they are + // assumed to be "normal" device pointers. + // If 'use_multiple_streams' is true, tensors may be defined and used on + // multiple streams and so se::Events must be defined and waited for. If + // 'use_multiple_streams' is true, 'allocate_xla_tensors' must also be true + // because we track inter-stream dependencies through events inside XlaTensor + // objects. + XlaComputationLaunchContext(xla::LocalClient* client, + se::DeviceMemoryAllocator* xla_allocator, + int device_ordinal, bool allocate_xla_tensors, + bool use_multiple_streams); + + // Builds a XlaCompiler::Argument vector from the arguments to an XlaLaunch + // op. + // Precondition: variables in `variable_args` are locked. + static StatusOr> BuildXlaCompilerArguments( + absl::Span must_be_constant_idxs, + absl::Span inputs, + absl::Span variable_args, Device* device); + + // Add all inputs within `ctx` as XLA arguments (returned by arguments()). + // `variables` is a map from TensorFlow argument number to resource variable. + // + // Assumes that the first `missing_ctx_input_prefix` inputs to the kernel are + // missing and adjusts input indices accordingly. All elements in kernel's + // input_mapping must be greater than or equal to `missing_ctx_input_prefix` + // (in other words, no inputs actually required by the kernel can be missing). + StatusOr> PopulateInputs( + OpKernelContext* ctx, + const XlaCompiler::CompilationResult* compilation_result, + const std::map& resource_vars, + int missing_ctx_input_prefix, + const xla::HloInputOutputAliasConfig& input_output_alias); + + // Given the XLA output in `output`, populate all outputs of `ctx`. Also + // writes out the resource variable updates. + // + // Updates to all resource variables are written in a single atomic operation. + // This models *->Write dependencies between resource variable operations. + // See jit/resource_operation_safety_analysis for details. + // + // + // Assumes that the first `missing_ctx_input_prefix` inputs to the + // compilation_result are missing and adjusts input indices accordingly. + Status PopulateOutputs( + OpKernelContext* ctx, + const XlaCompiler::CompilationResult* compilation_result, + xla::ScopedShapedBuffer output, int missing_ctx_input_prefix, + absl::Span variable_infos, + const xla::HloInputOutputAliasConfig& input_output_alias, + const std::map& resource_vars); + + private: + xla::LocalClient* client_; + se::DeviceMemoryAllocator* xla_allocator_; + bool allocate_xla_tensors_; + bool use_multiple_streams_; + int device_ordinal_; +}; + +// A simple TensorBuffer implementation that allows us to create Tensors that +// take ownership of pre-allocated memory. +class XlaTensorBuffer : public TensorBuffer { + public: + XlaTensorBuffer(const void* ptr, size_t expected_size, size_t actual_size, + Allocator* allocator) + : TensorBuffer(const_cast(ptr)), + expected_size_(expected_size), + actual_size_(actual_size), + allocator_(allocator) {} + + ~XlaTensorBuffer() override { + if (data()) { + allocator_->DeallocateRaw(data()); + } + } + + size_t size() const override { return expected_size_; } + + TensorBuffer* root_buffer() override { return this; } + + void FillAllocationDescription(AllocationDescription* proto) const override { + proto->set_requested_bytes(static_cast(expected_size_)); + proto->set_allocator_name(allocator_->Name()); + proto->set_ptr(reinterpret_cast(data())); + if (allocator_->TracksAllocationSizes()) { + auto ab = static_cast(allocator_->AllocatedSize(data())); + proto->set_allocated_bytes(ab); + int64_t id = allocator_->AllocationId(data()); + if (id > 0) { + proto->set_allocation_id(id); + } + if (RefCountIsOne()) { + proto->set_has_single_reference(true); + } + } + } + + private: + size_t expected_size_; + size_t actual_size_; + Allocator* allocator_; +}; + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_JIT_XLA_LAUNCH_UTIL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/xla_platform_info.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/xla_platform_info.h new file mode 100644 index 0000000000000000000000000000000000000000..454a1230b0b03f2b312d69c4926dbb6b55c0216f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/xla_platform_info.h @@ -0,0 +1,165 @@ +/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_JIT_XLA_PLATFORM_INFO_H_ +#define TENSORFLOW_COMPILER_JIT_XLA_PLATFORM_INFO_H_ + +#include +#include +#include + +#include "tensorflow/compiler/jit/device_compiler.h" +#include "tensorflow/compiler/jit/pjrt_base_device.h" +#include "tensorflow/compiler/jit/xla_device.h" +#include "xla/stream_executor/tf_allocator_adapter.h" +#include "tensorflow/core/framework/op_kernel.h" + +namespace tensorflow { + +// Holds some information about the platform on which an +// XlaLaunch/_XlaCompile/_XlaRun op must run on. Provides a common layer of +// abstraction for normal, XLA devices and devices inheriting from +// PjRtBaseDevice. +class XlaPlatformInfo { + public: + XlaPlatformInfo() : device_type_("") {} + XlaPlatformInfo(XlaPlatformInfo&&) = default; + explicit XlaPlatformInfo( + const DeviceType device_type, se::Platform::Id platform_id, + const XlaDevice::Metadata* xla_device_metadata, + const PjRtBaseDevice::Metadata* pjrt_device_metadata, + std::shared_ptr device_allocator) + : device_type_(device_type), + platform_id_(platform_id), + xla_device_metadata_(xla_device_metadata), + pjrt_device_metadata_(pjrt_device_metadata), + device_allocator_(device_allocator) {} + + XlaPlatformInfo& operator=(XlaPlatformInfo&& other) = default; + + bool UseMultipleStreams() const { + return xla_device_metadata_ && xla_device_metadata_->UseMultipleStreams(); + } + + // Non-null only when run on an XLA device. + std::shared_ptr custom_allocator() const { + return device_allocator_; + } + + DeviceType device_type() const { return device_type_; } + + // This is equal to xla_device_metadata()->platform()->id() if + // xla_device_metadata() is not nullptr. + se::Platform::Id platform_id() const { return platform_id_; } + + // This may be null if the op this XlaPlatformInfo is for was not placed on an + // XLA device. + const XlaDevice::Metadata* xla_device_metadata() const { + return xla_device_metadata_; + } + bool is_on_xla_device() const { return xla_device_metadata() != nullptr; } + + const PjRtBaseDevice::Metadata* pjrt_device_metadata() const { + return pjrt_device_metadata_; + } + + private: + DeviceType device_type_; + se::Platform::Id platform_id_; + + // xla_device_metadata_ lives in the tensorflow::DeviceBase in which the + // XlaLaunch/_XlaCompile/_XlaRun op is placed and thus does not die before the + // XlaLaunch/_XlaCompile/_XlaRun OpKernel. + const XlaDevice::Metadata* xla_device_metadata_; + + // pjrt_device_metadata_ lives in tensorflow::PjRtBaseDevice in which the + // XlaLaunch/XlaCompileOnDemand op is placed and thus does not die before the + // op kernel. + const PjRtBaseDevice::Metadata* pjrt_device_metadata_; + + // If the op associated with this XlaPlatformInfo is placed on an XLA device + // then device_allocator_ is the xla::Backend's memory allocator. If the op + // is placed on a regular CPU or GPU device then device_allocator_ is null. + // The allocator is of unknown provenance; keep it in a shared pointer to + // set an artificial refcount of one. + std::shared_ptr device_allocator_; + + TF_DISALLOW_COPY_AND_ASSIGN(XlaPlatformInfo); +}; + +// Returns a set containing the device ids contained in visible_device_list or +// nullopt if it is empty. It returns error in case of malformed configuration +// string. +StatusOr>> ParseVisibleDeviceList( + absl::string_view visible_device_list); + +// Builds a DeviceCompiler that uses xla::LocalClient using `platform_info` and +// sets *xla_device_compiler to point to it. Uses flags from +// `MarkForCompilationPassFlags` for configuring the persistor used in the +// DeviceCompiler. +Status BuildXlaDeviceCompiler( + DeviceBase* dev, FunctionLibraryRuntime* flr, + const XlaPlatformInfo& platform_info, + DeviceCompiler** + xla_device_compiler); + +// Fetches a DeviceCompiler from the tfrt_global resource manager (or creates +// one there if not found) that uses xla::PjRtClient using an appropriate +// PjRtClient for `platform_info.device_type()` and sets *pjrt_device_compiler +// to point to it. Also fetches/creates a DeviceCompilationProfiler from/in the +// tfrt_global resource manager for `platform_info.device_type()` and sets +// *profiler to point to it. Uses flags from `MarkForCompilationPassFlags` for +// configuring the persistor used in the DeviceCompiler. Please note that +// non-XLA devices aren't supported yet. This is because: +// 1. PjRtClient doesn't support data transfer for non-XLA devices yet +// 2. Fetching the PjRtClient for non-XLA devices is also not supported yet +Status GetOrCreatePjRtDeviceCompilerAndProfiler( + const OpKernelContext& ctx, const XlaPlatformInfo& platform_info, + FunctionLibraryRuntime* flr, + DeviceCompiler** + pjrt_device_compiler, + DeviceCompilationProfiler** profiler); + +// Same as the above function but takes the resource manager `rm` instead of an +// OpKernelContext. +Status GetOrCreatePjRtDeviceCompilerAndProfiler( + const XlaPlatformInfo& platform_info, ResourceMgr* rm, + FunctionLibraryRuntime* flr, + DeviceCompiler** + pjrt_device_compiler, + DeviceCompilationProfiler** profiler); + +// Returns information about the platform from kernel context. +XlaPlatformInfo XlaPlatformInfoFromDevice(DeviceBase* device); + +// Obtains persistent cache directory for executables that target a given device +// based off xla flags. If you shouldn't use persistent caching, returns "". +std::string GetPersistentCacheDirectory( + const DeviceType& compilation_device_type); + +// Returns allocator from platform info if non-null, or populate and return a +// pointer to the allocator adapter with allocator from context. +// +// This is necessary because for XLA devices the underlying TF allocator returns +// dummy tensors. +// +// `stream` parameter is nullable when running on host. +std::shared_ptr GetAllocator( + DeviceBase* device, se::Stream* stream, + const XlaPlatformInfo& platform_info); + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_JIT_XLA_PLATFORM_INFO_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/xla_tensor.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/xla_tensor.h new file mode 100644 index 0000000000000000000000000000000000000000..6ffd6401d79f9315556d1218fcc2b514ff69f413 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/jit/xla_tensor.h @@ -0,0 +1,114 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_JIT_XLA_TENSOR_H_ +#define TENSORFLOW_COMPILER_JIT_XLA_TENSOR_H_ + +#include + +#include "absl/memory/memory.h" +#include "xla/client/local_client.h" +#include "xla/service/shaped_buffer.h" +#include "tensorflow/core/framework/allocator.h" +#include "tensorflow/core/framework/device_base.h" +#include "tensorflow/core/lib/core/status.h" +#include "tensorflow/core/platform/mutex.h" + +namespace tensorflow { + +// The implementation of a Tensor for an XlaDevice. All device tensors are +// actually one of these. +// +// To distinguish between "normal" device tensors and XlaTensors, the raw +// pointer data stored in the TensorBuffer is a tagged pointer. +class XlaTensor { + public: + // Downcast from a Tensor to an XlaTensor. Return nullptr if the downcast + // fails. + static XlaTensor* FromTensor(const Tensor* tensor); + + // Create a DeviceMemoryBase from a Tensor. The Tensor can be an XlaTensor, in + // which case the returned value is shaped_buffer()->root_buffer(), or a + // normal Tensor in which case the returned value is + // {tensor.tensor_data().data(), tensor.tensor_data().size}. + static se::DeviceMemoryBase DeviceMemoryFromTensor(const Tensor& tensor); + + // Assign the internal ShapedBuffer to new memory for the given dtype and + // shape. If a ShapedBuffer exists already (has_shaped_buffer() == true), it + // is replaced and the managed memory deallocated. + Status AllocateShapedBuffer(DataType dtype, const xla::Shape& on_device_shape, + xla::LocalClient* client, int device_ordinal); + + // Some Tensors can have complex on-device shapes, including tuple shapes. To + // manage the memory for these tensors a ShapedBuffer may be required. + + // Return true if this XlaTensor contains a ShapedBuffer. + bool has_shaped_buffer() const { return shaped_buffer_.has_value(); } + // Return the contained ShapedBuffer. + // REQUIRES: has_shaped_buffer() + const xla::ShapedBuffer& shaped_buffer() const { + CHECK(has_shaped_buffer()); + return *shaped_buffer_; + } + xla::ShapedBuffer& shaped_buffer() { + CHECK(has_shaped_buffer()); + return *shaped_buffer_; + } + // Mutates the XlaTensor to set the ShapedBuffer. + void set_shaped_buffer(xla::ScopedShapedBuffer shaped_buffer) { + shaped_buffer_ = std::move(shaped_buffer); + } + + // Adds synchronization events to 'stream' that wait for this tensor to be + // defined on 'stream'. Does nothing if the tensor is already defined on that + // stream. + void WaitForDefinitionEventOnStream(se::Stream* stream); + + // (Re)sets the definition event of the tensor to 'event', and promises that + // the tensor has already been defined on stream. Removes any previous + // definition event or any previous promises about the tensor being defined on + // streams. + // It is legal to reset the definition event of a tensor when overwriting the + // tensor's value (at which point, it is effectively a new tensor once again.) + void ResetDefinitionEvent(std::shared_ptr event, + se::Stream* stream); + + // Refresh the status of streams_defined_on_. Return the first not-OK stream's + // status or OK. + Status RefreshStatusOfStreams(); + + // Convert from a raw pointer to an XlaTensor, removing the pointer tag. + static XlaTensor* FromOpaquePointer(void* ptr); + // Convert to a raw pointer from an XlaTensor, adding the pointer tag. + static void* ToOpaquePointer(XlaTensor* tensor); + + private: + // The optional contained ShapedBuffer. + std::optional shaped_buffer_; + // An optional host tensor value. + std::optional host_tensor_; + // An optional event that is triggered when the tensor's content has been + // defined. If this event is nullptr, it is assumed that the tensor's content + // is always defined. + std::shared_ptr definition_event_; + // A list of all streams for which the tensor's content is defined for any + // newly enqueued command. + absl::InlinedVector streams_defined_on_ TF_GUARDED_BY(mu_); + mutex mu_; +}; + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_JIT_XLA_TENSOR_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/lite/quantization/ir/FakeQuantSupport.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/lite/quantization/ir/FakeQuantSupport.h new file mode 100644 index 0000000000000000000000000000000000000000..6072172eaebe38d4eb722b1c2c48ab427d09d465 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/lite/quantization/ir/FakeQuantSupport.h @@ -0,0 +1,74 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ +// +// This file defines support utilities for interoperating with FakeQuant* based +// QAT (Quantized Aware Training) computations, as implemented by TFLite. Note +// that FakeQuant* operators mix multiple concerns specific to how TFLite +// originally implemented quantization. As such, utilities here enforce +// opinions taken by that codebase (vs providing any amount of genericity). +// +// Specifically, it combines the following concerns, each of which would be +// independent variables in a more generic setup: +// - numBits and isSigned imply storage data type (uint8, int8, int16) +// - numBits < 8 is promoted to uint8 or int8 +// - "narrow_range" narrows the lower bound of the storage type's range by +// 1 +// - the specified min/max values are "nudged" so that the result has a zero +// that can be exactly expressed +// - min=max=0 implies scale=0 and zero_point=0 +// +// With the above assumptions applied, every conforming specified FakeQuant op +// can be represented by a UniformQuantizedType. This scheme is not expected to +// be generalized further in the future and should be considered to be a +// legacy set of rules. +// +// As canonically used in TensorFlow graphs, the presence of a FakeQuant node +// is a hint that the specific math represented here has been simulated at +// training time. As such, it is usually not advised to arbitrarily change +// quantization parameters derived from FakeQuant. +// +//===----------------------------------------------------------------------===// + +#ifndef TENSORFLOW_COMPILER_MLIR_LITE_QUANTIZATION_IR_FAKEQUANTSUPPORT_H_ +#define TENSORFLOW_COMPILER_MLIR_LITE_QUANTIZATION_IR_FAKEQUANTSUPPORT_H_ + +#include "mlir/Dialect/Quant/QuantTypes.h" // from @llvm-project + +namespace mlir { +namespace quantfork { + +/// Converts per-layer FakeQuant attributes to the corresponding type. +/// In the event that the parameters cannot be converted, returns a nullptr +/// convertible Type and issues an appropriate error. +/// Note that there are multiple variants of a per-layer FakeQuant op, so +/// this function takes the attributes discretely vs taking a reference to the +/// originating op. +quant::UniformQuantizedType fakeQuantAttrsToType(Location loc, unsigned numBits, + double rmin, double rmax, + bool narrowRange, + Type expressedType, + bool isSigned = false); + +/// Converts per-channel FakeQuant attributes to the corresponding type. +/// In the event that the parameters cannot be converted, returns a nullptr +/// convertible Type and issues an appropriate error. +quant::UniformQuantizedPerAxisType fakeQuantAttrsToType( + Location loc, unsigned numBits, int32_t quantizedDimension, + ArrayRef rmins, ArrayRef rmax, bool narrowRange, + Type expressedType, bool isSigned = false); +} // namespace quantfork +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_LITE_QUANTIZATION_IR_FAKEQUANTSUPPORT_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/lite/quantization/ir/Passes.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/lite/quantization/ir/Passes.h new file mode 100644 index 0000000000000000000000000000000000000000..06f4697f641275c92b1e7af9c2eccf5be7a36ebe --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/lite/quantization/ir/Passes.h @@ -0,0 +1,57 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ +// +// This file defines all of the passes owned by the quantization dialect. As +// things mature, it is expected that passes specific to certain frontend or +// backend dialects will move to those dialects directly. For now, they are +// incubated here. +// +//===----------------------------------------------------------------------===// + +#ifndef TENSORFLOW_COMPILER_MLIR_LITE_QUANTIZATION_IR_PASSES_H_ +#define TENSORFLOW_COMPILER_MLIR_LITE_QUANTIZATION_IR_PASSES_H_ + +#include "mlir/Pass/Pass.h" // from @llvm-project + +namespace mlir { +namespace func { +class FuncOp; +} // namespace func + +namespace quantfork { + +/// Creates a pass that converts quantization simulation operations (i.e. +/// FakeQuant and those like it) to casts into/out of supported QuantizedTypes. +std::unique_ptr> createConvertSimulatedQuantPass(); + +/// Creates a pass that converts constants followed by a qbarrier to a +/// constant whose value is quantized. This is typically one of the last +/// passes done when lowering to express actual quantized arithmetic in a +/// low level representation. Because it modifies the constant, it is +/// destructive and cannot be undone. +std::unique_ptr> createConvertConstPass(); + +//===----------------------------------------------------------------------===// +// Registration +//===----------------------------------------------------------------------===// + +/// Generate the code for registering passes. +#define GEN_PASS_REGISTRATION +#include "tensorflow/compiler/mlir/lite/quantization/ir/Passes.h.inc" + +} // namespace quantfork +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_LITE_QUANTIZATION_IR_PASSES_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/lite/quantization/ir/Passes.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/lite/quantization/ir/Passes.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..a95d7a3424da56ea5688ad281e857e09d3904cc0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/lite/quantization/ir/Passes.h.inc @@ -0,0 +1,264 @@ +/* Autogenerated by mlir-tblgen; don't manually edit */ + +#ifdef GEN_PASS_DECL +// Generate declarations for all passes. +#define GEN_PASS_DECL_QUANTCONVERTCONST +#define GEN_PASS_DECL_QUANTCONVERTSIMULATEDQUANT +#undef GEN_PASS_DECL +#endif // GEN_PASS_DECL + +//===----------------------------------------------------------------------===// +// QuantConvertConst +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_QUANTCONVERTCONST +#undef GEN_PASS_DECL_QUANTCONVERTCONST +#endif // GEN_PASS_DECL_QUANTCONVERTCONST +#ifdef GEN_PASS_DEF_QUANTCONVERTCONST +namespace impl { + +template +class QuantConvertConstBase : public ::mlir::OperationPass { +public: + using Base = QuantConvertConstBase; + + QuantConvertConstBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + QuantConvertConstBase(const QuantConvertConstBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("quant-convert-const"); + } + ::llvm::StringRef getArgument() const override { return "quant-convert-const"; } + + ::llvm::StringRef getDescription() const override { return "Converts constants followed by qbarrier to actual quantized values"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("QuantConvertConst"); + } + ::llvm::StringRef getName() const override { return "QuantConvertConst"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(QuantConvertConstBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_QUANTCONVERTCONST +#endif // GEN_PASS_DEF_QUANTCONVERTCONST + +//===----------------------------------------------------------------------===// +// QuantConvertSimulatedQuant +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_QUANTCONVERTSIMULATEDQUANT +#undef GEN_PASS_DECL_QUANTCONVERTSIMULATEDQUANT +#endif // GEN_PASS_DECL_QUANTCONVERTSIMULATEDQUANT +#ifdef GEN_PASS_DEF_QUANTCONVERTSIMULATEDQUANT +namespace impl { + +template +class QuantConvertSimulatedQuantBase : public ::mlir::OperationPass { +public: + using Base = QuantConvertSimulatedQuantBase; + + QuantConvertSimulatedQuantBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + QuantConvertSimulatedQuantBase(const QuantConvertSimulatedQuantBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("quant-convert-simulated-quantization"); + } + ::llvm::StringRef getArgument() const override { return "quant-convert-simulated-quantization"; } + + ::llvm::StringRef getDescription() const override { return "Converts training-time simulated quantization ops to corresponding quantize/dequantize casts"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("QuantConvertSimulatedQuant"); + } + ::llvm::StringRef getName() const override { return "QuantConvertSimulatedQuant"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(QuantConvertSimulatedQuantBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_QUANTCONVERTSIMULATEDQUANT +#endif // GEN_PASS_DEF_QUANTCONVERTSIMULATEDQUANT +#ifdef GEN_PASS_REGISTRATION + +//===----------------------------------------------------------------------===// +// QuantConvertConst Registration +//===----------------------------------------------------------------------===// + +inline void registerQuantConvertConst() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::quantfork::createConvertConstPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerQuantConvertConstPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::quantfork::createConvertConstPass(); + }); +} + +//===----------------------------------------------------------------------===// +// QuantConvertSimulatedQuant Registration +//===----------------------------------------------------------------------===// + +inline void registerQuantConvertSimulatedQuant() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::quantfork::createConvertSimulatedQuantPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerQuantConvertSimulatedQuantPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::quantfork::createConvertSimulatedQuantPass(); + }); +} + +//===----------------------------------------------------------------------===// +// quantfork Registration +//===----------------------------------------------------------------------===// + +inline void registerquantforkPasses() { + registerQuantConvertConst(); + registerQuantConvertSimulatedQuant(); +} +#undef GEN_PASS_REGISTRATION +#endif // GEN_PASS_REGISTRATION +// Deprecated. Please use the new per-pass macros. +#ifdef GEN_PASS_CLASSES + +template +class QuantConvertConstBase : public ::mlir::OperationPass { +public: + using Base = QuantConvertConstBase; + + QuantConvertConstBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + QuantConvertConstBase(const QuantConvertConstBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("quant-convert-const"); + } + ::llvm::StringRef getArgument() const override { return "quant-convert-const"; } + + ::llvm::StringRef getDescription() const override { return "Converts constants followed by qbarrier to actual quantized values"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("QuantConvertConst"); + } + ::llvm::StringRef getName() const override { return "QuantConvertConst"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(QuantConvertConstBase) + +protected: +}; + +template +class QuantConvertSimulatedQuantBase : public ::mlir::OperationPass { +public: + using Base = QuantConvertSimulatedQuantBase; + + QuantConvertSimulatedQuantBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + QuantConvertSimulatedQuantBase(const QuantConvertSimulatedQuantBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("quant-convert-simulated-quantization"); + } + ::llvm::StringRef getArgument() const override { return "quant-convert-simulated-quantization"; } + + ::llvm::StringRef getDescription() const override { return "Converts training-time simulated quantization ops to corresponding quantize/dequantize casts"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("QuantConvertSimulatedQuant"); + } + ::llvm::StringRef getName() const override { return "QuantConvertSimulatedQuant"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(QuantConvertSimulatedQuantBase) + +protected: +}; +#undef GEN_PASS_CLASSES +#endif // GEN_PASS_CLASSES diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/lite/quantization/ir/QuantOps.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/lite/quantization/ir/QuantOps.h new file mode 100644 index 0000000000000000000000000000000000000000..bee081a1416ca2ed0cfef4d8b9c5c2fb9274efba --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/lite/quantization/ir/QuantOps.h @@ -0,0 +1,34 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_LITE_QUANTIZATION_IR_QUANTOPS_H_ +#define TENSORFLOW_COMPILER_MLIR_LITE_QUANTIZATION_IR_QUANTOPS_H_ + +#include "llvm/Support/MathExtras.h" +#include "mlir/Bytecode/BytecodeOpInterface.h" // from @llvm-project +#include "mlir/IR/Attributes.h" // from @llvm-project +#include "mlir/IR/Builders.h" // from @llvm-project +#include "mlir/IR/BuiltinTypes.h" // from @llvm-project +#include "mlir/IR/Dialect.h" // from @llvm-project +#include "mlir/IR/OpDefinition.h" // from @llvm-project +#include "mlir/IR/Types.h" // from @llvm-project +#include "mlir/Interfaces/InferTypeOpInterface.h" // from @llvm-project +#include "mlir/Interfaces/SideEffectInterfaces.h" // from @llvm-project +#include "tensorflow/compiler/mlir/lite/quantization/ir/QuantOpsDialect.h.inc" +#define GET_OP_CLASSES + +#include "tensorflow/compiler/mlir/lite/quantization/ir/QuantOps.h.inc" + +#endif // TENSORFLOW_COMPILER_MLIR_LITE_QUANTIZATION_IR_QUANTOPS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/lite/quantization/ir/QuantOps.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/lite/quantization/ir/QuantOps.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..afd5f7483f786f7fa9d83a583b9e75bd792672ba --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/lite/quantization/ir/QuantOps.h.inc @@ -0,0 +1,1413 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: QuantOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#if defined(GET_OP_CLASSES) || defined(GET_OP_FWD_DEFINES) +#undef GET_OP_FWD_DEFINES +namespace mlir { +namespace quantfork { +class ConstFakeQuant; +} // namespace quantfork +} // namespace mlir +namespace mlir { +namespace quantfork { +class ConstFakeQuantPerAxis; +} // namespace quantfork +} // namespace mlir +namespace mlir { +namespace quantfork { +class CoupledRefOp; +} // namespace quantfork +} // namespace mlir +namespace mlir { +namespace quantfork { +class DequantizeCastOp; +} // namespace quantfork +} // namespace mlir +namespace mlir { +namespace quantfork { +class QuantizeCastOp; +} // namespace quantfork +} // namespace mlir +namespace mlir { +namespace quantfork { +class QuantizeRegionOp; +} // namespace quantfork +} // namespace mlir +namespace mlir { +namespace quantfork { +class ReturnOp; +} // namespace quantfork +} // namespace mlir +namespace mlir { +namespace quantfork { +class StatisticsOp; +} // namespace quantfork +} // namespace mlir +namespace mlir { +namespace quantfork { +class StatisticsRefOp; +} // namespace quantfork +} // namespace mlir +namespace mlir { +namespace quantfork { +class StorageCastOp; +} // namespace quantfork +} // namespace mlir +#endif + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace quantfork { + +//===----------------------------------------------------------------------===// +// ::mlir::quantfork::ConstFakeQuant declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConstFakeQuantGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ConstFakeQuantGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ConstFakeQuantGenericAdaptorBase(ConstFakeQuant op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::FloatAttr getMinAttr(); + ::llvm::APFloat getMin(); + ::mlir::FloatAttr getMaxAttr(); + ::llvm::APFloat getMax(); + ::mlir::IntegerAttr getNumBitsAttr(); + uint64_t getNumBits(); + ::mlir::BoolAttr getNarrowRangeAttr(); + bool getNarrowRange(); + ::mlir::BoolAttr getIsSignedAttr(); + bool getIsSigned(); +}; +} // namespace detail +template +class ConstFakeQuantGenericAdaptor : public detail::ConstFakeQuantGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConstFakeQuantGenericAdaptorBase; +public: + ConstFakeQuantGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConstFakeQuantGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConstFakeQuantGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ConstFakeQuantGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputs() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConstFakeQuantAdaptor : public ConstFakeQuantGenericAdaptor<::mlir::ValueRange> { +public: + using ConstFakeQuantGenericAdaptor::ConstFakeQuantGenericAdaptor; + ConstFakeQuantAdaptor(ConstFakeQuant op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConstFakeQuant : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ConstFakeQuantAdaptor; + template + using GenericAdaptor = ConstFakeQuantGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("is_signed"), ::llvm::StringRef("max"), ::llvm::StringRef("min"), ::llvm::StringRef("narrow_range"), ::llvm::StringRef("num_bits")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getIsSignedAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getIsSignedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getMaxAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getMaxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getMinAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getMinAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getNarrowRangeAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getNarrowRangeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getNumBitsAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getNumBitsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("quantfork.const_fake_quant"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputs(); + ::mlir::OpOperand &getInputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutputs(); + ::mlir::FloatAttr getMinAttr(); + ::llvm::APFloat getMin(); + ::mlir::FloatAttr getMaxAttr(); + ::llvm::APFloat getMax(); + ::mlir::IntegerAttr getNumBitsAttr(); + uint64_t getNumBits(); + ::mlir::BoolAttr getNarrowRangeAttr(); + bool getNarrowRange(); + ::mlir::BoolAttr getIsSignedAttr(); + bool getIsSigned(); + void setMinAttr(::mlir::FloatAttr attr); + void setMin(::llvm::APFloat attrValue); + void setMaxAttr(::mlir::FloatAttr attr); + void setMax(::llvm::APFloat attrValue); + void setNumBitsAttr(::mlir::IntegerAttr attr); + void setNumBits(uint64_t attrValue); + void setNarrowRangeAttr(::mlir::BoolAttr attr); + void setNarrowRange(::std::optional attrValue); + void setIsSignedAttr(::mlir::BoolAttr attr); + void setIsSigned(::std::optional attrValue); + ::mlir::Attribute removeNarrowRangeAttr(); + ::mlir::Attribute removeIsSignedAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type outputs, ::mlir::Value inputs, ::mlir::FloatAttr min, ::mlir::FloatAttr max, ::mlir::IntegerAttr num_bits, /*optional*/::mlir::BoolAttr narrow_range, /*optional*/::mlir::BoolAttr is_signed); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value inputs, ::mlir::FloatAttr min, ::mlir::FloatAttr max, ::mlir::IntegerAttr num_bits, /*optional*/::mlir::BoolAttr narrow_range, /*optional*/::mlir::BoolAttr is_signed); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inputs, ::mlir::FloatAttr min, ::mlir::FloatAttr max, ::mlir::IntegerAttr num_bits, /*optional*/::mlir::BoolAttr narrow_range, /*optional*/::mlir::BoolAttr is_signed); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type outputs, ::mlir::Value inputs, ::llvm::APFloat min, ::llvm::APFloat max, uint64_t num_bits, /*optional*/bool narrow_range = false, /*optional*/bool is_signed = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value inputs, ::llvm::APFloat min, ::llvm::APFloat max, uint64_t num_bits, /*optional*/bool narrow_range = false, /*optional*/bool is_signed = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inputs, ::llvm::APFloat min, ::llvm::APFloat max, uint64_t num_bits, /*optional*/bool narrow_range = false, /*optional*/bool is_signed = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace quantfork +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::quantfork::ConstFakeQuant) + +namespace mlir { +namespace quantfork { + +//===----------------------------------------------------------------------===// +// ::mlir::quantfork::ConstFakeQuantPerAxis declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConstFakeQuantPerAxisGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ConstFakeQuantPerAxisGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ConstFakeQuantPerAxisGenericAdaptorBase(ConstFakeQuantPerAxis op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getMinAttr(); + ::mlir::ArrayAttr getMin(); + ::mlir::ArrayAttr getMaxAttr(); + ::mlir::ArrayAttr getMax(); + ::mlir::IntegerAttr getAxisAttr(); + uint64_t getAxis(); + ::mlir::IntegerAttr getNumBitsAttr(); + uint64_t getNumBits(); + ::mlir::BoolAttr getNarrowRangeAttr(); + bool getNarrowRange(); + ::mlir::BoolAttr getIsSignedAttr(); + bool getIsSigned(); +}; +} // namespace detail +template +class ConstFakeQuantPerAxisGenericAdaptor : public detail::ConstFakeQuantPerAxisGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConstFakeQuantPerAxisGenericAdaptorBase; +public: + ConstFakeQuantPerAxisGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConstFakeQuantPerAxisGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConstFakeQuantPerAxisGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ConstFakeQuantPerAxisGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputs() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConstFakeQuantPerAxisAdaptor : public ConstFakeQuantPerAxisGenericAdaptor<::mlir::ValueRange> { +public: + using ConstFakeQuantPerAxisGenericAdaptor::ConstFakeQuantPerAxisGenericAdaptor; + ConstFakeQuantPerAxisAdaptor(ConstFakeQuantPerAxis op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConstFakeQuantPerAxis : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ConstFakeQuantPerAxisAdaptor; + template + using GenericAdaptor = ConstFakeQuantPerAxisGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("axis"), ::llvm::StringRef("is_signed"), ::llvm::StringRef("max"), ::llvm::StringRef("min"), ::llvm::StringRef("narrow_range"), ::llvm::StringRef("num_bits")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAxisAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAxisAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getIsSignedAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getIsSignedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getMaxAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getMaxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getMinAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getMinAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getNarrowRangeAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getNarrowRangeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getNumBitsAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getNumBitsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("quantfork.const_fake_quant_per_axis"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputs(); + ::mlir::OpOperand &getInputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutputs(); + ::mlir::ArrayAttr getMinAttr(); + ::mlir::ArrayAttr getMin(); + ::mlir::ArrayAttr getMaxAttr(); + ::mlir::ArrayAttr getMax(); + ::mlir::IntegerAttr getAxisAttr(); + uint64_t getAxis(); + ::mlir::IntegerAttr getNumBitsAttr(); + uint64_t getNumBits(); + ::mlir::BoolAttr getNarrowRangeAttr(); + bool getNarrowRange(); + ::mlir::BoolAttr getIsSignedAttr(); + bool getIsSigned(); + void setMinAttr(::mlir::ArrayAttr attr); + void setMaxAttr(::mlir::ArrayAttr attr); + void setAxisAttr(::mlir::IntegerAttr attr); + void setAxis(uint64_t attrValue); + void setNumBitsAttr(::mlir::IntegerAttr attr); + void setNumBits(uint64_t attrValue); + void setNarrowRangeAttr(::mlir::BoolAttr attr); + void setNarrowRange(::std::optional attrValue); + void setIsSignedAttr(::mlir::BoolAttr attr); + void setIsSigned(::std::optional attrValue); + ::mlir::Attribute removeNarrowRangeAttr(); + ::mlir::Attribute removeIsSignedAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type outputs, ::mlir::Value inputs, ::mlir::ArrayAttr min, ::mlir::ArrayAttr max, ::mlir::IntegerAttr axis, ::mlir::IntegerAttr num_bits, /*optional*/::mlir::BoolAttr narrow_range, /*optional*/::mlir::BoolAttr is_signed); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value inputs, ::mlir::ArrayAttr min, ::mlir::ArrayAttr max, ::mlir::IntegerAttr axis, ::mlir::IntegerAttr num_bits, /*optional*/::mlir::BoolAttr narrow_range, /*optional*/::mlir::BoolAttr is_signed); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inputs, ::mlir::ArrayAttr min, ::mlir::ArrayAttr max, ::mlir::IntegerAttr axis, ::mlir::IntegerAttr num_bits, /*optional*/::mlir::BoolAttr narrow_range, /*optional*/::mlir::BoolAttr is_signed); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type outputs, ::mlir::Value inputs, ::mlir::ArrayAttr min, ::mlir::ArrayAttr max, uint64_t axis, uint64_t num_bits, /*optional*/bool narrow_range = false, /*optional*/bool is_signed = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value inputs, ::mlir::ArrayAttr min, ::mlir::ArrayAttr max, uint64_t axis, uint64_t num_bits, /*optional*/bool narrow_range = false, /*optional*/bool is_signed = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inputs, ::mlir::ArrayAttr min, ::mlir::ArrayAttr max, uint64_t axis, uint64_t num_bits, /*optional*/bool narrow_range = false, /*optional*/bool is_signed = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace quantfork +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::quantfork::ConstFakeQuantPerAxis) + +namespace mlir { +namespace quantfork { + +//===----------------------------------------------------------------------===// +// ::mlir::quantfork::CoupledRefOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CoupledRefOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CoupledRefOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CoupledRefOpGenericAdaptorBase(CoupledRefOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getCoupledKeyAttr(); + ::llvm::StringRef getCoupledKey(); +}; +} // namespace detail +template +class CoupledRefOpGenericAdaptor : public detail::CoupledRefOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CoupledRefOpGenericAdaptorBase; +public: + CoupledRefOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CoupledRefOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CoupledRefOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CoupledRefOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getArg() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CoupledRefOpAdaptor : public CoupledRefOpGenericAdaptor<::mlir::ValueRange> { +public: + using CoupledRefOpGenericAdaptor::CoupledRefOpGenericAdaptor; + CoupledRefOpAdaptor(CoupledRefOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CoupledRefOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CoupledRefOpAdaptor; + template + using GenericAdaptor = CoupledRefOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("coupledKey")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getCoupledKeyAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getCoupledKeyAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("quantfork.coupled_ref"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getArg(); + ::mlir::OpOperand &getArgMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::StringAttr getCoupledKeyAttr(); + ::llvm::StringRef getCoupledKey(); + void setCoupledKeyAttr(::mlir::StringAttr attr); + void setCoupledKey(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value arg, ::mlir::StringAttr coupledKey); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value arg, ::mlir::StringAttr coupledKey); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg, ::mlir::StringAttr coupledKey); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value arg, ::llvm::StringRef coupledKey); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value arg, ::llvm::StringRef coupledKey); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg, ::llvm::StringRef coupledKey); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace quantfork +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::quantfork::CoupledRefOp) + +namespace mlir { +namespace quantfork { + +//===----------------------------------------------------------------------===// +// ::mlir::quantfork::DequantizeCastOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DequantizeCastOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DequantizeCastOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DequantizeCastOpGenericAdaptorBase(DequantizeCastOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DequantizeCastOpGenericAdaptor : public detail::DequantizeCastOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DequantizeCastOpGenericAdaptorBase; +public: + DequantizeCastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DequantizeCastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DequantizeCastOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DequantizeCastOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getArg() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DequantizeCastOpAdaptor : public DequantizeCastOpGenericAdaptor<::mlir::ValueRange> { +public: + using DequantizeCastOpGenericAdaptor::DequantizeCastOpGenericAdaptor; + DequantizeCastOpAdaptor(DequantizeCastOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DequantizeCastOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DequantizeCastOpAdaptor; + template + using GenericAdaptor = DequantizeCastOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("quantfork.dcast"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getArg(); + ::mlir::OpOperand &getArgMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value arg); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace quantfork +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::quantfork::DequantizeCastOp) + +namespace mlir { +namespace quantfork { + +//===----------------------------------------------------------------------===// +// ::mlir::quantfork::QuantizeCastOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class QuantizeCastOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + QuantizeCastOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + QuantizeCastOpGenericAdaptorBase(QuantizeCastOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class QuantizeCastOpGenericAdaptor : public detail::QuantizeCastOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::QuantizeCastOpGenericAdaptorBase; +public: + QuantizeCastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + QuantizeCastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : QuantizeCastOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + QuantizeCastOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getArg() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class QuantizeCastOpAdaptor : public QuantizeCastOpGenericAdaptor<::mlir::ValueRange> { +public: + using QuantizeCastOpGenericAdaptor::QuantizeCastOpGenericAdaptor; + QuantizeCastOpAdaptor(QuantizeCastOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class QuantizeCastOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = QuantizeCastOpAdaptor; + template + using GenericAdaptor = QuantizeCastOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("quantfork.qcast"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getArg(); + ::mlir::OpOperand &getArgMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value arg); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace quantfork +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::quantfork::QuantizeCastOp) + +namespace mlir { +namespace quantfork { + +//===----------------------------------------------------------------------===// +// ::mlir::quantfork::QuantizeRegionOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class QuantizeRegionOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + QuantizeRegionOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + QuantizeRegionOpGenericAdaptorBase(QuantizeRegionOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getInputSpecsAttr(); + ::mlir::ArrayAttr getInputSpecs(); + ::mlir::ArrayAttr getOutputSpecsAttr(); + ::mlir::ArrayAttr getOutputSpecs(); + ::mlir::StringAttr getLogicalKernelAttr(); + ::llvm::StringRef getLogicalKernel(); + ::mlir::Region &getBody(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class QuantizeRegionOpGenericAdaptor : public detail::QuantizeRegionOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::QuantizeRegionOpGenericAdaptorBase; +public: + QuantizeRegionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + QuantizeRegionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : QuantizeRegionOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + QuantizeRegionOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class QuantizeRegionOpAdaptor : public QuantizeRegionOpGenericAdaptor<::mlir::ValueRange> { +public: + using QuantizeRegionOpGenericAdaptor::QuantizeRegionOpGenericAdaptor; + QuantizeRegionOpAdaptor(QuantizeRegionOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class QuantizeRegionOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::IsIsolatedFromAbove> { +public: + using Op::Op; + using Op::print; + using Adaptor = QuantizeRegionOpAdaptor; + template + using GenericAdaptor = QuantizeRegionOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("input_specs"), ::llvm::StringRef("logical_kernel"), ::llvm::StringRef("output_specs")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getInputSpecsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getInputSpecsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getLogicalKernelAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getLogicalKernelAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOutputSpecsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOutputSpecsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("quantfork.region"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::MutableOperandRange getInputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutputs(); + ::mlir::Region &getBody(); + ::mlir::ArrayAttr getInputSpecsAttr(); + ::mlir::ArrayAttr getInputSpecs(); + ::mlir::ArrayAttr getOutputSpecsAttr(); + ::mlir::ArrayAttr getOutputSpecs(); + ::mlir::StringAttr getLogicalKernelAttr(); + ::llvm::StringRef getLogicalKernel(); + void setInputSpecsAttr(::mlir::ArrayAttr attr); + void setOutputSpecsAttr(::mlir::ArrayAttr attr); + void setLogicalKernelAttr(::mlir::StringAttr attr); + void setLogicalKernel(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outputs, ::mlir::ValueRange inputs, ::mlir::ArrayAttr input_specs, ::mlir::ArrayAttr output_specs, ::mlir::StringAttr logical_kernel); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outputs, ::mlir::ValueRange inputs, ::mlir::ArrayAttr input_specs, ::mlir::ArrayAttr output_specs, ::llvm::StringRef logical_kernel); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace quantfork +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::quantfork::QuantizeRegionOp) + +namespace mlir { +namespace quantfork { + +//===----------------------------------------------------------------------===// +// ::mlir::quantfork::ReturnOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReturnOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ReturnOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ReturnOpGenericAdaptorBase(ReturnOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ReturnOpGenericAdaptor : public detail::ReturnOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReturnOpGenericAdaptorBase; +public: + ReturnOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReturnOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReturnOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ReturnOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getResults() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ReturnOpAdaptor : public ReturnOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReturnOpGenericAdaptor::ReturnOpGenericAdaptor; + ReturnOpAdaptor(ReturnOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReturnOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = ReturnOpAdaptor; + template + using GenericAdaptor = ReturnOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("quantfork.return"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getResults(); + ::mlir::MutableOperandRange getResultsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange results); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace quantfork +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::quantfork::ReturnOp) + +namespace mlir { +namespace quantfork { + +//===----------------------------------------------------------------------===// +// ::mlir::quantfork::StatisticsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StatisticsOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StatisticsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StatisticsOpGenericAdaptorBase(StatisticsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ElementsAttr getLayerStatsAttr(); + ::mlir::ElementsAttr getLayerStats(); + ::mlir::ElementsAttr getAxisStatsAttr(); + ::std::optional< ::mlir::ElementsAttr > getAxisStats(); + ::mlir::IntegerAttr getAxisAttr(); + ::std::optional getAxis(); +}; +} // namespace detail +template +class StatisticsOpGenericAdaptor : public detail::StatisticsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StatisticsOpGenericAdaptorBase; +public: + StatisticsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StatisticsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StatisticsOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StatisticsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getArg() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StatisticsOpAdaptor : public StatisticsOpGenericAdaptor<::mlir::ValueRange> { +public: + using StatisticsOpGenericAdaptor::StatisticsOpGenericAdaptor; + StatisticsOpAdaptor(StatisticsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StatisticsOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StatisticsOpAdaptor; + template + using GenericAdaptor = StatisticsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("axis"), ::llvm::StringRef("axisStats"), ::llvm::StringRef("layerStats")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAxisAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAxisAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAxisStatsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAxisStatsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getLayerStatsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getLayerStatsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("quantfork.stats"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getArg(); + ::mlir::OpOperand &getArgMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::ElementsAttr getLayerStatsAttr(); + ::mlir::ElementsAttr getLayerStats(); + ::mlir::ElementsAttr getAxisStatsAttr(); + ::std::optional< ::mlir::ElementsAttr > getAxisStats(); + ::mlir::IntegerAttr getAxisAttr(); + ::std::optional getAxis(); + void setLayerStatsAttr(::mlir::ElementsAttr attr); + void setAxisStatsAttr(::mlir::ElementsAttr attr); + void setAxisAttr(::mlir::IntegerAttr attr); + void setAxis(::std::optional attrValue); + ::mlir::Attribute removeAxisStatsAttr(); + ::mlir::Attribute removeAxisAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value arg, ::mlir::ElementsAttr layerStats, /*optional*/::mlir::ElementsAttr axisStats, /*optional*/::mlir::IntegerAttr axis); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value arg, ::mlir::ElementsAttr layerStats, /*optional*/::mlir::ElementsAttr axisStats, /*optional*/::mlir::IntegerAttr axis); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg, ::mlir::ElementsAttr layerStats, /*optional*/::mlir::ElementsAttr axisStats, /*optional*/::mlir::IntegerAttr axis); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace quantfork +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::quantfork::StatisticsOp) + +namespace mlir { +namespace quantfork { + +//===----------------------------------------------------------------------===// +// ::mlir::quantfork::StatisticsRefOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StatisticsRefOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StatisticsRefOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StatisticsRefOpGenericAdaptorBase(StatisticsRefOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getStatsKeyAttr(); + ::llvm::StringRef getStatsKey(); +}; +} // namespace detail +template +class StatisticsRefOpGenericAdaptor : public detail::StatisticsRefOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StatisticsRefOpGenericAdaptorBase; +public: + StatisticsRefOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StatisticsRefOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StatisticsRefOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StatisticsRefOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getArg() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StatisticsRefOpAdaptor : public StatisticsRefOpGenericAdaptor<::mlir::ValueRange> { +public: + using StatisticsRefOpGenericAdaptor::StatisticsRefOpGenericAdaptor; + StatisticsRefOpAdaptor(StatisticsRefOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StatisticsRefOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StatisticsRefOpAdaptor; + template + using GenericAdaptor = StatisticsRefOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("statsKey")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getStatsKeyAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getStatsKeyAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("quantfork.stats_ref"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getArg(); + ::mlir::OpOperand &getArgMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::StringAttr getStatsKeyAttr(); + ::llvm::StringRef getStatsKey(); + void setStatsKeyAttr(::mlir::StringAttr attr); + void setStatsKey(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value arg, ::mlir::StringAttr statsKey); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value arg, ::mlir::StringAttr statsKey); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg, ::mlir::StringAttr statsKey); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value arg, ::llvm::StringRef statsKey); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value arg, ::llvm::StringRef statsKey); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg, ::llvm::StringRef statsKey); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace quantfork +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::quantfork::StatisticsRefOp) + +namespace mlir { +namespace quantfork { + +//===----------------------------------------------------------------------===// +// ::mlir::quantfork::StorageCastOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StorageCastOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StorageCastOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StorageCastOpGenericAdaptorBase(StorageCastOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class StorageCastOpGenericAdaptor : public detail::StorageCastOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StorageCastOpGenericAdaptorBase; +public: + StorageCastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StorageCastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StorageCastOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StorageCastOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getArg() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StorageCastOpAdaptor : public StorageCastOpGenericAdaptor<::mlir::ValueRange> { +public: + using StorageCastOpGenericAdaptor::StorageCastOpGenericAdaptor; + StorageCastOpAdaptor(StorageCastOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StorageCastOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StorageCastOpAdaptor; + template + using GenericAdaptor = StorageCastOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("quantfork.scast"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getArg(); + ::mlir::OpOperand &getArgMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value arg); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace quantfork +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::quantfork::StorageCastOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/lite/quantization/ir/QuantOpsDialect.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/lite/quantization/ir/QuantOpsDialect.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..740cb6c2caff03cbfc75a41d1d583cd6258b7909 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/lite/quantization/ir/QuantOpsDialect.h.inc @@ -0,0 +1,26 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: QuantOps.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace quantfork { + +class QuantizationForkDialect : public ::mlir::Dialect { + explicit QuantizationForkDialect(::mlir::MLIRContext *context); + + void initialize(); + friend class ::mlir::MLIRContext; +public: + ~QuantizationForkDialect() override; + static constexpr ::llvm::StringLiteral getDialectNamespace() { + return ::llvm::StringLiteral("quantfork"); + } +}; +} // namespace quantfork +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::quantfork::QuantizationForkDialect) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/lite/quantization/ir/QuantizeUtils.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/lite/quantization/ir/QuantizeUtils.h new file mode 100644 index 0000000000000000000000000000000000000000..bfc6afb834b0b0b030468e09a47fc343e81f74be --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/lite/quantization/ir/QuantizeUtils.h @@ -0,0 +1,71 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_LITE_QUANTIZATION_IR_QUANTIZEUTILS_H_ +#define TENSORFLOW_COMPILER_MLIR_LITE_QUANTIZATION_IR_QUANTIZEUTILS_H_ + +namespace mlir { +class Attribute; +class Type; + +namespace quant { +class QuantizedType; +class UniformQuantizedType; +} // namespace quant +namespace quantfork { +class UniformQuantizedValueConverter; + +/// Converts an attribute from a type based on +/// quantizedElementType.getExpressedType() to one based on +/// quantizedElementType.getStorageType(), where quantizedElementType is as from +/// QuantizedType::getQuantizedElementType(). +/// Returns nullptr if the conversion is not supported. On success, stores the +/// converted type in outConvertedType. +/// +/// Examples: +/// 1. realValue is a primitive value attribute: +/// (realValue: FloatAttr, quantizedElementType: UniformQuantizedType[i8:f32]) +/// -> (IntegerAttr, outConvertedType: i8) +/// 2. realValue is an elements attribute: +/// (realValue: DenseElementsAttr[tensor<2x2xf32>], +/// quantizedElementType: UniformQuantizedType[i8:f32]) +/// -> (DenseElementsAttr[tensor<2x2xi8>], outConvertedType: tensor<2x2xi8>) +Attribute quantizeAttr(Attribute realValue, + quant::QuantizedType quantizedElementType, + Type &outConvertedType); + +/// Converts an attribute from a type based on +/// quantizedElementType.getExpressedType() to one based on +/// quantizedElementType.getStorageType(), where quantizedElementType is as from +/// QuantizedType::getQuantizedElementType() and casted to an +/// UniformQuantizedType. Returns nullptr if the conversion is not supported. On +/// success, stores the converted type in outConvertedType. +/// +/// Examples: +/// 1. realValue is a primitive value attribute: +/// (realValue: FloatAttr, quantizedElementType: UniformQuantizedType[i8:f32]) +/// -> (IntegerAttr, outConvertedType: i8) +/// 2. realValue is an elements attribute: +/// (realValue: DenseElementsAttr[tensor<2x2xf32>], +/// quantizedElementType: UniformQuantizedType[i8:f32]) +/// -> (DenseElementsAttr[tensor<2x2xi8>], outConvertedType: tensor<2x2xi8>) +Attribute quantizeAttrUniform(Attribute realValue, + quant::UniformQuantizedType quantizedElementType, + const UniformQuantizedValueConverter &converter, + Type &outConvertedType); +} // namespace quantfork +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_LITE_QUANTIZATION_IR_QUANTIZEUTILS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/lite/quantization/ir/UniformSupport.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/lite/quantization/ir/UniformSupport.h new file mode 100644 index 0000000000000000000000000000000000000000..064afb0b36aa13f57edb3b9aeb4f3489dfeb4617 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/lite/quantization/ir/UniformSupport.h @@ -0,0 +1,240 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_LITE_QUANTIZATION_IR_UNIFORMSUPPORT_H_ +#define TENSORFLOW_COMPILER_MLIR_LITE_QUANTIZATION_IR_UNIFORMSUPPORT_H_ + +#include + +#include "llvm/ADT/APFloat.h" +#include "llvm/ADT/APInt.h" +#include "llvm/ADT/APSInt.h" +#include "mlir/Dialect/Quant/QuantTypes.h" // from @llvm-project +#include "mlir/IR/BuiltinTypes.h" // from @llvm-project +#include "mlir/IR/Types.h" // from @llvm-project + +namespace mlir { +namespace quantfork { + +/// Performs type conversion from an arbitrary input type to a type +/// that is expressed by a QuantizedType. +/// +/// This handles cases where the inputType is a supported primitive type +/// (i.e. f32, bf16, etc) or a vector/tensor type based on a supported +/// elemental type. +/// +/// Since conversion often involves introspecting some attributes of the +/// input type in order to determine how to represent it, this is a two step +/// process. +struct ExpressedToQuantizedConverter { + /// Creates a converter for the given input type. + static ExpressedToQuantizedConverter forInputType(Type inputType); + + /// Converts the inputType to be based on the given elemental type, + /// returning the new type (or nullptr and emit an error on failure). + Type convert(quant::QuantizedType elementalType) const; + + /// Whether the conversion is legal. + explicit operator bool() const { return (bool)expressedType; } + + /// The input type that is being converted from. + /// This may be an elemental or composite type. + const Type inputType; + + /// Supported, elemental expressed type (i.e. f32). + /// Will be nullptr if conversion is not supported. + const Type expressedType; +}; + +/// Reference implementation of converting between real numbers and values +/// represented by a UniformQuantizedType. +/// Note that this is not expected to be speedy and may be superseded eventually +/// by a more optimal implementation. +/// Also, the interface assumes that quantization is done per-layer and will +/// need to be wider for various per-channel schemes. As such, this is a +/// placeholder. +class UniformQuantizedValueConverter { + public: + explicit UniformQuantizedValueConverter( + quant::UniformQuantizedType uniformType) + : UniformQuantizedValueConverter( + uniformType.getScale(), + static_cast(uniformType.getZeroPoint()), + static_cast(uniformType.getStorageTypeMin()), + static_cast(uniformType.getStorageTypeMax()), + uniformType.getStorageTypeIntegralWidth(), uniformType.isSigned()) { + assert(uniformType.getExpressedType().isa()); + assert(uniformType.getStorageType().isSignlessInteger()); + } + + UniformQuantizedValueConverter(double scale, double zeroPoint, + double clampMin, double clampMax, + uint32_t storageBitWidth, bool isSigned) + : scale(scale), + zeroPoint(zeroPoint), + clampMin(clampMin), + clampMax(clampMax), + scaleDouble(scale), + zeroPointDouble(zeroPoint), + clampMinDouble(clampMin), + clampMaxDouble(clampMax), + storageBitWidth(storageBitWidth), + isSigned(isSigned), + roundMode(APFloat::rmNearestTiesToAway) {} + + UniformQuantizedValueConverter(double scale, double zeroPoint, + const APFloat &clampMin, + const APFloat &clampMax, + uint32_t storageBitWidth, bool isSigned) + : scale(scale), + zeroPoint(zeroPoint), + clampMin(clampMin), + clampMax(clampMax), + scaleDouble(scale), + zeroPointDouble(zeroPoint), + clampMinDouble(clampMin.convertToDouble()), + clampMaxDouble(clampMax.convertToDouble()), + storageBitWidth(storageBitWidth), + isSigned(isSigned), + roundMode(APFloat::rmNearestTiesToAway) {} + + virtual APInt quantizeFloatToInt(APFloat expressedValue) const { + // This function is a performance critical code path in quantization + // since it runs for each single float parameter value. + + // Specialize f32->u8/i8 case to optimize performance. + if (&expressedValue.getSemantics() == &APFloat::IEEEsingle() && + storageBitWidth == 8 && + roundMode == llvm::APFloatBase::rmNearestTiesToAway) { + return quantizeF32ToInt8(expressedValue); + } + + bool lossy; + expressedValue.convert(scale.getSemantics(), roundMode, &lossy); + // fixedpoint = clamp(clampMin, clampMax, ( + // roundHalfToEven(expressed / scale) + zeroPoint)) + APFloat scaled = (expressedValue / scale); + scaled.roundToIntegral(roundMode); + scaled.add(zeroPoint, roundMode); + APFloat fixedpoint = llvm::minimum(scaled, clampMax); + fixedpoint = llvm::maximum(fixedpoint, clampMin); + + llvm::APSInt result(storageBitWidth, !isSigned); + fixedpoint.convertToInteger(result, roundMode, &lossy); + + return std::move(result); + } + + int64_t quantizeFloatToInt64(APFloat expressedValue) const { + APInt qValue = quantizeFloatToInt(std::move(expressedValue)); + return isSigned ? qValue.getSExtValue() : qValue.getZExtValue(); + } + + virtual ~UniformQuantizedValueConverter() = default; + + private: + // An optimized implementation to quantize f32 to i8/u8 with C++ native + // arithmetic. + virtual APInt quantizeF32ToInt8(APFloat expressedValue) const { + assert(&expressedValue.getSemantics() == &APFloat::IEEEsingle()); + assert(storageBitWidth == 8); + assert(roundMode == llvm::APFloatBase::rmNearestTiesToAway); + + const float realValue = expressedValue.convertToFloat(); + + const double scaled = realValue / scaleDouble + zeroPointDouble; + // Round to nearest integer with halfway cases rounded away from zero. + const double scaledRounded = std::round(scaled); + const double clamped = + std::min(std::max(scaledRounded, clampMinDouble), clampMaxDouble); + + uint64_t signlessResult; + if (isSigned) { + int64_t clampedInt = static_cast(clamped); + memcpy(&signlessResult, &clampedInt, sizeof(clampedInt)); + } else { + signlessResult = static_cast(clamped); + } + return APInt(storageBitWidth, signlessResult); + } + + // Keep both APFloat and double versions of the quantization parameters + // around since they will be used in generic and specialized arithmetic, + // respectively. + const APFloat scale; + const APFloat zeroPoint; + const APFloat clampMin; + const APFloat clampMax; + + const double scaleDouble; + const double zeroPointDouble; + const double clampMinDouble; + const double clampMaxDouble; + + const uint32_t storageBitWidth; + const bool isSigned; + const llvm::APFloat::roundingMode roundMode; +}; + +/// An utility class to quantize an attribute by the per-axis quantization +/// parameters. The size of the quantization dim in the converted elements +/// attribute should matche the size of of scales/zeroPoints vectors in the +/// quantization parameters. +class UniformQuantizedPerAxisValueConverter { + public: + explicit UniformQuantizedPerAxisValueConverter( + quant::UniformQuantizedPerAxisType uniformType) + : scales(uniformType.getScales()), + zeroPoints(uniformType.getZeroPoints()), + clampMin(static_cast(uniformType.getStorageTypeMin())), + clampMax(static_cast(uniformType.getStorageTypeMax())), + storageBitWidth(uniformType.getStorageTypeIntegralWidth()), + isSigned(uniformType.isSigned()), + quantizationDim(uniformType.getQuantizedDimension()) { + assert(uniformType.getExpressedType().isa()); + assert(uniformType.getStorageType().isSignlessInteger()); + assert(scales.size() == zeroPoints.size()); + } + + /// Quantize an Attribute by the quantization parameters. Return nullptr if + /// the conversion fails or the input array isn't an ElementsAttr. + ElementsAttr convert(Attribute realValue); + + private: + /// Quantize an DenseFPElementsAttr by the quantization parameters. + DenseElementsAttr convert(DenseFPElementsAttr attr); + + /// Get a uniform converter for the index-th chunk along the quantizationDim. + /// All the elements in this chunk is quantized by the returned converter. + UniformQuantizedValueConverter getPerChunkConverter(int index) const { + UniformQuantizedValueConverter converter(scales[index], zeroPoints[index], + clampMin, clampMax, + storageBitWidth, isSigned); + return converter; + } + + const ArrayRef scales; + const ArrayRef zeroPoints; + const APFloat clampMin; + const APFloat clampMax; + const uint32_t storageBitWidth; + const bool isSigned; + int32_t quantizationDim; +}; + +} // namespace quantfork +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_LITE_QUANTIZATION_IR_UNIFORMSUPPORT_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/lite/utils/validators.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/lite/utils/validators.h new file mode 100644 index 0000000000000000000000000000000000000000..08d2e7b068b4be89803eee800931dab982edb08b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/lite/utils/validators.h @@ -0,0 +1,118 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +// This header file defines common validators used by TFLite transformation +// passes to validate op attributes or values. + +#ifndef TENSORFLOW_COMPILER_MLIR_LITE_UTILS_VALIDATORS_H_ +#define TENSORFLOW_COMPILER_MLIR_LITE_UTILS_VALIDATORS_H_ + +#include "mlir/Dialect/Func/IR/FuncOps.h" // from @llvm-project +#include "mlir/IR/BuiltinTypes.h" // from @llvm-project + +namespace mlir { +namespace TFL { + +// TODO(jpienaar): Change these to being one of these variants and/or generate +// these predicates. + +// Returns true if the given TensorFlow op does not have a `data_format` +// attribute (then default to "NHWC"), or its `data_format` attribute is "NHWC". +inline bool TFDataFormatIsNHWC(Operation *op) { + auto attr = op->getAttrOfType("data_format"); + return !attr || attr.getValue() == "NHWC"; +} + +// Returns true if the given TensorFlow op does not have a `data_format` +// attribute (then default to "NDHWC"), or its `data_format` attribute is +// "NDHWC". +inline bool TFDataFormatIsNDHWC(Operation *op) { + auto attr = op->getAttrOfType("data_format"); + return !attr || attr.getValue() == "NDHWC"; +} + +// Returns true if the given `op` +// * has an attribute with the given `name`, +// * and the attribute is an integer list of the form [1, X, Y, 1], +// and writes X, Y as 32-bit integer attribute to `x`, `y`. +bool TFIntListIs1XY1(Operation *op, StringRef name, IntegerAttr *x, + IntegerAttr *y); + +// Returns true if the attribute is an integer list of the form [1, X, Y, 1]. +bool TFIntListIs1XY1(Attribute attr); + +// Returns true if the attribute is an integer list of the form [1, 1, X, Y]. +bool TFIntListIs11XY(Attribute attr); + +// Returns true if the given `op` +// * has an attribute with the given `name`, +// * and the attribute is an integer list of the form [1, X, Y, Z, 1], +// and writes X, Y as 32-bit integer attribute to `x`, `y`, z. +bool TFIntListIs1XYZ1(Operation *op, StringRef name, IntegerAttr *x, + IntegerAttr *y, IntegerAttr *z); + +// Returns true if every element of the attribute is 1. All elements of `attr` +// must be `IntegerAttr`. +bool TFIntListIsAllOnes(Attribute attr); + +// Returns true iff the given value is a float32 tensor. +// is "DT_FLOAT". +inline bool TFTypeIsFloat32Tensor(Value value) { + auto tensorType = value.getType().dyn_cast(); + if (!tensorType) return false; + return tensorType.getElementType().isF32(); +} + +// Returns true iff the given value is a bf16 tensor. +inline bool TFTypeIsBFloat16Tensor(Value value) { + auto tensorType = value.getType().dyn_cast(); + if (!tensorType) return false; + return tensorType.getElementType().isBF16(); +} + +// Returns true iff the given value is a f16 tensor. +inline bool TFTypeIsHalfTensor(Value value) { + auto tensorType = value.getType().dyn_cast(); + if (!tensorType) return false; + return tensorType.getElementType().isF16(); +} + +// Returns true iff the given value is a f16 or bf16 tensor. +inline bool TFTypeIsBFloat16OrHalfTensor(Value value) { + return TFTypeIsBFloat16Tensor(value) || TFTypeIsHalfTensor(value); +} + +// Returns true iff the given TensorFlow op has a `padding` attribute whose +// value is "SAME" or "VALID", and writes the attribute to `padding`. +inline bool TFPaddingIsSameOrValid(Operation *op, StringAttr *padding) { + auto padding_attr = op->getAttrOfType("padding"); + if (padding_attr.getValue() != "SAME" && padding_attr.getValue() != "VALID") + return false; + *padding = padding_attr; + return true; +} + +/// Returns whether the given `a` and `b` have broadcast-compatible +/// types. +bool IsBroadcastableElementsAttrs(mlir::TypedAttr a, mlir::TypedAttr b); +// Returns true if every dimension of the attribute is 1 except the last one. +bool IsDimensionsDegenerateExceptLastOne(mlir::TypedAttr val); +// Returns true if every element is 1 except the last one. +bool IsDimensionsDegenerateExceptLastOne(ArrayRef elements_shape); + +} // end namespace TFL +} // end namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_LITE_UTILS_VALIDATORS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/mlir_graph_optimization_pass.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/mlir_graph_optimization_pass.h new file mode 100644 index 0000000000000000000000000000000000000000..bf500be3b33510c094769b2b23708737d581f644 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/mlir_graph_optimization_pass.h @@ -0,0 +1,224 @@ +/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_MLIR_GRAPH_OPTIMIZATION_PASS_H_ +#define TENSORFLOW_COMPILER_MLIR_MLIR_GRAPH_OPTIMIZATION_PASS_H_ + +#include +#include +#include +#include +#include +#include + +#include "tensorflow/compiler/mlir/tf2xla/mlir_bridge_rollout_policy.h" +#include "mlir/Dialect/Func/IR/FuncOps.h" // from @llvm-project +#include "mlir/IR/BuiltinOps.h" // from @llvm-project +#include "tensorflow/core/common_runtime/function_optimization_registry.h" +#include "tensorflow/core/common_runtime/optimization_registry.h" + +namespace tensorflow { + +// -------------------------------------------------------------------------- // +// MLIR passes running on Tensorflow function graphs (Tensorflow V2). +// -------------------------------------------------------------------------- // + +// Disabled - skip execution of the pass. +// Enabled - execute the pass, propagate errors to the caller if any. +// FallbackEnabled - execute the pass and commit all the changes to the MLIR +// module in case of success. Do not commit any changes in case of failures, +// let the rest of the pipeline run. +enum class MlirOptimizationPassState { Disabled, Enabled, FallbackEnabled }; + +// An API for registering MLIR ModulePass with the Tensorflow runtime. These +// passes are running only for function graphs built by Tensorflow V2 and +// instantiated by the process_function_library_runtime (see +// FunctionOptimizationPass for details). +class MlirOptimizationPass { + public: + virtual ~MlirOptimizationPass() = default; + virtual llvm::StringRef name() const = 0; + + // Returns an enum value: + // Enabled if the pass is enabled for the given graph with specified config. + // Disabled if the pass is disabled. + // FallbackEnabled if the pass needs to be executed in fallback mode. + // + // When the pass is FallbackEnabled, the pass is executed and the changes it + // makes to the MLIR module will be committed only if the pass was successful, + // otherwise no changes are committed and the rest of the pipeline is run. + // + // `device_set` can be nullptr if the devices information is not + // available or no device specific filtering is required. + // `function_library` contains function definitions for function calls in + // `graph` not included in the `graph` FunctionLibraryDefinition. + virtual MlirOptimizationPassState GetPassState( + const DeviceSet* device_set, const ConfigProto& config_proto, + const Graph& graph, + const FunctionLibraryDefinition& function_library) const = 0; + + virtual Status Run(const std::string& function_name, + const ConfigProto& config_proto, mlir::ModuleOp module, + const Graph& graph, + const FunctionLibraryDefinition& function_library) = 0; +}; + +class MlirOptimizationPassRegistry { + public: + struct PassRegistration { + int priority; + std::unique_ptr pass; + }; + + struct PriorityComparator { + bool operator()(const PassRegistration& x, + const PassRegistration& y) const { + return x.priority < y.priority; + } + }; + + using Passes = std::set; + + // Returns the global registry of MLIR optimization passes. + static MlirOptimizationPassRegistry& Global(); + + // Register optimization `pass` with the given `priority`. + void Add(int priority, std::unique_ptr pass) { + auto inserted = passes_.insert({priority, std::move(pass)}); + CHECK(inserted.second) + << "Pass priority must be unique. " + << "Previously registered pass with the same priority: " + << inserted.first->pass->name().str(); + } + + // Free the memory allocated for all passes. + void ClearPasses() { passes_.clear(); } + + const Passes& passes() const { return passes_; } + + private: + Passes passes_; +}; + +// Function optimization pass that runs all MLIR passes registered in +// MlirOptimizationPassRegistry. +class MlirFunctionOptimizationPass : public FunctionOptimizationPass { + public: + explicit MlirFunctionOptimizationPass( + const MlirOptimizationPassRegistry* registry = + &MlirOptimizationPassRegistry::Global()) + : registry_(registry) {} + + // Executes all of the underlying registered MlirOptimizationPasses. + Status Run(const std::string& function_name, const DeviceSet& device_set, + const ConfigProto& config_proto, + const FunctionOptimizationPass::FunctionOptions& function_options, + std::unique_ptr* graph, FunctionLibraryDefinition* flib_def, + std::vector* control_ret_node_names, + bool* control_rets_updated) override; + + private: + const MlirOptimizationPassRegistry* registry_; +}; + +// -------------------------------------------------------------------------- // +// MLIR passes running on Tensorflow V1 graphs. +// -------------------------------------------------------------------------- // + +// An API for registering MLIR ModulePass with the Tensorflow runtime. These +// passes are running only for V1 graphs (legacy graphs) executed via Session +// runtime. Graph importer updates legacy graph behavior to V2 constructs (e.g. +// it raises control flow from Switch/Merge nodes to functional control flow +// with If/While operations). +class MlirV1CompatOptimizationPass { + public: + virtual ~MlirV1CompatOptimizationPass() = default; + virtual llvm::StringRef name() const = 0; + + // Returns a MlirOptimizationPassState based on the given graph and + // config. See comments on `MlirOptimizationPassState` enum for more info + // on exact values. + virtual MlirOptimizationPassState GetPassState( + const DeviceSet* device_set, const ConfigProto& config_proto, + const Graph& graph, + const FunctionLibraryDefinition& function_library) const = 0; + + virtual Status Run(const GraphOptimizationPassOptions& options, + mlir::ModuleOp module) = 0; +}; + +class MlirV1CompatOptimizationPassRegistry { + public: + // Returns the global registry of MLIR optimization passes. + static MlirV1CompatOptimizationPassRegistry& Global(); + + void Add(std::unique_ptr pass) { + CHECK(pass_ == nullptr) << "Only a single pass can be registered"; + pass_ = std::move(pass); + } + + MlirV1CompatOptimizationPass* pass() const { + return pass_ ? pass_.get() : nullptr; + } + + // Free the memory allocated for the single pass. + // This method is used for testing mostly. + void ClearPass() { pass_.reset(); } + + private: + std::unique_ptr pass_{}; +}; + +class MlirV1CompatGraphOptimizationPass : public GraphOptimizationPass { + public: + explicit MlirV1CompatGraphOptimizationPass( + const MlirV1CompatOptimizationPassRegistry* registry = + &MlirV1CompatOptimizationPassRegistry::Global()) + : registry_(registry) {} + + Status Run(const GraphOptimizationPassOptions& options) override; + + private: + const MlirV1CompatOptimizationPassRegistry* registry_; +}; + +// -------------------------------------------------------------------------- // +// Helper classes for static registration of MLIR (V1 Compat) passes in the +// corresponding registry. +// -------------------------------------------------------------------------- // + +namespace mlir_pass_registration { + +class MlirOptimizationPassRegistration { + public: + explicit MlirOptimizationPassRegistration( + int priority, std::unique_ptr pass) { + MlirOptimizationPassRegistry::Global().Add(priority, std::move(pass)); + } +}; + +class MlirV1CompatOptimizationPassRegistration { + public: + explicit MlirV1CompatOptimizationPassRegistration( + std::unique_ptr pass) { + MlirV1CompatOptimizationPassRegistry::Global().Add(std::move(pass)); + } +}; + +} // namespace mlir_pass_registration + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_MLIR_MLIR_GRAPH_OPTIMIZATION_PASS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/op_or_arg_name_mapper.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/op_or_arg_name_mapper.h new file mode 100644 index 0000000000000000000000000000000000000000..d8ff9cebc0108a6a0850a56febe0821f008d5f3b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/op_or_arg_name_mapper.h @@ -0,0 +1,104 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_OP_OR_ARG_NAME_MAPPER_H_ +#define TENSORFLOW_COMPILER_MLIR_OP_OR_ARG_NAME_MAPPER_H_ + +#include + +#include "absl/strings/string_view.h" +#include "llvm/ADT/DenseMap.h" +#include "llvm/ADT/PointerUnion.h" +#include "llvm/ADT/StringMap.h" +#include "llvm/ADT/StringRef.h" +#include "mlir/IR/Operation.h" // from @llvm-project +#include "mlir/IR/Value.h" // from @llvm-project + +namespace tensorflow { + +// PointerUnion for operation and value. +// TODO(jpienaar): Rename the files. +using OpOrVal = llvm::PointerUnion; + +// Mapper from operation or value to name. +class OpOrArgNameMapper { + public: + // Returns unique name for the given prefix. + llvm::StringRef GetUniqueName(llvm::StringRef prefix, int hash_value = 0); + + // Returns unique name for the operation or value. + llvm::StringRef GetUniqueName(OpOrVal op_or_val, int hash_value = 0); + + // Returns unique name as a string_view for the operation or value. + absl::string_view GetUniqueNameView(OpOrVal op_or_val); + + // Initializes operation or value to map to name. Returns number of + // operations or value already named 'name' which should be 0 else + // GetUniqueName could return the same names for different operations or + // values. + // Note: Its up to the caller to decide the behavior when assigning two + // operations or values to the same name. + int InitOpName(OpOrVal op_or_val, llvm::StringRef name); + + virtual ~OpOrArgNameMapper(); + + protected: + // Returns true if the name is unique. A derived class can override it if the + // class maintains uniqueness in a different scope. + virtual bool IsUnique(llvm::StringRef name); + + // Returns a constant view of the underlying map. + const llvm::DenseMap& GetMap() const { + return op_or_val_to_name_; + } + + // Returns the separator used before uniqueing suffix. + virtual llvm::StringRef GetSuffixSeparator() { return ""; } + + virtual llvm::StringRef GetDashSeparator() { return "_"; } + + private: + // Returns name from the location of the operation or value. + virtual std::string GetName(OpOrVal op_or_val) = 0; + + // Maps string name to count. This map is used to help keep track of unique + // names for operations or values. + llvm::StringMap name_to_count_; + // Maps operation or values to name. Value in map is a view of the string + // name in `name_to_count_`. Names in `name_to_count_` are never removed. + llvm::DenseMap op_or_val_to_name_; +}; + +// OpOrArgNameMapper that returns, for operations or values not initialized +// to a specific name, a name based on the location of the operation or +// value. +class OpOrArgLocNameMapper : public OpOrArgNameMapper { + protected: + std::string GetName(OpOrVal op_or_val) override; +}; + +// OpOrArgNameMapper that returns, for operations or values not initialized +// to a specific name, a short name. +class OpOrArgStripNameMapper : public OpOrArgNameMapper { + private: + std::string GetName(OpOrVal op_or_val) override; + + // Number of ops mapped. + int count_ = 0; +}; + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_MLIR_OP_OR_ARG_NAME_MAPPER_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/quantization/stablehlo/passes/bridge/passes.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/quantization/stablehlo/passes/bridge/passes.h new file mode 100644 index 0000000000000000000000000000000000000000..983339d813c7a08f833fe22b6e5a2052a2293eed --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/quantization/stablehlo/passes/bridge/passes.h @@ -0,0 +1,63 @@ +/* Copyright 2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_QUANTIZATION_STABLEHLO_PASSES_BRIDGE_PASSES_H_ +#define TENSORFLOW_COMPILER_MLIR_QUANTIZATION_STABLEHLO_PASSES_BRIDGE_PASSES_H_ + +#include + +#define GEN_PASS_DECL +#include "mlir/Dialect/Func/IR/FuncOps.h" // from @llvm-project +#include "mlir/Pass/Pass.h" // from @llvm-project + +namespace mlir::quant::stablehlo { + +// Legalizes from MHLO quantized ops with MHLO quant types to MHLO primitive ops +// like int ops. +std::unique_ptr> createConvertMHLOQuantToIntPass( + bool legalize_chlo = true); + +// Creates an instance of the ConvertTFQuantOpsToMHLOPass pass, which will +// convert TF uniform quantized ops to the corresponding quantized MHLO ops. +std::unique_ptr> +CreateConvertTFQuantOpsToMHLOPass(); + +// TODO(b/288094093): Migrate uniform quantization legalization in a separate +// pass. +void PopulateLegalizeTfQuantizationPatterns(MLIRContext *context, + RewritePatternSet *patterns); + +// Creates an instance of the ConvertTFQuantTypes pass, which will convert TF +// qint types to int types and surround TF UniformQuantized ops with qint <-> +// int casts. +std::unique_ptr> CreateConvertTFQuantTypesPass(); + +// Creates an instance of the VerifyQuantLegalization pass, which verifies all +// quant ops and types are lowered. +std::unique_ptr> +CreateVerifyQuantLegalizationPass(); + +// Add all passes for lowering TF quant ops and types to MHLO int. +void AddQuantizationLoweringPasses(mlir::OpPassManager &pm); + +#define GEN_PASS_REGISTRATION +#define GEN_PASS_DECL_CONVERTMHLOQUANTTOINT +#define GEN_PASS_DECL_CONVERTTFQUANTOPSTOMHLO +#define GEN_PASS_DECL_CONVERTTFQUANTTYPES +#define GEN_PASS_DECL_VERIFYQUANTLEGALIZATION +#include "tensorflow/compiler/mlir/quantization/stablehlo/passes/bridge/passes.h.inc" +} // namespace mlir::quant::stablehlo + +#endif // TENSORFLOW_COMPILER_MLIR_QUANTIZATION_STABLEHLO_PASSES_BRIDGE_PASSES_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/quantization/stablehlo/passes/bridge/passes.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/quantization/stablehlo/passes/bridge/passes.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..c561f925bb98fbd9b730491aa754ace24f99c963 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/quantization/stablehlo/passes/bridge/passes.h.inc @@ -0,0 +1,572 @@ +/* Autogenerated by mlir-tblgen; don't manually edit */ + +#ifdef GEN_PASS_DECL +// Generate declarations for all passes. +#define GEN_PASS_DECL_CONVERTMHLOQUANTTOINT +#define GEN_PASS_DECL_CONVERTTFQUANTOPSTOMHLO +#define GEN_PASS_DECL_CONVERTTFQUANTTYPES +#define GEN_PASS_DECL_VERIFYQUANTLEGALIZATION +#undef GEN_PASS_DECL +#endif // GEN_PASS_DECL + +//===----------------------------------------------------------------------===// +// ConvertMHLOQuantToInt +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTMHLOQUANTTOINT +struct ConvertMHLOQuantToIntOptions { + bool legalize_chlo_ = true; +}; +#undef GEN_PASS_DECL_CONVERTMHLOQUANTTOINT +#endif // GEN_PASS_DECL_CONVERTMHLOQUANTTOINT +#ifdef GEN_PASS_DEF_CONVERTMHLOQUANTTOINT +namespace impl { + +template +class ConvertMHLOQuantToIntBase : public ::mlir::OperationPass { +public: + using Base = ConvertMHLOQuantToIntBase; + + ConvertMHLOQuantToIntBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertMHLOQuantToIntBase(const ConvertMHLOQuantToIntBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-mhlo-quant-to-int"); + } + ::llvm::StringRef getArgument() const override { return "convert-mhlo-quant-to-int"; } + + ::llvm::StringRef getDescription() const override { return "Convert from MHLO quantized ops to MHLO primitive ops."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertMHLOQuantToInt"); + } + ::llvm::StringRef getName() const override { return "ConvertMHLOQuantToInt"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertMHLOQuantToIntBase) + + ConvertMHLOQuantToIntBase(const ConvertMHLOQuantToIntOptions &options) : ConvertMHLOQuantToIntBase() { + legalize_chlo_ = options.legalize_chlo_; + } +protected: + ::mlir::Pass::Option legalize_chlo_{*this, "legalize-chlo", ::llvm::cl::desc("Legalizes intermediate chlo ops to hlo"), ::llvm::cl::init(true)}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_CONVERTMHLOQUANTTOINT +#endif // GEN_PASS_DEF_CONVERTMHLOQUANTTOINT + +//===----------------------------------------------------------------------===// +// ConvertTFQuantOpsToMHLO +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTTFQUANTOPSTOMHLO +#undef GEN_PASS_DECL_CONVERTTFQUANTOPSTOMHLO +#endif // GEN_PASS_DECL_CONVERTTFQUANTOPSTOMHLO +#ifdef GEN_PASS_DEF_CONVERTTFQUANTOPSTOMHLO +namespace impl { + +template +class ConvertTFQuantOpsToMHLOBase : public ::mlir::OperationPass { +public: + using Base = ConvertTFQuantOpsToMHLOBase; + + ConvertTFQuantOpsToMHLOBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertTFQuantOpsToMHLOBase(const ConvertTFQuantOpsToMHLOBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("quant-convert-tf-quant-ops-to-mhlo"); + } + ::llvm::StringRef getArgument() const override { return "quant-convert-tf-quant-ops-to-mhlo"; } + + ::llvm::StringRef getDescription() const override { return "Convert TF Quant ops to MHLO quantizated ops."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertTFQuantOpsToMHLO"); + } + ::llvm::StringRef getName() const override { return "ConvertTFQuantOpsToMHLO"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertTFQuantOpsToMHLOBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_CONVERTTFQUANTOPSTOMHLO +#endif // GEN_PASS_DEF_CONVERTTFQUANTOPSTOMHLO + +//===----------------------------------------------------------------------===// +// ConvertTFQuantTypes +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTTFQUANTTYPES +#undef GEN_PASS_DECL_CONVERTTFQUANTTYPES +#endif // GEN_PASS_DECL_CONVERTTFQUANTTYPES +#ifdef GEN_PASS_DEF_CONVERTTFQUANTTYPES +namespace impl { + +template +class ConvertTFQuantTypesBase : public ::mlir::OperationPass { +public: + using Base = ConvertTFQuantTypesBase; + + ConvertTFQuantTypesBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertTFQuantTypesBase(const ConvertTFQuantTypesBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-tf-quant-types"); + } + ::llvm::StringRef getArgument() const override { return "convert-tf-quant-types"; } + + ::llvm::StringRef getDescription() const override { return "Replace TensorFlow qint types with int types."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertTFQuantTypes"); + } + ::llvm::StringRef getName() const override { return "ConvertTFQuantTypes"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertTFQuantTypesBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_CONVERTTFQUANTTYPES +#endif // GEN_PASS_DEF_CONVERTTFQUANTTYPES + +//===----------------------------------------------------------------------===// +// VerifyQuantLegalization +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_VERIFYQUANTLEGALIZATION +#undef GEN_PASS_DECL_VERIFYQUANTLEGALIZATION +#endif // GEN_PASS_DECL_VERIFYQUANTLEGALIZATION +#ifdef GEN_PASS_DEF_VERIFYQUANTLEGALIZATION +namespace impl { + +template +class VerifyQuantLegalizationBase : public ::mlir::OperationPass { +public: + using Base = VerifyQuantLegalizationBase; + + VerifyQuantLegalizationBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + VerifyQuantLegalizationBase(const VerifyQuantLegalizationBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("verify-quant-legalization"); + } + ::llvm::StringRef getArgument() const override { return "verify-quant-legalization"; } + + ::llvm::StringRef getDescription() const override { return "Verifies that all TF quant ops and types have been legalized."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("VerifyQuantLegalization"); + } + ::llvm::StringRef getName() const override { return "VerifyQuantLegalization"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(VerifyQuantLegalizationBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_VERIFYQUANTLEGALIZATION +#endif // GEN_PASS_DEF_VERIFYQUANTLEGALIZATION +#ifdef GEN_PASS_REGISTRATION + +//===----------------------------------------------------------------------===// +// ConvertMHLOQuantToInt Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertMHLOQuantToInt() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::quant::stablehlo::createConvertMHLOQuantToIntPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertMHLOQuantToIntPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::quant::stablehlo::createConvertMHLOQuantToIntPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertTFQuantOpsToMHLO Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertTFQuantOpsToMHLO() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::quant::stablehlo::CreateConvertTFQuantOpsToMHLOPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertTFQuantOpsToMHLOPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::quant::stablehlo::CreateConvertTFQuantOpsToMHLOPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertTFQuantTypes Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertTFQuantTypes() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::quant::stablehlo::CreateConvertTFQuantTypesPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertTFQuantTypesPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::quant::stablehlo::CreateConvertTFQuantTypesPass(); + }); +} + +//===----------------------------------------------------------------------===// +// VerifyQuantLegalization Registration +//===----------------------------------------------------------------------===// + +inline void registerVerifyQuantLegalization() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::quant::stablehlo::CreateVerifyQuantLegalizationPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerVerifyQuantLegalizationPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::quant::stablehlo::CreateVerifyQuantLegalizationPass(); + }); +} + +//===----------------------------------------------------------------------===// +// Bridge Registration +//===----------------------------------------------------------------------===// + +inline void registerBridgePasses() { + registerConvertMHLOQuantToInt(); + registerConvertTFQuantOpsToMHLO(); + registerConvertTFQuantTypes(); + registerVerifyQuantLegalization(); +} +#undef GEN_PASS_REGISTRATION +#endif // GEN_PASS_REGISTRATION +// Deprecated. Please use the new per-pass macros. +#ifdef GEN_PASS_CLASSES + +template +class ConvertMHLOQuantToIntBase : public ::mlir::OperationPass { +public: + using Base = ConvertMHLOQuantToIntBase; + + ConvertMHLOQuantToIntBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertMHLOQuantToIntBase(const ConvertMHLOQuantToIntBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-mhlo-quant-to-int"); + } + ::llvm::StringRef getArgument() const override { return "convert-mhlo-quant-to-int"; } + + ::llvm::StringRef getDescription() const override { return "Convert from MHLO quantized ops to MHLO primitive ops."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertMHLOQuantToInt"); + } + ::llvm::StringRef getName() const override { return "ConvertMHLOQuantToInt"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertMHLOQuantToIntBase) + +protected: + ::mlir::Pass::Option legalize_chlo_{*this, "legalize-chlo", ::llvm::cl::desc("Legalizes intermediate chlo ops to hlo"), ::llvm::cl::init(true)}; +}; + +template +class ConvertTFQuantOpsToMHLOBase : public ::mlir::OperationPass { +public: + using Base = ConvertTFQuantOpsToMHLOBase; + + ConvertTFQuantOpsToMHLOBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertTFQuantOpsToMHLOBase(const ConvertTFQuantOpsToMHLOBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("quant-convert-tf-quant-ops-to-mhlo"); + } + ::llvm::StringRef getArgument() const override { return "quant-convert-tf-quant-ops-to-mhlo"; } + + ::llvm::StringRef getDescription() const override { return "Convert TF Quant ops to MHLO quantizated ops."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertTFQuantOpsToMHLO"); + } + ::llvm::StringRef getName() const override { return "ConvertTFQuantOpsToMHLO"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertTFQuantOpsToMHLOBase) + +protected: +}; + +template +class ConvertTFQuantTypesBase : public ::mlir::OperationPass { +public: + using Base = ConvertTFQuantTypesBase; + + ConvertTFQuantTypesBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertTFQuantTypesBase(const ConvertTFQuantTypesBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-tf-quant-types"); + } + ::llvm::StringRef getArgument() const override { return "convert-tf-quant-types"; } + + ::llvm::StringRef getDescription() const override { return "Replace TensorFlow qint types with int types."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertTFQuantTypes"); + } + ::llvm::StringRef getName() const override { return "ConvertTFQuantTypes"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertTFQuantTypesBase) + +protected: +}; + +template +class VerifyQuantLegalizationBase : public ::mlir::OperationPass { +public: + using Base = VerifyQuantLegalizationBase; + + VerifyQuantLegalizationBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + VerifyQuantLegalizationBase(const VerifyQuantLegalizationBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("verify-quant-legalization"); + } + ::llvm::StringRef getArgument() const override { return "verify-quant-legalization"; } + + ::llvm::StringRef getDescription() const override { return "Verifies that all TF quant ops and types have been legalized."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("VerifyQuantLegalization"); + } + ::llvm::StringRef getName() const override { return "VerifyQuantLegalization"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(VerifyQuantLegalizationBase) + +protected: +}; +#undef GEN_PASS_CLASSES +#endif // GEN_PASS_CLASSES diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/quantization/stablehlo/utils/math_utils.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/quantization/stablehlo/utils/math_utils.h new file mode 100644 index 0000000000000000000000000000000000000000..f2d03d8bfac470989de16f12c533d9e33e6a18e0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/quantization/stablehlo/utils/math_utils.h @@ -0,0 +1,30 @@ +#ifndef TENSORFLOW_COMPILER_MLIR_QUANTIZATION_STABLEHLO_UTILS_MATH_UTILS_H_ +#define TENSORFLOW_COMPILER_MLIR_QUANTIZATION_STABLEHLO_UTILS_MATH_UTILS_H_ + +/* Copyright 2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#include "mlir/Support/LogicalResult.h" // from @llvm-project + +namespace mlir::quant::stablehlo { + +// Decomposes a given floating point value num into a normalized and quantized +// fraction and an integral power of two. +LogicalResult QuantizeMultiplier(double double_multiplier, + int32_t& quantized_fraction, int32_t& shift); + +} // namespace mlir::quant::stablehlo + +#endif // TENSORFLOW_COMPILER_MLIR_QUANTIZATION_STABLEHLO_UTILS_MATH_UTILS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/quantization/stablehlo/utils/tf_type_utils.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/quantization/stablehlo/utils/tf_type_utils.h new file mode 100644 index 0000000000000000000000000000000000000000..c23857b3f2b2c2a0c919d0c1e848945b030cef36 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/quantization/stablehlo/utils/tf_type_utils.h @@ -0,0 +1,43 @@ +/* Copyright 2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_QUANTIZATION_STABLEHLO_UTILS_TF_TYPE_UTILS_H_ +#define TENSORFLOW_COMPILER_MLIR_QUANTIZATION_STABLEHLO_UTILS_TF_TYPE_UTILS_H_ + +#include "llvm/ADT/StringRef.h" +#include "mlir/IR/BuiltinAttributes.h" // from @llvm-project +#include "mlir/IR/BuiltinTypes.h" // from @llvm-project +#include "mlir/IR/Types.h" // from @llvm-project +#include "mlir/Support/LogicalResult.h" // from @llvm-project + +namespace mlir::quant::tensorflow { + +// GetDenseAttrFromTensorProtoAttr returns DenseElementsAttr from tensor proto. +FailureOr GetDenseAttrFromTensorProtoAttr( + llvm::StringRef mangled_tensor_proto, TensorType result_tensor_type); + +// Check if a type is TF qint type. +bool IsTFQintType(Type type); + +// Convert qint type to the corresponding int type. Return original type if it +// is not qint type. +Type GetIntTypeFromTFQint(Type type); + +// Check if an op is TF UniformQuantized op. +bool IsTFUniformQuantizedOp(Operation *op); + +} // namespace mlir::quant::tensorflow + +#endif // TENSORFLOW_COMPILER_MLIR_QUANTIZATION_STABLEHLO_UTILS_TF_TYPE_UTILS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/analysis/per_function_aggregate_analysis.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/analysis/per_function_aggregate_analysis.h new file mode 100644 index 0000000000000000000000000000000000000000..5ba65901cc523de855a2d90ca22e93a9b3a07dd6 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/analysis/per_function_aggregate_analysis.h @@ -0,0 +1,85 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_ANALYSIS_PER_FUNCTION_AGGREGATE_ANALYSIS_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_ANALYSIS_PER_FUNCTION_AGGREGATE_ANALYSIS_H_ + +#include +#include +#include + +#include "llvm/ADT/DenseMap.h" +#include "mlir/Dialect/Func/IR/FuncOps.h" // from @llvm-project +#include "mlir/IR/BuiltinOps.h" // from @llvm-project +#include "mlir/Pass/Pass.h" // from @llvm-project + +namespace mlir { +namespace TF { +namespace detail { + +// This template defines an aggregate analysis base class, which analyzes a +// module but the analysis info is stored per function. +template +class PerFunctionAggregateAnalysis { + public: + using Info = InfoT; + + // Returns the analysis info for the given function. + const Info& GetAnalysisForFunc(func::FuncOp func) const { + auto it = info_map_.find(func); + assert(it != info_map_.end()); + return it->second; + } + + protected: + // Since `InfoT` might be large, DenseMap is used instead of SmallDenseMap to + // avoid stack overflow. + llvm::DenseMap info_map_; +}; + +} // namespace detail + +// Base CRTP class to help write passes that are consumes a per-function +// aggregate analysis and operate on all non-extern functions (similar to a +// OperationPass, but with no concurrency between functions). The +// derived classes need to provide a runOnFunction() method that accepts the +// function and the analysis information for that function. +template +class PerFunctionAggregateAnalysisConsumerPass + : public PassWrapper< + PerFunctionAggregateAnalysisConsumerPass, + OperationPass> { + public: + static ::mlir::TypeID resolveTypeID() { + static ::mlir::SelfOwningTypeID id; + return id; + } + + private: + void runOnOperation() override { + ModuleOp op = this->getOperation(); + DerivedT& derived = *static_cast(this); + auto& analysis = this->template getAnalysis(); + + for (auto func : op.getOps()) + if (!func.isExternal()) + derived.runOnFunction(func, analysis.GetAnalysisForFunc(func)); + } +}; + +} // namespace TF +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_ANALYSIS_PER_FUNCTION_AGGREGATE_ANALYSIS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/analysis/resource_alias_analysis.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/analysis/resource_alias_analysis.h new file mode 100644 index 0000000000000000000000000000000000000000..e8eb89fea13f32aaaf0c95b0211f22fd0a7dec61 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/analysis/resource_alias_analysis.h @@ -0,0 +1,160 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_ANALYSIS_RESOURCE_ALIAS_ANALYSIS_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_ANALYSIS_RESOURCE_ALIAS_ANALYSIS_H_ + +#include +#include +#include + +#include "llvm/ADT/ArrayRef.h" +#include "llvm/ADT/STLExtras.h" +#include "llvm/ADT/SetVector.h" +#include "llvm/ADT/SmallSet.h" +#include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/StringMap.h" +#include "mlir/IR/Operation.h" // from @llvm-project +#include "mlir/IR/Region.h" // from @llvm-project +#include "mlir/IR/TypeUtilities.h" // from @llvm-project +#include "tensorflow/compiler/mlir/tensorflow/analysis/per_function_aggregate_analysis.h" +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_types.h" + +namespace mlir { +namespace TF { +namespace detail { +class BacktrackAnalysis; +class BacktrackAnalysisInfo; + +// Resource alias analysis information for a single function. +class ResourceAliasAnalysisInfo { + public: + // Constructs analysis info by analyzing the given function. + ResourceAliasAnalysisInfo(func::FuncOp func, + const BacktrackAnalysis& backtrack_analysis, + SymbolTableCollection& symbol_table_collection); + + ResourceAliasAnalysisInfo(ResourceAliasAnalysisInfo&&) = default; + + // Returns if the analysis fails to resolve a resource-type value. + bool IsUnknownResource(Value resource) const; + + // Returns the set of unique IDs which `resource` could alias. Requires that + // IsUnknownResource(resource) == false. + const llvm::SmallSet& GetResourceUniqueIds(Value resource) const; + + // Returns the set of values that are potentially aliases of `value`. Requires + // `IsUnknownResource(resource) == false`. + llvm::SmallSetVector GetResourceAliases(Value resource) const; + + // Returns true iff given resource is allocated by op with + // `UniqueResourceAllocation` trait. This can be utilized for while-loop + // parallelization. + bool IsUniqueResourceAllocationId(int64_t resource_id) const { + return unique_resource_allocation_ids_.contains(resource_id); + } + + private: + // Maps resource value to unique ID and vice-versa. Returns true if the + // mapping has changed. + bool AddValueUniqueIDMapping(Value value, int64_t id) { + resource_value_to_ids_[value].insert(id); + return id_to_resource_values_[id].insert(value); + } + + // Returns the set unique Values which map to `id`. + const llvm::SmallSetVector& GetUniqueIdResources(int64_t id) const; + + // Propagates the resource IDs from an input operand to a result. Returns + // true of the mapping has changed. + bool PropagateInputToOutput(const Value& operand, const OpResult& result); + + // Analyzes while loops to compute resource IDs for the loop results. + // `body_info` is the backtrack analysis info for the loop body. + void AnalyzeWhileLoop(Operation* while_op, + const BacktrackAnalysisInfo& body_info); + + // Analyzes tf.Case/tf.If ops to compute resource IDs. + template + void AnalyzeFunctionalCaseOrIfOp(CaseOrIfOp case_or_if_op, + llvm::ArrayRef functions, + const BacktrackAnalysis& backtrack_analysis); + + // Analyzes tf.CaseRegion/tf.IfRegion ops to compute resource IDs. + void AnalyzeRegionCaseOrIfOp(Operation* case_or_if_op, + const BacktrackAnalysis& backtrack_analysis); + + // Maps each resource-type value to a set of unique IDs that it could alias. + llvm::SmallDenseMap, 8> + resource_value_to_ids_; + + // Maps each unique ID to a set of resource-type values that could alias to + // it. This is inverse of `resource_value_to_ids_` map. + llvm::SmallDenseMap, 8> + id_to_resource_values_; + + // Maps MLIR type IDs for resource types to internal resource type IDs. + llvm::SmallDenseMap type_id_to_internal_type_id_; + + // Contains IDs of all resources that are allocated by ops with + // `UniqueResourceAllocation` trait. + llvm::SmallDenseSet unique_resource_allocation_ids_; + + public: + // Resource IDs have the following semantics: + // a) -1 represents an unknown resource (both instance and type unknown) + // b) IDs in range [0,kMaxResourceTypeId] represent resource type IDs; we use + // such IDs when we know the resource type but not the instance + // c) IDs > kMaxResourceTypeId represent resource instance IDs (i.e., we know + // the specific resource instance) + // + // Note: In general, there can be different ops allocating a resource of the + // same type, for one we might assign a resource type ID and for the other + // a resource instance ID. That means, they will be treated as non-aliasing. + // This is correct for all current cases. A problematic case could be if we + // had two ops A and B, A has the `ResourceHandleAllocatorInterface` and B has + // not, and both ops might return a handle to the same resource (depending on + // attributes). In this case, the return value of A would get a different ID + // than the return value of B although both could point to the same resource. + // It seems highly unlikely to encounter such a case but, to be safe, this + // should be revisited for new resource-allocators that might potentially + // break our currently guaranteed correctness. + // For context, we are very conservative here compared to + // `auto_control_deps.py` where it is assumed that allocated resource values + // NEVER alias. We should align our assumptions in the future. + static constexpr int64_t kUnknownResourceId = -1; + static constexpr int64_t kInvalidResourceId = -2; + static constexpr int64_t kMaxResourceTypeId = 9999; +}; + +} // namespace detail + +// An analysis that runs on a module and maps each resource-type value to a +// set of unique IDs representing the possible resources it could alias. +// +// Note that this is not an inter-procedural or inter-regional analysis, i.e., +// each function and region are handled separately and cross-function or cross- +// region aliasing cannot be checked by this analysis. +class ResourceAliasAnalysis : public detail::PerFunctionAggregateAnalysis< + detail::ResourceAliasAnalysisInfo> { + public: + // Constructs analysis by analyzing the given module operation. + explicit ResourceAliasAnalysis(ModuleOp module); +}; + +} // namespace TF +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_ANALYSIS_RESOURCE_ALIAS_ANALYSIS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/analysis/resource_dataflow.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/analysis/resource_dataflow.h new file mode 100644 index 0000000000000000000000000000000000000000..68f6fa2d44c763fd8e33a3b56ff66fd821c198a7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/analysis/resource_dataflow.h @@ -0,0 +1,79 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_ANALYSIS_RESOURCE_DATAFLOW_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_ANALYSIS_RESOURCE_DATAFLOW_H_ + +#include +#include + +#include "llvm/ADT/BitVector.h" +#include "llvm/ADT/STLExtras.h" +#include "llvm/Support/Casting.h" +#include "llvm/Support/Debug.h" +#include "mlir/Analysis/DataFlow/DeadCodeAnalysis.h" // from @llvm-project +#include "mlir/Analysis/DataFlow/SparseAnalysis.h" // from @llvm-project +#include "mlir/Dialect/Func/IR/FuncOps.h" // from @llvm-project +#include "mlir/IR/Builders.h" // from @llvm-project +#include "mlir/IR/BuiltinOps.h" // from @llvm-project +#include "mlir/IR/SymbolTable.h" // from @llvm-project +#include "mlir/IR/Value.h" // from @llvm-project +#include "mlir/Pass/Pass.h" // from @llvm-project +#include "mlir/Support/LLVM.h" // from @llvm-project + +namespace mlir { +namespace TF { + +// Used as a lattice value. +struct ResourceConstructingOps { + explicit ResourceConstructingOps(Operation *op = nullptr); + static ResourceConstructingOps getPessimisticValueState(MLIRContext *context); + static ResourceConstructingOps getPessimisticValueState(Value value); + bool operator==(const ResourceConstructingOps &rhs) const { + return ops == rhs.ops; + } + + static ResourceConstructingOps join(const ResourceConstructingOps &lhs, + const ResourceConstructingOps &rhs); + void print(raw_ostream &os) const; + + // The operation(s) which created the resource value. + // IR constructs (i.e., GlobalTensorOp) are not const-correct. + mutable DenseSet ops; +}; + +class ResourceDataflowAnalysis + : public dataflow::SparseForwardDataFlowAnalysis< + dataflow::Lattice> { + public: + using StateT = dataflow::Lattice; + using dataflow::SparseForwardDataFlowAnalysis< + StateT>::SparseForwardDataFlowAnalysis; + ~ResourceDataflowAnalysis() override = default; + + void visitOperation(Operation *op, ArrayRef operands, + ArrayRef results) override; + + void setToEntryState(StateT *lattice) override { + propagateIfChanged( + lattice, + lattice->join(ResourceConstructingOps::getPessimisticValueState( + lattice->getPoint()))); + } +}; + +} // namespace TF +} // namespace mlir +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_ANALYSIS_RESOURCE_DATAFLOW_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/analysis/resource_value_typed_analyzer.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/analysis/resource_value_typed_analyzer.h new file mode 100644 index 0000000000000000000000000000000000000000..9817b290c4cbdbadfc34aeb30b4502499b827403 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/analysis/resource_value_typed_analyzer.h @@ -0,0 +1,74 @@ +/* Copyright 2021 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_ANALYSIS_RESOURCE_VALUE_TYPED_ANALYZER_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_ANALYSIS_RESOURCE_VALUE_TYPED_ANALYZER_H_ + +#include + +#include "llvm/ADT/DenseMap.h" +#include "llvm/ADT/StringRef.h" +#include "mlir/Dialect/Func/IR/FuncOps.h" // from @llvm-project +#include "mlir/IR/BuiltinOps.h" // from @llvm-project +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_ops.h" + +namespace mlir { +namespace TF { + +class ResourceAnalyzer { + public: + explicit ResourceAnalyzer(ModuleOp module, bool skip_session_init = false); + + bool IsPotentiallyWritten(Value resource) const; + + private: + // Analyze the specified region for resource mutating operations, namely + // TF::AssignVariableOp, if so, set the resource associated as "potentially + // written". + LogicalResult AnalyzeRegion(Region& region); + + // If an op is not one of the handled ones, we assume all resource usages + // within its purview are mutating in nature. + void PropagatePotentiallyWrittenWithinUnhandledOp(Operation* op); + + // Given a Region associated with the callee and operands from the + // corresponding callOp, propagate the potentially written decision to the + // callOp's operands, if the corresponding region's arguments are potentially + // written resources. + void PropagatePotentiallyWrittenUpFromCallee( + Region& region, Operation::operand_range propagate_to); + + // Marks 'resource' as written. + void SetPotentiallyWritten(Value resource); + + struct ResourceInfo { + bool potentially_written = false; + }; + // Key: Resource Value's + // Value: Information we know about that Value. + // Note that these Value's are in general in different functions. + DenseMap resource_infos_; + // The set of regions we already discovered. + DenseSet discovered_; + // Identifiers about mutable variables. + // All variables are identified by (device, container, shared_name). + DenseSet> + mutable_variables_; +}; + +} // namespace TF +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_ANALYSIS_RESOURCE_VALUE_TYPED_ANALYZER_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/analysis/side_effect_analysis.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/analysis/side_effect_analysis.h new file mode 100644 index 0000000000000000000000000000000000000000..f9fac1c61c3fd7847c29930123d7a684673519a2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/analysis/side_effect_analysis.h @@ -0,0 +1,218 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_ANALYSIS_SIDE_EFFECT_ANALYSIS_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_ANALYSIS_SIDE_EFFECT_ANALYSIS_H_ + +#include +#include +#include +#include + +#include "llvm/ADT/SetVector.h" +#include "llvm/ADT/SmallSet.h" +#include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/StringMap.h" +#include "mlir/IR/Operation.h" // from @llvm-project +#include "mlir/IR/Region.h" // from @llvm-project +#include "mlir/Support/LogicalResult.h" // from @llvm-project +#include "tensorflow/compiler/mlir/tensorflow/analysis/resource_alias_analysis.h" + +namespace mlir { +namespace TF { +using ResourceId = int64_t; +inline constexpr ResourceId kUnknownResourceId = + ResourceAliasAnalysis::Info::kUnknownResourceId; +static_assert(kUnknownResourceId < 0, "kUnknownResourceId must be < 0"); + +namespace detail { + +class OpSideEffectCollector; + +// Side effect analysis info for a single function. +// +// This class provides an interface for querying control predecessors and +// successors for ops of the given function. This information is computed from +// side effects, using resource alias analysis where possible. +// Remarks: +// - Control dependencies model execution order constraints for side-effecting +// ops. For example, two ops writing to the same resource cannot switch their +// order and cannot be executed in parallel. +// - A control dependency (A,B) means that op A has to be executed before op B. +// A is a control predecessor of B, and B is a control successor of A. +// - The control dependencies provided by side effect analysis are guaranteed to +// be sufficient for correct execution but they are not guaranteed to be +// minimal (that means, some control dependencies might not be required for +// correct execution). +class SideEffectAnalysisInfo { + public: + SideEffectAnalysisInfo() = default; + + // Constructs analysis info by analyzing the given function. + SideEffectAnalysisInfo(func::FuncOp func_op, + const OpSideEffectCollector& op_side_effect_collector, + const TF::ResourceAliasAnalysis::Info& alias_analysis) + : op_side_effect_collector_(op_side_effect_collector), + alias_analysis_(alias_analysis) { + AnalyzeFunction(func_op); + } + + // Constructs analysis info by analyzing the given region. + SideEffectAnalysisInfo(Region* region, + const OpSideEffectCollector& op_side_effect_collector, + const TF::ResourceAliasAnalysis::Info& alias_analysis) + : op_side_effect_collector_(op_side_effect_collector), + alias_analysis_(alias_analysis) { + AnalyzeRegion(region); + } + + SideEffectAnalysisInfo(SideEffectAnalysisInfo&&) = default; + + // Returns a vector of ops that are direct control predecessors of `op`, + // sorted in program order. If `filter` is provided, only predecessors that + // pass the filter (returning true) will be included. + const llvm::SmallVector& DirectControlPredecessors( + Operation* op) const; + llvm::SmallVector DirectControlPredecessors( + Operation* op, llvm::function_ref filter) const; + + // pass the filter (returning true) will be included. + const llvm::SmallVector& DirectControlSuccessors( + Operation* op) const; + llvm::SmallVector DirectControlSuccessors( + Operation* op, llvm::function_ref filter) const; + + // Returns a vector of ops that are control sinks (i.e. side-effecting ops + // with no control successors). + llvm::ArrayRef ControlSinks() const { + return sorted_control_sinks_; + } + + // Returns a vector with IDs of all resources that might be accessed by `op`. + // This includes both op-based and value-based resources. The bool indicates + // whether a resource is accessed read-only. + const llvm::SmallVector>& GetResourceIds( + Operation* op) const; + + // Returns true iff given resource is allocated by op with + // `UniqueResourceAllocation` trait. This can be utilized for while-loop + // parallelization. + bool IsUniqueResourceAllocationId(ResourceId resource_id) const { + return alias_analysis_.IsUniqueResourceAllocationId(resource_id); + } + + private: + // Runs the analysis and populates `sorted_control_predecessors_` and + // `sorted_control_successors_` for `func_op`. Clears `control_predecessors_`. + void AnalyzeFunction(func::FuncOp func_op); + + // Runs the analysis and populates `control_predecessors_` for `region`. + void AnalyzeRegion(Region* region); + + // Runs the analysis and populates `control_predecessors_` for `op`. + void AnalyzeOp(Operation* op); + + // Updates `control_predecessors_` for given `resource_id` and `op`. + void AddPredecessorsForAccess(ResourceId resource_id, Operation* op, + bool read_only); + + // Updates resource access for given `resource_id` and `op` in + // `per_resource_access_info_` and `op_to_resource_ids_`. + void UpdateAccess(ResourceId resource_id, Operation* op, bool read_only); + + // Returns true iff the last unknown resource access is already indirectly + // tracked by a previous `resource` access. `read_only` specifies the type of + // access considered. + bool IsUnknownAccessIndirectlyTrackedByResource(ResourceId resource, + bool read_only); + + // Returns a set of resource IDs that have potential dependencies to + // `resource_id` (i.e., there are potential dependencies between the + // resources corresponding to the IDs). + llvm::SmallSet GetDependentIds(ResourceId resource_id, + bool is_fetch_op) const; + + // Maps from an op to its control predecessors. + llvm::SmallDenseMap, 8> + control_predecessors_; + // Maps from an op to its control predecessors sorted in program order. + llvm::SmallDenseMap, 8> + sorted_control_predecessors_; + // Maps from an op to its control successors sorted in program order. + llvm::SmallDenseMap, 8> + sorted_control_successors_; + // Side-effecting ops with no control successors in this function. + llvm::SmallVector sorted_control_sinks_; + + // Maps from an op to its resource IDs along with a bool indicating if the + // resource is accessed `read-only`. + llvm::SmallDenseMap>> + op_to_resource_ids_; + llvm::SmallVector> empty_resource_ids_; + + // For predecessor / successor queries on ops we don't track. + llvm::SmallVector empty_operation_set_; + + // Internal per-resource data structure for building the dependencies. + struct PerResourceAccessInfo { + // Last op that writes to resource before the current op is being analyzed. + Operation* last_write = nullptr; + // Read ops since `last_write` before the current op is being analyzed. + llvm::SmallVector reads_since_last_write; + // Whether a previous access of this resource already tracks the last + // unknown read(s). + bool are_last_unknown_reads_tracked = false; + // Whether a previous write access of this resource already tracks the last + // unknown write. + bool is_last_unknown_write_tracked_by_write = false; + // Whether a previous read or write access of this resource already tracks + // the last unknown write. + bool is_last_unknown_write_tracked = false; + }; + + // Resource access info per resource ID. + llvm::SmallDenseMap + per_resource_access_info_; + + const OpSideEffectCollector& op_side_effect_collector_; + const TF::ResourceAliasAnalysis::Info& alias_analysis_; +}; + +} // namespace detail + +// An analysis that runs on a function and infers the control predecessors and +// successors for each op, based on side effects on known and unknown resources. +// Side-effecting ops on unknown resources are conservatively treated as +// interfering with all known resource op accesses. It distinguishes accesses +// based on whether they are read-only, and read-only ops do not interfere with +// each other. +// +// If there are nested regions, each region is handled separately, and control +// dependencies are only tracked for ops under the same parent op. +class SideEffectAnalysis : public detail::PerFunctionAggregateAnalysis< + detail::SideEffectAnalysisInfo> { + public: + // Constructs analysis by analyzing the given module operation. + explicit SideEffectAnalysis(ModuleOp module); + + private: + ResourceAliasAnalysis alias_analysis_; +}; + +} // namespace TF +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_ANALYSIS_SIDE_EFFECT_ANALYSIS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/dialect_registration.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/dialect_registration.h new file mode 100644 index 0000000000000000000000000000000000000000..3f8305ba3945e73f46621ddc1c7294d8578d8273 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/dialect_registration.h @@ -0,0 +1,61 @@ +/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_DIALECT_REGISTRATION_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_DIALECT_REGISTRATION_H_ + +#include "mlir/Dialect/Arith/IR/Arith.h" // from @llvm-project +#include "mlir/Dialect/ControlFlow/IR/ControlFlow.h" // from @llvm-project +#include "mlir/Dialect/Func/Extensions/AllExtensions.h" // from @llvm-project +#include "mlir/Dialect/Func/IR/FuncOps.h" // from @llvm-project +#include "mlir/Dialect/MLProgram/IR/MLProgram.h" // from @llvm-project +#include "mlir/Dialect/MLProgram/IR/MLProgramAttributes.h" // from @llvm-project +#include "mlir/IR/Dialect.h" // from @llvm-project +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_device.h" +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_executor.h" +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_ops.h" +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_saved_model.h" +#include "tensorflow/core/ir/ops.h" + +namespace mlir { +// Inserts all the TensorFlow dialects in the provided registry. This is +// intended for tools that need to register dialects before parsing .mlir files. +// If include_extensions is set (default), also registers extensions. Otherwise +// it is the responsibility of the caller, typically required when the registry +// is appended to the context in a parallel context, which does not allow for +// extensions to be added. +inline void RegisterAllTensorFlowDialectsImpl(DialectRegistry ®istry, + bool include_extensions = true) { + registry + .insert(); + if (include_extensions) { + mlir::func::registerAllExtensions(registry); + } +} + +// Inserts all the TensorFlow dialects in the provided registry. This is +// intended for tools that need to register dialects before parsing .mlir files. +inline void RegisterAllTensorFlowDialects(DialectRegistry ®istry) { + RegisterAllTensorFlowDialectsImpl(registry, true); +} +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_DIALECT_REGISTRATION_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_all_ops.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_all_ops.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..097f02c5ea953eee74cf67522ec9240afdf74e8c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_all_ops.h.inc @@ -0,0 +1,126716 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: tf_ops.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#if defined(GET_OP_CLASSES) || defined(GET_OP_FWD_DEFINES) +#undef GET_OP_FWD_DEFINES +namespace mlir { +namespace TF { +class AbsOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AcosOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AcoshOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AddNOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AddOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AddV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AdjustContrastv2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AdjustHueOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AdjustSaturationOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AllOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AllToAllOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AngleOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AnonymousIteratorOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AnonymousIteratorV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AnonymousIteratorV3Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AnonymousMemoryCacheOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AnonymousMultiDeviceIteratorOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AnonymousMultiDeviceIteratorV3Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AnonymousRandomSeedGeneratorOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AnonymousSeedGeneratorOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AnyOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ApproxTopKOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ApproximateEqualOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ArgMaxOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ArgMinOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AsStringOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AsinOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AsinhOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AssertOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AssignAddVariableOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AssignOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AssignSubVariableOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AssignVariableOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class Atan2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AtanOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AtanhOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AvgPool3DGradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AvgPool3DOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AvgPoolGradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AvgPoolOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class BatchDatasetV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class BatchFunctionOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class BatchMatMulOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class BatchMatMulV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class BatchMatMulV3Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class BatchNormWithGlobalNormalizationOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class BatchToSpaceNDOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class BatchToSpaceOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class BesselI0eOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class BesselI1eOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class BetaincOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class BiasAddGradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class BiasAddOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class BiasAddV1Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class BincountOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class BitcastOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class BitwiseAndOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class BitwiseOrOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class BitwiseXorOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class BoostedTreesBucketizeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class BroadcastArgsOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class BroadcastGradientArgsOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class BroadcastToOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class BucketizeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class CacheDatasetV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class CaseOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class CaseRegionOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class CastOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class CeilOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class CheckNumericsOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class CholeskyOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ClipByValueOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class CloseSummaryWriterOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class CollateTPUEmbeddingMemoryOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class CollectiveAllToAllV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class CollectiveAssignGroupV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class CollectiveBcastRecvOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class CollectiveBcastSendOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class CollectiveGatherOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class CollectiveGatherV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class CollectivePermuteOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class CollectiveReduceOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class CollectiveReduceScatterV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class CollectiveReduceV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ComplexAbsOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ComplexOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ConcatOffsetOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ConcatOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ConcatV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ConfigureAndInitializeGlobalTPUOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ConfigureDistributedTPUOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ConfigureTPUEmbeddingHostOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ConfigureTPUEmbeddingMemoryOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ConfigureTPUEmbeddingOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ConjOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ConjugateTransposeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ConnectTPUEmbeddingHostsOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ConstOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class Conv2DBackpropFilterOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class Conv2DBackpropFilterV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class Conv2DBackpropInputOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class Conv2DBackpropInputV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class Conv2DOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class Conv3DBackpropFilterOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class Conv3DBackpropFilterV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class Conv3DBackpropInputOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class Conv3DBackpropInputV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class Conv3DOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ConvOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ConvertToCooTensorOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class CosOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class CoshOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class CreateSummaryDbWriterOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class CreateSummaryFileWriterOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class CrossOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class CrossReplicaSumOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class CumprodOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class CumsumOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class CumulativeLogsumexpOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DataFormatDimMapOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DataFormatVecPermuteOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DebugIdentityV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DecodeAndCropJpegOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DecodeGifOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DecodeJpegOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DecodePaddedRawOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DecodePngOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DeleteIteratorOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DeleteMemoryCacheOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DeleteMultiDeviceIteratorOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DeleteRandomSeedGeneratorOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DeleteSeedGeneratorOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DepthToSpaceOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DepthwiseConv2dNativeBackpropFilterOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DepthwiseConv2dNativeBackpropInputOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DepthwiseConv2dNativeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DequantizeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DeserializeIteratorOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DeserializeSparseOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DestroyResourceOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DeviceIndexOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DiagOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DiagPartOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DigammaOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DisableCopyOnReadOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DivNoNanOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DivOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DummyMemoryCacheOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DummySeedGeneratorOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DynamicEnqueueTPUEmbeddingArbitraryTensorBatchOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DynamicPartitionOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DynamicStitchOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class EinsumOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class EluGradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class EluOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class EmptyOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class EmptyTensorListOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class EncodePngOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class EnqueueTPUEmbeddingArbitraryTensorBatchOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class EnqueueTPUEmbeddingBatchOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class EnqueueTPUEmbeddingIntegerBatchOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class EnqueueTPUEmbeddingRaggedTensorBatchOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class EnqueueTPUEmbeddingSparseBatchOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class EnqueueTPUEmbeddingSparseTensorBatchOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class EnsureShapeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class EqualOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ErfOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ErfcOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ErfinvOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ExecuteTPUEmbeddingPartitionerOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ExpOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ExpandDimsOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class Expm1Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ExtractImagePatchesOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class FFT2DOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class FFT3DOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class FFTOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class FakeParamOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class FakeQuantWithMinMaxArgsGradientOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class FakeQuantWithMinMaxArgsOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class FakeQuantWithMinMaxVarsGradientOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class FakeQuantWithMinMaxVarsOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class FakeQuantWithMinMaxVarsPerChannelGradientOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class FakeQuantWithMinMaxVarsPerChannelOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class FillOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class FinalizeDatasetOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class FinalizeTPUEmbeddingOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class FlatMapDatasetOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class FloorDivOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class FloorModOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class FloorOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class FlushSummaryWriterOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class FusedBatchNormGradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class FusedBatchNormGradV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class FusedBatchNormGradV3Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class FusedBatchNormOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class FusedBatchNormV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class FusedBatchNormV3Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class GatherNdOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class GatherOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class GatherV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class GeneratorDatasetOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class GetMinibatchSplitsWithPhysicalReplicaOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class GetMinibatchesInCsrWithPhysicalReplicaOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class GlobalIterIdOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class GreaterEqualOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class GreaterOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class HSVToRGBOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class HashTableOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class HashTableV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class IFFT2DOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class IFFT3DOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class IFFTOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class IRFFT2DOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class IRFFT3DOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class IRFFTOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class IdentityNOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class IdentityOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class IfOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class IfRegionOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class IgammaGradAOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class IgammaOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class IgammacOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ImagOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ImportEventOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class InTopKV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class InfeedDequeueOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class InfeedDequeueTupleOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class InfeedEnqueueTupleOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class InitializeTableFromDatasetOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class InitializeTableFromTextFileOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class InitializeTableFromTextFileV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class InitializeTableOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class InitializeTableV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class InplaceAddOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class InplaceUpdateOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class InvOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class InvertOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class InvertPermutationOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class IsFiniteOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class IsInfOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class IsNanOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class IteratorFromStringHandleOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class IteratorFromStringHandleV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class IteratorGetNextAsOptionalOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class IteratorGetNextOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class IteratorGetNextSyncOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class IteratorOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class IteratorToStringHandleOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class IteratorV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class KthOrderStatisticOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class L2LossOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LRNGradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LRNOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LeakyReluGradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LeakyReluOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LeftShiftOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LegacyCallOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LessEqualOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LessOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LgammaOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LinSpaceOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ListDiffOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LoadTPUEmbeddingADAMParametersGradAccumDebugOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LoadTPUEmbeddingADAMParametersOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LoadTPUEmbeddingAdadeltaParametersGradAccumDebugOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LoadTPUEmbeddingAdadeltaParametersOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LoadTPUEmbeddingAdagradParametersGradAccumDebugOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LoadTPUEmbeddingAdagradParametersOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LoadTPUEmbeddingCenteredRMSPropParametersOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LoadTPUEmbeddingFTRLParametersGradAccumDebugOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LoadTPUEmbeddingFTRLParametersOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LoadTPUEmbeddingMDLAdagradLightParametersOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LoadTPUEmbeddingMomentumParametersGradAccumDebugOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LoadTPUEmbeddingMomentumParametersOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LoadTPUEmbeddingProximalAdagradParametersGradAccumDebugOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LoadTPUEmbeddingProximalAdagradParametersOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LoadTPUEmbeddingProximalYogiParametersGradAccumDebugOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LoadTPUEmbeddingProximalYogiParametersOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LoadTPUEmbeddingRMSPropParametersGradAccumDebugOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LoadTPUEmbeddingRMSPropParametersOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LoadTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LoadTPUEmbeddingStochasticGradientDescentParametersOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class Log1pOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LogOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LogSoftmaxOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LogicalAndOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LogicalNotOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LogicalOrOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LookupTableExportV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LookupTableFindOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LookupTableFindV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LookupTableImportV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LookupTableInsertV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LookupTableRemoveV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LookupTableSizeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LookupTableSizeV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LowerBoundOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MakeIteratorOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MakeUniqueOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MapAndBatchDatasetOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MapDatasetOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MatMulOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MatrixBandPartOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MatrixDiagOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MatrixDiagPartV3Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MatrixDiagV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MatrixDiagV3Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MatrixInverseOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MatrixSetDiagOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MatrixSetDiagV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MatrixSetDiagV3Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MatrixSolveOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MatrixTriangularSolveOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MaxOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MaxPool3DGradGradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MaxPool3DGradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MaxPool3DOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MaxPoolGradGradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MaxPoolGradGradV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MaxPoolGradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MaxPoolGradV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MaxPoolOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MaxPoolV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MaximumOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MeanOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MergeSummaryOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MergeV2CheckpointsOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MinOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MinimumOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MirrorPadGradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MirrorPadOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MlirLocalVarOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MlirPassthroughOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ModOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ModelDatasetOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MulNoNanOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MulOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MultiDeviceIteratorFromStringHandleOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MultiDeviceIteratorGetNextFromShardOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MultiDeviceIteratorInitOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MultiDeviceIteratorOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MultiDeviceIteratorToStringHandleOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MultinomialOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MutableDenseHashTableV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MutableHashTableOfTensorsV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MutableHashTableV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class NcclAllReduceOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class NdtriOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class NegOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class NextAfterOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class NoOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class NonMaxSuppressionV3Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class NonMaxSuppressionV4Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class NonMaxSuppressionV5Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class NotEqualOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class OneHotOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class OneShotIteratorOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class OnesLikeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class OptimizeDatasetV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class OptionalFromValueOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class OptionalGetValueOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class OptionalHasValueOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class OptionalNoneOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class OutfeedEnqueueOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class OutfeedEnqueueTupleOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class PackOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class PadOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class PadV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ParallelDynamicStitchOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ParallelMapDatasetOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ParallelMapDatasetV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ParameterizedTruncatedNormalOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ParseExampleOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ParseExampleV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class PartitionedCallOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class PlaceholderOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class PlaceholderWithDefaultOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class PolygammaOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class PopulationCountOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class PowOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class PrefetchDatasetOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class PreventGradientOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class PrintOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class PrintV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ProdOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class QrOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class QuantizeAndDequantizeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class QuantizeAndDequantizeV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class QuantizeAndDequantizeV3Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class QuantizeAndDequantizeV4Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class QuantizeV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class QueueDequeueV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RFFT2DOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RFFT3DOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RFFTOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RGBToHSVOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RaggedGatherOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RaggedRangeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RandomGammaGradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RandomGammaOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RandomPoissonOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RandomPoissonV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RandomShuffleOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RandomStandardNormalOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RandomUniformIntOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RandomUniformOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RangeDatasetOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RangeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RankOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ReadVariableOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RealDivOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RealOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ReciprocalGradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ReciprocalOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RecvOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RecvTPUEmbeddingActivationsOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ReduceDatasetOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ReduceJoinOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class Relu6GradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class Relu6Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ReluGradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ReluOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RemoteCallOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RepeatDatasetOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ReshapeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResizeBilinearGradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResizeBilinearOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResizeNearestNeighborGradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResizeNearestNeighborOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceApplyAdaMaxOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceApplyAdadeltaOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceApplyAdagradDAOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceApplyAdagradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceApplyAdagradV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceApplyAdamOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceApplyAddSignOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceApplyCenteredRMSPropOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceApplyFtrlOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceApplyFtrlV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceApplyGradientDescentOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceApplyKerasMomentumOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceApplyMomentumOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceApplyPowerSignOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceApplyProximalAdagradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceApplyProximalGradientDescentOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceApplyRMSPropOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceGatherNdOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceGatherOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceScatterAddOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceScatterDivOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceScatterMaxOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceScatterMinOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceScatterMulOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceScatterNdAddOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceScatterNdSubOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceScatterNdUpdateOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceScatterSubOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceScatterUpdateOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceSparseApplyAdagradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceSparseApplyAdagradV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceSparseApplyFtrlOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceStridedSliceAssignOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RestoreOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RestoreV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RetrieveTPUEmbeddingADAMParametersGradAccumDebugOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RetrieveTPUEmbeddingADAMParametersOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebugOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RetrieveTPUEmbeddingAdadeltaParametersOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RetrieveTPUEmbeddingAdagradParametersGradAccumDebugOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RetrieveTPUEmbeddingAdagradParametersOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RetrieveTPUEmbeddingCenteredRMSPropParametersOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RetrieveTPUEmbeddingFTRLParametersGradAccumDebugOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RetrieveTPUEmbeddingFTRLParametersOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RetrieveTPUEmbeddingMDLAdagradLightParametersOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RetrieveTPUEmbeddingMomentumParametersGradAccumDebugOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RetrieveTPUEmbeddingMomentumParametersOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebugOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RetrieveTPUEmbeddingProximalAdagradParametersOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RetrieveTPUEmbeddingProximalYogiParametersGradAccumDebugOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RetrieveTPUEmbeddingProximalYogiParametersOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RetrieveTPUEmbeddingRMSPropParametersGradAccumDebugOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RetrieveTPUEmbeddingRMSPropParametersOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RetrieveTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RetrieveTPUEmbeddingStochasticGradientDescentParametersOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ReverseOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ReverseSequenceOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ReverseV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RightShiftOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RintOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RiscAddOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RiscDotOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RngReadAndSkipOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RollOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RoundOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RsqrtGradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RsqrtOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SaveOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SaveSlicesOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SaveV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ScatterNdOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SegmentMaxOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SegmentMaxV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SegmentMeanOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SegmentMinOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SegmentMinV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SegmentProdOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SegmentProdV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SegmentSumOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SegmentSumV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SelectOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SelectV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SelfAdjointEigV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SeluGradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SeluOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SendOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SendTPUEmbeddingGradientsOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SerializeIteratorOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SerializeSparseOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SetStaticDimensionBoundsOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ShapeNOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ShapeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ShardedFilenameOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ShuffleAndRepeatDatasetV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ShuffleDatasetV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ShuffleDatasetV3Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ShutdownDistributedTPUOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ShutdownTPUSystemOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SigmoidGradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SigmoidOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SignOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SinOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SinhOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SizeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SliceOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SnapshotOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SoftmaxCrossEntropyWithLogitsOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SoftmaxOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SoftplusGradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SoftplusOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SoftsignGradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SoftsignOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SpaceToBatchNDOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SpaceToBatchOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SpaceToDepthOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SparseAddOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SparseFillEmptyRowsOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SparseMatMulOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SparseReduceSumOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SparseReshapeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SparseSegmentMeanGradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SparseSegmentMeanOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SparseSegmentMeanWithNumSegmentsOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SparseSegmentSqrtNGradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SparseSegmentSqrtNOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SparseSegmentSqrtNWithNumSegmentsOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SparseSegmentSumOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SparseSoftmaxCrossEntropyWithLogitsOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SparseTensorDenseMatMulOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SparseToDenseOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SplitOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SplitVOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SqrtGradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SqrtOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SquareOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SquaredDifferenceOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SqueezeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StackCloseV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StackPopV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StackPushV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StackV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StatefulPartitionedCallOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StatefulStandardNormalV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StatefulTruncatedNormalOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StatefulUniformFullIntOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StatefulUniformIntOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StatefulUniformOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StatelessMultinomialOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StatelessParameterizedTruncatedNormalOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StatelessRandomBinomialOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StatelessRandomGammaV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StatelessRandomGetAlgOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StatelessRandomGetKeyCounterAlgOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StatelessRandomGetKeyCounterOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StatelessRandomNormalOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StatelessRandomNormalV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StatelessRandomPoissonOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StatelessRandomUniformFullIntOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StatelessRandomUniformFullIntV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StatelessRandomUniformIntOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StatelessRandomUniformIntV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StatelessRandomUniformOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StatelessRandomUniformV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StatelessTruncatedNormalOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StatelessTruncatedNormalV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StaticRegexFullMatchOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StopGradientOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StoreMinibatchStatisticsInFdoOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StridedSliceGradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StridedSliceOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StringFormatOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StringJoinOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StringStripOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StringToHashBucketFastOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SubOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SumOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SummaryWriterOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SvdOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SymbolicGradientOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TPUAnnotateTensorsWithDynamicShapeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TPUCompilationResultOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TPUCompileMlirAndExecuteOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TPUCompileSucceededAssertOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TPUCopyWithDynamicShapeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TPUCopyWithLayoutOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TPUEmbeddingActivationsOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TPUExecuteAndUpdateVariablesOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TPUExecuteOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TPUGetLayoutOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TPUOrdinalSelectorOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TPUPartitionedCallOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TPUPartitionedInputOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TPUPartitionedInputV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TPUPartitionedOutputOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TPUPartitionedOutputV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TPUReplicateMetadataOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TPUReplicatedInputOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TPUReplicatedOutputOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TPUReshardVariablesOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TPURoundRobinOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TakeDatasetOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TakeWhileDatasetOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TanOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TanhGradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TanhOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TensorArrayCloseV3Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TensorArrayConcatV3Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TensorArrayGatherV3Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TensorArrayGradV3Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TensorArrayReadV3Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TensorArrayScatterV3Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TensorArraySizeV3Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TensorArraySplitV3Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TensorArrayV3Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TensorArrayWriteV3Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TensorListConcatV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TensorListElementShapeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TensorListFromTensorOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TensorListGatherOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TensorListGetItemOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TensorListLengthOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TensorListPopBackOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TensorListPushBackOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TensorListReserveOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TensorListResizeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TensorListScatterIntoExistingListOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TensorListSetItemOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TensorListStackOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TensorScatterAddOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TensorScatterMaxOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TensorScatterMinOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TensorScatterSubOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TensorScatterUpdateOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TensorSliceDatasetOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TensorStridedSliceUpdateOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TileOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TimestampOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ToBoolOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TopKUniqueOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TopKV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TopKWithUniqueOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TransposeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TridiagonalMatMulOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TridiagonalSolveOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TruncateDivOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TruncateModOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TruncatedNormalOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class UncompressElementOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class UniformDequantizeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class UniformQuantizeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class UniformQuantizedAddOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class UniformQuantizedClipByValueOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class UniformQuantizedConvolutionHybridOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class UniformQuantizedConvolutionOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class UniformQuantizedDotHybridOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class UniformQuantizedDotOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class UniformRequantizeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class UniqueOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class UniqueV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class UnpackOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class UnsortedSegmentMaxOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class UnsortedSegmentMinOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class UnsortedSegmentProdOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class UnsortedSegmentSumOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class UpperBoundOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class VarHandleOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class VarIsInitializedOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class VariableOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class VariableShapeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class VariableV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class WhereOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class WhileOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class WhileRegionOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class WriteAudioSummaryOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class WriteGraphSummaryOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class WriteHistogramSummaryOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class WriteImageSummaryOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class WriteRawProtoSummaryOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class WriteScalarSummaryOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class WriteSummaryOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class WriteTrainingPredictionsOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XdivyOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaAllReduceOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaBroadcastHelperOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaCallModuleOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaClusterOutputOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaConvOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaConvV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaCustomCallV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaDotOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaDotV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaDynamicSliceOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaDynamicUpdateSliceOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaEinsumOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaGatherOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaHostComputeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaKeyValueSortOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaLaunchOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaLaunchV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaOptimizationBarrierOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaPadOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaRecvFromHostOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaRecvOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaRecvTPUEmbeddingActivationsOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaRecvTPUEmbeddingDeduplicationDataOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaReduceOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaReducePrecisionOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaReduceScatterOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaReduceWindowOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaRemoveDynamicDimensionSizeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaReplicaIdOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaRngBitGeneratorOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaScatterOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaSelectAndScatterOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaSelfAdjointEigOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaSendOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaSendTPUEmbeddingGradientsOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaSendToHostOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaSetBoundOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaSetDynamicDimensionSizeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaShardingOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaSortOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaSparseCoreAdagradMomentumOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaSparseCoreAdagradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaSparseCoreAdamOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaSparseCoreFtrlOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaSparseCoreSgdOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaSparseDenseMatmulGradWithSgdAndCsrInputOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaSparseDenseMatmulWithCsrInputOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaSpmdFullToShardShapeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaSpmdShardToFullShapeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaSvdOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaVariadicReduceOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaVariadicReduceV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaVariadicSortOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class Xlog1pyOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlogyOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class YieldOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ZerosLikeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ZetaOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class _ArrayToListOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class _EagerConstOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class _FusedBatchNormExOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class _FusedConv2DOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class _FusedMatMulOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class _HostRecvOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class _HostSendOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class _InternalTestMustExecuteTrait_; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class _InternalTestNonResourceValueSideEffects_; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class _ListToArrayOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class _RecvOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class _SendOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class _TPUCompileMlirOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class _TPUDeviceOrdinalPlaceholderOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class _UnaryOpsCompositionOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class _XlaCompileMlirPlaceholderProgramKeyOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class _XlaCompileOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class _XlaHostComputeMlirOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class _XlaRecvAtHostOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class _XlaRecvAtHostV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class _XlaRunOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class _XlaSendFromHostOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class _XlaSendFromHostV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaSparseDenseMatmulGradWithAdagradAndCsrInputOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaSparseDenseMatmulGradWithAdagradMomentumAndCsrInputOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaSparseDenseMatmulGradWithAdamAndCsrInputOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaSparseDenseMatmulGradWithFtrlAndCsrInputOp; +} // namespace TF +} // namespace mlir +#endif + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AbsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AbsOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AbsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AbsOpGenericAdaptorBase(AbsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AbsOpGenericAdaptor : public detail::AbsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AbsOpGenericAdaptorBase; +public: + AbsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AbsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AbsOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AbsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AbsOpAdaptor : public AbsOpGenericAdaptor<::mlir::ValueRange> { +public: + using AbsOpGenericAdaptor::AbsOpGenericAdaptor; + AbsOpAdaptor(AbsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AbsOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::IsIdempotent, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AbsOpAdaptor; + template + using GenericAdaptor = AbsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Abs"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AbsOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AcosOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AcosOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AcosOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AcosOpGenericAdaptorBase(AcosOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AcosOpGenericAdaptor : public detail::AcosOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AcosOpGenericAdaptorBase; +public: + AcosOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AcosOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AcosOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AcosOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AcosOpAdaptor : public AcosOpGenericAdaptor<::mlir::ValueRange> { +public: + using AcosOpGenericAdaptor::AcosOpGenericAdaptor; + AcosOpAdaptor(AcosOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AcosOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AcosOpAdaptor; + template + using GenericAdaptor = AcosOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Acos"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AcosOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AcoshOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AcoshOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AcoshOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AcoshOpGenericAdaptorBase(AcoshOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AcoshOpGenericAdaptor : public detail::AcoshOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AcoshOpGenericAdaptorBase; +public: + AcoshOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AcoshOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AcoshOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AcoshOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AcoshOpAdaptor : public AcoshOpGenericAdaptor<::mlir::ValueRange> { +public: + using AcoshOpGenericAdaptor::AcoshOpGenericAdaptor; + AcoshOpAdaptor(AcoshOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AcoshOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AcoshOpAdaptor; + template + using GenericAdaptor = AcoshOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Acosh"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AcoshOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AddNOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AddNOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AddNOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AddNOpGenericAdaptorBase(AddNOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AddNOpGenericAdaptor : public detail::AddNOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AddNOpGenericAdaptorBase; +public: + AddNOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AddNOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AddNOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AddNOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AddNOpAdaptor : public AddNOpGenericAdaptor<::mlir::ValueRange> { +public: + using AddNOpGenericAdaptor::AddNOpGenericAdaptor; + AddNOpAdaptor(AddNOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AddNOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsCommutative, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AddNOpAdaptor; + template + using GenericAdaptor = AddNOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("N"), ::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.AddN"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::MutableOperandRange getInputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSum(); + size_t getN(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type sum, ::mlir::ValueRange inputs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AddNOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AddOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AddOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AddOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AddOpGenericAdaptorBase(AddOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AddOpGenericAdaptor : public detail::AddOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AddOpGenericAdaptorBase; +public: + AddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AddOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AddOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AddOpAdaptor : public AddOpGenericAdaptor<::mlir::ValueRange> { +public: + using AddOpGenericAdaptor::AddOpGenericAdaptor; + AddOpAdaptor(AddOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AddOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::OpTrait::TF::LayoutAgnostic, ::mlir::OpTrait::TF::SameOperandsAndResultElementTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AddOpAdaptor; + template + using GenericAdaptor = AddOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Add"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AddOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AddV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AddV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AddV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AddV2OpGenericAdaptorBase(AddV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AddV2OpGenericAdaptor : public detail::AddV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AddV2OpGenericAdaptorBase; +public: + AddV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AddV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AddV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AddV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AddV2OpAdaptor : public AddV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using AddV2OpGenericAdaptor::AddV2OpGenericAdaptor; + AddV2OpAdaptor(AddV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AddV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsCommutative, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::OpTrait::TF::CwiseBinary, ::mlir::OpTrait::TF::LayoutAgnostic, ::mlir::OpTrait::TF::SameOperandsAndResultElementTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AddV2OpAdaptor; + template + using GenericAdaptor = AddV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.AddV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AddV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AdjustContrastv2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AdjustContrastv2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AdjustContrastv2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AdjustContrastv2OpGenericAdaptorBase(AdjustContrastv2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AdjustContrastv2OpGenericAdaptor : public detail::AdjustContrastv2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AdjustContrastv2OpGenericAdaptorBase; +public: + AdjustContrastv2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AdjustContrastv2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AdjustContrastv2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AdjustContrastv2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getImages() { + return (*getODSOperands(0).begin()); + } + + ValueT getContrastFactor() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AdjustContrastv2OpAdaptor : public AdjustContrastv2OpGenericAdaptor<::mlir::ValueRange> { +public: + using AdjustContrastv2OpGenericAdaptor::AdjustContrastv2OpGenericAdaptor; + AdjustContrastv2OpAdaptor(AdjustContrastv2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AdjustContrastv2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AdjustContrastv2OpAdaptor; + template + using GenericAdaptor = AdjustContrastv2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.AdjustContrastv2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getImages(); + ::mlir::TypedValue<::mlir::TensorType> getContrastFactor(); + ::mlir::OpOperand &getImagesMutable(); + ::mlir::OpOperand &getContrastFactorMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value images, ::mlir::Value contrast_factor); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value images, ::mlir::Value contrast_factor); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AdjustContrastv2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AdjustHueOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AdjustHueOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AdjustHueOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AdjustHueOpGenericAdaptorBase(AdjustHueOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AdjustHueOpGenericAdaptor : public detail::AdjustHueOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AdjustHueOpGenericAdaptorBase; +public: + AdjustHueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AdjustHueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AdjustHueOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AdjustHueOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getImages() { + return (*getODSOperands(0).begin()); + } + + ValueT getDelta() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AdjustHueOpAdaptor : public AdjustHueOpGenericAdaptor<::mlir::ValueRange> { +public: + using AdjustHueOpGenericAdaptor::AdjustHueOpGenericAdaptor; + AdjustHueOpAdaptor(AdjustHueOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AdjustHueOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AdjustHueOpAdaptor; + template + using GenericAdaptor = AdjustHueOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.AdjustHue"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getImages(); + ::mlir::TypedValue<::mlir::TensorType> getDelta(); + ::mlir::OpOperand &getImagesMutable(); + ::mlir::OpOperand &getDeltaMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value images, ::mlir::Value delta); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value images, ::mlir::Value delta); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AdjustHueOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AdjustSaturationOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AdjustSaturationOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AdjustSaturationOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AdjustSaturationOpGenericAdaptorBase(AdjustSaturationOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AdjustSaturationOpGenericAdaptor : public detail::AdjustSaturationOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AdjustSaturationOpGenericAdaptorBase; +public: + AdjustSaturationOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AdjustSaturationOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AdjustSaturationOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AdjustSaturationOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getImages() { + return (*getODSOperands(0).begin()); + } + + ValueT getScale() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AdjustSaturationOpAdaptor : public AdjustSaturationOpGenericAdaptor<::mlir::ValueRange> { +public: + using AdjustSaturationOpGenericAdaptor::AdjustSaturationOpGenericAdaptor; + AdjustSaturationOpAdaptor(AdjustSaturationOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AdjustSaturationOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AdjustSaturationOpAdaptor; + template + using GenericAdaptor = AdjustSaturationOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.AdjustSaturation"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getImages(); + ::mlir::TypedValue<::mlir::TensorType> getScale(); + ::mlir::OpOperand &getImagesMutable(); + ::mlir::OpOperand &getScaleMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value images, ::mlir::Value scale); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value images, ::mlir::Value scale); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AdjustSaturationOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AllOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AllOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AllOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AllOpGenericAdaptorBase(AllOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getKeepDimsAttr(); + bool getKeepDims(); +}; +} // namespace detail +template +class AllOpGenericAdaptor : public detail::AllOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AllOpGenericAdaptorBase; +public: + AllOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AllOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AllOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AllOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getReductionIndices() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AllOpAdaptor : public AllOpGenericAdaptor<::mlir::ValueRange> { +public: + using AllOpGenericAdaptor::AllOpGenericAdaptor; + AllOpAdaptor(AllOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AllOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AllOpAdaptor; + template + using GenericAdaptor = AllOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tidx"), ::llvm::StringRef("keep_dims")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTidxAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTidxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getKeepDimsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getKeepDimsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.All"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getReductionIndices(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getReductionIndicesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getKeepDimsAttr(); + bool getKeepDims(); + ::mlir::Type getTidx(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setKeepDimsAttr(::mlir::BoolAttr attr); + void setKeepDims(::std::optional attrValue); + ::mlir::Attribute removeKeepDimsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value reduction_indices, /*optional*/::mlir::BoolAttr keep_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value reduction_indices, /*optional*/::mlir::BoolAttr keep_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value reduction_indices, /*optional*/bool keep_dims = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value reduction_indices, /*optional*/bool keep_dims = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AllOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AllToAllOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AllToAllOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AllToAllOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AllToAllOpGenericAdaptorBase(AllToAllOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getConcatDimensionAttr(); + uint64_t getConcatDimension(); + ::mlir::IntegerAttr getSplitDimensionAttr(); + uint64_t getSplitDimension(); + ::mlir::IntegerAttr getSplitCountAttr(); + uint64_t getSplitCount(); +}; +} // namespace detail +template +class AllToAllOpGenericAdaptor : public detail::AllToAllOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AllToAllOpGenericAdaptorBase; +public: + AllToAllOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AllToAllOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AllToAllOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AllToAllOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getGroupAssignment() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AllToAllOpAdaptor : public AllToAllOpGenericAdaptor<::mlir::ValueRange> { +public: + using AllToAllOpGenericAdaptor::AllToAllOpGenericAdaptor; + AllToAllOpAdaptor(AllToAllOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AllToAllOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AllToAllOpAdaptor; + template + using GenericAdaptor = AllToAllOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("concat_dimension"), ::llvm::StringRef("split_count"), ::llvm::StringRef("split_dimension")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getConcatDimensionAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getConcatDimensionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getSplitCountAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getSplitCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSplitDimensionAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSplitDimensionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.AllToAll"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getGroupAssignment(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getGroupAssignmentMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getConcatDimensionAttr(); + uint64_t getConcatDimension(); + ::mlir::IntegerAttr getSplitDimensionAttr(); + uint64_t getSplitDimension(); + ::mlir::IntegerAttr getSplitCountAttr(); + uint64_t getSplitCount(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setConcatDimensionAttr(::mlir::IntegerAttr attr); + void setConcatDimension(uint64_t attrValue); + void setSplitDimensionAttr(::mlir::IntegerAttr attr); + void setSplitDimension(uint64_t attrValue); + void setSplitCountAttr(::mlir::IntegerAttr attr); + void setSplitCount(uint64_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value group_assignment, ::mlir::IntegerAttr concat_dimension, ::mlir::IntegerAttr split_dimension, ::mlir::IntegerAttr split_count); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value group_assignment, ::mlir::IntegerAttr concat_dimension, ::mlir::IntegerAttr split_dimension, ::mlir::IntegerAttr split_count); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value group_assignment, uint64_t concat_dimension, uint64_t split_dimension, uint64_t split_count); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value group_assignment, uint64_t concat_dimension, uint64_t split_dimension, uint64_t split_count); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AllToAllOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AngleOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AngleOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AngleOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AngleOpGenericAdaptorBase(AngleOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AngleOpGenericAdaptor : public detail::AngleOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AngleOpGenericAdaptorBase; +public: + AngleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AngleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AngleOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AngleOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AngleOpAdaptor : public AngleOpGenericAdaptor<::mlir::ValueRange> { +public: + using AngleOpGenericAdaptor::AngleOpGenericAdaptor; + AngleOpAdaptor(AngleOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AngleOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AngleOpAdaptor; + template + using GenericAdaptor = AngleOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tout")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getToutAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getToutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Angle"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTout(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AngleOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AnonymousIteratorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AnonymousIteratorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AnonymousIteratorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AnonymousIteratorOpGenericAdaptorBase(AnonymousIteratorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); +}; +} // namespace detail +template +class AnonymousIteratorOpGenericAdaptor : public detail::AnonymousIteratorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AnonymousIteratorOpGenericAdaptorBase; +public: + AnonymousIteratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AnonymousIteratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AnonymousIteratorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AnonymousIteratorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AnonymousIteratorOpAdaptor : public AnonymousIteratorOpGenericAdaptor<::mlir::ValueRange> { +public: + using AnonymousIteratorOpGenericAdaptor::AnonymousIteratorOpGenericAdaptor; + AnonymousIteratorOpAdaptor(AnonymousIteratorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AnonymousIteratorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ResourceHandleAllocatorInterface::Trait, ::mlir::OpTrait::TF::UniqueResourceAllocation, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AnonymousIteratorOpAdaptor; + template + using GenericAdaptor = AnonymousIteratorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.AnonymousIterator"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AnonymousIteratorOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AnonymousIteratorV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AnonymousIteratorV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AnonymousIteratorV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AnonymousIteratorV2OpGenericAdaptorBase(AnonymousIteratorV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); +}; +} // namespace detail +template +class AnonymousIteratorV2OpGenericAdaptor : public detail::AnonymousIteratorV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AnonymousIteratorV2OpGenericAdaptorBase; +public: + AnonymousIteratorV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AnonymousIteratorV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AnonymousIteratorV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AnonymousIteratorV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AnonymousIteratorV2OpAdaptor : public AnonymousIteratorV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using AnonymousIteratorV2OpGenericAdaptor::AnonymousIteratorV2OpGenericAdaptor; + AnonymousIteratorV2OpAdaptor(AnonymousIteratorV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AnonymousIteratorV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ResourceHandleAllocatorInterface::Trait, ::mlir::OpTrait::TF::UniqueResourceAllocation, ::mlir::OpAsmOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AnonymousIteratorV2OpAdaptor; + template + using GenericAdaptor = AnonymousIteratorV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.AnonymousIteratorV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::TypedValue<::mlir::TensorType> getDeleter(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Type deleter, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AnonymousIteratorV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AnonymousIteratorV3Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AnonymousIteratorV3OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AnonymousIteratorV3OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AnonymousIteratorV3OpGenericAdaptorBase(AnonymousIteratorV3Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); +}; +} // namespace detail +template +class AnonymousIteratorV3OpGenericAdaptor : public detail::AnonymousIteratorV3OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AnonymousIteratorV3OpGenericAdaptorBase; +public: + AnonymousIteratorV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AnonymousIteratorV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AnonymousIteratorV3OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AnonymousIteratorV3OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AnonymousIteratorV3OpAdaptor : public AnonymousIteratorV3OpGenericAdaptor<::mlir::ValueRange> { +public: + using AnonymousIteratorV3OpGenericAdaptor::AnonymousIteratorV3OpGenericAdaptor; + AnonymousIteratorV3OpAdaptor(AnonymousIteratorV3Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AnonymousIteratorV3Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ResourceHandleAllocatorInterface::Trait, ::mlir::OpTrait::TF::UniqueResourceAllocation, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AnonymousIteratorV3OpAdaptor; + template + using GenericAdaptor = AnonymousIteratorV3OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.AnonymousIteratorV3"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AnonymousIteratorV3Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AnonymousMemoryCacheOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AnonymousMemoryCacheOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AnonymousMemoryCacheOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AnonymousMemoryCacheOpGenericAdaptorBase(AnonymousMemoryCacheOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AnonymousMemoryCacheOpGenericAdaptor : public detail::AnonymousMemoryCacheOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AnonymousMemoryCacheOpGenericAdaptorBase; +public: + AnonymousMemoryCacheOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AnonymousMemoryCacheOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AnonymousMemoryCacheOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AnonymousMemoryCacheOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AnonymousMemoryCacheOpAdaptor : public AnonymousMemoryCacheOpGenericAdaptor<::mlir::ValueRange> { +public: + using AnonymousMemoryCacheOpGenericAdaptor::AnonymousMemoryCacheOpGenericAdaptor; + AnonymousMemoryCacheOpAdaptor(AnonymousMemoryCacheOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AnonymousMemoryCacheOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ResourceHandleAllocatorInterface::Trait, ::mlir::OpTrait::TF::UniqueResourceAllocation, ::mlir::OpAsmOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AnonymousMemoryCacheOpAdaptor; + template + using GenericAdaptor = AnonymousMemoryCacheOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.AnonymousMemoryCache"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::TypedValue<::mlir::TensorType> getDeleter(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Type deleter); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AnonymousMemoryCacheOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AnonymousMultiDeviceIteratorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AnonymousMultiDeviceIteratorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AnonymousMultiDeviceIteratorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AnonymousMultiDeviceIteratorOpGenericAdaptorBase(AnonymousMultiDeviceIteratorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getDevicesAttr(); + ::mlir::ArrayAttr getDevices(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); +}; +} // namespace detail +template +class AnonymousMultiDeviceIteratorOpGenericAdaptor : public detail::AnonymousMultiDeviceIteratorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AnonymousMultiDeviceIteratorOpGenericAdaptorBase; +public: + AnonymousMultiDeviceIteratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AnonymousMultiDeviceIteratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AnonymousMultiDeviceIteratorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AnonymousMultiDeviceIteratorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AnonymousMultiDeviceIteratorOpAdaptor : public AnonymousMultiDeviceIteratorOpGenericAdaptor<::mlir::ValueRange> { +public: + using AnonymousMultiDeviceIteratorOpGenericAdaptor::AnonymousMultiDeviceIteratorOpGenericAdaptor; + AnonymousMultiDeviceIteratorOpAdaptor(AnonymousMultiDeviceIteratorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AnonymousMultiDeviceIteratorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ResourceHandleAllocatorInterface::Trait, ::mlir::OpTrait::TF::UniqueResourceAllocation, ::mlir::OpAsmOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AnonymousMultiDeviceIteratorOpAdaptor; + template + using GenericAdaptor = AnonymousMultiDeviceIteratorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("devices"), ::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDevicesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDevicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.AnonymousMultiDeviceIterator"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::TypedValue<::mlir::TensorType> getDeleter(); + ::mlir::ArrayAttr getDevicesAttr(); + ::mlir::ArrayAttr getDevices(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + void setDevicesAttr(::mlir::ArrayAttr attr); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Type deleter, ::mlir::ArrayAttr devices, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ArrayAttr devices, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AnonymousMultiDeviceIteratorOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AnonymousMultiDeviceIteratorV3Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AnonymousMultiDeviceIteratorV3OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AnonymousMultiDeviceIteratorV3OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AnonymousMultiDeviceIteratorV3OpGenericAdaptorBase(AnonymousMultiDeviceIteratorV3Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getDevicesAttr(); + ::mlir::ArrayAttr getDevices(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); +}; +} // namespace detail +template +class AnonymousMultiDeviceIteratorV3OpGenericAdaptor : public detail::AnonymousMultiDeviceIteratorV3OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AnonymousMultiDeviceIteratorV3OpGenericAdaptorBase; +public: + AnonymousMultiDeviceIteratorV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AnonymousMultiDeviceIteratorV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AnonymousMultiDeviceIteratorV3OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AnonymousMultiDeviceIteratorV3OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AnonymousMultiDeviceIteratorV3OpAdaptor : public AnonymousMultiDeviceIteratorV3OpGenericAdaptor<::mlir::ValueRange> { +public: + using AnonymousMultiDeviceIteratorV3OpGenericAdaptor::AnonymousMultiDeviceIteratorV3OpGenericAdaptor; + AnonymousMultiDeviceIteratorV3OpAdaptor(AnonymousMultiDeviceIteratorV3Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AnonymousMultiDeviceIteratorV3Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ResourceHandleAllocatorInterface::Trait, ::mlir::OpTrait::TF::UniqueResourceAllocation, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AnonymousMultiDeviceIteratorV3OpAdaptor; + template + using GenericAdaptor = AnonymousMultiDeviceIteratorV3OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("devices"), ::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDevicesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDevicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.AnonymousMultiDeviceIteratorV3"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::ArrayAttr getDevicesAttr(); + ::mlir::ArrayAttr getDevices(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + void setDevicesAttr(::mlir::ArrayAttr attr); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::ArrayAttr devices, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ArrayAttr devices, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AnonymousMultiDeviceIteratorV3Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AnonymousRandomSeedGeneratorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AnonymousRandomSeedGeneratorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AnonymousRandomSeedGeneratorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AnonymousRandomSeedGeneratorOpGenericAdaptorBase(AnonymousRandomSeedGeneratorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AnonymousRandomSeedGeneratorOpGenericAdaptor : public detail::AnonymousRandomSeedGeneratorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AnonymousRandomSeedGeneratorOpGenericAdaptorBase; +public: + AnonymousRandomSeedGeneratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AnonymousRandomSeedGeneratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AnonymousRandomSeedGeneratorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AnonymousRandomSeedGeneratorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSeed() { + return (*getODSOperands(0).begin()); + } + + ValueT getSeed2() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AnonymousRandomSeedGeneratorOpAdaptor : public AnonymousRandomSeedGeneratorOpGenericAdaptor<::mlir::ValueRange> { +public: + using AnonymousRandomSeedGeneratorOpGenericAdaptor::AnonymousRandomSeedGeneratorOpGenericAdaptor; + AnonymousRandomSeedGeneratorOpAdaptor(AnonymousRandomSeedGeneratorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AnonymousRandomSeedGeneratorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ResourceHandleAllocatorInterface::Trait, ::mlir::OpTrait::TF::UniqueResourceAllocation, ::mlir::OpAsmOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AnonymousRandomSeedGeneratorOpAdaptor; + template + using GenericAdaptor = AnonymousRandomSeedGeneratorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.AnonymousRandomSeedGenerator"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSeed(); + ::mlir::TypedValue<::mlir::TensorType> getSeed2(); + ::mlir::OpOperand &getSeedMutable(); + ::mlir::OpOperand &getSeed2Mutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::TypedValue<::mlir::TensorType> getDeleter(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Type deleter, ::mlir::Value seed, ::mlir::Value seed2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value seed, ::mlir::Value seed2); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AnonymousRandomSeedGeneratorOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AnonymousSeedGeneratorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AnonymousSeedGeneratorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AnonymousSeedGeneratorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AnonymousSeedGeneratorOpGenericAdaptorBase(AnonymousSeedGeneratorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AnonymousSeedGeneratorOpGenericAdaptor : public detail::AnonymousSeedGeneratorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AnonymousSeedGeneratorOpGenericAdaptorBase; +public: + AnonymousSeedGeneratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AnonymousSeedGeneratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AnonymousSeedGeneratorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AnonymousSeedGeneratorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSeed() { + return (*getODSOperands(0).begin()); + } + + ValueT getSeed2() { + return (*getODSOperands(1).begin()); + } + + ValueT getReshuffle() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AnonymousSeedGeneratorOpAdaptor : public AnonymousSeedGeneratorOpGenericAdaptor<::mlir::ValueRange> { +public: + using AnonymousSeedGeneratorOpGenericAdaptor::AnonymousSeedGeneratorOpGenericAdaptor; + AnonymousSeedGeneratorOpAdaptor(AnonymousSeedGeneratorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AnonymousSeedGeneratorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ResourceHandleAllocatorInterface::Trait, ::mlir::OpTrait::TF::UniqueResourceAllocation, ::mlir::OpAsmOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AnonymousSeedGeneratorOpAdaptor; + template + using GenericAdaptor = AnonymousSeedGeneratorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.AnonymousSeedGenerator"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSeed(); + ::mlir::TypedValue<::mlir::TensorType> getSeed2(); + ::mlir::TypedValue<::mlir::TensorType> getReshuffle(); + ::mlir::OpOperand &getSeedMutable(); + ::mlir::OpOperand &getSeed2Mutable(); + ::mlir::OpOperand &getReshuffleMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::TypedValue<::mlir::TensorType> getDeleter(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Type deleter, ::mlir::Value seed, ::mlir::Value seed2, ::mlir::Value reshuffle); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value seed, ::mlir::Value seed2, ::mlir::Value reshuffle); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AnonymousSeedGeneratorOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AnyOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AnyOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AnyOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AnyOpGenericAdaptorBase(AnyOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getKeepDimsAttr(); + bool getKeepDims(); +}; +} // namespace detail +template +class AnyOpGenericAdaptor : public detail::AnyOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AnyOpGenericAdaptorBase; +public: + AnyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AnyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AnyOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AnyOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getReductionIndices() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AnyOpAdaptor : public AnyOpGenericAdaptor<::mlir::ValueRange> { +public: + using AnyOpGenericAdaptor::AnyOpGenericAdaptor; + AnyOpAdaptor(AnyOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AnyOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AnyOpAdaptor; + template + using GenericAdaptor = AnyOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tidx"), ::llvm::StringRef("keep_dims")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTidxAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTidxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getKeepDimsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getKeepDimsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Any"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getReductionIndices(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getReductionIndicesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getKeepDimsAttr(); + bool getKeepDims(); + ::mlir::Type getTidx(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setKeepDimsAttr(::mlir::BoolAttr attr); + void setKeepDims(::std::optional attrValue); + ::mlir::Attribute removeKeepDimsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value reduction_indices, /*optional*/::mlir::BoolAttr keep_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value reduction_indices, /*optional*/::mlir::BoolAttr keep_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value reduction_indices, /*optional*/bool keep_dims = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value reduction_indices, /*optional*/bool keep_dims = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AnyOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ApproxTopKOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ApproxTopKOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ApproxTopKOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ApproxTopKOpGenericAdaptorBase(ApproxTopKOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getKAttr(); + uint64_t getK(); + ::mlir::IntegerAttr getReductionDimensionAttr(); + uint64_t getReductionDimension(); + ::mlir::FloatAttr getRecallTargetAttr(); + ::llvm::APFloat getRecallTarget(); + ::mlir::BoolAttr getIsMaxKAttr(); + bool getIsMaxK(); + ::mlir::IntegerAttr getReductionInputSizeOverrideAttr(); + uint64_t getReductionInputSizeOverride(); + ::mlir::BoolAttr getAggregateToTopkAttr(); + bool getAggregateToTopk(); +}; +} // namespace detail +template +class ApproxTopKOpGenericAdaptor : public detail::ApproxTopKOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ApproxTopKOpGenericAdaptorBase; +public: + ApproxTopKOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ApproxTopKOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ApproxTopKOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ApproxTopKOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ApproxTopKOpAdaptor : public ApproxTopKOpGenericAdaptor<::mlir::ValueRange> { +public: + using ApproxTopKOpGenericAdaptor::ApproxTopKOpGenericAdaptor; + ApproxTopKOpAdaptor(ApproxTopKOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ApproxTopKOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ApproxTopKOpAdaptor; + template + using GenericAdaptor = ApproxTopKOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("aggregate_to_topk"), ::llvm::StringRef("is_max_k"), ::llvm::StringRef("k"), ::llvm::StringRef("recall_target"), ::llvm::StringRef("reduction_dimension"), ::llvm::StringRef("reduction_input_size_override")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAggregateToTopkAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAggregateToTopkAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getIsMaxKAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getIsMaxKAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getKAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getKAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getRecallTargetAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getRecallTargetAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getReductionDimensionAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getReductionDimensionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getReductionInputSizeOverrideAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getReductionInputSizeOverrideAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ApproxTopK"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getValues(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::IntegerAttr getKAttr(); + uint64_t getK(); + ::mlir::IntegerAttr getReductionDimensionAttr(); + uint64_t getReductionDimension(); + ::mlir::FloatAttr getRecallTargetAttr(); + ::llvm::APFloat getRecallTarget(); + ::mlir::BoolAttr getIsMaxKAttr(); + bool getIsMaxK(); + ::mlir::IntegerAttr getReductionInputSizeOverrideAttr(); + uint64_t getReductionInputSizeOverride(); + ::mlir::BoolAttr getAggregateToTopkAttr(); + bool getAggregateToTopk(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setKAttr(::mlir::IntegerAttr attr); + void setK(uint64_t attrValue); + void setReductionDimensionAttr(::mlir::IntegerAttr attr); + void setReductionDimension(::std::optional attrValue); + void setRecallTargetAttr(::mlir::FloatAttr attr); + void setRecallTarget(::std::optional<::llvm::APFloat> attrValue); + void setIsMaxKAttr(::mlir::BoolAttr attr); + void setIsMaxK(::std::optional attrValue); + void setReductionInputSizeOverrideAttr(::mlir::IntegerAttr attr); + void setReductionInputSizeOverride(::std::optional attrValue); + void setAggregateToTopkAttr(::mlir::BoolAttr attr); + void setAggregateToTopk(::std::optional attrValue); + ::mlir::Attribute removeReductionDimensionAttr(); + ::mlir::Attribute removeRecallTargetAttr(); + ::mlir::Attribute removeIsMaxKAttr(); + ::mlir::Attribute removeReductionInputSizeOverrideAttr(); + ::mlir::Attribute removeAggregateToTopkAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type values, ::mlir::Type indices, ::mlir::Value input, ::mlir::IntegerAttr k, /*optional*/::mlir::IntegerAttr reduction_dimension, /*optional*/::mlir::FloatAttr recall_target, /*optional*/::mlir::BoolAttr is_max_k, /*optional*/::mlir::IntegerAttr reduction_input_size_override, /*optional*/::mlir::BoolAttr aggregate_to_topk); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::IntegerAttr k, /*optional*/::mlir::IntegerAttr reduction_dimension, /*optional*/::mlir::FloatAttr recall_target, /*optional*/::mlir::BoolAttr is_max_k, /*optional*/::mlir::IntegerAttr reduction_input_size_override, /*optional*/::mlir::BoolAttr aggregate_to_topk); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type values, ::mlir::Type indices, ::mlir::Value input, uint64_t k, /*optional*/uint64_t reduction_dimension, /*optional*/::llvm::APFloat recall_target, /*optional*/bool is_max_k = true, /*optional*/uint64_t reduction_input_size_override = -1, /*optional*/bool aggregate_to_topk = true); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, uint64_t k, /*optional*/uint64_t reduction_dimension, /*optional*/::llvm::APFloat recall_target, /*optional*/bool is_max_k = true, /*optional*/uint64_t reduction_input_size_override = -1, /*optional*/bool aggregate_to_topk = true); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 7 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ApproxTopKOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ApproximateEqualOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ApproximateEqualOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ApproximateEqualOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ApproximateEqualOpGenericAdaptorBase(ApproximateEqualOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::FloatAttr getToleranceAttr(); + ::llvm::APFloat getTolerance(); +}; +} // namespace detail +template +class ApproximateEqualOpGenericAdaptor : public detail::ApproximateEqualOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ApproximateEqualOpGenericAdaptorBase; +public: + ApproximateEqualOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ApproximateEqualOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ApproximateEqualOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ApproximateEqualOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ApproximateEqualOpAdaptor : public ApproximateEqualOpGenericAdaptor<::mlir::ValueRange> { +public: + using ApproximateEqualOpGenericAdaptor::ApproximateEqualOpGenericAdaptor; + ApproximateEqualOpAdaptor(ApproximateEqualOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ApproximateEqualOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsCommutative, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ApproximateEqualOpAdaptor; + template + using GenericAdaptor = ApproximateEqualOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("tolerance")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getToleranceAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getToleranceAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ApproximateEqual"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::FloatAttr getToleranceAttr(); + ::llvm::APFloat getTolerance(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setToleranceAttr(::mlir::FloatAttr attr); + void setTolerance(::std::optional<::llvm::APFloat> attrValue); + ::mlir::Attribute removeToleranceAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y, /*optional*/::mlir::FloatAttr tolerance); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y, /*optional*/::mlir::FloatAttr tolerance); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y, /*optional*/::llvm::APFloat tolerance); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y, /*optional*/::llvm::APFloat tolerance); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ApproximateEqualOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ArgMaxOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ArgMaxOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ArgMaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ArgMaxOpGenericAdaptorBase(ArgMaxOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ArgMaxOpGenericAdaptor : public detail::ArgMaxOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ArgMaxOpGenericAdaptorBase; +public: + ArgMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ArgMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ArgMaxOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ArgMaxOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getDimension() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ArgMaxOpAdaptor : public ArgMaxOpGenericAdaptor<::mlir::ValueRange> { +public: + using ArgMaxOpGenericAdaptor::ArgMaxOpGenericAdaptor; + ArgMaxOpAdaptor(ArgMaxOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ArgMaxOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ArgMaxOpAdaptor; + template + using GenericAdaptor = ArgMaxOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tidx"), ::llvm::StringRef("output_type")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTidxAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTidxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOutputTypeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOutputTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ArgMax"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getDimension(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getDimensionMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTidx(); + ::mlir::Type getOutputType(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value dimension); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ArgMaxOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ArgMinOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ArgMinOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ArgMinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ArgMinOpGenericAdaptorBase(ArgMinOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ArgMinOpGenericAdaptor : public detail::ArgMinOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ArgMinOpGenericAdaptorBase; +public: + ArgMinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ArgMinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ArgMinOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ArgMinOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getDimension() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ArgMinOpAdaptor : public ArgMinOpGenericAdaptor<::mlir::ValueRange> { +public: + using ArgMinOpGenericAdaptor::ArgMinOpGenericAdaptor; + ArgMinOpAdaptor(ArgMinOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ArgMinOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ArgMinOpAdaptor; + template + using GenericAdaptor = ArgMinOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tidx"), ::llvm::StringRef("output_type")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTidxAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTidxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOutputTypeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOutputTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ArgMin"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getDimension(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getDimensionMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTidx(); + ::mlir::Type getOutputType(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value dimension); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ArgMinOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AsStringOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AsStringOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AsStringOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AsStringOpGenericAdaptorBase(AsStringOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getPrecisionAttr(); + uint64_t getPrecision(); + ::mlir::BoolAttr getScientificAttr(); + bool getScientific(); + ::mlir::BoolAttr getShortestAttr(); + bool getShortest(); + ::mlir::IntegerAttr getWidthAttr(); + uint64_t getWidth(); + ::mlir::StringAttr getFillAttr(); + ::llvm::StringRef getFill(); +}; +} // namespace detail +template +class AsStringOpGenericAdaptor : public detail::AsStringOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AsStringOpGenericAdaptorBase; +public: + AsStringOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AsStringOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AsStringOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AsStringOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AsStringOpAdaptor : public AsStringOpGenericAdaptor<::mlir::ValueRange> { +public: + using AsStringOpGenericAdaptor::AsStringOpGenericAdaptor; + AsStringOpAdaptor(AsStringOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AsStringOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AsStringOpAdaptor; + template + using GenericAdaptor = AsStringOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("fill"), ::llvm::StringRef("precision"), ::llvm::StringRef("scientific"), ::llvm::StringRef("shortest"), ::llvm::StringRef("width")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getFillAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getFillAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getPrecisionAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getPrecisionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getScientificAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getScientificAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getShortestAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getShortestAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getWidthAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getWidthAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.AsString"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getPrecisionAttr(); + uint64_t getPrecision(); + ::mlir::BoolAttr getScientificAttr(); + bool getScientific(); + ::mlir::BoolAttr getShortestAttr(); + bool getShortest(); + ::mlir::IntegerAttr getWidthAttr(); + uint64_t getWidth(); + ::mlir::StringAttr getFillAttr(); + ::llvm::StringRef getFill(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setPrecisionAttr(::mlir::IntegerAttr attr); + void setPrecision(::std::optional attrValue); + void setScientificAttr(::mlir::BoolAttr attr); + void setScientific(::std::optional attrValue); + void setShortestAttr(::mlir::BoolAttr attr); + void setShortest(::std::optional attrValue); + void setWidthAttr(::mlir::IntegerAttr attr); + void setWidth(::std::optional attrValue); + void setFillAttr(::mlir::StringAttr attr); + void setFill(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removePrecisionAttr(); + ::mlir::Attribute removeScientificAttr(); + ::mlir::Attribute removeShortestAttr(); + ::mlir::Attribute removeWidthAttr(); + ::mlir::Attribute removeFillAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, /*optional*/::mlir::IntegerAttr precision, /*optional*/::mlir::BoolAttr scientific, /*optional*/::mlir::BoolAttr shortest, /*optional*/::mlir::IntegerAttr width, /*optional*/::mlir::StringAttr fill); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, /*optional*/::mlir::IntegerAttr precision, /*optional*/::mlir::BoolAttr scientific, /*optional*/::mlir::BoolAttr shortest, /*optional*/::mlir::IntegerAttr width, /*optional*/::mlir::StringAttr fill); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, /*optional*/uint64_t precision = -1, /*optional*/bool scientific = false, /*optional*/bool shortest = false, /*optional*/uint64_t width = -1, /*optional*/::llvm::StringRef fill = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, /*optional*/uint64_t precision = -1, /*optional*/bool scientific = false, /*optional*/bool shortest = false, /*optional*/uint64_t width = -1, /*optional*/::llvm::StringRef fill = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AsStringOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AsinOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AsinOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AsinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AsinOpGenericAdaptorBase(AsinOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AsinOpGenericAdaptor : public detail::AsinOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AsinOpGenericAdaptorBase; +public: + AsinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AsinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AsinOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AsinOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AsinOpAdaptor : public AsinOpGenericAdaptor<::mlir::ValueRange> { +public: + using AsinOpGenericAdaptor::AsinOpGenericAdaptor; + AsinOpAdaptor(AsinOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AsinOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AsinOpAdaptor; + template + using GenericAdaptor = AsinOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Asin"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AsinOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AsinhOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AsinhOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AsinhOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AsinhOpGenericAdaptorBase(AsinhOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AsinhOpGenericAdaptor : public detail::AsinhOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AsinhOpGenericAdaptorBase; +public: + AsinhOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AsinhOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AsinhOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AsinhOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AsinhOpAdaptor : public AsinhOpGenericAdaptor<::mlir::ValueRange> { +public: + using AsinhOpGenericAdaptor::AsinhOpGenericAdaptor; + AsinhOpAdaptor(AsinhOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AsinhOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AsinhOpAdaptor; + template + using GenericAdaptor = AsinhOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Asinh"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AsinhOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AssertOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AssertOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AssertOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AssertOpGenericAdaptorBase(AssertOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getSummarizeAttr(); + uint64_t getSummarize(); +}; +} // namespace detail +template +class AssertOpGenericAdaptor : public detail::AssertOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AssertOpGenericAdaptorBase; +public: + AssertOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AssertOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AssertOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AssertOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getCondition() { + return (*getODSOperands(0).begin()); + } + + RangeT getData() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AssertOpAdaptor : public AssertOpGenericAdaptor<::mlir::ValueRange> { +public: + using AssertOpGenericAdaptor::AssertOpGenericAdaptor; + AssertOpAdaptor(AssertOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AssertOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AssertOpAdaptor; + template + using GenericAdaptor = AssertOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("summarize")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getSummarizeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getSummarizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Assert"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getCondition(); + ::mlir::Operation::operand_range getData(); + ::mlir::OpOperand &getConditionMutable(); + ::mlir::MutableOperandRange getDataMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getSummarizeAttr(); + uint64_t getSummarize(); + mlir::OperandElementTypeRange getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setSummarizeAttr(::mlir::IntegerAttr attr); + void setSummarize(::std::optional attrValue); + ::mlir::Attribute removeSummarizeAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value condition, ::mlir::ValueRange data, /*optional*/::mlir::IntegerAttr summarize); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value condition, ::mlir::ValueRange data, /*optional*/::mlir::IntegerAttr summarize); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value condition, ::mlir::ValueRange data, /*optional*/uint64_t summarize = 3); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value condition, ::mlir::ValueRange data, /*optional*/uint64_t summarize = 3); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AssertOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AssignAddVariableOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AssignAddVariableOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AssignAddVariableOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AssignAddVariableOpGenericAdaptorBase(AssignAddVariableOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AssignAddVariableOpGenericAdaptor : public detail::AssignAddVariableOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AssignAddVariableOpGenericAdaptorBase; +public: + AssignAddVariableOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AssignAddVariableOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AssignAddVariableOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AssignAddVariableOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getResource() { + return (*getODSOperands(0).begin()); + } + + ValueT getValue() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AssignAddVariableOpAdaptor : public AssignAddVariableOpGenericAdaptor<::mlir::ValueRange> { +public: + using AssignAddVariableOpGenericAdaptor::AssignAddVariableOpGenericAdaptor; + AssignAddVariableOpAdaptor(AssignAddVariableOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AssignAddVariableOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AssignAddVariableOpAdaptor; + template + using GenericAdaptor = AssignAddVariableOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.AssignAddVariableOp"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResource(); + ::mlir::TypedValue<::mlir::TensorType> getValue(); + ::mlir::OpOperand &getResourceMutable(); + ::mlir::OpOperand &getValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value resource, ::mlir::Value value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value resource, ::mlir::Value value); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AssignAddVariableOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AssignOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AssignOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AssignOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AssignOpGenericAdaptorBase(AssignOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getValidateShapeAttr(); + bool getValidateShape(); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); +}; +} // namespace detail +template +class AssignOpGenericAdaptor : public detail::AssignOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AssignOpGenericAdaptorBase; +public: + AssignOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AssignOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AssignOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AssignOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getRef() { + return (*getODSOperands(0).begin()); + } + + ValueT getValue() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AssignOpAdaptor : public AssignOpGenericAdaptor<::mlir::ValueRange> { +public: + using AssignOpGenericAdaptor::AssignOpGenericAdaptor; + AssignOpAdaptor(AssignOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AssignOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AssignOpAdaptor; + template + using GenericAdaptor = AssignOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("use_locking"), ::llvm::StringRef("validate_shape")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getUseLockingAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getUseLockingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getValidateShapeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getValidateShapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Assign"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getRef(); + ::mlir::TypedValue<::mlir::TensorType> getValue(); + ::mlir::OpOperand &getRefMutable(); + ::mlir::OpOperand &getValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutputRef(); + ::mlir::BoolAttr getValidateShapeAttr(); + bool getValidateShape(); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setValidateShapeAttr(::mlir::BoolAttr attr); + void setValidateShape(::std::optional attrValue); + void setUseLockingAttr(::mlir::BoolAttr attr); + void setUseLocking(::std::optional attrValue); + ::mlir::Attribute removeValidateShapeAttr(); + ::mlir::Attribute removeUseLockingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output_ref, ::mlir::Value ref, ::mlir::Value value, /*optional*/::mlir::BoolAttr validate_shape, /*optional*/::mlir::BoolAttr use_locking); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ref, ::mlir::Value value, /*optional*/::mlir::BoolAttr validate_shape, /*optional*/::mlir::BoolAttr use_locking); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output_ref, ::mlir::Value ref, ::mlir::Value value, /*optional*/bool validate_shape = true, /*optional*/bool use_locking = true); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ref, ::mlir::Value value, /*optional*/bool validate_shape = true, /*optional*/bool use_locking = true); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AssignOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AssignSubVariableOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AssignSubVariableOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AssignSubVariableOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AssignSubVariableOpGenericAdaptorBase(AssignSubVariableOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AssignSubVariableOpGenericAdaptor : public detail::AssignSubVariableOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AssignSubVariableOpGenericAdaptorBase; +public: + AssignSubVariableOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AssignSubVariableOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AssignSubVariableOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AssignSubVariableOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getResource() { + return (*getODSOperands(0).begin()); + } + + ValueT getValue() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AssignSubVariableOpAdaptor : public AssignSubVariableOpGenericAdaptor<::mlir::ValueRange> { +public: + using AssignSubVariableOpGenericAdaptor::AssignSubVariableOpGenericAdaptor; + AssignSubVariableOpAdaptor(AssignSubVariableOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AssignSubVariableOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AssignSubVariableOpAdaptor; + template + using GenericAdaptor = AssignSubVariableOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.AssignSubVariableOp"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResource(); + ::mlir::TypedValue<::mlir::TensorType> getValue(); + ::mlir::OpOperand &getResourceMutable(); + ::mlir::OpOperand &getValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value resource, ::mlir::Value value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value resource, ::mlir::Value value); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AssignSubVariableOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AssignVariableOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AssignVariableOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AssignVariableOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AssignVariableOpGenericAdaptorBase(AssignVariableOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getValidateShapeAttr(); + bool getValidateShape(); +}; +} // namespace detail +template +class AssignVariableOpGenericAdaptor : public detail::AssignVariableOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AssignVariableOpGenericAdaptorBase; +public: + AssignVariableOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AssignVariableOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AssignVariableOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AssignVariableOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getResource() { + return (*getODSOperands(0).begin()); + } + + ValueT getValue() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AssignVariableOpAdaptor : public AssignVariableOpGenericAdaptor<::mlir::ValueRange> { +public: + using AssignVariableOpGenericAdaptor::AssignVariableOpGenericAdaptor; + AssignVariableOpAdaptor(AssignVariableOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AssignVariableOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AssignVariableOpAdaptor; + template + using GenericAdaptor = AssignVariableOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dtype"), ::llvm::StringRef("validate_shape")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getValidateShapeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getValidateShapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.AssignVariableOp"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResource(); + ::mlir::TypedValue<::mlir::TensorType> getValue(); + ::mlir::OpOperand &getResourceMutable(); + ::mlir::OpOperand &getValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::BoolAttr getValidateShapeAttr(); + bool getValidateShape(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setValidateShapeAttr(::mlir::BoolAttr attr); + void setValidateShape(::std::optional attrValue); + ::mlir::Attribute removeValidateShapeAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value resource, ::mlir::Value value, /*optional*/::mlir::BoolAttr validate_shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value resource, ::mlir::Value value, /*optional*/::mlir::BoolAttr validate_shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value resource, ::mlir::Value value, /*optional*/bool validate_shape = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value resource, ::mlir::Value value, /*optional*/bool validate_shape = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AssignVariableOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::Atan2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Atan2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + Atan2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + Atan2OpGenericAdaptorBase(Atan2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class Atan2OpGenericAdaptor : public detail::Atan2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Atan2OpGenericAdaptorBase; +public: + Atan2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Atan2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Atan2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + Atan2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getY() { + return (*getODSOperands(0).begin()); + } + + ValueT getX() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Atan2OpAdaptor : public Atan2OpGenericAdaptor<::mlir::ValueRange> { +public: + using Atan2OpGenericAdaptor::Atan2OpGenericAdaptor; + Atan2OpAdaptor(Atan2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Atan2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::OpTrait::TF::SameOperandsAndResultElementTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = Atan2OpAdaptor; + template + using GenericAdaptor = Atan2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Atan2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getYMutable(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value y, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::Atan2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AtanOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AtanOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AtanOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AtanOpGenericAdaptorBase(AtanOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AtanOpGenericAdaptor : public detail::AtanOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AtanOpGenericAdaptorBase; +public: + AtanOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AtanOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AtanOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AtanOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AtanOpAdaptor : public AtanOpGenericAdaptor<::mlir::ValueRange> { +public: + using AtanOpGenericAdaptor::AtanOpGenericAdaptor; + AtanOpAdaptor(AtanOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AtanOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AtanOpAdaptor; + template + using GenericAdaptor = AtanOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Atan"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AtanOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AtanhOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AtanhOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AtanhOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AtanhOpGenericAdaptorBase(AtanhOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AtanhOpGenericAdaptor : public detail::AtanhOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AtanhOpGenericAdaptorBase; +public: + AtanhOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AtanhOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AtanhOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AtanhOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AtanhOpAdaptor : public AtanhOpGenericAdaptor<::mlir::ValueRange> { +public: + using AtanhOpGenericAdaptor::AtanhOpGenericAdaptor; + AtanhOpAdaptor(AtanhOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AtanhOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AtanhOpAdaptor; + template + using GenericAdaptor = AtanhOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Atanh"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AtanhOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AvgPool3DGradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AvgPool3DGradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AvgPool3DGradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AvgPool3DGradOpGenericAdaptorBase(AvgPool3DGradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getKsizeAttr(); + ::mlir::ArrayAttr getKsize(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); +}; +} // namespace detail +template +class AvgPool3DGradOpGenericAdaptor : public detail::AvgPool3DGradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AvgPool3DGradOpGenericAdaptorBase; +public: + AvgPool3DGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AvgPool3DGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AvgPool3DGradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AvgPool3DGradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOrigInputShape() { + return (*getODSOperands(0).begin()); + } + + ValueT getGrad() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AvgPool3DGradOpAdaptor : public AvgPool3DGradOpGenericAdaptor<::mlir::ValueRange> { +public: + using AvgPool3DGradOpGenericAdaptor::AvgPool3DGradOpGenericAdaptor; + AvgPool3DGradOpAdaptor(AvgPool3DGradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AvgPool3DGradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AvgPool3DGradOpAdaptor; + template + using GenericAdaptor = AvgPool3DGradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("data_format"), ::llvm::StringRef("ksize"), ::llvm::StringRef("padding"), ::llvm::StringRef("strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getKsizeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getKsizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.AvgPool3DGrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOrigInputShape(); + ::mlir::TypedValue<::mlir::TensorType> getGrad(); + ::mlir::OpOperand &getOrigInputShapeMutable(); + ::mlir::OpOperand &getGradMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ArrayAttr getKsizeAttr(); + ::mlir::ArrayAttr getKsize(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setKsizeAttr(::mlir::ArrayAttr attr); + void setStridesAttr(::mlir::ArrayAttr attr); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeDataFormatAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value orig_input_shape, ::mlir::Value grad, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value orig_input_shape, ::mlir::Value grad, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value orig_input_shape, ::mlir::Value grad, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::llvm::StringRef data_format = "NDHWC"); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value orig_input_shape, ::mlir::Value grad, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::llvm::StringRef data_format = "NDHWC"); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AvgPool3DGradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AvgPool3DOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AvgPool3DOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AvgPool3DOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AvgPool3DOpGenericAdaptorBase(AvgPool3DOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getKsizeAttr(); + ::mlir::ArrayAttr getKsize(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); +}; +} // namespace detail +template +class AvgPool3DOpGenericAdaptor : public detail::AvgPool3DOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AvgPool3DOpGenericAdaptorBase; +public: + AvgPool3DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AvgPool3DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AvgPool3DOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AvgPool3DOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AvgPool3DOpAdaptor : public AvgPool3DOpGenericAdaptor<::mlir::ValueRange> { +public: + using AvgPool3DOpGenericAdaptor::AvgPool3DOpGenericAdaptor; + AvgPool3DOpAdaptor(AvgPool3DOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AvgPool3DOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AvgPool3DOpAdaptor; + template + using GenericAdaptor = AvgPool3DOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("data_format"), ::llvm::StringRef("ksize"), ::llvm::StringRef("padding"), ::llvm::StringRef("strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getKsizeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getKsizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.AvgPool3D"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ArrayAttr getKsizeAttr(); + ::mlir::ArrayAttr getKsize(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setKsizeAttr(::mlir::ArrayAttr attr); + void setStridesAttr(::mlir::ArrayAttr attr); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeDataFormatAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::llvm::StringRef data_format = "NDHWC"); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::llvm::StringRef data_format = "NDHWC"); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AvgPool3DOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AvgPoolGradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AvgPoolGradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AvgPoolGradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AvgPoolGradOpGenericAdaptorBase(AvgPoolGradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getKsizeAttr(); + ::mlir::ArrayAttr getKsize(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); +}; +} // namespace detail +template +class AvgPoolGradOpGenericAdaptor : public detail::AvgPoolGradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AvgPoolGradOpGenericAdaptorBase; +public: + AvgPoolGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AvgPoolGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AvgPoolGradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AvgPoolGradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOrigInputShape() { + return (*getODSOperands(0).begin()); + } + + ValueT getGrad() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AvgPoolGradOpAdaptor : public AvgPoolGradOpGenericAdaptor<::mlir::ValueRange> { +public: + using AvgPoolGradOpGenericAdaptor::AvgPoolGradOpGenericAdaptor; + AvgPoolGradOpAdaptor(AvgPoolGradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AvgPoolGradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AvgPoolGradOpAdaptor; + template + using GenericAdaptor = AvgPoolGradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("data_format"), ::llvm::StringRef("ksize"), ::llvm::StringRef("padding"), ::llvm::StringRef("strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getKsizeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getKsizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.AvgPoolGrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOrigInputShape(); + ::mlir::TypedValue<::mlir::TensorType> getGrad(); + ::mlir::OpOperand &getOrigInputShapeMutable(); + ::mlir::OpOperand &getGradMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ArrayAttr getKsizeAttr(); + ::mlir::ArrayAttr getKsize(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setKsizeAttr(::mlir::ArrayAttr attr); + void setStridesAttr(::mlir::ArrayAttr attr); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeDataFormatAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value orig_input_shape, ::mlir::Value grad, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value orig_input_shape, ::mlir::Value grad, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value orig_input_shape, ::mlir::Value grad, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::llvm::StringRef data_format = "NHWC"); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value orig_input_shape, ::mlir::Value grad, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::llvm::StringRef data_format = "NHWC"); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AvgPoolGradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AvgPoolOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AvgPoolOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AvgPoolOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AvgPoolOpGenericAdaptorBase(AvgPoolOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getKsizeAttr(); + ::mlir::ArrayAttr getKsize(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); +}; +} // namespace detail +template +class AvgPoolOpGenericAdaptor : public detail::AvgPoolOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AvgPoolOpGenericAdaptorBase; +public: + AvgPoolOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AvgPoolOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AvgPoolOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AvgPoolOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getValue() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AvgPoolOpAdaptor : public AvgPoolOpGenericAdaptor<::mlir::ValueRange> { +public: + using AvgPoolOpGenericAdaptor::AvgPoolOpGenericAdaptor; + AvgPoolOpAdaptor(AvgPoolOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AvgPoolOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AvgPoolOpAdaptor; + template + using GenericAdaptor = AvgPoolOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("data_format"), ::llvm::StringRef("ksize"), ::llvm::StringRef("padding"), ::llvm::StringRef("strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getKsizeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getKsizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.AvgPool"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getValue(); + ::mlir::OpOperand &getValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ArrayAttr getKsizeAttr(); + ::mlir::ArrayAttr getKsize(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setKsizeAttr(::mlir::ArrayAttr attr); + void setStridesAttr(::mlir::ArrayAttr attr); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeDataFormatAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value value, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value value, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::llvm::StringRef data_format = "NHWC"); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::llvm::StringRef data_format = "NHWC"); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AvgPoolOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::BatchDatasetV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BatchDatasetV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BatchDatasetV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BatchDatasetV2OpGenericAdaptorBase(BatchDatasetV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getParallelCopyAttr(); + bool getParallelCopy(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); +}; +} // namespace detail +template +class BatchDatasetV2OpGenericAdaptor : public detail::BatchDatasetV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BatchDatasetV2OpGenericAdaptorBase; +public: + BatchDatasetV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BatchDatasetV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BatchDatasetV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BatchDatasetV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputDataset() { + return (*getODSOperands(0).begin()); + } + + ValueT getBatchSize() { + return (*getODSOperands(1).begin()); + } + + ValueT getDropRemainder() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BatchDatasetV2OpAdaptor : public BatchDatasetV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using BatchDatasetV2OpGenericAdaptor::BatchDatasetV2OpGenericAdaptor; + BatchDatasetV2OpAdaptor(BatchDatasetV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BatchDatasetV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BatchDatasetV2OpAdaptor; + template + using GenericAdaptor = BatchDatasetV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("metadata"), ::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types"), ::llvm::StringRef("parallel_copy")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getMetadataAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getMetadataAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getParallelCopyAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getParallelCopyAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.BatchDatasetV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputDataset(); + ::mlir::TypedValue<::mlir::TensorType> getBatchSize(); + ::mlir::TypedValue<::mlir::TensorType> getDropRemainder(); + ::mlir::OpOperand &getInputDatasetMutable(); + ::mlir::OpOperand &getBatchSizeMutable(); + ::mlir::OpOperand &getDropRemainderMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::BoolAttr getParallelCopyAttr(); + bool getParallelCopy(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); + void setParallelCopyAttr(::mlir::BoolAttr attr); + void setParallelCopy(::std::optional attrValue); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + void setMetadataAttr(::mlir::StringAttr attr); + void setMetadata(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeParallelCopyAttr(); + ::mlir::Attribute removeMetadataAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, ::mlir::Value batch_size, ::mlir::Value drop_remainder, /*optional*/::mlir::BoolAttr parallel_copy, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, ::mlir::Value batch_size, ::mlir::Value drop_remainder, /*optional*/::mlir::BoolAttr parallel_copy, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, ::mlir::Value batch_size, ::mlir::Value drop_remainder, /*optional*/bool parallel_copy, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::llvm::StringRef metadata = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, ::mlir::Value batch_size, ::mlir::Value drop_remainder, /*optional*/bool parallel_copy, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::llvm::StringRef metadata = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::BatchDatasetV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::BatchFunctionOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BatchFunctionOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BatchFunctionOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BatchFunctionOpGenericAdaptorBase(BatchFunctionOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::SymbolRefAttr getFAttr(); + ::mlir::SymbolRefAttr getF(); + ::mlir::IntegerAttr getNumBatchThreadsAttr(); + uint64_t getNumBatchThreads(); + ::mlir::IntegerAttr getMaxBatchSizeAttr(); + uint64_t getMaxBatchSize(); + ::mlir::IntegerAttr getBatchTimeoutMicrosAttr(); + uint64_t getBatchTimeoutMicros(); + ::mlir::IntegerAttr getMaxEnqueuedBatchesAttr(); + uint64_t getMaxEnqueuedBatches(); + ::mlir::ArrayAttr getAllowedBatchSizesAttr(); + ::mlir::ArrayAttr getAllowedBatchSizes(); + ::mlir::StringAttr getContainerAttr(); + ::llvm::StringRef getContainer(); + ::mlir::StringAttr getSharedNameAttr(); + ::llvm::StringRef getSharedName(); + ::mlir::StringAttr getBatchingQueueAttr(); + ::llvm::StringRef getBatchingQueue(); + ::mlir::IntegerAttr getLowPriorityMaxBatchSizeAttr(); + uint64_t getLowPriorityMaxBatchSize(); + ::mlir::IntegerAttr getLowPriorityBatchTimeoutMicrosAttr(); + uint64_t getLowPriorityBatchTimeoutMicros(); + ::mlir::ArrayAttr getLowPriorityAllowedBatchSizesAttr(); + ::mlir::ArrayAttr getLowPriorityAllowedBatchSizes(); + ::mlir::IntegerAttr getLowPriorityMaxEnqueuedBatchesAttr(); + uint64_t getLowPriorityMaxEnqueuedBatches(); + ::mlir::BoolAttr getEnableLargeBatchSplittingAttr(); + bool getEnableLargeBatchSplitting(); +}; +} // namespace detail +template +class BatchFunctionOpGenericAdaptor : public detail::BatchFunctionOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BatchFunctionOpGenericAdaptorBase; +public: + BatchFunctionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BatchFunctionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BatchFunctionOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BatchFunctionOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInTensors() { + return getODSOperands(0); + } + + RangeT getCapturedTensors() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BatchFunctionOpAdaptor : public BatchFunctionOpGenericAdaptor<::mlir::ValueRange> { +public: + using BatchFunctionOpGenericAdaptor::BatchFunctionOpGenericAdaptor; + BatchFunctionOpAdaptor(BatchFunctionOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BatchFunctionOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = BatchFunctionOpAdaptor; + template + using GenericAdaptor = BatchFunctionOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tcaptured"), ::llvm::StringRef("Tin"), ::llvm::StringRef("Tout"), ::llvm::StringRef("allowed_batch_sizes"), ::llvm::StringRef("batch_timeout_micros"), ::llvm::StringRef("batching_queue"), ::llvm::StringRef("container"), ::llvm::StringRef("enable_large_batch_splitting"), ::llvm::StringRef("f"), ::llvm::StringRef("low_priority_allowed_batch_sizes"), ::llvm::StringRef("low_priority_batch_timeout_micros"), ::llvm::StringRef("low_priority_max_batch_size"), ::llvm::StringRef("low_priority_max_enqueued_batches"), ::llvm::StringRef("max_batch_size"), ::llvm::StringRef("max_enqueued_batches"), ::llvm::StringRef("num_batch_threads"), ::llvm::StringRef("operandSegmentSizes"), ::llvm::StringRef("shared_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTcapturedAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTcapturedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTinAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTinAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getToutAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getToutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getAllowedBatchSizesAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getAllowedBatchSizesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getBatchTimeoutMicrosAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getBatchTimeoutMicrosAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getBatchingQueueAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getBatchingQueueAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getContainerAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getContainerAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getEnableLargeBatchSplittingAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getEnableLargeBatchSplittingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getFAttrName() { + return getAttributeNameForIndex(8); + } + + static ::mlir::StringAttr getFAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 8); + } + + ::mlir::StringAttr getLowPriorityAllowedBatchSizesAttrName() { + return getAttributeNameForIndex(9); + } + + static ::mlir::StringAttr getLowPriorityAllowedBatchSizesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 9); + } + + ::mlir::StringAttr getLowPriorityBatchTimeoutMicrosAttrName() { + return getAttributeNameForIndex(10); + } + + static ::mlir::StringAttr getLowPriorityBatchTimeoutMicrosAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 10); + } + + ::mlir::StringAttr getLowPriorityMaxBatchSizeAttrName() { + return getAttributeNameForIndex(11); + } + + static ::mlir::StringAttr getLowPriorityMaxBatchSizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 11); + } + + ::mlir::StringAttr getLowPriorityMaxEnqueuedBatchesAttrName() { + return getAttributeNameForIndex(12); + } + + static ::mlir::StringAttr getLowPriorityMaxEnqueuedBatchesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 12); + } + + ::mlir::StringAttr getMaxBatchSizeAttrName() { + return getAttributeNameForIndex(13); + } + + static ::mlir::StringAttr getMaxBatchSizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 13); + } + + ::mlir::StringAttr getMaxEnqueuedBatchesAttrName() { + return getAttributeNameForIndex(14); + } + + static ::mlir::StringAttr getMaxEnqueuedBatchesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 14); + } + + ::mlir::StringAttr getNumBatchThreadsAttrName() { + return getAttributeNameForIndex(15); + } + + static ::mlir::StringAttr getNumBatchThreadsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 15); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return getAttributeNameForIndex(16); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 16); + } + + ::mlir::StringAttr getSharedNameAttrName() { + return getAttributeNameForIndex(17); + } + + static ::mlir::StringAttr getSharedNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 17); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.BatchFunction"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInTensors(); + ::mlir::Operation::operand_range getCapturedTensors(); + ::mlir::MutableOperandRange getInTensorsMutable(); + ::mlir::MutableOperandRange getCapturedTensorsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutTensors(); + ::mlir::SymbolRefAttr getFAttr(); + ::mlir::SymbolRefAttr getF(); + ::mlir::IntegerAttr getNumBatchThreadsAttr(); + uint64_t getNumBatchThreads(); + ::mlir::IntegerAttr getMaxBatchSizeAttr(); + uint64_t getMaxBatchSize(); + ::mlir::IntegerAttr getBatchTimeoutMicrosAttr(); + uint64_t getBatchTimeoutMicros(); + ::mlir::IntegerAttr getMaxEnqueuedBatchesAttr(); + uint64_t getMaxEnqueuedBatches(); + ::mlir::ArrayAttr getAllowedBatchSizesAttr(); + ::mlir::ArrayAttr getAllowedBatchSizes(); + ::mlir::StringAttr getContainerAttr(); + ::llvm::StringRef getContainer(); + ::mlir::StringAttr getSharedNameAttr(); + ::llvm::StringRef getSharedName(); + ::mlir::StringAttr getBatchingQueueAttr(); + ::llvm::StringRef getBatchingQueue(); + ::mlir::IntegerAttr getLowPriorityMaxBatchSizeAttr(); + uint64_t getLowPriorityMaxBatchSize(); + ::mlir::IntegerAttr getLowPriorityBatchTimeoutMicrosAttr(); + uint64_t getLowPriorityBatchTimeoutMicros(); + ::mlir::ArrayAttr getLowPriorityAllowedBatchSizesAttr(); + ::mlir::ArrayAttr getLowPriorityAllowedBatchSizes(); + ::mlir::IntegerAttr getLowPriorityMaxEnqueuedBatchesAttr(); + uint64_t getLowPriorityMaxEnqueuedBatches(); + ::mlir::BoolAttr getEnableLargeBatchSplittingAttr(); + bool getEnableLargeBatchSplitting(); + mlir::OperandElementTypeRange getTcaptured(); + mlir::OperandElementTypeRange getTin(); + mlir::ResultElementTypeRange getTout(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setFAttr(::mlir::SymbolRefAttr attr); + void setNumBatchThreadsAttr(::mlir::IntegerAttr attr); + void setNumBatchThreads(uint64_t attrValue); + void setMaxBatchSizeAttr(::mlir::IntegerAttr attr); + void setMaxBatchSize(uint64_t attrValue); + void setBatchTimeoutMicrosAttr(::mlir::IntegerAttr attr); + void setBatchTimeoutMicros(uint64_t attrValue); + void setMaxEnqueuedBatchesAttr(::mlir::IntegerAttr attr); + void setMaxEnqueuedBatches(::std::optional attrValue); + void setAllowedBatchSizesAttr(::mlir::ArrayAttr attr); + void setContainerAttr(::mlir::StringAttr attr); + void setContainer(::std::optional<::llvm::StringRef> attrValue); + void setSharedNameAttr(::mlir::StringAttr attr); + void setSharedName(::std::optional<::llvm::StringRef> attrValue); + void setBatchingQueueAttr(::mlir::StringAttr attr); + void setBatchingQueue(::std::optional<::llvm::StringRef> attrValue); + void setLowPriorityMaxBatchSizeAttr(::mlir::IntegerAttr attr); + void setLowPriorityMaxBatchSize(::std::optional attrValue); + void setLowPriorityBatchTimeoutMicrosAttr(::mlir::IntegerAttr attr); + void setLowPriorityBatchTimeoutMicros(::std::optional attrValue); + void setLowPriorityAllowedBatchSizesAttr(::mlir::ArrayAttr attr); + void setLowPriorityMaxEnqueuedBatchesAttr(::mlir::IntegerAttr attr); + void setLowPriorityMaxEnqueuedBatches(::std::optional attrValue); + void setEnableLargeBatchSplittingAttr(::mlir::BoolAttr attr); + void setEnableLargeBatchSplitting(::std::optional attrValue); + ::mlir::Attribute removeMaxEnqueuedBatchesAttr(); + ::mlir::Attribute removeAllowedBatchSizesAttr(); + ::mlir::Attribute removeContainerAttr(); + ::mlir::Attribute removeSharedNameAttr(); + ::mlir::Attribute removeBatchingQueueAttr(); + ::mlir::Attribute removeLowPriorityMaxBatchSizeAttr(); + ::mlir::Attribute removeLowPriorityBatchTimeoutMicrosAttr(); + ::mlir::Attribute removeLowPriorityAllowedBatchSizesAttr(); + ::mlir::Attribute removeLowPriorityMaxEnqueuedBatchesAttr(); + ::mlir::Attribute removeEnableLargeBatchSplittingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange out_tensors, ::mlir::ValueRange in_tensors, ::mlir::ValueRange captured_tensors, ::mlir::SymbolRefAttr f, ::mlir::IntegerAttr num_batch_threads, ::mlir::IntegerAttr max_batch_size, ::mlir::IntegerAttr batch_timeout_micros, /*optional*/::mlir::IntegerAttr max_enqueued_batches, /*optional*/::mlir::ArrayAttr allowed_batch_sizes, /*optional*/::mlir::StringAttr container, /*optional*/::mlir::StringAttr shared_name, /*optional*/::mlir::StringAttr batching_queue, /*optional*/::mlir::IntegerAttr low_priority_max_batch_size, /*optional*/::mlir::IntegerAttr low_priority_batch_timeout_micros, /*optional*/::mlir::ArrayAttr low_priority_allowed_batch_sizes, /*optional*/::mlir::IntegerAttr low_priority_max_enqueued_batches, /*optional*/::mlir::BoolAttr enable_large_batch_splitting); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange out_tensors, ::mlir::ValueRange in_tensors, ::mlir::ValueRange captured_tensors, ::mlir::SymbolRefAttr f, uint64_t num_batch_threads, uint64_t max_batch_size, uint64_t batch_timeout_micros, /*optional*/uint64_t max_enqueued_batches, /*optional*/::mlir::ArrayAttr allowed_batch_sizes, /*optional*/::llvm::StringRef container, /*optional*/::llvm::StringRef shared_name, /*optional*/::llvm::StringRef batching_queue, /*optional*/uint64_t low_priority_max_batch_size, /*optional*/uint64_t low_priority_batch_timeout_micros, /*optional*/::mlir::ArrayAttr low_priority_allowed_batch_sizes, /*optional*/uint64_t low_priority_max_enqueued_batches = 0, /*optional*/bool enable_large_batch_splitting = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verifySymbolUses(::mlir::SymbolTableCollection &symbolTable); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 18 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Returns the callee of this operation. + func::FuncOp func() { + return SymbolTable::lookupNearestSymbolFrom(*this, getF()); + } + + // Erases variable arguments from `batch_func_op`. `erase_indices` contains + // the indices of the arguments to erase. + void eraseArguments(const BitVector& erase_indices); + + // Gets the argument operands to the called function. + operand_range getArgOperands() { + // Merge `in_tensors` and `captured_tensors`. `operandSegmentSizes` + // has two elements, so it will be merging two operand ranges (the two + // variadic arguments). Attributes like `batch_timeout_micros` will not + // make it to the return array. + auto segment_sizes = getOperation()->getAttrOfType(getOperandSegmentSizeAttr()); + return OperandRangeRange(getOperands(), segment_sizes).join(); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::BatchFunctionOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::BatchMatMulOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BatchMatMulOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BatchMatMulOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BatchMatMulOpGenericAdaptorBase(BatchMatMulOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getAdjXAttr(); + bool getAdjX(); + ::mlir::BoolAttr getAdjYAttr(); + bool getAdjY(); +}; +} // namespace detail +template +class BatchMatMulOpGenericAdaptor : public detail::BatchMatMulOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BatchMatMulOpGenericAdaptorBase; +public: + BatchMatMulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BatchMatMulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BatchMatMulOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BatchMatMulOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BatchMatMulOpAdaptor : public BatchMatMulOpGenericAdaptor<::mlir::ValueRange> { +public: + using BatchMatMulOpGenericAdaptor::BatchMatMulOpGenericAdaptor; + BatchMatMulOpAdaptor(BatchMatMulOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BatchMatMulOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::SameOperandsAndResultElementTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BatchMatMulOpAdaptor; + template + using GenericAdaptor = BatchMatMulOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("adj_x"), ::llvm::StringRef("adj_y")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAdjXAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAdjXAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getAdjYAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getAdjYAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.BatchMatMul"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getAdjXAttr(); + bool getAdjX(); + ::mlir::BoolAttr getAdjYAttr(); + bool getAdjY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setAdjXAttr(::mlir::BoolAttr attr); + void setAdjX(::std::optional attrValue); + void setAdjYAttr(::mlir::BoolAttr attr); + void setAdjY(::std::optional attrValue); + ::mlir::Attribute removeAdjXAttr(); + ::mlir::Attribute removeAdjYAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value x, ::mlir::Value y, /*optional*/::mlir::BoolAttr adj_x, /*optional*/::mlir::BoolAttr adj_y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y, /*optional*/::mlir::BoolAttr adj_x, /*optional*/::mlir::BoolAttr adj_y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value x, ::mlir::Value y, /*optional*/bool adj_x = false, /*optional*/bool adj_y = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y, /*optional*/bool adj_x = false, /*optional*/bool adj_y = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::BatchMatMulOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::BatchMatMulV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BatchMatMulV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BatchMatMulV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BatchMatMulV2OpGenericAdaptorBase(BatchMatMulV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getAdjXAttr(); + bool getAdjX(); + ::mlir::BoolAttr getAdjYAttr(); + bool getAdjY(); +}; +} // namespace detail +template +class BatchMatMulV2OpGenericAdaptor : public detail::BatchMatMulV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BatchMatMulV2OpGenericAdaptorBase; +public: + BatchMatMulV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BatchMatMulV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BatchMatMulV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BatchMatMulV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BatchMatMulV2OpAdaptor : public BatchMatMulV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using BatchMatMulV2OpGenericAdaptor::BatchMatMulV2OpGenericAdaptor; + BatchMatMulV2OpAdaptor(BatchMatMulV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BatchMatMulV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::SameOperandsAndResultElementTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BatchMatMulV2OpAdaptor; + template + using GenericAdaptor = BatchMatMulV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("adj_x"), ::llvm::StringRef("adj_y")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAdjXAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAdjXAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getAdjYAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getAdjYAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.BatchMatMulV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getAdjXAttr(); + bool getAdjX(); + ::mlir::BoolAttr getAdjYAttr(); + bool getAdjY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setAdjXAttr(::mlir::BoolAttr attr); + void setAdjX(::std::optional attrValue); + void setAdjYAttr(::mlir::BoolAttr attr); + void setAdjY(::std::optional attrValue); + ::mlir::Attribute removeAdjXAttr(); + ::mlir::Attribute removeAdjYAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value x, ::mlir::Value y, /*optional*/::mlir::BoolAttr adj_x, /*optional*/::mlir::BoolAttr adj_y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y, /*optional*/::mlir::BoolAttr adj_x, /*optional*/::mlir::BoolAttr adj_y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value x, ::mlir::Value y, /*optional*/bool adj_x = false, /*optional*/bool adj_y = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y, /*optional*/bool adj_x = false, /*optional*/bool adj_y = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::BatchMatMulV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::BatchMatMulV3Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BatchMatMulV3OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BatchMatMulV3OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BatchMatMulV3OpGenericAdaptorBase(BatchMatMulV3Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getAdjXAttr(); + bool getAdjX(); + ::mlir::BoolAttr getAdjYAttr(); + bool getAdjY(); +}; +} // namespace detail +template +class BatchMatMulV3OpGenericAdaptor : public detail::BatchMatMulV3OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BatchMatMulV3OpGenericAdaptorBase; +public: + BatchMatMulV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BatchMatMulV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BatchMatMulV3OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BatchMatMulV3OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BatchMatMulV3OpAdaptor : public BatchMatMulV3OpGenericAdaptor<::mlir::ValueRange> { +public: + using BatchMatMulV3OpGenericAdaptor::BatchMatMulV3OpGenericAdaptor; + BatchMatMulV3OpAdaptor(BatchMatMulV3Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BatchMatMulV3Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BatchMatMulV3OpAdaptor; + template + using GenericAdaptor = BatchMatMulV3OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Ta"), ::llvm::StringRef("Tb"), ::llvm::StringRef("Tout"), ::llvm::StringRef("adj_x"), ::llvm::StringRef("adj_y")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTaAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTaAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTbAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTbAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getToutAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getToutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getAdjXAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getAdjXAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getAdjYAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getAdjYAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.BatchMatMulV3"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getAdjXAttr(); + bool getAdjX(); + ::mlir::BoolAttr getAdjYAttr(); + bool getAdjY(); + ::mlir::Type getTa(); + ::mlir::Type getTb(); + ::mlir::Type getTout(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setAdjXAttr(::mlir::BoolAttr attr); + void setAdjX(::std::optional attrValue); + void setAdjYAttr(::mlir::BoolAttr attr); + void setAdjY(::std::optional attrValue); + ::mlir::Attribute removeAdjXAttr(); + ::mlir::Attribute removeAdjYAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value x, ::mlir::Value y, /*optional*/::mlir::BoolAttr adj_x, /*optional*/::mlir::BoolAttr adj_y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y, /*optional*/::mlir::BoolAttr adj_x, /*optional*/::mlir::BoolAttr adj_y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value x, ::mlir::Value y, /*optional*/bool adj_x = false, /*optional*/bool adj_y = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y, /*optional*/bool adj_x = false, /*optional*/bool adj_y = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::BatchMatMulV3Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::BatchNormWithGlobalNormalizationOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BatchNormWithGlobalNormalizationOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BatchNormWithGlobalNormalizationOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BatchNormWithGlobalNormalizationOpGenericAdaptorBase(BatchNormWithGlobalNormalizationOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::FloatAttr getVarianceEpsilonAttr(); + ::llvm::APFloat getVarianceEpsilon(); + ::mlir::BoolAttr getScaleAfterNormalizationAttr(); + bool getScaleAfterNormalization(); +}; +} // namespace detail +template +class BatchNormWithGlobalNormalizationOpGenericAdaptor : public detail::BatchNormWithGlobalNormalizationOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BatchNormWithGlobalNormalizationOpGenericAdaptorBase; +public: + BatchNormWithGlobalNormalizationOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BatchNormWithGlobalNormalizationOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BatchNormWithGlobalNormalizationOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BatchNormWithGlobalNormalizationOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getM() { + return (*getODSOperands(1).begin()); + } + + ValueT getV() { + return (*getODSOperands(2).begin()); + } + + ValueT getBeta() { + return (*getODSOperands(3).begin()); + } + + ValueT getGamma() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BatchNormWithGlobalNormalizationOpAdaptor : public BatchNormWithGlobalNormalizationOpGenericAdaptor<::mlir::ValueRange> { +public: + using BatchNormWithGlobalNormalizationOpGenericAdaptor::BatchNormWithGlobalNormalizationOpGenericAdaptor; + BatchNormWithGlobalNormalizationOpAdaptor(BatchNormWithGlobalNormalizationOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BatchNormWithGlobalNormalizationOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<5>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BatchNormWithGlobalNormalizationOpAdaptor; + template + using GenericAdaptor = BatchNormWithGlobalNormalizationOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("scale_after_normalization"), ::llvm::StringRef("variance_epsilon")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getScaleAfterNormalizationAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getScaleAfterNormalizationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getVarianceEpsilonAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getVarianceEpsilonAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.BatchNormWithGlobalNormalization"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getM(); + ::mlir::TypedValue<::mlir::TensorType> getV(); + ::mlir::TypedValue<::mlir::TensorType> getBeta(); + ::mlir::TypedValue<::mlir::TensorType> getGamma(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getMMutable(); + ::mlir::OpOperand &getVMutable(); + ::mlir::OpOperand &getBetaMutable(); + ::mlir::OpOperand &getGammaMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResult(); + ::mlir::FloatAttr getVarianceEpsilonAttr(); + ::llvm::APFloat getVarianceEpsilon(); + ::mlir::BoolAttr getScaleAfterNormalizationAttr(); + bool getScaleAfterNormalization(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setVarianceEpsilonAttr(::mlir::FloatAttr attr); + void setVarianceEpsilon(::llvm::APFloat attrValue); + void setScaleAfterNormalizationAttr(::mlir::BoolAttr attr); + void setScaleAfterNormalization(bool attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value x, ::mlir::Value m, ::mlir::Value v, ::mlir::Value beta, ::mlir::Value gamma, ::mlir::FloatAttr variance_epsilon, ::mlir::BoolAttr scale_after_normalization); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value m, ::mlir::Value v, ::mlir::Value beta, ::mlir::Value gamma, ::mlir::FloatAttr variance_epsilon, ::mlir::BoolAttr scale_after_normalization); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value x, ::mlir::Value m, ::mlir::Value v, ::mlir::Value beta, ::mlir::Value gamma, ::llvm::APFloat variance_epsilon, bool scale_after_normalization); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value m, ::mlir::Value v, ::mlir::Value beta, ::mlir::Value gamma, ::llvm::APFloat variance_epsilon, bool scale_after_normalization); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::BatchNormWithGlobalNormalizationOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::BatchToSpaceNDOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BatchToSpaceNDOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BatchToSpaceNDOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BatchToSpaceNDOpGenericAdaptorBase(BatchToSpaceNDOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class BatchToSpaceNDOpGenericAdaptor : public detail::BatchToSpaceNDOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BatchToSpaceNDOpGenericAdaptorBase; +public: + BatchToSpaceNDOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BatchToSpaceNDOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BatchToSpaceNDOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BatchToSpaceNDOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getBlockShape() { + return (*getODSOperands(1).begin()); + } + + ValueT getCrops() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BatchToSpaceNDOpAdaptor : public BatchToSpaceNDOpGenericAdaptor<::mlir::ValueRange> { +public: + using BatchToSpaceNDOpGenericAdaptor::BatchToSpaceNDOpGenericAdaptor; + BatchToSpaceNDOpAdaptor(BatchToSpaceNDOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BatchToSpaceNDOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BatchToSpaceNDOpAdaptor; + template + using GenericAdaptor = BatchToSpaceNDOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tblock_shape"), ::llvm::StringRef("Tcrops")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTblockShapeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTblockShapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTcropsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTcropsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.BatchToSpaceND"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getBlockShape(); + ::mlir::TypedValue<::mlir::TensorType> getCrops(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getBlockShapeMutable(); + ::mlir::OpOperand &getCropsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTblockShape(); + ::mlir::Type getTcrops(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value block_shape, ::mlir::Value crops); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value block_shape, ::mlir::Value crops); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::BatchToSpaceNDOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::BatchToSpaceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BatchToSpaceOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BatchToSpaceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BatchToSpaceOpGenericAdaptorBase(BatchToSpaceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getBlockSizeAttr(); + uint64_t getBlockSize(); +}; +} // namespace detail +template +class BatchToSpaceOpGenericAdaptor : public detail::BatchToSpaceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BatchToSpaceOpGenericAdaptorBase; +public: + BatchToSpaceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BatchToSpaceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BatchToSpaceOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BatchToSpaceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getCrops() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BatchToSpaceOpAdaptor : public BatchToSpaceOpGenericAdaptor<::mlir::ValueRange> { +public: + using BatchToSpaceOpGenericAdaptor::BatchToSpaceOpGenericAdaptor; + BatchToSpaceOpAdaptor(BatchToSpaceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BatchToSpaceOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BatchToSpaceOpAdaptor; + template + using GenericAdaptor = BatchToSpaceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tidx"), ::llvm::StringRef("block_size")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTidxAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTidxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getBlockSizeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getBlockSizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.BatchToSpace"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getCrops(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getCropsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getBlockSizeAttr(); + uint64_t getBlockSize(); + ::mlir::Type getT(); + ::mlir::Type getTidx(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setBlockSizeAttr(::mlir::IntegerAttr attr); + void setBlockSize(uint64_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value crops, ::mlir::IntegerAttr block_size); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value crops, ::mlir::IntegerAttr block_size); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value crops, uint64_t block_size); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value crops, uint64_t block_size); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::BatchToSpaceOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::BesselI0eOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BesselI0eOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BesselI0eOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BesselI0eOpGenericAdaptorBase(BesselI0eOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class BesselI0eOpGenericAdaptor : public detail::BesselI0eOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BesselI0eOpGenericAdaptorBase; +public: + BesselI0eOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BesselI0eOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BesselI0eOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BesselI0eOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BesselI0eOpAdaptor : public BesselI0eOpGenericAdaptor<::mlir::ValueRange> { +public: + using BesselI0eOpGenericAdaptor::BesselI0eOpGenericAdaptor; + BesselI0eOpAdaptor(BesselI0eOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BesselI0eOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BesselI0eOpAdaptor; + template + using GenericAdaptor = BesselI0eOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.BesselI0e"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::BesselI0eOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::BesselI1eOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BesselI1eOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BesselI1eOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BesselI1eOpGenericAdaptorBase(BesselI1eOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class BesselI1eOpGenericAdaptor : public detail::BesselI1eOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BesselI1eOpGenericAdaptorBase; +public: + BesselI1eOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BesselI1eOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BesselI1eOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BesselI1eOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BesselI1eOpAdaptor : public BesselI1eOpGenericAdaptor<::mlir::ValueRange> { +public: + using BesselI1eOpGenericAdaptor::BesselI1eOpGenericAdaptor; + BesselI1eOpAdaptor(BesselI1eOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BesselI1eOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BesselI1eOpAdaptor; + template + using GenericAdaptor = BesselI1eOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.BesselI1e"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::BesselI1eOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::BetaincOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BetaincOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BetaincOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BetaincOpGenericAdaptorBase(BetaincOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class BetaincOpGenericAdaptor : public detail::BetaincOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BetaincOpGenericAdaptorBase; +public: + BetaincOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BetaincOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BetaincOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BetaincOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + ValueT getB() { + return (*getODSOperands(1).begin()); + } + + ValueT getX() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BetaincOpAdaptor : public BetaincOpGenericAdaptor<::mlir::ValueRange> { +public: + using BetaincOpGenericAdaptor::BetaincOpGenericAdaptor; + BetaincOpAdaptor(BetaincOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BetaincOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BetaincOpAdaptor; + template + using GenericAdaptor = BetaincOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Betainc"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getA(); + ::mlir::TypedValue<::mlir::TensorType> getB(); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getAMutable(); + ::mlir::OpOperand &getBMutable(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value a, ::mlir::Value b, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::BetaincOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::BiasAddGradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BiasAddGradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BiasAddGradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BiasAddGradOpGenericAdaptorBase(BiasAddGradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); +}; +} // namespace detail +template +class BiasAddGradOpGenericAdaptor : public detail::BiasAddGradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BiasAddGradOpGenericAdaptorBase; +public: + BiasAddGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BiasAddGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BiasAddGradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BiasAddGradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOutBackprop() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BiasAddGradOpAdaptor : public BiasAddGradOpGenericAdaptor<::mlir::ValueRange> { +public: + using BiasAddGradOpGenericAdaptor::BiasAddGradOpGenericAdaptor; + BiasAddGradOpAdaptor(BiasAddGradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BiasAddGradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BiasAddGradOpAdaptor; + template + using GenericAdaptor = BiasAddGradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("data_format")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.BiasAddGrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutBackprop(); + ::mlir::OpOperand &getOutBackpropMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeDataFormatAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value out_backprop, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value out_backprop, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value out_backprop, /*optional*/::llvm::StringRef data_format = "NHWC"); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value out_backprop, /*optional*/::llvm::StringRef data_format = "NHWC"); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::BiasAddGradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::BiasAddOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BiasAddOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BiasAddOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BiasAddOpGenericAdaptorBase(BiasAddOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); +}; +} // namespace detail +template +class BiasAddOpGenericAdaptor : public detail::BiasAddOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BiasAddOpGenericAdaptorBase; +public: + BiasAddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BiasAddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BiasAddOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BiasAddOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getValue() { + return (*getODSOperands(0).begin()); + } + + ValueT getBias() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BiasAddOpAdaptor : public BiasAddOpGenericAdaptor<::mlir::ValueRange> { +public: + using BiasAddOpGenericAdaptor::BiasAddOpGenericAdaptor; + BiasAddOpAdaptor(BiasAddOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BiasAddOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, LayoutSensitiveInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BiasAddOpAdaptor; + template + using GenericAdaptor = BiasAddOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("data_format")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.BiasAdd"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getValue(); + ::mlir::TypedValue<::mlir::TensorType> getBias(); + ::mlir::OpOperand &getValueMutable(); + ::mlir::OpOperand &getBiasMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeDataFormatAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value value, ::mlir::Value bias, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value bias, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value value, ::mlir::Value bias, /*optional*/::llvm::StringRef data_format = "NHWC"); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value bias, /*optional*/::llvm::StringRef data_format = "NHWC"); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // TF_LayoutSensitiveInterface: + SmallVector GetLayoutDependentArgs() { return {0}; } + SmallVector GetLayoutDependentResults() { return {0}; } + StringRef GetOptimalLayout(const RuntimeDevices& devices); + LogicalResult UpdateDataFormat(StringRef data_format); +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::BiasAddOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::BiasAddV1Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BiasAddV1OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BiasAddV1OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BiasAddV1OpGenericAdaptorBase(BiasAddV1Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class BiasAddV1OpGenericAdaptor : public detail::BiasAddV1OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BiasAddV1OpGenericAdaptorBase; +public: + BiasAddV1OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BiasAddV1OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BiasAddV1OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BiasAddV1OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getValue() { + return (*getODSOperands(0).begin()); + } + + ValueT getBias() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BiasAddV1OpAdaptor : public BiasAddV1OpGenericAdaptor<::mlir::ValueRange> { +public: + using BiasAddV1OpGenericAdaptor::BiasAddV1OpGenericAdaptor; + BiasAddV1OpAdaptor(BiasAddV1Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BiasAddV1Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BiasAddV1OpAdaptor; + template + using GenericAdaptor = BiasAddV1OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.BiasAddV1"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getValue(); + ::mlir::TypedValue<::mlir::TensorType> getBias(); + ::mlir::OpOperand &getValueMutable(); + ::mlir::OpOperand &getBiasMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value value, ::mlir::Value bias); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value bias); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::BiasAddV1Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::BincountOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BincountOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BincountOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BincountOpGenericAdaptorBase(BincountOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class BincountOpGenericAdaptor : public detail::BincountOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BincountOpGenericAdaptorBase; +public: + BincountOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BincountOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BincountOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BincountOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getArr() { + return (*getODSOperands(0).begin()); + } + + ValueT getSize() { + return (*getODSOperands(1).begin()); + } + + ValueT getWeights() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BincountOpAdaptor : public BincountOpGenericAdaptor<::mlir::ValueRange> { +public: + using BincountOpGenericAdaptor::BincountOpGenericAdaptor; + BincountOpAdaptor(BincountOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BincountOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BincountOpAdaptor; + template + using GenericAdaptor = BincountOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Bincount"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getArr(); + ::mlir::TypedValue<::mlir::TensorType> getSize(); + ::mlir::TypedValue<::mlir::TensorType> getWeights(); + ::mlir::OpOperand &getArrMutable(); + ::mlir::OpOperand &getSizeMutable(); + ::mlir::OpOperand &getWeightsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getBins(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type bins, ::mlir::Value arr, ::mlir::Value size, ::mlir::Value weights); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arr, ::mlir::Value size, ::mlir::Value weights); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::BincountOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::BitcastOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BitcastOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BitcastOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BitcastOpGenericAdaptorBase(BitcastOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class BitcastOpGenericAdaptor : public detail::BitcastOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BitcastOpGenericAdaptorBase; +public: + BitcastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BitcastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BitcastOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BitcastOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BitcastOpAdaptor : public BitcastOpGenericAdaptor<::mlir::ValueRange> { +public: + using BitcastOpGenericAdaptor::BitcastOpGenericAdaptor; + BitcastOpAdaptor(BitcastOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BitcastOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BitcastOpAdaptor; + template + using GenericAdaptor = BitcastOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("type")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Bitcast"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getType(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::BitcastOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::BitwiseAndOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BitwiseAndOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BitwiseAndOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BitwiseAndOpGenericAdaptorBase(BitwiseAndOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class BitwiseAndOpGenericAdaptor : public detail::BitwiseAndOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BitwiseAndOpGenericAdaptorBase; +public: + BitwiseAndOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BitwiseAndOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BitwiseAndOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BitwiseAndOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BitwiseAndOpAdaptor : public BitwiseAndOpGenericAdaptor<::mlir::ValueRange> { +public: + using BitwiseAndOpGenericAdaptor::BitwiseAndOpGenericAdaptor; + BitwiseAndOpAdaptor(BitwiseAndOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BitwiseAndOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsCommutative, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BitwiseAndOpAdaptor; + template + using GenericAdaptor = BitwiseAndOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.BitwiseAnd"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::BitwiseAndOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::BitwiseOrOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BitwiseOrOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BitwiseOrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BitwiseOrOpGenericAdaptorBase(BitwiseOrOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class BitwiseOrOpGenericAdaptor : public detail::BitwiseOrOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BitwiseOrOpGenericAdaptorBase; +public: + BitwiseOrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BitwiseOrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BitwiseOrOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BitwiseOrOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BitwiseOrOpAdaptor : public BitwiseOrOpGenericAdaptor<::mlir::ValueRange> { +public: + using BitwiseOrOpGenericAdaptor::BitwiseOrOpGenericAdaptor; + BitwiseOrOpAdaptor(BitwiseOrOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BitwiseOrOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsCommutative, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BitwiseOrOpAdaptor; + template + using GenericAdaptor = BitwiseOrOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.BitwiseOr"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::BitwiseOrOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::BitwiseXorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BitwiseXorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BitwiseXorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BitwiseXorOpGenericAdaptorBase(BitwiseXorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class BitwiseXorOpGenericAdaptor : public detail::BitwiseXorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BitwiseXorOpGenericAdaptorBase; +public: + BitwiseXorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BitwiseXorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BitwiseXorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BitwiseXorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BitwiseXorOpAdaptor : public BitwiseXorOpGenericAdaptor<::mlir::ValueRange> { +public: + using BitwiseXorOpGenericAdaptor::BitwiseXorOpGenericAdaptor; + BitwiseXorOpAdaptor(BitwiseXorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BitwiseXorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsCommutative, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BitwiseXorOpAdaptor; + template + using GenericAdaptor = BitwiseXorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.BitwiseXor"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::BitwiseXorOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::BoostedTreesBucketizeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BoostedTreesBucketizeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BoostedTreesBucketizeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BoostedTreesBucketizeOpGenericAdaptorBase(BoostedTreesBucketizeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class BoostedTreesBucketizeOpGenericAdaptor : public detail::BoostedTreesBucketizeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BoostedTreesBucketizeOpGenericAdaptorBase; +public: + BoostedTreesBucketizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BoostedTreesBucketizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BoostedTreesBucketizeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BoostedTreesBucketizeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getFloatValues() { + return getODSOperands(0); + } + + RangeT getBucketBoundaries() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BoostedTreesBucketizeOpAdaptor : public BoostedTreesBucketizeOpGenericAdaptor<::mlir::ValueRange> { +public: + using BoostedTreesBucketizeOpGenericAdaptor::BoostedTreesBucketizeOpGenericAdaptor; + BoostedTreesBucketizeOpAdaptor(BoostedTreesBucketizeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BoostedTreesBucketizeOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = BoostedTreesBucketizeOpAdaptor; + template + using GenericAdaptor = BoostedTreesBucketizeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("num_features")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNumFeaturesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNumFeaturesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.BoostedTreesBucketize"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getFloatValues(); + ::mlir::Operation::operand_range getBucketBoundaries(); + ::mlir::MutableOperandRange getFloatValuesMutable(); + ::mlir::MutableOperandRange getBucketBoundariesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getBuckets(); + size_t getNumFeatures(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange buckets, ::mlir::ValueRange float_values, ::mlir::ValueRange bucket_boundaries); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::BoostedTreesBucketizeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::BroadcastArgsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BroadcastArgsOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BroadcastArgsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BroadcastArgsOpGenericAdaptorBase(BroadcastArgsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class BroadcastArgsOpGenericAdaptor : public detail::BroadcastArgsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BroadcastArgsOpGenericAdaptorBase; +public: + BroadcastArgsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BroadcastArgsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BroadcastArgsOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BroadcastArgsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getS0() { + return (*getODSOperands(0).begin()); + } + + ValueT getS1() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BroadcastArgsOpAdaptor : public BroadcastArgsOpGenericAdaptor<::mlir::ValueRange> { +public: + using BroadcastArgsOpGenericAdaptor::BroadcastArgsOpGenericAdaptor; + BroadcastArgsOpAdaptor(BroadcastArgsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BroadcastArgsOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BroadcastArgsOpAdaptor; + template + using GenericAdaptor = BroadcastArgsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.BroadcastArgs"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getS0(); + ::mlir::TypedValue<::mlir::TensorType> getS1(); + ::mlir::OpOperand &getS0Mutable(); + ::mlir::OpOperand &getS1Mutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getR0(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type r0, ::mlir::Value s0, ::mlir::Value s1); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value s0, ::mlir::Value s1); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::BroadcastArgsOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::BroadcastGradientArgsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BroadcastGradientArgsOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BroadcastGradientArgsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BroadcastGradientArgsOpGenericAdaptorBase(BroadcastGradientArgsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class BroadcastGradientArgsOpGenericAdaptor : public detail::BroadcastGradientArgsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BroadcastGradientArgsOpGenericAdaptorBase; +public: + BroadcastGradientArgsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BroadcastGradientArgsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BroadcastGradientArgsOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BroadcastGradientArgsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getS0() { + return (*getODSOperands(0).begin()); + } + + ValueT getS1() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BroadcastGradientArgsOpAdaptor : public BroadcastGradientArgsOpGenericAdaptor<::mlir::ValueRange> { +public: + using BroadcastGradientArgsOpGenericAdaptor::BroadcastGradientArgsOpGenericAdaptor; + BroadcastGradientArgsOpAdaptor(BroadcastGradientArgsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BroadcastGradientArgsOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultElementType, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BroadcastGradientArgsOpAdaptor; + template + using GenericAdaptor = BroadcastGradientArgsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.BroadcastGradientArgs"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getS0(); + ::mlir::TypedValue<::mlir::TensorType> getS1(); + ::mlir::OpOperand &getS0Mutable(); + ::mlir::OpOperand &getS1Mutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getR0(); + ::mlir::TypedValue<::mlir::TensorType> getR1(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type r0, ::mlir::Type r1, ::mlir::Value s0, ::mlir::Value s1); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value s0, ::mlir::Value s1); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::BroadcastGradientArgsOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::BroadcastToOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BroadcastToOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BroadcastToOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BroadcastToOpGenericAdaptorBase(BroadcastToOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class BroadcastToOpGenericAdaptor : public detail::BroadcastToOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BroadcastToOpGenericAdaptorBase; +public: + BroadcastToOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BroadcastToOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BroadcastToOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BroadcastToOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getShape() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BroadcastToOpAdaptor : public BroadcastToOpGenericAdaptor<::mlir::ValueRange> { +public: + using BroadcastToOpGenericAdaptor::BroadcastToOpGenericAdaptor; + BroadcastToOpAdaptor(BroadcastToOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BroadcastToOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BroadcastToOpAdaptor; + template + using GenericAdaptor = BroadcastToOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tidx")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTidxAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTidxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.BroadcastTo"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getShapeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTidx(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value shape); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::BroadcastToOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::BucketizeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BucketizeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BucketizeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BucketizeOpGenericAdaptorBase(BucketizeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getBoundariesAttr(); + ::mlir::ArrayAttr getBoundaries(); +}; +} // namespace detail +template +class BucketizeOpGenericAdaptor : public detail::BucketizeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BucketizeOpGenericAdaptorBase; +public: + BucketizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BucketizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BucketizeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BucketizeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BucketizeOpAdaptor : public BucketizeOpGenericAdaptor<::mlir::ValueRange> { +public: + using BucketizeOpGenericAdaptor::BucketizeOpGenericAdaptor; + BucketizeOpAdaptor(BucketizeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BucketizeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BucketizeOpAdaptor; + template + using GenericAdaptor = BucketizeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("boundaries")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getBoundariesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getBoundariesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Bucketize"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ArrayAttr getBoundariesAttr(); + ::mlir::ArrayAttr getBoundaries(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setBoundariesAttr(::mlir::ArrayAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::ArrayAttr boundaries); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::ArrayAttr boundaries); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::BucketizeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::CacheDatasetV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CacheDatasetV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CacheDatasetV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CacheDatasetV2OpGenericAdaptorBase(CacheDatasetV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); +}; +} // namespace detail +template +class CacheDatasetV2OpGenericAdaptor : public detail::CacheDatasetV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CacheDatasetV2OpGenericAdaptorBase; +public: + CacheDatasetV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CacheDatasetV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CacheDatasetV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CacheDatasetV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputDataset() { + return (*getODSOperands(0).begin()); + } + + ValueT getFilename() { + return (*getODSOperands(1).begin()); + } + + ValueT getCache() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CacheDatasetV2OpAdaptor : public CacheDatasetV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using CacheDatasetV2OpGenericAdaptor::CacheDatasetV2OpGenericAdaptor; + CacheDatasetV2OpAdaptor(CacheDatasetV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CacheDatasetV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CacheDatasetV2OpAdaptor; + template + using GenericAdaptor = CacheDatasetV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("metadata"), ::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getMetadataAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getMetadataAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.CacheDatasetV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputDataset(); + ::mlir::TypedValue<::mlir::TensorType> getFilename(); + ::mlir::TypedValue<::mlir::TensorType> getCache(); + ::mlir::OpOperand &getInputDatasetMutable(); + ::mlir::OpOperand &getFilenameMutable(); + ::mlir::OpOperand &getCacheMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + void setMetadataAttr(::mlir::StringAttr attr); + void setMetadata(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeMetadataAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, ::mlir::Value filename, ::mlir::Value cache, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, ::mlir::Value filename, ::mlir::Value cache, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, ::mlir::Value filename, ::mlir::Value cache, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::llvm::StringRef metadata = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, ::mlir::Value filename, ::mlir::Value cache, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::llvm::StringRef metadata = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::CacheDatasetV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::CaseOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CaseOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CaseOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CaseOpGenericAdaptorBase(CaseOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getBranchesAttr(); + ::mlir::ArrayAttr getBranches(); + ::mlir::BoolAttr getIsStatelessAttr(); + bool getIsStateless(); +}; +} // namespace detail +template +class CaseOpGenericAdaptor : public detail::CaseOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CaseOpGenericAdaptorBase; +public: + CaseOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CaseOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CaseOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CaseOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getBranchIndex() { + return (*getODSOperands(0).begin()); + } + + RangeT getInput() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CaseOpAdaptor : public CaseOpGenericAdaptor<::mlir::ValueRange> { +public: + using CaseOpGenericAdaptor::CaseOpGenericAdaptor; + CaseOpAdaptor(CaseOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CaseOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::SymbolUserOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CaseOpAdaptor; + template + using GenericAdaptor = CaseOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tin"), ::llvm::StringRef("Tout"), ::llvm::StringRef("branches"), ::llvm::StringRef("is_stateless"), ::llvm::StringRef("output_shapes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTinAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTinAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getToutAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getToutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getBranchesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getBranchesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getIsStatelessAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getIsStatelessAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Case"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getBranchIndex(); + ::mlir::Operation::operand_range getInput(); + ::mlir::OpOperand &getBranchIndexMutable(); + ::mlir::MutableOperandRange getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutput(); + ::mlir::ArrayAttr getBranchesAttr(); + ::mlir::ArrayAttr getBranches(); + ::mlir::BoolAttr getIsStatelessAttr(); + bool getIsStateless(); + mlir::OperandElementTypeRange getTin(); + mlir::ResultElementTypeRange getTout(); + mlir::TF::ResultShapeRange getOutputShapes(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setBranchesAttr(::mlir::ArrayAttr attr); + void setIsStatelessAttr(::mlir::BoolAttr attr); + void setIsStateless(bool attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::Value branch_index, ::mlir::ValueRange input, ::mlir::ArrayAttr branches, ::mlir::BoolAttr is_stateless); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::Value branch_index, ::mlir::ValueRange input, ::mlir::ArrayAttr branches, bool is_stateless); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::LogicalResult verifySymbolUses(::mlir::SymbolTableCollection &symbolTable); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + int num_branches() { return getBranches().size(); } + + // Gets function corresponding branch # `index`. + // Prefer passing in SymbolTableCollection to reduce lookup costs by + // enabling reusing cached symbol table lookup. + func::FuncOp ResolveBranchFunction(::mlir::SymbolTableCollection* table, int index) { + auto flat_sym_ref = getBranches()[index].cast(); + if (table) + return table->lookupNearestSymbolFrom(*this, flat_sym_ref); + return SymbolTable::lookupNearestSymbolFrom(*this, flat_sym_ref); + } + // TODO(b/204997177): Deprecate and remove. + func::FuncOp branch_function(int index) { return ResolveBranchFunction(nullptr, index); } + + // Resolve all branch functions. + // Prefer passing in SymbolTableCollection to reduce lookup costs by + // enabling reusing cached symbol table lookup. + void ResolveBranchFunctions(::mlir::SymbolTableCollection* table, + SmallVectorImpl &functions) { + functions.reserve(num_branches()); + for (int idx : llvm::seq(0, num_branches())) + functions.push_back(ResolveBranchFunction(table, idx)); + } + // TODO(b/204997177): Deprecate and remove. + void get_branch_functions(SmallVectorImpl &functions) { + return ResolveBranchFunctions(nullptr, functions); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::CaseOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::CaseRegionOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CaseRegionOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CaseRegionOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CaseRegionOpGenericAdaptorBase(CaseRegionOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getIsStatelessAttr(); + bool getIsStateless(); + ::mlir::RegionRange getBranches(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class CaseRegionOpGenericAdaptor : public detail::CaseRegionOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CaseRegionOpGenericAdaptorBase; +public: + CaseRegionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CaseRegionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CaseRegionOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CaseRegionOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getBranchIndex() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CaseRegionOpAdaptor : public CaseRegionOpGenericAdaptor<::mlir::ValueRange> { +public: + using CaseRegionOpGenericAdaptor::CaseRegionOpGenericAdaptor; + CaseRegionOpAdaptor(CaseRegionOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CaseRegionOp : public ::mlir::Op::Impl, ::mlir::OpTrait::NoRegionArguments, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = CaseRegionOpAdaptor; + template + using GenericAdaptor = CaseRegionOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("is_stateless")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getIsStatelessAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getIsStatelessAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.CaseRegion"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getBranchIndex(); + ::mlir::OpOperand &getBranchIndexMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutput(); + ::mlir::MutableArrayRef<::mlir::Region> getBranches(); + ::mlir::BoolAttr getIsStatelessAttr(); + bool getIsStateless(); + void setIsStatelessAttr(::mlir::BoolAttr attr); + void setIsStateless(bool attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::Value branch_index, ::mlir::BoolAttr is_stateless, unsigned branchesCount); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::Value branch_index, bool is_stateless, unsigned branchesCount); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes, unsigned numRegions); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::CaseRegionOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::CastOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CastOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CastOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CastOpGenericAdaptorBase(CastOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getTruncateAttr(); + bool getTruncate(); +}; +} // namespace detail +template +class CastOpGenericAdaptor : public detail::CastOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CastOpGenericAdaptorBase; +public: + CastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CastOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CastOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CastOpAdaptor : public CastOpGenericAdaptor<::mlir::ValueRange> { +public: + using CastOpGenericAdaptor::CastOpGenericAdaptor; + CastOpAdaptor(CastOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CastOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CastOpAdaptor; + template + using GenericAdaptor = CastOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("DstT"), ::llvm::StringRef("SrcT"), ::llvm::StringRef("Truncate")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDstTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDstTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getSrcTAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getSrcTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTruncateAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTruncateAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Cast"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::BoolAttr getTruncateAttr(); + bool getTruncate(); + ::mlir::Type getSrcT(); + ::mlir::Type getDstT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setTruncateAttr(::mlir::BoolAttr attr); + void setTruncate(::std::optional attrValue); + ::mlir::Attribute removeTruncateAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x, /*optional*/::mlir::BoolAttr Truncate); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, /*optional*/::mlir::BoolAttr Truncate); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x, /*optional*/bool Truncate = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, /*optional*/bool Truncate = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::CastOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::CeilOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CeilOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CeilOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CeilOpGenericAdaptorBase(CeilOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CeilOpGenericAdaptor : public detail::CeilOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CeilOpGenericAdaptorBase; +public: + CeilOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CeilOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CeilOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CeilOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CeilOpAdaptor : public CeilOpGenericAdaptor<::mlir::ValueRange> { +public: + using CeilOpGenericAdaptor::CeilOpGenericAdaptor; + CeilOpAdaptor(CeilOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CeilOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::IsIdempotent, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CeilOpAdaptor; + template + using GenericAdaptor = CeilOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Ceil"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::CeilOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::CheckNumericsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CheckNumericsOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CheckNumericsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CheckNumericsOpGenericAdaptorBase(CheckNumericsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getMessageAttr(); + ::llvm::StringRef getMessage(); +}; +} // namespace detail +template +class CheckNumericsOpGenericAdaptor : public detail::CheckNumericsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CheckNumericsOpGenericAdaptorBase; +public: + CheckNumericsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CheckNumericsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CheckNumericsOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CheckNumericsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTensor() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CheckNumericsOpAdaptor : public CheckNumericsOpGenericAdaptor<::mlir::ValueRange> { +public: + using CheckNumericsOpGenericAdaptor::CheckNumericsOpGenericAdaptor; + CheckNumericsOpAdaptor(CheckNumericsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CheckNumericsOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CheckNumericsOpAdaptor; + template + using GenericAdaptor = CheckNumericsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("message")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getMessageAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getMessageAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.CheckNumerics"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::OpOperand &getTensorMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::StringAttr getMessageAttr(); + ::llvm::StringRef getMessage(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setMessageAttr(::mlir::StringAttr attr); + void setMessage(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value tensor, ::mlir::StringAttr message); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value tensor, ::mlir::StringAttr message); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tensor, ::mlir::StringAttr message); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value tensor, ::llvm::StringRef message); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value tensor, ::llvm::StringRef message); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tensor, ::llvm::StringRef message); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::CheckNumericsOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::CholeskyOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CholeskyOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CholeskyOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CholeskyOpGenericAdaptorBase(CholeskyOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CholeskyOpGenericAdaptor : public detail::CholeskyOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CholeskyOpGenericAdaptorBase; +public: + CholeskyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CholeskyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CholeskyOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CholeskyOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CholeskyOpAdaptor : public CholeskyOpGenericAdaptor<::mlir::ValueRange> { +public: + using CholeskyOpGenericAdaptor::CholeskyOpGenericAdaptor; + CholeskyOpAdaptor(CholeskyOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CholeskyOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CholeskyOpAdaptor; + template + using GenericAdaptor = CholeskyOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Cholesky"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::CholeskyOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ClipByValueOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ClipByValueOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ClipByValueOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ClipByValueOpGenericAdaptorBase(ClipByValueOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ClipByValueOpGenericAdaptor : public detail::ClipByValueOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ClipByValueOpGenericAdaptorBase; +public: + ClipByValueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ClipByValueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ClipByValueOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ClipByValueOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getClipValueMin() { + return (*getODSOperands(1).begin()); + } + + ValueT getClipValueMax() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ClipByValueOpAdaptor : public ClipByValueOpGenericAdaptor<::mlir::ValueRange> { +public: + using ClipByValueOpGenericAdaptor::ClipByValueOpGenericAdaptor; + ClipByValueOpAdaptor(ClipByValueOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ClipByValueOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::SameOperandsAndResultElementTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ClipByValueOpAdaptor; + template + using GenericAdaptor = ClipByValueOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ClipByValue"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getClipValueMin(); + ::mlir::TypedValue<::mlir::TensorType> getClipValueMax(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getClipValueMinMutable(); + ::mlir::OpOperand &getClipValueMaxMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value x, ::mlir::Value clip_value_min, ::mlir::Value clip_value_max); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value clip_value_min, ::mlir::Value clip_value_max); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ClipByValueOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::CloseSummaryWriterOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CloseSummaryWriterOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CloseSummaryWriterOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CloseSummaryWriterOpGenericAdaptorBase(CloseSummaryWriterOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CloseSummaryWriterOpGenericAdaptor : public detail::CloseSummaryWriterOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CloseSummaryWriterOpGenericAdaptorBase; +public: + CloseSummaryWriterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CloseSummaryWriterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CloseSummaryWriterOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CloseSummaryWriterOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getWriter() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CloseSummaryWriterOpAdaptor : public CloseSummaryWriterOpGenericAdaptor<::mlir::ValueRange> { +public: + using CloseSummaryWriterOpGenericAdaptor::CloseSummaryWriterOpGenericAdaptor; + CloseSummaryWriterOpAdaptor(CloseSummaryWriterOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CloseSummaryWriterOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = CloseSummaryWriterOpAdaptor; + template + using GenericAdaptor = CloseSummaryWriterOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.CloseSummaryWriter"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getWriter(); + ::mlir::OpOperand &getWriterMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value writer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value writer); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::CloseSummaryWriterOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::CollateTPUEmbeddingMemoryOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CollateTPUEmbeddingMemoryOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CollateTPUEmbeddingMemoryOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CollateTPUEmbeddingMemoryOpGenericAdaptorBase(CollateTPUEmbeddingMemoryOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CollateTPUEmbeddingMemoryOpGenericAdaptor : public detail::CollateTPUEmbeddingMemoryOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CollateTPUEmbeddingMemoryOpGenericAdaptorBase; +public: + CollateTPUEmbeddingMemoryOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CollateTPUEmbeddingMemoryOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CollateTPUEmbeddingMemoryOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CollateTPUEmbeddingMemoryOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getMemoryConfigs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CollateTPUEmbeddingMemoryOpAdaptor : public CollateTPUEmbeddingMemoryOpGenericAdaptor<::mlir::ValueRange> { +public: + using CollateTPUEmbeddingMemoryOpGenericAdaptor::CollateTPUEmbeddingMemoryOpGenericAdaptor; + CollateTPUEmbeddingMemoryOpAdaptor(CollateTPUEmbeddingMemoryOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CollateTPUEmbeddingMemoryOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CollateTPUEmbeddingMemoryOpAdaptor; + template + using GenericAdaptor = CollateTPUEmbeddingMemoryOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("N")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.CollateTPUEmbeddingMemory"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getMemoryConfigs(); + ::mlir::MutableOperandRange getMemoryConfigsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getMergedMemoryConfig(); + size_t getN(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type merged_memory_config, ::mlir::ValueRange memory_configs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::CollateTPUEmbeddingMemoryOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::CollectiveAllToAllV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CollectiveAllToAllV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CollectiveAllToAllV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CollectiveAllToAllV2OpGenericAdaptorBase(CollectiveAllToAllV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getCommunicationHintAttr(); + ::llvm::StringRef getCommunicationHint(); + ::mlir::FloatAttr getTimeoutSecondsAttr(); + ::llvm::APFloat getTimeoutSeconds(); + ::mlir::BoolAttr getIsStatelessAttr(); + bool getIsStateless(); +}; +} // namespace detail +template +class CollectiveAllToAllV2OpGenericAdaptor : public detail::CollectiveAllToAllV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CollectiveAllToAllV2OpGenericAdaptorBase; +public: + CollectiveAllToAllV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CollectiveAllToAllV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CollectiveAllToAllV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CollectiveAllToAllV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getGroupSize() { + return (*getODSOperands(1).begin()); + } + + ValueT getGroupKey() { + return (*getODSOperands(2).begin()); + } + + ValueT getInstanceKey() { + return (*getODSOperands(3).begin()); + } + + RangeT getOrderingToken() { + return getODSOperands(4); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CollectiveAllToAllV2OpAdaptor : public CollectiveAllToAllV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using CollectiveAllToAllV2OpGenericAdaptor::CollectiveAllToAllV2OpGenericAdaptor; + CollectiveAllToAllV2OpAdaptor(CollectiveAllToAllV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CollectiveAllToAllV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, GetResourceInstanceInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CollectiveAllToAllV2OpAdaptor; + template + using GenericAdaptor = CollectiveAllToAllV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Nordering_token"), ::llvm::StringRef("T"), ::llvm::StringRef("communication_hint"), ::llvm::StringRef("is_stateless"), ::llvm::StringRef("timeout_seconds")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNorderingTokenAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNorderingTokenAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getCommunicationHintAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getCommunicationHintAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getIsStatelessAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getIsStatelessAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTimeoutSecondsAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTimeoutSecondsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.CollectiveAllToAllV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getGroupSize(); + ::mlir::TypedValue<::mlir::TensorType> getGroupKey(); + ::mlir::TypedValue<::mlir::TensorType> getInstanceKey(); + ::mlir::Operation::operand_range getOrderingToken(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getGroupSizeMutable(); + ::mlir::OpOperand &getGroupKeyMutable(); + ::mlir::OpOperand &getInstanceKeyMutable(); + ::mlir::MutableOperandRange getOrderingTokenMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getData(); + ::mlir::StringAttr getCommunicationHintAttr(); + ::llvm::StringRef getCommunicationHint(); + ::mlir::FloatAttr getTimeoutSecondsAttr(); + ::llvm::APFloat getTimeoutSeconds(); + ::mlir::BoolAttr getIsStatelessAttr(); + bool getIsStateless(); + size_t getNorderingToken(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setCommunicationHintAttr(::mlir::StringAttr attr); + void setCommunicationHint(::std::optional<::llvm::StringRef> attrValue); + void setTimeoutSecondsAttr(::mlir::FloatAttr attr); + void setTimeoutSeconds(::std::optional<::llvm::APFloat> attrValue); + void setIsStatelessAttr(::mlir::BoolAttr attr); + void setIsStateless(::std::optional attrValue); + ::mlir::Attribute removeCommunicationHintAttr(); + ::mlir::Attribute removeTimeoutSecondsAttr(); + ::mlir::Attribute removeIsStatelessAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type data, ::mlir::Value input, ::mlir::Value group_size, ::mlir::Value group_key, ::mlir::Value instance_key, ::mlir::ValueRange ordering_token, /*optional*/::mlir::StringAttr communication_hint, /*optional*/::mlir::FloatAttr timeout_seconds, /*optional*/::mlir::BoolAttr is_stateless); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value group_size, ::mlir::Value group_key, ::mlir::Value instance_key, ::mlir::ValueRange ordering_token, /*optional*/::mlir::StringAttr communication_hint, /*optional*/::mlir::FloatAttr timeout_seconds, /*optional*/::mlir::BoolAttr is_stateless); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type data, ::mlir::Value input, ::mlir::Value group_size, ::mlir::Value group_key, ::mlir::Value instance_key, ::mlir::ValueRange ordering_token, /*optional*/::llvm::StringRef communication_hint, /*optional*/::llvm::APFloat timeout_seconds, /*optional*/bool is_stateless = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value group_size, ::mlir::Value group_key, ::mlir::Value instance_key, ::mlir::ValueRange ordering_token, /*optional*/::llvm::StringRef communication_hint, /*optional*/::llvm::APFloat timeout_seconds, /*optional*/bool is_stateless = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + std::optional GetResourceInstanceStr(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::CollectiveAllToAllV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::CollectiveAssignGroupV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CollectiveAssignGroupV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CollectiveAssignGroupV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CollectiveAssignGroupV2OpGenericAdaptorBase(CollectiveAssignGroupV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CollectiveAssignGroupV2OpGenericAdaptor : public detail::CollectiveAssignGroupV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CollectiveAssignGroupV2OpGenericAdaptorBase; +public: + CollectiveAssignGroupV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CollectiveAssignGroupV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CollectiveAssignGroupV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CollectiveAssignGroupV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getGroupAssignment() { + return (*getODSOperands(0).begin()); + } + + ValueT getDeviceIndex() { + return (*getODSOperands(1).begin()); + } + + ValueT getBaseKey() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CollectiveAssignGroupV2OpAdaptor : public CollectiveAssignGroupV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using CollectiveAssignGroupV2OpGenericAdaptor::CollectiveAssignGroupV2OpGenericAdaptor; + CollectiveAssignGroupV2OpAdaptor(CollectiveAssignGroupV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CollectiveAssignGroupV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CollectiveAssignGroupV2OpAdaptor; + template + using GenericAdaptor = CollectiveAssignGroupV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.CollectiveAssignGroupV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getGroupAssignment(); + ::mlir::TypedValue<::mlir::TensorType> getDeviceIndex(); + ::mlir::TypedValue<::mlir::TensorType> getBaseKey(); + ::mlir::OpOperand &getGroupAssignmentMutable(); + ::mlir::OpOperand &getDeviceIndexMutable(); + ::mlir::OpOperand &getBaseKeyMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getGroupSize(); + ::mlir::TypedValue<::mlir::TensorType> getGroupKey(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type group_size, ::mlir::Type group_key, ::mlir::Value group_assignment, ::mlir::Value device_index, ::mlir::Value base_key); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value group_assignment, ::mlir::Value device_index, ::mlir::Value base_key); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::CollectiveAssignGroupV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::CollectiveBcastRecvOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CollectiveBcastRecvOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CollectiveBcastRecvOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CollectiveBcastRecvOpGenericAdaptorBase(CollectiveBcastRecvOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getGroupSizeAttr(); + uint64_t getGroupSize(); + ::mlir::IntegerAttr getGroupKeyAttr(); + uint64_t getGroupKey(); + ::mlir::IntegerAttr getInstanceKeyAttr(); + uint64_t getInstanceKey(); + ::mlir::Attribute getShapeAttr(); + std::optional> getShape(); + ::mlir::StringAttr getCommunicationHintAttr(); + ::llvm::StringRef getCommunicationHint(); + ::mlir::FloatAttr getTimeoutSecondsAttr(); + ::llvm::APFloat getTimeoutSeconds(); +}; +} // namespace detail +template +class CollectiveBcastRecvOpGenericAdaptor : public detail::CollectiveBcastRecvOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CollectiveBcastRecvOpGenericAdaptorBase; +public: + CollectiveBcastRecvOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CollectiveBcastRecvOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CollectiveBcastRecvOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CollectiveBcastRecvOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CollectiveBcastRecvOpAdaptor : public CollectiveBcastRecvOpGenericAdaptor<::mlir::ValueRange> { +public: + using CollectiveBcastRecvOpGenericAdaptor::CollectiveBcastRecvOpGenericAdaptor; + CollectiveBcastRecvOpAdaptor(CollectiveBcastRecvOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CollectiveBcastRecvOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CollectiveBcastRecvOpAdaptor; + template + using GenericAdaptor = CollectiveBcastRecvOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("communication_hint"), ::llvm::StringRef("group_key"), ::llvm::StringRef("group_size"), ::llvm::StringRef("instance_key"), ::llvm::StringRef("shape"), ::llvm::StringRef("timeout_seconds")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getCommunicationHintAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getCommunicationHintAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getGroupKeyAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getGroupKeyAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getGroupSizeAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getGroupSizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getInstanceKeyAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getInstanceKeyAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getShapeAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getShapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getTimeoutSecondsAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getTimeoutSecondsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.CollectiveBcastRecv"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getData(); + ::mlir::IntegerAttr getGroupSizeAttr(); + uint64_t getGroupSize(); + ::mlir::IntegerAttr getGroupKeyAttr(); + uint64_t getGroupKey(); + ::mlir::IntegerAttr getInstanceKeyAttr(); + uint64_t getInstanceKey(); + ::mlir::Attribute getShapeAttr(); + std::optional> getShape(); + ::mlir::StringAttr getCommunicationHintAttr(); + ::llvm::StringRef getCommunicationHint(); + ::mlir::FloatAttr getTimeoutSecondsAttr(); + ::llvm::APFloat getTimeoutSeconds(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setGroupSizeAttr(::mlir::IntegerAttr attr); + void setGroupSize(uint64_t attrValue); + void setGroupKeyAttr(::mlir::IntegerAttr attr); + void setGroupKey(uint64_t attrValue); + void setInstanceKeyAttr(::mlir::IntegerAttr attr); + void setInstanceKey(uint64_t attrValue); + void setShapeAttr(::mlir::Attribute attr); + void setShape(std::optional> attrValue); + void setCommunicationHintAttr(::mlir::StringAttr attr); + void setCommunicationHint(::std::optional<::llvm::StringRef> attrValue); + void setTimeoutSecondsAttr(::mlir::FloatAttr attr); + void setTimeoutSeconds(::std::optional<::llvm::APFloat> attrValue); + ::mlir::Attribute removeCommunicationHintAttr(); + ::mlir::Attribute removeTimeoutSecondsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type data, ::mlir::IntegerAttr group_size, ::mlir::IntegerAttr group_key, ::mlir::IntegerAttr instance_key, ::mlir::Attribute shape, /*optional*/::mlir::StringAttr communication_hint, /*optional*/::mlir::FloatAttr timeout_seconds); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr group_size, ::mlir::IntegerAttr group_key, ::mlir::IntegerAttr instance_key, ::mlir::Attribute shape, /*optional*/::mlir::StringAttr communication_hint, /*optional*/::mlir::FloatAttr timeout_seconds); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type data, uint64_t group_size, uint64_t group_key, uint64_t instance_key, std::optional> shape, /*optional*/::llvm::StringRef communication_hint, /*optional*/::llvm::APFloat timeout_seconds); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, uint64_t group_size, uint64_t group_key, uint64_t instance_key, std::optional> shape, /*optional*/::llvm::StringRef communication_hint, /*optional*/::llvm::APFloat timeout_seconds); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 7 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::CollectiveBcastRecvOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::CollectiveBcastSendOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CollectiveBcastSendOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CollectiveBcastSendOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CollectiveBcastSendOpGenericAdaptorBase(CollectiveBcastSendOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getGroupSizeAttr(); + uint64_t getGroupSize(); + ::mlir::IntegerAttr getGroupKeyAttr(); + uint64_t getGroupKey(); + ::mlir::IntegerAttr getInstanceKeyAttr(); + uint64_t getInstanceKey(); + ::mlir::Attribute getShapeAttr(); + std::optional> getShape(); + ::mlir::StringAttr getCommunicationHintAttr(); + ::llvm::StringRef getCommunicationHint(); + ::mlir::FloatAttr getTimeoutSecondsAttr(); + ::llvm::APFloat getTimeoutSeconds(); +}; +} // namespace detail +template +class CollectiveBcastSendOpGenericAdaptor : public detail::CollectiveBcastSendOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CollectiveBcastSendOpGenericAdaptorBase; +public: + CollectiveBcastSendOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CollectiveBcastSendOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CollectiveBcastSendOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CollectiveBcastSendOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CollectiveBcastSendOpAdaptor : public CollectiveBcastSendOpGenericAdaptor<::mlir::ValueRange> { +public: + using CollectiveBcastSendOpGenericAdaptor::CollectiveBcastSendOpGenericAdaptor; + CollectiveBcastSendOpAdaptor(CollectiveBcastSendOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CollectiveBcastSendOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CollectiveBcastSendOpAdaptor; + template + using GenericAdaptor = CollectiveBcastSendOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("communication_hint"), ::llvm::StringRef("group_key"), ::llvm::StringRef("group_size"), ::llvm::StringRef("instance_key"), ::llvm::StringRef("shape"), ::llvm::StringRef("timeout_seconds")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getCommunicationHintAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getCommunicationHintAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getGroupKeyAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getGroupKeyAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getGroupSizeAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getGroupSizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getInstanceKeyAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getInstanceKeyAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getShapeAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getShapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getTimeoutSecondsAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getTimeoutSecondsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.CollectiveBcastSend"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getData(); + ::mlir::IntegerAttr getGroupSizeAttr(); + uint64_t getGroupSize(); + ::mlir::IntegerAttr getGroupKeyAttr(); + uint64_t getGroupKey(); + ::mlir::IntegerAttr getInstanceKeyAttr(); + uint64_t getInstanceKey(); + ::mlir::Attribute getShapeAttr(); + std::optional> getShape(); + ::mlir::StringAttr getCommunicationHintAttr(); + ::llvm::StringRef getCommunicationHint(); + ::mlir::FloatAttr getTimeoutSecondsAttr(); + ::llvm::APFloat getTimeoutSeconds(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setGroupSizeAttr(::mlir::IntegerAttr attr); + void setGroupSize(uint64_t attrValue); + void setGroupKeyAttr(::mlir::IntegerAttr attr); + void setGroupKey(uint64_t attrValue); + void setInstanceKeyAttr(::mlir::IntegerAttr attr); + void setInstanceKey(uint64_t attrValue); + void setShapeAttr(::mlir::Attribute attr); + void setShape(std::optional> attrValue); + void setCommunicationHintAttr(::mlir::StringAttr attr); + void setCommunicationHint(::std::optional<::llvm::StringRef> attrValue); + void setTimeoutSecondsAttr(::mlir::FloatAttr attr); + void setTimeoutSeconds(::std::optional<::llvm::APFloat> attrValue); + ::mlir::Attribute removeCommunicationHintAttr(); + ::mlir::Attribute removeTimeoutSecondsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type data, ::mlir::Value input, ::mlir::IntegerAttr group_size, ::mlir::IntegerAttr group_key, ::mlir::IntegerAttr instance_key, ::mlir::Attribute shape, /*optional*/::mlir::StringAttr communication_hint, /*optional*/::mlir::FloatAttr timeout_seconds); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::IntegerAttr group_size, ::mlir::IntegerAttr group_key, ::mlir::IntegerAttr instance_key, ::mlir::Attribute shape, /*optional*/::mlir::StringAttr communication_hint, /*optional*/::mlir::FloatAttr timeout_seconds); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type data, ::mlir::Value input, uint64_t group_size, uint64_t group_key, uint64_t instance_key, std::optional> shape, /*optional*/::llvm::StringRef communication_hint, /*optional*/::llvm::APFloat timeout_seconds); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, uint64_t group_size, uint64_t group_key, uint64_t instance_key, std::optional> shape, /*optional*/::llvm::StringRef communication_hint, /*optional*/::llvm::APFloat timeout_seconds); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 7 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::CollectiveBcastSendOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::CollectiveGatherOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CollectiveGatherOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CollectiveGatherOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CollectiveGatherOpGenericAdaptorBase(CollectiveGatherOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getGroupSizeAttr(); + uint64_t getGroupSize(); + ::mlir::IntegerAttr getGroupKeyAttr(); + uint64_t getGroupKey(); + ::mlir::IntegerAttr getInstanceKeyAttr(); + uint64_t getInstanceKey(); + ::mlir::Attribute getShapeAttr(); + std::optional> getShape(); + ::mlir::StringAttr getCommunicationHintAttr(); + ::llvm::StringRef getCommunicationHint(); + ::mlir::FloatAttr getTimeoutSecondsAttr(); + ::llvm::APFloat getTimeoutSeconds(); +}; +} // namespace detail +template +class CollectiveGatherOpGenericAdaptor : public detail::CollectiveGatherOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CollectiveGatherOpGenericAdaptorBase; +public: + CollectiveGatherOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CollectiveGatherOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CollectiveGatherOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CollectiveGatherOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CollectiveGatherOpAdaptor : public CollectiveGatherOpGenericAdaptor<::mlir::ValueRange> { +public: + using CollectiveGatherOpGenericAdaptor::CollectiveGatherOpGenericAdaptor; + CollectiveGatherOpAdaptor(CollectiveGatherOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CollectiveGatherOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CollectiveGatherOpAdaptor; + template + using GenericAdaptor = CollectiveGatherOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("communication_hint"), ::llvm::StringRef("group_key"), ::llvm::StringRef("group_size"), ::llvm::StringRef("instance_key"), ::llvm::StringRef("shape"), ::llvm::StringRef("timeout_seconds")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getCommunicationHintAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getCommunicationHintAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getGroupKeyAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getGroupKeyAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getGroupSizeAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getGroupSizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getInstanceKeyAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getInstanceKeyAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getShapeAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getShapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getTimeoutSecondsAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getTimeoutSecondsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.CollectiveGather"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getData(); + ::mlir::IntegerAttr getGroupSizeAttr(); + uint64_t getGroupSize(); + ::mlir::IntegerAttr getGroupKeyAttr(); + uint64_t getGroupKey(); + ::mlir::IntegerAttr getInstanceKeyAttr(); + uint64_t getInstanceKey(); + ::mlir::Attribute getShapeAttr(); + std::optional> getShape(); + ::mlir::StringAttr getCommunicationHintAttr(); + ::llvm::StringRef getCommunicationHint(); + ::mlir::FloatAttr getTimeoutSecondsAttr(); + ::llvm::APFloat getTimeoutSeconds(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setGroupSizeAttr(::mlir::IntegerAttr attr); + void setGroupSize(uint64_t attrValue); + void setGroupKeyAttr(::mlir::IntegerAttr attr); + void setGroupKey(uint64_t attrValue); + void setInstanceKeyAttr(::mlir::IntegerAttr attr); + void setInstanceKey(uint64_t attrValue); + void setShapeAttr(::mlir::Attribute attr); + void setShape(std::optional> attrValue); + void setCommunicationHintAttr(::mlir::StringAttr attr); + void setCommunicationHint(::std::optional<::llvm::StringRef> attrValue); + void setTimeoutSecondsAttr(::mlir::FloatAttr attr); + void setTimeoutSeconds(::std::optional<::llvm::APFloat> attrValue); + ::mlir::Attribute removeCommunicationHintAttr(); + ::mlir::Attribute removeTimeoutSecondsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type data, ::mlir::Value input, ::mlir::IntegerAttr group_size, ::mlir::IntegerAttr group_key, ::mlir::IntegerAttr instance_key, ::mlir::Attribute shape, /*optional*/::mlir::StringAttr communication_hint, /*optional*/::mlir::FloatAttr timeout_seconds); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::IntegerAttr group_size, ::mlir::IntegerAttr group_key, ::mlir::IntegerAttr instance_key, ::mlir::Attribute shape, /*optional*/::mlir::StringAttr communication_hint, /*optional*/::mlir::FloatAttr timeout_seconds); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type data, ::mlir::Value input, uint64_t group_size, uint64_t group_key, uint64_t instance_key, std::optional> shape, /*optional*/::llvm::StringRef communication_hint, /*optional*/::llvm::APFloat timeout_seconds); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, uint64_t group_size, uint64_t group_key, uint64_t instance_key, std::optional> shape, /*optional*/::llvm::StringRef communication_hint, /*optional*/::llvm::APFloat timeout_seconds); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 7 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::CollectiveGatherOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::CollectiveGatherV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CollectiveGatherV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CollectiveGatherV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CollectiveGatherV2OpGenericAdaptorBase(CollectiveGatherV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getCommunicationHintAttr(); + ::llvm::StringRef getCommunicationHint(); + ::mlir::FloatAttr getTimeoutSecondsAttr(); + ::llvm::APFloat getTimeoutSeconds(); + ::mlir::BoolAttr getIsStatelessAttr(); + bool getIsStateless(); +}; +} // namespace detail +template +class CollectiveGatherV2OpGenericAdaptor : public detail::CollectiveGatherV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CollectiveGatherV2OpGenericAdaptorBase; +public: + CollectiveGatherV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CollectiveGatherV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CollectiveGatherV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CollectiveGatherV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getGroupSize() { + return (*getODSOperands(1).begin()); + } + + ValueT getGroupKey() { + return (*getODSOperands(2).begin()); + } + + ValueT getInstanceKey() { + return (*getODSOperands(3).begin()); + } + + RangeT getOrderingToken() { + return getODSOperands(4); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CollectiveGatherV2OpAdaptor : public CollectiveGatherV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using CollectiveGatherV2OpGenericAdaptor::CollectiveGatherV2OpGenericAdaptor; + CollectiveGatherV2OpAdaptor(CollectiveGatherV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CollectiveGatherV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, GetResourceInstanceInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CollectiveGatherV2OpAdaptor; + template + using GenericAdaptor = CollectiveGatherV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Nordering_token"), ::llvm::StringRef("T"), ::llvm::StringRef("communication_hint"), ::llvm::StringRef("is_stateless"), ::llvm::StringRef("timeout_seconds")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNorderingTokenAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNorderingTokenAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getCommunicationHintAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getCommunicationHintAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getIsStatelessAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getIsStatelessAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTimeoutSecondsAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTimeoutSecondsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.CollectiveGatherV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getGroupSize(); + ::mlir::TypedValue<::mlir::TensorType> getGroupKey(); + ::mlir::TypedValue<::mlir::TensorType> getInstanceKey(); + ::mlir::Operation::operand_range getOrderingToken(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getGroupSizeMutable(); + ::mlir::OpOperand &getGroupKeyMutable(); + ::mlir::OpOperand &getInstanceKeyMutable(); + ::mlir::MutableOperandRange getOrderingTokenMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getData(); + ::mlir::StringAttr getCommunicationHintAttr(); + ::llvm::StringRef getCommunicationHint(); + ::mlir::FloatAttr getTimeoutSecondsAttr(); + ::llvm::APFloat getTimeoutSeconds(); + ::mlir::BoolAttr getIsStatelessAttr(); + bool getIsStateless(); + size_t getNorderingToken(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setCommunicationHintAttr(::mlir::StringAttr attr); + void setCommunicationHint(::std::optional<::llvm::StringRef> attrValue); + void setTimeoutSecondsAttr(::mlir::FloatAttr attr); + void setTimeoutSeconds(::std::optional<::llvm::APFloat> attrValue); + void setIsStatelessAttr(::mlir::BoolAttr attr); + void setIsStateless(::std::optional attrValue); + ::mlir::Attribute removeCommunicationHintAttr(); + ::mlir::Attribute removeTimeoutSecondsAttr(); + ::mlir::Attribute removeIsStatelessAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type data, ::mlir::Value input, ::mlir::Value group_size, ::mlir::Value group_key, ::mlir::Value instance_key, ::mlir::ValueRange ordering_token, /*optional*/::mlir::StringAttr communication_hint, /*optional*/::mlir::FloatAttr timeout_seconds, /*optional*/::mlir::BoolAttr is_stateless); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value group_size, ::mlir::Value group_key, ::mlir::Value instance_key, ::mlir::ValueRange ordering_token, /*optional*/::mlir::StringAttr communication_hint, /*optional*/::mlir::FloatAttr timeout_seconds, /*optional*/::mlir::BoolAttr is_stateless); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type data, ::mlir::Value input, ::mlir::Value group_size, ::mlir::Value group_key, ::mlir::Value instance_key, ::mlir::ValueRange ordering_token, /*optional*/::llvm::StringRef communication_hint, /*optional*/::llvm::APFloat timeout_seconds, /*optional*/bool is_stateless = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value group_size, ::mlir::Value group_key, ::mlir::Value instance_key, ::mlir::ValueRange ordering_token, /*optional*/::llvm::StringRef communication_hint, /*optional*/::llvm::APFloat timeout_seconds, /*optional*/bool is_stateless = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + std::optional GetResourceInstanceStr(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::CollectiveGatherV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::CollectivePermuteOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CollectivePermuteOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CollectivePermuteOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CollectivePermuteOpGenericAdaptorBase(CollectivePermuteOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CollectivePermuteOpGenericAdaptor : public detail::CollectivePermuteOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CollectivePermuteOpGenericAdaptorBase; +public: + CollectivePermuteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CollectivePermuteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CollectivePermuteOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CollectivePermuteOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getSourceTargetPairs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CollectivePermuteOpAdaptor : public CollectivePermuteOpGenericAdaptor<::mlir::ValueRange> { +public: + using CollectivePermuteOpGenericAdaptor::CollectivePermuteOpGenericAdaptor; + CollectivePermuteOpAdaptor(CollectivePermuteOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CollectivePermuteOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CollectivePermuteOpAdaptor; + template + using GenericAdaptor = CollectivePermuteOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.CollectivePermute"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getSourceTargetPairs(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getSourceTargetPairsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value source_target_pairs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value source_target_pairs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::CollectivePermuteOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::CollectiveReduceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CollectiveReduceOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CollectiveReduceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CollectiveReduceOpGenericAdaptorBase(CollectiveReduceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getGroupSizeAttr(); + uint64_t getGroupSize(); + ::mlir::IntegerAttr getGroupKeyAttr(); + uint64_t getGroupKey(); + ::mlir::IntegerAttr getInstanceKeyAttr(); + uint64_t getInstanceKey(); + ::mlir::StringAttr getMergeOpAttr(); + ::llvm::StringRef getMergeOp(); + ::mlir::StringAttr getFinalOpAttr(); + ::llvm::StringRef getFinalOp(); + ::mlir::ArrayAttr getSubdivOffsetsAttr(); + ::mlir::ArrayAttr getSubdivOffsets(); + ::mlir::ArrayAttr getWaitForAttr(); + ::mlir::ArrayAttr getWaitFor(); + ::mlir::StringAttr getCommunicationHintAttr(); + ::llvm::StringRef getCommunicationHint(); + ::mlir::FloatAttr getTimeoutSecondsAttr(); + ::llvm::APFloat getTimeoutSeconds(); +}; +} // namespace detail +template +class CollectiveReduceOpGenericAdaptor : public detail::CollectiveReduceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CollectiveReduceOpGenericAdaptorBase; +public: + CollectiveReduceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CollectiveReduceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CollectiveReduceOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CollectiveReduceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CollectiveReduceOpAdaptor : public CollectiveReduceOpGenericAdaptor<::mlir::ValueRange> { +public: + using CollectiveReduceOpGenericAdaptor::CollectiveReduceOpGenericAdaptor; + CollectiveReduceOpAdaptor(CollectiveReduceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CollectiveReduceOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CollectiveReduceOpAdaptor; + template + using GenericAdaptor = CollectiveReduceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("communication_hint"), ::llvm::StringRef("final_op"), ::llvm::StringRef("group_key"), ::llvm::StringRef("group_size"), ::llvm::StringRef("instance_key"), ::llvm::StringRef("merge_op"), ::llvm::StringRef("subdiv_offsets"), ::llvm::StringRef("timeout_seconds"), ::llvm::StringRef("wait_for")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getCommunicationHintAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getCommunicationHintAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getFinalOpAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getFinalOpAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getGroupKeyAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getGroupKeyAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getGroupSizeAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getGroupSizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getInstanceKeyAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getInstanceKeyAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getMergeOpAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getMergeOpAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getSubdivOffsetsAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getSubdivOffsetsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getTimeoutSecondsAttrName() { + return getAttributeNameForIndex(8); + } + + static ::mlir::StringAttr getTimeoutSecondsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 8); + } + + ::mlir::StringAttr getWaitForAttrName() { + return getAttributeNameForIndex(9); + } + + static ::mlir::StringAttr getWaitForAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 9); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.CollectiveReduce"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getData(); + ::mlir::IntegerAttr getGroupSizeAttr(); + uint64_t getGroupSize(); + ::mlir::IntegerAttr getGroupKeyAttr(); + uint64_t getGroupKey(); + ::mlir::IntegerAttr getInstanceKeyAttr(); + uint64_t getInstanceKey(); + ::mlir::StringAttr getMergeOpAttr(); + ::llvm::StringRef getMergeOp(); + ::mlir::StringAttr getFinalOpAttr(); + ::llvm::StringRef getFinalOp(); + ::mlir::ArrayAttr getSubdivOffsetsAttr(); + ::mlir::ArrayAttr getSubdivOffsets(); + ::mlir::ArrayAttr getWaitForAttr(); + ::mlir::ArrayAttr getWaitFor(); + ::mlir::StringAttr getCommunicationHintAttr(); + ::llvm::StringRef getCommunicationHint(); + ::mlir::FloatAttr getTimeoutSecondsAttr(); + ::llvm::APFloat getTimeoutSeconds(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setGroupSizeAttr(::mlir::IntegerAttr attr); + void setGroupSize(uint64_t attrValue); + void setGroupKeyAttr(::mlir::IntegerAttr attr); + void setGroupKey(uint64_t attrValue); + void setInstanceKeyAttr(::mlir::IntegerAttr attr); + void setInstanceKey(uint64_t attrValue); + void setMergeOpAttr(::mlir::StringAttr attr); + void setMergeOp(::llvm::StringRef attrValue); + void setFinalOpAttr(::mlir::StringAttr attr); + void setFinalOp(::llvm::StringRef attrValue); + void setSubdivOffsetsAttr(::mlir::ArrayAttr attr); + void setWaitForAttr(::mlir::ArrayAttr attr); + void setCommunicationHintAttr(::mlir::StringAttr attr); + void setCommunicationHint(::std::optional<::llvm::StringRef> attrValue); + void setTimeoutSecondsAttr(::mlir::FloatAttr attr); + void setTimeoutSeconds(::std::optional<::llvm::APFloat> attrValue); + ::mlir::Attribute removeWaitForAttr(); + ::mlir::Attribute removeCommunicationHintAttr(); + ::mlir::Attribute removeTimeoutSecondsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type data, ::mlir::Value input, ::mlir::IntegerAttr group_size, ::mlir::IntegerAttr group_key, ::mlir::IntegerAttr instance_key, ::mlir::StringAttr merge_op, ::mlir::StringAttr final_op, ::mlir::ArrayAttr subdiv_offsets, /*optional*/::mlir::ArrayAttr wait_for, /*optional*/::mlir::StringAttr communication_hint, /*optional*/::mlir::FloatAttr timeout_seconds); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::IntegerAttr group_size, ::mlir::IntegerAttr group_key, ::mlir::IntegerAttr instance_key, ::mlir::StringAttr merge_op, ::mlir::StringAttr final_op, ::mlir::ArrayAttr subdiv_offsets, /*optional*/::mlir::ArrayAttr wait_for, /*optional*/::mlir::StringAttr communication_hint, /*optional*/::mlir::FloatAttr timeout_seconds); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::IntegerAttr group_size, ::mlir::IntegerAttr group_key, ::mlir::IntegerAttr instance_key, ::mlir::StringAttr merge_op, ::mlir::StringAttr final_op, ::mlir::ArrayAttr subdiv_offsets, /*optional*/::mlir::ArrayAttr wait_for, /*optional*/::mlir::StringAttr communication_hint, /*optional*/::mlir::FloatAttr timeout_seconds); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type data, ::mlir::Value input, uint64_t group_size, uint64_t group_key, uint64_t instance_key, ::llvm::StringRef merge_op, ::llvm::StringRef final_op, ::mlir::ArrayAttr subdiv_offsets, /*optional*/::mlir::ArrayAttr wait_for, /*optional*/::llvm::StringRef communication_hint, /*optional*/::llvm::APFloat timeout_seconds); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, uint64_t group_size, uint64_t group_key, uint64_t instance_key, ::llvm::StringRef merge_op, ::llvm::StringRef final_op, ::mlir::ArrayAttr subdiv_offsets, /*optional*/::mlir::ArrayAttr wait_for, /*optional*/::llvm::StringRef communication_hint, /*optional*/::llvm::APFloat timeout_seconds); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, uint64_t group_size, uint64_t group_key, uint64_t instance_key, ::llvm::StringRef merge_op, ::llvm::StringRef final_op, ::mlir::ArrayAttr subdiv_offsets, /*optional*/::mlir::ArrayAttr wait_for, /*optional*/::llvm::StringRef communication_hint, /*optional*/::llvm::APFloat timeout_seconds); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 10 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::CollectiveReduceOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::CollectiveReduceScatterV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CollectiveReduceScatterV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CollectiveReduceScatterV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CollectiveReduceScatterV2OpGenericAdaptorBase(CollectiveReduceScatterV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getMergeOpAttr(); + ::llvm::StringRef getMergeOp(); + ::mlir::StringAttr getFinalOpAttr(); + ::llvm::StringRef getFinalOp(); + ::mlir::StringAttr getCommunicationHintAttr(); + ::llvm::StringRef getCommunicationHint(); + ::mlir::FloatAttr getTimeoutSecondsAttr(); + ::llvm::APFloat getTimeoutSeconds(); + ::mlir::BoolAttr getIsStatelessAttr(); + bool getIsStateless(); + ::mlir::IntegerAttr getMaxSubdivsPerDeviceAttr(); + uint64_t getMaxSubdivsPerDevice(); +}; +} // namespace detail +template +class CollectiveReduceScatterV2OpGenericAdaptor : public detail::CollectiveReduceScatterV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CollectiveReduceScatterV2OpGenericAdaptorBase; +public: + CollectiveReduceScatterV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CollectiveReduceScatterV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CollectiveReduceScatterV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CollectiveReduceScatterV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getGroupSize() { + return (*getODSOperands(1).begin()); + } + + ValueT getGroupKey() { + return (*getODSOperands(2).begin()); + } + + ValueT getInstanceKey() { + return (*getODSOperands(3).begin()); + } + + RangeT getOrderingToken() { + return getODSOperands(4); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CollectiveReduceScatterV2OpAdaptor : public CollectiveReduceScatterV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using CollectiveReduceScatterV2OpGenericAdaptor::CollectiveReduceScatterV2OpGenericAdaptor; + CollectiveReduceScatterV2OpAdaptor(CollectiveReduceScatterV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CollectiveReduceScatterV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, GetResourceInstanceInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CollectiveReduceScatterV2OpAdaptor; + template + using GenericAdaptor = CollectiveReduceScatterV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Nordering_token"), ::llvm::StringRef("T"), ::llvm::StringRef("communication_hint"), ::llvm::StringRef("final_op"), ::llvm::StringRef("is_stateless"), ::llvm::StringRef("max_subdivs_per_device"), ::llvm::StringRef("merge_op"), ::llvm::StringRef("timeout_seconds")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNorderingTokenAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNorderingTokenAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getCommunicationHintAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getCommunicationHintAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getFinalOpAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getFinalOpAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getIsStatelessAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getIsStatelessAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getMaxSubdivsPerDeviceAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getMaxSubdivsPerDeviceAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getMergeOpAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getMergeOpAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getTimeoutSecondsAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getTimeoutSecondsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.CollectiveReduceScatterV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getGroupSize(); + ::mlir::TypedValue<::mlir::TensorType> getGroupKey(); + ::mlir::TypedValue<::mlir::TensorType> getInstanceKey(); + ::mlir::Operation::operand_range getOrderingToken(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getGroupSizeMutable(); + ::mlir::OpOperand &getGroupKeyMutable(); + ::mlir::OpOperand &getInstanceKeyMutable(); + ::mlir::MutableOperandRange getOrderingTokenMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getData(); + ::mlir::StringAttr getMergeOpAttr(); + ::llvm::StringRef getMergeOp(); + ::mlir::StringAttr getFinalOpAttr(); + ::llvm::StringRef getFinalOp(); + ::mlir::StringAttr getCommunicationHintAttr(); + ::llvm::StringRef getCommunicationHint(); + ::mlir::FloatAttr getTimeoutSecondsAttr(); + ::llvm::APFloat getTimeoutSeconds(); + ::mlir::BoolAttr getIsStatelessAttr(); + bool getIsStateless(); + ::mlir::IntegerAttr getMaxSubdivsPerDeviceAttr(); + uint64_t getMaxSubdivsPerDevice(); + size_t getNorderingToken(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setMergeOpAttr(::mlir::StringAttr attr); + void setMergeOp(::llvm::StringRef attrValue); + void setFinalOpAttr(::mlir::StringAttr attr); + void setFinalOp(::llvm::StringRef attrValue); + void setCommunicationHintAttr(::mlir::StringAttr attr); + void setCommunicationHint(::std::optional<::llvm::StringRef> attrValue); + void setTimeoutSecondsAttr(::mlir::FloatAttr attr); + void setTimeoutSeconds(::std::optional<::llvm::APFloat> attrValue); + void setIsStatelessAttr(::mlir::BoolAttr attr); + void setIsStateless(::std::optional attrValue); + void setMaxSubdivsPerDeviceAttr(::mlir::IntegerAttr attr); + void setMaxSubdivsPerDevice(::std::optional attrValue); + ::mlir::Attribute removeCommunicationHintAttr(); + ::mlir::Attribute removeTimeoutSecondsAttr(); + ::mlir::Attribute removeIsStatelessAttr(); + ::mlir::Attribute removeMaxSubdivsPerDeviceAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type data, ::mlir::Value input, ::mlir::Value group_size, ::mlir::Value group_key, ::mlir::Value instance_key, ::mlir::ValueRange ordering_token, ::mlir::StringAttr merge_op, ::mlir::StringAttr final_op, /*optional*/::mlir::StringAttr communication_hint, /*optional*/::mlir::FloatAttr timeout_seconds, /*optional*/::mlir::BoolAttr is_stateless, /*optional*/::mlir::IntegerAttr max_subdivs_per_device); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value group_size, ::mlir::Value group_key, ::mlir::Value instance_key, ::mlir::ValueRange ordering_token, ::mlir::StringAttr merge_op, ::mlir::StringAttr final_op, /*optional*/::mlir::StringAttr communication_hint, /*optional*/::mlir::FloatAttr timeout_seconds, /*optional*/::mlir::BoolAttr is_stateless, /*optional*/::mlir::IntegerAttr max_subdivs_per_device); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type data, ::mlir::Value input, ::mlir::Value group_size, ::mlir::Value group_key, ::mlir::Value instance_key, ::mlir::ValueRange ordering_token, ::llvm::StringRef merge_op, ::llvm::StringRef final_op, /*optional*/::llvm::StringRef communication_hint, /*optional*/::llvm::APFloat timeout_seconds, /*optional*/bool is_stateless = false, /*optional*/uint64_t max_subdivs_per_device = -1); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value group_size, ::mlir::Value group_key, ::mlir::Value instance_key, ::mlir::ValueRange ordering_token, ::llvm::StringRef merge_op, ::llvm::StringRef final_op, /*optional*/::llvm::StringRef communication_hint, /*optional*/::llvm::APFloat timeout_seconds, /*optional*/bool is_stateless = false, /*optional*/uint64_t max_subdivs_per_device = -1); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + std::optional GetResourceInstanceStr(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 8 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::CollectiveReduceScatterV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::CollectiveReduceV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CollectiveReduceV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CollectiveReduceV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CollectiveReduceV2OpGenericAdaptorBase(CollectiveReduceV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getMergeOpAttr(); + ::llvm::StringRef getMergeOp(); + ::mlir::StringAttr getFinalOpAttr(); + ::llvm::StringRef getFinalOp(); + ::mlir::StringAttr getCommunicationHintAttr(); + ::llvm::StringRef getCommunicationHint(); + ::mlir::FloatAttr getTimeoutSecondsAttr(); + ::llvm::APFloat getTimeoutSeconds(); + ::mlir::BoolAttr getIsStatelessAttr(); + bool getIsStateless(); + ::mlir::IntegerAttr getMaxSubdivsPerDeviceAttr(); + uint64_t getMaxSubdivsPerDevice(); +}; +} // namespace detail +template +class CollectiveReduceV2OpGenericAdaptor : public detail::CollectiveReduceV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CollectiveReduceV2OpGenericAdaptorBase; +public: + CollectiveReduceV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CollectiveReduceV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CollectiveReduceV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CollectiveReduceV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getGroupSize() { + return (*getODSOperands(1).begin()); + } + + ValueT getGroupKey() { + return (*getODSOperands(2).begin()); + } + + ValueT getInstanceKey() { + return (*getODSOperands(3).begin()); + } + + RangeT getOrderingToken() { + return getODSOperands(4); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CollectiveReduceV2OpAdaptor : public CollectiveReduceV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using CollectiveReduceV2OpGenericAdaptor::CollectiveReduceV2OpGenericAdaptor; + CollectiveReduceV2OpAdaptor(CollectiveReduceV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CollectiveReduceV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, GetResourceInstanceInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CollectiveReduceV2OpAdaptor; + template + using GenericAdaptor = CollectiveReduceV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Nordering_token"), ::llvm::StringRef("T"), ::llvm::StringRef("communication_hint"), ::llvm::StringRef("final_op"), ::llvm::StringRef("is_stateless"), ::llvm::StringRef("max_subdivs_per_device"), ::llvm::StringRef("merge_op"), ::llvm::StringRef("timeout_seconds")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNorderingTokenAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNorderingTokenAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getCommunicationHintAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getCommunicationHintAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getFinalOpAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getFinalOpAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getIsStatelessAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getIsStatelessAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getMaxSubdivsPerDeviceAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getMaxSubdivsPerDeviceAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getMergeOpAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getMergeOpAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getTimeoutSecondsAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getTimeoutSecondsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.CollectiveReduceV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getGroupSize(); + ::mlir::TypedValue<::mlir::TensorType> getGroupKey(); + ::mlir::TypedValue<::mlir::TensorType> getInstanceKey(); + ::mlir::Operation::operand_range getOrderingToken(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getGroupSizeMutable(); + ::mlir::OpOperand &getGroupKeyMutable(); + ::mlir::OpOperand &getInstanceKeyMutable(); + ::mlir::MutableOperandRange getOrderingTokenMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getData(); + ::mlir::StringAttr getMergeOpAttr(); + ::llvm::StringRef getMergeOp(); + ::mlir::StringAttr getFinalOpAttr(); + ::llvm::StringRef getFinalOp(); + ::mlir::StringAttr getCommunicationHintAttr(); + ::llvm::StringRef getCommunicationHint(); + ::mlir::FloatAttr getTimeoutSecondsAttr(); + ::llvm::APFloat getTimeoutSeconds(); + ::mlir::BoolAttr getIsStatelessAttr(); + bool getIsStateless(); + ::mlir::IntegerAttr getMaxSubdivsPerDeviceAttr(); + uint64_t getMaxSubdivsPerDevice(); + size_t getNorderingToken(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setMergeOpAttr(::mlir::StringAttr attr); + void setMergeOp(::llvm::StringRef attrValue); + void setFinalOpAttr(::mlir::StringAttr attr); + void setFinalOp(::llvm::StringRef attrValue); + void setCommunicationHintAttr(::mlir::StringAttr attr); + void setCommunicationHint(::std::optional<::llvm::StringRef> attrValue); + void setTimeoutSecondsAttr(::mlir::FloatAttr attr); + void setTimeoutSeconds(::std::optional<::llvm::APFloat> attrValue); + void setIsStatelessAttr(::mlir::BoolAttr attr); + void setIsStateless(::std::optional attrValue); + void setMaxSubdivsPerDeviceAttr(::mlir::IntegerAttr attr); + void setMaxSubdivsPerDevice(::std::optional attrValue); + ::mlir::Attribute removeCommunicationHintAttr(); + ::mlir::Attribute removeTimeoutSecondsAttr(); + ::mlir::Attribute removeIsStatelessAttr(); + ::mlir::Attribute removeMaxSubdivsPerDeviceAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type data, ::mlir::Value input, ::mlir::Value group_size, ::mlir::Value group_key, ::mlir::Value instance_key, ::mlir::ValueRange ordering_token, ::mlir::StringAttr merge_op, ::mlir::StringAttr final_op, /*optional*/::mlir::StringAttr communication_hint, /*optional*/::mlir::FloatAttr timeout_seconds, /*optional*/::mlir::BoolAttr is_stateless, /*optional*/::mlir::IntegerAttr max_subdivs_per_device); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value group_size, ::mlir::Value group_key, ::mlir::Value instance_key, ::mlir::ValueRange ordering_token, ::mlir::StringAttr merge_op, ::mlir::StringAttr final_op, /*optional*/::mlir::StringAttr communication_hint, /*optional*/::mlir::FloatAttr timeout_seconds, /*optional*/::mlir::BoolAttr is_stateless, /*optional*/::mlir::IntegerAttr max_subdivs_per_device); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type data, ::mlir::Value input, ::mlir::Value group_size, ::mlir::Value group_key, ::mlir::Value instance_key, ::mlir::ValueRange ordering_token, ::llvm::StringRef merge_op, ::llvm::StringRef final_op, /*optional*/::llvm::StringRef communication_hint, /*optional*/::llvm::APFloat timeout_seconds, /*optional*/bool is_stateless = false, /*optional*/uint64_t max_subdivs_per_device = -1); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value group_size, ::mlir::Value group_key, ::mlir::Value instance_key, ::mlir::ValueRange ordering_token, ::llvm::StringRef merge_op, ::llvm::StringRef final_op, /*optional*/::llvm::StringRef communication_hint, /*optional*/::llvm::APFloat timeout_seconds, /*optional*/bool is_stateless = false, /*optional*/uint64_t max_subdivs_per_device = -1); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + std::optional GetResourceInstanceStr(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 8 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::CollectiveReduceV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ComplexAbsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ComplexAbsOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ComplexAbsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ComplexAbsOpGenericAdaptorBase(ComplexAbsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ComplexAbsOpGenericAdaptor : public detail::ComplexAbsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ComplexAbsOpGenericAdaptorBase; +public: + ComplexAbsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ComplexAbsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ComplexAbsOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ComplexAbsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ComplexAbsOpAdaptor : public ComplexAbsOpGenericAdaptor<::mlir::ValueRange> { +public: + using ComplexAbsOpGenericAdaptor::ComplexAbsOpGenericAdaptor; + ComplexAbsOpAdaptor(ComplexAbsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ComplexAbsOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ComplexAbsOpAdaptor; + template + using GenericAdaptor = ComplexAbsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tout")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getToutAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getToutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ComplexAbs"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + ::mlir::Type getTout(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ComplexAbsOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ComplexOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ComplexOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ComplexOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ComplexOpGenericAdaptorBase(ComplexOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ComplexOpGenericAdaptor : public detail::ComplexOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ComplexOpGenericAdaptorBase; +public: + ComplexOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ComplexOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ComplexOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ComplexOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getReal() { + return (*getODSOperands(0).begin()); + } + + ValueT getImag() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ComplexOpAdaptor : public ComplexOpGenericAdaptor<::mlir::ValueRange> { +public: + using ComplexOpGenericAdaptor::ComplexOpGenericAdaptor; + ComplexOpAdaptor(ComplexOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ComplexOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ComplexOpAdaptor; + template + using GenericAdaptor = ComplexOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tout")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getToutAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getToutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Complex"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getReal(); + ::mlir::TypedValue<::mlir::TensorType> getImag(); + ::mlir::OpOperand &getRealMutable(); + ::mlir::OpOperand &getImagMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOut(); + ::mlir::Type getT(); + ::mlir::Type getTout(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, ::mlir::Value real, ::mlir::Value imag); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value real, ::mlir::Value imag); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ComplexOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ConcatOffsetOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConcatOffsetOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ConcatOffsetOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ConcatOffsetOpGenericAdaptorBase(ConcatOffsetOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ConcatOffsetOpGenericAdaptor : public detail::ConcatOffsetOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConcatOffsetOpGenericAdaptorBase; +public: + ConcatOffsetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConcatOffsetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConcatOffsetOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ConcatOffsetOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getConcatDim() { + return (*getODSOperands(0).begin()); + } + + RangeT getShape() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConcatOffsetOpAdaptor : public ConcatOffsetOpGenericAdaptor<::mlir::ValueRange> { +public: + using ConcatOffsetOpGenericAdaptor::ConcatOffsetOpGenericAdaptor; + ConcatOffsetOpAdaptor(ConcatOffsetOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConcatOffsetOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ConcatOffsetOpAdaptor; + template + using GenericAdaptor = ConcatOffsetOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("N"), ::llvm::StringRef("shape_type")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getShapeTypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getShapeTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ConcatOffset"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getConcatDim(); + ::mlir::Operation::operand_range getShape(); + ::mlir::OpOperand &getConcatDimMutable(); + ::mlir::MutableOperandRange getShapeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOffset(); + size_t getN(); + ::mlir::Type getShapeType(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange offset, ::mlir::Value concat_dim, ::mlir::ValueRange shape); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ConcatOffsetOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ConcatOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConcatOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ConcatOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ConcatOpGenericAdaptorBase(ConcatOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ConcatOpGenericAdaptor : public detail::ConcatOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConcatOpGenericAdaptorBase; +public: + ConcatOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConcatOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConcatOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ConcatOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getConcatDim() { + return (*getODSOperands(0).begin()); + } + + RangeT getValues() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConcatOpAdaptor : public ConcatOpGenericAdaptor<::mlir::ValueRange> { +public: + using ConcatOpGenericAdaptor::ConcatOpGenericAdaptor; + ConcatOpAdaptor(ConcatOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConcatOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ConcatOpAdaptor; + template + using GenericAdaptor = ConcatOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("N"), ::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Concat"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getConcatDim(); + ::mlir::Operation::operand_range getValues(); + ::mlir::OpOperand &getConcatDimMutable(); + ::mlir::MutableOperandRange getValuesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + size_t getN(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value concat_dim, ::mlir::ValueRange values); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value concat_dim, ::mlir::ValueRange values); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ConcatOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ConcatV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConcatV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ConcatV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ConcatV2OpGenericAdaptorBase(ConcatV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ConcatV2OpGenericAdaptor : public detail::ConcatV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConcatV2OpGenericAdaptorBase; +public: + ConcatV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConcatV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConcatV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ConcatV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getValues() { + return getODSOperands(0); + } + + ValueT getAxis() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConcatV2OpAdaptor : public ConcatV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using ConcatV2OpGenericAdaptor::ConcatV2OpGenericAdaptor; + ConcatV2OpAdaptor(ConcatV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConcatV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ConcatV2OpAdaptor; + template + using GenericAdaptor = ConcatV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("N"), ::llvm::StringRef("T"), ::llvm::StringRef("Tidx")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTidxAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTidxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ConcatV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getValues(); + ::mlir::TypedValue<::mlir::TensorType> getAxis(); + ::mlir::MutableOperandRange getValuesMutable(); + ::mlir::OpOperand &getAxisMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + size_t getN(); + ::mlir::Type getT(); + ::mlir::Type getTidx(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::ValueRange values, ::mlir::Value axis); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange values, ::mlir::Value axis); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ConcatV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ConfigureAndInitializeGlobalTPUOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConfigureAndInitializeGlobalTPUOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ConfigureAndInitializeGlobalTPUOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ConfigureAndInitializeGlobalTPUOpGenericAdaptorBase(ConfigureAndInitializeGlobalTPUOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ConfigureAndInitializeGlobalTPUOpGenericAdaptor : public detail::ConfigureAndInitializeGlobalTPUOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConfigureAndInitializeGlobalTPUOpGenericAdaptorBase; +public: + ConfigureAndInitializeGlobalTPUOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConfigureAndInitializeGlobalTPUOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConfigureAndInitializeGlobalTPUOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ConfigureAndInitializeGlobalTPUOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConfigureAndInitializeGlobalTPUOpAdaptor : public ConfigureAndInitializeGlobalTPUOpGenericAdaptor<::mlir::ValueRange> { +public: + using ConfigureAndInitializeGlobalTPUOpGenericAdaptor::ConfigureAndInitializeGlobalTPUOpGenericAdaptor; + ConfigureAndInitializeGlobalTPUOpAdaptor(ConfigureAndInitializeGlobalTPUOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConfigureAndInitializeGlobalTPUOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = ConfigureAndInitializeGlobalTPUOpAdaptor; + template + using GenericAdaptor = ConfigureAndInitializeGlobalTPUOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ConfigureAndInitializeGlobalTPU"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ConfigureAndInitializeGlobalTPUOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ConfigureDistributedTPUOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConfigureDistributedTPUOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ConfigureDistributedTPUOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ConfigureDistributedTPUOpGenericAdaptorBase(ConfigureDistributedTPUOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getEmbeddingConfigAttr(); + ::llvm::StringRef getEmbeddingConfig(); + ::mlir::StringAttr getTpuEmbeddingConfigAttr(); + ::llvm::StringRef getTpuEmbeddingConfig(); + ::mlir::BoolAttr getIsGlobalInitAttr(); + bool getIsGlobalInit(); + ::mlir::BoolAttr getEnableWholeMeshCompilationsAttr(); + bool getEnableWholeMeshCompilations(); + ::mlir::BoolAttr getCompilationFailureClosesChipsAttr(); + bool getCompilationFailureClosesChips(); + ::mlir::IntegerAttr getTpuCancellationClosesChipsAttr(); + uint64_t getTpuCancellationClosesChips(); +}; +} // namespace detail +template +class ConfigureDistributedTPUOpGenericAdaptor : public detail::ConfigureDistributedTPUOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConfigureDistributedTPUOpGenericAdaptorBase; +public: + ConfigureDistributedTPUOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConfigureDistributedTPUOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConfigureDistributedTPUOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ConfigureDistributedTPUOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConfigureDistributedTPUOpAdaptor : public ConfigureDistributedTPUOpGenericAdaptor<::mlir::ValueRange> { +public: + using ConfigureDistributedTPUOpGenericAdaptor::ConfigureDistributedTPUOpGenericAdaptor; + ConfigureDistributedTPUOpAdaptor(ConfigureDistributedTPUOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConfigureDistributedTPUOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = ConfigureDistributedTPUOpAdaptor; + template + using GenericAdaptor = ConfigureDistributedTPUOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("compilation_failure_closes_chips"), ::llvm::StringRef("embedding_config"), ::llvm::StringRef("enable_whole_mesh_compilations"), ::llvm::StringRef("is_global_init"), ::llvm::StringRef("tpu_cancellation_closes_chips"), ::llvm::StringRef("tpu_embedding_config")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getCompilationFailureClosesChipsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getCompilationFailureClosesChipsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getEmbeddingConfigAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getEmbeddingConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getEnableWholeMeshCompilationsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getEnableWholeMeshCompilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getIsGlobalInitAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getIsGlobalInitAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTpuCancellationClosesChipsAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTpuCancellationClosesChipsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getTpuEmbeddingConfigAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getTpuEmbeddingConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ConfigureDistributedTPU"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTopology(); + ::mlir::StringAttr getEmbeddingConfigAttr(); + ::llvm::StringRef getEmbeddingConfig(); + ::mlir::StringAttr getTpuEmbeddingConfigAttr(); + ::llvm::StringRef getTpuEmbeddingConfig(); + ::mlir::BoolAttr getIsGlobalInitAttr(); + bool getIsGlobalInit(); + ::mlir::BoolAttr getEnableWholeMeshCompilationsAttr(); + bool getEnableWholeMeshCompilations(); + ::mlir::BoolAttr getCompilationFailureClosesChipsAttr(); + bool getCompilationFailureClosesChips(); + ::mlir::IntegerAttr getTpuCancellationClosesChipsAttr(); + uint64_t getTpuCancellationClosesChips(); + void setEmbeddingConfigAttr(::mlir::StringAttr attr); + void setEmbeddingConfig(::std::optional<::llvm::StringRef> attrValue); + void setTpuEmbeddingConfigAttr(::mlir::StringAttr attr); + void setTpuEmbeddingConfig(::std::optional<::llvm::StringRef> attrValue); + void setIsGlobalInitAttr(::mlir::BoolAttr attr); + void setIsGlobalInit(::std::optional attrValue); + void setEnableWholeMeshCompilationsAttr(::mlir::BoolAttr attr); + void setEnableWholeMeshCompilations(::std::optional attrValue); + void setCompilationFailureClosesChipsAttr(::mlir::BoolAttr attr); + void setCompilationFailureClosesChips(::std::optional attrValue); + void setTpuCancellationClosesChipsAttr(::mlir::IntegerAttr attr); + void setTpuCancellationClosesChips(::std::optional attrValue); + ::mlir::Attribute removeEmbeddingConfigAttr(); + ::mlir::Attribute removeTpuEmbeddingConfigAttr(); + ::mlir::Attribute removeIsGlobalInitAttr(); + ::mlir::Attribute removeEnableWholeMeshCompilationsAttr(); + ::mlir::Attribute removeCompilationFailureClosesChipsAttr(); + ::mlir::Attribute removeTpuCancellationClosesChipsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type topology, /*optional*/::mlir::StringAttr embedding_config, /*optional*/::mlir::StringAttr tpu_embedding_config, /*optional*/::mlir::BoolAttr is_global_init, /*optional*/::mlir::BoolAttr enable_whole_mesh_compilations, /*optional*/::mlir::BoolAttr compilation_failure_closes_chips, /*optional*/::mlir::IntegerAttr tpu_cancellation_closes_chips); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::StringAttr embedding_config, /*optional*/::mlir::StringAttr tpu_embedding_config, /*optional*/::mlir::BoolAttr is_global_init, /*optional*/::mlir::BoolAttr enable_whole_mesh_compilations, /*optional*/::mlir::BoolAttr compilation_failure_closes_chips, /*optional*/::mlir::IntegerAttr tpu_cancellation_closes_chips); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type topology, /*optional*/::llvm::StringRef embedding_config = "", /*optional*/::llvm::StringRef tpu_embedding_config = "", /*optional*/bool is_global_init = false, /*optional*/bool enable_whole_mesh_compilations = false, /*optional*/bool compilation_failure_closes_chips = true, /*optional*/uint64_t tpu_cancellation_closes_chips = 0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::llvm::StringRef embedding_config = "", /*optional*/::llvm::StringRef tpu_embedding_config = "", /*optional*/bool is_global_init = false, /*optional*/bool enable_whole_mesh_compilations = false, /*optional*/bool compilation_failure_closes_chips = true, /*optional*/uint64_t tpu_cancellation_closes_chips = 0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ConfigureDistributedTPUOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ConfigureTPUEmbeddingHostOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConfigureTPUEmbeddingHostOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ConfigureTPUEmbeddingHostOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ConfigureTPUEmbeddingHostOpGenericAdaptorBase(ConfigureTPUEmbeddingHostOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class ConfigureTPUEmbeddingHostOpGenericAdaptor : public detail::ConfigureTPUEmbeddingHostOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConfigureTPUEmbeddingHostOpGenericAdaptorBase; +public: + ConfigureTPUEmbeddingHostOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConfigureTPUEmbeddingHostOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConfigureTPUEmbeddingHostOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ConfigureTPUEmbeddingHostOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getCommonConfig() { + return (*getODSOperands(0).begin()); + } + + ValueT getMemoryConfig() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConfigureTPUEmbeddingHostOpAdaptor : public ConfigureTPUEmbeddingHostOpGenericAdaptor<::mlir::ValueRange> { +public: + using ConfigureTPUEmbeddingHostOpGenericAdaptor::ConfigureTPUEmbeddingHostOpGenericAdaptor; + ConfigureTPUEmbeddingHostOpAdaptor(ConfigureTPUEmbeddingHostOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConfigureTPUEmbeddingHostOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = ConfigureTPUEmbeddingHostOpAdaptor; + template + using GenericAdaptor = ConfigureTPUEmbeddingHostOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ConfigureTPUEmbeddingHost"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getCommonConfig(); + ::mlir::TypedValue<::mlir::TensorType> getMemoryConfig(); + ::mlir::OpOperand &getCommonConfigMutable(); + ::mlir::OpOperand &getMemoryConfigMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getNetworkConfig(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type network_config, ::mlir::Value common_config, ::mlir::Value memory_config, ::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value common_config, ::mlir::Value memory_config, ::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type network_config, ::mlir::Value common_config, ::mlir::Value memory_config, ::llvm::StringRef config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value common_config, ::mlir::Value memory_config, ::llvm::StringRef config); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ConfigureTPUEmbeddingHostOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ConfigureTPUEmbeddingMemoryOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConfigureTPUEmbeddingMemoryOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ConfigureTPUEmbeddingMemoryOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ConfigureTPUEmbeddingMemoryOpGenericAdaptorBase(ConfigureTPUEmbeddingMemoryOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ConfigureTPUEmbeddingMemoryOpGenericAdaptor : public detail::ConfigureTPUEmbeddingMemoryOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConfigureTPUEmbeddingMemoryOpGenericAdaptorBase; +public: + ConfigureTPUEmbeddingMemoryOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConfigureTPUEmbeddingMemoryOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConfigureTPUEmbeddingMemoryOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ConfigureTPUEmbeddingMemoryOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getCommonConfig() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConfigureTPUEmbeddingMemoryOpAdaptor : public ConfigureTPUEmbeddingMemoryOpGenericAdaptor<::mlir::ValueRange> { +public: + using ConfigureTPUEmbeddingMemoryOpGenericAdaptor::ConfigureTPUEmbeddingMemoryOpGenericAdaptor; + ConfigureTPUEmbeddingMemoryOpAdaptor(ConfigureTPUEmbeddingMemoryOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConfigureTPUEmbeddingMemoryOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = ConfigureTPUEmbeddingMemoryOpAdaptor; + template + using GenericAdaptor = ConfigureTPUEmbeddingMemoryOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ConfigureTPUEmbeddingMemory"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getCommonConfig(); + ::mlir::OpOperand &getCommonConfigMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getMemoryConfig(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type memory_config, ::mlir::Value common_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value common_config); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ConfigureTPUEmbeddingMemoryOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ConfigureTPUEmbeddingOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConfigureTPUEmbeddingOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ConfigureTPUEmbeddingOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ConfigureTPUEmbeddingOpGenericAdaptorBase(ConfigureTPUEmbeddingOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class ConfigureTPUEmbeddingOpGenericAdaptor : public detail::ConfigureTPUEmbeddingOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConfigureTPUEmbeddingOpGenericAdaptorBase; +public: + ConfigureTPUEmbeddingOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConfigureTPUEmbeddingOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConfigureTPUEmbeddingOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ConfigureTPUEmbeddingOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConfigureTPUEmbeddingOpAdaptor : public ConfigureTPUEmbeddingOpGenericAdaptor<::mlir::ValueRange> { +public: + using ConfigureTPUEmbeddingOpGenericAdaptor::ConfigureTPUEmbeddingOpGenericAdaptor; + ConfigureTPUEmbeddingOpAdaptor(ConfigureTPUEmbeddingOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConfigureTPUEmbeddingOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = ConfigureTPUEmbeddingOpAdaptor; + template + using GenericAdaptor = ConfigureTPUEmbeddingOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ConfigureTPUEmbedding"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef config); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ConfigureTPUEmbeddingOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ConjOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConjOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ConjOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ConjOpGenericAdaptorBase(ConjOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ConjOpGenericAdaptor : public detail::ConjOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConjOpGenericAdaptorBase; +public: + ConjOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConjOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConjOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ConjOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConjOpAdaptor : public ConjOpGenericAdaptor<::mlir::ValueRange> { +public: + using ConjOpGenericAdaptor::ConjOpGenericAdaptor; + ConjOpAdaptor(ConjOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConjOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::IsInvolution, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ConjOpAdaptor; + template + using GenericAdaptor = ConjOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Conj"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ConjOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ConjugateTransposeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConjugateTransposeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ConjugateTransposeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ConjugateTransposeOpGenericAdaptorBase(ConjugateTransposeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ConjugateTransposeOpGenericAdaptor : public detail::ConjugateTransposeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConjugateTransposeOpGenericAdaptorBase; +public: + ConjugateTransposeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConjugateTransposeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConjugateTransposeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ConjugateTransposeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getPerm() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConjugateTransposeOpAdaptor : public ConjugateTransposeOpGenericAdaptor<::mlir::ValueRange> { +public: + using ConjugateTransposeOpGenericAdaptor::ConjugateTransposeOpGenericAdaptor; + ConjugateTransposeOpAdaptor(ConjugateTransposeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConjugateTransposeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ConjugateTransposeOpAdaptor; + template + using GenericAdaptor = ConjugateTransposeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tperm")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTpermAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTpermAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ConjugateTranspose"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getPerm(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getPermMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + ::mlir::Type getTperm(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x, ::mlir::Value perm); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value perm); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ConjugateTransposeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ConnectTPUEmbeddingHostsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConnectTPUEmbeddingHostsOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ConnectTPUEmbeddingHostsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ConnectTPUEmbeddingHostsOpGenericAdaptorBase(ConnectTPUEmbeddingHostsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ConnectTPUEmbeddingHostsOpGenericAdaptor : public detail::ConnectTPUEmbeddingHostsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConnectTPUEmbeddingHostsOpGenericAdaptorBase; +public: + ConnectTPUEmbeddingHostsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConnectTPUEmbeddingHostsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConnectTPUEmbeddingHostsOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ConnectTPUEmbeddingHostsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getNetworkConfigs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConnectTPUEmbeddingHostsOpAdaptor : public ConnectTPUEmbeddingHostsOpGenericAdaptor<::mlir::ValueRange> { +public: + using ConnectTPUEmbeddingHostsOpGenericAdaptor::ConnectTPUEmbeddingHostsOpGenericAdaptor; + ConnectTPUEmbeddingHostsOpAdaptor(ConnectTPUEmbeddingHostsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConnectTPUEmbeddingHostsOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = ConnectTPUEmbeddingHostsOpAdaptor; + template + using GenericAdaptor = ConnectTPUEmbeddingHostsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("N")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ConnectTPUEmbeddingHosts"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getNetworkConfigs(); + ::mlir::MutableOperandRange getNetworkConfigsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + size_t getN(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange network_configs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ConnectTPUEmbeddingHostsOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ConstOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConstOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ConstOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ConstOpGenericAdaptorBase(ConstOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ElementsAttr getValueAttr(); + ::mlir::ElementsAttr getValue(); +}; +} // namespace detail +template +class ConstOpGenericAdaptor : public detail::ConstOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConstOpGenericAdaptorBase; +public: + ConstOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConstOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConstOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ConstOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConstOpAdaptor : public ConstOpGenericAdaptor<::mlir::ValueRange> { +public: + using ConstOpGenericAdaptor::ConstOpGenericAdaptor; + ConstOpAdaptor(ConstOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConstOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::ConstantLike, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ConstOpAdaptor; + template + using GenericAdaptor = ConstOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dtype"), ::llvm::StringRef("value")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getValueAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getValueAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Const"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ElementsAttr getValueAttr(); + ::mlir::ElementsAttr getValue(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setValueAttr(::mlir::ElementsAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Attribute value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type type, Attribute value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::ElementsAttr value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ElementsAttr value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ElementsAttr value); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return BroadcastCompatible(l, r); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ConstOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::Conv2DBackpropFilterOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Conv2DBackpropFilterOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + Conv2DBackpropFilterOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + Conv2DBackpropFilterOpGenericAdaptorBase(Conv2DBackpropFilterOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::BoolAttr getUseCudnnOnGpuAttr(); + bool getUseCudnnOnGpu(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getExplicitPaddingsAttr(); + ::mlir::ArrayAttr getExplicitPaddings(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::ArrayAttr getDilationsAttr(); + ::mlir::ArrayAttr getDilations(); +}; +} // namespace detail +template +class Conv2DBackpropFilterOpGenericAdaptor : public detail::Conv2DBackpropFilterOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Conv2DBackpropFilterOpGenericAdaptorBase; +public: + Conv2DBackpropFilterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Conv2DBackpropFilterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Conv2DBackpropFilterOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + Conv2DBackpropFilterOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getFilterSizes() { + return (*getODSOperands(1).begin()); + } + + ValueT getOutBackprop() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Conv2DBackpropFilterOpAdaptor : public Conv2DBackpropFilterOpGenericAdaptor<::mlir::ValueRange> { +public: + using Conv2DBackpropFilterOpGenericAdaptor::Conv2DBackpropFilterOpGenericAdaptor; + Conv2DBackpropFilterOpAdaptor(Conv2DBackpropFilterOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Conv2DBackpropFilterOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, LayoutSensitiveInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = Conv2DBackpropFilterOpAdaptor; + template + using GenericAdaptor = Conv2DBackpropFilterOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("data_format"), ::llvm::StringRef("dilations"), ::llvm::StringRef("explicit_paddings"), ::llvm::StringRef("padding"), ::llvm::StringRef("strides"), ::llvm::StringRef("use_cudnn_on_gpu")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getExplicitPaddingsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getExplicitPaddingsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getUseCudnnOnGpuAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getUseCudnnOnGpuAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Conv2DBackpropFilter"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getFilterSizes(); + ::mlir::TypedValue<::mlir::TensorType> getOutBackprop(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getFilterSizesMutable(); + ::mlir::OpOperand &getOutBackpropMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::BoolAttr getUseCudnnOnGpuAttr(); + bool getUseCudnnOnGpu(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getExplicitPaddingsAttr(); + ::mlir::ArrayAttr getExplicitPaddings(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::ArrayAttr getDilationsAttr(); + ::mlir::ArrayAttr getDilations(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setStridesAttr(::mlir::ArrayAttr attr); + void setUseCudnnOnGpuAttr(::mlir::BoolAttr attr); + void setUseCudnnOnGpu(::std::optional attrValue); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + void setExplicitPaddingsAttr(::mlir::ArrayAttr attr); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + void setDilationsAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeUseCudnnOnGpuAttr(); + ::mlir::Attribute removeExplicitPaddingsAttr(); + ::mlir::Attribute removeDataFormatAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value filter_sizes, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, /*optional*/::mlir::BoolAttr use_cudnn_on_gpu, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter_sizes, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, /*optional*/::mlir::BoolAttr use_cudnn_on_gpu, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value filter_sizes, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, /*optional*/bool use_cudnn_on_gpu, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::llvm::StringRef data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter_sizes, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, /*optional*/bool use_cudnn_on_gpu, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::llvm::StringRef data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 7 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // TF_LayoutSensitiveInterface: + SmallVector GetLayoutDependentArgs() { return {0, 2}; } + SmallVector GetLayoutDependentResults() { return {}; } + StringRef GetOptimalLayout(const RuntimeDevices& devices); + LogicalResult UpdateDataFormat(StringRef data_format); +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::Conv2DBackpropFilterOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::Conv2DBackpropFilterV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Conv2DBackpropFilterV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + Conv2DBackpropFilterV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + Conv2DBackpropFilterV2OpGenericAdaptorBase(Conv2DBackpropFilterV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::BoolAttr getUseCudnnOnGpuAttr(); + bool getUseCudnnOnGpu(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getExplicitPaddingsAttr(); + ::mlir::ArrayAttr getExplicitPaddings(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::ArrayAttr getDilationsAttr(); + ::mlir::ArrayAttr getDilations(); +}; +} // namespace detail +template +class Conv2DBackpropFilterV2OpGenericAdaptor : public detail::Conv2DBackpropFilterV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Conv2DBackpropFilterV2OpGenericAdaptorBase; +public: + Conv2DBackpropFilterV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Conv2DBackpropFilterV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Conv2DBackpropFilterV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + Conv2DBackpropFilterV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getFilter() { + return (*getODSOperands(1).begin()); + } + + ValueT getOutBackprop() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Conv2DBackpropFilterV2OpAdaptor : public Conv2DBackpropFilterV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using Conv2DBackpropFilterV2OpGenericAdaptor::Conv2DBackpropFilterV2OpGenericAdaptor; + Conv2DBackpropFilterV2OpAdaptor(Conv2DBackpropFilterV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Conv2DBackpropFilterV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = Conv2DBackpropFilterV2OpAdaptor; + template + using GenericAdaptor = Conv2DBackpropFilterV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("data_format"), ::llvm::StringRef("dilations"), ::llvm::StringRef("explicit_paddings"), ::llvm::StringRef("padding"), ::llvm::StringRef("strides"), ::llvm::StringRef("use_cudnn_on_gpu")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getExplicitPaddingsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getExplicitPaddingsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getUseCudnnOnGpuAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getUseCudnnOnGpuAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Conv2DBackpropFilterV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getFilter(); + ::mlir::TypedValue<::mlir::TensorType> getOutBackprop(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getFilterMutable(); + ::mlir::OpOperand &getOutBackpropMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::BoolAttr getUseCudnnOnGpuAttr(); + bool getUseCudnnOnGpu(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getExplicitPaddingsAttr(); + ::mlir::ArrayAttr getExplicitPaddings(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::ArrayAttr getDilationsAttr(); + ::mlir::ArrayAttr getDilations(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setStridesAttr(::mlir::ArrayAttr attr); + void setUseCudnnOnGpuAttr(::mlir::BoolAttr attr); + void setUseCudnnOnGpu(::std::optional attrValue); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + void setExplicitPaddingsAttr(::mlir::ArrayAttr attr); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + void setDilationsAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeUseCudnnOnGpuAttr(); + ::mlir::Attribute removeExplicitPaddingsAttr(); + ::mlir::Attribute removeDataFormatAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value filter, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, /*optional*/::mlir::BoolAttr use_cudnn_on_gpu, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, /*optional*/::mlir::BoolAttr use_cudnn_on_gpu, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value filter, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, /*optional*/bool use_cudnn_on_gpu, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::llvm::StringRef data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, /*optional*/bool use_cudnn_on_gpu, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::llvm::StringRef data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 7 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::Conv2DBackpropFilterV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::Conv2DBackpropInputOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Conv2DBackpropInputOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + Conv2DBackpropInputOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + Conv2DBackpropInputOpGenericAdaptorBase(Conv2DBackpropInputOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::BoolAttr getUseCudnnOnGpuAttr(); + bool getUseCudnnOnGpu(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getExplicitPaddingsAttr(); + ::mlir::ArrayAttr getExplicitPaddings(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::ArrayAttr getDilationsAttr(); + ::mlir::ArrayAttr getDilations(); +}; +} // namespace detail +template +class Conv2DBackpropInputOpGenericAdaptor : public detail::Conv2DBackpropInputOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Conv2DBackpropInputOpGenericAdaptorBase; +public: + Conv2DBackpropInputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Conv2DBackpropInputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Conv2DBackpropInputOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + Conv2DBackpropInputOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputSizes() { + return (*getODSOperands(0).begin()); + } + + ValueT getFilter() { + return (*getODSOperands(1).begin()); + } + + ValueT getOutBackprop() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Conv2DBackpropInputOpAdaptor : public Conv2DBackpropInputOpGenericAdaptor<::mlir::ValueRange> { +public: + using Conv2DBackpropInputOpGenericAdaptor::Conv2DBackpropInputOpGenericAdaptor; + Conv2DBackpropInputOpAdaptor(Conv2DBackpropInputOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Conv2DBackpropInputOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, LayoutSensitiveInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = Conv2DBackpropInputOpAdaptor; + template + using GenericAdaptor = Conv2DBackpropInputOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("data_format"), ::llvm::StringRef("dilations"), ::llvm::StringRef("explicit_paddings"), ::llvm::StringRef("padding"), ::llvm::StringRef("strides"), ::llvm::StringRef("use_cudnn_on_gpu")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getExplicitPaddingsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getExplicitPaddingsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getUseCudnnOnGpuAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getUseCudnnOnGpuAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Conv2DBackpropInput"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputSizes(); + ::mlir::TypedValue<::mlir::TensorType> getFilter(); + ::mlir::TypedValue<::mlir::TensorType> getOutBackprop(); + ::mlir::OpOperand &getInputSizesMutable(); + ::mlir::OpOperand &getFilterMutable(); + ::mlir::OpOperand &getOutBackpropMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::BoolAttr getUseCudnnOnGpuAttr(); + bool getUseCudnnOnGpu(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getExplicitPaddingsAttr(); + ::mlir::ArrayAttr getExplicitPaddings(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::ArrayAttr getDilationsAttr(); + ::mlir::ArrayAttr getDilations(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setStridesAttr(::mlir::ArrayAttr attr); + void setUseCudnnOnGpuAttr(::mlir::BoolAttr attr); + void setUseCudnnOnGpu(::std::optional attrValue); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + void setExplicitPaddingsAttr(::mlir::ArrayAttr attr); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + void setDilationsAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeUseCudnnOnGpuAttr(); + ::mlir::Attribute removeExplicitPaddingsAttr(); + ::mlir::Attribute removeDataFormatAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input_sizes, ::mlir::Value filter, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, /*optional*/::mlir::BoolAttr use_cudnn_on_gpu, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_sizes, ::mlir::Value filter, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, /*optional*/::mlir::BoolAttr use_cudnn_on_gpu, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input_sizes, ::mlir::Value filter, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, /*optional*/bool use_cudnn_on_gpu, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::llvm::StringRef data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_sizes, ::mlir::Value filter, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, /*optional*/bool use_cudnn_on_gpu, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::llvm::StringRef data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 7 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // TF_LayoutSensitiveInterface: + SmallVector GetLayoutDependentArgs() { return {2}; } + SmallVector GetLayoutDependentResults() { return {0}; } + StringRef GetOptimalLayout(const RuntimeDevices& devices); + LogicalResult UpdateDataFormat(StringRef data_format); +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::Conv2DBackpropInputOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::Conv2DBackpropInputV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Conv2DBackpropInputV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + Conv2DBackpropInputV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + Conv2DBackpropInputV2OpGenericAdaptorBase(Conv2DBackpropInputV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::BoolAttr getUseCudnnOnGpuAttr(); + bool getUseCudnnOnGpu(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getExplicitPaddingsAttr(); + ::mlir::ArrayAttr getExplicitPaddings(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::ArrayAttr getDilationsAttr(); + ::mlir::ArrayAttr getDilations(); +}; +} // namespace detail +template +class Conv2DBackpropInputV2OpGenericAdaptor : public detail::Conv2DBackpropInputV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Conv2DBackpropInputV2OpGenericAdaptorBase; +public: + Conv2DBackpropInputV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Conv2DBackpropInputV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Conv2DBackpropInputV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + Conv2DBackpropInputV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getFilter() { + return (*getODSOperands(1).begin()); + } + + ValueT getOutBackprop() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Conv2DBackpropInputV2OpAdaptor : public Conv2DBackpropInputV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using Conv2DBackpropInputV2OpGenericAdaptor::Conv2DBackpropInputV2OpGenericAdaptor; + Conv2DBackpropInputV2OpAdaptor(Conv2DBackpropInputV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Conv2DBackpropInputV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = Conv2DBackpropInputV2OpAdaptor; + template + using GenericAdaptor = Conv2DBackpropInputV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("data_format"), ::llvm::StringRef("dilations"), ::llvm::StringRef("explicit_paddings"), ::llvm::StringRef("padding"), ::llvm::StringRef("strides"), ::llvm::StringRef("use_cudnn_on_gpu")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getExplicitPaddingsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getExplicitPaddingsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getUseCudnnOnGpuAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getUseCudnnOnGpuAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Conv2DBackpropInputV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getFilter(); + ::mlir::TypedValue<::mlir::TensorType> getOutBackprop(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getFilterMutable(); + ::mlir::OpOperand &getOutBackpropMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::BoolAttr getUseCudnnOnGpuAttr(); + bool getUseCudnnOnGpu(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getExplicitPaddingsAttr(); + ::mlir::ArrayAttr getExplicitPaddings(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::ArrayAttr getDilationsAttr(); + ::mlir::ArrayAttr getDilations(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setStridesAttr(::mlir::ArrayAttr attr); + void setUseCudnnOnGpuAttr(::mlir::BoolAttr attr); + void setUseCudnnOnGpu(::std::optional attrValue); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + void setExplicitPaddingsAttr(::mlir::ArrayAttr attr); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + void setDilationsAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeUseCudnnOnGpuAttr(); + ::mlir::Attribute removeExplicitPaddingsAttr(); + ::mlir::Attribute removeDataFormatAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value filter, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, /*optional*/::mlir::BoolAttr use_cudnn_on_gpu, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, /*optional*/::mlir::BoolAttr use_cudnn_on_gpu, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value filter, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, /*optional*/bool use_cudnn_on_gpu, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::llvm::StringRef data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, /*optional*/bool use_cudnn_on_gpu, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::llvm::StringRef data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 7 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::Conv2DBackpropInputV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::Conv2DOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Conv2DOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + Conv2DOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + Conv2DOpGenericAdaptorBase(Conv2DOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::BoolAttr getUseCudnnOnGpuAttr(); + bool getUseCudnnOnGpu(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getExplicitPaddingsAttr(); + ::mlir::ArrayAttr getExplicitPaddings(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::ArrayAttr getDilationsAttr(); + ::mlir::ArrayAttr getDilations(); +}; +} // namespace detail +template +class Conv2DOpGenericAdaptor : public detail::Conv2DOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Conv2DOpGenericAdaptorBase; +public: + Conv2DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Conv2DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Conv2DOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + Conv2DOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getFilter() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Conv2DOpAdaptor : public Conv2DOpGenericAdaptor<::mlir::ValueRange> { +public: + using Conv2DOpGenericAdaptor::Conv2DOpGenericAdaptor; + Conv2DOpAdaptor(Conv2DOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Conv2DOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, LayoutSensitiveInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = Conv2DOpAdaptor; + template + using GenericAdaptor = Conv2DOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("data_format"), ::llvm::StringRef("dilations"), ::llvm::StringRef("explicit_paddings"), ::llvm::StringRef("padding"), ::llvm::StringRef("strides"), ::llvm::StringRef("use_cudnn_on_gpu")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getExplicitPaddingsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getExplicitPaddingsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getUseCudnnOnGpuAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getUseCudnnOnGpuAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Conv2D"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getFilter(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getFilterMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::BoolAttr getUseCudnnOnGpuAttr(); + bool getUseCudnnOnGpu(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getExplicitPaddingsAttr(); + ::mlir::ArrayAttr getExplicitPaddings(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::ArrayAttr getDilationsAttr(); + ::mlir::ArrayAttr getDilations(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setStridesAttr(::mlir::ArrayAttr attr); + void setUseCudnnOnGpuAttr(::mlir::BoolAttr attr); + void setUseCudnnOnGpu(::std::optional attrValue); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + void setExplicitPaddingsAttr(::mlir::ArrayAttr attr); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + void setDilationsAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeUseCudnnOnGpuAttr(); + ::mlir::Attribute removeExplicitPaddingsAttr(); + ::mlir::Attribute removeDataFormatAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value filter, ::mlir::ArrayAttr strides, /*optional*/::mlir::BoolAttr use_cudnn_on_gpu, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value filter, ::mlir::ArrayAttr strides, /*optional*/::mlir::BoolAttr use_cudnn_on_gpu, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter, ::mlir::ArrayAttr strides, /*optional*/::mlir::BoolAttr use_cudnn_on_gpu, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value filter, ::mlir::ArrayAttr strides, /*optional*/bool use_cudnn_on_gpu, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::llvm::StringRef data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value filter, ::mlir::ArrayAttr strides, /*optional*/bool use_cudnn_on_gpu, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::llvm::StringRef data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter, ::mlir::ArrayAttr strides, /*optional*/bool use_cudnn_on_gpu, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::llvm::StringRef data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 7 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // TF_LayoutSensitiveInterface: + SmallVector GetLayoutDependentArgs() { return {0}; } + SmallVector GetLayoutDependentResults() { return {0}; } + StringRef GetOptimalLayout(const RuntimeDevices& devices); + LogicalResult UpdateDataFormat(StringRef data_format); + // InferTypeOpInterface: + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return ArraysAreCastCompatible(l, r); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::Conv2DOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::Conv3DBackpropFilterOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Conv3DBackpropFilterOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + Conv3DBackpropFilterOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + Conv3DBackpropFilterOpGenericAdaptorBase(Conv3DBackpropFilterOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getDilationsAttr(); + ::mlir::ArrayAttr getDilations(); +}; +} // namespace detail +template +class Conv3DBackpropFilterOpGenericAdaptor : public detail::Conv3DBackpropFilterOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Conv3DBackpropFilterOpGenericAdaptorBase; +public: + Conv3DBackpropFilterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Conv3DBackpropFilterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Conv3DBackpropFilterOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + Conv3DBackpropFilterOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getFilter() { + return (*getODSOperands(1).begin()); + } + + ValueT getOutBackprop() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Conv3DBackpropFilterOpAdaptor : public Conv3DBackpropFilterOpGenericAdaptor<::mlir::ValueRange> { +public: + using Conv3DBackpropFilterOpGenericAdaptor::Conv3DBackpropFilterOpGenericAdaptor; + Conv3DBackpropFilterOpAdaptor(Conv3DBackpropFilterOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Conv3DBackpropFilterOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = Conv3DBackpropFilterOpAdaptor; + template + using GenericAdaptor = Conv3DBackpropFilterOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("dilations"), ::llvm::StringRef("padding"), ::llvm::StringRef("strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Conv3DBackpropFilter"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getFilter(); + ::mlir::TypedValue<::mlir::TensorType> getOutBackprop(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getFilterMutable(); + ::mlir::OpOperand &getOutBackpropMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getDilationsAttr(); + ::mlir::ArrayAttr getDilations(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setStridesAttr(::mlir::ArrayAttr attr); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + void setDilationsAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value filter, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value filter, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::Conv3DBackpropFilterOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::Conv3DBackpropFilterV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Conv3DBackpropFilterV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + Conv3DBackpropFilterV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + Conv3DBackpropFilterV2OpGenericAdaptorBase(Conv3DBackpropFilterV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::ArrayAttr getDilationsAttr(); + ::mlir::ArrayAttr getDilations(); +}; +} // namespace detail +template +class Conv3DBackpropFilterV2OpGenericAdaptor : public detail::Conv3DBackpropFilterV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Conv3DBackpropFilterV2OpGenericAdaptorBase; +public: + Conv3DBackpropFilterV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Conv3DBackpropFilterV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Conv3DBackpropFilterV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + Conv3DBackpropFilterV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getFilterSizes() { + return (*getODSOperands(1).begin()); + } + + ValueT getOutBackprop() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Conv3DBackpropFilterV2OpAdaptor : public Conv3DBackpropFilterV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using Conv3DBackpropFilterV2OpGenericAdaptor::Conv3DBackpropFilterV2OpGenericAdaptor; + Conv3DBackpropFilterV2OpAdaptor(Conv3DBackpropFilterV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Conv3DBackpropFilterV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = Conv3DBackpropFilterV2OpAdaptor; + template + using GenericAdaptor = Conv3DBackpropFilterV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("data_format"), ::llvm::StringRef("dilations"), ::llvm::StringRef("padding"), ::llvm::StringRef("strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Conv3DBackpropFilterV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getFilterSizes(); + ::mlir::TypedValue<::mlir::TensorType> getOutBackprop(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getFilterSizesMutable(); + ::mlir::OpOperand &getOutBackpropMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::ArrayAttr getDilationsAttr(); + ::mlir::ArrayAttr getDilations(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setStridesAttr(::mlir::ArrayAttr attr); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + void setDilationsAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeDataFormatAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value filter_sizes, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter_sizes, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value filter_sizes, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::llvm::StringRef data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter_sizes, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::llvm::StringRef data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::Conv3DBackpropFilterV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::Conv3DBackpropInputOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Conv3DBackpropInputOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + Conv3DBackpropInputOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + Conv3DBackpropInputOpGenericAdaptorBase(Conv3DBackpropInputOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getDilationsAttr(); + ::mlir::ArrayAttr getDilations(); +}; +} // namespace detail +template +class Conv3DBackpropInputOpGenericAdaptor : public detail::Conv3DBackpropInputOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Conv3DBackpropInputOpGenericAdaptorBase; +public: + Conv3DBackpropInputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Conv3DBackpropInputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Conv3DBackpropInputOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + Conv3DBackpropInputOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getFilter() { + return (*getODSOperands(1).begin()); + } + + ValueT getOutBackprop() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Conv3DBackpropInputOpAdaptor : public Conv3DBackpropInputOpGenericAdaptor<::mlir::ValueRange> { +public: + using Conv3DBackpropInputOpGenericAdaptor::Conv3DBackpropInputOpGenericAdaptor; + Conv3DBackpropInputOpAdaptor(Conv3DBackpropInputOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Conv3DBackpropInputOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = Conv3DBackpropInputOpAdaptor; + template + using GenericAdaptor = Conv3DBackpropInputOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("dilations"), ::llvm::StringRef("padding"), ::llvm::StringRef("strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Conv3DBackpropInput"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getFilter(); + ::mlir::TypedValue<::mlir::TensorType> getOutBackprop(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getFilterMutable(); + ::mlir::OpOperand &getOutBackpropMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getDilationsAttr(); + ::mlir::ArrayAttr getDilations(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setStridesAttr(::mlir::ArrayAttr attr); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + void setDilationsAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value filter, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value filter, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::Conv3DBackpropInputOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::Conv3DBackpropInputV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Conv3DBackpropInputV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + Conv3DBackpropInputV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + Conv3DBackpropInputV2OpGenericAdaptorBase(Conv3DBackpropInputV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::ArrayAttr getDilationsAttr(); + ::mlir::ArrayAttr getDilations(); +}; +} // namespace detail +template +class Conv3DBackpropInputV2OpGenericAdaptor : public detail::Conv3DBackpropInputV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Conv3DBackpropInputV2OpGenericAdaptorBase; +public: + Conv3DBackpropInputV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Conv3DBackpropInputV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Conv3DBackpropInputV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + Conv3DBackpropInputV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputSizes() { + return (*getODSOperands(0).begin()); + } + + ValueT getFilter() { + return (*getODSOperands(1).begin()); + } + + ValueT getOutBackprop() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Conv3DBackpropInputV2OpAdaptor : public Conv3DBackpropInputV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using Conv3DBackpropInputV2OpGenericAdaptor::Conv3DBackpropInputV2OpGenericAdaptor; + Conv3DBackpropInputV2OpAdaptor(Conv3DBackpropInputV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Conv3DBackpropInputV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = Conv3DBackpropInputV2OpAdaptor; + template + using GenericAdaptor = Conv3DBackpropInputV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tshape"), ::llvm::StringRef("data_format"), ::llvm::StringRef("dilations"), ::llvm::StringRef("padding"), ::llvm::StringRef("strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTshapeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTshapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Conv3DBackpropInputV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputSizes(); + ::mlir::TypedValue<::mlir::TensorType> getFilter(); + ::mlir::TypedValue<::mlir::TensorType> getOutBackprop(); + ::mlir::OpOperand &getInputSizesMutable(); + ::mlir::OpOperand &getFilterMutable(); + ::mlir::OpOperand &getOutBackpropMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::ArrayAttr getDilationsAttr(); + ::mlir::ArrayAttr getDilations(); + ::mlir::Type getT(); + ::mlir::Type getTshape(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setStridesAttr(::mlir::ArrayAttr attr); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + void setDilationsAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeDataFormatAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input_sizes, ::mlir::Value filter, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_sizes, ::mlir::Value filter, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input_sizes, ::mlir::Value filter, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::llvm::StringRef data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_sizes, ::mlir::Value filter, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::llvm::StringRef data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::Conv3DBackpropInputV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::Conv3DOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Conv3DOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + Conv3DOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + Conv3DOpGenericAdaptorBase(Conv3DOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::ArrayAttr getDilationsAttr(); + ::mlir::ArrayAttr getDilations(); +}; +} // namespace detail +template +class Conv3DOpGenericAdaptor : public detail::Conv3DOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Conv3DOpGenericAdaptorBase; +public: + Conv3DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Conv3DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Conv3DOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + Conv3DOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getFilter() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Conv3DOpAdaptor : public Conv3DOpGenericAdaptor<::mlir::ValueRange> { +public: + using Conv3DOpGenericAdaptor::Conv3DOpGenericAdaptor; + Conv3DOpAdaptor(Conv3DOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Conv3DOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = Conv3DOpAdaptor; + template + using GenericAdaptor = Conv3DOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("data_format"), ::llvm::StringRef("dilations"), ::llvm::StringRef("padding"), ::llvm::StringRef("strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Conv3D"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getFilter(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getFilterMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::ArrayAttr getDilationsAttr(); + ::mlir::ArrayAttr getDilations(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setStridesAttr(::mlir::ArrayAttr attr); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + void setDilationsAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeDataFormatAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value filter, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value filter, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value filter, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::llvm::StringRef data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value filter, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::llvm::StringRef data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::llvm::StringRef data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // InferTypeOpInterface: + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return ArraysAreCastCompatible(l, r); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::Conv3DOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ConvOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConvOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ConvOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ConvOpGenericAdaptorBase(ConvOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getExplicitPaddingsAttr(); + ::mlir::ArrayAttr getExplicitPaddings(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::ArrayAttr getDilationsAttr(); + ::mlir::ArrayAttr getDilations(); + ::mlir::IntegerAttr getBatchDimsAttr(); + uint64_t getBatchDims(); + ::mlir::IntegerAttr getGroupsAttr(); + uint64_t getGroups(); +}; +} // namespace detail +template +class ConvOpGenericAdaptor : public detail::ConvOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConvOpGenericAdaptorBase; +public: + ConvOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConvOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConvOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ConvOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getFilter() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConvOpAdaptor : public ConvOpGenericAdaptor<::mlir::ValueRange> { +public: + using ConvOpGenericAdaptor::ConvOpGenericAdaptor; + ConvOpAdaptor(ConvOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConvOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ConvOpAdaptor; + template + using GenericAdaptor = ConvOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("batch_dims"), ::llvm::StringRef("data_format"), ::llvm::StringRef("dilations"), ::llvm::StringRef("explicit_paddings"), ::llvm::StringRef("groups"), ::llvm::StringRef("padding"), ::llvm::StringRef("strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getBatchDimsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getBatchDimsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getExplicitPaddingsAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getExplicitPaddingsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getGroupsAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getGroupsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Conv"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getFilter(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getFilterMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getExplicitPaddingsAttr(); + ::mlir::ArrayAttr getExplicitPaddings(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::ArrayAttr getDilationsAttr(); + ::mlir::ArrayAttr getDilations(); + ::mlir::IntegerAttr getBatchDimsAttr(); + uint64_t getBatchDims(); + ::mlir::IntegerAttr getGroupsAttr(); + uint64_t getGroups(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setStridesAttr(::mlir::ArrayAttr attr); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + void setExplicitPaddingsAttr(::mlir::ArrayAttr attr); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + void setDilationsAttr(::mlir::ArrayAttr attr); + void setBatchDimsAttr(::mlir::IntegerAttr attr); + void setBatchDims(::std::optional attrValue); + void setGroupsAttr(::mlir::IntegerAttr attr); + void setGroups(::std::optional attrValue); + ::mlir::Attribute removeExplicitPaddingsAttr(); + ::mlir::Attribute removeDataFormatAttr(); + ::mlir::Attribute removeDilationsAttr(); + ::mlir::Attribute removeBatchDimsAttr(); + ::mlir::Attribute removeGroupsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value filter, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::ArrayAttr dilations, /*optional*/::mlir::IntegerAttr batch_dims, /*optional*/::mlir::IntegerAttr groups); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::ArrayAttr dilations, /*optional*/::mlir::IntegerAttr batch_dims, /*optional*/::mlir::IntegerAttr groups); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value filter, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::llvm::StringRef data_format, /*optional*/::mlir::ArrayAttr dilations, /*optional*/uint64_t batch_dims = 1, /*optional*/uint64_t groups = 1); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::llvm::StringRef data_format, /*optional*/::mlir::ArrayAttr dilations, /*optional*/uint64_t batch_dims = 1, /*optional*/uint64_t groups = 1); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 8 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ConvOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ConvertToCooTensorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConvertToCooTensorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ConvertToCooTensorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ConvertToCooTensorOpGenericAdaptorBase(ConvertToCooTensorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getSampleCountAttr(); + uint64_t getSampleCount(); + ::mlir::StringAttr getCombinerAttr(); + ::llvm::StringRef getCombiner(); +}; +} // namespace detail +template +class ConvertToCooTensorOpGenericAdaptor : public detail::ConvertToCooTensorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConvertToCooTensorOpGenericAdaptorBase; +public: + ConvertToCooTensorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConvertToCooTensorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConvertToCooTensorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ConvertToCooTensorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIndicesOrRowSplits() { + return (*getODSOperands(0).begin()); + } + + ValueT getValues() { + return (*getODSOperands(1).begin()); + } + + ValueT getWeights() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConvertToCooTensorOpAdaptor : public ConvertToCooTensorOpGenericAdaptor<::mlir::ValueRange> { +public: + using ConvertToCooTensorOpGenericAdaptor::ConvertToCooTensorOpGenericAdaptor; + ConvertToCooTensorOpAdaptor(ConvertToCooTensorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConvertToCooTensorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ConvertToCooTensorOpAdaptor; + template + using GenericAdaptor = ConvertToCooTensorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("combiner"), ::llvm::StringRef("sample_count")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getCombinerAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getCombinerAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getSampleCountAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getSampleCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ConvertToCooTensor"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getIndicesOrRowSplits(); + ::mlir::TypedValue<::mlir::TensorType> getValues(); + ::mlir::TypedValue<::mlir::TensorType> getWeights(); + ::mlir::OpOperand &getIndicesOrRowSplitsMutable(); + ::mlir::OpOperand &getValuesMutable(); + ::mlir::OpOperand &getWeightsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getRowIds(); + ::mlir::TypedValue<::mlir::TensorType> getColIds(); + ::mlir::TypedValue<::mlir::TensorType> getGains(); + ::mlir::IntegerAttr getSampleCountAttr(); + uint64_t getSampleCount(); + ::mlir::StringAttr getCombinerAttr(); + ::llvm::StringRef getCombiner(); + void setSampleCountAttr(::mlir::IntegerAttr attr); + void setSampleCount(uint64_t attrValue); + void setCombinerAttr(::mlir::StringAttr attr); + void setCombiner(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type row_ids, ::mlir::Type col_ids, ::mlir::Type gains, ::mlir::Value indices_or_row_splits, ::mlir::Value values, ::mlir::Value weights, ::mlir::IntegerAttr sample_count, ::mlir::StringAttr combiner); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value indices_or_row_splits, ::mlir::Value values, ::mlir::Value weights, ::mlir::IntegerAttr sample_count, ::mlir::StringAttr combiner); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type row_ids, ::mlir::Type col_ids, ::mlir::Type gains, ::mlir::Value indices_or_row_splits, ::mlir::Value values, ::mlir::Value weights, uint64_t sample_count, ::llvm::StringRef combiner); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value indices_or_row_splits, ::mlir::Value values, ::mlir::Value weights, uint64_t sample_count, ::llvm::StringRef combiner); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ConvertToCooTensorOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::CosOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CosOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CosOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CosOpGenericAdaptorBase(CosOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CosOpGenericAdaptor : public detail::CosOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CosOpGenericAdaptorBase; +public: + CosOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CosOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CosOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CosOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CosOpAdaptor : public CosOpGenericAdaptor<::mlir::ValueRange> { +public: + using CosOpGenericAdaptor::CosOpGenericAdaptor; + CosOpAdaptor(CosOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CosOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CosOpAdaptor; + template + using GenericAdaptor = CosOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Cos"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::CosOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::CoshOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CoshOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CoshOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CoshOpGenericAdaptorBase(CoshOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CoshOpGenericAdaptor : public detail::CoshOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CoshOpGenericAdaptorBase; +public: + CoshOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CoshOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CoshOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CoshOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CoshOpAdaptor : public CoshOpGenericAdaptor<::mlir::ValueRange> { +public: + using CoshOpGenericAdaptor::CoshOpGenericAdaptor; + CoshOpAdaptor(CoshOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CoshOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CoshOpAdaptor; + template + using GenericAdaptor = CoshOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Cosh"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::CoshOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::CreateSummaryDbWriterOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CreateSummaryDbWriterOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CreateSummaryDbWriterOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CreateSummaryDbWriterOpGenericAdaptorBase(CreateSummaryDbWriterOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CreateSummaryDbWriterOpGenericAdaptor : public detail::CreateSummaryDbWriterOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CreateSummaryDbWriterOpGenericAdaptorBase; +public: + CreateSummaryDbWriterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CreateSummaryDbWriterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CreateSummaryDbWriterOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CreateSummaryDbWriterOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getWriter() { + return (*getODSOperands(0).begin()); + } + + ValueT getDbUri() { + return (*getODSOperands(1).begin()); + } + + ValueT getExperimentName() { + return (*getODSOperands(2).begin()); + } + + ValueT getRunName() { + return (*getODSOperands(3).begin()); + } + + ValueT getUserName() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CreateSummaryDbWriterOpAdaptor : public CreateSummaryDbWriterOpGenericAdaptor<::mlir::ValueRange> { +public: + using CreateSummaryDbWriterOpGenericAdaptor::CreateSummaryDbWriterOpGenericAdaptor; + CreateSummaryDbWriterOpAdaptor(CreateSummaryDbWriterOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CreateSummaryDbWriterOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CreateSummaryDbWriterOpAdaptor; + template + using GenericAdaptor = CreateSummaryDbWriterOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.CreateSummaryDbWriter"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getWriter(); + ::mlir::TypedValue<::mlir::TensorType> getDbUri(); + ::mlir::TypedValue<::mlir::TensorType> getExperimentName(); + ::mlir::TypedValue<::mlir::TensorType> getRunName(); + ::mlir::TypedValue<::mlir::TensorType> getUserName(); + ::mlir::OpOperand &getWriterMutable(); + ::mlir::OpOperand &getDbUriMutable(); + ::mlir::OpOperand &getExperimentNameMutable(); + ::mlir::OpOperand &getRunNameMutable(); + ::mlir::OpOperand &getUserNameMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value writer, ::mlir::Value db_uri, ::mlir::Value experiment_name, ::mlir::Value run_name, ::mlir::Value user_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value writer, ::mlir::Value db_uri, ::mlir::Value experiment_name, ::mlir::Value run_name, ::mlir::Value user_name); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::CreateSummaryDbWriterOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::CreateSummaryFileWriterOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CreateSummaryFileWriterOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CreateSummaryFileWriterOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CreateSummaryFileWriterOpGenericAdaptorBase(CreateSummaryFileWriterOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CreateSummaryFileWriterOpGenericAdaptor : public detail::CreateSummaryFileWriterOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CreateSummaryFileWriterOpGenericAdaptorBase; +public: + CreateSummaryFileWriterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CreateSummaryFileWriterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CreateSummaryFileWriterOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CreateSummaryFileWriterOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getWriter() { + return (*getODSOperands(0).begin()); + } + + ValueT getLogdir() { + return (*getODSOperands(1).begin()); + } + + ValueT getMaxQueue() { + return (*getODSOperands(2).begin()); + } + + ValueT getFlushMillis() { + return (*getODSOperands(3).begin()); + } + + ValueT getFilenameSuffix() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CreateSummaryFileWriterOpAdaptor : public CreateSummaryFileWriterOpGenericAdaptor<::mlir::ValueRange> { +public: + using CreateSummaryFileWriterOpGenericAdaptor::CreateSummaryFileWriterOpGenericAdaptor; + CreateSummaryFileWriterOpAdaptor(CreateSummaryFileWriterOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CreateSummaryFileWriterOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CreateSummaryFileWriterOpAdaptor; + template + using GenericAdaptor = CreateSummaryFileWriterOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.CreateSummaryFileWriter"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getWriter(); + ::mlir::TypedValue<::mlir::TensorType> getLogdir(); + ::mlir::TypedValue<::mlir::TensorType> getMaxQueue(); + ::mlir::TypedValue<::mlir::TensorType> getFlushMillis(); + ::mlir::TypedValue<::mlir::TensorType> getFilenameSuffix(); + ::mlir::OpOperand &getWriterMutable(); + ::mlir::OpOperand &getLogdirMutable(); + ::mlir::OpOperand &getMaxQueueMutable(); + ::mlir::OpOperand &getFlushMillisMutable(); + ::mlir::OpOperand &getFilenameSuffixMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value writer, ::mlir::Value logdir, ::mlir::Value max_queue, ::mlir::Value flush_millis, ::mlir::Value filename_suffix); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value writer, ::mlir::Value logdir, ::mlir::Value max_queue, ::mlir::Value flush_millis, ::mlir::Value filename_suffix); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::CreateSummaryFileWriterOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::CrossOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CrossOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CrossOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CrossOpGenericAdaptorBase(CrossOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CrossOpGenericAdaptor : public detail::CrossOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CrossOpGenericAdaptorBase; +public: + CrossOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CrossOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CrossOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CrossOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + ValueT getB() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CrossOpAdaptor : public CrossOpGenericAdaptor<::mlir::ValueRange> { +public: + using CrossOpGenericAdaptor::CrossOpGenericAdaptor; + CrossOpAdaptor(CrossOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CrossOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CrossOpAdaptor; + template + using GenericAdaptor = CrossOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Cross"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getA(); + ::mlir::TypedValue<::mlir::TensorType> getB(); + ::mlir::OpOperand &getAMutable(); + ::mlir::OpOperand &getBMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getProduct(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type product, ::mlir::Value a, ::mlir::Value b); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::CrossOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::CrossReplicaSumOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CrossReplicaSumOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CrossReplicaSumOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CrossReplicaSumOpGenericAdaptorBase(CrossReplicaSumOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CrossReplicaSumOpGenericAdaptor : public detail::CrossReplicaSumOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CrossReplicaSumOpGenericAdaptorBase; +public: + CrossReplicaSumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CrossReplicaSumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CrossReplicaSumOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CrossReplicaSumOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getGroupAssignment() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CrossReplicaSumOpAdaptor : public CrossReplicaSumOpGenericAdaptor<::mlir::ValueRange> { +public: + using CrossReplicaSumOpGenericAdaptor::CrossReplicaSumOpGenericAdaptor; + CrossReplicaSumOpAdaptor(CrossReplicaSumOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CrossReplicaSumOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CrossReplicaSumOpAdaptor; + template + using GenericAdaptor = CrossReplicaSumOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.CrossReplicaSum"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getGroupAssignment(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getGroupAssignmentMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value group_assignment); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value group_assignment); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::CrossReplicaSumOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::CumprodOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CumprodOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CumprodOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CumprodOpGenericAdaptorBase(CumprodOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getExclusiveAttr(); + bool getExclusive(); + ::mlir::BoolAttr getReverseAttr(); + bool getReverse(); +}; +} // namespace detail +template +class CumprodOpGenericAdaptor : public detail::CumprodOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CumprodOpGenericAdaptorBase; +public: + CumprodOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CumprodOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CumprodOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CumprodOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getAxis() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CumprodOpAdaptor : public CumprodOpGenericAdaptor<::mlir::ValueRange> { +public: + using CumprodOpGenericAdaptor::CumprodOpGenericAdaptor; + CumprodOpAdaptor(CumprodOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CumprodOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CumprodOpAdaptor; + template + using GenericAdaptor = CumprodOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tidx"), ::llvm::StringRef("exclusive"), ::llvm::StringRef("reverse")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTidxAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTidxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getExclusiveAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getExclusiveAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getReverseAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getReverseAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Cumprod"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getAxis(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getAxisMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOut(); + ::mlir::BoolAttr getExclusiveAttr(); + bool getExclusive(); + ::mlir::BoolAttr getReverseAttr(); + bool getReverse(); + ::mlir::Type getT(); + ::mlir::Type getTidx(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setExclusiveAttr(::mlir::BoolAttr attr); + void setExclusive(::std::optional attrValue); + void setReverseAttr(::mlir::BoolAttr attr); + void setReverse(::std::optional attrValue); + ::mlir::Attribute removeExclusiveAttr(); + ::mlir::Attribute removeReverseAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, ::mlir::Value x, ::mlir::Value axis, /*optional*/::mlir::BoolAttr exclusive, /*optional*/::mlir::BoolAttr reverse); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value axis, /*optional*/::mlir::BoolAttr exclusive, /*optional*/::mlir::BoolAttr reverse); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, ::mlir::Value x, ::mlir::Value axis, /*optional*/bool exclusive = false, /*optional*/bool reverse = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value axis, /*optional*/bool exclusive = false, /*optional*/bool reverse = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::CumprodOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::CumsumOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CumsumOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CumsumOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CumsumOpGenericAdaptorBase(CumsumOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getExclusiveAttr(); + bool getExclusive(); + ::mlir::BoolAttr getReverseAttr(); + bool getReverse(); +}; +} // namespace detail +template +class CumsumOpGenericAdaptor : public detail::CumsumOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CumsumOpGenericAdaptorBase; +public: + CumsumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CumsumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CumsumOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CumsumOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getAxis() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CumsumOpAdaptor : public CumsumOpGenericAdaptor<::mlir::ValueRange> { +public: + using CumsumOpGenericAdaptor::CumsumOpGenericAdaptor; + CumsumOpAdaptor(CumsumOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CumsumOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CumsumOpAdaptor; + template + using GenericAdaptor = CumsumOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tidx"), ::llvm::StringRef("exclusive"), ::llvm::StringRef("reverse")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTidxAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTidxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getExclusiveAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getExclusiveAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getReverseAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getReverseAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Cumsum"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getAxis(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getAxisMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOut(); + ::mlir::BoolAttr getExclusiveAttr(); + bool getExclusive(); + ::mlir::BoolAttr getReverseAttr(); + bool getReverse(); + ::mlir::Type getT(); + ::mlir::Type getTidx(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setExclusiveAttr(::mlir::BoolAttr attr); + void setExclusive(::std::optional attrValue); + void setReverseAttr(::mlir::BoolAttr attr); + void setReverse(::std::optional attrValue); + ::mlir::Attribute removeExclusiveAttr(); + ::mlir::Attribute removeReverseAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, ::mlir::Value x, ::mlir::Value axis, /*optional*/::mlir::BoolAttr exclusive, /*optional*/::mlir::BoolAttr reverse); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value axis, /*optional*/::mlir::BoolAttr exclusive, /*optional*/::mlir::BoolAttr reverse); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, ::mlir::Value x, ::mlir::Value axis, /*optional*/bool exclusive = false, /*optional*/bool reverse = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value axis, /*optional*/bool exclusive = false, /*optional*/bool reverse = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::CumsumOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::CumulativeLogsumexpOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CumulativeLogsumexpOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CumulativeLogsumexpOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CumulativeLogsumexpOpGenericAdaptorBase(CumulativeLogsumexpOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getExclusiveAttr(); + bool getExclusive(); + ::mlir::BoolAttr getReverseAttr(); + bool getReverse(); +}; +} // namespace detail +template +class CumulativeLogsumexpOpGenericAdaptor : public detail::CumulativeLogsumexpOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CumulativeLogsumexpOpGenericAdaptorBase; +public: + CumulativeLogsumexpOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CumulativeLogsumexpOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CumulativeLogsumexpOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CumulativeLogsumexpOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getAxis() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CumulativeLogsumexpOpAdaptor : public CumulativeLogsumexpOpGenericAdaptor<::mlir::ValueRange> { +public: + using CumulativeLogsumexpOpGenericAdaptor::CumulativeLogsumexpOpGenericAdaptor; + CumulativeLogsumexpOpAdaptor(CumulativeLogsumexpOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CumulativeLogsumexpOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CumulativeLogsumexpOpAdaptor; + template + using GenericAdaptor = CumulativeLogsumexpOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tidx"), ::llvm::StringRef("exclusive"), ::llvm::StringRef("reverse")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTidxAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTidxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getExclusiveAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getExclusiveAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getReverseAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getReverseAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.CumulativeLogsumexp"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getAxis(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getAxisMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOut(); + ::mlir::BoolAttr getExclusiveAttr(); + bool getExclusive(); + ::mlir::BoolAttr getReverseAttr(); + bool getReverse(); + ::mlir::Type getT(); + ::mlir::Type getTidx(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setExclusiveAttr(::mlir::BoolAttr attr); + void setExclusive(::std::optional attrValue); + void setReverseAttr(::mlir::BoolAttr attr); + void setReverse(::std::optional attrValue); + ::mlir::Attribute removeExclusiveAttr(); + ::mlir::Attribute removeReverseAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, ::mlir::Value x, ::mlir::Value axis, /*optional*/::mlir::BoolAttr exclusive, /*optional*/::mlir::BoolAttr reverse); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value axis, /*optional*/::mlir::BoolAttr exclusive, /*optional*/::mlir::BoolAttr reverse); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, ::mlir::Value x, ::mlir::Value axis, /*optional*/bool exclusive = false, /*optional*/bool reverse = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value axis, /*optional*/bool exclusive = false, /*optional*/bool reverse = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::CumulativeLogsumexpOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DataFormatDimMapOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DataFormatDimMapOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DataFormatDimMapOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DataFormatDimMapOpGenericAdaptorBase(DataFormatDimMapOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getSrcFormatAttr(); + ::llvm::StringRef getSrcFormat(); + ::mlir::StringAttr getDstFormatAttr(); + ::llvm::StringRef getDstFormat(); +}; +} // namespace detail +template +class DataFormatDimMapOpGenericAdaptor : public detail::DataFormatDimMapOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DataFormatDimMapOpGenericAdaptorBase; +public: + DataFormatDimMapOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DataFormatDimMapOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DataFormatDimMapOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DataFormatDimMapOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DataFormatDimMapOpAdaptor : public DataFormatDimMapOpGenericAdaptor<::mlir::ValueRange> { +public: + using DataFormatDimMapOpGenericAdaptor::DataFormatDimMapOpGenericAdaptor; + DataFormatDimMapOpAdaptor(DataFormatDimMapOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DataFormatDimMapOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DataFormatDimMapOpAdaptor; + template + using GenericAdaptor = DataFormatDimMapOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("dst_format"), ::llvm::StringRef("src_format")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDstFormatAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDstFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getSrcFormatAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getSrcFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.DataFormatDimMap"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::StringAttr getSrcFormatAttr(); + ::llvm::StringRef getSrcFormat(); + ::mlir::StringAttr getDstFormatAttr(); + ::llvm::StringRef getDstFormat(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setSrcFormatAttr(::mlir::StringAttr attr); + void setSrcFormat(::std::optional<::llvm::StringRef> attrValue); + void setDstFormatAttr(::mlir::StringAttr attr); + void setDstFormat(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeSrcFormatAttr(); + ::mlir::Attribute removeDstFormatAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x, /*optional*/::mlir::StringAttr src_format, /*optional*/::mlir::StringAttr dst_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x, /*optional*/::mlir::StringAttr src_format, /*optional*/::mlir::StringAttr dst_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, /*optional*/::mlir::StringAttr src_format, /*optional*/::mlir::StringAttr dst_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x, /*optional*/::llvm::StringRef src_format = "NHWC", /*optional*/::llvm::StringRef dst_format = "NCHW"); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x, /*optional*/::llvm::StringRef src_format = "NHWC", /*optional*/::llvm::StringRef dst_format = "NCHW"); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, /*optional*/::llvm::StringRef src_format = "NHWC", /*optional*/::llvm::StringRef dst_format = "NCHW"); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DataFormatDimMapOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DataFormatVecPermuteOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DataFormatVecPermuteOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DataFormatVecPermuteOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DataFormatVecPermuteOpGenericAdaptorBase(DataFormatVecPermuteOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getSrcFormatAttr(); + ::llvm::StringRef getSrcFormat(); + ::mlir::StringAttr getDstFormatAttr(); + ::llvm::StringRef getDstFormat(); +}; +} // namespace detail +template +class DataFormatVecPermuteOpGenericAdaptor : public detail::DataFormatVecPermuteOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DataFormatVecPermuteOpGenericAdaptorBase; +public: + DataFormatVecPermuteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DataFormatVecPermuteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DataFormatVecPermuteOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DataFormatVecPermuteOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DataFormatVecPermuteOpAdaptor : public DataFormatVecPermuteOpGenericAdaptor<::mlir::ValueRange> { +public: + using DataFormatVecPermuteOpGenericAdaptor::DataFormatVecPermuteOpGenericAdaptor; + DataFormatVecPermuteOpAdaptor(DataFormatVecPermuteOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DataFormatVecPermuteOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DataFormatVecPermuteOpAdaptor; + template + using GenericAdaptor = DataFormatVecPermuteOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("dst_format"), ::llvm::StringRef("src_format")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDstFormatAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDstFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getSrcFormatAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getSrcFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.DataFormatVecPermute"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::StringAttr getSrcFormatAttr(); + ::llvm::StringRef getSrcFormat(); + ::mlir::StringAttr getDstFormatAttr(); + ::llvm::StringRef getDstFormat(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setSrcFormatAttr(::mlir::StringAttr attr); + void setSrcFormat(::std::optional<::llvm::StringRef> attrValue); + void setDstFormatAttr(::mlir::StringAttr attr); + void setDstFormat(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeSrcFormatAttr(); + ::mlir::Attribute removeDstFormatAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x, /*optional*/::mlir::StringAttr src_format, /*optional*/::mlir::StringAttr dst_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x, /*optional*/::mlir::StringAttr src_format, /*optional*/::mlir::StringAttr dst_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, /*optional*/::mlir::StringAttr src_format, /*optional*/::mlir::StringAttr dst_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x, /*optional*/::llvm::StringRef src_format = "NHWC", /*optional*/::llvm::StringRef dst_format = "NCHW"); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x, /*optional*/::llvm::StringRef src_format = "NHWC", /*optional*/::llvm::StringRef dst_format = "NCHW"); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, /*optional*/::llvm::StringRef src_format = "NHWC", /*optional*/::llvm::StringRef dst_format = "NCHW"); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DataFormatVecPermuteOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DebugIdentityV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DebugIdentityV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DebugIdentityV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DebugIdentityV2OpGenericAdaptorBase(DebugIdentityV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getTfdbgContextIdAttr(); + ::llvm::StringRef getTfdbgContextId(); + ::mlir::StringAttr getOpNameAttr(); + ::llvm::StringRef getOpName(); + ::mlir::IntegerAttr getOutputSlotAttr(); + uint64_t getOutputSlot(); + ::mlir::IntegerAttr getTensorDebugModeAttr(); + uint64_t getTensorDebugMode(); + ::mlir::ArrayAttr getDebugUrlsAttr(); + ::mlir::ArrayAttr getDebugUrls(); + ::mlir::IntegerAttr getCircularBufferSizeAttr(); + uint64_t getCircularBufferSize(); + ::mlir::StringAttr getTfdbgRunIdAttr(); + ::llvm::StringRef getTfdbgRunId(); +}; +} // namespace detail +template +class DebugIdentityV2OpGenericAdaptor : public detail::DebugIdentityV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DebugIdentityV2OpGenericAdaptorBase; +public: + DebugIdentityV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DebugIdentityV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DebugIdentityV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DebugIdentityV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DebugIdentityV2OpAdaptor : public DebugIdentityV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using DebugIdentityV2OpGenericAdaptor::DebugIdentityV2OpGenericAdaptor; + DebugIdentityV2OpAdaptor(DebugIdentityV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DebugIdentityV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DebugIdentityV2OpAdaptor; + template + using GenericAdaptor = DebugIdentityV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("circular_buffer_size"), ::llvm::StringRef("debug_urls"), ::llvm::StringRef("op_name"), ::llvm::StringRef("output_slot"), ::llvm::StringRef("tensor_debug_mode"), ::llvm::StringRef("tfdbg_context_id"), ::llvm::StringRef("tfdbg_run_id")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getCircularBufferSizeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getCircularBufferSizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDebugUrlsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDebugUrlsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getOpNameAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getOpNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getOutputSlotAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getOutputSlotAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getTensorDebugModeAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getTensorDebugModeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getTfdbgContextIdAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getTfdbgContextIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getTfdbgRunIdAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getTfdbgRunIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.DebugIdentityV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::StringAttr getTfdbgContextIdAttr(); + ::llvm::StringRef getTfdbgContextId(); + ::mlir::StringAttr getOpNameAttr(); + ::llvm::StringRef getOpName(); + ::mlir::IntegerAttr getOutputSlotAttr(); + uint64_t getOutputSlot(); + ::mlir::IntegerAttr getTensorDebugModeAttr(); + uint64_t getTensorDebugMode(); + ::mlir::ArrayAttr getDebugUrlsAttr(); + ::mlir::ArrayAttr getDebugUrls(); + ::mlir::IntegerAttr getCircularBufferSizeAttr(); + uint64_t getCircularBufferSize(); + ::mlir::StringAttr getTfdbgRunIdAttr(); + ::llvm::StringRef getTfdbgRunId(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setTfdbgContextIdAttr(::mlir::StringAttr attr); + void setTfdbgContextId(::std::optional<::llvm::StringRef> attrValue); + void setOpNameAttr(::mlir::StringAttr attr); + void setOpName(::std::optional<::llvm::StringRef> attrValue); + void setOutputSlotAttr(::mlir::IntegerAttr attr); + void setOutputSlot(::std::optional attrValue); + void setTensorDebugModeAttr(::mlir::IntegerAttr attr); + void setTensorDebugMode(::std::optional attrValue); + void setDebugUrlsAttr(::mlir::ArrayAttr attr); + void setCircularBufferSizeAttr(::mlir::IntegerAttr attr); + void setCircularBufferSize(::std::optional attrValue); + void setTfdbgRunIdAttr(::mlir::StringAttr attr); + void setTfdbgRunId(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTfdbgContextIdAttr(); + ::mlir::Attribute removeOpNameAttr(); + ::mlir::Attribute removeOutputSlotAttr(); + ::mlir::Attribute removeTensorDebugModeAttr(); + ::mlir::Attribute removeDebugUrlsAttr(); + ::mlir::Attribute removeCircularBufferSizeAttr(); + ::mlir::Attribute removeTfdbgRunIdAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, /*optional*/::mlir::StringAttr tfdbg_context_id, /*optional*/::mlir::StringAttr op_name, /*optional*/::mlir::IntegerAttr output_slot, /*optional*/::mlir::IntegerAttr tensor_debug_mode, /*optional*/::mlir::ArrayAttr debug_urls, /*optional*/::mlir::IntegerAttr circular_buffer_size, /*optional*/::mlir::StringAttr tfdbg_run_id); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, /*optional*/::mlir::StringAttr tfdbg_context_id, /*optional*/::mlir::StringAttr op_name, /*optional*/::mlir::IntegerAttr output_slot, /*optional*/::mlir::IntegerAttr tensor_debug_mode, /*optional*/::mlir::ArrayAttr debug_urls, /*optional*/::mlir::IntegerAttr circular_buffer_size, /*optional*/::mlir::StringAttr tfdbg_run_id); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, /*optional*/::llvm::StringRef tfdbg_context_id, /*optional*/::llvm::StringRef op_name, /*optional*/uint64_t output_slot, /*optional*/uint64_t tensor_debug_mode, /*optional*/::mlir::ArrayAttr debug_urls, /*optional*/uint64_t circular_buffer_size = 1000, /*optional*/::llvm::StringRef tfdbg_run_id = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, /*optional*/::llvm::StringRef tfdbg_context_id, /*optional*/::llvm::StringRef op_name, /*optional*/uint64_t output_slot, /*optional*/uint64_t tensor_debug_mode, /*optional*/::mlir::ArrayAttr debug_urls, /*optional*/uint64_t circular_buffer_size = 1000, /*optional*/::llvm::StringRef tfdbg_run_id = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 8 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DebugIdentityV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DecodeAndCropJpegOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DecodeAndCropJpegOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DecodeAndCropJpegOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DecodeAndCropJpegOpGenericAdaptorBase(DecodeAndCropJpegOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getChannelsAttr(); + uint64_t getChannels(); + ::mlir::IntegerAttr getRatioAttr(); + uint64_t getRatio(); + ::mlir::BoolAttr getFancyUpscalingAttr(); + bool getFancyUpscaling(); + ::mlir::BoolAttr getTryRecoverTruncatedAttr(); + bool getTryRecoverTruncated(); + ::mlir::FloatAttr getAcceptableFractionAttr(); + ::llvm::APFloat getAcceptableFraction(); + ::mlir::StringAttr getDctMethodAttr(); + ::llvm::StringRef getDctMethod(); +}; +} // namespace detail +template +class DecodeAndCropJpegOpGenericAdaptor : public detail::DecodeAndCropJpegOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DecodeAndCropJpegOpGenericAdaptorBase; +public: + DecodeAndCropJpegOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DecodeAndCropJpegOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DecodeAndCropJpegOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DecodeAndCropJpegOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getContents() { + return (*getODSOperands(0).begin()); + } + + ValueT getCropWindow() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DecodeAndCropJpegOpAdaptor : public DecodeAndCropJpegOpGenericAdaptor<::mlir::ValueRange> { +public: + using DecodeAndCropJpegOpGenericAdaptor::DecodeAndCropJpegOpGenericAdaptor; + DecodeAndCropJpegOpAdaptor(DecodeAndCropJpegOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DecodeAndCropJpegOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DecodeAndCropJpegOpAdaptor; + template + using GenericAdaptor = DecodeAndCropJpegOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("acceptable_fraction"), ::llvm::StringRef("channels"), ::llvm::StringRef("dct_method"), ::llvm::StringRef("fancy_upscaling"), ::llvm::StringRef("ratio"), ::llvm::StringRef("try_recover_truncated")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAcceptableFractionAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAcceptableFractionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getChannelsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getChannelsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDctMethodAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDctMethodAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getFancyUpscalingAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getFancyUpscalingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getRatioAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getRatioAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getTryRecoverTruncatedAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getTryRecoverTruncatedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.DecodeAndCropJpeg"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getContents(); + ::mlir::TypedValue<::mlir::TensorType> getCropWindow(); + ::mlir::OpOperand &getContentsMutable(); + ::mlir::OpOperand &getCropWindowMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getImage(); + ::mlir::IntegerAttr getChannelsAttr(); + uint64_t getChannels(); + ::mlir::IntegerAttr getRatioAttr(); + uint64_t getRatio(); + ::mlir::BoolAttr getFancyUpscalingAttr(); + bool getFancyUpscaling(); + ::mlir::BoolAttr getTryRecoverTruncatedAttr(); + bool getTryRecoverTruncated(); + ::mlir::FloatAttr getAcceptableFractionAttr(); + ::llvm::APFloat getAcceptableFraction(); + ::mlir::StringAttr getDctMethodAttr(); + ::llvm::StringRef getDctMethod(); + void setChannelsAttr(::mlir::IntegerAttr attr); + void setChannels(::std::optional attrValue); + void setRatioAttr(::mlir::IntegerAttr attr); + void setRatio(::std::optional attrValue); + void setFancyUpscalingAttr(::mlir::BoolAttr attr); + void setFancyUpscaling(::std::optional attrValue); + void setTryRecoverTruncatedAttr(::mlir::BoolAttr attr); + void setTryRecoverTruncated(::std::optional attrValue); + void setAcceptableFractionAttr(::mlir::FloatAttr attr); + void setAcceptableFraction(::std::optional<::llvm::APFloat> attrValue); + void setDctMethodAttr(::mlir::StringAttr attr); + void setDctMethod(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeChannelsAttr(); + ::mlir::Attribute removeRatioAttr(); + ::mlir::Attribute removeFancyUpscalingAttr(); + ::mlir::Attribute removeTryRecoverTruncatedAttr(); + ::mlir::Attribute removeAcceptableFractionAttr(); + ::mlir::Attribute removeDctMethodAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type image, ::mlir::Value contents, ::mlir::Value crop_window, /*optional*/::mlir::IntegerAttr channels, /*optional*/::mlir::IntegerAttr ratio, /*optional*/::mlir::BoolAttr fancy_upscaling, /*optional*/::mlir::BoolAttr try_recover_truncated, /*optional*/::mlir::FloatAttr acceptable_fraction, /*optional*/::mlir::StringAttr dct_method); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value contents, ::mlir::Value crop_window, /*optional*/::mlir::IntegerAttr channels, /*optional*/::mlir::IntegerAttr ratio, /*optional*/::mlir::BoolAttr fancy_upscaling, /*optional*/::mlir::BoolAttr try_recover_truncated, /*optional*/::mlir::FloatAttr acceptable_fraction, /*optional*/::mlir::StringAttr dct_method); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type image, ::mlir::Value contents, ::mlir::Value crop_window, /*optional*/uint64_t channels, /*optional*/uint64_t ratio, /*optional*/bool fancy_upscaling, /*optional*/bool try_recover_truncated, /*optional*/::llvm::APFloat acceptable_fraction, /*optional*/::llvm::StringRef dct_method = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value contents, ::mlir::Value crop_window, /*optional*/uint64_t channels, /*optional*/uint64_t ratio, /*optional*/bool fancy_upscaling, /*optional*/bool try_recover_truncated, /*optional*/::llvm::APFloat acceptable_fraction, /*optional*/::llvm::StringRef dct_method = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DecodeAndCropJpegOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DecodeGifOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DecodeGifOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DecodeGifOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DecodeGifOpGenericAdaptorBase(DecodeGifOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DecodeGifOpGenericAdaptor : public detail::DecodeGifOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DecodeGifOpGenericAdaptorBase; +public: + DecodeGifOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DecodeGifOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DecodeGifOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DecodeGifOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getContents() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DecodeGifOpAdaptor : public DecodeGifOpGenericAdaptor<::mlir::ValueRange> { +public: + using DecodeGifOpGenericAdaptor::DecodeGifOpGenericAdaptor; + DecodeGifOpAdaptor(DecodeGifOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DecodeGifOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DecodeGifOpAdaptor; + template + using GenericAdaptor = DecodeGifOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.DecodeGif"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getContents(); + ::mlir::OpOperand &getContentsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getImage(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type image, ::mlir::Value contents); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value contents); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DecodeGifOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DecodeJpegOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DecodeJpegOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DecodeJpegOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DecodeJpegOpGenericAdaptorBase(DecodeJpegOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getChannelsAttr(); + uint64_t getChannels(); + ::mlir::IntegerAttr getRatioAttr(); + uint64_t getRatio(); + ::mlir::BoolAttr getFancyUpscalingAttr(); + bool getFancyUpscaling(); + ::mlir::BoolAttr getTryRecoverTruncatedAttr(); + bool getTryRecoverTruncated(); + ::mlir::FloatAttr getAcceptableFractionAttr(); + ::llvm::APFloat getAcceptableFraction(); + ::mlir::StringAttr getDctMethodAttr(); + ::llvm::StringRef getDctMethod(); +}; +} // namespace detail +template +class DecodeJpegOpGenericAdaptor : public detail::DecodeJpegOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DecodeJpegOpGenericAdaptorBase; +public: + DecodeJpegOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DecodeJpegOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DecodeJpegOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DecodeJpegOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getContents() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DecodeJpegOpAdaptor : public DecodeJpegOpGenericAdaptor<::mlir::ValueRange> { +public: + using DecodeJpegOpGenericAdaptor::DecodeJpegOpGenericAdaptor; + DecodeJpegOpAdaptor(DecodeJpegOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DecodeJpegOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DecodeJpegOpAdaptor; + template + using GenericAdaptor = DecodeJpegOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("acceptable_fraction"), ::llvm::StringRef("channels"), ::llvm::StringRef("dct_method"), ::llvm::StringRef("fancy_upscaling"), ::llvm::StringRef("ratio"), ::llvm::StringRef("try_recover_truncated")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAcceptableFractionAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAcceptableFractionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getChannelsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getChannelsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDctMethodAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDctMethodAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getFancyUpscalingAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getFancyUpscalingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getRatioAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getRatioAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getTryRecoverTruncatedAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getTryRecoverTruncatedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.DecodeJpeg"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getContents(); + ::mlir::OpOperand &getContentsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getImage(); + ::mlir::IntegerAttr getChannelsAttr(); + uint64_t getChannels(); + ::mlir::IntegerAttr getRatioAttr(); + uint64_t getRatio(); + ::mlir::BoolAttr getFancyUpscalingAttr(); + bool getFancyUpscaling(); + ::mlir::BoolAttr getTryRecoverTruncatedAttr(); + bool getTryRecoverTruncated(); + ::mlir::FloatAttr getAcceptableFractionAttr(); + ::llvm::APFloat getAcceptableFraction(); + ::mlir::StringAttr getDctMethodAttr(); + ::llvm::StringRef getDctMethod(); + void setChannelsAttr(::mlir::IntegerAttr attr); + void setChannels(::std::optional attrValue); + void setRatioAttr(::mlir::IntegerAttr attr); + void setRatio(::std::optional attrValue); + void setFancyUpscalingAttr(::mlir::BoolAttr attr); + void setFancyUpscaling(::std::optional attrValue); + void setTryRecoverTruncatedAttr(::mlir::BoolAttr attr); + void setTryRecoverTruncated(::std::optional attrValue); + void setAcceptableFractionAttr(::mlir::FloatAttr attr); + void setAcceptableFraction(::std::optional<::llvm::APFloat> attrValue); + void setDctMethodAttr(::mlir::StringAttr attr); + void setDctMethod(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeChannelsAttr(); + ::mlir::Attribute removeRatioAttr(); + ::mlir::Attribute removeFancyUpscalingAttr(); + ::mlir::Attribute removeTryRecoverTruncatedAttr(); + ::mlir::Attribute removeAcceptableFractionAttr(); + ::mlir::Attribute removeDctMethodAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type image, ::mlir::Value contents, /*optional*/::mlir::IntegerAttr channels, /*optional*/::mlir::IntegerAttr ratio, /*optional*/::mlir::BoolAttr fancy_upscaling, /*optional*/::mlir::BoolAttr try_recover_truncated, /*optional*/::mlir::FloatAttr acceptable_fraction, /*optional*/::mlir::StringAttr dct_method); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value contents, /*optional*/::mlir::IntegerAttr channels, /*optional*/::mlir::IntegerAttr ratio, /*optional*/::mlir::BoolAttr fancy_upscaling, /*optional*/::mlir::BoolAttr try_recover_truncated, /*optional*/::mlir::FloatAttr acceptable_fraction, /*optional*/::mlir::StringAttr dct_method); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type image, ::mlir::Value contents, /*optional*/uint64_t channels, /*optional*/uint64_t ratio, /*optional*/bool fancy_upscaling, /*optional*/bool try_recover_truncated, /*optional*/::llvm::APFloat acceptable_fraction, /*optional*/::llvm::StringRef dct_method = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value contents, /*optional*/uint64_t channels, /*optional*/uint64_t ratio, /*optional*/bool fancy_upscaling, /*optional*/bool try_recover_truncated, /*optional*/::llvm::APFloat acceptable_fraction, /*optional*/::llvm::StringRef dct_method = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DecodeJpegOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DecodePaddedRawOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DecodePaddedRawOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DecodePaddedRawOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DecodePaddedRawOpGenericAdaptorBase(DecodePaddedRawOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getLittleEndianAttr(); + bool getLittleEndian(); +}; +} // namespace detail +template +class DecodePaddedRawOpGenericAdaptor : public detail::DecodePaddedRawOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DecodePaddedRawOpGenericAdaptorBase; +public: + DecodePaddedRawOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DecodePaddedRawOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DecodePaddedRawOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DecodePaddedRawOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputBytes() { + return (*getODSOperands(0).begin()); + } + + ValueT getFixedLength() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DecodePaddedRawOpAdaptor : public DecodePaddedRawOpGenericAdaptor<::mlir::ValueRange> { +public: + using DecodePaddedRawOpGenericAdaptor::DecodePaddedRawOpGenericAdaptor; + DecodePaddedRawOpAdaptor(DecodePaddedRawOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DecodePaddedRawOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DecodePaddedRawOpAdaptor; + template + using GenericAdaptor = DecodePaddedRawOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("little_endian"), ::llvm::StringRef("out_type")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getLittleEndianAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getLittleEndianAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutTypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.DecodePaddedRaw"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputBytes(); + ::mlir::TypedValue<::mlir::TensorType> getFixedLength(); + ::mlir::OpOperand &getInputBytesMutable(); + ::mlir::OpOperand &getFixedLengthMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getLittleEndianAttr(); + bool getLittleEndian(); + ::mlir::Type getOutType(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setLittleEndianAttr(::mlir::BoolAttr attr); + void setLittleEndian(::std::optional attrValue); + ::mlir::Attribute removeLittleEndianAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input_bytes, ::mlir::Value fixed_length, /*optional*/::mlir::BoolAttr little_endian); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_bytes, ::mlir::Value fixed_length, /*optional*/::mlir::BoolAttr little_endian); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input_bytes, ::mlir::Value fixed_length, /*optional*/bool little_endian = true); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_bytes, ::mlir::Value fixed_length, /*optional*/bool little_endian = true); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DecodePaddedRawOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DecodePngOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DecodePngOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DecodePngOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DecodePngOpGenericAdaptorBase(DecodePngOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getChannelsAttr(); + uint64_t getChannels(); +}; +} // namespace detail +template +class DecodePngOpGenericAdaptor : public detail::DecodePngOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DecodePngOpGenericAdaptorBase; +public: + DecodePngOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DecodePngOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DecodePngOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DecodePngOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getContents() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DecodePngOpAdaptor : public DecodePngOpGenericAdaptor<::mlir::ValueRange> { +public: + using DecodePngOpGenericAdaptor::DecodePngOpGenericAdaptor; + DecodePngOpAdaptor(DecodePngOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DecodePngOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DecodePngOpAdaptor; + template + using GenericAdaptor = DecodePngOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("channels"), ::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getChannelsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getChannelsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.DecodePng"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getContents(); + ::mlir::OpOperand &getContentsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getImage(); + ::mlir::IntegerAttr getChannelsAttr(); + uint64_t getChannels(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setChannelsAttr(::mlir::IntegerAttr attr); + void setChannels(::std::optional attrValue); + ::mlir::Attribute removeChannelsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type image, ::mlir::Value contents, /*optional*/::mlir::IntegerAttr channels); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value contents, /*optional*/::mlir::IntegerAttr channels); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type image, ::mlir::Value contents, /*optional*/uint64_t channels = 0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value contents, /*optional*/uint64_t channels = 0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DecodePngOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DeleteIteratorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DeleteIteratorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DeleteIteratorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DeleteIteratorOpGenericAdaptorBase(DeleteIteratorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DeleteIteratorOpGenericAdaptor : public detail::DeleteIteratorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DeleteIteratorOpGenericAdaptorBase; +public: + DeleteIteratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DeleteIteratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DeleteIteratorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DeleteIteratorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getDeleter() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DeleteIteratorOpAdaptor : public DeleteIteratorOpGenericAdaptor<::mlir::ValueRange> { +public: + using DeleteIteratorOpGenericAdaptor::DeleteIteratorOpGenericAdaptor; + DeleteIteratorOpAdaptor(DeleteIteratorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DeleteIteratorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DeleteIteratorOpAdaptor; + template + using GenericAdaptor = DeleteIteratorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.DeleteIterator"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::TypedValue<::mlir::TensorType> getDeleter(); + ::mlir::OpOperand &getHandleMutable(); + ::mlir::OpOperand &getDeleterMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value handle, ::mlir::Value deleter); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value handle, ::mlir::Value deleter); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DeleteIteratorOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DeleteMemoryCacheOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DeleteMemoryCacheOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DeleteMemoryCacheOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DeleteMemoryCacheOpGenericAdaptorBase(DeleteMemoryCacheOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DeleteMemoryCacheOpGenericAdaptor : public detail::DeleteMemoryCacheOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DeleteMemoryCacheOpGenericAdaptorBase; +public: + DeleteMemoryCacheOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DeleteMemoryCacheOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DeleteMemoryCacheOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DeleteMemoryCacheOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getDeleter() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DeleteMemoryCacheOpAdaptor : public DeleteMemoryCacheOpGenericAdaptor<::mlir::ValueRange> { +public: + using DeleteMemoryCacheOpGenericAdaptor::DeleteMemoryCacheOpGenericAdaptor; + DeleteMemoryCacheOpAdaptor(DeleteMemoryCacheOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DeleteMemoryCacheOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DeleteMemoryCacheOpAdaptor; + template + using GenericAdaptor = DeleteMemoryCacheOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.DeleteMemoryCache"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::TypedValue<::mlir::TensorType> getDeleter(); + ::mlir::OpOperand &getHandleMutable(); + ::mlir::OpOperand &getDeleterMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value handle, ::mlir::Value deleter); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value handle, ::mlir::Value deleter); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DeleteMemoryCacheOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DeleteMultiDeviceIteratorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DeleteMultiDeviceIteratorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DeleteMultiDeviceIteratorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DeleteMultiDeviceIteratorOpGenericAdaptorBase(DeleteMultiDeviceIteratorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DeleteMultiDeviceIteratorOpGenericAdaptor : public detail::DeleteMultiDeviceIteratorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DeleteMultiDeviceIteratorOpGenericAdaptorBase; +public: + DeleteMultiDeviceIteratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DeleteMultiDeviceIteratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DeleteMultiDeviceIteratorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DeleteMultiDeviceIteratorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getMultiDeviceIterator() { + return (*getODSOperands(0).begin()); + } + + RangeT getIterators() { + return getODSOperands(1); + } + + ValueT getDeleter() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DeleteMultiDeviceIteratorOpAdaptor : public DeleteMultiDeviceIteratorOpGenericAdaptor<::mlir::ValueRange> { +public: + using DeleteMultiDeviceIteratorOpGenericAdaptor::DeleteMultiDeviceIteratorOpGenericAdaptor; + DeleteMultiDeviceIteratorOpAdaptor(DeleteMultiDeviceIteratorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DeleteMultiDeviceIteratorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DeleteMultiDeviceIteratorOpAdaptor; + template + using GenericAdaptor = DeleteMultiDeviceIteratorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("N")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.DeleteMultiDeviceIterator"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getMultiDeviceIterator(); + ::mlir::Operation::operand_range getIterators(); + ::mlir::TypedValue<::mlir::TensorType> getDeleter(); + ::mlir::OpOperand &getMultiDeviceIteratorMutable(); + ::mlir::MutableOperandRange getIteratorsMutable(); + ::mlir::OpOperand &getDeleterMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + size_t getN(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value multi_device_iterator, ::mlir::ValueRange iterators, ::mlir::Value deleter); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value multi_device_iterator, ::mlir::ValueRange iterators, ::mlir::Value deleter); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DeleteMultiDeviceIteratorOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DeleteRandomSeedGeneratorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DeleteRandomSeedGeneratorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DeleteRandomSeedGeneratorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DeleteRandomSeedGeneratorOpGenericAdaptorBase(DeleteRandomSeedGeneratorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DeleteRandomSeedGeneratorOpGenericAdaptor : public detail::DeleteRandomSeedGeneratorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DeleteRandomSeedGeneratorOpGenericAdaptorBase; +public: + DeleteRandomSeedGeneratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DeleteRandomSeedGeneratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DeleteRandomSeedGeneratorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DeleteRandomSeedGeneratorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getDeleter() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DeleteRandomSeedGeneratorOpAdaptor : public DeleteRandomSeedGeneratorOpGenericAdaptor<::mlir::ValueRange> { +public: + using DeleteRandomSeedGeneratorOpGenericAdaptor::DeleteRandomSeedGeneratorOpGenericAdaptor; + DeleteRandomSeedGeneratorOpAdaptor(DeleteRandomSeedGeneratorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DeleteRandomSeedGeneratorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DeleteRandomSeedGeneratorOpAdaptor; + template + using GenericAdaptor = DeleteRandomSeedGeneratorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.DeleteRandomSeedGenerator"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::TypedValue<::mlir::TensorType> getDeleter(); + ::mlir::OpOperand &getHandleMutable(); + ::mlir::OpOperand &getDeleterMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value handle, ::mlir::Value deleter); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value handle, ::mlir::Value deleter); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DeleteRandomSeedGeneratorOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DeleteSeedGeneratorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DeleteSeedGeneratorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DeleteSeedGeneratorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DeleteSeedGeneratorOpGenericAdaptorBase(DeleteSeedGeneratorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DeleteSeedGeneratorOpGenericAdaptor : public detail::DeleteSeedGeneratorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DeleteSeedGeneratorOpGenericAdaptorBase; +public: + DeleteSeedGeneratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DeleteSeedGeneratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DeleteSeedGeneratorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DeleteSeedGeneratorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getDeleter() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DeleteSeedGeneratorOpAdaptor : public DeleteSeedGeneratorOpGenericAdaptor<::mlir::ValueRange> { +public: + using DeleteSeedGeneratorOpGenericAdaptor::DeleteSeedGeneratorOpGenericAdaptor; + DeleteSeedGeneratorOpAdaptor(DeleteSeedGeneratorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DeleteSeedGeneratorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DeleteSeedGeneratorOpAdaptor; + template + using GenericAdaptor = DeleteSeedGeneratorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.DeleteSeedGenerator"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::TypedValue<::mlir::TensorType> getDeleter(); + ::mlir::OpOperand &getHandleMutable(); + ::mlir::OpOperand &getDeleterMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value handle, ::mlir::Value deleter); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value handle, ::mlir::Value deleter); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DeleteSeedGeneratorOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DepthToSpaceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DepthToSpaceOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DepthToSpaceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DepthToSpaceOpGenericAdaptorBase(DepthToSpaceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getBlockSizeAttr(); + uint64_t getBlockSize(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); +}; +} // namespace detail +template +class DepthToSpaceOpGenericAdaptor : public detail::DepthToSpaceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DepthToSpaceOpGenericAdaptorBase; +public: + DepthToSpaceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DepthToSpaceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DepthToSpaceOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DepthToSpaceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DepthToSpaceOpAdaptor : public DepthToSpaceOpGenericAdaptor<::mlir::ValueRange> { +public: + using DepthToSpaceOpGenericAdaptor::DepthToSpaceOpGenericAdaptor; + DepthToSpaceOpAdaptor(DepthToSpaceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DepthToSpaceOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DepthToSpaceOpAdaptor; + template + using GenericAdaptor = DepthToSpaceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("block_size"), ::llvm::StringRef("data_format")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getBlockSizeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getBlockSizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.DepthToSpace"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getBlockSizeAttr(); + uint64_t getBlockSize(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setBlockSizeAttr(::mlir::IntegerAttr attr); + void setBlockSize(uint64_t attrValue); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeDataFormatAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::IntegerAttr block_size, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::IntegerAttr block_size, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, uint64_t block_size, /*optional*/::llvm::StringRef data_format = "NHWC"); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, uint64_t block_size, /*optional*/::llvm::StringRef data_format = "NHWC"); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DepthToSpaceOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DepthwiseConv2dNativeBackpropFilterOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DepthwiseConv2dNativeBackpropFilterOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DepthwiseConv2dNativeBackpropFilterOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DepthwiseConv2dNativeBackpropFilterOpGenericAdaptorBase(DepthwiseConv2dNativeBackpropFilterOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getExplicitPaddingsAttr(); + ::mlir::ArrayAttr getExplicitPaddings(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::ArrayAttr getDilationsAttr(); + ::mlir::ArrayAttr getDilations(); +}; +} // namespace detail +template +class DepthwiseConv2dNativeBackpropFilterOpGenericAdaptor : public detail::DepthwiseConv2dNativeBackpropFilterOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DepthwiseConv2dNativeBackpropFilterOpGenericAdaptorBase; +public: + DepthwiseConv2dNativeBackpropFilterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DepthwiseConv2dNativeBackpropFilterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DepthwiseConv2dNativeBackpropFilterOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DepthwiseConv2dNativeBackpropFilterOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getFilterSizes() { + return (*getODSOperands(1).begin()); + } + + ValueT getOutBackprop() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DepthwiseConv2dNativeBackpropFilterOpAdaptor : public DepthwiseConv2dNativeBackpropFilterOpGenericAdaptor<::mlir::ValueRange> { +public: + using DepthwiseConv2dNativeBackpropFilterOpGenericAdaptor::DepthwiseConv2dNativeBackpropFilterOpGenericAdaptor; + DepthwiseConv2dNativeBackpropFilterOpAdaptor(DepthwiseConv2dNativeBackpropFilterOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DepthwiseConv2dNativeBackpropFilterOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DepthwiseConv2dNativeBackpropFilterOpAdaptor; + template + using GenericAdaptor = DepthwiseConv2dNativeBackpropFilterOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("data_format"), ::llvm::StringRef("dilations"), ::llvm::StringRef("explicit_paddings"), ::llvm::StringRef("padding"), ::llvm::StringRef("strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getExplicitPaddingsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getExplicitPaddingsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.DepthwiseConv2dNativeBackpropFilter"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getFilterSizes(); + ::mlir::TypedValue<::mlir::TensorType> getOutBackprop(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getFilterSizesMutable(); + ::mlir::OpOperand &getOutBackpropMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getExplicitPaddingsAttr(); + ::mlir::ArrayAttr getExplicitPaddings(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::ArrayAttr getDilationsAttr(); + ::mlir::ArrayAttr getDilations(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setStridesAttr(::mlir::ArrayAttr attr); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + void setExplicitPaddingsAttr(::mlir::ArrayAttr attr); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + void setDilationsAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeExplicitPaddingsAttr(); + ::mlir::Attribute removeDataFormatAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value filter_sizes, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter_sizes, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value filter_sizes, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::llvm::StringRef data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter_sizes, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::llvm::StringRef data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DepthwiseConv2dNativeBackpropFilterOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DepthwiseConv2dNativeBackpropInputOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DepthwiseConv2dNativeBackpropInputOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DepthwiseConv2dNativeBackpropInputOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DepthwiseConv2dNativeBackpropInputOpGenericAdaptorBase(DepthwiseConv2dNativeBackpropInputOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getExplicitPaddingsAttr(); + ::mlir::ArrayAttr getExplicitPaddings(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::ArrayAttr getDilationsAttr(); + ::mlir::ArrayAttr getDilations(); +}; +} // namespace detail +template +class DepthwiseConv2dNativeBackpropInputOpGenericAdaptor : public detail::DepthwiseConv2dNativeBackpropInputOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DepthwiseConv2dNativeBackpropInputOpGenericAdaptorBase; +public: + DepthwiseConv2dNativeBackpropInputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DepthwiseConv2dNativeBackpropInputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DepthwiseConv2dNativeBackpropInputOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DepthwiseConv2dNativeBackpropInputOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputSizes() { + return (*getODSOperands(0).begin()); + } + + ValueT getFilter() { + return (*getODSOperands(1).begin()); + } + + ValueT getOutBackprop() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DepthwiseConv2dNativeBackpropInputOpAdaptor : public DepthwiseConv2dNativeBackpropInputOpGenericAdaptor<::mlir::ValueRange> { +public: + using DepthwiseConv2dNativeBackpropInputOpGenericAdaptor::DepthwiseConv2dNativeBackpropInputOpGenericAdaptor; + DepthwiseConv2dNativeBackpropInputOpAdaptor(DepthwiseConv2dNativeBackpropInputOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DepthwiseConv2dNativeBackpropInputOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DepthwiseConv2dNativeBackpropInputOpAdaptor; + template + using GenericAdaptor = DepthwiseConv2dNativeBackpropInputOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("data_format"), ::llvm::StringRef("dilations"), ::llvm::StringRef("explicit_paddings"), ::llvm::StringRef("padding"), ::llvm::StringRef("strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getExplicitPaddingsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getExplicitPaddingsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.DepthwiseConv2dNativeBackpropInput"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputSizes(); + ::mlir::TypedValue<::mlir::TensorType> getFilter(); + ::mlir::TypedValue<::mlir::TensorType> getOutBackprop(); + ::mlir::OpOperand &getInputSizesMutable(); + ::mlir::OpOperand &getFilterMutable(); + ::mlir::OpOperand &getOutBackpropMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getExplicitPaddingsAttr(); + ::mlir::ArrayAttr getExplicitPaddings(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::ArrayAttr getDilationsAttr(); + ::mlir::ArrayAttr getDilations(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setStridesAttr(::mlir::ArrayAttr attr); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + void setExplicitPaddingsAttr(::mlir::ArrayAttr attr); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + void setDilationsAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeExplicitPaddingsAttr(); + ::mlir::Attribute removeDataFormatAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input_sizes, ::mlir::Value filter, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_sizes, ::mlir::Value filter, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input_sizes, ::mlir::Value filter, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::llvm::StringRef data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_sizes, ::mlir::Value filter, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::llvm::StringRef data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DepthwiseConv2dNativeBackpropInputOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DepthwiseConv2dNativeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DepthwiseConv2dNativeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DepthwiseConv2dNativeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DepthwiseConv2dNativeOpGenericAdaptorBase(DepthwiseConv2dNativeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getExplicitPaddingsAttr(); + ::mlir::ArrayAttr getExplicitPaddings(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::ArrayAttr getDilationsAttr(); + ::mlir::ArrayAttr getDilations(); +}; +} // namespace detail +template +class DepthwiseConv2dNativeOpGenericAdaptor : public detail::DepthwiseConv2dNativeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DepthwiseConv2dNativeOpGenericAdaptorBase; +public: + DepthwiseConv2dNativeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DepthwiseConv2dNativeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DepthwiseConv2dNativeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DepthwiseConv2dNativeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getFilter() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DepthwiseConv2dNativeOpAdaptor : public DepthwiseConv2dNativeOpGenericAdaptor<::mlir::ValueRange> { +public: + using DepthwiseConv2dNativeOpGenericAdaptor::DepthwiseConv2dNativeOpGenericAdaptor; + DepthwiseConv2dNativeOpAdaptor(DepthwiseConv2dNativeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DepthwiseConv2dNativeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DepthwiseConv2dNativeOpAdaptor; + template + using GenericAdaptor = DepthwiseConv2dNativeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("data_format"), ::llvm::StringRef("dilations"), ::llvm::StringRef("explicit_paddings"), ::llvm::StringRef("padding"), ::llvm::StringRef("strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getExplicitPaddingsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getExplicitPaddingsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.DepthwiseConv2dNative"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getFilter(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getFilterMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getExplicitPaddingsAttr(); + ::mlir::ArrayAttr getExplicitPaddings(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::ArrayAttr getDilationsAttr(); + ::mlir::ArrayAttr getDilations(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setStridesAttr(::mlir::ArrayAttr attr); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + void setExplicitPaddingsAttr(::mlir::ArrayAttr attr); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + void setDilationsAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeExplicitPaddingsAttr(); + ::mlir::Attribute removeDataFormatAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value filter, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value filter, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::llvm::StringRef data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::llvm::StringRef data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DepthwiseConv2dNativeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DequantizeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DequantizeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DequantizeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DequantizeOpGenericAdaptorBase(DequantizeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getModeAttr(); + ::llvm::StringRef getMode(); + ::mlir::BoolAttr getNarrowRangeAttr(); + bool getNarrowRange(); + ::mlir::IntegerAttr getAxisAttr(); + uint64_t getAxis(); +}; +} // namespace detail +template +class DequantizeOpGenericAdaptor : public detail::DequantizeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DequantizeOpGenericAdaptorBase; +public: + DequantizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DequantizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DequantizeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DequantizeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getMinRange() { + return (*getODSOperands(1).begin()); + } + + ValueT getMaxRange() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DequantizeOpAdaptor : public DequantizeOpGenericAdaptor<::mlir::ValueRange> { +public: + using DequantizeOpGenericAdaptor::DequantizeOpGenericAdaptor; + DequantizeOpAdaptor(DequantizeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DequantizeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DequantizeOpAdaptor; + template + using GenericAdaptor = DequantizeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("axis"), ::llvm::StringRef("dtype"), ::llvm::StringRef("mode"), ::llvm::StringRef("narrow_range")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAxisAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAxisAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getModeAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getModeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getNarrowRangeAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getNarrowRangeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Dequantize"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getMinRange(); + ::mlir::TypedValue<::mlir::TensorType> getMaxRange(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getMinRangeMutable(); + ::mlir::OpOperand &getMaxRangeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::StringAttr getModeAttr(); + ::llvm::StringRef getMode(); + ::mlir::BoolAttr getNarrowRangeAttr(); + bool getNarrowRange(); + ::mlir::IntegerAttr getAxisAttr(); + uint64_t getAxis(); + ::mlir::Type getT(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setModeAttr(::mlir::StringAttr attr); + void setMode(::std::optional<::llvm::StringRef> attrValue); + void setNarrowRangeAttr(::mlir::BoolAttr attr); + void setNarrowRange(::std::optional attrValue); + void setAxisAttr(::mlir::IntegerAttr attr); + void setAxis(::std::optional attrValue); + ::mlir::Attribute removeModeAttr(); + ::mlir::Attribute removeNarrowRangeAttr(); + ::mlir::Attribute removeAxisAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value min_range, ::mlir::Value max_range, /*optional*/::mlir::StringAttr mode, /*optional*/::mlir::BoolAttr narrow_range, /*optional*/::mlir::IntegerAttr axis); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value min_range, ::mlir::Value max_range, /*optional*/::mlir::StringAttr mode, /*optional*/::mlir::BoolAttr narrow_range, /*optional*/::mlir::IntegerAttr axis); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value min_range, ::mlir::Value max_range, /*optional*/::llvm::StringRef mode = "MIN_COMBINED", /*optional*/bool narrow_range = false, /*optional*/uint64_t axis = -1); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value min_range, ::mlir::Value max_range, /*optional*/::llvm::StringRef mode = "MIN_COMBINED", /*optional*/bool narrow_range = false, /*optional*/uint64_t axis = -1); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DequantizeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DeserializeIteratorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DeserializeIteratorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DeserializeIteratorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DeserializeIteratorOpGenericAdaptorBase(DeserializeIteratorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DeserializeIteratorOpGenericAdaptor : public detail::DeserializeIteratorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DeserializeIteratorOpGenericAdaptorBase; +public: + DeserializeIteratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DeserializeIteratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DeserializeIteratorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DeserializeIteratorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getResourceHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getSerialized() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DeserializeIteratorOpAdaptor : public DeserializeIteratorOpGenericAdaptor<::mlir::ValueRange> { +public: + using DeserializeIteratorOpGenericAdaptor::DeserializeIteratorOpGenericAdaptor; + DeserializeIteratorOpAdaptor(DeserializeIteratorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DeserializeIteratorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DeserializeIteratorOpAdaptor; + template + using GenericAdaptor = DeserializeIteratorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.DeserializeIterator"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResourceHandle(); + ::mlir::TypedValue<::mlir::TensorType> getSerialized(); + ::mlir::OpOperand &getResourceHandleMutable(); + ::mlir::OpOperand &getSerializedMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value resource_handle, ::mlir::Value serialized); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value resource_handle, ::mlir::Value serialized); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DeserializeIteratorOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DeserializeSparseOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DeserializeSparseOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DeserializeSparseOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DeserializeSparseOpGenericAdaptorBase(DeserializeSparseOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DeserializeSparseOpGenericAdaptor : public detail::DeserializeSparseOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DeserializeSparseOpGenericAdaptorBase; +public: + DeserializeSparseOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DeserializeSparseOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DeserializeSparseOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DeserializeSparseOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSerializedSparse() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DeserializeSparseOpAdaptor : public DeserializeSparseOpGenericAdaptor<::mlir::ValueRange> { +public: + using DeserializeSparseOpGenericAdaptor::DeserializeSparseOpGenericAdaptor; + DeserializeSparseOpAdaptor(DeserializeSparseOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DeserializeSparseOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DeserializeSparseOpAdaptor; + template + using GenericAdaptor = DeserializeSparseOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tserialized"), ::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTserializedAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTserializedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.DeserializeSparse"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSerializedSparse(); + ::mlir::OpOperand &getSerializedSparseMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSparseIndices(); + ::mlir::TypedValue<::mlir::TensorType> getSparseValues(); + ::mlir::TypedValue<::mlir::TensorType> getSparseShape(); + ::mlir::Type getTserialized(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type sparse_indices, ::mlir::Type sparse_values, ::mlir::Type sparse_shape, ::mlir::Value serialized_sparse); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value serialized_sparse); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DeserializeSparseOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DestroyResourceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DestroyResourceOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DestroyResourceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DestroyResourceOpGenericAdaptorBase(DestroyResourceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getIgnoreLookupErrorAttr(); + bool getIgnoreLookupError(); +}; +} // namespace detail +template +class DestroyResourceOpGenericAdaptor : public detail::DestroyResourceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DestroyResourceOpGenericAdaptorBase; +public: + DestroyResourceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DestroyResourceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DestroyResourceOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DestroyResourceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getResource() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DestroyResourceOpAdaptor : public DestroyResourceOpGenericAdaptor<::mlir::ValueRange> { +public: + using DestroyResourceOpGenericAdaptor::DestroyResourceOpGenericAdaptor; + DestroyResourceOpAdaptor(DestroyResourceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DestroyResourceOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = DestroyResourceOpAdaptor; + template + using GenericAdaptor = DestroyResourceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("ignore_lookup_error")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getIgnoreLookupErrorAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getIgnoreLookupErrorAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.DestroyResourceOp"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResource(); + ::mlir::OpOperand &getResourceMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::BoolAttr getIgnoreLookupErrorAttr(); + bool getIgnoreLookupError(); + void setIgnoreLookupErrorAttr(::mlir::BoolAttr attr); + void setIgnoreLookupError(::std::optional attrValue); + ::mlir::Attribute removeIgnoreLookupErrorAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value resource, /*optional*/::mlir::BoolAttr ignore_lookup_error); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value resource, /*optional*/::mlir::BoolAttr ignore_lookup_error); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value resource, /*optional*/bool ignore_lookup_error = true); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value resource, /*optional*/bool ignore_lookup_error = true); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DestroyResourceOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DeviceIndexOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DeviceIndexOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DeviceIndexOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DeviceIndexOpGenericAdaptorBase(DeviceIndexOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getDeviceNamesAttr(); + ::mlir::ArrayAttr getDeviceNames(); +}; +} // namespace detail +template +class DeviceIndexOpGenericAdaptor : public detail::DeviceIndexOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DeviceIndexOpGenericAdaptorBase; +public: + DeviceIndexOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DeviceIndexOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DeviceIndexOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DeviceIndexOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DeviceIndexOpAdaptor : public DeviceIndexOpGenericAdaptor<::mlir::ValueRange> { +public: + using DeviceIndexOpGenericAdaptor::DeviceIndexOpGenericAdaptor; + DeviceIndexOpAdaptor(DeviceIndexOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DeviceIndexOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold> { +public: + using Op::Op; + using Op::print; + using Adaptor = DeviceIndexOpAdaptor; + template + using GenericAdaptor = DeviceIndexOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("device_names")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDeviceNamesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDeviceNamesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.DeviceIndex"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getIndex(); + ::mlir::ArrayAttr getDeviceNamesAttr(); + ::mlir::ArrayAttr getDeviceNames(); + void setDeviceNamesAttr(::mlir::ArrayAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type index, ::mlir::ArrayAttr device_names); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ArrayAttr device_names); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DeviceIndexOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DiagOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DiagOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DiagOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DiagOpGenericAdaptorBase(DiagOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DiagOpGenericAdaptor : public detail::DiagOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DiagOpGenericAdaptorBase; +public: + DiagOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DiagOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DiagOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DiagOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getDiagonal() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DiagOpAdaptor : public DiagOpGenericAdaptor<::mlir::ValueRange> { +public: + using DiagOpGenericAdaptor::DiagOpGenericAdaptor; + DiagOpAdaptor(DiagOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DiagOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::SameOperandsAndResultElementTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DiagOpAdaptor; + template + using GenericAdaptor = DiagOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Diag"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getDiagonal(); + ::mlir::OpOperand &getDiagonalMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value diagonal); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value diagonal); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DiagOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DiagPartOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DiagPartOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DiagPartOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DiagPartOpGenericAdaptorBase(DiagPartOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DiagPartOpGenericAdaptor : public detail::DiagPartOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DiagPartOpGenericAdaptorBase; +public: + DiagPartOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DiagPartOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DiagPartOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DiagPartOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DiagPartOpAdaptor : public DiagPartOpGenericAdaptor<::mlir::ValueRange> { +public: + using DiagPartOpGenericAdaptor::DiagPartOpGenericAdaptor; + DiagPartOpAdaptor(DiagPartOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DiagPartOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DiagPartOpAdaptor; + template + using GenericAdaptor = DiagPartOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.DiagPart"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getDiagonal(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type diagonal, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DiagPartOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DigammaOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DigammaOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DigammaOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DigammaOpGenericAdaptorBase(DigammaOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DigammaOpGenericAdaptor : public detail::DigammaOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DigammaOpGenericAdaptorBase; +public: + DigammaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DigammaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DigammaOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DigammaOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DigammaOpAdaptor : public DigammaOpGenericAdaptor<::mlir::ValueRange> { +public: + using DigammaOpGenericAdaptor::DigammaOpGenericAdaptor; + DigammaOpAdaptor(DigammaOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DigammaOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DigammaOpAdaptor; + template + using GenericAdaptor = DigammaOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Digamma"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DigammaOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DisableCopyOnReadOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DisableCopyOnReadOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DisableCopyOnReadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DisableCopyOnReadOpGenericAdaptorBase(DisableCopyOnReadOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DisableCopyOnReadOpGenericAdaptor : public detail::DisableCopyOnReadOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DisableCopyOnReadOpGenericAdaptorBase; +public: + DisableCopyOnReadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DisableCopyOnReadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DisableCopyOnReadOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DisableCopyOnReadOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getResource() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DisableCopyOnReadOpAdaptor : public DisableCopyOnReadOpGenericAdaptor<::mlir::ValueRange> { +public: + using DisableCopyOnReadOpGenericAdaptor::DisableCopyOnReadOpGenericAdaptor; + DisableCopyOnReadOpAdaptor(DisableCopyOnReadOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DisableCopyOnReadOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = DisableCopyOnReadOpAdaptor; + template + using GenericAdaptor = DisableCopyOnReadOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.DisableCopyOnRead"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResource(); + ::mlir::OpOperand &getResourceMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value resource); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value resource); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DisableCopyOnReadOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DivNoNanOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DivNoNanOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DivNoNanOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DivNoNanOpGenericAdaptorBase(DivNoNanOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DivNoNanOpGenericAdaptor : public detail::DivNoNanOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DivNoNanOpGenericAdaptorBase; +public: + DivNoNanOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DivNoNanOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DivNoNanOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DivNoNanOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DivNoNanOpAdaptor : public DivNoNanOpGenericAdaptor<::mlir::ValueRange> { +public: + using DivNoNanOpGenericAdaptor::DivNoNanOpGenericAdaptor; + DivNoNanOpAdaptor(DivNoNanOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DivNoNanOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::OpTrait::TF::SameOperandsAndResultElementTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DivNoNanOpAdaptor; + template + using GenericAdaptor = DivNoNanOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.DivNoNan"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DivNoNanOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DivOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DivOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DivOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DivOpGenericAdaptorBase(DivOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DivOpGenericAdaptor : public detail::DivOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DivOpGenericAdaptorBase; +public: + DivOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DivOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DivOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DivOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DivOpAdaptor : public DivOpGenericAdaptor<::mlir::ValueRange> { +public: + using DivOpGenericAdaptor::DivOpGenericAdaptor; + DivOpAdaptor(DivOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DivOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::OpTrait::TF::SameOperandsAndResultElementTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DivOpAdaptor; + template + using GenericAdaptor = DivOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Div"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DivOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DummyMemoryCacheOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DummyMemoryCacheOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DummyMemoryCacheOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DummyMemoryCacheOpGenericAdaptorBase(DummyMemoryCacheOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DummyMemoryCacheOpGenericAdaptor : public detail::DummyMemoryCacheOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DummyMemoryCacheOpGenericAdaptorBase; +public: + DummyMemoryCacheOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DummyMemoryCacheOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DummyMemoryCacheOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DummyMemoryCacheOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DummyMemoryCacheOpAdaptor : public DummyMemoryCacheOpGenericAdaptor<::mlir::ValueRange> { +public: + using DummyMemoryCacheOpGenericAdaptor::DummyMemoryCacheOpGenericAdaptor; + DummyMemoryCacheOpAdaptor(DummyMemoryCacheOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DummyMemoryCacheOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DummyMemoryCacheOpAdaptor; + template + using GenericAdaptor = DummyMemoryCacheOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.DummyMemoryCache"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DummyMemoryCacheOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DummySeedGeneratorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DummySeedGeneratorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DummySeedGeneratorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DummySeedGeneratorOpGenericAdaptorBase(DummySeedGeneratorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DummySeedGeneratorOpGenericAdaptor : public detail::DummySeedGeneratorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DummySeedGeneratorOpGenericAdaptorBase; +public: + DummySeedGeneratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DummySeedGeneratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DummySeedGeneratorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DummySeedGeneratorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DummySeedGeneratorOpAdaptor : public DummySeedGeneratorOpGenericAdaptor<::mlir::ValueRange> { +public: + using DummySeedGeneratorOpGenericAdaptor::DummySeedGeneratorOpGenericAdaptor; + DummySeedGeneratorOpAdaptor(DummySeedGeneratorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DummySeedGeneratorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DummySeedGeneratorOpAdaptor; + template + using GenericAdaptor = DummySeedGeneratorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.DummySeedGenerator"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DummySeedGeneratorOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DynamicEnqueueTPUEmbeddingArbitraryTensorBatchOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DynamicEnqueueTPUEmbeddingArbitraryTensorBatchOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DynamicEnqueueTPUEmbeddingArbitraryTensorBatchOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DynamicEnqueueTPUEmbeddingArbitraryTensorBatchOpGenericAdaptorBase(DynamicEnqueueTPUEmbeddingArbitraryTensorBatchOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getCombinersAttr(); + ::mlir::ArrayAttr getCombiners(); +}; +} // namespace detail +template +class DynamicEnqueueTPUEmbeddingArbitraryTensorBatchOpGenericAdaptor : public detail::DynamicEnqueueTPUEmbeddingArbitraryTensorBatchOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DynamicEnqueueTPUEmbeddingArbitraryTensorBatchOpGenericAdaptorBase; +public: + DynamicEnqueueTPUEmbeddingArbitraryTensorBatchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DynamicEnqueueTPUEmbeddingArbitraryTensorBatchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DynamicEnqueueTPUEmbeddingArbitraryTensorBatchOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DynamicEnqueueTPUEmbeddingArbitraryTensorBatchOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getSampleIndicesOrRowSplits() { + return getODSOperands(0); + } + + RangeT getEmbeddingIndices() { + return getODSOperands(1); + } + + RangeT getAggregationWeights() { + return getODSOperands(2); + } + + ValueT getModeOverride() { + return (*getODSOperands(3).begin()); + } + + ValueT getDeviceOrdinal() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DynamicEnqueueTPUEmbeddingArbitraryTensorBatchOpAdaptor : public DynamicEnqueueTPUEmbeddingArbitraryTensorBatchOpGenericAdaptor<::mlir::ValueRange> { +public: + using DynamicEnqueueTPUEmbeddingArbitraryTensorBatchOpGenericAdaptor::DynamicEnqueueTPUEmbeddingArbitraryTensorBatchOpGenericAdaptor; + DynamicEnqueueTPUEmbeddingArbitraryTensorBatchOpAdaptor(DynamicEnqueueTPUEmbeddingArbitraryTensorBatchOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DynamicEnqueueTPUEmbeddingArbitraryTensorBatchOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DynamicEnqueueTPUEmbeddingArbitraryTensorBatchOpAdaptor; + template + using GenericAdaptor = DynamicEnqueueTPUEmbeddingArbitraryTensorBatchOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("N"), ::llvm::StringRef("T1"), ::llvm::StringRef("T2"), ::llvm::StringRef("T3"), ::llvm::StringRef("combiners")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getT1AttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getT1AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getT2AttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getT2AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getT3AttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getT3AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getCombinersAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getCombinersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.DynamicEnqueueTPUEmbeddingArbitraryTensorBatch"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getSampleIndicesOrRowSplits(); + ::mlir::Operation::operand_range getEmbeddingIndices(); + ::mlir::Operation::operand_range getAggregationWeights(); + ::mlir::TypedValue<::mlir::TensorType> getModeOverride(); + ::mlir::TypedValue<::mlir::TensorType> getDeviceOrdinal(); + ::mlir::MutableOperandRange getSampleIndicesOrRowSplitsMutable(); + ::mlir::MutableOperandRange getEmbeddingIndicesMutable(); + ::mlir::MutableOperandRange getAggregationWeightsMutable(); + ::mlir::OpOperand &getModeOverrideMutable(); + ::mlir::OpOperand &getDeviceOrdinalMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::ArrayAttr getCombinersAttr(); + ::mlir::ArrayAttr getCombiners(); + size_t getN(); + ::mlir::Type getT1(); + ::mlir::Type getT2(); + ::mlir::Type getT3(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setCombinersAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeCombinersAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange sample_indices_or_row_splits, ::mlir::ValueRange embedding_indices, ::mlir::ValueRange aggregation_weights, ::mlir::Value mode_override, ::mlir::Value device_ordinal, /*optional*/::mlir::ArrayAttr combiners); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange sample_indices_or_row_splits, ::mlir::ValueRange embedding_indices, ::mlir::ValueRange aggregation_weights, ::mlir::Value mode_override, ::mlir::Value device_ordinal, /*optional*/::mlir::ArrayAttr combiners); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DynamicEnqueueTPUEmbeddingArbitraryTensorBatchOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DynamicPartitionOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DynamicPartitionOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DynamicPartitionOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DynamicPartitionOpGenericAdaptorBase(DynamicPartitionOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DynamicPartitionOpGenericAdaptor : public detail::DynamicPartitionOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DynamicPartitionOpGenericAdaptorBase; +public: + DynamicPartitionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DynamicPartitionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DynamicPartitionOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DynamicPartitionOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getData() { + return (*getODSOperands(0).begin()); + } + + ValueT getPartitions() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DynamicPartitionOpAdaptor : public DynamicPartitionOpGenericAdaptor<::mlir::ValueRange> { +public: + using DynamicPartitionOpGenericAdaptor::DynamicPartitionOpGenericAdaptor; + DynamicPartitionOpAdaptor(DynamicPartitionOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DynamicPartitionOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DynamicPartitionOpAdaptor; + template + using GenericAdaptor = DynamicPartitionOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("num_partitions")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumPartitionsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumPartitionsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.DynamicPartition"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getData(); + ::mlir::TypedValue<::mlir::TensorType> getPartitions(); + ::mlir::OpOperand &getDataMutable(); + ::mlir::OpOperand &getPartitionsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutputs(); + ::mlir::Type getT(); + size_t getNumPartitions(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outputs, ::mlir::Value data, ::mlir::Value partitions); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DynamicPartitionOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DynamicStitchOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DynamicStitchOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DynamicStitchOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DynamicStitchOpGenericAdaptorBase(DynamicStitchOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DynamicStitchOpGenericAdaptor : public detail::DynamicStitchOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DynamicStitchOpGenericAdaptorBase; +public: + DynamicStitchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DynamicStitchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DynamicStitchOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DynamicStitchOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getIndices() { + return getODSOperands(0); + } + + RangeT getData() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DynamicStitchOpAdaptor : public DynamicStitchOpGenericAdaptor<::mlir::ValueRange> { +public: + using DynamicStitchOpGenericAdaptor::DynamicStitchOpGenericAdaptor; + DynamicStitchOpAdaptor(DynamicStitchOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DynamicStitchOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DynamicStitchOpAdaptor; + template + using GenericAdaptor = DynamicStitchOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("N"), ::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.DynamicStitch"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getIndices(); + ::mlir::Operation::operand_range getData(); + ::mlir::MutableOperandRange getIndicesMutable(); + ::mlir::MutableOperandRange getDataMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getMerged(); + size_t getN(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type merged, ::mlir::ValueRange indices, ::mlir::ValueRange data); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange indices, ::mlir::ValueRange data); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DynamicStitchOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::EinsumOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class EinsumOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + EinsumOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + EinsumOpGenericAdaptorBase(EinsumOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getEquationAttr(); + ::llvm::StringRef getEquation(); +}; +} // namespace detail +template +class EinsumOpGenericAdaptor : public detail::EinsumOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::EinsumOpGenericAdaptorBase; +public: + EinsumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + EinsumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : EinsumOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + EinsumOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class EinsumOpAdaptor : public EinsumOpGenericAdaptor<::mlir::ValueRange> { +public: + using EinsumOpGenericAdaptor::EinsumOpGenericAdaptor; + EinsumOpAdaptor(EinsumOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class EinsumOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = EinsumOpAdaptor; + template + using GenericAdaptor = EinsumOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("N"), ::llvm::StringRef("T"), ::llvm::StringRef("equation")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getEquationAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getEquationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Einsum"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::MutableOperandRange getInputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::StringAttr getEquationAttr(); + ::llvm::StringRef getEquation(); + size_t getN(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setEquationAttr(::mlir::StringAttr attr); + void setEquation(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::ValueRange inputs, ::mlir::StringAttr equation); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::mlir::StringAttr equation); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::ValueRange inputs, ::llvm::StringRef equation); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::llvm::StringRef equation); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::EinsumOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::EluGradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class EluGradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + EluGradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + EluGradOpGenericAdaptorBase(EluGradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class EluGradOpGenericAdaptor : public detail::EluGradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::EluGradOpGenericAdaptorBase; +public: + EluGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + EluGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : EluGradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + EluGradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getGradients() { + return (*getODSOperands(0).begin()); + } + + ValueT getOutputs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class EluGradOpAdaptor : public EluGradOpGenericAdaptor<::mlir::ValueRange> { +public: + using EluGradOpGenericAdaptor::EluGradOpGenericAdaptor; + EluGradOpAdaptor(EluGradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class EluGradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = EluGradOpAdaptor; + template + using GenericAdaptor = EluGradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.EluGrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getGradients(); + ::mlir::TypedValue<::mlir::TensorType> getOutputs(); + ::mlir::OpOperand &getGradientsMutable(); + ::mlir::OpOperand &getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getBackprops(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type backprops, ::mlir::Value gradients, ::mlir::Value outputs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value gradients, ::mlir::Value outputs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value gradients, ::mlir::Value outputs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::EluGradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::EluOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class EluOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + EluOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + EluOpGenericAdaptorBase(EluOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class EluOpGenericAdaptor : public detail::EluOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::EluOpGenericAdaptorBase; +public: + EluOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + EluOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : EluOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + EluOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getFeatures() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class EluOpAdaptor : public EluOpGenericAdaptor<::mlir::ValueRange> { +public: + using EluOpGenericAdaptor::EluOpGenericAdaptor; + EluOpAdaptor(EluOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class EluOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = EluOpAdaptor; + template + using GenericAdaptor = EluOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Elu"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getFeatures(); + ::mlir::OpOperand &getFeaturesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getActivations(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type activations, ::mlir::Value features); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value features); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value features); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::EluOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::EmptyOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class EmptyOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + EmptyOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + EmptyOpGenericAdaptorBase(EmptyOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getInitAttr(); + bool getInit(); +}; +} // namespace detail +template +class EmptyOpGenericAdaptor : public detail::EmptyOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::EmptyOpGenericAdaptorBase; +public: + EmptyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + EmptyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : EmptyOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + EmptyOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getShape() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class EmptyOpAdaptor : public EmptyOpGenericAdaptor<::mlir::ValueRange> { +public: + using EmptyOpGenericAdaptor::EmptyOpGenericAdaptor; + EmptyOpAdaptor(EmptyOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class EmptyOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = EmptyOpAdaptor; + template + using GenericAdaptor = EmptyOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dtype"), ::llvm::StringRef("init")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getInitAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getInitAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Empty"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::OpOperand &getShapeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getInitAttr(); + bool getInit(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setInitAttr(::mlir::BoolAttr attr); + void setInit(::std::optional attrValue); + ::mlir::Attribute removeInitAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, /*optional*/::mlir::BoolAttr init); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, /*optional*/::mlir::BoolAttr init); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, /*optional*/bool init = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, /*optional*/bool init = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::EmptyOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::EmptyTensorListOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class EmptyTensorListOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + EmptyTensorListOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + EmptyTensorListOpGenericAdaptorBase(EmptyTensorListOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class EmptyTensorListOpGenericAdaptor : public detail::EmptyTensorListOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::EmptyTensorListOpGenericAdaptorBase; +public: + EmptyTensorListOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + EmptyTensorListOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : EmptyTensorListOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + EmptyTensorListOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getElementShape() { + return (*getODSOperands(0).begin()); + } + + ValueT getMaxNumElements() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class EmptyTensorListOpAdaptor : public EmptyTensorListOpGenericAdaptor<::mlir::ValueRange> { +public: + using EmptyTensorListOpGenericAdaptor::EmptyTensorListOpGenericAdaptor; + EmptyTensorListOpAdaptor(EmptyTensorListOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class EmptyTensorListOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = EmptyTensorListOpAdaptor; + template + using GenericAdaptor = EmptyTensorListOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("element_dtype"), ::llvm::StringRef("shape_type")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getElementDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getElementDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getShapeTypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getShapeTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.EmptyTensorList"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getElementShape(); + ::mlir::TypedValue<::mlir::TensorType> getMaxNumElements(); + ::mlir::OpOperand &getElementShapeMutable(); + ::mlir::OpOperand &getMaxNumElementsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::Type getShapeType(); + ::mlir::Type getElementDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value element_shape, ::mlir::Value max_num_elements); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value element_shape, ::mlir::Value max_num_elements); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Returns type of the TensorList element produced by this op. + TensorType element_type() { return handle_dtype().getSubtypes()[0]; } + + // Returns data type of the result handle. Returned type contains type of + // the TensorList element as a subtype. + VariantType handle_dtype() { + return getElementTypeOrSelf(getHandle().getType()).cast(); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::EmptyTensorListOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::EncodePngOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class EncodePngOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + EncodePngOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + EncodePngOpGenericAdaptorBase(EncodePngOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getCompressionAttr(); + uint64_t getCompression(); +}; +} // namespace detail +template +class EncodePngOpGenericAdaptor : public detail::EncodePngOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::EncodePngOpGenericAdaptorBase; +public: + EncodePngOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + EncodePngOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : EncodePngOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + EncodePngOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getImage() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class EncodePngOpAdaptor : public EncodePngOpGenericAdaptor<::mlir::ValueRange> { +public: + using EncodePngOpGenericAdaptor::EncodePngOpGenericAdaptor; + EncodePngOpAdaptor(EncodePngOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class EncodePngOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = EncodePngOpAdaptor; + template + using GenericAdaptor = EncodePngOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("compression")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getCompressionAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getCompressionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.EncodePng"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getImage(); + ::mlir::OpOperand &getImageMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getContents(); + ::mlir::IntegerAttr getCompressionAttr(); + uint64_t getCompression(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setCompressionAttr(::mlir::IntegerAttr attr); + void setCompression(::std::optional attrValue); + ::mlir::Attribute removeCompressionAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type contents, ::mlir::Value image, /*optional*/::mlir::IntegerAttr compression); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value image, /*optional*/::mlir::IntegerAttr compression); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type contents, ::mlir::Value image, /*optional*/uint64_t compression = -1); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value image, /*optional*/uint64_t compression = -1); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::EncodePngOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::EnqueueTPUEmbeddingArbitraryTensorBatchOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class EnqueueTPUEmbeddingArbitraryTensorBatchOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + EnqueueTPUEmbeddingArbitraryTensorBatchOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + EnqueueTPUEmbeddingArbitraryTensorBatchOpGenericAdaptorBase(EnqueueTPUEmbeddingArbitraryTensorBatchOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getDeviceOrdinalAttr(); + uint64_t getDeviceOrdinal(); + ::mlir::ArrayAttr getCombinersAttr(); + ::mlir::ArrayAttr getCombiners(); +}; +} // namespace detail +template +class EnqueueTPUEmbeddingArbitraryTensorBatchOpGenericAdaptor : public detail::EnqueueTPUEmbeddingArbitraryTensorBatchOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::EnqueueTPUEmbeddingArbitraryTensorBatchOpGenericAdaptorBase; +public: + EnqueueTPUEmbeddingArbitraryTensorBatchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + EnqueueTPUEmbeddingArbitraryTensorBatchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : EnqueueTPUEmbeddingArbitraryTensorBatchOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + EnqueueTPUEmbeddingArbitraryTensorBatchOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getSampleIndicesOrRowSplits() { + return getODSOperands(0); + } + + RangeT getEmbeddingIndices() { + return getODSOperands(1); + } + + RangeT getAggregationWeights() { + return getODSOperands(2); + } + + ValueT getModeOverride() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class EnqueueTPUEmbeddingArbitraryTensorBatchOpAdaptor : public EnqueueTPUEmbeddingArbitraryTensorBatchOpGenericAdaptor<::mlir::ValueRange> { +public: + using EnqueueTPUEmbeddingArbitraryTensorBatchOpGenericAdaptor::EnqueueTPUEmbeddingArbitraryTensorBatchOpGenericAdaptor; + EnqueueTPUEmbeddingArbitraryTensorBatchOpAdaptor(EnqueueTPUEmbeddingArbitraryTensorBatchOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class EnqueueTPUEmbeddingArbitraryTensorBatchOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, GetResourceInstanceInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = EnqueueTPUEmbeddingArbitraryTensorBatchOpAdaptor; + template + using GenericAdaptor = EnqueueTPUEmbeddingArbitraryTensorBatchOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("N"), ::llvm::StringRef("T1"), ::llvm::StringRef("T2"), ::llvm::StringRef("T3"), ::llvm::StringRef("combiners"), ::llvm::StringRef("device_ordinal")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getT1AttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getT1AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getT2AttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getT2AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getT3AttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getT3AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getCombinersAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getCombinersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getDeviceOrdinalAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getDeviceOrdinalAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.EnqueueTPUEmbeddingArbitraryTensorBatch"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getSampleIndicesOrRowSplits(); + ::mlir::Operation::operand_range getEmbeddingIndices(); + ::mlir::Operation::operand_range getAggregationWeights(); + ::mlir::TypedValue<::mlir::TensorType> getModeOverride(); + ::mlir::MutableOperandRange getSampleIndicesOrRowSplitsMutable(); + ::mlir::MutableOperandRange getEmbeddingIndicesMutable(); + ::mlir::MutableOperandRange getAggregationWeightsMutable(); + ::mlir::OpOperand &getModeOverrideMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getDeviceOrdinalAttr(); + uint64_t getDeviceOrdinal(); + ::mlir::ArrayAttr getCombinersAttr(); + ::mlir::ArrayAttr getCombiners(); + size_t getN(); + ::mlir::Type getT1(); + ::mlir::Type getT2(); + ::mlir::Type getT3(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setDeviceOrdinalAttr(::mlir::IntegerAttr attr); + void setDeviceOrdinal(::std::optional attrValue); + void setCombinersAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeDeviceOrdinalAttr(); + ::mlir::Attribute removeCombinersAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange sample_indices_or_row_splits, ::mlir::ValueRange embedding_indices, ::mlir::ValueRange aggregation_weights, ::mlir::Value mode_override, /*optional*/::mlir::IntegerAttr device_ordinal, /*optional*/::mlir::ArrayAttr combiners); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange sample_indices_or_row_splits, ::mlir::ValueRange embedding_indices, ::mlir::ValueRange aggregation_weights, ::mlir::Value mode_override, /*optional*/::mlir::IntegerAttr device_ordinal, /*optional*/::mlir::ArrayAttr combiners); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange sample_indices_or_row_splits, ::mlir::ValueRange embedding_indices, ::mlir::ValueRange aggregation_weights, ::mlir::Value mode_override, /*optional*/uint64_t device_ordinal, /*optional*/::mlir::ArrayAttr combiners); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange sample_indices_or_row_splits, ::mlir::ValueRange embedding_indices, ::mlir::ValueRange aggregation_weights, ::mlir::Value mode_override, /*optional*/uint64_t device_ordinal, /*optional*/::mlir::ArrayAttr combiners); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + std::optional GetResourceInstanceStr(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::EnqueueTPUEmbeddingArbitraryTensorBatchOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::EnqueueTPUEmbeddingBatchOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class EnqueueTPUEmbeddingBatchOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + EnqueueTPUEmbeddingBatchOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + EnqueueTPUEmbeddingBatchOpGenericAdaptorBase(EnqueueTPUEmbeddingBatchOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getDeviceOrdinalAttr(); + uint64_t getDeviceOrdinal(); + ::mlir::ArrayAttr getCombinersAttr(); + ::mlir::ArrayAttr getCombiners(); +}; +} // namespace detail +template +class EnqueueTPUEmbeddingBatchOpGenericAdaptor : public detail::EnqueueTPUEmbeddingBatchOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::EnqueueTPUEmbeddingBatchOpGenericAdaptorBase; +public: + EnqueueTPUEmbeddingBatchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + EnqueueTPUEmbeddingBatchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : EnqueueTPUEmbeddingBatchOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + EnqueueTPUEmbeddingBatchOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getBatch() { + return getODSOperands(0); + } + + ValueT getModeOverride() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class EnqueueTPUEmbeddingBatchOpAdaptor : public EnqueueTPUEmbeddingBatchOpGenericAdaptor<::mlir::ValueRange> { +public: + using EnqueueTPUEmbeddingBatchOpGenericAdaptor::EnqueueTPUEmbeddingBatchOpGenericAdaptor; + EnqueueTPUEmbeddingBatchOpAdaptor(EnqueueTPUEmbeddingBatchOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class EnqueueTPUEmbeddingBatchOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, GetResourceInstanceInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = EnqueueTPUEmbeddingBatchOpAdaptor; + template + using GenericAdaptor = EnqueueTPUEmbeddingBatchOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("N"), ::llvm::StringRef("combiners"), ::llvm::StringRef("device_ordinal")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getCombinersAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getCombinersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDeviceOrdinalAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDeviceOrdinalAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.EnqueueTPUEmbeddingBatch"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getBatch(); + ::mlir::TypedValue<::mlir::TensorType> getModeOverride(); + ::mlir::MutableOperandRange getBatchMutable(); + ::mlir::OpOperand &getModeOverrideMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getDeviceOrdinalAttr(); + uint64_t getDeviceOrdinal(); + ::mlir::ArrayAttr getCombinersAttr(); + ::mlir::ArrayAttr getCombiners(); + size_t getN(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setDeviceOrdinalAttr(::mlir::IntegerAttr attr); + void setDeviceOrdinal(::std::optional attrValue); + void setCombinersAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeDeviceOrdinalAttr(); + ::mlir::Attribute removeCombinersAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange batch, ::mlir::Value mode_override, /*optional*/::mlir::IntegerAttr device_ordinal, /*optional*/::mlir::ArrayAttr combiners); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange batch, ::mlir::Value mode_override, /*optional*/::mlir::IntegerAttr device_ordinal, /*optional*/::mlir::ArrayAttr combiners); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange batch, ::mlir::Value mode_override, /*optional*/uint64_t device_ordinal, /*optional*/::mlir::ArrayAttr combiners); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange batch, ::mlir::Value mode_override, /*optional*/uint64_t device_ordinal, /*optional*/::mlir::ArrayAttr combiners); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + std::optional GetResourceInstanceStr(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::EnqueueTPUEmbeddingBatchOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::EnqueueTPUEmbeddingIntegerBatchOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class EnqueueTPUEmbeddingIntegerBatchOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + EnqueueTPUEmbeddingIntegerBatchOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + EnqueueTPUEmbeddingIntegerBatchOpGenericAdaptorBase(EnqueueTPUEmbeddingIntegerBatchOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getDeviceOrdinalAttr(); + uint64_t getDeviceOrdinal(); +}; +} // namespace detail +template +class EnqueueTPUEmbeddingIntegerBatchOpGenericAdaptor : public detail::EnqueueTPUEmbeddingIntegerBatchOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::EnqueueTPUEmbeddingIntegerBatchOpGenericAdaptorBase; +public: + EnqueueTPUEmbeddingIntegerBatchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + EnqueueTPUEmbeddingIntegerBatchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : EnqueueTPUEmbeddingIntegerBatchOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + EnqueueTPUEmbeddingIntegerBatchOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getBatch() { + return getODSOperands(0); + } + + ValueT getModeOverride() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class EnqueueTPUEmbeddingIntegerBatchOpAdaptor : public EnqueueTPUEmbeddingIntegerBatchOpGenericAdaptor<::mlir::ValueRange> { +public: + using EnqueueTPUEmbeddingIntegerBatchOpGenericAdaptor::EnqueueTPUEmbeddingIntegerBatchOpGenericAdaptor; + EnqueueTPUEmbeddingIntegerBatchOpAdaptor(EnqueueTPUEmbeddingIntegerBatchOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class EnqueueTPUEmbeddingIntegerBatchOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, GetResourceInstanceInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = EnqueueTPUEmbeddingIntegerBatchOpAdaptor; + template + using GenericAdaptor = EnqueueTPUEmbeddingIntegerBatchOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("N"), ::llvm::StringRef("device_ordinal")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDeviceOrdinalAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDeviceOrdinalAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.EnqueueTPUEmbeddingIntegerBatch"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getBatch(); + ::mlir::TypedValue<::mlir::TensorType> getModeOverride(); + ::mlir::MutableOperandRange getBatchMutable(); + ::mlir::OpOperand &getModeOverrideMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getDeviceOrdinalAttr(); + uint64_t getDeviceOrdinal(); + size_t getN(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setDeviceOrdinalAttr(::mlir::IntegerAttr attr); + void setDeviceOrdinal(::std::optional attrValue); + ::mlir::Attribute removeDeviceOrdinalAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange batch, ::mlir::Value mode_override, /*optional*/::mlir::IntegerAttr device_ordinal); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange batch, ::mlir::Value mode_override, /*optional*/::mlir::IntegerAttr device_ordinal); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange batch, ::mlir::Value mode_override, /*optional*/uint64_t device_ordinal = -1); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange batch, ::mlir::Value mode_override, /*optional*/uint64_t device_ordinal = -1); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + std::optional GetResourceInstanceStr(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::EnqueueTPUEmbeddingIntegerBatchOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::EnqueueTPUEmbeddingRaggedTensorBatchOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class EnqueueTPUEmbeddingRaggedTensorBatchOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + EnqueueTPUEmbeddingRaggedTensorBatchOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + EnqueueTPUEmbeddingRaggedTensorBatchOpGenericAdaptorBase(EnqueueTPUEmbeddingRaggedTensorBatchOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getDeviceOrdinalAttr(); + uint64_t getDeviceOrdinal(); + ::mlir::ArrayAttr getCombinersAttr(); + ::mlir::ArrayAttr getCombiners(); + ::mlir::ArrayAttr getTableIdsAttr(); + ::mlir::ArrayAttr getTableIds(); + ::mlir::ArrayAttr getMaxSequenceLengthsAttr(); + ::mlir::ArrayAttr getMaxSequenceLengths(); + ::mlir::ArrayAttr getNumFeaturesAttr(); + ::mlir::ArrayAttr getNumFeatures(); +}; +} // namespace detail +template +class EnqueueTPUEmbeddingRaggedTensorBatchOpGenericAdaptor : public detail::EnqueueTPUEmbeddingRaggedTensorBatchOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::EnqueueTPUEmbeddingRaggedTensorBatchOpGenericAdaptorBase; +public: + EnqueueTPUEmbeddingRaggedTensorBatchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + EnqueueTPUEmbeddingRaggedTensorBatchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : EnqueueTPUEmbeddingRaggedTensorBatchOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + EnqueueTPUEmbeddingRaggedTensorBatchOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getSampleSplits() { + return getODSOperands(0); + } + + RangeT getEmbeddingIndices() { + return getODSOperands(1); + } + + RangeT getAggregationWeights() { + return getODSOperands(2); + } + + ValueT getModeOverride() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class EnqueueTPUEmbeddingRaggedTensorBatchOpAdaptor : public EnqueueTPUEmbeddingRaggedTensorBatchOpGenericAdaptor<::mlir::ValueRange> { +public: + using EnqueueTPUEmbeddingRaggedTensorBatchOpGenericAdaptor::EnqueueTPUEmbeddingRaggedTensorBatchOpGenericAdaptor; + EnqueueTPUEmbeddingRaggedTensorBatchOpAdaptor(EnqueueTPUEmbeddingRaggedTensorBatchOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class EnqueueTPUEmbeddingRaggedTensorBatchOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, GetResourceInstanceInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = EnqueueTPUEmbeddingRaggedTensorBatchOpAdaptor; + template + using GenericAdaptor = EnqueueTPUEmbeddingRaggedTensorBatchOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("N"), ::llvm::StringRef("T1"), ::llvm::StringRef("T2"), ::llvm::StringRef("T3"), ::llvm::StringRef("combiners"), ::llvm::StringRef("device_ordinal"), ::llvm::StringRef("max_sequence_lengths"), ::llvm::StringRef("num_features"), ::llvm::StringRef("table_ids")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getT1AttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getT1AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getT2AttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getT2AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getT3AttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getT3AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getCombinersAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getCombinersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getDeviceOrdinalAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getDeviceOrdinalAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getMaxSequenceLengthsAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getMaxSequenceLengthsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getNumFeaturesAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getNumFeaturesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getTableIdsAttrName() { + return getAttributeNameForIndex(8); + } + + static ::mlir::StringAttr getTableIdsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 8); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.EnqueueTPUEmbeddingRaggedTensorBatch"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getSampleSplits(); + ::mlir::Operation::operand_range getEmbeddingIndices(); + ::mlir::Operation::operand_range getAggregationWeights(); + ::mlir::TypedValue<::mlir::TensorType> getModeOverride(); + ::mlir::MutableOperandRange getSampleSplitsMutable(); + ::mlir::MutableOperandRange getEmbeddingIndicesMutable(); + ::mlir::MutableOperandRange getAggregationWeightsMutable(); + ::mlir::OpOperand &getModeOverrideMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getDeviceOrdinalAttr(); + uint64_t getDeviceOrdinal(); + ::mlir::ArrayAttr getCombinersAttr(); + ::mlir::ArrayAttr getCombiners(); + ::mlir::ArrayAttr getTableIdsAttr(); + ::mlir::ArrayAttr getTableIds(); + ::mlir::ArrayAttr getMaxSequenceLengthsAttr(); + ::mlir::ArrayAttr getMaxSequenceLengths(); + ::mlir::ArrayAttr getNumFeaturesAttr(); + ::mlir::ArrayAttr getNumFeatures(); + size_t getN(); + ::mlir::Type getT1(); + ::mlir::Type getT2(); + ::mlir::Type getT3(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setDeviceOrdinalAttr(::mlir::IntegerAttr attr); + void setDeviceOrdinal(::std::optional attrValue); + void setCombinersAttr(::mlir::ArrayAttr attr); + void setTableIdsAttr(::mlir::ArrayAttr attr); + void setMaxSequenceLengthsAttr(::mlir::ArrayAttr attr); + void setNumFeaturesAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeDeviceOrdinalAttr(); + ::mlir::Attribute removeCombinersAttr(); + ::mlir::Attribute removeMaxSequenceLengthsAttr(); + ::mlir::Attribute removeNumFeaturesAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange sample_splits, ::mlir::ValueRange embedding_indices, ::mlir::ValueRange aggregation_weights, ::mlir::Value mode_override, /*optional*/::mlir::IntegerAttr device_ordinal, /*optional*/::mlir::ArrayAttr combiners, ::mlir::ArrayAttr table_ids, /*optional*/::mlir::ArrayAttr max_sequence_lengths, /*optional*/::mlir::ArrayAttr num_features); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange sample_splits, ::mlir::ValueRange embedding_indices, ::mlir::ValueRange aggregation_weights, ::mlir::Value mode_override, /*optional*/::mlir::IntegerAttr device_ordinal, /*optional*/::mlir::ArrayAttr combiners, ::mlir::ArrayAttr table_ids, /*optional*/::mlir::ArrayAttr max_sequence_lengths, /*optional*/::mlir::ArrayAttr num_features); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange sample_splits, ::mlir::ValueRange embedding_indices, ::mlir::ValueRange aggregation_weights, ::mlir::Value mode_override, /*optional*/uint64_t device_ordinal, /*optional*/::mlir::ArrayAttr combiners, ::mlir::ArrayAttr table_ids, /*optional*/::mlir::ArrayAttr max_sequence_lengths, /*optional*/::mlir::ArrayAttr num_features); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange sample_splits, ::mlir::ValueRange embedding_indices, ::mlir::ValueRange aggregation_weights, ::mlir::Value mode_override, /*optional*/uint64_t device_ordinal, /*optional*/::mlir::ArrayAttr combiners, ::mlir::ArrayAttr table_ids, /*optional*/::mlir::ArrayAttr max_sequence_lengths, /*optional*/::mlir::ArrayAttr num_features); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + std::optional GetResourceInstanceStr(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 9 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::EnqueueTPUEmbeddingRaggedTensorBatchOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::EnqueueTPUEmbeddingSparseBatchOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class EnqueueTPUEmbeddingSparseBatchOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + EnqueueTPUEmbeddingSparseBatchOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + EnqueueTPUEmbeddingSparseBatchOpGenericAdaptorBase(EnqueueTPUEmbeddingSparseBatchOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getDeviceOrdinalAttr(); + uint64_t getDeviceOrdinal(); + ::mlir::ArrayAttr getCombinersAttr(); + ::mlir::ArrayAttr getCombiners(); +}; +} // namespace detail +template +class EnqueueTPUEmbeddingSparseBatchOpGenericAdaptor : public detail::EnqueueTPUEmbeddingSparseBatchOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::EnqueueTPUEmbeddingSparseBatchOpGenericAdaptorBase; +public: + EnqueueTPUEmbeddingSparseBatchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + EnqueueTPUEmbeddingSparseBatchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : EnqueueTPUEmbeddingSparseBatchOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + EnqueueTPUEmbeddingSparseBatchOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getSampleIndices() { + return getODSOperands(0); + } + + RangeT getEmbeddingIndices() { + return getODSOperands(1); + } + + RangeT getAggregationWeights() { + return getODSOperands(2); + } + + ValueT getModeOverride() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class EnqueueTPUEmbeddingSparseBatchOpAdaptor : public EnqueueTPUEmbeddingSparseBatchOpGenericAdaptor<::mlir::ValueRange> { +public: + using EnqueueTPUEmbeddingSparseBatchOpGenericAdaptor::EnqueueTPUEmbeddingSparseBatchOpGenericAdaptor; + EnqueueTPUEmbeddingSparseBatchOpAdaptor(EnqueueTPUEmbeddingSparseBatchOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class EnqueueTPUEmbeddingSparseBatchOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, GetResourceInstanceInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = EnqueueTPUEmbeddingSparseBatchOpAdaptor; + template + using GenericAdaptor = EnqueueTPUEmbeddingSparseBatchOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("N"), ::llvm::StringRef("T1"), ::llvm::StringRef("T2"), ::llvm::StringRef("T3"), ::llvm::StringRef("combiners"), ::llvm::StringRef("device_ordinal")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getT1AttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getT1AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getT2AttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getT2AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getT3AttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getT3AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getCombinersAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getCombinersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getDeviceOrdinalAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getDeviceOrdinalAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.EnqueueTPUEmbeddingSparseBatch"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getSampleIndices(); + ::mlir::Operation::operand_range getEmbeddingIndices(); + ::mlir::Operation::operand_range getAggregationWeights(); + ::mlir::TypedValue<::mlir::TensorType> getModeOverride(); + ::mlir::MutableOperandRange getSampleIndicesMutable(); + ::mlir::MutableOperandRange getEmbeddingIndicesMutable(); + ::mlir::MutableOperandRange getAggregationWeightsMutable(); + ::mlir::OpOperand &getModeOverrideMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getDeviceOrdinalAttr(); + uint64_t getDeviceOrdinal(); + ::mlir::ArrayAttr getCombinersAttr(); + ::mlir::ArrayAttr getCombiners(); + size_t getN(); + ::mlir::Type getT1(); + ::mlir::Type getT2(); + ::mlir::Type getT3(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setDeviceOrdinalAttr(::mlir::IntegerAttr attr); + void setDeviceOrdinal(::std::optional attrValue); + void setCombinersAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeDeviceOrdinalAttr(); + ::mlir::Attribute removeCombinersAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange sample_indices, ::mlir::ValueRange embedding_indices, ::mlir::ValueRange aggregation_weights, ::mlir::Value mode_override, /*optional*/::mlir::IntegerAttr device_ordinal, /*optional*/::mlir::ArrayAttr combiners); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange sample_indices, ::mlir::ValueRange embedding_indices, ::mlir::ValueRange aggregation_weights, ::mlir::Value mode_override, /*optional*/::mlir::IntegerAttr device_ordinal, /*optional*/::mlir::ArrayAttr combiners); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange sample_indices, ::mlir::ValueRange embedding_indices, ::mlir::ValueRange aggregation_weights, ::mlir::Value mode_override, /*optional*/uint64_t device_ordinal, /*optional*/::mlir::ArrayAttr combiners); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange sample_indices, ::mlir::ValueRange embedding_indices, ::mlir::ValueRange aggregation_weights, ::mlir::Value mode_override, /*optional*/uint64_t device_ordinal, /*optional*/::mlir::ArrayAttr combiners); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + std::optional GetResourceInstanceStr(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::EnqueueTPUEmbeddingSparseBatchOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::EnqueueTPUEmbeddingSparseTensorBatchOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class EnqueueTPUEmbeddingSparseTensorBatchOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + EnqueueTPUEmbeddingSparseTensorBatchOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + EnqueueTPUEmbeddingSparseTensorBatchOpGenericAdaptorBase(EnqueueTPUEmbeddingSparseTensorBatchOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getDeviceOrdinalAttr(); + uint64_t getDeviceOrdinal(); + ::mlir::ArrayAttr getCombinersAttr(); + ::mlir::ArrayAttr getCombiners(); + ::mlir::ArrayAttr getTableIdsAttr(); + ::mlir::ArrayAttr getTableIds(); + ::mlir::ArrayAttr getMaxSequenceLengthsAttr(); + ::mlir::ArrayAttr getMaxSequenceLengths(); + ::mlir::ArrayAttr getNumFeaturesAttr(); + ::mlir::ArrayAttr getNumFeatures(); +}; +} // namespace detail +template +class EnqueueTPUEmbeddingSparseTensorBatchOpGenericAdaptor : public detail::EnqueueTPUEmbeddingSparseTensorBatchOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::EnqueueTPUEmbeddingSparseTensorBatchOpGenericAdaptorBase; +public: + EnqueueTPUEmbeddingSparseTensorBatchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + EnqueueTPUEmbeddingSparseTensorBatchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : EnqueueTPUEmbeddingSparseTensorBatchOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + EnqueueTPUEmbeddingSparseTensorBatchOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getSampleIndices() { + return getODSOperands(0); + } + + RangeT getEmbeddingIndices() { + return getODSOperands(1); + } + + RangeT getAggregationWeights() { + return getODSOperands(2); + } + + ValueT getModeOverride() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class EnqueueTPUEmbeddingSparseTensorBatchOpAdaptor : public EnqueueTPUEmbeddingSparseTensorBatchOpGenericAdaptor<::mlir::ValueRange> { +public: + using EnqueueTPUEmbeddingSparseTensorBatchOpGenericAdaptor::EnqueueTPUEmbeddingSparseTensorBatchOpGenericAdaptor; + EnqueueTPUEmbeddingSparseTensorBatchOpAdaptor(EnqueueTPUEmbeddingSparseTensorBatchOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class EnqueueTPUEmbeddingSparseTensorBatchOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, GetResourceInstanceInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = EnqueueTPUEmbeddingSparseTensorBatchOpAdaptor; + template + using GenericAdaptor = EnqueueTPUEmbeddingSparseTensorBatchOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("N"), ::llvm::StringRef("T1"), ::llvm::StringRef("T2"), ::llvm::StringRef("T3"), ::llvm::StringRef("combiners"), ::llvm::StringRef("device_ordinal"), ::llvm::StringRef("max_sequence_lengths"), ::llvm::StringRef("num_features"), ::llvm::StringRef("table_ids")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getT1AttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getT1AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getT2AttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getT2AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getT3AttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getT3AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getCombinersAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getCombinersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getDeviceOrdinalAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getDeviceOrdinalAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getMaxSequenceLengthsAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getMaxSequenceLengthsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getNumFeaturesAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getNumFeaturesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getTableIdsAttrName() { + return getAttributeNameForIndex(8); + } + + static ::mlir::StringAttr getTableIdsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 8); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.EnqueueTPUEmbeddingSparseTensorBatch"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getSampleIndices(); + ::mlir::Operation::operand_range getEmbeddingIndices(); + ::mlir::Operation::operand_range getAggregationWeights(); + ::mlir::TypedValue<::mlir::TensorType> getModeOverride(); + ::mlir::MutableOperandRange getSampleIndicesMutable(); + ::mlir::MutableOperandRange getEmbeddingIndicesMutable(); + ::mlir::MutableOperandRange getAggregationWeightsMutable(); + ::mlir::OpOperand &getModeOverrideMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getDeviceOrdinalAttr(); + uint64_t getDeviceOrdinal(); + ::mlir::ArrayAttr getCombinersAttr(); + ::mlir::ArrayAttr getCombiners(); + ::mlir::ArrayAttr getTableIdsAttr(); + ::mlir::ArrayAttr getTableIds(); + ::mlir::ArrayAttr getMaxSequenceLengthsAttr(); + ::mlir::ArrayAttr getMaxSequenceLengths(); + ::mlir::ArrayAttr getNumFeaturesAttr(); + ::mlir::ArrayAttr getNumFeatures(); + size_t getN(); + ::mlir::Type getT1(); + ::mlir::Type getT2(); + ::mlir::Type getT3(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setDeviceOrdinalAttr(::mlir::IntegerAttr attr); + void setDeviceOrdinal(::std::optional attrValue); + void setCombinersAttr(::mlir::ArrayAttr attr); + void setTableIdsAttr(::mlir::ArrayAttr attr); + void setMaxSequenceLengthsAttr(::mlir::ArrayAttr attr); + void setNumFeaturesAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeDeviceOrdinalAttr(); + ::mlir::Attribute removeCombinersAttr(); + ::mlir::Attribute removeMaxSequenceLengthsAttr(); + ::mlir::Attribute removeNumFeaturesAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange sample_indices, ::mlir::ValueRange embedding_indices, ::mlir::ValueRange aggregation_weights, ::mlir::Value mode_override, /*optional*/::mlir::IntegerAttr device_ordinal, /*optional*/::mlir::ArrayAttr combiners, ::mlir::ArrayAttr table_ids, /*optional*/::mlir::ArrayAttr max_sequence_lengths, /*optional*/::mlir::ArrayAttr num_features); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange sample_indices, ::mlir::ValueRange embedding_indices, ::mlir::ValueRange aggregation_weights, ::mlir::Value mode_override, /*optional*/::mlir::IntegerAttr device_ordinal, /*optional*/::mlir::ArrayAttr combiners, ::mlir::ArrayAttr table_ids, /*optional*/::mlir::ArrayAttr max_sequence_lengths, /*optional*/::mlir::ArrayAttr num_features); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange sample_indices, ::mlir::ValueRange embedding_indices, ::mlir::ValueRange aggregation_weights, ::mlir::Value mode_override, /*optional*/uint64_t device_ordinal, /*optional*/::mlir::ArrayAttr combiners, ::mlir::ArrayAttr table_ids, /*optional*/::mlir::ArrayAttr max_sequence_lengths, /*optional*/::mlir::ArrayAttr num_features); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange sample_indices, ::mlir::ValueRange embedding_indices, ::mlir::ValueRange aggregation_weights, ::mlir::Value mode_override, /*optional*/uint64_t device_ordinal, /*optional*/::mlir::ArrayAttr combiners, ::mlir::ArrayAttr table_ids, /*optional*/::mlir::ArrayAttr max_sequence_lengths, /*optional*/::mlir::ArrayAttr num_features); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + std::optional GetResourceInstanceStr(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 9 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::EnqueueTPUEmbeddingSparseTensorBatchOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::EnsureShapeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class EnsureShapeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + EnsureShapeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + EnsureShapeOpGenericAdaptorBase(EnsureShapeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Attribute getShapeAttr(); + std::optional> getShape(); +}; +} // namespace detail +template +class EnsureShapeOpGenericAdaptor : public detail::EnsureShapeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::EnsureShapeOpGenericAdaptorBase; +public: + EnsureShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + EnsureShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : EnsureShapeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + EnsureShapeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class EnsureShapeOpAdaptor : public EnsureShapeOpGenericAdaptor<::mlir::ValueRange> { +public: + using EnsureShapeOpGenericAdaptor::EnsureShapeOpGenericAdaptor; + EnsureShapeOpAdaptor(EnsureShapeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class EnsureShapeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = EnsureShapeOpAdaptor; + template + using GenericAdaptor = EnsureShapeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("shape")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getShapeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getShapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.EnsureShape"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Attribute getShapeAttr(); + std::optional> getShape(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setShapeAttr(::mlir::Attribute attr); + void setShape(std::optional> attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Attribute shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Attribute shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, std::optional> shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, std::optional> shape); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::EnsureShapeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::EqualOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class EqualOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + EqualOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + EqualOpGenericAdaptorBase(EqualOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getIncompatibleShapeErrorAttr(); + bool getIncompatibleShapeError(); +}; +} // namespace detail +template +class EqualOpGenericAdaptor : public detail::EqualOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::EqualOpGenericAdaptorBase; +public: + EqualOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + EqualOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : EqualOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + EqualOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class EqualOpAdaptor : public EqualOpGenericAdaptor<::mlir::ValueRange> { +public: + using EqualOpGenericAdaptor::EqualOpGenericAdaptor; + EqualOpAdaptor(EqualOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class EqualOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsCommutative, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = EqualOpAdaptor; + template + using GenericAdaptor = EqualOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("incompatible_shape_error")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getIncompatibleShapeErrorAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getIncompatibleShapeErrorAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Equal"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::BoolAttr getIncompatibleShapeErrorAttr(); + bool getIncompatibleShapeError(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setIncompatibleShapeErrorAttr(::mlir::BoolAttr attr); + void setIncompatibleShapeError(::std::optional attrValue); + ::mlir::Attribute removeIncompatibleShapeErrorAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y, BoolAttr incompatible_shape_error); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y, /*optional*/::mlir::BoolAttr incompatible_shape_error); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y, /*optional*/::mlir::BoolAttr incompatible_shape_error); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y, /*optional*/bool incompatible_shape_error = true); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y, /*optional*/bool incompatible_shape_error = true); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::EqualOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ErfOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ErfOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ErfOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ErfOpGenericAdaptorBase(ErfOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ErfOpGenericAdaptor : public detail::ErfOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ErfOpGenericAdaptorBase; +public: + ErfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ErfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ErfOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ErfOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ErfOpAdaptor : public ErfOpGenericAdaptor<::mlir::ValueRange> { +public: + using ErfOpGenericAdaptor::ErfOpGenericAdaptor; + ErfOpAdaptor(ErfOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ErfOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ErfOpAdaptor; + template + using GenericAdaptor = ErfOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Erf"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ErfOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ErfcOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ErfcOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ErfcOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ErfcOpGenericAdaptorBase(ErfcOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ErfcOpGenericAdaptor : public detail::ErfcOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ErfcOpGenericAdaptorBase; +public: + ErfcOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ErfcOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ErfcOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ErfcOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ErfcOpAdaptor : public ErfcOpGenericAdaptor<::mlir::ValueRange> { +public: + using ErfcOpGenericAdaptor::ErfcOpGenericAdaptor; + ErfcOpAdaptor(ErfcOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ErfcOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ErfcOpAdaptor; + template + using GenericAdaptor = ErfcOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Erfc"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ErfcOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ErfinvOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ErfinvOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ErfinvOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ErfinvOpGenericAdaptorBase(ErfinvOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ErfinvOpGenericAdaptor : public detail::ErfinvOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ErfinvOpGenericAdaptorBase; +public: + ErfinvOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ErfinvOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ErfinvOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ErfinvOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ErfinvOpAdaptor : public ErfinvOpGenericAdaptor<::mlir::ValueRange> { +public: + using ErfinvOpGenericAdaptor::ErfinvOpGenericAdaptor; + ErfinvOpAdaptor(ErfinvOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ErfinvOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ErfinvOpAdaptor; + template + using GenericAdaptor = ErfinvOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Erfinv"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ErfinvOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ExecuteTPUEmbeddingPartitionerOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ExecuteTPUEmbeddingPartitionerOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ExecuteTPUEmbeddingPartitionerOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ExecuteTPUEmbeddingPartitionerOpGenericAdaptorBase(ExecuteTPUEmbeddingPartitionerOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class ExecuteTPUEmbeddingPartitionerOpGenericAdaptor : public detail::ExecuteTPUEmbeddingPartitionerOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ExecuteTPUEmbeddingPartitionerOpGenericAdaptorBase; +public: + ExecuteTPUEmbeddingPartitionerOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ExecuteTPUEmbeddingPartitionerOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ExecuteTPUEmbeddingPartitionerOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ExecuteTPUEmbeddingPartitionerOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ExecuteTPUEmbeddingPartitionerOpAdaptor : public ExecuteTPUEmbeddingPartitionerOpGenericAdaptor<::mlir::ValueRange> { +public: + using ExecuteTPUEmbeddingPartitionerOpGenericAdaptor::ExecuteTPUEmbeddingPartitionerOpGenericAdaptor; + ExecuteTPUEmbeddingPartitionerOpAdaptor(ExecuteTPUEmbeddingPartitionerOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ExecuteTPUEmbeddingPartitionerOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = ExecuteTPUEmbeddingPartitionerOpAdaptor; + template + using GenericAdaptor = ExecuteTPUEmbeddingPartitionerOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ExecuteTPUEmbeddingPartitioner"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getCommonConfig(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type common_config, ::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type common_config, ::llvm::StringRef config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef config); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ExecuteTPUEmbeddingPartitionerOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ExpOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ExpOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ExpOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ExpOpGenericAdaptorBase(ExpOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ExpOpGenericAdaptor : public detail::ExpOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ExpOpGenericAdaptorBase; +public: + ExpOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ExpOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ExpOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ExpOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ExpOpAdaptor : public ExpOpGenericAdaptor<::mlir::ValueRange> { +public: + using ExpOpGenericAdaptor::ExpOpGenericAdaptor; + ExpOpAdaptor(ExpOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ExpOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ExpOpAdaptor; + template + using GenericAdaptor = ExpOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Exp"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ExpOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ExpandDimsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ExpandDimsOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ExpandDimsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ExpandDimsOpGenericAdaptorBase(ExpandDimsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ExpandDimsOpGenericAdaptor : public detail::ExpandDimsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ExpandDimsOpGenericAdaptorBase; +public: + ExpandDimsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ExpandDimsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ExpandDimsOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ExpandDimsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getDim() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ExpandDimsOpAdaptor : public ExpandDimsOpGenericAdaptor<::mlir::ValueRange> { +public: + using ExpandDimsOpGenericAdaptor::ExpandDimsOpGenericAdaptor; + ExpandDimsOpAdaptor(ExpandDimsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ExpandDimsOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ExpandDimsOpAdaptor; + template + using GenericAdaptor = ExpandDimsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tdim")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTdimAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTdimAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ExpandDims"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getDim(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getDimMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTdim(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value condition, Value dim); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value dim); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value dim); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ExpandDimsOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::Expm1Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Expm1OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + Expm1OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + Expm1OpGenericAdaptorBase(Expm1Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class Expm1OpGenericAdaptor : public detail::Expm1OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Expm1OpGenericAdaptorBase; +public: + Expm1OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Expm1OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Expm1OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + Expm1OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Expm1OpAdaptor : public Expm1OpGenericAdaptor<::mlir::ValueRange> { +public: + using Expm1OpGenericAdaptor::Expm1OpGenericAdaptor; + Expm1OpAdaptor(Expm1Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Expm1Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = Expm1OpAdaptor; + template + using GenericAdaptor = Expm1OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Expm1"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::Expm1Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ExtractImagePatchesOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ExtractImagePatchesOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ExtractImagePatchesOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ExtractImagePatchesOpGenericAdaptorBase(ExtractImagePatchesOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getKsizesAttr(); + ::mlir::ArrayAttr getKsizes(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::ArrayAttr getRatesAttr(); + ::mlir::ArrayAttr getRates(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); +}; +} // namespace detail +template +class ExtractImagePatchesOpGenericAdaptor : public detail::ExtractImagePatchesOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ExtractImagePatchesOpGenericAdaptorBase; +public: + ExtractImagePatchesOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ExtractImagePatchesOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ExtractImagePatchesOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ExtractImagePatchesOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getImages() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ExtractImagePatchesOpAdaptor : public ExtractImagePatchesOpGenericAdaptor<::mlir::ValueRange> { +public: + using ExtractImagePatchesOpGenericAdaptor::ExtractImagePatchesOpGenericAdaptor; + ExtractImagePatchesOpAdaptor(ExtractImagePatchesOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ExtractImagePatchesOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ExtractImagePatchesOpAdaptor; + template + using GenericAdaptor = ExtractImagePatchesOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("ksizes"), ::llvm::StringRef("padding"), ::llvm::StringRef("rates"), ::llvm::StringRef("strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getKsizesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getKsizesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getRatesAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getRatesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ExtractImagePatches"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getImages(); + ::mlir::OpOperand &getImagesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getPatches(); + ::mlir::ArrayAttr getKsizesAttr(); + ::mlir::ArrayAttr getKsizes(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::ArrayAttr getRatesAttr(); + ::mlir::ArrayAttr getRates(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setKsizesAttr(::mlir::ArrayAttr attr); + void setStridesAttr(::mlir::ArrayAttr attr); + void setRatesAttr(::mlir::ArrayAttr attr); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type patches, ::mlir::Value images, ::mlir::ArrayAttr ksizes, ::mlir::ArrayAttr strides, ::mlir::ArrayAttr rates, ::mlir::StringAttr padding); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value images, ::mlir::ArrayAttr ksizes, ::mlir::ArrayAttr strides, ::mlir::ArrayAttr rates, ::mlir::StringAttr padding); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type patches, ::mlir::Value images, ::mlir::ArrayAttr ksizes, ::mlir::ArrayAttr strides, ::mlir::ArrayAttr rates, ::llvm::StringRef padding); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value images, ::mlir::ArrayAttr ksizes, ::mlir::ArrayAttr strides, ::mlir::ArrayAttr rates, ::llvm::StringRef padding); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ExtractImagePatchesOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::FFT2DOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FFT2DOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FFT2DOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FFT2DOpGenericAdaptorBase(FFT2DOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class FFT2DOpGenericAdaptor : public detail::FFT2DOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FFT2DOpGenericAdaptorBase; +public: + FFT2DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FFT2DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FFT2DOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FFT2DOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FFT2DOpAdaptor : public FFT2DOpGenericAdaptor<::mlir::ValueRange> { +public: + using FFT2DOpGenericAdaptor::FFT2DOpGenericAdaptor; + FFT2DOpAdaptor(FFT2DOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FFT2DOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FFT2DOpAdaptor; + template + using GenericAdaptor = FFT2DOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tcomplex")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTcomplexAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTcomplexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.FFT2D"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getTcomplex(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::FFT2DOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::FFT3DOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FFT3DOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FFT3DOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FFT3DOpGenericAdaptorBase(FFT3DOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class FFT3DOpGenericAdaptor : public detail::FFT3DOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FFT3DOpGenericAdaptorBase; +public: + FFT3DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FFT3DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FFT3DOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FFT3DOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FFT3DOpAdaptor : public FFT3DOpGenericAdaptor<::mlir::ValueRange> { +public: + using FFT3DOpGenericAdaptor::FFT3DOpGenericAdaptor; + FFT3DOpAdaptor(FFT3DOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FFT3DOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FFT3DOpAdaptor; + template + using GenericAdaptor = FFT3DOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tcomplex")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTcomplexAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTcomplexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.FFT3D"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getTcomplex(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::FFT3DOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::FFTOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FFTOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FFTOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FFTOpGenericAdaptorBase(FFTOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class FFTOpGenericAdaptor : public detail::FFTOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FFTOpGenericAdaptorBase; +public: + FFTOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FFTOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FFTOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FFTOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FFTOpAdaptor : public FFTOpGenericAdaptor<::mlir::ValueRange> { +public: + using FFTOpGenericAdaptor::FFTOpGenericAdaptor; + FFTOpAdaptor(FFTOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FFTOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FFTOpAdaptor; + template + using GenericAdaptor = FFTOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tcomplex")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTcomplexAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTcomplexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.FFT"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getTcomplex(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::FFTOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::FakeParamOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FakeParamOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FakeParamOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FakeParamOpGenericAdaptorBase(FakeParamOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Attribute getShapeAttr(); + std::optional> getShape(); +}; +} // namespace detail +template +class FakeParamOpGenericAdaptor : public detail::FakeParamOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FakeParamOpGenericAdaptorBase; +public: + FakeParamOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FakeParamOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FakeParamOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FakeParamOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FakeParamOpAdaptor : public FakeParamOpGenericAdaptor<::mlir::ValueRange> { +public: + using FakeParamOpGenericAdaptor::FakeParamOpGenericAdaptor; + FakeParamOpAdaptor(FakeParamOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FakeParamOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FakeParamOpAdaptor; + template + using GenericAdaptor = FakeParamOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dtype"), ::llvm::StringRef("shape")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getShapeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getShapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.FakeParam"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Attribute getShapeAttr(); + std::optional> getShape(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setShapeAttr(::mlir::Attribute attr); + void setShape(std::optional> attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Attribute shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Attribute shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, std::optional> shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, std::optional> shape); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::FakeParamOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::FakeQuantWithMinMaxArgsGradientOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FakeQuantWithMinMaxArgsGradientOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FakeQuantWithMinMaxArgsGradientOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FakeQuantWithMinMaxArgsGradientOpGenericAdaptorBase(FakeQuantWithMinMaxArgsGradientOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::FloatAttr getMinAttr(); + ::llvm::APFloat getMin(); + ::mlir::FloatAttr getMaxAttr(); + ::llvm::APFloat getMax(); + ::mlir::IntegerAttr getNumBitsAttr(); + uint64_t getNumBits(); + ::mlir::BoolAttr getNarrowRangeAttr(); + bool getNarrowRange(); +}; +} // namespace detail +template +class FakeQuantWithMinMaxArgsGradientOpGenericAdaptor : public detail::FakeQuantWithMinMaxArgsGradientOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FakeQuantWithMinMaxArgsGradientOpGenericAdaptorBase; +public: + FakeQuantWithMinMaxArgsGradientOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FakeQuantWithMinMaxArgsGradientOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FakeQuantWithMinMaxArgsGradientOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FakeQuantWithMinMaxArgsGradientOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getGradients() { + return (*getODSOperands(0).begin()); + } + + ValueT getInputs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FakeQuantWithMinMaxArgsGradientOpAdaptor : public FakeQuantWithMinMaxArgsGradientOpGenericAdaptor<::mlir::ValueRange> { +public: + using FakeQuantWithMinMaxArgsGradientOpGenericAdaptor::FakeQuantWithMinMaxArgsGradientOpGenericAdaptor; + FakeQuantWithMinMaxArgsGradientOpAdaptor(FakeQuantWithMinMaxArgsGradientOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FakeQuantWithMinMaxArgsGradientOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef> { +public: + using Op::Op; + using Op::print; + using Adaptor = FakeQuantWithMinMaxArgsGradientOpAdaptor; + template + using GenericAdaptor = FakeQuantWithMinMaxArgsGradientOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("max"), ::llvm::StringRef("min"), ::llvm::StringRef("narrow_range"), ::llvm::StringRef("num_bits")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getMaxAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getMaxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getMinAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getMinAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getNarrowRangeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getNarrowRangeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getNumBitsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getNumBitsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.FakeQuantWithMinMaxArgsGradient"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getGradients(); + ::mlir::TypedValue<::mlir::TensorType> getInputs(); + ::mlir::OpOperand &getGradientsMutable(); + ::mlir::OpOperand &getInputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getBackprops(); + ::mlir::FloatAttr getMinAttr(); + ::llvm::APFloat getMin(); + ::mlir::FloatAttr getMaxAttr(); + ::llvm::APFloat getMax(); + ::mlir::IntegerAttr getNumBitsAttr(); + uint64_t getNumBits(); + ::mlir::BoolAttr getNarrowRangeAttr(); + bool getNarrowRange(); + void setMinAttr(::mlir::FloatAttr attr); + void setMin(::std::optional<::llvm::APFloat> attrValue); + void setMaxAttr(::mlir::FloatAttr attr); + void setMax(::std::optional<::llvm::APFloat> attrValue); + void setNumBitsAttr(::mlir::IntegerAttr attr); + void setNumBits(::std::optional attrValue); + void setNarrowRangeAttr(::mlir::BoolAttr attr); + void setNarrowRange(::std::optional attrValue); + ::mlir::Attribute removeMinAttr(); + ::mlir::Attribute removeMaxAttr(); + ::mlir::Attribute removeNumBitsAttr(); + ::mlir::Attribute removeNarrowRangeAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type backprops, ::mlir::Value gradients, ::mlir::Value inputs, /*optional*/::mlir::FloatAttr min, /*optional*/::mlir::FloatAttr max, /*optional*/::mlir::IntegerAttr num_bits, /*optional*/::mlir::BoolAttr narrow_range); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value gradients, ::mlir::Value inputs, /*optional*/::mlir::FloatAttr min, /*optional*/::mlir::FloatAttr max, /*optional*/::mlir::IntegerAttr num_bits, /*optional*/::mlir::BoolAttr narrow_range); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value gradients, ::mlir::Value inputs, /*optional*/::mlir::FloatAttr min, /*optional*/::mlir::FloatAttr max, /*optional*/::mlir::IntegerAttr num_bits, /*optional*/::mlir::BoolAttr narrow_range); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type backprops, ::mlir::Value gradients, ::mlir::Value inputs, /*optional*/::llvm::APFloat min, /*optional*/::llvm::APFloat max, /*optional*/uint64_t num_bits = 8, /*optional*/bool narrow_range = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value gradients, ::mlir::Value inputs, /*optional*/::llvm::APFloat min, /*optional*/::llvm::APFloat max, /*optional*/uint64_t num_bits = 8, /*optional*/bool narrow_range = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value gradients, ::mlir::Value inputs, /*optional*/::llvm::APFloat min, /*optional*/::llvm::APFloat max, /*optional*/uint64_t num_bits = 8, /*optional*/bool narrow_range = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::FakeQuantWithMinMaxArgsGradientOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::FakeQuantWithMinMaxArgsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FakeQuantWithMinMaxArgsOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FakeQuantWithMinMaxArgsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FakeQuantWithMinMaxArgsOpGenericAdaptorBase(FakeQuantWithMinMaxArgsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::FloatAttr getMinAttr(); + ::llvm::APFloat getMin(); + ::mlir::FloatAttr getMaxAttr(); + ::llvm::APFloat getMax(); + ::mlir::IntegerAttr getNumBitsAttr(); + uint64_t getNumBits(); + ::mlir::BoolAttr getNarrowRangeAttr(); + bool getNarrowRange(); +}; +} // namespace detail +template +class FakeQuantWithMinMaxArgsOpGenericAdaptor : public detail::FakeQuantWithMinMaxArgsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FakeQuantWithMinMaxArgsOpGenericAdaptorBase; +public: + FakeQuantWithMinMaxArgsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FakeQuantWithMinMaxArgsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FakeQuantWithMinMaxArgsOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FakeQuantWithMinMaxArgsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputs() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FakeQuantWithMinMaxArgsOpAdaptor : public FakeQuantWithMinMaxArgsOpGenericAdaptor<::mlir::ValueRange> { +public: + using FakeQuantWithMinMaxArgsOpGenericAdaptor::FakeQuantWithMinMaxArgsOpGenericAdaptor; + FakeQuantWithMinMaxArgsOpAdaptor(FakeQuantWithMinMaxArgsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FakeQuantWithMinMaxArgsOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef> { +public: + using Op::Op; + using Op::print; + using Adaptor = FakeQuantWithMinMaxArgsOpAdaptor; + template + using GenericAdaptor = FakeQuantWithMinMaxArgsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("max"), ::llvm::StringRef("min"), ::llvm::StringRef("narrow_range"), ::llvm::StringRef("num_bits")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getMaxAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getMaxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getMinAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getMinAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getNarrowRangeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getNarrowRangeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getNumBitsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getNumBitsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.FakeQuantWithMinMaxArgs"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputs(); + ::mlir::OpOperand &getInputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutputs(); + ::mlir::FloatAttr getMinAttr(); + ::llvm::APFloat getMin(); + ::mlir::FloatAttr getMaxAttr(); + ::llvm::APFloat getMax(); + ::mlir::IntegerAttr getNumBitsAttr(); + uint64_t getNumBits(); + ::mlir::BoolAttr getNarrowRangeAttr(); + bool getNarrowRange(); + void setMinAttr(::mlir::FloatAttr attr); + void setMin(::std::optional<::llvm::APFloat> attrValue); + void setMaxAttr(::mlir::FloatAttr attr); + void setMax(::std::optional<::llvm::APFloat> attrValue); + void setNumBitsAttr(::mlir::IntegerAttr attr); + void setNumBits(::std::optional attrValue); + void setNarrowRangeAttr(::mlir::BoolAttr attr); + void setNarrowRange(::std::optional attrValue); + ::mlir::Attribute removeMinAttr(); + ::mlir::Attribute removeMaxAttr(); + ::mlir::Attribute removeNumBitsAttr(); + ::mlir::Attribute removeNarrowRangeAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type outputs, ::mlir::Value inputs, /*optional*/::mlir::FloatAttr min, /*optional*/::mlir::FloatAttr max, /*optional*/::mlir::IntegerAttr num_bits, /*optional*/::mlir::BoolAttr narrow_range); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value inputs, /*optional*/::mlir::FloatAttr min, /*optional*/::mlir::FloatAttr max, /*optional*/::mlir::IntegerAttr num_bits, /*optional*/::mlir::BoolAttr narrow_range); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inputs, /*optional*/::mlir::FloatAttr min, /*optional*/::mlir::FloatAttr max, /*optional*/::mlir::IntegerAttr num_bits, /*optional*/::mlir::BoolAttr narrow_range); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type outputs, ::mlir::Value inputs, /*optional*/::llvm::APFloat min, /*optional*/::llvm::APFloat max, /*optional*/uint64_t num_bits = 8, /*optional*/bool narrow_range = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value inputs, /*optional*/::llvm::APFloat min, /*optional*/::llvm::APFloat max, /*optional*/uint64_t num_bits = 8, /*optional*/bool narrow_range = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inputs, /*optional*/::llvm::APFloat min, /*optional*/::llvm::APFloat max, /*optional*/uint64_t num_bits = 8, /*optional*/bool narrow_range = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::FakeQuantWithMinMaxArgsOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::FakeQuantWithMinMaxVarsGradientOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FakeQuantWithMinMaxVarsGradientOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FakeQuantWithMinMaxVarsGradientOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FakeQuantWithMinMaxVarsGradientOpGenericAdaptorBase(FakeQuantWithMinMaxVarsGradientOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getNumBitsAttr(); + uint64_t getNumBits(); + ::mlir::BoolAttr getNarrowRangeAttr(); + bool getNarrowRange(); +}; +} // namespace detail +template +class FakeQuantWithMinMaxVarsGradientOpGenericAdaptor : public detail::FakeQuantWithMinMaxVarsGradientOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FakeQuantWithMinMaxVarsGradientOpGenericAdaptorBase; +public: + FakeQuantWithMinMaxVarsGradientOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FakeQuantWithMinMaxVarsGradientOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FakeQuantWithMinMaxVarsGradientOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FakeQuantWithMinMaxVarsGradientOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getGradients() { + return (*getODSOperands(0).begin()); + } + + ValueT getInputs() { + return (*getODSOperands(1).begin()); + } + + ValueT getMin() { + return (*getODSOperands(2).begin()); + } + + ValueT getMax() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FakeQuantWithMinMaxVarsGradientOpAdaptor : public FakeQuantWithMinMaxVarsGradientOpGenericAdaptor<::mlir::ValueRange> { +public: + using FakeQuantWithMinMaxVarsGradientOpGenericAdaptor::FakeQuantWithMinMaxVarsGradientOpGenericAdaptor; + FakeQuantWithMinMaxVarsGradientOpAdaptor(FakeQuantWithMinMaxVarsGradientOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FakeQuantWithMinMaxVarsGradientOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FakeQuantWithMinMaxVarsGradientOpAdaptor; + template + using GenericAdaptor = FakeQuantWithMinMaxVarsGradientOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("narrow_range"), ::llvm::StringRef("num_bits")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNarrowRangeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNarrowRangeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumBitsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumBitsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.FakeQuantWithMinMaxVarsGradient"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getGradients(); + ::mlir::TypedValue<::mlir::TensorType> getInputs(); + ::mlir::TypedValue<::mlir::TensorType> getMin(); + ::mlir::TypedValue<::mlir::TensorType> getMax(); + ::mlir::OpOperand &getGradientsMutable(); + ::mlir::OpOperand &getInputsMutable(); + ::mlir::OpOperand &getMinMutable(); + ::mlir::OpOperand &getMaxMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getBackpropsWrtInput(); + ::mlir::TypedValue<::mlir::TensorType> getBackpropWrtMin(); + ::mlir::TypedValue<::mlir::TensorType> getBackpropWrtMax(); + ::mlir::IntegerAttr getNumBitsAttr(); + uint64_t getNumBits(); + ::mlir::BoolAttr getNarrowRangeAttr(); + bool getNarrowRange(); + void setNumBitsAttr(::mlir::IntegerAttr attr); + void setNumBits(::std::optional attrValue); + void setNarrowRangeAttr(::mlir::BoolAttr attr); + void setNarrowRange(::std::optional attrValue); + ::mlir::Attribute removeNumBitsAttr(); + ::mlir::Attribute removeNarrowRangeAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type backprops_wrt_input, ::mlir::Type backprop_wrt_min, ::mlir::Type backprop_wrt_max, ::mlir::Value gradients, ::mlir::Value inputs, ::mlir::Value min, ::mlir::Value max, /*optional*/::mlir::IntegerAttr num_bits, /*optional*/::mlir::BoolAttr narrow_range); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value gradients, ::mlir::Value inputs, ::mlir::Value min, ::mlir::Value max, /*optional*/::mlir::IntegerAttr num_bits, /*optional*/::mlir::BoolAttr narrow_range); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type backprops_wrt_input, ::mlir::Type backprop_wrt_min, ::mlir::Type backprop_wrt_max, ::mlir::Value gradients, ::mlir::Value inputs, ::mlir::Value min, ::mlir::Value max, /*optional*/uint64_t num_bits = 8, /*optional*/bool narrow_range = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value gradients, ::mlir::Value inputs, ::mlir::Value min, ::mlir::Value max, /*optional*/uint64_t num_bits = 8, /*optional*/bool narrow_range = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::FakeQuantWithMinMaxVarsGradientOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::FakeQuantWithMinMaxVarsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FakeQuantWithMinMaxVarsOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FakeQuantWithMinMaxVarsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FakeQuantWithMinMaxVarsOpGenericAdaptorBase(FakeQuantWithMinMaxVarsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getNumBitsAttr(); + uint64_t getNumBits(); + ::mlir::BoolAttr getNarrowRangeAttr(); + bool getNarrowRange(); +}; +} // namespace detail +template +class FakeQuantWithMinMaxVarsOpGenericAdaptor : public detail::FakeQuantWithMinMaxVarsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FakeQuantWithMinMaxVarsOpGenericAdaptorBase; +public: + FakeQuantWithMinMaxVarsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FakeQuantWithMinMaxVarsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FakeQuantWithMinMaxVarsOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FakeQuantWithMinMaxVarsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputs() { + return (*getODSOperands(0).begin()); + } + + ValueT getMin() { + return (*getODSOperands(1).begin()); + } + + ValueT getMax() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FakeQuantWithMinMaxVarsOpAdaptor : public FakeQuantWithMinMaxVarsOpGenericAdaptor<::mlir::ValueRange> { +public: + using FakeQuantWithMinMaxVarsOpGenericAdaptor::FakeQuantWithMinMaxVarsOpGenericAdaptor; + FakeQuantWithMinMaxVarsOpAdaptor(FakeQuantWithMinMaxVarsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FakeQuantWithMinMaxVarsOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FakeQuantWithMinMaxVarsOpAdaptor; + template + using GenericAdaptor = FakeQuantWithMinMaxVarsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("narrow_range"), ::llvm::StringRef("num_bits")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNarrowRangeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNarrowRangeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumBitsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumBitsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.FakeQuantWithMinMaxVars"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputs(); + ::mlir::TypedValue<::mlir::TensorType> getMin(); + ::mlir::TypedValue<::mlir::TensorType> getMax(); + ::mlir::OpOperand &getInputsMutable(); + ::mlir::OpOperand &getMinMutable(); + ::mlir::OpOperand &getMaxMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutputs(); + ::mlir::IntegerAttr getNumBitsAttr(); + uint64_t getNumBits(); + ::mlir::BoolAttr getNarrowRangeAttr(); + bool getNarrowRange(); + void setNumBitsAttr(::mlir::IntegerAttr attr); + void setNumBits(::std::optional attrValue); + void setNarrowRangeAttr(::mlir::BoolAttr attr); + void setNarrowRange(::std::optional attrValue); + ::mlir::Attribute removeNumBitsAttr(); + ::mlir::Attribute removeNarrowRangeAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type outputs, ::mlir::Value inputs, ::mlir::Value min, ::mlir::Value max, /*optional*/::mlir::IntegerAttr num_bits, /*optional*/::mlir::BoolAttr narrow_range); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inputs, ::mlir::Value min, ::mlir::Value max, /*optional*/::mlir::IntegerAttr num_bits, /*optional*/::mlir::BoolAttr narrow_range); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type outputs, ::mlir::Value inputs, ::mlir::Value min, ::mlir::Value max, /*optional*/uint64_t num_bits = 8, /*optional*/bool narrow_range = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inputs, ::mlir::Value min, ::mlir::Value max, /*optional*/uint64_t num_bits = 8, /*optional*/bool narrow_range = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::FakeQuantWithMinMaxVarsOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::FakeQuantWithMinMaxVarsPerChannelGradientOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FakeQuantWithMinMaxVarsPerChannelGradientOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FakeQuantWithMinMaxVarsPerChannelGradientOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FakeQuantWithMinMaxVarsPerChannelGradientOpGenericAdaptorBase(FakeQuantWithMinMaxVarsPerChannelGradientOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getNumBitsAttr(); + uint64_t getNumBits(); + ::mlir::BoolAttr getNarrowRangeAttr(); + bool getNarrowRange(); +}; +} // namespace detail +template +class FakeQuantWithMinMaxVarsPerChannelGradientOpGenericAdaptor : public detail::FakeQuantWithMinMaxVarsPerChannelGradientOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FakeQuantWithMinMaxVarsPerChannelGradientOpGenericAdaptorBase; +public: + FakeQuantWithMinMaxVarsPerChannelGradientOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FakeQuantWithMinMaxVarsPerChannelGradientOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FakeQuantWithMinMaxVarsPerChannelGradientOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FakeQuantWithMinMaxVarsPerChannelGradientOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getGradients() { + return (*getODSOperands(0).begin()); + } + + ValueT getInputs() { + return (*getODSOperands(1).begin()); + } + + ValueT getMin() { + return (*getODSOperands(2).begin()); + } + + ValueT getMax() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FakeQuantWithMinMaxVarsPerChannelGradientOpAdaptor : public FakeQuantWithMinMaxVarsPerChannelGradientOpGenericAdaptor<::mlir::ValueRange> { +public: + using FakeQuantWithMinMaxVarsPerChannelGradientOpGenericAdaptor::FakeQuantWithMinMaxVarsPerChannelGradientOpGenericAdaptor; + FakeQuantWithMinMaxVarsPerChannelGradientOpAdaptor(FakeQuantWithMinMaxVarsPerChannelGradientOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FakeQuantWithMinMaxVarsPerChannelGradientOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FakeQuantWithMinMaxVarsPerChannelGradientOpAdaptor; + template + using GenericAdaptor = FakeQuantWithMinMaxVarsPerChannelGradientOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("narrow_range"), ::llvm::StringRef("num_bits")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNarrowRangeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNarrowRangeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumBitsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumBitsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.FakeQuantWithMinMaxVarsPerChannelGradient"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getGradients(); + ::mlir::TypedValue<::mlir::TensorType> getInputs(); + ::mlir::TypedValue<::mlir::TensorType> getMin(); + ::mlir::TypedValue<::mlir::TensorType> getMax(); + ::mlir::OpOperand &getGradientsMutable(); + ::mlir::OpOperand &getInputsMutable(); + ::mlir::OpOperand &getMinMutable(); + ::mlir::OpOperand &getMaxMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getBackpropsWrtInput(); + ::mlir::TypedValue<::mlir::TensorType> getBackpropWrtMin(); + ::mlir::TypedValue<::mlir::TensorType> getBackpropWrtMax(); + ::mlir::IntegerAttr getNumBitsAttr(); + uint64_t getNumBits(); + ::mlir::BoolAttr getNarrowRangeAttr(); + bool getNarrowRange(); + void setNumBitsAttr(::mlir::IntegerAttr attr); + void setNumBits(::std::optional attrValue); + void setNarrowRangeAttr(::mlir::BoolAttr attr); + void setNarrowRange(::std::optional attrValue); + ::mlir::Attribute removeNumBitsAttr(); + ::mlir::Attribute removeNarrowRangeAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type backprops_wrt_input, ::mlir::Type backprop_wrt_min, ::mlir::Type backprop_wrt_max, ::mlir::Value gradients, ::mlir::Value inputs, ::mlir::Value min, ::mlir::Value max, /*optional*/::mlir::IntegerAttr num_bits, /*optional*/::mlir::BoolAttr narrow_range); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value gradients, ::mlir::Value inputs, ::mlir::Value min, ::mlir::Value max, /*optional*/::mlir::IntegerAttr num_bits, /*optional*/::mlir::BoolAttr narrow_range); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type backprops_wrt_input, ::mlir::Type backprop_wrt_min, ::mlir::Type backprop_wrt_max, ::mlir::Value gradients, ::mlir::Value inputs, ::mlir::Value min, ::mlir::Value max, /*optional*/uint64_t num_bits = 8, /*optional*/bool narrow_range = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value gradients, ::mlir::Value inputs, ::mlir::Value min, ::mlir::Value max, /*optional*/uint64_t num_bits = 8, /*optional*/bool narrow_range = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::FakeQuantWithMinMaxVarsPerChannelGradientOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::FakeQuantWithMinMaxVarsPerChannelOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FakeQuantWithMinMaxVarsPerChannelOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FakeQuantWithMinMaxVarsPerChannelOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FakeQuantWithMinMaxVarsPerChannelOpGenericAdaptorBase(FakeQuantWithMinMaxVarsPerChannelOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getNumBitsAttr(); + uint64_t getNumBits(); + ::mlir::BoolAttr getNarrowRangeAttr(); + bool getNarrowRange(); +}; +} // namespace detail +template +class FakeQuantWithMinMaxVarsPerChannelOpGenericAdaptor : public detail::FakeQuantWithMinMaxVarsPerChannelOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FakeQuantWithMinMaxVarsPerChannelOpGenericAdaptorBase; +public: + FakeQuantWithMinMaxVarsPerChannelOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FakeQuantWithMinMaxVarsPerChannelOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FakeQuantWithMinMaxVarsPerChannelOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FakeQuantWithMinMaxVarsPerChannelOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputs() { + return (*getODSOperands(0).begin()); + } + + ValueT getMin() { + return (*getODSOperands(1).begin()); + } + + ValueT getMax() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FakeQuantWithMinMaxVarsPerChannelOpAdaptor : public FakeQuantWithMinMaxVarsPerChannelOpGenericAdaptor<::mlir::ValueRange> { +public: + using FakeQuantWithMinMaxVarsPerChannelOpGenericAdaptor::FakeQuantWithMinMaxVarsPerChannelOpGenericAdaptor; + FakeQuantWithMinMaxVarsPerChannelOpAdaptor(FakeQuantWithMinMaxVarsPerChannelOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FakeQuantWithMinMaxVarsPerChannelOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FakeQuantWithMinMaxVarsPerChannelOpAdaptor; + template + using GenericAdaptor = FakeQuantWithMinMaxVarsPerChannelOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("narrow_range"), ::llvm::StringRef("num_bits")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNarrowRangeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNarrowRangeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumBitsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumBitsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.FakeQuantWithMinMaxVarsPerChannel"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputs(); + ::mlir::TypedValue<::mlir::TensorType> getMin(); + ::mlir::TypedValue<::mlir::TensorType> getMax(); + ::mlir::OpOperand &getInputsMutable(); + ::mlir::OpOperand &getMinMutable(); + ::mlir::OpOperand &getMaxMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutputs(); + ::mlir::IntegerAttr getNumBitsAttr(); + uint64_t getNumBits(); + ::mlir::BoolAttr getNarrowRangeAttr(); + bool getNarrowRange(); + void setNumBitsAttr(::mlir::IntegerAttr attr); + void setNumBits(::std::optional attrValue); + void setNarrowRangeAttr(::mlir::BoolAttr attr); + void setNarrowRange(::std::optional attrValue); + ::mlir::Attribute removeNumBitsAttr(); + ::mlir::Attribute removeNarrowRangeAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type outputs, ::mlir::Value inputs, ::mlir::Value min, ::mlir::Value max, /*optional*/::mlir::IntegerAttr num_bits, /*optional*/::mlir::BoolAttr narrow_range); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inputs, ::mlir::Value min, ::mlir::Value max, /*optional*/::mlir::IntegerAttr num_bits, /*optional*/::mlir::BoolAttr narrow_range); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type outputs, ::mlir::Value inputs, ::mlir::Value min, ::mlir::Value max, /*optional*/uint64_t num_bits = 8, /*optional*/bool narrow_range = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inputs, ::mlir::Value min, ::mlir::Value max, /*optional*/uint64_t num_bits = 8, /*optional*/bool narrow_range = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::FakeQuantWithMinMaxVarsPerChannelOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::FillOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FillOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FillOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FillOpGenericAdaptorBase(FillOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class FillOpGenericAdaptor : public detail::FillOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FillOpGenericAdaptorBase; +public: + FillOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FillOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FillOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FillOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getDims() { + return (*getODSOperands(0).begin()); + } + + ValueT getValue() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FillOpAdaptor : public FillOpGenericAdaptor<::mlir::ValueRange> { +public: + using FillOpGenericAdaptor::FillOpGenericAdaptor; + FillOpAdaptor(FillOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FillOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FillOpAdaptor; + template + using GenericAdaptor = FillOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("index_type")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getIndexTypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getIndexTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Fill"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getDims(); + ::mlir::TypedValue<::mlir::TensorType> getValue(); + ::mlir::OpOperand &getDimsMutable(); + ::mlir::OpOperand &getValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getIndexType(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value dims, Value value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value dims, ::mlir::Value value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value dims, ::mlir::Value value); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::FillOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::FinalizeDatasetOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FinalizeDatasetOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FinalizeDatasetOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FinalizeDatasetOpGenericAdaptorBase(FinalizeDatasetOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getHasCapturedRefAttr(); + bool getHasCapturedRef(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); +}; +} // namespace detail +template +class FinalizeDatasetOpGenericAdaptor : public detail::FinalizeDatasetOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FinalizeDatasetOpGenericAdaptorBase; +public: + FinalizeDatasetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FinalizeDatasetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FinalizeDatasetOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FinalizeDatasetOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputDataset() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FinalizeDatasetOpAdaptor : public FinalizeDatasetOpGenericAdaptor<::mlir::ValueRange> { +public: + using FinalizeDatasetOpGenericAdaptor::FinalizeDatasetOpGenericAdaptor; + FinalizeDatasetOpAdaptor(FinalizeDatasetOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FinalizeDatasetOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FinalizeDatasetOpAdaptor; + template + using GenericAdaptor = FinalizeDatasetOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("has_captured_ref"), ::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getHasCapturedRefAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getHasCapturedRefAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.FinalizeDataset"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputDataset(); + ::mlir::OpOperand &getInputDatasetMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::BoolAttr getHasCapturedRefAttr(); + bool getHasCapturedRef(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + void setHasCapturedRefAttr(::mlir::BoolAttr attr); + void setHasCapturedRef(::std::optional attrValue); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeHasCapturedRefAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, /*optional*/::mlir::BoolAttr has_captured_ref, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, /*optional*/::mlir::BoolAttr has_captured_ref, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, /*optional*/bool has_captured_ref, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, /*optional*/bool has_captured_ref, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::FinalizeDatasetOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::FinalizeTPUEmbeddingOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FinalizeTPUEmbeddingOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FinalizeTPUEmbeddingOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FinalizeTPUEmbeddingOpGenericAdaptorBase(FinalizeTPUEmbeddingOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class FinalizeTPUEmbeddingOpGenericAdaptor : public detail::FinalizeTPUEmbeddingOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FinalizeTPUEmbeddingOpGenericAdaptorBase; +public: + FinalizeTPUEmbeddingOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FinalizeTPUEmbeddingOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FinalizeTPUEmbeddingOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FinalizeTPUEmbeddingOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getCommonConfig() { + return (*getODSOperands(0).begin()); + } + + ValueT getMemoryConfig() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FinalizeTPUEmbeddingOpAdaptor : public FinalizeTPUEmbeddingOpGenericAdaptor<::mlir::ValueRange> { +public: + using FinalizeTPUEmbeddingOpGenericAdaptor::FinalizeTPUEmbeddingOpGenericAdaptor; + FinalizeTPUEmbeddingOpAdaptor(FinalizeTPUEmbeddingOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FinalizeTPUEmbeddingOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = FinalizeTPUEmbeddingOpAdaptor; + template + using GenericAdaptor = FinalizeTPUEmbeddingOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.FinalizeTPUEmbedding"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getCommonConfig(); + ::mlir::TypedValue<::mlir::TensorType> getMemoryConfig(); + ::mlir::OpOperand &getCommonConfigMutable(); + ::mlir::OpOperand &getMemoryConfigMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value common_config, ::mlir::Value memory_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value common_config, ::mlir::Value memory_config); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::FinalizeTPUEmbeddingOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::FlatMapDatasetOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FlatMapDatasetOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FlatMapDatasetOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FlatMapDatasetOpGenericAdaptorBase(FlatMapDatasetOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::SymbolRefAttr getFAttr(); + ::mlir::SymbolRefAttr getF(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); +}; +} // namespace detail +template +class FlatMapDatasetOpGenericAdaptor : public detail::FlatMapDatasetOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FlatMapDatasetOpGenericAdaptorBase; +public: + FlatMapDatasetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FlatMapDatasetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FlatMapDatasetOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FlatMapDatasetOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputDataset() { + return (*getODSOperands(0).begin()); + } + + RangeT getOtherArguments() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FlatMapDatasetOpAdaptor : public FlatMapDatasetOpGenericAdaptor<::mlir::ValueRange> { +public: + using FlatMapDatasetOpGenericAdaptor::FlatMapDatasetOpGenericAdaptor; + FlatMapDatasetOpAdaptor(FlatMapDatasetOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FlatMapDatasetOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FlatMapDatasetOpAdaptor; + template + using GenericAdaptor = FlatMapDatasetOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Targuments"), ::llvm::StringRef("f"), ::llvm::StringRef("metadata"), ::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTargumentsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTargumentsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getFAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getFAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getMetadataAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getMetadataAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.FlatMapDataset"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputDataset(); + ::mlir::Operation::operand_range getOtherArguments(); + ::mlir::OpOperand &getInputDatasetMutable(); + ::mlir::MutableOperandRange getOtherArgumentsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::SymbolRefAttr getFAttr(); + ::mlir::SymbolRefAttr getF(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); + mlir::OperandElementTypeRange getTarguments(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setFAttr(::mlir::SymbolRefAttr attr); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + void setMetadataAttr(::mlir::StringAttr attr); + void setMetadata(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeMetadataAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, ::mlir::ValueRange other_arguments, ::mlir::SymbolRefAttr f, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, ::mlir::ValueRange other_arguments, ::mlir::SymbolRefAttr f, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, ::mlir::ValueRange other_arguments, ::mlir::SymbolRefAttr f, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::llvm::StringRef metadata = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, ::mlir::ValueRange other_arguments, ::mlir::SymbolRefAttr f, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::llvm::StringRef metadata = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::FlatMapDatasetOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::FloorDivOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FloorDivOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FloorDivOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FloorDivOpGenericAdaptorBase(FloorDivOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class FloorDivOpGenericAdaptor : public detail::FloorDivOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FloorDivOpGenericAdaptorBase; +public: + FloorDivOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FloorDivOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FloorDivOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FloorDivOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FloorDivOpAdaptor : public FloorDivOpGenericAdaptor<::mlir::ValueRange> { +public: + using FloorDivOpGenericAdaptor::FloorDivOpGenericAdaptor; + FloorDivOpAdaptor(FloorDivOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FloorDivOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FloorDivOpAdaptor; + template + using GenericAdaptor = FloorDivOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.FloorDiv"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::FloorDivOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::FloorModOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FloorModOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FloorModOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FloorModOpGenericAdaptorBase(FloorModOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class FloorModOpGenericAdaptor : public detail::FloorModOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FloorModOpGenericAdaptorBase; +public: + FloorModOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FloorModOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FloorModOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FloorModOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FloorModOpAdaptor : public FloorModOpGenericAdaptor<::mlir::ValueRange> { +public: + using FloorModOpGenericAdaptor::FloorModOpGenericAdaptor; + FloorModOpAdaptor(FloorModOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FloorModOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::OpTrait::TF::SameOperandsAndResultElementTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FloorModOpAdaptor; + template + using GenericAdaptor = FloorModOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.FloorMod"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::FloorModOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::FloorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FloorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FloorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FloorOpGenericAdaptorBase(FloorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class FloorOpGenericAdaptor : public detail::FloorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FloorOpGenericAdaptorBase; +public: + FloorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FloorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FloorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FloorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FloorOpAdaptor : public FloorOpGenericAdaptor<::mlir::ValueRange> { +public: + using FloorOpGenericAdaptor::FloorOpGenericAdaptor; + FloorOpAdaptor(FloorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FloorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::IsIdempotent, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FloorOpAdaptor; + template + using GenericAdaptor = FloorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Floor"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::FloorOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::FlushSummaryWriterOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FlushSummaryWriterOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FlushSummaryWriterOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FlushSummaryWriterOpGenericAdaptorBase(FlushSummaryWriterOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class FlushSummaryWriterOpGenericAdaptor : public detail::FlushSummaryWriterOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FlushSummaryWriterOpGenericAdaptorBase; +public: + FlushSummaryWriterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FlushSummaryWriterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FlushSummaryWriterOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FlushSummaryWriterOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getWriter() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FlushSummaryWriterOpAdaptor : public FlushSummaryWriterOpGenericAdaptor<::mlir::ValueRange> { +public: + using FlushSummaryWriterOpGenericAdaptor::FlushSummaryWriterOpGenericAdaptor; + FlushSummaryWriterOpAdaptor(FlushSummaryWriterOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FlushSummaryWriterOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = FlushSummaryWriterOpAdaptor; + template + using GenericAdaptor = FlushSummaryWriterOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.FlushSummaryWriter"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getWriter(); + ::mlir::OpOperand &getWriterMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value writer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value writer); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::FlushSummaryWriterOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::FusedBatchNormGradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FusedBatchNormGradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FusedBatchNormGradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FusedBatchNormGradOpGenericAdaptorBase(FusedBatchNormGradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::BoolAttr getIsTrainingAttr(); + bool getIsTraining(); +}; +} // namespace detail +template +class FusedBatchNormGradOpGenericAdaptor : public detail::FusedBatchNormGradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FusedBatchNormGradOpGenericAdaptorBase; +public: + FusedBatchNormGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FusedBatchNormGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FusedBatchNormGradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FusedBatchNormGradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getYBackprop() { + return (*getODSOperands(0).begin()); + } + + ValueT getX() { + return (*getODSOperands(1).begin()); + } + + ValueT getScale() { + return (*getODSOperands(2).begin()); + } + + ValueT getReserveSpace_1() { + return (*getODSOperands(3).begin()); + } + + ValueT getReserveSpace_2() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FusedBatchNormGradOpAdaptor : public FusedBatchNormGradOpGenericAdaptor<::mlir::ValueRange> { +public: + using FusedBatchNormGradOpGenericAdaptor::FusedBatchNormGradOpGenericAdaptor; + FusedBatchNormGradOpAdaptor(FusedBatchNormGradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FusedBatchNormGradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<5>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FusedBatchNormGradOpAdaptor; + template + using GenericAdaptor = FusedBatchNormGradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("data_format"), ::llvm::StringRef("epsilon"), ::llvm::StringRef("is_training")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getEpsilonAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getEpsilonAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getIsTrainingAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getIsTrainingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.FusedBatchNormGrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getYBackprop(); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getScale(); + ::mlir::TypedValue<::mlir::TensorType> getReserveSpace_1(); + ::mlir::TypedValue<::mlir::TensorType> getReserveSpace_2(); + ::mlir::OpOperand &getYBackpropMutable(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getScaleMutable(); + ::mlir::OpOperand &getReserveSpace_1Mutable(); + ::mlir::OpOperand &getReserveSpace_2Mutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getXBackprop(); + ::mlir::TypedValue<::mlir::TensorType> getScaleBackprop(); + ::mlir::TypedValue<::mlir::TensorType> getOffsetBackprop(); + ::mlir::TypedValue<::mlir::TensorType> getReserveSpace_3(); + ::mlir::TypedValue<::mlir::TensorType> getReserveSpace_4(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::BoolAttr getIsTrainingAttr(); + bool getIsTraining(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setEpsilonAttr(::mlir::FloatAttr attr); + void setEpsilon(::std::optional<::llvm::APFloat> attrValue); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + void setIsTrainingAttr(::mlir::BoolAttr attr); + void setIsTraining(::std::optional attrValue); + ::mlir::Attribute removeEpsilonAttr(); + ::mlir::Attribute removeDataFormatAttr(); + ::mlir::Attribute removeIsTrainingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type x_backprop, ::mlir::Type scale_backprop, ::mlir::Type offset_backprop, ::mlir::Type reserve_space_3, ::mlir::Type reserve_space_4, ::mlir::Value y_backprop, ::mlir::Value x, ::mlir::Value scale, ::mlir::Value reserve_space_1, ::mlir::Value reserve_space_2, /*optional*/::mlir::FloatAttr epsilon, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::BoolAttr is_training); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value y_backprop, ::mlir::Value x, ::mlir::Value scale, ::mlir::Value reserve_space_1, ::mlir::Value reserve_space_2, /*optional*/::mlir::FloatAttr epsilon, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::BoolAttr is_training); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type x_backprop, ::mlir::Type scale_backprop, ::mlir::Type offset_backprop, ::mlir::Type reserve_space_3, ::mlir::Type reserve_space_4, ::mlir::Value y_backprop, ::mlir::Value x, ::mlir::Value scale, ::mlir::Value reserve_space_1, ::mlir::Value reserve_space_2, /*optional*/::llvm::APFloat epsilon, /*optional*/::llvm::StringRef data_format = "NHWC", /*optional*/bool is_training = true); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value y_backprop, ::mlir::Value x, ::mlir::Value scale, ::mlir::Value reserve_space_1, ::mlir::Value reserve_space_2, /*optional*/::llvm::APFloat epsilon, /*optional*/::llvm::StringRef data_format = "NHWC", /*optional*/bool is_training = true); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::FusedBatchNormGradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::FusedBatchNormGradV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FusedBatchNormGradV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FusedBatchNormGradV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FusedBatchNormGradV2OpGenericAdaptorBase(FusedBatchNormGradV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::BoolAttr getIsTrainingAttr(); + bool getIsTraining(); +}; +} // namespace detail +template +class FusedBatchNormGradV2OpGenericAdaptor : public detail::FusedBatchNormGradV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FusedBatchNormGradV2OpGenericAdaptorBase; +public: + FusedBatchNormGradV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FusedBatchNormGradV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FusedBatchNormGradV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FusedBatchNormGradV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getYBackprop() { + return (*getODSOperands(0).begin()); + } + + ValueT getX() { + return (*getODSOperands(1).begin()); + } + + ValueT getScale() { + return (*getODSOperands(2).begin()); + } + + ValueT getReserveSpace_1() { + return (*getODSOperands(3).begin()); + } + + ValueT getReserveSpace_2() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FusedBatchNormGradV2OpAdaptor : public FusedBatchNormGradV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using FusedBatchNormGradV2OpGenericAdaptor::FusedBatchNormGradV2OpGenericAdaptor; + FusedBatchNormGradV2OpAdaptor(FusedBatchNormGradV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FusedBatchNormGradV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<5>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FusedBatchNormGradV2OpAdaptor; + template + using GenericAdaptor = FusedBatchNormGradV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("U"), ::llvm::StringRef("data_format"), ::llvm::StringRef("epsilon"), ::llvm::StringRef("is_training")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getUAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getUAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getEpsilonAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getEpsilonAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getIsTrainingAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getIsTrainingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.FusedBatchNormGradV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getYBackprop(); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getScale(); + ::mlir::TypedValue<::mlir::TensorType> getReserveSpace_1(); + ::mlir::TypedValue<::mlir::TensorType> getReserveSpace_2(); + ::mlir::OpOperand &getYBackpropMutable(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getScaleMutable(); + ::mlir::OpOperand &getReserveSpace_1Mutable(); + ::mlir::OpOperand &getReserveSpace_2Mutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getXBackprop(); + ::mlir::TypedValue<::mlir::TensorType> getScaleBackprop(); + ::mlir::TypedValue<::mlir::TensorType> getOffsetBackprop(); + ::mlir::TypedValue<::mlir::TensorType> getReserveSpace_3(); + ::mlir::TypedValue<::mlir::TensorType> getReserveSpace_4(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::BoolAttr getIsTrainingAttr(); + bool getIsTraining(); + ::mlir::Type getT(); + ::mlir::Type getU(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setEpsilonAttr(::mlir::FloatAttr attr); + void setEpsilon(::std::optional<::llvm::APFloat> attrValue); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + void setIsTrainingAttr(::mlir::BoolAttr attr); + void setIsTraining(::std::optional attrValue); + ::mlir::Attribute removeEpsilonAttr(); + ::mlir::Attribute removeDataFormatAttr(); + ::mlir::Attribute removeIsTrainingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type x_backprop, ::mlir::Type scale_backprop, ::mlir::Type offset_backprop, ::mlir::Type reserve_space_3, ::mlir::Type reserve_space_4, ::mlir::Value y_backprop, ::mlir::Value x, ::mlir::Value scale, ::mlir::Value reserve_space_1, ::mlir::Value reserve_space_2, /*optional*/::mlir::FloatAttr epsilon, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::BoolAttr is_training); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value y_backprop, ::mlir::Value x, ::mlir::Value scale, ::mlir::Value reserve_space_1, ::mlir::Value reserve_space_2, /*optional*/::mlir::FloatAttr epsilon, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::BoolAttr is_training); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type x_backprop, ::mlir::Type scale_backprop, ::mlir::Type offset_backprop, ::mlir::Type reserve_space_3, ::mlir::Type reserve_space_4, ::mlir::Value y_backprop, ::mlir::Value x, ::mlir::Value scale, ::mlir::Value reserve_space_1, ::mlir::Value reserve_space_2, /*optional*/::llvm::APFloat epsilon, /*optional*/::llvm::StringRef data_format = "NHWC", /*optional*/bool is_training = true); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value y_backprop, ::mlir::Value x, ::mlir::Value scale, ::mlir::Value reserve_space_1, ::mlir::Value reserve_space_2, /*optional*/::llvm::APFloat epsilon, /*optional*/::llvm::StringRef data_format = "NHWC", /*optional*/bool is_training = true); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::FusedBatchNormGradV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::FusedBatchNormGradV3Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FusedBatchNormGradV3OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FusedBatchNormGradV3OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FusedBatchNormGradV3OpGenericAdaptorBase(FusedBatchNormGradV3Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::BoolAttr getIsTrainingAttr(); + bool getIsTraining(); +}; +} // namespace detail +template +class FusedBatchNormGradV3OpGenericAdaptor : public detail::FusedBatchNormGradV3OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FusedBatchNormGradV3OpGenericAdaptorBase; +public: + FusedBatchNormGradV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FusedBatchNormGradV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FusedBatchNormGradV3OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FusedBatchNormGradV3OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getYBackprop() { + return (*getODSOperands(0).begin()); + } + + ValueT getX() { + return (*getODSOperands(1).begin()); + } + + ValueT getScale() { + return (*getODSOperands(2).begin()); + } + + ValueT getReserveSpace_1() { + return (*getODSOperands(3).begin()); + } + + ValueT getReserveSpace_2() { + return (*getODSOperands(4).begin()); + } + + ValueT getReserveSpace_3() { + return (*getODSOperands(5).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FusedBatchNormGradV3OpAdaptor : public FusedBatchNormGradV3OpGenericAdaptor<::mlir::ValueRange> { +public: + using FusedBatchNormGradV3OpGenericAdaptor::FusedBatchNormGradV3OpGenericAdaptor; + FusedBatchNormGradV3OpAdaptor(FusedBatchNormGradV3Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FusedBatchNormGradV3Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<6>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, LayoutSensitiveInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FusedBatchNormGradV3OpAdaptor; + template + using GenericAdaptor = FusedBatchNormGradV3OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("U"), ::llvm::StringRef("data_format"), ::llvm::StringRef("epsilon"), ::llvm::StringRef("is_training")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getUAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getUAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getEpsilonAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getEpsilonAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getIsTrainingAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getIsTrainingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.FusedBatchNormGradV3"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getYBackprop(); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getScale(); + ::mlir::TypedValue<::mlir::TensorType> getReserveSpace_1(); + ::mlir::TypedValue<::mlir::TensorType> getReserveSpace_2(); + ::mlir::TypedValue<::mlir::TensorType> getReserveSpace_3(); + ::mlir::OpOperand &getYBackpropMutable(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getScaleMutable(); + ::mlir::OpOperand &getReserveSpace_1Mutable(); + ::mlir::OpOperand &getReserveSpace_2Mutable(); + ::mlir::OpOperand &getReserveSpace_3Mutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getXBackprop(); + ::mlir::TypedValue<::mlir::TensorType> getScaleBackprop(); + ::mlir::TypedValue<::mlir::TensorType> getOffsetBackprop(); + ::mlir::TypedValue<::mlir::TensorType> getReserveSpace_4(); + ::mlir::TypedValue<::mlir::TensorType> getReserveSpace_5(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::BoolAttr getIsTrainingAttr(); + bool getIsTraining(); + ::mlir::Type getT(); + ::mlir::Type getU(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setEpsilonAttr(::mlir::FloatAttr attr); + void setEpsilon(::std::optional<::llvm::APFloat> attrValue); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + void setIsTrainingAttr(::mlir::BoolAttr attr); + void setIsTraining(::std::optional attrValue); + ::mlir::Attribute removeEpsilonAttr(); + ::mlir::Attribute removeDataFormatAttr(); + ::mlir::Attribute removeIsTrainingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type x_backprop, ::mlir::Type scale_backprop, ::mlir::Type offset_backprop, ::mlir::Type reserve_space_4, ::mlir::Type reserve_space_5, ::mlir::Value y_backprop, ::mlir::Value x, ::mlir::Value scale, ::mlir::Value reserve_space_1, ::mlir::Value reserve_space_2, ::mlir::Value reserve_space_3, /*optional*/::mlir::FloatAttr epsilon, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::BoolAttr is_training); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value y_backprop, ::mlir::Value x, ::mlir::Value scale, ::mlir::Value reserve_space_1, ::mlir::Value reserve_space_2, ::mlir::Value reserve_space_3, /*optional*/::mlir::FloatAttr epsilon, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::BoolAttr is_training); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type x_backprop, ::mlir::Type scale_backprop, ::mlir::Type offset_backprop, ::mlir::Type reserve_space_4, ::mlir::Type reserve_space_5, ::mlir::Value y_backprop, ::mlir::Value x, ::mlir::Value scale, ::mlir::Value reserve_space_1, ::mlir::Value reserve_space_2, ::mlir::Value reserve_space_3, /*optional*/::llvm::APFloat epsilon, /*optional*/::llvm::StringRef data_format = "NHWC", /*optional*/bool is_training = true); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value y_backprop, ::mlir::Value x, ::mlir::Value scale, ::mlir::Value reserve_space_1, ::mlir::Value reserve_space_2, ::mlir::Value reserve_space_3, /*optional*/::llvm::APFloat epsilon, /*optional*/::llvm::StringRef data_format = "NHWC", /*optional*/bool is_training = true); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // TF_LayoutSensitiveInterface: + SmallVector GetLayoutDependentArgs() { return {0, 1}; } + SmallVector GetLayoutDependentResults() { return {0}; } + StringRef GetOptimalLayout(const RuntimeDevices& devices); + LogicalResult UpdateDataFormat(StringRef data_format); +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::FusedBatchNormGradV3Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::FusedBatchNormOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FusedBatchNormOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FusedBatchNormOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FusedBatchNormOpGenericAdaptorBase(FusedBatchNormOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::FloatAttr getExponentialAvgFactorAttr(); + ::llvm::APFloat getExponentialAvgFactor(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::BoolAttr getIsTrainingAttr(); + bool getIsTraining(); +}; +} // namespace detail +template +class FusedBatchNormOpGenericAdaptor : public detail::FusedBatchNormOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FusedBatchNormOpGenericAdaptorBase; +public: + FusedBatchNormOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FusedBatchNormOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FusedBatchNormOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FusedBatchNormOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getScale() { + return (*getODSOperands(1).begin()); + } + + ValueT getOffset() { + return (*getODSOperands(2).begin()); + } + + ValueT getMean() { + return (*getODSOperands(3).begin()); + } + + ValueT getVariance() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FusedBatchNormOpAdaptor : public FusedBatchNormOpGenericAdaptor<::mlir::ValueRange> { +public: + using FusedBatchNormOpGenericAdaptor::FusedBatchNormOpGenericAdaptor; + FusedBatchNormOpAdaptor(FusedBatchNormOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FusedBatchNormOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<5>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FusedBatchNormOpAdaptor; + template + using GenericAdaptor = FusedBatchNormOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("data_format"), ::llvm::StringRef("epsilon"), ::llvm::StringRef("exponential_avg_factor"), ::llvm::StringRef("is_training")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getEpsilonAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getEpsilonAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getExponentialAvgFactorAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getExponentialAvgFactorAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getIsTrainingAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getIsTrainingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.FusedBatchNorm"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getScale(); + ::mlir::TypedValue<::mlir::TensorType> getOffset(); + ::mlir::TypedValue<::mlir::TensorType> getMean(); + ::mlir::TypedValue<::mlir::TensorType> getVariance(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getScaleMutable(); + ::mlir::OpOperand &getOffsetMutable(); + ::mlir::OpOperand &getMeanMutable(); + ::mlir::OpOperand &getVarianceMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::TypedValue<::mlir::TensorType> getBatchMean(); + ::mlir::TypedValue<::mlir::TensorType> getBatchVariance(); + ::mlir::TypedValue<::mlir::TensorType> getReserveSpace_1(); + ::mlir::TypedValue<::mlir::TensorType> getReserveSpace_2(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::FloatAttr getExponentialAvgFactorAttr(); + ::llvm::APFloat getExponentialAvgFactor(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::BoolAttr getIsTrainingAttr(); + bool getIsTraining(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setEpsilonAttr(::mlir::FloatAttr attr); + void setEpsilon(::std::optional<::llvm::APFloat> attrValue); + void setExponentialAvgFactorAttr(::mlir::FloatAttr attr); + void setExponentialAvgFactor(::std::optional<::llvm::APFloat> attrValue); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + void setIsTrainingAttr(::mlir::BoolAttr attr); + void setIsTraining(::std::optional attrValue); + ::mlir::Attribute removeEpsilonAttr(); + ::mlir::Attribute removeExponentialAvgFactorAttr(); + ::mlir::Attribute removeDataFormatAttr(); + ::mlir::Attribute removeIsTrainingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Type batch_mean, ::mlir::Type batch_variance, ::mlir::Type reserve_space_1, ::mlir::Type reserve_space_2, ::mlir::Value x, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value mean, ::mlir::Value variance, /*optional*/::mlir::FloatAttr epsilon, /*optional*/::mlir::FloatAttr exponential_avg_factor, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::BoolAttr is_training); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value mean, ::mlir::Value variance, /*optional*/::mlir::FloatAttr epsilon, /*optional*/::mlir::FloatAttr exponential_avg_factor, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::BoolAttr is_training); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Type batch_mean, ::mlir::Type batch_variance, ::mlir::Type reserve_space_1, ::mlir::Type reserve_space_2, ::mlir::Value x, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value mean, ::mlir::Value variance, /*optional*/::llvm::APFloat epsilon, /*optional*/::llvm::APFloat exponential_avg_factor, /*optional*/::llvm::StringRef data_format = "NHWC", /*optional*/bool is_training = true); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value mean, ::mlir::Value variance, /*optional*/::llvm::APFloat epsilon, /*optional*/::llvm::APFloat exponential_avg_factor, /*optional*/::llvm::StringRef data_format = "NHWC", /*optional*/bool is_training = true); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::FusedBatchNormOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::FusedBatchNormV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FusedBatchNormV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FusedBatchNormV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FusedBatchNormV2OpGenericAdaptorBase(FusedBatchNormV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::FloatAttr getExponentialAvgFactorAttr(); + ::llvm::APFloat getExponentialAvgFactor(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::BoolAttr getIsTrainingAttr(); + bool getIsTraining(); +}; +} // namespace detail +template +class FusedBatchNormV2OpGenericAdaptor : public detail::FusedBatchNormV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FusedBatchNormV2OpGenericAdaptorBase; +public: + FusedBatchNormV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FusedBatchNormV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FusedBatchNormV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FusedBatchNormV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getScale() { + return (*getODSOperands(1).begin()); + } + + ValueT getOffset() { + return (*getODSOperands(2).begin()); + } + + ValueT getMean() { + return (*getODSOperands(3).begin()); + } + + ValueT getVariance() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FusedBatchNormV2OpAdaptor : public FusedBatchNormV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using FusedBatchNormV2OpGenericAdaptor::FusedBatchNormV2OpGenericAdaptor; + FusedBatchNormV2OpAdaptor(FusedBatchNormV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FusedBatchNormV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<5>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, FoldOperandsTransposeInterface::Trait, LayoutSensitiveInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FusedBatchNormV2OpAdaptor; + template + using GenericAdaptor = FusedBatchNormV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("U"), ::llvm::StringRef("data_format"), ::llvm::StringRef("epsilon"), ::llvm::StringRef("exponential_avg_factor"), ::llvm::StringRef("is_training")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getUAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getUAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getEpsilonAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getEpsilonAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getExponentialAvgFactorAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getExponentialAvgFactorAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getIsTrainingAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getIsTrainingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.FusedBatchNormV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getScale(); + ::mlir::TypedValue<::mlir::TensorType> getOffset(); + ::mlir::TypedValue<::mlir::TensorType> getMean(); + ::mlir::TypedValue<::mlir::TensorType> getVariance(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getScaleMutable(); + ::mlir::OpOperand &getOffsetMutable(); + ::mlir::OpOperand &getMeanMutable(); + ::mlir::OpOperand &getVarianceMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::TypedValue<::mlir::TensorType> getBatchMean(); + ::mlir::TypedValue<::mlir::TensorType> getBatchVariance(); + ::mlir::TypedValue<::mlir::TensorType> getReserveSpace_1(); + ::mlir::TypedValue<::mlir::TensorType> getReserveSpace_2(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::FloatAttr getExponentialAvgFactorAttr(); + ::llvm::APFloat getExponentialAvgFactor(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::BoolAttr getIsTrainingAttr(); + bool getIsTraining(); + ::mlir::Type getT(); + ::mlir::Type getU(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setEpsilonAttr(::mlir::FloatAttr attr); + void setEpsilon(::std::optional<::llvm::APFloat> attrValue); + void setExponentialAvgFactorAttr(::mlir::FloatAttr attr); + void setExponentialAvgFactor(::std::optional<::llvm::APFloat> attrValue); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + void setIsTrainingAttr(::mlir::BoolAttr attr); + void setIsTraining(::std::optional attrValue); + ::mlir::Attribute removeEpsilonAttr(); + ::mlir::Attribute removeExponentialAvgFactorAttr(); + ::mlir::Attribute removeDataFormatAttr(); + ::mlir::Attribute removeIsTrainingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Type batch_mean, ::mlir::Type batch_variance, ::mlir::Type reserve_space_1, ::mlir::Type reserve_space_2, ::mlir::Value x, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value mean, ::mlir::Value variance, /*optional*/::mlir::FloatAttr epsilon, /*optional*/::mlir::FloatAttr exponential_avg_factor, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::BoolAttr is_training); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value mean, ::mlir::Value variance, /*optional*/::mlir::FloatAttr epsilon, /*optional*/::mlir::FloatAttr exponential_avg_factor, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::BoolAttr is_training); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Type batch_mean, ::mlir::Type batch_variance, ::mlir::Type reserve_space_1, ::mlir::Type reserve_space_2, ::mlir::Value x, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value mean, ::mlir::Value variance, /*optional*/::llvm::APFloat epsilon, /*optional*/::llvm::APFloat exponential_avg_factor, /*optional*/::llvm::StringRef data_format = "NHWC", /*optional*/bool is_training = true); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value mean, ::mlir::Value variance, /*optional*/::llvm::APFloat epsilon, /*optional*/::llvm::APFloat exponential_avg_factor, /*optional*/::llvm::StringRef data_format = "NHWC", /*optional*/bool is_training = true); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // TF_FoldOperandsTransposeInterface: + SmallVector GetLayoutDependentArgs() { return {0}; } + SmallVector GetLayoutDependentResults() { return {0}; } + LogicalResult FoldOperandsPermutation(ArrayRef permutation); + + // TF_LayoutSensitiveInterface: + StringRef GetOptimalLayout(const RuntimeDevices& devices); + LogicalResult UpdateDataFormat(StringRef data_format); +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::FusedBatchNormV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::FusedBatchNormV3Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FusedBatchNormV3OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FusedBatchNormV3OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FusedBatchNormV3OpGenericAdaptorBase(FusedBatchNormV3Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::FloatAttr getExponentialAvgFactorAttr(); + ::llvm::APFloat getExponentialAvgFactor(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::BoolAttr getIsTrainingAttr(); + bool getIsTraining(); +}; +} // namespace detail +template +class FusedBatchNormV3OpGenericAdaptor : public detail::FusedBatchNormV3OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FusedBatchNormV3OpGenericAdaptorBase; +public: + FusedBatchNormV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FusedBatchNormV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FusedBatchNormV3OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FusedBatchNormV3OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getScale() { + return (*getODSOperands(1).begin()); + } + + ValueT getOffset() { + return (*getODSOperands(2).begin()); + } + + ValueT getMean() { + return (*getODSOperands(3).begin()); + } + + ValueT getVariance() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FusedBatchNormV3OpAdaptor : public FusedBatchNormV3OpGenericAdaptor<::mlir::ValueRange> { +public: + using FusedBatchNormV3OpGenericAdaptor::FusedBatchNormV3OpGenericAdaptor; + FusedBatchNormV3OpAdaptor(FusedBatchNormV3Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FusedBatchNormV3Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<5>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, FoldOperandsTransposeInterface::Trait, LayoutSensitiveInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FusedBatchNormV3OpAdaptor; + template + using GenericAdaptor = FusedBatchNormV3OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("U"), ::llvm::StringRef("data_format"), ::llvm::StringRef("epsilon"), ::llvm::StringRef("exponential_avg_factor"), ::llvm::StringRef("is_training")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getUAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getUAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getEpsilonAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getEpsilonAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getExponentialAvgFactorAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getExponentialAvgFactorAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getIsTrainingAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getIsTrainingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.FusedBatchNormV3"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getScale(); + ::mlir::TypedValue<::mlir::TensorType> getOffset(); + ::mlir::TypedValue<::mlir::TensorType> getMean(); + ::mlir::TypedValue<::mlir::TensorType> getVariance(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getScaleMutable(); + ::mlir::OpOperand &getOffsetMutable(); + ::mlir::OpOperand &getMeanMutable(); + ::mlir::OpOperand &getVarianceMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::TypedValue<::mlir::TensorType> getBatchMean(); + ::mlir::TypedValue<::mlir::TensorType> getBatchVariance(); + ::mlir::TypedValue<::mlir::TensorType> getReserveSpace_1(); + ::mlir::TypedValue<::mlir::TensorType> getReserveSpace_2(); + ::mlir::TypedValue<::mlir::TensorType> getReserveSpace_3(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::FloatAttr getExponentialAvgFactorAttr(); + ::llvm::APFloat getExponentialAvgFactor(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::BoolAttr getIsTrainingAttr(); + bool getIsTraining(); + ::mlir::Type getT(); + ::mlir::Type getU(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setEpsilonAttr(::mlir::FloatAttr attr); + void setEpsilon(::std::optional<::llvm::APFloat> attrValue); + void setExponentialAvgFactorAttr(::mlir::FloatAttr attr); + void setExponentialAvgFactor(::std::optional<::llvm::APFloat> attrValue); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + void setIsTrainingAttr(::mlir::BoolAttr attr); + void setIsTraining(::std::optional attrValue); + ::mlir::Attribute removeEpsilonAttr(); + ::mlir::Attribute removeExponentialAvgFactorAttr(); + ::mlir::Attribute removeDataFormatAttr(); + ::mlir::Attribute removeIsTrainingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Type batch_mean, ::mlir::Type batch_variance, ::mlir::Type reserve_space_1, ::mlir::Type reserve_space_2, ::mlir::Type reserve_space_3, ::mlir::Value x, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value mean, ::mlir::Value variance, /*optional*/::mlir::FloatAttr epsilon, /*optional*/::mlir::FloatAttr exponential_avg_factor, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::BoolAttr is_training); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value mean, ::mlir::Value variance, /*optional*/::mlir::FloatAttr epsilon, /*optional*/::mlir::FloatAttr exponential_avg_factor, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::BoolAttr is_training); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Type batch_mean, ::mlir::Type batch_variance, ::mlir::Type reserve_space_1, ::mlir::Type reserve_space_2, ::mlir::Type reserve_space_3, ::mlir::Value x, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value mean, ::mlir::Value variance, /*optional*/::llvm::APFloat epsilon, /*optional*/::llvm::APFloat exponential_avg_factor, /*optional*/::llvm::StringRef data_format = "NHWC", /*optional*/bool is_training = true); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value mean, ::mlir::Value variance, /*optional*/::llvm::APFloat epsilon, /*optional*/::llvm::APFloat exponential_avg_factor, /*optional*/::llvm::StringRef data_format = "NHWC", /*optional*/bool is_training = true); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // TF_FoldOperandsTransposeInterface: + SmallVector GetLayoutDependentArgs() { return {0}; } + SmallVector GetLayoutDependentResults() { return {0}; } + LogicalResult FoldOperandsPermutation(ArrayRef permutation); + + // TF_LayoutSensitiveInterface: + StringRef GetOptimalLayout(const RuntimeDevices& devices); + LogicalResult UpdateDataFormat(StringRef data_format); +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::FusedBatchNormV3Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::GatherNdOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GatherNdOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + GatherNdOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + GatherNdOpGenericAdaptorBase(GatherNdOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class GatherNdOpGenericAdaptor : public detail::GatherNdOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GatherNdOpGenericAdaptorBase; +public: + GatherNdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GatherNdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GatherNdOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + GatherNdOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getParams() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GatherNdOpAdaptor : public GatherNdOpGenericAdaptor<::mlir::ValueRange> { +public: + using GatherNdOpGenericAdaptor::GatherNdOpGenericAdaptor; + GatherNdOpAdaptor(GatherNdOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GatherNdOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = GatherNdOpAdaptor; + template + using GenericAdaptor = GatherNdOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tindices"), ::llvm::StringRef("Tparams")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTparamsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTparamsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.GatherNd"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParams(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::OpOperand &getParamsMutable(); + ::mlir::OpOperand &getIndicesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getTindices(); + ::mlir::Type getTparams(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value params, ::mlir::Value indices); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value params, ::mlir::Value indices); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::GatherNdOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::GatherOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GatherOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + GatherOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + GatherOpGenericAdaptorBase(GatherOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getValidateIndicesAttr(); + bool getValidateIndices(); +}; +} // namespace detail +template +class GatherOpGenericAdaptor : public detail::GatherOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GatherOpGenericAdaptorBase; +public: + GatherOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GatherOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GatherOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + GatherOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getParams() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GatherOpAdaptor : public GatherOpGenericAdaptor<::mlir::ValueRange> { +public: + using GatherOpGenericAdaptor::GatherOpGenericAdaptor; + GatherOpAdaptor(GatherOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GatherOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = GatherOpAdaptor; + template + using GenericAdaptor = GatherOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tindices"), ::llvm::StringRef("Tparams"), ::llvm::StringRef("validate_indices")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTparamsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTparamsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getValidateIndicesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getValidateIndicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Gather"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParams(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::OpOperand &getParamsMutable(); + ::mlir::OpOperand &getIndicesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getValidateIndicesAttr(); + bool getValidateIndices(); + ::mlir::Type getTindices(); + ::mlir::Type getTparams(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setValidateIndicesAttr(::mlir::BoolAttr attr); + void setValidateIndices(::std::optional attrValue); + ::mlir::Attribute removeValidateIndicesAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value params, ::mlir::Value indices, /*optional*/::mlir::BoolAttr validate_indices); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value params, ::mlir::Value indices, /*optional*/::mlir::BoolAttr validate_indices); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value params, ::mlir::Value indices, /*optional*/bool validate_indices = true); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value params, ::mlir::Value indices, /*optional*/bool validate_indices = true); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::GatherOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::GatherV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GatherV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + GatherV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + GatherV2OpGenericAdaptorBase(GatherV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getBatchDimsAttr(); + uint64_t getBatchDims(); +}; +} // namespace detail +template +class GatherV2OpGenericAdaptor : public detail::GatherV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GatherV2OpGenericAdaptorBase; +public: + GatherV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GatherV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GatherV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + GatherV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getParams() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getAxis() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GatherV2OpAdaptor : public GatherV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using GatherV2OpGenericAdaptor::GatherV2OpGenericAdaptor; + GatherV2OpAdaptor(GatherV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GatherV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = GatherV2OpAdaptor; + template + using GenericAdaptor = GatherV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Taxis"), ::llvm::StringRef("Tindices"), ::llvm::StringRef("Tparams"), ::llvm::StringRef("batch_dims")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTaxisAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTaxisAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTparamsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTparamsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getBatchDimsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getBatchDimsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.GatherV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParams(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getAxis(); + ::mlir::OpOperand &getParamsMutable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getAxisMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getBatchDimsAttr(); + uint64_t getBatchDims(); + ::mlir::Type getTaxis(); + ::mlir::Type getTindices(); + ::mlir::Type getTparams(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setBatchDimsAttr(::mlir::IntegerAttr attr); + void setBatchDims(::std::optional attrValue); + ::mlir::Attribute removeBatchDimsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value params, ::mlir::Value indices, ::mlir::Value axis, /*optional*/::mlir::IntegerAttr batch_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value params, ::mlir::Value indices, ::mlir::Value axis, /*optional*/::mlir::IntegerAttr batch_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value params, ::mlir::Value indices, ::mlir::Value axis, /*optional*/uint64_t batch_dims = 0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value params, ::mlir::Value indices, ::mlir::Value axis, /*optional*/uint64_t batch_dims = 0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::GatherV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::GeneratorDatasetOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GeneratorDatasetOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + GeneratorDatasetOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + GeneratorDatasetOpGenericAdaptorBase(GeneratorDatasetOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::SymbolRefAttr getInitFuncAttr(); + ::mlir::SymbolRefAttr getInitFunc(); + ::mlir::SymbolRefAttr getNextFuncAttr(); + ::mlir::SymbolRefAttr getNextFunc(); + ::mlir::SymbolRefAttr getFinalizeFuncAttr(); + ::mlir::SymbolRefAttr getFinalizeFunc(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); +}; +} // namespace detail +template +class GeneratorDatasetOpGenericAdaptor : public detail::GeneratorDatasetOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GeneratorDatasetOpGenericAdaptorBase; +public: + GeneratorDatasetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GeneratorDatasetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GeneratorDatasetOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + GeneratorDatasetOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInitFuncOtherArgs() { + return getODSOperands(0); + } + + RangeT getNextFuncOtherArgs() { + return getODSOperands(1); + } + + RangeT getFinalizeFuncOtherArgs() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GeneratorDatasetOpAdaptor : public GeneratorDatasetOpGenericAdaptor<::mlir::ValueRange> { +public: + using GeneratorDatasetOpGenericAdaptor::GeneratorDatasetOpGenericAdaptor; + GeneratorDatasetOpAdaptor(GeneratorDatasetOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GeneratorDatasetOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = GeneratorDatasetOpAdaptor; + template + using GenericAdaptor = GeneratorDatasetOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tfinalize_func_args"), ::llvm::StringRef("Tinit_func_args"), ::llvm::StringRef("Tnext_func_args"), ::llvm::StringRef("finalize_func"), ::llvm::StringRef("init_func"), ::llvm::StringRef("metadata"), ::llvm::StringRef("next_func"), ::llvm::StringRef("operandSegmentSizes"), ::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTfinalizeFuncArgsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTfinalizeFuncArgsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTinitFuncArgsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTinitFuncArgsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTnextFuncArgsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTnextFuncArgsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getFinalizeFuncAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getFinalizeFuncAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getInitFuncAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getInitFuncAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getMetadataAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getMetadataAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getNextFuncAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getNextFuncAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(8); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 8); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(9); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 9); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.GeneratorDataset"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInitFuncOtherArgs(); + ::mlir::Operation::operand_range getNextFuncOtherArgs(); + ::mlir::Operation::operand_range getFinalizeFuncOtherArgs(); + ::mlir::MutableOperandRange getInitFuncOtherArgsMutable(); + ::mlir::MutableOperandRange getNextFuncOtherArgsMutable(); + ::mlir::MutableOperandRange getFinalizeFuncOtherArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::SymbolRefAttr getInitFuncAttr(); + ::mlir::SymbolRefAttr getInitFunc(); + ::mlir::SymbolRefAttr getNextFuncAttr(); + ::mlir::SymbolRefAttr getNextFunc(); + ::mlir::SymbolRefAttr getFinalizeFuncAttr(); + ::mlir::SymbolRefAttr getFinalizeFunc(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); + mlir::OperandElementTypeRange getTfinalizeFuncArgs(); + mlir::OperandElementTypeRange getTinitFuncArgs(); + mlir::OperandElementTypeRange getTnextFuncArgs(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setInitFuncAttr(::mlir::SymbolRefAttr attr); + void setNextFuncAttr(::mlir::SymbolRefAttr attr); + void setFinalizeFuncAttr(::mlir::SymbolRefAttr attr); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + void setMetadataAttr(::mlir::StringAttr attr); + void setMetadata(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeMetadataAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::ValueRange init_func_other_args, ::mlir::ValueRange next_func_other_args, ::mlir::ValueRange finalize_func_other_args, ::mlir::SymbolRefAttr init_func, ::mlir::SymbolRefAttr next_func, ::mlir::SymbolRefAttr finalize_func, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange init_func_other_args, ::mlir::ValueRange next_func_other_args, ::mlir::ValueRange finalize_func_other_args, ::mlir::SymbolRefAttr init_func, ::mlir::SymbolRefAttr next_func, ::mlir::SymbolRefAttr finalize_func, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::ValueRange init_func_other_args, ::mlir::ValueRange next_func_other_args, ::mlir::ValueRange finalize_func_other_args, ::mlir::SymbolRefAttr init_func, ::mlir::SymbolRefAttr next_func, ::mlir::SymbolRefAttr finalize_func, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::llvm::StringRef metadata = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange init_func_other_args, ::mlir::ValueRange next_func_other_args, ::mlir::ValueRange finalize_func_other_args, ::mlir::SymbolRefAttr init_func, ::mlir::SymbolRefAttr next_func, ::mlir::SymbolRefAttr finalize_func, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::llvm::StringRef metadata = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 10 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::GeneratorDatasetOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::GetMinibatchSplitsWithPhysicalReplicaOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GetMinibatchSplitsWithPhysicalReplicaOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + GetMinibatchSplitsWithPhysicalReplicaOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + GetMinibatchSplitsWithPhysicalReplicaOpGenericAdaptorBase(GetMinibatchSplitsWithPhysicalReplicaOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getSampleCountAttr(); + uint64_t getSampleCount(); + ::mlir::IntegerAttr getNumReplicaAttr(); + uint64_t getNumReplica(); + ::mlir::IntegerAttr getTableVocabSizeAttr(); + uint64_t getTableVocabSize(); + ::mlir::IntegerAttr getFeatureWidthAttr(); + uint64_t getFeatureWidth(); + ::mlir::IntegerAttr getNumScPerChipAttr(); + uint64_t getNumScPerChip(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::StringAttr getMiniBatchSplitsAttr(); + ::llvm::StringRef getMiniBatchSplits(); +}; +} // namespace detail +template +class GetMinibatchSplitsWithPhysicalReplicaOpGenericAdaptor : public detail::GetMinibatchSplitsWithPhysicalReplicaOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GetMinibatchSplitsWithPhysicalReplicaOpGenericAdaptorBase; +public: + GetMinibatchSplitsWithPhysicalReplicaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GetMinibatchSplitsWithPhysicalReplicaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GetMinibatchSplitsWithPhysicalReplicaOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + GetMinibatchSplitsWithPhysicalReplicaOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getProgramKey() { + return (*getODSOperands(0).begin()); + } + + ValueT getRowIds() { + return (*getODSOperands(1).begin()); + } + + ValueT getColIds() { + return (*getODSOperands(2).begin()); + } + + ValueT getGains() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GetMinibatchSplitsWithPhysicalReplicaOpAdaptor : public GetMinibatchSplitsWithPhysicalReplicaOpGenericAdaptor<::mlir::ValueRange> { +public: + using GetMinibatchSplitsWithPhysicalReplicaOpGenericAdaptor::GetMinibatchSplitsWithPhysicalReplicaOpGenericAdaptor; + GetMinibatchSplitsWithPhysicalReplicaOpAdaptor(GetMinibatchSplitsWithPhysicalReplicaOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GetMinibatchSplitsWithPhysicalReplicaOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = GetMinibatchSplitsWithPhysicalReplicaOpAdaptor; + template + using GenericAdaptor = GetMinibatchSplitsWithPhysicalReplicaOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("feature_width"), ::llvm::StringRef("mini_batch_splits"), ::llvm::StringRef("num_replica"), ::llvm::StringRef("num_sc_per_chip"), ::llvm::StringRef("sample_count"), ::llvm::StringRef("table_name"), ::llvm::StringRef("table_vocab_size")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFeatureWidthAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFeatureWidthAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getMiniBatchSplitsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getMiniBatchSplitsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getNumReplicaAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getNumReplicaAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getNumScPerChipAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getNumScPerChipAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getSampleCountAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getSampleCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getTableVocabSizeAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getTableVocabSizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.GetMinibatchSplitsWithPhysicalReplica"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getProgramKey(); + ::mlir::TypedValue<::mlir::TensorType> getRowIds(); + ::mlir::TypedValue<::mlir::TensorType> getColIds(); + ::mlir::TypedValue<::mlir::TensorType> getGains(); + ::mlir::OpOperand &getProgramKeyMutable(); + ::mlir::OpOperand &getRowIdsMutable(); + ::mlir::OpOperand &getColIdsMutable(); + ::mlir::OpOperand &getGainsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSortedRowIds(); + ::mlir::TypedValue<::mlir::TensorType> getSortedColIds(); + ::mlir::TypedValue<::mlir::TensorType> getSortedGains(); + ::mlir::TypedValue<::mlir::TensorType> getSplits(); + ::mlir::TypedValue<::mlir::TensorType> getIdCounts(); + ::mlir::TypedValue<::mlir::TensorType> getMaxIds(); + ::mlir::TypedValue<::mlir::TensorType> getMaxUniques(); + ::mlir::IntegerAttr getSampleCountAttr(); + uint64_t getSampleCount(); + ::mlir::IntegerAttr getNumReplicaAttr(); + uint64_t getNumReplica(); + ::mlir::IntegerAttr getTableVocabSizeAttr(); + uint64_t getTableVocabSize(); + ::mlir::IntegerAttr getFeatureWidthAttr(); + uint64_t getFeatureWidth(); + ::mlir::IntegerAttr getNumScPerChipAttr(); + uint64_t getNumScPerChip(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::StringAttr getMiniBatchSplitsAttr(); + ::llvm::StringRef getMiniBatchSplits(); + void setSampleCountAttr(::mlir::IntegerAttr attr); + void setSampleCount(uint64_t attrValue); + void setNumReplicaAttr(::mlir::IntegerAttr attr); + void setNumReplica(uint64_t attrValue); + void setTableVocabSizeAttr(::mlir::IntegerAttr attr); + void setTableVocabSize(uint64_t attrValue); + void setFeatureWidthAttr(::mlir::IntegerAttr attr); + void setFeatureWidth(uint64_t attrValue); + void setNumScPerChipAttr(::mlir::IntegerAttr attr); + void setNumScPerChip(uint64_t attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::llvm::StringRef attrValue); + void setMiniBatchSplitsAttr(::mlir::StringAttr attr); + void setMiniBatchSplits(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type sorted_row_ids, ::mlir::Type sorted_col_ids, ::mlir::Type sorted_gains, ::mlir::Type splits, ::mlir::Type id_counts, ::mlir::Type max_ids, ::mlir::Type max_uniques, ::mlir::Value program_key, ::mlir::Value row_ids, ::mlir::Value col_ids, ::mlir::Value gains, ::mlir::IntegerAttr sample_count, ::mlir::IntegerAttr num_replica, ::mlir::IntegerAttr table_vocab_size, ::mlir::IntegerAttr feature_width, ::mlir::IntegerAttr num_sc_per_chip, ::mlir::StringAttr table_name, ::mlir::StringAttr mini_batch_splits); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value program_key, ::mlir::Value row_ids, ::mlir::Value col_ids, ::mlir::Value gains, ::mlir::IntegerAttr sample_count, ::mlir::IntegerAttr num_replica, ::mlir::IntegerAttr table_vocab_size, ::mlir::IntegerAttr feature_width, ::mlir::IntegerAttr num_sc_per_chip, ::mlir::StringAttr table_name, ::mlir::StringAttr mini_batch_splits); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type sorted_row_ids, ::mlir::Type sorted_col_ids, ::mlir::Type sorted_gains, ::mlir::Type splits, ::mlir::Type id_counts, ::mlir::Type max_ids, ::mlir::Type max_uniques, ::mlir::Value program_key, ::mlir::Value row_ids, ::mlir::Value col_ids, ::mlir::Value gains, uint64_t sample_count, uint64_t num_replica, uint64_t table_vocab_size, uint64_t feature_width, uint64_t num_sc_per_chip, ::llvm::StringRef table_name, ::llvm::StringRef mini_batch_splits); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value program_key, ::mlir::Value row_ids, ::mlir::Value col_ids, ::mlir::Value gains, uint64_t sample_count, uint64_t num_replica, uint64_t table_vocab_size, uint64_t feature_width, uint64_t num_sc_per_chip, ::llvm::StringRef table_name, ::llvm::StringRef mini_batch_splits); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 7 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::GetMinibatchSplitsWithPhysicalReplicaOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::GetMinibatchesInCsrWithPhysicalReplicaOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GetMinibatchesInCsrWithPhysicalReplicaOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + GetMinibatchesInCsrWithPhysicalReplicaOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + GetMinibatchesInCsrWithPhysicalReplicaOpGenericAdaptorBase(GetMinibatchesInCsrWithPhysicalReplicaOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getSampleCountAttr(); + uint64_t getSampleCount(); + ::mlir::IntegerAttr getNumReplicaAttr(); + uint64_t getNumReplica(); + ::mlir::IntegerAttr getMaxMinibatchesPerScAttr(); + uint64_t getMaxMinibatchesPerSc(); + ::mlir::IntegerAttr getMaxIdsPerChipPerSampleAttr(); + uint64_t getMaxIdsPerChipPerSample(); + ::mlir::IntegerAttr getTableVocabSizeAttr(); + uint64_t getTableVocabSize(); + ::mlir::IntegerAttr getFeatureWidthAttr(); + uint64_t getFeatureWidth(); + ::mlir::IntegerAttr getNumScPerChipAttr(); + uint64_t getNumScPerChip(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::StringAttr getMiniBatchInCsrAttr(); + ::llvm::StringRef getMiniBatchInCsr(); +}; +} // namespace detail +template +class GetMinibatchesInCsrWithPhysicalReplicaOpGenericAdaptor : public detail::GetMinibatchesInCsrWithPhysicalReplicaOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GetMinibatchesInCsrWithPhysicalReplicaOpGenericAdaptorBase; +public: + GetMinibatchesInCsrWithPhysicalReplicaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GetMinibatchesInCsrWithPhysicalReplicaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GetMinibatchesInCsrWithPhysicalReplicaOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + GetMinibatchesInCsrWithPhysicalReplicaOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getProgramKey() { + return (*getODSOperands(0).begin()); + } + + ValueT getRowIds() { + return (*getODSOperands(1).begin()); + } + + ValueT getColIds() { + return (*getODSOperands(2).begin()); + } + + ValueT getGains() { + return (*getODSOperands(3).begin()); + } + + ValueT getSplits() { + return (*getODSOperands(4).begin()); + } + + ValueT getIdCounts() { + return (*getODSOperands(5).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GetMinibatchesInCsrWithPhysicalReplicaOpAdaptor : public GetMinibatchesInCsrWithPhysicalReplicaOpGenericAdaptor<::mlir::ValueRange> { +public: + using GetMinibatchesInCsrWithPhysicalReplicaOpGenericAdaptor::GetMinibatchesInCsrWithPhysicalReplicaOpGenericAdaptor; + GetMinibatchesInCsrWithPhysicalReplicaOpAdaptor(GetMinibatchesInCsrWithPhysicalReplicaOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GetMinibatchesInCsrWithPhysicalReplicaOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<6>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = GetMinibatchesInCsrWithPhysicalReplicaOpAdaptor; + template + using GenericAdaptor = GetMinibatchesInCsrWithPhysicalReplicaOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("feature_width"), ::llvm::StringRef("max_ids_per_chip_per_sample"), ::llvm::StringRef("max_minibatches_per_sc"), ::llvm::StringRef("mini_batch_in_csr"), ::llvm::StringRef("num_replica"), ::llvm::StringRef("num_sc_per_chip"), ::llvm::StringRef("sample_count"), ::llvm::StringRef("table_name"), ::llvm::StringRef("table_vocab_size")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFeatureWidthAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFeatureWidthAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getMaxIdsPerChipPerSampleAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getMaxIdsPerChipPerSampleAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getMaxMinibatchesPerScAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getMaxMinibatchesPerScAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getMiniBatchInCsrAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getMiniBatchInCsrAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getNumReplicaAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getNumReplicaAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getNumScPerChipAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getNumScPerChipAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getSampleCountAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getSampleCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getTableVocabSizeAttrName() { + return getAttributeNameForIndex(8); + } + + static ::mlir::StringAttr getTableVocabSizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 8); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.GetMinibatchesInCsrWithPhysicalReplica"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getProgramKey(); + ::mlir::TypedValue<::mlir::TensorType> getRowIds(); + ::mlir::TypedValue<::mlir::TensorType> getColIds(); + ::mlir::TypedValue<::mlir::TensorType> getGains(); + ::mlir::TypedValue<::mlir::TensorType> getSplits(); + ::mlir::TypedValue<::mlir::TensorType> getIdCounts(); + ::mlir::OpOperand &getProgramKeyMutable(); + ::mlir::OpOperand &getRowIdsMutable(); + ::mlir::OpOperand &getColIdsMutable(); + ::mlir::OpOperand &getGainsMutable(); + ::mlir::OpOperand &getSplitsMutable(); + ::mlir::OpOperand &getIdCountsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getRowPointers(); + ::mlir::TypedValue<::mlir::TensorType> getSortedSampleIds(); + ::mlir::TypedValue<::mlir::TensorType> getSortedTokenIds(); + ::mlir::TypedValue<::mlir::TensorType> getSortedGains(); + ::mlir::TypedValue<::mlir::TensorType> getRowPointersUnpaddedSize(); + ::mlir::TypedValue<::mlir::TensorType> getIdsUnpaddedSize(); + ::mlir::TypedValue<::mlir::TensorType> getNumMinibatchesPerPhysicalSparseCore(); + ::mlir::IntegerAttr getSampleCountAttr(); + uint64_t getSampleCount(); + ::mlir::IntegerAttr getNumReplicaAttr(); + uint64_t getNumReplica(); + ::mlir::IntegerAttr getMaxMinibatchesPerScAttr(); + uint64_t getMaxMinibatchesPerSc(); + ::mlir::IntegerAttr getMaxIdsPerChipPerSampleAttr(); + uint64_t getMaxIdsPerChipPerSample(); + ::mlir::IntegerAttr getTableVocabSizeAttr(); + uint64_t getTableVocabSize(); + ::mlir::IntegerAttr getFeatureWidthAttr(); + uint64_t getFeatureWidth(); + ::mlir::IntegerAttr getNumScPerChipAttr(); + uint64_t getNumScPerChip(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::StringAttr getMiniBatchInCsrAttr(); + ::llvm::StringRef getMiniBatchInCsr(); + void setSampleCountAttr(::mlir::IntegerAttr attr); + void setSampleCount(uint64_t attrValue); + void setNumReplicaAttr(::mlir::IntegerAttr attr); + void setNumReplica(uint64_t attrValue); + void setMaxMinibatchesPerScAttr(::mlir::IntegerAttr attr); + void setMaxMinibatchesPerSc(uint64_t attrValue); + void setMaxIdsPerChipPerSampleAttr(::mlir::IntegerAttr attr); + void setMaxIdsPerChipPerSample(uint64_t attrValue); + void setTableVocabSizeAttr(::mlir::IntegerAttr attr); + void setTableVocabSize(uint64_t attrValue); + void setFeatureWidthAttr(::mlir::IntegerAttr attr); + void setFeatureWidth(uint64_t attrValue); + void setNumScPerChipAttr(::mlir::IntegerAttr attr); + void setNumScPerChip(uint64_t attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::llvm::StringRef attrValue); + void setMiniBatchInCsrAttr(::mlir::StringAttr attr); + void setMiniBatchInCsr(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type row_pointers, ::mlir::Type sorted_sample_ids, ::mlir::Type sorted_token_ids, ::mlir::Type sorted_gains, ::mlir::Type row_pointers_unpadded_size, ::mlir::Type ids_unpadded_size, ::mlir::Type num_minibatches_per_physical_sparse_core, ::mlir::Value program_key, ::mlir::Value row_ids, ::mlir::Value col_ids, ::mlir::Value gains, ::mlir::Value splits, ::mlir::Value id_counts, ::mlir::IntegerAttr sample_count, ::mlir::IntegerAttr num_replica, ::mlir::IntegerAttr max_minibatches_per_sc, ::mlir::IntegerAttr max_ids_per_chip_per_sample, ::mlir::IntegerAttr table_vocab_size, ::mlir::IntegerAttr feature_width, ::mlir::IntegerAttr num_sc_per_chip, ::mlir::StringAttr table_name, ::mlir::StringAttr mini_batch_in_csr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value program_key, ::mlir::Value row_ids, ::mlir::Value col_ids, ::mlir::Value gains, ::mlir::Value splits, ::mlir::Value id_counts, ::mlir::IntegerAttr sample_count, ::mlir::IntegerAttr num_replica, ::mlir::IntegerAttr max_minibatches_per_sc, ::mlir::IntegerAttr max_ids_per_chip_per_sample, ::mlir::IntegerAttr table_vocab_size, ::mlir::IntegerAttr feature_width, ::mlir::IntegerAttr num_sc_per_chip, ::mlir::StringAttr table_name, ::mlir::StringAttr mini_batch_in_csr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type row_pointers, ::mlir::Type sorted_sample_ids, ::mlir::Type sorted_token_ids, ::mlir::Type sorted_gains, ::mlir::Type row_pointers_unpadded_size, ::mlir::Type ids_unpadded_size, ::mlir::Type num_minibatches_per_physical_sparse_core, ::mlir::Value program_key, ::mlir::Value row_ids, ::mlir::Value col_ids, ::mlir::Value gains, ::mlir::Value splits, ::mlir::Value id_counts, uint64_t sample_count, uint64_t num_replica, uint64_t max_minibatches_per_sc, uint64_t max_ids_per_chip_per_sample, uint64_t table_vocab_size, uint64_t feature_width, uint64_t num_sc_per_chip, ::llvm::StringRef table_name, ::llvm::StringRef mini_batch_in_csr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value program_key, ::mlir::Value row_ids, ::mlir::Value col_ids, ::mlir::Value gains, ::mlir::Value splits, ::mlir::Value id_counts, uint64_t sample_count, uint64_t num_replica, uint64_t max_minibatches_per_sc, uint64_t max_ids_per_chip_per_sample, uint64_t table_vocab_size, uint64_t feature_width, uint64_t num_sc_per_chip, ::llvm::StringRef table_name, ::llvm::StringRef mini_batch_in_csr); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 9 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::GetMinibatchesInCsrWithPhysicalReplicaOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::GlobalIterIdOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GlobalIterIdOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + GlobalIterIdOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + GlobalIterIdOpGenericAdaptorBase(GlobalIterIdOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class GlobalIterIdOpGenericAdaptor : public detail::GlobalIterIdOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GlobalIterIdOpGenericAdaptorBase; +public: + GlobalIterIdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GlobalIterIdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GlobalIterIdOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + GlobalIterIdOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GlobalIterIdOpAdaptor : public GlobalIterIdOpGenericAdaptor<::mlir::ValueRange> { +public: + using GlobalIterIdOpGenericAdaptor::GlobalIterIdOpGenericAdaptor; + GlobalIterIdOpAdaptor(GlobalIterIdOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GlobalIterIdOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, GetResourceInstanceInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = GlobalIterIdOpAdaptor; + template + using GenericAdaptor = GlobalIterIdOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.GlobalIterId"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getIterId(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type iter_id); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + std::optional GetResourceInstanceStr(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::GlobalIterIdOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::GreaterEqualOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GreaterEqualOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + GreaterEqualOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + GreaterEqualOpGenericAdaptorBase(GreaterEqualOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class GreaterEqualOpGenericAdaptor : public detail::GreaterEqualOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GreaterEqualOpGenericAdaptorBase; +public: + GreaterEqualOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GreaterEqualOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GreaterEqualOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + GreaterEqualOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GreaterEqualOpAdaptor : public GreaterEqualOpGenericAdaptor<::mlir::ValueRange> { +public: + using GreaterEqualOpGenericAdaptor::GreaterEqualOpGenericAdaptor; + GreaterEqualOpAdaptor(GreaterEqualOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GreaterEqualOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = GreaterEqualOpAdaptor; + template + using GenericAdaptor = GreaterEqualOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.GreaterEqual"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::GreaterEqualOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::GreaterOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GreaterOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + GreaterOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + GreaterOpGenericAdaptorBase(GreaterOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class GreaterOpGenericAdaptor : public detail::GreaterOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GreaterOpGenericAdaptorBase; +public: + GreaterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GreaterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GreaterOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + GreaterOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GreaterOpAdaptor : public GreaterOpGenericAdaptor<::mlir::ValueRange> { +public: + using GreaterOpGenericAdaptor::GreaterOpGenericAdaptor; + GreaterOpAdaptor(GreaterOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GreaterOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = GreaterOpAdaptor; + template + using GenericAdaptor = GreaterOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Greater"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::GreaterOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::HSVToRGBOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class HSVToRGBOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + HSVToRGBOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + HSVToRGBOpGenericAdaptorBase(HSVToRGBOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class HSVToRGBOpGenericAdaptor : public detail::HSVToRGBOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::HSVToRGBOpGenericAdaptorBase; +public: + HSVToRGBOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + HSVToRGBOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : HSVToRGBOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + HSVToRGBOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getImages() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class HSVToRGBOpAdaptor : public HSVToRGBOpGenericAdaptor<::mlir::ValueRange> { +public: + using HSVToRGBOpGenericAdaptor::HSVToRGBOpGenericAdaptor; + HSVToRGBOpAdaptor(HSVToRGBOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class HSVToRGBOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = HSVToRGBOpAdaptor; + template + using GenericAdaptor = HSVToRGBOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.HSVToRGB"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getImages(); + ::mlir::OpOperand &getImagesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value images); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value images); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::HSVToRGBOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::HashTableOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class HashTableOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + HashTableOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + HashTableOpGenericAdaptorBase(HashTableOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getContainerAttr(); + ::llvm::StringRef getContainer(); + ::mlir::StringAttr getSharedNameAttr(); + ::llvm::StringRef getSharedName(); + ::mlir::BoolAttr getUseNodeNameSharingAttr(); + bool getUseNodeNameSharing(); + ::mlir::TypeAttr getKeyDtypeAttr(); + ::mlir::Type getKeyDtype(); + ::mlir::TypeAttr getValueDtypeAttr(); + ::mlir::Type getValueDtype(); +}; +} // namespace detail +template +class HashTableOpGenericAdaptor : public detail::HashTableOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::HashTableOpGenericAdaptorBase; +public: + HashTableOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + HashTableOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : HashTableOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + HashTableOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class HashTableOpAdaptor : public HashTableOpGenericAdaptor<::mlir::ValueRange> { +public: + using HashTableOpGenericAdaptor::HashTableOpGenericAdaptor; + HashTableOpAdaptor(HashTableOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class HashTableOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = HashTableOpAdaptor; + template + using GenericAdaptor = HashTableOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("container"), ::llvm::StringRef("key_dtype"), ::llvm::StringRef("shared_name"), ::llvm::StringRef("use_node_name_sharing"), ::llvm::StringRef("value_dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getContainerAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getContainerAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getKeyDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getKeyDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getSharedNameAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getSharedNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getUseNodeNameSharingAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getUseNodeNameSharingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getValueDtypeAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getValueDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.HashTable"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTableHandle(); + ::mlir::StringAttr getContainerAttr(); + ::llvm::StringRef getContainer(); + ::mlir::StringAttr getSharedNameAttr(); + ::llvm::StringRef getSharedName(); + ::mlir::BoolAttr getUseNodeNameSharingAttr(); + bool getUseNodeNameSharing(); + ::mlir::TypeAttr getKeyDtypeAttr(); + ::mlir::Type getKeyDtype(); + ::mlir::TypeAttr getValueDtypeAttr(); + ::mlir::Type getValueDtype(); + void setContainerAttr(::mlir::StringAttr attr); + void setContainer(::std::optional<::llvm::StringRef> attrValue); + void setSharedNameAttr(::mlir::StringAttr attr); + void setSharedName(::std::optional<::llvm::StringRef> attrValue); + void setUseNodeNameSharingAttr(::mlir::BoolAttr attr); + void setUseNodeNameSharing(::std::optional attrValue); + void setKeyDtypeAttr(::mlir::TypeAttr attr); + void setKeyDtype(::mlir::Type attrValue); + void setValueDtypeAttr(::mlir::TypeAttr attr); + void setValueDtype(::mlir::Type attrValue); + ::mlir::Attribute removeContainerAttr(); + ::mlir::Attribute removeSharedNameAttr(); + ::mlir::Attribute removeUseNodeNameSharingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type table_handle, /*optional*/::mlir::StringAttr container, /*optional*/::mlir::StringAttr shared_name, /*optional*/::mlir::BoolAttr use_node_name_sharing, ::mlir::TypeAttr key_dtype, ::mlir::TypeAttr value_dtype); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::StringAttr container, /*optional*/::mlir::StringAttr shared_name, /*optional*/::mlir::BoolAttr use_node_name_sharing, ::mlir::TypeAttr key_dtype, ::mlir::TypeAttr value_dtype); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type table_handle, /*optional*/::llvm::StringRef container, /*optional*/::llvm::StringRef shared_name, /*optional*/bool use_node_name_sharing, ::mlir::Type key_dtype, ::mlir::Type value_dtype); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::llvm::StringRef container, /*optional*/::llvm::StringRef shared_name, /*optional*/bool use_node_name_sharing, ::mlir::Type key_dtype, ::mlir::Type value_dtype); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::HashTableOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::HashTableV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class HashTableV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + HashTableV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + HashTableV2OpGenericAdaptorBase(HashTableV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getContainerAttr(); + ::llvm::StringRef getContainer(); + ::mlir::StringAttr getSharedNameAttr(); + ::llvm::StringRef getSharedName(); + ::mlir::BoolAttr getUseNodeNameSharingAttr(); + bool getUseNodeNameSharing(); + ::mlir::TypeAttr getKeyDtypeAttr(); + ::mlir::Type getKeyDtype(); + ::mlir::TypeAttr getValueDtypeAttr(); + ::mlir::Type getValueDtype(); +}; +} // namespace detail +template +class HashTableV2OpGenericAdaptor : public detail::HashTableV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::HashTableV2OpGenericAdaptorBase; +public: + HashTableV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + HashTableV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : HashTableV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + HashTableV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class HashTableV2OpAdaptor : public HashTableV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using HashTableV2OpGenericAdaptor::HashTableV2OpGenericAdaptor; + HashTableV2OpAdaptor(HashTableV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class HashTableV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = HashTableV2OpAdaptor; + template + using GenericAdaptor = HashTableV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("container"), ::llvm::StringRef("key_dtype"), ::llvm::StringRef("shared_name"), ::llvm::StringRef("use_node_name_sharing"), ::llvm::StringRef("value_dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getContainerAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getContainerAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getKeyDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getKeyDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getSharedNameAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getSharedNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getUseNodeNameSharingAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getUseNodeNameSharingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getValueDtypeAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getValueDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.HashTableV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTableHandle(); + ::mlir::StringAttr getContainerAttr(); + ::llvm::StringRef getContainer(); + ::mlir::StringAttr getSharedNameAttr(); + ::llvm::StringRef getSharedName(); + ::mlir::BoolAttr getUseNodeNameSharingAttr(); + bool getUseNodeNameSharing(); + ::mlir::TypeAttr getKeyDtypeAttr(); + ::mlir::Type getKeyDtype(); + ::mlir::TypeAttr getValueDtypeAttr(); + ::mlir::Type getValueDtype(); + void setContainerAttr(::mlir::StringAttr attr); + void setContainer(::std::optional<::llvm::StringRef> attrValue); + void setSharedNameAttr(::mlir::StringAttr attr); + void setSharedName(::std::optional<::llvm::StringRef> attrValue); + void setUseNodeNameSharingAttr(::mlir::BoolAttr attr); + void setUseNodeNameSharing(::std::optional attrValue); + void setKeyDtypeAttr(::mlir::TypeAttr attr); + void setKeyDtype(::mlir::Type attrValue); + void setValueDtypeAttr(::mlir::TypeAttr attr); + void setValueDtype(::mlir::Type attrValue); + ::mlir::Attribute removeContainerAttr(); + ::mlir::Attribute removeSharedNameAttr(); + ::mlir::Attribute removeUseNodeNameSharingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, StringAttr container, StringAttr shared_name, BoolAttr use_node_name_sharing, TypeAttr key_dtype, TypeAttr value_dtype); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type table_handle, /*optional*/::mlir::StringAttr container, /*optional*/::mlir::StringAttr shared_name, /*optional*/::mlir::BoolAttr use_node_name_sharing, ::mlir::TypeAttr key_dtype, ::mlir::TypeAttr value_dtype); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::StringAttr container, /*optional*/::mlir::StringAttr shared_name, /*optional*/::mlir::BoolAttr use_node_name_sharing, ::mlir::TypeAttr key_dtype, ::mlir::TypeAttr value_dtype); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type table_handle, /*optional*/::llvm::StringRef container, /*optional*/::llvm::StringRef shared_name, /*optional*/bool use_node_name_sharing, ::mlir::Type key_dtype, ::mlir::Type value_dtype); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::llvm::StringRef container, /*optional*/::llvm::StringRef shared_name, /*optional*/bool use_node_name_sharing, ::mlir::Type key_dtype, ::mlir::Type value_dtype); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::HashTableV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::IFFT2DOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IFFT2DOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IFFT2DOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IFFT2DOpGenericAdaptorBase(IFFT2DOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class IFFT2DOpGenericAdaptor : public detail::IFFT2DOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IFFT2DOpGenericAdaptorBase; +public: + IFFT2DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IFFT2DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IFFT2DOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IFFT2DOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IFFT2DOpAdaptor : public IFFT2DOpGenericAdaptor<::mlir::ValueRange> { +public: + using IFFT2DOpGenericAdaptor::IFFT2DOpGenericAdaptor; + IFFT2DOpAdaptor(IFFT2DOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IFFT2DOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = IFFT2DOpAdaptor; + template + using GenericAdaptor = IFFT2DOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tcomplex")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTcomplexAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTcomplexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.IFFT2D"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getTcomplex(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::IFFT2DOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::IFFT3DOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IFFT3DOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IFFT3DOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IFFT3DOpGenericAdaptorBase(IFFT3DOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class IFFT3DOpGenericAdaptor : public detail::IFFT3DOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IFFT3DOpGenericAdaptorBase; +public: + IFFT3DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IFFT3DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IFFT3DOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IFFT3DOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IFFT3DOpAdaptor : public IFFT3DOpGenericAdaptor<::mlir::ValueRange> { +public: + using IFFT3DOpGenericAdaptor::IFFT3DOpGenericAdaptor; + IFFT3DOpAdaptor(IFFT3DOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IFFT3DOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = IFFT3DOpAdaptor; + template + using GenericAdaptor = IFFT3DOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tcomplex")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTcomplexAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTcomplexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.IFFT3D"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getTcomplex(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::IFFT3DOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::IFFTOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IFFTOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IFFTOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IFFTOpGenericAdaptorBase(IFFTOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class IFFTOpGenericAdaptor : public detail::IFFTOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IFFTOpGenericAdaptorBase; +public: + IFFTOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IFFTOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IFFTOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IFFTOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IFFTOpAdaptor : public IFFTOpGenericAdaptor<::mlir::ValueRange> { +public: + using IFFTOpGenericAdaptor::IFFTOpGenericAdaptor; + IFFTOpAdaptor(IFFTOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IFFTOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = IFFTOpAdaptor; + template + using GenericAdaptor = IFFTOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tcomplex")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTcomplexAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTcomplexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.IFFT"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getTcomplex(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::IFFTOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::IRFFT2DOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IRFFT2DOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IRFFT2DOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IRFFT2DOpGenericAdaptorBase(IRFFT2DOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class IRFFT2DOpGenericAdaptor : public detail::IRFFT2DOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IRFFT2DOpGenericAdaptorBase; +public: + IRFFT2DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IRFFT2DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IRFFT2DOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IRFFT2DOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getFftLength() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IRFFT2DOpAdaptor : public IRFFT2DOpGenericAdaptor<::mlir::ValueRange> { +public: + using IRFFT2DOpGenericAdaptor::IRFFT2DOpGenericAdaptor; + IRFFT2DOpAdaptor(IRFFT2DOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IRFFT2DOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = IRFFT2DOpAdaptor; + template + using GenericAdaptor = IRFFT2DOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tcomplex"), ::llvm::StringRef("Treal")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTcomplexAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTcomplexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTrealAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTrealAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.IRFFT2D"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getFftLength(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getFftLengthMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getTcomplex(); + ::mlir::Type getTreal(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value fft_length); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value fft_length); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::IRFFT2DOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::IRFFT3DOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IRFFT3DOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IRFFT3DOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IRFFT3DOpGenericAdaptorBase(IRFFT3DOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class IRFFT3DOpGenericAdaptor : public detail::IRFFT3DOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IRFFT3DOpGenericAdaptorBase; +public: + IRFFT3DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IRFFT3DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IRFFT3DOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IRFFT3DOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getFftLength() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IRFFT3DOpAdaptor : public IRFFT3DOpGenericAdaptor<::mlir::ValueRange> { +public: + using IRFFT3DOpGenericAdaptor::IRFFT3DOpGenericAdaptor; + IRFFT3DOpAdaptor(IRFFT3DOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IRFFT3DOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = IRFFT3DOpAdaptor; + template + using GenericAdaptor = IRFFT3DOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tcomplex"), ::llvm::StringRef("Treal")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTcomplexAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTcomplexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTrealAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTrealAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.IRFFT3D"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getFftLength(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getFftLengthMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getTcomplex(); + ::mlir::Type getTreal(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value fft_length); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value fft_length); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::IRFFT3DOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::IRFFTOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IRFFTOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IRFFTOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IRFFTOpGenericAdaptorBase(IRFFTOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class IRFFTOpGenericAdaptor : public detail::IRFFTOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IRFFTOpGenericAdaptorBase; +public: + IRFFTOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IRFFTOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IRFFTOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IRFFTOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getFftLength() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IRFFTOpAdaptor : public IRFFTOpGenericAdaptor<::mlir::ValueRange> { +public: + using IRFFTOpGenericAdaptor::IRFFTOpGenericAdaptor; + IRFFTOpAdaptor(IRFFTOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IRFFTOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = IRFFTOpAdaptor; + template + using GenericAdaptor = IRFFTOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tcomplex"), ::llvm::StringRef("Treal")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTcomplexAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTcomplexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTrealAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTrealAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.IRFFT"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getFftLength(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getFftLengthMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getTcomplex(); + ::mlir::Type getTreal(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value fft_length); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value fft_length); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::IRFFTOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::IdentityNOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IdentityNOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IdentityNOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IdentityNOpGenericAdaptorBase(IdentityNOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class IdentityNOpGenericAdaptor : public detail::IdentityNOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IdentityNOpGenericAdaptorBase; +public: + IdentityNOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IdentityNOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IdentityNOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IdentityNOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInput() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IdentityNOpAdaptor : public IdentityNOpGenericAdaptor<::mlir::ValueRange> { +public: + using IdentityNOpGenericAdaptor::IdentityNOpGenericAdaptor; + IdentityNOpAdaptor(IdentityNOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IdentityNOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = IdentityNOpAdaptor; + template + using GenericAdaptor = IdentityNOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.IdentityN"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInput(); + ::mlir::MutableOperandRange getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutput(); + mlir::OperandElementTypeRange getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::IdentityNOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::IdentityOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IdentityOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IdentityOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IdentityOpGenericAdaptorBase(IdentityOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class IdentityOpGenericAdaptor : public detail::IdentityOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IdentityOpGenericAdaptorBase; +public: + IdentityOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IdentityOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IdentityOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IdentityOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IdentityOpAdaptor : public IdentityOpGenericAdaptor<::mlir::ValueRange> { +public: + using IdentityOpGenericAdaptor::IdentityOpGenericAdaptor; + IdentityOpAdaptor(IdentityOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IdentityOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::OpTrait::TF::OperandsSameAsResultsTypeOrRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = IdentityOpAdaptor; + template + using GenericAdaptor = IdentityOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Identity"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::IdentityOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::IfOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IfOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IfOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IfOpGenericAdaptorBase(IfOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::FlatSymbolRefAttr getThenBranchAttr(); + ::llvm::StringRef getThenBranch(); + ::mlir::FlatSymbolRefAttr getElseBranchAttr(); + ::llvm::StringRef getElseBranch(); + ::mlir::BoolAttr getIsStatelessAttr(); + bool getIsStateless(); +}; +} // namespace detail +template +class IfOpGenericAdaptor : public detail::IfOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IfOpGenericAdaptorBase; +public: + IfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IfOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IfOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getCond() { + return (*getODSOperands(0).begin()); + } + + RangeT getInput() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IfOpAdaptor : public IfOpGenericAdaptor<::mlir::ValueRange> { +public: + using IfOpGenericAdaptor::IfOpGenericAdaptor; + IfOpAdaptor(IfOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IfOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::SymbolUserOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = IfOpAdaptor; + template + using GenericAdaptor = IfOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tcond"), ::llvm::StringRef("Tin"), ::llvm::StringRef("Tout"), ::llvm::StringRef("else_branch"), ::llvm::StringRef("is_stateless"), ::llvm::StringRef("output_shapes"), ::llvm::StringRef("then_branch")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTcondAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTcondAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTinAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTinAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getToutAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getToutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getElseBranchAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getElseBranchAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getIsStatelessAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getIsStatelessAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getThenBranchAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getThenBranchAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.If"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getCond(); + ::mlir::Operation::operand_range getInput(); + ::mlir::OpOperand &getCondMutable(); + ::mlir::MutableOperandRange getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutput(); + ::mlir::FlatSymbolRefAttr getThenBranchAttr(); + ::llvm::StringRef getThenBranch(); + ::mlir::FlatSymbolRefAttr getElseBranchAttr(); + ::llvm::StringRef getElseBranch(); + ::mlir::BoolAttr getIsStatelessAttr(); + bool getIsStateless(); + ::mlir::Type getTcond(); + mlir::OperandElementTypeRange getTin(); + mlir::ResultElementTypeRange getTout(); + mlir::TF::ResultShapeRange getOutputShapes(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setThenBranchAttr(::mlir::FlatSymbolRefAttr attr); + void setThenBranch(::llvm::StringRef attrValue); + void setElseBranchAttr(::mlir::FlatSymbolRefAttr attr); + void setElseBranch(::llvm::StringRef attrValue); + void setIsStatelessAttr(::mlir::BoolAttr attr); + void setIsStateless(bool attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::Value cond, ::mlir::ValueRange input, ::mlir::FlatSymbolRefAttr then_branch, ::mlir::FlatSymbolRefAttr else_branch, ::mlir::BoolAttr is_stateless); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::Value cond, ::mlir::ValueRange input, ::llvm::StringRef then_branch, ::llvm::StringRef else_branch, bool is_stateless); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::LogicalResult verifySymbolUses(::mlir::SymbolTableCollection &symbolTable); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 7 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Resolve the then branch function. + // Prefer passing in SymbolTableCollection to reduce lookup costs by + // enabling reusing cached symbol table lookup. + func::FuncOp ResolveThenFunction(::mlir::SymbolTableCollection* table) { + if (table) + return table->lookupNearestSymbolFrom(*this, getThenBranchAttr()); + return SymbolTable::lookupNearestSymbolFrom( + *this, getThenBranchAttr()); + } + // TODO(b/204997177): Deprecate and remove. + func::FuncOp then_function(::mlir::SymbolTableCollection* table = nullptr) { + return ResolveThenFunction(table); + } + + // Resolve the else branch function. + // Prefer passing in SymbolTableCollection to reduce lookup costs by + // enabling reusing cached symbol table lookup. + func::FuncOp ResolveElseFunction(::mlir::SymbolTableCollection* table) { + if (table) + return table->lookupNearestSymbolFrom(*this, getElseBranchAttr()); + return SymbolTable::lookupNearestSymbolFrom( + *this, getElseBranchAttr()); + } + // TODO(b/204997177): Deprecate and remove. + func::FuncOp else_function(::mlir::SymbolTableCollection* table = nullptr) { + return ResolveElseFunction(table); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::IfOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::IfRegionOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IfRegionOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IfRegionOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IfRegionOpGenericAdaptorBase(IfRegionOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getIsStatelessAttr(); + bool getIsStateless(); + ::mlir::StringAttr get_thenFuncNameAttr(); + ::std::optional< ::llvm::StringRef > get_thenFuncName(); + ::mlir::StringAttr get_elseFuncNameAttr(); + ::std::optional< ::llvm::StringRef > get_elseFuncName(); + ::mlir::Region &getThenBranch(); + ::mlir::Region &getElseBranch(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class IfRegionOpGenericAdaptor : public detail::IfRegionOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IfRegionOpGenericAdaptorBase; +public: + IfRegionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IfRegionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IfRegionOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IfRegionOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getCond() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IfRegionOpAdaptor : public IfRegionOpGenericAdaptor<::mlir::ValueRange> { +public: + using IfRegionOpGenericAdaptor::IfRegionOpGenericAdaptor; + IfRegionOpAdaptor(IfRegionOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IfRegionOp : public ::mlir::Op::Impl, ::mlir::OpTrait::VariadicResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::SingleBlock, ::mlir::OpTrait::SingleBlockImplicitTerminator::Impl, ::mlir::OpTrait::NoRegionArguments, ::mlir::OpTrait::OpInvariants, ::mlir::RegionBranchOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = IfRegionOpAdaptor; + template + using GenericAdaptor = IfRegionOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("_else_func_name"), ::llvm::StringRef("_then_func_name"), ::llvm::StringRef("is_stateless")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr get_elseFuncNameAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr get_elseFuncNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr get_thenFuncNameAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr get_thenFuncNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getIsStatelessAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getIsStatelessAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.IfRegion"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::RankedTensorType> getCond(); + ::mlir::OpOperand &getCondMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutput(); + ::mlir::Region &getThenBranch(); + ::mlir::Region &getElseBranch(); + ::mlir::BoolAttr getIsStatelessAttr(); + bool getIsStateless(); + ::mlir::StringAttr get_thenFuncNameAttr(); + ::std::optional< ::llvm::StringRef > get_thenFuncName(); + ::mlir::StringAttr get_elseFuncNameAttr(); + ::std::optional< ::llvm::StringRef > get_elseFuncName(); + void setIsStatelessAttr(::mlir::BoolAttr attr); + void setIsStateless(bool attrValue); + void set_thenFuncNameAttr(::mlir::StringAttr attr); + void set_thenFuncName(::std::optional<::llvm::StringRef> attrValue); + void set_elseFuncNameAttr(::mlir::StringAttr attr); + void set_elseFuncName(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute remove_thenFuncNameAttr(); + ::mlir::Attribute remove_elseFuncNameAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTypes, ValueRange operands, llvm::ArrayRef<::mlir::NamedAttribute> attributes, unsigned numRegions); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::Value cond, ::mlir::BoolAttr is_stateless, /*optional*/::mlir::StringAttr _then_func_name, /*optional*/::mlir::StringAttr _else_func_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::Value cond, bool is_stateless, /*optional*/::mlir::StringAttr _then_func_name, /*optional*/::mlir::StringAttr _else_func_name); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verifyRegions(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::OperandRange getEntrySuccessorOperands(::mlir::RegionBranchPoint point); + void getSuccessorRegions(::mlir::RegionBranchPoint point, ::llvm::SmallVectorImpl<::mlir::RegionSuccessor> ®ions); + void getRegionInvocationBounds(::llvm::ArrayRef<::mlir::Attribute> operands, ::llvm::SmallVectorImpl<::mlir::InvocationBounds> &invocationBounds); + bool areTypesCompatible(::mlir::Type lhs, ::mlir::Type rhs); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::IfRegionOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::IgammaGradAOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IgammaGradAOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IgammaGradAOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IgammaGradAOpGenericAdaptorBase(IgammaGradAOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class IgammaGradAOpGenericAdaptor : public detail::IgammaGradAOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IgammaGradAOpGenericAdaptorBase; +public: + IgammaGradAOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IgammaGradAOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IgammaGradAOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IgammaGradAOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + ValueT getX() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IgammaGradAOpAdaptor : public IgammaGradAOpGenericAdaptor<::mlir::ValueRange> { +public: + using IgammaGradAOpGenericAdaptor::IgammaGradAOpGenericAdaptor; + IgammaGradAOpAdaptor(IgammaGradAOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IgammaGradAOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::OpTrait::TF::SameOperandsAndResultElementTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = IgammaGradAOpAdaptor; + template + using GenericAdaptor = IgammaGradAOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.IgammaGradA"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getA(); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getAMutable(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value a, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::IgammaGradAOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::IgammaOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IgammaOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IgammaOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IgammaOpGenericAdaptorBase(IgammaOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class IgammaOpGenericAdaptor : public detail::IgammaOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IgammaOpGenericAdaptorBase; +public: + IgammaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IgammaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IgammaOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IgammaOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + ValueT getX() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IgammaOpAdaptor : public IgammaOpGenericAdaptor<::mlir::ValueRange> { +public: + using IgammaOpGenericAdaptor::IgammaOpGenericAdaptor; + IgammaOpAdaptor(IgammaOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IgammaOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::OpTrait::TF::SameOperandsAndResultElementTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = IgammaOpAdaptor; + template + using GenericAdaptor = IgammaOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Igamma"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getA(); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getAMutable(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value a, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::IgammaOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::IgammacOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IgammacOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IgammacOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IgammacOpGenericAdaptorBase(IgammacOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class IgammacOpGenericAdaptor : public detail::IgammacOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IgammacOpGenericAdaptorBase; +public: + IgammacOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IgammacOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IgammacOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IgammacOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + ValueT getX() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IgammacOpAdaptor : public IgammacOpGenericAdaptor<::mlir::ValueRange> { +public: + using IgammacOpGenericAdaptor::IgammacOpGenericAdaptor; + IgammacOpAdaptor(IgammacOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IgammacOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::OpTrait::TF::SameOperandsAndResultElementTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = IgammacOpAdaptor; + template + using GenericAdaptor = IgammacOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Igammac"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getA(); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getAMutable(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value a, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::IgammacOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ImagOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ImagOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ImagOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ImagOpGenericAdaptorBase(ImagOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ImagOpGenericAdaptor : public detail::ImagOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ImagOpGenericAdaptorBase; +public: + ImagOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ImagOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ImagOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ImagOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ImagOpAdaptor : public ImagOpGenericAdaptor<::mlir::ValueRange> { +public: + using ImagOpGenericAdaptor::ImagOpGenericAdaptor; + ImagOpAdaptor(ImagOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ImagOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ImagOpAdaptor; + template + using GenericAdaptor = ImagOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tout")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getToutAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getToutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Imag"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTout(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ImagOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ImportEventOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ImportEventOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ImportEventOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ImportEventOpGenericAdaptorBase(ImportEventOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ImportEventOpGenericAdaptor : public detail::ImportEventOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ImportEventOpGenericAdaptorBase; +public: + ImportEventOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ImportEventOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ImportEventOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ImportEventOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getWriter() { + return (*getODSOperands(0).begin()); + } + + ValueT getEvent() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ImportEventOpAdaptor : public ImportEventOpGenericAdaptor<::mlir::ValueRange> { +public: + using ImportEventOpGenericAdaptor::ImportEventOpGenericAdaptor; + ImportEventOpAdaptor(ImportEventOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ImportEventOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ImportEventOpAdaptor; + template + using GenericAdaptor = ImportEventOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ImportEvent"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getWriter(); + ::mlir::TypedValue<::mlir::TensorType> getEvent(); + ::mlir::OpOperand &getWriterMutable(); + ::mlir::OpOperand &getEventMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value writer, ::mlir::Value event); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value writer, ::mlir::Value event); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ImportEventOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::InTopKV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class InTopKV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + InTopKV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + InTopKV2OpGenericAdaptorBase(InTopKV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class InTopKV2OpGenericAdaptor : public detail::InTopKV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::InTopKV2OpGenericAdaptorBase; +public: + InTopKV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + InTopKV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : InTopKV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + InTopKV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getPredictions() { + return (*getODSOperands(0).begin()); + } + + ValueT getTargets() { + return (*getODSOperands(1).begin()); + } + + ValueT getK() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class InTopKV2OpAdaptor : public InTopKV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using InTopKV2OpGenericAdaptor::InTopKV2OpGenericAdaptor; + InTopKV2OpAdaptor(InTopKV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class InTopKV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = InTopKV2OpAdaptor; + template + using GenericAdaptor = InTopKV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.InTopKV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getPredictions(); + ::mlir::TypedValue<::mlir::TensorType> getTargets(); + ::mlir::TypedValue<::mlir::TensorType> getK(); + ::mlir::OpOperand &getPredictionsMutable(); + ::mlir::OpOperand &getTargetsMutable(); + ::mlir::OpOperand &getKMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getPrecision(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type precision, ::mlir::Value predictions, ::mlir::Value targets, ::mlir::Value k); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value predictions, ::mlir::Value targets, ::mlir::Value k); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::InTopKV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::InfeedDequeueOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class InfeedDequeueOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + InfeedDequeueOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + InfeedDequeueOpGenericAdaptorBase(InfeedDequeueOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Attribute getShapeAttr(); + std::optional> getShape(); +}; +} // namespace detail +template +class InfeedDequeueOpGenericAdaptor : public detail::InfeedDequeueOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::InfeedDequeueOpGenericAdaptorBase; +public: + InfeedDequeueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + InfeedDequeueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : InfeedDequeueOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + InfeedDequeueOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class InfeedDequeueOpAdaptor : public InfeedDequeueOpGenericAdaptor<::mlir::ValueRange> { +public: + using InfeedDequeueOpGenericAdaptor::InfeedDequeueOpGenericAdaptor; + InfeedDequeueOpAdaptor(InfeedDequeueOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class InfeedDequeueOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = InfeedDequeueOpAdaptor; + template + using GenericAdaptor = InfeedDequeueOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dtype"), ::llvm::StringRef("shape")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getShapeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getShapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.InfeedDequeue"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Attribute getShapeAttr(); + std::optional> getShape(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setShapeAttr(::mlir::Attribute attr); + void setShape(std::optional> attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Attribute shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Attribute shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, std::optional> shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, std::optional> shape); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::InfeedDequeueOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::InfeedDequeueTupleOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class InfeedDequeueTupleOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + InfeedDequeueTupleOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + InfeedDequeueTupleOpGenericAdaptorBase(InfeedDequeueTupleOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr get_XlaShardingAttr(); + ::std::optional< ::llvm::StringRef > get_XlaSharding(); + ::mlir::ArrayAttr getLayoutsAttr(); + ::std::optional< ::mlir::ArrayAttr > getLayouts(); +}; +} // namespace detail +template +class InfeedDequeueTupleOpGenericAdaptor : public detail::InfeedDequeueTupleOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::InfeedDequeueTupleOpGenericAdaptorBase; +public: + InfeedDequeueTupleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + InfeedDequeueTupleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : InfeedDequeueTupleOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + InfeedDequeueTupleOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class InfeedDequeueTupleOpAdaptor : public InfeedDequeueTupleOpGenericAdaptor<::mlir::ValueRange> { +public: + using InfeedDequeueTupleOpGenericAdaptor::InfeedDequeueTupleOpGenericAdaptor; + InfeedDequeueTupleOpAdaptor(InfeedDequeueTupleOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class InfeedDequeueTupleOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = InfeedDequeueTupleOpAdaptor; + template + using GenericAdaptor = InfeedDequeueTupleOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("_XlaSharding"), ::llvm::StringRef("dtypes"), ::llvm::StringRef("layouts"), ::llvm::StringRef("shapes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr get_XlaShardingAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr get_XlaShardingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDtypesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDtypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getLayoutsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getLayoutsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getShapesAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.InfeedDequeueTuple"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutputs(); + ::mlir::StringAttr get_XlaShardingAttr(); + ::std::optional< ::llvm::StringRef > get_XlaSharding(); + ::mlir::ArrayAttr getLayoutsAttr(); + ::std::optional< ::mlir::ArrayAttr > getLayouts(); + mlir::TF::ResultShapeRange getShapes(); + mlir::ResultElementTypeRange getDtypes(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void set_XlaShardingAttr(::mlir::StringAttr attr); + void set_XlaSharding(::std::optional<::llvm::StringRef> attrValue); + void setLayoutsAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute remove_XlaShardingAttr(); + ::mlir::Attribute removeLayoutsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outputs, /*optional*/::mlir::StringAttr _XlaSharding, /*optional*/::mlir::ArrayAttr layouts); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::InfeedDequeueTupleOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::InfeedEnqueueTupleOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class InfeedEnqueueTupleOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + InfeedEnqueueTupleOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + InfeedEnqueueTupleOpGenericAdaptorBase(InfeedEnqueueTupleOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getDtypesAttr(); + ::mlir::ArrayAttr getDtypes(); + ::mlir::ArrayAttr getShapesAttr(); + ::mlir::ArrayAttr getShapes(); + ::mlir::ArrayAttr getLayoutsAttr(); + ::mlir::ArrayAttr getLayouts(); + ::mlir::IntegerAttr getDeviceOrdinalAttr(); + uint64_t getDeviceOrdinal(); +}; +} // namespace detail +template +class InfeedEnqueueTupleOpGenericAdaptor : public detail::InfeedEnqueueTupleOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::InfeedEnqueueTupleOpGenericAdaptorBase; +public: + InfeedEnqueueTupleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + InfeedEnqueueTupleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : InfeedEnqueueTupleOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + InfeedEnqueueTupleOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class InfeedEnqueueTupleOpAdaptor : public InfeedEnqueueTupleOpGenericAdaptor<::mlir::ValueRange> { +public: + using InfeedEnqueueTupleOpGenericAdaptor::InfeedEnqueueTupleOpGenericAdaptor; + InfeedEnqueueTupleOpAdaptor(InfeedEnqueueTupleOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class InfeedEnqueueTupleOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = InfeedEnqueueTupleOpAdaptor; + template + using GenericAdaptor = InfeedEnqueueTupleOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("device_ordinal"), ::llvm::StringRef("dtypes"), ::llvm::StringRef("layouts"), ::llvm::StringRef("shapes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDeviceOrdinalAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDeviceOrdinalAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDtypesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDtypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getLayoutsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getLayoutsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getShapesAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.InfeedEnqueueTuple"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::MutableOperandRange getInputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::ArrayAttr getDtypesAttr(); + ::mlir::ArrayAttr getDtypes(); + ::mlir::ArrayAttr getShapesAttr(); + ::mlir::ArrayAttr getShapes(); + ::mlir::ArrayAttr getLayoutsAttr(); + ::mlir::ArrayAttr getLayouts(); + ::mlir::IntegerAttr getDeviceOrdinalAttr(); + uint64_t getDeviceOrdinal(); + void setDtypesAttr(::mlir::ArrayAttr attr); + void setShapesAttr(::mlir::ArrayAttr attr); + void setLayoutsAttr(::mlir::ArrayAttr attr); + void setDeviceOrdinalAttr(::mlir::IntegerAttr attr); + void setDeviceOrdinal(::std::optional attrValue); + ::mlir::Attribute removeLayoutsAttr(); + ::mlir::Attribute removeDeviceOrdinalAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange inputs, ::mlir::ArrayAttr dtypes, ::mlir::ArrayAttr shapes, /*optional*/::mlir::ArrayAttr layouts, /*optional*/::mlir::IntegerAttr device_ordinal); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::mlir::ArrayAttr dtypes, ::mlir::ArrayAttr shapes, /*optional*/::mlir::ArrayAttr layouts, /*optional*/::mlir::IntegerAttr device_ordinal); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange inputs, ::mlir::ArrayAttr dtypes, ::mlir::ArrayAttr shapes, /*optional*/::mlir::ArrayAttr layouts, /*optional*/uint64_t device_ordinal = -1); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::mlir::ArrayAttr dtypes, ::mlir::ArrayAttr shapes, /*optional*/::mlir::ArrayAttr layouts, /*optional*/uint64_t device_ordinal = -1); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::InfeedEnqueueTupleOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::InitializeTableFromDatasetOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class InitializeTableFromDatasetOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + InitializeTableFromDatasetOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + InitializeTableFromDatasetOpGenericAdaptorBase(InitializeTableFromDatasetOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class InitializeTableFromDatasetOpGenericAdaptor : public detail::InitializeTableFromDatasetOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::InitializeTableFromDatasetOpGenericAdaptorBase; +public: + InitializeTableFromDatasetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + InitializeTableFromDatasetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : InitializeTableFromDatasetOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + InitializeTableFromDatasetOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTableHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getDataset() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class InitializeTableFromDatasetOpAdaptor : public InitializeTableFromDatasetOpGenericAdaptor<::mlir::ValueRange> { +public: + using InitializeTableFromDatasetOpGenericAdaptor::InitializeTableFromDatasetOpGenericAdaptor; + InitializeTableFromDatasetOpAdaptor(InitializeTableFromDatasetOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class InitializeTableFromDatasetOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = InitializeTableFromDatasetOpAdaptor; + template + using GenericAdaptor = InitializeTableFromDatasetOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.InitializeTableFromDataset"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTableHandle(); + ::mlir::TypedValue<::mlir::TensorType> getDataset(); + ::mlir::OpOperand &getTableHandleMutable(); + ::mlir::OpOperand &getDatasetMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value table_handle, ::mlir::Value dataset); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value table_handle, ::mlir::Value dataset); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::InitializeTableFromDatasetOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::InitializeTableFromTextFileOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class InitializeTableFromTextFileOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + InitializeTableFromTextFileOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + InitializeTableFromTextFileOpGenericAdaptorBase(InitializeTableFromTextFileOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getKeyIndexAttr(); + uint64_t getKeyIndex(); + ::mlir::IntegerAttr getValueIndexAttr(); + uint64_t getValueIndex(); + ::mlir::IntegerAttr getVocabSizeAttr(); + uint64_t getVocabSize(); + ::mlir::StringAttr getDelimiterAttr(); + ::llvm::StringRef getDelimiter(); + ::mlir::IntegerAttr getOffsetAttr(); + uint64_t getOffset(); +}; +} // namespace detail +template +class InitializeTableFromTextFileOpGenericAdaptor : public detail::InitializeTableFromTextFileOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::InitializeTableFromTextFileOpGenericAdaptorBase; +public: + InitializeTableFromTextFileOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + InitializeTableFromTextFileOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : InitializeTableFromTextFileOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + InitializeTableFromTextFileOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTableHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getFilename() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class InitializeTableFromTextFileOpAdaptor : public InitializeTableFromTextFileOpGenericAdaptor<::mlir::ValueRange> { +public: + using InitializeTableFromTextFileOpGenericAdaptor::InitializeTableFromTextFileOpGenericAdaptor; + InitializeTableFromTextFileOpAdaptor(InitializeTableFromTextFileOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class InitializeTableFromTextFileOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = InitializeTableFromTextFileOpAdaptor; + template + using GenericAdaptor = InitializeTableFromTextFileOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("delimiter"), ::llvm::StringRef("key_index"), ::llvm::StringRef("offset"), ::llvm::StringRef("value_index"), ::llvm::StringRef("vocab_size")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDelimiterAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDelimiterAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getKeyIndexAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getKeyIndexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOffsetAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOffsetAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getValueIndexAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getValueIndexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getVocabSizeAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getVocabSizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.InitializeTableFromTextFile"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTableHandle(); + ::mlir::TypedValue<::mlir::TensorType> getFilename(); + ::mlir::OpOperand &getTableHandleMutable(); + ::mlir::OpOperand &getFilenameMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getKeyIndexAttr(); + uint64_t getKeyIndex(); + ::mlir::IntegerAttr getValueIndexAttr(); + uint64_t getValueIndex(); + ::mlir::IntegerAttr getVocabSizeAttr(); + uint64_t getVocabSize(); + ::mlir::StringAttr getDelimiterAttr(); + ::llvm::StringRef getDelimiter(); + ::mlir::IntegerAttr getOffsetAttr(); + uint64_t getOffset(); + void setKeyIndexAttr(::mlir::IntegerAttr attr); + void setKeyIndex(uint64_t attrValue); + void setValueIndexAttr(::mlir::IntegerAttr attr); + void setValueIndex(uint64_t attrValue); + void setVocabSizeAttr(::mlir::IntegerAttr attr); + void setVocabSize(::std::optional attrValue); + void setDelimiterAttr(::mlir::StringAttr attr); + void setDelimiter(::std::optional<::llvm::StringRef> attrValue); + void setOffsetAttr(::mlir::IntegerAttr attr); + void setOffset(::std::optional attrValue); + ::mlir::Attribute removeVocabSizeAttr(); + ::mlir::Attribute removeDelimiterAttr(); + ::mlir::Attribute removeOffsetAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value table_handle, ::mlir::Value filename, ::mlir::IntegerAttr key_index, ::mlir::IntegerAttr value_index, /*optional*/::mlir::IntegerAttr vocab_size, /*optional*/::mlir::StringAttr delimiter, /*optional*/::mlir::IntegerAttr offset); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value table_handle, ::mlir::Value filename, ::mlir::IntegerAttr key_index, ::mlir::IntegerAttr value_index, /*optional*/::mlir::IntegerAttr vocab_size, /*optional*/::mlir::StringAttr delimiter, /*optional*/::mlir::IntegerAttr offset); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value table_handle, ::mlir::Value filename, uint64_t key_index, uint64_t value_index, /*optional*/uint64_t vocab_size = -1, /*optional*/::llvm::StringRef delimiter = "\t", /*optional*/uint64_t offset = 0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value table_handle, ::mlir::Value filename, uint64_t key_index, uint64_t value_index, /*optional*/uint64_t vocab_size = -1, /*optional*/::llvm::StringRef delimiter = "\t", /*optional*/uint64_t offset = 0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::InitializeTableFromTextFileOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::InitializeTableFromTextFileV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class InitializeTableFromTextFileV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + InitializeTableFromTextFileV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + InitializeTableFromTextFileV2OpGenericAdaptorBase(InitializeTableFromTextFileV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getKeyIndexAttr(); + uint64_t getKeyIndex(); + ::mlir::IntegerAttr getValueIndexAttr(); + uint64_t getValueIndex(); + ::mlir::IntegerAttr getVocabSizeAttr(); + uint64_t getVocabSize(); + ::mlir::StringAttr getDelimiterAttr(); + ::llvm::StringRef getDelimiter(); + ::mlir::IntegerAttr getOffsetAttr(); + uint64_t getOffset(); +}; +} // namespace detail +template +class InitializeTableFromTextFileV2OpGenericAdaptor : public detail::InitializeTableFromTextFileV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::InitializeTableFromTextFileV2OpGenericAdaptorBase; +public: + InitializeTableFromTextFileV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + InitializeTableFromTextFileV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : InitializeTableFromTextFileV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + InitializeTableFromTextFileV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTableHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getFilename() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class InitializeTableFromTextFileV2OpAdaptor : public InitializeTableFromTextFileV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using InitializeTableFromTextFileV2OpGenericAdaptor::InitializeTableFromTextFileV2OpGenericAdaptor; + InitializeTableFromTextFileV2OpAdaptor(InitializeTableFromTextFileV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class InitializeTableFromTextFileV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = InitializeTableFromTextFileV2OpAdaptor; + template + using GenericAdaptor = InitializeTableFromTextFileV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("delimiter"), ::llvm::StringRef("key_index"), ::llvm::StringRef("offset"), ::llvm::StringRef("value_index"), ::llvm::StringRef("vocab_size")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDelimiterAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDelimiterAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getKeyIndexAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getKeyIndexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOffsetAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOffsetAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getValueIndexAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getValueIndexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getVocabSizeAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getVocabSizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.InitializeTableFromTextFileV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTableHandle(); + ::mlir::TypedValue<::mlir::TensorType> getFilename(); + ::mlir::OpOperand &getTableHandleMutable(); + ::mlir::OpOperand &getFilenameMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getKeyIndexAttr(); + uint64_t getKeyIndex(); + ::mlir::IntegerAttr getValueIndexAttr(); + uint64_t getValueIndex(); + ::mlir::IntegerAttr getVocabSizeAttr(); + uint64_t getVocabSize(); + ::mlir::StringAttr getDelimiterAttr(); + ::llvm::StringRef getDelimiter(); + ::mlir::IntegerAttr getOffsetAttr(); + uint64_t getOffset(); + void setKeyIndexAttr(::mlir::IntegerAttr attr); + void setKeyIndex(uint64_t attrValue); + void setValueIndexAttr(::mlir::IntegerAttr attr); + void setValueIndex(uint64_t attrValue); + void setVocabSizeAttr(::mlir::IntegerAttr attr); + void setVocabSize(::std::optional attrValue); + void setDelimiterAttr(::mlir::StringAttr attr); + void setDelimiter(::std::optional<::llvm::StringRef> attrValue); + void setOffsetAttr(::mlir::IntegerAttr attr); + void setOffset(::std::optional attrValue); + ::mlir::Attribute removeVocabSizeAttr(); + ::mlir::Attribute removeDelimiterAttr(); + ::mlir::Attribute removeOffsetAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value table_handle, ::mlir::Value filename, ::mlir::IntegerAttr key_index, ::mlir::IntegerAttr value_index, /*optional*/::mlir::IntegerAttr vocab_size, /*optional*/::mlir::StringAttr delimiter, /*optional*/::mlir::IntegerAttr offset); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value table_handle, ::mlir::Value filename, ::mlir::IntegerAttr key_index, ::mlir::IntegerAttr value_index, /*optional*/::mlir::IntegerAttr vocab_size, /*optional*/::mlir::StringAttr delimiter, /*optional*/::mlir::IntegerAttr offset); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value table_handle, ::mlir::Value filename, uint64_t key_index, uint64_t value_index, /*optional*/uint64_t vocab_size = -1, /*optional*/::llvm::StringRef delimiter = "\t", /*optional*/uint64_t offset = 0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value table_handle, ::mlir::Value filename, uint64_t key_index, uint64_t value_index, /*optional*/uint64_t vocab_size = -1, /*optional*/::llvm::StringRef delimiter = "\t", /*optional*/uint64_t offset = 0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::InitializeTableFromTextFileV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::InitializeTableOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class InitializeTableOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + InitializeTableOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + InitializeTableOpGenericAdaptorBase(InitializeTableOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class InitializeTableOpGenericAdaptor : public detail::InitializeTableOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::InitializeTableOpGenericAdaptorBase; +public: + InitializeTableOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + InitializeTableOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : InitializeTableOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + InitializeTableOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTableHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getKeys() { + return (*getODSOperands(1).begin()); + } + + ValueT getValues() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class InitializeTableOpAdaptor : public InitializeTableOpGenericAdaptor<::mlir::ValueRange> { +public: + using InitializeTableOpGenericAdaptor::InitializeTableOpGenericAdaptor; + InitializeTableOpAdaptor(InitializeTableOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class InitializeTableOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = InitializeTableOpAdaptor; + template + using GenericAdaptor = InitializeTableOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tkey"), ::llvm::StringRef("Tval")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTkeyAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTkeyAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTvalAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTvalAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.InitializeTable"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTableHandle(); + ::mlir::TypedValue<::mlir::TensorType> getKeys(); + ::mlir::TypedValue<::mlir::TensorType> getValues(); + ::mlir::OpOperand &getTableHandleMutable(); + ::mlir::OpOperand &getKeysMutable(); + ::mlir::OpOperand &getValuesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Type getTkey(); + ::mlir::Type getTval(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value table_handle, ::mlir::Value keys, ::mlir::Value values); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value table_handle, ::mlir::Value keys, ::mlir::Value values); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::InitializeTableOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::InitializeTableV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class InitializeTableV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + InitializeTableV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + InitializeTableV2OpGenericAdaptorBase(InitializeTableV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class InitializeTableV2OpGenericAdaptor : public detail::InitializeTableV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::InitializeTableV2OpGenericAdaptorBase; +public: + InitializeTableV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + InitializeTableV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : InitializeTableV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + InitializeTableV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTableHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getKeys() { + return (*getODSOperands(1).begin()); + } + + ValueT getValues() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class InitializeTableV2OpAdaptor : public InitializeTableV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using InitializeTableV2OpGenericAdaptor::InitializeTableV2OpGenericAdaptor; + InitializeTableV2OpAdaptor(InitializeTableV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class InitializeTableV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = InitializeTableV2OpAdaptor; + template + using GenericAdaptor = InitializeTableV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tkey"), ::llvm::StringRef("Tval")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTkeyAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTkeyAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTvalAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTvalAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.InitializeTableV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTableHandle(); + ::mlir::TypedValue<::mlir::TensorType> getKeys(); + ::mlir::TypedValue<::mlir::TensorType> getValues(); + ::mlir::OpOperand &getTableHandleMutable(); + ::mlir::OpOperand &getKeysMutable(); + ::mlir::OpOperand &getValuesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Type getTkey(); + ::mlir::Type getTval(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value table_handle, ::mlir::Value keys, ::mlir::Value values); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value table_handle, ::mlir::Value keys, ::mlir::Value values); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::InitializeTableV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::InplaceAddOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class InplaceAddOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + InplaceAddOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + InplaceAddOpGenericAdaptorBase(InplaceAddOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class InplaceAddOpGenericAdaptor : public detail::InplaceAddOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::InplaceAddOpGenericAdaptorBase; +public: + InplaceAddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + InplaceAddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : InplaceAddOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + InplaceAddOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getI() { + return (*getODSOperands(1).begin()); + } + + ValueT getV() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class InplaceAddOpAdaptor : public InplaceAddOpGenericAdaptor<::mlir::ValueRange> { +public: + using InplaceAddOpGenericAdaptor::InplaceAddOpGenericAdaptor; + InplaceAddOpAdaptor(InplaceAddOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class InplaceAddOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = InplaceAddOpAdaptor; + template + using GenericAdaptor = InplaceAddOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.InplaceAdd"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getI(); + ::mlir::TypedValue<::mlir::TensorType> getV(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getIMutable(); + ::mlir::OpOperand &getVMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x, ::mlir::Value i, ::mlir::Value v); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value i, ::mlir::Value v); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::InplaceAddOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::InplaceUpdateOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class InplaceUpdateOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + InplaceUpdateOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + InplaceUpdateOpGenericAdaptorBase(InplaceUpdateOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class InplaceUpdateOpGenericAdaptor : public detail::InplaceUpdateOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::InplaceUpdateOpGenericAdaptorBase; +public: + InplaceUpdateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + InplaceUpdateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : InplaceUpdateOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + InplaceUpdateOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getI() { + return (*getODSOperands(1).begin()); + } + + ValueT getV() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class InplaceUpdateOpAdaptor : public InplaceUpdateOpGenericAdaptor<::mlir::ValueRange> { +public: + using InplaceUpdateOpGenericAdaptor::InplaceUpdateOpGenericAdaptor; + InplaceUpdateOpAdaptor(InplaceUpdateOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class InplaceUpdateOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = InplaceUpdateOpAdaptor; + template + using GenericAdaptor = InplaceUpdateOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.InplaceUpdate"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getI(); + ::mlir::TypedValue<::mlir::TensorType> getV(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getIMutable(); + ::mlir::OpOperand &getVMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x, ::mlir::Value i, ::mlir::Value v); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value i, ::mlir::Value v); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::InplaceUpdateOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::InvOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class InvOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + InvOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + InvOpGenericAdaptorBase(InvOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class InvOpGenericAdaptor : public detail::InvOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::InvOpGenericAdaptorBase; +public: + InvOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + InvOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : InvOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + InvOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class InvOpAdaptor : public InvOpGenericAdaptor<::mlir::ValueRange> { +public: + using InvOpGenericAdaptor::InvOpGenericAdaptor; + InvOpAdaptor(InvOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class InvOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = InvOpAdaptor; + template + using GenericAdaptor = InvOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Inv"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::InvOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::InvertOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class InvertOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + InvertOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + InvertOpGenericAdaptorBase(InvertOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class InvertOpGenericAdaptor : public detail::InvertOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::InvertOpGenericAdaptorBase; +public: + InvertOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + InvertOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : InvertOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + InvertOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class InvertOpAdaptor : public InvertOpGenericAdaptor<::mlir::ValueRange> { +public: + using InvertOpGenericAdaptor::InvertOpGenericAdaptor; + InvertOpAdaptor(InvertOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class InvertOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::IsInvolution, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = InvertOpAdaptor; + template + using GenericAdaptor = InvertOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Invert"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::InvertOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::InvertPermutationOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class InvertPermutationOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + InvertPermutationOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + InvertPermutationOpGenericAdaptorBase(InvertPermutationOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class InvertPermutationOpGenericAdaptor : public detail::InvertPermutationOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::InvertPermutationOpGenericAdaptorBase; +public: + InvertPermutationOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + InvertPermutationOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : InvertPermutationOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + InvertPermutationOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class InvertPermutationOpAdaptor : public InvertPermutationOpGenericAdaptor<::mlir::ValueRange> { +public: + using InvertPermutationOpGenericAdaptor::InvertPermutationOpGenericAdaptor; + InvertPermutationOpAdaptor(InvertPermutationOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class InvertPermutationOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = InvertPermutationOpAdaptor; + template + using GenericAdaptor = InvertPermutationOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.InvertPermutation"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::InvertPermutationOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::IsFiniteOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IsFiniteOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IsFiniteOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IsFiniteOpGenericAdaptorBase(IsFiniteOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class IsFiniteOpGenericAdaptor : public detail::IsFiniteOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IsFiniteOpGenericAdaptorBase; +public: + IsFiniteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IsFiniteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IsFiniteOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IsFiniteOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IsFiniteOpAdaptor : public IsFiniteOpGenericAdaptor<::mlir::ValueRange> { +public: + using IsFiniteOpGenericAdaptor::IsFiniteOpGenericAdaptor; + IsFiniteOpAdaptor(IsFiniteOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IsFiniteOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = IsFiniteOpAdaptor; + template + using GenericAdaptor = IsFiniteOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.IsFinite"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::IsFiniteOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::IsInfOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IsInfOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IsInfOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IsInfOpGenericAdaptorBase(IsInfOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class IsInfOpGenericAdaptor : public detail::IsInfOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IsInfOpGenericAdaptorBase; +public: + IsInfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IsInfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IsInfOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IsInfOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IsInfOpAdaptor : public IsInfOpGenericAdaptor<::mlir::ValueRange> { +public: + using IsInfOpGenericAdaptor::IsInfOpGenericAdaptor; + IsInfOpAdaptor(IsInfOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IsInfOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = IsInfOpAdaptor; + template + using GenericAdaptor = IsInfOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.IsInf"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::IsInfOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::IsNanOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IsNanOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IsNanOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IsNanOpGenericAdaptorBase(IsNanOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class IsNanOpGenericAdaptor : public detail::IsNanOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IsNanOpGenericAdaptorBase; +public: + IsNanOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IsNanOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IsNanOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IsNanOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IsNanOpAdaptor : public IsNanOpGenericAdaptor<::mlir::ValueRange> { +public: + using IsNanOpGenericAdaptor::IsNanOpGenericAdaptor; + IsNanOpAdaptor(IsNanOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IsNanOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = IsNanOpAdaptor; + template + using GenericAdaptor = IsNanOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.IsNan"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::IsNanOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::IteratorFromStringHandleOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IteratorFromStringHandleOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IteratorFromStringHandleOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IteratorFromStringHandleOpGenericAdaptorBase(IteratorFromStringHandleOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); +}; +} // namespace detail +template +class IteratorFromStringHandleOpGenericAdaptor : public detail::IteratorFromStringHandleOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IteratorFromStringHandleOpGenericAdaptorBase; +public: + IteratorFromStringHandleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IteratorFromStringHandleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IteratorFromStringHandleOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IteratorFromStringHandleOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getStringHandle() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IteratorFromStringHandleOpAdaptor : public IteratorFromStringHandleOpGenericAdaptor<::mlir::ValueRange> { +public: + using IteratorFromStringHandleOpGenericAdaptor::IteratorFromStringHandleOpGenericAdaptor; + IteratorFromStringHandleOpAdaptor(IteratorFromStringHandleOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IteratorFromStringHandleOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = IteratorFromStringHandleOpAdaptor; + template + using GenericAdaptor = IteratorFromStringHandleOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.IteratorFromStringHandle"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getStringHandle(); + ::mlir::OpOperand &getStringHandleMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResourceHandle(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeOutputTypesAttr(); + ::mlir::Attribute removeOutputShapesAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resource_handle, ::mlir::Value string_handle, /*optional*/::mlir::ArrayAttr output_types, /*optional*/::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value string_handle, /*optional*/::mlir::ArrayAttr output_types, /*optional*/::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::IteratorFromStringHandleOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::IteratorFromStringHandleV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IteratorFromStringHandleV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IteratorFromStringHandleV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IteratorFromStringHandleV2OpGenericAdaptorBase(IteratorFromStringHandleV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); +}; +} // namespace detail +template +class IteratorFromStringHandleV2OpGenericAdaptor : public detail::IteratorFromStringHandleV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IteratorFromStringHandleV2OpGenericAdaptorBase; +public: + IteratorFromStringHandleV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IteratorFromStringHandleV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IteratorFromStringHandleV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IteratorFromStringHandleV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getStringHandle() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IteratorFromStringHandleV2OpAdaptor : public IteratorFromStringHandleV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using IteratorFromStringHandleV2OpGenericAdaptor::IteratorFromStringHandleV2OpGenericAdaptor; + IteratorFromStringHandleV2OpAdaptor(IteratorFromStringHandleV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IteratorFromStringHandleV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = IteratorFromStringHandleV2OpAdaptor; + template + using GenericAdaptor = IteratorFromStringHandleV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.IteratorFromStringHandleV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getStringHandle(); + ::mlir::OpOperand &getStringHandleMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResourceHandle(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeOutputTypesAttr(); + ::mlir::Attribute removeOutputShapesAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resource_handle, ::mlir::Value string_handle, /*optional*/::mlir::ArrayAttr output_types, /*optional*/::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value string_handle, /*optional*/::mlir::ArrayAttr output_types, /*optional*/::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::IteratorFromStringHandleV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::IteratorGetNextAsOptionalOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IteratorGetNextAsOptionalOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IteratorGetNextAsOptionalOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IteratorGetNextAsOptionalOpGenericAdaptorBase(IteratorGetNextAsOptionalOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); +}; +} // namespace detail +template +class IteratorGetNextAsOptionalOpGenericAdaptor : public detail::IteratorGetNextAsOptionalOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IteratorGetNextAsOptionalOpGenericAdaptorBase; +public: + IteratorGetNextAsOptionalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IteratorGetNextAsOptionalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IteratorGetNextAsOptionalOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IteratorGetNextAsOptionalOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIterator() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IteratorGetNextAsOptionalOpAdaptor : public IteratorGetNextAsOptionalOpGenericAdaptor<::mlir::ValueRange> { +public: + using IteratorGetNextAsOptionalOpGenericAdaptor::IteratorGetNextAsOptionalOpGenericAdaptor; + IteratorGetNextAsOptionalOpAdaptor(IteratorGetNextAsOptionalOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IteratorGetNextAsOptionalOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = IteratorGetNextAsOptionalOpAdaptor; + template + using GenericAdaptor = IteratorGetNextAsOptionalOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.IteratorGetNextAsOptional"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getIterator(); + ::mlir::OpOperand &getIteratorMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOptional(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type optional, ::mlir::Value iterator, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value iterator, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::IteratorGetNextAsOptionalOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::IteratorGetNextOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IteratorGetNextOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IteratorGetNextOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IteratorGetNextOpGenericAdaptorBase(IteratorGetNextOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class IteratorGetNextOpGenericAdaptor : public detail::IteratorGetNextOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IteratorGetNextOpGenericAdaptorBase; +public: + IteratorGetNextOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IteratorGetNextOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IteratorGetNextOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IteratorGetNextOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIterator() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IteratorGetNextOpAdaptor : public IteratorGetNextOpGenericAdaptor<::mlir::ValueRange> { +public: + using IteratorGetNextOpGenericAdaptor::IteratorGetNextOpGenericAdaptor; + IteratorGetNextOpAdaptor(IteratorGetNextOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IteratorGetNextOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = IteratorGetNextOpAdaptor; + template + using GenericAdaptor = IteratorGetNextOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.IteratorGetNext"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getIterator(); + ::mlir::OpOperand &getIteratorMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getComponents(); + mlir::TF::ResultShapeRange getOutputShapes(); + mlir::ResultElementTypeRange getOutputTypes(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange components, ::mlir::Value iterator); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::IteratorGetNextOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::IteratorGetNextSyncOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IteratorGetNextSyncOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IteratorGetNextSyncOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IteratorGetNextSyncOpGenericAdaptorBase(IteratorGetNextSyncOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class IteratorGetNextSyncOpGenericAdaptor : public detail::IteratorGetNextSyncOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IteratorGetNextSyncOpGenericAdaptorBase; +public: + IteratorGetNextSyncOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IteratorGetNextSyncOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IteratorGetNextSyncOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IteratorGetNextSyncOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIterator() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IteratorGetNextSyncOpAdaptor : public IteratorGetNextSyncOpGenericAdaptor<::mlir::ValueRange> { +public: + using IteratorGetNextSyncOpGenericAdaptor::IteratorGetNextSyncOpGenericAdaptor; + IteratorGetNextSyncOpAdaptor(IteratorGetNextSyncOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IteratorGetNextSyncOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = IteratorGetNextSyncOpAdaptor; + template + using GenericAdaptor = IteratorGetNextSyncOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.IteratorGetNextSync"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getIterator(); + ::mlir::OpOperand &getIteratorMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getComponents(); + mlir::TF::ResultShapeRange getOutputShapes(); + mlir::ResultElementTypeRange getOutputTypes(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange components, ::mlir::Value iterator); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::IteratorGetNextSyncOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::IteratorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IteratorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IteratorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IteratorOpGenericAdaptorBase(IteratorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getSharedNameAttr(); + ::llvm::StringRef getSharedName(); + ::mlir::StringAttr getContainerAttr(); + ::llvm::StringRef getContainer(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); +}; +} // namespace detail +template +class IteratorOpGenericAdaptor : public detail::IteratorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IteratorOpGenericAdaptorBase; +public: + IteratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IteratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IteratorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IteratorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IteratorOpAdaptor : public IteratorOpGenericAdaptor<::mlir::ValueRange> { +public: + using IteratorOpGenericAdaptor::IteratorOpGenericAdaptor; + IteratorOpAdaptor(IteratorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IteratorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = IteratorOpAdaptor; + template + using GenericAdaptor = IteratorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("container"), ::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types"), ::llvm::StringRef("shared_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getContainerAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getContainerAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSharedNameAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSharedNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Iterator"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::StringAttr getSharedNameAttr(); + ::llvm::StringRef getSharedName(); + ::mlir::StringAttr getContainerAttr(); + ::llvm::StringRef getContainer(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + void setSharedNameAttr(::mlir::StringAttr attr); + void setSharedName(::llvm::StringRef attrValue); + void setContainerAttr(::mlir::StringAttr attr); + void setContainer(::llvm::StringRef attrValue); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::StringAttr shared_name, ::mlir::StringAttr container, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr shared_name, ::mlir::StringAttr container, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::llvm::StringRef shared_name, ::llvm::StringRef container, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef shared_name, ::llvm::StringRef container, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::IteratorOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::IteratorToStringHandleOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IteratorToStringHandleOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IteratorToStringHandleOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IteratorToStringHandleOpGenericAdaptorBase(IteratorToStringHandleOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class IteratorToStringHandleOpGenericAdaptor : public detail::IteratorToStringHandleOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IteratorToStringHandleOpGenericAdaptorBase; +public: + IteratorToStringHandleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IteratorToStringHandleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IteratorToStringHandleOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IteratorToStringHandleOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getResourceHandle() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IteratorToStringHandleOpAdaptor : public IteratorToStringHandleOpGenericAdaptor<::mlir::ValueRange> { +public: + using IteratorToStringHandleOpGenericAdaptor::IteratorToStringHandleOpGenericAdaptor; + IteratorToStringHandleOpAdaptor(IteratorToStringHandleOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IteratorToStringHandleOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = IteratorToStringHandleOpAdaptor; + template + using GenericAdaptor = IteratorToStringHandleOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.IteratorToStringHandle"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResourceHandle(); + ::mlir::OpOperand &getResourceHandleMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getStringHandle(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type string_handle, ::mlir::Value resource_handle); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value resource_handle); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::IteratorToStringHandleOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::IteratorV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IteratorV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IteratorV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IteratorV2OpGenericAdaptorBase(IteratorV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getSharedNameAttr(); + ::llvm::StringRef getSharedName(); + ::mlir::StringAttr getContainerAttr(); + ::llvm::StringRef getContainer(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); +}; +} // namespace detail +template +class IteratorV2OpGenericAdaptor : public detail::IteratorV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IteratorV2OpGenericAdaptorBase; +public: + IteratorV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IteratorV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IteratorV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IteratorV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IteratorV2OpAdaptor : public IteratorV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using IteratorV2OpGenericAdaptor::IteratorV2OpGenericAdaptor; + IteratorV2OpAdaptor(IteratorV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IteratorV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = IteratorV2OpAdaptor; + template + using GenericAdaptor = IteratorV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("container"), ::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types"), ::llvm::StringRef("shared_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getContainerAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getContainerAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSharedNameAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSharedNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.IteratorV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::StringAttr getSharedNameAttr(); + ::llvm::StringRef getSharedName(); + ::mlir::StringAttr getContainerAttr(); + ::llvm::StringRef getContainer(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + void setSharedNameAttr(::mlir::StringAttr attr); + void setSharedName(::llvm::StringRef attrValue); + void setContainerAttr(::mlir::StringAttr attr); + void setContainer(::llvm::StringRef attrValue); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::StringAttr shared_name, ::mlir::StringAttr container, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr shared_name, ::mlir::StringAttr container, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::llvm::StringRef shared_name, ::llvm::StringRef container, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef shared_name, ::llvm::StringRef container, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::IteratorV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::KthOrderStatisticOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class KthOrderStatisticOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + KthOrderStatisticOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + KthOrderStatisticOpGenericAdaptorBase(KthOrderStatisticOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getKAttr(); + uint64_t getK(); +}; +} // namespace detail +template +class KthOrderStatisticOpGenericAdaptor : public detail::KthOrderStatisticOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::KthOrderStatisticOpGenericAdaptorBase; +public: + KthOrderStatisticOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + KthOrderStatisticOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : KthOrderStatisticOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + KthOrderStatisticOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class KthOrderStatisticOpAdaptor : public KthOrderStatisticOpGenericAdaptor<::mlir::ValueRange> { +public: + using KthOrderStatisticOpGenericAdaptor::KthOrderStatisticOpGenericAdaptor; + KthOrderStatisticOpAdaptor(KthOrderStatisticOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class KthOrderStatisticOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = KthOrderStatisticOpAdaptor; + template + using GenericAdaptor = KthOrderStatisticOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("k")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getKAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getKAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.KthOrderStatistic"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getKAttr(); + uint64_t getK(); + void setKAttr(::mlir::IntegerAttr attr); + void setK(uint64_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::IntegerAttr k); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::IntegerAttr k); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, uint64_t k); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, uint64_t k); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::KthOrderStatisticOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::L2LossOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class L2LossOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + L2LossOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + L2LossOpGenericAdaptorBase(L2LossOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class L2LossOpGenericAdaptor : public detail::L2LossOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::L2LossOpGenericAdaptorBase; +public: + L2LossOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + L2LossOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : L2LossOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + L2LossOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class L2LossOpAdaptor : public L2LossOpGenericAdaptor<::mlir::ValueRange> { +public: + using L2LossOpGenericAdaptor::L2LossOpGenericAdaptor; + L2LossOpAdaptor(L2LossOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class L2LossOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = L2LossOpAdaptor; + template + using GenericAdaptor = L2LossOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.L2Loss"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::L2LossOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LRNGradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LRNGradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LRNGradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LRNGradOpGenericAdaptorBase(LRNGradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getDepthRadiusAttr(); + uint64_t getDepthRadius(); + ::mlir::FloatAttr getBiasAttr(); + ::llvm::APFloat getBias(); + ::mlir::FloatAttr getAlphaAttr(); + ::llvm::APFloat getAlpha(); + ::mlir::FloatAttr getBetaAttr(); + ::llvm::APFloat getBeta(); +}; +} // namespace detail +template +class LRNGradOpGenericAdaptor : public detail::LRNGradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LRNGradOpGenericAdaptorBase; +public: + LRNGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LRNGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LRNGradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LRNGradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputGrads() { + return (*getODSOperands(0).begin()); + } + + ValueT getInputImage() { + return (*getODSOperands(1).begin()); + } + + ValueT getOutputImage() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LRNGradOpAdaptor : public LRNGradOpGenericAdaptor<::mlir::ValueRange> { +public: + using LRNGradOpGenericAdaptor::LRNGradOpGenericAdaptor; + LRNGradOpAdaptor(LRNGradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LRNGradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LRNGradOpAdaptor; + template + using GenericAdaptor = LRNGradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("alpha"), ::llvm::StringRef("beta"), ::llvm::StringRef("bias"), ::llvm::StringRef("depth_radius")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAlphaAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAlphaAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getBetaAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getBetaAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getBiasAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getBiasAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getDepthRadiusAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getDepthRadiusAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LRNGrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputGrads(); + ::mlir::TypedValue<::mlir::TensorType> getInputImage(); + ::mlir::TypedValue<::mlir::TensorType> getOutputImage(); + ::mlir::OpOperand &getInputGradsMutable(); + ::mlir::OpOperand &getInputImageMutable(); + ::mlir::OpOperand &getOutputImageMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getDepthRadiusAttr(); + uint64_t getDepthRadius(); + ::mlir::FloatAttr getBiasAttr(); + ::llvm::APFloat getBias(); + ::mlir::FloatAttr getAlphaAttr(); + ::llvm::APFloat getAlpha(); + ::mlir::FloatAttr getBetaAttr(); + ::llvm::APFloat getBeta(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setDepthRadiusAttr(::mlir::IntegerAttr attr); + void setDepthRadius(::std::optional attrValue); + void setBiasAttr(::mlir::FloatAttr attr); + void setBias(::std::optional<::llvm::APFloat> attrValue); + void setAlphaAttr(::mlir::FloatAttr attr); + void setAlpha(::std::optional<::llvm::APFloat> attrValue); + void setBetaAttr(::mlir::FloatAttr attr); + void setBeta(::std::optional<::llvm::APFloat> attrValue); + ::mlir::Attribute removeDepthRadiusAttr(); + ::mlir::Attribute removeBiasAttr(); + ::mlir::Attribute removeAlphaAttr(); + ::mlir::Attribute removeBetaAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input_grads, ::mlir::Value input_image, ::mlir::Value output_image, /*optional*/::mlir::IntegerAttr depth_radius, /*optional*/::mlir::FloatAttr bias, /*optional*/::mlir::FloatAttr alpha, /*optional*/::mlir::FloatAttr beta); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_grads, ::mlir::Value input_image, ::mlir::Value output_image, /*optional*/::mlir::IntegerAttr depth_radius, /*optional*/::mlir::FloatAttr bias, /*optional*/::mlir::FloatAttr alpha, /*optional*/::mlir::FloatAttr beta); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input_grads, ::mlir::Value input_image, ::mlir::Value output_image, /*optional*/uint64_t depth_radius, /*optional*/::llvm::APFloat bias, /*optional*/::llvm::APFloat alpha, /*optional*/::llvm::APFloat beta); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_grads, ::mlir::Value input_image, ::mlir::Value output_image, /*optional*/uint64_t depth_radius, /*optional*/::llvm::APFloat bias, /*optional*/::llvm::APFloat alpha, /*optional*/::llvm::APFloat beta); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LRNGradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LRNOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LRNOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LRNOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LRNOpGenericAdaptorBase(LRNOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getDepthRadiusAttr(); + uint64_t getDepthRadius(); + ::mlir::FloatAttr getBiasAttr(); + ::llvm::APFloat getBias(); + ::mlir::FloatAttr getAlphaAttr(); + ::llvm::APFloat getAlpha(); + ::mlir::FloatAttr getBetaAttr(); + ::llvm::APFloat getBeta(); +}; +} // namespace detail +template +class LRNOpGenericAdaptor : public detail::LRNOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LRNOpGenericAdaptorBase; +public: + LRNOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LRNOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LRNOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LRNOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LRNOpAdaptor : public LRNOpGenericAdaptor<::mlir::ValueRange> { +public: + using LRNOpGenericAdaptor::LRNOpGenericAdaptor; + LRNOpAdaptor(LRNOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LRNOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LRNOpAdaptor; + template + using GenericAdaptor = LRNOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("alpha"), ::llvm::StringRef("beta"), ::llvm::StringRef("bias"), ::llvm::StringRef("depth_radius")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAlphaAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAlphaAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getBetaAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getBetaAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getBiasAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getBiasAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getDepthRadiusAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getDepthRadiusAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LRN"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getDepthRadiusAttr(); + uint64_t getDepthRadius(); + ::mlir::FloatAttr getBiasAttr(); + ::llvm::APFloat getBias(); + ::mlir::FloatAttr getAlphaAttr(); + ::llvm::APFloat getAlpha(); + ::mlir::FloatAttr getBetaAttr(); + ::llvm::APFloat getBeta(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setDepthRadiusAttr(::mlir::IntegerAttr attr); + void setDepthRadius(::std::optional attrValue); + void setBiasAttr(::mlir::FloatAttr attr); + void setBias(::std::optional<::llvm::APFloat> attrValue); + void setAlphaAttr(::mlir::FloatAttr attr); + void setAlpha(::std::optional<::llvm::APFloat> attrValue); + void setBetaAttr(::mlir::FloatAttr attr); + void setBeta(::std::optional<::llvm::APFloat> attrValue); + ::mlir::Attribute removeDepthRadiusAttr(); + ::mlir::Attribute removeBiasAttr(); + ::mlir::Attribute removeAlphaAttr(); + ::mlir::Attribute removeBetaAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, /*optional*/::mlir::IntegerAttr depth_radius, /*optional*/::mlir::FloatAttr bias, /*optional*/::mlir::FloatAttr alpha, /*optional*/::mlir::FloatAttr beta); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, /*optional*/::mlir::IntegerAttr depth_radius, /*optional*/::mlir::FloatAttr bias, /*optional*/::mlir::FloatAttr alpha, /*optional*/::mlir::FloatAttr beta); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, /*optional*/uint64_t depth_radius, /*optional*/::llvm::APFloat bias, /*optional*/::llvm::APFloat alpha, /*optional*/::llvm::APFloat beta); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, /*optional*/uint64_t depth_radius, /*optional*/::llvm::APFloat bias, /*optional*/::llvm::APFloat alpha, /*optional*/::llvm::APFloat beta); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LRNOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LeakyReluGradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LeakyReluGradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LeakyReluGradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LeakyReluGradOpGenericAdaptorBase(LeakyReluGradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::FloatAttr getAlphaAttr(); + ::llvm::APFloat getAlpha(); +}; +} // namespace detail +template +class LeakyReluGradOpGenericAdaptor : public detail::LeakyReluGradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LeakyReluGradOpGenericAdaptorBase; +public: + LeakyReluGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LeakyReluGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LeakyReluGradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LeakyReluGradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getGradients() { + return (*getODSOperands(0).begin()); + } + + ValueT getFeatures() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LeakyReluGradOpAdaptor : public LeakyReluGradOpGenericAdaptor<::mlir::ValueRange> { +public: + using LeakyReluGradOpGenericAdaptor::LeakyReluGradOpGenericAdaptor; + LeakyReluGradOpAdaptor(LeakyReluGradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LeakyReluGradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LeakyReluGradOpAdaptor; + template + using GenericAdaptor = LeakyReluGradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("alpha")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAlphaAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAlphaAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LeakyReluGrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getGradients(); + ::mlir::TypedValue<::mlir::TensorType> getFeatures(); + ::mlir::OpOperand &getGradientsMutable(); + ::mlir::OpOperand &getFeaturesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getBackprops(); + ::mlir::FloatAttr getAlphaAttr(); + ::llvm::APFloat getAlpha(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setAlphaAttr(::mlir::FloatAttr attr); + void setAlpha(::std::optional<::llvm::APFloat> attrValue); + ::mlir::Attribute removeAlphaAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type backprops, ::mlir::Value gradients, ::mlir::Value features, /*optional*/::mlir::FloatAttr alpha); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value gradients, ::mlir::Value features, /*optional*/::mlir::FloatAttr alpha); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value gradients, ::mlir::Value features, /*optional*/::mlir::FloatAttr alpha); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type backprops, ::mlir::Value gradients, ::mlir::Value features, /*optional*/::llvm::APFloat alpha); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value gradients, ::mlir::Value features, /*optional*/::llvm::APFloat alpha); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value gradients, ::mlir::Value features, /*optional*/::llvm::APFloat alpha); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LeakyReluGradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LeakyReluOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LeakyReluOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LeakyReluOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LeakyReluOpGenericAdaptorBase(LeakyReluOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::FloatAttr getAlphaAttr(); + ::llvm::APFloat getAlpha(); +}; +} // namespace detail +template +class LeakyReluOpGenericAdaptor : public detail::LeakyReluOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LeakyReluOpGenericAdaptorBase; +public: + LeakyReluOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LeakyReluOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LeakyReluOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LeakyReluOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getFeatures() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LeakyReluOpAdaptor : public LeakyReluOpGenericAdaptor<::mlir::ValueRange> { +public: + using LeakyReluOpGenericAdaptor::LeakyReluOpGenericAdaptor; + LeakyReluOpAdaptor(LeakyReluOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LeakyReluOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LeakyReluOpAdaptor; + template + using GenericAdaptor = LeakyReluOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("alpha")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAlphaAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAlphaAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LeakyRelu"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getFeatures(); + ::mlir::OpOperand &getFeaturesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getActivations(); + ::mlir::FloatAttr getAlphaAttr(); + ::llvm::APFloat getAlpha(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setAlphaAttr(::mlir::FloatAttr attr); + void setAlpha(::std::optional<::llvm::APFloat> attrValue); + ::mlir::Attribute removeAlphaAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type activations, ::mlir::Value features, /*optional*/::mlir::FloatAttr alpha); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value features, /*optional*/::mlir::FloatAttr alpha); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value features, /*optional*/::mlir::FloatAttr alpha); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type activations, ::mlir::Value features, /*optional*/::llvm::APFloat alpha); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value features, /*optional*/::llvm::APFloat alpha); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value features, /*optional*/::llvm::APFloat alpha); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LeakyReluOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LeftShiftOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LeftShiftOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LeftShiftOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LeftShiftOpGenericAdaptorBase(LeftShiftOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class LeftShiftOpGenericAdaptor : public detail::LeftShiftOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LeftShiftOpGenericAdaptorBase; +public: + LeftShiftOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LeftShiftOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LeftShiftOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LeftShiftOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LeftShiftOpAdaptor : public LeftShiftOpGenericAdaptor<::mlir::ValueRange> { +public: + using LeftShiftOpGenericAdaptor::LeftShiftOpGenericAdaptor; + LeftShiftOpAdaptor(LeftShiftOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LeftShiftOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LeftShiftOpAdaptor; + template + using GenericAdaptor = LeftShiftOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LeftShift"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LeftShiftOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LegacyCallOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LegacyCallOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LegacyCallOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LegacyCallOpGenericAdaptorBase(LegacyCallOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::FlatSymbolRefAttr getFAttr(); + ::llvm::StringRef getF(); + ::mlir::BoolAttr get_disableCallShapeInferenceAttr(); + bool get_disableCallShapeInference(); +}; +} // namespace detail +template +class LegacyCallOpGenericAdaptor : public detail::LegacyCallOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LegacyCallOpGenericAdaptorBase; +public: + LegacyCallOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LegacyCallOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LegacyCallOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LegacyCallOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LegacyCallOpAdaptor : public LegacyCallOpGenericAdaptor<::mlir::ValueRange> { +public: + using LegacyCallOpGenericAdaptor::LegacyCallOpGenericAdaptor; + LegacyCallOpAdaptor(LegacyCallOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LegacyCallOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = LegacyCallOpAdaptor; + template + using GenericAdaptor = LegacyCallOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("_disable_call_shape_inference"), ::llvm::StringRef("f")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr get_disableCallShapeInferenceAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr get_disableCallShapeInferenceAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getFAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getFAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LegacyCall"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutput(); + ::mlir::FlatSymbolRefAttr getFAttr(); + ::llvm::StringRef getF(); + ::mlir::BoolAttr get_disableCallShapeInferenceAttr(); + bool get_disableCallShapeInference(); + void setFAttr(::mlir::FlatSymbolRefAttr attr); + void setF(::llvm::StringRef attrValue); + void set_disableCallShapeInferenceAttr(::mlir::BoolAttr attr); + void set_disableCallShapeInference(::std::optional attrValue); + ::mlir::Attribute remove_disableCallShapeInferenceAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::ValueRange args, ::mlir::FlatSymbolRefAttr f, /*optional*/::mlir::BoolAttr _disable_call_shape_inference); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::ValueRange args, ::llvm::StringRef f, /*optional*/bool _disable_call_shape_inference = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verifySymbolUses(::mlir::SymbolTableCollection &symbolTable); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Gets the argument operands to the called function. + operand_range getArgOperands() { return getArgs(); } + MutableOperandRange getArgOperandsMutable() { + return getArgsMutable(); + } + + // Returns the callee of this operation. + CallInterfaceCallable getCallableForCallee() { return getFAttr(); } + // Sets the callee from the callable + void setCalleeFromCallable(::mlir::CallInterfaceCallable callee); + + // Returns the resolved callee function of this operation. + // Prefer passing in SymbolTableCollection to reduce lookup costs by + // enabling reusing cached symbol table lookup. + func::FuncOp ResolveFunc(::mlir::SymbolTableCollection* table) { + if (table) + return table->lookupNearestSymbolFrom(*this, getFAttr()); + return SymbolTable::lookupNearestSymbolFrom(*this, getFAttr()); + } + // TODO(b/204997177): Deprecate and remove. + func::FuncOp func() { return ResolveFunc(nullptr); } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LegacyCallOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LessEqualOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LessEqualOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LessEqualOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LessEqualOpGenericAdaptorBase(LessEqualOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class LessEqualOpGenericAdaptor : public detail::LessEqualOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LessEqualOpGenericAdaptorBase; +public: + LessEqualOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LessEqualOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LessEqualOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LessEqualOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LessEqualOpAdaptor : public LessEqualOpGenericAdaptor<::mlir::ValueRange> { +public: + using LessEqualOpGenericAdaptor::LessEqualOpGenericAdaptor; + LessEqualOpAdaptor(LessEqualOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LessEqualOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LessEqualOpAdaptor; + template + using GenericAdaptor = LessEqualOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LessEqual"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LessEqualOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LessOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LessOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LessOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LessOpGenericAdaptorBase(LessOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class LessOpGenericAdaptor : public detail::LessOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LessOpGenericAdaptorBase; +public: + LessOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LessOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LessOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LessOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LessOpAdaptor : public LessOpGenericAdaptor<::mlir::ValueRange> { +public: + using LessOpGenericAdaptor::LessOpGenericAdaptor; + LessOpAdaptor(LessOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LessOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LessOpAdaptor; + template + using GenericAdaptor = LessOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Less"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LessOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LgammaOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LgammaOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LgammaOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LgammaOpGenericAdaptorBase(LgammaOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class LgammaOpGenericAdaptor : public detail::LgammaOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LgammaOpGenericAdaptorBase; +public: + LgammaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LgammaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LgammaOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LgammaOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LgammaOpAdaptor : public LgammaOpGenericAdaptor<::mlir::ValueRange> { +public: + using LgammaOpGenericAdaptor::LgammaOpGenericAdaptor; + LgammaOpAdaptor(LgammaOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LgammaOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LgammaOpAdaptor; + template + using GenericAdaptor = LgammaOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Lgamma"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LgammaOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LinSpaceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LinSpaceOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LinSpaceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LinSpaceOpGenericAdaptorBase(LinSpaceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class LinSpaceOpGenericAdaptor : public detail::LinSpaceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LinSpaceOpGenericAdaptorBase; +public: + LinSpaceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LinSpaceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LinSpaceOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LinSpaceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getStart() { + return (*getODSOperands(0).begin()); + } + + ValueT getStop() { + return (*getODSOperands(1).begin()); + } + + ValueT getNum() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LinSpaceOpAdaptor : public LinSpaceOpGenericAdaptor<::mlir::ValueRange> { +public: + using LinSpaceOpGenericAdaptor::LinSpaceOpGenericAdaptor; + LinSpaceOpAdaptor(LinSpaceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LinSpaceOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LinSpaceOpAdaptor; + template + using GenericAdaptor = LinSpaceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tidx")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTidxAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTidxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LinSpace"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getStart(); + ::mlir::TypedValue<::mlir::TensorType> getStop(); + ::mlir::TypedValue<::mlir::TensorType> getNum(); + ::mlir::OpOperand &getStartMutable(); + ::mlir::OpOperand &getStopMutable(); + ::mlir::OpOperand &getNumMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTidx(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value start, ::mlir::Value stop, ::mlir::Value num); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value start, ::mlir::Value stop, ::mlir::Value num); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LinSpaceOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ListDiffOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ListDiffOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ListDiffOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ListDiffOpGenericAdaptorBase(ListDiffOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ListDiffOpGenericAdaptor : public detail::ListDiffOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ListDiffOpGenericAdaptorBase; +public: + ListDiffOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ListDiffOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ListDiffOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ListDiffOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ListDiffOpAdaptor : public ListDiffOpGenericAdaptor<::mlir::ValueRange> { +public: + using ListDiffOpGenericAdaptor::ListDiffOpGenericAdaptor; + ListDiffOpAdaptor(ListDiffOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ListDiffOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ListDiffOpAdaptor; + template + using GenericAdaptor = ListDiffOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("out_idx")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutIdxAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutIdxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ListDiff"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOut(); + ::mlir::TypedValue<::mlir::TensorType> getIdx(); + ::mlir::Type getT(); + ::mlir::Type getOutIdx(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, ::mlir::Type idx, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ListDiffOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LoadTPUEmbeddingADAMParametersGradAccumDebugOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LoadTPUEmbeddingADAMParametersGradAccumDebugOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LoadTPUEmbeddingADAMParametersGradAccumDebugOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LoadTPUEmbeddingADAMParametersGradAccumDebugOpGenericAdaptorBase(LoadTPUEmbeddingADAMParametersGradAccumDebugOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class LoadTPUEmbeddingADAMParametersGradAccumDebugOpGenericAdaptor : public detail::LoadTPUEmbeddingADAMParametersGradAccumDebugOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LoadTPUEmbeddingADAMParametersGradAccumDebugOpGenericAdaptorBase; +public: + LoadTPUEmbeddingADAMParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LoadTPUEmbeddingADAMParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LoadTPUEmbeddingADAMParametersGradAccumDebugOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LoadTPUEmbeddingADAMParametersGradAccumDebugOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getParameters() { + return (*getODSOperands(0).begin()); + } + + ValueT getMomenta() { + return (*getODSOperands(1).begin()); + } + + ValueT getVelocities() { + return (*getODSOperands(2).begin()); + } + + ValueT getGradientAccumulators() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LoadTPUEmbeddingADAMParametersGradAccumDebugOpAdaptor : public LoadTPUEmbeddingADAMParametersGradAccumDebugOpGenericAdaptor<::mlir::ValueRange> { +public: + using LoadTPUEmbeddingADAMParametersGradAccumDebugOpGenericAdaptor::LoadTPUEmbeddingADAMParametersGradAccumDebugOpGenericAdaptor; + LoadTPUEmbeddingADAMParametersGradAccumDebugOpAdaptor(LoadTPUEmbeddingADAMParametersGradAccumDebugOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LoadTPUEmbeddingADAMParametersGradAccumDebugOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LoadTPUEmbeddingADAMParametersGradAccumDebugOpAdaptor; + template + using GenericAdaptor = LoadTPUEmbeddingADAMParametersGradAccumDebugOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LoadTPUEmbeddingADAMParametersGradAccumDebug"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getMomenta(); + ::mlir::TypedValue<::mlir::TensorType> getVelocities(); + ::mlir::TypedValue<::mlir::TensorType> getGradientAccumulators(); + ::mlir::OpOperand &getParametersMutable(); + ::mlir::OpOperand &getMomentaMutable(); + ::mlir::OpOperand &getVelocitiesMutable(); + ::mlir::OpOperand &getGradientAccumulatorsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value momenta, ::mlir::Value velocities, ::mlir::Value gradient_accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value momenta, ::mlir::Value velocities, ::mlir::Value gradient_accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value momenta, ::mlir::Value velocities, ::mlir::Value gradient_accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value momenta, ::mlir::Value velocities, ::mlir::Value gradient_accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LoadTPUEmbeddingADAMParametersGradAccumDebugOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LoadTPUEmbeddingADAMParametersOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LoadTPUEmbeddingADAMParametersOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LoadTPUEmbeddingADAMParametersOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LoadTPUEmbeddingADAMParametersOpGenericAdaptorBase(LoadTPUEmbeddingADAMParametersOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class LoadTPUEmbeddingADAMParametersOpGenericAdaptor : public detail::LoadTPUEmbeddingADAMParametersOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LoadTPUEmbeddingADAMParametersOpGenericAdaptorBase; +public: + LoadTPUEmbeddingADAMParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LoadTPUEmbeddingADAMParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LoadTPUEmbeddingADAMParametersOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LoadTPUEmbeddingADAMParametersOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getParameters() { + return (*getODSOperands(0).begin()); + } + + ValueT getMomenta() { + return (*getODSOperands(1).begin()); + } + + ValueT getVelocities() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LoadTPUEmbeddingADAMParametersOpAdaptor : public LoadTPUEmbeddingADAMParametersOpGenericAdaptor<::mlir::ValueRange> { +public: + using LoadTPUEmbeddingADAMParametersOpGenericAdaptor::LoadTPUEmbeddingADAMParametersOpGenericAdaptor; + LoadTPUEmbeddingADAMParametersOpAdaptor(LoadTPUEmbeddingADAMParametersOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LoadTPUEmbeddingADAMParametersOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LoadTPUEmbeddingADAMParametersOpAdaptor; + template + using GenericAdaptor = LoadTPUEmbeddingADAMParametersOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LoadTPUEmbeddingADAMParameters"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getMomenta(); + ::mlir::TypedValue<::mlir::TensorType> getVelocities(); + ::mlir::OpOperand &getParametersMutable(); + ::mlir::OpOperand &getMomentaMutable(); + ::mlir::OpOperand &getVelocitiesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value momenta, ::mlir::Value velocities, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value momenta, ::mlir::Value velocities, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value momenta, ::mlir::Value velocities, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value momenta, ::mlir::Value velocities, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LoadTPUEmbeddingADAMParametersOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LoadTPUEmbeddingAdadeltaParametersGradAccumDebugOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LoadTPUEmbeddingAdadeltaParametersGradAccumDebugOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LoadTPUEmbeddingAdadeltaParametersGradAccumDebugOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LoadTPUEmbeddingAdadeltaParametersGradAccumDebugOpGenericAdaptorBase(LoadTPUEmbeddingAdadeltaParametersGradAccumDebugOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class LoadTPUEmbeddingAdadeltaParametersGradAccumDebugOpGenericAdaptor : public detail::LoadTPUEmbeddingAdadeltaParametersGradAccumDebugOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LoadTPUEmbeddingAdadeltaParametersGradAccumDebugOpGenericAdaptorBase; +public: + LoadTPUEmbeddingAdadeltaParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LoadTPUEmbeddingAdadeltaParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LoadTPUEmbeddingAdadeltaParametersGradAccumDebugOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LoadTPUEmbeddingAdadeltaParametersGradAccumDebugOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getParameters() { + return (*getODSOperands(0).begin()); + } + + ValueT getAccumulators() { + return (*getODSOperands(1).begin()); + } + + ValueT getUpdates() { + return (*getODSOperands(2).begin()); + } + + ValueT getGradientAccumulators() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LoadTPUEmbeddingAdadeltaParametersGradAccumDebugOpAdaptor : public LoadTPUEmbeddingAdadeltaParametersGradAccumDebugOpGenericAdaptor<::mlir::ValueRange> { +public: + using LoadTPUEmbeddingAdadeltaParametersGradAccumDebugOpGenericAdaptor::LoadTPUEmbeddingAdadeltaParametersGradAccumDebugOpGenericAdaptor; + LoadTPUEmbeddingAdadeltaParametersGradAccumDebugOpAdaptor(LoadTPUEmbeddingAdadeltaParametersGradAccumDebugOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LoadTPUEmbeddingAdadeltaParametersGradAccumDebugOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LoadTPUEmbeddingAdadeltaParametersGradAccumDebugOpAdaptor; + template + using GenericAdaptor = LoadTPUEmbeddingAdadeltaParametersGradAccumDebugOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LoadTPUEmbeddingAdadeltaParametersGradAccumDebug"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getAccumulators(); + ::mlir::TypedValue<::mlir::TensorType> getUpdates(); + ::mlir::TypedValue<::mlir::TensorType> getGradientAccumulators(); + ::mlir::OpOperand &getParametersMutable(); + ::mlir::OpOperand &getAccumulatorsMutable(); + ::mlir::OpOperand &getUpdatesMutable(); + ::mlir::OpOperand &getGradientAccumulatorsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value accumulators, ::mlir::Value updates, ::mlir::Value gradient_accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value accumulators, ::mlir::Value updates, ::mlir::Value gradient_accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value accumulators, ::mlir::Value updates, ::mlir::Value gradient_accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value accumulators, ::mlir::Value updates, ::mlir::Value gradient_accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LoadTPUEmbeddingAdadeltaParametersGradAccumDebugOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LoadTPUEmbeddingAdadeltaParametersOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LoadTPUEmbeddingAdadeltaParametersOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LoadTPUEmbeddingAdadeltaParametersOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LoadTPUEmbeddingAdadeltaParametersOpGenericAdaptorBase(LoadTPUEmbeddingAdadeltaParametersOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class LoadTPUEmbeddingAdadeltaParametersOpGenericAdaptor : public detail::LoadTPUEmbeddingAdadeltaParametersOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LoadTPUEmbeddingAdadeltaParametersOpGenericAdaptorBase; +public: + LoadTPUEmbeddingAdadeltaParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LoadTPUEmbeddingAdadeltaParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LoadTPUEmbeddingAdadeltaParametersOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LoadTPUEmbeddingAdadeltaParametersOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getParameters() { + return (*getODSOperands(0).begin()); + } + + ValueT getAccumulators() { + return (*getODSOperands(1).begin()); + } + + ValueT getUpdates() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LoadTPUEmbeddingAdadeltaParametersOpAdaptor : public LoadTPUEmbeddingAdadeltaParametersOpGenericAdaptor<::mlir::ValueRange> { +public: + using LoadTPUEmbeddingAdadeltaParametersOpGenericAdaptor::LoadTPUEmbeddingAdadeltaParametersOpGenericAdaptor; + LoadTPUEmbeddingAdadeltaParametersOpAdaptor(LoadTPUEmbeddingAdadeltaParametersOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LoadTPUEmbeddingAdadeltaParametersOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LoadTPUEmbeddingAdadeltaParametersOpAdaptor; + template + using GenericAdaptor = LoadTPUEmbeddingAdadeltaParametersOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LoadTPUEmbeddingAdadeltaParameters"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getAccumulators(); + ::mlir::TypedValue<::mlir::TensorType> getUpdates(); + ::mlir::OpOperand &getParametersMutable(); + ::mlir::OpOperand &getAccumulatorsMutable(); + ::mlir::OpOperand &getUpdatesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value accumulators, ::mlir::Value updates, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value accumulators, ::mlir::Value updates, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value accumulators, ::mlir::Value updates, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value accumulators, ::mlir::Value updates, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LoadTPUEmbeddingAdadeltaParametersOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LoadTPUEmbeddingAdagradParametersGradAccumDebugOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LoadTPUEmbeddingAdagradParametersGradAccumDebugOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LoadTPUEmbeddingAdagradParametersGradAccumDebugOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LoadTPUEmbeddingAdagradParametersGradAccumDebugOpGenericAdaptorBase(LoadTPUEmbeddingAdagradParametersGradAccumDebugOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class LoadTPUEmbeddingAdagradParametersGradAccumDebugOpGenericAdaptor : public detail::LoadTPUEmbeddingAdagradParametersGradAccumDebugOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LoadTPUEmbeddingAdagradParametersGradAccumDebugOpGenericAdaptorBase; +public: + LoadTPUEmbeddingAdagradParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LoadTPUEmbeddingAdagradParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LoadTPUEmbeddingAdagradParametersGradAccumDebugOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LoadTPUEmbeddingAdagradParametersGradAccumDebugOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getParameters() { + return (*getODSOperands(0).begin()); + } + + ValueT getAccumulators() { + return (*getODSOperands(1).begin()); + } + + ValueT getGradientAccumulators() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LoadTPUEmbeddingAdagradParametersGradAccumDebugOpAdaptor : public LoadTPUEmbeddingAdagradParametersGradAccumDebugOpGenericAdaptor<::mlir::ValueRange> { +public: + using LoadTPUEmbeddingAdagradParametersGradAccumDebugOpGenericAdaptor::LoadTPUEmbeddingAdagradParametersGradAccumDebugOpGenericAdaptor; + LoadTPUEmbeddingAdagradParametersGradAccumDebugOpAdaptor(LoadTPUEmbeddingAdagradParametersGradAccumDebugOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LoadTPUEmbeddingAdagradParametersGradAccumDebugOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LoadTPUEmbeddingAdagradParametersGradAccumDebugOpAdaptor; + template + using GenericAdaptor = LoadTPUEmbeddingAdagradParametersGradAccumDebugOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LoadTPUEmbeddingAdagradParametersGradAccumDebug"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getAccumulators(); + ::mlir::TypedValue<::mlir::TensorType> getGradientAccumulators(); + ::mlir::OpOperand &getParametersMutable(); + ::mlir::OpOperand &getAccumulatorsMutable(); + ::mlir::OpOperand &getGradientAccumulatorsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value accumulators, ::mlir::Value gradient_accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value accumulators, ::mlir::Value gradient_accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value accumulators, ::mlir::Value gradient_accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value accumulators, ::mlir::Value gradient_accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LoadTPUEmbeddingAdagradParametersGradAccumDebugOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LoadTPUEmbeddingAdagradParametersOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LoadTPUEmbeddingAdagradParametersOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LoadTPUEmbeddingAdagradParametersOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LoadTPUEmbeddingAdagradParametersOpGenericAdaptorBase(LoadTPUEmbeddingAdagradParametersOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class LoadTPUEmbeddingAdagradParametersOpGenericAdaptor : public detail::LoadTPUEmbeddingAdagradParametersOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LoadTPUEmbeddingAdagradParametersOpGenericAdaptorBase; +public: + LoadTPUEmbeddingAdagradParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LoadTPUEmbeddingAdagradParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LoadTPUEmbeddingAdagradParametersOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LoadTPUEmbeddingAdagradParametersOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getParameters() { + return (*getODSOperands(0).begin()); + } + + ValueT getAccumulators() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LoadTPUEmbeddingAdagradParametersOpAdaptor : public LoadTPUEmbeddingAdagradParametersOpGenericAdaptor<::mlir::ValueRange> { +public: + using LoadTPUEmbeddingAdagradParametersOpGenericAdaptor::LoadTPUEmbeddingAdagradParametersOpGenericAdaptor; + LoadTPUEmbeddingAdagradParametersOpAdaptor(LoadTPUEmbeddingAdagradParametersOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LoadTPUEmbeddingAdagradParametersOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LoadTPUEmbeddingAdagradParametersOpAdaptor; + template + using GenericAdaptor = LoadTPUEmbeddingAdagradParametersOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LoadTPUEmbeddingAdagradParameters"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getAccumulators(); + ::mlir::OpOperand &getParametersMutable(); + ::mlir::OpOperand &getAccumulatorsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LoadTPUEmbeddingAdagradParametersOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LoadTPUEmbeddingCenteredRMSPropParametersOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LoadTPUEmbeddingCenteredRMSPropParametersOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LoadTPUEmbeddingCenteredRMSPropParametersOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LoadTPUEmbeddingCenteredRMSPropParametersOpGenericAdaptorBase(LoadTPUEmbeddingCenteredRMSPropParametersOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class LoadTPUEmbeddingCenteredRMSPropParametersOpGenericAdaptor : public detail::LoadTPUEmbeddingCenteredRMSPropParametersOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LoadTPUEmbeddingCenteredRMSPropParametersOpGenericAdaptorBase; +public: + LoadTPUEmbeddingCenteredRMSPropParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LoadTPUEmbeddingCenteredRMSPropParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LoadTPUEmbeddingCenteredRMSPropParametersOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LoadTPUEmbeddingCenteredRMSPropParametersOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getParameters() { + return (*getODSOperands(0).begin()); + } + + ValueT getMs() { + return (*getODSOperands(1).begin()); + } + + ValueT getMom() { + return (*getODSOperands(2).begin()); + } + + ValueT getMg() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LoadTPUEmbeddingCenteredRMSPropParametersOpAdaptor : public LoadTPUEmbeddingCenteredRMSPropParametersOpGenericAdaptor<::mlir::ValueRange> { +public: + using LoadTPUEmbeddingCenteredRMSPropParametersOpGenericAdaptor::LoadTPUEmbeddingCenteredRMSPropParametersOpGenericAdaptor; + LoadTPUEmbeddingCenteredRMSPropParametersOpAdaptor(LoadTPUEmbeddingCenteredRMSPropParametersOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LoadTPUEmbeddingCenteredRMSPropParametersOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LoadTPUEmbeddingCenteredRMSPropParametersOpAdaptor; + template + using GenericAdaptor = LoadTPUEmbeddingCenteredRMSPropParametersOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LoadTPUEmbeddingCenteredRMSPropParameters"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getMs(); + ::mlir::TypedValue<::mlir::TensorType> getMom(); + ::mlir::TypedValue<::mlir::TensorType> getMg(); + ::mlir::OpOperand &getParametersMutable(); + ::mlir::OpOperand &getMsMutable(); + ::mlir::OpOperand &getMomMutable(); + ::mlir::OpOperand &getMgMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value ms, ::mlir::Value mom, ::mlir::Value mg, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value ms, ::mlir::Value mom, ::mlir::Value mg, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value ms, ::mlir::Value mom, ::mlir::Value mg, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value ms, ::mlir::Value mom, ::mlir::Value mg, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LoadTPUEmbeddingCenteredRMSPropParametersOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LoadTPUEmbeddingFTRLParametersGradAccumDebugOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LoadTPUEmbeddingFTRLParametersGradAccumDebugOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LoadTPUEmbeddingFTRLParametersGradAccumDebugOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LoadTPUEmbeddingFTRLParametersGradAccumDebugOpGenericAdaptorBase(LoadTPUEmbeddingFTRLParametersGradAccumDebugOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class LoadTPUEmbeddingFTRLParametersGradAccumDebugOpGenericAdaptor : public detail::LoadTPUEmbeddingFTRLParametersGradAccumDebugOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LoadTPUEmbeddingFTRLParametersGradAccumDebugOpGenericAdaptorBase; +public: + LoadTPUEmbeddingFTRLParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LoadTPUEmbeddingFTRLParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LoadTPUEmbeddingFTRLParametersGradAccumDebugOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LoadTPUEmbeddingFTRLParametersGradAccumDebugOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getParameters() { + return (*getODSOperands(0).begin()); + } + + ValueT getAccumulators() { + return (*getODSOperands(1).begin()); + } + + ValueT getLinears() { + return (*getODSOperands(2).begin()); + } + + ValueT getGradientAccumulators() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LoadTPUEmbeddingFTRLParametersGradAccumDebugOpAdaptor : public LoadTPUEmbeddingFTRLParametersGradAccumDebugOpGenericAdaptor<::mlir::ValueRange> { +public: + using LoadTPUEmbeddingFTRLParametersGradAccumDebugOpGenericAdaptor::LoadTPUEmbeddingFTRLParametersGradAccumDebugOpGenericAdaptor; + LoadTPUEmbeddingFTRLParametersGradAccumDebugOpAdaptor(LoadTPUEmbeddingFTRLParametersGradAccumDebugOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LoadTPUEmbeddingFTRLParametersGradAccumDebugOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LoadTPUEmbeddingFTRLParametersGradAccumDebugOpAdaptor; + template + using GenericAdaptor = LoadTPUEmbeddingFTRLParametersGradAccumDebugOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LoadTPUEmbeddingFTRLParametersGradAccumDebug"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getAccumulators(); + ::mlir::TypedValue<::mlir::TensorType> getLinears(); + ::mlir::TypedValue<::mlir::TensorType> getGradientAccumulators(); + ::mlir::OpOperand &getParametersMutable(); + ::mlir::OpOperand &getAccumulatorsMutable(); + ::mlir::OpOperand &getLinearsMutable(); + ::mlir::OpOperand &getGradientAccumulatorsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value accumulators, ::mlir::Value linears, ::mlir::Value gradient_accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value accumulators, ::mlir::Value linears, ::mlir::Value gradient_accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value accumulators, ::mlir::Value linears, ::mlir::Value gradient_accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value accumulators, ::mlir::Value linears, ::mlir::Value gradient_accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LoadTPUEmbeddingFTRLParametersGradAccumDebugOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LoadTPUEmbeddingFTRLParametersOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LoadTPUEmbeddingFTRLParametersOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LoadTPUEmbeddingFTRLParametersOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LoadTPUEmbeddingFTRLParametersOpGenericAdaptorBase(LoadTPUEmbeddingFTRLParametersOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class LoadTPUEmbeddingFTRLParametersOpGenericAdaptor : public detail::LoadTPUEmbeddingFTRLParametersOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LoadTPUEmbeddingFTRLParametersOpGenericAdaptorBase; +public: + LoadTPUEmbeddingFTRLParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LoadTPUEmbeddingFTRLParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LoadTPUEmbeddingFTRLParametersOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LoadTPUEmbeddingFTRLParametersOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getParameters() { + return (*getODSOperands(0).begin()); + } + + ValueT getAccumulators() { + return (*getODSOperands(1).begin()); + } + + ValueT getLinears() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LoadTPUEmbeddingFTRLParametersOpAdaptor : public LoadTPUEmbeddingFTRLParametersOpGenericAdaptor<::mlir::ValueRange> { +public: + using LoadTPUEmbeddingFTRLParametersOpGenericAdaptor::LoadTPUEmbeddingFTRLParametersOpGenericAdaptor; + LoadTPUEmbeddingFTRLParametersOpAdaptor(LoadTPUEmbeddingFTRLParametersOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LoadTPUEmbeddingFTRLParametersOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LoadTPUEmbeddingFTRLParametersOpAdaptor; + template + using GenericAdaptor = LoadTPUEmbeddingFTRLParametersOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LoadTPUEmbeddingFTRLParameters"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getAccumulators(); + ::mlir::TypedValue<::mlir::TensorType> getLinears(); + ::mlir::OpOperand &getParametersMutable(); + ::mlir::OpOperand &getAccumulatorsMutable(); + ::mlir::OpOperand &getLinearsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value accumulators, ::mlir::Value linears, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value accumulators, ::mlir::Value linears, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value accumulators, ::mlir::Value linears, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value accumulators, ::mlir::Value linears, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LoadTPUEmbeddingFTRLParametersOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LoadTPUEmbeddingMDLAdagradLightParametersOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LoadTPUEmbeddingMDLAdagradLightParametersOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LoadTPUEmbeddingMDLAdagradLightParametersOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LoadTPUEmbeddingMDLAdagradLightParametersOpGenericAdaptorBase(LoadTPUEmbeddingMDLAdagradLightParametersOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class LoadTPUEmbeddingMDLAdagradLightParametersOpGenericAdaptor : public detail::LoadTPUEmbeddingMDLAdagradLightParametersOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LoadTPUEmbeddingMDLAdagradLightParametersOpGenericAdaptorBase; +public: + LoadTPUEmbeddingMDLAdagradLightParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LoadTPUEmbeddingMDLAdagradLightParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LoadTPUEmbeddingMDLAdagradLightParametersOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LoadTPUEmbeddingMDLAdagradLightParametersOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getParameters() { + return (*getODSOperands(0).begin()); + } + + ValueT getAccumulators() { + return (*getODSOperands(1).begin()); + } + + ValueT getWeights() { + return (*getODSOperands(2).begin()); + } + + ValueT getBenefits() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LoadTPUEmbeddingMDLAdagradLightParametersOpAdaptor : public LoadTPUEmbeddingMDLAdagradLightParametersOpGenericAdaptor<::mlir::ValueRange> { +public: + using LoadTPUEmbeddingMDLAdagradLightParametersOpGenericAdaptor::LoadTPUEmbeddingMDLAdagradLightParametersOpGenericAdaptor; + LoadTPUEmbeddingMDLAdagradLightParametersOpAdaptor(LoadTPUEmbeddingMDLAdagradLightParametersOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LoadTPUEmbeddingMDLAdagradLightParametersOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LoadTPUEmbeddingMDLAdagradLightParametersOpAdaptor; + template + using GenericAdaptor = LoadTPUEmbeddingMDLAdagradLightParametersOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LoadTPUEmbeddingMDLAdagradLightParameters"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getAccumulators(); + ::mlir::TypedValue<::mlir::TensorType> getWeights(); + ::mlir::TypedValue<::mlir::TensorType> getBenefits(); + ::mlir::OpOperand &getParametersMutable(); + ::mlir::OpOperand &getAccumulatorsMutable(); + ::mlir::OpOperand &getWeightsMutable(); + ::mlir::OpOperand &getBenefitsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value accumulators, ::mlir::Value weights, ::mlir::Value benefits, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value accumulators, ::mlir::Value weights, ::mlir::Value benefits, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value accumulators, ::mlir::Value weights, ::mlir::Value benefits, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value accumulators, ::mlir::Value weights, ::mlir::Value benefits, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LoadTPUEmbeddingMDLAdagradLightParametersOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LoadTPUEmbeddingMomentumParametersGradAccumDebugOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LoadTPUEmbeddingMomentumParametersGradAccumDebugOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LoadTPUEmbeddingMomentumParametersGradAccumDebugOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LoadTPUEmbeddingMomentumParametersGradAccumDebugOpGenericAdaptorBase(LoadTPUEmbeddingMomentumParametersGradAccumDebugOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class LoadTPUEmbeddingMomentumParametersGradAccumDebugOpGenericAdaptor : public detail::LoadTPUEmbeddingMomentumParametersGradAccumDebugOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LoadTPUEmbeddingMomentumParametersGradAccumDebugOpGenericAdaptorBase; +public: + LoadTPUEmbeddingMomentumParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LoadTPUEmbeddingMomentumParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LoadTPUEmbeddingMomentumParametersGradAccumDebugOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LoadTPUEmbeddingMomentumParametersGradAccumDebugOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getParameters() { + return (*getODSOperands(0).begin()); + } + + ValueT getMomenta() { + return (*getODSOperands(1).begin()); + } + + ValueT getGradientAccumulators() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LoadTPUEmbeddingMomentumParametersGradAccumDebugOpAdaptor : public LoadTPUEmbeddingMomentumParametersGradAccumDebugOpGenericAdaptor<::mlir::ValueRange> { +public: + using LoadTPUEmbeddingMomentumParametersGradAccumDebugOpGenericAdaptor::LoadTPUEmbeddingMomentumParametersGradAccumDebugOpGenericAdaptor; + LoadTPUEmbeddingMomentumParametersGradAccumDebugOpAdaptor(LoadTPUEmbeddingMomentumParametersGradAccumDebugOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LoadTPUEmbeddingMomentumParametersGradAccumDebugOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LoadTPUEmbeddingMomentumParametersGradAccumDebugOpAdaptor; + template + using GenericAdaptor = LoadTPUEmbeddingMomentumParametersGradAccumDebugOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LoadTPUEmbeddingMomentumParametersGradAccumDebug"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getMomenta(); + ::mlir::TypedValue<::mlir::TensorType> getGradientAccumulators(); + ::mlir::OpOperand &getParametersMutable(); + ::mlir::OpOperand &getMomentaMutable(); + ::mlir::OpOperand &getGradientAccumulatorsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value momenta, ::mlir::Value gradient_accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value momenta, ::mlir::Value gradient_accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value momenta, ::mlir::Value gradient_accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value momenta, ::mlir::Value gradient_accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LoadTPUEmbeddingMomentumParametersGradAccumDebugOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LoadTPUEmbeddingMomentumParametersOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LoadTPUEmbeddingMomentumParametersOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LoadTPUEmbeddingMomentumParametersOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LoadTPUEmbeddingMomentumParametersOpGenericAdaptorBase(LoadTPUEmbeddingMomentumParametersOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class LoadTPUEmbeddingMomentumParametersOpGenericAdaptor : public detail::LoadTPUEmbeddingMomentumParametersOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LoadTPUEmbeddingMomentumParametersOpGenericAdaptorBase; +public: + LoadTPUEmbeddingMomentumParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LoadTPUEmbeddingMomentumParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LoadTPUEmbeddingMomentumParametersOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LoadTPUEmbeddingMomentumParametersOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getParameters() { + return (*getODSOperands(0).begin()); + } + + ValueT getMomenta() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LoadTPUEmbeddingMomentumParametersOpAdaptor : public LoadTPUEmbeddingMomentumParametersOpGenericAdaptor<::mlir::ValueRange> { +public: + using LoadTPUEmbeddingMomentumParametersOpGenericAdaptor::LoadTPUEmbeddingMomentumParametersOpGenericAdaptor; + LoadTPUEmbeddingMomentumParametersOpAdaptor(LoadTPUEmbeddingMomentumParametersOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LoadTPUEmbeddingMomentumParametersOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LoadTPUEmbeddingMomentumParametersOpAdaptor; + template + using GenericAdaptor = LoadTPUEmbeddingMomentumParametersOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LoadTPUEmbeddingMomentumParameters"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getMomenta(); + ::mlir::OpOperand &getParametersMutable(); + ::mlir::OpOperand &getMomentaMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value momenta, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value momenta, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value momenta, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value momenta, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LoadTPUEmbeddingMomentumParametersOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LoadTPUEmbeddingProximalAdagradParametersGradAccumDebugOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LoadTPUEmbeddingProximalAdagradParametersGradAccumDebugOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LoadTPUEmbeddingProximalAdagradParametersGradAccumDebugOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LoadTPUEmbeddingProximalAdagradParametersGradAccumDebugOpGenericAdaptorBase(LoadTPUEmbeddingProximalAdagradParametersGradAccumDebugOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class LoadTPUEmbeddingProximalAdagradParametersGradAccumDebugOpGenericAdaptor : public detail::LoadTPUEmbeddingProximalAdagradParametersGradAccumDebugOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LoadTPUEmbeddingProximalAdagradParametersGradAccumDebugOpGenericAdaptorBase; +public: + LoadTPUEmbeddingProximalAdagradParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LoadTPUEmbeddingProximalAdagradParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LoadTPUEmbeddingProximalAdagradParametersGradAccumDebugOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LoadTPUEmbeddingProximalAdagradParametersGradAccumDebugOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getParameters() { + return (*getODSOperands(0).begin()); + } + + ValueT getAccumulators() { + return (*getODSOperands(1).begin()); + } + + ValueT getGradientAccumulators() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LoadTPUEmbeddingProximalAdagradParametersGradAccumDebugOpAdaptor : public LoadTPUEmbeddingProximalAdagradParametersGradAccumDebugOpGenericAdaptor<::mlir::ValueRange> { +public: + using LoadTPUEmbeddingProximalAdagradParametersGradAccumDebugOpGenericAdaptor::LoadTPUEmbeddingProximalAdagradParametersGradAccumDebugOpGenericAdaptor; + LoadTPUEmbeddingProximalAdagradParametersGradAccumDebugOpAdaptor(LoadTPUEmbeddingProximalAdagradParametersGradAccumDebugOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LoadTPUEmbeddingProximalAdagradParametersGradAccumDebugOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LoadTPUEmbeddingProximalAdagradParametersGradAccumDebugOpAdaptor; + template + using GenericAdaptor = LoadTPUEmbeddingProximalAdagradParametersGradAccumDebugOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LoadTPUEmbeddingProximalAdagradParametersGradAccumDebug"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getAccumulators(); + ::mlir::TypedValue<::mlir::TensorType> getGradientAccumulators(); + ::mlir::OpOperand &getParametersMutable(); + ::mlir::OpOperand &getAccumulatorsMutable(); + ::mlir::OpOperand &getGradientAccumulatorsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value accumulators, ::mlir::Value gradient_accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value accumulators, ::mlir::Value gradient_accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value accumulators, ::mlir::Value gradient_accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value accumulators, ::mlir::Value gradient_accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LoadTPUEmbeddingProximalAdagradParametersGradAccumDebugOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LoadTPUEmbeddingProximalAdagradParametersOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LoadTPUEmbeddingProximalAdagradParametersOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LoadTPUEmbeddingProximalAdagradParametersOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LoadTPUEmbeddingProximalAdagradParametersOpGenericAdaptorBase(LoadTPUEmbeddingProximalAdagradParametersOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class LoadTPUEmbeddingProximalAdagradParametersOpGenericAdaptor : public detail::LoadTPUEmbeddingProximalAdagradParametersOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LoadTPUEmbeddingProximalAdagradParametersOpGenericAdaptorBase; +public: + LoadTPUEmbeddingProximalAdagradParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LoadTPUEmbeddingProximalAdagradParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LoadTPUEmbeddingProximalAdagradParametersOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LoadTPUEmbeddingProximalAdagradParametersOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getParameters() { + return (*getODSOperands(0).begin()); + } + + ValueT getAccumulators() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LoadTPUEmbeddingProximalAdagradParametersOpAdaptor : public LoadTPUEmbeddingProximalAdagradParametersOpGenericAdaptor<::mlir::ValueRange> { +public: + using LoadTPUEmbeddingProximalAdagradParametersOpGenericAdaptor::LoadTPUEmbeddingProximalAdagradParametersOpGenericAdaptor; + LoadTPUEmbeddingProximalAdagradParametersOpAdaptor(LoadTPUEmbeddingProximalAdagradParametersOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LoadTPUEmbeddingProximalAdagradParametersOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LoadTPUEmbeddingProximalAdagradParametersOpAdaptor; + template + using GenericAdaptor = LoadTPUEmbeddingProximalAdagradParametersOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LoadTPUEmbeddingProximalAdagradParameters"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getAccumulators(); + ::mlir::OpOperand &getParametersMutable(); + ::mlir::OpOperand &getAccumulatorsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LoadTPUEmbeddingProximalAdagradParametersOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LoadTPUEmbeddingProximalYogiParametersGradAccumDebugOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LoadTPUEmbeddingProximalYogiParametersGradAccumDebugOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LoadTPUEmbeddingProximalYogiParametersGradAccumDebugOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LoadTPUEmbeddingProximalYogiParametersGradAccumDebugOpGenericAdaptorBase(LoadTPUEmbeddingProximalYogiParametersGradAccumDebugOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class LoadTPUEmbeddingProximalYogiParametersGradAccumDebugOpGenericAdaptor : public detail::LoadTPUEmbeddingProximalYogiParametersGradAccumDebugOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LoadTPUEmbeddingProximalYogiParametersGradAccumDebugOpGenericAdaptorBase; +public: + LoadTPUEmbeddingProximalYogiParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LoadTPUEmbeddingProximalYogiParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LoadTPUEmbeddingProximalYogiParametersGradAccumDebugOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LoadTPUEmbeddingProximalYogiParametersGradAccumDebugOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getParameters() { + return (*getODSOperands(0).begin()); + } + + ValueT getV() { + return (*getODSOperands(1).begin()); + } + + ValueT getM() { + return (*getODSOperands(2).begin()); + } + + ValueT getGradientAccumulators() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LoadTPUEmbeddingProximalYogiParametersGradAccumDebugOpAdaptor : public LoadTPUEmbeddingProximalYogiParametersGradAccumDebugOpGenericAdaptor<::mlir::ValueRange> { +public: + using LoadTPUEmbeddingProximalYogiParametersGradAccumDebugOpGenericAdaptor::LoadTPUEmbeddingProximalYogiParametersGradAccumDebugOpGenericAdaptor; + LoadTPUEmbeddingProximalYogiParametersGradAccumDebugOpAdaptor(LoadTPUEmbeddingProximalYogiParametersGradAccumDebugOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LoadTPUEmbeddingProximalYogiParametersGradAccumDebugOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LoadTPUEmbeddingProximalYogiParametersGradAccumDebugOpAdaptor; + template + using GenericAdaptor = LoadTPUEmbeddingProximalYogiParametersGradAccumDebugOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LoadTPUEmbeddingProximalYogiParametersGradAccumDebug"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getV(); + ::mlir::TypedValue<::mlir::TensorType> getM(); + ::mlir::TypedValue<::mlir::TensorType> getGradientAccumulators(); + ::mlir::OpOperand &getParametersMutable(); + ::mlir::OpOperand &getVMutable(); + ::mlir::OpOperand &getMMutable(); + ::mlir::OpOperand &getGradientAccumulatorsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value v, ::mlir::Value m, ::mlir::Value gradient_accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value v, ::mlir::Value m, ::mlir::Value gradient_accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value v, ::mlir::Value m, ::mlir::Value gradient_accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value v, ::mlir::Value m, ::mlir::Value gradient_accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LoadTPUEmbeddingProximalYogiParametersGradAccumDebugOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LoadTPUEmbeddingProximalYogiParametersOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LoadTPUEmbeddingProximalYogiParametersOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LoadTPUEmbeddingProximalYogiParametersOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LoadTPUEmbeddingProximalYogiParametersOpGenericAdaptorBase(LoadTPUEmbeddingProximalYogiParametersOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class LoadTPUEmbeddingProximalYogiParametersOpGenericAdaptor : public detail::LoadTPUEmbeddingProximalYogiParametersOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LoadTPUEmbeddingProximalYogiParametersOpGenericAdaptorBase; +public: + LoadTPUEmbeddingProximalYogiParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LoadTPUEmbeddingProximalYogiParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LoadTPUEmbeddingProximalYogiParametersOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LoadTPUEmbeddingProximalYogiParametersOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getParameters() { + return (*getODSOperands(0).begin()); + } + + ValueT getV() { + return (*getODSOperands(1).begin()); + } + + ValueT getM() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LoadTPUEmbeddingProximalYogiParametersOpAdaptor : public LoadTPUEmbeddingProximalYogiParametersOpGenericAdaptor<::mlir::ValueRange> { +public: + using LoadTPUEmbeddingProximalYogiParametersOpGenericAdaptor::LoadTPUEmbeddingProximalYogiParametersOpGenericAdaptor; + LoadTPUEmbeddingProximalYogiParametersOpAdaptor(LoadTPUEmbeddingProximalYogiParametersOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LoadTPUEmbeddingProximalYogiParametersOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LoadTPUEmbeddingProximalYogiParametersOpAdaptor; + template + using GenericAdaptor = LoadTPUEmbeddingProximalYogiParametersOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LoadTPUEmbeddingProximalYogiParameters"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getV(); + ::mlir::TypedValue<::mlir::TensorType> getM(); + ::mlir::OpOperand &getParametersMutable(); + ::mlir::OpOperand &getVMutable(); + ::mlir::OpOperand &getMMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value v, ::mlir::Value m, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value v, ::mlir::Value m, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value v, ::mlir::Value m, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value v, ::mlir::Value m, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LoadTPUEmbeddingProximalYogiParametersOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LoadTPUEmbeddingRMSPropParametersGradAccumDebugOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LoadTPUEmbeddingRMSPropParametersGradAccumDebugOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LoadTPUEmbeddingRMSPropParametersGradAccumDebugOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LoadTPUEmbeddingRMSPropParametersGradAccumDebugOpGenericAdaptorBase(LoadTPUEmbeddingRMSPropParametersGradAccumDebugOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class LoadTPUEmbeddingRMSPropParametersGradAccumDebugOpGenericAdaptor : public detail::LoadTPUEmbeddingRMSPropParametersGradAccumDebugOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LoadTPUEmbeddingRMSPropParametersGradAccumDebugOpGenericAdaptorBase; +public: + LoadTPUEmbeddingRMSPropParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LoadTPUEmbeddingRMSPropParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LoadTPUEmbeddingRMSPropParametersGradAccumDebugOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LoadTPUEmbeddingRMSPropParametersGradAccumDebugOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getParameters() { + return (*getODSOperands(0).begin()); + } + + ValueT getMs() { + return (*getODSOperands(1).begin()); + } + + ValueT getMom() { + return (*getODSOperands(2).begin()); + } + + ValueT getGradientAccumulators() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LoadTPUEmbeddingRMSPropParametersGradAccumDebugOpAdaptor : public LoadTPUEmbeddingRMSPropParametersGradAccumDebugOpGenericAdaptor<::mlir::ValueRange> { +public: + using LoadTPUEmbeddingRMSPropParametersGradAccumDebugOpGenericAdaptor::LoadTPUEmbeddingRMSPropParametersGradAccumDebugOpGenericAdaptor; + LoadTPUEmbeddingRMSPropParametersGradAccumDebugOpAdaptor(LoadTPUEmbeddingRMSPropParametersGradAccumDebugOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LoadTPUEmbeddingRMSPropParametersGradAccumDebugOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LoadTPUEmbeddingRMSPropParametersGradAccumDebugOpAdaptor; + template + using GenericAdaptor = LoadTPUEmbeddingRMSPropParametersGradAccumDebugOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LoadTPUEmbeddingRMSPropParametersGradAccumDebug"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getMs(); + ::mlir::TypedValue<::mlir::TensorType> getMom(); + ::mlir::TypedValue<::mlir::TensorType> getGradientAccumulators(); + ::mlir::OpOperand &getParametersMutable(); + ::mlir::OpOperand &getMsMutable(); + ::mlir::OpOperand &getMomMutable(); + ::mlir::OpOperand &getGradientAccumulatorsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value ms, ::mlir::Value mom, ::mlir::Value gradient_accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value ms, ::mlir::Value mom, ::mlir::Value gradient_accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value ms, ::mlir::Value mom, ::mlir::Value gradient_accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value ms, ::mlir::Value mom, ::mlir::Value gradient_accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LoadTPUEmbeddingRMSPropParametersGradAccumDebugOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LoadTPUEmbeddingRMSPropParametersOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LoadTPUEmbeddingRMSPropParametersOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LoadTPUEmbeddingRMSPropParametersOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LoadTPUEmbeddingRMSPropParametersOpGenericAdaptorBase(LoadTPUEmbeddingRMSPropParametersOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class LoadTPUEmbeddingRMSPropParametersOpGenericAdaptor : public detail::LoadTPUEmbeddingRMSPropParametersOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LoadTPUEmbeddingRMSPropParametersOpGenericAdaptorBase; +public: + LoadTPUEmbeddingRMSPropParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LoadTPUEmbeddingRMSPropParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LoadTPUEmbeddingRMSPropParametersOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LoadTPUEmbeddingRMSPropParametersOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getParameters() { + return (*getODSOperands(0).begin()); + } + + ValueT getMs() { + return (*getODSOperands(1).begin()); + } + + ValueT getMom() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LoadTPUEmbeddingRMSPropParametersOpAdaptor : public LoadTPUEmbeddingRMSPropParametersOpGenericAdaptor<::mlir::ValueRange> { +public: + using LoadTPUEmbeddingRMSPropParametersOpGenericAdaptor::LoadTPUEmbeddingRMSPropParametersOpGenericAdaptor; + LoadTPUEmbeddingRMSPropParametersOpAdaptor(LoadTPUEmbeddingRMSPropParametersOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LoadTPUEmbeddingRMSPropParametersOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LoadTPUEmbeddingRMSPropParametersOpAdaptor; + template + using GenericAdaptor = LoadTPUEmbeddingRMSPropParametersOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LoadTPUEmbeddingRMSPropParameters"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getMs(); + ::mlir::TypedValue<::mlir::TensorType> getMom(); + ::mlir::OpOperand &getParametersMutable(); + ::mlir::OpOperand &getMsMutable(); + ::mlir::OpOperand &getMomMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value ms, ::mlir::Value mom, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value ms, ::mlir::Value mom, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value ms, ::mlir::Value mom, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value ms, ::mlir::Value mom, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LoadTPUEmbeddingRMSPropParametersOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LoadTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LoadTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LoadTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LoadTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpGenericAdaptorBase(LoadTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class LoadTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpGenericAdaptor : public detail::LoadTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LoadTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpGenericAdaptorBase; +public: + LoadTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LoadTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LoadTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LoadTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getParameters() { + return (*getODSOperands(0).begin()); + } + + ValueT getGradientAccumulators() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LoadTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpAdaptor : public LoadTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpGenericAdaptor<::mlir::ValueRange> { +public: + using LoadTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpGenericAdaptor::LoadTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpGenericAdaptor; + LoadTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpAdaptor(LoadTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LoadTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LoadTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpAdaptor; + template + using GenericAdaptor = LoadTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LoadTPUEmbeddingStochasticGradientDescentParametersGradAccumDebug"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getGradientAccumulators(); + ::mlir::OpOperand &getParametersMutable(); + ::mlir::OpOperand &getGradientAccumulatorsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value gradient_accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value gradient_accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value gradient_accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value gradient_accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LoadTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LoadTPUEmbeddingStochasticGradientDescentParametersOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LoadTPUEmbeddingStochasticGradientDescentParametersOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LoadTPUEmbeddingStochasticGradientDescentParametersOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LoadTPUEmbeddingStochasticGradientDescentParametersOpGenericAdaptorBase(LoadTPUEmbeddingStochasticGradientDescentParametersOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class LoadTPUEmbeddingStochasticGradientDescentParametersOpGenericAdaptor : public detail::LoadTPUEmbeddingStochasticGradientDescentParametersOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LoadTPUEmbeddingStochasticGradientDescentParametersOpGenericAdaptorBase; +public: + LoadTPUEmbeddingStochasticGradientDescentParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LoadTPUEmbeddingStochasticGradientDescentParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LoadTPUEmbeddingStochasticGradientDescentParametersOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LoadTPUEmbeddingStochasticGradientDescentParametersOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getParameters() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LoadTPUEmbeddingStochasticGradientDescentParametersOpAdaptor : public LoadTPUEmbeddingStochasticGradientDescentParametersOpGenericAdaptor<::mlir::ValueRange> { +public: + using LoadTPUEmbeddingStochasticGradientDescentParametersOpGenericAdaptor::LoadTPUEmbeddingStochasticGradientDescentParametersOpGenericAdaptor; + LoadTPUEmbeddingStochasticGradientDescentParametersOpAdaptor(LoadTPUEmbeddingStochasticGradientDescentParametersOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LoadTPUEmbeddingStochasticGradientDescentParametersOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = LoadTPUEmbeddingStochasticGradientDescentParametersOpAdaptor; + template + using GenericAdaptor = LoadTPUEmbeddingStochasticGradientDescentParametersOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LoadTPUEmbeddingStochasticGradientDescentParameters"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::OpOperand &getParametersMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LoadTPUEmbeddingStochasticGradientDescentParametersOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::Log1pOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Log1pOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + Log1pOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + Log1pOpGenericAdaptorBase(Log1pOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class Log1pOpGenericAdaptor : public detail::Log1pOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Log1pOpGenericAdaptorBase; +public: + Log1pOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Log1pOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Log1pOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + Log1pOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Log1pOpAdaptor : public Log1pOpGenericAdaptor<::mlir::ValueRange> { +public: + using Log1pOpGenericAdaptor::Log1pOpGenericAdaptor; + Log1pOpAdaptor(Log1pOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Log1pOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::CwiseUnary, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = Log1pOpAdaptor; + template + using GenericAdaptor = Log1pOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Log1p"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::Log1pOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LogOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LogOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LogOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LogOpGenericAdaptorBase(LogOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class LogOpGenericAdaptor : public detail::LogOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LogOpGenericAdaptorBase; +public: + LogOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LogOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LogOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LogOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LogOpAdaptor : public LogOpGenericAdaptor<::mlir::ValueRange> { +public: + using LogOpGenericAdaptor::LogOpGenericAdaptor; + LogOpAdaptor(LogOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LogOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LogOpAdaptor; + template + using GenericAdaptor = LogOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Log"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LogOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LogSoftmaxOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LogSoftmaxOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LogSoftmaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LogSoftmaxOpGenericAdaptorBase(LogSoftmaxOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class LogSoftmaxOpGenericAdaptor : public detail::LogSoftmaxOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LogSoftmaxOpGenericAdaptorBase; +public: + LogSoftmaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LogSoftmaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LogSoftmaxOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LogSoftmaxOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLogits() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LogSoftmaxOpAdaptor : public LogSoftmaxOpGenericAdaptor<::mlir::ValueRange> { +public: + using LogSoftmaxOpGenericAdaptor::LogSoftmaxOpGenericAdaptor; + LogSoftmaxOpAdaptor(LogSoftmaxOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LogSoftmaxOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LogSoftmaxOpAdaptor; + template + using GenericAdaptor = LogSoftmaxOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LogSoftmax"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLogits(); + ::mlir::OpOperand &getLogitsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLogsoftmax(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type logsoftmax, ::mlir::Value logits); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value logits); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value logits); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LogSoftmaxOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LogicalAndOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LogicalAndOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LogicalAndOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LogicalAndOpGenericAdaptorBase(LogicalAndOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class LogicalAndOpGenericAdaptor : public detail::LogicalAndOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LogicalAndOpGenericAdaptorBase; +public: + LogicalAndOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LogicalAndOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LogicalAndOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LogicalAndOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LogicalAndOpAdaptor : public LogicalAndOpGenericAdaptor<::mlir::ValueRange> { +public: + using LogicalAndOpGenericAdaptor::LogicalAndOpGenericAdaptor; + LogicalAndOpAdaptor(LogicalAndOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LogicalAndOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsCommutative, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape> { +public: + using Op::Op; + using Op::print; + using Adaptor = LogicalAndOpAdaptor; + template + using GenericAdaptor = LogicalAndOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LogicalAnd"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LogicalAndOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LogicalNotOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LogicalNotOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LogicalNotOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LogicalNotOpGenericAdaptorBase(LogicalNotOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class LogicalNotOpGenericAdaptor : public detail::LogicalNotOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LogicalNotOpGenericAdaptorBase; +public: + LogicalNotOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LogicalNotOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LogicalNotOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LogicalNotOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LogicalNotOpAdaptor : public LogicalNotOpGenericAdaptor<::mlir::ValueRange> { +public: + using LogicalNotOpGenericAdaptor::LogicalNotOpGenericAdaptor; + LogicalNotOpAdaptor(LogicalNotOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LogicalNotOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::IsInvolution, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef> { +public: + using Op::Op; + using Op::print; + using Adaptor = LogicalNotOpAdaptor; + template + using GenericAdaptor = LogicalNotOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LogicalNot"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LogicalNotOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LogicalOrOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LogicalOrOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LogicalOrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LogicalOrOpGenericAdaptorBase(LogicalOrOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class LogicalOrOpGenericAdaptor : public detail::LogicalOrOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LogicalOrOpGenericAdaptorBase; +public: + LogicalOrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LogicalOrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LogicalOrOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LogicalOrOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LogicalOrOpAdaptor : public LogicalOrOpGenericAdaptor<::mlir::ValueRange> { +public: + using LogicalOrOpGenericAdaptor::LogicalOrOpGenericAdaptor; + LogicalOrOpAdaptor(LogicalOrOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LogicalOrOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsCommutative, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape> { +public: + using Op::Op; + using Op::print; + using Adaptor = LogicalOrOpAdaptor; + template + using GenericAdaptor = LogicalOrOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LogicalOr"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LogicalOrOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LookupTableExportV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LookupTableExportV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LookupTableExportV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LookupTableExportV2OpGenericAdaptorBase(LookupTableExportV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class LookupTableExportV2OpGenericAdaptor : public detail::LookupTableExportV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LookupTableExportV2OpGenericAdaptorBase; +public: + LookupTableExportV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LookupTableExportV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LookupTableExportV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LookupTableExportV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTableHandle() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LookupTableExportV2OpAdaptor : public LookupTableExportV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using LookupTableExportV2OpGenericAdaptor::LookupTableExportV2OpGenericAdaptor; + LookupTableExportV2OpAdaptor(LookupTableExportV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LookupTableExportV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LookupTableExportV2OpAdaptor; + template + using GenericAdaptor = LookupTableExportV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tkeys"), ::llvm::StringRef("Tvalues")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTkeysAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTkeysAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTvaluesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTvaluesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LookupTableExportV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTableHandle(); + ::mlir::OpOperand &getTableHandleMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getKeys(); + ::mlir::TypedValue<::mlir::TensorType> getValues(); + ::mlir::Type getTkeys(); + ::mlir::Type getTvalues(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type keys, ::mlir::Type values, ::mlir::Value table_handle); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value table_handle); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LookupTableExportV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LookupTableFindOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LookupTableFindOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LookupTableFindOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LookupTableFindOpGenericAdaptorBase(LookupTableFindOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class LookupTableFindOpGenericAdaptor : public detail::LookupTableFindOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LookupTableFindOpGenericAdaptorBase; +public: + LookupTableFindOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LookupTableFindOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LookupTableFindOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LookupTableFindOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTableHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getKeys() { + return (*getODSOperands(1).begin()); + } + + ValueT getDefaultValue() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LookupTableFindOpAdaptor : public LookupTableFindOpGenericAdaptor<::mlir::ValueRange> { +public: + using LookupTableFindOpGenericAdaptor::LookupTableFindOpGenericAdaptor; + LookupTableFindOpAdaptor(LookupTableFindOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LookupTableFindOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LookupTableFindOpAdaptor; + template + using GenericAdaptor = LookupTableFindOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tin"), ::llvm::StringRef("Tout")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTinAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTinAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getToutAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getToutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LookupTableFind"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTableHandle(); + ::mlir::TypedValue<::mlir::TensorType> getKeys(); + ::mlir::TypedValue<::mlir::TensorType> getDefaultValue(); + ::mlir::OpOperand &getTableHandleMutable(); + ::mlir::OpOperand &getKeysMutable(); + ::mlir::OpOperand &getDefaultValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getValues(); + ::mlir::Type getTin(); + ::mlir::Type getTout(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type values, ::mlir::Value table_handle, ::mlir::Value keys, ::mlir::Value default_value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value table_handle, ::mlir::Value keys, ::mlir::Value default_value); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LookupTableFindOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LookupTableFindV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LookupTableFindV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LookupTableFindV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LookupTableFindV2OpGenericAdaptorBase(LookupTableFindV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class LookupTableFindV2OpGenericAdaptor : public detail::LookupTableFindV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LookupTableFindV2OpGenericAdaptorBase; +public: + LookupTableFindV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LookupTableFindV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LookupTableFindV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LookupTableFindV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTableHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getKeys() { + return (*getODSOperands(1).begin()); + } + + ValueT getDefaultValue() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LookupTableFindV2OpAdaptor : public LookupTableFindV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using LookupTableFindV2OpGenericAdaptor::LookupTableFindV2OpGenericAdaptor; + LookupTableFindV2OpAdaptor(LookupTableFindV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LookupTableFindV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LookupTableFindV2OpAdaptor; + template + using GenericAdaptor = LookupTableFindV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tin"), ::llvm::StringRef("Tout")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTinAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTinAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getToutAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getToutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LookupTableFindV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTableHandle(); + ::mlir::TypedValue<::mlir::TensorType> getKeys(); + ::mlir::TypedValue<::mlir::TensorType> getDefaultValue(); + ::mlir::OpOperand &getTableHandleMutable(); + ::mlir::OpOperand &getKeysMutable(); + ::mlir::OpOperand &getDefaultValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getValues(); + ::mlir::Type getTin(); + ::mlir::Type getTout(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type values, ::mlir::Value table_handle, ::mlir::Value keys, ::mlir::Value default_value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value table_handle, ::mlir::Value keys, ::mlir::Value default_value); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LookupTableFindV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LookupTableImportV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LookupTableImportV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LookupTableImportV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LookupTableImportV2OpGenericAdaptorBase(LookupTableImportV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class LookupTableImportV2OpGenericAdaptor : public detail::LookupTableImportV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LookupTableImportV2OpGenericAdaptorBase; +public: + LookupTableImportV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LookupTableImportV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LookupTableImportV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LookupTableImportV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTableHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getKeys() { + return (*getODSOperands(1).begin()); + } + + ValueT getValues() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LookupTableImportV2OpAdaptor : public LookupTableImportV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using LookupTableImportV2OpGenericAdaptor::LookupTableImportV2OpGenericAdaptor; + LookupTableImportV2OpAdaptor(LookupTableImportV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LookupTableImportV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LookupTableImportV2OpAdaptor; + template + using GenericAdaptor = LookupTableImportV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tin"), ::llvm::StringRef("Tout")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTinAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTinAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getToutAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getToutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LookupTableImportV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTableHandle(); + ::mlir::TypedValue<::mlir::TensorType> getKeys(); + ::mlir::TypedValue<::mlir::TensorType> getValues(); + ::mlir::OpOperand &getTableHandleMutable(); + ::mlir::OpOperand &getKeysMutable(); + ::mlir::OpOperand &getValuesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Type getTin(); + ::mlir::Type getTout(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value table_handle, ::mlir::Value keys, ::mlir::Value values); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value table_handle, ::mlir::Value keys, ::mlir::Value values); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LookupTableImportV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LookupTableInsertV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LookupTableInsertV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LookupTableInsertV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LookupTableInsertV2OpGenericAdaptorBase(LookupTableInsertV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class LookupTableInsertV2OpGenericAdaptor : public detail::LookupTableInsertV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LookupTableInsertV2OpGenericAdaptorBase; +public: + LookupTableInsertV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LookupTableInsertV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LookupTableInsertV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LookupTableInsertV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTableHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getKeys() { + return (*getODSOperands(1).begin()); + } + + ValueT getValues() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LookupTableInsertV2OpAdaptor : public LookupTableInsertV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using LookupTableInsertV2OpGenericAdaptor::LookupTableInsertV2OpGenericAdaptor; + LookupTableInsertV2OpAdaptor(LookupTableInsertV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LookupTableInsertV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LookupTableInsertV2OpAdaptor; + template + using GenericAdaptor = LookupTableInsertV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tin"), ::llvm::StringRef("Tout")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTinAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTinAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getToutAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getToutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LookupTableInsertV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTableHandle(); + ::mlir::TypedValue<::mlir::TensorType> getKeys(); + ::mlir::TypedValue<::mlir::TensorType> getValues(); + ::mlir::OpOperand &getTableHandleMutable(); + ::mlir::OpOperand &getKeysMutable(); + ::mlir::OpOperand &getValuesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Type getTin(); + ::mlir::Type getTout(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value table_handle, ::mlir::Value keys, ::mlir::Value values); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value table_handle, ::mlir::Value keys, ::mlir::Value values); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LookupTableInsertV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LookupTableRemoveV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LookupTableRemoveV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LookupTableRemoveV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LookupTableRemoveV2OpGenericAdaptorBase(LookupTableRemoveV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class LookupTableRemoveV2OpGenericAdaptor : public detail::LookupTableRemoveV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LookupTableRemoveV2OpGenericAdaptorBase; +public: + LookupTableRemoveV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LookupTableRemoveV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LookupTableRemoveV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LookupTableRemoveV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTableHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getKeys() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LookupTableRemoveV2OpAdaptor : public LookupTableRemoveV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using LookupTableRemoveV2OpGenericAdaptor::LookupTableRemoveV2OpGenericAdaptor; + LookupTableRemoveV2OpAdaptor(LookupTableRemoveV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LookupTableRemoveV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LookupTableRemoveV2OpAdaptor; + template + using GenericAdaptor = LookupTableRemoveV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tin")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTinAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTinAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LookupTableRemoveV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTableHandle(); + ::mlir::TypedValue<::mlir::TensorType> getKeys(); + ::mlir::OpOperand &getTableHandleMutable(); + ::mlir::OpOperand &getKeysMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Type getTin(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value table_handle, ::mlir::Value keys); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value table_handle, ::mlir::Value keys); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LookupTableRemoveV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LookupTableSizeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LookupTableSizeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LookupTableSizeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LookupTableSizeOpGenericAdaptorBase(LookupTableSizeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class LookupTableSizeOpGenericAdaptor : public detail::LookupTableSizeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LookupTableSizeOpGenericAdaptorBase; +public: + LookupTableSizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LookupTableSizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LookupTableSizeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LookupTableSizeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTableHandle() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LookupTableSizeOpAdaptor : public LookupTableSizeOpGenericAdaptor<::mlir::ValueRange> { +public: + using LookupTableSizeOpGenericAdaptor::LookupTableSizeOpGenericAdaptor; + LookupTableSizeOpAdaptor(LookupTableSizeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LookupTableSizeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LookupTableSizeOpAdaptor; + template + using GenericAdaptor = LookupTableSizeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LookupTableSize"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTableHandle(); + ::mlir::OpOperand &getTableHandleMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSize(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type size, ::mlir::Value table_handle); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value table_handle); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LookupTableSizeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LookupTableSizeV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LookupTableSizeV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LookupTableSizeV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LookupTableSizeV2OpGenericAdaptorBase(LookupTableSizeV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class LookupTableSizeV2OpGenericAdaptor : public detail::LookupTableSizeV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LookupTableSizeV2OpGenericAdaptorBase; +public: + LookupTableSizeV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LookupTableSizeV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LookupTableSizeV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LookupTableSizeV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTableHandle() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LookupTableSizeV2OpAdaptor : public LookupTableSizeV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using LookupTableSizeV2OpGenericAdaptor::LookupTableSizeV2OpGenericAdaptor; + LookupTableSizeV2OpAdaptor(LookupTableSizeV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LookupTableSizeV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LookupTableSizeV2OpAdaptor; + template + using GenericAdaptor = LookupTableSizeV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LookupTableSizeV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTableHandle(); + ::mlir::OpOperand &getTableHandleMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSize(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type size, ::mlir::Value table_handle); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value table_handle); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LookupTableSizeV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LowerBoundOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LowerBoundOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LowerBoundOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LowerBoundOpGenericAdaptorBase(LowerBoundOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class LowerBoundOpGenericAdaptor : public detail::LowerBoundOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LowerBoundOpGenericAdaptorBase; +public: + LowerBoundOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LowerBoundOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LowerBoundOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LowerBoundOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSortedInputs() { + return (*getODSOperands(0).begin()); + } + + ValueT getValues() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LowerBoundOpAdaptor : public LowerBoundOpGenericAdaptor<::mlir::ValueRange> { +public: + using LowerBoundOpGenericAdaptor::LowerBoundOpGenericAdaptor; + LowerBoundOpAdaptor(LowerBoundOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LowerBoundOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LowerBoundOpAdaptor; + template + using GenericAdaptor = LowerBoundOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("out_type")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutTypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LowerBound"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSortedInputs(); + ::mlir::TypedValue<::mlir::TensorType> getValues(); + ::mlir::OpOperand &getSortedInputsMutable(); + ::mlir::OpOperand &getValuesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getOutType(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value sorted_inputs, ::mlir::Value values); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value sorted_inputs, ::mlir::Value values); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LowerBoundOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MakeIteratorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MakeIteratorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MakeIteratorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MakeIteratorOpGenericAdaptorBase(MakeIteratorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MakeIteratorOpGenericAdaptor : public detail::MakeIteratorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MakeIteratorOpGenericAdaptorBase; +public: + MakeIteratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MakeIteratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MakeIteratorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MakeIteratorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getDataset() { + return (*getODSOperands(0).begin()); + } + + ValueT getIterator() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MakeIteratorOpAdaptor : public MakeIteratorOpGenericAdaptor<::mlir::ValueRange> { +public: + using MakeIteratorOpGenericAdaptor::MakeIteratorOpGenericAdaptor; + MakeIteratorOpAdaptor(MakeIteratorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MakeIteratorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MakeIteratorOpAdaptor; + template + using GenericAdaptor = MakeIteratorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MakeIterator"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getDataset(); + ::mlir::TypedValue<::mlir::TensorType> getIterator(); + ::mlir::OpOperand &getDatasetMutable(); + ::mlir::OpOperand &getIteratorMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value dataset, ::mlir::Value iterator); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value dataset, ::mlir::Value iterator); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MakeIteratorOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MakeUniqueOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MakeUniqueOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MakeUniqueOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MakeUniqueOpGenericAdaptorBase(MakeUniqueOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MakeUniqueOpGenericAdaptor : public detail::MakeUniqueOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MakeUniqueOpGenericAdaptorBase; +public: + MakeUniqueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MakeUniqueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MakeUniqueOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MakeUniqueOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MakeUniqueOpAdaptor : public MakeUniqueOpGenericAdaptor<::mlir::ValueRange> { +public: + using MakeUniqueOpGenericAdaptor::MakeUniqueOpGenericAdaptor; + MakeUniqueOpAdaptor(MakeUniqueOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MakeUniqueOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MakeUniqueOpAdaptor; + template + using GenericAdaptor = MakeUniqueOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MakeUnique"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MakeUniqueOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MapAndBatchDatasetOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MapAndBatchDatasetOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MapAndBatchDatasetOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MapAndBatchDatasetOpGenericAdaptorBase(MapAndBatchDatasetOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::SymbolRefAttr getFAttr(); + ::mlir::SymbolRefAttr getF(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::BoolAttr getPreserveCardinalityAttr(); + bool getPreserveCardinality(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); +}; +} // namespace detail +template +class MapAndBatchDatasetOpGenericAdaptor : public detail::MapAndBatchDatasetOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MapAndBatchDatasetOpGenericAdaptorBase; +public: + MapAndBatchDatasetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MapAndBatchDatasetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MapAndBatchDatasetOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MapAndBatchDatasetOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputDataset() { + return (*getODSOperands(0).begin()); + } + + RangeT getOtherArguments() { + return getODSOperands(1); + } + + ValueT getBatchSize() { + return (*getODSOperands(2).begin()); + } + + ValueT getNumParallelCalls() { + return (*getODSOperands(3).begin()); + } + + ValueT getDropRemainder() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MapAndBatchDatasetOpAdaptor : public MapAndBatchDatasetOpGenericAdaptor<::mlir::ValueRange> { +public: + using MapAndBatchDatasetOpGenericAdaptor::MapAndBatchDatasetOpGenericAdaptor; + MapAndBatchDatasetOpAdaptor(MapAndBatchDatasetOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MapAndBatchDatasetOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MapAndBatchDatasetOpAdaptor; + template + using GenericAdaptor = MapAndBatchDatasetOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Targuments"), ::llvm::StringRef("f"), ::llvm::StringRef("metadata"), ::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types"), ::llvm::StringRef("preserve_cardinality")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTargumentsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTargumentsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getFAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getFAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getMetadataAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getMetadataAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getPreserveCardinalityAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getPreserveCardinalityAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MapAndBatchDataset"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputDataset(); + ::mlir::Operation::operand_range getOtherArguments(); + ::mlir::TypedValue<::mlir::TensorType> getBatchSize(); + ::mlir::TypedValue<::mlir::TensorType> getNumParallelCalls(); + ::mlir::TypedValue<::mlir::TensorType> getDropRemainder(); + ::mlir::OpOperand &getInputDatasetMutable(); + ::mlir::MutableOperandRange getOtherArgumentsMutable(); + ::mlir::OpOperand &getBatchSizeMutable(); + ::mlir::OpOperand &getNumParallelCallsMutable(); + ::mlir::OpOperand &getDropRemainderMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::SymbolRefAttr getFAttr(); + ::mlir::SymbolRefAttr getF(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::BoolAttr getPreserveCardinalityAttr(); + bool getPreserveCardinality(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); + mlir::OperandElementTypeRange getTarguments(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setFAttr(::mlir::SymbolRefAttr attr); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + void setPreserveCardinalityAttr(::mlir::BoolAttr attr); + void setPreserveCardinality(::std::optional attrValue); + void setMetadataAttr(::mlir::StringAttr attr); + void setMetadata(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removePreserveCardinalityAttr(); + ::mlir::Attribute removeMetadataAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, ::mlir::ValueRange other_arguments, ::mlir::Value batch_size, ::mlir::Value num_parallel_calls, ::mlir::Value drop_remainder, ::mlir::SymbolRefAttr f, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::BoolAttr preserve_cardinality, /*optional*/::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, ::mlir::ValueRange other_arguments, ::mlir::Value batch_size, ::mlir::Value num_parallel_calls, ::mlir::Value drop_remainder, ::mlir::SymbolRefAttr f, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::BoolAttr preserve_cardinality, /*optional*/::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, ::mlir::ValueRange other_arguments, ::mlir::Value batch_size, ::mlir::Value num_parallel_calls, ::mlir::Value drop_remainder, ::mlir::SymbolRefAttr f, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/bool preserve_cardinality = false, /*optional*/::llvm::StringRef metadata = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, ::mlir::ValueRange other_arguments, ::mlir::Value batch_size, ::mlir::Value num_parallel_calls, ::mlir::Value drop_remainder, ::mlir::SymbolRefAttr f, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/bool preserve_cardinality = false, /*optional*/::llvm::StringRef metadata = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MapAndBatchDatasetOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MapDatasetOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MapDatasetOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MapDatasetOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MapDatasetOpGenericAdaptorBase(MapDatasetOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::SymbolRefAttr getFAttr(); + ::mlir::SymbolRefAttr getF(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::BoolAttr getUseInterOpParallelismAttr(); + bool getUseInterOpParallelism(); + ::mlir::BoolAttr getPreserveCardinalityAttr(); + bool getPreserveCardinality(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); +}; +} // namespace detail +template +class MapDatasetOpGenericAdaptor : public detail::MapDatasetOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MapDatasetOpGenericAdaptorBase; +public: + MapDatasetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MapDatasetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MapDatasetOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MapDatasetOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputDataset() { + return (*getODSOperands(0).begin()); + } + + RangeT getOtherArguments() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MapDatasetOpAdaptor : public MapDatasetOpGenericAdaptor<::mlir::ValueRange> { +public: + using MapDatasetOpGenericAdaptor::MapDatasetOpGenericAdaptor; + MapDatasetOpAdaptor(MapDatasetOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MapDatasetOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MapDatasetOpAdaptor; + template + using GenericAdaptor = MapDatasetOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Targuments"), ::llvm::StringRef("f"), ::llvm::StringRef("metadata"), ::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types"), ::llvm::StringRef("preserve_cardinality"), ::llvm::StringRef("use_inter_op_parallelism")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTargumentsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTargumentsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getFAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getFAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getMetadataAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getMetadataAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getPreserveCardinalityAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getPreserveCardinalityAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getUseInterOpParallelismAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getUseInterOpParallelismAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MapDataset"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputDataset(); + ::mlir::Operation::operand_range getOtherArguments(); + ::mlir::OpOperand &getInputDatasetMutable(); + ::mlir::MutableOperandRange getOtherArgumentsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::SymbolRefAttr getFAttr(); + ::mlir::SymbolRefAttr getF(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::BoolAttr getUseInterOpParallelismAttr(); + bool getUseInterOpParallelism(); + ::mlir::BoolAttr getPreserveCardinalityAttr(); + bool getPreserveCardinality(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); + mlir::OperandElementTypeRange getTarguments(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setFAttr(::mlir::SymbolRefAttr attr); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + void setUseInterOpParallelismAttr(::mlir::BoolAttr attr); + void setUseInterOpParallelism(::std::optional attrValue); + void setPreserveCardinalityAttr(::mlir::BoolAttr attr); + void setPreserveCardinality(::std::optional attrValue); + void setMetadataAttr(::mlir::StringAttr attr); + void setMetadata(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeUseInterOpParallelismAttr(); + ::mlir::Attribute removePreserveCardinalityAttr(); + ::mlir::Attribute removeMetadataAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, ::mlir::ValueRange other_arguments, ::mlir::SymbolRefAttr f, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::BoolAttr use_inter_op_parallelism, /*optional*/::mlir::BoolAttr preserve_cardinality, /*optional*/::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, ::mlir::ValueRange other_arguments, ::mlir::SymbolRefAttr f, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::BoolAttr use_inter_op_parallelism, /*optional*/::mlir::BoolAttr preserve_cardinality, /*optional*/::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, ::mlir::ValueRange other_arguments, ::mlir::SymbolRefAttr f, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/bool use_inter_op_parallelism = true, /*optional*/bool preserve_cardinality = false, /*optional*/::llvm::StringRef metadata = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, ::mlir::ValueRange other_arguments, ::mlir::SymbolRefAttr f, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/bool use_inter_op_parallelism = true, /*optional*/bool preserve_cardinality = false, /*optional*/::llvm::StringRef metadata = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 7 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MapDatasetOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MatMulOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MatMulOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MatMulOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MatMulOpGenericAdaptorBase(MatMulOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getTransposeAAttr(); + bool getTransposeA(); + ::mlir::BoolAttr getTransposeBAttr(); + bool getTransposeB(); +}; +} // namespace detail +template +class MatMulOpGenericAdaptor : public detail::MatMulOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MatMulOpGenericAdaptorBase; +public: + MatMulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MatMulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MatMulOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MatMulOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + ValueT getB() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MatMulOpAdaptor : public MatMulOpGenericAdaptor<::mlir::ValueRange> { +public: + using MatMulOpGenericAdaptor::MatMulOpGenericAdaptor; + MatMulOpAdaptor(MatMulOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MatMulOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::SameOperandsAndResultElementTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MatMulOpAdaptor; + template + using GenericAdaptor = MatMulOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("transpose_a"), ::llvm::StringRef("transpose_b")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTransposeAAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTransposeAAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTransposeBAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTransposeBAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MatMul"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getA(); + ::mlir::TypedValue<::mlir::TensorType> getB(); + ::mlir::OpOperand &getAMutable(); + ::mlir::OpOperand &getBMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getProduct(); + ::mlir::BoolAttr getTransposeAAttr(); + bool getTransposeA(); + ::mlir::BoolAttr getTransposeBAttr(); + bool getTransposeB(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setTransposeAAttr(::mlir::BoolAttr attr); + void setTransposeA(::std::optional attrValue); + void setTransposeBAttr(::mlir::BoolAttr attr); + void setTransposeB(::std::optional attrValue); + ::mlir::Attribute removeTransposeAAttr(); + ::mlir::Attribute removeTransposeBAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type product, ::mlir::Value a, ::mlir::Value b, /*optional*/::mlir::BoolAttr transpose_a, /*optional*/::mlir::BoolAttr transpose_b); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, /*optional*/::mlir::BoolAttr transpose_a, /*optional*/::mlir::BoolAttr transpose_b); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type product, ::mlir::Value a, ::mlir::Value b, /*optional*/bool transpose_a = false, /*optional*/bool transpose_b = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, /*optional*/bool transpose_a = false, /*optional*/bool transpose_b = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MatMulOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MatrixBandPartOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MatrixBandPartOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MatrixBandPartOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MatrixBandPartOpGenericAdaptorBase(MatrixBandPartOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MatrixBandPartOpGenericAdaptor : public detail::MatrixBandPartOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MatrixBandPartOpGenericAdaptorBase; +public: + MatrixBandPartOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MatrixBandPartOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MatrixBandPartOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MatrixBandPartOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getNumLower() { + return (*getODSOperands(1).begin()); + } + + ValueT getNumUpper() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MatrixBandPartOpAdaptor : public MatrixBandPartOpGenericAdaptor<::mlir::ValueRange> { +public: + using MatrixBandPartOpGenericAdaptor::MatrixBandPartOpGenericAdaptor; + MatrixBandPartOpAdaptor(MatrixBandPartOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MatrixBandPartOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MatrixBandPartOpAdaptor; + template + using GenericAdaptor = MatrixBandPartOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindex")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindexAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MatrixBandPart"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getNumLower(); + ::mlir::TypedValue<::mlir::TensorType> getNumUpper(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getNumLowerMutable(); + ::mlir::OpOperand &getNumUpperMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getBand(); + ::mlir::Type getT(); + ::mlir::Type getTindex(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type band, ::mlir::Value input, ::mlir::Value num_lower, ::mlir::Value num_upper); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value num_lower, ::mlir::Value num_upper); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MatrixBandPartOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MatrixDiagOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MatrixDiagOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MatrixDiagOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MatrixDiagOpGenericAdaptorBase(MatrixDiagOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MatrixDiagOpGenericAdaptor : public detail::MatrixDiagOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MatrixDiagOpGenericAdaptorBase; +public: + MatrixDiagOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MatrixDiagOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MatrixDiagOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MatrixDiagOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getDiagonal() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MatrixDiagOpAdaptor : public MatrixDiagOpGenericAdaptor<::mlir::ValueRange> { +public: + using MatrixDiagOpGenericAdaptor::MatrixDiagOpGenericAdaptor; + MatrixDiagOpAdaptor(MatrixDiagOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MatrixDiagOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MatrixDiagOpAdaptor; + template + using GenericAdaptor = MatrixDiagOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MatrixDiag"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getDiagonal(); + ::mlir::OpOperand &getDiagonalMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value diagonal); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value diagonal); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MatrixDiagOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MatrixDiagPartV3Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MatrixDiagPartV3OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MatrixDiagPartV3OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MatrixDiagPartV3OpGenericAdaptorBase(MatrixDiagPartV3Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getAlignAttr(); + ::llvm::StringRef getAlign(); +}; +} // namespace detail +template +class MatrixDiagPartV3OpGenericAdaptor : public detail::MatrixDiagPartV3OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MatrixDiagPartV3OpGenericAdaptorBase; +public: + MatrixDiagPartV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MatrixDiagPartV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MatrixDiagPartV3OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MatrixDiagPartV3OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getK() { + return (*getODSOperands(1).begin()); + } + + ValueT getPaddingValue() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MatrixDiagPartV3OpAdaptor : public MatrixDiagPartV3OpGenericAdaptor<::mlir::ValueRange> { +public: + using MatrixDiagPartV3OpGenericAdaptor::MatrixDiagPartV3OpGenericAdaptor; + MatrixDiagPartV3OpAdaptor(MatrixDiagPartV3Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MatrixDiagPartV3Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MatrixDiagPartV3OpAdaptor; + template + using GenericAdaptor = MatrixDiagPartV3OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("align")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAlignAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAlignAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MatrixDiagPartV3"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getK(); + ::mlir::TypedValue<::mlir::TensorType> getPaddingValue(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getKMutable(); + ::mlir::OpOperand &getPaddingValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getDiagonal(); + ::mlir::StringAttr getAlignAttr(); + ::llvm::StringRef getAlign(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setAlignAttr(::mlir::StringAttr attr); + void setAlign(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeAlignAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type diagonal, ::mlir::Value input, ::mlir::Value k, ::mlir::Value padding_value, /*optional*/::mlir::StringAttr align); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value k, ::mlir::Value padding_value, /*optional*/::mlir::StringAttr align); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type diagonal, ::mlir::Value input, ::mlir::Value k, ::mlir::Value padding_value, /*optional*/::llvm::StringRef align = "RIGHT_LEFT"); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value k, ::mlir::Value padding_value, /*optional*/::llvm::StringRef align = "RIGHT_LEFT"); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MatrixDiagPartV3Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MatrixDiagV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MatrixDiagV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MatrixDiagV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MatrixDiagV2OpGenericAdaptorBase(MatrixDiagV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MatrixDiagV2OpGenericAdaptor : public detail::MatrixDiagV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MatrixDiagV2OpGenericAdaptorBase; +public: + MatrixDiagV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MatrixDiagV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MatrixDiagV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MatrixDiagV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getDiagonal() { + return (*getODSOperands(0).begin()); + } + + ValueT getK() { + return (*getODSOperands(1).begin()); + } + + ValueT getNumRows() { + return (*getODSOperands(2).begin()); + } + + ValueT getNumCols() { + return (*getODSOperands(3).begin()); + } + + ValueT getPaddingValue() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MatrixDiagV2OpAdaptor : public MatrixDiagV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using MatrixDiagV2OpGenericAdaptor::MatrixDiagV2OpGenericAdaptor; + MatrixDiagV2OpAdaptor(MatrixDiagV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MatrixDiagV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<5>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MatrixDiagV2OpAdaptor; + template + using GenericAdaptor = MatrixDiagV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MatrixDiagV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getDiagonal(); + ::mlir::TypedValue<::mlir::TensorType> getK(); + ::mlir::TypedValue<::mlir::TensorType> getNumRows(); + ::mlir::TypedValue<::mlir::TensorType> getNumCols(); + ::mlir::TypedValue<::mlir::TensorType> getPaddingValue(); + ::mlir::OpOperand &getDiagonalMutable(); + ::mlir::OpOperand &getKMutable(); + ::mlir::OpOperand &getNumRowsMutable(); + ::mlir::OpOperand &getNumColsMutable(); + ::mlir::OpOperand &getPaddingValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value diagonal, ::mlir::Value k, ::mlir::Value num_rows, ::mlir::Value num_cols, ::mlir::Value padding_value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value diagonal, ::mlir::Value k, ::mlir::Value num_rows, ::mlir::Value num_cols, ::mlir::Value padding_value); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MatrixDiagV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MatrixDiagV3Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MatrixDiagV3OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MatrixDiagV3OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MatrixDiagV3OpGenericAdaptorBase(MatrixDiagV3Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getAlignAttr(); + ::llvm::StringRef getAlign(); +}; +} // namespace detail +template +class MatrixDiagV3OpGenericAdaptor : public detail::MatrixDiagV3OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MatrixDiagV3OpGenericAdaptorBase; +public: + MatrixDiagV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MatrixDiagV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MatrixDiagV3OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MatrixDiagV3OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getDiagonal() { + return (*getODSOperands(0).begin()); + } + + ValueT getK() { + return (*getODSOperands(1).begin()); + } + + ValueT getNumRows() { + return (*getODSOperands(2).begin()); + } + + ValueT getNumCols() { + return (*getODSOperands(3).begin()); + } + + ValueT getPaddingValue() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MatrixDiagV3OpAdaptor : public MatrixDiagV3OpGenericAdaptor<::mlir::ValueRange> { +public: + using MatrixDiagV3OpGenericAdaptor::MatrixDiagV3OpGenericAdaptor; + MatrixDiagV3OpAdaptor(MatrixDiagV3Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MatrixDiagV3Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<5>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MatrixDiagV3OpAdaptor; + template + using GenericAdaptor = MatrixDiagV3OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("align")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAlignAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAlignAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MatrixDiagV3"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getDiagonal(); + ::mlir::TypedValue<::mlir::TensorType> getK(); + ::mlir::TypedValue<::mlir::TensorType> getNumRows(); + ::mlir::TypedValue<::mlir::TensorType> getNumCols(); + ::mlir::TypedValue<::mlir::TensorType> getPaddingValue(); + ::mlir::OpOperand &getDiagonalMutable(); + ::mlir::OpOperand &getKMutable(); + ::mlir::OpOperand &getNumRowsMutable(); + ::mlir::OpOperand &getNumColsMutable(); + ::mlir::OpOperand &getPaddingValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::StringAttr getAlignAttr(); + ::llvm::StringRef getAlign(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setAlignAttr(::mlir::StringAttr attr); + void setAlign(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeAlignAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value diagonal, ::mlir::Value k, ::mlir::Value num_rows, ::mlir::Value num_cols, ::mlir::Value padding_value, /*optional*/::mlir::StringAttr align); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value diagonal, ::mlir::Value k, ::mlir::Value num_rows, ::mlir::Value num_cols, ::mlir::Value padding_value, /*optional*/::mlir::StringAttr align); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value diagonal, ::mlir::Value k, ::mlir::Value num_rows, ::mlir::Value num_cols, ::mlir::Value padding_value, /*optional*/::llvm::StringRef align = "RIGHT_LEFT"); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value diagonal, ::mlir::Value k, ::mlir::Value num_rows, ::mlir::Value num_cols, ::mlir::Value padding_value, /*optional*/::llvm::StringRef align = "RIGHT_LEFT"); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MatrixDiagV3Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MatrixInverseOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MatrixInverseOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MatrixInverseOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MatrixInverseOpGenericAdaptorBase(MatrixInverseOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getAdjointAttr(); + bool getAdjoint(); +}; +} // namespace detail +template +class MatrixInverseOpGenericAdaptor : public detail::MatrixInverseOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MatrixInverseOpGenericAdaptorBase; +public: + MatrixInverseOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MatrixInverseOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MatrixInverseOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MatrixInverseOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MatrixInverseOpAdaptor : public MatrixInverseOpGenericAdaptor<::mlir::ValueRange> { +public: + using MatrixInverseOpGenericAdaptor::MatrixInverseOpGenericAdaptor; + MatrixInverseOpAdaptor(MatrixInverseOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MatrixInverseOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MatrixInverseOpAdaptor; + template + using GenericAdaptor = MatrixInverseOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("adjoint")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAdjointAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAdjointAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MatrixInverse"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getAdjointAttr(); + bool getAdjoint(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setAdjointAttr(::mlir::BoolAttr attr); + void setAdjoint(::std::optional attrValue); + ::mlir::Attribute removeAdjointAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, /*optional*/::mlir::BoolAttr adjoint); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, /*optional*/::mlir::BoolAttr adjoint); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, /*optional*/bool adjoint = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, /*optional*/bool adjoint = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MatrixInverseOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MatrixSetDiagOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MatrixSetDiagOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MatrixSetDiagOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MatrixSetDiagOpGenericAdaptorBase(MatrixSetDiagOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MatrixSetDiagOpGenericAdaptor : public detail::MatrixSetDiagOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MatrixSetDiagOpGenericAdaptorBase; +public: + MatrixSetDiagOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MatrixSetDiagOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MatrixSetDiagOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MatrixSetDiagOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getDiagonal() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MatrixSetDiagOpAdaptor : public MatrixSetDiagOpGenericAdaptor<::mlir::ValueRange> { +public: + using MatrixSetDiagOpGenericAdaptor::MatrixSetDiagOpGenericAdaptor; + MatrixSetDiagOpAdaptor(MatrixSetDiagOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MatrixSetDiagOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MatrixSetDiagOpAdaptor; + template + using GenericAdaptor = MatrixSetDiagOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MatrixSetDiag"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getDiagonal(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getDiagonalMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value diagonal); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value diagonal); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MatrixSetDiagOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MatrixSetDiagV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MatrixSetDiagV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MatrixSetDiagV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MatrixSetDiagV2OpGenericAdaptorBase(MatrixSetDiagV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MatrixSetDiagV2OpGenericAdaptor : public detail::MatrixSetDiagV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MatrixSetDiagV2OpGenericAdaptorBase; +public: + MatrixSetDiagV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MatrixSetDiagV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MatrixSetDiagV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MatrixSetDiagV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getDiagonal() { + return (*getODSOperands(1).begin()); + } + + ValueT getK() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MatrixSetDiagV2OpAdaptor : public MatrixSetDiagV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using MatrixSetDiagV2OpGenericAdaptor::MatrixSetDiagV2OpGenericAdaptor; + MatrixSetDiagV2OpAdaptor(MatrixSetDiagV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MatrixSetDiagV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MatrixSetDiagV2OpAdaptor; + template + using GenericAdaptor = MatrixSetDiagV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MatrixSetDiagV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getDiagonal(); + ::mlir::TypedValue<::mlir::TensorType> getK(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getDiagonalMutable(); + ::mlir::OpOperand &getKMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value diagonal, ::mlir::Value k); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value diagonal, ::mlir::Value k); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MatrixSetDiagV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MatrixSetDiagV3Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MatrixSetDiagV3OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MatrixSetDiagV3OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MatrixSetDiagV3OpGenericAdaptorBase(MatrixSetDiagV3Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getAlignAttr(); + ::llvm::StringRef getAlign(); +}; +} // namespace detail +template +class MatrixSetDiagV3OpGenericAdaptor : public detail::MatrixSetDiagV3OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MatrixSetDiagV3OpGenericAdaptorBase; +public: + MatrixSetDiagV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MatrixSetDiagV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MatrixSetDiagV3OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MatrixSetDiagV3OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getDiagonal() { + return (*getODSOperands(1).begin()); + } + + ValueT getK() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MatrixSetDiagV3OpAdaptor : public MatrixSetDiagV3OpGenericAdaptor<::mlir::ValueRange> { +public: + using MatrixSetDiagV3OpGenericAdaptor::MatrixSetDiagV3OpGenericAdaptor; + MatrixSetDiagV3OpAdaptor(MatrixSetDiagV3Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MatrixSetDiagV3Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MatrixSetDiagV3OpAdaptor; + template + using GenericAdaptor = MatrixSetDiagV3OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("align")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAlignAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAlignAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MatrixSetDiagV3"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getDiagonal(); + ::mlir::TypedValue<::mlir::TensorType> getK(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getDiagonalMutable(); + ::mlir::OpOperand &getKMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::StringAttr getAlignAttr(); + ::llvm::StringRef getAlign(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setAlignAttr(::mlir::StringAttr attr); + void setAlign(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeAlignAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value diagonal, ::mlir::Value k, /*optional*/::mlir::StringAttr align); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value diagonal, ::mlir::Value k, /*optional*/::mlir::StringAttr align); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value diagonal, ::mlir::Value k, /*optional*/::llvm::StringRef align = "RIGHT_LEFT"); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value diagonal, ::mlir::Value k, /*optional*/::llvm::StringRef align = "RIGHT_LEFT"); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MatrixSetDiagV3Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MatrixSolveOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MatrixSolveOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MatrixSolveOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MatrixSolveOpGenericAdaptorBase(MatrixSolveOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getAdjointAttr(); + bool getAdjoint(); +}; +} // namespace detail +template +class MatrixSolveOpGenericAdaptor : public detail::MatrixSolveOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MatrixSolveOpGenericAdaptorBase; +public: + MatrixSolveOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MatrixSolveOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MatrixSolveOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MatrixSolveOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getMatrix() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MatrixSolveOpAdaptor : public MatrixSolveOpGenericAdaptor<::mlir::ValueRange> { +public: + using MatrixSolveOpGenericAdaptor::MatrixSolveOpGenericAdaptor; + MatrixSolveOpAdaptor(MatrixSolveOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MatrixSolveOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MatrixSolveOpAdaptor; + template + using GenericAdaptor = MatrixSolveOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("adjoint")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAdjointAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAdjointAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MatrixSolve"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getMatrix(); + ::mlir::TypedValue<::mlir::TensorType> getRhs(); + ::mlir::OpOperand &getMatrixMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getAdjointAttr(); + bool getAdjoint(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setAdjointAttr(::mlir::BoolAttr attr); + void setAdjoint(::std::optional attrValue); + ::mlir::Attribute removeAdjointAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value matrix, ::mlir::Value rhs, /*optional*/::mlir::BoolAttr adjoint); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value matrix, ::mlir::Value rhs, /*optional*/::mlir::BoolAttr adjoint); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value matrix, ::mlir::Value rhs, /*optional*/bool adjoint = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value matrix, ::mlir::Value rhs, /*optional*/bool adjoint = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MatrixSolveOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MatrixTriangularSolveOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MatrixTriangularSolveOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MatrixTriangularSolveOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MatrixTriangularSolveOpGenericAdaptorBase(MatrixTriangularSolveOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getLowerAttr(); + bool getLower(); + ::mlir::BoolAttr getAdjointAttr(); + bool getAdjoint(); +}; +} // namespace detail +template +class MatrixTriangularSolveOpGenericAdaptor : public detail::MatrixTriangularSolveOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MatrixTriangularSolveOpGenericAdaptorBase; +public: + MatrixTriangularSolveOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MatrixTriangularSolveOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MatrixTriangularSolveOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MatrixTriangularSolveOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getMatrix() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MatrixTriangularSolveOpAdaptor : public MatrixTriangularSolveOpGenericAdaptor<::mlir::ValueRange> { +public: + using MatrixTriangularSolveOpGenericAdaptor::MatrixTriangularSolveOpGenericAdaptor; + MatrixTriangularSolveOpAdaptor(MatrixTriangularSolveOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MatrixTriangularSolveOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MatrixTriangularSolveOpAdaptor; + template + using GenericAdaptor = MatrixTriangularSolveOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("adjoint"), ::llvm::StringRef("lower")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAdjointAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAdjointAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getLowerAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getLowerAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MatrixTriangularSolve"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getMatrix(); + ::mlir::TypedValue<::mlir::TensorType> getRhs(); + ::mlir::OpOperand &getMatrixMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getLowerAttr(); + bool getLower(); + ::mlir::BoolAttr getAdjointAttr(); + bool getAdjoint(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setLowerAttr(::mlir::BoolAttr attr); + void setLower(::std::optional attrValue); + void setAdjointAttr(::mlir::BoolAttr attr); + void setAdjoint(::std::optional attrValue); + ::mlir::Attribute removeLowerAttr(); + ::mlir::Attribute removeAdjointAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value matrix, ::mlir::Value rhs, /*optional*/::mlir::BoolAttr lower, /*optional*/::mlir::BoolAttr adjoint); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value matrix, ::mlir::Value rhs, /*optional*/::mlir::BoolAttr lower, /*optional*/::mlir::BoolAttr adjoint); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value matrix, ::mlir::Value rhs, /*optional*/bool lower = true, /*optional*/bool adjoint = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value matrix, ::mlir::Value rhs, /*optional*/bool lower = true, /*optional*/bool adjoint = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MatrixTriangularSolveOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MaxOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MaxOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MaxOpGenericAdaptorBase(MaxOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getKeepDimsAttr(); + bool getKeepDims(); +}; +} // namespace detail +template +class MaxOpGenericAdaptor : public detail::MaxOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MaxOpGenericAdaptorBase; +public: + MaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MaxOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MaxOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getReductionIndices() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MaxOpAdaptor : public MaxOpGenericAdaptor<::mlir::ValueRange> { +public: + using MaxOpGenericAdaptor::MaxOpGenericAdaptor; + MaxOpAdaptor(MaxOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MaxOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MaxOpAdaptor; + template + using GenericAdaptor = MaxOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tidx"), ::llvm::StringRef("keep_dims")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTidxAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTidxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getKeepDimsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getKeepDimsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Max"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getReductionIndices(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getReductionIndicesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getKeepDimsAttr(); + bool getKeepDims(); + ::mlir::Type getT(); + ::mlir::Type getTidx(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setKeepDimsAttr(::mlir::BoolAttr attr); + void setKeepDims(::std::optional attrValue); + ::mlir::Attribute removeKeepDimsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value input, Value reduction_indices, BoolAttr keep_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value reduction_indices, /*optional*/::mlir::BoolAttr keep_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value reduction_indices, /*optional*/::mlir::BoolAttr keep_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value reduction_indices, /*optional*/bool keep_dims = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value reduction_indices, /*optional*/bool keep_dims = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MaxOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MaxPool3DGradGradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MaxPool3DGradGradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MaxPool3DGradGradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MaxPool3DGradGradOpGenericAdaptorBase(MaxPool3DGradGradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getKsizeAttr(); + ::mlir::ArrayAttr getKsize(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); +}; +} // namespace detail +template +class MaxPool3DGradGradOpGenericAdaptor : public detail::MaxPool3DGradGradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MaxPool3DGradGradOpGenericAdaptorBase; +public: + MaxPool3DGradGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MaxPool3DGradGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MaxPool3DGradGradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MaxPool3DGradGradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOrigInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getOrigOutput() { + return (*getODSOperands(1).begin()); + } + + ValueT getGrad() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MaxPool3DGradGradOpAdaptor : public MaxPool3DGradGradOpGenericAdaptor<::mlir::ValueRange> { +public: + using MaxPool3DGradGradOpGenericAdaptor::MaxPool3DGradGradOpGenericAdaptor; + MaxPool3DGradGradOpAdaptor(MaxPool3DGradGradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MaxPool3DGradGradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MaxPool3DGradGradOpAdaptor; + template + using GenericAdaptor = MaxPool3DGradGradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("data_format"), ::llvm::StringRef("ksize"), ::llvm::StringRef("padding"), ::llvm::StringRef("strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getKsizeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getKsizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MaxPool3DGradGrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOrigInput(); + ::mlir::TypedValue<::mlir::TensorType> getOrigOutput(); + ::mlir::TypedValue<::mlir::TensorType> getGrad(); + ::mlir::OpOperand &getOrigInputMutable(); + ::mlir::OpOperand &getOrigOutputMutable(); + ::mlir::OpOperand &getGradMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ArrayAttr getKsizeAttr(); + ::mlir::ArrayAttr getKsize(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setKsizeAttr(::mlir::ArrayAttr attr); + void setStridesAttr(::mlir::ArrayAttr attr); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeDataFormatAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value orig_input, ::mlir::Value orig_output, ::mlir::Value grad, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value orig_input, ::mlir::Value orig_output, ::mlir::Value grad, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value orig_input, ::mlir::Value orig_output, ::mlir::Value grad, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::llvm::StringRef data_format = "NDHWC"); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value orig_input, ::mlir::Value orig_output, ::mlir::Value grad, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::llvm::StringRef data_format = "NDHWC"); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MaxPool3DGradGradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MaxPool3DGradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MaxPool3DGradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MaxPool3DGradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MaxPool3DGradOpGenericAdaptorBase(MaxPool3DGradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getKsizeAttr(); + ::mlir::ArrayAttr getKsize(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); +}; +} // namespace detail +template +class MaxPool3DGradOpGenericAdaptor : public detail::MaxPool3DGradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MaxPool3DGradOpGenericAdaptorBase; +public: + MaxPool3DGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MaxPool3DGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MaxPool3DGradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MaxPool3DGradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOrigInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getOrigOutput() { + return (*getODSOperands(1).begin()); + } + + ValueT getGrad() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MaxPool3DGradOpAdaptor : public MaxPool3DGradOpGenericAdaptor<::mlir::ValueRange> { +public: + using MaxPool3DGradOpGenericAdaptor::MaxPool3DGradOpGenericAdaptor; + MaxPool3DGradOpAdaptor(MaxPool3DGradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MaxPool3DGradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MaxPool3DGradOpAdaptor; + template + using GenericAdaptor = MaxPool3DGradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("TInput"), ::llvm::StringRef("data_format"), ::llvm::StringRef("ksize"), ::llvm::StringRef("padding"), ::llvm::StringRef("strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTInputAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTInputAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getKsizeAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getKsizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MaxPool3DGrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOrigInput(); + ::mlir::TypedValue<::mlir::TensorType> getOrigOutput(); + ::mlir::TypedValue<::mlir::TensorType> getGrad(); + ::mlir::OpOperand &getOrigInputMutable(); + ::mlir::OpOperand &getOrigOutputMutable(); + ::mlir::OpOperand &getGradMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ArrayAttr getKsizeAttr(); + ::mlir::ArrayAttr getKsize(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::Type getT(); + ::mlir::Type getTInput(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setKsizeAttr(::mlir::ArrayAttr attr); + void setStridesAttr(::mlir::ArrayAttr attr); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeDataFormatAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value orig_input, ::mlir::Value orig_output, ::mlir::Value grad, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value orig_input, ::mlir::Value orig_output, ::mlir::Value grad, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value orig_input, ::mlir::Value orig_output, ::mlir::Value grad, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::llvm::StringRef data_format = "NDHWC"); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value orig_input, ::mlir::Value orig_output, ::mlir::Value grad, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::llvm::StringRef data_format = "NDHWC"); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MaxPool3DGradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MaxPool3DOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MaxPool3DOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MaxPool3DOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MaxPool3DOpGenericAdaptorBase(MaxPool3DOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getKsizeAttr(); + ::mlir::ArrayAttr getKsize(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); +}; +} // namespace detail +template +class MaxPool3DOpGenericAdaptor : public detail::MaxPool3DOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MaxPool3DOpGenericAdaptorBase; +public: + MaxPool3DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MaxPool3DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MaxPool3DOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MaxPool3DOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MaxPool3DOpAdaptor : public MaxPool3DOpGenericAdaptor<::mlir::ValueRange> { +public: + using MaxPool3DOpGenericAdaptor::MaxPool3DOpGenericAdaptor; + MaxPool3DOpAdaptor(MaxPool3DOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MaxPool3DOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MaxPool3DOpAdaptor; + template + using GenericAdaptor = MaxPool3DOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("data_format"), ::llvm::StringRef("ksize"), ::llvm::StringRef("padding"), ::llvm::StringRef("strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getKsizeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getKsizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MaxPool3D"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ArrayAttr getKsizeAttr(); + ::mlir::ArrayAttr getKsize(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setKsizeAttr(::mlir::ArrayAttr attr); + void setStridesAttr(::mlir::ArrayAttr attr); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeDataFormatAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::llvm::StringRef data_format = "NDHWC"); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::llvm::StringRef data_format = "NDHWC"); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MaxPool3DOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MaxPoolGradGradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MaxPoolGradGradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MaxPoolGradGradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MaxPoolGradGradOpGenericAdaptorBase(MaxPoolGradGradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getKsizeAttr(); + ::mlir::ArrayAttr getKsize(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); +}; +} // namespace detail +template +class MaxPoolGradGradOpGenericAdaptor : public detail::MaxPoolGradGradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MaxPoolGradGradOpGenericAdaptorBase; +public: + MaxPoolGradGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MaxPoolGradGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MaxPoolGradGradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MaxPoolGradGradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOrigInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getOrigOutput() { + return (*getODSOperands(1).begin()); + } + + ValueT getGrad() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MaxPoolGradGradOpAdaptor : public MaxPoolGradGradOpGenericAdaptor<::mlir::ValueRange> { +public: + using MaxPoolGradGradOpGenericAdaptor::MaxPoolGradGradOpGenericAdaptor; + MaxPoolGradGradOpAdaptor(MaxPoolGradGradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MaxPoolGradGradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MaxPoolGradGradOpAdaptor; + template + using GenericAdaptor = MaxPoolGradGradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("data_format"), ::llvm::StringRef("ksize"), ::llvm::StringRef("padding"), ::llvm::StringRef("strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getKsizeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getKsizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MaxPoolGradGrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOrigInput(); + ::mlir::TypedValue<::mlir::TensorType> getOrigOutput(); + ::mlir::TypedValue<::mlir::TensorType> getGrad(); + ::mlir::OpOperand &getOrigInputMutable(); + ::mlir::OpOperand &getOrigOutputMutable(); + ::mlir::OpOperand &getGradMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ArrayAttr getKsizeAttr(); + ::mlir::ArrayAttr getKsize(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setKsizeAttr(::mlir::ArrayAttr attr); + void setStridesAttr(::mlir::ArrayAttr attr); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeDataFormatAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value orig_input, ::mlir::Value orig_output, ::mlir::Value grad, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value orig_input, ::mlir::Value orig_output, ::mlir::Value grad, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value orig_input, ::mlir::Value orig_output, ::mlir::Value grad, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::llvm::StringRef data_format = "NHWC"); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value orig_input, ::mlir::Value orig_output, ::mlir::Value grad, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::llvm::StringRef data_format = "NHWC"); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MaxPoolGradGradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MaxPoolGradGradV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MaxPoolGradGradV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MaxPoolGradGradV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MaxPoolGradGradV2OpGenericAdaptorBase(MaxPoolGradGradV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); +}; +} // namespace detail +template +class MaxPoolGradGradV2OpGenericAdaptor : public detail::MaxPoolGradGradV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MaxPoolGradGradV2OpGenericAdaptorBase; +public: + MaxPoolGradGradV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MaxPoolGradGradV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MaxPoolGradGradV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MaxPoolGradGradV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOrigInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getOrigOutput() { + return (*getODSOperands(1).begin()); + } + + ValueT getGrad() { + return (*getODSOperands(2).begin()); + } + + ValueT getKsize() { + return (*getODSOperands(3).begin()); + } + + ValueT getStrides() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MaxPoolGradGradV2OpAdaptor : public MaxPoolGradGradV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using MaxPoolGradGradV2OpGenericAdaptor::MaxPoolGradGradV2OpGenericAdaptor; + MaxPoolGradGradV2OpAdaptor(MaxPoolGradGradV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MaxPoolGradGradV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<5>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MaxPoolGradGradV2OpAdaptor; + template + using GenericAdaptor = MaxPoolGradGradV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("data_format"), ::llvm::StringRef("padding")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MaxPoolGradGradV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOrigInput(); + ::mlir::TypedValue<::mlir::TensorType> getOrigOutput(); + ::mlir::TypedValue<::mlir::TensorType> getGrad(); + ::mlir::TypedValue<::mlir::TensorType> getKsize(); + ::mlir::TypedValue<::mlir::TensorType> getStrides(); + ::mlir::OpOperand &getOrigInputMutable(); + ::mlir::OpOperand &getOrigOutputMutable(); + ::mlir::OpOperand &getGradMutable(); + ::mlir::OpOperand &getKsizeMutable(); + ::mlir::OpOperand &getStridesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeDataFormatAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value orig_input, ::mlir::Value orig_output, ::mlir::Value grad, ::mlir::Value ksize, ::mlir::Value strides, ::mlir::StringAttr padding, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value orig_input, ::mlir::Value orig_output, ::mlir::Value grad, ::mlir::Value ksize, ::mlir::Value strides, ::mlir::StringAttr padding, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value orig_input, ::mlir::Value orig_output, ::mlir::Value grad, ::mlir::Value ksize, ::mlir::Value strides, ::llvm::StringRef padding, /*optional*/::llvm::StringRef data_format = "NHWC"); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value orig_input, ::mlir::Value orig_output, ::mlir::Value grad, ::mlir::Value ksize, ::mlir::Value strides, ::llvm::StringRef padding, /*optional*/::llvm::StringRef data_format = "NHWC"); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MaxPoolGradGradV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MaxPoolGradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MaxPoolGradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MaxPoolGradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MaxPoolGradOpGenericAdaptorBase(MaxPoolGradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getKsizeAttr(); + ::mlir::ArrayAttr getKsize(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getExplicitPaddingsAttr(); + ::mlir::ArrayAttr getExplicitPaddings(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); +}; +} // namespace detail +template +class MaxPoolGradOpGenericAdaptor : public detail::MaxPoolGradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MaxPoolGradOpGenericAdaptorBase; +public: + MaxPoolGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MaxPoolGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MaxPoolGradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MaxPoolGradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOrigInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getOrigOutput() { + return (*getODSOperands(1).begin()); + } + + ValueT getGrad() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MaxPoolGradOpAdaptor : public MaxPoolGradOpGenericAdaptor<::mlir::ValueRange> { +public: + using MaxPoolGradOpGenericAdaptor::MaxPoolGradOpGenericAdaptor; + MaxPoolGradOpAdaptor(MaxPoolGradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MaxPoolGradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MaxPoolGradOpAdaptor; + template + using GenericAdaptor = MaxPoolGradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("data_format"), ::llvm::StringRef("explicit_paddings"), ::llvm::StringRef("ksize"), ::llvm::StringRef("padding"), ::llvm::StringRef("strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getExplicitPaddingsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getExplicitPaddingsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getKsizeAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getKsizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MaxPoolGrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOrigInput(); + ::mlir::TypedValue<::mlir::TensorType> getOrigOutput(); + ::mlir::TypedValue<::mlir::TensorType> getGrad(); + ::mlir::OpOperand &getOrigInputMutable(); + ::mlir::OpOperand &getOrigOutputMutable(); + ::mlir::OpOperand &getGradMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ArrayAttr getKsizeAttr(); + ::mlir::ArrayAttr getKsize(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getExplicitPaddingsAttr(); + ::mlir::ArrayAttr getExplicitPaddings(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setKsizeAttr(::mlir::ArrayAttr attr); + void setStridesAttr(::mlir::ArrayAttr attr); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + void setExplicitPaddingsAttr(::mlir::ArrayAttr attr); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeExplicitPaddingsAttr(); + ::mlir::Attribute removeDataFormatAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value orig_input, ::mlir::Value orig_output, ::mlir::Value grad, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value orig_input, ::mlir::Value orig_output, ::mlir::Value grad, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value orig_input, ::mlir::Value orig_output, ::mlir::Value grad, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::llvm::StringRef data_format = "NHWC"); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value orig_input, ::mlir::Value orig_output, ::mlir::Value grad, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::llvm::StringRef data_format = "NHWC"); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MaxPoolGradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MaxPoolGradV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MaxPoolGradV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MaxPoolGradV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MaxPoolGradV2OpGenericAdaptorBase(MaxPoolGradV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); +}; +} // namespace detail +template +class MaxPoolGradV2OpGenericAdaptor : public detail::MaxPoolGradV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MaxPoolGradV2OpGenericAdaptorBase; +public: + MaxPoolGradV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MaxPoolGradV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MaxPoolGradV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MaxPoolGradV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOrigInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getOrigOutput() { + return (*getODSOperands(1).begin()); + } + + ValueT getGrad() { + return (*getODSOperands(2).begin()); + } + + ValueT getKsize() { + return (*getODSOperands(3).begin()); + } + + ValueT getStrides() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MaxPoolGradV2OpAdaptor : public MaxPoolGradV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using MaxPoolGradV2OpGenericAdaptor::MaxPoolGradV2OpGenericAdaptor; + MaxPoolGradV2OpAdaptor(MaxPoolGradV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MaxPoolGradV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<5>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MaxPoolGradV2OpAdaptor; + template + using GenericAdaptor = MaxPoolGradV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("data_format"), ::llvm::StringRef("padding")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MaxPoolGradV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOrigInput(); + ::mlir::TypedValue<::mlir::TensorType> getOrigOutput(); + ::mlir::TypedValue<::mlir::TensorType> getGrad(); + ::mlir::TypedValue<::mlir::TensorType> getKsize(); + ::mlir::TypedValue<::mlir::TensorType> getStrides(); + ::mlir::OpOperand &getOrigInputMutable(); + ::mlir::OpOperand &getOrigOutputMutable(); + ::mlir::OpOperand &getGradMutable(); + ::mlir::OpOperand &getKsizeMutable(); + ::mlir::OpOperand &getStridesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeDataFormatAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value orig_input, ::mlir::Value orig_output, ::mlir::Value grad, ::mlir::Value ksize, ::mlir::Value strides, ::mlir::StringAttr padding, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value orig_input, ::mlir::Value orig_output, ::mlir::Value grad, ::mlir::Value ksize, ::mlir::Value strides, ::mlir::StringAttr padding, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value orig_input, ::mlir::Value orig_output, ::mlir::Value grad, ::mlir::Value ksize, ::mlir::Value strides, ::llvm::StringRef padding, /*optional*/::llvm::StringRef data_format = "NHWC"); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value orig_input, ::mlir::Value orig_output, ::mlir::Value grad, ::mlir::Value ksize, ::mlir::Value strides, ::llvm::StringRef padding, /*optional*/::llvm::StringRef data_format = "NHWC"); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MaxPoolGradV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MaxPoolOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MaxPoolOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MaxPoolOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MaxPoolOpGenericAdaptorBase(MaxPoolOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getKsizeAttr(); + ::mlir::ArrayAttr getKsize(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getExplicitPaddingsAttr(); + ::mlir::ArrayAttr getExplicitPaddings(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); +}; +} // namespace detail +template +class MaxPoolOpGenericAdaptor : public detail::MaxPoolOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MaxPoolOpGenericAdaptorBase; +public: + MaxPoolOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MaxPoolOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MaxPoolOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MaxPoolOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MaxPoolOpAdaptor : public MaxPoolOpGenericAdaptor<::mlir::ValueRange> { +public: + using MaxPoolOpGenericAdaptor::MaxPoolOpGenericAdaptor; + MaxPoolOpAdaptor(MaxPoolOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MaxPoolOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, FoldOperandsTransposeInterface::Trait, LayoutSensitiveInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MaxPoolOpAdaptor; + template + using GenericAdaptor = MaxPoolOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("data_format"), ::llvm::StringRef("explicit_paddings"), ::llvm::StringRef("ksize"), ::llvm::StringRef("padding"), ::llvm::StringRef("strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getExplicitPaddingsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getExplicitPaddingsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getKsizeAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getKsizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MaxPool"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ArrayAttr getKsizeAttr(); + ::mlir::ArrayAttr getKsize(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getExplicitPaddingsAttr(); + ::mlir::ArrayAttr getExplicitPaddings(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setKsizeAttr(::mlir::ArrayAttr attr); + void setStridesAttr(::mlir::ArrayAttr attr); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + void setExplicitPaddingsAttr(::mlir::ArrayAttr attr); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeExplicitPaddingsAttr(); + ::mlir::Attribute removeDataFormatAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::llvm::StringRef data_format = "NHWC"); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::llvm::StringRef data_format = "NHWC"); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // TF_FoldOperandsTransposeInterface: + SmallVector GetLayoutDependentArgs() { return {0}; } + SmallVector GetLayoutDependentResults() { return {0}; } + LogicalResult FoldOperandsPermutation(ArrayRef permutation); + // TF_LayoutSensitiveInterface: + StringRef GetOptimalLayout(const RuntimeDevices& devices); + LogicalResult UpdateDataFormat(StringRef data_format); +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MaxPoolOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MaxPoolV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MaxPoolV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MaxPoolV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MaxPoolV2OpGenericAdaptorBase(MaxPoolV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); +}; +} // namespace detail +template +class MaxPoolV2OpGenericAdaptor : public detail::MaxPoolV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MaxPoolV2OpGenericAdaptorBase; +public: + MaxPoolV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MaxPoolV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MaxPoolV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MaxPoolV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getKsize() { + return (*getODSOperands(1).begin()); + } + + ValueT getStrides() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MaxPoolV2OpAdaptor : public MaxPoolV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using MaxPoolV2OpGenericAdaptor::MaxPoolV2OpGenericAdaptor; + MaxPoolV2OpAdaptor(MaxPoolV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MaxPoolV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MaxPoolV2OpAdaptor; + template + using GenericAdaptor = MaxPoolV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("data_format"), ::llvm::StringRef("padding")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MaxPoolV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getKsize(); + ::mlir::TypedValue<::mlir::TensorType> getStrides(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getKsizeMutable(); + ::mlir::OpOperand &getStridesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeDataFormatAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value ksize, ::mlir::Value strides, ::mlir::StringAttr padding, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value ksize, ::mlir::Value strides, ::mlir::StringAttr padding, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value ksize, ::mlir::Value strides, ::llvm::StringRef padding, /*optional*/::llvm::StringRef data_format = "NHWC"); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value ksize, ::mlir::Value strides, ::llvm::StringRef padding, /*optional*/::llvm::StringRef data_format = "NHWC"); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MaxPoolV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MaximumOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MaximumOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MaximumOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MaximumOpGenericAdaptorBase(MaximumOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MaximumOpGenericAdaptor : public detail::MaximumOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MaximumOpGenericAdaptorBase; +public: + MaximumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MaximumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MaximumOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MaximumOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MaximumOpAdaptor : public MaximumOpGenericAdaptor<::mlir::ValueRange> { +public: + using MaximumOpGenericAdaptor::MaximumOpGenericAdaptor; + MaximumOpAdaptor(MaximumOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MaximumOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::OpTrait::TF::SameOperandsAndResultElementTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MaximumOpAdaptor; + template + using GenericAdaptor = MaximumOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Maximum"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MaximumOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MeanOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MeanOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MeanOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MeanOpGenericAdaptorBase(MeanOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getKeepDimsAttr(); + bool getKeepDims(); +}; +} // namespace detail +template +class MeanOpGenericAdaptor : public detail::MeanOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MeanOpGenericAdaptorBase; +public: + MeanOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MeanOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MeanOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MeanOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getReductionIndices() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MeanOpAdaptor : public MeanOpGenericAdaptor<::mlir::ValueRange> { +public: + using MeanOpGenericAdaptor::MeanOpGenericAdaptor; + MeanOpAdaptor(MeanOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MeanOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, FoldOperandsTransposeInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MeanOpAdaptor; + template + using GenericAdaptor = MeanOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tidx"), ::llvm::StringRef("keep_dims")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTidxAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTidxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getKeepDimsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getKeepDimsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Mean"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getReductionIndices(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getReductionIndicesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getKeepDimsAttr(); + bool getKeepDims(); + ::mlir::Type getT(); + ::mlir::Type getTidx(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setKeepDimsAttr(::mlir::BoolAttr attr); + void setKeepDims(::std::optional attrValue); + ::mlir::Attribute removeKeepDimsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value reduction_indices, /*optional*/::mlir::BoolAttr keep_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value reduction_indices, /*optional*/::mlir::BoolAttr keep_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value reduction_indices, /*optional*/bool keep_dims = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value reduction_indices, /*optional*/bool keep_dims = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // TF_FoldOperandsTransposeInterface: + SmallVector GetLayoutDependentArgs() { return {0}; } + SmallVector GetLayoutDependentResults() { return {}; } + LogicalResult FoldOperandsPermutation(ArrayRef permutation); +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MeanOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MergeSummaryOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MergeSummaryOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MergeSummaryOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MergeSummaryOpGenericAdaptorBase(MergeSummaryOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MergeSummaryOpGenericAdaptor : public detail::MergeSummaryOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MergeSummaryOpGenericAdaptorBase; +public: + MergeSummaryOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MergeSummaryOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MergeSummaryOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MergeSummaryOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MergeSummaryOpAdaptor : public MergeSummaryOpGenericAdaptor<::mlir::ValueRange> { +public: + using MergeSummaryOpGenericAdaptor::MergeSummaryOpGenericAdaptor; + MergeSummaryOpAdaptor(MergeSummaryOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MergeSummaryOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MergeSummaryOpAdaptor; + template + using GenericAdaptor = MergeSummaryOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("N")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MergeSummary"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::MutableOperandRange getInputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSummary(); + size_t getN(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type summary, ::mlir::ValueRange inputs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MergeSummaryOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MergeV2CheckpointsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MergeV2CheckpointsOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MergeV2CheckpointsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MergeV2CheckpointsOpGenericAdaptorBase(MergeV2CheckpointsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getDeleteOldDirsAttr(); + bool getDeleteOldDirs(); + ::mlir::BoolAttr getAllowMissingFilesAttr(); + bool getAllowMissingFiles(); +}; +} // namespace detail +template +class MergeV2CheckpointsOpGenericAdaptor : public detail::MergeV2CheckpointsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MergeV2CheckpointsOpGenericAdaptorBase; +public: + MergeV2CheckpointsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MergeV2CheckpointsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MergeV2CheckpointsOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MergeV2CheckpointsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getCheckpointPrefixes() { + return (*getODSOperands(0).begin()); + } + + ValueT getDestinationPrefix() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MergeV2CheckpointsOpAdaptor : public MergeV2CheckpointsOpGenericAdaptor<::mlir::ValueRange> { +public: + using MergeV2CheckpointsOpGenericAdaptor::MergeV2CheckpointsOpGenericAdaptor; + MergeV2CheckpointsOpAdaptor(MergeV2CheckpointsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MergeV2CheckpointsOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = MergeV2CheckpointsOpAdaptor; + template + using GenericAdaptor = MergeV2CheckpointsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("allow_missing_files"), ::llvm::StringRef("delete_old_dirs")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAllowMissingFilesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAllowMissingFilesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDeleteOldDirsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDeleteOldDirsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MergeV2Checkpoints"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getCheckpointPrefixes(); + ::mlir::TypedValue<::mlir::TensorType> getDestinationPrefix(); + ::mlir::OpOperand &getCheckpointPrefixesMutable(); + ::mlir::OpOperand &getDestinationPrefixMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::BoolAttr getDeleteOldDirsAttr(); + bool getDeleteOldDirs(); + ::mlir::BoolAttr getAllowMissingFilesAttr(); + bool getAllowMissingFiles(); + void setDeleteOldDirsAttr(::mlir::BoolAttr attr); + void setDeleteOldDirs(::std::optional attrValue); + void setAllowMissingFilesAttr(::mlir::BoolAttr attr); + void setAllowMissingFiles(::std::optional attrValue); + ::mlir::Attribute removeDeleteOldDirsAttr(); + ::mlir::Attribute removeAllowMissingFilesAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value checkpoint_prefixes, ::mlir::Value destination_prefix, /*optional*/::mlir::BoolAttr delete_old_dirs, /*optional*/::mlir::BoolAttr allow_missing_files); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value checkpoint_prefixes, ::mlir::Value destination_prefix, /*optional*/::mlir::BoolAttr delete_old_dirs, /*optional*/::mlir::BoolAttr allow_missing_files); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value checkpoint_prefixes, ::mlir::Value destination_prefix, /*optional*/bool delete_old_dirs = true, /*optional*/bool allow_missing_files = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value checkpoint_prefixes, ::mlir::Value destination_prefix, /*optional*/bool delete_old_dirs = true, /*optional*/bool allow_missing_files = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MergeV2CheckpointsOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MinOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MinOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MinOpGenericAdaptorBase(MinOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getKeepDimsAttr(); + bool getKeepDims(); +}; +} // namespace detail +template +class MinOpGenericAdaptor : public detail::MinOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MinOpGenericAdaptorBase; +public: + MinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MinOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MinOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getReductionIndices() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MinOpAdaptor : public MinOpGenericAdaptor<::mlir::ValueRange> { +public: + using MinOpGenericAdaptor::MinOpGenericAdaptor; + MinOpAdaptor(MinOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MinOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MinOpAdaptor; + template + using GenericAdaptor = MinOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tidx"), ::llvm::StringRef("keep_dims")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTidxAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTidxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getKeepDimsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getKeepDimsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Min"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getReductionIndices(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getReductionIndicesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getKeepDimsAttr(); + bool getKeepDims(); + ::mlir::Type getT(); + ::mlir::Type getTidx(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setKeepDimsAttr(::mlir::BoolAttr attr); + void setKeepDims(::std::optional attrValue); + ::mlir::Attribute removeKeepDimsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value reduction_indices, /*optional*/::mlir::BoolAttr keep_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value reduction_indices, /*optional*/::mlir::BoolAttr keep_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value reduction_indices, /*optional*/bool keep_dims = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value reduction_indices, /*optional*/bool keep_dims = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MinOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MinimumOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MinimumOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MinimumOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MinimumOpGenericAdaptorBase(MinimumOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MinimumOpGenericAdaptor : public detail::MinimumOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MinimumOpGenericAdaptorBase; +public: + MinimumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MinimumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MinimumOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MinimumOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MinimumOpAdaptor : public MinimumOpGenericAdaptor<::mlir::ValueRange> { +public: + using MinimumOpGenericAdaptor::MinimumOpGenericAdaptor; + MinimumOpAdaptor(MinimumOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MinimumOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::OpTrait::TF::SameOperandsAndResultElementTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MinimumOpAdaptor; + template + using GenericAdaptor = MinimumOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Minimum"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MinimumOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MirrorPadGradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MirrorPadGradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MirrorPadGradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MirrorPadGradOpGenericAdaptorBase(MirrorPadGradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getModeAttr(); + ::llvm::StringRef getMode(); +}; +} // namespace detail +template +class MirrorPadGradOpGenericAdaptor : public detail::MirrorPadGradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MirrorPadGradOpGenericAdaptorBase; +public: + MirrorPadGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MirrorPadGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MirrorPadGradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MirrorPadGradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getPaddings() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MirrorPadGradOpAdaptor : public MirrorPadGradOpGenericAdaptor<::mlir::ValueRange> { +public: + using MirrorPadGradOpGenericAdaptor::MirrorPadGradOpGenericAdaptor; + MirrorPadGradOpAdaptor(MirrorPadGradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MirrorPadGradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MirrorPadGradOpAdaptor; + template + using GenericAdaptor = MirrorPadGradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tpaddings"), ::llvm::StringRef("mode")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTpaddingsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTpaddingsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getModeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getModeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MirrorPadGrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getPaddings(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getPaddingsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::StringAttr getModeAttr(); + ::llvm::StringRef getMode(); + ::mlir::Type getT(); + ::mlir::Type getTpaddings(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setModeAttr(::mlir::StringAttr attr); + void setMode(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value paddings, ::mlir::StringAttr mode); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value paddings, ::mlir::StringAttr mode); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value paddings, ::llvm::StringRef mode); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value paddings, ::llvm::StringRef mode); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MirrorPadGradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MirrorPadOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MirrorPadOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MirrorPadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MirrorPadOpGenericAdaptorBase(MirrorPadOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getModeAttr(); + ::llvm::StringRef getMode(); +}; +} // namespace detail +template +class MirrorPadOpGenericAdaptor : public detail::MirrorPadOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MirrorPadOpGenericAdaptorBase; +public: + MirrorPadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MirrorPadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MirrorPadOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MirrorPadOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getPaddings() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MirrorPadOpAdaptor : public MirrorPadOpGenericAdaptor<::mlir::ValueRange> { +public: + using MirrorPadOpGenericAdaptor::MirrorPadOpGenericAdaptor; + MirrorPadOpAdaptor(MirrorPadOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MirrorPadOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MirrorPadOpAdaptor; + template + using GenericAdaptor = MirrorPadOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tpaddings"), ::llvm::StringRef("mode")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTpaddingsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTpaddingsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getModeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getModeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MirrorPad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getPaddings(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getPaddingsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::StringAttr getModeAttr(); + ::llvm::StringRef getMode(); + ::mlir::Type getT(); + ::mlir::Type getTpaddings(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setModeAttr(::mlir::StringAttr attr); + void setMode(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value paddings, ::mlir::StringAttr mode); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value paddings, ::mlir::StringAttr mode); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value paddings, ::llvm::StringRef mode); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value paddings, ::llvm::StringRef mode); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MirrorPadOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MlirLocalVarOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MlirLocalVarOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MlirLocalVarOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MlirLocalVarOpGenericAdaptorBase(MlirLocalVarOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MlirLocalVarOpGenericAdaptor : public detail::MlirLocalVarOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MlirLocalVarOpGenericAdaptorBase; +public: + MlirLocalVarOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MlirLocalVarOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MlirLocalVarOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MlirLocalVarOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MlirLocalVarOpAdaptor : public MlirLocalVarOpGenericAdaptor<::mlir::ValueRange> { +public: + using MlirLocalVarOpGenericAdaptor::MlirLocalVarOpGenericAdaptor; + MlirLocalVarOpAdaptor(MlirLocalVarOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MlirLocalVarOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MlirLocalVarOpAdaptor; + template + using GenericAdaptor = MlirLocalVarOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MlirLocalVarOp"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResource(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resource); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MlirLocalVarOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MlirPassthroughOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MlirPassthroughOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MlirPassthroughOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MlirPassthroughOpGenericAdaptorBase(MlirPassthroughOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getMlirModuleAttr(); + ::llvm::StringRef getMlirModule(); +}; +} // namespace detail +template +class MlirPassthroughOpGenericAdaptor : public detail::MlirPassthroughOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MlirPassthroughOpGenericAdaptorBase; +public: + MlirPassthroughOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MlirPassthroughOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MlirPassthroughOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MlirPassthroughOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MlirPassthroughOpAdaptor : public MlirPassthroughOpGenericAdaptor<::mlir::ValueRange> { +public: + using MlirPassthroughOpGenericAdaptor::MlirPassthroughOpGenericAdaptor; + MlirPassthroughOpAdaptor(MlirPassthroughOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MlirPassthroughOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = MlirPassthroughOpAdaptor; + template + using GenericAdaptor = MlirPassthroughOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tinputs"), ::llvm::StringRef("Toutputs"), ::llvm::StringRef("mlir_module")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTinputsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTinputsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getToutputsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getToutputsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getMlirModuleAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getMlirModuleAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MlirPassthroughOp"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::MutableOperandRange getInputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutputs(); + ::mlir::StringAttr getMlirModuleAttr(); + ::llvm::StringRef getMlirModule(); + mlir::OperandElementTypeRange getTinputs(); + mlir::ResultElementTypeRange getToutputs(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setMlirModuleAttr(::mlir::StringAttr attr); + void setMlirModule(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outputs, ::mlir::ValueRange inputs, ::mlir::StringAttr mlir_module); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outputs, ::mlir::ValueRange inputs, ::llvm::StringRef mlir_module); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MlirPassthroughOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ModOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ModOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ModOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ModOpGenericAdaptorBase(ModOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ModOpGenericAdaptor : public detail::ModOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ModOpGenericAdaptorBase; +public: + ModOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ModOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ModOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ModOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ModOpAdaptor : public ModOpGenericAdaptor<::mlir::ValueRange> { +public: + using ModOpGenericAdaptor::ModOpGenericAdaptor; + ModOpAdaptor(ModOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ModOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::OpTrait::TF::SameOperandsAndResultElementTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ModOpAdaptor; + template + using GenericAdaptor = ModOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Mod"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ModOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ModelDatasetOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ModelDatasetOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ModelDatasetOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ModelDatasetOpGenericAdaptorBase(ModelDatasetOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getAlgorithmAttr(); + uint64_t getAlgorithm(); + ::mlir::IntegerAttr getCpuBudgetAttr(); + uint64_t getCpuBudget(); + ::mlir::IntegerAttr getRamBudgetAttr(); + uint64_t getRamBudget(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); +}; +} // namespace detail +template +class ModelDatasetOpGenericAdaptor : public detail::ModelDatasetOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ModelDatasetOpGenericAdaptorBase; +public: + ModelDatasetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ModelDatasetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ModelDatasetOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ModelDatasetOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputDataset() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ModelDatasetOpAdaptor : public ModelDatasetOpGenericAdaptor<::mlir::ValueRange> { +public: + using ModelDatasetOpGenericAdaptor::ModelDatasetOpGenericAdaptor; + ModelDatasetOpAdaptor(ModelDatasetOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ModelDatasetOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ModelDatasetOpAdaptor; + template + using GenericAdaptor = ModelDatasetOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("algorithm"), ::llvm::StringRef("cpu_budget"), ::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types"), ::llvm::StringRef("ram_budget")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAlgorithmAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAlgorithmAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getCpuBudgetAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getCpuBudgetAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getRamBudgetAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getRamBudgetAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ModelDataset"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputDataset(); + ::mlir::OpOperand &getInputDatasetMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::IntegerAttr getAlgorithmAttr(); + uint64_t getAlgorithm(); + ::mlir::IntegerAttr getCpuBudgetAttr(); + uint64_t getCpuBudget(); + ::mlir::IntegerAttr getRamBudgetAttr(); + uint64_t getRamBudget(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + void setAlgorithmAttr(::mlir::IntegerAttr attr); + void setAlgorithm(::std::optional attrValue); + void setCpuBudgetAttr(::mlir::IntegerAttr attr); + void setCpuBudget(::std::optional attrValue); + void setRamBudgetAttr(::mlir::IntegerAttr attr); + void setRamBudget(::std::optional attrValue); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeAlgorithmAttr(); + ::mlir::Attribute removeCpuBudgetAttr(); + ::mlir::Attribute removeRamBudgetAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, /*optional*/::mlir::IntegerAttr algorithm, /*optional*/::mlir::IntegerAttr cpu_budget, /*optional*/::mlir::IntegerAttr ram_budget, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, /*optional*/::mlir::IntegerAttr algorithm, /*optional*/::mlir::IntegerAttr cpu_budget, /*optional*/::mlir::IntegerAttr ram_budget, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, /*optional*/uint64_t algorithm, /*optional*/uint64_t cpu_budget, /*optional*/uint64_t ram_budget, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, /*optional*/uint64_t algorithm, /*optional*/uint64_t cpu_budget, /*optional*/uint64_t ram_budget, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ModelDatasetOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MulNoNanOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MulNoNanOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MulNoNanOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MulNoNanOpGenericAdaptorBase(MulNoNanOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MulNoNanOpGenericAdaptor : public detail::MulNoNanOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MulNoNanOpGenericAdaptorBase; +public: + MulNoNanOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MulNoNanOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MulNoNanOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MulNoNanOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MulNoNanOpAdaptor : public MulNoNanOpGenericAdaptor<::mlir::ValueRange> { +public: + using MulNoNanOpGenericAdaptor::MulNoNanOpGenericAdaptor; + MulNoNanOpAdaptor(MulNoNanOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MulNoNanOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MulNoNanOpAdaptor; + template + using GenericAdaptor = MulNoNanOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MulNoNan"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MulNoNanOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MulOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MulOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MulOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MulOpGenericAdaptorBase(MulOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MulOpGenericAdaptor : public detail::MulOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MulOpGenericAdaptorBase; +public: + MulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MulOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MulOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MulOpAdaptor : public MulOpGenericAdaptor<::mlir::ValueRange> { +public: + using MulOpGenericAdaptor::MulOpGenericAdaptor; + MulOpAdaptor(MulOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MulOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsCommutative, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::OpTrait::TF::CwiseBinary, ::mlir::OpTrait::TF::SameOperandsAndResultElementTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MulOpAdaptor; + template + using GenericAdaptor = MulOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Mul"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MulOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MultiDeviceIteratorFromStringHandleOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MultiDeviceIteratorFromStringHandleOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MultiDeviceIteratorFromStringHandleOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MultiDeviceIteratorFromStringHandleOpGenericAdaptorBase(MultiDeviceIteratorFromStringHandleOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); +}; +} // namespace detail +template +class MultiDeviceIteratorFromStringHandleOpGenericAdaptor : public detail::MultiDeviceIteratorFromStringHandleOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MultiDeviceIteratorFromStringHandleOpGenericAdaptorBase; +public: + MultiDeviceIteratorFromStringHandleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MultiDeviceIteratorFromStringHandleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MultiDeviceIteratorFromStringHandleOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MultiDeviceIteratorFromStringHandleOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getStringHandle() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MultiDeviceIteratorFromStringHandleOpAdaptor : public MultiDeviceIteratorFromStringHandleOpGenericAdaptor<::mlir::ValueRange> { +public: + using MultiDeviceIteratorFromStringHandleOpGenericAdaptor::MultiDeviceIteratorFromStringHandleOpGenericAdaptor; + MultiDeviceIteratorFromStringHandleOpAdaptor(MultiDeviceIteratorFromStringHandleOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MultiDeviceIteratorFromStringHandleOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MultiDeviceIteratorFromStringHandleOpAdaptor; + template + using GenericAdaptor = MultiDeviceIteratorFromStringHandleOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MultiDeviceIteratorFromStringHandle"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getStringHandle(); + ::mlir::OpOperand &getStringHandleMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getMultiDeviceIterator(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeOutputTypesAttr(); + ::mlir::Attribute removeOutputShapesAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type multi_device_iterator, ::mlir::Value string_handle, /*optional*/::mlir::ArrayAttr output_types, /*optional*/::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value string_handle, /*optional*/::mlir::ArrayAttr output_types, /*optional*/::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MultiDeviceIteratorFromStringHandleOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MultiDeviceIteratorGetNextFromShardOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MultiDeviceIteratorGetNextFromShardOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MultiDeviceIteratorGetNextFromShardOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MultiDeviceIteratorGetNextFromShardOpGenericAdaptorBase(MultiDeviceIteratorGetNextFromShardOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MultiDeviceIteratorGetNextFromShardOpGenericAdaptor : public detail::MultiDeviceIteratorGetNextFromShardOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MultiDeviceIteratorGetNextFromShardOpGenericAdaptorBase; +public: + MultiDeviceIteratorGetNextFromShardOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MultiDeviceIteratorGetNextFromShardOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MultiDeviceIteratorGetNextFromShardOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MultiDeviceIteratorGetNextFromShardOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getMultiDeviceIterator() { + return (*getODSOperands(0).begin()); + } + + ValueT getShardNum() { + return (*getODSOperands(1).begin()); + } + + ValueT getIncarnationId() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MultiDeviceIteratorGetNextFromShardOpAdaptor : public MultiDeviceIteratorGetNextFromShardOpGenericAdaptor<::mlir::ValueRange> { +public: + using MultiDeviceIteratorGetNextFromShardOpGenericAdaptor::MultiDeviceIteratorGetNextFromShardOpGenericAdaptor; + MultiDeviceIteratorGetNextFromShardOpAdaptor(MultiDeviceIteratorGetNextFromShardOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MultiDeviceIteratorGetNextFromShardOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MultiDeviceIteratorGetNextFromShardOpAdaptor; + template + using GenericAdaptor = MultiDeviceIteratorGetNextFromShardOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MultiDeviceIteratorGetNextFromShard"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getMultiDeviceIterator(); + ::mlir::TypedValue<::mlir::TensorType> getShardNum(); + ::mlir::TypedValue<::mlir::TensorType> getIncarnationId(); + ::mlir::OpOperand &getMultiDeviceIteratorMutable(); + ::mlir::OpOperand &getShardNumMutable(); + ::mlir::OpOperand &getIncarnationIdMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getComponents(); + mlir::TF::ResultShapeRange getOutputShapes(); + mlir::ResultElementTypeRange getOutputTypes(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange components, ::mlir::Value multi_device_iterator, ::mlir::Value shard_num, ::mlir::Value incarnation_id); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MultiDeviceIteratorGetNextFromShardOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MultiDeviceIteratorInitOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MultiDeviceIteratorInitOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MultiDeviceIteratorInitOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MultiDeviceIteratorInitOpGenericAdaptorBase(MultiDeviceIteratorInitOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MultiDeviceIteratorInitOpGenericAdaptor : public detail::MultiDeviceIteratorInitOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MultiDeviceIteratorInitOpGenericAdaptorBase; +public: + MultiDeviceIteratorInitOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MultiDeviceIteratorInitOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MultiDeviceIteratorInitOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MultiDeviceIteratorInitOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getDataset() { + return (*getODSOperands(0).begin()); + } + + ValueT getMultiDeviceIterator() { + return (*getODSOperands(1).begin()); + } + + ValueT getMaxBufferSize() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MultiDeviceIteratorInitOpAdaptor : public MultiDeviceIteratorInitOpGenericAdaptor<::mlir::ValueRange> { +public: + using MultiDeviceIteratorInitOpGenericAdaptor::MultiDeviceIteratorInitOpGenericAdaptor; + MultiDeviceIteratorInitOpAdaptor(MultiDeviceIteratorInitOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MultiDeviceIteratorInitOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MultiDeviceIteratorInitOpAdaptor; + template + using GenericAdaptor = MultiDeviceIteratorInitOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MultiDeviceIteratorInit"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getDataset(); + ::mlir::TypedValue<::mlir::TensorType> getMultiDeviceIterator(); + ::mlir::TypedValue<::mlir::TensorType> getMaxBufferSize(); + ::mlir::OpOperand &getDatasetMutable(); + ::mlir::OpOperand &getMultiDeviceIteratorMutable(); + ::mlir::OpOperand &getMaxBufferSizeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getIncarnationId(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type incarnation_id, ::mlir::Value dataset, ::mlir::Value multi_device_iterator, ::mlir::Value max_buffer_size); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value dataset, ::mlir::Value multi_device_iterator, ::mlir::Value max_buffer_size); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MultiDeviceIteratorInitOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MultiDeviceIteratorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MultiDeviceIteratorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MultiDeviceIteratorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MultiDeviceIteratorOpGenericAdaptorBase(MultiDeviceIteratorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getDevicesAttr(); + ::mlir::ArrayAttr getDevices(); + ::mlir::StringAttr getSharedNameAttr(); + ::llvm::StringRef getSharedName(); + ::mlir::StringAttr getContainerAttr(); + ::llvm::StringRef getContainer(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); +}; +} // namespace detail +template +class MultiDeviceIteratorOpGenericAdaptor : public detail::MultiDeviceIteratorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MultiDeviceIteratorOpGenericAdaptorBase; +public: + MultiDeviceIteratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MultiDeviceIteratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MultiDeviceIteratorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MultiDeviceIteratorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MultiDeviceIteratorOpAdaptor : public MultiDeviceIteratorOpGenericAdaptor<::mlir::ValueRange> { +public: + using MultiDeviceIteratorOpGenericAdaptor::MultiDeviceIteratorOpGenericAdaptor; + MultiDeviceIteratorOpAdaptor(MultiDeviceIteratorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MultiDeviceIteratorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MultiDeviceIteratorOpAdaptor; + template + using GenericAdaptor = MultiDeviceIteratorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("container"), ::llvm::StringRef("devices"), ::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types"), ::llvm::StringRef("shared_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getContainerAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getContainerAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDevicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDevicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getSharedNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getSharedNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MultiDeviceIterator"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::ArrayAttr getDevicesAttr(); + ::mlir::ArrayAttr getDevices(); + ::mlir::StringAttr getSharedNameAttr(); + ::llvm::StringRef getSharedName(); + ::mlir::StringAttr getContainerAttr(); + ::llvm::StringRef getContainer(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + void setDevicesAttr(::mlir::ArrayAttr attr); + void setSharedNameAttr(::mlir::StringAttr attr); + void setSharedName(::llvm::StringRef attrValue); + void setContainerAttr(::mlir::StringAttr attr); + void setContainer(::llvm::StringRef attrValue); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::ArrayAttr devices, ::mlir::StringAttr shared_name, ::mlir::StringAttr container, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ArrayAttr devices, ::mlir::StringAttr shared_name, ::mlir::StringAttr container, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::ArrayAttr devices, ::llvm::StringRef shared_name, ::llvm::StringRef container, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ArrayAttr devices, ::llvm::StringRef shared_name, ::llvm::StringRef container, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MultiDeviceIteratorOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MultiDeviceIteratorToStringHandleOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MultiDeviceIteratorToStringHandleOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MultiDeviceIteratorToStringHandleOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MultiDeviceIteratorToStringHandleOpGenericAdaptorBase(MultiDeviceIteratorToStringHandleOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MultiDeviceIteratorToStringHandleOpGenericAdaptor : public detail::MultiDeviceIteratorToStringHandleOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MultiDeviceIteratorToStringHandleOpGenericAdaptorBase; +public: + MultiDeviceIteratorToStringHandleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MultiDeviceIteratorToStringHandleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MultiDeviceIteratorToStringHandleOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MultiDeviceIteratorToStringHandleOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getMultiDeviceIterator() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MultiDeviceIteratorToStringHandleOpAdaptor : public MultiDeviceIteratorToStringHandleOpGenericAdaptor<::mlir::ValueRange> { +public: + using MultiDeviceIteratorToStringHandleOpGenericAdaptor::MultiDeviceIteratorToStringHandleOpGenericAdaptor; + MultiDeviceIteratorToStringHandleOpAdaptor(MultiDeviceIteratorToStringHandleOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MultiDeviceIteratorToStringHandleOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MultiDeviceIteratorToStringHandleOpAdaptor; + template + using GenericAdaptor = MultiDeviceIteratorToStringHandleOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MultiDeviceIteratorToStringHandle"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getMultiDeviceIterator(); + ::mlir::OpOperand &getMultiDeviceIteratorMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getStringHandle(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type string_handle, ::mlir::Value multi_device_iterator); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value multi_device_iterator); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MultiDeviceIteratorToStringHandleOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MultinomialOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MultinomialOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MultinomialOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MultinomialOpGenericAdaptorBase(MultinomialOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getSeedAttr(); + uint64_t getSeed(); + ::mlir::IntegerAttr getSeed2Attr(); + uint64_t getSeed2(); +}; +} // namespace detail +template +class MultinomialOpGenericAdaptor : public detail::MultinomialOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MultinomialOpGenericAdaptorBase; +public: + MultinomialOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MultinomialOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MultinomialOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MultinomialOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLogits() { + return (*getODSOperands(0).begin()); + } + + ValueT getNumSamples() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MultinomialOpAdaptor : public MultinomialOpGenericAdaptor<::mlir::ValueRange> { +public: + using MultinomialOpGenericAdaptor::MultinomialOpGenericAdaptor; + MultinomialOpAdaptor(MultinomialOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MultinomialOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::TF::CannotDuplicate, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MultinomialOpAdaptor; + template + using GenericAdaptor = MultinomialOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("output_dtype"), ::llvm::StringRef("seed"), ::llvm::StringRef("seed2")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutputDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutputDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getSeedAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getSeedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSeed2AttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSeed2AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Multinomial"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLogits(); + ::mlir::TypedValue<::mlir::TensorType> getNumSamples(); + ::mlir::OpOperand &getLogitsMutable(); + ::mlir::OpOperand &getNumSamplesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getSeedAttr(); + uint64_t getSeed(); + ::mlir::IntegerAttr getSeed2Attr(); + uint64_t getSeed2(); + ::mlir::Type getT(); + ::mlir::Type getOutputDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setSeedAttr(::mlir::IntegerAttr attr); + void setSeed(::std::optional attrValue); + void setSeed2Attr(::mlir::IntegerAttr attr); + void setSeed2(::std::optional attrValue); + ::mlir::Attribute removeSeedAttr(); + ::mlir::Attribute removeSeed2Attr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value logits, ::mlir::Value num_samples, /*optional*/::mlir::IntegerAttr seed, /*optional*/::mlir::IntegerAttr seed2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value logits, ::mlir::Value num_samples, /*optional*/::mlir::IntegerAttr seed, /*optional*/::mlir::IntegerAttr seed2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value logits, ::mlir::Value num_samples, /*optional*/uint64_t seed = 0, /*optional*/uint64_t seed2 = 0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value logits, ::mlir::Value num_samples, /*optional*/uint64_t seed = 0, /*optional*/uint64_t seed2 = 0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MultinomialOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MutableDenseHashTableV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MutableDenseHashTableV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MutableDenseHashTableV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MutableDenseHashTableV2OpGenericAdaptorBase(MutableDenseHashTableV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getContainerAttr(); + ::llvm::StringRef getContainer(); + ::mlir::StringAttr getSharedNameAttr(); + ::llvm::StringRef getSharedName(); + ::mlir::BoolAttr getUseNodeNameSharingAttr(); + bool getUseNodeNameSharing(); + ::mlir::TypeAttr getValueDtypeAttr(); + ::mlir::Type getValueDtype(); + ::mlir::Attribute getValueShapeAttr(); + std::optional> getValueShape(); + ::mlir::IntegerAttr getInitialNumBucketsAttr(); + uint64_t getInitialNumBuckets(); + ::mlir::FloatAttr getMaxLoadFactorAttr(); + ::llvm::APFloat getMaxLoadFactor(); +}; +} // namespace detail +template +class MutableDenseHashTableV2OpGenericAdaptor : public detail::MutableDenseHashTableV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MutableDenseHashTableV2OpGenericAdaptorBase; +public: + MutableDenseHashTableV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MutableDenseHashTableV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MutableDenseHashTableV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MutableDenseHashTableV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getEmptyKey() { + return (*getODSOperands(0).begin()); + } + + ValueT getDeletedKey() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MutableDenseHashTableV2OpAdaptor : public MutableDenseHashTableV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using MutableDenseHashTableV2OpGenericAdaptor::MutableDenseHashTableV2OpGenericAdaptor; + MutableDenseHashTableV2OpAdaptor(MutableDenseHashTableV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MutableDenseHashTableV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MutableDenseHashTableV2OpAdaptor; + template + using GenericAdaptor = MutableDenseHashTableV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("container"), ::llvm::StringRef("initial_num_buckets"), ::llvm::StringRef("key_dtype"), ::llvm::StringRef("max_load_factor"), ::llvm::StringRef("shared_name"), ::llvm::StringRef("use_node_name_sharing"), ::llvm::StringRef("value_dtype"), ::llvm::StringRef("value_shape")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getContainerAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getContainerAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getInitialNumBucketsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getInitialNumBucketsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getKeyDtypeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getKeyDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getMaxLoadFactorAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getMaxLoadFactorAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getSharedNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getSharedNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getUseNodeNameSharingAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getUseNodeNameSharingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getValueDtypeAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getValueDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getValueShapeAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getValueShapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MutableDenseHashTableV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getEmptyKey(); + ::mlir::TypedValue<::mlir::TensorType> getDeletedKey(); + ::mlir::OpOperand &getEmptyKeyMutable(); + ::mlir::OpOperand &getDeletedKeyMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTableHandle(); + ::mlir::StringAttr getContainerAttr(); + ::llvm::StringRef getContainer(); + ::mlir::StringAttr getSharedNameAttr(); + ::llvm::StringRef getSharedName(); + ::mlir::BoolAttr getUseNodeNameSharingAttr(); + bool getUseNodeNameSharing(); + ::mlir::TypeAttr getValueDtypeAttr(); + ::mlir::Type getValueDtype(); + ::mlir::Attribute getValueShapeAttr(); + std::optional> getValueShape(); + ::mlir::IntegerAttr getInitialNumBucketsAttr(); + uint64_t getInitialNumBuckets(); + ::mlir::FloatAttr getMaxLoadFactorAttr(); + ::llvm::APFloat getMaxLoadFactor(); + ::mlir::Type getKeyDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setContainerAttr(::mlir::StringAttr attr); + void setContainer(::std::optional<::llvm::StringRef> attrValue); + void setSharedNameAttr(::mlir::StringAttr attr); + void setSharedName(::std::optional<::llvm::StringRef> attrValue); + void setUseNodeNameSharingAttr(::mlir::BoolAttr attr); + void setUseNodeNameSharing(::std::optional attrValue); + void setValueDtypeAttr(::mlir::TypeAttr attr); + void setValueDtype(::mlir::Type attrValue); + void setValueShapeAttr(::mlir::Attribute attr); + void setValueShape(::std::optional>> attrValue); + void setInitialNumBucketsAttr(::mlir::IntegerAttr attr); + void setInitialNumBuckets(::std::optional attrValue); + void setMaxLoadFactorAttr(::mlir::FloatAttr attr); + void setMaxLoadFactor(::std::optional<::llvm::APFloat> attrValue); + ::mlir::Attribute removeContainerAttr(); + ::mlir::Attribute removeSharedNameAttr(); + ::mlir::Attribute removeUseNodeNameSharingAttr(); + ::mlir::Attribute removeValueShapeAttr(); + ::mlir::Attribute removeInitialNumBucketsAttr(); + ::mlir::Attribute removeMaxLoadFactorAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type table_handle, ::mlir::Value empty_key, ::mlir::Value deleted_key, /*optional*/::mlir::StringAttr container, /*optional*/::mlir::StringAttr shared_name, /*optional*/::mlir::BoolAttr use_node_name_sharing, ::mlir::TypeAttr value_dtype, /*optional*/::mlir::Attribute value_shape, /*optional*/::mlir::IntegerAttr initial_num_buckets, /*optional*/::mlir::FloatAttr max_load_factor); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value empty_key, ::mlir::Value deleted_key, /*optional*/::mlir::StringAttr container, /*optional*/::mlir::StringAttr shared_name, /*optional*/::mlir::BoolAttr use_node_name_sharing, ::mlir::TypeAttr value_dtype, /*optional*/::mlir::Attribute value_shape, /*optional*/::mlir::IntegerAttr initial_num_buckets, /*optional*/::mlir::FloatAttr max_load_factor); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type table_handle, ::mlir::Value empty_key, ::mlir::Value deleted_key, /*optional*/::llvm::StringRef container, /*optional*/::llvm::StringRef shared_name, /*optional*/bool use_node_name_sharing, ::mlir::Type value_dtype, /*optional*/std::optional> value_shape, /*optional*/uint64_t initial_num_buckets, /*optional*/::llvm::APFloat max_load_factor); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value empty_key, ::mlir::Value deleted_key, /*optional*/::llvm::StringRef container, /*optional*/::llvm::StringRef shared_name, /*optional*/bool use_node_name_sharing, ::mlir::Type value_dtype, /*optional*/std::optional> value_shape, /*optional*/uint64_t initial_num_buckets, /*optional*/::llvm::APFloat max_load_factor); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 8 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MutableDenseHashTableV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MutableHashTableOfTensorsV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MutableHashTableOfTensorsV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MutableHashTableOfTensorsV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MutableHashTableOfTensorsV2OpGenericAdaptorBase(MutableHashTableOfTensorsV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getContainerAttr(); + ::llvm::StringRef getContainer(); + ::mlir::StringAttr getSharedNameAttr(); + ::llvm::StringRef getSharedName(); + ::mlir::BoolAttr getUseNodeNameSharingAttr(); + bool getUseNodeNameSharing(); + ::mlir::TypeAttr getKeyDtypeAttr(); + ::mlir::Type getKeyDtype(); + ::mlir::TypeAttr getValueDtypeAttr(); + ::mlir::Type getValueDtype(); + ::mlir::Attribute getValueShapeAttr(); + std::optional> getValueShape(); +}; +} // namespace detail +template +class MutableHashTableOfTensorsV2OpGenericAdaptor : public detail::MutableHashTableOfTensorsV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MutableHashTableOfTensorsV2OpGenericAdaptorBase; +public: + MutableHashTableOfTensorsV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MutableHashTableOfTensorsV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MutableHashTableOfTensorsV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MutableHashTableOfTensorsV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MutableHashTableOfTensorsV2OpAdaptor : public MutableHashTableOfTensorsV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using MutableHashTableOfTensorsV2OpGenericAdaptor::MutableHashTableOfTensorsV2OpGenericAdaptor; + MutableHashTableOfTensorsV2OpAdaptor(MutableHashTableOfTensorsV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MutableHashTableOfTensorsV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MutableHashTableOfTensorsV2OpAdaptor; + template + using GenericAdaptor = MutableHashTableOfTensorsV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("container"), ::llvm::StringRef("key_dtype"), ::llvm::StringRef("shared_name"), ::llvm::StringRef("use_node_name_sharing"), ::llvm::StringRef("value_dtype"), ::llvm::StringRef("value_shape")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getContainerAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getContainerAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getKeyDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getKeyDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getSharedNameAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getSharedNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getUseNodeNameSharingAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getUseNodeNameSharingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getValueDtypeAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getValueDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getValueShapeAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getValueShapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MutableHashTableOfTensorsV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTableHandle(); + ::mlir::StringAttr getContainerAttr(); + ::llvm::StringRef getContainer(); + ::mlir::StringAttr getSharedNameAttr(); + ::llvm::StringRef getSharedName(); + ::mlir::BoolAttr getUseNodeNameSharingAttr(); + bool getUseNodeNameSharing(); + ::mlir::TypeAttr getKeyDtypeAttr(); + ::mlir::Type getKeyDtype(); + ::mlir::TypeAttr getValueDtypeAttr(); + ::mlir::Type getValueDtype(); + ::mlir::Attribute getValueShapeAttr(); + std::optional> getValueShape(); + void setContainerAttr(::mlir::StringAttr attr); + void setContainer(::std::optional<::llvm::StringRef> attrValue); + void setSharedNameAttr(::mlir::StringAttr attr); + void setSharedName(::std::optional<::llvm::StringRef> attrValue); + void setUseNodeNameSharingAttr(::mlir::BoolAttr attr); + void setUseNodeNameSharing(::std::optional attrValue); + void setKeyDtypeAttr(::mlir::TypeAttr attr); + void setKeyDtype(::mlir::Type attrValue); + void setValueDtypeAttr(::mlir::TypeAttr attr); + void setValueDtype(::mlir::Type attrValue); + void setValueShapeAttr(::mlir::Attribute attr); + void setValueShape(::std::optional>> attrValue); + ::mlir::Attribute removeContainerAttr(); + ::mlir::Attribute removeSharedNameAttr(); + ::mlir::Attribute removeUseNodeNameSharingAttr(); + ::mlir::Attribute removeValueShapeAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type table_handle, /*optional*/::mlir::StringAttr container, /*optional*/::mlir::StringAttr shared_name, /*optional*/::mlir::BoolAttr use_node_name_sharing, ::mlir::TypeAttr key_dtype, ::mlir::TypeAttr value_dtype, /*optional*/::mlir::Attribute value_shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::StringAttr container, /*optional*/::mlir::StringAttr shared_name, /*optional*/::mlir::BoolAttr use_node_name_sharing, ::mlir::TypeAttr key_dtype, ::mlir::TypeAttr value_dtype, /*optional*/::mlir::Attribute value_shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type table_handle, /*optional*/::llvm::StringRef container, /*optional*/::llvm::StringRef shared_name, /*optional*/bool use_node_name_sharing, ::mlir::Type key_dtype, ::mlir::Type value_dtype, /*optional*/std::optional> value_shape = llvm::ArrayRef({})); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::llvm::StringRef container, /*optional*/::llvm::StringRef shared_name, /*optional*/bool use_node_name_sharing, ::mlir::Type key_dtype, ::mlir::Type value_dtype, /*optional*/std::optional> value_shape = llvm::ArrayRef({})); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MutableHashTableOfTensorsV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MutableHashTableV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MutableHashTableV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MutableHashTableV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MutableHashTableV2OpGenericAdaptorBase(MutableHashTableV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getContainerAttr(); + ::llvm::StringRef getContainer(); + ::mlir::StringAttr getSharedNameAttr(); + ::llvm::StringRef getSharedName(); + ::mlir::BoolAttr getUseNodeNameSharingAttr(); + bool getUseNodeNameSharing(); + ::mlir::TypeAttr getKeyDtypeAttr(); + ::mlir::Type getKeyDtype(); + ::mlir::TypeAttr getValueDtypeAttr(); + ::mlir::Type getValueDtype(); +}; +} // namespace detail +template +class MutableHashTableV2OpGenericAdaptor : public detail::MutableHashTableV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MutableHashTableV2OpGenericAdaptorBase; +public: + MutableHashTableV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MutableHashTableV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MutableHashTableV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MutableHashTableV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MutableHashTableV2OpAdaptor : public MutableHashTableV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using MutableHashTableV2OpGenericAdaptor::MutableHashTableV2OpGenericAdaptor; + MutableHashTableV2OpAdaptor(MutableHashTableV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MutableHashTableV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MutableHashTableV2OpAdaptor; + template + using GenericAdaptor = MutableHashTableV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("container"), ::llvm::StringRef("key_dtype"), ::llvm::StringRef("shared_name"), ::llvm::StringRef("use_node_name_sharing"), ::llvm::StringRef("value_dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getContainerAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getContainerAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getKeyDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getKeyDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getSharedNameAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getSharedNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getUseNodeNameSharingAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getUseNodeNameSharingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getValueDtypeAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getValueDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MutableHashTableV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTableHandle(); + ::mlir::StringAttr getContainerAttr(); + ::llvm::StringRef getContainer(); + ::mlir::StringAttr getSharedNameAttr(); + ::llvm::StringRef getSharedName(); + ::mlir::BoolAttr getUseNodeNameSharingAttr(); + bool getUseNodeNameSharing(); + ::mlir::TypeAttr getKeyDtypeAttr(); + ::mlir::Type getKeyDtype(); + ::mlir::TypeAttr getValueDtypeAttr(); + ::mlir::Type getValueDtype(); + void setContainerAttr(::mlir::StringAttr attr); + void setContainer(::std::optional<::llvm::StringRef> attrValue); + void setSharedNameAttr(::mlir::StringAttr attr); + void setSharedName(::std::optional<::llvm::StringRef> attrValue); + void setUseNodeNameSharingAttr(::mlir::BoolAttr attr); + void setUseNodeNameSharing(::std::optional attrValue); + void setKeyDtypeAttr(::mlir::TypeAttr attr); + void setKeyDtype(::mlir::Type attrValue); + void setValueDtypeAttr(::mlir::TypeAttr attr); + void setValueDtype(::mlir::Type attrValue); + ::mlir::Attribute removeContainerAttr(); + ::mlir::Attribute removeSharedNameAttr(); + ::mlir::Attribute removeUseNodeNameSharingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type table_handle, /*optional*/::mlir::StringAttr container, /*optional*/::mlir::StringAttr shared_name, /*optional*/::mlir::BoolAttr use_node_name_sharing, ::mlir::TypeAttr key_dtype, ::mlir::TypeAttr value_dtype); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::StringAttr container, /*optional*/::mlir::StringAttr shared_name, /*optional*/::mlir::BoolAttr use_node_name_sharing, ::mlir::TypeAttr key_dtype, ::mlir::TypeAttr value_dtype); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type table_handle, /*optional*/::llvm::StringRef container, /*optional*/::llvm::StringRef shared_name, /*optional*/bool use_node_name_sharing, ::mlir::Type key_dtype, ::mlir::Type value_dtype); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::llvm::StringRef container, /*optional*/::llvm::StringRef shared_name, /*optional*/bool use_node_name_sharing, ::mlir::Type key_dtype, ::mlir::Type value_dtype); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MutableHashTableV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::NcclAllReduceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class NcclAllReduceOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + NcclAllReduceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + NcclAllReduceOpGenericAdaptorBase(NcclAllReduceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getReductionAttr(); + ::llvm::StringRef getReduction(); + ::mlir::IntegerAttr getNumDevicesAttr(); + uint64_t getNumDevices(); + ::mlir::StringAttr getSharedNameAttr(); + ::llvm::StringRef getSharedName(); +}; +} // namespace detail +template +class NcclAllReduceOpGenericAdaptor : public detail::NcclAllReduceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::NcclAllReduceOpGenericAdaptorBase; +public: + NcclAllReduceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + NcclAllReduceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : NcclAllReduceOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + NcclAllReduceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class NcclAllReduceOpAdaptor : public NcclAllReduceOpGenericAdaptor<::mlir::ValueRange> { +public: + using NcclAllReduceOpGenericAdaptor::NcclAllReduceOpGenericAdaptor; + NcclAllReduceOpAdaptor(NcclAllReduceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class NcclAllReduceOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, GetResourceInstanceInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = NcclAllReduceOpAdaptor; + template + using GenericAdaptor = NcclAllReduceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("num_devices"), ::llvm::StringRef("reduction"), ::llvm::StringRef("shared_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumDevicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumDevicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getReductionAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getReductionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSharedNameAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSharedNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.NcclAllReduce"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getData(); + ::mlir::StringAttr getReductionAttr(); + ::llvm::StringRef getReduction(); + ::mlir::IntegerAttr getNumDevicesAttr(); + uint64_t getNumDevices(); + ::mlir::StringAttr getSharedNameAttr(); + ::llvm::StringRef getSharedName(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setReductionAttr(::mlir::StringAttr attr); + void setReduction(::llvm::StringRef attrValue); + void setNumDevicesAttr(::mlir::IntegerAttr attr); + void setNumDevices(uint64_t attrValue); + void setSharedNameAttr(::mlir::StringAttr attr); + void setSharedName(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type data, ::mlir::Value input, ::mlir::StringAttr reduction, ::mlir::IntegerAttr num_devices, ::mlir::StringAttr shared_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::StringAttr reduction, ::mlir::IntegerAttr num_devices, ::mlir::StringAttr shared_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::StringAttr reduction, ::mlir::IntegerAttr num_devices, ::mlir::StringAttr shared_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type data, ::mlir::Value input, ::llvm::StringRef reduction, uint64_t num_devices, ::llvm::StringRef shared_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::llvm::StringRef reduction, uint64_t num_devices, ::llvm::StringRef shared_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::llvm::StringRef reduction, uint64_t num_devices, ::llvm::StringRef shared_name); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + std::optional GetResourceInstanceStr(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::NcclAllReduceOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::NdtriOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class NdtriOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + NdtriOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + NdtriOpGenericAdaptorBase(NdtriOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class NdtriOpGenericAdaptor : public detail::NdtriOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::NdtriOpGenericAdaptorBase; +public: + NdtriOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + NdtriOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : NdtriOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + NdtriOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class NdtriOpAdaptor : public NdtriOpGenericAdaptor<::mlir::ValueRange> { +public: + using NdtriOpGenericAdaptor::NdtriOpGenericAdaptor; + NdtriOpAdaptor(NdtriOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class NdtriOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = NdtriOpAdaptor; + template + using GenericAdaptor = NdtriOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Ndtri"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::NdtriOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::NegOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class NegOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + NegOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + NegOpGenericAdaptorBase(NegOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class NegOpGenericAdaptor : public detail::NegOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::NegOpGenericAdaptorBase; +public: + NegOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + NegOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : NegOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + NegOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class NegOpAdaptor : public NegOpGenericAdaptor<::mlir::ValueRange> { +public: + using NegOpGenericAdaptor::NegOpGenericAdaptor; + NegOpAdaptor(NegOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class NegOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::CwiseUnary, ::mlir::OpTrait::TF::IsInvolution, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = NegOpAdaptor; + template + using GenericAdaptor = NegOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Neg"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::NegOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::NextAfterOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class NextAfterOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + NextAfterOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + NextAfterOpGenericAdaptorBase(NextAfterOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class NextAfterOpGenericAdaptor : public detail::NextAfterOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::NextAfterOpGenericAdaptorBase; +public: + NextAfterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + NextAfterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : NextAfterOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + NextAfterOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX1() { + return (*getODSOperands(0).begin()); + } + + ValueT getX2() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class NextAfterOpAdaptor : public NextAfterOpGenericAdaptor<::mlir::ValueRange> { +public: + using NextAfterOpGenericAdaptor::NextAfterOpGenericAdaptor; + NextAfterOpAdaptor(NextAfterOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class NextAfterOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = NextAfterOpAdaptor; + template + using GenericAdaptor = NextAfterOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.NextAfter"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX1(); + ::mlir::TypedValue<::mlir::TensorType> getX2(); + ::mlir::OpOperand &getX1Mutable(); + ::mlir::OpOperand &getX2Mutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value x1, ::mlir::Value x2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x1, ::mlir::Value x2); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::NextAfterOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::NoOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class NoOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + NoOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + NoOpGenericAdaptorBase(NoOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class NoOpGenericAdaptor : public detail::NoOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::NoOpGenericAdaptorBase; +public: + NoOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + NoOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : NoOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + NoOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class NoOpAdaptor : public NoOpGenericAdaptor<::mlir::ValueRange> { +public: + using NoOpGenericAdaptor::NoOpGenericAdaptor; + NoOpAdaptor(NoOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class NoOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = NoOpAdaptor; + template + using GenericAdaptor = NoOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.NoOp"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::NoOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::NonMaxSuppressionV3Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class NonMaxSuppressionV3OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + NonMaxSuppressionV3OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + NonMaxSuppressionV3OpGenericAdaptorBase(NonMaxSuppressionV3Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class NonMaxSuppressionV3OpGenericAdaptor : public detail::NonMaxSuppressionV3OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::NonMaxSuppressionV3OpGenericAdaptorBase; +public: + NonMaxSuppressionV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + NonMaxSuppressionV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : NonMaxSuppressionV3OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + NonMaxSuppressionV3OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getBoxes() { + return (*getODSOperands(0).begin()); + } + + ValueT getScores() { + return (*getODSOperands(1).begin()); + } + + ValueT getMaxOutputSize() { + return (*getODSOperands(2).begin()); + } + + ValueT getIouThreshold() { + return (*getODSOperands(3).begin()); + } + + ValueT getScoreThreshold() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class NonMaxSuppressionV3OpAdaptor : public NonMaxSuppressionV3OpGenericAdaptor<::mlir::ValueRange> { +public: + using NonMaxSuppressionV3OpGenericAdaptor::NonMaxSuppressionV3OpGenericAdaptor; + NonMaxSuppressionV3OpAdaptor(NonMaxSuppressionV3Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class NonMaxSuppressionV3Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<5>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = NonMaxSuppressionV3OpAdaptor; + template + using GenericAdaptor = NonMaxSuppressionV3OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("T_threshold")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTThresholdAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTThresholdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.NonMaxSuppressionV3"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getBoxes(); + ::mlir::TypedValue<::mlir::TensorType> getScores(); + ::mlir::TypedValue<::mlir::TensorType> getMaxOutputSize(); + ::mlir::TypedValue<::mlir::TensorType> getIouThreshold(); + ::mlir::TypedValue<::mlir::TensorType> getScoreThreshold(); + ::mlir::OpOperand &getBoxesMutable(); + ::mlir::OpOperand &getScoresMutable(); + ::mlir::OpOperand &getMaxOutputSizeMutable(); + ::mlir::OpOperand &getIouThresholdMutable(); + ::mlir::OpOperand &getScoreThresholdMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSelectedIndices(); + ::mlir::Type getT(); + ::mlir::Type getTThreshold(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type selected_indices, ::mlir::Value boxes, ::mlir::Value scores, ::mlir::Value max_output_size, ::mlir::Value iou_threshold, ::mlir::Value score_threshold); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value boxes, ::mlir::Value scores, ::mlir::Value max_output_size, ::mlir::Value iou_threshold, ::mlir::Value score_threshold); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::NonMaxSuppressionV3Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::NonMaxSuppressionV4Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class NonMaxSuppressionV4OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + NonMaxSuppressionV4OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + NonMaxSuppressionV4OpGenericAdaptorBase(NonMaxSuppressionV4Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getPadToMaxOutputSizeAttr(); + bool getPadToMaxOutputSize(); +}; +} // namespace detail +template +class NonMaxSuppressionV4OpGenericAdaptor : public detail::NonMaxSuppressionV4OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::NonMaxSuppressionV4OpGenericAdaptorBase; +public: + NonMaxSuppressionV4OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + NonMaxSuppressionV4OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : NonMaxSuppressionV4OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + NonMaxSuppressionV4OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getBoxes() { + return (*getODSOperands(0).begin()); + } + + ValueT getScores() { + return (*getODSOperands(1).begin()); + } + + ValueT getMaxOutputSize() { + return (*getODSOperands(2).begin()); + } + + ValueT getIouThreshold() { + return (*getODSOperands(3).begin()); + } + + ValueT getScoreThreshold() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class NonMaxSuppressionV4OpAdaptor : public NonMaxSuppressionV4OpGenericAdaptor<::mlir::ValueRange> { +public: + using NonMaxSuppressionV4OpGenericAdaptor::NonMaxSuppressionV4OpGenericAdaptor; + NonMaxSuppressionV4OpAdaptor(NonMaxSuppressionV4Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class NonMaxSuppressionV4Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<5>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = NonMaxSuppressionV4OpAdaptor; + template + using GenericAdaptor = NonMaxSuppressionV4OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("T_threshold"), ::llvm::StringRef("pad_to_max_output_size")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTThresholdAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTThresholdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getPadToMaxOutputSizeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getPadToMaxOutputSizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.NonMaxSuppressionV4"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getBoxes(); + ::mlir::TypedValue<::mlir::TensorType> getScores(); + ::mlir::TypedValue<::mlir::TensorType> getMaxOutputSize(); + ::mlir::TypedValue<::mlir::TensorType> getIouThreshold(); + ::mlir::TypedValue<::mlir::TensorType> getScoreThreshold(); + ::mlir::OpOperand &getBoxesMutable(); + ::mlir::OpOperand &getScoresMutable(); + ::mlir::OpOperand &getMaxOutputSizeMutable(); + ::mlir::OpOperand &getIouThresholdMutable(); + ::mlir::OpOperand &getScoreThresholdMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSelectedIndices(); + ::mlir::TypedValue<::mlir::TensorType> getValidOutputs(); + ::mlir::BoolAttr getPadToMaxOutputSizeAttr(); + bool getPadToMaxOutputSize(); + ::mlir::Type getT(); + ::mlir::Type getTThreshold(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setPadToMaxOutputSizeAttr(::mlir::BoolAttr attr); + void setPadToMaxOutputSize(::std::optional attrValue); + ::mlir::Attribute removePadToMaxOutputSizeAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type selected_indices, ::mlir::Type valid_outputs, ::mlir::Value boxes, ::mlir::Value scores, ::mlir::Value max_output_size, ::mlir::Value iou_threshold, ::mlir::Value score_threshold, /*optional*/::mlir::BoolAttr pad_to_max_output_size); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value boxes, ::mlir::Value scores, ::mlir::Value max_output_size, ::mlir::Value iou_threshold, ::mlir::Value score_threshold, /*optional*/::mlir::BoolAttr pad_to_max_output_size); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type selected_indices, ::mlir::Type valid_outputs, ::mlir::Value boxes, ::mlir::Value scores, ::mlir::Value max_output_size, ::mlir::Value iou_threshold, ::mlir::Value score_threshold, /*optional*/bool pad_to_max_output_size = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value boxes, ::mlir::Value scores, ::mlir::Value max_output_size, ::mlir::Value iou_threshold, ::mlir::Value score_threshold, /*optional*/bool pad_to_max_output_size = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::NonMaxSuppressionV4Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::NonMaxSuppressionV5Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class NonMaxSuppressionV5OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + NonMaxSuppressionV5OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + NonMaxSuppressionV5OpGenericAdaptorBase(NonMaxSuppressionV5Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getPadToMaxOutputSizeAttr(); + bool getPadToMaxOutputSize(); +}; +} // namespace detail +template +class NonMaxSuppressionV5OpGenericAdaptor : public detail::NonMaxSuppressionV5OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::NonMaxSuppressionV5OpGenericAdaptorBase; +public: + NonMaxSuppressionV5OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + NonMaxSuppressionV5OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : NonMaxSuppressionV5OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + NonMaxSuppressionV5OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getBoxes() { + return (*getODSOperands(0).begin()); + } + + ValueT getScores() { + return (*getODSOperands(1).begin()); + } + + ValueT getMaxOutputSize() { + return (*getODSOperands(2).begin()); + } + + ValueT getIouThreshold() { + return (*getODSOperands(3).begin()); + } + + ValueT getScoreThreshold() { + return (*getODSOperands(4).begin()); + } + + ValueT getSoftNmsSigma() { + return (*getODSOperands(5).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class NonMaxSuppressionV5OpAdaptor : public NonMaxSuppressionV5OpGenericAdaptor<::mlir::ValueRange> { +public: + using NonMaxSuppressionV5OpGenericAdaptor::NonMaxSuppressionV5OpGenericAdaptor; + NonMaxSuppressionV5OpAdaptor(NonMaxSuppressionV5Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class NonMaxSuppressionV5Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<6>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = NonMaxSuppressionV5OpAdaptor; + template + using GenericAdaptor = NonMaxSuppressionV5OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("pad_to_max_output_size")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getPadToMaxOutputSizeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getPadToMaxOutputSizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.NonMaxSuppressionV5"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getBoxes(); + ::mlir::TypedValue<::mlir::TensorType> getScores(); + ::mlir::TypedValue<::mlir::TensorType> getMaxOutputSize(); + ::mlir::TypedValue<::mlir::TensorType> getIouThreshold(); + ::mlir::TypedValue<::mlir::TensorType> getScoreThreshold(); + ::mlir::TypedValue<::mlir::TensorType> getSoftNmsSigma(); + ::mlir::OpOperand &getBoxesMutable(); + ::mlir::OpOperand &getScoresMutable(); + ::mlir::OpOperand &getMaxOutputSizeMutable(); + ::mlir::OpOperand &getIouThresholdMutable(); + ::mlir::OpOperand &getScoreThresholdMutable(); + ::mlir::OpOperand &getSoftNmsSigmaMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSelectedIndices(); + ::mlir::TypedValue<::mlir::TensorType> getSelectedScores(); + ::mlir::TypedValue<::mlir::TensorType> getValidOutputs(); + ::mlir::BoolAttr getPadToMaxOutputSizeAttr(); + bool getPadToMaxOutputSize(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setPadToMaxOutputSizeAttr(::mlir::BoolAttr attr); + void setPadToMaxOutputSize(::std::optional attrValue); + ::mlir::Attribute removePadToMaxOutputSizeAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type selected_indices, ::mlir::Type selected_scores, ::mlir::Type valid_outputs, ::mlir::Value boxes, ::mlir::Value scores, ::mlir::Value max_output_size, ::mlir::Value iou_threshold, ::mlir::Value score_threshold, ::mlir::Value soft_nms_sigma, /*optional*/::mlir::BoolAttr pad_to_max_output_size); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value boxes, ::mlir::Value scores, ::mlir::Value max_output_size, ::mlir::Value iou_threshold, ::mlir::Value score_threshold, ::mlir::Value soft_nms_sigma, /*optional*/::mlir::BoolAttr pad_to_max_output_size); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type selected_indices, ::mlir::Type selected_scores, ::mlir::Type valid_outputs, ::mlir::Value boxes, ::mlir::Value scores, ::mlir::Value max_output_size, ::mlir::Value iou_threshold, ::mlir::Value score_threshold, ::mlir::Value soft_nms_sigma, /*optional*/bool pad_to_max_output_size = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value boxes, ::mlir::Value scores, ::mlir::Value max_output_size, ::mlir::Value iou_threshold, ::mlir::Value score_threshold, ::mlir::Value soft_nms_sigma, /*optional*/bool pad_to_max_output_size = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::NonMaxSuppressionV5Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::NotEqualOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class NotEqualOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + NotEqualOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + NotEqualOpGenericAdaptorBase(NotEqualOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getIncompatibleShapeErrorAttr(); + bool getIncompatibleShapeError(); +}; +} // namespace detail +template +class NotEqualOpGenericAdaptor : public detail::NotEqualOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::NotEqualOpGenericAdaptorBase; +public: + NotEqualOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + NotEqualOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : NotEqualOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + NotEqualOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class NotEqualOpAdaptor : public NotEqualOpGenericAdaptor<::mlir::ValueRange> { +public: + using NotEqualOpGenericAdaptor::NotEqualOpGenericAdaptor; + NotEqualOpAdaptor(NotEqualOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class NotEqualOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsCommutative, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = NotEqualOpAdaptor; + template + using GenericAdaptor = NotEqualOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("incompatible_shape_error")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getIncompatibleShapeErrorAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getIncompatibleShapeErrorAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.NotEqual"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::BoolAttr getIncompatibleShapeErrorAttr(); + bool getIncompatibleShapeError(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setIncompatibleShapeErrorAttr(::mlir::BoolAttr attr); + void setIncompatibleShapeError(::std::optional attrValue); + ::mlir::Attribute removeIncompatibleShapeErrorAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y, BoolAttr incompatible_shape_error); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y, /*optional*/::mlir::BoolAttr incompatible_shape_error); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y, /*optional*/::mlir::BoolAttr incompatible_shape_error); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y, /*optional*/bool incompatible_shape_error = true); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y, /*optional*/bool incompatible_shape_error = true); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::NotEqualOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::OneHotOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class OneHotOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + OneHotOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + OneHotOpGenericAdaptorBase(OneHotOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getAxisAttr(); + uint64_t getAxis(); +}; +} // namespace detail +template +class OneHotOpGenericAdaptor : public detail::OneHotOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::OneHotOpGenericAdaptorBase; +public: + OneHotOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + OneHotOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : OneHotOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + OneHotOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIndices() { + return (*getODSOperands(0).begin()); + } + + ValueT getDepth() { + return (*getODSOperands(1).begin()); + } + + ValueT getOnValue() { + return (*getODSOperands(2).begin()); + } + + ValueT getOffValue() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class OneHotOpAdaptor : public OneHotOpGenericAdaptor<::mlir::ValueRange> { +public: + using OneHotOpGenericAdaptor::OneHotOpGenericAdaptor; + OneHotOpAdaptor(OneHotOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class OneHotOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = OneHotOpAdaptor; + template + using GenericAdaptor = OneHotOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("TI"), ::llvm::StringRef("axis")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTIAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTIAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getAxisAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getAxisAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.OneHot"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getDepth(); + ::mlir::TypedValue<::mlir::TensorType> getOnValue(); + ::mlir::TypedValue<::mlir::TensorType> getOffValue(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getDepthMutable(); + ::mlir::OpOperand &getOnValueMutable(); + ::mlir::OpOperand &getOffValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getAxisAttr(); + uint64_t getAxis(); + ::mlir::Type getT(); + ::mlir::Type getTI(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setAxisAttr(::mlir::IntegerAttr attr); + void setAxis(::std::optional attrValue); + ::mlir::Attribute removeAxisAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value indices, Value depth, Value on_value, Value off_value, IntegerAttr axis); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value indices, ::mlir::Value depth, ::mlir::Value on_value, ::mlir::Value off_value, /*optional*/::mlir::IntegerAttr axis); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value indices, ::mlir::Value depth, ::mlir::Value on_value, ::mlir::Value off_value, /*optional*/::mlir::IntegerAttr axis); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value indices, ::mlir::Value depth, ::mlir::Value on_value, ::mlir::Value off_value, /*optional*/uint64_t axis = -1); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value indices, ::mlir::Value depth, ::mlir::Value on_value, ::mlir::Value off_value, /*optional*/uint64_t axis = -1); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::OneHotOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::OneShotIteratorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class OneShotIteratorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + OneShotIteratorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + OneShotIteratorOpGenericAdaptorBase(OneShotIteratorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::SymbolRefAttr getDatasetFactoryAttr(); + ::mlir::SymbolRefAttr getDatasetFactory(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::StringAttr getContainerAttr(); + ::llvm::StringRef getContainer(); + ::mlir::StringAttr getSharedNameAttr(); + ::llvm::StringRef getSharedName(); +}; +} // namespace detail +template +class OneShotIteratorOpGenericAdaptor : public detail::OneShotIteratorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::OneShotIteratorOpGenericAdaptorBase; +public: + OneShotIteratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + OneShotIteratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : OneShotIteratorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + OneShotIteratorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class OneShotIteratorOpAdaptor : public OneShotIteratorOpGenericAdaptor<::mlir::ValueRange> { +public: + using OneShotIteratorOpGenericAdaptor::OneShotIteratorOpGenericAdaptor; + OneShotIteratorOpAdaptor(OneShotIteratorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class OneShotIteratorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = OneShotIteratorOpAdaptor; + template + using GenericAdaptor = OneShotIteratorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("container"), ::llvm::StringRef("dataset_factory"), ::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types"), ::llvm::StringRef("shared_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getContainerAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getContainerAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDatasetFactoryAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDatasetFactoryAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getSharedNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getSharedNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.OneShotIterator"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::SymbolRefAttr getDatasetFactoryAttr(); + ::mlir::SymbolRefAttr getDatasetFactory(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::StringAttr getContainerAttr(); + ::llvm::StringRef getContainer(); + ::mlir::StringAttr getSharedNameAttr(); + ::llvm::StringRef getSharedName(); + void setDatasetFactoryAttr(::mlir::SymbolRefAttr attr); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + void setContainerAttr(::mlir::StringAttr attr); + void setContainer(::std::optional<::llvm::StringRef> attrValue); + void setSharedNameAttr(::mlir::StringAttr attr); + void setSharedName(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeContainerAttr(); + ::mlir::Attribute removeSharedNameAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::SymbolRefAttr dataset_factory, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::StringAttr container, /*optional*/::mlir::StringAttr shared_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::SymbolRefAttr dataset_factory, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::StringAttr container, /*optional*/::mlir::StringAttr shared_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::SymbolRefAttr dataset_factory, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::llvm::StringRef container = "", /*optional*/::llvm::StringRef shared_name = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::SymbolRefAttr dataset_factory, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::llvm::StringRef container = "", /*optional*/::llvm::StringRef shared_name = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::OneShotIteratorOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::OnesLikeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class OnesLikeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + OnesLikeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + OnesLikeOpGenericAdaptorBase(OnesLikeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class OnesLikeOpGenericAdaptor : public detail::OnesLikeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::OnesLikeOpGenericAdaptorBase; +public: + OnesLikeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + OnesLikeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : OnesLikeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + OnesLikeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class OnesLikeOpAdaptor : public OnesLikeOpGenericAdaptor<::mlir::ValueRange> { +public: + using OnesLikeOpGenericAdaptor::OnesLikeOpGenericAdaptor; + OnesLikeOpAdaptor(OnesLikeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class OnesLikeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::IsIdempotent, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = OnesLikeOpAdaptor; + template + using GenericAdaptor = OnesLikeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.OnesLike"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::OnesLikeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::OptimizeDatasetV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class OptimizeDatasetV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + OptimizeDatasetV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + OptimizeDatasetV2OpGenericAdaptorBase(OptimizeDatasetV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::ArrayAttr getOptimizationConfigsAttr(); + ::mlir::ArrayAttr getOptimizationConfigs(); +}; +} // namespace detail +template +class OptimizeDatasetV2OpGenericAdaptor : public detail::OptimizeDatasetV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::OptimizeDatasetV2OpGenericAdaptorBase; +public: + OptimizeDatasetV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + OptimizeDatasetV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : OptimizeDatasetV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + OptimizeDatasetV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputDataset() { + return (*getODSOperands(0).begin()); + } + + ValueT getOptimizationsEnabled() { + return (*getODSOperands(1).begin()); + } + + ValueT getOptimizationsDisabled() { + return (*getODSOperands(2).begin()); + } + + ValueT getOptimizationsDefault() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class OptimizeDatasetV2OpAdaptor : public OptimizeDatasetV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using OptimizeDatasetV2OpGenericAdaptor::OptimizeDatasetV2OpGenericAdaptor; + OptimizeDatasetV2OpAdaptor(OptimizeDatasetV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class OptimizeDatasetV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = OptimizeDatasetV2OpAdaptor; + template + using GenericAdaptor = OptimizeDatasetV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("optimization_configs"), ::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOptimizationConfigsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getOptimizationConfigsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.OptimizeDatasetV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputDataset(); + ::mlir::TypedValue<::mlir::TensorType> getOptimizationsEnabled(); + ::mlir::TypedValue<::mlir::TensorType> getOptimizationsDisabled(); + ::mlir::TypedValue<::mlir::TensorType> getOptimizationsDefault(); + ::mlir::OpOperand &getInputDatasetMutable(); + ::mlir::OpOperand &getOptimizationsEnabledMutable(); + ::mlir::OpOperand &getOptimizationsDisabledMutable(); + ::mlir::OpOperand &getOptimizationsDefaultMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::ArrayAttr getOptimizationConfigsAttr(); + ::mlir::ArrayAttr getOptimizationConfigs(); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + void setOptimizationConfigsAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeOptimizationConfigsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, ::mlir::Value optimizations_enabled, ::mlir::Value optimizations_disabled, ::mlir::Value optimizations_default, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::ArrayAttr optimization_configs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, ::mlir::Value optimizations_enabled, ::mlir::Value optimizations_disabled, ::mlir::Value optimizations_default, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::ArrayAttr optimization_configs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::OptimizeDatasetV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::OptionalFromValueOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class OptionalFromValueOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + OptionalFromValueOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + OptionalFromValueOpGenericAdaptorBase(OptionalFromValueOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class OptionalFromValueOpGenericAdaptor : public detail::OptionalFromValueOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::OptionalFromValueOpGenericAdaptorBase; +public: + OptionalFromValueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + OptionalFromValueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : OptionalFromValueOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + OptionalFromValueOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getComponents() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class OptionalFromValueOpAdaptor : public OptionalFromValueOpGenericAdaptor<::mlir::ValueRange> { +public: + using OptionalFromValueOpGenericAdaptor::OptionalFromValueOpGenericAdaptor; + OptionalFromValueOpAdaptor(OptionalFromValueOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class OptionalFromValueOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = OptionalFromValueOpAdaptor; + template + using GenericAdaptor = OptionalFromValueOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Toutput_types")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getToutputTypesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getToutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.OptionalFromValue"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getComponents(); + ::mlir::MutableOperandRange getComponentsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOptional(); + mlir::OperandElementTypeRange getToutputTypes(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type optional, ::mlir::ValueRange components); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::OptionalFromValueOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::OptionalGetValueOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class OptionalGetValueOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + OptionalGetValueOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + OptionalGetValueOpGenericAdaptorBase(OptionalGetValueOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class OptionalGetValueOpGenericAdaptor : public detail::OptionalGetValueOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::OptionalGetValueOpGenericAdaptorBase; +public: + OptionalGetValueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + OptionalGetValueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : OptionalGetValueOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + OptionalGetValueOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOptional() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class OptionalGetValueOpAdaptor : public OptionalGetValueOpGenericAdaptor<::mlir::ValueRange> { +public: + using OptionalGetValueOpGenericAdaptor::OptionalGetValueOpGenericAdaptor; + OptionalGetValueOpAdaptor(OptionalGetValueOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class OptionalGetValueOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = OptionalGetValueOpAdaptor; + template + using GenericAdaptor = OptionalGetValueOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.OptionalGetValue"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOptional(); + ::mlir::OpOperand &getOptionalMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getComponents(); + mlir::TF::ResultShapeRange getOutputShapes(); + mlir::ResultElementTypeRange getOutputTypes(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange components, ::mlir::Value optional); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::OptionalGetValueOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::OptionalHasValueOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class OptionalHasValueOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + OptionalHasValueOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + OptionalHasValueOpGenericAdaptorBase(OptionalHasValueOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class OptionalHasValueOpGenericAdaptor : public detail::OptionalHasValueOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::OptionalHasValueOpGenericAdaptorBase; +public: + OptionalHasValueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + OptionalHasValueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : OptionalHasValueOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + OptionalHasValueOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOptional() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class OptionalHasValueOpAdaptor : public OptionalHasValueOpGenericAdaptor<::mlir::ValueRange> { +public: + using OptionalHasValueOpGenericAdaptor::OptionalHasValueOpGenericAdaptor; + OptionalHasValueOpAdaptor(OptionalHasValueOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class OptionalHasValueOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = OptionalHasValueOpAdaptor; + template + using GenericAdaptor = OptionalHasValueOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.OptionalHasValue"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOptional(); + ::mlir::OpOperand &getOptionalMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHasValue(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type has_value, ::mlir::Value optional); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value optional); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::OptionalHasValueOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::OptionalNoneOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class OptionalNoneOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + OptionalNoneOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + OptionalNoneOpGenericAdaptorBase(OptionalNoneOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class OptionalNoneOpGenericAdaptor : public detail::OptionalNoneOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::OptionalNoneOpGenericAdaptorBase; +public: + OptionalNoneOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + OptionalNoneOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : OptionalNoneOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + OptionalNoneOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class OptionalNoneOpAdaptor : public OptionalNoneOpGenericAdaptor<::mlir::ValueRange> { +public: + using OptionalNoneOpGenericAdaptor::OptionalNoneOpGenericAdaptor; + OptionalNoneOpAdaptor(OptionalNoneOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class OptionalNoneOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = OptionalNoneOpAdaptor; + template + using GenericAdaptor = OptionalNoneOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.OptionalNone"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOptional(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type optional); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::OptionalNoneOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::OutfeedEnqueueOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class OutfeedEnqueueOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + OutfeedEnqueueOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + OutfeedEnqueueOpGenericAdaptorBase(OutfeedEnqueueOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class OutfeedEnqueueOpGenericAdaptor : public detail::OutfeedEnqueueOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::OutfeedEnqueueOpGenericAdaptorBase; +public: + OutfeedEnqueueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + OutfeedEnqueueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : OutfeedEnqueueOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + OutfeedEnqueueOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class OutfeedEnqueueOpAdaptor : public OutfeedEnqueueOpGenericAdaptor<::mlir::ValueRange> { +public: + using OutfeedEnqueueOpGenericAdaptor::OutfeedEnqueueOpGenericAdaptor; + OutfeedEnqueueOpAdaptor(OutfeedEnqueueOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class OutfeedEnqueueOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = OutfeedEnqueueOpAdaptor; + template + using GenericAdaptor = OutfeedEnqueueOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.OutfeedEnqueue"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::OutfeedEnqueueOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::OutfeedEnqueueTupleOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class OutfeedEnqueueTupleOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + OutfeedEnqueueTupleOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + OutfeedEnqueueTupleOpGenericAdaptorBase(OutfeedEnqueueTupleOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class OutfeedEnqueueTupleOpGenericAdaptor : public detail::OutfeedEnqueueTupleOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::OutfeedEnqueueTupleOpGenericAdaptorBase; +public: + OutfeedEnqueueTupleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + OutfeedEnqueueTupleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : OutfeedEnqueueTupleOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + OutfeedEnqueueTupleOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class OutfeedEnqueueTupleOpAdaptor : public OutfeedEnqueueTupleOpGenericAdaptor<::mlir::ValueRange> { +public: + using OutfeedEnqueueTupleOpGenericAdaptor::OutfeedEnqueueTupleOpGenericAdaptor; + OutfeedEnqueueTupleOpAdaptor(OutfeedEnqueueTupleOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class OutfeedEnqueueTupleOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = OutfeedEnqueueTupleOpAdaptor; + template + using GenericAdaptor = OutfeedEnqueueTupleOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dtypes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDtypesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDtypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.OutfeedEnqueueTuple"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::MutableOperandRange getInputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + mlir::OperandElementTypeRange getDtypes(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange inputs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::OutfeedEnqueueTupleOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::PackOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PackOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + PackOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + PackOpGenericAdaptorBase(PackOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getAxisAttr(); + uint64_t getAxis(); +}; +} // namespace detail +template +class PackOpGenericAdaptor : public detail::PackOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PackOpGenericAdaptorBase; +public: + PackOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PackOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PackOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + PackOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getValues() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PackOpAdaptor : public PackOpGenericAdaptor<::mlir::ValueRange> { +public: + using PackOpGenericAdaptor::PackOpGenericAdaptor; + PackOpAdaptor(PackOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PackOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = PackOpAdaptor; + template + using GenericAdaptor = PackOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("N"), ::llvm::StringRef("T"), ::llvm::StringRef("axis")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getAxisAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getAxisAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Pack"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getValues(); + ::mlir::MutableOperandRange getValuesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getAxisAttr(); + uint64_t getAxis(); + size_t getN(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setAxisAttr(::mlir::IntegerAttr attr); + void setAxis(::std::optional attrValue); + ::mlir::Attribute removeAxisAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::ValueRange values, /*optional*/::mlir::IntegerAttr axis); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange values, /*optional*/::mlir::IntegerAttr axis); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::ValueRange values, /*optional*/uint64_t axis = 0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange values, /*optional*/uint64_t axis = 0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::PackOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::PadOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PadOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + PadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + PadOpGenericAdaptorBase(PadOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class PadOpGenericAdaptor : public detail::PadOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PadOpGenericAdaptorBase; +public: + PadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PadOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + PadOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getPaddings() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PadOpAdaptor : public PadOpGenericAdaptor<::mlir::ValueRange> { +public: + using PadOpGenericAdaptor::PadOpGenericAdaptor; + PadOpAdaptor(PadOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PadOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, FoldOperandsTransposeInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = PadOpAdaptor; + template + using GenericAdaptor = PadOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tpaddings")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTpaddingsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTpaddingsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Pad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getPaddings(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getPaddingsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTpaddings(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value paddings); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value paddings); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // TF_FoldOperandsTransposeInterface: + SmallVector GetLayoutDependentArgs() { return {0}; } + SmallVector GetLayoutDependentResults() { return {0}; } + LogicalResult FoldOperandsPermutation(ArrayRef permutation); +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::PadOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::PadV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PadV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + PadV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + PadV2OpGenericAdaptorBase(PadV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class PadV2OpGenericAdaptor : public detail::PadV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PadV2OpGenericAdaptorBase; +public: + PadV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PadV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PadV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + PadV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getPaddings() { + return (*getODSOperands(1).begin()); + } + + ValueT getConstantValues() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PadV2OpAdaptor : public PadV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using PadV2OpGenericAdaptor::PadV2OpGenericAdaptor; + PadV2OpAdaptor(PadV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PadV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = PadV2OpAdaptor; + template + using GenericAdaptor = PadV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tpaddings")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTpaddingsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTpaddingsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.PadV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getPaddings(); + ::mlir::TypedValue<::mlir::TensorType> getConstantValues(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getPaddingsMutable(); + ::mlir::OpOperand &getConstantValuesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTpaddings(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value paddings, ::mlir::Value constant_values); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value paddings, ::mlir::Value constant_values); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::PadV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ParallelDynamicStitchOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ParallelDynamicStitchOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ParallelDynamicStitchOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ParallelDynamicStitchOpGenericAdaptorBase(ParallelDynamicStitchOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ParallelDynamicStitchOpGenericAdaptor : public detail::ParallelDynamicStitchOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ParallelDynamicStitchOpGenericAdaptorBase; +public: + ParallelDynamicStitchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ParallelDynamicStitchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ParallelDynamicStitchOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ParallelDynamicStitchOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getIndices() { + return getODSOperands(0); + } + + RangeT getData() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ParallelDynamicStitchOpAdaptor : public ParallelDynamicStitchOpGenericAdaptor<::mlir::ValueRange> { +public: + using ParallelDynamicStitchOpGenericAdaptor::ParallelDynamicStitchOpGenericAdaptor; + ParallelDynamicStitchOpAdaptor(ParallelDynamicStitchOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ParallelDynamicStitchOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ParallelDynamicStitchOpAdaptor; + template + using GenericAdaptor = ParallelDynamicStitchOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("N"), ::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ParallelDynamicStitch"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getIndices(); + ::mlir::Operation::operand_range getData(); + ::mlir::MutableOperandRange getIndicesMutable(); + ::mlir::MutableOperandRange getDataMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getMerged(); + size_t getN(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type merged, ::mlir::ValueRange indices, ::mlir::ValueRange data); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange indices, ::mlir::ValueRange data); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ParallelDynamicStitchOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ParallelMapDatasetOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ParallelMapDatasetOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ParallelMapDatasetOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ParallelMapDatasetOpGenericAdaptorBase(ParallelMapDatasetOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::SymbolRefAttr getFAttr(); + ::mlir::SymbolRefAttr getF(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::BoolAttr getUseInterOpParallelismAttr(); + bool getUseInterOpParallelism(); + ::mlir::BoolAttr getSloppyAttr(); + bool getSloppy(); + ::mlir::BoolAttr getPreserveCardinalityAttr(); + bool getPreserveCardinality(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); +}; +} // namespace detail +template +class ParallelMapDatasetOpGenericAdaptor : public detail::ParallelMapDatasetOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ParallelMapDatasetOpGenericAdaptorBase; +public: + ParallelMapDatasetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ParallelMapDatasetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ParallelMapDatasetOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ParallelMapDatasetOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputDataset() { + return (*getODSOperands(0).begin()); + } + + RangeT getOtherArguments() { + return getODSOperands(1); + } + + ValueT getNumParallelCalls() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ParallelMapDatasetOpAdaptor : public ParallelMapDatasetOpGenericAdaptor<::mlir::ValueRange> { +public: + using ParallelMapDatasetOpGenericAdaptor::ParallelMapDatasetOpGenericAdaptor; + ParallelMapDatasetOpAdaptor(ParallelMapDatasetOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ParallelMapDatasetOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ParallelMapDatasetOpAdaptor; + template + using GenericAdaptor = ParallelMapDatasetOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Targuments"), ::llvm::StringRef("f"), ::llvm::StringRef("metadata"), ::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types"), ::llvm::StringRef("preserve_cardinality"), ::llvm::StringRef("sloppy"), ::llvm::StringRef("use_inter_op_parallelism")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTargumentsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTargumentsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getFAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getFAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getMetadataAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getMetadataAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getPreserveCardinalityAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getPreserveCardinalityAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getSloppyAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getSloppyAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getUseInterOpParallelismAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getUseInterOpParallelismAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ParallelMapDataset"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputDataset(); + ::mlir::Operation::operand_range getOtherArguments(); + ::mlir::TypedValue<::mlir::TensorType> getNumParallelCalls(); + ::mlir::OpOperand &getInputDatasetMutable(); + ::mlir::MutableOperandRange getOtherArgumentsMutable(); + ::mlir::OpOperand &getNumParallelCallsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::SymbolRefAttr getFAttr(); + ::mlir::SymbolRefAttr getF(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::BoolAttr getUseInterOpParallelismAttr(); + bool getUseInterOpParallelism(); + ::mlir::BoolAttr getSloppyAttr(); + bool getSloppy(); + ::mlir::BoolAttr getPreserveCardinalityAttr(); + bool getPreserveCardinality(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); + mlir::OperandElementTypeRange getTarguments(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setFAttr(::mlir::SymbolRefAttr attr); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + void setUseInterOpParallelismAttr(::mlir::BoolAttr attr); + void setUseInterOpParallelism(::std::optional attrValue); + void setSloppyAttr(::mlir::BoolAttr attr); + void setSloppy(::std::optional attrValue); + void setPreserveCardinalityAttr(::mlir::BoolAttr attr); + void setPreserveCardinality(::std::optional attrValue); + void setMetadataAttr(::mlir::StringAttr attr); + void setMetadata(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeUseInterOpParallelismAttr(); + ::mlir::Attribute removeSloppyAttr(); + ::mlir::Attribute removePreserveCardinalityAttr(); + ::mlir::Attribute removeMetadataAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, ::mlir::ValueRange other_arguments, ::mlir::Value num_parallel_calls, ::mlir::SymbolRefAttr f, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::BoolAttr use_inter_op_parallelism, /*optional*/::mlir::BoolAttr sloppy, /*optional*/::mlir::BoolAttr preserve_cardinality, /*optional*/::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, ::mlir::ValueRange other_arguments, ::mlir::Value num_parallel_calls, ::mlir::SymbolRefAttr f, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::BoolAttr use_inter_op_parallelism, /*optional*/::mlir::BoolAttr sloppy, /*optional*/::mlir::BoolAttr preserve_cardinality, /*optional*/::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, ::mlir::ValueRange other_arguments, ::mlir::Value num_parallel_calls, ::mlir::SymbolRefAttr f, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/bool use_inter_op_parallelism = true, /*optional*/bool sloppy = false, /*optional*/bool preserve_cardinality = false, /*optional*/::llvm::StringRef metadata = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, ::mlir::ValueRange other_arguments, ::mlir::Value num_parallel_calls, ::mlir::SymbolRefAttr f, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/bool use_inter_op_parallelism = true, /*optional*/bool sloppy = false, /*optional*/bool preserve_cardinality = false, /*optional*/::llvm::StringRef metadata = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 8 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ParallelMapDatasetOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ParallelMapDatasetV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ParallelMapDatasetV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ParallelMapDatasetV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ParallelMapDatasetV2OpGenericAdaptorBase(ParallelMapDatasetV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::SymbolRefAttr getFAttr(); + ::mlir::SymbolRefAttr getF(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::BoolAttr getUseInterOpParallelismAttr(); + bool getUseInterOpParallelism(); + ::mlir::StringAttr getDeterministicAttr(); + ::llvm::StringRef getDeterministic(); + ::mlir::BoolAttr getPreserveCardinalityAttr(); + bool getPreserveCardinality(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); +}; +} // namespace detail +template +class ParallelMapDatasetV2OpGenericAdaptor : public detail::ParallelMapDatasetV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ParallelMapDatasetV2OpGenericAdaptorBase; +public: + ParallelMapDatasetV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ParallelMapDatasetV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ParallelMapDatasetV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ParallelMapDatasetV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputDataset() { + return (*getODSOperands(0).begin()); + } + + RangeT getOtherArguments() { + return getODSOperands(1); + } + + ValueT getNumParallelCalls() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ParallelMapDatasetV2OpAdaptor : public ParallelMapDatasetV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using ParallelMapDatasetV2OpGenericAdaptor::ParallelMapDatasetV2OpGenericAdaptor; + ParallelMapDatasetV2OpAdaptor(ParallelMapDatasetV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ParallelMapDatasetV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ParallelMapDatasetV2OpAdaptor; + template + using GenericAdaptor = ParallelMapDatasetV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Targuments"), ::llvm::StringRef("deterministic"), ::llvm::StringRef("f"), ::llvm::StringRef("metadata"), ::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types"), ::llvm::StringRef("preserve_cardinality"), ::llvm::StringRef("use_inter_op_parallelism")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTargumentsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTargumentsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDeterministicAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDeterministicAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getFAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getFAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getMetadataAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getMetadataAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getPreserveCardinalityAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getPreserveCardinalityAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getUseInterOpParallelismAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getUseInterOpParallelismAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ParallelMapDatasetV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputDataset(); + ::mlir::Operation::operand_range getOtherArguments(); + ::mlir::TypedValue<::mlir::TensorType> getNumParallelCalls(); + ::mlir::OpOperand &getInputDatasetMutable(); + ::mlir::MutableOperandRange getOtherArgumentsMutable(); + ::mlir::OpOperand &getNumParallelCallsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::SymbolRefAttr getFAttr(); + ::mlir::SymbolRefAttr getF(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::BoolAttr getUseInterOpParallelismAttr(); + bool getUseInterOpParallelism(); + ::mlir::StringAttr getDeterministicAttr(); + ::llvm::StringRef getDeterministic(); + ::mlir::BoolAttr getPreserveCardinalityAttr(); + bool getPreserveCardinality(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); + mlir::OperandElementTypeRange getTarguments(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setFAttr(::mlir::SymbolRefAttr attr); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + void setUseInterOpParallelismAttr(::mlir::BoolAttr attr); + void setUseInterOpParallelism(::std::optional attrValue); + void setDeterministicAttr(::mlir::StringAttr attr); + void setDeterministic(::std::optional<::llvm::StringRef> attrValue); + void setPreserveCardinalityAttr(::mlir::BoolAttr attr); + void setPreserveCardinality(::std::optional attrValue); + void setMetadataAttr(::mlir::StringAttr attr); + void setMetadata(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeUseInterOpParallelismAttr(); + ::mlir::Attribute removeDeterministicAttr(); + ::mlir::Attribute removePreserveCardinalityAttr(); + ::mlir::Attribute removeMetadataAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, ::mlir::ValueRange other_arguments, ::mlir::Value num_parallel_calls, ::mlir::SymbolRefAttr f, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::BoolAttr use_inter_op_parallelism, /*optional*/::mlir::StringAttr deterministic, /*optional*/::mlir::BoolAttr preserve_cardinality, /*optional*/::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, ::mlir::ValueRange other_arguments, ::mlir::Value num_parallel_calls, ::mlir::SymbolRefAttr f, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::BoolAttr use_inter_op_parallelism, /*optional*/::mlir::StringAttr deterministic, /*optional*/::mlir::BoolAttr preserve_cardinality, /*optional*/::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, ::mlir::ValueRange other_arguments, ::mlir::Value num_parallel_calls, ::mlir::SymbolRefAttr f, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/bool use_inter_op_parallelism = true, /*optional*/::llvm::StringRef deterministic = "default", /*optional*/bool preserve_cardinality = false, /*optional*/::llvm::StringRef metadata = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, ::mlir::ValueRange other_arguments, ::mlir::Value num_parallel_calls, ::mlir::SymbolRefAttr f, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/bool use_inter_op_parallelism = true, /*optional*/::llvm::StringRef deterministic = "default", /*optional*/bool preserve_cardinality = false, /*optional*/::llvm::StringRef metadata = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 8 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ParallelMapDatasetV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ParameterizedTruncatedNormalOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ParameterizedTruncatedNormalOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ParameterizedTruncatedNormalOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ParameterizedTruncatedNormalOpGenericAdaptorBase(ParameterizedTruncatedNormalOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getSeedAttr(); + uint64_t getSeed(); + ::mlir::IntegerAttr getSeed2Attr(); + uint64_t getSeed2(); +}; +} // namespace detail +template +class ParameterizedTruncatedNormalOpGenericAdaptor : public detail::ParameterizedTruncatedNormalOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ParameterizedTruncatedNormalOpGenericAdaptorBase; +public: + ParameterizedTruncatedNormalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ParameterizedTruncatedNormalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ParameterizedTruncatedNormalOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ParameterizedTruncatedNormalOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getShape() { + return (*getODSOperands(0).begin()); + } + + ValueT getMeans() { + return (*getODSOperands(1).begin()); + } + + ValueT getStdevs() { + return (*getODSOperands(2).begin()); + } + + ValueT getMinvals() { + return (*getODSOperands(3).begin()); + } + + ValueT getMaxvals() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ParameterizedTruncatedNormalOpAdaptor : public ParameterizedTruncatedNormalOpGenericAdaptor<::mlir::ValueRange> { +public: + using ParameterizedTruncatedNormalOpGenericAdaptor::ParameterizedTruncatedNormalOpGenericAdaptor; + ParameterizedTruncatedNormalOpAdaptor(ParameterizedTruncatedNormalOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ParameterizedTruncatedNormalOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<5>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::TF::CannotDuplicate, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ParameterizedTruncatedNormalOpAdaptor; + template + using GenericAdaptor = ParameterizedTruncatedNormalOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("dtype"), ::llvm::StringRef("seed"), ::llvm::StringRef("seed2")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getSeedAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getSeedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSeed2AttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSeed2AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ParameterizedTruncatedNormal"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::TypedValue<::mlir::TensorType> getMeans(); + ::mlir::TypedValue<::mlir::TensorType> getStdevs(); + ::mlir::TypedValue<::mlir::TensorType> getMinvals(); + ::mlir::TypedValue<::mlir::TensorType> getMaxvals(); + ::mlir::OpOperand &getShapeMutable(); + ::mlir::OpOperand &getMeansMutable(); + ::mlir::OpOperand &getStdevsMutable(); + ::mlir::OpOperand &getMinvalsMutable(); + ::mlir::OpOperand &getMaxvalsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getSeedAttr(); + uint64_t getSeed(); + ::mlir::IntegerAttr getSeed2Attr(); + uint64_t getSeed2(); + ::mlir::Type getT(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setSeedAttr(::mlir::IntegerAttr attr); + void setSeed(::std::optional attrValue); + void setSeed2Attr(::mlir::IntegerAttr attr); + void setSeed2(::std::optional attrValue); + ::mlir::Attribute removeSeedAttr(); + ::mlir::Attribute removeSeed2Attr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, ::mlir::Value means, ::mlir::Value stdevs, ::mlir::Value minvals, ::mlir::Value maxvals, /*optional*/::mlir::IntegerAttr seed, /*optional*/::mlir::IntegerAttr seed2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, ::mlir::Value means, ::mlir::Value stdevs, ::mlir::Value minvals, ::mlir::Value maxvals, /*optional*/::mlir::IntegerAttr seed, /*optional*/::mlir::IntegerAttr seed2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, ::mlir::Value means, ::mlir::Value stdevs, ::mlir::Value minvals, ::mlir::Value maxvals, /*optional*/uint64_t seed = 0, /*optional*/uint64_t seed2 = 0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, ::mlir::Value means, ::mlir::Value stdevs, ::mlir::Value minvals, ::mlir::Value maxvals, /*optional*/uint64_t seed = 0, /*optional*/uint64_t seed2 = 0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ParameterizedTruncatedNormalOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ParseExampleOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ParseExampleOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ParseExampleOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ParseExampleOpGenericAdaptorBase(ParseExampleOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getDenseShapesAttr(); + ::mlir::ArrayAttr getDenseShapes(); + ::mlir::DenseI32ArrayAttr getResultSegmentSizesAttr(); + ::llvm::ArrayRef getResultSegmentSizes(); + ::mlir::DenseI32ArrayAttr getOperandSegmentSizesAttr(); + ::llvm::ArrayRef getOperandSegmentSizes(); +}; +} // namespace detail +template +class ParseExampleOpGenericAdaptor : public detail::ParseExampleOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ParseExampleOpGenericAdaptorBase; +public: + ParseExampleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ParseExampleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ParseExampleOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ParseExampleOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSerialized() { + return (*getODSOperands(0).begin()); + } + + ValueT getNames() { + return (*getODSOperands(1).begin()); + } + + RangeT getSparseKeys() { + return getODSOperands(2); + } + + RangeT getDenseKeys() { + return getODSOperands(3); + } + + RangeT getDenseDefaults() { + return getODSOperands(4); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ParseExampleOpAdaptor : public ParseExampleOpGenericAdaptor<::mlir::ValueRange> { +public: + using ParseExampleOpGenericAdaptor::ParseExampleOpGenericAdaptor; + ParseExampleOpAdaptor(ParseExampleOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ParseExampleOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedResultSegments, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ParseExampleOpAdaptor; + template + using GenericAdaptor = ParseExampleOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Ndense"), ::llvm::StringRef("Nsparse"), ::llvm::StringRef("Tdense"), ::llvm::StringRef("dense_shapes"), ::llvm::StringRef("operandSegmentSizes"), ::llvm::StringRef("resultSegmentSizes"), ::llvm::StringRef("sparse_types")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNdenseAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNdenseAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNsparseAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNsparseAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTdenseAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTdenseAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getDenseShapesAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getDenseShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getResultSegmentSizesAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getResultSegmentSizesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getSparseTypesAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getSparseTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ParseExample"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSerialized(); + ::mlir::TypedValue<::mlir::TensorType> getNames(); + ::mlir::Operation::operand_range getSparseKeys(); + ::mlir::Operation::operand_range getDenseKeys(); + ::mlir::Operation::operand_range getDenseDefaults(); + ::mlir::OpOperand &getSerializedMutable(); + ::mlir::OpOperand &getNamesMutable(); + ::mlir::MutableOperandRange getSparseKeysMutable(); + ::mlir::MutableOperandRange getDenseKeysMutable(); + ::mlir::MutableOperandRange getDenseDefaultsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getSparseIndices(); + ::mlir::Operation::result_range getSparseValues(); + ::mlir::Operation::result_range getSparseShapes(); + ::mlir::Operation::result_range getDenseValues(); + ::mlir::ArrayAttr getDenseShapesAttr(); + ::mlir::ArrayAttr getDenseShapes(); + ::mlir::DenseI32ArrayAttr getResultSegmentSizesAttr(); + ::llvm::ArrayRef getResultSegmentSizes(); + ::mlir::DenseI32ArrayAttr getOperandSegmentSizesAttr(); + ::llvm::ArrayRef getOperandSegmentSizes(); + size_t getNsparse(); + size_t getNdense(); + mlir::OperandElementTypeRange getTdense(); + mlir::ResultElementTypeRange getSparseTypes(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setDenseShapesAttr(::mlir::ArrayAttr attr); + void setResultSegmentSizesAttr(::mlir::DenseI32ArrayAttr attr); + void setResultSegmentSizes(::llvm::ArrayRef attrValue); + void setOperandSegmentSizesAttr(::mlir::DenseI32ArrayAttr attr); + void setOperandSegmentSizes(::llvm::ArrayRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange sparse_indices, ::mlir::TypeRange sparse_values, ::mlir::TypeRange sparse_shapes, ::mlir::TypeRange dense_values, ::mlir::Value serialized, ::mlir::Value names, ::mlir::ValueRange sparse_keys, ::mlir::ValueRange dense_keys, ::mlir::ValueRange dense_defaults, ::mlir::ArrayAttr dense_shapes, ::mlir::DenseI32ArrayAttr resultSegmentSizes, ::mlir::DenseI32ArrayAttr operandSegmentSizes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value serialized, ::mlir::Value names, ::mlir::ValueRange sparse_keys, ::mlir::ValueRange dense_keys, ::mlir::ValueRange dense_defaults, ::mlir::ArrayAttr dense_shapes, ::mlir::DenseI32ArrayAttr resultSegmentSizes, ::mlir::DenseI32ArrayAttr operandSegmentSizes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange sparse_indices, ::mlir::TypeRange sparse_values, ::mlir::TypeRange sparse_shapes, ::mlir::TypeRange dense_values, ::mlir::Value serialized, ::mlir::Value names, ::mlir::ValueRange sparse_keys, ::mlir::ValueRange dense_keys, ::mlir::ValueRange dense_defaults, ::mlir::ArrayAttr dense_shapes, ::llvm::ArrayRef resultSegmentSizes, ::llvm::ArrayRef operandSegmentSizes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value serialized, ::mlir::Value names, ::mlir::ValueRange sparse_keys, ::mlir::ValueRange dense_keys, ::mlir::ValueRange dense_defaults, ::mlir::ArrayAttr dense_shapes, ::llvm::ArrayRef resultSegmentSizes, ::llvm::ArrayRef operandSegmentSizes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 7 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ParseExampleOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ParseExampleV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ParseExampleV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ParseExampleV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ParseExampleV2OpGenericAdaptorBase(ParseExampleV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getNumSparseAttr(); + uint64_t getNumSparse(); + ::mlir::ArrayAttr getDenseShapesAttr(); + ::mlir::ArrayAttr getDenseShapes(); + ::mlir::DenseI32ArrayAttr getResultSegmentSizesAttr(); + ::llvm::ArrayRef getResultSegmentSizes(); +}; +} // namespace detail +template +class ParseExampleV2OpGenericAdaptor : public detail::ParseExampleV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ParseExampleV2OpGenericAdaptorBase; +public: + ParseExampleV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ParseExampleV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ParseExampleV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ParseExampleV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSerialized() { + return (*getODSOperands(0).begin()); + } + + ValueT getNames() { + return (*getODSOperands(1).begin()); + } + + ValueT getSparseKeys() { + return (*getODSOperands(2).begin()); + } + + ValueT getDenseKeys() { + return (*getODSOperands(3).begin()); + } + + ValueT getRaggedKeys() { + return (*getODSOperands(4).begin()); + } + + RangeT getDenseDefaults() { + return getODSOperands(5); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ParseExampleV2OpAdaptor : public ParseExampleV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using ParseExampleV2OpGenericAdaptor::ParseExampleV2OpGenericAdaptor; + ParseExampleV2OpAdaptor(ParseExampleV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ParseExampleV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedResultSegments, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ParseExampleV2OpAdaptor; + template + using GenericAdaptor = ParseExampleV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tdense"), ::llvm::StringRef("dense_shapes"), ::llvm::StringRef("num_sparse"), ::llvm::StringRef("ragged_split_types"), ::llvm::StringRef("ragged_value_types"), ::llvm::StringRef("resultSegmentSizes"), ::llvm::StringRef("sparse_types")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTdenseAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTdenseAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDenseShapesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDenseShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getNumSparseAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getNumSparseAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getRaggedSplitTypesAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getRaggedSplitTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getRaggedValueTypesAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getRaggedValueTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getResultSegmentSizesAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getResultSegmentSizesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getSparseTypesAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getSparseTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ParseExampleV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSerialized(); + ::mlir::TypedValue<::mlir::TensorType> getNames(); + ::mlir::TypedValue<::mlir::TensorType> getSparseKeys(); + ::mlir::TypedValue<::mlir::TensorType> getDenseKeys(); + ::mlir::TypedValue<::mlir::TensorType> getRaggedKeys(); + ::mlir::Operation::operand_range getDenseDefaults(); + ::mlir::OpOperand &getSerializedMutable(); + ::mlir::OpOperand &getNamesMutable(); + ::mlir::OpOperand &getSparseKeysMutable(); + ::mlir::OpOperand &getDenseKeysMutable(); + ::mlir::OpOperand &getRaggedKeysMutable(); + ::mlir::MutableOperandRange getDenseDefaultsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getSparseIndices(); + ::mlir::Operation::result_range getSparseValues(); + ::mlir::Operation::result_range getSparseShapes(); + ::mlir::Operation::result_range getDenseValues(); + ::mlir::Operation::result_range getRaggedValues(); + ::mlir::Operation::result_range getRaggedRowSplits(); + ::mlir::IntegerAttr getNumSparseAttr(); + uint64_t getNumSparse(); + ::mlir::ArrayAttr getDenseShapesAttr(); + ::mlir::ArrayAttr getDenseShapes(); + ::mlir::DenseI32ArrayAttr getResultSegmentSizesAttr(); + ::llvm::ArrayRef getResultSegmentSizes(); + mlir::OperandElementTypeRange getTdense(); + mlir::ResultElementTypeRange getSparseTypes(); + mlir::ResultElementTypeRange getRaggedValueTypes(); + mlir::ResultElementTypeRange getRaggedSplitTypes(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setNumSparseAttr(::mlir::IntegerAttr attr); + void setNumSparse(uint64_t attrValue); + void setDenseShapesAttr(::mlir::ArrayAttr attr); + void setResultSegmentSizesAttr(::mlir::DenseI32ArrayAttr attr); + void setResultSegmentSizes(::llvm::ArrayRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange sparse_indices, ::mlir::TypeRange sparse_values, ::mlir::TypeRange sparse_shapes, ::mlir::TypeRange dense_values, ::mlir::TypeRange ragged_values, ::mlir::TypeRange ragged_row_splits, ::mlir::Value serialized, ::mlir::Value names, ::mlir::Value sparse_keys, ::mlir::Value dense_keys, ::mlir::Value ragged_keys, ::mlir::ValueRange dense_defaults, ::mlir::IntegerAttr num_sparse, ::mlir::ArrayAttr dense_shapes, ::mlir::DenseI32ArrayAttr resultSegmentSizes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value serialized, ::mlir::Value names, ::mlir::Value sparse_keys, ::mlir::Value dense_keys, ::mlir::Value ragged_keys, ::mlir::ValueRange dense_defaults, ::mlir::IntegerAttr num_sparse, ::mlir::ArrayAttr dense_shapes, ::mlir::DenseI32ArrayAttr resultSegmentSizes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange sparse_indices, ::mlir::TypeRange sparse_values, ::mlir::TypeRange sparse_shapes, ::mlir::TypeRange dense_values, ::mlir::TypeRange ragged_values, ::mlir::TypeRange ragged_row_splits, ::mlir::Value serialized, ::mlir::Value names, ::mlir::Value sparse_keys, ::mlir::Value dense_keys, ::mlir::Value ragged_keys, ::mlir::ValueRange dense_defaults, uint64_t num_sparse, ::mlir::ArrayAttr dense_shapes, ::llvm::ArrayRef resultSegmentSizes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value serialized, ::mlir::Value names, ::mlir::Value sparse_keys, ::mlir::Value dense_keys, ::mlir::Value ragged_keys, ::mlir::ValueRange dense_defaults, uint64_t num_sparse, ::mlir::ArrayAttr dense_shapes, ::llvm::ArrayRef resultSegmentSizes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 7 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ParseExampleV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::PartitionedCallOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PartitionedCallOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + PartitionedCallOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + PartitionedCallOpGenericAdaptorBase(PartitionedCallOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::SymbolRefAttr getFAttr(); + ::mlir::SymbolRefAttr getF(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + ::mlir::StringAttr getConfigProtoAttr(); + ::llvm::StringRef getConfigProto(); + ::mlir::StringAttr getExecutorTypeAttr(); + ::llvm::StringRef getExecutorType(); +}; +} // namespace detail +template +class PartitionedCallOpGenericAdaptor : public detail::PartitionedCallOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PartitionedCallOpGenericAdaptorBase; +public: + PartitionedCallOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PartitionedCallOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PartitionedCallOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + PartitionedCallOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PartitionedCallOpAdaptor : public PartitionedCallOpGenericAdaptor<::mlir::ValueRange> { +public: + using PartitionedCallOpGenericAdaptor::PartitionedCallOpGenericAdaptor; + PartitionedCallOpAdaptor(PartitionedCallOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PartitionedCallOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = PartitionedCallOpAdaptor; + template + using GenericAdaptor = PartitionedCallOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tin"), ::llvm::StringRef("Tout"), ::llvm::StringRef("config"), ::llvm::StringRef("config_proto"), ::llvm::StringRef("executor_type"), ::llvm::StringRef("f")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTinAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTinAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getToutAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getToutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getConfigProtoAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getConfigProtoAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getExecutorTypeAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getExecutorTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getFAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getFAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.PartitionedCall"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutput(); + ::mlir::SymbolRefAttr getFAttr(); + ::mlir::SymbolRefAttr getF(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + ::mlir::StringAttr getConfigProtoAttr(); + ::llvm::StringRef getConfigProto(); + ::mlir::StringAttr getExecutorTypeAttr(); + ::llvm::StringRef getExecutorType(); + mlir::OperandElementTypeRange getTin(); + mlir::ResultElementTypeRange getTout(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setFAttr(::mlir::SymbolRefAttr attr); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + void setConfigProtoAttr(::mlir::StringAttr attr); + void setConfigProto(::std::optional<::llvm::StringRef> attrValue); + void setExecutorTypeAttr(::mlir::StringAttr attr); + void setExecutorType(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeConfigAttr(); + ::mlir::Attribute removeConfigProtoAttr(); + ::mlir::Attribute removeExecutorTypeAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::ValueRange args, ::mlir::SymbolRefAttr f, /*optional*/::mlir::StringAttr config, /*optional*/::mlir::StringAttr config_proto, /*optional*/::mlir::StringAttr executor_type); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::ValueRange args, ::mlir::SymbolRefAttr f, /*optional*/::llvm::StringRef config = "", /*optional*/::llvm::StringRef config_proto = "", /*optional*/::llvm::StringRef executor_type = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verifySymbolUses(::mlir::SymbolTableCollection &symbolTable); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Gets the argument operands to the called function. + operand_range getArgOperands() { return getArgs(); } + MutableOperandRange getArgOperandsMutable() { + return getArgsMutable(); + } + + // Returns the callee of this operation. + CallInterfaceCallable getCallableForCallee() { return getFAttr(); } + // Sets the callee from the callable. + void setCalleeFromCallable(CallInterfaceCallable callee); + + // returns the callee of this operation. + func::FuncOp func() { + return SymbolTable::lookupNearestSymbolFrom(*this, getF()); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::PartitionedCallOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::PlaceholderOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PlaceholderOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + PlaceholderOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + PlaceholderOpGenericAdaptorBase(PlaceholderOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class PlaceholderOpGenericAdaptor : public detail::PlaceholderOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PlaceholderOpGenericAdaptorBase; +public: + PlaceholderOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PlaceholderOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PlaceholderOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + PlaceholderOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PlaceholderOpAdaptor : public PlaceholderOpGenericAdaptor<::mlir::ValueRange> { +public: + using PlaceholderOpGenericAdaptor::PlaceholderOpGenericAdaptor; + PlaceholderOpAdaptor(PlaceholderOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PlaceholderOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = PlaceholderOpAdaptor; + template + using GenericAdaptor = PlaceholderOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Placeholder"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::PlaceholderOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::PlaceholderWithDefaultOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PlaceholderWithDefaultOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + PlaceholderWithDefaultOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + PlaceholderWithDefaultOpGenericAdaptorBase(PlaceholderWithDefaultOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class PlaceholderWithDefaultOpGenericAdaptor : public detail::PlaceholderWithDefaultOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PlaceholderWithDefaultOpGenericAdaptorBase; +public: + PlaceholderWithDefaultOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PlaceholderWithDefaultOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PlaceholderWithDefaultOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + PlaceholderWithDefaultOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PlaceholderWithDefaultOpAdaptor : public PlaceholderWithDefaultOpGenericAdaptor<::mlir::ValueRange> { +public: + using PlaceholderWithDefaultOpGenericAdaptor::PlaceholderWithDefaultOpGenericAdaptor; + PlaceholderWithDefaultOpAdaptor(PlaceholderWithDefaultOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PlaceholderWithDefaultOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = PlaceholderWithDefaultOpAdaptor; + template + using GenericAdaptor = PlaceholderWithDefaultOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dtype"), ::llvm::StringRef("shape")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getShapeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getShapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.PlaceholderWithDefault"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getDtype(); + ShapedType getShape(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::PlaceholderWithDefaultOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::PolygammaOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PolygammaOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + PolygammaOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + PolygammaOpGenericAdaptorBase(PolygammaOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class PolygammaOpGenericAdaptor : public detail::PolygammaOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PolygammaOpGenericAdaptorBase; +public: + PolygammaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PolygammaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PolygammaOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + PolygammaOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + ValueT getX() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PolygammaOpAdaptor : public PolygammaOpGenericAdaptor<::mlir::ValueRange> { +public: + using PolygammaOpGenericAdaptor::PolygammaOpGenericAdaptor; + PolygammaOpAdaptor(PolygammaOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PolygammaOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = PolygammaOpAdaptor; + template + using GenericAdaptor = PolygammaOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Polygamma"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getA(); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getAMutable(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value a, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::PolygammaOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::PopulationCountOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PopulationCountOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + PopulationCountOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + PopulationCountOpGenericAdaptorBase(PopulationCountOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class PopulationCountOpGenericAdaptor : public detail::PopulationCountOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PopulationCountOpGenericAdaptorBase; +public: + PopulationCountOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PopulationCountOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PopulationCountOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + PopulationCountOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PopulationCountOpAdaptor : public PopulationCountOpGenericAdaptor<::mlir::ValueRange> { +public: + using PopulationCountOpGenericAdaptor::PopulationCountOpGenericAdaptor; + PopulationCountOpAdaptor(PopulationCountOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PopulationCountOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = PopulationCountOpAdaptor; + template + using GenericAdaptor = PopulationCountOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.PopulationCount"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::PopulationCountOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::PowOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PowOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + PowOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + PowOpGenericAdaptorBase(PowOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class PowOpGenericAdaptor : public detail::PowOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PowOpGenericAdaptorBase; +public: + PowOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PowOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PowOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + PowOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PowOpAdaptor : public PowOpGenericAdaptor<::mlir::ValueRange> { +public: + using PowOpGenericAdaptor::PowOpGenericAdaptor; + PowOpAdaptor(PowOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PowOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::OpTrait::TF::SameOperandsAndResultElementTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = PowOpAdaptor; + template + using GenericAdaptor = PowOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Pow"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::PowOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::PrefetchDatasetOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PrefetchDatasetOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + PrefetchDatasetOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + PrefetchDatasetOpGenericAdaptorBase(PrefetchDatasetOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::IntegerAttr getSlackPeriodAttr(); + uint64_t getSlackPeriod(); + ::mlir::BoolAttr getLegacyAutotuneAttr(); + bool getLegacyAutotune(); + ::mlir::IntegerAttr getBufferSizeMinAttr(); + uint64_t getBufferSizeMin(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); +}; +} // namespace detail +template +class PrefetchDatasetOpGenericAdaptor : public detail::PrefetchDatasetOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PrefetchDatasetOpGenericAdaptorBase; +public: + PrefetchDatasetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PrefetchDatasetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PrefetchDatasetOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + PrefetchDatasetOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputDataset() { + return (*getODSOperands(0).begin()); + } + + ValueT getBufferSize() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PrefetchDatasetOpAdaptor : public PrefetchDatasetOpGenericAdaptor<::mlir::ValueRange> { +public: + using PrefetchDatasetOpGenericAdaptor::PrefetchDatasetOpGenericAdaptor; + PrefetchDatasetOpAdaptor(PrefetchDatasetOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PrefetchDatasetOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = PrefetchDatasetOpAdaptor; + template + using GenericAdaptor = PrefetchDatasetOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("buffer_size_min"), ::llvm::StringRef("legacy_autotune"), ::llvm::StringRef("metadata"), ::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types"), ::llvm::StringRef("slack_period")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBufferSizeMinAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBufferSizeMinAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getLegacyAutotuneAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getLegacyAutotuneAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getMetadataAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getMetadataAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getSlackPeriodAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getSlackPeriodAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.PrefetchDataset"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputDataset(); + ::mlir::TypedValue<::mlir::TensorType> getBufferSize(); + ::mlir::OpOperand &getInputDatasetMutable(); + ::mlir::OpOperand &getBufferSizeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::IntegerAttr getSlackPeriodAttr(); + uint64_t getSlackPeriod(); + ::mlir::BoolAttr getLegacyAutotuneAttr(); + bool getLegacyAutotune(); + ::mlir::IntegerAttr getBufferSizeMinAttr(); + uint64_t getBufferSizeMin(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + void setSlackPeriodAttr(::mlir::IntegerAttr attr); + void setSlackPeriod(::std::optional attrValue); + void setLegacyAutotuneAttr(::mlir::BoolAttr attr); + void setLegacyAutotune(::std::optional attrValue); + void setBufferSizeMinAttr(::mlir::IntegerAttr attr); + void setBufferSizeMin(::std::optional attrValue); + void setMetadataAttr(::mlir::StringAttr attr); + void setMetadata(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeSlackPeriodAttr(); + ::mlir::Attribute removeLegacyAutotuneAttr(); + ::mlir::Attribute removeBufferSizeMinAttr(); + ::mlir::Attribute removeMetadataAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, ::mlir::Value buffer_size, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::IntegerAttr slack_period, /*optional*/::mlir::BoolAttr legacy_autotune, /*optional*/::mlir::IntegerAttr buffer_size_min, /*optional*/::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, ::mlir::Value buffer_size, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::IntegerAttr slack_period, /*optional*/::mlir::BoolAttr legacy_autotune, /*optional*/::mlir::IntegerAttr buffer_size_min, /*optional*/::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, ::mlir::Value buffer_size, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/uint64_t slack_period = 0, /*optional*/bool legacy_autotune = true, /*optional*/uint64_t buffer_size_min = 0, /*optional*/::llvm::StringRef metadata = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, ::mlir::Value buffer_size, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/uint64_t slack_period = 0, /*optional*/bool legacy_autotune = true, /*optional*/uint64_t buffer_size_min = 0, /*optional*/::llvm::StringRef metadata = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::PrefetchDatasetOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::PreventGradientOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PreventGradientOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + PreventGradientOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + PreventGradientOpGenericAdaptorBase(PreventGradientOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getMessageAttr(); + ::llvm::StringRef getMessage(); +}; +} // namespace detail +template +class PreventGradientOpGenericAdaptor : public detail::PreventGradientOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PreventGradientOpGenericAdaptorBase; +public: + PreventGradientOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PreventGradientOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PreventGradientOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + PreventGradientOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PreventGradientOpAdaptor : public PreventGradientOpGenericAdaptor<::mlir::ValueRange> { +public: + using PreventGradientOpGenericAdaptor::PreventGradientOpGenericAdaptor; + PreventGradientOpAdaptor(PreventGradientOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PreventGradientOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = PreventGradientOpAdaptor; + template + using GenericAdaptor = PreventGradientOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("message")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getMessageAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getMessageAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.PreventGradient"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::StringAttr getMessageAttr(); + ::llvm::StringRef getMessage(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setMessageAttr(::mlir::StringAttr attr); + void setMessage(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeMessageAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, /*optional*/::mlir::StringAttr message); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, /*optional*/::mlir::StringAttr message); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, /*optional*/::mlir::StringAttr message); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, /*optional*/::llvm::StringRef message = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, /*optional*/::llvm::StringRef message = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, /*optional*/::llvm::StringRef message = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::PreventGradientOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::PrintOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PrintOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + PrintOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + PrintOpGenericAdaptorBase(PrintOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getMessageAttr(); + ::llvm::StringRef getMessage(); + ::mlir::IntegerAttr getFirstNAttr(); + uint64_t getFirstN(); + ::mlir::IntegerAttr getSummarizeAttr(); + uint64_t getSummarize(); +}; +} // namespace detail +template +class PrintOpGenericAdaptor : public detail::PrintOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PrintOpGenericAdaptorBase; +public: + PrintOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PrintOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PrintOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + PrintOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getData() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PrintOpAdaptor : public PrintOpGenericAdaptor<::mlir::ValueRange> { +public: + using PrintOpGenericAdaptor::PrintOpGenericAdaptor; + PrintOpAdaptor(PrintOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PrintOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = PrintOpAdaptor; + template + using GenericAdaptor = PrintOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("U"), ::llvm::StringRef("first_n"), ::llvm::StringRef("message"), ::llvm::StringRef("summarize")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getUAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getUAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getFirstNAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getFirstNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getMessageAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getMessageAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getSummarizeAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getSummarizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Print"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::Operation::operand_range getData(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::MutableOperandRange getDataMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::StringAttr getMessageAttr(); + ::llvm::StringRef getMessage(); + ::mlir::IntegerAttr getFirstNAttr(); + uint64_t getFirstN(); + ::mlir::IntegerAttr getSummarizeAttr(); + uint64_t getSummarize(); + ::mlir::Type getT(); + mlir::OperandElementTypeRange getU(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setMessageAttr(::mlir::StringAttr attr); + void setMessage(::std::optional<::llvm::StringRef> attrValue); + void setFirstNAttr(::mlir::IntegerAttr attr); + void setFirstN(::std::optional attrValue); + void setSummarizeAttr(::mlir::IntegerAttr attr); + void setSummarize(::std::optional attrValue); + ::mlir::Attribute removeMessageAttr(); + ::mlir::Attribute removeFirstNAttr(); + ::mlir::Attribute removeSummarizeAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::ValueRange data, /*optional*/::mlir::StringAttr message, /*optional*/::mlir::IntegerAttr first_n, /*optional*/::mlir::IntegerAttr summarize); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::ValueRange data, /*optional*/::mlir::StringAttr message, /*optional*/::mlir::IntegerAttr first_n, /*optional*/::mlir::IntegerAttr summarize); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::ValueRange data, /*optional*/::llvm::StringRef message = "", /*optional*/uint64_t first_n = -1, /*optional*/uint64_t summarize = 3); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::ValueRange data, /*optional*/::llvm::StringRef message = "", /*optional*/uint64_t first_n = -1, /*optional*/uint64_t summarize = 3); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::PrintOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::PrintV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PrintV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + PrintV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + PrintV2OpGenericAdaptorBase(PrintV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getOutputStreamAttr(); + ::llvm::StringRef getOutputStream(); + ::mlir::StringAttr getEndAttr(); + ::llvm::StringRef getEnd(); +}; +} // namespace detail +template +class PrintV2OpGenericAdaptor : public detail::PrintV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PrintV2OpGenericAdaptorBase; +public: + PrintV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PrintV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PrintV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + PrintV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PrintV2OpAdaptor : public PrintV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using PrintV2OpGenericAdaptor::PrintV2OpGenericAdaptor; + PrintV2OpAdaptor(PrintV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PrintV2Op : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = PrintV2OpAdaptor; + template + using GenericAdaptor = PrintV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("end"), ::llvm::StringRef("output_stream")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getEndAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getEndAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutputStreamAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutputStreamAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.PrintV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::StringAttr getOutputStreamAttr(); + ::llvm::StringRef getOutputStream(); + ::mlir::StringAttr getEndAttr(); + ::llvm::StringRef getEnd(); + void setOutputStreamAttr(::mlir::StringAttr attr); + void setOutputStream(::std::optional<::llvm::StringRef> attrValue); + void setEndAttr(::mlir::StringAttr attr); + void setEnd(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeOutputStreamAttr(); + ::mlir::Attribute removeEndAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, /*optional*/::mlir::StringAttr output_stream, /*optional*/::mlir::StringAttr end); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, /*optional*/::mlir::StringAttr output_stream, /*optional*/::mlir::StringAttr end); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, /*optional*/::llvm::StringRef output_stream = "stderr", /*optional*/::llvm::StringRef end = "\n"); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, /*optional*/::llvm::StringRef output_stream = "stderr", /*optional*/::llvm::StringRef end = "\n"); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::PrintV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ProdOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ProdOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ProdOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ProdOpGenericAdaptorBase(ProdOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getKeepDimsAttr(); + bool getKeepDims(); +}; +} // namespace detail +template +class ProdOpGenericAdaptor : public detail::ProdOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ProdOpGenericAdaptorBase; +public: + ProdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ProdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ProdOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ProdOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getReductionIndices() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ProdOpAdaptor : public ProdOpGenericAdaptor<::mlir::ValueRange> { +public: + using ProdOpGenericAdaptor::ProdOpGenericAdaptor; + ProdOpAdaptor(ProdOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ProdOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ProdOpAdaptor; + template + using GenericAdaptor = ProdOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tidx"), ::llvm::StringRef("keep_dims")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTidxAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTidxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getKeepDimsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getKeepDimsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Prod"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getReductionIndices(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getReductionIndicesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getKeepDimsAttr(); + bool getKeepDims(); + ::mlir::Type getT(); + ::mlir::Type getTidx(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setKeepDimsAttr(::mlir::BoolAttr attr); + void setKeepDims(::std::optional attrValue); + ::mlir::Attribute removeKeepDimsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value reduction_indices, /*optional*/::mlir::BoolAttr keep_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value reduction_indices, /*optional*/::mlir::BoolAttr keep_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value reduction_indices, /*optional*/bool keep_dims = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value reduction_indices, /*optional*/bool keep_dims = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ProdOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::QrOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class QrOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + QrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + QrOpGenericAdaptorBase(QrOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getFullMatricesAttr(); + bool getFullMatrices(); +}; +} // namespace detail +template +class QrOpGenericAdaptor : public detail::QrOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::QrOpGenericAdaptorBase; +public: + QrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + QrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : QrOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + QrOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class QrOpAdaptor : public QrOpGenericAdaptor<::mlir::ValueRange> { +public: + using QrOpGenericAdaptor::QrOpGenericAdaptor; + QrOpAdaptor(QrOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class QrOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = QrOpAdaptor; + template + using GenericAdaptor = QrOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("full_matrices")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getFullMatricesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getFullMatricesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Qr"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getQ(); + ::mlir::TypedValue<::mlir::TensorType> getR(); + ::mlir::BoolAttr getFullMatricesAttr(); + bool getFullMatrices(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setFullMatricesAttr(::mlir::BoolAttr attr); + void setFullMatrices(::std::optional attrValue); + ::mlir::Attribute removeFullMatricesAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type q, ::mlir::Type r, ::mlir::Value input, /*optional*/::mlir::BoolAttr full_matrices); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, /*optional*/::mlir::BoolAttr full_matrices); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type q, ::mlir::Type r, ::mlir::Value input, /*optional*/bool full_matrices = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, /*optional*/bool full_matrices = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::QrOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::QuantizeAndDequantizeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class QuantizeAndDequantizeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + QuantizeAndDequantizeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + QuantizeAndDequantizeOpGenericAdaptorBase(QuantizeAndDequantizeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getSignedInputAttr(); + bool getSignedInput(); + ::mlir::IntegerAttr getNumBitsAttr(); + uint64_t getNumBits(); + ::mlir::BoolAttr getRangeGivenAttr(); + bool getRangeGiven(); + ::mlir::FloatAttr getInputMinAttr(); + ::llvm::APFloat getInputMin(); + ::mlir::FloatAttr getInputMaxAttr(); + ::llvm::APFloat getInputMax(); +}; +} // namespace detail +template +class QuantizeAndDequantizeOpGenericAdaptor : public detail::QuantizeAndDequantizeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::QuantizeAndDequantizeOpGenericAdaptorBase; +public: + QuantizeAndDequantizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + QuantizeAndDequantizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : QuantizeAndDequantizeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + QuantizeAndDequantizeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class QuantizeAndDequantizeOpAdaptor : public QuantizeAndDequantizeOpGenericAdaptor<::mlir::ValueRange> { +public: + using QuantizeAndDequantizeOpGenericAdaptor::QuantizeAndDequantizeOpGenericAdaptor; + QuantizeAndDequantizeOpAdaptor(QuantizeAndDequantizeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class QuantizeAndDequantizeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = QuantizeAndDequantizeOpAdaptor; + template + using GenericAdaptor = QuantizeAndDequantizeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("input_max"), ::llvm::StringRef("input_min"), ::llvm::StringRef("num_bits"), ::llvm::StringRef("range_given"), ::llvm::StringRef("signed_input")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getInputMaxAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getInputMaxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getInputMinAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getInputMinAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getNumBitsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getNumBitsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getRangeGivenAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getRangeGivenAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getSignedInputAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getSignedInputAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.QuantizeAndDequantize"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getSignedInputAttr(); + bool getSignedInput(); + ::mlir::IntegerAttr getNumBitsAttr(); + uint64_t getNumBits(); + ::mlir::BoolAttr getRangeGivenAttr(); + bool getRangeGiven(); + ::mlir::FloatAttr getInputMinAttr(); + ::llvm::APFloat getInputMin(); + ::mlir::FloatAttr getInputMaxAttr(); + ::llvm::APFloat getInputMax(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setSignedInputAttr(::mlir::BoolAttr attr); + void setSignedInput(::std::optional attrValue); + void setNumBitsAttr(::mlir::IntegerAttr attr); + void setNumBits(::std::optional attrValue); + void setRangeGivenAttr(::mlir::BoolAttr attr); + void setRangeGiven(::std::optional attrValue); + void setInputMinAttr(::mlir::FloatAttr attr); + void setInputMin(::std::optional<::llvm::APFloat> attrValue); + void setInputMaxAttr(::mlir::FloatAttr attr); + void setInputMax(::std::optional<::llvm::APFloat> attrValue); + ::mlir::Attribute removeSignedInputAttr(); + ::mlir::Attribute removeNumBitsAttr(); + ::mlir::Attribute removeRangeGivenAttr(); + ::mlir::Attribute removeInputMinAttr(); + ::mlir::Attribute removeInputMaxAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, /*optional*/::mlir::BoolAttr signed_input, /*optional*/::mlir::IntegerAttr num_bits, /*optional*/::mlir::BoolAttr range_given, /*optional*/::mlir::FloatAttr input_min, /*optional*/::mlir::FloatAttr input_max); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, /*optional*/::mlir::BoolAttr signed_input, /*optional*/::mlir::IntegerAttr num_bits, /*optional*/::mlir::BoolAttr range_given, /*optional*/::mlir::FloatAttr input_min, /*optional*/::mlir::FloatAttr input_max); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, /*optional*/::mlir::BoolAttr signed_input, /*optional*/::mlir::IntegerAttr num_bits, /*optional*/::mlir::BoolAttr range_given, /*optional*/::mlir::FloatAttr input_min, /*optional*/::mlir::FloatAttr input_max); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, /*optional*/bool signed_input, /*optional*/uint64_t num_bits, /*optional*/bool range_given, /*optional*/::llvm::APFloat input_min, /*optional*/::llvm::APFloat input_max); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, /*optional*/bool signed_input, /*optional*/uint64_t num_bits, /*optional*/bool range_given, /*optional*/::llvm::APFloat input_min, /*optional*/::llvm::APFloat input_max); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, /*optional*/bool signed_input, /*optional*/uint64_t num_bits, /*optional*/bool range_given, /*optional*/::llvm::APFloat input_min, /*optional*/::llvm::APFloat input_max); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::QuantizeAndDequantizeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::QuantizeAndDequantizeV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class QuantizeAndDequantizeV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + QuantizeAndDequantizeV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + QuantizeAndDequantizeV2OpGenericAdaptorBase(QuantizeAndDequantizeV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getSignedInputAttr(); + bool getSignedInput(); + ::mlir::IntegerAttr getNumBitsAttr(); + uint64_t getNumBits(); + ::mlir::BoolAttr getRangeGivenAttr(); + bool getRangeGiven(); + ::mlir::StringAttr getRoundModeAttr(); + ::llvm::StringRef getRoundMode(); + ::mlir::BoolAttr getNarrowRangeAttr(); + bool getNarrowRange(); + ::mlir::IntegerAttr getAxisAttr(); + uint64_t getAxis(); +}; +} // namespace detail +template +class QuantizeAndDequantizeV2OpGenericAdaptor : public detail::QuantizeAndDequantizeV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::QuantizeAndDequantizeV2OpGenericAdaptorBase; +public: + QuantizeAndDequantizeV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + QuantizeAndDequantizeV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : QuantizeAndDequantizeV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + QuantizeAndDequantizeV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getInputMin() { + return (*getODSOperands(1).begin()); + } + + ValueT getInputMax() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class QuantizeAndDequantizeV2OpAdaptor : public QuantizeAndDequantizeV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using QuantizeAndDequantizeV2OpGenericAdaptor::QuantizeAndDequantizeV2OpGenericAdaptor; + QuantizeAndDequantizeV2OpAdaptor(QuantizeAndDequantizeV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class QuantizeAndDequantizeV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = QuantizeAndDequantizeV2OpAdaptor; + template + using GenericAdaptor = QuantizeAndDequantizeV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("axis"), ::llvm::StringRef("narrow_range"), ::llvm::StringRef("num_bits"), ::llvm::StringRef("range_given"), ::llvm::StringRef("round_mode"), ::llvm::StringRef("signed_input")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAxisAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAxisAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getNarrowRangeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getNarrowRangeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getNumBitsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getNumBitsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getRangeGivenAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getRangeGivenAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getRoundModeAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getRoundModeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getSignedInputAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getSignedInputAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.QuantizeAndDequantizeV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getInputMin(); + ::mlir::TypedValue<::mlir::TensorType> getInputMax(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getInputMinMutable(); + ::mlir::OpOperand &getInputMaxMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getSignedInputAttr(); + bool getSignedInput(); + ::mlir::IntegerAttr getNumBitsAttr(); + uint64_t getNumBits(); + ::mlir::BoolAttr getRangeGivenAttr(); + bool getRangeGiven(); + ::mlir::StringAttr getRoundModeAttr(); + ::llvm::StringRef getRoundMode(); + ::mlir::BoolAttr getNarrowRangeAttr(); + bool getNarrowRange(); + ::mlir::IntegerAttr getAxisAttr(); + uint64_t getAxis(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setSignedInputAttr(::mlir::BoolAttr attr); + void setSignedInput(::std::optional attrValue); + void setNumBitsAttr(::mlir::IntegerAttr attr); + void setNumBits(::std::optional attrValue); + void setRangeGivenAttr(::mlir::BoolAttr attr); + void setRangeGiven(::std::optional attrValue); + void setRoundModeAttr(::mlir::StringAttr attr); + void setRoundMode(::std::optional<::llvm::StringRef> attrValue); + void setNarrowRangeAttr(::mlir::BoolAttr attr); + void setNarrowRange(::std::optional attrValue); + void setAxisAttr(::mlir::IntegerAttr attr); + void setAxis(::std::optional attrValue); + ::mlir::Attribute removeSignedInputAttr(); + ::mlir::Attribute removeNumBitsAttr(); + ::mlir::Attribute removeRangeGivenAttr(); + ::mlir::Attribute removeRoundModeAttr(); + ::mlir::Attribute removeNarrowRangeAttr(); + ::mlir::Attribute removeAxisAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value input_min, ::mlir::Value input_max, /*optional*/::mlir::BoolAttr signed_input, /*optional*/::mlir::IntegerAttr num_bits, /*optional*/::mlir::BoolAttr range_given, /*optional*/::mlir::StringAttr round_mode, /*optional*/::mlir::BoolAttr narrow_range, /*optional*/::mlir::IntegerAttr axis); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value input_min, ::mlir::Value input_max, /*optional*/::mlir::BoolAttr signed_input, /*optional*/::mlir::IntegerAttr num_bits, /*optional*/::mlir::BoolAttr range_given, /*optional*/::mlir::StringAttr round_mode, /*optional*/::mlir::BoolAttr narrow_range, /*optional*/::mlir::IntegerAttr axis); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value input_min, ::mlir::Value input_max, /*optional*/bool signed_input = true, /*optional*/uint64_t num_bits = 8, /*optional*/bool range_given = false, /*optional*/::llvm::StringRef round_mode = "HALF_TO_EVEN", /*optional*/bool narrow_range = false, /*optional*/uint64_t axis = -1); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value input_min, ::mlir::Value input_max, /*optional*/bool signed_input = true, /*optional*/uint64_t num_bits = 8, /*optional*/bool range_given = false, /*optional*/::llvm::StringRef round_mode = "HALF_TO_EVEN", /*optional*/bool narrow_range = false, /*optional*/uint64_t axis = -1); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 7 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::QuantizeAndDequantizeV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::QuantizeAndDequantizeV3Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class QuantizeAndDequantizeV3OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + QuantizeAndDequantizeV3OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + QuantizeAndDequantizeV3OpGenericAdaptorBase(QuantizeAndDequantizeV3Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getSignedInputAttr(); + bool getSignedInput(); + ::mlir::BoolAttr getRangeGivenAttr(); + bool getRangeGiven(); + ::mlir::BoolAttr getNarrowRangeAttr(); + bool getNarrowRange(); + ::mlir::IntegerAttr getAxisAttr(); + uint64_t getAxis(); +}; +} // namespace detail +template +class QuantizeAndDequantizeV3OpGenericAdaptor : public detail::QuantizeAndDequantizeV3OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::QuantizeAndDequantizeV3OpGenericAdaptorBase; +public: + QuantizeAndDequantizeV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + QuantizeAndDequantizeV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : QuantizeAndDequantizeV3OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + QuantizeAndDequantizeV3OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getInputMin() { + return (*getODSOperands(1).begin()); + } + + ValueT getInputMax() { + return (*getODSOperands(2).begin()); + } + + ValueT getNumBits() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class QuantizeAndDequantizeV3OpAdaptor : public QuantizeAndDequantizeV3OpGenericAdaptor<::mlir::ValueRange> { +public: + using QuantizeAndDequantizeV3OpGenericAdaptor::QuantizeAndDequantizeV3OpGenericAdaptor; + QuantizeAndDequantizeV3OpAdaptor(QuantizeAndDequantizeV3Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class QuantizeAndDequantizeV3Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = QuantizeAndDequantizeV3OpAdaptor; + template + using GenericAdaptor = QuantizeAndDequantizeV3OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("axis"), ::llvm::StringRef("narrow_range"), ::llvm::StringRef("range_given"), ::llvm::StringRef("signed_input")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAxisAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAxisAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getNarrowRangeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getNarrowRangeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getRangeGivenAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getRangeGivenAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getSignedInputAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getSignedInputAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.QuantizeAndDequantizeV3"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getInputMin(); + ::mlir::TypedValue<::mlir::TensorType> getInputMax(); + ::mlir::TypedValue<::mlir::TensorType> getNumBits(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getInputMinMutable(); + ::mlir::OpOperand &getInputMaxMutable(); + ::mlir::OpOperand &getNumBitsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getSignedInputAttr(); + bool getSignedInput(); + ::mlir::BoolAttr getRangeGivenAttr(); + bool getRangeGiven(); + ::mlir::BoolAttr getNarrowRangeAttr(); + bool getNarrowRange(); + ::mlir::IntegerAttr getAxisAttr(); + uint64_t getAxis(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setSignedInputAttr(::mlir::BoolAttr attr); + void setSignedInput(::std::optional attrValue); + void setRangeGivenAttr(::mlir::BoolAttr attr); + void setRangeGiven(::std::optional attrValue); + void setNarrowRangeAttr(::mlir::BoolAttr attr); + void setNarrowRange(::std::optional attrValue); + void setAxisAttr(::mlir::IntegerAttr attr); + void setAxis(::std::optional attrValue); + ::mlir::Attribute removeSignedInputAttr(); + ::mlir::Attribute removeRangeGivenAttr(); + ::mlir::Attribute removeNarrowRangeAttr(); + ::mlir::Attribute removeAxisAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value input_min, ::mlir::Value input_max, ::mlir::Value num_bits, /*optional*/::mlir::BoolAttr signed_input, /*optional*/::mlir::BoolAttr range_given, /*optional*/::mlir::BoolAttr narrow_range, /*optional*/::mlir::IntegerAttr axis); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value input_min, ::mlir::Value input_max, ::mlir::Value num_bits, /*optional*/::mlir::BoolAttr signed_input, /*optional*/::mlir::BoolAttr range_given, /*optional*/::mlir::BoolAttr narrow_range, /*optional*/::mlir::IntegerAttr axis); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value input_min, ::mlir::Value input_max, ::mlir::Value num_bits, /*optional*/bool signed_input = true, /*optional*/bool range_given = true, /*optional*/bool narrow_range = false, /*optional*/uint64_t axis = -1); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value input_min, ::mlir::Value input_max, ::mlir::Value num_bits, /*optional*/bool signed_input = true, /*optional*/bool range_given = true, /*optional*/bool narrow_range = false, /*optional*/uint64_t axis = -1); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::QuantizeAndDequantizeV3Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::QuantizeAndDequantizeV4Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class QuantizeAndDequantizeV4OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + QuantizeAndDequantizeV4OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + QuantizeAndDequantizeV4OpGenericAdaptorBase(QuantizeAndDequantizeV4Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getSignedInputAttr(); + bool getSignedInput(); + ::mlir::IntegerAttr getNumBitsAttr(); + uint64_t getNumBits(); + ::mlir::BoolAttr getRangeGivenAttr(); + bool getRangeGiven(); + ::mlir::StringAttr getRoundModeAttr(); + ::llvm::StringRef getRoundMode(); + ::mlir::BoolAttr getNarrowRangeAttr(); + bool getNarrowRange(); + ::mlir::IntegerAttr getAxisAttr(); + uint64_t getAxis(); +}; +} // namespace detail +template +class QuantizeAndDequantizeV4OpGenericAdaptor : public detail::QuantizeAndDequantizeV4OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::QuantizeAndDequantizeV4OpGenericAdaptorBase; +public: + QuantizeAndDequantizeV4OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + QuantizeAndDequantizeV4OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : QuantizeAndDequantizeV4OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + QuantizeAndDequantizeV4OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getInputMin() { + return (*getODSOperands(1).begin()); + } + + ValueT getInputMax() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class QuantizeAndDequantizeV4OpAdaptor : public QuantizeAndDequantizeV4OpGenericAdaptor<::mlir::ValueRange> { +public: + using QuantizeAndDequantizeV4OpGenericAdaptor::QuantizeAndDequantizeV4OpGenericAdaptor; + QuantizeAndDequantizeV4OpAdaptor(QuantizeAndDequantizeV4Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class QuantizeAndDequantizeV4Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = QuantizeAndDequantizeV4OpAdaptor; + template + using GenericAdaptor = QuantizeAndDequantizeV4OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("axis"), ::llvm::StringRef("narrow_range"), ::llvm::StringRef("num_bits"), ::llvm::StringRef("range_given"), ::llvm::StringRef("round_mode"), ::llvm::StringRef("signed_input")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAxisAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAxisAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getNarrowRangeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getNarrowRangeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getNumBitsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getNumBitsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getRangeGivenAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getRangeGivenAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getRoundModeAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getRoundModeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getSignedInputAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getSignedInputAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.QuantizeAndDequantizeV4"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getInputMin(); + ::mlir::TypedValue<::mlir::TensorType> getInputMax(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getInputMinMutable(); + ::mlir::OpOperand &getInputMaxMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getSignedInputAttr(); + bool getSignedInput(); + ::mlir::IntegerAttr getNumBitsAttr(); + uint64_t getNumBits(); + ::mlir::BoolAttr getRangeGivenAttr(); + bool getRangeGiven(); + ::mlir::StringAttr getRoundModeAttr(); + ::llvm::StringRef getRoundMode(); + ::mlir::BoolAttr getNarrowRangeAttr(); + bool getNarrowRange(); + ::mlir::IntegerAttr getAxisAttr(); + uint64_t getAxis(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setSignedInputAttr(::mlir::BoolAttr attr); + void setSignedInput(::std::optional attrValue); + void setNumBitsAttr(::mlir::IntegerAttr attr); + void setNumBits(::std::optional attrValue); + void setRangeGivenAttr(::mlir::BoolAttr attr); + void setRangeGiven(::std::optional attrValue); + void setRoundModeAttr(::mlir::StringAttr attr); + void setRoundMode(::std::optional<::llvm::StringRef> attrValue); + void setNarrowRangeAttr(::mlir::BoolAttr attr); + void setNarrowRange(::std::optional attrValue); + void setAxisAttr(::mlir::IntegerAttr attr); + void setAxis(::std::optional attrValue); + ::mlir::Attribute removeSignedInputAttr(); + ::mlir::Attribute removeNumBitsAttr(); + ::mlir::Attribute removeRangeGivenAttr(); + ::mlir::Attribute removeRoundModeAttr(); + ::mlir::Attribute removeNarrowRangeAttr(); + ::mlir::Attribute removeAxisAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value input_min, ::mlir::Value input_max, /*optional*/::mlir::BoolAttr signed_input, /*optional*/::mlir::IntegerAttr num_bits, /*optional*/::mlir::BoolAttr range_given, /*optional*/::mlir::StringAttr round_mode, /*optional*/::mlir::BoolAttr narrow_range, /*optional*/::mlir::IntegerAttr axis); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value input_min, ::mlir::Value input_max, /*optional*/::mlir::BoolAttr signed_input, /*optional*/::mlir::IntegerAttr num_bits, /*optional*/::mlir::BoolAttr range_given, /*optional*/::mlir::StringAttr round_mode, /*optional*/::mlir::BoolAttr narrow_range, /*optional*/::mlir::IntegerAttr axis); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value input_min, ::mlir::Value input_max, /*optional*/bool signed_input = true, /*optional*/uint64_t num_bits = 8, /*optional*/bool range_given = false, /*optional*/::llvm::StringRef round_mode = "HALF_TO_EVEN", /*optional*/bool narrow_range = false, /*optional*/uint64_t axis = -1); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value input_min, ::mlir::Value input_max, /*optional*/bool signed_input = true, /*optional*/uint64_t num_bits = 8, /*optional*/bool range_given = false, /*optional*/::llvm::StringRef round_mode = "HALF_TO_EVEN", /*optional*/bool narrow_range = false, /*optional*/uint64_t axis = -1); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 7 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::QuantizeAndDequantizeV4Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::QuantizeV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class QuantizeV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + QuantizeV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + QuantizeV2OpGenericAdaptorBase(QuantizeV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getModeAttr(); + ::llvm::StringRef getMode(); + ::mlir::StringAttr getRoundModeAttr(); + ::llvm::StringRef getRoundMode(); + ::mlir::BoolAttr getNarrowRangeAttr(); + bool getNarrowRange(); + ::mlir::IntegerAttr getAxisAttr(); + uint64_t getAxis(); + ::mlir::FloatAttr getEnsureMinimumRangeAttr(); + ::llvm::APFloat getEnsureMinimumRange(); +}; +} // namespace detail +template +class QuantizeV2OpGenericAdaptor : public detail::QuantizeV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::QuantizeV2OpGenericAdaptorBase; +public: + QuantizeV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + QuantizeV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : QuantizeV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + QuantizeV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getMinRange() { + return (*getODSOperands(1).begin()); + } + + ValueT getMaxRange() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class QuantizeV2OpAdaptor : public QuantizeV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using QuantizeV2OpGenericAdaptor::QuantizeV2OpGenericAdaptor; + QuantizeV2OpAdaptor(QuantizeV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class QuantizeV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = QuantizeV2OpAdaptor; + template + using GenericAdaptor = QuantizeV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("axis"), ::llvm::StringRef("ensure_minimum_range"), ::llvm::StringRef("mode"), ::llvm::StringRef("narrow_range"), ::llvm::StringRef("round_mode")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAxisAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAxisAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getEnsureMinimumRangeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getEnsureMinimumRangeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getModeAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getModeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getNarrowRangeAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getNarrowRangeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getRoundModeAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getRoundModeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.QuantizeV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getMinRange(); + ::mlir::TypedValue<::mlir::TensorType> getMaxRange(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getMinRangeMutable(); + ::mlir::OpOperand &getMaxRangeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::TypedValue<::mlir::TensorType> getOutputMin(); + ::mlir::TypedValue<::mlir::TensorType> getOutputMax(); + ::mlir::StringAttr getModeAttr(); + ::llvm::StringRef getMode(); + ::mlir::StringAttr getRoundModeAttr(); + ::llvm::StringRef getRoundMode(); + ::mlir::BoolAttr getNarrowRangeAttr(); + bool getNarrowRange(); + ::mlir::IntegerAttr getAxisAttr(); + uint64_t getAxis(); + ::mlir::FloatAttr getEnsureMinimumRangeAttr(); + ::llvm::APFloat getEnsureMinimumRange(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setModeAttr(::mlir::StringAttr attr); + void setMode(::std::optional<::llvm::StringRef> attrValue); + void setRoundModeAttr(::mlir::StringAttr attr); + void setRoundMode(::std::optional<::llvm::StringRef> attrValue); + void setNarrowRangeAttr(::mlir::BoolAttr attr); + void setNarrowRange(::std::optional attrValue); + void setAxisAttr(::mlir::IntegerAttr attr); + void setAxis(::std::optional attrValue); + void setEnsureMinimumRangeAttr(::mlir::FloatAttr attr); + void setEnsureMinimumRange(::std::optional<::llvm::APFloat> attrValue); + ::mlir::Attribute removeModeAttr(); + ::mlir::Attribute removeRoundModeAttr(); + ::mlir::Attribute removeNarrowRangeAttr(); + ::mlir::Attribute removeAxisAttr(); + ::mlir::Attribute removeEnsureMinimumRangeAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Type output_min, ::mlir::Type output_max, ::mlir::Value input, ::mlir::Value min_range, ::mlir::Value max_range, /*optional*/::mlir::StringAttr mode, /*optional*/::mlir::StringAttr round_mode, /*optional*/::mlir::BoolAttr narrow_range, /*optional*/::mlir::IntegerAttr axis, /*optional*/::mlir::FloatAttr ensure_minimum_range); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value min_range, ::mlir::Value max_range, /*optional*/::mlir::StringAttr mode, /*optional*/::mlir::StringAttr round_mode, /*optional*/::mlir::BoolAttr narrow_range, /*optional*/::mlir::IntegerAttr axis, /*optional*/::mlir::FloatAttr ensure_minimum_range); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Type output_min, ::mlir::Type output_max, ::mlir::Value input, ::mlir::Value min_range, ::mlir::Value max_range, /*optional*/::llvm::StringRef mode, /*optional*/::llvm::StringRef round_mode, /*optional*/bool narrow_range, /*optional*/uint64_t axis, /*optional*/::llvm::APFloat ensure_minimum_range); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value min_range, ::mlir::Value max_range, /*optional*/::llvm::StringRef mode, /*optional*/::llvm::StringRef round_mode, /*optional*/bool narrow_range, /*optional*/uint64_t axis, /*optional*/::llvm::APFloat ensure_minimum_range); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::QuantizeV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::QueueDequeueV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class QueueDequeueV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + QueueDequeueV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + QueueDequeueV2OpGenericAdaptorBase(QueueDequeueV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTimeoutMsAttr(); + uint64_t getTimeoutMs(); +}; +} // namespace detail +template +class QueueDequeueV2OpGenericAdaptor : public detail::QueueDequeueV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::QueueDequeueV2OpGenericAdaptorBase; +public: + QueueDequeueV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + QueueDequeueV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : QueueDequeueV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + QueueDequeueV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getHandle() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class QueueDequeueV2OpAdaptor : public QueueDequeueV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using QueueDequeueV2OpGenericAdaptor::QueueDequeueV2OpGenericAdaptor; + QueueDequeueV2OpAdaptor(QueueDequeueV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class QueueDequeueV2Op : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = QueueDequeueV2OpAdaptor; + template + using GenericAdaptor = QueueDequeueV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("component_types"), ::llvm::StringRef("timeout_ms")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getComponentTypesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getComponentTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTimeoutMsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTimeoutMsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.QueueDequeueV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::OpOperand &getHandleMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getComponents(); + ::mlir::IntegerAttr getTimeoutMsAttr(); + uint64_t getTimeoutMs(); + mlir::ResultElementTypeRange getComponentTypes(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setTimeoutMsAttr(::mlir::IntegerAttr attr); + void setTimeoutMs(::std::optional attrValue); + ::mlir::Attribute removeTimeoutMsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange components, ::mlir::Value handle, /*optional*/::mlir::IntegerAttr timeout_ms); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange components, ::mlir::Value handle, /*optional*/uint64_t timeout_ms = -1); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::QueueDequeueV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RFFT2DOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RFFT2DOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RFFT2DOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RFFT2DOpGenericAdaptorBase(RFFT2DOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RFFT2DOpGenericAdaptor : public detail::RFFT2DOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RFFT2DOpGenericAdaptorBase; +public: + RFFT2DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RFFT2DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RFFT2DOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RFFT2DOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getFftLength() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RFFT2DOpAdaptor : public RFFT2DOpGenericAdaptor<::mlir::ValueRange> { +public: + using RFFT2DOpGenericAdaptor::RFFT2DOpGenericAdaptor; + RFFT2DOpAdaptor(RFFT2DOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RFFT2DOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RFFT2DOpAdaptor; + template + using GenericAdaptor = RFFT2DOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tcomplex"), ::llvm::StringRef("Treal")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTcomplexAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTcomplexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTrealAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTrealAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RFFT2D"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getFftLength(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getFftLengthMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getTreal(); + ::mlir::Type getTcomplex(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value fft_length); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value fft_length); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RFFT2DOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RFFT3DOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RFFT3DOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RFFT3DOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RFFT3DOpGenericAdaptorBase(RFFT3DOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RFFT3DOpGenericAdaptor : public detail::RFFT3DOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RFFT3DOpGenericAdaptorBase; +public: + RFFT3DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RFFT3DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RFFT3DOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RFFT3DOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getFftLength() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RFFT3DOpAdaptor : public RFFT3DOpGenericAdaptor<::mlir::ValueRange> { +public: + using RFFT3DOpGenericAdaptor::RFFT3DOpGenericAdaptor; + RFFT3DOpAdaptor(RFFT3DOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RFFT3DOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RFFT3DOpAdaptor; + template + using GenericAdaptor = RFFT3DOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tcomplex"), ::llvm::StringRef("Treal")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTcomplexAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTcomplexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTrealAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTrealAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RFFT3D"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getFftLength(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getFftLengthMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getTreal(); + ::mlir::Type getTcomplex(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value fft_length); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value fft_length); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RFFT3DOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RFFTOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RFFTOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RFFTOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RFFTOpGenericAdaptorBase(RFFTOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RFFTOpGenericAdaptor : public detail::RFFTOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RFFTOpGenericAdaptorBase; +public: + RFFTOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RFFTOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RFFTOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RFFTOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getFftLength() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RFFTOpAdaptor : public RFFTOpGenericAdaptor<::mlir::ValueRange> { +public: + using RFFTOpGenericAdaptor::RFFTOpGenericAdaptor; + RFFTOpAdaptor(RFFTOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RFFTOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RFFTOpAdaptor; + template + using GenericAdaptor = RFFTOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tcomplex"), ::llvm::StringRef("Treal")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTcomplexAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTcomplexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTrealAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTrealAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RFFT"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getFftLength(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getFftLengthMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getTreal(); + ::mlir::Type getTcomplex(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value fft_length); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value fft_length); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RFFTOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RGBToHSVOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RGBToHSVOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RGBToHSVOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RGBToHSVOpGenericAdaptorBase(RGBToHSVOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RGBToHSVOpGenericAdaptor : public detail::RGBToHSVOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RGBToHSVOpGenericAdaptorBase; +public: + RGBToHSVOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RGBToHSVOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RGBToHSVOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RGBToHSVOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getImages() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RGBToHSVOpAdaptor : public RGBToHSVOpGenericAdaptor<::mlir::ValueRange> { +public: + using RGBToHSVOpGenericAdaptor::RGBToHSVOpGenericAdaptor; + RGBToHSVOpAdaptor(RGBToHSVOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RGBToHSVOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RGBToHSVOpAdaptor; + template + using GenericAdaptor = RGBToHSVOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RGBToHSV"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getImages(); + ::mlir::OpOperand &getImagesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value images); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value images); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RGBToHSVOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RaggedGatherOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RaggedGatherOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RaggedGatherOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RaggedGatherOpGenericAdaptorBase(RaggedGatherOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RaggedGatherOpGenericAdaptor : public detail::RaggedGatherOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RaggedGatherOpGenericAdaptorBase; +public: + RaggedGatherOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RaggedGatherOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RaggedGatherOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RaggedGatherOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getParamsNestedSplits() { + return getODSOperands(0); + } + + ValueT getParamsDenseValues() { + return (*getODSOperands(1).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RaggedGatherOpAdaptor : public RaggedGatherOpGenericAdaptor<::mlir::ValueRange> { +public: + using RaggedGatherOpGenericAdaptor::RaggedGatherOpGenericAdaptor; + RaggedGatherOpAdaptor(RaggedGatherOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RaggedGatherOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RaggedGatherOpAdaptor; + template + using GenericAdaptor = RaggedGatherOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("OUTPUT_RAGGED_RANK"), ::llvm::StringRef("PARAMS_RAGGED_RANK"), ::llvm::StringRef("Tindices"), ::llvm::StringRef("Tsplits"), ::llvm::StringRef("Tvalues")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOUTPUT_RAGGED_RANKAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getOUTPUT_RAGGED_RANKAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getPARAMS_RAGGED_RANKAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getPARAMS_RAGGED_RANKAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTsplitsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTsplitsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTvaluesAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTvaluesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RaggedGather"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getParamsNestedSplits(); + ::mlir::TypedValue<::mlir::TensorType> getParamsDenseValues(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::MutableOperandRange getParamsNestedSplitsMutable(); + ::mlir::OpOperand &getParamsDenseValuesMutable(); + ::mlir::OpOperand &getIndicesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutputNestedSplits(); + ::mlir::TypedValue<::mlir::TensorType> getOutputDenseValues(); + size_t getPARAMS_RAGGED_RANK(); + ::mlir::Type getTindices(); + ::mlir::Type getTsplits(); + ::mlir::Type getTvalues(); + size_t getOUTPUT_RAGGED_RANK(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output_nested_splits, ::mlir::Type output_dense_values, ::mlir::ValueRange params_nested_splits, ::mlir::Value params_dense_values, ::mlir::Value indices); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange params_nested_splits, ::mlir::Value params_dense_values, ::mlir::Value indices); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RaggedGatherOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RaggedRangeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RaggedRangeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RaggedRangeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RaggedRangeOpGenericAdaptorBase(RaggedRangeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RaggedRangeOpGenericAdaptor : public detail::RaggedRangeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RaggedRangeOpGenericAdaptorBase; +public: + RaggedRangeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RaggedRangeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RaggedRangeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RaggedRangeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getStarts() { + return (*getODSOperands(0).begin()); + } + + ValueT getLimits() { + return (*getODSOperands(1).begin()); + } + + ValueT getDeltas() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RaggedRangeOpAdaptor : public RaggedRangeOpGenericAdaptor<::mlir::ValueRange> { +public: + using RaggedRangeOpGenericAdaptor::RaggedRangeOpGenericAdaptor; + RaggedRangeOpAdaptor(RaggedRangeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RaggedRangeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RaggedRangeOpAdaptor; + template + using GenericAdaptor = RaggedRangeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tsplits")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTsplitsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTsplitsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RaggedRange"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getStarts(); + ::mlir::TypedValue<::mlir::TensorType> getLimits(); + ::mlir::TypedValue<::mlir::TensorType> getDeltas(); + ::mlir::OpOperand &getStartsMutable(); + ::mlir::OpOperand &getLimitsMutable(); + ::mlir::OpOperand &getDeltasMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getRtNestedSplits(); + ::mlir::TypedValue<::mlir::TensorType> getRtDenseValues(); + ::mlir::Type getT(); + ::mlir::Type getTsplits(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type rt_nested_splits, ::mlir::Type rt_dense_values, ::mlir::Value starts, ::mlir::Value limits, ::mlir::Value deltas); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value starts, ::mlir::Value limits, ::mlir::Value deltas); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RaggedRangeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RandomGammaGradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RandomGammaGradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RandomGammaGradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RandomGammaGradOpGenericAdaptorBase(RandomGammaGradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RandomGammaGradOpGenericAdaptor : public detail::RandomGammaGradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RandomGammaGradOpGenericAdaptorBase; +public: + RandomGammaGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RandomGammaGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RandomGammaGradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RandomGammaGradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getAlpha() { + return (*getODSOperands(0).begin()); + } + + ValueT getSample() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RandomGammaGradOpAdaptor : public RandomGammaGradOpGenericAdaptor<::mlir::ValueRange> { +public: + using RandomGammaGradOpGenericAdaptor::RandomGammaGradOpGenericAdaptor; + RandomGammaGradOpAdaptor(RandomGammaGradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RandomGammaGradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RandomGammaGradOpAdaptor; + template + using GenericAdaptor = RandomGammaGradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RandomGammaGrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getAlpha(); + ::mlir::TypedValue<::mlir::TensorType> getSample(); + ::mlir::OpOperand &getAlphaMutable(); + ::mlir::OpOperand &getSampleMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value alpha, ::mlir::Value sample); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value alpha, ::mlir::Value sample); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RandomGammaGradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RandomGammaOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RandomGammaOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RandomGammaOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RandomGammaOpGenericAdaptorBase(RandomGammaOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getSeedAttr(); + uint64_t getSeed(); + ::mlir::IntegerAttr getSeed2Attr(); + uint64_t getSeed2(); +}; +} // namespace detail +template +class RandomGammaOpGenericAdaptor : public detail::RandomGammaOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RandomGammaOpGenericAdaptorBase; +public: + RandomGammaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RandomGammaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RandomGammaOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RandomGammaOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getShape() { + return (*getODSOperands(0).begin()); + } + + ValueT getAlpha() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RandomGammaOpAdaptor : public RandomGammaOpGenericAdaptor<::mlir::ValueRange> { +public: + using RandomGammaOpGenericAdaptor::RandomGammaOpGenericAdaptor; + RandomGammaOpAdaptor(RandomGammaOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RandomGammaOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::TF::CannotDuplicate, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RandomGammaOpAdaptor; + template + using GenericAdaptor = RandomGammaOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("S"), ::llvm::StringRef("T"), ::llvm::StringRef("seed"), ::llvm::StringRef("seed2")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getSAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getSAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getSeedAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getSeedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSeed2AttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSeed2AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RandomGamma"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::TypedValue<::mlir::TensorType> getAlpha(); + ::mlir::OpOperand &getShapeMutable(); + ::mlir::OpOperand &getAlphaMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getSeedAttr(); + uint64_t getSeed(); + ::mlir::IntegerAttr getSeed2Attr(); + uint64_t getSeed2(); + ::mlir::Type getS(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setSeedAttr(::mlir::IntegerAttr attr); + void setSeed(::std::optional attrValue); + void setSeed2Attr(::mlir::IntegerAttr attr); + void setSeed2(::std::optional attrValue); + ::mlir::Attribute removeSeedAttr(); + ::mlir::Attribute removeSeed2Attr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, ::mlir::Value alpha, /*optional*/::mlir::IntegerAttr seed, /*optional*/::mlir::IntegerAttr seed2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, ::mlir::Value alpha, /*optional*/::mlir::IntegerAttr seed, /*optional*/::mlir::IntegerAttr seed2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, ::mlir::Value alpha, /*optional*/uint64_t seed = 0, /*optional*/uint64_t seed2 = 0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, ::mlir::Value alpha, /*optional*/uint64_t seed = 0, /*optional*/uint64_t seed2 = 0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RandomGammaOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RandomPoissonOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RandomPoissonOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RandomPoissonOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RandomPoissonOpGenericAdaptorBase(RandomPoissonOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getSeedAttr(); + uint64_t getSeed(); + ::mlir::IntegerAttr getSeed2Attr(); + uint64_t getSeed2(); +}; +} // namespace detail +template +class RandomPoissonOpGenericAdaptor : public detail::RandomPoissonOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RandomPoissonOpGenericAdaptorBase; +public: + RandomPoissonOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RandomPoissonOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RandomPoissonOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RandomPoissonOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getShape() { + return (*getODSOperands(0).begin()); + } + + ValueT getRate() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RandomPoissonOpAdaptor : public RandomPoissonOpGenericAdaptor<::mlir::ValueRange> { +public: + using RandomPoissonOpGenericAdaptor::RandomPoissonOpGenericAdaptor; + RandomPoissonOpAdaptor(RandomPoissonOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RandomPoissonOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::TF::CannotDuplicate, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RandomPoissonOpAdaptor; + template + using GenericAdaptor = RandomPoissonOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("S"), ::llvm::StringRef("dtype"), ::llvm::StringRef("seed"), ::llvm::StringRef("seed2")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getSAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getSAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getSeedAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getSeedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSeed2AttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSeed2AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RandomPoisson"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::TypedValue<::mlir::TensorType> getRate(); + ::mlir::OpOperand &getShapeMutable(); + ::mlir::OpOperand &getRateMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getSeedAttr(); + uint64_t getSeed(); + ::mlir::IntegerAttr getSeed2Attr(); + uint64_t getSeed2(); + ::mlir::Type getS(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setSeedAttr(::mlir::IntegerAttr attr); + void setSeed(::std::optional attrValue); + void setSeed2Attr(::mlir::IntegerAttr attr); + void setSeed2(::std::optional attrValue); + ::mlir::Attribute removeSeedAttr(); + ::mlir::Attribute removeSeed2Attr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, ::mlir::Value rate, /*optional*/::mlir::IntegerAttr seed, /*optional*/::mlir::IntegerAttr seed2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, ::mlir::Value rate, /*optional*/::mlir::IntegerAttr seed, /*optional*/::mlir::IntegerAttr seed2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, ::mlir::Value rate, /*optional*/uint64_t seed = 0, /*optional*/uint64_t seed2 = 0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, ::mlir::Value rate, /*optional*/uint64_t seed = 0, /*optional*/uint64_t seed2 = 0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RandomPoissonOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RandomPoissonV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RandomPoissonV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RandomPoissonV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RandomPoissonV2OpGenericAdaptorBase(RandomPoissonV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getSeedAttr(); + uint64_t getSeed(); + ::mlir::IntegerAttr getSeed2Attr(); + uint64_t getSeed2(); +}; +} // namespace detail +template +class RandomPoissonV2OpGenericAdaptor : public detail::RandomPoissonV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RandomPoissonV2OpGenericAdaptorBase; +public: + RandomPoissonV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RandomPoissonV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RandomPoissonV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RandomPoissonV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getShape() { + return (*getODSOperands(0).begin()); + } + + ValueT getRate() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RandomPoissonV2OpAdaptor : public RandomPoissonV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using RandomPoissonV2OpGenericAdaptor::RandomPoissonV2OpGenericAdaptor; + RandomPoissonV2OpAdaptor(RandomPoissonV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RandomPoissonV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::TF::CannotDuplicate, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RandomPoissonV2OpAdaptor; + template + using GenericAdaptor = RandomPoissonV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("R"), ::llvm::StringRef("S"), ::llvm::StringRef("dtype"), ::llvm::StringRef("seed"), ::llvm::StringRef("seed2")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getRAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getRAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getSAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getSAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSeedAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSeedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getSeed2AttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getSeed2AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RandomPoissonV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::TypedValue<::mlir::TensorType> getRate(); + ::mlir::OpOperand &getShapeMutable(); + ::mlir::OpOperand &getRateMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getSeedAttr(); + uint64_t getSeed(); + ::mlir::IntegerAttr getSeed2Attr(); + uint64_t getSeed2(); + ::mlir::Type getR(); + ::mlir::Type getS(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setSeedAttr(::mlir::IntegerAttr attr); + void setSeed(::std::optional attrValue); + void setSeed2Attr(::mlir::IntegerAttr attr); + void setSeed2(::std::optional attrValue); + ::mlir::Attribute removeSeedAttr(); + ::mlir::Attribute removeSeed2Attr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, ::mlir::Value rate, /*optional*/::mlir::IntegerAttr seed, /*optional*/::mlir::IntegerAttr seed2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, ::mlir::Value rate, /*optional*/::mlir::IntegerAttr seed, /*optional*/::mlir::IntegerAttr seed2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, ::mlir::Value rate, /*optional*/uint64_t seed = 0, /*optional*/uint64_t seed2 = 0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, ::mlir::Value rate, /*optional*/uint64_t seed = 0, /*optional*/uint64_t seed2 = 0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RandomPoissonV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RandomShuffleOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RandomShuffleOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RandomShuffleOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RandomShuffleOpGenericAdaptorBase(RandomShuffleOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getSeedAttr(); + uint64_t getSeed(); + ::mlir::IntegerAttr getSeed2Attr(); + uint64_t getSeed2(); +}; +} // namespace detail +template +class RandomShuffleOpGenericAdaptor : public detail::RandomShuffleOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RandomShuffleOpGenericAdaptorBase; +public: + RandomShuffleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RandomShuffleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RandomShuffleOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RandomShuffleOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getValue() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RandomShuffleOpAdaptor : public RandomShuffleOpGenericAdaptor<::mlir::ValueRange> { +public: + using RandomShuffleOpGenericAdaptor::RandomShuffleOpGenericAdaptor; + RandomShuffleOpAdaptor(RandomShuffleOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RandomShuffleOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::TF::CannotDuplicate, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RandomShuffleOpAdaptor; + template + using GenericAdaptor = RandomShuffleOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("seed"), ::llvm::StringRef("seed2")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getSeedAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getSeedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getSeed2AttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getSeed2AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RandomShuffle"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getValue(); + ::mlir::OpOperand &getValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getSeedAttr(); + uint64_t getSeed(); + ::mlir::IntegerAttr getSeed2Attr(); + uint64_t getSeed2(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setSeedAttr(::mlir::IntegerAttr attr); + void setSeed(::std::optional attrValue); + void setSeed2Attr(::mlir::IntegerAttr attr); + void setSeed2(::std::optional attrValue); + ::mlir::Attribute removeSeedAttr(); + ::mlir::Attribute removeSeed2Attr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value value, /*optional*/::mlir::IntegerAttr seed, /*optional*/::mlir::IntegerAttr seed2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, /*optional*/::mlir::IntegerAttr seed, /*optional*/::mlir::IntegerAttr seed2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, /*optional*/::mlir::IntegerAttr seed, /*optional*/::mlir::IntegerAttr seed2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value value, /*optional*/uint64_t seed = 0, /*optional*/uint64_t seed2 = 0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, /*optional*/uint64_t seed = 0, /*optional*/uint64_t seed2 = 0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, /*optional*/uint64_t seed = 0, /*optional*/uint64_t seed2 = 0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RandomShuffleOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RandomStandardNormalOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RandomStandardNormalOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RandomStandardNormalOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RandomStandardNormalOpGenericAdaptorBase(RandomStandardNormalOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getSeedAttr(); + uint64_t getSeed(); + ::mlir::IntegerAttr getSeed2Attr(); + uint64_t getSeed2(); +}; +} // namespace detail +template +class RandomStandardNormalOpGenericAdaptor : public detail::RandomStandardNormalOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RandomStandardNormalOpGenericAdaptorBase; +public: + RandomStandardNormalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RandomStandardNormalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RandomStandardNormalOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RandomStandardNormalOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getShape() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RandomStandardNormalOpAdaptor : public RandomStandardNormalOpGenericAdaptor<::mlir::ValueRange> { +public: + using RandomStandardNormalOpGenericAdaptor::RandomStandardNormalOpGenericAdaptor; + RandomStandardNormalOpAdaptor(RandomStandardNormalOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RandomStandardNormalOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::TF::CannotDuplicate, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RandomStandardNormalOpAdaptor; + template + using GenericAdaptor = RandomStandardNormalOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("dtype"), ::llvm::StringRef("seed"), ::llvm::StringRef("seed2")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getSeedAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getSeedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSeed2AttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSeed2AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RandomStandardNormal"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::OpOperand &getShapeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getSeedAttr(); + uint64_t getSeed(); + ::mlir::IntegerAttr getSeed2Attr(); + uint64_t getSeed2(); + ::mlir::Type getT(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setSeedAttr(::mlir::IntegerAttr attr); + void setSeed(::std::optional attrValue); + void setSeed2Attr(::mlir::IntegerAttr attr); + void setSeed2(::std::optional attrValue); + ::mlir::Attribute removeSeedAttr(); + ::mlir::Attribute removeSeed2Attr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, /*optional*/::mlir::IntegerAttr seed, /*optional*/::mlir::IntegerAttr seed2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, /*optional*/::mlir::IntegerAttr seed, /*optional*/::mlir::IntegerAttr seed2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, /*optional*/uint64_t seed = 0, /*optional*/uint64_t seed2 = 0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, /*optional*/uint64_t seed = 0, /*optional*/uint64_t seed2 = 0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RandomStandardNormalOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RandomUniformIntOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RandomUniformIntOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RandomUniformIntOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RandomUniformIntOpGenericAdaptorBase(RandomUniformIntOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getSeedAttr(); + uint64_t getSeed(); + ::mlir::IntegerAttr getSeed2Attr(); + uint64_t getSeed2(); +}; +} // namespace detail +template +class RandomUniformIntOpGenericAdaptor : public detail::RandomUniformIntOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RandomUniformIntOpGenericAdaptorBase; +public: + RandomUniformIntOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RandomUniformIntOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RandomUniformIntOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RandomUniformIntOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getShape() { + return (*getODSOperands(0).begin()); + } + + ValueT getMinval() { + return (*getODSOperands(1).begin()); + } + + ValueT getMaxval() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RandomUniformIntOpAdaptor : public RandomUniformIntOpGenericAdaptor<::mlir::ValueRange> { +public: + using RandomUniformIntOpGenericAdaptor::RandomUniformIntOpGenericAdaptor; + RandomUniformIntOpAdaptor(RandomUniformIntOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RandomUniformIntOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::TF::CannotDuplicate, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RandomUniformIntOpAdaptor; + template + using GenericAdaptor = RandomUniformIntOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tout"), ::llvm::StringRef("seed"), ::llvm::StringRef("seed2")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getToutAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getToutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getSeedAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getSeedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSeed2AttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSeed2AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RandomUniformInt"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::TypedValue<::mlir::TensorType> getMinval(); + ::mlir::TypedValue<::mlir::TensorType> getMaxval(); + ::mlir::OpOperand &getShapeMutable(); + ::mlir::OpOperand &getMinvalMutable(); + ::mlir::OpOperand &getMaxvalMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getSeedAttr(); + uint64_t getSeed(); + ::mlir::IntegerAttr getSeed2Attr(); + uint64_t getSeed2(); + ::mlir::Type getT(); + ::mlir::Type getTout(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setSeedAttr(::mlir::IntegerAttr attr); + void setSeed(::std::optional attrValue); + void setSeed2Attr(::mlir::IntegerAttr attr); + void setSeed2(::std::optional attrValue); + ::mlir::Attribute removeSeedAttr(); + ::mlir::Attribute removeSeed2Attr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, ::mlir::Value minval, ::mlir::Value maxval, /*optional*/::mlir::IntegerAttr seed, /*optional*/::mlir::IntegerAttr seed2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, ::mlir::Value minval, ::mlir::Value maxval, /*optional*/::mlir::IntegerAttr seed, /*optional*/::mlir::IntegerAttr seed2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, ::mlir::Value minval, ::mlir::Value maxval, /*optional*/uint64_t seed = 0, /*optional*/uint64_t seed2 = 0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, ::mlir::Value minval, ::mlir::Value maxval, /*optional*/uint64_t seed = 0, /*optional*/uint64_t seed2 = 0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RandomUniformIntOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RandomUniformOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RandomUniformOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RandomUniformOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RandomUniformOpGenericAdaptorBase(RandomUniformOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getSeedAttr(); + uint64_t getSeed(); + ::mlir::IntegerAttr getSeed2Attr(); + uint64_t getSeed2(); +}; +} // namespace detail +template +class RandomUniformOpGenericAdaptor : public detail::RandomUniformOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RandomUniformOpGenericAdaptorBase; +public: + RandomUniformOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RandomUniformOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RandomUniformOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RandomUniformOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getShape() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RandomUniformOpAdaptor : public RandomUniformOpGenericAdaptor<::mlir::ValueRange> { +public: + using RandomUniformOpGenericAdaptor::RandomUniformOpGenericAdaptor; + RandomUniformOpAdaptor(RandomUniformOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RandomUniformOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::TF::CannotDuplicate, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RandomUniformOpAdaptor; + template + using GenericAdaptor = RandomUniformOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("dtype"), ::llvm::StringRef("seed"), ::llvm::StringRef("seed2")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getSeedAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getSeedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSeed2AttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSeed2AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RandomUniform"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::OpOperand &getShapeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getSeedAttr(); + uint64_t getSeed(); + ::mlir::IntegerAttr getSeed2Attr(); + uint64_t getSeed2(); + ::mlir::Type getT(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setSeedAttr(::mlir::IntegerAttr attr); + void setSeed(::std::optional attrValue); + void setSeed2Attr(::mlir::IntegerAttr attr); + void setSeed2(::std::optional attrValue); + ::mlir::Attribute removeSeedAttr(); + ::mlir::Attribute removeSeed2Attr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, /*optional*/::mlir::IntegerAttr seed, /*optional*/::mlir::IntegerAttr seed2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, /*optional*/::mlir::IntegerAttr seed, /*optional*/::mlir::IntegerAttr seed2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, /*optional*/uint64_t seed = 0, /*optional*/uint64_t seed2 = 0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, /*optional*/uint64_t seed = 0, /*optional*/uint64_t seed2 = 0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RandomUniformOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RangeDatasetOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RangeDatasetOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RangeDatasetOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RangeDatasetOpGenericAdaptorBase(RangeDatasetOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); + ::mlir::BoolAttr getReplicateOnSplitAttr(); + bool getReplicateOnSplit(); +}; +} // namespace detail +template +class RangeDatasetOpGenericAdaptor : public detail::RangeDatasetOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RangeDatasetOpGenericAdaptorBase; +public: + RangeDatasetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RangeDatasetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RangeDatasetOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RangeDatasetOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getStart() { + return (*getODSOperands(0).begin()); + } + + ValueT getStop() { + return (*getODSOperands(1).begin()); + } + + ValueT getStep() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RangeDatasetOpAdaptor : public RangeDatasetOpGenericAdaptor<::mlir::ValueRange> { +public: + using RangeDatasetOpGenericAdaptor::RangeDatasetOpGenericAdaptor; + RangeDatasetOpAdaptor(RangeDatasetOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RangeDatasetOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold> { +public: + using Op::Op; + using Op::print; + using Adaptor = RangeDatasetOpAdaptor; + template + using GenericAdaptor = RangeDatasetOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("metadata"), ::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types"), ::llvm::StringRef("replicate_on_split")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getMetadataAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getMetadataAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getReplicateOnSplitAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getReplicateOnSplitAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RangeDataset"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getStart(); + ::mlir::TypedValue<::mlir::TensorType> getStop(); + ::mlir::TypedValue<::mlir::TensorType> getStep(); + ::mlir::OpOperand &getStartMutable(); + ::mlir::OpOperand &getStopMutable(); + ::mlir::OpOperand &getStepMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); + ::mlir::BoolAttr getReplicateOnSplitAttr(); + bool getReplicateOnSplit(); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + void setMetadataAttr(::mlir::StringAttr attr); + void setMetadata(::std::optional<::llvm::StringRef> attrValue); + void setReplicateOnSplitAttr(::mlir::BoolAttr attr); + void setReplicateOnSplit(::std::optional attrValue); + ::mlir::Attribute removeMetadataAttr(); + ::mlir::Attribute removeReplicateOnSplitAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value start, ::mlir::Value stop, ::mlir::Value step, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::StringAttr metadata, /*optional*/::mlir::BoolAttr replicate_on_split); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value start, ::mlir::Value stop, ::mlir::Value step, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::StringAttr metadata, /*optional*/::mlir::BoolAttr replicate_on_split); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value start, ::mlir::Value stop, ::mlir::Value step, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::llvm::StringRef metadata = "", /*optional*/bool replicate_on_split = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value start, ::mlir::Value stop, ::mlir::Value step, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::llvm::StringRef metadata = "", /*optional*/bool replicate_on_split = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RangeDatasetOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RangeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RangeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RangeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RangeOpGenericAdaptorBase(RangeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RangeOpGenericAdaptor : public detail::RangeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RangeOpGenericAdaptorBase; +public: + RangeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RangeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RangeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RangeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getStart() { + return (*getODSOperands(0).begin()); + } + + ValueT getLimit() { + return (*getODSOperands(1).begin()); + } + + ValueT getDelta() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RangeOpAdaptor : public RangeOpGenericAdaptor<::mlir::ValueRange> { +public: + using RangeOpGenericAdaptor::RangeOpGenericAdaptor; + RangeOpAdaptor(RangeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RangeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::SameOperandsAndResultElementTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RangeOpAdaptor; + template + using GenericAdaptor = RangeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tidx")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTidxAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTidxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Range"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getStart(); + ::mlir::TypedValue<::mlir::TensorType> getLimit(); + ::mlir::TypedValue<::mlir::TensorType> getDelta(); + ::mlir::OpOperand &getStartMutable(); + ::mlir::OpOperand &getLimitMutable(); + ::mlir::OpOperand &getDeltaMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getTidx(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value start, Value limit, Value delta); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value start, ::mlir::Value limit, ::mlir::Value delta); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value start, ::mlir::Value limit, ::mlir::Value delta); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RangeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RankOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RankOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RankOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RankOpGenericAdaptorBase(RankOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RankOpGenericAdaptor : public detail::RankOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RankOpGenericAdaptorBase; +public: + RankOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RankOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RankOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RankOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RankOpAdaptor : public RankOpGenericAdaptor<::mlir::ValueRange> { +public: + using RankOpGenericAdaptor::RankOpGenericAdaptor; + RankOpAdaptor(RankOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RankOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RankOpAdaptor; + template + using GenericAdaptor = RankOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Rank"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RankOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ReadVariableOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReadVariableOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ReadVariableOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ReadVariableOpGenericAdaptorBase(ReadVariableOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ReadVariableOpGenericAdaptor : public detail::ReadVariableOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReadVariableOpGenericAdaptorBase; +public: + ReadVariableOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReadVariableOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReadVariableOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ReadVariableOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getResource() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ReadVariableOpAdaptor : public ReadVariableOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReadVariableOpGenericAdaptor::ReadVariableOpGenericAdaptor; + ReadVariableOpAdaptor(ReadVariableOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReadVariableOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ReadVariableOpAdaptor; + template + using GenericAdaptor = ReadVariableOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ReadVariableOp"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResource(); + ::mlir::OpOperand &getResourceMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getValue(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type value, ::mlir::Value resource); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value resource); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ReadVariableOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RealDivOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RealDivOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RealDivOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RealDivOpGenericAdaptorBase(RealDivOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RealDivOpGenericAdaptor : public detail::RealDivOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RealDivOpGenericAdaptorBase; +public: + RealDivOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RealDivOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RealDivOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RealDivOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RealDivOpAdaptor : public RealDivOpGenericAdaptor<::mlir::ValueRange> { +public: + using RealDivOpGenericAdaptor::RealDivOpGenericAdaptor; + RealDivOpAdaptor(RealDivOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RealDivOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::OpTrait::TF::CwiseBinary, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RealDivOpAdaptor; + template + using GenericAdaptor = RealDivOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RealDiv"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RealDivOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RealOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RealOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RealOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RealOpGenericAdaptorBase(RealOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RealOpGenericAdaptor : public detail::RealOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RealOpGenericAdaptorBase; +public: + RealOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RealOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RealOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RealOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RealOpAdaptor : public RealOpGenericAdaptor<::mlir::ValueRange> { +public: + using RealOpGenericAdaptor::RealOpGenericAdaptor; + RealOpAdaptor(RealOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RealOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RealOpAdaptor; + template + using GenericAdaptor = RealOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tout")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getToutAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getToutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Real"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTout(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RealOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ReciprocalGradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReciprocalGradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ReciprocalGradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ReciprocalGradOpGenericAdaptorBase(ReciprocalGradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ReciprocalGradOpGenericAdaptor : public detail::ReciprocalGradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReciprocalGradOpGenericAdaptorBase; +public: + ReciprocalGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReciprocalGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReciprocalGradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ReciprocalGradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getY() { + return (*getODSOperands(0).begin()); + } + + ValueT getDy() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ReciprocalGradOpAdaptor : public ReciprocalGradOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReciprocalGradOpGenericAdaptor::ReciprocalGradOpGenericAdaptor; + ReciprocalGradOpAdaptor(ReciprocalGradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReciprocalGradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ReciprocalGradOpAdaptor; + template + using GenericAdaptor = ReciprocalGradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ReciprocalGrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::TypedValue<::mlir::TensorType> getDy(); + ::mlir::OpOperand &getYMutable(); + ::mlir::OpOperand &getDyMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value y, ::mlir::Value dy); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value y, ::mlir::Value dy); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value y, ::mlir::Value dy); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ReciprocalGradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ReciprocalOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReciprocalOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ReciprocalOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ReciprocalOpGenericAdaptorBase(ReciprocalOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ReciprocalOpGenericAdaptor : public detail::ReciprocalOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReciprocalOpGenericAdaptorBase; +public: + ReciprocalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReciprocalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReciprocalOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ReciprocalOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ReciprocalOpAdaptor : public ReciprocalOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReciprocalOpGenericAdaptor::ReciprocalOpGenericAdaptor; + ReciprocalOpAdaptor(ReciprocalOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReciprocalOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::IsInvolution, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ReciprocalOpAdaptor; + template + using GenericAdaptor = ReciprocalOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Reciprocal"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ReciprocalOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RecvOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RecvOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RecvOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RecvOpGenericAdaptorBase(RecvOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getTensorNameAttr(); + ::llvm::StringRef getTensorName(); + ::mlir::StringAttr getSendDeviceAttr(); + ::llvm::StringRef getSendDevice(); + ::mlir::IntegerAttr getSendDeviceIncarnationAttr(); + uint64_t getSendDeviceIncarnation(); + ::mlir::StringAttr getRecvDeviceAttr(); + ::llvm::StringRef getRecvDevice(); + ::mlir::BoolAttr getClientTerminatedAttr(); + bool getClientTerminated(); +}; +} // namespace detail +template +class RecvOpGenericAdaptor : public detail::RecvOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RecvOpGenericAdaptorBase; +public: + RecvOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RecvOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RecvOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RecvOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RecvOpAdaptor : public RecvOpGenericAdaptor<::mlir::ValueRange> { +public: + using RecvOpGenericAdaptor::RecvOpGenericAdaptor; + RecvOpAdaptor(RecvOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RecvOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RecvOpAdaptor; + template + using GenericAdaptor = RecvOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("client_terminated"), ::llvm::StringRef("recv_device"), ::llvm::StringRef("send_device"), ::llvm::StringRef("send_device_incarnation"), ::llvm::StringRef("tensor_name"), ::llvm::StringRef("tensor_type")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getClientTerminatedAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getClientTerminatedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getRecvDeviceAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getRecvDeviceAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getSendDeviceAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getSendDeviceAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSendDeviceIncarnationAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSendDeviceIncarnationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTensorNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTensorNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getTensorTypeAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getTensorTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Recv"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::StringAttr getTensorNameAttr(); + ::llvm::StringRef getTensorName(); + ::mlir::StringAttr getSendDeviceAttr(); + ::llvm::StringRef getSendDevice(); + ::mlir::IntegerAttr getSendDeviceIncarnationAttr(); + uint64_t getSendDeviceIncarnation(); + ::mlir::StringAttr getRecvDeviceAttr(); + ::llvm::StringRef getRecvDevice(); + ::mlir::BoolAttr getClientTerminatedAttr(); + bool getClientTerminated(); + ::mlir::Type getTensorType(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setTensorNameAttr(::mlir::StringAttr attr); + void setTensorName(::llvm::StringRef attrValue); + void setSendDeviceAttr(::mlir::StringAttr attr); + void setSendDevice(::llvm::StringRef attrValue); + void setSendDeviceIncarnationAttr(::mlir::IntegerAttr attr); + void setSendDeviceIncarnation(uint64_t attrValue); + void setRecvDeviceAttr(::mlir::StringAttr attr); + void setRecvDevice(::llvm::StringRef attrValue); + void setClientTerminatedAttr(::mlir::BoolAttr attr); + void setClientTerminated(::std::optional attrValue); + ::mlir::Attribute removeClientTerminatedAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type tensor, ::mlir::StringAttr tensor_name, ::mlir::StringAttr send_device, ::mlir::IntegerAttr send_device_incarnation, ::mlir::StringAttr recv_device, /*optional*/::mlir::BoolAttr client_terminated); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr tensor_name, ::mlir::StringAttr send_device, ::mlir::IntegerAttr send_device_incarnation, ::mlir::StringAttr recv_device, /*optional*/::mlir::BoolAttr client_terminated); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type tensor, ::llvm::StringRef tensor_name, ::llvm::StringRef send_device, uint64_t send_device_incarnation, ::llvm::StringRef recv_device, /*optional*/bool client_terminated = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef tensor_name, ::llvm::StringRef send_device, uint64_t send_device_incarnation, ::llvm::StringRef recv_device, /*optional*/bool client_terminated = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RecvOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RecvTPUEmbeddingActivationsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RecvTPUEmbeddingActivationsOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RecvTPUEmbeddingActivationsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RecvTPUEmbeddingActivationsOpGenericAdaptorBase(RecvTPUEmbeddingActivationsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class RecvTPUEmbeddingActivationsOpGenericAdaptor : public detail::RecvTPUEmbeddingActivationsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RecvTPUEmbeddingActivationsOpGenericAdaptorBase; +public: + RecvTPUEmbeddingActivationsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RecvTPUEmbeddingActivationsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RecvTPUEmbeddingActivationsOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RecvTPUEmbeddingActivationsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RecvTPUEmbeddingActivationsOpAdaptor : public RecvTPUEmbeddingActivationsOpGenericAdaptor<::mlir::ValueRange> { +public: + using RecvTPUEmbeddingActivationsOpGenericAdaptor::RecvTPUEmbeddingActivationsOpGenericAdaptor; + RecvTPUEmbeddingActivationsOpAdaptor(RecvTPUEmbeddingActivationsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RecvTPUEmbeddingActivationsOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = RecvTPUEmbeddingActivationsOpAdaptor; + template + using GenericAdaptor = RecvTPUEmbeddingActivationsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_outputs")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumOutputsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumOutputsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RecvTPUEmbeddingActivations"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutputs(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + size_t getNumOutputs(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outputs, ::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outputs, ::llvm::StringRef config); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RecvTPUEmbeddingActivationsOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ReduceDatasetOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReduceDatasetOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ReduceDatasetOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ReduceDatasetOpGenericAdaptorBase(ReduceDatasetOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::SymbolRefAttr getFAttr(); + ::mlir::SymbolRefAttr getF(); + ::mlir::ArrayAttr getTstateAttr(); + ::mlir::ArrayAttr getTstate(); + ::mlir::ArrayAttr getTargumentsAttr(); + ::mlir::ArrayAttr getTarguments(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::BoolAttr getUseInterOpParallelismAttr(); + bool getUseInterOpParallelism(); +}; +} // namespace detail +template +class ReduceDatasetOpGenericAdaptor : public detail::ReduceDatasetOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReduceDatasetOpGenericAdaptorBase; +public: + ReduceDatasetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReduceDatasetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReduceDatasetOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ReduceDatasetOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputDataset() { + return (*getODSOperands(0).begin()); + } + + RangeT getInitialState() { + return getODSOperands(1); + } + + RangeT getOtherArguments() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ReduceDatasetOpAdaptor : public ReduceDatasetOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReduceDatasetOpGenericAdaptor::ReduceDatasetOpGenericAdaptor; + ReduceDatasetOpAdaptor(ReduceDatasetOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReduceDatasetOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = ReduceDatasetOpAdaptor; + template + using GenericAdaptor = ReduceDatasetOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Targuments"), ::llvm::StringRef("Tstate"), ::llvm::StringRef("f"), ::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types"), ::llvm::StringRef("use_inter_op_parallelism")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTargumentsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTargumentsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTstateAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTstateAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getFAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getFAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getUseInterOpParallelismAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getUseInterOpParallelismAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ReduceDataset"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputDataset(); + ::mlir::Operation::operand_range getInitialState(); + ::mlir::Operation::operand_range getOtherArguments(); + ::mlir::OpOperand &getInputDatasetMutable(); + ::mlir::MutableOperandRange getInitialStateMutable(); + ::mlir::MutableOperandRange getOtherArgumentsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getComponents(); + ::mlir::SymbolRefAttr getFAttr(); + ::mlir::SymbolRefAttr getF(); + ::mlir::ArrayAttr getTstateAttr(); + ::mlir::ArrayAttr getTstate(); + ::mlir::ArrayAttr getTargumentsAttr(); + ::mlir::ArrayAttr getTarguments(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::BoolAttr getUseInterOpParallelismAttr(); + bool getUseInterOpParallelism(); + void setFAttr(::mlir::SymbolRefAttr attr); + void setTstateAttr(::mlir::ArrayAttr attr); + void setTargumentsAttr(::mlir::ArrayAttr attr); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + void setUseInterOpParallelismAttr(::mlir::BoolAttr attr); + void setUseInterOpParallelism(::std::optional attrValue); + ::mlir::Attribute removeUseInterOpParallelismAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange components, ::mlir::Value input_dataset, ::mlir::ValueRange initial_state, ::mlir::ValueRange other_arguments, ::mlir::SymbolRefAttr f, ::mlir::ArrayAttr Tstate, ::mlir::ArrayAttr Targuments, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::BoolAttr use_inter_op_parallelism); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange components, ::mlir::Value input_dataset, ::mlir::ValueRange initial_state, ::mlir::ValueRange other_arguments, ::mlir::SymbolRefAttr f, ::mlir::ArrayAttr Tstate, ::mlir::ArrayAttr Targuments, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/bool use_inter_op_parallelism = true); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ReduceDatasetOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ReduceJoinOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReduceJoinOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ReduceJoinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ReduceJoinOpGenericAdaptorBase(ReduceJoinOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getKeepDimsAttr(); + bool getKeepDims(); + ::mlir::StringAttr getSeparatorAttr(); + ::llvm::StringRef getSeparator(); +}; +} // namespace detail +template +class ReduceJoinOpGenericAdaptor : public detail::ReduceJoinOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReduceJoinOpGenericAdaptorBase; +public: + ReduceJoinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReduceJoinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReduceJoinOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ReduceJoinOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputs() { + return (*getODSOperands(0).begin()); + } + + ValueT getReductionIndices() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ReduceJoinOpAdaptor : public ReduceJoinOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReduceJoinOpGenericAdaptor::ReduceJoinOpGenericAdaptor; + ReduceJoinOpAdaptor(ReduceJoinOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReduceJoinOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ReduceJoinOpAdaptor; + template + using GenericAdaptor = ReduceJoinOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("keep_dims"), ::llvm::StringRef("separator")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getKeepDimsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getKeepDimsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getSeparatorAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getSeparatorAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ReduceJoin"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputs(); + ::mlir::TypedValue<::mlir::TensorType> getReductionIndices(); + ::mlir::OpOperand &getInputsMutable(); + ::mlir::OpOperand &getReductionIndicesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getKeepDimsAttr(); + bool getKeepDims(); + ::mlir::StringAttr getSeparatorAttr(); + ::llvm::StringRef getSeparator(); + void setKeepDimsAttr(::mlir::BoolAttr attr); + void setKeepDims(::std::optional attrValue); + void setSeparatorAttr(::mlir::StringAttr attr); + void setSeparator(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeKeepDimsAttr(); + ::mlir::Attribute removeSeparatorAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value inputs, ::mlir::Value reduction_indices, /*optional*/::mlir::BoolAttr keep_dims, /*optional*/::mlir::StringAttr separator); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inputs, ::mlir::Value reduction_indices, /*optional*/::mlir::BoolAttr keep_dims, /*optional*/::mlir::StringAttr separator); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value inputs, ::mlir::Value reduction_indices, /*optional*/bool keep_dims = false, /*optional*/::llvm::StringRef separator = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inputs, ::mlir::Value reduction_indices, /*optional*/bool keep_dims = false, /*optional*/::llvm::StringRef separator = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ReduceJoinOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::Relu6GradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Relu6GradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + Relu6GradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + Relu6GradOpGenericAdaptorBase(Relu6GradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class Relu6GradOpGenericAdaptor : public detail::Relu6GradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Relu6GradOpGenericAdaptorBase; +public: + Relu6GradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Relu6GradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Relu6GradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + Relu6GradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getGradients() { + return (*getODSOperands(0).begin()); + } + + ValueT getFeatures() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Relu6GradOpAdaptor : public Relu6GradOpGenericAdaptor<::mlir::ValueRange> { +public: + using Relu6GradOpGenericAdaptor::Relu6GradOpGenericAdaptor; + Relu6GradOpAdaptor(Relu6GradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Relu6GradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = Relu6GradOpAdaptor; + template + using GenericAdaptor = Relu6GradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Relu6Grad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getGradients(); + ::mlir::TypedValue<::mlir::TensorType> getFeatures(); + ::mlir::OpOperand &getGradientsMutable(); + ::mlir::OpOperand &getFeaturesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getBackprops(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type backprops, ::mlir::Value gradients, ::mlir::Value features); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value gradients, ::mlir::Value features); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value gradients, ::mlir::Value features); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::Relu6GradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::Relu6Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Relu6OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + Relu6OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + Relu6OpGenericAdaptorBase(Relu6Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class Relu6OpGenericAdaptor : public detail::Relu6OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Relu6OpGenericAdaptorBase; +public: + Relu6OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Relu6OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Relu6OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + Relu6OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getFeatures() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Relu6OpAdaptor : public Relu6OpGenericAdaptor<::mlir::ValueRange> { +public: + using Relu6OpGenericAdaptor::Relu6OpGenericAdaptor; + Relu6OpAdaptor(Relu6Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Relu6Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::IsIdempotent, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = Relu6OpAdaptor; + template + using GenericAdaptor = Relu6OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Relu6"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getFeatures(); + ::mlir::OpOperand &getFeaturesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getActivations(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type activations, ::mlir::Value features); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value features); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value features); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::Relu6Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ReluGradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReluGradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ReluGradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ReluGradOpGenericAdaptorBase(ReluGradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ReluGradOpGenericAdaptor : public detail::ReluGradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReluGradOpGenericAdaptorBase; +public: + ReluGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReluGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReluGradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ReluGradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getGradients() { + return (*getODSOperands(0).begin()); + } + + ValueT getFeatures() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ReluGradOpAdaptor : public ReluGradOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReluGradOpGenericAdaptor::ReluGradOpGenericAdaptor; + ReluGradOpAdaptor(ReluGradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReluGradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ReluGradOpAdaptor; + template + using GenericAdaptor = ReluGradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ReluGrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getGradients(); + ::mlir::TypedValue<::mlir::TensorType> getFeatures(); + ::mlir::OpOperand &getGradientsMutable(); + ::mlir::OpOperand &getFeaturesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getBackprops(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type backprops, ::mlir::Value gradients, ::mlir::Value features); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value gradients, ::mlir::Value features); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value gradients, ::mlir::Value features); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ReluGradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ReluOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReluOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ReluOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ReluOpGenericAdaptorBase(ReluOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ReluOpGenericAdaptor : public detail::ReluOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReluOpGenericAdaptorBase; +public: + ReluOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReluOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReluOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ReluOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getFeatures() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ReluOpAdaptor : public ReluOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReluOpGenericAdaptor::ReluOpGenericAdaptor; + ReluOpAdaptor(ReluOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReluOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::IsIdempotent, ::mlir::OpTrait::TF::LayoutAgnostic, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ReluOpAdaptor; + template + using GenericAdaptor = ReluOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Relu"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getFeatures(); + ::mlir::OpOperand &getFeaturesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getActivations(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type activations, ::mlir::Value features); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value features); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value features); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ReluOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RemoteCallOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RemoteCallOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RemoteCallOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RemoteCallOpGenericAdaptorBase(RemoteCallOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::SymbolRefAttr getFAttr(); + ::mlir::SymbolRefAttr getF(); +}; +} // namespace detail +template +class RemoteCallOpGenericAdaptor : public detail::RemoteCallOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RemoteCallOpGenericAdaptorBase; +public: + RemoteCallOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RemoteCallOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RemoteCallOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RemoteCallOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTarget() { + return (*getODSOperands(0).begin()); + } + + RangeT getArgs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RemoteCallOpAdaptor : public RemoteCallOpGenericAdaptor<::mlir::ValueRange> { +public: + using RemoteCallOpGenericAdaptor::RemoteCallOpGenericAdaptor; + RemoteCallOpAdaptor(RemoteCallOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RemoteCallOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::CallOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RemoteCallOpAdaptor; + template + using GenericAdaptor = RemoteCallOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tin"), ::llvm::StringRef("Tout"), ::llvm::StringRef("f")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTinAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTinAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getToutAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getToutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getFAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getFAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RemoteCall"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTarget(); + ::mlir::Operation::operand_range getArgs(); + ::mlir::OpOperand &getTargetMutable(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutput(); + ::mlir::SymbolRefAttr getFAttr(); + ::mlir::SymbolRefAttr getF(); + mlir::OperandElementTypeRange getTin(); + mlir::ResultElementTypeRange getTout(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setFAttr(::mlir::SymbolRefAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::Value target, ::mlir::ValueRange args, ::mlir::SymbolRefAttr f); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + /// Get the argument operands to the called function. + operand_range getArgOperands() { + return getArgs(); + } + + MutableOperandRange getArgOperandsMutable() { + return getArgsMutable(); + } + + /// Return the callee of this operation. + CallInterfaceCallable getCallableForCallee() { + return (*this)->getAttrOfType("f"); + } + + /// Set the callee for this operation. + void setCalleeFromCallable(CallInterfaceCallable callee) { + (*this)->setAttr("f", callee.get()); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RemoteCallOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RepeatDatasetOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RepeatDatasetOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RepeatDatasetOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RepeatDatasetOpGenericAdaptorBase(RepeatDatasetOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); +}; +} // namespace detail +template +class RepeatDatasetOpGenericAdaptor : public detail::RepeatDatasetOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RepeatDatasetOpGenericAdaptorBase; +public: + RepeatDatasetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RepeatDatasetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RepeatDatasetOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RepeatDatasetOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputDataset() { + return (*getODSOperands(0).begin()); + } + + ValueT getCount() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RepeatDatasetOpAdaptor : public RepeatDatasetOpGenericAdaptor<::mlir::ValueRange> { +public: + using RepeatDatasetOpGenericAdaptor::RepeatDatasetOpGenericAdaptor; + RepeatDatasetOpAdaptor(RepeatDatasetOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RepeatDatasetOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RepeatDatasetOpAdaptor; + template + using GenericAdaptor = RepeatDatasetOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("metadata"), ::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getMetadataAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getMetadataAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RepeatDataset"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputDataset(); + ::mlir::TypedValue<::mlir::TensorType> getCount(); + ::mlir::OpOperand &getInputDatasetMutable(); + ::mlir::OpOperand &getCountMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + void setMetadataAttr(::mlir::StringAttr attr); + void setMetadata(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeMetadataAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, ::mlir::Value count, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, ::mlir::Value count, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, ::mlir::Value count, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::llvm::StringRef metadata = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, ::mlir::Value count, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::llvm::StringRef metadata = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RepeatDatasetOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ReshapeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReshapeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ReshapeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ReshapeOpGenericAdaptorBase(ReshapeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ReshapeOpGenericAdaptor : public detail::ReshapeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReshapeOpGenericAdaptorBase; +public: + ReshapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReshapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReshapeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ReshapeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTensor() { + return (*getODSOperands(0).begin()); + } + + ValueT getShape() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ReshapeOpAdaptor : public ReshapeOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReshapeOpGenericAdaptor::ReshapeOpGenericAdaptor; + ReshapeOpAdaptor(ReshapeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReshapeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ReshapeOpAdaptor; + template + using GenericAdaptor = ReshapeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tshape")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTshapeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTshapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Reshape"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::OpOperand &getTensorMutable(); + ::mlir::OpOperand &getShapeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTshape(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value tensor, Value shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value tensor, ::mlir::Value shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tensor, ::mlir::Value shape); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ReshapeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResizeBilinearGradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResizeBilinearGradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResizeBilinearGradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResizeBilinearGradOpGenericAdaptorBase(ResizeBilinearGradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getAlignCornersAttr(); + bool getAlignCorners(); + ::mlir::BoolAttr getHalfPixelCentersAttr(); + bool getHalfPixelCenters(); +}; +} // namespace detail +template +class ResizeBilinearGradOpGenericAdaptor : public detail::ResizeBilinearGradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResizeBilinearGradOpGenericAdaptorBase; +public: + ResizeBilinearGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResizeBilinearGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResizeBilinearGradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResizeBilinearGradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getGrads() { + return (*getODSOperands(0).begin()); + } + + ValueT getOriginalImage() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResizeBilinearGradOpAdaptor : public ResizeBilinearGradOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResizeBilinearGradOpGenericAdaptor::ResizeBilinearGradOpGenericAdaptor; + ResizeBilinearGradOpAdaptor(ResizeBilinearGradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResizeBilinearGradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResizeBilinearGradOpAdaptor; + template + using GenericAdaptor = ResizeBilinearGradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("align_corners"), ::llvm::StringRef("half_pixel_centers")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAlignCornersAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAlignCornersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getHalfPixelCentersAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getHalfPixelCentersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResizeBilinearGrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getGrads(); + ::mlir::TypedValue<::mlir::TensorType> getOriginalImage(); + ::mlir::OpOperand &getGradsMutable(); + ::mlir::OpOperand &getOriginalImageMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getAlignCornersAttr(); + bool getAlignCorners(); + ::mlir::BoolAttr getHalfPixelCentersAttr(); + bool getHalfPixelCenters(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setAlignCornersAttr(::mlir::BoolAttr attr); + void setAlignCorners(::std::optional attrValue); + void setHalfPixelCentersAttr(::mlir::BoolAttr attr); + void setHalfPixelCenters(::std::optional attrValue); + ::mlir::Attribute removeAlignCornersAttr(); + ::mlir::Attribute removeHalfPixelCentersAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value grads, ::mlir::Value original_image, /*optional*/::mlir::BoolAttr align_corners, /*optional*/::mlir::BoolAttr half_pixel_centers); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value grads, ::mlir::Value original_image, /*optional*/::mlir::BoolAttr align_corners, /*optional*/::mlir::BoolAttr half_pixel_centers); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value grads, ::mlir::Value original_image, /*optional*/bool align_corners = false, /*optional*/bool half_pixel_centers = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value grads, ::mlir::Value original_image, /*optional*/bool align_corners = false, /*optional*/bool half_pixel_centers = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResizeBilinearGradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResizeBilinearOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResizeBilinearOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResizeBilinearOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResizeBilinearOpGenericAdaptorBase(ResizeBilinearOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getAlignCornersAttr(); + bool getAlignCorners(); + ::mlir::BoolAttr getHalfPixelCentersAttr(); + bool getHalfPixelCenters(); +}; +} // namespace detail +template +class ResizeBilinearOpGenericAdaptor : public detail::ResizeBilinearOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResizeBilinearOpGenericAdaptorBase; +public: + ResizeBilinearOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResizeBilinearOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResizeBilinearOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResizeBilinearOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getImages() { + return (*getODSOperands(0).begin()); + } + + ValueT getSize() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResizeBilinearOpAdaptor : public ResizeBilinearOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResizeBilinearOpGenericAdaptor::ResizeBilinearOpGenericAdaptor; + ResizeBilinearOpAdaptor(ResizeBilinearOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResizeBilinearOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResizeBilinearOpAdaptor; + template + using GenericAdaptor = ResizeBilinearOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("align_corners"), ::llvm::StringRef("half_pixel_centers")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAlignCornersAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAlignCornersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getHalfPixelCentersAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getHalfPixelCentersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResizeBilinear"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getImages(); + ::mlir::TypedValue<::mlir::TensorType> getSize(); + ::mlir::OpOperand &getImagesMutable(); + ::mlir::OpOperand &getSizeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResizedImages(); + ::mlir::BoolAttr getAlignCornersAttr(); + bool getAlignCorners(); + ::mlir::BoolAttr getHalfPixelCentersAttr(); + bool getHalfPixelCenters(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setAlignCornersAttr(::mlir::BoolAttr attr); + void setAlignCorners(::std::optional attrValue); + void setHalfPixelCentersAttr(::mlir::BoolAttr attr); + void setHalfPixelCenters(::std::optional attrValue); + ::mlir::Attribute removeAlignCornersAttr(); + ::mlir::Attribute removeHalfPixelCentersAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resized_images, ::mlir::Value images, ::mlir::Value size, /*optional*/::mlir::BoolAttr align_corners, /*optional*/::mlir::BoolAttr half_pixel_centers); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value images, ::mlir::Value size, /*optional*/::mlir::BoolAttr align_corners, /*optional*/::mlir::BoolAttr half_pixel_centers); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resized_images, ::mlir::Value images, ::mlir::Value size, /*optional*/bool align_corners = false, /*optional*/bool half_pixel_centers = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value images, ::mlir::Value size, /*optional*/bool align_corners = false, /*optional*/bool half_pixel_centers = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResizeBilinearOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResizeNearestNeighborGradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResizeNearestNeighborGradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResizeNearestNeighborGradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResizeNearestNeighborGradOpGenericAdaptorBase(ResizeNearestNeighborGradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getAlignCornersAttr(); + bool getAlignCorners(); + ::mlir::BoolAttr getHalfPixelCentersAttr(); + bool getHalfPixelCenters(); +}; +} // namespace detail +template +class ResizeNearestNeighborGradOpGenericAdaptor : public detail::ResizeNearestNeighborGradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResizeNearestNeighborGradOpGenericAdaptorBase; +public: + ResizeNearestNeighborGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResizeNearestNeighborGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResizeNearestNeighborGradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResizeNearestNeighborGradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getGrads() { + return (*getODSOperands(0).begin()); + } + + ValueT getSize() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResizeNearestNeighborGradOpAdaptor : public ResizeNearestNeighborGradOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResizeNearestNeighborGradOpGenericAdaptor::ResizeNearestNeighborGradOpGenericAdaptor; + ResizeNearestNeighborGradOpAdaptor(ResizeNearestNeighborGradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResizeNearestNeighborGradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResizeNearestNeighborGradOpAdaptor; + template + using GenericAdaptor = ResizeNearestNeighborGradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("align_corners"), ::llvm::StringRef("half_pixel_centers")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAlignCornersAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAlignCornersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getHalfPixelCentersAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getHalfPixelCentersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResizeNearestNeighborGrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getGrads(); + ::mlir::TypedValue<::mlir::TensorType> getSize(); + ::mlir::OpOperand &getGradsMutable(); + ::mlir::OpOperand &getSizeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getAlignCornersAttr(); + bool getAlignCorners(); + ::mlir::BoolAttr getHalfPixelCentersAttr(); + bool getHalfPixelCenters(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setAlignCornersAttr(::mlir::BoolAttr attr); + void setAlignCorners(::std::optional attrValue); + void setHalfPixelCentersAttr(::mlir::BoolAttr attr); + void setHalfPixelCenters(::std::optional attrValue); + ::mlir::Attribute removeAlignCornersAttr(); + ::mlir::Attribute removeHalfPixelCentersAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value grads, ::mlir::Value size, /*optional*/::mlir::BoolAttr align_corners, /*optional*/::mlir::BoolAttr half_pixel_centers); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value grads, ::mlir::Value size, /*optional*/::mlir::BoolAttr align_corners, /*optional*/::mlir::BoolAttr half_pixel_centers); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value grads, ::mlir::Value size, /*optional*/bool align_corners = false, /*optional*/bool half_pixel_centers = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value grads, ::mlir::Value size, /*optional*/bool align_corners = false, /*optional*/bool half_pixel_centers = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResizeNearestNeighborGradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResizeNearestNeighborOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResizeNearestNeighborOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResizeNearestNeighborOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResizeNearestNeighborOpGenericAdaptorBase(ResizeNearestNeighborOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getAlignCornersAttr(); + bool getAlignCorners(); + ::mlir::BoolAttr getHalfPixelCentersAttr(); + bool getHalfPixelCenters(); +}; +} // namespace detail +template +class ResizeNearestNeighborOpGenericAdaptor : public detail::ResizeNearestNeighborOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResizeNearestNeighborOpGenericAdaptorBase; +public: + ResizeNearestNeighborOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResizeNearestNeighborOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResizeNearestNeighborOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResizeNearestNeighborOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getImages() { + return (*getODSOperands(0).begin()); + } + + ValueT getSize() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResizeNearestNeighborOpAdaptor : public ResizeNearestNeighborOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResizeNearestNeighborOpGenericAdaptor::ResizeNearestNeighborOpGenericAdaptor; + ResizeNearestNeighborOpAdaptor(ResizeNearestNeighborOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResizeNearestNeighborOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResizeNearestNeighborOpAdaptor; + template + using GenericAdaptor = ResizeNearestNeighborOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("align_corners"), ::llvm::StringRef("half_pixel_centers")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAlignCornersAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAlignCornersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getHalfPixelCentersAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getHalfPixelCentersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResizeNearestNeighbor"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getImages(); + ::mlir::TypedValue<::mlir::TensorType> getSize(); + ::mlir::OpOperand &getImagesMutable(); + ::mlir::OpOperand &getSizeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResizedImages(); + ::mlir::BoolAttr getAlignCornersAttr(); + bool getAlignCorners(); + ::mlir::BoolAttr getHalfPixelCentersAttr(); + bool getHalfPixelCenters(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setAlignCornersAttr(::mlir::BoolAttr attr); + void setAlignCorners(::std::optional attrValue); + void setHalfPixelCentersAttr(::mlir::BoolAttr attr); + void setHalfPixelCenters(::std::optional attrValue); + ::mlir::Attribute removeAlignCornersAttr(); + ::mlir::Attribute removeHalfPixelCentersAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resized_images, ::mlir::Value images, ::mlir::Value size, /*optional*/::mlir::BoolAttr align_corners, /*optional*/::mlir::BoolAttr half_pixel_centers); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value images, ::mlir::Value size, /*optional*/::mlir::BoolAttr align_corners, /*optional*/::mlir::BoolAttr half_pixel_centers); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resized_images, ::mlir::Value images, ::mlir::Value size, /*optional*/bool align_corners = false, /*optional*/bool half_pixel_centers = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value images, ::mlir::Value size, /*optional*/bool align_corners = false, /*optional*/bool half_pixel_centers = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResizeNearestNeighborOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceApplyAdaMaxOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceApplyAdaMaxOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceApplyAdaMaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceApplyAdaMaxOpGenericAdaptorBase(ResourceApplyAdaMaxOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); +}; +} // namespace detail +template +class ResourceApplyAdaMaxOpGenericAdaptor : public detail::ResourceApplyAdaMaxOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceApplyAdaMaxOpGenericAdaptorBase; +public: + ResourceApplyAdaMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceApplyAdaMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceApplyAdaMaxOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceApplyAdaMaxOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVar() { + return (*getODSOperands(0).begin()); + } + + ValueT getM() { + return (*getODSOperands(1).begin()); + } + + ValueT getV() { + return (*getODSOperands(2).begin()); + } + + ValueT getBeta1Power() { + return (*getODSOperands(3).begin()); + } + + ValueT getLr() { + return (*getODSOperands(4).begin()); + } + + ValueT getBeta1() { + return (*getODSOperands(5).begin()); + } + + ValueT getBeta2() { + return (*getODSOperands(6).begin()); + } + + ValueT getEpsilon() { + return (*getODSOperands(7).begin()); + } + + ValueT getGrad() { + return (*getODSOperands(8).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceApplyAdaMaxOpAdaptor : public ResourceApplyAdaMaxOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceApplyAdaMaxOpGenericAdaptor::ResourceApplyAdaMaxOpGenericAdaptor; + ResourceApplyAdaMaxOpAdaptor(ResourceApplyAdaMaxOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceApplyAdaMaxOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceApplyAdaMaxOpAdaptor; + template + using GenericAdaptor = ResourceApplyAdaMaxOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("use_locking")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getUseLockingAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getUseLockingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceApplyAdaMax"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getVar(); + ::mlir::TypedValue<::mlir::TensorType> getM(); + ::mlir::TypedValue<::mlir::TensorType> getV(); + ::mlir::TypedValue<::mlir::TensorType> getBeta1Power(); + ::mlir::TypedValue<::mlir::TensorType> getLr(); + ::mlir::TypedValue<::mlir::TensorType> getBeta1(); + ::mlir::TypedValue<::mlir::TensorType> getBeta2(); + ::mlir::TypedValue<::mlir::TensorType> getEpsilon(); + ::mlir::TypedValue<::mlir::TensorType> getGrad(); + ::mlir::OpOperand &getVarMutable(); + ::mlir::OpOperand &getMMutable(); + ::mlir::OpOperand &getVMutable(); + ::mlir::OpOperand &getBeta1PowerMutable(); + ::mlir::OpOperand &getLrMutable(); + ::mlir::OpOperand &getBeta1Mutable(); + ::mlir::OpOperand &getBeta2Mutable(); + ::mlir::OpOperand &getEpsilonMutable(); + ::mlir::OpOperand &getGradMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setUseLockingAttr(::mlir::BoolAttr attr); + void setUseLocking(::std::optional attrValue); + ::mlir::Attribute removeUseLockingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value m, ::mlir::Value v, ::mlir::Value beta1_power, ::mlir::Value lr, ::mlir::Value beta1, ::mlir::Value beta2, ::mlir::Value epsilon, ::mlir::Value grad, /*optional*/::mlir::BoolAttr use_locking); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value m, ::mlir::Value v, ::mlir::Value beta1_power, ::mlir::Value lr, ::mlir::Value beta1, ::mlir::Value beta2, ::mlir::Value epsilon, ::mlir::Value grad, /*optional*/::mlir::BoolAttr use_locking); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value m, ::mlir::Value v, ::mlir::Value beta1_power, ::mlir::Value lr, ::mlir::Value beta1, ::mlir::Value beta2, ::mlir::Value epsilon, ::mlir::Value grad, /*optional*/bool use_locking = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value m, ::mlir::Value v, ::mlir::Value beta1_power, ::mlir::Value lr, ::mlir::Value beta1, ::mlir::Value beta2, ::mlir::Value epsilon, ::mlir::Value grad, /*optional*/bool use_locking = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceApplyAdaMaxOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceApplyAdadeltaOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceApplyAdadeltaOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceApplyAdadeltaOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceApplyAdadeltaOpGenericAdaptorBase(ResourceApplyAdadeltaOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); +}; +} // namespace detail +template +class ResourceApplyAdadeltaOpGenericAdaptor : public detail::ResourceApplyAdadeltaOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceApplyAdadeltaOpGenericAdaptorBase; +public: + ResourceApplyAdadeltaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceApplyAdadeltaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceApplyAdadeltaOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceApplyAdadeltaOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVar() { + return (*getODSOperands(0).begin()); + } + + ValueT getAccum() { + return (*getODSOperands(1).begin()); + } + + ValueT getAccumUpdate() { + return (*getODSOperands(2).begin()); + } + + ValueT getLr() { + return (*getODSOperands(3).begin()); + } + + ValueT getRho() { + return (*getODSOperands(4).begin()); + } + + ValueT getEpsilon() { + return (*getODSOperands(5).begin()); + } + + ValueT getGrad() { + return (*getODSOperands(6).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceApplyAdadeltaOpAdaptor : public ResourceApplyAdadeltaOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceApplyAdadeltaOpGenericAdaptor::ResourceApplyAdadeltaOpGenericAdaptor; + ResourceApplyAdadeltaOpAdaptor(ResourceApplyAdadeltaOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceApplyAdadeltaOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceApplyAdadeltaOpAdaptor; + template + using GenericAdaptor = ResourceApplyAdadeltaOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("use_locking")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getUseLockingAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getUseLockingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceApplyAdadelta"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getVar(); + ::mlir::TypedValue<::mlir::TensorType> getAccum(); + ::mlir::TypedValue<::mlir::TensorType> getAccumUpdate(); + ::mlir::TypedValue<::mlir::TensorType> getLr(); + ::mlir::TypedValue<::mlir::TensorType> getRho(); + ::mlir::TypedValue<::mlir::TensorType> getEpsilon(); + ::mlir::TypedValue<::mlir::TensorType> getGrad(); + ::mlir::OpOperand &getVarMutable(); + ::mlir::OpOperand &getAccumMutable(); + ::mlir::OpOperand &getAccumUpdateMutable(); + ::mlir::OpOperand &getLrMutable(); + ::mlir::OpOperand &getRhoMutable(); + ::mlir::OpOperand &getEpsilonMutable(); + ::mlir::OpOperand &getGradMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setUseLockingAttr(::mlir::BoolAttr attr); + void setUseLocking(::std::optional attrValue); + ::mlir::Attribute removeUseLockingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value accum_update, ::mlir::Value lr, ::mlir::Value rho, ::mlir::Value epsilon, ::mlir::Value grad, /*optional*/::mlir::BoolAttr use_locking); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value accum_update, ::mlir::Value lr, ::mlir::Value rho, ::mlir::Value epsilon, ::mlir::Value grad, /*optional*/::mlir::BoolAttr use_locking); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value accum_update, ::mlir::Value lr, ::mlir::Value rho, ::mlir::Value epsilon, ::mlir::Value grad, /*optional*/bool use_locking = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value accum_update, ::mlir::Value lr, ::mlir::Value rho, ::mlir::Value epsilon, ::mlir::Value grad, /*optional*/bool use_locking = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceApplyAdadeltaOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceApplyAdagradDAOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceApplyAdagradDAOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceApplyAdagradDAOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceApplyAdagradDAOpGenericAdaptorBase(ResourceApplyAdagradDAOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); +}; +} // namespace detail +template +class ResourceApplyAdagradDAOpGenericAdaptor : public detail::ResourceApplyAdagradDAOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceApplyAdagradDAOpGenericAdaptorBase; +public: + ResourceApplyAdagradDAOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceApplyAdagradDAOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceApplyAdagradDAOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceApplyAdagradDAOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVar() { + return (*getODSOperands(0).begin()); + } + + ValueT getGradientAccumulator() { + return (*getODSOperands(1).begin()); + } + + ValueT getGradientSquaredAccumulator() { + return (*getODSOperands(2).begin()); + } + + ValueT getGrad() { + return (*getODSOperands(3).begin()); + } + + ValueT getLr() { + return (*getODSOperands(4).begin()); + } + + ValueT getL1() { + return (*getODSOperands(5).begin()); + } + + ValueT getL2() { + return (*getODSOperands(6).begin()); + } + + ValueT getGlobalStep() { + return (*getODSOperands(7).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceApplyAdagradDAOpAdaptor : public ResourceApplyAdagradDAOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceApplyAdagradDAOpGenericAdaptor::ResourceApplyAdagradDAOpGenericAdaptor; + ResourceApplyAdagradDAOpAdaptor(ResourceApplyAdagradDAOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceApplyAdagradDAOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceApplyAdagradDAOpAdaptor; + template + using GenericAdaptor = ResourceApplyAdagradDAOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("use_locking")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getUseLockingAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getUseLockingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceApplyAdagradDA"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getVar(); + ::mlir::TypedValue<::mlir::TensorType> getGradientAccumulator(); + ::mlir::TypedValue<::mlir::TensorType> getGradientSquaredAccumulator(); + ::mlir::TypedValue<::mlir::TensorType> getGrad(); + ::mlir::TypedValue<::mlir::TensorType> getLr(); + ::mlir::TypedValue<::mlir::TensorType> getL1(); + ::mlir::TypedValue<::mlir::TensorType> getL2(); + ::mlir::TypedValue<::mlir::TensorType> getGlobalStep(); + ::mlir::OpOperand &getVarMutable(); + ::mlir::OpOperand &getGradientAccumulatorMutable(); + ::mlir::OpOperand &getGradientSquaredAccumulatorMutable(); + ::mlir::OpOperand &getGradMutable(); + ::mlir::OpOperand &getLrMutable(); + ::mlir::OpOperand &getL1Mutable(); + ::mlir::OpOperand &getL2Mutable(); + ::mlir::OpOperand &getGlobalStepMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setUseLockingAttr(::mlir::BoolAttr attr); + void setUseLocking(::std::optional attrValue); + ::mlir::Attribute removeUseLockingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value gradient_accumulator, ::mlir::Value gradient_squared_accumulator, ::mlir::Value grad, ::mlir::Value lr, ::mlir::Value l1, ::mlir::Value l2, ::mlir::Value global_step, /*optional*/::mlir::BoolAttr use_locking); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value gradient_accumulator, ::mlir::Value gradient_squared_accumulator, ::mlir::Value grad, ::mlir::Value lr, ::mlir::Value l1, ::mlir::Value l2, ::mlir::Value global_step, /*optional*/::mlir::BoolAttr use_locking); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value gradient_accumulator, ::mlir::Value gradient_squared_accumulator, ::mlir::Value grad, ::mlir::Value lr, ::mlir::Value l1, ::mlir::Value l2, ::mlir::Value global_step, /*optional*/bool use_locking = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value gradient_accumulator, ::mlir::Value gradient_squared_accumulator, ::mlir::Value grad, ::mlir::Value lr, ::mlir::Value l1, ::mlir::Value l2, ::mlir::Value global_step, /*optional*/bool use_locking = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceApplyAdagradDAOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceApplyAdagradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceApplyAdagradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceApplyAdagradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceApplyAdagradOpGenericAdaptorBase(ResourceApplyAdagradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::BoolAttr getUpdateSlotsAttr(); + bool getUpdateSlots(); +}; +} // namespace detail +template +class ResourceApplyAdagradOpGenericAdaptor : public detail::ResourceApplyAdagradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceApplyAdagradOpGenericAdaptorBase; +public: + ResourceApplyAdagradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceApplyAdagradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceApplyAdagradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceApplyAdagradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVar() { + return (*getODSOperands(0).begin()); + } + + ValueT getAccum() { + return (*getODSOperands(1).begin()); + } + + ValueT getLr() { + return (*getODSOperands(2).begin()); + } + + ValueT getGrad() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceApplyAdagradOpAdaptor : public ResourceApplyAdagradOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceApplyAdagradOpGenericAdaptor::ResourceApplyAdagradOpGenericAdaptor; + ResourceApplyAdagradOpAdaptor(ResourceApplyAdagradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceApplyAdagradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceApplyAdagradOpAdaptor; + template + using GenericAdaptor = ResourceApplyAdagradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("update_slots"), ::llvm::StringRef("use_locking")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getUpdateSlotsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getUpdateSlotsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getUseLockingAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getUseLockingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceApplyAdagrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getVar(); + ::mlir::TypedValue<::mlir::TensorType> getAccum(); + ::mlir::TypedValue<::mlir::TensorType> getLr(); + ::mlir::TypedValue<::mlir::TensorType> getGrad(); + ::mlir::OpOperand &getVarMutable(); + ::mlir::OpOperand &getAccumMutable(); + ::mlir::OpOperand &getLrMutable(); + ::mlir::OpOperand &getGradMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::BoolAttr getUpdateSlotsAttr(); + bool getUpdateSlots(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setUseLockingAttr(::mlir::BoolAttr attr); + void setUseLocking(::std::optional attrValue); + void setUpdateSlotsAttr(::mlir::BoolAttr attr); + void setUpdateSlots(::std::optional attrValue); + ::mlir::Attribute removeUseLockingAttr(); + ::mlir::Attribute removeUpdateSlotsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value lr, ::mlir::Value grad, /*optional*/::mlir::BoolAttr use_locking, /*optional*/::mlir::BoolAttr update_slots); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value lr, ::mlir::Value grad, /*optional*/::mlir::BoolAttr use_locking, /*optional*/::mlir::BoolAttr update_slots); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value lr, ::mlir::Value grad, /*optional*/bool use_locking = false, /*optional*/bool update_slots = true); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value lr, ::mlir::Value grad, /*optional*/bool use_locking = false, /*optional*/bool update_slots = true); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceApplyAdagradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceApplyAdagradV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceApplyAdagradV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceApplyAdagradV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceApplyAdagradV2OpGenericAdaptorBase(ResourceApplyAdagradV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::BoolAttr getUpdateSlotsAttr(); + bool getUpdateSlots(); +}; +} // namespace detail +template +class ResourceApplyAdagradV2OpGenericAdaptor : public detail::ResourceApplyAdagradV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceApplyAdagradV2OpGenericAdaptorBase; +public: + ResourceApplyAdagradV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceApplyAdagradV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceApplyAdagradV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceApplyAdagradV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVar() { + return (*getODSOperands(0).begin()); + } + + ValueT getAccum() { + return (*getODSOperands(1).begin()); + } + + ValueT getLr() { + return (*getODSOperands(2).begin()); + } + + ValueT getEpsilon() { + return (*getODSOperands(3).begin()); + } + + ValueT getGrad() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceApplyAdagradV2OpAdaptor : public ResourceApplyAdagradV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceApplyAdagradV2OpGenericAdaptor::ResourceApplyAdagradV2OpGenericAdaptor; + ResourceApplyAdagradV2OpAdaptor(ResourceApplyAdagradV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceApplyAdagradV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceApplyAdagradV2OpAdaptor; + template + using GenericAdaptor = ResourceApplyAdagradV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("update_slots"), ::llvm::StringRef("use_locking")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getUpdateSlotsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getUpdateSlotsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getUseLockingAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getUseLockingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceApplyAdagradV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getVar(); + ::mlir::TypedValue<::mlir::TensorType> getAccum(); + ::mlir::TypedValue<::mlir::TensorType> getLr(); + ::mlir::TypedValue<::mlir::TensorType> getEpsilon(); + ::mlir::TypedValue<::mlir::TensorType> getGrad(); + ::mlir::OpOperand &getVarMutable(); + ::mlir::OpOperand &getAccumMutable(); + ::mlir::OpOperand &getLrMutable(); + ::mlir::OpOperand &getEpsilonMutable(); + ::mlir::OpOperand &getGradMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::BoolAttr getUpdateSlotsAttr(); + bool getUpdateSlots(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setUseLockingAttr(::mlir::BoolAttr attr); + void setUseLocking(::std::optional attrValue); + void setUpdateSlotsAttr(::mlir::BoolAttr attr); + void setUpdateSlots(::std::optional attrValue); + ::mlir::Attribute removeUseLockingAttr(); + ::mlir::Attribute removeUpdateSlotsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value lr, ::mlir::Value epsilon, ::mlir::Value grad, /*optional*/::mlir::BoolAttr use_locking, /*optional*/::mlir::BoolAttr update_slots); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value lr, ::mlir::Value epsilon, ::mlir::Value grad, /*optional*/::mlir::BoolAttr use_locking, /*optional*/::mlir::BoolAttr update_slots); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value lr, ::mlir::Value epsilon, ::mlir::Value grad, /*optional*/bool use_locking = false, /*optional*/bool update_slots = true); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value lr, ::mlir::Value epsilon, ::mlir::Value grad, /*optional*/bool use_locking = false, /*optional*/bool update_slots = true); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceApplyAdagradV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceApplyAdamOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceApplyAdamOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceApplyAdamOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceApplyAdamOpGenericAdaptorBase(ResourceApplyAdamOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::BoolAttr getUseNesterovAttr(); + bool getUseNesterov(); +}; +} // namespace detail +template +class ResourceApplyAdamOpGenericAdaptor : public detail::ResourceApplyAdamOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceApplyAdamOpGenericAdaptorBase; +public: + ResourceApplyAdamOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceApplyAdamOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceApplyAdamOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceApplyAdamOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVar() { + return (*getODSOperands(0).begin()); + } + + ValueT getM() { + return (*getODSOperands(1).begin()); + } + + ValueT getV() { + return (*getODSOperands(2).begin()); + } + + ValueT getBeta1Power() { + return (*getODSOperands(3).begin()); + } + + ValueT getBeta2Power() { + return (*getODSOperands(4).begin()); + } + + ValueT getLr() { + return (*getODSOperands(5).begin()); + } + + ValueT getBeta1() { + return (*getODSOperands(6).begin()); + } + + ValueT getBeta2() { + return (*getODSOperands(7).begin()); + } + + ValueT getEpsilon() { + return (*getODSOperands(8).begin()); + } + + ValueT getGrad() { + return (*getODSOperands(9).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceApplyAdamOpAdaptor : public ResourceApplyAdamOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceApplyAdamOpGenericAdaptor::ResourceApplyAdamOpGenericAdaptor; + ResourceApplyAdamOpAdaptor(ResourceApplyAdamOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceApplyAdamOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceApplyAdamOpAdaptor; + template + using GenericAdaptor = ResourceApplyAdamOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("use_locking"), ::llvm::StringRef("use_nesterov")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getUseLockingAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getUseLockingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getUseNesterovAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getUseNesterovAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceApplyAdam"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getVar(); + ::mlir::TypedValue<::mlir::TensorType> getM(); + ::mlir::TypedValue<::mlir::TensorType> getV(); + ::mlir::TypedValue<::mlir::TensorType> getBeta1Power(); + ::mlir::TypedValue<::mlir::TensorType> getBeta2Power(); + ::mlir::TypedValue<::mlir::TensorType> getLr(); + ::mlir::TypedValue<::mlir::TensorType> getBeta1(); + ::mlir::TypedValue<::mlir::TensorType> getBeta2(); + ::mlir::TypedValue<::mlir::TensorType> getEpsilon(); + ::mlir::TypedValue<::mlir::TensorType> getGrad(); + ::mlir::OpOperand &getVarMutable(); + ::mlir::OpOperand &getMMutable(); + ::mlir::OpOperand &getVMutable(); + ::mlir::OpOperand &getBeta1PowerMutable(); + ::mlir::OpOperand &getBeta2PowerMutable(); + ::mlir::OpOperand &getLrMutable(); + ::mlir::OpOperand &getBeta1Mutable(); + ::mlir::OpOperand &getBeta2Mutable(); + ::mlir::OpOperand &getEpsilonMutable(); + ::mlir::OpOperand &getGradMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::BoolAttr getUseNesterovAttr(); + bool getUseNesterov(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setUseLockingAttr(::mlir::BoolAttr attr); + void setUseLocking(::std::optional attrValue); + void setUseNesterovAttr(::mlir::BoolAttr attr); + void setUseNesterov(::std::optional attrValue); + ::mlir::Attribute removeUseLockingAttr(); + ::mlir::Attribute removeUseNesterovAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value m, ::mlir::Value v, ::mlir::Value beta1_power, ::mlir::Value beta2_power, ::mlir::Value lr, ::mlir::Value beta1, ::mlir::Value beta2, ::mlir::Value epsilon, ::mlir::Value grad, /*optional*/::mlir::BoolAttr use_locking, /*optional*/::mlir::BoolAttr use_nesterov); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value m, ::mlir::Value v, ::mlir::Value beta1_power, ::mlir::Value beta2_power, ::mlir::Value lr, ::mlir::Value beta1, ::mlir::Value beta2, ::mlir::Value epsilon, ::mlir::Value grad, /*optional*/::mlir::BoolAttr use_locking, /*optional*/::mlir::BoolAttr use_nesterov); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value m, ::mlir::Value v, ::mlir::Value beta1_power, ::mlir::Value beta2_power, ::mlir::Value lr, ::mlir::Value beta1, ::mlir::Value beta2, ::mlir::Value epsilon, ::mlir::Value grad, /*optional*/bool use_locking = false, /*optional*/bool use_nesterov = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value m, ::mlir::Value v, ::mlir::Value beta1_power, ::mlir::Value beta2_power, ::mlir::Value lr, ::mlir::Value beta1, ::mlir::Value beta2, ::mlir::Value epsilon, ::mlir::Value grad, /*optional*/bool use_locking = false, /*optional*/bool use_nesterov = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceApplyAdamOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceApplyAddSignOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceApplyAddSignOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceApplyAddSignOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceApplyAddSignOpGenericAdaptorBase(ResourceApplyAddSignOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); +}; +} // namespace detail +template +class ResourceApplyAddSignOpGenericAdaptor : public detail::ResourceApplyAddSignOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceApplyAddSignOpGenericAdaptorBase; +public: + ResourceApplyAddSignOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceApplyAddSignOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceApplyAddSignOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceApplyAddSignOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVar() { + return (*getODSOperands(0).begin()); + } + + ValueT getM() { + return (*getODSOperands(1).begin()); + } + + ValueT getLr() { + return (*getODSOperands(2).begin()); + } + + ValueT getAlpha() { + return (*getODSOperands(3).begin()); + } + + ValueT getSignDecay() { + return (*getODSOperands(4).begin()); + } + + ValueT getBeta() { + return (*getODSOperands(5).begin()); + } + + ValueT getGrad() { + return (*getODSOperands(6).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceApplyAddSignOpAdaptor : public ResourceApplyAddSignOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceApplyAddSignOpGenericAdaptor::ResourceApplyAddSignOpGenericAdaptor; + ResourceApplyAddSignOpAdaptor(ResourceApplyAddSignOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceApplyAddSignOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceApplyAddSignOpAdaptor; + template + using GenericAdaptor = ResourceApplyAddSignOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("use_locking")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getUseLockingAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getUseLockingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceApplyAddSign"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getVar(); + ::mlir::TypedValue<::mlir::TensorType> getM(); + ::mlir::TypedValue<::mlir::TensorType> getLr(); + ::mlir::TypedValue<::mlir::TensorType> getAlpha(); + ::mlir::TypedValue<::mlir::TensorType> getSignDecay(); + ::mlir::TypedValue<::mlir::TensorType> getBeta(); + ::mlir::TypedValue<::mlir::TensorType> getGrad(); + ::mlir::OpOperand &getVarMutable(); + ::mlir::OpOperand &getMMutable(); + ::mlir::OpOperand &getLrMutable(); + ::mlir::OpOperand &getAlphaMutable(); + ::mlir::OpOperand &getSignDecayMutable(); + ::mlir::OpOperand &getBetaMutable(); + ::mlir::OpOperand &getGradMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setUseLockingAttr(::mlir::BoolAttr attr); + void setUseLocking(::std::optional attrValue); + ::mlir::Attribute removeUseLockingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value m, ::mlir::Value lr, ::mlir::Value alpha, ::mlir::Value sign_decay, ::mlir::Value beta, ::mlir::Value grad, /*optional*/::mlir::BoolAttr use_locking); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value m, ::mlir::Value lr, ::mlir::Value alpha, ::mlir::Value sign_decay, ::mlir::Value beta, ::mlir::Value grad, /*optional*/::mlir::BoolAttr use_locking); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value m, ::mlir::Value lr, ::mlir::Value alpha, ::mlir::Value sign_decay, ::mlir::Value beta, ::mlir::Value grad, /*optional*/bool use_locking = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value m, ::mlir::Value lr, ::mlir::Value alpha, ::mlir::Value sign_decay, ::mlir::Value beta, ::mlir::Value grad, /*optional*/bool use_locking = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceApplyAddSignOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceApplyCenteredRMSPropOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceApplyCenteredRMSPropOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceApplyCenteredRMSPropOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceApplyCenteredRMSPropOpGenericAdaptorBase(ResourceApplyCenteredRMSPropOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); +}; +} // namespace detail +template +class ResourceApplyCenteredRMSPropOpGenericAdaptor : public detail::ResourceApplyCenteredRMSPropOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceApplyCenteredRMSPropOpGenericAdaptorBase; +public: + ResourceApplyCenteredRMSPropOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceApplyCenteredRMSPropOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceApplyCenteredRMSPropOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceApplyCenteredRMSPropOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVar() { + return (*getODSOperands(0).begin()); + } + + ValueT getMg() { + return (*getODSOperands(1).begin()); + } + + ValueT getMs() { + return (*getODSOperands(2).begin()); + } + + ValueT getMom() { + return (*getODSOperands(3).begin()); + } + + ValueT getLr() { + return (*getODSOperands(4).begin()); + } + + ValueT getRho() { + return (*getODSOperands(5).begin()); + } + + ValueT getMomentum() { + return (*getODSOperands(6).begin()); + } + + ValueT getEpsilon() { + return (*getODSOperands(7).begin()); + } + + ValueT getGrad() { + return (*getODSOperands(8).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceApplyCenteredRMSPropOpAdaptor : public ResourceApplyCenteredRMSPropOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceApplyCenteredRMSPropOpGenericAdaptor::ResourceApplyCenteredRMSPropOpGenericAdaptor; + ResourceApplyCenteredRMSPropOpAdaptor(ResourceApplyCenteredRMSPropOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceApplyCenteredRMSPropOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceApplyCenteredRMSPropOpAdaptor; + template + using GenericAdaptor = ResourceApplyCenteredRMSPropOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("use_locking")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getUseLockingAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getUseLockingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceApplyCenteredRMSProp"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getVar(); + ::mlir::TypedValue<::mlir::TensorType> getMg(); + ::mlir::TypedValue<::mlir::TensorType> getMs(); + ::mlir::TypedValue<::mlir::TensorType> getMom(); + ::mlir::TypedValue<::mlir::TensorType> getLr(); + ::mlir::TypedValue<::mlir::TensorType> getRho(); + ::mlir::TypedValue<::mlir::TensorType> getMomentum(); + ::mlir::TypedValue<::mlir::TensorType> getEpsilon(); + ::mlir::TypedValue<::mlir::TensorType> getGrad(); + ::mlir::OpOperand &getVarMutable(); + ::mlir::OpOperand &getMgMutable(); + ::mlir::OpOperand &getMsMutable(); + ::mlir::OpOperand &getMomMutable(); + ::mlir::OpOperand &getLrMutable(); + ::mlir::OpOperand &getRhoMutable(); + ::mlir::OpOperand &getMomentumMutable(); + ::mlir::OpOperand &getEpsilonMutable(); + ::mlir::OpOperand &getGradMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setUseLockingAttr(::mlir::BoolAttr attr); + void setUseLocking(::std::optional attrValue); + ::mlir::Attribute removeUseLockingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value mg, ::mlir::Value ms, ::mlir::Value mom, ::mlir::Value lr, ::mlir::Value rho, ::mlir::Value momentum, ::mlir::Value epsilon, ::mlir::Value grad, /*optional*/::mlir::BoolAttr use_locking); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value mg, ::mlir::Value ms, ::mlir::Value mom, ::mlir::Value lr, ::mlir::Value rho, ::mlir::Value momentum, ::mlir::Value epsilon, ::mlir::Value grad, /*optional*/::mlir::BoolAttr use_locking); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value mg, ::mlir::Value ms, ::mlir::Value mom, ::mlir::Value lr, ::mlir::Value rho, ::mlir::Value momentum, ::mlir::Value epsilon, ::mlir::Value grad, /*optional*/bool use_locking = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value mg, ::mlir::Value ms, ::mlir::Value mom, ::mlir::Value lr, ::mlir::Value rho, ::mlir::Value momentum, ::mlir::Value epsilon, ::mlir::Value grad, /*optional*/bool use_locking = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceApplyCenteredRMSPropOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceApplyFtrlOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceApplyFtrlOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceApplyFtrlOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceApplyFtrlOpGenericAdaptorBase(ResourceApplyFtrlOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::BoolAttr getMultiplyLinearByLrAttr(); + bool getMultiplyLinearByLr(); +}; +} // namespace detail +template +class ResourceApplyFtrlOpGenericAdaptor : public detail::ResourceApplyFtrlOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceApplyFtrlOpGenericAdaptorBase; +public: + ResourceApplyFtrlOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceApplyFtrlOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceApplyFtrlOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceApplyFtrlOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVar() { + return (*getODSOperands(0).begin()); + } + + ValueT getAccum() { + return (*getODSOperands(1).begin()); + } + + ValueT getLinear() { + return (*getODSOperands(2).begin()); + } + + ValueT getGrad() { + return (*getODSOperands(3).begin()); + } + + ValueT getLr() { + return (*getODSOperands(4).begin()); + } + + ValueT getL1() { + return (*getODSOperands(5).begin()); + } + + ValueT getL2() { + return (*getODSOperands(6).begin()); + } + + ValueT getLrPower() { + return (*getODSOperands(7).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceApplyFtrlOpAdaptor : public ResourceApplyFtrlOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceApplyFtrlOpGenericAdaptor::ResourceApplyFtrlOpGenericAdaptor; + ResourceApplyFtrlOpAdaptor(ResourceApplyFtrlOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceApplyFtrlOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceApplyFtrlOpAdaptor; + template + using GenericAdaptor = ResourceApplyFtrlOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("multiply_linear_by_lr"), ::llvm::StringRef("use_locking")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getMultiplyLinearByLrAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getMultiplyLinearByLrAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getUseLockingAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getUseLockingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceApplyFtrl"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getVar(); + ::mlir::TypedValue<::mlir::TensorType> getAccum(); + ::mlir::TypedValue<::mlir::TensorType> getLinear(); + ::mlir::TypedValue<::mlir::TensorType> getGrad(); + ::mlir::TypedValue<::mlir::TensorType> getLr(); + ::mlir::TypedValue<::mlir::TensorType> getL1(); + ::mlir::TypedValue<::mlir::TensorType> getL2(); + ::mlir::TypedValue<::mlir::TensorType> getLrPower(); + ::mlir::OpOperand &getVarMutable(); + ::mlir::OpOperand &getAccumMutable(); + ::mlir::OpOperand &getLinearMutable(); + ::mlir::OpOperand &getGradMutable(); + ::mlir::OpOperand &getLrMutable(); + ::mlir::OpOperand &getL1Mutable(); + ::mlir::OpOperand &getL2Mutable(); + ::mlir::OpOperand &getLrPowerMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::BoolAttr getMultiplyLinearByLrAttr(); + bool getMultiplyLinearByLr(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setUseLockingAttr(::mlir::BoolAttr attr); + void setUseLocking(::std::optional attrValue); + void setMultiplyLinearByLrAttr(::mlir::BoolAttr attr); + void setMultiplyLinearByLr(::std::optional attrValue); + ::mlir::Attribute removeUseLockingAttr(); + ::mlir::Attribute removeMultiplyLinearByLrAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value linear, ::mlir::Value grad, ::mlir::Value lr, ::mlir::Value l1, ::mlir::Value l2, ::mlir::Value lr_power, /*optional*/::mlir::BoolAttr use_locking, /*optional*/::mlir::BoolAttr multiply_linear_by_lr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value linear, ::mlir::Value grad, ::mlir::Value lr, ::mlir::Value l1, ::mlir::Value l2, ::mlir::Value lr_power, /*optional*/::mlir::BoolAttr use_locking, /*optional*/::mlir::BoolAttr multiply_linear_by_lr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value linear, ::mlir::Value grad, ::mlir::Value lr, ::mlir::Value l1, ::mlir::Value l2, ::mlir::Value lr_power, /*optional*/bool use_locking = false, /*optional*/bool multiply_linear_by_lr = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value linear, ::mlir::Value grad, ::mlir::Value lr, ::mlir::Value l1, ::mlir::Value l2, ::mlir::Value lr_power, /*optional*/bool use_locking = false, /*optional*/bool multiply_linear_by_lr = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceApplyFtrlOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceApplyFtrlV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceApplyFtrlV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceApplyFtrlV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceApplyFtrlV2OpGenericAdaptorBase(ResourceApplyFtrlV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::BoolAttr getMultiplyLinearByLrAttr(); + bool getMultiplyLinearByLr(); +}; +} // namespace detail +template +class ResourceApplyFtrlV2OpGenericAdaptor : public detail::ResourceApplyFtrlV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceApplyFtrlV2OpGenericAdaptorBase; +public: + ResourceApplyFtrlV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceApplyFtrlV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceApplyFtrlV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceApplyFtrlV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVar() { + return (*getODSOperands(0).begin()); + } + + ValueT getAccum() { + return (*getODSOperands(1).begin()); + } + + ValueT getLinear() { + return (*getODSOperands(2).begin()); + } + + ValueT getGrad() { + return (*getODSOperands(3).begin()); + } + + ValueT getLr() { + return (*getODSOperands(4).begin()); + } + + ValueT getL1() { + return (*getODSOperands(5).begin()); + } + + ValueT getL2() { + return (*getODSOperands(6).begin()); + } + + ValueT getL2Shrinkage() { + return (*getODSOperands(7).begin()); + } + + ValueT getLrPower() { + return (*getODSOperands(8).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceApplyFtrlV2OpAdaptor : public ResourceApplyFtrlV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceApplyFtrlV2OpGenericAdaptor::ResourceApplyFtrlV2OpGenericAdaptor; + ResourceApplyFtrlV2OpAdaptor(ResourceApplyFtrlV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceApplyFtrlV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceApplyFtrlV2OpAdaptor; + template + using GenericAdaptor = ResourceApplyFtrlV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("multiply_linear_by_lr"), ::llvm::StringRef("use_locking")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getMultiplyLinearByLrAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getMultiplyLinearByLrAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getUseLockingAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getUseLockingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceApplyFtrlV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getVar(); + ::mlir::TypedValue<::mlir::TensorType> getAccum(); + ::mlir::TypedValue<::mlir::TensorType> getLinear(); + ::mlir::TypedValue<::mlir::TensorType> getGrad(); + ::mlir::TypedValue<::mlir::TensorType> getLr(); + ::mlir::TypedValue<::mlir::TensorType> getL1(); + ::mlir::TypedValue<::mlir::TensorType> getL2(); + ::mlir::TypedValue<::mlir::TensorType> getL2Shrinkage(); + ::mlir::TypedValue<::mlir::TensorType> getLrPower(); + ::mlir::OpOperand &getVarMutable(); + ::mlir::OpOperand &getAccumMutable(); + ::mlir::OpOperand &getLinearMutable(); + ::mlir::OpOperand &getGradMutable(); + ::mlir::OpOperand &getLrMutable(); + ::mlir::OpOperand &getL1Mutable(); + ::mlir::OpOperand &getL2Mutable(); + ::mlir::OpOperand &getL2ShrinkageMutable(); + ::mlir::OpOperand &getLrPowerMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::BoolAttr getMultiplyLinearByLrAttr(); + bool getMultiplyLinearByLr(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setUseLockingAttr(::mlir::BoolAttr attr); + void setUseLocking(::std::optional attrValue); + void setMultiplyLinearByLrAttr(::mlir::BoolAttr attr); + void setMultiplyLinearByLr(::std::optional attrValue); + ::mlir::Attribute removeUseLockingAttr(); + ::mlir::Attribute removeMultiplyLinearByLrAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value linear, ::mlir::Value grad, ::mlir::Value lr, ::mlir::Value l1, ::mlir::Value l2, ::mlir::Value l2_shrinkage, ::mlir::Value lr_power, /*optional*/::mlir::BoolAttr use_locking, /*optional*/::mlir::BoolAttr multiply_linear_by_lr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value linear, ::mlir::Value grad, ::mlir::Value lr, ::mlir::Value l1, ::mlir::Value l2, ::mlir::Value l2_shrinkage, ::mlir::Value lr_power, /*optional*/::mlir::BoolAttr use_locking, /*optional*/::mlir::BoolAttr multiply_linear_by_lr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value linear, ::mlir::Value grad, ::mlir::Value lr, ::mlir::Value l1, ::mlir::Value l2, ::mlir::Value l2_shrinkage, ::mlir::Value lr_power, /*optional*/bool use_locking = false, /*optional*/bool multiply_linear_by_lr = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value linear, ::mlir::Value grad, ::mlir::Value lr, ::mlir::Value l1, ::mlir::Value l2, ::mlir::Value l2_shrinkage, ::mlir::Value lr_power, /*optional*/bool use_locking = false, /*optional*/bool multiply_linear_by_lr = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceApplyFtrlV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceApplyGradientDescentOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceApplyGradientDescentOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceApplyGradientDescentOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceApplyGradientDescentOpGenericAdaptorBase(ResourceApplyGradientDescentOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); +}; +} // namespace detail +template +class ResourceApplyGradientDescentOpGenericAdaptor : public detail::ResourceApplyGradientDescentOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceApplyGradientDescentOpGenericAdaptorBase; +public: + ResourceApplyGradientDescentOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceApplyGradientDescentOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceApplyGradientDescentOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceApplyGradientDescentOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVar() { + return (*getODSOperands(0).begin()); + } + + ValueT getAlpha() { + return (*getODSOperands(1).begin()); + } + + ValueT getDelta() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceApplyGradientDescentOpAdaptor : public ResourceApplyGradientDescentOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceApplyGradientDescentOpGenericAdaptor::ResourceApplyGradientDescentOpGenericAdaptor; + ResourceApplyGradientDescentOpAdaptor(ResourceApplyGradientDescentOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceApplyGradientDescentOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceApplyGradientDescentOpAdaptor; + template + using GenericAdaptor = ResourceApplyGradientDescentOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("use_locking")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getUseLockingAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getUseLockingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceApplyGradientDescent"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getVar(); + ::mlir::TypedValue<::mlir::TensorType> getAlpha(); + ::mlir::TypedValue<::mlir::TensorType> getDelta(); + ::mlir::OpOperand &getVarMutable(); + ::mlir::OpOperand &getAlphaMutable(); + ::mlir::OpOperand &getDeltaMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setUseLockingAttr(::mlir::BoolAttr attr); + void setUseLocking(::std::optional attrValue); + ::mlir::Attribute removeUseLockingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value alpha, ::mlir::Value delta, /*optional*/::mlir::BoolAttr use_locking); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value alpha, ::mlir::Value delta, /*optional*/::mlir::BoolAttr use_locking); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value alpha, ::mlir::Value delta, /*optional*/bool use_locking = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value alpha, ::mlir::Value delta, /*optional*/bool use_locking = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceApplyGradientDescentOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceApplyKerasMomentumOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceApplyKerasMomentumOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceApplyKerasMomentumOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceApplyKerasMomentumOpGenericAdaptorBase(ResourceApplyKerasMomentumOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::BoolAttr getUseNesterovAttr(); + bool getUseNesterov(); +}; +} // namespace detail +template +class ResourceApplyKerasMomentumOpGenericAdaptor : public detail::ResourceApplyKerasMomentumOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceApplyKerasMomentumOpGenericAdaptorBase; +public: + ResourceApplyKerasMomentumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceApplyKerasMomentumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceApplyKerasMomentumOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceApplyKerasMomentumOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVar() { + return (*getODSOperands(0).begin()); + } + + ValueT getAccum() { + return (*getODSOperands(1).begin()); + } + + ValueT getLr() { + return (*getODSOperands(2).begin()); + } + + ValueT getGrad() { + return (*getODSOperands(3).begin()); + } + + ValueT getMomentum() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceApplyKerasMomentumOpAdaptor : public ResourceApplyKerasMomentumOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceApplyKerasMomentumOpGenericAdaptor::ResourceApplyKerasMomentumOpGenericAdaptor; + ResourceApplyKerasMomentumOpAdaptor(ResourceApplyKerasMomentumOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceApplyKerasMomentumOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceApplyKerasMomentumOpAdaptor; + template + using GenericAdaptor = ResourceApplyKerasMomentumOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("use_locking"), ::llvm::StringRef("use_nesterov")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getUseLockingAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getUseLockingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getUseNesterovAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getUseNesterovAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceApplyKerasMomentum"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getVar(); + ::mlir::TypedValue<::mlir::TensorType> getAccum(); + ::mlir::TypedValue<::mlir::TensorType> getLr(); + ::mlir::TypedValue<::mlir::TensorType> getGrad(); + ::mlir::TypedValue<::mlir::TensorType> getMomentum(); + ::mlir::OpOperand &getVarMutable(); + ::mlir::OpOperand &getAccumMutable(); + ::mlir::OpOperand &getLrMutable(); + ::mlir::OpOperand &getGradMutable(); + ::mlir::OpOperand &getMomentumMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::BoolAttr getUseNesterovAttr(); + bool getUseNesterov(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setUseLockingAttr(::mlir::BoolAttr attr); + void setUseLocking(::std::optional attrValue); + void setUseNesterovAttr(::mlir::BoolAttr attr); + void setUseNesterov(::std::optional attrValue); + ::mlir::Attribute removeUseLockingAttr(); + ::mlir::Attribute removeUseNesterovAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value lr, ::mlir::Value grad, ::mlir::Value momentum, /*optional*/::mlir::BoolAttr use_locking, /*optional*/::mlir::BoolAttr use_nesterov); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value lr, ::mlir::Value grad, ::mlir::Value momentum, /*optional*/::mlir::BoolAttr use_locking, /*optional*/::mlir::BoolAttr use_nesterov); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value lr, ::mlir::Value grad, ::mlir::Value momentum, /*optional*/bool use_locking = false, /*optional*/bool use_nesterov = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value lr, ::mlir::Value grad, ::mlir::Value momentum, /*optional*/bool use_locking = false, /*optional*/bool use_nesterov = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceApplyKerasMomentumOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceApplyMomentumOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceApplyMomentumOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceApplyMomentumOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceApplyMomentumOpGenericAdaptorBase(ResourceApplyMomentumOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::BoolAttr getUseNesterovAttr(); + bool getUseNesterov(); +}; +} // namespace detail +template +class ResourceApplyMomentumOpGenericAdaptor : public detail::ResourceApplyMomentumOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceApplyMomentumOpGenericAdaptorBase; +public: + ResourceApplyMomentumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceApplyMomentumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceApplyMomentumOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceApplyMomentumOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVar() { + return (*getODSOperands(0).begin()); + } + + ValueT getAccum() { + return (*getODSOperands(1).begin()); + } + + ValueT getLr() { + return (*getODSOperands(2).begin()); + } + + ValueT getGrad() { + return (*getODSOperands(3).begin()); + } + + ValueT getMomentum() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceApplyMomentumOpAdaptor : public ResourceApplyMomentumOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceApplyMomentumOpGenericAdaptor::ResourceApplyMomentumOpGenericAdaptor; + ResourceApplyMomentumOpAdaptor(ResourceApplyMomentumOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceApplyMomentumOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceApplyMomentumOpAdaptor; + template + using GenericAdaptor = ResourceApplyMomentumOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("use_locking"), ::llvm::StringRef("use_nesterov")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getUseLockingAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getUseLockingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getUseNesterovAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getUseNesterovAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceApplyMomentum"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getVar(); + ::mlir::TypedValue<::mlir::TensorType> getAccum(); + ::mlir::TypedValue<::mlir::TensorType> getLr(); + ::mlir::TypedValue<::mlir::TensorType> getGrad(); + ::mlir::TypedValue<::mlir::TensorType> getMomentum(); + ::mlir::OpOperand &getVarMutable(); + ::mlir::OpOperand &getAccumMutable(); + ::mlir::OpOperand &getLrMutable(); + ::mlir::OpOperand &getGradMutable(); + ::mlir::OpOperand &getMomentumMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::BoolAttr getUseNesterovAttr(); + bool getUseNesterov(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setUseLockingAttr(::mlir::BoolAttr attr); + void setUseLocking(::std::optional attrValue); + void setUseNesterovAttr(::mlir::BoolAttr attr); + void setUseNesterov(::std::optional attrValue); + ::mlir::Attribute removeUseLockingAttr(); + ::mlir::Attribute removeUseNesterovAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value lr, ::mlir::Value grad, ::mlir::Value momentum, /*optional*/::mlir::BoolAttr use_locking, /*optional*/::mlir::BoolAttr use_nesterov); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value lr, ::mlir::Value grad, ::mlir::Value momentum, /*optional*/::mlir::BoolAttr use_locking, /*optional*/::mlir::BoolAttr use_nesterov); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value lr, ::mlir::Value grad, ::mlir::Value momentum, /*optional*/bool use_locking = false, /*optional*/bool use_nesterov = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value lr, ::mlir::Value grad, ::mlir::Value momentum, /*optional*/bool use_locking = false, /*optional*/bool use_nesterov = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceApplyMomentumOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceApplyPowerSignOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceApplyPowerSignOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceApplyPowerSignOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceApplyPowerSignOpGenericAdaptorBase(ResourceApplyPowerSignOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); +}; +} // namespace detail +template +class ResourceApplyPowerSignOpGenericAdaptor : public detail::ResourceApplyPowerSignOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceApplyPowerSignOpGenericAdaptorBase; +public: + ResourceApplyPowerSignOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceApplyPowerSignOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceApplyPowerSignOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceApplyPowerSignOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVar() { + return (*getODSOperands(0).begin()); + } + + ValueT getM() { + return (*getODSOperands(1).begin()); + } + + ValueT getLr() { + return (*getODSOperands(2).begin()); + } + + ValueT getLogbase() { + return (*getODSOperands(3).begin()); + } + + ValueT getSignDecay() { + return (*getODSOperands(4).begin()); + } + + ValueT getBeta() { + return (*getODSOperands(5).begin()); + } + + ValueT getGrad() { + return (*getODSOperands(6).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceApplyPowerSignOpAdaptor : public ResourceApplyPowerSignOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceApplyPowerSignOpGenericAdaptor::ResourceApplyPowerSignOpGenericAdaptor; + ResourceApplyPowerSignOpAdaptor(ResourceApplyPowerSignOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceApplyPowerSignOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceApplyPowerSignOpAdaptor; + template + using GenericAdaptor = ResourceApplyPowerSignOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("use_locking")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getUseLockingAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getUseLockingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceApplyPowerSign"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getVar(); + ::mlir::TypedValue<::mlir::TensorType> getM(); + ::mlir::TypedValue<::mlir::TensorType> getLr(); + ::mlir::TypedValue<::mlir::TensorType> getLogbase(); + ::mlir::TypedValue<::mlir::TensorType> getSignDecay(); + ::mlir::TypedValue<::mlir::TensorType> getBeta(); + ::mlir::TypedValue<::mlir::TensorType> getGrad(); + ::mlir::OpOperand &getVarMutable(); + ::mlir::OpOperand &getMMutable(); + ::mlir::OpOperand &getLrMutable(); + ::mlir::OpOperand &getLogbaseMutable(); + ::mlir::OpOperand &getSignDecayMutable(); + ::mlir::OpOperand &getBetaMutable(); + ::mlir::OpOperand &getGradMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setUseLockingAttr(::mlir::BoolAttr attr); + void setUseLocking(::std::optional attrValue); + ::mlir::Attribute removeUseLockingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value m, ::mlir::Value lr, ::mlir::Value logbase, ::mlir::Value sign_decay, ::mlir::Value beta, ::mlir::Value grad, /*optional*/::mlir::BoolAttr use_locking); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value m, ::mlir::Value lr, ::mlir::Value logbase, ::mlir::Value sign_decay, ::mlir::Value beta, ::mlir::Value grad, /*optional*/::mlir::BoolAttr use_locking); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value m, ::mlir::Value lr, ::mlir::Value logbase, ::mlir::Value sign_decay, ::mlir::Value beta, ::mlir::Value grad, /*optional*/bool use_locking = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value m, ::mlir::Value lr, ::mlir::Value logbase, ::mlir::Value sign_decay, ::mlir::Value beta, ::mlir::Value grad, /*optional*/bool use_locking = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceApplyPowerSignOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceApplyProximalAdagradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceApplyProximalAdagradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceApplyProximalAdagradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceApplyProximalAdagradOpGenericAdaptorBase(ResourceApplyProximalAdagradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); +}; +} // namespace detail +template +class ResourceApplyProximalAdagradOpGenericAdaptor : public detail::ResourceApplyProximalAdagradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceApplyProximalAdagradOpGenericAdaptorBase; +public: + ResourceApplyProximalAdagradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceApplyProximalAdagradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceApplyProximalAdagradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceApplyProximalAdagradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVar() { + return (*getODSOperands(0).begin()); + } + + ValueT getAccum() { + return (*getODSOperands(1).begin()); + } + + ValueT getLr() { + return (*getODSOperands(2).begin()); + } + + ValueT getL1() { + return (*getODSOperands(3).begin()); + } + + ValueT getL2() { + return (*getODSOperands(4).begin()); + } + + ValueT getGrad() { + return (*getODSOperands(5).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceApplyProximalAdagradOpAdaptor : public ResourceApplyProximalAdagradOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceApplyProximalAdagradOpGenericAdaptor::ResourceApplyProximalAdagradOpGenericAdaptor; + ResourceApplyProximalAdagradOpAdaptor(ResourceApplyProximalAdagradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceApplyProximalAdagradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceApplyProximalAdagradOpAdaptor; + template + using GenericAdaptor = ResourceApplyProximalAdagradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("use_locking")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getUseLockingAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getUseLockingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceApplyProximalAdagrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getVar(); + ::mlir::TypedValue<::mlir::TensorType> getAccum(); + ::mlir::TypedValue<::mlir::TensorType> getLr(); + ::mlir::TypedValue<::mlir::TensorType> getL1(); + ::mlir::TypedValue<::mlir::TensorType> getL2(); + ::mlir::TypedValue<::mlir::TensorType> getGrad(); + ::mlir::OpOperand &getVarMutable(); + ::mlir::OpOperand &getAccumMutable(); + ::mlir::OpOperand &getLrMutable(); + ::mlir::OpOperand &getL1Mutable(); + ::mlir::OpOperand &getL2Mutable(); + ::mlir::OpOperand &getGradMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setUseLockingAttr(::mlir::BoolAttr attr); + void setUseLocking(::std::optional attrValue); + ::mlir::Attribute removeUseLockingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value lr, ::mlir::Value l1, ::mlir::Value l2, ::mlir::Value grad, /*optional*/::mlir::BoolAttr use_locking); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value lr, ::mlir::Value l1, ::mlir::Value l2, ::mlir::Value grad, /*optional*/::mlir::BoolAttr use_locking); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value lr, ::mlir::Value l1, ::mlir::Value l2, ::mlir::Value grad, /*optional*/bool use_locking = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value lr, ::mlir::Value l1, ::mlir::Value l2, ::mlir::Value grad, /*optional*/bool use_locking = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceApplyProximalAdagradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceApplyProximalGradientDescentOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceApplyProximalGradientDescentOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceApplyProximalGradientDescentOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceApplyProximalGradientDescentOpGenericAdaptorBase(ResourceApplyProximalGradientDescentOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); +}; +} // namespace detail +template +class ResourceApplyProximalGradientDescentOpGenericAdaptor : public detail::ResourceApplyProximalGradientDescentOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceApplyProximalGradientDescentOpGenericAdaptorBase; +public: + ResourceApplyProximalGradientDescentOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceApplyProximalGradientDescentOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceApplyProximalGradientDescentOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceApplyProximalGradientDescentOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVar() { + return (*getODSOperands(0).begin()); + } + + ValueT getAlpha() { + return (*getODSOperands(1).begin()); + } + + ValueT getL1() { + return (*getODSOperands(2).begin()); + } + + ValueT getL2() { + return (*getODSOperands(3).begin()); + } + + ValueT getDelta() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceApplyProximalGradientDescentOpAdaptor : public ResourceApplyProximalGradientDescentOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceApplyProximalGradientDescentOpGenericAdaptor::ResourceApplyProximalGradientDescentOpGenericAdaptor; + ResourceApplyProximalGradientDescentOpAdaptor(ResourceApplyProximalGradientDescentOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceApplyProximalGradientDescentOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceApplyProximalGradientDescentOpAdaptor; + template + using GenericAdaptor = ResourceApplyProximalGradientDescentOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("use_locking")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getUseLockingAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getUseLockingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceApplyProximalGradientDescent"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getVar(); + ::mlir::TypedValue<::mlir::TensorType> getAlpha(); + ::mlir::TypedValue<::mlir::TensorType> getL1(); + ::mlir::TypedValue<::mlir::TensorType> getL2(); + ::mlir::TypedValue<::mlir::TensorType> getDelta(); + ::mlir::OpOperand &getVarMutable(); + ::mlir::OpOperand &getAlphaMutable(); + ::mlir::OpOperand &getL1Mutable(); + ::mlir::OpOperand &getL2Mutable(); + ::mlir::OpOperand &getDeltaMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setUseLockingAttr(::mlir::BoolAttr attr); + void setUseLocking(::std::optional attrValue); + ::mlir::Attribute removeUseLockingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value alpha, ::mlir::Value l1, ::mlir::Value l2, ::mlir::Value delta, /*optional*/::mlir::BoolAttr use_locking); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value alpha, ::mlir::Value l1, ::mlir::Value l2, ::mlir::Value delta, /*optional*/::mlir::BoolAttr use_locking); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value alpha, ::mlir::Value l1, ::mlir::Value l2, ::mlir::Value delta, /*optional*/bool use_locking = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value alpha, ::mlir::Value l1, ::mlir::Value l2, ::mlir::Value delta, /*optional*/bool use_locking = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceApplyProximalGradientDescentOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceApplyRMSPropOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceApplyRMSPropOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceApplyRMSPropOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceApplyRMSPropOpGenericAdaptorBase(ResourceApplyRMSPropOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); +}; +} // namespace detail +template +class ResourceApplyRMSPropOpGenericAdaptor : public detail::ResourceApplyRMSPropOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceApplyRMSPropOpGenericAdaptorBase; +public: + ResourceApplyRMSPropOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceApplyRMSPropOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceApplyRMSPropOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceApplyRMSPropOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVar() { + return (*getODSOperands(0).begin()); + } + + ValueT getMs() { + return (*getODSOperands(1).begin()); + } + + ValueT getMom() { + return (*getODSOperands(2).begin()); + } + + ValueT getLr() { + return (*getODSOperands(3).begin()); + } + + ValueT getRho() { + return (*getODSOperands(4).begin()); + } + + ValueT getMomentum() { + return (*getODSOperands(5).begin()); + } + + ValueT getEpsilon() { + return (*getODSOperands(6).begin()); + } + + ValueT getGrad() { + return (*getODSOperands(7).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceApplyRMSPropOpAdaptor : public ResourceApplyRMSPropOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceApplyRMSPropOpGenericAdaptor::ResourceApplyRMSPropOpGenericAdaptor; + ResourceApplyRMSPropOpAdaptor(ResourceApplyRMSPropOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceApplyRMSPropOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceApplyRMSPropOpAdaptor; + template + using GenericAdaptor = ResourceApplyRMSPropOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("use_locking")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getUseLockingAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getUseLockingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceApplyRMSProp"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getVar(); + ::mlir::TypedValue<::mlir::TensorType> getMs(); + ::mlir::TypedValue<::mlir::TensorType> getMom(); + ::mlir::TypedValue<::mlir::TensorType> getLr(); + ::mlir::TypedValue<::mlir::TensorType> getRho(); + ::mlir::TypedValue<::mlir::TensorType> getMomentum(); + ::mlir::TypedValue<::mlir::TensorType> getEpsilon(); + ::mlir::TypedValue<::mlir::TensorType> getGrad(); + ::mlir::OpOperand &getVarMutable(); + ::mlir::OpOperand &getMsMutable(); + ::mlir::OpOperand &getMomMutable(); + ::mlir::OpOperand &getLrMutable(); + ::mlir::OpOperand &getRhoMutable(); + ::mlir::OpOperand &getMomentumMutable(); + ::mlir::OpOperand &getEpsilonMutable(); + ::mlir::OpOperand &getGradMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setUseLockingAttr(::mlir::BoolAttr attr); + void setUseLocking(::std::optional attrValue); + ::mlir::Attribute removeUseLockingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value ms, ::mlir::Value mom, ::mlir::Value lr, ::mlir::Value rho, ::mlir::Value momentum, ::mlir::Value epsilon, ::mlir::Value grad, /*optional*/::mlir::BoolAttr use_locking); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value ms, ::mlir::Value mom, ::mlir::Value lr, ::mlir::Value rho, ::mlir::Value momentum, ::mlir::Value epsilon, ::mlir::Value grad, /*optional*/::mlir::BoolAttr use_locking); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value ms, ::mlir::Value mom, ::mlir::Value lr, ::mlir::Value rho, ::mlir::Value momentum, ::mlir::Value epsilon, ::mlir::Value grad, /*optional*/bool use_locking = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value ms, ::mlir::Value mom, ::mlir::Value lr, ::mlir::Value rho, ::mlir::Value momentum, ::mlir::Value epsilon, ::mlir::Value grad, /*optional*/bool use_locking = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceApplyRMSPropOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceGatherNdOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceGatherNdOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceGatherNdOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceGatherNdOpGenericAdaptorBase(ResourceGatherNdOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ResourceGatherNdOpGenericAdaptor : public detail::ResourceGatherNdOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceGatherNdOpGenericAdaptorBase; +public: + ResourceGatherNdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceGatherNdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceGatherNdOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceGatherNdOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getResource() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceGatherNdOpAdaptor : public ResourceGatherNdOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceGatherNdOpGenericAdaptor::ResourceGatherNdOpGenericAdaptor; + ResourceGatherNdOpAdaptor(ResourceGatherNdOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceGatherNdOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceGatherNdOpAdaptor; + template + using GenericAdaptor = ResourceGatherNdOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tindices"), ::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceGatherNd"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResource(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::OpOperand &getResourceMutable(); + ::mlir::OpOperand &getIndicesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getTindices(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value resource, ::mlir::Value indices); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value resource, ::mlir::Value indices); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceGatherNdOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceGatherOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceGatherOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceGatherOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceGatherOpGenericAdaptorBase(ResourceGatherOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getBatchDimsAttr(); + uint64_t getBatchDims(); + ::mlir::BoolAttr getValidateIndicesAttr(); + bool getValidateIndices(); +}; +} // namespace detail +template +class ResourceGatherOpGenericAdaptor : public detail::ResourceGatherOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceGatherOpGenericAdaptorBase; +public: + ResourceGatherOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceGatherOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceGatherOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceGatherOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getResource() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceGatherOpAdaptor : public ResourceGatherOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceGatherOpGenericAdaptor::ResourceGatherOpGenericAdaptor; + ResourceGatherOpAdaptor(ResourceGatherOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceGatherOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceGatherOpAdaptor; + template + using GenericAdaptor = ResourceGatherOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tindices"), ::llvm::StringRef("batch_dims"), ::llvm::StringRef("dtype"), ::llvm::StringRef("validate_indices")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getBatchDimsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getBatchDimsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getValidateIndicesAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getValidateIndicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceGather"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResource(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::OpOperand &getResourceMutable(); + ::mlir::OpOperand &getIndicesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getBatchDimsAttr(); + uint64_t getBatchDims(); + ::mlir::BoolAttr getValidateIndicesAttr(); + bool getValidateIndices(); + ::mlir::Type getTindices(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setBatchDimsAttr(::mlir::IntegerAttr attr); + void setBatchDims(::std::optional attrValue); + void setValidateIndicesAttr(::mlir::BoolAttr attr); + void setValidateIndices(::std::optional attrValue); + ::mlir::Attribute removeBatchDimsAttr(); + ::mlir::Attribute removeValidateIndicesAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value resource, ::mlir::Value indices, /*optional*/::mlir::IntegerAttr batch_dims, /*optional*/::mlir::BoolAttr validate_indices); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value resource, ::mlir::Value indices, /*optional*/::mlir::IntegerAttr batch_dims, /*optional*/::mlir::BoolAttr validate_indices); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value resource, ::mlir::Value indices, /*optional*/uint64_t batch_dims = 0, /*optional*/bool validate_indices = true); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value resource, ::mlir::Value indices, /*optional*/uint64_t batch_dims = 0, /*optional*/bool validate_indices = true); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceGatherOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceScatterAddOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceScatterAddOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceScatterAddOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceScatterAddOpGenericAdaptorBase(ResourceScatterAddOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ResourceScatterAddOpGenericAdaptor : public detail::ResourceScatterAddOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceScatterAddOpGenericAdaptorBase; +public: + ResourceScatterAddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceScatterAddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceScatterAddOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceScatterAddOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getResource() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getUpdates() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceScatterAddOpAdaptor : public ResourceScatterAddOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceScatterAddOpGenericAdaptor::ResourceScatterAddOpGenericAdaptor; + ResourceScatterAddOpAdaptor(ResourceScatterAddOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceScatterAddOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceScatterAddOpAdaptor; + template + using GenericAdaptor = ResourceScatterAddOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tindices"), ::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceScatterAdd"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResource(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getUpdates(); + ::mlir::OpOperand &getResourceMutable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getUpdatesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Type getTindices(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value resource, ::mlir::Value indices, ::mlir::Value updates); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value resource, ::mlir::Value indices, ::mlir::Value updates); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceScatterAddOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceScatterDivOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceScatterDivOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceScatterDivOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceScatterDivOpGenericAdaptorBase(ResourceScatterDivOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ResourceScatterDivOpGenericAdaptor : public detail::ResourceScatterDivOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceScatterDivOpGenericAdaptorBase; +public: + ResourceScatterDivOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceScatterDivOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceScatterDivOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceScatterDivOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getResource() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getUpdates() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceScatterDivOpAdaptor : public ResourceScatterDivOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceScatterDivOpGenericAdaptor::ResourceScatterDivOpGenericAdaptor; + ResourceScatterDivOpAdaptor(ResourceScatterDivOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceScatterDivOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceScatterDivOpAdaptor; + template + using GenericAdaptor = ResourceScatterDivOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tindices"), ::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceScatterDiv"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResource(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getUpdates(); + ::mlir::OpOperand &getResourceMutable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getUpdatesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Type getTindices(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value resource, ::mlir::Value indices, ::mlir::Value updates); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value resource, ::mlir::Value indices, ::mlir::Value updates); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceScatterDivOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceScatterMaxOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceScatterMaxOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceScatterMaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceScatterMaxOpGenericAdaptorBase(ResourceScatterMaxOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ResourceScatterMaxOpGenericAdaptor : public detail::ResourceScatterMaxOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceScatterMaxOpGenericAdaptorBase; +public: + ResourceScatterMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceScatterMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceScatterMaxOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceScatterMaxOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getResource() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getUpdates() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceScatterMaxOpAdaptor : public ResourceScatterMaxOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceScatterMaxOpGenericAdaptor::ResourceScatterMaxOpGenericAdaptor; + ResourceScatterMaxOpAdaptor(ResourceScatterMaxOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceScatterMaxOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceScatterMaxOpAdaptor; + template + using GenericAdaptor = ResourceScatterMaxOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tindices"), ::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceScatterMax"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResource(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getUpdates(); + ::mlir::OpOperand &getResourceMutable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getUpdatesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Type getTindices(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value resource, ::mlir::Value indices, ::mlir::Value updates); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value resource, ::mlir::Value indices, ::mlir::Value updates); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceScatterMaxOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceScatterMinOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceScatterMinOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceScatterMinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceScatterMinOpGenericAdaptorBase(ResourceScatterMinOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ResourceScatterMinOpGenericAdaptor : public detail::ResourceScatterMinOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceScatterMinOpGenericAdaptorBase; +public: + ResourceScatterMinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceScatterMinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceScatterMinOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceScatterMinOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getResource() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getUpdates() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceScatterMinOpAdaptor : public ResourceScatterMinOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceScatterMinOpGenericAdaptor::ResourceScatterMinOpGenericAdaptor; + ResourceScatterMinOpAdaptor(ResourceScatterMinOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceScatterMinOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceScatterMinOpAdaptor; + template + using GenericAdaptor = ResourceScatterMinOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tindices"), ::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceScatterMin"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResource(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getUpdates(); + ::mlir::OpOperand &getResourceMutable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getUpdatesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Type getTindices(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value resource, ::mlir::Value indices, ::mlir::Value updates); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value resource, ::mlir::Value indices, ::mlir::Value updates); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceScatterMinOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceScatterMulOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceScatterMulOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceScatterMulOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceScatterMulOpGenericAdaptorBase(ResourceScatterMulOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ResourceScatterMulOpGenericAdaptor : public detail::ResourceScatterMulOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceScatterMulOpGenericAdaptorBase; +public: + ResourceScatterMulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceScatterMulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceScatterMulOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceScatterMulOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getResource() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getUpdates() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceScatterMulOpAdaptor : public ResourceScatterMulOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceScatterMulOpGenericAdaptor::ResourceScatterMulOpGenericAdaptor; + ResourceScatterMulOpAdaptor(ResourceScatterMulOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceScatterMulOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceScatterMulOpAdaptor; + template + using GenericAdaptor = ResourceScatterMulOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tindices"), ::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceScatterMul"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResource(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getUpdates(); + ::mlir::OpOperand &getResourceMutable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getUpdatesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Type getTindices(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value resource, ::mlir::Value indices, ::mlir::Value updates); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value resource, ::mlir::Value indices, ::mlir::Value updates); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceScatterMulOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceScatterNdAddOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceScatterNdAddOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceScatterNdAddOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceScatterNdAddOpGenericAdaptorBase(ResourceScatterNdAddOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); +}; +} // namespace detail +template +class ResourceScatterNdAddOpGenericAdaptor : public detail::ResourceScatterNdAddOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceScatterNdAddOpGenericAdaptorBase; +public: + ResourceScatterNdAddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceScatterNdAddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceScatterNdAddOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceScatterNdAddOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getRef() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getUpdates() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceScatterNdAddOpAdaptor : public ResourceScatterNdAddOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceScatterNdAddOpGenericAdaptor::ResourceScatterNdAddOpGenericAdaptor; + ResourceScatterNdAddOpAdaptor(ResourceScatterNdAddOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceScatterNdAddOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceScatterNdAddOpAdaptor; + template + using GenericAdaptor = ResourceScatterNdAddOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices"), ::llvm::StringRef("use_locking")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getUseLockingAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getUseLockingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceScatterNdAdd"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getRef(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getUpdates(); + ::mlir::OpOperand &getRefMutable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getUpdatesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setUseLockingAttr(::mlir::BoolAttr attr); + void setUseLocking(::std::optional attrValue); + ::mlir::Attribute removeUseLockingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value ref, ::mlir::Value indices, ::mlir::Value updates, /*optional*/::mlir::BoolAttr use_locking); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ref, ::mlir::Value indices, ::mlir::Value updates, /*optional*/::mlir::BoolAttr use_locking); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value ref, ::mlir::Value indices, ::mlir::Value updates, /*optional*/bool use_locking = true); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ref, ::mlir::Value indices, ::mlir::Value updates, /*optional*/bool use_locking = true); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceScatterNdAddOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceScatterNdSubOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceScatterNdSubOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceScatterNdSubOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceScatterNdSubOpGenericAdaptorBase(ResourceScatterNdSubOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); +}; +} // namespace detail +template +class ResourceScatterNdSubOpGenericAdaptor : public detail::ResourceScatterNdSubOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceScatterNdSubOpGenericAdaptorBase; +public: + ResourceScatterNdSubOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceScatterNdSubOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceScatterNdSubOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceScatterNdSubOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getRef() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getUpdates() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceScatterNdSubOpAdaptor : public ResourceScatterNdSubOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceScatterNdSubOpGenericAdaptor::ResourceScatterNdSubOpGenericAdaptor; + ResourceScatterNdSubOpAdaptor(ResourceScatterNdSubOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceScatterNdSubOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceScatterNdSubOpAdaptor; + template + using GenericAdaptor = ResourceScatterNdSubOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices"), ::llvm::StringRef("use_locking")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getUseLockingAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getUseLockingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceScatterNdSub"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getRef(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getUpdates(); + ::mlir::OpOperand &getRefMutable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getUpdatesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setUseLockingAttr(::mlir::BoolAttr attr); + void setUseLocking(::std::optional attrValue); + ::mlir::Attribute removeUseLockingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value ref, ::mlir::Value indices, ::mlir::Value updates, /*optional*/::mlir::BoolAttr use_locking); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ref, ::mlir::Value indices, ::mlir::Value updates, /*optional*/::mlir::BoolAttr use_locking); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value ref, ::mlir::Value indices, ::mlir::Value updates, /*optional*/bool use_locking = true); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ref, ::mlir::Value indices, ::mlir::Value updates, /*optional*/bool use_locking = true); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceScatterNdSubOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceScatterNdUpdateOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceScatterNdUpdateOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceScatterNdUpdateOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceScatterNdUpdateOpGenericAdaptorBase(ResourceScatterNdUpdateOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); +}; +} // namespace detail +template +class ResourceScatterNdUpdateOpGenericAdaptor : public detail::ResourceScatterNdUpdateOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceScatterNdUpdateOpGenericAdaptorBase; +public: + ResourceScatterNdUpdateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceScatterNdUpdateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceScatterNdUpdateOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceScatterNdUpdateOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getRef() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getUpdates() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceScatterNdUpdateOpAdaptor : public ResourceScatterNdUpdateOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceScatterNdUpdateOpGenericAdaptor::ResourceScatterNdUpdateOpGenericAdaptor; + ResourceScatterNdUpdateOpAdaptor(ResourceScatterNdUpdateOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceScatterNdUpdateOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceScatterNdUpdateOpAdaptor; + template + using GenericAdaptor = ResourceScatterNdUpdateOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices"), ::llvm::StringRef("use_locking")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getUseLockingAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getUseLockingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceScatterNdUpdate"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getRef(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getUpdates(); + ::mlir::OpOperand &getRefMutable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getUpdatesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setUseLockingAttr(::mlir::BoolAttr attr); + void setUseLocking(::std::optional attrValue); + ::mlir::Attribute removeUseLockingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value ref, ::mlir::Value indices, ::mlir::Value updates, /*optional*/::mlir::BoolAttr use_locking); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ref, ::mlir::Value indices, ::mlir::Value updates, /*optional*/::mlir::BoolAttr use_locking); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value ref, ::mlir::Value indices, ::mlir::Value updates, /*optional*/bool use_locking = true); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ref, ::mlir::Value indices, ::mlir::Value updates, /*optional*/bool use_locking = true); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceScatterNdUpdateOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceScatterSubOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceScatterSubOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceScatterSubOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceScatterSubOpGenericAdaptorBase(ResourceScatterSubOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ResourceScatterSubOpGenericAdaptor : public detail::ResourceScatterSubOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceScatterSubOpGenericAdaptorBase; +public: + ResourceScatterSubOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceScatterSubOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceScatterSubOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceScatterSubOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getResource() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getUpdates() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceScatterSubOpAdaptor : public ResourceScatterSubOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceScatterSubOpGenericAdaptor::ResourceScatterSubOpGenericAdaptor; + ResourceScatterSubOpAdaptor(ResourceScatterSubOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceScatterSubOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceScatterSubOpAdaptor; + template + using GenericAdaptor = ResourceScatterSubOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tindices"), ::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceScatterSub"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResource(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getUpdates(); + ::mlir::OpOperand &getResourceMutable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getUpdatesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Type getTindices(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value resource, ::mlir::Value indices, ::mlir::Value updates); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value resource, ::mlir::Value indices, ::mlir::Value updates); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceScatterSubOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceScatterUpdateOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceScatterUpdateOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceScatterUpdateOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceScatterUpdateOpGenericAdaptorBase(ResourceScatterUpdateOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ResourceScatterUpdateOpGenericAdaptor : public detail::ResourceScatterUpdateOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceScatterUpdateOpGenericAdaptorBase; +public: + ResourceScatterUpdateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceScatterUpdateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceScatterUpdateOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceScatterUpdateOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getResource() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getUpdates() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceScatterUpdateOpAdaptor : public ResourceScatterUpdateOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceScatterUpdateOpGenericAdaptor::ResourceScatterUpdateOpGenericAdaptor; + ResourceScatterUpdateOpAdaptor(ResourceScatterUpdateOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceScatterUpdateOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceScatterUpdateOpAdaptor; + template + using GenericAdaptor = ResourceScatterUpdateOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tindices"), ::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceScatterUpdate"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResource(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getUpdates(); + ::mlir::OpOperand &getResourceMutable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getUpdatesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Type getTindices(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value resource, ::mlir::Value indices, ::mlir::Value updates); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value resource, ::mlir::Value indices, ::mlir::Value updates); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceScatterUpdateOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceSparseApplyAdagradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceSparseApplyAdagradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceSparseApplyAdagradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceSparseApplyAdagradOpGenericAdaptorBase(ResourceSparseApplyAdagradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::BoolAttr getUpdateSlotsAttr(); + bool getUpdateSlots(); +}; +} // namespace detail +template +class ResourceSparseApplyAdagradOpGenericAdaptor : public detail::ResourceSparseApplyAdagradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceSparseApplyAdagradOpGenericAdaptorBase; +public: + ResourceSparseApplyAdagradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceSparseApplyAdagradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceSparseApplyAdagradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceSparseApplyAdagradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVar() { + return (*getODSOperands(0).begin()); + } + + ValueT getAccum() { + return (*getODSOperands(1).begin()); + } + + ValueT getLr() { + return (*getODSOperands(2).begin()); + } + + ValueT getGrad() { + return (*getODSOperands(3).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceSparseApplyAdagradOpAdaptor : public ResourceSparseApplyAdagradOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceSparseApplyAdagradOpGenericAdaptor::ResourceSparseApplyAdagradOpGenericAdaptor; + ResourceSparseApplyAdagradOpAdaptor(ResourceSparseApplyAdagradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceSparseApplyAdagradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceSparseApplyAdagradOpAdaptor; + template + using GenericAdaptor = ResourceSparseApplyAdagradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices"), ::llvm::StringRef("update_slots"), ::llvm::StringRef("use_locking")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getUpdateSlotsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getUpdateSlotsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getUseLockingAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getUseLockingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceSparseApplyAdagrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getVar(); + ::mlir::TypedValue<::mlir::TensorType> getAccum(); + ::mlir::TypedValue<::mlir::TensorType> getLr(); + ::mlir::TypedValue<::mlir::TensorType> getGrad(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::OpOperand &getVarMutable(); + ::mlir::OpOperand &getAccumMutable(); + ::mlir::OpOperand &getLrMutable(); + ::mlir::OpOperand &getGradMutable(); + ::mlir::OpOperand &getIndicesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::BoolAttr getUpdateSlotsAttr(); + bool getUpdateSlots(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setUseLockingAttr(::mlir::BoolAttr attr); + void setUseLocking(::std::optional attrValue); + void setUpdateSlotsAttr(::mlir::BoolAttr attr); + void setUpdateSlots(::std::optional attrValue); + ::mlir::Attribute removeUseLockingAttr(); + ::mlir::Attribute removeUpdateSlotsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value lr, ::mlir::Value grad, ::mlir::Value indices, /*optional*/::mlir::BoolAttr use_locking, /*optional*/::mlir::BoolAttr update_slots); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value lr, ::mlir::Value grad, ::mlir::Value indices, /*optional*/::mlir::BoolAttr use_locking, /*optional*/::mlir::BoolAttr update_slots); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value lr, ::mlir::Value grad, ::mlir::Value indices, /*optional*/bool use_locking = false, /*optional*/bool update_slots = true); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value lr, ::mlir::Value grad, ::mlir::Value indices, /*optional*/bool use_locking = false, /*optional*/bool update_slots = true); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceSparseApplyAdagradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceSparseApplyAdagradV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceSparseApplyAdagradV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceSparseApplyAdagradV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceSparseApplyAdagradV2OpGenericAdaptorBase(ResourceSparseApplyAdagradV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::BoolAttr getUpdateSlotsAttr(); + bool getUpdateSlots(); +}; +} // namespace detail +template +class ResourceSparseApplyAdagradV2OpGenericAdaptor : public detail::ResourceSparseApplyAdagradV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceSparseApplyAdagradV2OpGenericAdaptorBase; +public: + ResourceSparseApplyAdagradV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceSparseApplyAdagradV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceSparseApplyAdagradV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceSparseApplyAdagradV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVar() { + return (*getODSOperands(0).begin()); + } + + ValueT getAccum() { + return (*getODSOperands(1).begin()); + } + + ValueT getLr() { + return (*getODSOperands(2).begin()); + } + + ValueT getEpsilon() { + return (*getODSOperands(3).begin()); + } + + ValueT getGrad() { + return (*getODSOperands(4).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(5).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceSparseApplyAdagradV2OpAdaptor : public ResourceSparseApplyAdagradV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceSparseApplyAdagradV2OpGenericAdaptor::ResourceSparseApplyAdagradV2OpGenericAdaptor; + ResourceSparseApplyAdagradV2OpAdaptor(ResourceSparseApplyAdagradV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceSparseApplyAdagradV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceSparseApplyAdagradV2OpAdaptor; + template + using GenericAdaptor = ResourceSparseApplyAdagradV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices"), ::llvm::StringRef("update_slots"), ::llvm::StringRef("use_locking")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getUpdateSlotsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getUpdateSlotsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getUseLockingAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getUseLockingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceSparseApplyAdagradV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getVar(); + ::mlir::TypedValue<::mlir::TensorType> getAccum(); + ::mlir::TypedValue<::mlir::TensorType> getLr(); + ::mlir::TypedValue<::mlir::TensorType> getEpsilon(); + ::mlir::TypedValue<::mlir::TensorType> getGrad(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::OpOperand &getVarMutable(); + ::mlir::OpOperand &getAccumMutable(); + ::mlir::OpOperand &getLrMutable(); + ::mlir::OpOperand &getEpsilonMutable(); + ::mlir::OpOperand &getGradMutable(); + ::mlir::OpOperand &getIndicesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::BoolAttr getUpdateSlotsAttr(); + bool getUpdateSlots(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setUseLockingAttr(::mlir::BoolAttr attr); + void setUseLocking(::std::optional attrValue); + void setUpdateSlotsAttr(::mlir::BoolAttr attr); + void setUpdateSlots(::std::optional attrValue); + ::mlir::Attribute removeUseLockingAttr(); + ::mlir::Attribute removeUpdateSlotsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value lr, ::mlir::Value epsilon, ::mlir::Value grad, ::mlir::Value indices, /*optional*/::mlir::BoolAttr use_locking, /*optional*/::mlir::BoolAttr update_slots); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value lr, ::mlir::Value epsilon, ::mlir::Value grad, ::mlir::Value indices, /*optional*/::mlir::BoolAttr use_locking, /*optional*/::mlir::BoolAttr update_slots); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value lr, ::mlir::Value epsilon, ::mlir::Value grad, ::mlir::Value indices, /*optional*/bool use_locking = false, /*optional*/bool update_slots = true); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value lr, ::mlir::Value epsilon, ::mlir::Value grad, ::mlir::Value indices, /*optional*/bool use_locking = false, /*optional*/bool update_slots = true); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceSparseApplyAdagradV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceSparseApplyFtrlOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceSparseApplyFtrlOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceSparseApplyFtrlOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceSparseApplyFtrlOpGenericAdaptorBase(ResourceSparseApplyFtrlOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::BoolAttr getMultiplyLinearByLrAttr(); + bool getMultiplyLinearByLr(); +}; +} // namespace detail +template +class ResourceSparseApplyFtrlOpGenericAdaptor : public detail::ResourceSparseApplyFtrlOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceSparseApplyFtrlOpGenericAdaptorBase; +public: + ResourceSparseApplyFtrlOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceSparseApplyFtrlOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceSparseApplyFtrlOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceSparseApplyFtrlOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVar() { + return (*getODSOperands(0).begin()); + } + + ValueT getAccum() { + return (*getODSOperands(1).begin()); + } + + ValueT getLinear() { + return (*getODSOperands(2).begin()); + } + + ValueT getGrad() { + return (*getODSOperands(3).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(4).begin()); + } + + ValueT getLr() { + return (*getODSOperands(5).begin()); + } + + ValueT getL1() { + return (*getODSOperands(6).begin()); + } + + ValueT getL2() { + return (*getODSOperands(7).begin()); + } + + ValueT getLrPower() { + return (*getODSOperands(8).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceSparseApplyFtrlOpAdaptor : public ResourceSparseApplyFtrlOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceSparseApplyFtrlOpGenericAdaptor::ResourceSparseApplyFtrlOpGenericAdaptor; + ResourceSparseApplyFtrlOpAdaptor(ResourceSparseApplyFtrlOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceSparseApplyFtrlOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceSparseApplyFtrlOpAdaptor; + template + using GenericAdaptor = ResourceSparseApplyFtrlOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices"), ::llvm::StringRef("multiply_linear_by_lr"), ::llvm::StringRef("use_locking")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getMultiplyLinearByLrAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getMultiplyLinearByLrAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getUseLockingAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getUseLockingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceSparseApplyFtrl"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getVar(); + ::mlir::TypedValue<::mlir::TensorType> getAccum(); + ::mlir::TypedValue<::mlir::TensorType> getLinear(); + ::mlir::TypedValue<::mlir::TensorType> getGrad(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getLr(); + ::mlir::TypedValue<::mlir::TensorType> getL1(); + ::mlir::TypedValue<::mlir::TensorType> getL2(); + ::mlir::TypedValue<::mlir::TensorType> getLrPower(); + ::mlir::OpOperand &getVarMutable(); + ::mlir::OpOperand &getAccumMutable(); + ::mlir::OpOperand &getLinearMutable(); + ::mlir::OpOperand &getGradMutable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getLrMutable(); + ::mlir::OpOperand &getL1Mutable(); + ::mlir::OpOperand &getL2Mutable(); + ::mlir::OpOperand &getLrPowerMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::BoolAttr getMultiplyLinearByLrAttr(); + bool getMultiplyLinearByLr(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setUseLockingAttr(::mlir::BoolAttr attr); + void setUseLocking(::std::optional attrValue); + void setMultiplyLinearByLrAttr(::mlir::BoolAttr attr); + void setMultiplyLinearByLr(::std::optional attrValue); + ::mlir::Attribute removeUseLockingAttr(); + ::mlir::Attribute removeMultiplyLinearByLrAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value linear, ::mlir::Value grad, ::mlir::Value indices, ::mlir::Value lr, ::mlir::Value l1, ::mlir::Value l2, ::mlir::Value lr_power, /*optional*/::mlir::BoolAttr use_locking, /*optional*/::mlir::BoolAttr multiply_linear_by_lr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value linear, ::mlir::Value grad, ::mlir::Value indices, ::mlir::Value lr, ::mlir::Value l1, ::mlir::Value l2, ::mlir::Value lr_power, /*optional*/::mlir::BoolAttr use_locking, /*optional*/::mlir::BoolAttr multiply_linear_by_lr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value linear, ::mlir::Value grad, ::mlir::Value indices, ::mlir::Value lr, ::mlir::Value l1, ::mlir::Value l2, ::mlir::Value lr_power, /*optional*/bool use_locking = false, /*optional*/bool multiply_linear_by_lr = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value linear, ::mlir::Value grad, ::mlir::Value indices, ::mlir::Value lr, ::mlir::Value l1, ::mlir::Value l2, ::mlir::Value lr_power, /*optional*/bool use_locking = false, /*optional*/bool multiply_linear_by_lr = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceSparseApplyFtrlOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceStridedSliceAssignOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceStridedSliceAssignOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceStridedSliceAssignOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceStridedSliceAssignOpGenericAdaptorBase(ResourceStridedSliceAssignOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getBeginMaskAttr(); + uint64_t getBeginMask(); + ::mlir::IntegerAttr getEndMaskAttr(); + uint64_t getEndMask(); + ::mlir::IntegerAttr getEllipsisMaskAttr(); + uint64_t getEllipsisMask(); + ::mlir::IntegerAttr getNewAxisMaskAttr(); + uint64_t getNewAxisMask(); + ::mlir::IntegerAttr getShrinkAxisMaskAttr(); + uint64_t getShrinkAxisMask(); +}; +} // namespace detail +template +class ResourceStridedSliceAssignOpGenericAdaptor : public detail::ResourceStridedSliceAssignOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceStridedSliceAssignOpGenericAdaptorBase; +public: + ResourceStridedSliceAssignOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceStridedSliceAssignOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceStridedSliceAssignOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceStridedSliceAssignOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getRef() { + return (*getODSOperands(0).begin()); + } + + ValueT getBegin() { + return (*getODSOperands(1).begin()); + } + + ValueT getEnd() { + return (*getODSOperands(2).begin()); + } + + ValueT getStrides() { + return (*getODSOperands(3).begin()); + } + + ValueT getValue() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceStridedSliceAssignOpAdaptor : public ResourceStridedSliceAssignOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceStridedSliceAssignOpGenericAdaptor::ResourceStridedSliceAssignOpGenericAdaptor; + ResourceStridedSliceAssignOpAdaptor(ResourceStridedSliceAssignOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceStridedSliceAssignOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceStridedSliceAssignOpAdaptor; + template + using GenericAdaptor = ResourceStridedSliceAssignOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Index"), ::llvm::StringRef("T"), ::llvm::StringRef("begin_mask"), ::llvm::StringRef("ellipsis_mask"), ::llvm::StringRef("end_mask"), ::llvm::StringRef("new_axis_mask"), ::llvm::StringRef("shrink_axis_mask")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getIndexAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getIndexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getBeginMaskAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getBeginMaskAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getEllipsisMaskAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getEllipsisMaskAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getEndMaskAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getEndMaskAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getNewAxisMaskAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getNewAxisMaskAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getShrinkAxisMaskAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getShrinkAxisMaskAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceStridedSliceAssign"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getRef(); + ::mlir::TypedValue<::mlir::TensorType> getBegin(); + ::mlir::TypedValue<::mlir::TensorType> getEnd(); + ::mlir::TypedValue<::mlir::TensorType> getStrides(); + ::mlir::TypedValue<::mlir::TensorType> getValue(); + ::mlir::OpOperand &getRefMutable(); + ::mlir::OpOperand &getBeginMutable(); + ::mlir::OpOperand &getEndMutable(); + ::mlir::OpOperand &getStridesMutable(); + ::mlir::OpOperand &getValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getBeginMaskAttr(); + uint64_t getBeginMask(); + ::mlir::IntegerAttr getEndMaskAttr(); + uint64_t getEndMask(); + ::mlir::IntegerAttr getEllipsisMaskAttr(); + uint64_t getEllipsisMask(); + ::mlir::IntegerAttr getNewAxisMaskAttr(); + uint64_t getNewAxisMask(); + ::mlir::IntegerAttr getShrinkAxisMaskAttr(); + uint64_t getShrinkAxisMask(); + ::mlir::Type getIndex(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setBeginMaskAttr(::mlir::IntegerAttr attr); + void setBeginMask(::std::optional attrValue); + void setEndMaskAttr(::mlir::IntegerAttr attr); + void setEndMask(::std::optional attrValue); + void setEllipsisMaskAttr(::mlir::IntegerAttr attr); + void setEllipsisMask(::std::optional attrValue); + void setNewAxisMaskAttr(::mlir::IntegerAttr attr); + void setNewAxisMask(::std::optional attrValue); + void setShrinkAxisMaskAttr(::mlir::IntegerAttr attr); + void setShrinkAxisMask(::std::optional attrValue); + ::mlir::Attribute removeBeginMaskAttr(); + ::mlir::Attribute removeEndMaskAttr(); + ::mlir::Attribute removeEllipsisMaskAttr(); + ::mlir::Attribute removeNewAxisMaskAttr(); + ::mlir::Attribute removeShrinkAxisMaskAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value ref, ::mlir::Value begin, ::mlir::Value end, ::mlir::Value strides, ::mlir::Value value, /*optional*/::mlir::IntegerAttr begin_mask, /*optional*/::mlir::IntegerAttr end_mask, /*optional*/::mlir::IntegerAttr ellipsis_mask, /*optional*/::mlir::IntegerAttr new_axis_mask, /*optional*/::mlir::IntegerAttr shrink_axis_mask); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ref, ::mlir::Value begin, ::mlir::Value end, ::mlir::Value strides, ::mlir::Value value, /*optional*/::mlir::IntegerAttr begin_mask, /*optional*/::mlir::IntegerAttr end_mask, /*optional*/::mlir::IntegerAttr ellipsis_mask, /*optional*/::mlir::IntegerAttr new_axis_mask, /*optional*/::mlir::IntegerAttr shrink_axis_mask); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value ref, ::mlir::Value begin, ::mlir::Value end, ::mlir::Value strides, ::mlir::Value value, /*optional*/uint64_t begin_mask = 0, /*optional*/uint64_t end_mask = 0, /*optional*/uint64_t ellipsis_mask = 0, /*optional*/uint64_t new_axis_mask = 0, /*optional*/uint64_t shrink_axis_mask = 0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ref, ::mlir::Value begin, ::mlir::Value end, ::mlir::Value strides, ::mlir::Value value, /*optional*/uint64_t begin_mask = 0, /*optional*/uint64_t end_mask = 0, /*optional*/uint64_t ellipsis_mask = 0, /*optional*/uint64_t new_axis_mask = 0, /*optional*/uint64_t shrink_axis_mask = 0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 7 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceStridedSliceAssignOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RestoreOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RestoreOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RestoreOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RestoreOpGenericAdaptorBase(RestoreOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getPreferredShardAttr(); + uint64_t getPreferredShard(); +}; +} // namespace detail +template +class RestoreOpGenericAdaptor : public detail::RestoreOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RestoreOpGenericAdaptorBase; +public: + RestoreOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RestoreOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RestoreOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RestoreOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getFilePattern() { + return (*getODSOperands(0).begin()); + } + + ValueT getTensorName() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RestoreOpAdaptor : public RestoreOpGenericAdaptor<::mlir::ValueRange> { +public: + using RestoreOpGenericAdaptor::RestoreOpGenericAdaptor; + RestoreOpAdaptor(RestoreOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RestoreOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RestoreOpAdaptor; + template + using GenericAdaptor = RestoreOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dt"), ::llvm::StringRef("preferred_shard")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDtAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDtAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getPreferredShardAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getPreferredShardAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Restore"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getFilePattern(); + ::mlir::TypedValue<::mlir::TensorType> getTensorName(); + ::mlir::OpOperand &getFilePatternMutable(); + ::mlir::OpOperand &getTensorNameMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::IntegerAttr getPreferredShardAttr(); + uint64_t getPreferredShard(); + ::mlir::Type getDt(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setPreferredShardAttr(::mlir::IntegerAttr attr); + void setPreferredShard(::std::optional attrValue); + ::mlir::Attribute removePreferredShardAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type tensor, ::mlir::Value file_pattern, ::mlir::Value tensor_name, /*optional*/::mlir::IntegerAttr preferred_shard); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value file_pattern, ::mlir::Value tensor_name, /*optional*/::mlir::IntegerAttr preferred_shard); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type tensor, ::mlir::Value file_pattern, ::mlir::Value tensor_name, /*optional*/uint64_t preferred_shard = -1); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value file_pattern, ::mlir::Value tensor_name, /*optional*/uint64_t preferred_shard = -1); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RestoreOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RestoreV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RestoreV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RestoreV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RestoreV2OpGenericAdaptorBase(RestoreV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RestoreV2OpGenericAdaptor : public detail::RestoreV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RestoreV2OpGenericAdaptorBase; +public: + RestoreV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RestoreV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RestoreV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RestoreV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getPrefix() { + return (*getODSOperands(0).begin()); + } + + ValueT getTensorNames() { + return (*getODSOperands(1).begin()); + } + + ValueT getShapeAndSlices() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RestoreV2OpAdaptor : public RestoreV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using RestoreV2OpGenericAdaptor::RestoreV2OpGenericAdaptor; + RestoreV2OpAdaptor(RestoreV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RestoreV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RestoreV2OpAdaptor; + template + using GenericAdaptor = RestoreV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dtypes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDtypesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDtypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RestoreV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getPrefix(); + ::mlir::TypedValue<::mlir::TensorType> getTensorNames(); + ::mlir::TypedValue<::mlir::TensorType> getShapeAndSlices(); + ::mlir::OpOperand &getPrefixMutable(); + ::mlir::OpOperand &getTensorNamesMutable(); + ::mlir::OpOperand &getShapeAndSlicesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getTensors(); + mlir::ResultElementTypeRange getDtypes(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange tensors, ::mlir::Value prefix, ::mlir::Value tensor_names, ::mlir::Value shape_and_slices); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RestoreV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RetrieveTPUEmbeddingADAMParametersGradAccumDebugOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RetrieveTPUEmbeddingADAMParametersGradAccumDebugOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RetrieveTPUEmbeddingADAMParametersGradAccumDebugOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RetrieveTPUEmbeddingADAMParametersGradAccumDebugOpGenericAdaptorBase(RetrieveTPUEmbeddingADAMParametersGradAccumDebugOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class RetrieveTPUEmbeddingADAMParametersGradAccumDebugOpGenericAdaptor : public detail::RetrieveTPUEmbeddingADAMParametersGradAccumDebugOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RetrieveTPUEmbeddingADAMParametersGradAccumDebugOpGenericAdaptorBase; +public: + RetrieveTPUEmbeddingADAMParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RetrieveTPUEmbeddingADAMParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RetrieveTPUEmbeddingADAMParametersGradAccumDebugOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RetrieveTPUEmbeddingADAMParametersGradAccumDebugOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RetrieveTPUEmbeddingADAMParametersGradAccumDebugOpAdaptor : public RetrieveTPUEmbeddingADAMParametersGradAccumDebugOpGenericAdaptor<::mlir::ValueRange> { +public: + using RetrieveTPUEmbeddingADAMParametersGradAccumDebugOpGenericAdaptor::RetrieveTPUEmbeddingADAMParametersGradAccumDebugOpGenericAdaptor; + RetrieveTPUEmbeddingADAMParametersGradAccumDebugOpAdaptor(RetrieveTPUEmbeddingADAMParametersGradAccumDebugOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RetrieveTPUEmbeddingADAMParametersGradAccumDebugOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RetrieveTPUEmbeddingADAMParametersGradAccumDebugOpAdaptor; + template + using GenericAdaptor = RetrieveTPUEmbeddingADAMParametersGradAccumDebugOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RetrieveTPUEmbeddingADAMParametersGradAccumDebug"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getMomenta(); + ::mlir::TypedValue<::mlir::TensorType> getVelocities(); + ::mlir::TypedValue<::mlir::TensorType> getGradientAccumulators(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type momenta, ::mlir::Type velocities, ::mlir::Type gradient_accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type momenta, ::mlir::Type velocities, ::mlir::Type gradient_accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RetrieveTPUEmbeddingADAMParametersGradAccumDebugOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RetrieveTPUEmbeddingADAMParametersOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RetrieveTPUEmbeddingADAMParametersOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RetrieveTPUEmbeddingADAMParametersOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RetrieveTPUEmbeddingADAMParametersOpGenericAdaptorBase(RetrieveTPUEmbeddingADAMParametersOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class RetrieveTPUEmbeddingADAMParametersOpGenericAdaptor : public detail::RetrieveTPUEmbeddingADAMParametersOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RetrieveTPUEmbeddingADAMParametersOpGenericAdaptorBase; +public: + RetrieveTPUEmbeddingADAMParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RetrieveTPUEmbeddingADAMParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RetrieveTPUEmbeddingADAMParametersOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RetrieveTPUEmbeddingADAMParametersOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RetrieveTPUEmbeddingADAMParametersOpAdaptor : public RetrieveTPUEmbeddingADAMParametersOpGenericAdaptor<::mlir::ValueRange> { +public: + using RetrieveTPUEmbeddingADAMParametersOpGenericAdaptor::RetrieveTPUEmbeddingADAMParametersOpGenericAdaptor; + RetrieveTPUEmbeddingADAMParametersOpAdaptor(RetrieveTPUEmbeddingADAMParametersOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RetrieveTPUEmbeddingADAMParametersOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RetrieveTPUEmbeddingADAMParametersOpAdaptor; + template + using GenericAdaptor = RetrieveTPUEmbeddingADAMParametersOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RetrieveTPUEmbeddingADAMParameters"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getMomenta(); + ::mlir::TypedValue<::mlir::TensorType> getVelocities(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type momenta, ::mlir::Type velocities, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type momenta, ::mlir::Type velocities, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RetrieveTPUEmbeddingADAMParametersOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebugOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebugOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebugOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebugOpGenericAdaptorBase(RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebugOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebugOpGenericAdaptor : public detail::RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebugOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebugOpGenericAdaptorBase; +public: + RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebugOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebugOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebugOpAdaptor : public RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebugOpGenericAdaptor<::mlir::ValueRange> { +public: + using RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebugOpGenericAdaptor::RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebugOpGenericAdaptor; + RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebugOpAdaptor(RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebugOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebugOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebugOpAdaptor; + template + using GenericAdaptor = RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebugOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebug"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getAccumulators(); + ::mlir::TypedValue<::mlir::TensorType> getUpdates(); + ::mlir::TypedValue<::mlir::TensorType> getGradientAccumulators(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type accumulators, ::mlir::Type updates, ::mlir::Type gradient_accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type accumulators, ::mlir::Type updates, ::mlir::Type gradient_accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebugOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RetrieveTPUEmbeddingAdadeltaParametersOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RetrieveTPUEmbeddingAdadeltaParametersOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RetrieveTPUEmbeddingAdadeltaParametersOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RetrieveTPUEmbeddingAdadeltaParametersOpGenericAdaptorBase(RetrieveTPUEmbeddingAdadeltaParametersOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class RetrieveTPUEmbeddingAdadeltaParametersOpGenericAdaptor : public detail::RetrieveTPUEmbeddingAdadeltaParametersOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RetrieveTPUEmbeddingAdadeltaParametersOpGenericAdaptorBase; +public: + RetrieveTPUEmbeddingAdadeltaParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RetrieveTPUEmbeddingAdadeltaParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RetrieveTPUEmbeddingAdadeltaParametersOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RetrieveTPUEmbeddingAdadeltaParametersOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RetrieveTPUEmbeddingAdadeltaParametersOpAdaptor : public RetrieveTPUEmbeddingAdadeltaParametersOpGenericAdaptor<::mlir::ValueRange> { +public: + using RetrieveTPUEmbeddingAdadeltaParametersOpGenericAdaptor::RetrieveTPUEmbeddingAdadeltaParametersOpGenericAdaptor; + RetrieveTPUEmbeddingAdadeltaParametersOpAdaptor(RetrieveTPUEmbeddingAdadeltaParametersOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RetrieveTPUEmbeddingAdadeltaParametersOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RetrieveTPUEmbeddingAdadeltaParametersOpAdaptor; + template + using GenericAdaptor = RetrieveTPUEmbeddingAdadeltaParametersOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RetrieveTPUEmbeddingAdadeltaParameters"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getAccumulators(); + ::mlir::TypedValue<::mlir::TensorType> getUpdates(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type accumulators, ::mlir::Type updates, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type accumulators, ::mlir::Type updates, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RetrieveTPUEmbeddingAdadeltaParametersOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RetrieveTPUEmbeddingAdagradParametersGradAccumDebugOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RetrieveTPUEmbeddingAdagradParametersGradAccumDebugOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RetrieveTPUEmbeddingAdagradParametersGradAccumDebugOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RetrieveTPUEmbeddingAdagradParametersGradAccumDebugOpGenericAdaptorBase(RetrieveTPUEmbeddingAdagradParametersGradAccumDebugOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class RetrieveTPUEmbeddingAdagradParametersGradAccumDebugOpGenericAdaptor : public detail::RetrieveTPUEmbeddingAdagradParametersGradAccumDebugOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RetrieveTPUEmbeddingAdagradParametersGradAccumDebugOpGenericAdaptorBase; +public: + RetrieveTPUEmbeddingAdagradParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RetrieveTPUEmbeddingAdagradParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RetrieveTPUEmbeddingAdagradParametersGradAccumDebugOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RetrieveTPUEmbeddingAdagradParametersGradAccumDebugOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RetrieveTPUEmbeddingAdagradParametersGradAccumDebugOpAdaptor : public RetrieveTPUEmbeddingAdagradParametersGradAccumDebugOpGenericAdaptor<::mlir::ValueRange> { +public: + using RetrieveTPUEmbeddingAdagradParametersGradAccumDebugOpGenericAdaptor::RetrieveTPUEmbeddingAdagradParametersGradAccumDebugOpGenericAdaptor; + RetrieveTPUEmbeddingAdagradParametersGradAccumDebugOpAdaptor(RetrieveTPUEmbeddingAdagradParametersGradAccumDebugOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RetrieveTPUEmbeddingAdagradParametersGradAccumDebugOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RetrieveTPUEmbeddingAdagradParametersGradAccumDebugOpAdaptor; + template + using GenericAdaptor = RetrieveTPUEmbeddingAdagradParametersGradAccumDebugOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RetrieveTPUEmbeddingAdagradParametersGradAccumDebug"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getAccumulators(); + ::mlir::TypedValue<::mlir::TensorType> getGradientAccumulators(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type accumulators, ::mlir::Type gradient_accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type accumulators, ::mlir::Type gradient_accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RetrieveTPUEmbeddingAdagradParametersGradAccumDebugOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RetrieveTPUEmbeddingAdagradParametersOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RetrieveTPUEmbeddingAdagradParametersOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RetrieveTPUEmbeddingAdagradParametersOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RetrieveTPUEmbeddingAdagradParametersOpGenericAdaptorBase(RetrieveTPUEmbeddingAdagradParametersOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class RetrieveTPUEmbeddingAdagradParametersOpGenericAdaptor : public detail::RetrieveTPUEmbeddingAdagradParametersOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RetrieveTPUEmbeddingAdagradParametersOpGenericAdaptorBase; +public: + RetrieveTPUEmbeddingAdagradParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RetrieveTPUEmbeddingAdagradParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RetrieveTPUEmbeddingAdagradParametersOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RetrieveTPUEmbeddingAdagradParametersOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RetrieveTPUEmbeddingAdagradParametersOpAdaptor : public RetrieveTPUEmbeddingAdagradParametersOpGenericAdaptor<::mlir::ValueRange> { +public: + using RetrieveTPUEmbeddingAdagradParametersOpGenericAdaptor::RetrieveTPUEmbeddingAdagradParametersOpGenericAdaptor; + RetrieveTPUEmbeddingAdagradParametersOpAdaptor(RetrieveTPUEmbeddingAdagradParametersOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RetrieveTPUEmbeddingAdagradParametersOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RetrieveTPUEmbeddingAdagradParametersOpAdaptor; + template + using GenericAdaptor = RetrieveTPUEmbeddingAdagradParametersOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RetrieveTPUEmbeddingAdagradParameters"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getAccumulators(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RetrieveTPUEmbeddingAdagradParametersOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RetrieveTPUEmbeddingCenteredRMSPropParametersOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RetrieveTPUEmbeddingCenteredRMSPropParametersOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RetrieveTPUEmbeddingCenteredRMSPropParametersOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RetrieveTPUEmbeddingCenteredRMSPropParametersOpGenericAdaptorBase(RetrieveTPUEmbeddingCenteredRMSPropParametersOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class RetrieveTPUEmbeddingCenteredRMSPropParametersOpGenericAdaptor : public detail::RetrieveTPUEmbeddingCenteredRMSPropParametersOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RetrieveTPUEmbeddingCenteredRMSPropParametersOpGenericAdaptorBase; +public: + RetrieveTPUEmbeddingCenteredRMSPropParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RetrieveTPUEmbeddingCenteredRMSPropParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RetrieveTPUEmbeddingCenteredRMSPropParametersOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RetrieveTPUEmbeddingCenteredRMSPropParametersOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RetrieveTPUEmbeddingCenteredRMSPropParametersOpAdaptor : public RetrieveTPUEmbeddingCenteredRMSPropParametersOpGenericAdaptor<::mlir::ValueRange> { +public: + using RetrieveTPUEmbeddingCenteredRMSPropParametersOpGenericAdaptor::RetrieveTPUEmbeddingCenteredRMSPropParametersOpGenericAdaptor; + RetrieveTPUEmbeddingCenteredRMSPropParametersOpAdaptor(RetrieveTPUEmbeddingCenteredRMSPropParametersOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RetrieveTPUEmbeddingCenteredRMSPropParametersOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RetrieveTPUEmbeddingCenteredRMSPropParametersOpAdaptor; + template + using GenericAdaptor = RetrieveTPUEmbeddingCenteredRMSPropParametersOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RetrieveTPUEmbeddingCenteredRMSPropParameters"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getMs(); + ::mlir::TypedValue<::mlir::TensorType> getMom(); + ::mlir::TypedValue<::mlir::TensorType> getMg(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type ms, ::mlir::Type mom, ::mlir::Type mg, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type ms, ::mlir::Type mom, ::mlir::Type mg, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RetrieveTPUEmbeddingCenteredRMSPropParametersOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RetrieveTPUEmbeddingFTRLParametersGradAccumDebugOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RetrieveTPUEmbeddingFTRLParametersGradAccumDebugOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RetrieveTPUEmbeddingFTRLParametersGradAccumDebugOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RetrieveTPUEmbeddingFTRLParametersGradAccumDebugOpGenericAdaptorBase(RetrieveTPUEmbeddingFTRLParametersGradAccumDebugOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class RetrieveTPUEmbeddingFTRLParametersGradAccumDebugOpGenericAdaptor : public detail::RetrieveTPUEmbeddingFTRLParametersGradAccumDebugOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RetrieveTPUEmbeddingFTRLParametersGradAccumDebugOpGenericAdaptorBase; +public: + RetrieveTPUEmbeddingFTRLParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RetrieveTPUEmbeddingFTRLParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RetrieveTPUEmbeddingFTRLParametersGradAccumDebugOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RetrieveTPUEmbeddingFTRLParametersGradAccumDebugOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RetrieveTPUEmbeddingFTRLParametersGradAccumDebugOpAdaptor : public RetrieveTPUEmbeddingFTRLParametersGradAccumDebugOpGenericAdaptor<::mlir::ValueRange> { +public: + using RetrieveTPUEmbeddingFTRLParametersGradAccumDebugOpGenericAdaptor::RetrieveTPUEmbeddingFTRLParametersGradAccumDebugOpGenericAdaptor; + RetrieveTPUEmbeddingFTRLParametersGradAccumDebugOpAdaptor(RetrieveTPUEmbeddingFTRLParametersGradAccumDebugOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RetrieveTPUEmbeddingFTRLParametersGradAccumDebugOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RetrieveTPUEmbeddingFTRLParametersGradAccumDebugOpAdaptor; + template + using GenericAdaptor = RetrieveTPUEmbeddingFTRLParametersGradAccumDebugOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RetrieveTPUEmbeddingFTRLParametersGradAccumDebug"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getAccumulators(); + ::mlir::TypedValue<::mlir::TensorType> getLinears(); + ::mlir::TypedValue<::mlir::TensorType> getGradientAccumulators(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type accumulators, ::mlir::Type linears, ::mlir::Type gradient_accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type accumulators, ::mlir::Type linears, ::mlir::Type gradient_accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RetrieveTPUEmbeddingFTRLParametersGradAccumDebugOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RetrieveTPUEmbeddingFTRLParametersOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RetrieveTPUEmbeddingFTRLParametersOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RetrieveTPUEmbeddingFTRLParametersOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RetrieveTPUEmbeddingFTRLParametersOpGenericAdaptorBase(RetrieveTPUEmbeddingFTRLParametersOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class RetrieveTPUEmbeddingFTRLParametersOpGenericAdaptor : public detail::RetrieveTPUEmbeddingFTRLParametersOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RetrieveTPUEmbeddingFTRLParametersOpGenericAdaptorBase; +public: + RetrieveTPUEmbeddingFTRLParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RetrieveTPUEmbeddingFTRLParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RetrieveTPUEmbeddingFTRLParametersOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RetrieveTPUEmbeddingFTRLParametersOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RetrieveTPUEmbeddingFTRLParametersOpAdaptor : public RetrieveTPUEmbeddingFTRLParametersOpGenericAdaptor<::mlir::ValueRange> { +public: + using RetrieveTPUEmbeddingFTRLParametersOpGenericAdaptor::RetrieveTPUEmbeddingFTRLParametersOpGenericAdaptor; + RetrieveTPUEmbeddingFTRLParametersOpAdaptor(RetrieveTPUEmbeddingFTRLParametersOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RetrieveTPUEmbeddingFTRLParametersOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RetrieveTPUEmbeddingFTRLParametersOpAdaptor; + template + using GenericAdaptor = RetrieveTPUEmbeddingFTRLParametersOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RetrieveTPUEmbeddingFTRLParameters"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getAccumulators(); + ::mlir::TypedValue<::mlir::TensorType> getLinears(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type accumulators, ::mlir::Type linears, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type accumulators, ::mlir::Type linears, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RetrieveTPUEmbeddingFTRLParametersOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RetrieveTPUEmbeddingMDLAdagradLightParametersOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RetrieveTPUEmbeddingMDLAdagradLightParametersOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RetrieveTPUEmbeddingMDLAdagradLightParametersOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RetrieveTPUEmbeddingMDLAdagradLightParametersOpGenericAdaptorBase(RetrieveTPUEmbeddingMDLAdagradLightParametersOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class RetrieveTPUEmbeddingMDLAdagradLightParametersOpGenericAdaptor : public detail::RetrieveTPUEmbeddingMDLAdagradLightParametersOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RetrieveTPUEmbeddingMDLAdagradLightParametersOpGenericAdaptorBase; +public: + RetrieveTPUEmbeddingMDLAdagradLightParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RetrieveTPUEmbeddingMDLAdagradLightParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RetrieveTPUEmbeddingMDLAdagradLightParametersOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RetrieveTPUEmbeddingMDLAdagradLightParametersOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RetrieveTPUEmbeddingMDLAdagradLightParametersOpAdaptor : public RetrieveTPUEmbeddingMDLAdagradLightParametersOpGenericAdaptor<::mlir::ValueRange> { +public: + using RetrieveTPUEmbeddingMDLAdagradLightParametersOpGenericAdaptor::RetrieveTPUEmbeddingMDLAdagradLightParametersOpGenericAdaptor; + RetrieveTPUEmbeddingMDLAdagradLightParametersOpAdaptor(RetrieveTPUEmbeddingMDLAdagradLightParametersOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RetrieveTPUEmbeddingMDLAdagradLightParametersOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RetrieveTPUEmbeddingMDLAdagradLightParametersOpAdaptor; + template + using GenericAdaptor = RetrieveTPUEmbeddingMDLAdagradLightParametersOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RetrieveTPUEmbeddingMDLAdagradLightParameters"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getAccumulators(); + ::mlir::TypedValue<::mlir::TensorType> getWeights(); + ::mlir::TypedValue<::mlir::TensorType> getBenefits(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type accumulators, ::mlir::Type weights, ::mlir::Type benefits, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type accumulators, ::mlir::Type weights, ::mlir::Type benefits, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RetrieveTPUEmbeddingMDLAdagradLightParametersOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RetrieveTPUEmbeddingMomentumParametersGradAccumDebugOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RetrieveTPUEmbeddingMomentumParametersGradAccumDebugOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RetrieveTPUEmbeddingMomentumParametersGradAccumDebugOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RetrieveTPUEmbeddingMomentumParametersGradAccumDebugOpGenericAdaptorBase(RetrieveTPUEmbeddingMomentumParametersGradAccumDebugOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class RetrieveTPUEmbeddingMomentumParametersGradAccumDebugOpGenericAdaptor : public detail::RetrieveTPUEmbeddingMomentumParametersGradAccumDebugOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RetrieveTPUEmbeddingMomentumParametersGradAccumDebugOpGenericAdaptorBase; +public: + RetrieveTPUEmbeddingMomentumParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RetrieveTPUEmbeddingMomentumParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RetrieveTPUEmbeddingMomentumParametersGradAccumDebugOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RetrieveTPUEmbeddingMomentumParametersGradAccumDebugOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RetrieveTPUEmbeddingMomentumParametersGradAccumDebugOpAdaptor : public RetrieveTPUEmbeddingMomentumParametersGradAccumDebugOpGenericAdaptor<::mlir::ValueRange> { +public: + using RetrieveTPUEmbeddingMomentumParametersGradAccumDebugOpGenericAdaptor::RetrieveTPUEmbeddingMomentumParametersGradAccumDebugOpGenericAdaptor; + RetrieveTPUEmbeddingMomentumParametersGradAccumDebugOpAdaptor(RetrieveTPUEmbeddingMomentumParametersGradAccumDebugOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RetrieveTPUEmbeddingMomentumParametersGradAccumDebugOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RetrieveTPUEmbeddingMomentumParametersGradAccumDebugOpAdaptor; + template + using GenericAdaptor = RetrieveTPUEmbeddingMomentumParametersGradAccumDebugOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RetrieveTPUEmbeddingMomentumParametersGradAccumDebug"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getMomenta(); + ::mlir::TypedValue<::mlir::TensorType> getGradientAccumulators(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type momenta, ::mlir::Type gradient_accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type momenta, ::mlir::Type gradient_accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RetrieveTPUEmbeddingMomentumParametersGradAccumDebugOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RetrieveTPUEmbeddingMomentumParametersOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RetrieveTPUEmbeddingMomentumParametersOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RetrieveTPUEmbeddingMomentumParametersOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RetrieveTPUEmbeddingMomentumParametersOpGenericAdaptorBase(RetrieveTPUEmbeddingMomentumParametersOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class RetrieveTPUEmbeddingMomentumParametersOpGenericAdaptor : public detail::RetrieveTPUEmbeddingMomentumParametersOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RetrieveTPUEmbeddingMomentumParametersOpGenericAdaptorBase; +public: + RetrieveTPUEmbeddingMomentumParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RetrieveTPUEmbeddingMomentumParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RetrieveTPUEmbeddingMomentumParametersOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RetrieveTPUEmbeddingMomentumParametersOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RetrieveTPUEmbeddingMomentumParametersOpAdaptor : public RetrieveTPUEmbeddingMomentumParametersOpGenericAdaptor<::mlir::ValueRange> { +public: + using RetrieveTPUEmbeddingMomentumParametersOpGenericAdaptor::RetrieveTPUEmbeddingMomentumParametersOpGenericAdaptor; + RetrieveTPUEmbeddingMomentumParametersOpAdaptor(RetrieveTPUEmbeddingMomentumParametersOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RetrieveTPUEmbeddingMomentumParametersOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RetrieveTPUEmbeddingMomentumParametersOpAdaptor; + template + using GenericAdaptor = RetrieveTPUEmbeddingMomentumParametersOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RetrieveTPUEmbeddingMomentumParameters"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getMomenta(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type momenta, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type momenta, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RetrieveTPUEmbeddingMomentumParametersOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebugOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebugOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebugOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebugOpGenericAdaptorBase(RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebugOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebugOpGenericAdaptor : public detail::RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebugOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebugOpGenericAdaptorBase; +public: + RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebugOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebugOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebugOpAdaptor : public RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebugOpGenericAdaptor<::mlir::ValueRange> { +public: + using RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebugOpGenericAdaptor::RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebugOpGenericAdaptor; + RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebugOpAdaptor(RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebugOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebugOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebugOpAdaptor; + template + using GenericAdaptor = RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebugOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebug"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getAccumulators(); + ::mlir::TypedValue<::mlir::TensorType> getGradientAccumulators(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type accumulators, ::mlir::Type gradient_accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type accumulators, ::mlir::Type gradient_accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebugOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RetrieveTPUEmbeddingProximalAdagradParametersOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RetrieveTPUEmbeddingProximalAdagradParametersOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RetrieveTPUEmbeddingProximalAdagradParametersOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RetrieveTPUEmbeddingProximalAdagradParametersOpGenericAdaptorBase(RetrieveTPUEmbeddingProximalAdagradParametersOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class RetrieveTPUEmbeddingProximalAdagradParametersOpGenericAdaptor : public detail::RetrieveTPUEmbeddingProximalAdagradParametersOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RetrieveTPUEmbeddingProximalAdagradParametersOpGenericAdaptorBase; +public: + RetrieveTPUEmbeddingProximalAdagradParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RetrieveTPUEmbeddingProximalAdagradParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RetrieveTPUEmbeddingProximalAdagradParametersOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RetrieveTPUEmbeddingProximalAdagradParametersOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RetrieveTPUEmbeddingProximalAdagradParametersOpAdaptor : public RetrieveTPUEmbeddingProximalAdagradParametersOpGenericAdaptor<::mlir::ValueRange> { +public: + using RetrieveTPUEmbeddingProximalAdagradParametersOpGenericAdaptor::RetrieveTPUEmbeddingProximalAdagradParametersOpGenericAdaptor; + RetrieveTPUEmbeddingProximalAdagradParametersOpAdaptor(RetrieveTPUEmbeddingProximalAdagradParametersOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RetrieveTPUEmbeddingProximalAdagradParametersOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RetrieveTPUEmbeddingProximalAdagradParametersOpAdaptor; + template + using GenericAdaptor = RetrieveTPUEmbeddingProximalAdagradParametersOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RetrieveTPUEmbeddingProximalAdagradParameters"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getAccumulators(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RetrieveTPUEmbeddingProximalAdagradParametersOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RetrieveTPUEmbeddingProximalYogiParametersGradAccumDebugOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RetrieveTPUEmbeddingProximalYogiParametersGradAccumDebugOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RetrieveTPUEmbeddingProximalYogiParametersGradAccumDebugOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RetrieveTPUEmbeddingProximalYogiParametersGradAccumDebugOpGenericAdaptorBase(RetrieveTPUEmbeddingProximalYogiParametersGradAccumDebugOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class RetrieveTPUEmbeddingProximalYogiParametersGradAccumDebugOpGenericAdaptor : public detail::RetrieveTPUEmbeddingProximalYogiParametersGradAccumDebugOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RetrieveTPUEmbeddingProximalYogiParametersGradAccumDebugOpGenericAdaptorBase; +public: + RetrieveTPUEmbeddingProximalYogiParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RetrieveTPUEmbeddingProximalYogiParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RetrieveTPUEmbeddingProximalYogiParametersGradAccumDebugOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RetrieveTPUEmbeddingProximalYogiParametersGradAccumDebugOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RetrieveTPUEmbeddingProximalYogiParametersGradAccumDebugOpAdaptor : public RetrieveTPUEmbeddingProximalYogiParametersGradAccumDebugOpGenericAdaptor<::mlir::ValueRange> { +public: + using RetrieveTPUEmbeddingProximalYogiParametersGradAccumDebugOpGenericAdaptor::RetrieveTPUEmbeddingProximalYogiParametersGradAccumDebugOpGenericAdaptor; + RetrieveTPUEmbeddingProximalYogiParametersGradAccumDebugOpAdaptor(RetrieveTPUEmbeddingProximalYogiParametersGradAccumDebugOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RetrieveTPUEmbeddingProximalYogiParametersGradAccumDebugOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RetrieveTPUEmbeddingProximalYogiParametersGradAccumDebugOpAdaptor; + template + using GenericAdaptor = RetrieveTPUEmbeddingProximalYogiParametersGradAccumDebugOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RetrieveTPUEmbeddingProximalYogiParametersGradAccumDebug"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getV(); + ::mlir::TypedValue<::mlir::TensorType> getM(); + ::mlir::TypedValue<::mlir::TensorType> getGradientAccumulators(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type v, ::mlir::Type m, ::mlir::Type gradient_accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type v, ::mlir::Type m, ::mlir::Type gradient_accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RetrieveTPUEmbeddingProximalYogiParametersGradAccumDebugOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RetrieveTPUEmbeddingProximalYogiParametersOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RetrieveTPUEmbeddingProximalYogiParametersOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RetrieveTPUEmbeddingProximalYogiParametersOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RetrieveTPUEmbeddingProximalYogiParametersOpGenericAdaptorBase(RetrieveTPUEmbeddingProximalYogiParametersOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class RetrieveTPUEmbeddingProximalYogiParametersOpGenericAdaptor : public detail::RetrieveTPUEmbeddingProximalYogiParametersOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RetrieveTPUEmbeddingProximalYogiParametersOpGenericAdaptorBase; +public: + RetrieveTPUEmbeddingProximalYogiParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RetrieveTPUEmbeddingProximalYogiParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RetrieveTPUEmbeddingProximalYogiParametersOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RetrieveTPUEmbeddingProximalYogiParametersOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RetrieveTPUEmbeddingProximalYogiParametersOpAdaptor : public RetrieveTPUEmbeddingProximalYogiParametersOpGenericAdaptor<::mlir::ValueRange> { +public: + using RetrieveTPUEmbeddingProximalYogiParametersOpGenericAdaptor::RetrieveTPUEmbeddingProximalYogiParametersOpGenericAdaptor; + RetrieveTPUEmbeddingProximalYogiParametersOpAdaptor(RetrieveTPUEmbeddingProximalYogiParametersOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RetrieveTPUEmbeddingProximalYogiParametersOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RetrieveTPUEmbeddingProximalYogiParametersOpAdaptor; + template + using GenericAdaptor = RetrieveTPUEmbeddingProximalYogiParametersOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RetrieveTPUEmbeddingProximalYogiParameters"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getV(); + ::mlir::TypedValue<::mlir::TensorType> getM(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type v, ::mlir::Type m, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type v, ::mlir::Type m, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RetrieveTPUEmbeddingProximalYogiParametersOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RetrieveTPUEmbeddingRMSPropParametersGradAccumDebugOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RetrieveTPUEmbeddingRMSPropParametersGradAccumDebugOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RetrieveTPUEmbeddingRMSPropParametersGradAccumDebugOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RetrieveTPUEmbeddingRMSPropParametersGradAccumDebugOpGenericAdaptorBase(RetrieveTPUEmbeddingRMSPropParametersGradAccumDebugOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class RetrieveTPUEmbeddingRMSPropParametersGradAccumDebugOpGenericAdaptor : public detail::RetrieveTPUEmbeddingRMSPropParametersGradAccumDebugOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RetrieveTPUEmbeddingRMSPropParametersGradAccumDebugOpGenericAdaptorBase; +public: + RetrieveTPUEmbeddingRMSPropParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RetrieveTPUEmbeddingRMSPropParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RetrieveTPUEmbeddingRMSPropParametersGradAccumDebugOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RetrieveTPUEmbeddingRMSPropParametersGradAccumDebugOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RetrieveTPUEmbeddingRMSPropParametersGradAccumDebugOpAdaptor : public RetrieveTPUEmbeddingRMSPropParametersGradAccumDebugOpGenericAdaptor<::mlir::ValueRange> { +public: + using RetrieveTPUEmbeddingRMSPropParametersGradAccumDebugOpGenericAdaptor::RetrieveTPUEmbeddingRMSPropParametersGradAccumDebugOpGenericAdaptor; + RetrieveTPUEmbeddingRMSPropParametersGradAccumDebugOpAdaptor(RetrieveTPUEmbeddingRMSPropParametersGradAccumDebugOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RetrieveTPUEmbeddingRMSPropParametersGradAccumDebugOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RetrieveTPUEmbeddingRMSPropParametersGradAccumDebugOpAdaptor; + template + using GenericAdaptor = RetrieveTPUEmbeddingRMSPropParametersGradAccumDebugOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RetrieveTPUEmbeddingRMSPropParametersGradAccumDebug"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getMs(); + ::mlir::TypedValue<::mlir::TensorType> getMom(); + ::mlir::TypedValue<::mlir::TensorType> getGradientAccumulators(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type ms, ::mlir::Type mom, ::mlir::Type gradient_accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type ms, ::mlir::Type mom, ::mlir::Type gradient_accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RetrieveTPUEmbeddingRMSPropParametersGradAccumDebugOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RetrieveTPUEmbeddingRMSPropParametersOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RetrieveTPUEmbeddingRMSPropParametersOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RetrieveTPUEmbeddingRMSPropParametersOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RetrieveTPUEmbeddingRMSPropParametersOpGenericAdaptorBase(RetrieveTPUEmbeddingRMSPropParametersOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class RetrieveTPUEmbeddingRMSPropParametersOpGenericAdaptor : public detail::RetrieveTPUEmbeddingRMSPropParametersOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RetrieveTPUEmbeddingRMSPropParametersOpGenericAdaptorBase; +public: + RetrieveTPUEmbeddingRMSPropParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RetrieveTPUEmbeddingRMSPropParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RetrieveTPUEmbeddingRMSPropParametersOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RetrieveTPUEmbeddingRMSPropParametersOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RetrieveTPUEmbeddingRMSPropParametersOpAdaptor : public RetrieveTPUEmbeddingRMSPropParametersOpGenericAdaptor<::mlir::ValueRange> { +public: + using RetrieveTPUEmbeddingRMSPropParametersOpGenericAdaptor::RetrieveTPUEmbeddingRMSPropParametersOpGenericAdaptor; + RetrieveTPUEmbeddingRMSPropParametersOpAdaptor(RetrieveTPUEmbeddingRMSPropParametersOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RetrieveTPUEmbeddingRMSPropParametersOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RetrieveTPUEmbeddingRMSPropParametersOpAdaptor; + template + using GenericAdaptor = RetrieveTPUEmbeddingRMSPropParametersOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RetrieveTPUEmbeddingRMSPropParameters"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getMs(); + ::mlir::TypedValue<::mlir::TensorType> getMom(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type ms, ::mlir::Type mom, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type ms, ::mlir::Type mom, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RetrieveTPUEmbeddingRMSPropParametersOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RetrieveTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RetrieveTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RetrieveTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RetrieveTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpGenericAdaptorBase(RetrieveTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class RetrieveTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpGenericAdaptor : public detail::RetrieveTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RetrieveTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpGenericAdaptorBase; +public: + RetrieveTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RetrieveTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RetrieveTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RetrieveTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RetrieveTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpAdaptor : public RetrieveTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpGenericAdaptor<::mlir::ValueRange> { +public: + using RetrieveTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpGenericAdaptor::RetrieveTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpGenericAdaptor; + RetrieveTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpAdaptor(RetrieveTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RetrieveTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RetrieveTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpAdaptor; + template + using GenericAdaptor = RetrieveTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RetrieveTPUEmbeddingStochasticGradientDescentParametersGradAccumDebug"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getGradientAccumulators(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type gradient_accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type gradient_accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RetrieveTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RetrieveTPUEmbeddingStochasticGradientDescentParametersOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RetrieveTPUEmbeddingStochasticGradientDescentParametersOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RetrieveTPUEmbeddingStochasticGradientDescentParametersOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RetrieveTPUEmbeddingStochasticGradientDescentParametersOpGenericAdaptorBase(RetrieveTPUEmbeddingStochasticGradientDescentParametersOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class RetrieveTPUEmbeddingStochasticGradientDescentParametersOpGenericAdaptor : public detail::RetrieveTPUEmbeddingStochasticGradientDescentParametersOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RetrieveTPUEmbeddingStochasticGradientDescentParametersOpGenericAdaptorBase; +public: + RetrieveTPUEmbeddingStochasticGradientDescentParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RetrieveTPUEmbeddingStochasticGradientDescentParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RetrieveTPUEmbeddingStochasticGradientDescentParametersOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RetrieveTPUEmbeddingStochasticGradientDescentParametersOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RetrieveTPUEmbeddingStochasticGradientDescentParametersOpAdaptor : public RetrieveTPUEmbeddingStochasticGradientDescentParametersOpGenericAdaptor<::mlir::ValueRange> { +public: + using RetrieveTPUEmbeddingStochasticGradientDescentParametersOpGenericAdaptor::RetrieveTPUEmbeddingStochasticGradientDescentParametersOpGenericAdaptor; + RetrieveTPUEmbeddingStochasticGradientDescentParametersOpAdaptor(RetrieveTPUEmbeddingStochasticGradientDescentParametersOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RetrieveTPUEmbeddingStochasticGradientDescentParametersOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RetrieveTPUEmbeddingStochasticGradientDescentParametersOpAdaptor; + template + using GenericAdaptor = RetrieveTPUEmbeddingStochasticGradientDescentParametersOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RetrieveTPUEmbeddingStochasticGradientDescentParameters"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RetrieveTPUEmbeddingStochasticGradientDescentParametersOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ReverseOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReverseOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ReverseOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ReverseOpGenericAdaptorBase(ReverseOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ReverseOpGenericAdaptor : public detail::ReverseOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReverseOpGenericAdaptorBase; +public: + ReverseOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReverseOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReverseOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ReverseOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTensor() { + return (*getODSOperands(0).begin()); + } + + ValueT getDims() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ReverseOpAdaptor : public ReverseOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReverseOpGenericAdaptor::ReverseOpGenericAdaptor; + ReverseOpAdaptor(ReverseOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReverseOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ReverseOpAdaptor; + template + using GenericAdaptor = ReverseOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Reverse"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::TypedValue<::mlir::TensorType> getDims(); + ::mlir::OpOperand &getTensorMutable(); + ::mlir::OpOperand &getDimsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value tensor, ::mlir::Value dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tensor, ::mlir::Value dims); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ReverseOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ReverseSequenceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReverseSequenceOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ReverseSequenceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ReverseSequenceOpGenericAdaptorBase(ReverseSequenceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getSeqDimAttr(); + uint64_t getSeqDim(); + ::mlir::IntegerAttr getBatchDimAttr(); + uint64_t getBatchDim(); +}; +} // namespace detail +template +class ReverseSequenceOpGenericAdaptor : public detail::ReverseSequenceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReverseSequenceOpGenericAdaptorBase; +public: + ReverseSequenceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReverseSequenceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReverseSequenceOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ReverseSequenceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getSeqLengths() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ReverseSequenceOpAdaptor : public ReverseSequenceOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReverseSequenceOpGenericAdaptor::ReverseSequenceOpGenericAdaptor; + ReverseSequenceOpAdaptor(ReverseSequenceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReverseSequenceOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ReverseSequenceOpAdaptor; + template + using GenericAdaptor = ReverseSequenceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tlen"), ::llvm::StringRef("batch_dim"), ::llvm::StringRef("seq_dim")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTlenAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTlenAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getBatchDimAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getBatchDimAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSeqDimAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSeqDimAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ReverseSequence"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getSeqLengths(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getSeqLengthsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getSeqDimAttr(); + uint64_t getSeqDim(); + ::mlir::IntegerAttr getBatchDimAttr(); + uint64_t getBatchDim(); + ::mlir::Type getT(); + ::mlir::Type getTlen(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setSeqDimAttr(::mlir::IntegerAttr attr); + void setSeqDim(uint64_t attrValue); + void setBatchDimAttr(::mlir::IntegerAttr attr); + void setBatchDim(::std::optional attrValue); + ::mlir::Attribute removeBatchDimAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value seq_lengths, ::mlir::IntegerAttr seq_dim, /*optional*/::mlir::IntegerAttr batch_dim); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value seq_lengths, ::mlir::IntegerAttr seq_dim, /*optional*/::mlir::IntegerAttr batch_dim); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value seq_lengths, uint64_t seq_dim, /*optional*/uint64_t batch_dim = 0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value seq_lengths, uint64_t seq_dim, /*optional*/uint64_t batch_dim = 0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ReverseSequenceOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ReverseV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReverseV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ReverseV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ReverseV2OpGenericAdaptorBase(ReverseV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ReverseV2OpGenericAdaptor : public detail::ReverseV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReverseV2OpGenericAdaptorBase; +public: + ReverseV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReverseV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReverseV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ReverseV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTensor() { + return (*getODSOperands(0).begin()); + } + + ValueT getAxis() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ReverseV2OpAdaptor : public ReverseV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using ReverseV2OpGenericAdaptor::ReverseV2OpGenericAdaptor; + ReverseV2OpAdaptor(ReverseV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReverseV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ReverseV2OpAdaptor; + template + using GenericAdaptor = ReverseV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tidx")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTidxAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTidxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ReverseV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::TypedValue<::mlir::TensorType> getAxis(); + ::mlir::OpOperand &getTensorMutable(); + ::mlir::OpOperand &getAxisMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTidx(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value tensor, ::mlir::Value axis); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tensor, ::mlir::Value axis); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ReverseV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RightShiftOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RightShiftOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RightShiftOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RightShiftOpGenericAdaptorBase(RightShiftOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RightShiftOpGenericAdaptor : public detail::RightShiftOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RightShiftOpGenericAdaptorBase; +public: + RightShiftOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RightShiftOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RightShiftOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RightShiftOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RightShiftOpAdaptor : public RightShiftOpGenericAdaptor<::mlir::ValueRange> { +public: + using RightShiftOpGenericAdaptor::RightShiftOpGenericAdaptor; + RightShiftOpAdaptor(RightShiftOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RightShiftOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RightShiftOpAdaptor; + template + using GenericAdaptor = RightShiftOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RightShift"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RightShiftOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RintOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RintOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RintOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RintOpGenericAdaptorBase(RintOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RintOpGenericAdaptor : public detail::RintOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RintOpGenericAdaptorBase; +public: + RintOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RintOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RintOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RintOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RintOpAdaptor : public RintOpGenericAdaptor<::mlir::ValueRange> { +public: + using RintOpGenericAdaptor::RintOpGenericAdaptor; + RintOpAdaptor(RintOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RintOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::IsIdempotent, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RintOpAdaptor; + template + using GenericAdaptor = RintOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Rint"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RintOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RiscAddOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RiscAddOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RiscAddOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RiscAddOpGenericAdaptorBase(RiscAddOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RiscAddOpGenericAdaptor : public detail::RiscAddOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RiscAddOpGenericAdaptorBase; +public: + RiscAddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RiscAddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RiscAddOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RiscAddOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RiscAddOpAdaptor : public RiscAddOpGenericAdaptor<::mlir::ValueRange> { +public: + using RiscAddOpGenericAdaptor::RiscAddOpGenericAdaptor; + RiscAddOpAdaptor(RiscAddOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RiscAddOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsCommutative, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RiscAddOpAdaptor; + template + using GenericAdaptor = RiscAddOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RiscAdd"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RiscAddOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RiscDotOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RiscDotOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RiscDotOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RiscDotOpGenericAdaptorBase(RiscDotOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getTransposeAAttr(); + bool getTransposeA(); + ::mlir::BoolAttr getTransposeBAttr(); + bool getTransposeB(); +}; +} // namespace detail +template +class RiscDotOpGenericAdaptor : public detail::RiscDotOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RiscDotOpGenericAdaptorBase; +public: + RiscDotOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RiscDotOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RiscDotOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RiscDotOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + ValueT getB() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RiscDotOpAdaptor : public RiscDotOpGenericAdaptor<::mlir::ValueRange> { +public: + using RiscDotOpGenericAdaptor::RiscDotOpGenericAdaptor; + RiscDotOpAdaptor(RiscDotOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RiscDotOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RiscDotOpAdaptor; + template + using GenericAdaptor = RiscDotOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("transpose_a"), ::llvm::StringRef("transpose_b")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTransposeAAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTransposeAAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTransposeBAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTransposeBAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RiscDot"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getA(); + ::mlir::TypedValue<::mlir::TensorType> getB(); + ::mlir::OpOperand &getAMutable(); + ::mlir::OpOperand &getBMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getProduct(); + ::mlir::BoolAttr getTransposeAAttr(); + bool getTransposeA(); + ::mlir::BoolAttr getTransposeBAttr(); + bool getTransposeB(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setTransposeAAttr(::mlir::BoolAttr attr); + void setTransposeA(::std::optional attrValue); + void setTransposeBAttr(::mlir::BoolAttr attr); + void setTransposeB(::std::optional attrValue); + ::mlir::Attribute removeTransposeAAttr(); + ::mlir::Attribute removeTransposeBAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type product, ::mlir::Value a, ::mlir::Value b, /*optional*/::mlir::BoolAttr transpose_a, /*optional*/::mlir::BoolAttr transpose_b); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, /*optional*/::mlir::BoolAttr transpose_a, /*optional*/::mlir::BoolAttr transpose_b); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type product, ::mlir::Value a, ::mlir::Value b, /*optional*/bool transpose_a = false, /*optional*/bool transpose_b = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, /*optional*/bool transpose_a = false, /*optional*/bool transpose_b = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RiscDotOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RngReadAndSkipOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RngReadAndSkipOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RngReadAndSkipOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RngReadAndSkipOpGenericAdaptorBase(RngReadAndSkipOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RngReadAndSkipOpGenericAdaptor : public detail::RngReadAndSkipOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RngReadAndSkipOpGenericAdaptorBase; +public: + RngReadAndSkipOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RngReadAndSkipOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RngReadAndSkipOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RngReadAndSkipOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getResource() { + return (*getODSOperands(0).begin()); + } + + ValueT getAlg() { + return (*getODSOperands(1).begin()); + } + + ValueT getDelta() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RngReadAndSkipOpAdaptor : public RngReadAndSkipOpGenericAdaptor<::mlir::ValueRange> { +public: + using RngReadAndSkipOpGenericAdaptor::RngReadAndSkipOpGenericAdaptor; + RngReadAndSkipOpAdaptor(RngReadAndSkipOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RngReadAndSkipOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = RngReadAndSkipOpAdaptor; + template + using GenericAdaptor = RngReadAndSkipOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RngReadAndSkip"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResource(); + ::mlir::TypedValue<::mlir::TensorType> getAlg(); + ::mlir::TypedValue<::mlir::TensorType> getDelta(); + ::mlir::OpOperand &getResourceMutable(); + ::mlir::OpOperand &getAlgMutable(); + ::mlir::OpOperand &getDeltaMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getValue(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type value, ::mlir::Value resource, ::mlir::Value alg, ::mlir::Value delta); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value resource, ::mlir::Value alg, ::mlir::Value delta); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RngReadAndSkipOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RollOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RollOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RollOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RollOpGenericAdaptorBase(RollOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RollOpGenericAdaptor : public detail::RollOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RollOpGenericAdaptorBase; +public: + RollOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RollOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RollOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RollOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getShift() { + return (*getODSOperands(1).begin()); + } + + ValueT getAxis() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RollOpAdaptor : public RollOpGenericAdaptor<::mlir::ValueRange> { +public: + using RollOpGenericAdaptor::RollOpGenericAdaptor; + RollOpAdaptor(RollOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RollOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RollOpAdaptor; + template + using GenericAdaptor = RollOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Taxis"), ::llvm::StringRef("Tshift")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTaxisAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTaxisAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTshiftAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTshiftAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Roll"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getShift(); + ::mlir::TypedValue<::mlir::TensorType> getAxis(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getShiftMutable(); + ::mlir::OpOperand &getAxisMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTaxis(); + ::mlir::Type getTshift(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value shift, ::mlir::Value axis); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value shift, ::mlir::Value axis); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RollOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RoundOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RoundOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RoundOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RoundOpGenericAdaptorBase(RoundOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RoundOpGenericAdaptor : public detail::RoundOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RoundOpGenericAdaptorBase; +public: + RoundOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RoundOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RoundOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RoundOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RoundOpAdaptor : public RoundOpGenericAdaptor<::mlir::ValueRange> { +public: + using RoundOpGenericAdaptor::RoundOpGenericAdaptor; + RoundOpAdaptor(RoundOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RoundOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::IsIdempotent, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RoundOpAdaptor; + template + using GenericAdaptor = RoundOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Round"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RoundOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RsqrtGradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RsqrtGradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RsqrtGradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RsqrtGradOpGenericAdaptorBase(RsqrtGradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RsqrtGradOpGenericAdaptor : public detail::RsqrtGradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RsqrtGradOpGenericAdaptorBase; +public: + RsqrtGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RsqrtGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RsqrtGradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RsqrtGradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getY() { + return (*getODSOperands(0).begin()); + } + + ValueT getDy() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RsqrtGradOpAdaptor : public RsqrtGradOpGenericAdaptor<::mlir::ValueRange> { +public: + using RsqrtGradOpGenericAdaptor::RsqrtGradOpGenericAdaptor; + RsqrtGradOpAdaptor(RsqrtGradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RsqrtGradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RsqrtGradOpAdaptor; + template + using GenericAdaptor = RsqrtGradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RsqrtGrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::TypedValue<::mlir::TensorType> getDy(); + ::mlir::OpOperand &getYMutable(); + ::mlir::OpOperand &getDyMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value y, ::mlir::Value dy); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value y, ::mlir::Value dy); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value y, ::mlir::Value dy); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RsqrtGradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RsqrtOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RsqrtOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RsqrtOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RsqrtOpGenericAdaptorBase(RsqrtOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RsqrtOpGenericAdaptor : public detail::RsqrtOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RsqrtOpGenericAdaptorBase; +public: + RsqrtOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RsqrtOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RsqrtOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RsqrtOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RsqrtOpAdaptor : public RsqrtOpGenericAdaptor<::mlir::ValueRange> { +public: + using RsqrtOpGenericAdaptor::RsqrtOpGenericAdaptor; + RsqrtOpAdaptor(RsqrtOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RsqrtOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RsqrtOpAdaptor; + template + using GenericAdaptor = RsqrtOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Rsqrt"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RsqrtOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SaveOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SaveOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SaveOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SaveOpGenericAdaptorBase(SaveOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SaveOpGenericAdaptor : public detail::SaveOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SaveOpGenericAdaptorBase; +public: + SaveOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SaveOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SaveOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SaveOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getFilename() { + return (*getODSOperands(0).begin()); + } + + ValueT getTensorNames() { + return (*getODSOperands(1).begin()); + } + + RangeT getData() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SaveOpAdaptor : public SaveOpGenericAdaptor<::mlir::ValueRange> { +public: + using SaveOpGenericAdaptor::SaveOpGenericAdaptor; + SaveOpAdaptor(SaveOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SaveOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SaveOpAdaptor; + template + using GenericAdaptor = SaveOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Save"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getFilename(); + ::mlir::TypedValue<::mlir::TensorType> getTensorNames(); + ::mlir::Operation::operand_range getData(); + ::mlir::OpOperand &getFilenameMutable(); + ::mlir::OpOperand &getTensorNamesMutable(); + ::mlir::MutableOperandRange getDataMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + mlir::OperandElementTypeRange getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value filename, ::mlir::Value tensor_names, ::mlir::ValueRange data); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value filename, ::mlir::Value tensor_names, ::mlir::ValueRange data); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SaveOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SaveSlicesOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SaveSlicesOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SaveSlicesOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SaveSlicesOpGenericAdaptorBase(SaveSlicesOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SaveSlicesOpGenericAdaptor : public detail::SaveSlicesOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SaveSlicesOpGenericAdaptorBase; +public: + SaveSlicesOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SaveSlicesOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SaveSlicesOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SaveSlicesOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getFilename() { + return (*getODSOperands(0).begin()); + } + + ValueT getTensorNames() { + return (*getODSOperands(1).begin()); + } + + ValueT getShapesAndSlices() { + return (*getODSOperands(2).begin()); + } + + RangeT getData() { + return getODSOperands(3); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SaveSlicesOpAdaptor : public SaveSlicesOpGenericAdaptor<::mlir::ValueRange> { +public: + using SaveSlicesOpGenericAdaptor::SaveSlicesOpGenericAdaptor; + SaveSlicesOpAdaptor(SaveSlicesOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SaveSlicesOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SaveSlicesOpAdaptor; + template + using GenericAdaptor = SaveSlicesOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SaveSlices"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getFilename(); + ::mlir::TypedValue<::mlir::TensorType> getTensorNames(); + ::mlir::TypedValue<::mlir::TensorType> getShapesAndSlices(); + ::mlir::Operation::operand_range getData(); + ::mlir::OpOperand &getFilenameMutable(); + ::mlir::OpOperand &getTensorNamesMutable(); + ::mlir::OpOperand &getShapesAndSlicesMutable(); + ::mlir::MutableOperandRange getDataMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + mlir::OperandElementTypeRange getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value filename, ::mlir::Value tensor_names, ::mlir::Value shapes_and_slices, ::mlir::ValueRange data); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value filename, ::mlir::Value tensor_names, ::mlir::Value shapes_and_slices, ::mlir::ValueRange data); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SaveSlicesOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SaveV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SaveV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SaveV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SaveV2OpGenericAdaptorBase(SaveV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SaveV2OpGenericAdaptor : public detail::SaveV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SaveV2OpGenericAdaptorBase; +public: + SaveV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SaveV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SaveV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SaveV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getPrefix() { + return (*getODSOperands(0).begin()); + } + + ValueT getTensorNames() { + return (*getODSOperands(1).begin()); + } + + ValueT getShapeAndSlices() { + return (*getODSOperands(2).begin()); + } + + RangeT getTensors() { + return getODSOperands(3); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SaveV2OpAdaptor : public SaveV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using SaveV2OpGenericAdaptor::SaveV2OpGenericAdaptor; + SaveV2OpAdaptor(SaveV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SaveV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SaveV2OpAdaptor; + template + using GenericAdaptor = SaveV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dtypes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDtypesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDtypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SaveV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getPrefix(); + ::mlir::TypedValue<::mlir::TensorType> getTensorNames(); + ::mlir::TypedValue<::mlir::TensorType> getShapeAndSlices(); + ::mlir::Operation::operand_range getTensors(); + ::mlir::OpOperand &getPrefixMutable(); + ::mlir::OpOperand &getTensorNamesMutable(); + ::mlir::OpOperand &getShapeAndSlicesMutable(); + ::mlir::MutableOperandRange getTensorsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + mlir::OperandElementTypeRange getDtypes(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value prefix, ::mlir::Value tensor_names, ::mlir::Value shape_and_slices, ::mlir::ValueRange tensors); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value prefix, ::mlir::Value tensor_names, ::mlir::Value shape_and_slices, ::mlir::ValueRange tensors); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SaveV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ScatterNdOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ScatterNdOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ScatterNdOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ScatterNdOpGenericAdaptorBase(ScatterNdOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ScatterNdOpGenericAdaptor : public detail::ScatterNdOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ScatterNdOpGenericAdaptorBase; +public: + ScatterNdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ScatterNdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ScatterNdOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ScatterNdOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIndices() { + return (*getODSOperands(0).begin()); + } + + ValueT getUpdates() { + return (*getODSOperands(1).begin()); + } + + ValueT getShape() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ScatterNdOpAdaptor : public ScatterNdOpGenericAdaptor<::mlir::ValueRange> { +public: + using ScatterNdOpGenericAdaptor::ScatterNdOpGenericAdaptor; + ScatterNdOpAdaptor(ScatterNdOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ScatterNdOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ScatterNdOpAdaptor; + template + using GenericAdaptor = ScatterNdOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ScatterNd"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getUpdates(); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getUpdatesMutable(); + ::mlir::OpOperand &getShapeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value indices, ::mlir::Value updates, ::mlir::Value shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value indices, ::mlir::Value updates, ::mlir::Value shape); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ScatterNdOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SegmentMaxOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SegmentMaxOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SegmentMaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SegmentMaxOpGenericAdaptorBase(SegmentMaxOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SegmentMaxOpGenericAdaptor : public detail::SegmentMaxOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SegmentMaxOpGenericAdaptorBase; +public: + SegmentMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SegmentMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SegmentMaxOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SegmentMaxOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getData() { + return (*getODSOperands(0).begin()); + } + + ValueT getSegmentIds() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SegmentMaxOpAdaptor : public SegmentMaxOpGenericAdaptor<::mlir::ValueRange> { +public: + using SegmentMaxOpGenericAdaptor::SegmentMaxOpGenericAdaptor; + SegmentMaxOpAdaptor(SegmentMaxOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SegmentMaxOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SegmentMaxOpAdaptor; + template + using GenericAdaptor = SegmentMaxOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SegmentMax"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getData(); + ::mlir::TypedValue<::mlir::TensorType> getSegmentIds(); + ::mlir::OpOperand &getDataMutable(); + ::mlir::OpOperand &getSegmentIdsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value data, ::mlir::Value segment_ids); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value data, ::mlir::Value segment_ids); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SegmentMaxOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SegmentMaxV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SegmentMaxV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SegmentMaxV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SegmentMaxV2OpGenericAdaptorBase(SegmentMaxV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SegmentMaxV2OpGenericAdaptor : public detail::SegmentMaxV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SegmentMaxV2OpGenericAdaptorBase; +public: + SegmentMaxV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SegmentMaxV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SegmentMaxV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SegmentMaxV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getData() { + return (*getODSOperands(0).begin()); + } + + ValueT getSegmentIds() { + return (*getODSOperands(1).begin()); + } + + ValueT getNumSegments() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SegmentMaxV2OpAdaptor : public SegmentMaxV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using SegmentMaxV2OpGenericAdaptor::SegmentMaxV2OpGenericAdaptor; + SegmentMaxV2OpAdaptor(SegmentMaxV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SegmentMaxV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SegmentMaxV2OpAdaptor; + template + using GenericAdaptor = SegmentMaxV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices"), ::llvm::StringRef("Tnumsegments")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTnumsegmentsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTnumsegmentsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SegmentMaxV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getData(); + ::mlir::TypedValue<::mlir::TensorType> getSegmentIds(); + ::mlir::TypedValue<::mlir::TensorType> getNumSegments(); + ::mlir::OpOperand &getDataMutable(); + ::mlir::OpOperand &getSegmentIdsMutable(); + ::mlir::OpOperand &getNumSegmentsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + ::mlir::Type getTnumsegments(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value data, ::mlir::Value segment_ids, ::mlir::Value num_segments); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value data, ::mlir::Value segment_ids, ::mlir::Value num_segments); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SegmentMaxV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SegmentMeanOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SegmentMeanOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SegmentMeanOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SegmentMeanOpGenericAdaptorBase(SegmentMeanOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SegmentMeanOpGenericAdaptor : public detail::SegmentMeanOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SegmentMeanOpGenericAdaptorBase; +public: + SegmentMeanOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SegmentMeanOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SegmentMeanOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SegmentMeanOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getData() { + return (*getODSOperands(0).begin()); + } + + ValueT getSegmentIds() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SegmentMeanOpAdaptor : public SegmentMeanOpGenericAdaptor<::mlir::ValueRange> { +public: + using SegmentMeanOpGenericAdaptor::SegmentMeanOpGenericAdaptor; + SegmentMeanOpAdaptor(SegmentMeanOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SegmentMeanOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SegmentMeanOpAdaptor; + template + using GenericAdaptor = SegmentMeanOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SegmentMean"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getData(); + ::mlir::TypedValue<::mlir::TensorType> getSegmentIds(); + ::mlir::OpOperand &getDataMutable(); + ::mlir::OpOperand &getSegmentIdsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value data, ::mlir::Value segment_ids); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value data, ::mlir::Value segment_ids); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SegmentMeanOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SegmentMinOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SegmentMinOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SegmentMinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SegmentMinOpGenericAdaptorBase(SegmentMinOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SegmentMinOpGenericAdaptor : public detail::SegmentMinOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SegmentMinOpGenericAdaptorBase; +public: + SegmentMinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SegmentMinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SegmentMinOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SegmentMinOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getData() { + return (*getODSOperands(0).begin()); + } + + ValueT getSegmentIds() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SegmentMinOpAdaptor : public SegmentMinOpGenericAdaptor<::mlir::ValueRange> { +public: + using SegmentMinOpGenericAdaptor::SegmentMinOpGenericAdaptor; + SegmentMinOpAdaptor(SegmentMinOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SegmentMinOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SegmentMinOpAdaptor; + template + using GenericAdaptor = SegmentMinOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SegmentMin"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getData(); + ::mlir::TypedValue<::mlir::TensorType> getSegmentIds(); + ::mlir::OpOperand &getDataMutable(); + ::mlir::OpOperand &getSegmentIdsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value data, ::mlir::Value segment_ids); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value data, ::mlir::Value segment_ids); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SegmentMinOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SegmentMinV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SegmentMinV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SegmentMinV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SegmentMinV2OpGenericAdaptorBase(SegmentMinV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SegmentMinV2OpGenericAdaptor : public detail::SegmentMinV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SegmentMinV2OpGenericAdaptorBase; +public: + SegmentMinV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SegmentMinV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SegmentMinV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SegmentMinV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getData() { + return (*getODSOperands(0).begin()); + } + + ValueT getSegmentIds() { + return (*getODSOperands(1).begin()); + } + + ValueT getNumSegments() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SegmentMinV2OpAdaptor : public SegmentMinV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using SegmentMinV2OpGenericAdaptor::SegmentMinV2OpGenericAdaptor; + SegmentMinV2OpAdaptor(SegmentMinV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SegmentMinV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SegmentMinV2OpAdaptor; + template + using GenericAdaptor = SegmentMinV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices"), ::llvm::StringRef("Tnumsegments")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTnumsegmentsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTnumsegmentsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SegmentMinV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getData(); + ::mlir::TypedValue<::mlir::TensorType> getSegmentIds(); + ::mlir::TypedValue<::mlir::TensorType> getNumSegments(); + ::mlir::OpOperand &getDataMutable(); + ::mlir::OpOperand &getSegmentIdsMutable(); + ::mlir::OpOperand &getNumSegmentsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + ::mlir::Type getTnumsegments(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value data, ::mlir::Value segment_ids, ::mlir::Value num_segments); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value data, ::mlir::Value segment_ids, ::mlir::Value num_segments); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SegmentMinV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SegmentProdOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SegmentProdOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SegmentProdOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SegmentProdOpGenericAdaptorBase(SegmentProdOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SegmentProdOpGenericAdaptor : public detail::SegmentProdOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SegmentProdOpGenericAdaptorBase; +public: + SegmentProdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SegmentProdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SegmentProdOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SegmentProdOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getData() { + return (*getODSOperands(0).begin()); + } + + ValueT getSegmentIds() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SegmentProdOpAdaptor : public SegmentProdOpGenericAdaptor<::mlir::ValueRange> { +public: + using SegmentProdOpGenericAdaptor::SegmentProdOpGenericAdaptor; + SegmentProdOpAdaptor(SegmentProdOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SegmentProdOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SegmentProdOpAdaptor; + template + using GenericAdaptor = SegmentProdOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SegmentProd"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getData(); + ::mlir::TypedValue<::mlir::TensorType> getSegmentIds(); + ::mlir::OpOperand &getDataMutable(); + ::mlir::OpOperand &getSegmentIdsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value data, ::mlir::Value segment_ids); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value data, ::mlir::Value segment_ids); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SegmentProdOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SegmentProdV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SegmentProdV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SegmentProdV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SegmentProdV2OpGenericAdaptorBase(SegmentProdV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SegmentProdV2OpGenericAdaptor : public detail::SegmentProdV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SegmentProdV2OpGenericAdaptorBase; +public: + SegmentProdV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SegmentProdV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SegmentProdV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SegmentProdV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getData() { + return (*getODSOperands(0).begin()); + } + + ValueT getSegmentIds() { + return (*getODSOperands(1).begin()); + } + + ValueT getNumSegments() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SegmentProdV2OpAdaptor : public SegmentProdV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using SegmentProdV2OpGenericAdaptor::SegmentProdV2OpGenericAdaptor; + SegmentProdV2OpAdaptor(SegmentProdV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SegmentProdV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SegmentProdV2OpAdaptor; + template + using GenericAdaptor = SegmentProdV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices"), ::llvm::StringRef("Tnumsegments")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTnumsegmentsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTnumsegmentsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SegmentProdV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getData(); + ::mlir::TypedValue<::mlir::TensorType> getSegmentIds(); + ::mlir::TypedValue<::mlir::TensorType> getNumSegments(); + ::mlir::OpOperand &getDataMutable(); + ::mlir::OpOperand &getSegmentIdsMutable(); + ::mlir::OpOperand &getNumSegmentsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + ::mlir::Type getTnumsegments(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value data, ::mlir::Value segment_ids, ::mlir::Value num_segments); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value data, ::mlir::Value segment_ids, ::mlir::Value num_segments); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SegmentProdV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SegmentSumOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SegmentSumOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SegmentSumOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SegmentSumOpGenericAdaptorBase(SegmentSumOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SegmentSumOpGenericAdaptor : public detail::SegmentSumOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SegmentSumOpGenericAdaptorBase; +public: + SegmentSumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SegmentSumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SegmentSumOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SegmentSumOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getData() { + return (*getODSOperands(0).begin()); + } + + ValueT getSegmentIds() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SegmentSumOpAdaptor : public SegmentSumOpGenericAdaptor<::mlir::ValueRange> { +public: + using SegmentSumOpGenericAdaptor::SegmentSumOpGenericAdaptor; + SegmentSumOpAdaptor(SegmentSumOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SegmentSumOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SegmentSumOpAdaptor; + template + using GenericAdaptor = SegmentSumOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SegmentSum"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getData(); + ::mlir::TypedValue<::mlir::TensorType> getSegmentIds(); + ::mlir::OpOperand &getDataMutable(); + ::mlir::OpOperand &getSegmentIdsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value data, ::mlir::Value segment_ids); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value data, ::mlir::Value segment_ids); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SegmentSumOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SegmentSumV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SegmentSumV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SegmentSumV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SegmentSumV2OpGenericAdaptorBase(SegmentSumV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SegmentSumV2OpGenericAdaptor : public detail::SegmentSumV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SegmentSumV2OpGenericAdaptorBase; +public: + SegmentSumV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SegmentSumV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SegmentSumV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SegmentSumV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getData() { + return (*getODSOperands(0).begin()); + } + + ValueT getSegmentIds() { + return (*getODSOperands(1).begin()); + } + + ValueT getNumSegments() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SegmentSumV2OpAdaptor : public SegmentSumV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using SegmentSumV2OpGenericAdaptor::SegmentSumV2OpGenericAdaptor; + SegmentSumV2OpAdaptor(SegmentSumV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SegmentSumV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SegmentSumV2OpAdaptor; + template + using GenericAdaptor = SegmentSumV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices"), ::llvm::StringRef("Tnumsegments")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTnumsegmentsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTnumsegmentsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SegmentSumV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getData(); + ::mlir::TypedValue<::mlir::TensorType> getSegmentIds(); + ::mlir::TypedValue<::mlir::TensorType> getNumSegments(); + ::mlir::OpOperand &getDataMutable(); + ::mlir::OpOperand &getSegmentIdsMutable(); + ::mlir::OpOperand &getNumSegmentsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + ::mlir::Type getTnumsegments(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value data, ::mlir::Value segment_ids, ::mlir::Value num_segments); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value data, ::mlir::Value segment_ids, ::mlir::Value num_segments); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SegmentSumV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SelectOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SelectOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SelectOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SelectOpGenericAdaptorBase(SelectOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SelectOpGenericAdaptor : public detail::SelectOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SelectOpGenericAdaptorBase; +public: + SelectOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SelectOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SelectOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SelectOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getCondition() { + return (*getODSOperands(0).begin()); + } + + ValueT getThenValue() { + return (*getODSOperands(1).begin()); + } + + ValueT getElseValue() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SelectOpAdaptor : public SelectOpGenericAdaptor<::mlir::ValueRange> { +public: + using SelectOpGenericAdaptor::SelectOpGenericAdaptor; + SelectOpAdaptor(SelectOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SelectOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SelectOpAdaptor; + template + using GenericAdaptor = SelectOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Select"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getCondition(); + ::mlir::TypedValue<::mlir::TensorType> getThenValue(); + ::mlir::TypedValue<::mlir::TensorType> getElseValue(); + ::mlir::OpOperand &getConditionMutable(); + ::mlir::OpOperand &getThenValueMutable(); + ::mlir::OpOperand &getElseValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value condition, ::mlir::Value then_value, ::mlir::Value else_value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value condition, ::mlir::Value then_value, ::mlir::Value else_value); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SelectOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SelectV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SelectV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SelectV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SelectV2OpGenericAdaptorBase(SelectV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SelectV2OpGenericAdaptor : public detail::SelectV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SelectV2OpGenericAdaptorBase; +public: + SelectV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SelectV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SelectV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SelectV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getCondition() { + return (*getODSOperands(0).begin()); + } + + ValueT getThenValue() { + return (*getODSOperands(1).begin()); + } + + ValueT getElseValue() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SelectV2OpAdaptor : public SelectV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using SelectV2OpGenericAdaptor::SelectV2OpGenericAdaptor; + SelectV2OpAdaptor(SelectV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SelectV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SelectV2OpAdaptor; + template + using GenericAdaptor = SelectV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SelectV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getCondition(); + ::mlir::TypedValue<::mlir::TensorType> getThenValue(); + ::mlir::TypedValue<::mlir::TensorType> getElseValue(); + ::mlir::OpOperand &getConditionMutable(); + ::mlir::OpOperand &getThenValueMutable(); + ::mlir::OpOperand &getElseValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value condition, Value e, Value t); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value condition, ::mlir::Value then_value, ::mlir::Value else_value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value condition, ::mlir::Value then_value, ::mlir::Value else_value); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SelectV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SelfAdjointEigV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SelfAdjointEigV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SelfAdjointEigV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SelfAdjointEigV2OpGenericAdaptorBase(SelfAdjointEigV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getComputeVAttr(); + bool getComputeV(); +}; +} // namespace detail +template +class SelfAdjointEigV2OpGenericAdaptor : public detail::SelfAdjointEigV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SelfAdjointEigV2OpGenericAdaptorBase; +public: + SelfAdjointEigV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SelfAdjointEigV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SelfAdjointEigV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SelfAdjointEigV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SelfAdjointEigV2OpAdaptor : public SelfAdjointEigV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using SelfAdjointEigV2OpGenericAdaptor::SelfAdjointEigV2OpGenericAdaptor; + SelfAdjointEigV2OpAdaptor(SelfAdjointEigV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SelfAdjointEigV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SelfAdjointEigV2OpAdaptor; + template + using GenericAdaptor = SelfAdjointEigV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("compute_v")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getComputeVAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getComputeVAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SelfAdjointEigV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getE(); + ::mlir::TypedValue<::mlir::TensorType> getV(); + ::mlir::BoolAttr getComputeVAttr(); + bool getComputeV(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setComputeVAttr(::mlir::BoolAttr attr); + void setComputeV(::std::optional attrValue); + ::mlir::Attribute removeComputeVAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type e, ::mlir::Type v, ::mlir::Value input, /*optional*/::mlir::BoolAttr compute_v); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, /*optional*/::mlir::BoolAttr compute_v); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type e, ::mlir::Type v, ::mlir::Value input, /*optional*/bool compute_v = true); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, /*optional*/bool compute_v = true); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SelfAdjointEigV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SeluGradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SeluGradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SeluGradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SeluGradOpGenericAdaptorBase(SeluGradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SeluGradOpGenericAdaptor : public detail::SeluGradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SeluGradOpGenericAdaptorBase; +public: + SeluGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SeluGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SeluGradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SeluGradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getGradients() { + return (*getODSOperands(0).begin()); + } + + ValueT getOutputs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SeluGradOpAdaptor : public SeluGradOpGenericAdaptor<::mlir::ValueRange> { +public: + using SeluGradOpGenericAdaptor::SeluGradOpGenericAdaptor; + SeluGradOpAdaptor(SeluGradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SeluGradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SeluGradOpAdaptor; + template + using GenericAdaptor = SeluGradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SeluGrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getGradients(); + ::mlir::TypedValue<::mlir::TensorType> getOutputs(); + ::mlir::OpOperand &getGradientsMutable(); + ::mlir::OpOperand &getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getBackprops(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type backprops, ::mlir::Value gradients, ::mlir::Value outputs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value gradients, ::mlir::Value outputs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value gradients, ::mlir::Value outputs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SeluGradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SeluOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SeluOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SeluOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SeluOpGenericAdaptorBase(SeluOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SeluOpGenericAdaptor : public detail::SeluOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SeluOpGenericAdaptorBase; +public: + SeluOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SeluOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SeluOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SeluOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getFeatures() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SeluOpAdaptor : public SeluOpGenericAdaptor<::mlir::ValueRange> { +public: + using SeluOpGenericAdaptor::SeluOpGenericAdaptor; + SeluOpAdaptor(SeluOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SeluOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SeluOpAdaptor; + template + using GenericAdaptor = SeluOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Selu"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getFeatures(); + ::mlir::OpOperand &getFeaturesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getActivations(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type activations, ::mlir::Value features); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value features); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value features); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SeluOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SendOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SendOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SendOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SendOpGenericAdaptorBase(SendOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getTensorNameAttr(); + ::llvm::StringRef getTensorName(); + ::mlir::StringAttr getSendDeviceAttr(); + ::llvm::StringRef getSendDevice(); + ::mlir::IntegerAttr getSendDeviceIncarnationAttr(); + uint64_t getSendDeviceIncarnation(); + ::mlir::StringAttr getRecvDeviceAttr(); + ::llvm::StringRef getRecvDevice(); + ::mlir::BoolAttr getClientTerminatedAttr(); + bool getClientTerminated(); +}; +} // namespace detail +template +class SendOpGenericAdaptor : public detail::SendOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SendOpGenericAdaptorBase; +public: + SendOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SendOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SendOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SendOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTensor() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SendOpAdaptor : public SendOpGenericAdaptor<::mlir::ValueRange> { +public: + using SendOpGenericAdaptor::SendOpGenericAdaptor; + SendOpAdaptor(SendOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SendOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = SendOpAdaptor; + template + using GenericAdaptor = SendOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("client_terminated"), ::llvm::StringRef("recv_device"), ::llvm::StringRef("send_device"), ::llvm::StringRef("send_device_incarnation"), ::llvm::StringRef("tensor_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getClientTerminatedAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getClientTerminatedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getRecvDeviceAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getRecvDeviceAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSendDeviceAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSendDeviceAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getSendDeviceIncarnationAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getSendDeviceIncarnationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getTensorNameAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getTensorNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Send"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::OpOperand &getTensorMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::StringAttr getTensorNameAttr(); + ::llvm::StringRef getTensorName(); + ::mlir::StringAttr getSendDeviceAttr(); + ::llvm::StringRef getSendDevice(); + ::mlir::IntegerAttr getSendDeviceIncarnationAttr(); + uint64_t getSendDeviceIncarnation(); + ::mlir::StringAttr getRecvDeviceAttr(); + ::llvm::StringRef getRecvDevice(); + ::mlir::BoolAttr getClientTerminatedAttr(); + bool getClientTerminated(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setTensorNameAttr(::mlir::StringAttr attr); + void setTensorName(::llvm::StringRef attrValue); + void setSendDeviceAttr(::mlir::StringAttr attr); + void setSendDevice(::llvm::StringRef attrValue); + void setSendDeviceIncarnationAttr(::mlir::IntegerAttr attr); + void setSendDeviceIncarnation(uint64_t attrValue); + void setRecvDeviceAttr(::mlir::StringAttr attr); + void setRecvDevice(::llvm::StringRef attrValue); + void setClientTerminatedAttr(::mlir::BoolAttr attr); + void setClientTerminated(::std::optional attrValue); + ::mlir::Attribute removeClientTerminatedAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value tensor, ::mlir::StringAttr tensor_name, ::mlir::StringAttr send_device, ::mlir::IntegerAttr send_device_incarnation, ::mlir::StringAttr recv_device, /*optional*/::mlir::BoolAttr client_terminated); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tensor, ::mlir::StringAttr tensor_name, ::mlir::StringAttr send_device, ::mlir::IntegerAttr send_device_incarnation, ::mlir::StringAttr recv_device, /*optional*/::mlir::BoolAttr client_terminated); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value tensor, ::llvm::StringRef tensor_name, ::llvm::StringRef send_device, uint64_t send_device_incarnation, ::llvm::StringRef recv_device, /*optional*/bool client_terminated = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tensor, ::llvm::StringRef tensor_name, ::llvm::StringRef send_device, uint64_t send_device_incarnation, ::llvm::StringRef recv_device, /*optional*/bool client_terminated = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SendOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SendTPUEmbeddingGradientsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SendTPUEmbeddingGradientsOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SendTPUEmbeddingGradientsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SendTPUEmbeddingGradientsOpGenericAdaptorBase(SendTPUEmbeddingGradientsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class SendTPUEmbeddingGradientsOpGenericAdaptor : public detail::SendTPUEmbeddingGradientsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SendTPUEmbeddingGradientsOpGenericAdaptorBase; +public: + SendTPUEmbeddingGradientsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SendTPUEmbeddingGradientsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SendTPUEmbeddingGradientsOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SendTPUEmbeddingGradientsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getLearningRates() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SendTPUEmbeddingGradientsOpAdaptor : public SendTPUEmbeddingGradientsOpGenericAdaptor<::mlir::ValueRange> { +public: + using SendTPUEmbeddingGradientsOpGenericAdaptor::SendTPUEmbeddingGradientsOpGenericAdaptor; + SendTPUEmbeddingGradientsOpAdaptor(SendTPUEmbeddingGradientsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SendTPUEmbeddingGradientsOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = SendTPUEmbeddingGradientsOpAdaptor; + template + using GenericAdaptor = SendTPUEmbeddingGradientsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("N"), ::llvm::StringRef("NN"), ::llvm::StringRef("config"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNNAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SendTPUEmbeddingGradients"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getLearningRates(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getLearningRatesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + size_t getN(); + size_t getNN(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange inputs, ::mlir::ValueRange learning_rates, ::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::mlir::ValueRange learning_rates, ::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange inputs, ::mlir::ValueRange learning_rates, ::llvm::StringRef config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::mlir::ValueRange learning_rates, ::llvm::StringRef config); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SendTPUEmbeddingGradientsOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SerializeIteratorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SerializeIteratorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SerializeIteratorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SerializeIteratorOpGenericAdaptorBase(SerializeIteratorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getExternalStatePolicyAttr(); + uint64_t getExternalStatePolicy(); +}; +} // namespace detail +template +class SerializeIteratorOpGenericAdaptor : public detail::SerializeIteratorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SerializeIteratorOpGenericAdaptorBase; +public: + SerializeIteratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SerializeIteratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SerializeIteratorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SerializeIteratorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getResourceHandle() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SerializeIteratorOpAdaptor : public SerializeIteratorOpGenericAdaptor<::mlir::ValueRange> { +public: + using SerializeIteratorOpGenericAdaptor::SerializeIteratorOpGenericAdaptor; + SerializeIteratorOpAdaptor(SerializeIteratorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SerializeIteratorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SerializeIteratorOpAdaptor; + template + using GenericAdaptor = SerializeIteratorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("external_state_policy")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getExternalStatePolicyAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getExternalStatePolicyAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SerializeIterator"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResourceHandle(); + ::mlir::OpOperand &getResourceHandleMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSerialized(); + ::mlir::IntegerAttr getExternalStatePolicyAttr(); + uint64_t getExternalStatePolicy(); + void setExternalStatePolicyAttr(::mlir::IntegerAttr attr); + void setExternalStatePolicy(::std::optional attrValue); + ::mlir::Attribute removeExternalStatePolicyAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type serialized, ::mlir::Value resource_handle, /*optional*/::mlir::IntegerAttr external_state_policy); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value resource_handle, /*optional*/::mlir::IntegerAttr external_state_policy); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type serialized, ::mlir::Value resource_handle, /*optional*/uint64_t external_state_policy = 0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value resource_handle, /*optional*/uint64_t external_state_policy = 0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SerializeIteratorOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SerializeSparseOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SerializeSparseOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SerializeSparseOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SerializeSparseOpGenericAdaptorBase(SerializeSparseOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SerializeSparseOpGenericAdaptor : public detail::SerializeSparseOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SerializeSparseOpGenericAdaptorBase; +public: + SerializeSparseOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SerializeSparseOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SerializeSparseOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SerializeSparseOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSparseIndices() { + return (*getODSOperands(0).begin()); + } + + ValueT getSparseValues() { + return (*getODSOperands(1).begin()); + } + + ValueT getSparseShape() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SerializeSparseOpAdaptor : public SerializeSparseOpGenericAdaptor<::mlir::ValueRange> { +public: + using SerializeSparseOpGenericAdaptor::SerializeSparseOpGenericAdaptor; + SerializeSparseOpAdaptor(SerializeSparseOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SerializeSparseOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SerializeSparseOpAdaptor; + template + using GenericAdaptor = SerializeSparseOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("out_type")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutTypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SerializeSparse"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSparseIndices(); + ::mlir::TypedValue<::mlir::TensorType> getSparseValues(); + ::mlir::TypedValue<::mlir::TensorType> getSparseShape(); + ::mlir::OpOperand &getSparseIndicesMutable(); + ::mlir::OpOperand &getSparseValuesMutable(); + ::mlir::OpOperand &getSparseShapeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSerializedSparse(); + ::mlir::Type getT(); + ::mlir::Type getOutType(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type serialized_sparse, ::mlir::Value sparse_indices, ::mlir::Value sparse_values, ::mlir::Value sparse_shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value sparse_indices, ::mlir::Value sparse_values, ::mlir::Value sparse_shape); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SerializeSparseOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SetStaticDimensionBoundsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SetStaticDimensionBoundsOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SetStaticDimensionBoundsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SetStaticDimensionBoundsOpGenericAdaptorBase(SetStaticDimensionBoundsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SetStaticDimensionBoundsOpGenericAdaptor : public detail::SetStaticDimensionBoundsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SetStaticDimensionBoundsOpGenericAdaptorBase; +public: + SetStaticDimensionBoundsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SetStaticDimensionBoundsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SetStaticDimensionBoundsOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SetStaticDimensionBoundsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getStaticShape() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SetStaticDimensionBoundsOpAdaptor : public SetStaticDimensionBoundsOpGenericAdaptor<::mlir::ValueRange> { +public: + using SetStaticDimensionBoundsOpGenericAdaptor::SetStaticDimensionBoundsOpGenericAdaptor; + SetStaticDimensionBoundsOpAdaptor(SetStaticDimensionBoundsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SetStaticDimensionBoundsOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = SetStaticDimensionBoundsOpAdaptor; + template + using GenericAdaptor = SetStaticDimensionBoundsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SetStaticDimensionBounds"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getStaticShape(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getStaticShapeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value static_shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value static_shape); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SetStaticDimensionBoundsOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ShapeNOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ShapeNOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ShapeNOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ShapeNOpGenericAdaptorBase(ShapeNOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ShapeNOpGenericAdaptor : public detail::ShapeNOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ShapeNOpGenericAdaptorBase; +public: + ShapeNOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ShapeNOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ShapeNOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ShapeNOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInput() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ShapeNOpAdaptor : public ShapeNOpGenericAdaptor<::mlir::ValueRange> { +public: + using ShapeNOpGenericAdaptor::ShapeNOpGenericAdaptor; + ShapeNOpAdaptor(ShapeNOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ShapeNOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = ShapeNOpAdaptor; + template + using GenericAdaptor = ShapeNOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("N"), ::llvm::StringRef("T"), ::llvm::StringRef("out_type")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOutTypeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOutTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ShapeN"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInput(); + ::mlir::MutableOperandRange getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutput(); + size_t getN(); + ::mlir::Type getT(); + ::mlir::Type getOutType(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ShapeNOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ShapeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ShapeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ShapeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ShapeOpGenericAdaptorBase(ShapeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ShapeOpGenericAdaptor : public detail::ShapeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ShapeOpGenericAdaptorBase; +public: + ShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ShapeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ShapeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ShapeOpAdaptor : public ShapeOpGenericAdaptor<::mlir::ValueRange> { +public: + using ShapeOpGenericAdaptor::ShapeOpGenericAdaptor; + ShapeOpAdaptor(ShapeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ShapeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ShapeOpAdaptor; + template + using GenericAdaptor = ShapeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("out_type")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutTypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Shape"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getOutType(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value input, BoolAttr use32Bit); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ShapeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ShardedFilenameOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ShardedFilenameOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ShardedFilenameOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ShardedFilenameOpGenericAdaptorBase(ShardedFilenameOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ShardedFilenameOpGenericAdaptor : public detail::ShardedFilenameOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ShardedFilenameOpGenericAdaptorBase; +public: + ShardedFilenameOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ShardedFilenameOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ShardedFilenameOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ShardedFilenameOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getBasename() { + return (*getODSOperands(0).begin()); + } + + ValueT getShard() { + return (*getODSOperands(1).begin()); + } + + ValueT getNumShards() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ShardedFilenameOpAdaptor : public ShardedFilenameOpGenericAdaptor<::mlir::ValueRange> { +public: + using ShardedFilenameOpGenericAdaptor::ShardedFilenameOpGenericAdaptor; + ShardedFilenameOpAdaptor(ShardedFilenameOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ShardedFilenameOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ShardedFilenameOpAdaptor; + template + using GenericAdaptor = ShardedFilenameOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ShardedFilename"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getBasename(); + ::mlir::TypedValue<::mlir::TensorType> getShard(); + ::mlir::TypedValue<::mlir::TensorType> getNumShards(); + ::mlir::OpOperand &getBasenameMutable(); + ::mlir::OpOperand &getShardMutable(); + ::mlir::OpOperand &getNumShardsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getFilename(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type filename, ::mlir::Value basename, ::mlir::Value shard, ::mlir::Value num_shards); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value basename, ::mlir::Value shard, ::mlir::Value num_shards); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ShardedFilenameOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ShuffleAndRepeatDatasetV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ShuffleAndRepeatDatasetV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ShuffleAndRepeatDatasetV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ShuffleAndRepeatDatasetV2OpGenericAdaptorBase(ShuffleAndRepeatDatasetV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getReshuffleEachIterationAttr(); + bool getReshuffleEachIteration(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); +}; +} // namespace detail +template +class ShuffleAndRepeatDatasetV2OpGenericAdaptor : public detail::ShuffleAndRepeatDatasetV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ShuffleAndRepeatDatasetV2OpGenericAdaptorBase; +public: + ShuffleAndRepeatDatasetV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ShuffleAndRepeatDatasetV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ShuffleAndRepeatDatasetV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ShuffleAndRepeatDatasetV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputDataset() { + return (*getODSOperands(0).begin()); + } + + ValueT getBufferSize() { + return (*getODSOperands(1).begin()); + } + + ValueT getSeed() { + return (*getODSOperands(2).begin()); + } + + ValueT getSeed2() { + return (*getODSOperands(3).begin()); + } + + ValueT getCount() { + return (*getODSOperands(4).begin()); + } + + ValueT getSeedGenerator() { + return (*getODSOperands(5).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ShuffleAndRepeatDatasetV2OpAdaptor : public ShuffleAndRepeatDatasetV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using ShuffleAndRepeatDatasetV2OpGenericAdaptor::ShuffleAndRepeatDatasetV2OpGenericAdaptor; + ShuffleAndRepeatDatasetV2OpAdaptor(ShuffleAndRepeatDatasetV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ShuffleAndRepeatDatasetV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<6>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ShuffleAndRepeatDatasetV2OpAdaptor; + template + using GenericAdaptor = ShuffleAndRepeatDatasetV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("metadata"), ::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types"), ::llvm::StringRef("reshuffle_each_iteration")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getMetadataAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getMetadataAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getReshuffleEachIterationAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getReshuffleEachIterationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ShuffleAndRepeatDatasetV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputDataset(); + ::mlir::TypedValue<::mlir::TensorType> getBufferSize(); + ::mlir::TypedValue<::mlir::TensorType> getSeed(); + ::mlir::TypedValue<::mlir::TensorType> getSeed2(); + ::mlir::TypedValue<::mlir::TensorType> getCount(); + ::mlir::TypedValue<::mlir::TensorType> getSeedGenerator(); + ::mlir::OpOperand &getInputDatasetMutable(); + ::mlir::OpOperand &getBufferSizeMutable(); + ::mlir::OpOperand &getSeedMutable(); + ::mlir::OpOperand &getSeed2Mutable(); + ::mlir::OpOperand &getCountMutable(); + ::mlir::OpOperand &getSeedGeneratorMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::BoolAttr getReshuffleEachIterationAttr(); + bool getReshuffleEachIteration(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); + void setReshuffleEachIterationAttr(::mlir::BoolAttr attr); + void setReshuffleEachIteration(::std::optional attrValue); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + void setMetadataAttr(::mlir::StringAttr attr); + void setMetadata(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeReshuffleEachIterationAttr(); + ::mlir::Attribute removeMetadataAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, ::mlir::Value buffer_size, ::mlir::Value seed, ::mlir::Value seed2, ::mlir::Value count, ::mlir::Value seed_generator, /*optional*/::mlir::BoolAttr reshuffle_each_iteration, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, ::mlir::Value buffer_size, ::mlir::Value seed, ::mlir::Value seed2, ::mlir::Value count, ::mlir::Value seed_generator, /*optional*/::mlir::BoolAttr reshuffle_each_iteration, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, ::mlir::Value buffer_size, ::mlir::Value seed, ::mlir::Value seed2, ::mlir::Value count, ::mlir::Value seed_generator, /*optional*/bool reshuffle_each_iteration, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::llvm::StringRef metadata = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, ::mlir::Value buffer_size, ::mlir::Value seed, ::mlir::Value seed2, ::mlir::Value count, ::mlir::Value seed_generator, /*optional*/bool reshuffle_each_iteration, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::llvm::StringRef metadata = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ShuffleAndRepeatDatasetV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ShuffleDatasetV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ShuffleDatasetV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ShuffleDatasetV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ShuffleDatasetV2OpGenericAdaptorBase(ShuffleDatasetV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); +}; +} // namespace detail +template +class ShuffleDatasetV2OpGenericAdaptor : public detail::ShuffleDatasetV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ShuffleDatasetV2OpGenericAdaptorBase; +public: + ShuffleDatasetV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ShuffleDatasetV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ShuffleDatasetV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ShuffleDatasetV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputDataset() { + return (*getODSOperands(0).begin()); + } + + ValueT getBufferSize() { + return (*getODSOperands(1).begin()); + } + + ValueT getSeedGenerator() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ShuffleDatasetV2OpAdaptor : public ShuffleDatasetV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using ShuffleDatasetV2OpGenericAdaptor::ShuffleDatasetV2OpGenericAdaptor; + ShuffleDatasetV2OpAdaptor(ShuffleDatasetV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ShuffleDatasetV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ShuffleDatasetV2OpAdaptor; + template + using GenericAdaptor = ShuffleDatasetV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("metadata"), ::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getMetadataAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getMetadataAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ShuffleDatasetV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputDataset(); + ::mlir::TypedValue<::mlir::TensorType> getBufferSize(); + ::mlir::TypedValue<::mlir::TensorType> getSeedGenerator(); + ::mlir::OpOperand &getInputDatasetMutable(); + ::mlir::OpOperand &getBufferSizeMutable(); + ::mlir::OpOperand &getSeedGeneratorMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + void setMetadataAttr(::mlir::StringAttr attr); + void setMetadata(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeMetadataAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, ::mlir::Value buffer_size, ::mlir::Value seed_generator, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, ::mlir::Value buffer_size, ::mlir::Value seed_generator, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, ::mlir::Value buffer_size, ::mlir::Value seed_generator, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::llvm::StringRef metadata = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, ::mlir::Value buffer_size, ::mlir::Value seed_generator, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::llvm::StringRef metadata = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ShuffleDatasetV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ShuffleDatasetV3Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ShuffleDatasetV3OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ShuffleDatasetV3OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ShuffleDatasetV3OpGenericAdaptorBase(ShuffleDatasetV3Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getReshuffleEachIterationAttr(); + bool getReshuffleEachIteration(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); +}; +} // namespace detail +template +class ShuffleDatasetV3OpGenericAdaptor : public detail::ShuffleDatasetV3OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ShuffleDatasetV3OpGenericAdaptorBase; +public: + ShuffleDatasetV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ShuffleDatasetV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ShuffleDatasetV3OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ShuffleDatasetV3OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputDataset() { + return (*getODSOperands(0).begin()); + } + + ValueT getBufferSize() { + return (*getODSOperands(1).begin()); + } + + ValueT getSeed() { + return (*getODSOperands(2).begin()); + } + + ValueT getSeed2() { + return (*getODSOperands(3).begin()); + } + + ValueT getSeedGenerator() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ShuffleDatasetV3OpAdaptor : public ShuffleDatasetV3OpGenericAdaptor<::mlir::ValueRange> { +public: + using ShuffleDatasetV3OpGenericAdaptor::ShuffleDatasetV3OpGenericAdaptor; + ShuffleDatasetV3OpAdaptor(ShuffleDatasetV3Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ShuffleDatasetV3Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<5>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ShuffleDatasetV3OpAdaptor; + template + using GenericAdaptor = ShuffleDatasetV3OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("metadata"), ::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types"), ::llvm::StringRef("reshuffle_each_iteration")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getMetadataAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getMetadataAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getReshuffleEachIterationAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getReshuffleEachIterationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ShuffleDatasetV3"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputDataset(); + ::mlir::TypedValue<::mlir::TensorType> getBufferSize(); + ::mlir::TypedValue<::mlir::TensorType> getSeed(); + ::mlir::TypedValue<::mlir::TensorType> getSeed2(); + ::mlir::TypedValue<::mlir::TensorType> getSeedGenerator(); + ::mlir::OpOperand &getInputDatasetMutable(); + ::mlir::OpOperand &getBufferSizeMutable(); + ::mlir::OpOperand &getSeedMutable(); + ::mlir::OpOperand &getSeed2Mutable(); + ::mlir::OpOperand &getSeedGeneratorMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::BoolAttr getReshuffleEachIterationAttr(); + bool getReshuffleEachIteration(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); + void setReshuffleEachIterationAttr(::mlir::BoolAttr attr); + void setReshuffleEachIteration(::std::optional attrValue); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + void setMetadataAttr(::mlir::StringAttr attr); + void setMetadata(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeReshuffleEachIterationAttr(); + ::mlir::Attribute removeMetadataAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, ::mlir::Value buffer_size, ::mlir::Value seed, ::mlir::Value seed2, ::mlir::Value seed_generator, /*optional*/::mlir::BoolAttr reshuffle_each_iteration, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, ::mlir::Value buffer_size, ::mlir::Value seed, ::mlir::Value seed2, ::mlir::Value seed_generator, /*optional*/::mlir::BoolAttr reshuffle_each_iteration, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, ::mlir::Value buffer_size, ::mlir::Value seed, ::mlir::Value seed2, ::mlir::Value seed_generator, /*optional*/bool reshuffle_each_iteration, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::llvm::StringRef metadata = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, ::mlir::Value buffer_size, ::mlir::Value seed, ::mlir::Value seed2, ::mlir::Value seed_generator, /*optional*/bool reshuffle_each_iteration, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::llvm::StringRef metadata = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ShuffleDatasetV3Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ShutdownDistributedTPUOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ShutdownDistributedTPUOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ShutdownDistributedTPUOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ShutdownDistributedTPUOpGenericAdaptorBase(ShutdownDistributedTPUOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ShutdownDistributedTPUOpGenericAdaptor : public detail::ShutdownDistributedTPUOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ShutdownDistributedTPUOpGenericAdaptorBase; +public: + ShutdownDistributedTPUOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ShutdownDistributedTPUOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ShutdownDistributedTPUOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ShutdownDistributedTPUOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ShutdownDistributedTPUOpAdaptor : public ShutdownDistributedTPUOpGenericAdaptor<::mlir::ValueRange> { +public: + using ShutdownDistributedTPUOpGenericAdaptor::ShutdownDistributedTPUOpGenericAdaptor; + ShutdownDistributedTPUOpAdaptor(ShutdownDistributedTPUOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ShutdownDistributedTPUOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = ShutdownDistributedTPUOpAdaptor; + template + using GenericAdaptor = ShutdownDistributedTPUOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ShutdownDistributedTPU"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ShutdownDistributedTPUOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ShutdownTPUSystemOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ShutdownTPUSystemOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ShutdownTPUSystemOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ShutdownTPUSystemOpGenericAdaptorBase(ShutdownTPUSystemOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ShutdownTPUSystemOpGenericAdaptor : public detail::ShutdownTPUSystemOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ShutdownTPUSystemOpGenericAdaptorBase; +public: + ShutdownTPUSystemOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ShutdownTPUSystemOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ShutdownTPUSystemOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ShutdownTPUSystemOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ShutdownTPUSystemOpAdaptor : public ShutdownTPUSystemOpGenericAdaptor<::mlir::ValueRange> { +public: + using ShutdownTPUSystemOpGenericAdaptor::ShutdownTPUSystemOpGenericAdaptor; + ShutdownTPUSystemOpAdaptor(ShutdownTPUSystemOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ShutdownTPUSystemOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = ShutdownTPUSystemOpAdaptor; + template + using GenericAdaptor = ShutdownTPUSystemOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ShutdownTPUSystem"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSuccess(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type success); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ShutdownTPUSystemOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SigmoidGradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SigmoidGradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SigmoidGradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SigmoidGradOpGenericAdaptorBase(SigmoidGradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SigmoidGradOpGenericAdaptor : public detail::SigmoidGradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SigmoidGradOpGenericAdaptorBase; +public: + SigmoidGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SigmoidGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SigmoidGradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SigmoidGradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getY() { + return (*getODSOperands(0).begin()); + } + + ValueT getDy() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SigmoidGradOpAdaptor : public SigmoidGradOpGenericAdaptor<::mlir::ValueRange> { +public: + using SigmoidGradOpGenericAdaptor::SigmoidGradOpGenericAdaptor; + SigmoidGradOpAdaptor(SigmoidGradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SigmoidGradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SigmoidGradOpAdaptor; + template + using GenericAdaptor = SigmoidGradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SigmoidGrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::TypedValue<::mlir::TensorType> getDy(); + ::mlir::OpOperand &getYMutable(); + ::mlir::OpOperand &getDyMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value y, ::mlir::Value dy); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value y, ::mlir::Value dy); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value y, ::mlir::Value dy); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SigmoidGradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SigmoidOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SigmoidOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SigmoidOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SigmoidOpGenericAdaptorBase(SigmoidOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SigmoidOpGenericAdaptor : public detail::SigmoidOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SigmoidOpGenericAdaptorBase; +public: + SigmoidOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SigmoidOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SigmoidOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SigmoidOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SigmoidOpAdaptor : public SigmoidOpGenericAdaptor<::mlir::ValueRange> { +public: + using SigmoidOpGenericAdaptor::SigmoidOpGenericAdaptor; + SigmoidOpAdaptor(SigmoidOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SigmoidOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SigmoidOpAdaptor; + template + using GenericAdaptor = SigmoidOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Sigmoid"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SigmoidOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SignOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SignOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SignOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SignOpGenericAdaptorBase(SignOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SignOpGenericAdaptor : public detail::SignOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SignOpGenericAdaptorBase; +public: + SignOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SignOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SignOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SignOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SignOpAdaptor : public SignOpGenericAdaptor<::mlir::ValueRange> { +public: + using SignOpGenericAdaptor::SignOpGenericAdaptor; + SignOpAdaptor(SignOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SignOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::IsIdempotent, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SignOpAdaptor; + template + using GenericAdaptor = SignOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Sign"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SignOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SinOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SinOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SinOpGenericAdaptorBase(SinOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SinOpGenericAdaptor : public detail::SinOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SinOpGenericAdaptorBase; +public: + SinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SinOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SinOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SinOpAdaptor : public SinOpGenericAdaptor<::mlir::ValueRange> { +public: + using SinOpGenericAdaptor::SinOpGenericAdaptor; + SinOpAdaptor(SinOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SinOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SinOpAdaptor; + template + using GenericAdaptor = SinOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Sin"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SinOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SinhOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SinhOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SinhOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SinhOpGenericAdaptorBase(SinhOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SinhOpGenericAdaptor : public detail::SinhOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SinhOpGenericAdaptorBase; +public: + SinhOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SinhOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SinhOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SinhOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SinhOpAdaptor : public SinhOpGenericAdaptor<::mlir::ValueRange> { +public: + using SinhOpGenericAdaptor::SinhOpGenericAdaptor; + SinhOpAdaptor(SinhOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SinhOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SinhOpAdaptor; + template + using GenericAdaptor = SinhOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Sinh"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SinhOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SizeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SizeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SizeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SizeOpGenericAdaptorBase(SizeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SizeOpGenericAdaptor : public detail::SizeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SizeOpGenericAdaptorBase; +public: + SizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SizeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SizeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SizeOpAdaptor : public SizeOpGenericAdaptor<::mlir::ValueRange> { +public: + using SizeOpGenericAdaptor::SizeOpGenericAdaptor; + SizeOpAdaptor(SizeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SizeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SizeOpAdaptor; + template + using GenericAdaptor = SizeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("out_type")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutTypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Size"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getOutType(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SizeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SliceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SliceOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SliceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SliceOpGenericAdaptorBase(SliceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SliceOpGenericAdaptor : public detail::SliceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SliceOpGenericAdaptorBase; +public: + SliceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SliceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SliceOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SliceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getBegin() { + return (*getODSOperands(1).begin()); + } + + ValueT getSize() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SliceOpAdaptor : public SliceOpGenericAdaptor<::mlir::ValueRange> { +public: + using SliceOpGenericAdaptor::SliceOpGenericAdaptor; + SliceOpAdaptor(SliceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SliceOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SliceOpAdaptor; + template + using GenericAdaptor = SliceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Index"), ::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getIndexAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getIndexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Slice"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getBegin(); + ::mlir::TypedValue<::mlir::TensorType> getSize(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getBeginMutable(); + ::mlir::OpOperand &getSizeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getIndex(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value begin, ::mlir::Value size); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value begin, ::mlir::Value size); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SliceOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SnapshotOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SnapshotOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SnapshotOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SnapshotOpGenericAdaptorBase(SnapshotOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SnapshotOpGenericAdaptor : public detail::SnapshotOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SnapshotOpGenericAdaptorBase; +public: + SnapshotOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SnapshotOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SnapshotOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SnapshotOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SnapshotOpAdaptor : public SnapshotOpGenericAdaptor<::mlir::ValueRange> { +public: + using SnapshotOpGenericAdaptor::SnapshotOpGenericAdaptor; + SnapshotOpAdaptor(SnapshotOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SnapshotOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SnapshotOpAdaptor; + template + using GenericAdaptor = SnapshotOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Snapshot"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SnapshotOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SoftmaxCrossEntropyWithLogitsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SoftmaxCrossEntropyWithLogitsOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SoftmaxCrossEntropyWithLogitsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SoftmaxCrossEntropyWithLogitsOpGenericAdaptorBase(SoftmaxCrossEntropyWithLogitsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SoftmaxCrossEntropyWithLogitsOpGenericAdaptor : public detail::SoftmaxCrossEntropyWithLogitsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SoftmaxCrossEntropyWithLogitsOpGenericAdaptorBase; +public: + SoftmaxCrossEntropyWithLogitsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SoftmaxCrossEntropyWithLogitsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SoftmaxCrossEntropyWithLogitsOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SoftmaxCrossEntropyWithLogitsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getFeatures() { + return (*getODSOperands(0).begin()); + } + + ValueT getLabels() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SoftmaxCrossEntropyWithLogitsOpAdaptor : public SoftmaxCrossEntropyWithLogitsOpGenericAdaptor<::mlir::ValueRange> { +public: + using SoftmaxCrossEntropyWithLogitsOpGenericAdaptor::SoftmaxCrossEntropyWithLogitsOpGenericAdaptor; + SoftmaxCrossEntropyWithLogitsOpAdaptor(SoftmaxCrossEntropyWithLogitsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SoftmaxCrossEntropyWithLogitsOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SoftmaxCrossEntropyWithLogitsOpAdaptor; + template + using GenericAdaptor = SoftmaxCrossEntropyWithLogitsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SoftmaxCrossEntropyWithLogits"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getFeatures(); + ::mlir::TypedValue<::mlir::TensorType> getLabels(); + ::mlir::OpOperand &getFeaturesMutable(); + ::mlir::OpOperand &getLabelsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLoss(); + ::mlir::TypedValue<::mlir::TensorType> getBackprop(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type loss, ::mlir::Type backprop, ::mlir::Value features, ::mlir::Value labels); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value features, ::mlir::Value labels); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SoftmaxCrossEntropyWithLogitsOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SoftmaxOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SoftmaxOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SoftmaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SoftmaxOpGenericAdaptorBase(SoftmaxOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SoftmaxOpGenericAdaptor : public detail::SoftmaxOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SoftmaxOpGenericAdaptorBase; +public: + SoftmaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SoftmaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SoftmaxOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SoftmaxOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLogits() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SoftmaxOpAdaptor : public SoftmaxOpGenericAdaptor<::mlir::ValueRange> { +public: + using SoftmaxOpGenericAdaptor::SoftmaxOpGenericAdaptor; + SoftmaxOpAdaptor(SoftmaxOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SoftmaxOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SoftmaxOpAdaptor; + template + using GenericAdaptor = SoftmaxOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Softmax"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLogits(); + ::mlir::OpOperand &getLogitsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSoftmax(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type softmax, ::mlir::Value logits); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value logits); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value logits); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SoftmaxOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SoftplusGradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SoftplusGradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SoftplusGradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SoftplusGradOpGenericAdaptorBase(SoftplusGradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SoftplusGradOpGenericAdaptor : public detail::SoftplusGradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SoftplusGradOpGenericAdaptorBase; +public: + SoftplusGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SoftplusGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SoftplusGradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SoftplusGradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getGradients() { + return (*getODSOperands(0).begin()); + } + + ValueT getFeatures() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SoftplusGradOpAdaptor : public SoftplusGradOpGenericAdaptor<::mlir::ValueRange> { +public: + using SoftplusGradOpGenericAdaptor::SoftplusGradOpGenericAdaptor; + SoftplusGradOpAdaptor(SoftplusGradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SoftplusGradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SoftplusGradOpAdaptor; + template + using GenericAdaptor = SoftplusGradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SoftplusGrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getGradients(); + ::mlir::TypedValue<::mlir::TensorType> getFeatures(); + ::mlir::OpOperand &getGradientsMutable(); + ::mlir::OpOperand &getFeaturesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getBackprops(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type backprops, ::mlir::Value gradients, ::mlir::Value features); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value gradients, ::mlir::Value features); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value gradients, ::mlir::Value features); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SoftplusGradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SoftplusOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SoftplusOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SoftplusOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SoftplusOpGenericAdaptorBase(SoftplusOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SoftplusOpGenericAdaptor : public detail::SoftplusOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SoftplusOpGenericAdaptorBase; +public: + SoftplusOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SoftplusOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SoftplusOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SoftplusOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getFeatures() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SoftplusOpAdaptor : public SoftplusOpGenericAdaptor<::mlir::ValueRange> { +public: + using SoftplusOpGenericAdaptor::SoftplusOpGenericAdaptor; + SoftplusOpAdaptor(SoftplusOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SoftplusOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SoftplusOpAdaptor; + template + using GenericAdaptor = SoftplusOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Softplus"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getFeatures(); + ::mlir::OpOperand &getFeaturesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getActivations(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type activations, ::mlir::Value features); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value features); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value features); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SoftplusOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SoftsignGradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SoftsignGradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SoftsignGradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SoftsignGradOpGenericAdaptorBase(SoftsignGradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SoftsignGradOpGenericAdaptor : public detail::SoftsignGradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SoftsignGradOpGenericAdaptorBase; +public: + SoftsignGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SoftsignGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SoftsignGradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SoftsignGradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getGradients() { + return (*getODSOperands(0).begin()); + } + + ValueT getFeatures() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SoftsignGradOpAdaptor : public SoftsignGradOpGenericAdaptor<::mlir::ValueRange> { +public: + using SoftsignGradOpGenericAdaptor::SoftsignGradOpGenericAdaptor; + SoftsignGradOpAdaptor(SoftsignGradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SoftsignGradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SoftsignGradOpAdaptor; + template + using GenericAdaptor = SoftsignGradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SoftsignGrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getGradients(); + ::mlir::TypedValue<::mlir::TensorType> getFeatures(); + ::mlir::OpOperand &getGradientsMutable(); + ::mlir::OpOperand &getFeaturesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getBackprops(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type backprops, ::mlir::Value gradients, ::mlir::Value features); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value gradients, ::mlir::Value features); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value gradients, ::mlir::Value features); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SoftsignGradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SoftsignOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SoftsignOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SoftsignOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SoftsignOpGenericAdaptorBase(SoftsignOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SoftsignOpGenericAdaptor : public detail::SoftsignOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SoftsignOpGenericAdaptorBase; +public: + SoftsignOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SoftsignOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SoftsignOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SoftsignOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getFeatures() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SoftsignOpAdaptor : public SoftsignOpGenericAdaptor<::mlir::ValueRange> { +public: + using SoftsignOpGenericAdaptor::SoftsignOpGenericAdaptor; + SoftsignOpAdaptor(SoftsignOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SoftsignOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SoftsignOpAdaptor; + template + using GenericAdaptor = SoftsignOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Softsign"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getFeatures(); + ::mlir::OpOperand &getFeaturesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getActivations(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type activations, ::mlir::Value features); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value features); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value features); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SoftsignOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SpaceToBatchNDOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SpaceToBatchNDOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SpaceToBatchNDOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SpaceToBatchNDOpGenericAdaptorBase(SpaceToBatchNDOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SpaceToBatchNDOpGenericAdaptor : public detail::SpaceToBatchNDOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SpaceToBatchNDOpGenericAdaptorBase; +public: + SpaceToBatchNDOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SpaceToBatchNDOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SpaceToBatchNDOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SpaceToBatchNDOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getBlockShape() { + return (*getODSOperands(1).begin()); + } + + ValueT getPaddings() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SpaceToBatchNDOpAdaptor : public SpaceToBatchNDOpGenericAdaptor<::mlir::ValueRange> { +public: + using SpaceToBatchNDOpGenericAdaptor::SpaceToBatchNDOpGenericAdaptor; + SpaceToBatchNDOpAdaptor(SpaceToBatchNDOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SpaceToBatchNDOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SpaceToBatchNDOpAdaptor; + template + using GenericAdaptor = SpaceToBatchNDOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tblock_shape"), ::llvm::StringRef("Tpaddings")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTblockShapeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTblockShapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTpaddingsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTpaddingsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SpaceToBatchND"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getBlockShape(); + ::mlir::TypedValue<::mlir::TensorType> getPaddings(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getBlockShapeMutable(); + ::mlir::OpOperand &getPaddingsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTblockShape(); + ::mlir::Type getTpaddings(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value block_shape, ::mlir::Value paddings); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value block_shape, ::mlir::Value paddings); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return ArraysAreCastCompatible(l, r); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SpaceToBatchNDOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SpaceToBatchOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SpaceToBatchOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SpaceToBatchOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SpaceToBatchOpGenericAdaptorBase(SpaceToBatchOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getBlockSizeAttr(); + uint64_t getBlockSize(); +}; +} // namespace detail +template +class SpaceToBatchOpGenericAdaptor : public detail::SpaceToBatchOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SpaceToBatchOpGenericAdaptorBase; +public: + SpaceToBatchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SpaceToBatchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SpaceToBatchOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SpaceToBatchOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getPaddings() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SpaceToBatchOpAdaptor : public SpaceToBatchOpGenericAdaptor<::mlir::ValueRange> { +public: + using SpaceToBatchOpGenericAdaptor::SpaceToBatchOpGenericAdaptor; + SpaceToBatchOpAdaptor(SpaceToBatchOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SpaceToBatchOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SpaceToBatchOpAdaptor; + template + using GenericAdaptor = SpaceToBatchOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tpaddings"), ::llvm::StringRef("block_size")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTpaddingsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTpaddingsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getBlockSizeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getBlockSizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SpaceToBatch"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getPaddings(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getPaddingsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getBlockSizeAttr(); + uint64_t getBlockSize(); + ::mlir::Type getT(); + ::mlir::Type getTpaddings(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setBlockSizeAttr(::mlir::IntegerAttr attr); + void setBlockSize(uint64_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value paddings, ::mlir::IntegerAttr block_size); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value paddings, ::mlir::IntegerAttr block_size); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value paddings, uint64_t block_size); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value paddings, uint64_t block_size); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SpaceToBatchOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SpaceToDepthOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SpaceToDepthOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SpaceToDepthOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SpaceToDepthOpGenericAdaptorBase(SpaceToDepthOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getBlockSizeAttr(); + uint64_t getBlockSize(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); +}; +} // namespace detail +template +class SpaceToDepthOpGenericAdaptor : public detail::SpaceToDepthOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SpaceToDepthOpGenericAdaptorBase; +public: + SpaceToDepthOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SpaceToDepthOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SpaceToDepthOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SpaceToDepthOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SpaceToDepthOpAdaptor : public SpaceToDepthOpGenericAdaptor<::mlir::ValueRange> { +public: + using SpaceToDepthOpGenericAdaptor::SpaceToDepthOpGenericAdaptor; + SpaceToDepthOpAdaptor(SpaceToDepthOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SpaceToDepthOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SpaceToDepthOpAdaptor; + template + using GenericAdaptor = SpaceToDepthOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("block_size"), ::llvm::StringRef("data_format")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getBlockSizeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getBlockSizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SpaceToDepth"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getBlockSizeAttr(); + uint64_t getBlockSize(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setBlockSizeAttr(::mlir::IntegerAttr attr); + void setBlockSize(uint64_t attrValue); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeDataFormatAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::IntegerAttr block_size, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::IntegerAttr block_size, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, uint64_t block_size, /*optional*/::llvm::StringRef data_format = "NHWC"); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, uint64_t block_size, /*optional*/::llvm::StringRef data_format = "NHWC"); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SpaceToDepthOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SparseAddOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SparseAddOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SparseAddOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SparseAddOpGenericAdaptorBase(SparseAddOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SparseAddOpGenericAdaptor : public detail::SparseAddOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SparseAddOpGenericAdaptorBase; +public: + SparseAddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SparseAddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SparseAddOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SparseAddOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getAIndices() { + return (*getODSOperands(0).begin()); + } + + ValueT getAValues() { + return (*getODSOperands(1).begin()); + } + + ValueT getAShape() { + return (*getODSOperands(2).begin()); + } + + ValueT getBIndices() { + return (*getODSOperands(3).begin()); + } + + ValueT getBValues() { + return (*getODSOperands(4).begin()); + } + + ValueT getBShape() { + return (*getODSOperands(5).begin()); + } + + ValueT getThresh() { + return (*getODSOperands(6).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SparseAddOpAdaptor : public SparseAddOpGenericAdaptor<::mlir::ValueRange> { +public: + using SparseAddOpGenericAdaptor::SparseAddOpGenericAdaptor; + SparseAddOpAdaptor(SparseAddOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SparseAddOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<7>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SparseAddOpAdaptor; + template + using GenericAdaptor = SparseAddOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Treal")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTrealAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTrealAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SparseAdd"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getAIndices(); + ::mlir::TypedValue<::mlir::TensorType> getAValues(); + ::mlir::TypedValue<::mlir::TensorType> getAShape(); + ::mlir::TypedValue<::mlir::TensorType> getBIndices(); + ::mlir::TypedValue<::mlir::TensorType> getBValues(); + ::mlir::TypedValue<::mlir::TensorType> getBShape(); + ::mlir::TypedValue<::mlir::TensorType> getThresh(); + ::mlir::OpOperand &getAIndicesMutable(); + ::mlir::OpOperand &getAValuesMutable(); + ::mlir::OpOperand &getAShapeMutable(); + ::mlir::OpOperand &getBIndicesMutable(); + ::mlir::OpOperand &getBValuesMutable(); + ::mlir::OpOperand &getBShapeMutable(); + ::mlir::OpOperand &getThreshMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSumIndices(); + ::mlir::TypedValue<::mlir::TensorType> getSumValues(); + ::mlir::TypedValue<::mlir::TensorType> getSumShape(); + ::mlir::Type getT(); + ::mlir::Type getTreal(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type sum_indices, ::mlir::Type sum_values, ::mlir::Type sum_shape, ::mlir::Value a_indices, ::mlir::Value a_values, ::mlir::Value a_shape, ::mlir::Value b_indices, ::mlir::Value b_values, ::mlir::Value b_shape, ::mlir::Value thresh); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a_indices, ::mlir::Value a_values, ::mlir::Value a_shape, ::mlir::Value b_indices, ::mlir::Value b_values, ::mlir::Value b_shape, ::mlir::Value thresh); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SparseAddOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SparseFillEmptyRowsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SparseFillEmptyRowsOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SparseFillEmptyRowsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SparseFillEmptyRowsOpGenericAdaptorBase(SparseFillEmptyRowsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SparseFillEmptyRowsOpGenericAdaptor : public detail::SparseFillEmptyRowsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SparseFillEmptyRowsOpGenericAdaptorBase; +public: + SparseFillEmptyRowsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SparseFillEmptyRowsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SparseFillEmptyRowsOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SparseFillEmptyRowsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIndices() { + return (*getODSOperands(0).begin()); + } + + ValueT getValues() { + return (*getODSOperands(1).begin()); + } + + ValueT getDenseShape() { + return (*getODSOperands(2).begin()); + } + + ValueT getDefaultValue() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SparseFillEmptyRowsOpAdaptor : public SparseFillEmptyRowsOpGenericAdaptor<::mlir::ValueRange> { +public: + using SparseFillEmptyRowsOpGenericAdaptor::SparseFillEmptyRowsOpGenericAdaptor; + SparseFillEmptyRowsOpAdaptor(SparseFillEmptyRowsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SparseFillEmptyRowsOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SparseFillEmptyRowsOpAdaptor; + template + using GenericAdaptor = SparseFillEmptyRowsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SparseFillEmptyRows"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getValues(); + ::mlir::TypedValue<::mlir::TensorType> getDenseShape(); + ::mlir::TypedValue<::mlir::TensorType> getDefaultValue(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getValuesMutable(); + ::mlir::OpOperand &getDenseShapeMutable(); + ::mlir::OpOperand &getDefaultValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutputIndices(); + ::mlir::TypedValue<::mlir::TensorType> getOutputValues(); + ::mlir::TypedValue<::mlir::TensorType> getEmptyRowIndicator(); + ::mlir::TypedValue<::mlir::TensorType> getReverseIndexMap(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output_indices, ::mlir::Type output_values, ::mlir::Type empty_row_indicator, ::mlir::Type reverse_index_map, ::mlir::Value indices, ::mlir::Value values, ::mlir::Value dense_shape, ::mlir::Value default_value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value indices, ::mlir::Value values, ::mlir::Value dense_shape, ::mlir::Value default_value); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SparseFillEmptyRowsOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SparseMatMulOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SparseMatMulOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SparseMatMulOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SparseMatMulOpGenericAdaptorBase(SparseMatMulOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getTransposeAAttr(); + bool getTransposeA(); + ::mlir::BoolAttr getTransposeBAttr(); + bool getTransposeB(); + ::mlir::BoolAttr getAIsSparseAttr(); + bool getAIsSparse(); + ::mlir::BoolAttr getBIsSparseAttr(); + bool getBIsSparse(); +}; +} // namespace detail +template +class SparseMatMulOpGenericAdaptor : public detail::SparseMatMulOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SparseMatMulOpGenericAdaptorBase; +public: + SparseMatMulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SparseMatMulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SparseMatMulOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SparseMatMulOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + ValueT getB() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SparseMatMulOpAdaptor : public SparseMatMulOpGenericAdaptor<::mlir::ValueRange> { +public: + using SparseMatMulOpGenericAdaptor::SparseMatMulOpGenericAdaptor; + SparseMatMulOpAdaptor(SparseMatMulOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SparseMatMulOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SparseMatMulOpAdaptor; + template + using GenericAdaptor = SparseMatMulOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Ta"), ::llvm::StringRef("Tb"), ::llvm::StringRef("a_is_sparse"), ::llvm::StringRef("b_is_sparse"), ::llvm::StringRef("transpose_a"), ::llvm::StringRef("transpose_b")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTaAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTaAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTbAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTbAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getAIsSparseAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getAIsSparseAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getBIsSparseAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getBIsSparseAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTransposeAAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTransposeAAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getTransposeBAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getTransposeBAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SparseMatMul"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getA(); + ::mlir::TypedValue<::mlir::TensorType> getB(); + ::mlir::OpOperand &getAMutable(); + ::mlir::OpOperand &getBMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getProduct(); + ::mlir::BoolAttr getTransposeAAttr(); + bool getTransposeA(); + ::mlir::BoolAttr getTransposeBAttr(); + bool getTransposeB(); + ::mlir::BoolAttr getAIsSparseAttr(); + bool getAIsSparse(); + ::mlir::BoolAttr getBIsSparseAttr(); + bool getBIsSparse(); + ::mlir::Type getTa(); + ::mlir::Type getTb(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setTransposeAAttr(::mlir::BoolAttr attr); + void setTransposeA(::std::optional attrValue); + void setTransposeBAttr(::mlir::BoolAttr attr); + void setTransposeB(::std::optional attrValue); + void setAIsSparseAttr(::mlir::BoolAttr attr); + void setAIsSparse(::std::optional attrValue); + void setBIsSparseAttr(::mlir::BoolAttr attr); + void setBIsSparse(::std::optional attrValue); + ::mlir::Attribute removeTransposeAAttr(); + ::mlir::Attribute removeTransposeBAttr(); + ::mlir::Attribute removeAIsSparseAttr(); + ::mlir::Attribute removeBIsSparseAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type product, ::mlir::Value a, ::mlir::Value b, /*optional*/::mlir::BoolAttr transpose_a, /*optional*/::mlir::BoolAttr transpose_b, /*optional*/::mlir::BoolAttr a_is_sparse, /*optional*/::mlir::BoolAttr b_is_sparse); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, /*optional*/::mlir::BoolAttr transpose_a, /*optional*/::mlir::BoolAttr transpose_b, /*optional*/::mlir::BoolAttr a_is_sparse, /*optional*/::mlir::BoolAttr b_is_sparse); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type product, ::mlir::Value a, ::mlir::Value b, /*optional*/bool transpose_a = false, /*optional*/bool transpose_b = false, /*optional*/bool a_is_sparse = false, /*optional*/bool b_is_sparse = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, /*optional*/bool transpose_a = false, /*optional*/bool transpose_b = false, /*optional*/bool a_is_sparse = false, /*optional*/bool b_is_sparse = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SparseMatMulOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SparseReduceSumOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SparseReduceSumOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SparseReduceSumOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SparseReduceSumOpGenericAdaptorBase(SparseReduceSumOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getKeepDimsAttr(); + bool getKeepDims(); +}; +} // namespace detail +template +class SparseReduceSumOpGenericAdaptor : public detail::SparseReduceSumOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SparseReduceSumOpGenericAdaptorBase; +public: + SparseReduceSumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SparseReduceSumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SparseReduceSumOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SparseReduceSumOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputIndices() { + return (*getODSOperands(0).begin()); + } + + ValueT getInputValues() { + return (*getODSOperands(1).begin()); + } + + ValueT getInputShape() { + return (*getODSOperands(2).begin()); + } + + ValueT getReductionAxes() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SparseReduceSumOpAdaptor : public SparseReduceSumOpGenericAdaptor<::mlir::ValueRange> { +public: + using SparseReduceSumOpGenericAdaptor::SparseReduceSumOpGenericAdaptor; + SparseReduceSumOpAdaptor(SparseReduceSumOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SparseReduceSumOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SparseReduceSumOpAdaptor; + template + using GenericAdaptor = SparseReduceSumOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("keep_dims")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getKeepDimsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getKeepDimsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SparseReduceSum"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputIndices(); + ::mlir::TypedValue<::mlir::TensorType> getInputValues(); + ::mlir::TypedValue<::mlir::TensorType> getInputShape(); + ::mlir::TypedValue<::mlir::TensorType> getReductionAxes(); + ::mlir::OpOperand &getInputIndicesMutable(); + ::mlir::OpOperand &getInputValuesMutable(); + ::mlir::OpOperand &getInputShapeMutable(); + ::mlir::OpOperand &getReductionAxesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getKeepDimsAttr(); + bool getKeepDims(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setKeepDimsAttr(::mlir::BoolAttr attr); + void setKeepDims(::std::optional attrValue); + ::mlir::Attribute removeKeepDimsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input_indices, ::mlir::Value input_values, ::mlir::Value input_shape, ::mlir::Value reduction_axes, /*optional*/::mlir::BoolAttr keep_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_indices, ::mlir::Value input_values, ::mlir::Value input_shape, ::mlir::Value reduction_axes, /*optional*/::mlir::BoolAttr keep_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input_indices, ::mlir::Value input_values, ::mlir::Value input_shape, ::mlir::Value reduction_axes, /*optional*/bool keep_dims = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_indices, ::mlir::Value input_values, ::mlir::Value input_shape, ::mlir::Value reduction_axes, /*optional*/bool keep_dims = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SparseReduceSumOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SparseReshapeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SparseReshapeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SparseReshapeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SparseReshapeOpGenericAdaptorBase(SparseReshapeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SparseReshapeOpGenericAdaptor : public detail::SparseReshapeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SparseReshapeOpGenericAdaptorBase; +public: + SparseReshapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SparseReshapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SparseReshapeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SparseReshapeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputIndices() { + return (*getODSOperands(0).begin()); + } + + ValueT getInputShape() { + return (*getODSOperands(1).begin()); + } + + ValueT getNewShape() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SparseReshapeOpAdaptor : public SparseReshapeOpGenericAdaptor<::mlir::ValueRange> { +public: + using SparseReshapeOpGenericAdaptor::SparseReshapeOpGenericAdaptor; + SparseReshapeOpAdaptor(SparseReshapeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SparseReshapeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SparseReshapeOpAdaptor; + template + using GenericAdaptor = SparseReshapeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SparseReshape"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputIndices(); + ::mlir::TypedValue<::mlir::TensorType> getInputShape(); + ::mlir::TypedValue<::mlir::TensorType> getNewShape(); + ::mlir::OpOperand &getInputIndicesMutable(); + ::mlir::OpOperand &getInputShapeMutable(); + ::mlir::OpOperand &getNewShapeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutputIndices(); + ::mlir::TypedValue<::mlir::TensorType> getOutputShape(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output_indices, ::mlir::Type output_shape, ::mlir::Value input_indices, ::mlir::Value input_shape, ::mlir::Value new_shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_indices, ::mlir::Value input_shape, ::mlir::Value new_shape); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SparseReshapeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SparseSegmentMeanGradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SparseSegmentMeanGradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SparseSegmentMeanGradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SparseSegmentMeanGradOpGenericAdaptorBase(SparseSegmentMeanGradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SparseSegmentMeanGradOpGenericAdaptor : public detail::SparseSegmentMeanGradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SparseSegmentMeanGradOpGenericAdaptorBase; +public: + SparseSegmentMeanGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SparseSegmentMeanGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SparseSegmentMeanGradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SparseSegmentMeanGradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getGrad() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getSegmentIds() { + return (*getODSOperands(2).begin()); + } + + ValueT getOutputDim0() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SparseSegmentMeanGradOpAdaptor : public SparseSegmentMeanGradOpGenericAdaptor<::mlir::ValueRange> { +public: + using SparseSegmentMeanGradOpGenericAdaptor::SparseSegmentMeanGradOpGenericAdaptor; + SparseSegmentMeanGradOpAdaptor(SparseSegmentMeanGradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SparseSegmentMeanGradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SparseSegmentMeanGradOpAdaptor; + template + using GenericAdaptor = SparseSegmentMeanGradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tidx"), ::llvm::StringRef("Tsegmentids")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTidxAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTidxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTsegmentidsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTsegmentidsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SparseSegmentMeanGrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getGrad(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getSegmentIds(); + ::mlir::TypedValue<::mlir::TensorType> getOutputDim0(); + ::mlir::OpOperand &getGradMutable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getSegmentIdsMutable(); + ::mlir::OpOperand &getOutputDim0Mutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTidx(); + ::mlir::Type getTsegmentids(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value grad, ::mlir::Value indices, ::mlir::Value segment_ids, ::mlir::Value output_dim0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value grad, ::mlir::Value indices, ::mlir::Value segment_ids, ::mlir::Value output_dim0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SparseSegmentMeanGradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SparseSegmentMeanOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SparseSegmentMeanOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SparseSegmentMeanOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SparseSegmentMeanOpGenericAdaptorBase(SparseSegmentMeanOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getSparseGradientAttr(); + bool getSparseGradient(); +}; +} // namespace detail +template +class SparseSegmentMeanOpGenericAdaptor : public detail::SparseSegmentMeanOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SparseSegmentMeanOpGenericAdaptorBase; +public: + SparseSegmentMeanOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SparseSegmentMeanOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SparseSegmentMeanOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SparseSegmentMeanOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getData() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getSegmentIds() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SparseSegmentMeanOpAdaptor : public SparseSegmentMeanOpGenericAdaptor<::mlir::ValueRange> { +public: + using SparseSegmentMeanOpGenericAdaptor::SparseSegmentMeanOpGenericAdaptor; + SparseSegmentMeanOpAdaptor(SparseSegmentMeanOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SparseSegmentMeanOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SparseSegmentMeanOpAdaptor; + template + using GenericAdaptor = SparseSegmentMeanOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tidx"), ::llvm::StringRef("Tsegmentids"), ::llvm::StringRef("sparse_gradient")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTidxAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTidxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTsegmentidsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTsegmentidsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSparseGradientAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSparseGradientAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SparseSegmentMean"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getData(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getSegmentIds(); + ::mlir::OpOperand &getDataMutable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getSegmentIdsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getSparseGradientAttr(); + bool getSparseGradient(); + ::mlir::Type getT(); + ::mlir::Type getTidx(); + ::mlir::Type getTsegmentids(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setSparseGradientAttr(::mlir::BoolAttr attr); + void setSparseGradient(::std::optional attrValue); + ::mlir::Attribute removeSparseGradientAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value data, ::mlir::Value indices, ::mlir::Value segment_ids, /*optional*/::mlir::BoolAttr sparse_gradient); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value data, ::mlir::Value indices, ::mlir::Value segment_ids, /*optional*/::mlir::BoolAttr sparse_gradient); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value data, ::mlir::Value indices, ::mlir::Value segment_ids, /*optional*/bool sparse_gradient = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value data, ::mlir::Value indices, ::mlir::Value segment_ids, /*optional*/bool sparse_gradient = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SparseSegmentMeanOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SparseSegmentMeanWithNumSegmentsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SparseSegmentMeanWithNumSegmentsOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SparseSegmentMeanWithNumSegmentsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SparseSegmentMeanWithNumSegmentsOpGenericAdaptorBase(SparseSegmentMeanWithNumSegmentsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getSparseGradientAttr(); + bool getSparseGradient(); +}; +} // namespace detail +template +class SparseSegmentMeanWithNumSegmentsOpGenericAdaptor : public detail::SparseSegmentMeanWithNumSegmentsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SparseSegmentMeanWithNumSegmentsOpGenericAdaptorBase; +public: + SparseSegmentMeanWithNumSegmentsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SparseSegmentMeanWithNumSegmentsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SparseSegmentMeanWithNumSegmentsOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SparseSegmentMeanWithNumSegmentsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getData() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getSegmentIds() { + return (*getODSOperands(2).begin()); + } + + ValueT getNumSegments() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SparseSegmentMeanWithNumSegmentsOpAdaptor : public SparseSegmentMeanWithNumSegmentsOpGenericAdaptor<::mlir::ValueRange> { +public: + using SparseSegmentMeanWithNumSegmentsOpGenericAdaptor::SparseSegmentMeanWithNumSegmentsOpGenericAdaptor; + SparseSegmentMeanWithNumSegmentsOpAdaptor(SparseSegmentMeanWithNumSegmentsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SparseSegmentMeanWithNumSegmentsOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SparseSegmentMeanWithNumSegmentsOpAdaptor; + template + using GenericAdaptor = SparseSegmentMeanWithNumSegmentsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tidx"), ::llvm::StringRef("Tnumsegments"), ::llvm::StringRef("Tsegmentids"), ::llvm::StringRef("sparse_gradient")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTidxAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTidxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTnumsegmentsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTnumsegmentsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTsegmentidsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTsegmentidsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getSparseGradientAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getSparseGradientAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SparseSegmentMeanWithNumSegments"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getData(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getSegmentIds(); + ::mlir::TypedValue<::mlir::TensorType> getNumSegments(); + ::mlir::OpOperand &getDataMutable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getSegmentIdsMutable(); + ::mlir::OpOperand &getNumSegmentsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getSparseGradientAttr(); + bool getSparseGradient(); + ::mlir::Type getT(); + ::mlir::Type getTidx(); + ::mlir::Type getTnumsegments(); + ::mlir::Type getTsegmentids(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setSparseGradientAttr(::mlir::BoolAttr attr); + void setSparseGradient(::std::optional attrValue); + ::mlir::Attribute removeSparseGradientAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value data, ::mlir::Value indices, ::mlir::Value segment_ids, ::mlir::Value num_segments, /*optional*/::mlir::BoolAttr sparse_gradient); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value data, ::mlir::Value indices, ::mlir::Value segment_ids, ::mlir::Value num_segments, /*optional*/::mlir::BoolAttr sparse_gradient); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value data, ::mlir::Value indices, ::mlir::Value segment_ids, ::mlir::Value num_segments, /*optional*/bool sparse_gradient = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value data, ::mlir::Value indices, ::mlir::Value segment_ids, ::mlir::Value num_segments, /*optional*/bool sparse_gradient = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SparseSegmentMeanWithNumSegmentsOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SparseSegmentSqrtNGradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SparseSegmentSqrtNGradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SparseSegmentSqrtNGradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SparseSegmentSqrtNGradOpGenericAdaptorBase(SparseSegmentSqrtNGradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SparseSegmentSqrtNGradOpGenericAdaptor : public detail::SparseSegmentSqrtNGradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SparseSegmentSqrtNGradOpGenericAdaptorBase; +public: + SparseSegmentSqrtNGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SparseSegmentSqrtNGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SparseSegmentSqrtNGradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SparseSegmentSqrtNGradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getGrad() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getSegmentIds() { + return (*getODSOperands(2).begin()); + } + + ValueT getOutputDim0() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SparseSegmentSqrtNGradOpAdaptor : public SparseSegmentSqrtNGradOpGenericAdaptor<::mlir::ValueRange> { +public: + using SparseSegmentSqrtNGradOpGenericAdaptor::SparseSegmentSqrtNGradOpGenericAdaptor; + SparseSegmentSqrtNGradOpAdaptor(SparseSegmentSqrtNGradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SparseSegmentSqrtNGradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SparseSegmentSqrtNGradOpAdaptor; + template + using GenericAdaptor = SparseSegmentSqrtNGradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tidx"), ::llvm::StringRef("Tsegmentids")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTidxAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTidxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTsegmentidsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTsegmentidsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SparseSegmentSqrtNGrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getGrad(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getSegmentIds(); + ::mlir::TypedValue<::mlir::TensorType> getOutputDim0(); + ::mlir::OpOperand &getGradMutable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getSegmentIdsMutable(); + ::mlir::OpOperand &getOutputDim0Mutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTidx(); + ::mlir::Type getTsegmentids(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value grad, ::mlir::Value indices, ::mlir::Value segment_ids, ::mlir::Value output_dim0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value grad, ::mlir::Value indices, ::mlir::Value segment_ids, ::mlir::Value output_dim0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SparseSegmentSqrtNGradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SparseSegmentSqrtNOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SparseSegmentSqrtNOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SparseSegmentSqrtNOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SparseSegmentSqrtNOpGenericAdaptorBase(SparseSegmentSqrtNOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getSparseGradientAttr(); + bool getSparseGradient(); +}; +} // namespace detail +template +class SparseSegmentSqrtNOpGenericAdaptor : public detail::SparseSegmentSqrtNOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SparseSegmentSqrtNOpGenericAdaptorBase; +public: + SparseSegmentSqrtNOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SparseSegmentSqrtNOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SparseSegmentSqrtNOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SparseSegmentSqrtNOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getData() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getSegmentIds() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SparseSegmentSqrtNOpAdaptor : public SparseSegmentSqrtNOpGenericAdaptor<::mlir::ValueRange> { +public: + using SparseSegmentSqrtNOpGenericAdaptor::SparseSegmentSqrtNOpGenericAdaptor; + SparseSegmentSqrtNOpAdaptor(SparseSegmentSqrtNOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SparseSegmentSqrtNOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SparseSegmentSqrtNOpAdaptor; + template + using GenericAdaptor = SparseSegmentSqrtNOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tidx"), ::llvm::StringRef("Tsegmentids"), ::llvm::StringRef("sparse_gradient")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTidxAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTidxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTsegmentidsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTsegmentidsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSparseGradientAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSparseGradientAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SparseSegmentSqrtN"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getData(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getSegmentIds(); + ::mlir::OpOperand &getDataMutable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getSegmentIdsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getSparseGradientAttr(); + bool getSparseGradient(); + ::mlir::Type getT(); + ::mlir::Type getTidx(); + ::mlir::Type getTsegmentids(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setSparseGradientAttr(::mlir::BoolAttr attr); + void setSparseGradient(::std::optional attrValue); + ::mlir::Attribute removeSparseGradientAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value data, ::mlir::Value indices, ::mlir::Value segment_ids, /*optional*/::mlir::BoolAttr sparse_gradient); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value data, ::mlir::Value indices, ::mlir::Value segment_ids, /*optional*/::mlir::BoolAttr sparse_gradient); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value data, ::mlir::Value indices, ::mlir::Value segment_ids, /*optional*/bool sparse_gradient = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value data, ::mlir::Value indices, ::mlir::Value segment_ids, /*optional*/bool sparse_gradient = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SparseSegmentSqrtNOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SparseSegmentSqrtNWithNumSegmentsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SparseSegmentSqrtNWithNumSegmentsOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SparseSegmentSqrtNWithNumSegmentsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SparseSegmentSqrtNWithNumSegmentsOpGenericAdaptorBase(SparseSegmentSqrtNWithNumSegmentsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getSparseGradientAttr(); + bool getSparseGradient(); +}; +} // namespace detail +template +class SparseSegmentSqrtNWithNumSegmentsOpGenericAdaptor : public detail::SparseSegmentSqrtNWithNumSegmentsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SparseSegmentSqrtNWithNumSegmentsOpGenericAdaptorBase; +public: + SparseSegmentSqrtNWithNumSegmentsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SparseSegmentSqrtNWithNumSegmentsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SparseSegmentSqrtNWithNumSegmentsOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SparseSegmentSqrtNWithNumSegmentsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getData() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getSegmentIds() { + return (*getODSOperands(2).begin()); + } + + ValueT getNumSegments() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SparseSegmentSqrtNWithNumSegmentsOpAdaptor : public SparseSegmentSqrtNWithNumSegmentsOpGenericAdaptor<::mlir::ValueRange> { +public: + using SparseSegmentSqrtNWithNumSegmentsOpGenericAdaptor::SparseSegmentSqrtNWithNumSegmentsOpGenericAdaptor; + SparseSegmentSqrtNWithNumSegmentsOpAdaptor(SparseSegmentSqrtNWithNumSegmentsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SparseSegmentSqrtNWithNumSegmentsOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SparseSegmentSqrtNWithNumSegmentsOpAdaptor; + template + using GenericAdaptor = SparseSegmentSqrtNWithNumSegmentsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tidx"), ::llvm::StringRef("Tnumsegments"), ::llvm::StringRef("Tsegmentids"), ::llvm::StringRef("sparse_gradient")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTidxAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTidxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTnumsegmentsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTnumsegmentsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTsegmentidsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTsegmentidsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getSparseGradientAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getSparseGradientAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SparseSegmentSqrtNWithNumSegments"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getData(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getSegmentIds(); + ::mlir::TypedValue<::mlir::TensorType> getNumSegments(); + ::mlir::OpOperand &getDataMutable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getSegmentIdsMutable(); + ::mlir::OpOperand &getNumSegmentsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getSparseGradientAttr(); + bool getSparseGradient(); + ::mlir::Type getT(); + ::mlir::Type getTidx(); + ::mlir::Type getTnumsegments(); + ::mlir::Type getTsegmentids(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setSparseGradientAttr(::mlir::BoolAttr attr); + void setSparseGradient(::std::optional attrValue); + ::mlir::Attribute removeSparseGradientAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value data, ::mlir::Value indices, ::mlir::Value segment_ids, ::mlir::Value num_segments, /*optional*/::mlir::BoolAttr sparse_gradient); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value data, ::mlir::Value indices, ::mlir::Value segment_ids, ::mlir::Value num_segments, /*optional*/::mlir::BoolAttr sparse_gradient); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value data, ::mlir::Value indices, ::mlir::Value segment_ids, ::mlir::Value num_segments, /*optional*/bool sparse_gradient = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value data, ::mlir::Value indices, ::mlir::Value segment_ids, ::mlir::Value num_segments, /*optional*/bool sparse_gradient = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SparseSegmentSqrtNWithNumSegmentsOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SparseSegmentSumOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SparseSegmentSumOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SparseSegmentSumOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SparseSegmentSumOpGenericAdaptorBase(SparseSegmentSumOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getSparseGradientAttr(); + bool getSparseGradient(); +}; +} // namespace detail +template +class SparseSegmentSumOpGenericAdaptor : public detail::SparseSegmentSumOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SparseSegmentSumOpGenericAdaptorBase; +public: + SparseSegmentSumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SparseSegmentSumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SparseSegmentSumOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SparseSegmentSumOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getData() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getSegmentIds() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SparseSegmentSumOpAdaptor : public SparseSegmentSumOpGenericAdaptor<::mlir::ValueRange> { +public: + using SparseSegmentSumOpGenericAdaptor::SparseSegmentSumOpGenericAdaptor; + SparseSegmentSumOpAdaptor(SparseSegmentSumOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SparseSegmentSumOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SparseSegmentSumOpAdaptor; + template + using GenericAdaptor = SparseSegmentSumOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tidx"), ::llvm::StringRef("Tsegmentids"), ::llvm::StringRef("sparse_gradient")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTidxAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTidxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTsegmentidsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTsegmentidsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSparseGradientAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSparseGradientAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SparseSegmentSum"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getData(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getSegmentIds(); + ::mlir::OpOperand &getDataMutable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getSegmentIdsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getSparseGradientAttr(); + bool getSparseGradient(); + ::mlir::Type getT(); + ::mlir::Type getTidx(); + ::mlir::Type getTsegmentids(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setSparseGradientAttr(::mlir::BoolAttr attr); + void setSparseGradient(::std::optional attrValue); + ::mlir::Attribute removeSparseGradientAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value data, ::mlir::Value indices, ::mlir::Value segment_ids, /*optional*/::mlir::BoolAttr sparse_gradient); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value data, ::mlir::Value indices, ::mlir::Value segment_ids, /*optional*/::mlir::BoolAttr sparse_gradient); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value data, ::mlir::Value indices, ::mlir::Value segment_ids, /*optional*/bool sparse_gradient = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value data, ::mlir::Value indices, ::mlir::Value segment_ids, /*optional*/bool sparse_gradient = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SparseSegmentSumOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SparseSoftmaxCrossEntropyWithLogitsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SparseSoftmaxCrossEntropyWithLogitsOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SparseSoftmaxCrossEntropyWithLogitsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SparseSoftmaxCrossEntropyWithLogitsOpGenericAdaptorBase(SparseSoftmaxCrossEntropyWithLogitsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SparseSoftmaxCrossEntropyWithLogitsOpGenericAdaptor : public detail::SparseSoftmaxCrossEntropyWithLogitsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SparseSoftmaxCrossEntropyWithLogitsOpGenericAdaptorBase; +public: + SparseSoftmaxCrossEntropyWithLogitsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SparseSoftmaxCrossEntropyWithLogitsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SparseSoftmaxCrossEntropyWithLogitsOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SparseSoftmaxCrossEntropyWithLogitsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getFeatures() { + return (*getODSOperands(0).begin()); + } + + ValueT getLabels() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SparseSoftmaxCrossEntropyWithLogitsOpAdaptor : public SparseSoftmaxCrossEntropyWithLogitsOpGenericAdaptor<::mlir::ValueRange> { +public: + using SparseSoftmaxCrossEntropyWithLogitsOpGenericAdaptor::SparseSoftmaxCrossEntropyWithLogitsOpGenericAdaptor; + SparseSoftmaxCrossEntropyWithLogitsOpAdaptor(SparseSoftmaxCrossEntropyWithLogitsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SparseSoftmaxCrossEntropyWithLogitsOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SparseSoftmaxCrossEntropyWithLogitsOpAdaptor; + template + using GenericAdaptor = SparseSoftmaxCrossEntropyWithLogitsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tlabels")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTlabelsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTlabelsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SparseSoftmaxCrossEntropyWithLogits"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getFeatures(); + ::mlir::TypedValue<::mlir::TensorType> getLabels(); + ::mlir::OpOperand &getFeaturesMutable(); + ::mlir::OpOperand &getLabelsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLoss(); + ::mlir::TypedValue<::mlir::TensorType> getBackprop(); + ::mlir::Type getT(); + ::mlir::Type getTlabels(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type loss, ::mlir::Type backprop, ::mlir::Value features, ::mlir::Value labels); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value features, ::mlir::Value labels); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SparseSoftmaxCrossEntropyWithLogitsOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SparseTensorDenseMatMulOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SparseTensorDenseMatMulOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SparseTensorDenseMatMulOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SparseTensorDenseMatMulOpGenericAdaptorBase(SparseTensorDenseMatMulOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getAdjointAAttr(); + bool getAdjointA(); + ::mlir::BoolAttr getAdjointBAttr(); + bool getAdjointB(); +}; +} // namespace detail +template +class SparseTensorDenseMatMulOpGenericAdaptor : public detail::SparseTensorDenseMatMulOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SparseTensorDenseMatMulOpGenericAdaptorBase; +public: + SparseTensorDenseMatMulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SparseTensorDenseMatMulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SparseTensorDenseMatMulOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SparseTensorDenseMatMulOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getAIndices() { + return (*getODSOperands(0).begin()); + } + + ValueT getAValues() { + return (*getODSOperands(1).begin()); + } + + ValueT getAShape() { + return (*getODSOperands(2).begin()); + } + + ValueT getB() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SparseTensorDenseMatMulOpAdaptor : public SparseTensorDenseMatMulOpGenericAdaptor<::mlir::ValueRange> { +public: + using SparseTensorDenseMatMulOpGenericAdaptor::SparseTensorDenseMatMulOpGenericAdaptor; + SparseTensorDenseMatMulOpAdaptor(SparseTensorDenseMatMulOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SparseTensorDenseMatMulOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SparseTensorDenseMatMulOpAdaptor; + template + using GenericAdaptor = SparseTensorDenseMatMulOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices"), ::llvm::StringRef("adjoint_a"), ::llvm::StringRef("adjoint_b")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getAdjointAAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getAdjointAAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getAdjointBAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getAdjointBAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SparseTensorDenseMatMul"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getAIndices(); + ::mlir::TypedValue<::mlir::TensorType> getAValues(); + ::mlir::TypedValue<::mlir::TensorType> getAShape(); + ::mlir::TypedValue<::mlir::TensorType> getB(); + ::mlir::OpOperand &getAIndicesMutable(); + ::mlir::OpOperand &getAValuesMutable(); + ::mlir::OpOperand &getAShapeMutable(); + ::mlir::OpOperand &getBMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getProduct(); + ::mlir::BoolAttr getAdjointAAttr(); + bool getAdjointA(); + ::mlir::BoolAttr getAdjointBAttr(); + bool getAdjointB(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setAdjointAAttr(::mlir::BoolAttr attr); + void setAdjointA(::std::optional attrValue); + void setAdjointBAttr(::mlir::BoolAttr attr); + void setAdjointB(::std::optional attrValue); + ::mlir::Attribute removeAdjointAAttr(); + ::mlir::Attribute removeAdjointBAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type product, ::mlir::Value a_indices, ::mlir::Value a_values, ::mlir::Value a_shape, ::mlir::Value b, /*optional*/::mlir::BoolAttr adjoint_a, /*optional*/::mlir::BoolAttr adjoint_b); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a_indices, ::mlir::Value a_values, ::mlir::Value a_shape, ::mlir::Value b, /*optional*/::mlir::BoolAttr adjoint_a, /*optional*/::mlir::BoolAttr adjoint_b); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type product, ::mlir::Value a_indices, ::mlir::Value a_values, ::mlir::Value a_shape, ::mlir::Value b, /*optional*/bool adjoint_a = false, /*optional*/bool adjoint_b = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a_indices, ::mlir::Value a_values, ::mlir::Value a_shape, ::mlir::Value b, /*optional*/bool adjoint_a = false, /*optional*/bool adjoint_b = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SparseTensorDenseMatMulOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SparseToDenseOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SparseToDenseOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SparseToDenseOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SparseToDenseOpGenericAdaptorBase(SparseToDenseOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getValidateIndicesAttr(); + bool getValidateIndices(); +}; +} // namespace detail +template +class SparseToDenseOpGenericAdaptor : public detail::SparseToDenseOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SparseToDenseOpGenericAdaptorBase; +public: + SparseToDenseOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SparseToDenseOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SparseToDenseOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SparseToDenseOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSparseIndices() { + return (*getODSOperands(0).begin()); + } + + ValueT getOutputShape() { + return (*getODSOperands(1).begin()); + } + + ValueT getSparseValues() { + return (*getODSOperands(2).begin()); + } + + ValueT getDefaultValue() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SparseToDenseOpAdaptor : public SparseToDenseOpGenericAdaptor<::mlir::ValueRange> { +public: + using SparseToDenseOpGenericAdaptor::SparseToDenseOpGenericAdaptor; + SparseToDenseOpAdaptor(SparseToDenseOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SparseToDenseOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SparseToDenseOpAdaptor; + template + using GenericAdaptor = SparseToDenseOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices"), ::llvm::StringRef("validate_indices")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getValidateIndicesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getValidateIndicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SparseToDense"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSparseIndices(); + ::mlir::TypedValue<::mlir::TensorType> getOutputShape(); + ::mlir::TypedValue<::mlir::TensorType> getSparseValues(); + ::mlir::TypedValue<::mlir::TensorType> getDefaultValue(); + ::mlir::OpOperand &getSparseIndicesMutable(); + ::mlir::OpOperand &getOutputShapeMutable(); + ::mlir::OpOperand &getSparseValuesMutable(); + ::mlir::OpOperand &getDefaultValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getDense(); + ::mlir::BoolAttr getValidateIndicesAttr(); + bool getValidateIndices(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setValidateIndicesAttr(::mlir::BoolAttr attr); + void setValidateIndices(::std::optional attrValue); + ::mlir::Attribute removeValidateIndicesAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type dense, ::mlir::Value sparse_indices, ::mlir::Value output_shape, ::mlir::Value sparse_values, ::mlir::Value default_value, /*optional*/::mlir::BoolAttr validate_indices); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value sparse_indices, ::mlir::Value output_shape, ::mlir::Value sparse_values, ::mlir::Value default_value, /*optional*/::mlir::BoolAttr validate_indices); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type dense, ::mlir::Value sparse_indices, ::mlir::Value output_shape, ::mlir::Value sparse_values, ::mlir::Value default_value, /*optional*/bool validate_indices = true); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value sparse_indices, ::mlir::Value output_shape, ::mlir::Value sparse_values, ::mlir::Value default_value, /*optional*/bool validate_indices = true); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SparseToDenseOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SplitOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SplitOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SplitOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SplitOpGenericAdaptorBase(SplitOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SplitOpGenericAdaptor : public detail::SplitOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SplitOpGenericAdaptorBase; +public: + SplitOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SplitOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SplitOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SplitOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSplitDim() { + return (*getODSOperands(0).begin()); + } + + ValueT getValue() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SplitOpAdaptor : public SplitOpGenericAdaptor<::mlir::ValueRange> { +public: + using SplitOpGenericAdaptor::SplitOpGenericAdaptor; + SplitOpAdaptor(SplitOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SplitOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SplitOpAdaptor; + template + using GenericAdaptor = SplitOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("num_split")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumSplitAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumSplitAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Split"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSplitDim(); + ::mlir::TypedValue<::mlir::TensorType> getValue(); + ::mlir::OpOperand &getSplitDimMutable(); + ::mlir::OpOperand &getValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutput(); + ::mlir::Type getT(); + size_t getNumSplit(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::Value split_dim, ::mlir::Value value); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SplitOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SplitVOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SplitVOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SplitVOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SplitVOpGenericAdaptorBase(SplitVOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SplitVOpGenericAdaptor : public detail::SplitVOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SplitVOpGenericAdaptorBase; +public: + SplitVOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SplitVOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SplitVOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SplitVOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getValue() { + return (*getODSOperands(0).begin()); + } + + ValueT getSizeSplits() { + return (*getODSOperands(1).begin()); + } + + ValueT getSplitDim() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SplitVOpAdaptor : public SplitVOpGenericAdaptor<::mlir::ValueRange> { +public: + using SplitVOpGenericAdaptor::SplitVOpGenericAdaptor; + SplitVOpAdaptor(SplitVOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SplitVOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SplitVOpAdaptor; + template + using GenericAdaptor = SplitVOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tlen"), ::llvm::StringRef("num_split")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTlenAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTlenAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getNumSplitAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getNumSplitAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SplitV"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getValue(); + ::mlir::TypedValue<::mlir::TensorType> getSizeSplits(); + ::mlir::TypedValue<::mlir::TensorType> getSplitDim(); + ::mlir::OpOperand &getValueMutable(); + ::mlir::OpOperand &getSizeSplitsMutable(); + ::mlir::OpOperand &getSplitDimMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTlen(); + size_t getNumSplit(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::Value value, ::mlir::Value size_splits, ::mlir::Value split_dim); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SplitVOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SqrtGradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SqrtGradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SqrtGradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SqrtGradOpGenericAdaptorBase(SqrtGradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SqrtGradOpGenericAdaptor : public detail::SqrtGradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SqrtGradOpGenericAdaptorBase; +public: + SqrtGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SqrtGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SqrtGradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SqrtGradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getY() { + return (*getODSOperands(0).begin()); + } + + ValueT getDy() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SqrtGradOpAdaptor : public SqrtGradOpGenericAdaptor<::mlir::ValueRange> { +public: + using SqrtGradOpGenericAdaptor::SqrtGradOpGenericAdaptor; + SqrtGradOpAdaptor(SqrtGradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SqrtGradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SqrtGradOpAdaptor; + template + using GenericAdaptor = SqrtGradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SqrtGrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::TypedValue<::mlir::TensorType> getDy(); + ::mlir::OpOperand &getYMutable(); + ::mlir::OpOperand &getDyMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value y, ::mlir::Value dy); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value y, ::mlir::Value dy); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value y, ::mlir::Value dy); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SqrtGradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SqrtOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SqrtOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SqrtOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SqrtOpGenericAdaptorBase(SqrtOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SqrtOpGenericAdaptor : public detail::SqrtOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SqrtOpGenericAdaptorBase; +public: + SqrtOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SqrtOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SqrtOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SqrtOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SqrtOpAdaptor : public SqrtOpGenericAdaptor<::mlir::ValueRange> { +public: + using SqrtOpGenericAdaptor::SqrtOpGenericAdaptor; + SqrtOpAdaptor(SqrtOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SqrtOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SqrtOpAdaptor; + template + using GenericAdaptor = SqrtOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Sqrt"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SqrtOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SquareOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SquareOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SquareOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SquareOpGenericAdaptorBase(SquareOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SquareOpGenericAdaptor : public detail::SquareOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SquareOpGenericAdaptorBase; +public: + SquareOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SquareOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SquareOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SquareOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SquareOpAdaptor : public SquareOpGenericAdaptor<::mlir::ValueRange> { +public: + using SquareOpGenericAdaptor::SquareOpGenericAdaptor; + SquareOpAdaptor(SquareOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SquareOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SquareOpAdaptor; + template + using GenericAdaptor = SquareOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Square"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SquareOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SquaredDifferenceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SquaredDifferenceOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SquaredDifferenceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SquaredDifferenceOpGenericAdaptorBase(SquaredDifferenceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SquaredDifferenceOpGenericAdaptor : public detail::SquaredDifferenceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SquaredDifferenceOpGenericAdaptorBase; +public: + SquaredDifferenceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SquaredDifferenceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SquaredDifferenceOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SquaredDifferenceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SquaredDifferenceOpAdaptor : public SquaredDifferenceOpGenericAdaptor<::mlir::ValueRange> { +public: + using SquaredDifferenceOpGenericAdaptor::SquaredDifferenceOpGenericAdaptor; + SquaredDifferenceOpAdaptor(SquaredDifferenceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SquaredDifferenceOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsCommutative, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SquaredDifferenceOpAdaptor; + template + using GenericAdaptor = SquaredDifferenceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SquaredDifference"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SquaredDifferenceOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SqueezeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SqueezeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SqueezeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SqueezeOpGenericAdaptorBase(SqueezeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getSqueezeDimsAttr(); + ::mlir::ArrayAttr getSqueezeDims(); +}; +} // namespace detail +template +class SqueezeOpGenericAdaptor : public detail::SqueezeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SqueezeOpGenericAdaptorBase; +public: + SqueezeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SqueezeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SqueezeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SqueezeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SqueezeOpAdaptor : public SqueezeOpGenericAdaptor<::mlir::ValueRange> { +public: + using SqueezeOpGenericAdaptor::SqueezeOpGenericAdaptor; + SqueezeOpAdaptor(SqueezeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SqueezeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SqueezeOpAdaptor; + template + using GenericAdaptor = SqueezeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("squeeze_dims")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getSqueezeDimsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getSqueezeDimsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Squeeze"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ArrayAttr getSqueezeDimsAttr(); + ::mlir::ArrayAttr getSqueezeDims(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setSqueezeDimsAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeSqueezeDimsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, /*optional*/::mlir::ArrayAttr squeeze_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, /*optional*/::mlir::ArrayAttr squeeze_dims); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SqueezeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StackCloseV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StackCloseV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StackCloseV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StackCloseV2OpGenericAdaptorBase(StackCloseV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class StackCloseV2OpGenericAdaptor : public detail::StackCloseV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StackCloseV2OpGenericAdaptorBase; +public: + StackCloseV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StackCloseV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StackCloseV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StackCloseV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getHandle() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StackCloseV2OpAdaptor : public StackCloseV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using StackCloseV2OpGenericAdaptor::StackCloseV2OpGenericAdaptor; + StackCloseV2OpAdaptor(StackCloseV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StackCloseV2Op : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = StackCloseV2OpAdaptor; + template + using GenericAdaptor = StackCloseV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StackCloseV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::OpOperand &getHandleMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value handle); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value handle); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StackCloseV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StackPopV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StackPopV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StackPopV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StackPopV2OpGenericAdaptorBase(StackPopV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class StackPopV2OpGenericAdaptor : public detail::StackPopV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StackPopV2OpGenericAdaptorBase; +public: + StackPopV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StackPopV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StackPopV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StackPopV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getHandle() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StackPopV2OpAdaptor : public StackPopV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using StackPopV2OpGenericAdaptor::StackPopV2OpGenericAdaptor; + StackPopV2OpAdaptor(StackPopV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StackPopV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StackPopV2OpAdaptor; + template + using GenericAdaptor = StackPopV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("elem_type")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getElemTypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getElemTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StackPopV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::OpOperand &getHandleMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getElem(); + ::mlir::Type getElemType(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type elem, ::mlir::Value handle); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value handle); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StackPopV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StackPushV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StackPushV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StackPushV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StackPushV2OpGenericAdaptorBase(StackPushV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getSwapMemoryAttr(); + bool getSwapMemory(); +}; +} // namespace detail +template +class StackPushV2OpGenericAdaptor : public detail::StackPushV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StackPushV2OpGenericAdaptorBase; +public: + StackPushV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StackPushV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StackPushV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StackPushV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getElem() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StackPushV2OpAdaptor : public StackPushV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using StackPushV2OpGenericAdaptor::StackPushV2OpGenericAdaptor; + StackPushV2OpAdaptor(StackPushV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StackPushV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StackPushV2OpAdaptor; + template + using GenericAdaptor = StackPushV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("swap_memory")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getSwapMemoryAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getSwapMemoryAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StackPushV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::TypedValue<::mlir::TensorType> getElem(); + ::mlir::OpOperand &getHandleMutable(); + ::mlir::OpOperand &getElemMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getSwapMemoryAttr(); + bool getSwapMemory(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setSwapMemoryAttr(::mlir::BoolAttr attr); + void setSwapMemory(::std::optional attrValue); + ::mlir::Attribute removeSwapMemoryAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value handle, ::mlir::Value elem, /*optional*/::mlir::BoolAttr swap_memory); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value handle, ::mlir::Value elem, /*optional*/::mlir::BoolAttr swap_memory); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value handle, ::mlir::Value elem, /*optional*/bool swap_memory = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value handle, ::mlir::Value elem, /*optional*/bool swap_memory = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StackPushV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StackV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StackV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StackV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StackV2OpGenericAdaptorBase(StackV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::TypeAttr getElemTypeAttr(); + ::mlir::Type getElemType(); + ::mlir::StringAttr getStackNameAttr(); + ::llvm::StringRef getStackName(); +}; +} // namespace detail +template +class StackV2OpGenericAdaptor : public detail::StackV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StackV2OpGenericAdaptorBase; +public: + StackV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StackV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StackV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StackV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getMaxSize() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StackV2OpAdaptor : public StackV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using StackV2OpGenericAdaptor::StackV2OpGenericAdaptor; + StackV2OpAdaptor(StackV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StackV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ResourceHandleAllocatorInterface::Trait, ::mlir::OpTrait::TF::UniqueResourceAllocation, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StackV2OpAdaptor; + template + using GenericAdaptor = StackV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("elem_type"), ::llvm::StringRef("stack_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getElemTypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getElemTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getStackNameAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getStackNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StackV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getMaxSize(); + ::mlir::OpOperand &getMaxSizeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::TypeAttr getElemTypeAttr(); + ::mlir::Type getElemType(); + ::mlir::StringAttr getStackNameAttr(); + ::llvm::StringRef getStackName(); + void setElemTypeAttr(::mlir::TypeAttr attr); + void setElemType(::mlir::Type attrValue); + void setStackNameAttr(::mlir::StringAttr attr); + void setStackName(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeStackNameAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value max_size, ::mlir::TypeAttr elem_type, /*optional*/::mlir::StringAttr stack_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value max_size, ::mlir::TypeAttr elem_type, /*optional*/::mlir::StringAttr stack_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value max_size, ::mlir::Type elem_type, /*optional*/::llvm::StringRef stack_name = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value max_size, ::mlir::Type elem_type, /*optional*/::llvm::StringRef stack_name = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StackV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StatefulPartitionedCallOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StatefulPartitionedCallOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StatefulPartitionedCallOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StatefulPartitionedCallOpGenericAdaptorBase(StatefulPartitionedCallOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::FlatSymbolRefAttr getFAttr(); + ::llvm::StringRef getF(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + ::mlir::StringAttr getConfigProtoAttr(); + ::llvm::StringRef getConfigProto(); + ::mlir::StringAttr getExecutorTypeAttr(); + ::llvm::StringRef getExecutorType(); +}; +} // namespace detail +template +class StatefulPartitionedCallOpGenericAdaptor : public detail::StatefulPartitionedCallOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StatefulPartitionedCallOpGenericAdaptorBase; +public: + StatefulPartitionedCallOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StatefulPartitionedCallOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StatefulPartitionedCallOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StatefulPartitionedCallOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StatefulPartitionedCallOpAdaptor : public StatefulPartitionedCallOpGenericAdaptor<::mlir::ValueRange> { +public: + using StatefulPartitionedCallOpGenericAdaptor::StatefulPartitionedCallOpGenericAdaptor; + StatefulPartitionedCallOpAdaptor(StatefulPartitionedCallOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StatefulPartitionedCallOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = StatefulPartitionedCallOpAdaptor; + template + using GenericAdaptor = StatefulPartitionedCallOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tin"), ::llvm::StringRef("Tout"), ::llvm::StringRef("config"), ::llvm::StringRef("config_proto"), ::llvm::StringRef("executor_type"), ::llvm::StringRef("f")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTinAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTinAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getToutAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getToutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getConfigProtoAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getConfigProtoAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getExecutorTypeAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getExecutorTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getFAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getFAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StatefulPartitionedCall"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutput(); + ::mlir::FlatSymbolRefAttr getFAttr(); + ::llvm::StringRef getF(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + ::mlir::StringAttr getConfigProtoAttr(); + ::llvm::StringRef getConfigProto(); + ::mlir::StringAttr getExecutorTypeAttr(); + ::llvm::StringRef getExecutorType(); + mlir::OperandElementTypeRange getTin(); + mlir::ResultElementTypeRange getTout(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setFAttr(::mlir::FlatSymbolRefAttr attr); + void setF(::llvm::StringRef attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::llvm::StringRef attrValue); + void setConfigProtoAttr(::mlir::StringAttr attr); + void setConfigProto(::llvm::StringRef attrValue); + void setExecutorTypeAttr(::mlir::StringAttr attr); + void setExecutorType(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::ValueRange args, ::mlir::FlatSymbolRefAttr f, ::mlir::StringAttr config, ::mlir::StringAttr config_proto, ::mlir::StringAttr executor_type); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::ValueRange args, ::llvm::StringRef f, ::llvm::StringRef config, ::llvm::StringRef config_proto, ::llvm::StringRef executor_type); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verifySymbolUses(::mlir::SymbolTableCollection &symbolTable); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Gets the argument operands to the called function. + operand_range getArgOperands() { return getArgs(); } + MutableOperandRange getArgOperandsMutable() { + return getArgsMutable(); + } + + // Returns the callee of this operation. + CallInterfaceCallable getCallableForCallee() { return getFAttr(); } + // Sets the callee from the callable + void setCalleeFromCallable(::mlir::CallInterfaceCallable callee); + + // Returns the resolved callee function of this operation. + // Prefer passing in SymbolTableCollection to reduce lookup costs by + // enabling reusing cached symbol table lookup. + func::FuncOp ResolveFunc(::mlir::SymbolTableCollection* table) { + if (table) + return table->lookupNearestSymbolFrom(*this, getFAttr()); + return SymbolTable::lookupNearestSymbolFrom(*this, getFAttr()); + } + // TODO(b/204997177): Deprecate and remove. + func::FuncOp func() { return ResolveFunc(nullptr); } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StatefulPartitionedCallOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StatefulStandardNormalV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StatefulStandardNormalV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StatefulStandardNormalV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StatefulStandardNormalV2OpGenericAdaptorBase(StatefulStandardNormalV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class StatefulStandardNormalV2OpGenericAdaptor : public detail::StatefulStandardNormalV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StatefulStandardNormalV2OpGenericAdaptorBase; +public: + StatefulStandardNormalV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StatefulStandardNormalV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StatefulStandardNormalV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StatefulStandardNormalV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getResource() { + return (*getODSOperands(0).begin()); + } + + ValueT getAlgorithm() { + return (*getODSOperands(1).begin()); + } + + ValueT getShape() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StatefulStandardNormalV2OpAdaptor : public StatefulStandardNormalV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using StatefulStandardNormalV2OpGenericAdaptor::StatefulStandardNormalV2OpGenericAdaptor; + StatefulStandardNormalV2OpAdaptor(StatefulStandardNormalV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StatefulStandardNormalV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StatefulStandardNormalV2OpAdaptor; + template + using GenericAdaptor = StatefulStandardNormalV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dtype"), ::llvm::StringRef("shape_dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getShapeDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getShapeDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StatefulStandardNormalV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResource(); + ::mlir::TypedValue<::mlir::TensorType> getAlgorithm(); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::OpOperand &getResourceMutable(); + ::mlir::OpOperand &getAlgorithmMutable(); + ::mlir::OpOperand &getShapeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getShapeDtype(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value resource, ::mlir::Value algorithm, ::mlir::Value shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value resource, ::mlir::Value algorithm, ::mlir::Value shape); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StatefulStandardNormalV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StatefulTruncatedNormalOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StatefulTruncatedNormalOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StatefulTruncatedNormalOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StatefulTruncatedNormalOpGenericAdaptorBase(StatefulTruncatedNormalOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class StatefulTruncatedNormalOpGenericAdaptor : public detail::StatefulTruncatedNormalOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StatefulTruncatedNormalOpGenericAdaptorBase; +public: + StatefulTruncatedNormalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StatefulTruncatedNormalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StatefulTruncatedNormalOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StatefulTruncatedNormalOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getResource() { + return (*getODSOperands(0).begin()); + } + + ValueT getAlgorithm() { + return (*getODSOperands(1).begin()); + } + + ValueT getShape() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StatefulTruncatedNormalOpAdaptor : public StatefulTruncatedNormalOpGenericAdaptor<::mlir::ValueRange> { +public: + using StatefulTruncatedNormalOpGenericAdaptor::StatefulTruncatedNormalOpGenericAdaptor; + StatefulTruncatedNormalOpAdaptor(StatefulTruncatedNormalOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StatefulTruncatedNormalOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StatefulTruncatedNormalOpAdaptor; + template + using GenericAdaptor = StatefulTruncatedNormalOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dtype"), ::llvm::StringRef("shape_dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getShapeDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getShapeDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StatefulTruncatedNormal"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResource(); + ::mlir::TypedValue<::mlir::TensorType> getAlgorithm(); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::OpOperand &getResourceMutable(); + ::mlir::OpOperand &getAlgorithmMutable(); + ::mlir::OpOperand &getShapeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getShapeDtype(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value resource, ::mlir::Value algorithm, ::mlir::Value shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value resource, ::mlir::Value algorithm, ::mlir::Value shape); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StatefulTruncatedNormalOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StatefulUniformFullIntOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StatefulUniformFullIntOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StatefulUniformFullIntOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StatefulUniformFullIntOpGenericAdaptorBase(StatefulUniformFullIntOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class StatefulUniformFullIntOpGenericAdaptor : public detail::StatefulUniformFullIntOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StatefulUniformFullIntOpGenericAdaptorBase; +public: + StatefulUniformFullIntOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StatefulUniformFullIntOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StatefulUniformFullIntOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StatefulUniformFullIntOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getResource() { + return (*getODSOperands(0).begin()); + } + + ValueT getAlgorithm() { + return (*getODSOperands(1).begin()); + } + + ValueT getShape() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StatefulUniformFullIntOpAdaptor : public StatefulUniformFullIntOpGenericAdaptor<::mlir::ValueRange> { +public: + using StatefulUniformFullIntOpGenericAdaptor::StatefulUniformFullIntOpGenericAdaptor; + StatefulUniformFullIntOpAdaptor(StatefulUniformFullIntOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StatefulUniformFullIntOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StatefulUniformFullIntOpAdaptor; + template + using GenericAdaptor = StatefulUniformFullIntOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dtype"), ::llvm::StringRef("shape_dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getShapeDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getShapeDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StatefulUniformFullInt"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResource(); + ::mlir::TypedValue<::mlir::TensorType> getAlgorithm(); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::OpOperand &getResourceMutable(); + ::mlir::OpOperand &getAlgorithmMutable(); + ::mlir::OpOperand &getShapeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getShapeDtype(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value resource, ::mlir::Value algorithm, ::mlir::Value shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value resource, ::mlir::Value algorithm, ::mlir::Value shape); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StatefulUniformFullIntOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StatefulUniformIntOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StatefulUniformIntOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StatefulUniformIntOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StatefulUniformIntOpGenericAdaptorBase(StatefulUniformIntOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class StatefulUniformIntOpGenericAdaptor : public detail::StatefulUniformIntOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StatefulUniformIntOpGenericAdaptorBase; +public: + StatefulUniformIntOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StatefulUniformIntOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StatefulUniformIntOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StatefulUniformIntOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getResource() { + return (*getODSOperands(0).begin()); + } + + ValueT getAlgorithm() { + return (*getODSOperands(1).begin()); + } + + ValueT getShape() { + return (*getODSOperands(2).begin()); + } + + ValueT getMinval() { + return (*getODSOperands(3).begin()); + } + + ValueT getMaxval() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StatefulUniformIntOpAdaptor : public StatefulUniformIntOpGenericAdaptor<::mlir::ValueRange> { +public: + using StatefulUniformIntOpGenericAdaptor::StatefulUniformIntOpGenericAdaptor; + StatefulUniformIntOpAdaptor(StatefulUniformIntOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StatefulUniformIntOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<5>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StatefulUniformIntOpAdaptor; + template + using GenericAdaptor = StatefulUniformIntOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dtype"), ::llvm::StringRef("shape_dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getShapeDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getShapeDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StatefulUniformInt"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResource(); + ::mlir::TypedValue<::mlir::TensorType> getAlgorithm(); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::TypedValue<::mlir::TensorType> getMinval(); + ::mlir::TypedValue<::mlir::TensorType> getMaxval(); + ::mlir::OpOperand &getResourceMutable(); + ::mlir::OpOperand &getAlgorithmMutable(); + ::mlir::OpOperand &getShapeMutable(); + ::mlir::OpOperand &getMinvalMutable(); + ::mlir::OpOperand &getMaxvalMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getShapeDtype(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value resource, ::mlir::Value algorithm, ::mlir::Value shape, ::mlir::Value minval, ::mlir::Value maxval); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value resource, ::mlir::Value algorithm, ::mlir::Value shape, ::mlir::Value minval, ::mlir::Value maxval); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StatefulUniformIntOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StatefulUniformOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StatefulUniformOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StatefulUniformOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StatefulUniformOpGenericAdaptorBase(StatefulUniformOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class StatefulUniformOpGenericAdaptor : public detail::StatefulUniformOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StatefulUniformOpGenericAdaptorBase; +public: + StatefulUniformOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StatefulUniformOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StatefulUniformOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StatefulUniformOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getResource() { + return (*getODSOperands(0).begin()); + } + + ValueT getAlgorithm() { + return (*getODSOperands(1).begin()); + } + + ValueT getShape() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StatefulUniformOpAdaptor : public StatefulUniformOpGenericAdaptor<::mlir::ValueRange> { +public: + using StatefulUniformOpGenericAdaptor::StatefulUniformOpGenericAdaptor; + StatefulUniformOpAdaptor(StatefulUniformOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StatefulUniformOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StatefulUniformOpAdaptor; + template + using GenericAdaptor = StatefulUniformOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dtype"), ::llvm::StringRef("shape_dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getShapeDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getShapeDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StatefulUniform"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResource(); + ::mlir::TypedValue<::mlir::TensorType> getAlgorithm(); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::OpOperand &getResourceMutable(); + ::mlir::OpOperand &getAlgorithmMutable(); + ::mlir::OpOperand &getShapeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getShapeDtype(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value resource, ::mlir::Value algorithm, ::mlir::Value shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value resource, ::mlir::Value algorithm, ::mlir::Value shape); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StatefulUniformOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StatelessMultinomialOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StatelessMultinomialOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StatelessMultinomialOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StatelessMultinomialOpGenericAdaptorBase(StatelessMultinomialOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class StatelessMultinomialOpGenericAdaptor : public detail::StatelessMultinomialOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StatelessMultinomialOpGenericAdaptorBase; +public: + StatelessMultinomialOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StatelessMultinomialOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StatelessMultinomialOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StatelessMultinomialOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLogits() { + return (*getODSOperands(0).begin()); + } + + ValueT getNumSamples() { + return (*getODSOperands(1).begin()); + } + + ValueT getSeed() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StatelessMultinomialOpAdaptor : public StatelessMultinomialOpGenericAdaptor<::mlir::ValueRange> { +public: + using StatelessMultinomialOpGenericAdaptor::StatelessMultinomialOpGenericAdaptor; + StatelessMultinomialOpAdaptor(StatelessMultinomialOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StatelessMultinomialOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StatelessMultinomialOpAdaptor; + template + using GenericAdaptor = StatelessMultinomialOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tseed"), ::llvm::StringRef("output_dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTseedAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTseedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOutputDtypeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOutputDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StatelessMultinomial"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLogits(); + ::mlir::TypedValue<::mlir::TensorType> getNumSamples(); + ::mlir::TypedValue<::mlir::TensorType> getSeed(); + ::mlir::OpOperand &getLogitsMutable(); + ::mlir::OpOperand &getNumSamplesMutable(); + ::mlir::OpOperand &getSeedMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTseed(); + ::mlir::Type getOutputDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value logits, ::mlir::Value num_samples, ::mlir::Value seed); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value logits, ::mlir::Value num_samples, ::mlir::Value seed); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StatelessMultinomialOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StatelessParameterizedTruncatedNormalOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StatelessParameterizedTruncatedNormalOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StatelessParameterizedTruncatedNormalOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StatelessParameterizedTruncatedNormalOpGenericAdaptorBase(StatelessParameterizedTruncatedNormalOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class StatelessParameterizedTruncatedNormalOpGenericAdaptor : public detail::StatelessParameterizedTruncatedNormalOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StatelessParameterizedTruncatedNormalOpGenericAdaptorBase; +public: + StatelessParameterizedTruncatedNormalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StatelessParameterizedTruncatedNormalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StatelessParameterizedTruncatedNormalOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StatelessParameterizedTruncatedNormalOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getShape() { + return (*getODSOperands(0).begin()); + } + + ValueT getSeed() { + return (*getODSOperands(1).begin()); + } + + ValueT getMeans() { + return (*getODSOperands(2).begin()); + } + + ValueT getStddevs() { + return (*getODSOperands(3).begin()); + } + + ValueT getMinvals() { + return (*getODSOperands(4).begin()); + } + + ValueT getMaxvals() { + return (*getODSOperands(5).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StatelessParameterizedTruncatedNormalOpAdaptor : public StatelessParameterizedTruncatedNormalOpGenericAdaptor<::mlir::ValueRange> { +public: + using StatelessParameterizedTruncatedNormalOpGenericAdaptor::StatelessParameterizedTruncatedNormalOpGenericAdaptor; + StatelessParameterizedTruncatedNormalOpAdaptor(StatelessParameterizedTruncatedNormalOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StatelessParameterizedTruncatedNormalOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<6>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StatelessParameterizedTruncatedNormalOpAdaptor; + template + using GenericAdaptor = StatelessParameterizedTruncatedNormalOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("S"), ::llvm::StringRef("Tseed"), ::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getSAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getSAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTseedAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTseedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StatelessParameterizedTruncatedNormal"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::TypedValue<::mlir::TensorType> getSeed(); + ::mlir::TypedValue<::mlir::TensorType> getMeans(); + ::mlir::TypedValue<::mlir::TensorType> getStddevs(); + ::mlir::TypedValue<::mlir::TensorType> getMinvals(); + ::mlir::TypedValue<::mlir::TensorType> getMaxvals(); + ::mlir::OpOperand &getShapeMutable(); + ::mlir::OpOperand &getSeedMutable(); + ::mlir::OpOperand &getMeansMutable(); + ::mlir::OpOperand &getStddevsMutable(); + ::mlir::OpOperand &getMinvalsMutable(); + ::mlir::OpOperand &getMaxvalsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getS(); + ::mlir::Type getTseed(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, ::mlir::Value seed, ::mlir::Value means, ::mlir::Value stddevs, ::mlir::Value minvals, ::mlir::Value maxvals); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, ::mlir::Value seed, ::mlir::Value means, ::mlir::Value stddevs, ::mlir::Value minvals, ::mlir::Value maxvals); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StatelessParameterizedTruncatedNormalOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StatelessRandomBinomialOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StatelessRandomBinomialOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StatelessRandomBinomialOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StatelessRandomBinomialOpGenericAdaptorBase(StatelessRandomBinomialOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class StatelessRandomBinomialOpGenericAdaptor : public detail::StatelessRandomBinomialOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StatelessRandomBinomialOpGenericAdaptorBase; +public: + StatelessRandomBinomialOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StatelessRandomBinomialOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StatelessRandomBinomialOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StatelessRandomBinomialOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getShape() { + return (*getODSOperands(0).begin()); + } + + ValueT getSeed() { + return (*getODSOperands(1).begin()); + } + + ValueT getCounts() { + return (*getODSOperands(2).begin()); + } + + ValueT getProbs() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StatelessRandomBinomialOpAdaptor : public StatelessRandomBinomialOpGenericAdaptor<::mlir::ValueRange> { +public: + using StatelessRandomBinomialOpGenericAdaptor::StatelessRandomBinomialOpGenericAdaptor; + StatelessRandomBinomialOpAdaptor(StatelessRandomBinomialOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StatelessRandomBinomialOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StatelessRandomBinomialOpAdaptor; + template + using GenericAdaptor = StatelessRandomBinomialOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("S"), ::llvm::StringRef("T"), ::llvm::StringRef("Tseed"), ::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getSAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getSAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTseedAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTseedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StatelessRandomBinomial"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::TypedValue<::mlir::TensorType> getSeed(); + ::mlir::TypedValue<::mlir::TensorType> getCounts(); + ::mlir::TypedValue<::mlir::TensorType> getProbs(); + ::mlir::OpOperand &getShapeMutable(); + ::mlir::OpOperand &getSeedMutable(); + ::mlir::OpOperand &getCountsMutable(); + ::mlir::OpOperand &getProbsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getS(); + ::mlir::Type getT(); + ::mlir::Type getTseed(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, ::mlir::Value seed, ::mlir::Value counts, ::mlir::Value probs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, ::mlir::Value seed, ::mlir::Value counts, ::mlir::Value probs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StatelessRandomBinomialOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StatelessRandomGammaV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StatelessRandomGammaV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StatelessRandomGammaV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StatelessRandomGammaV2OpGenericAdaptorBase(StatelessRandomGammaV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class StatelessRandomGammaV2OpGenericAdaptor : public detail::StatelessRandomGammaV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StatelessRandomGammaV2OpGenericAdaptorBase; +public: + StatelessRandomGammaV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StatelessRandomGammaV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StatelessRandomGammaV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StatelessRandomGammaV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getShape() { + return (*getODSOperands(0).begin()); + } + + ValueT getSeed() { + return (*getODSOperands(1).begin()); + } + + ValueT getAlpha() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StatelessRandomGammaV2OpAdaptor : public StatelessRandomGammaV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using StatelessRandomGammaV2OpGenericAdaptor::StatelessRandomGammaV2OpGenericAdaptor; + StatelessRandomGammaV2OpAdaptor(StatelessRandomGammaV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StatelessRandomGammaV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StatelessRandomGammaV2OpAdaptor; + template + using GenericAdaptor = StatelessRandomGammaV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tseed"), ::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTseedAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTseedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StatelessRandomGammaV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::TypedValue<::mlir::TensorType> getSeed(); + ::mlir::TypedValue<::mlir::TensorType> getAlpha(); + ::mlir::OpOperand &getShapeMutable(); + ::mlir::OpOperand &getSeedMutable(); + ::mlir::OpOperand &getAlphaMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTseed(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, ::mlir::Value seed, ::mlir::Value alpha); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, ::mlir::Value seed, ::mlir::Value alpha); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StatelessRandomGammaV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StatelessRandomGetAlgOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StatelessRandomGetAlgOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StatelessRandomGetAlgOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StatelessRandomGetAlgOpGenericAdaptorBase(StatelessRandomGetAlgOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class StatelessRandomGetAlgOpGenericAdaptor : public detail::StatelessRandomGetAlgOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StatelessRandomGetAlgOpGenericAdaptorBase; +public: + StatelessRandomGetAlgOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StatelessRandomGetAlgOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StatelessRandomGetAlgOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StatelessRandomGetAlgOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StatelessRandomGetAlgOpAdaptor : public StatelessRandomGetAlgOpGenericAdaptor<::mlir::ValueRange> { +public: + using StatelessRandomGetAlgOpGenericAdaptor::StatelessRandomGetAlgOpGenericAdaptor; + StatelessRandomGetAlgOpAdaptor(StatelessRandomGetAlgOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StatelessRandomGetAlgOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = StatelessRandomGetAlgOpAdaptor; + template + using GenericAdaptor = StatelessRandomGetAlgOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StatelessRandomGetAlg"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getAlg(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type alg); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StatelessRandomGetAlgOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StatelessRandomGetKeyCounterAlgOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StatelessRandomGetKeyCounterAlgOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StatelessRandomGetKeyCounterAlgOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StatelessRandomGetKeyCounterAlgOpGenericAdaptorBase(StatelessRandomGetKeyCounterAlgOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class StatelessRandomGetKeyCounterAlgOpGenericAdaptor : public detail::StatelessRandomGetKeyCounterAlgOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StatelessRandomGetKeyCounterAlgOpGenericAdaptorBase; +public: + StatelessRandomGetKeyCounterAlgOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StatelessRandomGetKeyCounterAlgOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StatelessRandomGetKeyCounterAlgOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StatelessRandomGetKeyCounterAlgOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSeed() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StatelessRandomGetKeyCounterAlgOpAdaptor : public StatelessRandomGetKeyCounterAlgOpGenericAdaptor<::mlir::ValueRange> { +public: + using StatelessRandomGetKeyCounterAlgOpGenericAdaptor::StatelessRandomGetKeyCounterAlgOpGenericAdaptor; + StatelessRandomGetKeyCounterAlgOpAdaptor(StatelessRandomGetKeyCounterAlgOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StatelessRandomGetKeyCounterAlgOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StatelessRandomGetKeyCounterAlgOpAdaptor; + template + using GenericAdaptor = StatelessRandomGetKeyCounterAlgOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tseed")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTseedAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTseedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StatelessRandomGetKeyCounterAlg"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSeed(); + ::mlir::OpOperand &getSeedMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getKey(); + ::mlir::TypedValue<::mlir::TensorType> getCounter(); + ::mlir::TypedValue<::mlir::TensorType> getAlg(); + ::mlir::Type getTseed(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type key, ::mlir::Type counter, ::mlir::Type alg, ::mlir::Value seed); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value seed); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StatelessRandomGetKeyCounterAlgOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StatelessRandomGetKeyCounterOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StatelessRandomGetKeyCounterOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StatelessRandomGetKeyCounterOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StatelessRandomGetKeyCounterOpGenericAdaptorBase(StatelessRandomGetKeyCounterOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class StatelessRandomGetKeyCounterOpGenericAdaptor : public detail::StatelessRandomGetKeyCounterOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StatelessRandomGetKeyCounterOpGenericAdaptorBase; +public: + StatelessRandomGetKeyCounterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StatelessRandomGetKeyCounterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StatelessRandomGetKeyCounterOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StatelessRandomGetKeyCounterOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSeed() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StatelessRandomGetKeyCounterOpAdaptor : public StatelessRandomGetKeyCounterOpGenericAdaptor<::mlir::ValueRange> { +public: + using StatelessRandomGetKeyCounterOpGenericAdaptor::StatelessRandomGetKeyCounterOpGenericAdaptor; + StatelessRandomGetKeyCounterOpAdaptor(StatelessRandomGetKeyCounterOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StatelessRandomGetKeyCounterOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StatelessRandomGetKeyCounterOpAdaptor; + template + using GenericAdaptor = StatelessRandomGetKeyCounterOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tseed")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTseedAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTseedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StatelessRandomGetKeyCounter"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSeed(); + ::mlir::OpOperand &getSeedMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getKey(); + ::mlir::TypedValue<::mlir::TensorType> getCounter(); + ::mlir::Type getTseed(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type key, ::mlir::Type counter, ::mlir::Value seed); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value seed); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StatelessRandomGetKeyCounterOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StatelessRandomNormalOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StatelessRandomNormalOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StatelessRandomNormalOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StatelessRandomNormalOpGenericAdaptorBase(StatelessRandomNormalOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class StatelessRandomNormalOpGenericAdaptor : public detail::StatelessRandomNormalOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StatelessRandomNormalOpGenericAdaptorBase; +public: + StatelessRandomNormalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StatelessRandomNormalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StatelessRandomNormalOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StatelessRandomNormalOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getShape() { + return (*getODSOperands(0).begin()); + } + + ValueT getSeed() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StatelessRandomNormalOpAdaptor : public StatelessRandomNormalOpGenericAdaptor<::mlir::ValueRange> { +public: + using StatelessRandomNormalOpGenericAdaptor::StatelessRandomNormalOpGenericAdaptor; + StatelessRandomNormalOpAdaptor(StatelessRandomNormalOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StatelessRandomNormalOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StatelessRandomNormalOpAdaptor; + template + using GenericAdaptor = StatelessRandomNormalOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tseed"), ::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTseedAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTseedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StatelessRandomNormal"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::TypedValue<::mlir::TensorType> getSeed(); + ::mlir::OpOperand &getShapeMutable(); + ::mlir::OpOperand &getSeedMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTseed(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, ::mlir::Value seed); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, ::mlir::Value seed); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StatelessRandomNormalOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StatelessRandomNormalV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StatelessRandomNormalV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StatelessRandomNormalV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StatelessRandomNormalV2OpGenericAdaptorBase(StatelessRandomNormalV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class StatelessRandomNormalV2OpGenericAdaptor : public detail::StatelessRandomNormalV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StatelessRandomNormalV2OpGenericAdaptorBase; +public: + StatelessRandomNormalV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StatelessRandomNormalV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StatelessRandomNormalV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StatelessRandomNormalV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getShape() { + return (*getODSOperands(0).begin()); + } + + ValueT getKey() { + return (*getODSOperands(1).begin()); + } + + ValueT getCounter() { + return (*getODSOperands(2).begin()); + } + + ValueT getAlg() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StatelessRandomNormalV2OpAdaptor : public StatelessRandomNormalV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using StatelessRandomNormalV2OpGenericAdaptor::StatelessRandomNormalV2OpGenericAdaptor; + StatelessRandomNormalV2OpAdaptor(StatelessRandomNormalV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StatelessRandomNormalV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StatelessRandomNormalV2OpAdaptor; + template + using GenericAdaptor = StatelessRandomNormalV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tshape"), ::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTshapeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTshapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StatelessRandomNormalV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::TypedValue<::mlir::TensorType> getKey(); + ::mlir::TypedValue<::mlir::TensorType> getCounter(); + ::mlir::TypedValue<::mlir::TensorType> getAlg(); + ::mlir::OpOperand &getShapeMutable(); + ::mlir::OpOperand &getKeyMutable(); + ::mlir::OpOperand &getCounterMutable(); + ::mlir::OpOperand &getAlgMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getTshape(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, ::mlir::Value key, ::mlir::Value counter, ::mlir::Value alg); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, ::mlir::Value key, ::mlir::Value counter, ::mlir::Value alg); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StatelessRandomNormalV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StatelessRandomPoissonOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StatelessRandomPoissonOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StatelessRandomPoissonOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StatelessRandomPoissonOpGenericAdaptorBase(StatelessRandomPoissonOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class StatelessRandomPoissonOpGenericAdaptor : public detail::StatelessRandomPoissonOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StatelessRandomPoissonOpGenericAdaptorBase; +public: + StatelessRandomPoissonOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StatelessRandomPoissonOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StatelessRandomPoissonOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StatelessRandomPoissonOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getShape() { + return (*getODSOperands(0).begin()); + } + + ValueT getSeed() { + return (*getODSOperands(1).begin()); + } + + ValueT getLam() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StatelessRandomPoissonOpAdaptor : public StatelessRandomPoissonOpGenericAdaptor<::mlir::ValueRange> { +public: + using StatelessRandomPoissonOpGenericAdaptor::StatelessRandomPoissonOpGenericAdaptor; + StatelessRandomPoissonOpAdaptor(StatelessRandomPoissonOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StatelessRandomPoissonOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StatelessRandomPoissonOpAdaptor; + template + using GenericAdaptor = StatelessRandomPoissonOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Rtype"), ::llvm::StringRef("T"), ::llvm::StringRef("Tseed"), ::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getRtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getRtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTseedAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTseedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StatelessRandomPoisson"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::TypedValue<::mlir::TensorType> getSeed(); + ::mlir::TypedValue<::mlir::TensorType> getLam(); + ::mlir::OpOperand &getShapeMutable(); + ::mlir::OpOperand &getSeedMutable(); + ::mlir::OpOperand &getLamMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getRtype(); + ::mlir::Type getT(); + ::mlir::Type getTseed(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, ::mlir::Value seed, ::mlir::Value lam); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, ::mlir::Value seed, ::mlir::Value lam); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StatelessRandomPoissonOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StatelessRandomUniformFullIntOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StatelessRandomUniformFullIntOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StatelessRandomUniformFullIntOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StatelessRandomUniformFullIntOpGenericAdaptorBase(StatelessRandomUniformFullIntOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class StatelessRandomUniformFullIntOpGenericAdaptor : public detail::StatelessRandomUniformFullIntOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StatelessRandomUniformFullIntOpGenericAdaptorBase; +public: + StatelessRandomUniformFullIntOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StatelessRandomUniformFullIntOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StatelessRandomUniformFullIntOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StatelessRandomUniformFullIntOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getShape() { + return (*getODSOperands(0).begin()); + } + + ValueT getSeed() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StatelessRandomUniformFullIntOpAdaptor : public StatelessRandomUniformFullIntOpGenericAdaptor<::mlir::ValueRange> { +public: + using StatelessRandomUniformFullIntOpGenericAdaptor::StatelessRandomUniformFullIntOpGenericAdaptor; + StatelessRandomUniformFullIntOpAdaptor(StatelessRandomUniformFullIntOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StatelessRandomUniformFullIntOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StatelessRandomUniformFullIntOpAdaptor; + template + using GenericAdaptor = StatelessRandomUniformFullIntOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tseed"), ::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTseedAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTseedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StatelessRandomUniformFullInt"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::TypedValue<::mlir::TensorType> getSeed(); + ::mlir::OpOperand &getShapeMutable(); + ::mlir::OpOperand &getSeedMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTseed(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, ::mlir::Value seed); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, ::mlir::Value seed); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StatelessRandomUniformFullIntOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StatelessRandomUniformFullIntV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StatelessRandomUniformFullIntV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StatelessRandomUniformFullIntV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StatelessRandomUniformFullIntV2OpGenericAdaptorBase(StatelessRandomUniformFullIntV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class StatelessRandomUniformFullIntV2OpGenericAdaptor : public detail::StatelessRandomUniformFullIntV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StatelessRandomUniformFullIntV2OpGenericAdaptorBase; +public: + StatelessRandomUniformFullIntV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StatelessRandomUniformFullIntV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StatelessRandomUniformFullIntV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StatelessRandomUniformFullIntV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getShape() { + return (*getODSOperands(0).begin()); + } + + ValueT getKey() { + return (*getODSOperands(1).begin()); + } + + ValueT getCounter() { + return (*getODSOperands(2).begin()); + } + + ValueT getAlg() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StatelessRandomUniformFullIntV2OpAdaptor : public StatelessRandomUniformFullIntV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using StatelessRandomUniformFullIntV2OpGenericAdaptor::StatelessRandomUniformFullIntV2OpGenericAdaptor; + StatelessRandomUniformFullIntV2OpAdaptor(StatelessRandomUniformFullIntV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StatelessRandomUniformFullIntV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StatelessRandomUniformFullIntV2OpAdaptor; + template + using GenericAdaptor = StatelessRandomUniformFullIntV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tshape"), ::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTshapeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTshapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StatelessRandomUniformFullIntV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::TypedValue<::mlir::TensorType> getKey(); + ::mlir::TypedValue<::mlir::TensorType> getCounter(); + ::mlir::TypedValue<::mlir::TensorType> getAlg(); + ::mlir::OpOperand &getShapeMutable(); + ::mlir::OpOperand &getKeyMutable(); + ::mlir::OpOperand &getCounterMutable(); + ::mlir::OpOperand &getAlgMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getTshape(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, ::mlir::Value key, ::mlir::Value counter, ::mlir::Value alg); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, ::mlir::Value key, ::mlir::Value counter, ::mlir::Value alg); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StatelessRandomUniformFullIntV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StatelessRandomUniformIntOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StatelessRandomUniformIntOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StatelessRandomUniformIntOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StatelessRandomUniformIntOpGenericAdaptorBase(StatelessRandomUniformIntOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class StatelessRandomUniformIntOpGenericAdaptor : public detail::StatelessRandomUniformIntOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StatelessRandomUniformIntOpGenericAdaptorBase; +public: + StatelessRandomUniformIntOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StatelessRandomUniformIntOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StatelessRandomUniformIntOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StatelessRandomUniformIntOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getShape() { + return (*getODSOperands(0).begin()); + } + + ValueT getSeed() { + return (*getODSOperands(1).begin()); + } + + ValueT getMinval() { + return (*getODSOperands(2).begin()); + } + + ValueT getMaxval() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StatelessRandomUniformIntOpAdaptor : public StatelessRandomUniformIntOpGenericAdaptor<::mlir::ValueRange> { +public: + using StatelessRandomUniformIntOpGenericAdaptor::StatelessRandomUniformIntOpGenericAdaptor; + StatelessRandomUniformIntOpAdaptor(StatelessRandomUniformIntOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StatelessRandomUniformIntOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StatelessRandomUniformIntOpAdaptor; + template + using GenericAdaptor = StatelessRandomUniformIntOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tseed"), ::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTseedAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTseedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StatelessRandomUniformInt"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::TypedValue<::mlir::TensorType> getSeed(); + ::mlir::TypedValue<::mlir::TensorType> getMinval(); + ::mlir::TypedValue<::mlir::TensorType> getMaxval(); + ::mlir::OpOperand &getShapeMutable(); + ::mlir::OpOperand &getSeedMutable(); + ::mlir::OpOperand &getMinvalMutable(); + ::mlir::OpOperand &getMaxvalMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTseed(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, ::mlir::Value seed, ::mlir::Value minval, ::mlir::Value maxval); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, ::mlir::Value seed, ::mlir::Value minval, ::mlir::Value maxval); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StatelessRandomUniformIntOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StatelessRandomUniformIntV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StatelessRandomUniformIntV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StatelessRandomUniformIntV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StatelessRandomUniformIntV2OpGenericAdaptorBase(StatelessRandomUniformIntV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class StatelessRandomUniformIntV2OpGenericAdaptor : public detail::StatelessRandomUniformIntV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StatelessRandomUniformIntV2OpGenericAdaptorBase; +public: + StatelessRandomUniformIntV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StatelessRandomUniformIntV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StatelessRandomUniformIntV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StatelessRandomUniformIntV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getShape() { + return (*getODSOperands(0).begin()); + } + + ValueT getKey() { + return (*getODSOperands(1).begin()); + } + + ValueT getCounter() { + return (*getODSOperands(2).begin()); + } + + ValueT getAlg() { + return (*getODSOperands(3).begin()); + } + + ValueT getMinval() { + return (*getODSOperands(4).begin()); + } + + ValueT getMaxval() { + return (*getODSOperands(5).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StatelessRandomUniformIntV2OpAdaptor : public StatelessRandomUniformIntV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using StatelessRandomUniformIntV2OpGenericAdaptor::StatelessRandomUniformIntV2OpGenericAdaptor; + StatelessRandomUniformIntV2OpAdaptor(StatelessRandomUniformIntV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StatelessRandomUniformIntV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<6>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StatelessRandomUniformIntV2OpAdaptor; + template + using GenericAdaptor = StatelessRandomUniformIntV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tshape"), ::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTshapeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTshapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StatelessRandomUniformIntV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::TypedValue<::mlir::TensorType> getKey(); + ::mlir::TypedValue<::mlir::TensorType> getCounter(); + ::mlir::TypedValue<::mlir::TensorType> getAlg(); + ::mlir::TypedValue<::mlir::TensorType> getMinval(); + ::mlir::TypedValue<::mlir::TensorType> getMaxval(); + ::mlir::OpOperand &getShapeMutable(); + ::mlir::OpOperand &getKeyMutable(); + ::mlir::OpOperand &getCounterMutable(); + ::mlir::OpOperand &getAlgMutable(); + ::mlir::OpOperand &getMinvalMutable(); + ::mlir::OpOperand &getMaxvalMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getTshape(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, ::mlir::Value key, ::mlir::Value counter, ::mlir::Value alg, ::mlir::Value minval, ::mlir::Value maxval); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, ::mlir::Value key, ::mlir::Value counter, ::mlir::Value alg, ::mlir::Value minval, ::mlir::Value maxval); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StatelessRandomUniformIntV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StatelessRandomUniformOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StatelessRandomUniformOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StatelessRandomUniformOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StatelessRandomUniformOpGenericAdaptorBase(StatelessRandomUniformOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class StatelessRandomUniformOpGenericAdaptor : public detail::StatelessRandomUniformOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StatelessRandomUniformOpGenericAdaptorBase; +public: + StatelessRandomUniformOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StatelessRandomUniformOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StatelessRandomUniformOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StatelessRandomUniformOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getShape() { + return (*getODSOperands(0).begin()); + } + + ValueT getSeed() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StatelessRandomUniformOpAdaptor : public StatelessRandomUniformOpGenericAdaptor<::mlir::ValueRange> { +public: + using StatelessRandomUniformOpGenericAdaptor::StatelessRandomUniformOpGenericAdaptor; + StatelessRandomUniformOpAdaptor(StatelessRandomUniformOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StatelessRandomUniformOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StatelessRandomUniformOpAdaptor; + template + using GenericAdaptor = StatelessRandomUniformOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tseed"), ::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTseedAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTseedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StatelessRandomUniform"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::TypedValue<::mlir::TensorType> getSeed(); + ::mlir::OpOperand &getShapeMutable(); + ::mlir::OpOperand &getSeedMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTseed(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, ::mlir::Value seed); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, ::mlir::Value seed); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StatelessRandomUniformOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StatelessRandomUniformV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StatelessRandomUniformV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StatelessRandomUniformV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StatelessRandomUniformV2OpGenericAdaptorBase(StatelessRandomUniformV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class StatelessRandomUniformV2OpGenericAdaptor : public detail::StatelessRandomUniformV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StatelessRandomUniformV2OpGenericAdaptorBase; +public: + StatelessRandomUniformV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StatelessRandomUniformV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StatelessRandomUniformV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StatelessRandomUniformV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getShape() { + return (*getODSOperands(0).begin()); + } + + ValueT getKey() { + return (*getODSOperands(1).begin()); + } + + ValueT getCounter() { + return (*getODSOperands(2).begin()); + } + + ValueT getAlg() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StatelessRandomUniformV2OpAdaptor : public StatelessRandomUniformV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using StatelessRandomUniformV2OpGenericAdaptor::StatelessRandomUniformV2OpGenericAdaptor; + StatelessRandomUniformV2OpAdaptor(StatelessRandomUniformV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StatelessRandomUniformV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StatelessRandomUniformV2OpAdaptor; + template + using GenericAdaptor = StatelessRandomUniformV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tshape"), ::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTshapeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTshapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StatelessRandomUniformV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::TypedValue<::mlir::TensorType> getKey(); + ::mlir::TypedValue<::mlir::TensorType> getCounter(); + ::mlir::TypedValue<::mlir::TensorType> getAlg(); + ::mlir::OpOperand &getShapeMutable(); + ::mlir::OpOperand &getKeyMutable(); + ::mlir::OpOperand &getCounterMutable(); + ::mlir::OpOperand &getAlgMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getTshape(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, ::mlir::Value key, ::mlir::Value counter, ::mlir::Value alg); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, ::mlir::Value key, ::mlir::Value counter, ::mlir::Value alg); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StatelessRandomUniformV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StatelessTruncatedNormalOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StatelessTruncatedNormalOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StatelessTruncatedNormalOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StatelessTruncatedNormalOpGenericAdaptorBase(StatelessTruncatedNormalOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class StatelessTruncatedNormalOpGenericAdaptor : public detail::StatelessTruncatedNormalOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StatelessTruncatedNormalOpGenericAdaptorBase; +public: + StatelessTruncatedNormalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StatelessTruncatedNormalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StatelessTruncatedNormalOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StatelessTruncatedNormalOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getShape() { + return (*getODSOperands(0).begin()); + } + + ValueT getSeed() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StatelessTruncatedNormalOpAdaptor : public StatelessTruncatedNormalOpGenericAdaptor<::mlir::ValueRange> { +public: + using StatelessTruncatedNormalOpGenericAdaptor::StatelessTruncatedNormalOpGenericAdaptor; + StatelessTruncatedNormalOpAdaptor(StatelessTruncatedNormalOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StatelessTruncatedNormalOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StatelessTruncatedNormalOpAdaptor; + template + using GenericAdaptor = StatelessTruncatedNormalOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tseed"), ::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTseedAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTseedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StatelessTruncatedNormal"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::TypedValue<::mlir::TensorType> getSeed(); + ::mlir::OpOperand &getShapeMutable(); + ::mlir::OpOperand &getSeedMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTseed(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, ::mlir::Value seed); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, ::mlir::Value seed); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StatelessTruncatedNormalOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StatelessTruncatedNormalV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StatelessTruncatedNormalV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StatelessTruncatedNormalV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StatelessTruncatedNormalV2OpGenericAdaptorBase(StatelessTruncatedNormalV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class StatelessTruncatedNormalV2OpGenericAdaptor : public detail::StatelessTruncatedNormalV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StatelessTruncatedNormalV2OpGenericAdaptorBase; +public: + StatelessTruncatedNormalV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StatelessTruncatedNormalV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StatelessTruncatedNormalV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StatelessTruncatedNormalV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getShape() { + return (*getODSOperands(0).begin()); + } + + ValueT getKey() { + return (*getODSOperands(1).begin()); + } + + ValueT getCounter() { + return (*getODSOperands(2).begin()); + } + + ValueT getAlg() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StatelessTruncatedNormalV2OpAdaptor : public StatelessTruncatedNormalV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using StatelessTruncatedNormalV2OpGenericAdaptor::StatelessTruncatedNormalV2OpGenericAdaptor; + StatelessTruncatedNormalV2OpAdaptor(StatelessTruncatedNormalV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StatelessTruncatedNormalV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StatelessTruncatedNormalV2OpAdaptor; + template + using GenericAdaptor = StatelessTruncatedNormalV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tshape"), ::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTshapeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTshapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StatelessTruncatedNormalV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::TypedValue<::mlir::TensorType> getKey(); + ::mlir::TypedValue<::mlir::TensorType> getCounter(); + ::mlir::TypedValue<::mlir::TensorType> getAlg(); + ::mlir::OpOperand &getShapeMutable(); + ::mlir::OpOperand &getKeyMutable(); + ::mlir::OpOperand &getCounterMutable(); + ::mlir::OpOperand &getAlgMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getTshape(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, ::mlir::Value key, ::mlir::Value counter, ::mlir::Value alg); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, ::mlir::Value key, ::mlir::Value counter, ::mlir::Value alg); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StatelessTruncatedNormalV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StaticRegexFullMatchOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StaticRegexFullMatchOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StaticRegexFullMatchOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StaticRegexFullMatchOpGenericAdaptorBase(StaticRegexFullMatchOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getPatternAttr(); + ::llvm::StringRef getPattern(); +}; +} // namespace detail +template +class StaticRegexFullMatchOpGenericAdaptor : public detail::StaticRegexFullMatchOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StaticRegexFullMatchOpGenericAdaptorBase; +public: + StaticRegexFullMatchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StaticRegexFullMatchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StaticRegexFullMatchOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StaticRegexFullMatchOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StaticRegexFullMatchOpAdaptor : public StaticRegexFullMatchOpGenericAdaptor<::mlir::ValueRange> { +public: + using StaticRegexFullMatchOpGenericAdaptor::StaticRegexFullMatchOpGenericAdaptor; + StaticRegexFullMatchOpAdaptor(StaticRegexFullMatchOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StaticRegexFullMatchOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape> { +public: + using Op::Op; + using Op::print; + using Adaptor = StaticRegexFullMatchOpAdaptor; + template + using GenericAdaptor = StaticRegexFullMatchOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("pattern")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getPatternAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getPatternAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StaticRegexFullMatch"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::StringAttr getPatternAttr(); + ::llvm::StringRef getPattern(); + void setPatternAttr(::mlir::StringAttr attr); + void setPattern(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::StringAttr pattern); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::StringAttr pattern); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::llvm::StringRef pattern); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::llvm::StringRef pattern); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StaticRegexFullMatchOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StopGradientOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StopGradientOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StopGradientOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StopGradientOpGenericAdaptorBase(StopGradientOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class StopGradientOpGenericAdaptor : public detail::StopGradientOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StopGradientOpGenericAdaptorBase; +public: + StopGradientOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StopGradientOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StopGradientOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StopGradientOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StopGradientOpAdaptor : public StopGradientOpGenericAdaptor<::mlir::ValueRange> { +public: + using StopGradientOpGenericAdaptor::StopGradientOpGenericAdaptor; + StopGradientOpAdaptor(StopGradientOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StopGradientOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StopGradientOpAdaptor; + template + using GenericAdaptor = StopGradientOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StopGradient"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StopGradientOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StoreMinibatchStatisticsInFdoOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StoreMinibatchStatisticsInFdoOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StoreMinibatchStatisticsInFdoOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StoreMinibatchStatisticsInFdoOpGenericAdaptorBase(StoreMinibatchStatisticsInFdoOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getSampleCountAttr(); + uint64_t getSampleCount(); + ::mlir::IntegerAttr getNumReplicaAttr(); + uint64_t getNumReplica(); + ::mlir::IntegerAttr getFeatureWidthAttr(); + uint64_t getFeatureWidth(); + ::mlir::IntegerAttr getNumScPerChipAttr(); + uint64_t getNumScPerChip(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::StringAttr getMiniBatchSplitsAttr(); + ::llvm::StringRef getMiniBatchSplits(); +}; +} // namespace detail +template +class StoreMinibatchStatisticsInFdoOpGenericAdaptor : public detail::StoreMinibatchStatisticsInFdoOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StoreMinibatchStatisticsInFdoOpGenericAdaptorBase; +public: + StoreMinibatchStatisticsInFdoOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StoreMinibatchStatisticsInFdoOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StoreMinibatchStatisticsInFdoOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StoreMinibatchStatisticsInFdoOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getProgramKey() { + return (*getODSOperands(0).begin()); + } + + ValueT getMaxIds() { + return (*getODSOperands(1).begin()); + } + + ValueT getMaxUniques() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StoreMinibatchStatisticsInFdoOpAdaptor : public StoreMinibatchStatisticsInFdoOpGenericAdaptor<::mlir::ValueRange> { +public: + using StoreMinibatchStatisticsInFdoOpGenericAdaptor::StoreMinibatchStatisticsInFdoOpGenericAdaptor; + StoreMinibatchStatisticsInFdoOpAdaptor(StoreMinibatchStatisticsInFdoOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StoreMinibatchStatisticsInFdoOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StoreMinibatchStatisticsInFdoOpAdaptor; + template + using GenericAdaptor = StoreMinibatchStatisticsInFdoOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("feature_width"), ::llvm::StringRef("mini_batch_splits"), ::llvm::StringRef("num_replica"), ::llvm::StringRef("num_sc_per_chip"), ::llvm::StringRef("sample_count"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFeatureWidthAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFeatureWidthAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getMiniBatchSplitsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getMiniBatchSplitsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getNumReplicaAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getNumReplicaAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getNumScPerChipAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getNumScPerChipAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getSampleCountAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getSampleCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StoreMinibatchStatisticsInFdo"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getProgramKey(); + ::mlir::TypedValue<::mlir::TensorType> getMaxIds(); + ::mlir::TypedValue<::mlir::TensorType> getMaxUniques(); + ::mlir::OpOperand &getProgramKeyMutable(); + ::mlir::OpOperand &getMaxIdsMutable(); + ::mlir::OpOperand &getMaxUniquesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getSampleCountAttr(); + uint64_t getSampleCount(); + ::mlir::IntegerAttr getNumReplicaAttr(); + uint64_t getNumReplica(); + ::mlir::IntegerAttr getFeatureWidthAttr(); + uint64_t getFeatureWidth(); + ::mlir::IntegerAttr getNumScPerChipAttr(); + uint64_t getNumScPerChip(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::StringAttr getMiniBatchSplitsAttr(); + ::llvm::StringRef getMiniBatchSplits(); + void setSampleCountAttr(::mlir::IntegerAttr attr); + void setSampleCount(uint64_t attrValue); + void setNumReplicaAttr(::mlir::IntegerAttr attr); + void setNumReplica(uint64_t attrValue); + void setFeatureWidthAttr(::mlir::IntegerAttr attr); + void setFeatureWidth(uint64_t attrValue); + void setNumScPerChipAttr(::mlir::IntegerAttr attr); + void setNumScPerChip(uint64_t attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::llvm::StringRef attrValue); + void setMiniBatchSplitsAttr(::mlir::StringAttr attr); + void setMiniBatchSplits(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value program_key, ::mlir::Value max_ids, ::mlir::Value max_uniques, ::mlir::IntegerAttr sample_count, ::mlir::IntegerAttr num_replica, ::mlir::IntegerAttr feature_width, ::mlir::IntegerAttr num_sc_per_chip, ::mlir::StringAttr table_name, ::mlir::StringAttr mini_batch_splits); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value program_key, ::mlir::Value max_ids, ::mlir::Value max_uniques, ::mlir::IntegerAttr sample_count, ::mlir::IntegerAttr num_replica, ::mlir::IntegerAttr feature_width, ::mlir::IntegerAttr num_sc_per_chip, ::mlir::StringAttr table_name, ::mlir::StringAttr mini_batch_splits); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value program_key, ::mlir::Value max_ids, ::mlir::Value max_uniques, uint64_t sample_count, uint64_t num_replica, uint64_t feature_width, uint64_t num_sc_per_chip, ::llvm::StringRef table_name, ::llvm::StringRef mini_batch_splits); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value program_key, ::mlir::Value max_ids, ::mlir::Value max_uniques, uint64_t sample_count, uint64_t num_replica, uint64_t feature_width, uint64_t num_sc_per_chip, ::llvm::StringRef table_name, ::llvm::StringRef mini_batch_splits); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StoreMinibatchStatisticsInFdoOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StridedSliceGradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StridedSliceGradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StridedSliceGradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StridedSliceGradOpGenericAdaptorBase(StridedSliceGradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getBeginMaskAttr(); + uint64_t getBeginMask(); + ::mlir::IntegerAttr getEndMaskAttr(); + uint64_t getEndMask(); + ::mlir::IntegerAttr getEllipsisMaskAttr(); + uint64_t getEllipsisMask(); + ::mlir::IntegerAttr getNewAxisMaskAttr(); + uint64_t getNewAxisMask(); + ::mlir::IntegerAttr getShrinkAxisMaskAttr(); + uint64_t getShrinkAxisMask(); +}; +} // namespace detail +template +class StridedSliceGradOpGenericAdaptor : public detail::StridedSliceGradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StridedSliceGradOpGenericAdaptorBase; +public: + StridedSliceGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StridedSliceGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StridedSliceGradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StridedSliceGradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getShape() { + return (*getODSOperands(0).begin()); + } + + ValueT getBegin() { + return (*getODSOperands(1).begin()); + } + + ValueT getEnd() { + return (*getODSOperands(2).begin()); + } + + ValueT getStrides() { + return (*getODSOperands(3).begin()); + } + + ValueT getDy() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StridedSliceGradOpAdaptor : public StridedSliceGradOpGenericAdaptor<::mlir::ValueRange> { +public: + using StridedSliceGradOpGenericAdaptor::StridedSliceGradOpGenericAdaptor; + StridedSliceGradOpAdaptor(StridedSliceGradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StridedSliceGradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<5>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StridedSliceGradOpAdaptor; + template + using GenericAdaptor = StridedSliceGradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Index"), ::llvm::StringRef("T"), ::llvm::StringRef("begin_mask"), ::llvm::StringRef("ellipsis_mask"), ::llvm::StringRef("end_mask"), ::llvm::StringRef("new_axis_mask"), ::llvm::StringRef("shrink_axis_mask")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getIndexAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getIndexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getBeginMaskAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getBeginMaskAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getEllipsisMaskAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getEllipsisMaskAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getEndMaskAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getEndMaskAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getNewAxisMaskAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getNewAxisMaskAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getShrinkAxisMaskAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getShrinkAxisMaskAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StridedSliceGrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::TypedValue<::mlir::TensorType> getBegin(); + ::mlir::TypedValue<::mlir::TensorType> getEnd(); + ::mlir::TypedValue<::mlir::TensorType> getStrides(); + ::mlir::TypedValue<::mlir::TensorType> getDy(); + ::mlir::OpOperand &getShapeMutable(); + ::mlir::OpOperand &getBeginMutable(); + ::mlir::OpOperand &getEndMutable(); + ::mlir::OpOperand &getStridesMutable(); + ::mlir::OpOperand &getDyMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getBeginMaskAttr(); + uint64_t getBeginMask(); + ::mlir::IntegerAttr getEndMaskAttr(); + uint64_t getEndMask(); + ::mlir::IntegerAttr getEllipsisMaskAttr(); + uint64_t getEllipsisMask(); + ::mlir::IntegerAttr getNewAxisMaskAttr(); + uint64_t getNewAxisMask(); + ::mlir::IntegerAttr getShrinkAxisMaskAttr(); + uint64_t getShrinkAxisMask(); + ::mlir::Type getIndex(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setBeginMaskAttr(::mlir::IntegerAttr attr); + void setBeginMask(::std::optional attrValue); + void setEndMaskAttr(::mlir::IntegerAttr attr); + void setEndMask(::std::optional attrValue); + void setEllipsisMaskAttr(::mlir::IntegerAttr attr); + void setEllipsisMask(::std::optional attrValue); + void setNewAxisMaskAttr(::mlir::IntegerAttr attr); + void setNewAxisMask(::std::optional attrValue); + void setShrinkAxisMaskAttr(::mlir::IntegerAttr attr); + void setShrinkAxisMask(::std::optional attrValue); + ::mlir::Attribute removeBeginMaskAttr(); + ::mlir::Attribute removeEndMaskAttr(); + ::mlir::Attribute removeEllipsisMaskAttr(); + ::mlir::Attribute removeNewAxisMaskAttr(); + ::mlir::Attribute removeShrinkAxisMaskAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, ::mlir::Value begin, ::mlir::Value end, ::mlir::Value strides, ::mlir::Value dy, /*optional*/::mlir::IntegerAttr begin_mask, /*optional*/::mlir::IntegerAttr end_mask, /*optional*/::mlir::IntegerAttr ellipsis_mask, /*optional*/::mlir::IntegerAttr new_axis_mask, /*optional*/::mlir::IntegerAttr shrink_axis_mask); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, ::mlir::Value begin, ::mlir::Value end, ::mlir::Value strides, ::mlir::Value dy, /*optional*/::mlir::IntegerAttr begin_mask, /*optional*/::mlir::IntegerAttr end_mask, /*optional*/::mlir::IntegerAttr ellipsis_mask, /*optional*/::mlir::IntegerAttr new_axis_mask, /*optional*/::mlir::IntegerAttr shrink_axis_mask); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, ::mlir::Value begin, ::mlir::Value end, ::mlir::Value strides, ::mlir::Value dy, /*optional*/uint64_t begin_mask = 0, /*optional*/uint64_t end_mask = 0, /*optional*/uint64_t ellipsis_mask = 0, /*optional*/uint64_t new_axis_mask = 0, /*optional*/uint64_t shrink_axis_mask = 0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, ::mlir::Value begin, ::mlir::Value end, ::mlir::Value strides, ::mlir::Value dy, /*optional*/uint64_t begin_mask = 0, /*optional*/uint64_t end_mask = 0, /*optional*/uint64_t ellipsis_mask = 0, /*optional*/uint64_t new_axis_mask = 0, /*optional*/uint64_t shrink_axis_mask = 0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 7 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // If sliced shape is able to be deduced, returns true, updates `shape` + // with the final shape after performing StridedSlice, and updates + // `begin_indices`, `end_indices`, and `strides` with their canonical + // values, respectively. + bool GetSlicedShapeAndBoundRanges( + ::llvm::SmallVectorImpl *input_shape, + ::llvm::SmallVectorImpl *slice_begin, + ::llvm::SmallVectorImpl *slice_end, + ::llvm::SmallVectorImpl *slice_stride); +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StridedSliceGradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StridedSliceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StridedSliceOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StridedSliceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StridedSliceOpGenericAdaptorBase(StridedSliceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getBeginMaskAttr(); + uint64_t getBeginMask(); + ::mlir::IntegerAttr getEndMaskAttr(); + uint64_t getEndMask(); + ::mlir::IntegerAttr getEllipsisMaskAttr(); + uint64_t getEllipsisMask(); + ::mlir::IntegerAttr getNewAxisMaskAttr(); + uint64_t getNewAxisMask(); + ::mlir::IntegerAttr getShrinkAxisMaskAttr(); + uint64_t getShrinkAxisMask(); +}; +} // namespace detail +template +class StridedSliceOpGenericAdaptor : public detail::StridedSliceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StridedSliceOpGenericAdaptorBase; +public: + StridedSliceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StridedSliceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StridedSliceOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StridedSliceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getBegin() { + return (*getODSOperands(1).begin()); + } + + ValueT getEnd() { + return (*getODSOperands(2).begin()); + } + + ValueT getStrides() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StridedSliceOpAdaptor : public StridedSliceOpGenericAdaptor<::mlir::ValueRange> { +public: + using StridedSliceOpGenericAdaptor::StridedSliceOpGenericAdaptor; + StridedSliceOpAdaptor(StridedSliceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StridedSliceOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StridedSliceOpAdaptor; + template + using GenericAdaptor = StridedSliceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Index"), ::llvm::StringRef("T"), ::llvm::StringRef("begin_mask"), ::llvm::StringRef("ellipsis_mask"), ::llvm::StringRef("end_mask"), ::llvm::StringRef("new_axis_mask"), ::llvm::StringRef("shrink_axis_mask")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getIndexAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getIndexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getBeginMaskAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getBeginMaskAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getEllipsisMaskAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getEllipsisMaskAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getEndMaskAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getEndMaskAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getNewAxisMaskAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getNewAxisMaskAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getShrinkAxisMaskAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getShrinkAxisMaskAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StridedSlice"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getBegin(); + ::mlir::TypedValue<::mlir::TensorType> getEnd(); + ::mlir::TypedValue<::mlir::TensorType> getStrides(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getBeginMutable(); + ::mlir::OpOperand &getEndMutable(); + ::mlir::OpOperand &getStridesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getBeginMaskAttr(); + uint64_t getBeginMask(); + ::mlir::IntegerAttr getEndMaskAttr(); + uint64_t getEndMask(); + ::mlir::IntegerAttr getEllipsisMaskAttr(); + uint64_t getEllipsisMask(); + ::mlir::IntegerAttr getNewAxisMaskAttr(); + uint64_t getNewAxisMask(); + ::mlir::IntegerAttr getShrinkAxisMaskAttr(); + uint64_t getShrinkAxisMask(); + ::mlir::Type getIndex(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setBeginMaskAttr(::mlir::IntegerAttr attr); + void setBeginMask(::std::optional attrValue); + void setEndMaskAttr(::mlir::IntegerAttr attr); + void setEndMask(::std::optional attrValue); + void setEllipsisMaskAttr(::mlir::IntegerAttr attr); + void setEllipsisMask(::std::optional attrValue); + void setNewAxisMaskAttr(::mlir::IntegerAttr attr); + void setNewAxisMask(::std::optional attrValue); + void setShrinkAxisMaskAttr(::mlir::IntegerAttr attr); + void setShrinkAxisMask(::std::optional attrValue); + ::mlir::Attribute removeBeginMaskAttr(); + ::mlir::Attribute removeEndMaskAttr(); + ::mlir::Attribute removeEllipsisMaskAttr(); + ::mlir::Attribute removeNewAxisMaskAttr(); + ::mlir::Attribute removeShrinkAxisMaskAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value begin, ::mlir::Value end, ::mlir::Value strides, /*optional*/::mlir::IntegerAttr begin_mask, /*optional*/::mlir::IntegerAttr end_mask, /*optional*/::mlir::IntegerAttr ellipsis_mask, /*optional*/::mlir::IntegerAttr new_axis_mask, /*optional*/::mlir::IntegerAttr shrink_axis_mask); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value begin, ::mlir::Value end, ::mlir::Value strides, /*optional*/::mlir::IntegerAttr begin_mask, /*optional*/::mlir::IntegerAttr end_mask, /*optional*/::mlir::IntegerAttr ellipsis_mask, /*optional*/::mlir::IntegerAttr new_axis_mask, /*optional*/::mlir::IntegerAttr shrink_axis_mask); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value begin, ::mlir::Value end, ::mlir::Value strides, /*optional*/uint64_t begin_mask = 0, /*optional*/uint64_t end_mask = 0, /*optional*/uint64_t ellipsis_mask = 0, /*optional*/uint64_t new_axis_mask = 0, /*optional*/uint64_t shrink_axis_mask = 0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value begin, ::mlir::Value end, ::mlir::Value strides, /*optional*/uint64_t begin_mask = 0, /*optional*/uint64_t end_mask = 0, /*optional*/uint64_t ellipsis_mask = 0, /*optional*/uint64_t new_axis_mask = 0, /*optional*/uint64_t shrink_axis_mask = 0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 7 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // If sliced shape is able to be deduced, returns true, updates + // `begin_indices`, `end_indices`, and `strides` with their canonical + // values, respectively. + bool GetSlicedBoundRanges( + ::llvm::SmallVectorImpl *slice_begin, + ::llvm::SmallVectorImpl *slice_end, + ::llvm::SmallVectorImpl *slice_stride); +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StridedSliceOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StringFormatOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StringFormatOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StringFormatOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StringFormatOpGenericAdaptorBase(StringFormatOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getStrtemplateAttr(); + ::llvm::StringRef getStrtemplate(); + ::mlir::StringAttr getPlaceholderAttr(); + ::llvm::StringRef getPlaceholder(); + ::mlir::IntegerAttr getSummarizeAttr(); + uint64_t getSummarize(); +}; +} // namespace detail +template +class StringFormatOpGenericAdaptor : public detail::StringFormatOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StringFormatOpGenericAdaptorBase; +public: + StringFormatOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StringFormatOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StringFormatOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StringFormatOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StringFormatOpAdaptor : public StringFormatOpGenericAdaptor<::mlir::ValueRange> { +public: + using StringFormatOpGenericAdaptor::StringFormatOpGenericAdaptor; + StringFormatOpAdaptor(StringFormatOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StringFormatOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StringFormatOpAdaptor; + template + using GenericAdaptor = StringFormatOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("placeholder"), ::llvm::StringRef("strtemplate"), ::llvm::StringRef("summarize")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getPlaceholderAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getPlaceholderAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getStrtemplateAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getStrtemplateAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSummarizeAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSummarizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StringFormat"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::MutableOperandRange getInputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::StringAttr getStrtemplateAttr(); + ::llvm::StringRef getStrtemplate(); + ::mlir::StringAttr getPlaceholderAttr(); + ::llvm::StringRef getPlaceholder(); + ::mlir::IntegerAttr getSummarizeAttr(); + uint64_t getSummarize(); + mlir::OperandElementTypeRange getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setStrtemplateAttr(::mlir::StringAttr attr); + void setStrtemplate(::llvm::StringRef attrValue); + void setPlaceholderAttr(::mlir::StringAttr attr); + void setPlaceholder(::llvm::StringRef attrValue); + void setSummarizeAttr(::mlir::IntegerAttr attr); + void setSummarize(::std::optional attrValue); + ::mlir::Attribute removeSummarizeAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::ValueRange inputs, ::mlir::StringAttr strtemplate, ::mlir::StringAttr placeholder, /*optional*/::mlir::IntegerAttr summarize); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::mlir::StringAttr strtemplate, ::mlir::StringAttr placeholder, /*optional*/::mlir::IntegerAttr summarize); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::ValueRange inputs, ::llvm::StringRef strtemplate = "%s", ::llvm::StringRef placeholder = "%s", /*optional*/uint64_t summarize = 3); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::llvm::StringRef strtemplate = "%s", ::llvm::StringRef placeholder = "%s", /*optional*/uint64_t summarize = 3); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultAttrs(const ::mlir::OperationName &opName, ::mlir::NamedAttrList &attributes); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StringFormatOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StringJoinOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StringJoinOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StringJoinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StringJoinOpGenericAdaptorBase(StringJoinOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getSeparatorAttr(); + ::llvm::StringRef getSeparator(); +}; +} // namespace detail +template +class StringJoinOpGenericAdaptor : public detail::StringJoinOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StringJoinOpGenericAdaptorBase; +public: + StringJoinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StringJoinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StringJoinOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StringJoinOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StringJoinOpAdaptor : public StringJoinOpGenericAdaptor<::mlir::ValueRange> { +public: + using StringJoinOpGenericAdaptor::StringJoinOpGenericAdaptor; + StringJoinOpAdaptor(StringJoinOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StringJoinOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StringJoinOpAdaptor; + template + using GenericAdaptor = StringJoinOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("N"), ::llvm::StringRef("separator")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getSeparatorAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getSeparatorAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StringJoin"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::MutableOperandRange getInputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::StringAttr getSeparatorAttr(); + ::llvm::StringRef getSeparator(); + size_t getN(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setSeparatorAttr(::mlir::StringAttr attr); + void setSeparator(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeSeparatorAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::ValueRange inputs, /*optional*/::mlir::StringAttr separator); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, /*optional*/::mlir::StringAttr separator); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::ValueRange inputs, /*optional*/::llvm::StringRef separator = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, /*optional*/::llvm::StringRef separator = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StringJoinOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StringStripOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StringStripOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StringStripOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StringStripOpGenericAdaptorBase(StringStripOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class StringStripOpGenericAdaptor : public detail::StringStripOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StringStripOpGenericAdaptorBase; +public: + StringStripOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StringStripOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StringStripOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StringStripOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StringStripOpAdaptor : public StringStripOpGenericAdaptor<::mlir::ValueRange> { +public: + using StringStripOpGenericAdaptor::StringStripOpGenericAdaptor; + StringStripOpAdaptor(StringStripOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StringStripOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef> { +public: + using Op::Op; + using Op::print; + using Adaptor = StringStripOpAdaptor; + template + using GenericAdaptor = StringStripOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StringStrip"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StringStripOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StringToHashBucketFastOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StringToHashBucketFastOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StringToHashBucketFastOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StringToHashBucketFastOpGenericAdaptorBase(StringToHashBucketFastOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getNumBucketsAttr(); + uint64_t getNumBuckets(); +}; +} // namespace detail +template +class StringToHashBucketFastOpGenericAdaptor : public detail::StringToHashBucketFastOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StringToHashBucketFastOpGenericAdaptorBase; +public: + StringToHashBucketFastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StringToHashBucketFastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StringToHashBucketFastOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StringToHashBucketFastOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StringToHashBucketFastOpAdaptor : public StringToHashBucketFastOpGenericAdaptor<::mlir::ValueRange> { +public: + using StringToHashBucketFastOpGenericAdaptor::StringToHashBucketFastOpGenericAdaptor; + StringToHashBucketFastOpAdaptor(StringToHashBucketFastOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StringToHashBucketFastOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StringToHashBucketFastOpAdaptor; + template + using GenericAdaptor = StringToHashBucketFastOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("num_buckets")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNumBucketsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNumBucketsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StringToHashBucketFast"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getNumBucketsAttr(); + uint64_t getNumBuckets(); + void setNumBucketsAttr(::mlir::IntegerAttr attr); + void setNumBuckets(uint64_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::IntegerAttr num_buckets); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::IntegerAttr num_buckets); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, uint64_t num_buckets); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, uint64_t num_buckets); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StringToHashBucketFastOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SubOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SubOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SubOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SubOpGenericAdaptorBase(SubOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SubOpGenericAdaptor : public detail::SubOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SubOpGenericAdaptorBase; +public: + SubOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SubOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SubOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SubOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SubOpAdaptor : public SubOpGenericAdaptor<::mlir::ValueRange> { +public: + using SubOpGenericAdaptor::SubOpGenericAdaptor; + SubOpAdaptor(SubOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SubOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::OpTrait::TF::CwiseBinary, ::mlir::OpTrait::TF::SameOperandsAndResultElementTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SubOpAdaptor; + template + using GenericAdaptor = SubOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Sub"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SubOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SumOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SumOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SumOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SumOpGenericAdaptorBase(SumOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getKeepDimsAttr(); + bool getKeepDims(); +}; +} // namespace detail +template +class SumOpGenericAdaptor : public detail::SumOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SumOpGenericAdaptorBase; +public: + SumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SumOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SumOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getReductionIndices() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SumOpAdaptor : public SumOpGenericAdaptor<::mlir::ValueRange> { +public: + using SumOpGenericAdaptor::SumOpGenericAdaptor; + SumOpAdaptor(SumOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SumOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SumOpAdaptor; + template + using GenericAdaptor = SumOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tidx"), ::llvm::StringRef("keep_dims")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTidxAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTidxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getKeepDimsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getKeepDimsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Sum"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getReductionIndices(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getReductionIndicesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getKeepDimsAttr(); + bool getKeepDims(); + ::mlir::Type getT(); + ::mlir::Type getTidx(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setKeepDimsAttr(::mlir::BoolAttr attr); + void setKeepDims(::std::optional attrValue); + ::mlir::Attribute removeKeepDimsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value input, Value reduction_indices, BoolAttr keep_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value reduction_indices, /*optional*/::mlir::BoolAttr keep_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value reduction_indices, /*optional*/::mlir::BoolAttr keep_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value reduction_indices, /*optional*/bool keep_dims = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value reduction_indices, /*optional*/bool keep_dims = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SumOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SummaryWriterOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SummaryWriterOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SummaryWriterOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SummaryWriterOpGenericAdaptorBase(SummaryWriterOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getSharedNameAttr(); + ::llvm::StringRef getSharedName(); + ::mlir::StringAttr getContainerAttr(); + ::llvm::StringRef getContainer(); +}; +} // namespace detail +template +class SummaryWriterOpGenericAdaptor : public detail::SummaryWriterOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SummaryWriterOpGenericAdaptorBase; +public: + SummaryWriterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SummaryWriterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SummaryWriterOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SummaryWriterOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SummaryWriterOpAdaptor : public SummaryWriterOpGenericAdaptor<::mlir::ValueRange> { +public: + using SummaryWriterOpGenericAdaptor::SummaryWriterOpGenericAdaptor; + SummaryWriterOpAdaptor(SummaryWriterOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SummaryWriterOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ResourceHandleAllocatorInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SummaryWriterOpAdaptor; + template + using GenericAdaptor = SummaryWriterOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("container"), ::llvm::StringRef("shared_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getContainerAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getContainerAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getSharedNameAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getSharedNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SummaryWriter"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getWriter(); + ::mlir::StringAttr getSharedNameAttr(); + ::llvm::StringRef getSharedName(); + ::mlir::StringAttr getContainerAttr(); + ::llvm::StringRef getContainer(); + void setSharedNameAttr(::mlir::StringAttr attr); + void setSharedName(::llvm::StringRef attrValue); + void setContainerAttr(::mlir::StringAttr attr); + void setContainer(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type writer, ::mlir::StringAttr shared_name, ::mlir::StringAttr container); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr shared_name, ::mlir::StringAttr container); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type writer, ::llvm::StringRef shared_name, ::llvm::StringRef container); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef shared_name, ::llvm::StringRef container); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + llvm::SmallVector GetResourceHandleValueAndIdList(llvm::SmallDenseMap&resource_handle_id_map, int64_t&next_id); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SummaryWriterOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SvdOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SvdOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SvdOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SvdOpGenericAdaptorBase(SvdOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getComputeUvAttr(); + bool getComputeUv(); + ::mlir::BoolAttr getFullMatricesAttr(); + bool getFullMatrices(); +}; +} // namespace detail +template +class SvdOpGenericAdaptor : public detail::SvdOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SvdOpGenericAdaptorBase; +public: + SvdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SvdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SvdOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SvdOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SvdOpAdaptor : public SvdOpGenericAdaptor<::mlir::ValueRange> { +public: + using SvdOpGenericAdaptor::SvdOpGenericAdaptor; + SvdOpAdaptor(SvdOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SvdOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SvdOpAdaptor; + template + using GenericAdaptor = SvdOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("compute_uv"), ::llvm::StringRef("full_matrices")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getComputeUvAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getComputeUvAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getFullMatricesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getFullMatricesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Svd"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getS(); + ::mlir::TypedValue<::mlir::TensorType> getU(); + ::mlir::TypedValue<::mlir::TensorType> getV(); + ::mlir::BoolAttr getComputeUvAttr(); + bool getComputeUv(); + ::mlir::BoolAttr getFullMatricesAttr(); + bool getFullMatrices(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setComputeUvAttr(::mlir::BoolAttr attr); + void setComputeUv(::std::optional attrValue); + void setFullMatricesAttr(::mlir::BoolAttr attr); + void setFullMatrices(::std::optional attrValue); + ::mlir::Attribute removeComputeUvAttr(); + ::mlir::Attribute removeFullMatricesAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type s, ::mlir::Type u, ::mlir::Type v, ::mlir::Value input, /*optional*/::mlir::BoolAttr compute_uv, /*optional*/::mlir::BoolAttr full_matrices); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, /*optional*/::mlir::BoolAttr compute_uv, /*optional*/::mlir::BoolAttr full_matrices); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type s, ::mlir::Type u, ::mlir::Type v, ::mlir::Value input, /*optional*/bool compute_uv = true, /*optional*/bool full_matrices = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, /*optional*/bool compute_uv = true, /*optional*/bool full_matrices = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SvdOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SymbolicGradientOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SymbolicGradientOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SymbolicGradientOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SymbolicGradientOpGenericAdaptorBase(SymbolicGradientOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::SymbolRefAttr getFAttr(); + ::mlir::SymbolRefAttr getF(); +}; +} // namespace detail +template +class SymbolicGradientOpGenericAdaptor : public detail::SymbolicGradientOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SymbolicGradientOpGenericAdaptorBase; +public: + SymbolicGradientOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SymbolicGradientOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SymbolicGradientOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SymbolicGradientOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInput() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SymbolicGradientOpAdaptor : public SymbolicGradientOpGenericAdaptor<::mlir::ValueRange> { +public: + using SymbolicGradientOpGenericAdaptor::SymbolicGradientOpGenericAdaptor; + SymbolicGradientOpAdaptor(SymbolicGradientOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SymbolicGradientOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = SymbolicGradientOpAdaptor; + template + using GenericAdaptor = SymbolicGradientOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tin"), ::llvm::StringRef("Tout"), ::llvm::StringRef("f")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTinAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTinAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getToutAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getToutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getFAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getFAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SymbolicGradient"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInput(); + ::mlir::MutableOperandRange getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutput(); + ::mlir::SymbolRefAttr getFAttr(); + ::mlir::SymbolRefAttr getF(); + mlir::OperandElementTypeRange getTin(); + mlir::ResultElementTypeRange getTout(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setFAttr(::mlir::SymbolRefAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::ValueRange input, ::mlir::SymbolRefAttr f); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SymbolicGradientOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TPUAnnotateTensorsWithDynamicShapeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TPUAnnotateTensorsWithDynamicShapeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TPUAnnotateTensorsWithDynamicShapeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TPUAnnotateTensorsWithDynamicShapeOpGenericAdaptorBase(TPUAnnotateTensorsWithDynamicShapeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TPUAnnotateTensorsWithDynamicShapeOpGenericAdaptor : public detail::TPUAnnotateTensorsWithDynamicShapeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TPUAnnotateTensorsWithDynamicShapeOpGenericAdaptorBase; +public: + TPUAnnotateTensorsWithDynamicShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TPUAnnotateTensorsWithDynamicShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TPUAnnotateTensorsWithDynamicShapeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TPUAnnotateTensorsWithDynamicShapeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getTensors() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TPUAnnotateTensorsWithDynamicShapeOpAdaptor : public TPUAnnotateTensorsWithDynamicShapeOpGenericAdaptor<::mlir::ValueRange> { +public: + using TPUAnnotateTensorsWithDynamicShapeOpGenericAdaptor::TPUAnnotateTensorsWithDynamicShapeOpGenericAdaptor; + TPUAnnotateTensorsWithDynamicShapeOpAdaptor(TPUAnnotateTensorsWithDynamicShapeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TPUAnnotateTensorsWithDynamicShapeOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = TPUAnnotateTensorsWithDynamicShapeOpAdaptor; + template + using GenericAdaptor = TPUAnnotateTensorsWithDynamicShapeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TPUAnnotateTensorsWithDynamicShape"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getTensors(); + ::mlir::MutableOperandRange getTensorsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getTpuTensors(); + mlir::OperandElementTypeRange getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TPUAnnotateTensorsWithDynamicShapeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TPUCompilationResultOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TPUCompilationResultOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TPUCompilationResultOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TPUCompilationResultOpGenericAdaptorBase(TPUCompilationResultOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TPUCompilationResultOpGenericAdaptor : public detail::TPUCompilationResultOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TPUCompilationResultOpGenericAdaptorBase; +public: + TPUCompilationResultOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TPUCompilationResultOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TPUCompilationResultOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TPUCompilationResultOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TPUCompilationResultOpAdaptor : public TPUCompilationResultOpGenericAdaptor<::mlir::ValueRange> { +public: + using TPUCompilationResultOpGenericAdaptor::TPUCompilationResultOpGenericAdaptor; + TPUCompilationResultOpAdaptor(TPUCompilationResultOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TPUCompilationResultOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TPUCompilationResultOpAdaptor; + template + using GenericAdaptor = TPUCompilationResultOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TPUCompilationResult"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TPUCompilationResultOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TPUCompileMlirAndExecuteOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TPUCompileMlirAndExecuteOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TPUCompileMlirAndExecuteOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TPUCompileMlirAndExecuteOpGenericAdaptorBase(TPUCompileMlirAndExecuteOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getOperandsWithStaticShapeAttr(); + ::std::optional< ::mlir::ArrayAttr > getOperandsWithStaticShape(); + ::mlir::StringAttr getMlirModuleAttr(); + ::llvm::StringRef getMlirModule(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); + ::mlir::StringAttr getProducerNameAttr(); + ::llvm::StringRef getProducerName(); +}; +} // namespace detail +template +class TPUCompileMlirAndExecuteOpGenericAdaptor : public detail::TPUCompileMlirAndExecuteOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TPUCompileMlirAndExecuteOpGenericAdaptorBase; +public: + TPUCompileMlirAndExecuteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TPUCompileMlirAndExecuteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TPUCompileMlirAndExecuteOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TPUCompileMlirAndExecuteOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getStaticShapes() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TPUCompileMlirAndExecuteOpAdaptor : public TPUCompileMlirAndExecuteOpGenericAdaptor<::mlir::ValueRange> { +public: + using TPUCompileMlirAndExecuteOpGenericAdaptor::TPUCompileMlirAndExecuteOpGenericAdaptor; + TPUCompileMlirAndExecuteOpAdaptor(TPUCompileMlirAndExecuteOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TPUCompileMlirAndExecuteOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TPUCompileMlirAndExecuteOpAdaptor; + template + using GenericAdaptor = TPUCompileMlirAndExecuteOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Targs"), ::llvm::StringRef("Tresults"), ::llvm::StringRef("metadata"), ::llvm::StringRef("mlir_module"), ::llvm::StringRef("operandSegmentSizes"), ::llvm::StringRef("operands_with_static_shape"), ::llvm::StringRef("producer_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTargsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTargsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTresultsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTresultsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getMetadataAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getMetadataAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getMlirModuleAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getMlirModuleAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getOperandsWithStaticShapeAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getOperandsWithStaticShapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getProducerNameAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getProducerNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TPUCompileMlirAndExecute"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::Operation::operand_range getStaticShapes(); + ::mlir::MutableOperandRange getArgsMutable(); + ::mlir::MutableOperandRange getStaticShapesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getRendezvousKeyBase(); + ::mlir::Operation::result_range getResults(); + ::mlir::ArrayAttr getOperandsWithStaticShapeAttr(); + ::std::optional< ::mlir::ArrayAttr > getOperandsWithStaticShape(); + ::mlir::StringAttr getMlirModuleAttr(); + ::llvm::StringRef getMlirModule(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); + ::mlir::StringAttr getProducerNameAttr(); + ::llvm::StringRef getProducerName(); + mlir::OperandElementTypeRange getTargs(); + mlir::ResultElementTypeRange getTresults(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setOperandsWithStaticShapeAttr(::mlir::ArrayAttr attr); + void setMlirModuleAttr(::mlir::StringAttr attr); + void setMlirModule(::llvm::StringRef attrValue); + void setMetadataAttr(::mlir::StringAttr attr); + void setMetadata(::llvm::StringRef attrValue); + void setProducerNameAttr(::mlir::StringAttr attr); + void setProducerName(::llvm::StringRef attrValue); + ::mlir::Attribute removeOperandsWithStaticShapeAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type rendezvous_key_base, ::mlir::TypeRange results, ::mlir::ValueRange args, ::mlir::ValueRange static_shapes, /*optional*/::mlir::ArrayAttr operands_with_static_shape, ::mlir::StringAttr mlir_module, ::mlir::StringAttr metadata, ::mlir::StringAttr producer_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange args, ::mlir::ValueRange static_shapes, /*optional*/::mlir::ArrayAttr operands_with_static_shape, ::mlir::StringAttr mlir_module, ::mlir::StringAttr metadata, ::mlir::StringAttr producer_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type rendezvous_key_base, ::mlir::TypeRange results, ::mlir::ValueRange args, ::mlir::ValueRange static_shapes, /*optional*/::mlir::ArrayAttr operands_with_static_shape, ::llvm::StringRef mlir_module, ::llvm::StringRef metadata, ::llvm::StringRef producer_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange args, ::mlir::ValueRange static_shapes, /*optional*/::mlir::ArrayAttr operands_with_static_shape, ::llvm::StringRef mlir_module, ::llvm::StringRef metadata, ::llvm::StringRef producer_name); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultAttrs(const ::mlir::OperationName &opName, ::mlir::NamedAttrList &attributes); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 7 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TPUCompileMlirAndExecuteOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TPUCompileSucceededAssertOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TPUCompileSucceededAssertOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TPUCompileSucceededAssertOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TPUCompileSucceededAssertOpGenericAdaptorBase(TPUCompileSucceededAssertOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TPUCompileSucceededAssertOpGenericAdaptor : public detail::TPUCompileSucceededAssertOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TPUCompileSucceededAssertOpGenericAdaptorBase; +public: + TPUCompileSucceededAssertOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TPUCompileSucceededAssertOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TPUCompileSucceededAssertOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TPUCompileSucceededAssertOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getCompilationStatus() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TPUCompileSucceededAssertOpAdaptor : public TPUCompileSucceededAssertOpGenericAdaptor<::mlir::ValueRange> { +public: + using TPUCompileSucceededAssertOpGenericAdaptor::TPUCompileSucceededAssertOpGenericAdaptor; + TPUCompileSucceededAssertOpAdaptor(TPUCompileSucceededAssertOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TPUCompileSucceededAssertOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = TPUCompileSucceededAssertOpAdaptor; + template + using GenericAdaptor = TPUCompileSucceededAssertOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TPUCompileSucceededAssert"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getCompilationStatus(); + ::mlir::OpOperand &getCompilationStatusMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value compilation_status); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value compilation_status); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TPUCompileSucceededAssertOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TPUCopyWithDynamicShapeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TPUCopyWithDynamicShapeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TPUCopyWithDynamicShapeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TPUCopyWithDynamicShapeOpGenericAdaptorBase(TPUCopyWithDynamicShapeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TPUCopyWithDynamicShapeOpGenericAdaptor : public detail::TPUCopyWithDynamicShapeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TPUCopyWithDynamicShapeOpGenericAdaptorBase; +public: + TPUCopyWithDynamicShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TPUCopyWithDynamicShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TPUCopyWithDynamicShapeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TPUCopyWithDynamicShapeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getTensors() { + return getODSOperands(0); + } + + RangeT getUnpaddedSizes() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TPUCopyWithDynamicShapeOpAdaptor : public TPUCopyWithDynamicShapeOpGenericAdaptor<::mlir::ValueRange> { +public: + using TPUCopyWithDynamicShapeOpGenericAdaptor::TPUCopyWithDynamicShapeOpGenericAdaptor; + TPUCopyWithDynamicShapeOpAdaptor(TPUCopyWithDynamicShapeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TPUCopyWithDynamicShapeOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = TPUCopyWithDynamicShapeOpAdaptor; + template + using GenericAdaptor = TPUCopyWithDynamicShapeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("N"), ::llvm::StringRef("T"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TPUCopyWithDynamicShape"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getTensors(); + ::mlir::Operation::operand_range getUnpaddedSizes(); + ::mlir::MutableOperandRange getTensorsMutable(); + ::mlir::MutableOperandRange getUnpaddedSizesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getTpuTensors(); + size_t getN(); + mlir::OperandElementTypeRange getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange tpu_tensors, ::mlir::ValueRange tensors, ::mlir::ValueRange unpadded_sizes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TPUCopyWithDynamicShapeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TPUCopyWithLayoutOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TPUCopyWithLayoutOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TPUCopyWithLayoutOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TPUCopyWithLayoutOpGenericAdaptorBase(TPUCopyWithLayoutOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TPUCopyWithLayoutOpGenericAdaptor : public detail::TPUCopyWithLayoutOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TPUCopyWithLayoutOpGenericAdaptorBase; +public: + TPUCopyWithLayoutOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TPUCopyWithLayoutOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TPUCopyWithLayoutOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TPUCopyWithLayoutOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getLayout() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TPUCopyWithLayoutOpAdaptor : public TPUCopyWithLayoutOpGenericAdaptor<::mlir::ValueRange> { +public: + using TPUCopyWithLayoutOpGenericAdaptor::TPUCopyWithLayoutOpGenericAdaptor; + TPUCopyWithLayoutOpAdaptor(TPUCopyWithLayoutOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TPUCopyWithLayoutOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TPUCopyWithLayoutOpAdaptor; + template + using GenericAdaptor = TPUCopyWithLayoutOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TPUCopyWithLayout"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getLayout(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getLayoutMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value layout); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value layout); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TPUCopyWithLayoutOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TPUEmbeddingActivationsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TPUEmbeddingActivationsOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TPUEmbeddingActivationsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TPUEmbeddingActivationsOpGenericAdaptorBase(TPUEmbeddingActivationsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::IntegerAttr getLookupIdAttr(); + uint64_t getLookupId(); +}; +} // namespace detail +template +class TPUEmbeddingActivationsOpGenericAdaptor : public detail::TPUEmbeddingActivationsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TPUEmbeddingActivationsOpGenericAdaptorBase; +public: + TPUEmbeddingActivationsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TPUEmbeddingActivationsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TPUEmbeddingActivationsOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TPUEmbeddingActivationsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getEmbeddingVariable() { + return (*getODSOperands(0).begin()); + } + + ValueT getSlicedActivations() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TPUEmbeddingActivationsOpAdaptor : public TPUEmbeddingActivationsOpGenericAdaptor<::mlir::ValueRange> { +public: + using TPUEmbeddingActivationsOpGenericAdaptor::TPUEmbeddingActivationsOpGenericAdaptor; + TPUEmbeddingActivationsOpAdaptor(TPUEmbeddingActivationsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TPUEmbeddingActivationsOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TPUEmbeddingActivationsOpAdaptor; + template + using GenericAdaptor = TPUEmbeddingActivationsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("lookup_id"), ::llvm::StringRef("table_id")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getLookupIdAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getLookupIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TPUEmbeddingActivations"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getEmbeddingVariable(); + ::mlir::TypedValue<::mlir::TensorType> getSlicedActivations(); + ::mlir::OpOperand &getEmbeddingVariableMutable(); + ::mlir::OpOperand &getSlicedActivationsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::IntegerAttr getLookupIdAttr(); + uint64_t getLookupId(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(uint64_t attrValue); + void setLookupIdAttr(::mlir::IntegerAttr attr); + void setLookupId(uint64_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value embedding_variable, ::mlir::Value sliced_activations, ::mlir::IntegerAttr table_id, ::mlir::IntegerAttr lookup_id); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value embedding_variable, ::mlir::Value sliced_activations, ::mlir::IntegerAttr table_id, ::mlir::IntegerAttr lookup_id); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value embedding_variable, ::mlir::Value sliced_activations, uint64_t table_id, uint64_t lookup_id); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value embedding_variable, ::mlir::Value sliced_activations, uint64_t table_id, uint64_t lookup_id); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TPUEmbeddingActivationsOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TPUExecuteAndUpdateVariablesOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TPUExecuteAndUpdateVariablesOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TPUExecuteAndUpdateVariablesOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TPUExecuteAndUpdateVariablesOpGenericAdaptorBase(TPUExecuteAndUpdateVariablesOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getDeviceVarReadsIndicesAttr(); + ::mlir::ArrayAttr getDeviceVarReadsIndices(); + ::mlir::ArrayAttr getDeviceVarUpdatesIndicesAttr(); + ::mlir::ArrayAttr getDeviceVarUpdatesIndices(); +}; +} // namespace detail +template +class TPUExecuteAndUpdateVariablesOpGenericAdaptor : public detail::TPUExecuteAndUpdateVariablesOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TPUExecuteAndUpdateVariablesOpGenericAdaptorBase; +public: + TPUExecuteAndUpdateVariablesOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TPUExecuteAndUpdateVariablesOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TPUExecuteAndUpdateVariablesOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TPUExecuteAndUpdateVariablesOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + ValueT getKey() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TPUExecuteAndUpdateVariablesOpAdaptor : public TPUExecuteAndUpdateVariablesOpGenericAdaptor<::mlir::ValueRange> { +public: + using TPUExecuteAndUpdateVariablesOpGenericAdaptor::TPUExecuteAndUpdateVariablesOpGenericAdaptor; + TPUExecuteAndUpdateVariablesOpAdaptor(TPUExecuteAndUpdateVariablesOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TPUExecuteAndUpdateVariablesOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TPUExecuteAndUpdateVariablesOpAdaptor; + template + using GenericAdaptor = TPUExecuteAndUpdateVariablesOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Targs"), ::llvm::StringRef("Tresults"), ::llvm::StringRef("device_var_reads_indices"), ::llvm::StringRef("device_var_updates_indices")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTargsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTargsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTresultsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTresultsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDeviceVarReadsIndicesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDeviceVarReadsIndicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getDeviceVarUpdatesIndicesAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getDeviceVarUpdatesIndicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TPUExecuteAndUpdateVariables"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::TypedValue<::mlir::TensorType> getKey(); + ::mlir::MutableOperandRange getArgsMutable(); + ::mlir::OpOperand &getKeyMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResults(); + ::mlir::ArrayAttr getDeviceVarReadsIndicesAttr(); + ::mlir::ArrayAttr getDeviceVarReadsIndices(); + ::mlir::ArrayAttr getDeviceVarUpdatesIndicesAttr(); + ::mlir::ArrayAttr getDeviceVarUpdatesIndices(); + mlir::OperandElementTypeRange getTargs(); + mlir::ResultElementTypeRange getTresults(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setDeviceVarReadsIndicesAttr(::mlir::ArrayAttr attr); + void setDeviceVarUpdatesIndicesAttr(::mlir::ArrayAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange results, ::mlir::ValueRange args, ::mlir::Value key, ::mlir::ArrayAttr device_var_reads_indices, ::mlir::ArrayAttr device_var_updates_indices); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TPUExecuteAndUpdateVariablesOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TPUExecuteOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TPUExecuteOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TPUExecuteOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TPUExecuteOpGenericAdaptorBase(TPUExecuteOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TPUExecuteOpGenericAdaptor : public detail::TPUExecuteOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TPUExecuteOpGenericAdaptorBase; +public: + TPUExecuteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TPUExecuteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TPUExecuteOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TPUExecuteOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + ValueT getKey() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TPUExecuteOpAdaptor : public TPUExecuteOpGenericAdaptor<::mlir::ValueRange> { +public: + using TPUExecuteOpGenericAdaptor::TPUExecuteOpGenericAdaptor; + TPUExecuteOpAdaptor(TPUExecuteOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TPUExecuteOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TPUExecuteOpAdaptor; + template + using GenericAdaptor = TPUExecuteOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Targs"), ::llvm::StringRef("Tresults")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTargsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTargsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTresultsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTresultsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TPUExecute"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::TypedValue<::mlir::TensorType> getKey(); + ::mlir::MutableOperandRange getArgsMutable(); + ::mlir::OpOperand &getKeyMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResults(); + mlir::OperandElementTypeRange getTargs(); + mlir::ResultElementTypeRange getTresults(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange results, ::mlir::ValueRange args, ::mlir::Value key); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TPUExecuteOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TPUGetLayoutOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TPUGetLayoutOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TPUGetLayoutOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TPUGetLayoutOpGenericAdaptorBase(TPUGetLayoutOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getIndexAttr(); + uint64_t getIndex(); + ::mlir::BoolAttr getIsOutputAttr(); + bool getIsOutput(); +}; +} // namespace detail +template +class TPUGetLayoutOpGenericAdaptor : public detail::TPUGetLayoutOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TPUGetLayoutOpGenericAdaptorBase; +public: + TPUGetLayoutOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TPUGetLayoutOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TPUGetLayoutOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TPUGetLayoutOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getCacheKey() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TPUGetLayoutOpAdaptor : public TPUGetLayoutOpGenericAdaptor<::mlir::ValueRange> { +public: + using TPUGetLayoutOpGenericAdaptor::TPUGetLayoutOpGenericAdaptor; + TPUGetLayoutOpAdaptor(TPUGetLayoutOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TPUGetLayoutOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TPUGetLayoutOpAdaptor; + template + using GenericAdaptor = TPUGetLayoutOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("index"), ::llvm::StringRef("is_output")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getIndexAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getIndexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getIsOutputAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getIsOutputAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TPUGetLayoutOp"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getCacheKey(); + ::mlir::OpOperand &getCacheKeyMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLayout(); + ::mlir::IntegerAttr getIndexAttr(); + uint64_t getIndex(); + ::mlir::BoolAttr getIsOutputAttr(); + bool getIsOutput(); + void setIndexAttr(::mlir::IntegerAttr attr); + void setIndex(uint64_t attrValue); + void setIsOutputAttr(::mlir::BoolAttr attr); + void setIsOutput(bool attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type layout, ::mlir::Value cache_key, ::mlir::IntegerAttr index, ::mlir::BoolAttr is_output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value cache_key, ::mlir::IntegerAttr index, ::mlir::BoolAttr is_output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type layout, ::mlir::Value cache_key, uint64_t index, bool is_output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value cache_key, uint64_t index, bool is_output); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TPUGetLayoutOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TPUOrdinalSelectorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TPUOrdinalSelectorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TPUOrdinalSelectorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TPUOrdinalSelectorOpGenericAdaptorBase(TPUOrdinalSelectorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TPUOrdinalSelectorOpGenericAdaptor : public detail::TPUOrdinalSelectorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TPUOrdinalSelectorOpGenericAdaptorBase; +public: + TPUOrdinalSelectorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TPUOrdinalSelectorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TPUOrdinalSelectorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TPUOrdinalSelectorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TPUOrdinalSelectorOpAdaptor : public TPUOrdinalSelectorOpGenericAdaptor<::mlir::ValueRange> { +public: + using TPUOrdinalSelectorOpGenericAdaptor::TPUOrdinalSelectorOpGenericAdaptor; + TPUOrdinalSelectorOpAdaptor(TPUOrdinalSelectorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TPUOrdinalSelectorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = TPUOrdinalSelectorOpAdaptor; + template + using GenericAdaptor = TPUOrdinalSelectorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TPUOrdinalSelector"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getDeviceOrdinals(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type device_ordinals); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TPUOrdinalSelectorOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TPUPartitionedCallOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TPUPartitionedCallOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TPUPartitionedCallOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TPUPartitionedCallOpGenericAdaptorBase(TPUPartitionedCallOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::SymbolRefAttr getFAttr(); + ::mlir::SymbolRefAttr getF(); + ::mlir::IntegerAttr getAutotunerThreshAttr(); + uint64_t getAutotunerThresh(); +}; +} // namespace detail +template +class TPUPartitionedCallOpGenericAdaptor : public detail::TPUPartitionedCallOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TPUPartitionedCallOpGenericAdaptorBase; +public: + TPUPartitionedCallOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TPUPartitionedCallOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TPUPartitionedCallOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TPUPartitionedCallOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + ValueT getDeviceOrdinal() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TPUPartitionedCallOpAdaptor : public TPUPartitionedCallOpGenericAdaptor<::mlir::ValueRange> { +public: + using TPUPartitionedCallOpGenericAdaptor::TPUPartitionedCallOpGenericAdaptor; + TPUPartitionedCallOpAdaptor(TPUPartitionedCallOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TPUPartitionedCallOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::CallOpInterface::Trait, ::mlir::SymbolUserOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TPUPartitionedCallOpAdaptor; + template + using GenericAdaptor = TPUPartitionedCallOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tin"), ::llvm::StringRef("Tout"), ::llvm::StringRef("autotuner_thresh"), ::llvm::StringRef("f")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTinAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTinAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getToutAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getToutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getAutotunerThreshAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getAutotunerThreshAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getFAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getFAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TPUPartitionedCall"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::TypedValue<::mlir::TensorType> getDeviceOrdinal(); + ::mlir::MutableOperandRange getArgsMutable(); + ::mlir::OpOperand &getDeviceOrdinalMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutput(); + ::mlir::SymbolRefAttr getFAttr(); + ::mlir::SymbolRefAttr getF(); + ::mlir::IntegerAttr getAutotunerThreshAttr(); + uint64_t getAutotunerThresh(); + mlir::OperandElementTypeRange getTin(); + mlir::ResultElementTypeRange getTout(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setFAttr(::mlir::SymbolRefAttr attr); + void setAutotunerThreshAttr(::mlir::IntegerAttr attr); + void setAutotunerThresh(::std::optional attrValue); + ::mlir::Attribute removeAutotunerThreshAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::ValueRange args, ::mlir::Value device_ordinal, ::mlir::SymbolRefAttr f, /*optional*/::mlir::IntegerAttr autotuner_thresh); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::ValueRange args, ::mlir::Value device_ordinal, ::mlir::SymbolRefAttr f, /*optional*/uint64_t autotuner_thresh = 0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verifySymbolUses(::mlir::SymbolTableCollection &symbolTable); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Gets the argument operands to the called function. + operand_range getArgOperands() { return getArgs(); } + MutableOperandRange getArgOperandsMutable() { + return getArgsMutable(); + } + + // Returns the callee of this operation. + CallInterfaceCallable getCallableForCallee() { return getFAttr(); } + // Sets the callee from the callable. + void setCalleeFromCallable(CallInterfaceCallable callee); + + // Returns the resolved callee function of this operation. + // Prefer passing in SymbolTableCollection to reduce lookup costs by + // enabling reusing cached symbol table lookup. + func::FuncOp ResolveFunc(::mlir::SymbolTableCollection* table) { + if (table) + return table->lookupNearestSymbolFrom(*this, getFAttr()); + return SymbolTable::lookupNearestSymbolFrom(*this, getFAttr()); + } + // TODO(b/204997177): Deprecate and remove. + func::FuncOp func() { return ResolveFunc(nullptr); } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TPUPartitionedCallOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TPUPartitionedInputOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TPUPartitionedInputOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TPUPartitionedInputOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TPUPartitionedInputOpGenericAdaptorBase(TPUPartitionedInputOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getPartitionDimAttr(); + uint64_t getPartitionDim(); + ::mlir::StringAttr get_XlaShardingAttr(); + ::std::optional< ::llvm::StringRef > get_XlaSharding(); +}; +} // namespace detail +template +class TPUPartitionedInputOpGenericAdaptor : public detail::TPUPartitionedInputOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TPUPartitionedInputOpGenericAdaptorBase; +public: + TPUPartitionedInputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TPUPartitionedInputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TPUPartitionedInputOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TPUPartitionedInputOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TPUPartitionedInputOpAdaptor : public TPUPartitionedInputOpGenericAdaptor<::mlir::ValueRange> { +public: + using TPUPartitionedInputOpGenericAdaptor::TPUPartitionedInputOpGenericAdaptor; + TPUPartitionedInputOpAdaptor(TPUPartitionedInputOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TPUPartitionedInputOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TPUPartitionedInputOpAdaptor; + template + using GenericAdaptor = TPUPartitionedInputOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("N"), ::llvm::StringRef("T"), ::llvm::StringRef("_XlaSharding"), ::llvm::StringRef("partition_dim")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr get_XlaShardingAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr get_XlaShardingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getPartitionDimAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getPartitionDimAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TPUPartitionedInput"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::MutableOperandRange getInputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getPartitionDimAttr(); + uint64_t getPartitionDim(); + ::mlir::StringAttr get_XlaShardingAttr(); + ::std::optional< ::llvm::StringRef > get_XlaSharding(); + ::mlir::Type getT(); + size_t getN(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setPartitionDimAttr(::mlir::IntegerAttr attr); + void setPartitionDim(::std::optional attrValue); + void set_XlaShardingAttr(::mlir::StringAttr attr); + void set_XlaSharding(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removePartitionDimAttr(); + ::mlir::Attribute remove_XlaShardingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::ValueRange inputs, /*optional*/::mlir::IntegerAttr partition_dim, /*optional*/::mlir::StringAttr _XlaSharding); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, /*optional*/::mlir::IntegerAttr partition_dim, /*optional*/::mlir::StringAttr _XlaSharding); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::ValueRange inputs, /*optional*/uint64_t partition_dim, /*optional*/::mlir::StringAttr _XlaSharding); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, /*optional*/uint64_t partition_dim, /*optional*/::mlir::StringAttr _XlaSharding); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TPUPartitionedInputOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TPUPartitionedInputV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TPUPartitionedInputV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TPUPartitionedInputV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TPUPartitionedInputV2OpGenericAdaptorBase(TPUPartitionedInputV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getPartitionDimsAttr(); + ::mlir::ArrayAttr getPartitionDims(); + ::mlir::BoolAttr getIsPackedAttr(); + bool getIsPacked(); + ::mlir::StringAttr get_XlaShardingAttr(); + ::std::optional< ::llvm::StringRef > get_XlaSharding(); +}; +} // namespace detail +template +class TPUPartitionedInputV2OpGenericAdaptor : public detail::TPUPartitionedInputV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TPUPartitionedInputV2OpGenericAdaptorBase; +public: + TPUPartitionedInputV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TPUPartitionedInputV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TPUPartitionedInputV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TPUPartitionedInputV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TPUPartitionedInputV2OpAdaptor : public TPUPartitionedInputV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using TPUPartitionedInputV2OpGenericAdaptor::TPUPartitionedInputV2OpGenericAdaptor; + TPUPartitionedInputV2OpAdaptor(TPUPartitionedInputV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TPUPartitionedInputV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TPUPartitionedInputV2OpAdaptor; + template + using GenericAdaptor = TPUPartitionedInputV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("N"), ::llvm::StringRef("T"), ::llvm::StringRef("_XlaSharding"), ::llvm::StringRef("is_packed"), ::llvm::StringRef("partition_dims")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr get_XlaShardingAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr get_XlaShardingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getIsPackedAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getIsPackedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getPartitionDimsAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getPartitionDimsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TPUPartitionedInputV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::MutableOperandRange getInputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ArrayAttr getPartitionDimsAttr(); + ::mlir::ArrayAttr getPartitionDims(); + ::mlir::BoolAttr getIsPackedAttr(); + bool getIsPacked(); + ::mlir::StringAttr get_XlaShardingAttr(); + ::std::optional< ::llvm::StringRef > get_XlaSharding(); + ::mlir::Type getT(); + size_t getN(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setPartitionDimsAttr(::mlir::ArrayAttr attr); + void setIsPackedAttr(::mlir::BoolAttr attr); + void setIsPacked(::std::optional attrValue); + void set_XlaShardingAttr(::mlir::StringAttr attr); + void set_XlaSharding(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeIsPackedAttr(); + ::mlir::Attribute remove_XlaShardingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::ValueRange inputs, ::mlir::ArrayAttr partition_dims, /*optional*/::mlir::BoolAttr is_packed, /*optional*/::mlir::StringAttr _XlaSharding); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::mlir::ArrayAttr partition_dims, /*optional*/::mlir::BoolAttr is_packed, /*optional*/::mlir::StringAttr _XlaSharding); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::ValueRange inputs, ::mlir::ArrayAttr partition_dims, /*optional*/bool is_packed, /*optional*/::mlir::StringAttr _XlaSharding); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::mlir::ArrayAttr partition_dims, /*optional*/bool is_packed, /*optional*/::mlir::StringAttr _XlaSharding); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TPUPartitionedInputV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TPUPartitionedOutputOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TPUPartitionedOutputOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TPUPartitionedOutputOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TPUPartitionedOutputOpGenericAdaptorBase(TPUPartitionedOutputOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getPartitionDimAttr(); + uint64_t getPartitionDim(); + ::mlir::StringAttr get_XlaShardingAttr(); + ::std::optional< ::llvm::StringRef > get_XlaSharding(); +}; +} // namespace detail +template +class TPUPartitionedOutputOpGenericAdaptor : public detail::TPUPartitionedOutputOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TPUPartitionedOutputOpGenericAdaptorBase; +public: + TPUPartitionedOutputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TPUPartitionedOutputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TPUPartitionedOutputOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TPUPartitionedOutputOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputs() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TPUPartitionedOutputOpAdaptor : public TPUPartitionedOutputOpGenericAdaptor<::mlir::ValueRange> { +public: + using TPUPartitionedOutputOpGenericAdaptor::TPUPartitionedOutputOpGenericAdaptor; + TPUPartitionedOutputOpAdaptor(TPUPartitionedOutputOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TPUPartitionedOutputOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = TPUPartitionedOutputOpAdaptor; + template + using GenericAdaptor = TPUPartitionedOutputOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("_XlaSharding"), ::llvm::StringRef("num_splits"), ::llvm::StringRef("partition_dim")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr get_XlaShardingAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr get_XlaShardingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getNumSplitsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getNumSplitsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getPartitionDimAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getPartitionDimAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TPUPartitionedOutput"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputs(); + ::mlir::OpOperand &getInputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutput(); + ::mlir::IntegerAttr getPartitionDimAttr(); + uint64_t getPartitionDim(); + ::mlir::StringAttr get_XlaShardingAttr(); + ::std::optional< ::llvm::StringRef > get_XlaSharding(); + ::mlir::Type getT(); + size_t getNumSplits(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setPartitionDimAttr(::mlir::IntegerAttr attr); + void setPartitionDim(::std::optional attrValue); + void set_XlaShardingAttr(::mlir::StringAttr attr); + void set_XlaSharding(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removePartitionDimAttr(); + ::mlir::Attribute remove_XlaShardingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::Value inputs, /*optional*/::mlir::IntegerAttr partition_dim, /*optional*/::mlir::StringAttr _XlaSharding); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::Value inputs, /*optional*/uint64_t partition_dim, /*optional*/::mlir::StringAttr _XlaSharding); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TPUPartitionedOutputOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TPUPartitionedOutputV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TPUPartitionedOutputV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TPUPartitionedOutputV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TPUPartitionedOutputV2OpGenericAdaptorBase(TPUPartitionedOutputV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getPartitionDimsAttr(); + ::mlir::ArrayAttr getPartitionDims(); + ::mlir::StringAttr get_XlaShardingAttr(); + ::std::optional< ::llvm::StringRef > get_XlaSharding(); +}; +} // namespace detail +template +class TPUPartitionedOutputV2OpGenericAdaptor : public detail::TPUPartitionedOutputV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TPUPartitionedOutputV2OpGenericAdaptorBase; +public: + TPUPartitionedOutputV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TPUPartitionedOutputV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TPUPartitionedOutputV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TPUPartitionedOutputV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputs() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TPUPartitionedOutputV2OpAdaptor : public TPUPartitionedOutputV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using TPUPartitionedOutputV2OpGenericAdaptor::TPUPartitionedOutputV2OpGenericAdaptor; + TPUPartitionedOutputV2OpAdaptor(TPUPartitionedOutputV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TPUPartitionedOutputV2Op : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = TPUPartitionedOutputV2OpAdaptor; + template + using GenericAdaptor = TPUPartitionedOutputV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("_XlaSharding"), ::llvm::StringRef("num_splits"), ::llvm::StringRef("partition_dims")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr get_XlaShardingAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr get_XlaShardingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getNumSplitsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getNumSplitsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getPartitionDimsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getPartitionDimsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TPUPartitionedOutputV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputs(); + ::mlir::OpOperand &getInputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutput(); + ::mlir::ArrayAttr getPartitionDimsAttr(); + ::mlir::ArrayAttr getPartitionDims(); + ::mlir::StringAttr get_XlaShardingAttr(); + ::std::optional< ::llvm::StringRef > get_XlaSharding(); + ::mlir::Type getT(); + size_t getNumSplits(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setPartitionDimsAttr(::mlir::ArrayAttr attr); + void set_XlaShardingAttr(::mlir::StringAttr attr); + void set_XlaSharding(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute remove_XlaShardingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::Value inputs, ::mlir::ArrayAttr partition_dims, /*optional*/::mlir::StringAttr _XlaSharding); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TPUPartitionedOutputV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TPUReplicateMetadataOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TPUReplicateMetadataOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TPUReplicateMetadataOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TPUReplicateMetadataOpGenericAdaptorBase(TPUReplicateMetadataOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getNumReplicasAttr(); + uint64_t getNumReplicas(); + ::mlir::IntegerAttr getNumCoresPerReplicaAttr(); + uint64_t getNumCoresPerReplica(); + ::mlir::StringAttr getTopologyAttr(); + ::llvm::StringRef getTopology(); + ::mlir::BoolAttr getUseTpuAttr(); + bool getUseTpu(); + ::mlir::ArrayAttr getDeviceAssignmentAttr(); + ::mlir::ArrayAttr getDeviceAssignment(); + ::mlir::ArrayAttr getComputationShapeAttr(); + ::mlir::ArrayAttr getComputationShape(); + ::mlir::ArrayAttr getHostComputeCoreAttr(); + ::mlir::ArrayAttr getHostComputeCore(); + ::mlir::ArrayAttr getPaddingMapAttr(); + ::mlir::ArrayAttr getPaddingMap(); + ::mlir::StringAttr getStepMarkerLocationAttr(); + ::llvm::StringRef getStepMarkerLocation(); + ::mlir::BoolAttr getAllowSoftPlacementAttr(); + bool getAllowSoftPlacement(); + ::mlir::BoolAttr getUseSpmdForXlaPartitioningAttr(); + bool getUseSpmdForXlaPartitioning(); + ::mlir::StringAttr getTpuCompileOptionsProtoAttr(); + ::llvm::StringRef getTpuCompileOptionsProto(); +}; +} // namespace detail +template +class TPUReplicateMetadataOpGenericAdaptor : public detail::TPUReplicateMetadataOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TPUReplicateMetadataOpGenericAdaptorBase; +public: + TPUReplicateMetadataOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TPUReplicateMetadataOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TPUReplicateMetadataOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TPUReplicateMetadataOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TPUReplicateMetadataOpAdaptor : public TPUReplicateMetadataOpGenericAdaptor<::mlir::ValueRange> { +public: + using TPUReplicateMetadataOpGenericAdaptor::TPUReplicateMetadataOpGenericAdaptor; + TPUReplicateMetadataOpAdaptor(TPUReplicateMetadataOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TPUReplicateMetadataOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = TPUReplicateMetadataOpAdaptor; + template + using GenericAdaptor = TPUReplicateMetadataOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("allow_soft_placement"), ::llvm::StringRef("computation_shape"), ::llvm::StringRef("device_assignment"), ::llvm::StringRef("host_compute_core"), ::llvm::StringRef("num_cores_per_replica"), ::llvm::StringRef("num_replicas"), ::llvm::StringRef("padding_map"), ::llvm::StringRef("step_marker_location"), ::llvm::StringRef("topology"), ::llvm::StringRef("tpu_compile_options_proto"), ::llvm::StringRef("use_spmd_for_xla_partitioning"), ::llvm::StringRef("use_tpu")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAllowSoftPlacementAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAllowSoftPlacementAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getComputationShapeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getComputationShapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDeviceAssignmentAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDeviceAssignmentAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getHostComputeCoreAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getHostComputeCoreAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getNumCoresPerReplicaAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getNumCoresPerReplicaAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getNumReplicasAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getNumReplicasAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getPaddingMapAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getPaddingMapAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getStepMarkerLocationAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getStepMarkerLocationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getTopologyAttrName() { + return getAttributeNameForIndex(8); + } + + static ::mlir::StringAttr getTopologyAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 8); + } + + ::mlir::StringAttr getTpuCompileOptionsProtoAttrName() { + return getAttributeNameForIndex(9); + } + + static ::mlir::StringAttr getTpuCompileOptionsProtoAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 9); + } + + ::mlir::StringAttr getUseSpmdForXlaPartitioningAttrName() { + return getAttributeNameForIndex(10); + } + + static ::mlir::StringAttr getUseSpmdForXlaPartitioningAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 10); + } + + ::mlir::StringAttr getUseTpuAttrName() { + return getAttributeNameForIndex(11); + } + + static ::mlir::StringAttr getUseTpuAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 11); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TPUReplicateMetadata"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getNumReplicasAttr(); + uint64_t getNumReplicas(); + ::mlir::IntegerAttr getNumCoresPerReplicaAttr(); + uint64_t getNumCoresPerReplica(); + ::mlir::StringAttr getTopologyAttr(); + ::llvm::StringRef getTopology(); + ::mlir::BoolAttr getUseTpuAttr(); + bool getUseTpu(); + ::mlir::ArrayAttr getDeviceAssignmentAttr(); + ::mlir::ArrayAttr getDeviceAssignment(); + ::mlir::ArrayAttr getComputationShapeAttr(); + ::mlir::ArrayAttr getComputationShape(); + ::mlir::ArrayAttr getHostComputeCoreAttr(); + ::mlir::ArrayAttr getHostComputeCore(); + ::mlir::ArrayAttr getPaddingMapAttr(); + ::mlir::ArrayAttr getPaddingMap(); + ::mlir::StringAttr getStepMarkerLocationAttr(); + ::llvm::StringRef getStepMarkerLocation(); + ::mlir::BoolAttr getAllowSoftPlacementAttr(); + bool getAllowSoftPlacement(); + ::mlir::BoolAttr getUseSpmdForXlaPartitioningAttr(); + bool getUseSpmdForXlaPartitioning(); + ::mlir::StringAttr getTpuCompileOptionsProtoAttr(); + ::llvm::StringRef getTpuCompileOptionsProto(); + void setNumReplicasAttr(::mlir::IntegerAttr attr); + void setNumReplicas(uint64_t attrValue); + void setNumCoresPerReplicaAttr(::mlir::IntegerAttr attr); + void setNumCoresPerReplica(::std::optional attrValue); + void setTopologyAttr(::mlir::StringAttr attr); + void setTopology(::std::optional<::llvm::StringRef> attrValue); + void setUseTpuAttr(::mlir::BoolAttr attr); + void setUseTpu(::std::optional attrValue); + void setDeviceAssignmentAttr(::mlir::ArrayAttr attr); + void setComputationShapeAttr(::mlir::ArrayAttr attr); + void setHostComputeCoreAttr(::mlir::ArrayAttr attr); + void setPaddingMapAttr(::mlir::ArrayAttr attr); + void setStepMarkerLocationAttr(::mlir::StringAttr attr); + void setStepMarkerLocation(::std::optional<::llvm::StringRef> attrValue); + void setAllowSoftPlacementAttr(::mlir::BoolAttr attr); + void setAllowSoftPlacement(::std::optional attrValue); + void setUseSpmdForXlaPartitioningAttr(::mlir::BoolAttr attr); + void setUseSpmdForXlaPartitioning(::std::optional attrValue); + void setTpuCompileOptionsProtoAttr(::mlir::StringAttr attr); + void setTpuCompileOptionsProto(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeNumCoresPerReplicaAttr(); + ::mlir::Attribute removeTopologyAttr(); + ::mlir::Attribute removeUseTpuAttr(); + ::mlir::Attribute removeDeviceAssignmentAttr(); + ::mlir::Attribute removeComputationShapeAttr(); + ::mlir::Attribute removeHostComputeCoreAttr(); + ::mlir::Attribute removePaddingMapAttr(); + ::mlir::Attribute removeStepMarkerLocationAttr(); + ::mlir::Attribute removeAllowSoftPlacementAttr(); + ::mlir::Attribute removeUseSpmdForXlaPartitioningAttr(); + ::mlir::Attribute removeTpuCompileOptionsProtoAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::IntegerAttr num_replicas, /*optional*/::mlir::IntegerAttr num_cores_per_replica, /*optional*/::mlir::StringAttr topology, /*optional*/::mlir::BoolAttr use_tpu, /*optional*/::mlir::ArrayAttr device_assignment, /*optional*/::mlir::ArrayAttr computation_shape, /*optional*/::mlir::ArrayAttr host_compute_core, /*optional*/::mlir::ArrayAttr padding_map, /*optional*/::mlir::StringAttr step_marker_location, /*optional*/::mlir::BoolAttr allow_soft_placement, /*optional*/::mlir::BoolAttr use_spmd_for_xla_partitioning, /*optional*/::mlir::StringAttr tpu_compile_options_proto); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr num_replicas, /*optional*/::mlir::IntegerAttr num_cores_per_replica, /*optional*/::mlir::StringAttr topology, /*optional*/::mlir::BoolAttr use_tpu, /*optional*/::mlir::ArrayAttr device_assignment, /*optional*/::mlir::ArrayAttr computation_shape, /*optional*/::mlir::ArrayAttr host_compute_core, /*optional*/::mlir::ArrayAttr padding_map, /*optional*/::mlir::StringAttr step_marker_location, /*optional*/::mlir::BoolAttr allow_soft_placement, /*optional*/::mlir::BoolAttr use_spmd_for_xla_partitioning, /*optional*/::mlir::StringAttr tpu_compile_options_proto); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, uint64_t num_replicas, /*optional*/uint64_t num_cores_per_replica, /*optional*/::llvm::StringRef topology, /*optional*/bool use_tpu, /*optional*/::mlir::ArrayAttr device_assignment, /*optional*/::mlir::ArrayAttr computation_shape, /*optional*/::mlir::ArrayAttr host_compute_core, /*optional*/::mlir::ArrayAttr padding_map, /*optional*/::llvm::StringRef step_marker_location = "STEP_MARK_AT_ENTRY", /*optional*/bool allow_soft_placement = false, /*optional*/bool use_spmd_for_xla_partitioning = false, /*optional*/::llvm::StringRef tpu_compile_options_proto = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, uint64_t num_replicas, /*optional*/uint64_t num_cores_per_replica, /*optional*/::llvm::StringRef topology, /*optional*/bool use_tpu, /*optional*/::mlir::ArrayAttr device_assignment, /*optional*/::mlir::ArrayAttr computation_shape, /*optional*/::mlir::ArrayAttr host_compute_core, /*optional*/::mlir::ArrayAttr padding_map, /*optional*/::llvm::StringRef step_marker_location = "STEP_MARK_AT_ENTRY", /*optional*/bool allow_soft_placement = false, /*optional*/bool use_spmd_for_xla_partitioning = false, /*optional*/::llvm::StringRef tpu_compile_options_proto = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 12 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TPUReplicateMetadataOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TPUReplicatedInputOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TPUReplicatedInputOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TPUReplicatedInputOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TPUReplicatedInputOpGenericAdaptorBase(TPUReplicatedInputOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getIsMirroredVariableAttr(); + bool getIsMirroredVariable(); + ::mlir::IntegerAttr getIndexAttr(); + uint64_t getIndex(); + ::mlir::BoolAttr getIsPackedAttr(); + bool getIsPacked(); +}; +} // namespace detail +template +class TPUReplicatedInputOpGenericAdaptor : public detail::TPUReplicatedInputOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TPUReplicatedInputOpGenericAdaptorBase; +public: + TPUReplicatedInputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TPUReplicatedInputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TPUReplicatedInputOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TPUReplicatedInputOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TPUReplicatedInputOpAdaptor : public TPUReplicatedInputOpGenericAdaptor<::mlir::ValueRange> { +public: + using TPUReplicatedInputOpGenericAdaptor::TPUReplicatedInputOpGenericAdaptor; + TPUReplicatedInputOpAdaptor(TPUReplicatedInputOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TPUReplicatedInputOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TPUReplicatedInputOpAdaptor; + template + using GenericAdaptor = TPUReplicatedInputOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("N"), ::llvm::StringRef("T"), ::llvm::StringRef("index"), ::llvm::StringRef("is_mirrored_variable"), ::llvm::StringRef("is_packed")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getIndexAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getIndexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getIsMirroredVariableAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getIsMirroredVariableAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getIsPackedAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getIsPackedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TPUReplicatedInput"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::MutableOperandRange getInputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getIsMirroredVariableAttr(); + bool getIsMirroredVariable(); + ::mlir::IntegerAttr getIndexAttr(); + uint64_t getIndex(); + ::mlir::BoolAttr getIsPackedAttr(); + bool getIsPacked(); + size_t getN(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setIsMirroredVariableAttr(::mlir::BoolAttr attr); + void setIsMirroredVariable(::std::optional attrValue); + void setIndexAttr(::mlir::IntegerAttr attr); + void setIndex(::std::optional attrValue); + void setIsPackedAttr(::mlir::BoolAttr attr); + void setIsPacked(::std::optional attrValue); + ::mlir::Attribute removeIsMirroredVariableAttr(); + ::mlir::Attribute removeIndexAttr(); + ::mlir::Attribute removeIsPackedAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::ValueRange inputs, /*optional*/::mlir::BoolAttr is_mirrored_variable, /*optional*/::mlir::IntegerAttr index, /*optional*/::mlir::BoolAttr is_packed); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, /*optional*/::mlir::BoolAttr is_mirrored_variable, /*optional*/::mlir::IntegerAttr index, /*optional*/::mlir::BoolAttr is_packed); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::ValueRange inputs, /*optional*/bool is_mirrored_variable = false, /*optional*/uint64_t index = -1, /*optional*/bool is_packed = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, /*optional*/bool is_mirrored_variable = false, /*optional*/uint64_t index = -1, /*optional*/bool is_packed = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TPUReplicatedInputOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TPUReplicatedOutputOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TPUReplicatedOutputOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TPUReplicatedOutputOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TPUReplicatedOutputOpGenericAdaptorBase(TPUReplicatedOutputOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TPUReplicatedOutputOpGenericAdaptor : public detail::TPUReplicatedOutputOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TPUReplicatedOutputOpGenericAdaptorBase; +public: + TPUReplicatedOutputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TPUReplicatedOutputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TPUReplicatedOutputOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TPUReplicatedOutputOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TPUReplicatedOutputOpAdaptor : public TPUReplicatedOutputOpGenericAdaptor<::mlir::ValueRange> { +public: + using TPUReplicatedOutputOpGenericAdaptor::TPUReplicatedOutputOpGenericAdaptor; + TPUReplicatedOutputOpAdaptor(TPUReplicatedOutputOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TPUReplicatedOutputOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = TPUReplicatedOutputOpAdaptor; + template + using GenericAdaptor = TPUReplicatedOutputOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("num_replicas")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumReplicasAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumReplicasAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TPUReplicatedOutput"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutputs(); + ::mlir::Type getT(); + size_t getNumReplicas(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outputs, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TPUReplicatedOutputOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TPUReshardVariablesOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TPUReshardVariablesOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TPUReshardVariablesOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TPUReshardVariablesOpGenericAdaptorBase(TPUReshardVariablesOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TPUReshardVariablesOpGenericAdaptor : public detail::TPUReshardVariablesOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TPUReshardVariablesOpGenericAdaptorBase; +public: + TPUReshardVariablesOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TPUReshardVariablesOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TPUReshardVariablesOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TPUReshardVariablesOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getVars() { + return getODSOperands(0); + } + + ValueT getNewFormatKey() { + return (*getODSOperands(1).begin()); + } + + ValueT getFormatStateVar() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TPUReshardVariablesOpAdaptor : public TPUReshardVariablesOpGenericAdaptor<::mlir::ValueRange> { +public: + using TPUReshardVariablesOpGenericAdaptor::TPUReshardVariablesOpGenericAdaptor; + TPUReshardVariablesOpAdaptor(TPUReshardVariablesOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TPUReshardVariablesOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TPUReshardVariablesOpAdaptor; + template + using GenericAdaptor = TPUReshardVariablesOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("N")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TPUReshardVariables"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getVars(); + ::mlir::TypedValue<::mlir::TensorType> getNewFormatKey(); + ::mlir::TypedValue<::mlir::TensorType> getFormatStateVar(); + ::mlir::MutableOperandRange getVarsMutable(); + ::mlir::OpOperand &getNewFormatKeyMutable(); + ::mlir::OpOperand &getFormatStateVarMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + size_t getN(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange vars, ::mlir::Value new_format_key, ::mlir::Value format_state_var); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange vars, ::mlir::Value new_format_key, ::mlir::Value format_state_var); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TPUReshardVariablesOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TPURoundRobinOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TPURoundRobinOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TPURoundRobinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TPURoundRobinOpGenericAdaptorBase(TPURoundRobinOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TPURoundRobinOpGenericAdaptor : public detail::TPURoundRobinOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TPURoundRobinOpGenericAdaptorBase; +public: + TPURoundRobinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TPURoundRobinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TPURoundRobinOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TPURoundRobinOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TPURoundRobinOpAdaptor : public TPURoundRobinOpGenericAdaptor<::mlir::ValueRange> { +public: + using TPURoundRobinOpGenericAdaptor::TPURoundRobinOpGenericAdaptor; + TPURoundRobinOpAdaptor(TPURoundRobinOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TPURoundRobinOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = TPURoundRobinOpAdaptor; + template + using GenericAdaptor = TPURoundRobinOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TPURoundRobin"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getDeviceOrdinal(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type device_ordinal); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TPURoundRobinOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TakeDatasetOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TakeDatasetOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TakeDatasetOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TakeDatasetOpGenericAdaptorBase(TakeDatasetOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); +}; +} // namespace detail +template +class TakeDatasetOpGenericAdaptor : public detail::TakeDatasetOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TakeDatasetOpGenericAdaptorBase; +public: + TakeDatasetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TakeDatasetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TakeDatasetOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TakeDatasetOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputDataset() { + return (*getODSOperands(0).begin()); + } + + ValueT getCount() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TakeDatasetOpAdaptor : public TakeDatasetOpGenericAdaptor<::mlir::ValueRange> { +public: + using TakeDatasetOpGenericAdaptor::TakeDatasetOpGenericAdaptor; + TakeDatasetOpAdaptor(TakeDatasetOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TakeDatasetOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TakeDatasetOpAdaptor; + template + using GenericAdaptor = TakeDatasetOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("metadata"), ::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getMetadataAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getMetadataAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TakeDataset"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputDataset(); + ::mlir::TypedValue<::mlir::TensorType> getCount(); + ::mlir::OpOperand &getInputDatasetMutable(); + ::mlir::OpOperand &getCountMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + void setMetadataAttr(::mlir::StringAttr attr); + void setMetadata(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeMetadataAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, ::mlir::Value count, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, ::mlir::Value count, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, ::mlir::Value count, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::llvm::StringRef metadata = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, ::mlir::Value count, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::llvm::StringRef metadata = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TakeDatasetOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TakeWhileDatasetOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TakeWhileDatasetOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TakeWhileDatasetOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TakeWhileDatasetOpGenericAdaptorBase(TakeWhileDatasetOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::SymbolRefAttr getPredicateAttr(); + ::mlir::SymbolRefAttr getPredicate(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); +}; +} // namespace detail +template +class TakeWhileDatasetOpGenericAdaptor : public detail::TakeWhileDatasetOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TakeWhileDatasetOpGenericAdaptorBase; +public: + TakeWhileDatasetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TakeWhileDatasetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TakeWhileDatasetOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TakeWhileDatasetOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputDataset() { + return (*getODSOperands(0).begin()); + } + + RangeT getOtherArguments() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TakeWhileDatasetOpAdaptor : public TakeWhileDatasetOpGenericAdaptor<::mlir::ValueRange> { +public: + using TakeWhileDatasetOpGenericAdaptor::TakeWhileDatasetOpGenericAdaptor; + TakeWhileDatasetOpAdaptor(TakeWhileDatasetOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TakeWhileDatasetOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TakeWhileDatasetOpAdaptor; + template + using GenericAdaptor = TakeWhileDatasetOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Targuments"), ::llvm::StringRef("metadata"), ::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types"), ::llvm::StringRef("predicate")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTargumentsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTargumentsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getMetadataAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getMetadataAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getPredicateAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getPredicateAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TakeWhileDataset"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputDataset(); + ::mlir::Operation::operand_range getOtherArguments(); + ::mlir::OpOperand &getInputDatasetMutable(); + ::mlir::MutableOperandRange getOtherArgumentsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::SymbolRefAttr getPredicateAttr(); + ::mlir::SymbolRefAttr getPredicate(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); + mlir::OperandElementTypeRange getTarguments(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setPredicateAttr(::mlir::SymbolRefAttr attr); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + void setMetadataAttr(::mlir::StringAttr attr); + void setMetadata(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeMetadataAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, ::mlir::ValueRange other_arguments, ::mlir::SymbolRefAttr predicate, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, ::mlir::ValueRange other_arguments, ::mlir::SymbolRefAttr predicate, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, ::mlir::ValueRange other_arguments, ::mlir::SymbolRefAttr predicate, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::llvm::StringRef metadata = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, ::mlir::ValueRange other_arguments, ::mlir::SymbolRefAttr predicate, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::llvm::StringRef metadata = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TakeWhileDatasetOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TanOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TanOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TanOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TanOpGenericAdaptorBase(TanOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TanOpGenericAdaptor : public detail::TanOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TanOpGenericAdaptorBase; +public: + TanOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TanOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TanOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TanOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TanOpAdaptor : public TanOpGenericAdaptor<::mlir::ValueRange> { +public: + using TanOpGenericAdaptor::TanOpGenericAdaptor; + TanOpAdaptor(TanOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TanOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TanOpAdaptor; + template + using GenericAdaptor = TanOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Tan"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TanOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TanhGradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TanhGradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TanhGradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TanhGradOpGenericAdaptorBase(TanhGradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TanhGradOpGenericAdaptor : public detail::TanhGradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TanhGradOpGenericAdaptorBase; +public: + TanhGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TanhGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TanhGradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TanhGradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getY() { + return (*getODSOperands(0).begin()); + } + + ValueT getDy() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TanhGradOpAdaptor : public TanhGradOpGenericAdaptor<::mlir::ValueRange> { +public: + using TanhGradOpGenericAdaptor::TanhGradOpGenericAdaptor; + TanhGradOpAdaptor(TanhGradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TanhGradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TanhGradOpAdaptor; + template + using GenericAdaptor = TanhGradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TanhGrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::TypedValue<::mlir::TensorType> getDy(); + ::mlir::OpOperand &getYMutable(); + ::mlir::OpOperand &getDyMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value y, ::mlir::Value dy); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value y, ::mlir::Value dy); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value y, ::mlir::Value dy); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TanhGradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TanhOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TanhOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TanhOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TanhOpGenericAdaptorBase(TanhOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TanhOpGenericAdaptor : public detail::TanhOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TanhOpGenericAdaptorBase; +public: + TanhOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TanhOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TanhOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TanhOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TanhOpAdaptor : public TanhOpGenericAdaptor<::mlir::ValueRange> { +public: + using TanhOpGenericAdaptor::TanhOpGenericAdaptor; + TanhOpAdaptor(TanhOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TanhOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::LayoutAgnostic, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TanhOpAdaptor; + template + using GenericAdaptor = TanhOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Tanh"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TanhOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TensorArrayCloseV3Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorArrayCloseV3OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorArrayCloseV3OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorArrayCloseV3OpGenericAdaptorBase(TensorArrayCloseV3Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TensorArrayCloseV3OpGenericAdaptor : public detail::TensorArrayCloseV3OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorArrayCloseV3OpGenericAdaptorBase; +public: + TensorArrayCloseV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorArrayCloseV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorArrayCloseV3OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorArrayCloseV3OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getHandle() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorArrayCloseV3OpAdaptor : public TensorArrayCloseV3OpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorArrayCloseV3OpGenericAdaptor::TensorArrayCloseV3OpGenericAdaptor; + TensorArrayCloseV3OpAdaptor(TensorArrayCloseV3Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorArrayCloseV3Op : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorArrayCloseV3OpAdaptor; + template + using GenericAdaptor = TensorArrayCloseV3OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TensorArrayCloseV3"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::OpOperand &getHandleMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value handle); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value handle); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TensorArrayCloseV3Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TensorArrayConcatV3Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorArrayConcatV3OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorArrayConcatV3OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorArrayConcatV3OpGenericAdaptorBase(TensorArrayConcatV3Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Attribute getElementShapeExcept0Attr(); + std::optional> getElementShapeExcept0(); +}; +} // namespace detail +template +class TensorArrayConcatV3OpGenericAdaptor : public detail::TensorArrayConcatV3OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorArrayConcatV3OpGenericAdaptorBase; +public: + TensorArrayConcatV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorArrayConcatV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorArrayConcatV3OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorArrayConcatV3OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getFlowIn() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorArrayConcatV3OpAdaptor : public TensorArrayConcatV3OpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorArrayConcatV3OpGenericAdaptor::TensorArrayConcatV3OpGenericAdaptor; + TensorArrayConcatV3OpAdaptor(TensorArrayConcatV3Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorArrayConcatV3Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorArrayConcatV3OpAdaptor; + template + using GenericAdaptor = TensorArrayConcatV3OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dtype"), ::llvm::StringRef("element_shape_except0")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getElementShapeExcept0AttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getElementShapeExcept0AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TensorArrayConcatV3"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::TypedValue<::mlir::TensorType> getFlowIn(); + ::mlir::OpOperand &getHandleMutable(); + ::mlir::OpOperand &getFlowInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getValue(); + ::mlir::TypedValue<::mlir::TensorType> getLengths(); + ::mlir::Attribute getElementShapeExcept0Attr(); + std::optional> getElementShapeExcept0(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setElementShapeExcept0Attr(::mlir::Attribute attr); + void setElementShapeExcept0(::std::optional>> attrValue); + ::mlir::Attribute removeElementShapeExcept0Attr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type value, ::mlir::Type lengths, ::mlir::Value handle, ::mlir::Value flow_in, /*optional*/::mlir::Attribute element_shape_except0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value handle, ::mlir::Value flow_in, /*optional*/::mlir::Attribute element_shape_except0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type value, ::mlir::Type lengths, ::mlir::Value handle, ::mlir::Value flow_in, /*optional*/std::optional> element_shape_except0 = std::nullopt); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value handle, ::mlir::Value flow_in, /*optional*/std::optional> element_shape_except0 = std::nullopt); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TensorArrayConcatV3Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TensorArrayGatherV3Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorArrayGatherV3OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorArrayGatherV3OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorArrayGatherV3OpGenericAdaptorBase(TensorArrayGatherV3Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Attribute getElementShapeAttr(); + std::optional> getElementShape(); +}; +} // namespace detail +template +class TensorArrayGatherV3OpGenericAdaptor : public detail::TensorArrayGatherV3OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorArrayGatherV3OpGenericAdaptorBase; +public: + TensorArrayGatherV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorArrayGatherV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorArrayGatherV3OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorArrayGatherV3OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getFlowIn() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorArrayGatherV3OpAdaptor : public TensorArrayGatherV3OpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorArrayGatherV3OpGenericAdaptor::TensorArrayGatherV3OpGenericAdaptor; + TensorArrayGatherV3OpAdaptor(TensorArrayGatherV3Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorArrayGatherV3Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorArrayGatherV3OpAdaptor; + template + using GenericAdaptor = TensorArrayGatherV3OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dtype"), ::llvm::StringRef("element_shape")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getElementShapeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getElementShapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TensorArrayGatherV3"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getFlowIn(); + ::mlir::OpOperand &getHandleMutable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getFlowInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getValue(); + ::mlir::Attribute getElementShapeAttr(); + std::optional> getElementShape(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setElementShapeAttr(::mlir::Attribute attr); + void setElementShape(::std::optional>> attrValue); + ::mlir::Attribute removeElementShapeAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type value, ::mlir::Value handle, ::mlir::Value indices, ::mlir::Value flow_in, /*optional*/::mlir::Attribute element_shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value handle, ::mlir::Value indices, ::mlir::Value flow_in, /*optional*/::mlir::Attribute element_shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type value, ::mlir::Value handle, ::mlir::Value indices, ::mlir::Value flow_in, /*optional*/std::optional> element_shape = std::nullopt); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value handle, ::mlir::Value indices, ::mlir::Value flow_in, /*optional*/std::optional> element_shape = std::nullopt); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TensorArrayGatherV3Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TensorArrayGradV3Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorArrayGradV3OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorArrayGradV3OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorArrayGradV3OpGenericAdaptorBase(TensorArrayGradV3Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getSourceAttr(); + ::llvm::StringRef getSource(); +}; +} // namespace detail +template +class TensorArrayGradV3OpGenericAdaptor : public detail::TensorArrayGradV3OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorArrayGradV3OpGenericAdaptorBase; +public: + TensorArrayGradV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorArrayGradV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorArrayGradV3OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorArrayGradV3OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getFlowIn() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorArrayGradV3OpAdaptor : public TensorArrayGradV3OpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorArrayGradV3OpGenericAdaptor::TensorArrayGradV3OpGenericAdaptor; + TensorArrayGradV3OpAdaptor(TensorArrayGradV3Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorArrayGradV3Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpAsmOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorArrayGradV3OpAdaptor; + template + using GenericAdaptor = TensorArrayGradV3OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("source")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getSourceAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getSourceAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TensorArrayGradV3"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::TypedValue<::mlir::TensorType> getFlowIn(); + ::mlir::OpOperand &getHandleMutable(); + ::mlir::OpOperand &getFlowInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getGradHandle(); + ::mlir::TypedValue<::mlir::TensorType> getFlowOut(); + ::mlir::StringAttr getSourceAttr(); + ::llvm::StringRef getSource(); + void setSourceAttr(::mlir::StringAttr attr); + void setSource(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type grad_handle, ::mlir::Type flow_out, ::mlir::Value handle, ::mlir::Value flow_in, ::mlir::StringAttr source); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value handle, ::mlir::Value flow_in, ::mlir::StringAttr source); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type grad_handle, ::mlir::Type flow_out, ::mlir::Value handle, ::mlir::Value flow_in, ::llvm::StringRef source); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value handle, ::mlir::Value flow_in, ::llvm::StringRef source); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TensorArrayGradV3Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TensorArrayReadV3Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorArrayReadV3OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorArrayReadV3OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorArrayReadV3OpGenericAdaptorBase(TensorArrayReadV3Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TensorArrayReadV3OpGenericAdaptor : public detail::TensorArrayReadV3OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorArrayReadV3OpGenericAdaptorBase; +public: + TensorArrayReadV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorArrayReadV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorArrayReadV3OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorArrayReadV3OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndex() { + return (*getODSOperands(1).begin()); + } + + ValueT getFlowIn() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorArrayReadV3OpAdaptor : public TensorArrayReadV3OpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorArrayReadV3OpGenericAdaptor::TensorArrayReadV3OpGenericAdaptor; + TensorArrayReadV3OpAdaptor(TensorArrayReadV3Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorArrayReadV3Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorArrayReadV3OpAdaptor; + template + using GenericAdaptor = TensorArrayReadV3OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TensorArrayReadV3"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::TypedValue<::mlir::TensorType> getIndex(); + ::mlir::TypedValue<::mlir::TensorType> getFlowIn(); + ::mlir::OpOperand &getHandleMutable(); + ::mlir::OpOperand &getIndexMutable(); + ::mlir::OpOperand &getFlowInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getValue(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type value, ::mlir::Value handle, ::mlir::Value index, ::mlir::Value flow_in); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value handle, ::mlir::Value index, ::mlir::Value flow_in); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TensorArrayReadV3Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TensorArrayScatterV3Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorArrayScatterV3OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorArrayScatterV3OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorArrayScatterV3OpGenericAdaptorBase(TensorArrayScatterV3Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TensorArrayScatterV3OpGenericAdaptor : public detail::TensorArrayScatterV3OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorArrayScatterV3OpGenericAdaptorBase; +public: + TensorArrayScatterV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorArrayScatterV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorArrayScatterV3OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorArrayScatterV3OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getValue() { + return (*getODSOperands(2).begin()); + } + + ValueT getFlowIn() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorArrayScatterV3OpAdaptor : public TensorArrayScatterV3OpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorArrayScatterV3OpGenericAdaptor::TensorArrayScatterV3OpGenericAdaptor; + TensorArrayScatterV3OpAdaptor(TensorArrayScatterV3Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorArrayScatterV3Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorArrayScatterV3OpAdaptor; + template + using GenericAdaptor = TensorArrayScatterV3OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TensorArrayScatterV3"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getValue(); + ::mlir::TypedValue<::mlir::TensorType> getFlowIn(); + ::mlir::OpOperand &getHandleMutable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getValueMutable(); + ::mlir::OpOperand &getFlowInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getFlowOut(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type flow_out, ::mlir::Value handle, ::mlir::Value indices, ::mlir::Value value, ::mlir::Value flow_in); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value handle, ::mlir::Value indices, ::mlir::Value value, ::mlir::Value flow_in); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TensorArrayScatterV3Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TensorArraySizeV3Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorArraySizeV3OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorArraySizeV3OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorArraySizeV3OpGenericAdaptorBase(TensorArraySizeV3Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TensorArraySizeV3OpGenericAdaptor : public detail::TensorArraySizeV3OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorArraySizeV3OpGenericAdaptorBase; +public: + TensorArraySizeV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorArraySizeV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorArraySizeV3OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorArraySizeV3OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getFlowIn() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorArraySizeV3OpAdaptor : public TensorArraySizeV3OpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorArraySizeV3OpGenericAdaptor::TensorArraySizeV3OpGenericAdaptor; + TensorArraySizeV3OpAdaptor(TensorArraySizeV3Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorArraySizeV3Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorArraySizeV3OpAdaptor; + template + using GenericAdaptor = TensorArraySizeV3OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TensorArraySizeV3"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::TypedValue<::mlir::TensorType> getFlowIn(); + ::mlir::OpOperand &getHandleMutable(); + ::mlir::OpOperand &getFlowInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSize(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type size, ::mlir::Value handle, ::mlir::Value flow_in); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value handle, ::mlir::Value flow_in); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TensorArraySizeV3Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TensorArraySplitV3Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorArraySplitV3OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorArraySplitV3OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorArraySplitV3OpGenericAdaptorBase(TensorArraySplitV3Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TensorArraySplitV3OpGenericAdaptor : public detail::TensorArraySplitV3OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorArraySplitV3OpGenericAdaptorBase; +public: + TensorArraySplitV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorArraySplitV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorArraySplitV3OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorArraySplitV3OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getValue() { + return (*getODSOperands(1).begin()); + } + + ValueT getLengths() { + return (*getODSOperands(2).begin()); + } + + ValueT getFlowIn() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorArraySplitV3OpAdaptor : public TensorArraySplitV3OpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorArraySplitV3OpGenericAdaptor::TensorArraySplitV3OpGenericAdaptor; + TensorArraySplitV3OpAdaptor(TensorArraySplitV3Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorArraySplitV3Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorArraySplitV3OpAdaptor; + template + using GenericAdaptor = TensorArraySplitV3OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TensorArraySplitV3"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::TypedValue<::mlir::TensorType> getValue(); + ::mlir::TypedValue<::mlir::TensorType> getLengths(); + ::mlir::TypedValue<::mlir::TensorType> getFlowIn(); + ::mlir::OpOperand &getHandleMutable(); + ::mlir::OpOperand &getValueMutable(); + ::mlir::OpOperand &getLengthsMutable(); + ::mlir::OpOperand &getFlowInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getFlowOut(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type flow_out, ::mlir::Value handle, ::mlir::Value value, ::mlir::Value lengths, ::mlir::Value flow_in); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value handle, ::mlir::Value value, ::mlir::Value lengths, ::mlir::Value flow_in); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TensorArraySplitV3Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TensorArrayV3Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorArrayV3OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorArrayV3OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorArrayV3OpGenericAdaptorBase(TensorArrayV3Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::TypeAttr getDtypeAttr(); + ::mlir::Type getDtype(); + ::mlir::Attribute getElementShapeAttr(); + std::optional> getElementShape(); + ::mlir::BoolAttr getDynamicSizeAttr(); + bool getDynamicSize(); + ::mlir::BoolAttr getClearAfterReadAttr(); + bool getClearAfterRead(); + ::mlir::BoolAttr getIdenticalElementShapesAttr(); + bool getIdenticalElementShapes(); + ::mlir::StringAttr getTensorArrayNameAttr(); + ::llvm::StringRef getTensorArrayName(); +}; +} // namespace detail +template +class TensorArrayV3OpGenericAdaptor : public detail::TensorArrayV3OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorArrayV3OpGenericAdaptorBase; +public: + TensorArrayV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorArrayV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorArrayV3OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorArrayV3OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSize() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorArrayV3OpAdaptor : public TensorArrayV3OpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorArrayV3OpGenericAdaptor::TensorArrayV3OpGenericAdaptor; + TensorArrayV3OpAdaptor(TensorArrayV3Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorArrayV3Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::OpAsmOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorArrayV3OpAdaptor; + template + using GenericAdaptor = TensorArrayV3OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("clear_after_read"), ::llvm::StringRef("dtype"), ::llvm::StringRef("dynamic_size"), ::llvm::StringRef("element_shape"), ::llvm::StringRef("identical_element_shapes"), ::llvm::StringRef("tensor_array_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getClearAfterReadAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getClearAfterReadAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDynamicSizeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDynamicSizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getElementShapeAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getElementShapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getIdenticalElementShapesAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getIdenticalElementShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getTensorArrayNameAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getTensorArrayNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TensorArrayV3"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSize(); + ::mlir::OpOperand &getSizeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::TypedValue<::mlir::TensorType> getFlow(); + ::mlir::TypeAttr getDtypeAttr(); + ::mlir::Type getDtype(); + ::mlir::Attribute getElementShapeAttr(); + std::optional> getElementShape(); + ::mlir::BoolAttr getDynamicSizeAttr(); + bool getDynamicSize(); + ::mlir::BoolAttr getClearAfterReadAttr(); + bool getClearAfterRead(); + ::mlir::BoolAttr getIdenticalElementShapesAttr(); + bool getIdenticalElementShapes(); + ::mlir::StringAttr getTensorArrayNameAttr(); + ::llvm::StringRef getTensorArrayName(); + void setDtypeAttr(::mlir::TypeAttr attr); + void setDtype(::mlir::Type attrValue); + void setElementShapeAttr(::mlir::Attribute attr); + void setElementShape(::std::optional>> attrValue); + void setDynamicSizeAttr(::mlir::BoolAttr attr); + void setDynamicSize(::std::optional attrValue); + void setClearAfterReadAttr(::mlir::BoolAttr attr); + void setClearAfterRead(::std::optional attrValue); + void setIdenticalElementShapesAttr(::mlir::BoolAttr attr); + void setIdenticalElementShapes(::std::optional attrValue); + void setTensorArrayNameAttr(::mlir::StringAttr attr); + void setTensorArrayName(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeElementShapeAttr(); + ::mlir::Attribute removeDynamicSizeAttr(); + ::mlir::Attribute removeClearAfterReadAttr(); + ::mlir::Attribute removeIdenticalElementShapesAttr(); + ::mlir::Attribute removeTensorArrayNameAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Type flow, ::mlir::Value size, ::mlir::TypeAttr dtype, /*optional*/::mlir::Attribute element_shape, /*optional*/::mlir::BoolAttr dynamic_size, /*optional*/::mlir::BoolAttr clear_after_read, /*optional*/::mlir::BoolAttr identical_element_shapes, /*optional*/::mlir::StringAttr tensor_array_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value size, ::mlir::TypeAttr dtype, /*optional*/::mlir::Attribute element_shape, /*optional*/::mlir::BoolAttr dynamic_size, /*optional*/::mlir::BoolAttr clear_after_read, /*optional*/::mlir::BoolAttr identical_element_shapes, /*optional*/::mlir::StringAttr tensor_array_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Type flow, ::mlir::Value size, ::mlir::Type dtype, /*optional*/std::optional> element_shape = std::nullopt, /*optional*/bool dynamic_size = false, /*optional*/bool clear_after_read = true, /*optional*/bool identical_element_shapes = false, /*optional*/::llvm::StringRef tensor_array_name = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value size, ::mlir::Type dtype, /*optional*/std::optional> element_shape = std::nullopt, /*optional*/bool dynamic_size = false, /*optional*/bool clear_after_read = true, /*optional*/bool identical_element_shapes = false, /*optional*/::llvm::StringRef tensor_array_name = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TensorArrayV3Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TensorArrayWriteV3Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorArrayWriteV3OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorArrayWriteV3OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorArrayWriteV3OpGenericAdaptorBase(TensorArrayWriteV3Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TensorArrayWriteV3OpGenericAdaptor : public detail::TensorArrayWriteV3OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorArrayWriteV3OpGenericAdaptorBase; +public: + TensorArrayWriteV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorArrayWriteV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorArrayWriteV3OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorArrayWriteV3OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndex() { + return (*getODSOperands(1).begin()); + } + + ValueT getValue() { + return (*getODSOperands(2).begin()); + } + + ValueT getFlowIn() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorArrayWriteV3OpAdaptor : public TensorArrayWriteV3OpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorArrayWriteV3OpGenericAdaptor::TensorArrayWriteV3OpGenericAdaptor; + TensorArrayWriteV3OpAdaptor(TensorArrayWriteV3Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorArrayWriteV3Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorArrayWriteV3OpAdaptor; + template + using GenericAdaptor = TensorArrayWriteV3OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TensorArrayWriteV3"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::TypedValue<::mlir::TensorType> getIndex(); + ::mlir::TypedValue<::mlir::TensorType> getValue(); + ::mlir::TypedValue<::mlir::TensorType> getFlowIn(); + ::mlir::OpOperand &getHandleMutable(); + ::mlir::OpOperand &getIndexMutable(); + ::mlir::OpOperand &getValueMutable(); + ::mlir::OpOperand &getFlowInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getFlowOut(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type flow_out, ::mlir::Value handle, ::mlir::Value index, ::mlir::Value value, ::mlir::Value flow_in); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value handle, ::mlir::Value index, ::mlir::Value value, ::mlir::Value flow_in); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TensorArrayWriteV3Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TensorListConcatV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorListConcatV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorListConcatV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorListConcatV2OpGenericAdaptorBase(TensorListConcatV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TensorListConcatV2OpGenericAdaptor : public detail::TensorListConcatV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorListConcatV2OpGenericAdaptorBase; +public: + TensorListConcatV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorListConcatV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorListConcatV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorListConcatV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getElementShape() { + return (*getODSOperands(1).begin()); + } + + ValueT getLeadingDims() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorListConcatV2OpAdaptor : public TensorListConcatV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorListConcatV2OpGenericAdaptor::TensorListConcatV2OpGenericAdaptor; + TensorListConcatV2OpAdaptor(TensorListConcatV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorListConcatV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorListConcatV2OpAdaptor; + template + using GenericAdaptor = TensorListConcatV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("element_dtype"), ::llvm::StringRef("shape_type")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getElementDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getElementDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getShapeTypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getShapeTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TensorListConcatV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputHandle(); + ::mlir::TypedValue<::mlir::TensorType> getElementShape(); + ::mlir::TypedValue<::mlir::TensorType> getLeadingDims(); + ::mlir::OpOperand &getInputHandleMutable(); + ::mlir::OpOperand &getElementShapeMutable(); + ::mlir::OpOperand &getLeadingDimsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::TypedValue<::mlir::TensorType> getLengths(); + ::mlir::Type getShapeType(); + ::mlir::Type getElementDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type tensor, ::mlir::Type lengths, ::mlir::Value input_handle, ::mlir::Value element_shape, ::mlir::Value leading_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_handle, ::mlir::Value element_shape, ::mlir::Value leading_dims); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TensorListConcatV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TensorListElementShapeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorListElementShapeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorListElementShapeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorListElementShapeOpGenericAdaptorBase(TensorListElementShapeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TensorListElementShapeOpGenericAdaptor : public detail::TensorListElementShapeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorListElementShapeOpGenericAdaptorBase; +public: + TensorListElementShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorListElementShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorListElementShapeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorListElementShapeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputHandle() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorListElementShapeOpAdaptor : public TensorListElementShapeOpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorListElementShapeOpGenericAdaptor::TensorListElementShapeOpGenericAdaptor; + TensorListElementShapeOpAdaptor(TensorListElementShapeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorListElementShapeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorListElementShapeOpAdaptor; + template + using GenericAdaptor = TensorListElementShapeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("shape_type")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getShapeTypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getShapeTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TensorListElementShape"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputHandle(); + ::mlir::OpOperand &getInputHandleMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getElementShape(); + ::mlir::Type getShapeType(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type element_shape, ::mlir::Value input_handle); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_handle); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TensorListElementShapeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TensorListFromTensorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorListFromTensorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorListFromTensorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorListFromTensorOpGenericAdaptorBase(TensorListFromTensorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TensorListFromTensorOpGenericAdaptor : public detail::TensorListFromTensorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorListFromTensorOpGenericAdaptorBase; +public: + TensorListFromTensorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorListFromTensorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorListFromTensorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorListFromTensorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTensor() { + return (*getODSOperands(0).begin()); + } + + ValueT getElementShape() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorListFromTensorOpAdaptor : public TensorListFromTensorOpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorListFromTensorOpGenericAdaptor::TensorListFromTensorOpGenericAdaptor; + TensorListFromTensorOpAdaptor(TensorListFromTensorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorListFromTensorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorListFromTensorOpAdaptor; + template + using GenericAdaptor = TensorListFromTensorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("element_dtype"), ::llvm::StringRef("shape_type")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getElementDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getElementDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getShapeTypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getShapeTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TensorListFromTensor"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::TypedValue<::mlir::TensorType> getElementShape(); + ::mlir::OpOperand &getTensorMutable(); + ::mlir::OpOperand &getElementShapeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutputHandle(); + ::mlir::Type getElementDtype(); + ::mlir::Type getShapeType(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output_handle, ::mlir::Value tensor, ::mlir::Value element_shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tensor, ::mlir::Value element_shape); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TensorListFromTensorOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TensorListGatherOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorListGatherOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorListGatherOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorListGatherOpGenericAdaptorBase(TensorListGatherOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TensorListGatherOpGenericAdaptor : public detail::TensorListGatherOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorListGatherOpGenericAdaptorBase; +public: + TensorListGatherOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorListGatherOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorListGatherOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorListGatherOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getElementShape() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorListGatherOpAdaptor : public TensorListGatherOpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorListGatherOpGenericAdaptor::TensorListGatherOpGenericAdaptor; + TensorListGatherOpAdaptor(TensorListGatherOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorListGatherOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorListGatherOpAdaptor; + template + using GenericAdaptor = TensorListGatherOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("element_dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getElementDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getElementDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TensorListGather"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputHandle(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getElementShape(); + ::mlir::OpOperand &getInputHandleMutable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getElementShapeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getValues(); + ::mlir::Type getElementDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type values, ::mlir::Value input_handle, ::mlir::Value indices, ::mlir::Value element_shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_handle, ::mlir::Value indices, ::mlir::Value element_shape); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TensorListGatherOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TensorListGetItemOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorListGetItemOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorListGetItemOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorListGetItemOpGenericAdaptorBase(TensorListGetItemOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TensorListGetItemOpGenericAdaptor : public detail::TensorListGetItemOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorListGetItemOpGenericAdaptorBase; +public: + TensorListGetItemOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorListGetItemOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorListGetItemOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorListGetItemOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndex() { + return (*getODSOperands(1).begin()); + } + + ValueT getElementShape() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorListGetItemOpAdaptor : public TensorListGetItemOpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorListGetItemOpGenericAdaptor::TensorListGetItemOpGenericAdaptor; + TensorListGetItemOpAdaptor(TensorListGetItemOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorListGetItemOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorListGetItemOpAdaptor; + template + using GenericAdaptor = TensorListGetItemOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("element_dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getElementDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getElementDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TensorListGetItem"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputHandle(); + ::mlir::TypedValue<::mlir::TensorType> getIndex(); + ::mlir::TypedValue<::mlir::TensorType> getElementShape(); + ::mlir::OpOperand &getInputHandleMutable(); + ::mlir::OpOperand &getIndexMutable(); + ::mlir::OpOperand &getElementShapeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getItem(); + ::mlir::Type getElementDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type item, ::mlir::Value input_handle, ::mlir::Value index, ::mlir::Value element_shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_handle, ::mlir::Value index, ::mlir::Value element_shape); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TensorListGetItemOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TensorListLengthOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorListLengthOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorListLengthOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorListLengthOpGenericAdaptorBase(TensorListLengthOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TensorListLengthOpGenericAdaptor : public detail::TensorListLengthOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorListLengthOpGenericAdaptorBase; +public: + TensorListLengthOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorListLengthOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorListLengthOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorListLengthOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputHandle() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorListLengthOpAdaptor : public TensorListLengthOpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorListLengthOpGenericAdaptor::TensorListLengthOpGenericAdaptor; + TensorListLengthOpAdaptor(TensorListLengthOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorListLengthOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorListLengthOpAdaptor; + template + using GenericAdaptor = TensorListLengthOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TensorListLength"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputHandle(); + ::mlir::OpOperand &getInputHandleMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLength(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type length, ::mlir::Value input_handle); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_handle); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TensorListLengthOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TensorListPopBackOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorListPopBackOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorListPopBackOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorListPopBackOpGenericAdaptorBase(TensorListPopBackOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TensorListPopBackOpGenericAdaptor : public detail::TensorListPopBackOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorListPopBackOpGenericAdaptorBase; +public: + TensorListPopBackOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorListPopBackOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorListPopBackOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorListPopBackOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getElementShape() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorListPopBackOpAdaptor : public TensorListPopBackOpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorListPopBackOpGenericAdaptor::TensorListPopBackOpGenericAdaptor; + TensorListPopBackOpAdaptor(TensorListPopBackOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorListPopBackOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorListPopBackOpAdaptor; + template + using GenericAdaptor = TensorListPopBackOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("element_dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getElementDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getElementDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TensorListPopBack"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputHandle(); + ::mlir::TypedValue<::mlir::TensorType> getElementShape(); + ::mlir::OpOperand &getInputHandleMutable(); + ::mlir::OpOperand &getElementShapeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutputHandle(); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::Type getElementDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output_handle, ::mlir::Type tensor, ::mlir::Value input_handle, ::mlir::Value element_shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_handle, ::mlir::Value element_shape); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TensorListPopBackOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TensorListPushBackOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorListPushBackOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorListPushBackOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorListPushBackOpGenericAdaptorBase(TensorListPushBackOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TensorListPushBackOpGenericAdaptor : public detail::TensorListPushBackOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorListPushBackOpGenericAdaptorBase; +public: + TensorListPushBackOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorListPushBackOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorListPushBackOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorListPushBackOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getTensor() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorListPushBackOpAdaptor : public TensorListPushBackOpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorListPushBackOpGenericAdaptor::TensorListPushBackOpGenericAdaptor; + TensorListPushBackOpAdaptor(TensorListPushBackOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorListPushBackOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorListPushBackOpAdaptor; + template + using GenericAdaptor = TensorListPushBackOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("element_dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getElementDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getElementDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TensorListPushBack"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputHandle(); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::OpOperand &getInputHandleMutable(); + ::mlir::OpOperand &getTensorMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutputHandle(); + ::mlir::Type getElementDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output_handle, ::mlir::Value input_handle, ::mlir::Value tensor); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_handle, ::mlir::Value tensor); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TensorListPushBackOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TensorListReserveOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorListReserveOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorListReserveOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorListReserveOpGenericAdaptorBase(TensorListReserveOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TensorListReserveOpGenericAdaptor : public detail::TensorListReserveOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorListReserveOpGenericAdaptorBase; +public: + TensorListReserveOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorListReserveOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorListReserveOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorListReserveOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getElementShape() { + return (*getODSOperands(0).begin()); + } + + ValueT getNumElements() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorListReserveOpAdaptor : public TensorListReserveOpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorListReserveOpGenericAdaptor::TensorListReserveOpGenericAdaptor; + TensorListReserveOpAdaptor(TensorListReserveOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorListReserveOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorListReserveOpAdaptor; + template + using GenericAdaptor = TensorListReserveOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("element_dtype"), ::llvm::StringRef("shape_type")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getElementDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getElementDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getShapeTypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getShapeTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TensorListReserve"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getElementShape(); + ::mlir::TypedValue<::mlir::TensorType> getNumElements(); + ::mlir::OpOperand &getElementShapeMutable(); + ::mlir::OpOperand &getNumElementsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::Type getShapeType(); + ::mlir::Type getElementDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value element_shape, ::mlir::Value num_elements); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value element_shape, ::mlir::Value num_elements); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Returns type of the TensorList element produced by this op. + TensorType element_type() { return handle_dtype().getSubtypes()[0]; } + + // Returns data type of the result handle. Returned type contains type of + // the TensorList element as a subtype. + VariantType handle_dtype() { + return getElementTypeOrSelf(getHandle().getType()).cast(); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TensorListReserveOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TensorListResizeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorListResizeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorListResizeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorListResizeOpGenericAdaptorBase(TensorListResizeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TensorListResizeOpGenericAdaptor : public detail::TensorListResizeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorListResizeOpGenericAdaptorBase; +public: + TensorListResizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorListResizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorListResizeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorListResizeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getSize() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorListResizeOpAdaptor : public TensorListResizeOpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorListResizeOpGenericAdaptor::TensorListResizeOpGenericAdaptor; + TensorListResizeOpAdaptor(TensorListResizeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorListResizeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorListResizeOpAdaptor; + template + using GenericAdaptor = TensorListResizeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TensorListResize"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputHandle(); + ::mlir::TypedValue<::mlir::TensorType> getSize(); + ::mlir::OpOperand &getInputHandleMutable(); + ::mlir::OpOperand &getSizeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutputHandle(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output_handle, ::mlir::Value input_handle, ::mlir::Value size); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_handle, ::mlir::Value size); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TensorListResizeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TensorListScatterIntoExistingListOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorListScatterIntoExistingListOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorListScatterIntoExistingListOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorListScatterIntoExistingListOpGenericAdaptorBase(TensorListScatterIntoExistingListOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TensorListScatterIntoExistingListOpGenericAdaptor : public detail::TensorListScatterIntoExistingListOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorListScatterIntoExistingListOpGenericAdaptorBase; +public: + TensorListScatterIntoExistingListOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorListScatterIntoExistingListOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorListScatterIntoExistingListOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorListScatterIntoExistingListOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getTensor() { + return (*getODSOperands(1).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorListScatterIntoExistingListOpAdaptor : public TensorListScatterIntoExistingListOpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorListScatterIntoExistingListOpGenericAdaptor::TensorListScatterIntoExistingListOpGenericAdaptor; + TensorListScatterIntoExistingListOpAdaptor(TensorListScatterIntoExistingListOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorListScatterIntoExistingListOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorListScatterIntoExistingListOpAdaptor; + template + using GenericAdaptor = TensorListScatterIntoExistingListOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("element_dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getElementDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getElementDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TensorListScatterIntoExistingList"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputHandle(); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::OpOperand &getInputHandleMutable(); + ::mlir::OpOperand &getTensorMutable(); + ::mlir::OpOperand &getIndicesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutputHandle(); + ::mlir::Type getElementDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output_handle, ::mlir::Value input_handle, ::mlir::Value tensor, ::mlir::Value indices); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_handle, ::mlir::Value tensor, ::mlir::Value indices); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TensorListScatterIntoExistingListOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TensorListSetItemOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorListSetItemOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorListSetItemOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorListSetItemOpGenericAdaptorBase(TensorListSetItemOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getResizeIfIndexOutOfBoundsAttr(); + bool getResizeIfIndexOutOfBounds(); +}; +} // namespace detail +template +class TensorListSetItemOpGenericAdaptor : public detail::TensorListSetItemOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorListSetItemOpGenericAdaptorBase; +public: + TensorListSetItemOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorListSetItemOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorListSetItemOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorListSetItemOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndex() { + return (*getODSOperands(1).begin()); + } + + ValueT getItem() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorListSetItemOpAdaptor : public TensorListSetItemOpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorListSetItemOpGenericAdaptor::TensorListSetItemOpGenericAdaptor; + TensorListSetItemOpAdaptor(TensorListSetItemOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorListSetItemOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorListSetItemOpAdaptor; + template + using GenericAdaptor = TensorListSetItemOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("element_dtype"), ::llvm::StringRef("resize_if_index_out_of_bounds")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getElementDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getElementDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getResizeIfIndexOutOfBoundsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getResizeIfIndexOutOfBoundsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TensorListSetItem"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputHandle(); + ::mlir::TypedValue<::mlir::TensorType> getIndex(); + ::mlir::TypedValue<::mlir::TensorType> getItem(); + ::mlir::OpOperand &getInputHandleMutable(); + ::mlir::OpOperand &getIndexMutable(); + ::mlir::OpOperand &getItemMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutputHandle(); + ::mlir::BoolAttr getResizeIfIndexOutOfBoundsAttr(); + bool getResizeIfIndexOutOfBounds(); + ::mlir::Type getElementDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setResizeIfIndexOutOfBoundsAttr(::mlir::BoolAttr attr); + void setResizeIfIndexOutOfBounds(::std::optional attrValue); + ::mlir::Attribute removeResizeIfIndexOutOfBoundsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output_handle, ::mlir::Value input_handle, ::mlir::Value index, ::mlir::Value item, /*optional*/::mlir::BoolAttr resize_if_index_out_of_bounds); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_handle, ::mlir::Value index, ::mlir::Value item, /*optional*/::mlir::BoolAttr resize_if_index_out_of_bounds); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output_handle, ::mlir::Value input_handle, ::mlir::Value index, ::mlir::Value item, /*optional*/bool resize_if_index_out_of_bounds = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_handle, ::mlir::Value index, ::mlir::Value item, /*optional*/bool resize_if_index_out_of_bounds = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TensorListSetItemOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TensorListStackOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorListStackOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorListStackOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorListStackOpGenericAdaptorBase(TensorListStackOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getNumElementsAttr(); + uint64_t getNumElements(); +}; +} // namespace detail +template +class TensorListStackOpGenericAdaptor : public detail::TensorListStackOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorListStackOpGenericAdaptorBase; +public: + TensorListStackOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorListStackOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorListStackOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorListStackOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getElementShape() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorListStackOpAdaptor : public TensorListStackOpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorListStackOpGenericAdaptor::TensorListStackOpGenericAdaptor; + TensorListStackOpAdaptor(TensorListStackOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorListStackOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorListStackOpAdaptor; + template + using GenericAdaptor = TensorListStackOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("element_dtype"), ::llvm::StringRef("num_elements")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getElementDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getElementDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumElementsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumElementsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TensorListStack"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputHandle(); + ::mlir::TypedValue<::mlir::TensorType> getElementShape(); + ::mlir::OpOperand &getInputHandleMutable(); + ::mlir::OpOperand &getElementShapeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::IntegerAttr getNumElementsAttr(); + uint64_t getNumElements(); + ::mlir::Type getElementDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setNumElementsAttr(::mlir::IntegerAttr attr); + void setNumElements(::std::optional attrValue); + ::mlir::Attribute removeNumElementsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type tensor, ::mlir::Value input_handle, ::mlir::Value element_shape, /*optional*/::mlir::IntegerAttr num_elements); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_handle, ::mlir::Value element_shape, /*optional*/::mlir::IntegerAttr num_elements); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type tensor, ::mlir::Value input_handle, ::mlir::Value element_shape, /*optional*/uint64_t num_elements = -1); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_handle, ::mlir::Value element_shape, /*optional*/uint64_t num_elements = -1); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TensorListStackOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TensorScatterAddOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorScatterAddOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorScatterAddOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorScatterAddOpGenericAdaptorBase(TensorScatterAddOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TensorScatterAddOpGenericAdaptor : public detail::TensorScatterAddOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorScatterAddOpGenericAdaptorBase; +public: + TensorScatterAddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorScatterAddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorScatterAddOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorScatterAddOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTensor() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getUpdates() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorScatterAddOpAdaptor : public TensorScatterAddOpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorScatterAddOpGenericAdaptor::TensorScatterAddOpGenericAdaptor; + TensorScatterAddOpAdaptor(TensorScatterAddOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorScatterAddOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorScatterAddOpAdaptor; + template + using GenericAdaptor = TensorScatterAddOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TensorScatterAdd"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getUpdates(); + ::mlir::OpOperand &getTensorMutable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getUpdatesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value tensor, Value indices, Value updates); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value tensor, ::mlir::Value indices, ::mlir::Value updates); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tensor, ::mlir::Value indices, ::mlir::Value updates); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TensorScatterAddOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TensorScatterMaxOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorScatterMaxOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorScatterMaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorScatterMaxOpGenericAdaptorBase(TensorScatterMaxOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TensorScatterMaxOpGenericAdaptor : public detail::TensorScatterMaxOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorScatterMaxOpGenericAdaptorBase; +public: + TensorScatterMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorScatterMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorScatterMaxOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorScatterMaxOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTensor() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getUpdates() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorScatterMaxOpAdaptor : public TensorScatterMaxOpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorScatterMaxOpGenericAdaptor::TensorScatterMaxOpGenericAdaptor; + TensorScatterMaxOpAdaptor(TensorScatterMaxOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorScatterMaxOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorScatterMaxOpAdaptor; + template + using GenericAdaptor = TensorScatterMaxOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TensorScatterMax"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getUpdates(); + ::mlir::OpOperand &getTensorMutable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getUpdatesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value tensor, ::mlir::Value indices, ::mlir::Value updates); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tensor, ::mlir::Value indices, ::mlir::Value updates); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TensorScatterMaxOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TensorScatterMinOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorScatterMinOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorScatterMinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorScatterMinOpGenericAdaptorBase(TensorScatterMinOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TensorScatterMinOpGenericAdaptor : public detail::TensorScatterMinOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorScatterMinOpGenericAdaptorBase; +public: + TensorScatterMinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorScatterMinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorScatterMinOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorScatterMinOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTensor() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getUpdates() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorScatterMinOpAdaptor : public TensorScatterMinOpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorScatterMinOpGenericAdaptor::TensorScatterMinOpGenericAdaptor; + TensorScatterMinOpAdaptor(TensorScatterMinOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorScatterMinOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorScatterMinOpAdaptor; + template + using GenericAdaptor = TensorScatterMinOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TensorScatterMin"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getUpdates(); + ::mlir::OpOperand &getTensorMutable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getUpdatesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value tensor, ::mlir::Value indices, ::mlir::Value updates); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tensor, ::mlir::Value indices, ::mlir::Value updates); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TensorScatterMinOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TensorScatterSubOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorScatterSubOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorScatterSubOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorScatterSubOpGenericAdaptorBase(TensorScatterSubOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TensorScatterSubOpGenericAdaptor : public detail::TensorScatterSubOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorScatterSubOpGenericAdaptorBase; +public: + TensorScatterSubOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorScatterSubOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorScatterSubOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorScatterSubOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTensor() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getUpdates() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorScatterSubOpAdaptor : public TensorScatterSubOpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorScatterSubOpGenericAdaptor::TensorScatterSubOpGenericAdaptor; + TensorScatterSubOpAdaptor(TensorScatterSubOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorScatterSubOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorScatterSubOpAdaptor; + template + using GenericAdaptor = TensorScatterSubOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TensorScatterSub"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getUpdates(); + ::mlir::OpOperand &getTensorMutable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getUpdatesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value tensor, ::mlir::Value indices, ::mlir::Value updates); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tensor, ::mlir::Value indices, ::mlir::Value updates); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TensorScatterSubOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TensorScatterUpdateOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorScatterUpdateOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorScatterUpdateOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorScatterUpdateOpGenericAdaptorBase(TensorScatterUpdateOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TensorScatterUpdateOpGenericAdaptor : public detail::TensorScatterUpdateOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorScatterUpdateOpGenericAdaptorBase; +public: + TensorScatterUpdateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorScatterUpdateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorScatterUpdateOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorScatterUpdateOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTensor() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getUpdates() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorScatterUpdateOpAdaptor : public TensorScatterUpdateOpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorScatterUpdateOpGenericAdaptor::TensorScatterUpdateOpGenericAdaptor; + TensorScatterUpdateOpAdaptor(TensorScatterUpdateOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorScatterUpdateOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorScatterUpdateOpAdaptor; + template + using GenericAdaptor = TensorScatterUpdateOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TensorScatterUpdate"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getUpdates(); + ::mlir::OpOperand &getTensorMutable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getUpdatesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value tensor, Value indices, Value updates); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value tensor, ::mlir::Value indices, ::mlir::Value updates); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tensor, ::mlir::Value indices, ::mlir::Value updates); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TensorScatterUpdateOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TensorSliceDatasetOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorSliceDatasetOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorSliceDatasetOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorSliceDatasetOpGenericAdaptorBase(TensorSliceDatasetOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::BoolAttr getIsFilesAttr(); + bool getIsFiles(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); + ::mlir::BoolAttr getReplicateOnSplitAttr(); + bool getReplicateOnSplit(); +}; +} // namespace detail +template +class TensorSliceDatasetOpGenericAdaptor : public detail::TensorSliceDatasetOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorSliceDatasetOpGenericAdaptorBase; +public: + TensorSliceDatasetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorSliceDatasetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorSliceDatasetOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorSliceDatasetOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getComponents() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorSliceDatasetOpAdaptor : public TensorSliceDatasetOpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorSliceDatasetOpGenericAdaptor::TensorSliceDatasetOpGenericAdaptor; + TensorSliceDatasetOpAdaptor(TensorSliceDatasetOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorSliceDatasetOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorSliceDatasetOpAdaptor; + template + using GenericAdaptor = TensorSliceDatasetOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Toutput_types"), ::llvm::StringRef("is_files"), ::llvm::StringRef("metadata"), ::llvm::StringRef("output_shapes"), ::llvm::StringRef("replicate_on_split")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getToutputTypesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getToutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getIsFilesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getIsFilesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getMetadataAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getMetadataAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getReplicateOnSplitAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getReplicateOnSplitAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TensorSliceDataset"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getComponents(); + ::mlir::MutableOperandRange getComponentsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::BoolAttr getIsFilesAttr(); + bool getIsFiles(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); + ::mlir::BoolAttr getReplicateOnSplitAttr(); + bool getReplicateOnSplit(); + mlir::OperandElementTypeRange getToutputTypes(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + void setIsFilesAttr(::mlir::BoolAttr attr); + void setIsFiles(::std::optional attrValue); + void setMetadataAttr(::mlir::StringAttr attr); + void setMetadata(::std::optional<::llvm::StringRef> attrValue); + void setReplicateOnSplitAttr(::mlir::BoolAttr attr); + void setReplicateOnSplit(::std::optional attrValue); + ::mlir::Attribute removeIsFilesAttr(); + ::mlir::Attribute removeMetadataAttr(); + ::mlir::Attribute removeReplicateOnSplitAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::ValueRange components, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::BoolAttr is_files, /*optional*/::mlir::StringAttr metadata, /*optional*/::mlir::BoolAttr replicate_on_split); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange components, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::BoolAttr is_files, /*optional*/::mlir::StringAttr metadata, /*optional*/::mlir::BoolAttr replicate_on_split); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::ValueRange components, ::mlir::ArrayAttr output_shapes, /*optional*/bool is_files = false, /*optional*/::llvm::StringRef metadata = "", /*optional*/bool replicate_on_split = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange components, ::mlir::ArrayAttr output_shapes, /*optional*/bool is_files = false, /*optional*/::llvm::StringRef metadata = "", /*optional*/bool replicate_on_split = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TensorSliceDatasetOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TensorStridedSliceUpdateOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorStridedSliceUpdateOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorStridedSliceUpdateOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorStridedSliceUpdateOpGenericAdaptorBase(TensorStridedSliceUpdateOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getBeginMaskAttr(); + uint64_t getBeginMask(); + ::mlir::IntegerAttr getEndMaskAttr(); + uint64_t getEndMask(); + ::mlir::IntegerAttr getEllipsisMaskAttr(); + uint64_t getEllipsisMask(); + ::mlir::IntegerAttr getNewAxisMaskAttr(); + uint64_t getNewAxisMask(); + ::mlir::IntegerAttr getShrinkAxisMaskAttr(); + uint64_t getShrinkAxisMask(); +}; +} // namespace detail +template +class TensorStridedSliceUpdateOpGenericAdaptor : public detail::TensorStridedSliceUpdateOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorStridedSliceUpdateOpGenericAdaptorBase; +public: + TensorStridedSliceUpdateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorStridedSliceUpdateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorStridedSliceUpdateOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorStridedSliceUpdateOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getBegin() { + return (*getODSOperands(1).begin()); + } + + ValueT getEnd() { + return (*getODSOperands(2).begin()); + } + + ValueT getStrides() { + return (*getODSOperands(3).begin()); + } + + ValueT getValue() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorStridedSliceUpdateOpAdaptor : public TensorStridedSliceUpdateOpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorStridedSliceUpdateOpGenericAdaptor::TensorStridedSliceUpdateOpGenericAdaptor; + TensorStridedSliceUpdateOpAdaptor(TensorStridedSliceUpdateOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorStridedSliceUpdateOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<5>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorStridedSliceUpdateOpAdaptor; + template + using GenericAdaptor = TensorStridedSliceUpdateOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Index"), ::llvm::StringRef("T"), ::llvm::StringRef("begin_mask"), ::llvm::StringRef("ellipsis_mask"), ::llvm::StringRef("end_mask"), ::llvm::StringRef("new_axis_mask"), ::llvm::StringRef("shrink_axis_mask")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getIndexAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getIndexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getBeginMaskAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getBeginMaskAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getEllipsisMaskAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getEllipsisMaskAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getEndMaskAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getEndMaskAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getNewAxisMaskAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getNewAxisMaskAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getShrinkAxisMaskAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getShrinkAxisMaskAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TensorStridedSliceUpdate"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getBegin(); + ::mlir::TypedValue<::mlir::TensorType> getEnd(); + ::mlir::TypedValue<::mlir::TensorType> getStrides(); + ::mlir::TypedValue<::mlir::TensorType> getValue(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getBeginMutable(); + ::mlir::OpOperand &getEndMutable(); + ::mlir::OpOperand &getStridesMutable(); + ::mlir::OpOperand &getValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getBeginMaskAttr(); + uint64_t getBeginMask(); + ::mlir::IntegerAttr getEndMaskAttr(); + uint64_t getEndMask(); + ::mlir::IntegerAttr getEllipsisMaskAttr(); + uint64_t getEllipsisMask(); + ::mlir::IntegerAttr getNewAxisMaskAttr(); + uint64_t getNewAxisMask(); + ::mlir::IntegerAttr getShrinkAxisMaskAttr(); + uint64_t getShrinkAxisMask(); + ::mlir::Type getIndex(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setBeginMaskAttr(::mlir::IntegerAttr attr); + void setBeginMask(::std::optional attrValue); + void setEndMaskAttr(::mlir::IntegerAttr attr); + void setEndMask(::std::optional attrValue); + void setEllipsisMaskAttr(::mlir::IntegerAttr attr); + void setEllipsisMask(::std::optional attrValue); + void setNewAxisMaskAttr(::mlir::IntegerAttr attr); + void setNewAxisMask(::std::optional attrValue); + void setShrinkAxisMaskAttr(::mlir::IntegerAttr attr); + void setShrinkAxisMask(::std::optional attrValue); + ::mlir::Attribute removeBeginMaskAttr(); + ::mlir::Attribute removeEndMaskAttr(); + ::mlir::Attribute removeEllipsisMaskAttr(); + ::mlir::Attribute removeNewAxisMaskAttr(); + ::mlir::Attribute removeShrinkAxisMaskAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value begin, ::mlir::Value end, ::mlir::Value strides, ::mlir::Value value, /*optional*/::mlir::IntegerAttr begin_mask, /*optional*/::mlir::IntegerAttr end_mask, /*optional*/::mlir::IntegerAttr ellipsis_mask, /*optional*/::mlir::IntegerAttr new_axis_mask, /*optional*/::mlir::IntegerAttr shrink_axis_mask); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value begin, ::mlir::Value end, ::mlir::Value strides, ::mlir::Value value, /*optional*/::mlir::IntegerAttr begin_mask, /*optional*/::mlir::IntegerAttr end_mask, /*optional*/::mlir::IntegerAttr ellipsis_mask, /*optional*/::mlir::IntegerAttr new_axis_mask, /*optional*/::mlir::IntegerAttr shrink_axis_mask); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value begin, ::mlir::Value end, ::mlir::Value strides, ::mlir::Value value, /*optional*/uint64_t begin_mask = 0, /*optional*/uint64_t end_mask = 0, /*optional*/uint64_t ellipsis_mask = 0, /*optional*/uint64_t new_axis_mask = 0, /*optional*/uint64_t shrink_axis_mask = 0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value begin, ::mlir::Value end, ::mlir::Value strides, ::mlir::Value value, /*optional*/uint64_t begin_mask = 0, /*optional*/uint64_t end_mask = 0, /*optional*/uint64_t ellipsis_mask = 0, /*optional*/uint64_t new_axis_mask = 0, /*optional*/uint64_t shrink_axis_mask = 0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 7 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TensorStridedSliceUpdateOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TileOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TileOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TileOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TileOpGenericAdaptorBase(TileOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TileOpGenericAdaptor : public detail::TileOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TileOpGenericAdaptorBase; +public: + TileOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TileOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TileOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TileOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getMultiples() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TileOpAdaptor : public TileOpGenericAdaptor<::mlir::ValueRange> { +public: + using TileOpGenericAdaptor::TileOpGenericAdaptor; + TileOpAdaptor(TileOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TileOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TileOpAdaptor; + template + using GenericAdaptor = TileOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tmultiples")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTmultiplesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTmultiplesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Tile"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getMultiples(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getMultiplesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTmultiples(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value multiples); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value multiples); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TileOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TimestampOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TimestampOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TimestampOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TimestampOpGenericAdaptorBase(TimestampOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TimestampOpGenericAdaptor : public detail::TimestampOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TimestampOpGenericAdaptorBase; +public: + TimestampOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TimestampOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TimestampOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TimestampOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TimestampOpAdaptor : public TimestampOpGenericAdaptor<::mlir::ValueRange> { +public: + using TimestampOpGenericAdaptor::TimestampOpGenericAdaptor; + TimestampOpAdaptor(TimestampOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TimestampOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = TimestampOpAdaptor; + template + using GenericAdaptor = TimestampOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Timestamp"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTs(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type ts); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TimestampOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ToBoolOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ToBoolOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ToBoolOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ToBoolOpGenericAdaptorBase(ToBoolOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ToBoolOpGenericAdaptor : public detail::ToBoolOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ToBoolOpGenericAdaptorBase; +public: + ToBoolOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ToBoolOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ToBoolOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ToBoolOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ToBoolOpAdaptor : public ToBoolOpGenericAdaptor<::mlir::ValueRange> { +public: + using ToBoolOpGenericAdaptor::ToBoolOpGenericAdaptor; + ToBoolOpAdaptor(ToBoolOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ToBoolOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::InferTypeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ToBoolOpAdaptor; + template + using GenericAdaptor = ToBoolOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ToBool"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // InferTypeOpInterface: + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return ArraysAreCastCompatible(l, r); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ToBoolOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TopKUniqueOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TopKUniqueOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TopKUniqueOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TopKUniqueOpGenericAdaptorBase(TopKUniqueOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getKAttr(); + uint64_t getK(); +}; +} // namespace detail +template +class TopKUniqueOpGenericAdaptor : public detail::TopKUniqueOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TopKUniqueOpGenericAdaptorBase; +public: + TopKUniqueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TopKUniqueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TopKUniqueOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TopKUniqueOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TopKUniqueOpAdaptor : public TopKUniqueOpGenericAdaptor<::mlir::ValueRange> { +public: + using TopKUniqueOpGenericAdaptor::TopKUniqueOpGenericAdaptor; + TopKUniqueOpAdaptor(TopKUniqueOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TopKUniqueOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TopKUniqueOpAdaptor; + template + using GenericAdaptor = TopKUniqueOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("k")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getKAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getKAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TopKUnique"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTopk(); + ::mlir::TypedValue<::mlir::TensorType> getTopkIndices(); + ::mlir::IntegerAttr getKAttr(); + uint64_t getK(); + void setKAttr(::mlir::IntegerAttr attr); + void setK(uint64_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type topk, ::mlir::Type topk_indices, ::mlir::Value input, ::mlir::IntegerAttr k); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::IntegerAttr k); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type topk, ::mlir::Type topk_indices, ::mlir::Value input, uint64_t k); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, uint64_t k); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TopKUniqueOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TopKV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TopKV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TopKV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TopKV2OpGenericAdaptorBase(TopKV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getSortedAttr(); + bool getSorted(); +}; +} // namespace detail +template +class TopKV2OpGenericAdaptor : public detail::TopKV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TopKV2OpGenericAdaptorBase; +public: + TopKV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TopKV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TopKV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TopKV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getK() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TopKV2OpAdaptor : public TopKV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using TopKV2OpGenericAdaptor::TopKV2OpGenericAdaptor; + TopKV2OpAdaptor(TopKV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TopKV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TopKV2OpAdaptor; + template + using GenericAdaptor = TopKV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tk"), ::llvm::StringRef("index_type"), ::llvm::StringRef("sorted")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTkAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTkAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getIndexTypeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getIndexTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSortedAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSortedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TopKV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getK(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getKMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getValues(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::BoolAttr getSortedAttr(); + bool getSorted(); + ::mlir::Type getT(); + ::mlir::Type getTk(); + ::mlir::Type getIndexType(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setSortedAttr(::mlir::BoolAttr attr); + void setSorted(::std::optional attrValue); + ::mlir::Attribute removeSortedAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type values, ::mlir::Type indices, ::mlir::Value input, ::mlir::Value k, /*optional*/::mlir::BoolAttr sorted); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value k, /*optional*/::mlir::BoolAttr sorted); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type values, ::mlir::Type indices, ::mlir::Value input, ::mlir::Value k, /*optional*/bool sorted = true); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value k, /*optional*/bool sorted = true); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TopKV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TopKWithUniqueOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TopKWithUniqueOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TopKWithUniqueOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TopKWithUniqueOpGenericAdaptorBase(TopKWithUniqueOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getKAttr(); + uint64_t getK(); +}; +} // namespace detail +template +class TopKWithUniqueOpGenericAdaptor : public detail::TopKWithUniqueOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TopKWithUniqueOpGenericAdaptorBase; +public: + TopKWithUniqueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TopKWithUniqueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TopKWithUniqueOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TopKWithUniqueOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TopKWithUniqueOpAdaptor : public TopKWithUniqueOpGenericAdaptor<::mlir::ValueRange> { +public: + using TopKWithUniqueOpGenericAdaptor::TopKWithUniqueOpGenericAdaptor; + TopKWithUniqueOpAdaptor(TopKWithUniqueOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TopKWithUniqueOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TopKWithUniqueOpAdaptor; + template + using GenericAdaptor = TopKWithUniqueOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("k")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getKAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getKAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TopKWithUnique"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTopk(); + ::mlir::TypedValue<::mlir::TensorType> getTopkIndices(); + ::mlir::IntegerAttr getKAttr(); + uint64_t getK(); + void setKAttr(::mlir::IntegerAttr attr); + void setK(uint64_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type topk, ::mlir::Type topk_indices, ::mlir::Value input, ::mlir::IntegerAttr k); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::IntegerAttr k); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type topk, ::mlir::Type topk_indices, ::mlir::Value input, uint64_t k); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, uint64_t k); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TopKWithUniqueOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TransposeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TransposeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TransposeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TransposeOpGenericAdaptorBase(TransposeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TransposeOpGenericAdaptor : public detail::TransposeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TransposeOpGenericAdaptorBase; +public: + TransposeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TransposeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TransposeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TransposeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getPerm() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TransposeOpAdaptor : public TransposeOpGenericAdaptor<::mlir::ValueRange> { +public: + using TransposeOpGenericAdaptor::TransposeOpGenericAdaptor; + TransposeOpAdaptor(TransposeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TransposeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TransposeOpAdaptor; + template + using GenericAdaptor = TransposeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tperm")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTpermAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTpermAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Transpose"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getPerm(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getPermMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + ::mlir::Type getTperm(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value perm); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x, ::mlir::Value perm); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value perm); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TransposeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TridiagonalMatMulOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TridiagonalMatMulOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TridiagonalMatMulOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TridiagonalMatMulOpGenericAdaptorBase(TridiagonalMatMulOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TridiagonalMatMulOpGenericAdaptor : public detail::TridiagonalMatMulOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TridiagonalMatMulOpGenericAdaptorBase; +public: + TridiagonalMatMulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TridiagonalMatMulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TridiagonalMatMulOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TridiagonalMatMulOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSuperdiag() { + return (*getODSOperands(0).begin()); + } + + ValueT getMaindiag() { + return (*getODSOperands(1).begin()); + } + + ValueT getSubdiag() { + return (*getODSOperands(2).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TridiagonalMatMulOpAdaptor : public TridiagonalMatMulOpGenericAdaptor<::mlir::ValueRange> { +public: + using TridiagonalMatMulOpGenericAdaptor::TridiagonalMatMulOpGenericAdaptor; + TridiagonalMatMulOpAdaptor(TridiagonalMatMulOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TridiagonalMatMulOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TridiagonalMatMulOpAdaptor; + template + using GenericAdaptor = TridiagonalMatMulOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TridiagonalMatMul"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSuperdiag(); + ::mlir::TypedValue<::mlir::TensorType> getMaindiag(); + ::mlir::TypedValue<::mlir::TensorType> getSubdiag(); + ::mlir::TypedValue<::mlir::TensorType> getRhs(); + ::mlir::OpOperand &getSuperdiagMutable(); + ::mlir::OpOperand &getMaindiagMutable(); + ::mlir::OpOperand &getSubdiagMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value superdiag, ::mlir::Value maindiag, ::mlir::Value subdiag, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value superdiag, ::mlir::Value maindiag, ::mlir::Value subdiag, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TridiagonalMatMulOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TridiagonalSolveOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TridiagonalSolveOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TridiagonalSolveOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TridiagonalSolveOpGenericAdaptorBase(TridiagonalSolveOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getPartialPivotingAttr(); + bool getPartialPivoting(); + ::mlir::BoolAttr getPerturbSingularAttr(); + bool getPerturbSingular(); +}; +} // namespace detail +template +class TridiagonalSolveOpGenericAdaptor : public detail::TridiagonalSolveOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TridiagonalSolveOpGenericAdaptorBase; +public: + TridiagonalSolveOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TridiagonalSolveOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TridiagonalSolveOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TridiagonalSolveOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getDiagonals() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TridiagonalSolveOpAdaptor : public TridiagonalSolveOpGenericAdaptor<::mlir::ValueRange> { +public: + using TridiagonalSolveOpGenericAdaptor::TridiagonalSolveOpGenericAdaptor; + TridiagonalSolveOpAdaptor(TridiagonalSolveOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TridiagonalSolveOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TridiagonalSolveOpAdaptor; + template + using GenericAdaptor = TridiagonalSolveOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("partial_pivoting"), ::llvm::StringRef("perturb_singular")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getPartialPivotingAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getPartialPivotingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getPerturbSingularAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getPerturbSingularAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TridiagonalSolve"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getDiagonals(); + ::mlir::TypedValue<::mlir::TensorType> getRhs(); + ::mlir::OpOperand &getDiagonalsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getPartialPivotingAttr(); + bool getPartialPivoting(); + ::mlir::BoolAttr getPerturbSingularAttr(); + bool getPerturbSingular(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setPartialPivotingAttr(::mlir::BoolAttr attr); + void setPartialPivoting(::std::optional attrValue); + void setPerturbSingularAttr(::mlir::BoolAttr attr); + void setPerturbSingular(::std::optional attrValue); + ::mlir::Attribute removePartialPivotingAttr(); + ::mlir::Attribute removePerturbSingularAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value diagonals, ::mlir::Value rhs, /*optional*/::mlir::BoolAttr partial_pivoting, /*optional*/::mlir::BoolAttr perturb_singular); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value diagonals, ::mlir::Value rhs, /*optional*/::mlir::BoolAttr partial_pivoting, /*optional*/::mlir::BoolAttr perturb_singular); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value diagonals, ::mlir::Value rhs, /*optional*/bool partial_pivoting = true, /*optional*/bool perturb_singular = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value diagonals, ::mlir::Value rhs, /*optional*/bool partial_pivoting = true, /*optional*/bool perturb_singular = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TridiagonalSolveOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TruncateDivOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TruncateDivOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TruncateDivOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TruncateDivOpGenericAdaptorBase(TruncateDivOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TruncateDivOpGenericAdaptor : public detail::TruncateDivOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TruncateDivOpGenericAdaptorBase; +public: + TruncateDivOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TruncateDivOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TruncateDivOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TruncateDivOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TruncateDivOpAdaptor : public TruncateDivOpGenericAdaptor<::mlir::ValueRange> { +public: + using TruncateDivOpGenericAdaptor::TruncateDivOpGenericAdaptor; + TruncateDivOpAdaptor(TruncateDivOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TruncateDivOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TruncateDivOpAdaptor; + template + using GenericAdaptor = TruncateDivOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TruncateDiv"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TruncateDivOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TruncateModOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TruncateModOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TruncateModOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TruncateModOpGenericAdaptorBase(TruncateModOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TruncateModOpGenericAdaptor : public detail::TruncateModOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TruncateModOpGenericAdaptorBase; +public: + TruncateModOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TruncateModOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TruncateModOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TruncateModOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TruncateModOpAdaptor : public TruncateModOpGenericAdaptor<::mlir::ValueRange> { +public: + using TruncateModOpGenericAdaptor::TruncateModOpGenericAdaptor; + TruncateModOpAdaptor(TruncateModOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TruncateModOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::OpTrait::TF::SameOperandsAndResultElementTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TruncateModOpAdaptor; + template + using GenericAdaptor = TruncateModOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TruncateMod"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TruncateModOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TruncatedNormalOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TruncatedNormalOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TruncatedNormalOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TruncatedNormalOpGenericAdaptorBase(TruncatedNormalOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getSeedAttr(); + uint64_t getSeed(); + ::mlir::IntegerAttr getSeed2Attr(); + uint64_t getSeed2(); +}; +} // namespace detail +template +class TruncatedNormalOpGenericAdaptor : public detail::TruncatedNormalOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TruncatedNormalOpGenericAdaptorBase; +public: + TruncatedNormalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TruncatedNormalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TruncatedNormalOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TruncatedNormalOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getShape() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TruncatedNormalOpAdaptor : public TruncatedNormalOpGenericAdaptor<::mlir::ValueRange> { +public: + using TruncatedNormalOpGenericAdaptor::TruncatedNormalOpGenericAdaptor; + TruncatedNormalOpAdaptor(TruncatedNormalOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TruncatedNormalOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::TF::CannotDuplicate, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TruncatedNormalOpAdaptor; + template + using GenericAdaptor = TruncatedNormalOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("dtype"), ::llvm::StringRef("seed"), ::llvm::StringRef("seed2")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getSeedAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getSeedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSeed2AttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSeed2AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TruncatedNormal"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::OpOperand &getShapeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getSeedAttr(); + uint64_t getSeed(); + ::mlir::IntegerAttr getSeed2Attr(); + uint64_t getSeed2(); + ::mlir::Type getT(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setSeedAttr(::mlir::IntegerAttr attr); + void setSeed(::std::optional attrValue); + void setSeed2Attr(::mlir::IntegerAttr attr); + void setSeed2(::std::optional attrValue); + ::mlir::Attribute removeSeedAttr(); + ::mlir::Attribute removeSeed2Attr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, /*optional*/::mlir::IntegerAttr seed, /*optional*/::mlir::IntegerAttr seed2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, /*optional*/::mlir::IntegerAttr seed, /*optional*/::mlir::IntegerAttr seed2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, /*optional*/uint64_t seed = 0, /*optional*/uint64_t seed2 = 0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, /*optional*/uint64_t seed = 0, /*optional*/uint64_t seed2 = 0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TruncatedNormalOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::UncompressElementOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class UncompressElementOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + UncompressElementOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + UncompressElementOpGenericAdaptorBase(UncompressElementOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class UncompressElementOpGenericAdaptor : public detail::UncompressElementOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::UncompressElementOpGenericAdaptorBase; +public: + UncompressElementOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + UncompressElementOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : UncompressElementOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + UncompressElementOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getCompressed() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class UncompressElementOpAdaptor : public UncompressElementOpGenericAdaptor<::mlir::ValueRange> { +public: + using UncompressElementOpGenericAdaptor::UncompressElementOpGenericAdaptor; + UncompressElementOpAdaptor(UncompressElementOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class UncompressElementOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = UncompressElementOpAdaptor; + template + using GenericAdaptor = UncompressElementOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.UncompressElement"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getCompressed(); + ::mlir::OpOperand &getCompressedMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getComponents(); + mlir::TF::ResultShapeRange getOutputShapes(); + mlir::ResultElementTypeRange getOutputTypes(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange components, ::mlir::Value compressed); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::UncompressElementOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::UniformDequantizeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class UniformDequantizeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + UniformDequantizeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + UniformDequantizeOpGenericAdaptorBase(UniformDequantizeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getQuantizationAxisAttr(); + uint64_t getQuantizationAxis(); + ::mlir::IntegerAttr getQuantizationMinValAttr(); + uint64_t getQuantizationMinVal(); + ::mlir::IntegerAttr getQuantizationMaxValAttr(); + uint64_t getQuantizationMaxVal(); +}; +} // namespace detail +template +class UniformDequantizeOpGenericAdaptor : public detail::UniformDequantizeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::UniformDequantizeOpGenericAdaptorBase; +public: + UniformDequantizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + UniformDequantizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : UniformDequantizeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + UniformDequantizeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getScales() { + return (*getODSOperands(1).begin()); + } + + ValueT getZeroPoints() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class UniformDequantizeOpAdaptor : public UniformDequantizeOpGenericAdaptor<::mlir::ValueRange> { +public: + using UniformDequantizeOpGenericAdaptor::UniformDequantizeOpGenericAdaptor; + UniformDequantizeOpAdaptor(UniformDequantizeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class UniformDequantizeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = UniformDequantizeOpAdaptor; + template + using GenericAdaptor = UniformDequantizeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tin"), ::llvm::StringRef("Tout"), ::llvm::StringRef("quantization_axis"), ::llvm::StringRef("quantization_max_val"), ::llvm::StringRef("quantization_min_val")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTinAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTinAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getToutAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getToutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getQuantizationAxisAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getQuantizationAxisAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getQuantizationMaxValAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getQuantizationMaxValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getQuantizationMinValAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getQuantizationMinValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.UniformDequantize"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getScales(); + ::mlir::TypedValue<::mlir::TensorType> getZeroPoints(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getScalesMutable(); + ::mlir::OpOperand &getZeroPointsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getQuantizationAxisAttr(); + uint64_t getQuantizationAxis(); + ::mlir::IntegerAttr getQuantizationMinValAttr(); + uint64_t getQuantizationMinVal(); + ::mlir::IntegerAttr getQuantizationMaxValAttr(); + uint64_t getQuantizationMaxVal(); + ::mlir::Type getTin(); + ::mlir::Type getTout(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setQuantizationAxisAttr(::mlir::IntegerAttr attr); + void setQuantizationAxis(::std::optional attrValue); + void setQuantizationMinValAttr(::mlir::IntegerAttr attr); + void setQuantizationMinVal(uint64_t attrValue); + void setQuantizationMaxValAttr(::mlir::IntegerAttr attr); + void setQuantizationMaxVal(uint64_t attrValue); + ::mlir::Attribute removeQuantizationAxisAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value scales, ::mlir::Value zero_points, /*optional*/::mlir::IntegerAttr quantization_axis, ::mlir::IntegerAttr quantization_min_val, ::mlir::IntegerAttr quantization_max_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value scales, ::mlir::Value zero_points, /*optional*/::mlir::IntegerAttr quantization_axis, ::mlir::IntegerAttr quantization_min_val, ::mlir::IntegerAttr quantization_max_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value scales, ::mlir::Value zero_points, /*optional*/uint64_t quantization_axis, uint64_t quantization_min_val, uint64_t quantization_max_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value scales, ::mlir::Value zero_points, /*optional*/uint64_t quantization_axis, uint64_t quantization_min_val, uint64_t quantization_max_val); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::UniformDequantizeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::UniformQuantizeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class UniformQuantizeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + UniformQuantizeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + UniformQuantizeOpGenericAdaptorBase(UniformQuantizeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getQuantizationAxisAttr(); + uint64_t getQuantizationAxis(); + ::mlir::IntegerAttr getQuantizationMinValAttr(); + uint64_t getQuantizationMinVal(); + ::mlir::IntegerAttr getQuantizationMaxValAttr(); + uint64_t getQuantizationMaxVal(); +}; +} // namespace detail +template +class UniformQuantizeOpGenericAdaptor : public detail::UniformQuantizeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::UniformQuantizeOpGenericAdaptorBase; +public: + UniformQuantizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + UniformQuantizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : UniformQuantizeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + UniformQuantizeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getScales() { + return (*getODSOperands(1).begin()); + } + + ValueT getZeroPoints() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class UniformQuantizeOpAdaptor : public UniformQuantizeOpGenericAdaptor<::mlir::ValueRange> { +public: + using UniformQuantizeOpGenericAdaptor::UniformQuantizeOpGenericAdaptor; + UniformQuantizeOpAdaptor(UniformQuantizeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class UniformQuantizeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = UniformQuantizeOpAdaptor; + template + using GenericAdaptor = UniformQuantizeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tin"), ::llvm::StringRef("Tout"), ::llvm::StringRef("quantization_axis"), ::llvm::StringRef("quantization_max_val"), ::llvm::StringRef("quantization_min_val")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTinAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTinAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getToutAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getToutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getQuantizationAxisAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getQuantizationAxisAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getQuantizationMaxValAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getQuantizationMaxValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getQuantizationMinValAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getQuantizationMinValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.UniformQuantize"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getScales(); + ::mlir::TypedValue<::mlir::TensorType> getZeroPoints(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getScalesMutable(); + ::mlir::OpOperand &getZeroPointsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getQuantizationAxisAttr(); + uint64_t getQuantizationAxis(); + ::mlir::IntegerAttr getQuantizationMinValAttr(); + uint64_t getQuantizationMinVal(); + ::mlir::IntegerAttr getQuantizationMaxValAttr(); + uint64_t getQuantizationMaxVal(); + ::mlir::Type getTin(); + ::mlir::Type getTout(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setQuantizationAxisAttr(::mlir::IntegerAttr attr); + void setQuantizationAxis(::std::optional attrValue); + void setQuantizationMinValAttr(::mlir::IntegerAttr attr); + void setQuantizationMinVal(uint64_t attrValue); + void setQuantizationMaxValAttr(::mlir::IntegerAttr attr); + void setQuantizationMaxVal(uint64_t attrValue); + ::mlir::Attribute removeQuantizationAxisAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value scales, ::mlir::Value zero_points, /*optional*/::mlir::IntegerAttr quantization_axis, ::mlir::IntegerAttr quantization_min_val, ::mlir::IntegerAttr quantization_max_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value scales, ::mlir::Value zero_points, /*optional*/::mlir::IntegerAttr quantization_axis, ::mlir::IntegerAttr quantization_min_val, ::mlir::IntegerAttr quantization_max_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value scales, ::mlir::Value zero_points, /*optional*/uint64_t quantization_axis, uint64_t quantization_min_val, uint64_t quantization_max_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value scales, ::mlir::Value zero_points, /*optional*/uint64_t quantization_axis, uint64_t quantization_min_val, uint64_t quantization_max_val); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::UniformQuantizeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::UniformQuantizedAddOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class UniformQuantizedAddOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + UniformQuantizedAddOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + UniformQuantizedAddOpGenericAdaptorBase(UniformQuantizedAddOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getLhsQuantizationAxisAttr(); + uint64_t getLhsQuantizationAxis(); + ::mlir::IntegerAttr getLhsQuantizationMinValAttr(); + uint64_t getLhsQuantizationMinVal(); + ::mlir::IntegerAttr getLhsQuantizationMaxValAttr(); + uint64_t getLhsQuantizationMaxVal(); + ::mlir::IntegerAttr getRhsQuantizationAxisAttr(); + uint64_t getRhsQuantizationAxis(); + ::mlir::IntegerAttr getRhsQuantizationMinValAttr(); + uint64_t getRhsQuantizationMinVal(); + ::mlir::IntegerAttr getRhsQuantizationMaxValAttr(); + uint64_t getRhsQuantizationMaxVal(); + ::mlir::IntegerAttr getOutputQuantizationAxisAttr(); + uint64_t getOutputQuantizationAxis(); + ::mlir::IntegerAttr getOutputQuantizationMinValAttr(); + uint64_t getOutputQuantizationMinVal(); + ::mlir::IntegerAttr getOutputQuantizationMaxValAttr(); + uint64_t getOutputQuantizationMaxVal(); +}; +} // namespace detail +template +class UniformQuantizedAddOpGenericAdaptor : public detail::UniformQuantizedAddOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::UniformQuantizedAddOpGenericAdaptorBase; +public: + UniformQuantizedAddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + UniformQuantizedAddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : UniformQuantizedAddOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + UniformQuantizedAddOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + ValueT getLhsScales() { + return (*getODSOperands(2).begin()); + } + + ValueT getLhsZeroPoints() { + return (*getODSOperands(3).begin()); + } + + ValueT getRhsScales() { + return (*getODSOperands(4).begin()); + } + + ValueT getRhsZeroPoints() { + return (*getODSOperands(5).begin()); + } + + ValueT getOutputScales() { + return (*getODSOperands(6).begin()); + } + + ValueT getOutputZeroPoints() { + return (*getODSOperands(7).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class UniformQuantizedAddOpAdaptor : public UniformQuantizedAddOpGenericAdaptor<::mlir::ValueRange> { +public: + using UniformQuantizedAddOpGenericAdaptor::UniformQuantizedAddOpGenericAdaptor; + UniformQuantizedAddOpAdaptor(UniformQuantizedAddOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class UniformQuantizedAddOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<8>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = UniformQuantizedAddOpAdaptor; + template + using GenericAdaptor = UniformQuantizedAddOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("lhs_quantization_axis"), ::llvm::StringRef("lhs_quantization_max_val"), ::llvm::StringRef("lhs_quantization_min_val"), ::llvm::StringRef("output_quantization_axis"), ::llvm::StringRef("output_quantization_max_val"), ::llvm::StringRef("output_quantization_min_val"), ::llvm::StringRef("rhs_quantization_axis"), ::llvm::StringRef("rhs_quantization_max_val"), ::llvm::StringRef("rhs_quantization_min_val")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getLhsQuantizationAxisAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getLhsQuantizationAxisAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getLhsQuantizationMaxValAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getLhsQuantizationMaxValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getLhsQuantizationMinValAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getLhsQuantizationMinValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getOutputQuantizationAxisAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getOutputQuantizationAxisAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getOutputQuantizationMaxValAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getOutputQuantizationMaxValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getOutputQuantizationMinValAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getOutputQuantizationMinValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getRhsQuantizationAxisAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getRhsQuantizationAxisAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getRhsQuantizationMaxValAttrName() { + return getAttributeNameForIndex(8); + } + + static ::mlir::StringAttr getRhsQuantizationMaxValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 8); + } + + ::mlir::StringAttr getRhsQuantizationMinValAttrName() { + return getAttributeNameForIndex(9); + } + + static ::mlir::StringAttr getRhsQuantizationMinValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 9); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.UniformQuantizedAdd"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLhs(); + ::mlir::TypedValue<::mlir::TensorType> getRhs(); + ::mlir::TypedValue<::mlir::TensorType> getLhsScales(); + ::mlir::TypedValue<::mlir::TensorType> getLhsZeroPoints(); + ::mlir::TypedValue<::mlir::TensorType> getRhsScales(); + ::mlir::TypedValue<::mlir::TensorType> getRhsZeroPoints(); + ::mlir::TypedValue<::mlir::TensorType> getOutputScales(); + ::mlir::TypedValue<::mlir::TensorType> getOutputZeroPoints(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + ::mlir::OpOperand &getLhsScalesMutable(); + ::mlir::OpOperand &getLhsZeroPointsMutable(); + ::mlir::OpOperand &getRhsScalesMutable(); + ::mlir::OpOperand &getRhsZeroPointsMutable(); + ::mlir::OpOperand &getOutputScalesMutable(); + ::mlir::OpOperand &getOutputZeroPointsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getLhsQuantizationAxisAttr(); + uint64_t getLhsQuantizationAxis(); + ::mlir::IntegerAttr getLhsQuantizationMinValAttr(); + uint64_t getLhsQuantizationMinVal(); + ::mlir::IntegerAttr getLhsQuantizationMaxValAttr(); + uint64_t getLhsQuantizationMaxVal(); + ::mlir::IntegerAttr getRhsQuantizationAxisAttr(); + uint64_t getRhsQuantizationAxis(); + ::mlir::IntegerAttr getRhsQuantizationMinValAttr(); + uint64_t getRhsQuantizationMinVal(); + ::mlir::IntegerAttr getRhsQuantizationMaxValAttr(); + uint64_t getRhsQuantizationMaxVal(); + ::mlir::IntegerAttr getOutputQuantizationAxisAttr(); + uint64_t getOutputQuantizationAxis(); + ::mlir::IntegerAttr getOutputQuantizationMinValAttr(); + uint64_t getOutputQuantizationMinVal(); + ::mlir::IntegerAttr getOutputQuantizationMaxValAttr(); + uint64_t getOutputQuantizationMaxVal(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setLhsQuantizationAxisAttr(::mlir::IntegerAttr attr); + void setLhsQuantizationAxis(::std::optional attrValue); + void setLhsQuantizationMinValAttr(::mlir::IntegerAttr attr); + void setLhsQuantizationMinVal(uint64_t attrValue); + void setLhsQuantizationMaxValAttr(::mlir::IntegerAttr attr); + void setLhsQuantizationMaxVal(uint64_t attrValue); + void setRhsQuantizationAxisAttr(::mlir::IntegerAttr attr); + void setRhsQuantizationAxis(::std::optional attrValue); + void setRhsQuantizationMinValAttr(::mlir::IntegerAttr attr); + void setRhsQuantizationMinVal(uint64_t attrValue); + void setRhsQuantizationMaxValAttr(::mlir::IntegerAttr attr); + void setRhsQuantizationMaxVal(uint64_t attrValue); + void setOutputQuantizationAxisAttr(::mlir::IntegerAttr attr); + void setOutputQuantizationAxis(::std::optional attrValue); + void setOutputQuantizationMinValAttr(::mlir::IntegerAttr attr); + void setOutputQuantizationMinVal(uint64_t attrValue); + void setOutputQuantizationMaxValAttr(::mlir::IntegerAttr attr); + void setOutputQuantizationMaxVal(uint64_t attrValue); + ::mlir::Attribute removeLhsQuantizationAxisAttr(); + ::mlir::Attribute removeRhsQuantizationAxisAttr(); + ::mlir::Attribute removeOutputQuantizationAxisAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value lhs_scales, ::mlir::Value lhs_zero_points, ::mlir::Value rhs_scales, ::mlir::Value rhs_zero_points, ::mlir::Value output_scales, ::mlir::Value output_zero_points, /*optional*/::mlir::IntegerAttr lhs_quantization_axis, ::mlir::IntegerAttr lhs_quantization_min_val, ::mlir::IntegerAttr lhs_quantization_max_val, /*optional*/::mlir::IntegerAttr rhs_quantization_axis, ::mlir::IntegerAttr rhs_quantization_min_val, ::mlir::IntegerAttr rhs_quantization_max_val, /*optional*/::mlir::IntegerAttr output_quantization_axis, ::mlir::IntegerAttr output_quantization_min_val, ::mlir::IntegerAttr output_quantization_max_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value lhs_scales, ::mlir::Value lhs_zero_points, ::mlir::Value rhs_scales, ::mlir::Value rhs_zero_points, ::mlir::Value output_scales, ::mlir::Value output_zero_points, /*optional*/::mlir::IntegerAttr lhs_quantization_axis, ::mlir::IntegerAttr lhs_quantization_min_val, ::mlir::IntegerAttr lhs_quantization_max_val, /*optional*/::mlir::IntegerAttr rhs_quantization_axis, ::mlir::IntegerAttr rhs_quantization_min_val, ::mlir::IntegerAttr rhs_quantization_max_val, /*optional*/::mlir::IntegerAttr output_quantization_axis, ::mlir::IntegerAttr output_quantization_min_val, ::mlir::IntegerAttr output_quantization_max_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value lhs_scales, ::mlir::Value lhs_zero_points, ::mlir::Value rhs_scales, ::mlir::Value rhs_zero_points, ::mlir::Value output_scales, ::mlir::Value output_zero_points, /*optional*/uint64_t lhs_quantization_axis, uint64_t lhs_quantization_min_val, uint64_t lhs_quantization_max_val, /*optional*/uint64_t rhs_quantization_axis, uint64_t rhs_quantization_min_val, uint64_t rhs_quantization_max_val, /*optional*/uint64_t output_quantization_axis, uint64_t output_quantization_min_val, uint64_t output_quantization_max_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value lhs_scales, ::mlir::Value lhs_zero_points, ::mlir::Value rhs_scales, ::mlir::Value rhs_zero_points, ::mlir::Value output_scales, ::mlir::Value output_zero_points, /*optional*/uint64_t lhs_quantization_axis, uint64_t lhs_quantization_min_val, uint64_t lhs_quantization_max_val, /*optional*/uint64_t rhs_quantization_axis, uint64_t rhs_quantization_min_val, uint64_t rhs_quantization_max_val, /*optional*/uint64_t output_quantization_axis, uint64_t output_quantization_min_val, uint64_t output_quantization_max_val); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 10 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::UniformQuantizedAddOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::UniformQuantizedClipByValueOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class UniformQuantizedClipByValueOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + UniformQuantizedClipByValueOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + UniformQuantizedClipByValueOpGenericAdaptorBase(UniformQuantizedClipByValueOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getQuantizationAxisAttr(); + uint64_t getQuantizationAxis(); + ::mlir::IntegerAttr getQuantizationMinValAttr(); + uint64_t getQuantizationMinVal(); + ::mlir::IntegerAttr getQuantizationMaxValAttr(); + uint64_t getQuantizationMaxVal(); +}; +} // namespace detail +template +class UniformQuantizedClipByValueOpGenericAdaptor : public detail::UniformQuantizedClipByValueOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::UniformQuantizedClipByValueOpGenericAdaptorBase; +public: + UniformQuantizedClipByValueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + UniformQuantizedClipByValueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : UniformQuantizedClipByValueOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + UniformQuantizedClipByValueOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + ValueT getMin() { + return (*getODSOperands(1).begin()); + } + + ValueT getMax() { + return (*getODSOperands(2).begin()); + } + + ValueT getScales() { + return (*getODSOperands(3).begin()); + } + + ValueT getZeroPoints() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class UniformQuantizedClipByValueOpAdaptor : public UniformQuantizedClipByValueOpGenericAdaptor<::mlir::ValueRange> { +public: + using UniformQuantizedClipByValueOpGenericAdaptor::UniformQuantizedClipByValueOpGenericAdaptor; + UniformQuantizedClipByValueOpAdaptor(UniformQuantizedClipByValueOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class UniformQuantizedClipByValueOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<5>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = UniformQuantizedClipByValueOpAdaptor; + template + using GenericAdaptor = UniformQuantizedClipByValueOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("quantization_axis"), ::llvm::StringRef("quantization_max_val"), ::llvm::StringRef("quantization_min_val")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getQuantizationAxisAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getQuantizationAxisAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getQuantizationMaxValAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getQuantizationMaxValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getQuantizationMinValAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getQuantizationMinValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.UniformQuantizedClipByValue"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::TypedValue<::mlir::TensorType> getMin(); + ::mlir::TypedValue<::mlir::TensorType> getMax(); + ::mlir::TypedValue<::mlir::TensorType> getScales(); + ::mlir::TypedValue<::mlir::TensorType> getZeroPoints(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::OpOperand &getMinMutable(); + ::mlir::OpOperand &getMaxMutable(); + ::mlir::OpOperand &getScalesMutable(); + ::mlir::OpOperand &getZeroPointsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getQuantizationAxisAttr(); + uint64_t getQuantizationAxis(); + ::mlir::IntegerAttr getQuantizationMinValAttr(); + uint64_t getQuantizationMinVal(); + ::mlir::IntegerAttr getQuantizationMaxValAttr(); + uint64_t getQuantizationMaxVal(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setQuantizationAxisAttr(::mlir::IntegerAttr attr); + void setQuantizationAxis(::std::optional attrValue); + void setQuantizationMinValAttr(::mlir::IntegerAttr attr); + void setQuantizationMinVal(uint64_t attrValue); + void setQuantizationMaxValAttr(::mlir::IntegerAttr attr); + void setQuantizationMaxVal(uint64_t attrValue); + ::mlir::Attribute removeQuantizationAxisAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value operand, ::mlir::Value min, ::mlir::Value max, ::mlir::Value scales, ::mlir::Value zero_points, /*optional*/::mlir::IntegerAttr quantization_axis, ::mlir::IntegerAttr quantization_min_val, ::mlir::IntegerAttr quantization_max_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value min, ::mlir::Value max, ::mlir::Value scales, ::mlir::Value zero_points, /*optional*/::mlir::IntegerAttr quantization_axis, ::mlir::IntegerAttr quantization_min_val, ::mlir::IntegerAttr quantization_max_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value operand, ::mlir::Value min, ::mlir::Value max, ::mlir::Value scales, ::mlir::Value zero_points, /*optional*/uint64_t quantization_axis, uint64_t quantization_min_val, uint64_t quantization_max_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value min, ::mlir::Value max, ::mlir::Value scales, ::mlir::Value zero_points, /*optional*/uint64_t quantization_axis, uint64_t quantization_min_val, uint64_t quantization_max_val); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::UniformQuantizedClipByValueOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::UniformQuantizedConvolutionHybridOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class UniformQuantizedConvolutionHybridOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + UniformQuantizedConvolutionHybridOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + UniformQuantizedConvolutionHybridOpGenericAdaptorBase(UniformQuantizedConvolutionHybridOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getWindowStridesAttr(); + ::mlir::ArrayAttr getWindowStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getExplicitPaddingAttr(); + ::mlir::ArrayAttr getExplicitPadding(); + ::mlir::ArrayAttr getLhsDilationAttr(); + ::mlir::ArrayAttr getLhsDilation(); + ::mlir::ArrayAttr getRhsDilationAttr(); + ::mlir::ArrayAttr getRhsDilation(); + ::mlir::IntegerAttr getBatchGroupCountAttr(); + uint64_t getBatchGroupCount(); + ::mlir::IntegerAttr getFeatureGroupCountAttr(); + uint64_t getFeatureGroupCount(); + ::mlir::StringAttr getDimensionNumbersAttr(); + ::llvm::StringRef getDimensionNumbers(); + ::mlir::IntegerAttr getRhsQuantizationAxisAttr(); + uint64_t getRhsQuantizationAxis(); + ::mlir::IntegerAttr getRhsQuantizationMinValAttr(); + uint64_t getRhsQuantizationMinVal(); + ::mlir::IntegerAttr getRhsQuantizationMaxValAttr(); + uint64_t getRhsQuantizationMaxVal(); +}; +} // namespace detail +template +class UniformQuantizedConvolutionHybridOpGenericAdaptor : public detail::UniformQuantizedConvolutionHybridOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::UniformQuantizedConvolutionHybridOpGenericAdaptorBase; +public: + UniformQuantizedConvolutionHybridOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + UniformQuantizedConvolutionHybridOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : UniformQuantizedConvolutionHybridOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + UniformQuantizedConvolutionHybridOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + ValueT getRhsScales() { + return (*getODSOperands(2).begin()); + } + + ValueT getRhsZeroPoints() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class UniformQuantizedConvolutionHybridOpAdaptor : public UniformQuantizedConvolutionHybridOpGenericAdaptor<::mlir::ValueRange> { +public: + using UniformQuantizedConvolutionHybridOpGenericAdaptor::UniformQuantizedConvolutionHybridOpGenericAdaptor; + UniformQuantizedConvolutionHybridOpAdaptor(UniformQuantizedConvolutionHybridOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class UniformQuantizedConvolutionHybridOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = UniformQuantizedConvolutionHybridOpAdaptor; + template + using GenericAdaptor = UniformQuantizedConvolutionHybridOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tlhs"), ::llvm::StringRef("Tout"), ::llvm::StringRef("Trhs"), ::llvm::StringRef("batch_group_count"), ::llvm::StringRef("dimension_numbers"), ::llvm::StringRef("explicit_padding"), ::llvm::StringRef("feature_group_count"), ::llvm::StringRef("lhs_dilation"), ::llvm::StringRef("padding"), ::llvm::StringRef("rhs_dilation"), ::llvm::StringRef("rhs_quantization_axis"), ::llvm::StringRef("rhs_quantization_max_val"), ::llvm::StringRef("rhs_quantization_min_val"), ::llvm::StringRef("window_strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTlhsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTlhsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getToutAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getToutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTrhsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTrhsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getBatchGroupCountAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getBatchGroupCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getDimensionNumbersAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getDimensionNumbersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getExplicitPaddingAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getExplicitPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getFeatureGroupCountAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getFeatureGroupCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getLhsDilationAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getLhsDilationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(8); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 8); + } + + ::mlir::StringAttr getRhsDilationAttrName() { + return getAttributeNameForIndex(9); + } + + static ::mlir::StringAttr getRhsDilationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 9); + } + + ::mlir::StringAttr getRhsQuantizationAxisAttrName() { + return getAttributeNameForIndex(10); + } + + static ::mlir::StringAttr getRhsQuantizationAxisAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 10); + } + + ::mlir::StringAttr getRhsQuantizationMaxValAttrName() { + return getAttributeNameForIndex(11); + } + + static ::mlir::StringAttr getRhsQuantizationMaxValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 11); + } + + ::mlir::StringAttr getRhsQuantizationMinValAttrName() { + return getAttributeNameForIndex(12); + } + + static ::mlir::StringAttr getRhsQuantizationMinValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 12); + } + + ::mlir::StringAttr getWindowStridesAttrName() { + return getAttributeNameForIndex(13); + } + + static ::mlir::StringAttr getWindowStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 13); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.UniformQuantizedConvolutionHybrid"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLhs(); + ::mlir::TypedValue<::mlir::TensorType> getRhs(); + ::mlir::TypedValue<::mlir::TensorType> getRhsScales(); + ::mlir::TypedValue<::mlir::TensorType> getRhsZeroPoints(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + ::mlir::OpOperand &getRhsScalesMutable(); + ::mlir::OpOperand &getRhsZeroPointsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ArrayAttr getWindowStridesAttr(); + ::mlir::ArrayAttr getWindowStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getExplicitPaddingAttr(); + ::mlir::ArrayAttr getExplicitPadding(); + ::mlir::ArrayAttr getLhsDilationAttr(); + ::mlir::ArrayAttr getLhsDilation(); + ::mlir::ArrayAttr getRhsDilationAttr(); + ::mlir::ArrayAttr getRhsDilation(); + ::mlir::IntegerAttr getBatchGroupCountAttr(); + uint64_t getBatchGroupCount(); + ::mlir::IntegerAttr getFeatureGroupCountAttr(); + uint64_t getFeatureGroupCount(); + ::mlir::StringAttr getDimensionNumbersAttr(); + ::llvm::StringRef getDimensionNumbers(); + ::mlir::IntegerAttr getRhsQuantizationAxisAttr(); + uint64_t getRhsQuantizationAxis(); + ::mlir::IntegerAttr getRhsQuantizationMinValAttr(); + uint64_t getRhsQuantizationMinVal(); + ::mlir::IntegerAttr getRhsQuantizationMaxValAttr(); + uint64_t getRhsQuantizationMaxVal(); + ::mlir::Type getTlhs(); + ::mlir::Type getTrhs(); + ::mlir::Type getTout(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setWindowStridesAttr(::mlir::ArrayAttr attr); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + void setExplicitPaddingAttr(::mlir::ArrayAttr attr); + void setLhsDilationAttr(::mlir::ArrayAttr attr); + void setRhsDilationAttr(::mlir::ArrayAttr attr); + void setBatchGroupCountAttr(::mlir::IntegerAttr attr); + void setBatchGroupCount(::std::optional attrValue); + void setFeatureGroupCountAttr(::mlir::IntegerAttr attr); + void setFeatureGroupCount(::std::optional attrValue); + void setDimensionNumbersAttr(::mlir::StringAttr attr); + void setDimensionNumbers(::std::optional<::llvm::StringRef> attrValue); + void setRhsQuantizationAxisAttr(::mlir::IntegerAttr attr); + void setRhsQuantizationAxis(::std::optional attrValue); + void setRhsQuantizationMinValAttr(::mlir::IntegerAttr attr); + void setRhsQuantizationMinVal(uint64_t attrValue); + void setRhsQuantizationMaxValAttr(::mlir::IntegerAttr attr); + void setRhsQuantizationMaxVal(uint64_t attrValue); + ::mlir::Attribute removeWindowStridesAttr(); + ::mlir::Attribute removeExplicitPaddingAttr(); + ::mlir::Attribute removeLhsDilationAttr(); + ::mlir::Attribute removeRhsDilationAttr(); + ::mlir::Attribute removeBatchGroupCountAttr(); + ::mlir::Attribute removeFeatureGroupCountAttr(); + ::mlir::Attribute removeDimensionNumbersAttr(); + ::mlir::Attribute removeRhsQuantizationAxisAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value rhs_scales, ::mlir::Value rhs_zero_points, /*optional*/::mlir::ArrayAttr window_strides, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr explicit_padding, /*optional*/::mlir::ArrayAttr lhs_dilation, /*optional*/::mlir::ArrayAttr rhs_dilation, /*optional*/::mlir::IntegerAttr batch_group_count, /*optional*/::mlir::IntegerAttr feature_group_count, /*optional*/::mlir::StringAttr dimension_numbers, /*optional*/::mlir::IntegerAttr rhs_quantization_axis, ::mlir::IntegerAttr rhs_quantization_min_val, ::mlir::IntegerAttr rhs_quantization_max_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value rhs_scales, ::mlir::Value rhs_zero_points, /*optional*/::mlir::ArrayAttr window_strides, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr explicit_padding, /*optional*/::mlir::ArrayAttr lhs_dilation, /*optional*/::mlir::ArrayAttr rhs_dilation, /*optional*/::mlir::IntegerAttr batch_group_count, /*optional*/::mlir::IntegerAttr feature_group_count, /*optional*/::mlir::StringAttr dimension_numbers, /*optional*/::mlir::IntegerAttr rhs_quantization_axis, ::mlir::IntegerAttr rhs_quantization_min_val, ::mlir::IntegerAttr rhs_quantization_max_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value rhs_scales, ::mlir::Value rhs_zero_points, /*optional*/::mlir::ArrayAttr window_strides, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr explicit_padding, /*optional*/::mlir::ArrayAttr lhs_dilation, /*optional*/::mlir::ArrayAttr rhs_dilation, /*optional*/uint64_t batch_group_count, /*optional*/uint64_t feature_group_count, /*optional*/::llvm::StringRef dimension_numbers, /*optional*/uint64_t rhs_quantization_axis, uint64_t rhs_quantization_min_val, uint64_t rhs_quantization_max_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value rhs_scales, ::mlir::Value rhs_zero_points, /*optional*/::mlir::ArrayAttr window_strides, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr explicit_padding, /*optional*/::mlir::ArrayAttr lhs_dilation, /*optional*/::mlir::ArrayAttr rhs_dilation, /*optional*/uint64_t batch_group_count, /*optional*/uint64_t feature_group_count, /*optional*/::llvm::StringRef dimension_numbers, /*optional*/uint64_t rhs_quantization_axis, uint64_t rhs_quantization_min_val, uint64_t rhs_quantization_max_val); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 14 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::UniformQuantizedConvolutionHybridOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::UniformQuantizedConvolutionOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class UniformQuantizedConvolutionOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + UniformQuantizedConvolutionOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + UniformQuantizedConvolutionOpGenericAdaptorBase(UniformQuantizedConvolutionOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getWindowStridesAttr(); + ::mlir::ArrayAttr getWindowStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getExplicitPaddingAttr(); + ::mlir::ArrayAttr getExplicitPadding(); + ::mlir::ArrayAttr getLhsDilationAttr(); + ::mlir::ArrayAttr getLhsDilation(); + ::mlir::ArrayAttr getRhsDilationAttr(); + ::mlir::ArrayAttr getRhsDilation(); + ::mlir::IntegerAttr getBatchGroupCountAttr(); + uint64_t getBatchGroupCount(); + ::mlir::IntegerAttr getFeatureGroupCountAttr(); + uint64_t getFeatureGroupCount(); + ::mlir::StringAttr getDimensionNumbersAttr(); + ::llvm::StringRef getDimensionNumbers(); + ::mlir::IntegerAttr getLhsQuantizationAxisAttr(); + uint64_t getLhsQuantizationAxis(); + ::mlir::IntegerAttr getLhsQuantizationMinValAttr(); + uint64_t getLhsQuantizationMinVal(); + ::mlir::IntegerAttr getLhsQuantizationMaxValAttr(); + uint64_t getLhsQuantizationMaxVal(); + ::mlir::IntegerAttr getRhsQuantizationAxisAttr(); + uint64_t getRhsQuantizationAxis(); + ::mlir::IntegerAttr getRhsQuantizationMinValAttr(); + uint64_t getRhsQuantizationMinVal(); + ::mlir::IntegerAttr getRhsQuantizationMaxValAttr(); + uint64_t getRhsQuantizationMaxVal(); + ::mlir::IntegerAttr getOutputQuantizationAxisAttr(); + uint64_t getOutputQuantizationAxis(); + ::mlir::IntegerAttr getOutputQuantizationMinValAttr(); + uint64_t getOutputQuantizationMinVal(); + ::mlir::IntegerAttr getOutputQuantizationMaxValAttr(); + uint64_t getOutputQuantizationMaxVal(); +}; +} // namespace detail +template +class UniformQuantizedConvolutionOpGenericAdaptor : public detail::UniformQuantizedConvolutionOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::UniformQuantizedConvolutionOpGenericAdaptorBase; +public: + UniformQuantizedConvolutionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + UniformQuantizedConvolutionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : UniformQuantizedConvolutionOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + UniformQuantizedConvolutionOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + ValueT getLhsScales() { + return (*getODSOperands(2).begin()); + } + + ValueT getLhsZeroPoints() { + return (*getODSOperands(3).begin()); + } + + ValueT getRhsScales() { + return (*getODSOperands(4).begin()); + } + + ValueT getRhsZeroPoints() { + return (*getODSOperands(5).begin()); + } + + ValueT getOutputScales() { + return (*getODSOperands(6).begin()); + } + + ValueT getOutputZeroPoints() { + return (*getODSOperands(7).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class UniformQuantizedConvolutionOpAdaptor : public UniformQuantizedConvolutionOpGenericAdaptor<::mlir::ValueRange> { +public: + using UniformQuantizedConvolutionOpGenericAdaptor::UniformQuantizedConvolutionOpGenericAdaptor; + UniformQuantizedConvolutionOpAdaptor(UniformQuantizedConvolutionOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class UniformQuantizedConvolutionOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<8>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = UniformQuantizedConvolutionOpAdaptor; + template + using GenericAdaptor = UniformQuantizedConvolutionOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tin"), ::llvm::StringRef("Tout"), ::llvm::StringRef("batch_group_count"), ::llvm::StringRef("dimension_numbers"), ::llvm::StringRef("explicit_padding"), ::llvm::StringRef("feature_group_count"), ::llvm::StringRef("lhs_dilation"), ::llvm::StringRef("lhs_quantization_axis"), ::llvm::StringRef("lhs_quantization_max_val"), ::llvm::StringRef("lhs_quantization_min_val"), ::llvm::StringRef("output_quantization_axis"), ::llvm::StringRef("output_quantization_max_val"), ::llvm::StringRef("output_quantization_min_val"), ::llvm::StringRef("padding"), ::llvm::StringRef("rhs_dilation"), ::llvm::StringRef("rhs_quantization_axis"), ::llvm::StringRef("rhs_quantization_max_val"), ::llvm::StringRef("rhs_quantization_min_val"), ::llvm::StringRef("window_strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTinAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTinAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getToutAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getToutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getBatchGroupCountAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getBatchGroupCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getDimensionNumbersAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getDimensionNumbersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getExplicitPaddingAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getExplicitPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getFeatureGroupCountAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getFeatureGroupCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getLhsDilationAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getLhsDilationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getLhsQuantizationAxisAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getLhsQuantizationAxisAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getLhsQuantizationMaxValAttrName() { + return getAttributeNameForIndex(8); + } + + static ::mlir::StringAttr getLhsQuantizationMaxValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 8); + } + + ::mlir::StringAttr getLhsQuantizationMinValAttrName() { + return getAttributeNameForIndex(9); + } + + static ::mlir::StringAttr getLhsQuantizationMinValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 9); + } + + ::mlir::StringAttr getOutputQuantizationAxisAttrName() { + return getAttributeNameForIndex(10); + } + + static ::mlir::StringAttr getOutputQuantizationAxisAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 10); + } + + ::mlir::StringAttr getOutputQuantizationMaxValAttrName() { + return getAttributeNameForIndex(11); + } + + static ::mlir::StringAttr getOutputQuantizationMaxValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 11); + } + + ::mlir::StringAttr getOutputQuantizationMinValAttrName() { + return getAttributeNameForIndex(12); + } + + static ::mlir::StringAttr getOutputQuantizationMinValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 12); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(13); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 13); + } + + ::mlir::StringAttr getRhsDilationAttrName() { + return getAttributeNameForIndex(14); + } + + static ::mlir::StringAttr getRhsDilationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 14); + } + + ::mlir::StringAttr getRhsQuantizationAxisAttrName() { + return getAttributeNameForIndex(15); + } + + static ::mlir::StringAttr getRhsQuantizationAxisAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 15); + } + + ::mlir::StringAttr getRhsQuantizationMaxValAttrName() { + return getAttributeNameForIndex(16); + } + + static ::mlir::StringAttr getRhsQuantizationMaxValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 16); + } + + ::mlir::StringAttr getRhsQuantizationMinValAttrName() { + return getAttributeNameForIndex(17); + } + + static ::mlir::StringAttr getRhsQuantizationMinValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 17); + } + + ::mlir::StringAttr getWindowStridesAttrName() { + return getAttributeNameForIndex(18); + } + + static ::mlir::StringAttr getWindowStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 18); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.UniformQuantizedConvolution"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLhs(); + ::mlir::TypedValue<::mlir::TensorType> getRhs(); + ::mlir::TypedValue<::mlir::TensorType> getLhsScales(); + ::mlir::TypedValue<::mlir::TensorType> getLhsZeroPoints(); + ::mlir::TypedValue<::mlir::TensorType> getRhsScales(); + ::mlir::TypedValue<::mlir::TensorType> getRhsZeroPoints(); + ::mlir::TypedValue<::mlir::TensorType> getOutputScales(); + ::mlir::TypedValue<::mlir::TensorType> getOutputZeroPoints(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + ::mlir::OpOperand &getLhsScalesMutable(); + ::mlir::OpOperand &getLhsZeroPointsMutable(); + ::mlir::OpOperand &getRhsScalesMutable(); + ::mlir::OpOperand &getRhsZeroPointsMutable(); + ::mlir::OpOperand &getOutputScalesMutable(); + ::mlir::OpOperand &getOutputZeroPointsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ArrayAttr getWindowStridesAttr(); + ::mlir::ArrayAttr getWindowStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getExplicitPaddingAttr(); + ::mlir::ArrayAttr getExplicitPadding(); + ::mlir::ArrayAttr getLhsDilationAttr(); + ::mlir::ArrayAttr getLhsDilation(); + ::mlir::ArrayAttr getRhsDilationAttr(); + ::mlir::ArrayAttr getRhsDilation(); + ::mlir::IntegerAttr getBatchGroupCountAttr(); + uint64_t getBatchGroupCount(); + ::mlir::IntegerAttr getFeatureGroupCountAttr(); + uint64_t getFeatureGroupCount(); + ::mlir::StringAttr getDimensionNumbersAttr(); + ::llvm::StringRef getDimensionNumbers(); + ::mlir::IntegerAttr getLhsQuantizationAxisAttr(); + uint64_t getLhsQuantizationAxis(); + ::mlir::IntegerAttr getLhsQuantizationMinValAttr(); + uint64_t getLhsQuantizationMinVal(); + ::mlir::IntegerAttr getLhsQuantizationMaxValAttr(); + uint64_t getLhsQuantizationMaxVal(); + ::mlir::IntegerAttr getRhsQuantizationAxisAttr(); + uint64_t getRhsQuantizationAxis(); + ::mlir::IntegerAttr getRhsQuantizationMinValAttr(); + uint64_t getRhsQuantizationMinVal(); + ::mlir::IntegerAttr getRhsQuantizationMaxValAttr(); + uint64_t getRhsQuantizationMaxVal(); + ::mlir::IntegerAttr getOutputQuantizationAxisAttr(); + uint64_t getOutputQuantizationAxis(); + ::mlir::IntegerAttr getOutputQuantizationMinValAttr(); + uint64_t getOutputQuantizationMinVal(); + ::mlir::IntegerAttr getOutputQuantizationMaxValAttr(); + uint64_t getOutputQuantizationMaxVal(); + ::mlir::Type getTin(); + ::mlir::Type getTout(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setWindowStridesAttr(::mlir::ArrayAttr attr); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + void setExplicitPaddingAttr(::mlir::ArrayAttr attr); + void setLhsDilationAttr(::mlir::ArrayAttr attr); + void setRhsDilationAttr(::mlir::ArrayAttr attr); + void setBatchGroupCountAttr(::mlir::IntegerAttr attr); + void setBatchGroupCount(::std::optional attrValue); + void setFeatureGroupCountAttr(::mlir::IntegerAttr attr); + void setFeatureGroupCount(::std::optional attrValue); + void setDimensionNumbersAttr(::mlir::StringAttr attr); + void setDimensionNumbers(::std::optional<::llvm::StringRef> attrValue); + void setLhsQuantizationAxisAttr(::mlir::IntegerAttr attr); + void setLhsQuantizationAxis(::std::optional attrValue); + void setLhsQuantizationMinValAttr(::mlir::IntegerAttr attr); + void setLhsQuantizationMinVal(uint64_t attrValue); + void setLhsQuantizationMaxValAttr(::mlir::IntegerAttr attr); + void setLhsQuantizationMaxVal(uint64_t attrValue); + void setRhsQuantizationAxisAttr(::mlir::IntegerAttr attr); + void setRhsQuantizationAxis(::std::optional attrValue); + void setRhsQuantizationMinValAttr(::mlir::IntegerAttr attr); + void setRhsQuantizationMinVal(uint64_t attrValue); + void setRhsQuantizationMaxValAttr(::mlir::IntegerAttr attr); + void setRhsQuantizationMaxVal(uint64_t attrValue); + void setOutputQuantizationAxisAttr(::mlir::IntegerAttr attr); + void setOutputQuantizationAxis(::std::optional attrValue); + void setOutputQuantizationMinValAttr(::mlir::IntegerAttr attr); + void setOutputQuantizationMinVal(uint64_t attrValue); + void setOutputQuantizationMaxValAttr(::mlir::IntegerAttr attr); + void setOutputQuantizationMaxVal(uint64_t attrValue); + ::mlir::Attribute removeWindowStridesAttr(); + ::mlir::Attribute removeExplicitPaddingAttr(); + ::mlir::Attribute removeLhsDilationAttr(); + ::mlir::Attribute removeRhsDilationAttr(); + ::mlir::Attribute removeBatchGroupCountAttr(); + ::mlir::Attribute removeFeatureGroupCountAttr(); + ::mlir::Attribute removeDimensionNumbersAttr(); + ::mlir::Attribute removeLhsQuantizationAxisAttr(); + ::mlir::Attribute removeRhsQuantizationAxisAttr(); + ::mlir::Attribute removeOutputQuantizationAxisAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value lhs_scales, ::mlir::Value lhs_zero_points, ::mlir::Value rhs_scales, ::mlir::Value rhs_zero_points, ::mlir::Value output_scales, ::mlir::Value output_zero_points, /*optional*/::mlir::ArrayAttr window_strides, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr explicit_padding, /*optional*/::mlir::ArrayAttr lhs_dilation, /*optional*/::mlir::ArrayAttr rhs_dilation, /*optional*/::mlir::IntegerAttr batch_group_count, /*optional*/::mlir::IntegerAttr feature_group_count, /*optional*/::mlir::StringAttr dimension_numbers, /*optional*/::mlir::IntegerAttr lhs_quantization_axis, ::mlir::IntegerAttr lhs_quantization_min_val, ::mlir::IntegerAttr lhs_quantization_max_val, /*optional*/::mlir::IntegerAttr rhs_quantization_axis, ::mlir::IntegerAttr rhs_quantization_min_val, ::mlir::IntegerAttr rhs_quantization_max_val, /*optional*/::mlir::IntegerAttr output_quantization_axis, ::mlir::IntegerAttr output_quantization_min_val, ::mlir::IntegerAttr output_quantization_max_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value lhs_scales, ::mlir::Value lhs_zero_points, ::mlir::Value rhs_scales, ::mlir::Value rhs_zero_points, ::mlir::Value output_scales, ::mlir::Value output_zero_points, /*optional*/::mlir::ArrayAttr window_strides, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr explicit_padding, /*optional*/::mlir::ArrayAttr lhs_dilation, /*optional*/::mlir::ArrayAttr rhs_dilation, /*optional*/::mlir::IntegerAttr batch_group_count, /*optional*/::mlir::IntegerAttr feature_group_count, /*optional*/::mlir::StringAttr dimension_numbers, /*optional*/::mlir::IntegerAttr lhs_quantization_axis, ::mlir::IntegerAttr lhs_quantization_min_val, ::mlir::IntegerAttr lhs_quantization_max_val, /*optional*/::mlir::IntegerAttr rhs_quantization_axis, ::mlir::IntegerAttr rhs_quantization_min_val, ::mlir::IntegerAttr rhs_quantization_max_val, /*optional*/::mlir::IntegerAttr output_quantization_axis, ::mlir::IntegerAttr output_quantization_min_val, ::mlir::IntegerAttr output_quantization_max_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value lhs_scales, ::mlir::Value lhs_zero_points, ::mlir::Value rhs_scales, ::mlir::Value rhs_zero_points, ::mlir::Value output_scales, ::mlir::Value output_zero_points, /*optional*/::mlir::ArrayAttr window_strides, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr explicit_padding, /*optional*/::mlir::ArrayAttr lhs_dilation, /*optional*/::mlir::ArrayAttr rhs_dilation, /*optional*/uint64_t batch_group_count, /*optional*/uint64_t feature_group_count, /*optional*/::llvm::StringRef dimension_numbers, /*optional*/uint64_t lhs_quantization_axis, uint64_t lhs_quantization_min_val, uint64_t lhs_quantization_max_val, /*optional*/uint64_t rhs_quantization_axis, uint64_t rhs_quantization_min_val, uint64_t rhs_quantization_max_val, /*optional*/uint64_t output_quantization_axis, uint64_t output_quantization_min_val, uint64_t output_quantization_max_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value lhs_scales, ::mlir::Value lhs_zero_points, ::mlir::Value rhs_scales, ::mlir::Value rhs_zero_points, ::mlir::Value output_scales, ::mlir::Value output_zero_points, /*optional*/::mlir::ArrayAttr window_strides, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr explicit_padding, /*optional*/::mlir::ArrayAttr lhs_dilation, /*optional*/::mlir::ArrayAttr rhs_dilation, /*optional*/uint64_t batch_group_count, /*optional*/uint64_t feature_group_count, /*optional*/::llvm::StringRef dimension_numbers, /*optional*/uint64_t lhs_quantization_axis, uint64_t lhs_quantization_min_val, uint64_t lhs_quantization_max_val, /*optional*/uint64_t rhs_quantization_axis, uint64_t rhs_quantization_min_val, uint64_t rhs_quantization_max_val, /*optional*/uint64_t output_quantization_axis, uint64_t output_quantization_min_val, uint64_t output_quantization_max_val); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 19 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::UniformQuantizedConvolutionOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::UniformQuantizedDotHybridOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class UniformQuantizedDotHybridOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + UniformQuantizedDotHybridOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + UniformQuantizedDotHybridOpGenericAdaptorBase(UniformQuantizedDotHybridOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getRhsQuantizationAxisAttr(); + uint64_t getRhsQuantizationAxis(); + ::mlir::IntegerAttr getRhsQuantizationMinValAttr(); + uint64_t getRhsQuantizationMinVal(); + ::mlir::IntegerAttr getRhsQuantizationMaxValAttr(); + uint64_t getRhsQuantizationMaxVal(); +}; +} // namespace detail +template +class UniformQuantizedDotHybridOpGenericAdaptor : public detail::UniformQuantizedDotHybridOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::UniformQuantizedDotHybridOpGenericAdaptorBase; +public: + UniformQuantizedDotHybridOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + UniformQuantizedDotHybridOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : UniformQuantizedDotHybridOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + UniformQuantizedDotHybridOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + ValueT getRhsScales() { + return (*getODSOperands(2).begin()); + } + + ValueT getRhsZeroPoints() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class UniformQuantizedDotHybridOpAdaptor : public UniformQuantizedDotHybridOpGenericAdaptor<::mlir::ValueRange> { +public: + using UniformQuantizedDotHybridOpGenericAdaptor::UniformQuantizedDotHybridOpGenericAdaptor; + UniformQuantizedDotHybridOpAdaptor(UniformQuantizedDotHybridOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class UniformQuantizedDotHybridOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = UniformQuantizedDotHybridOpAdaptor; + template + using GenericAdaptor = UniformQuantizedDotHybridOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tlhs"), ::llvm::StringRef("Tout"), ::llvm::StringRef("Trhs"), ::llvm::StringRef("rhs_quantization_axis"), ::llvm::StringRef("rhs_quantization_max_val"), ::llvm::StringRef("rhs_quantization_min_val")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTlhsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTlhsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getToutAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getToutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTrhsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTrhsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getRhsQuantizationAxisAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getRhsQuantizationAxisAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getRhsQuantizationMaxValAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getRhsQuantizationMaxValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getRhsQuantizationMinValAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getRhsQuantizationMinValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.UniformQuantizedDotHybrid"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLhs(); + ::mlir::TypedValue<::mlir::TensorType> getRhs(); + ::mlir::TypedValue<::mlir::TensorType> getRhsScales(); + ::mlir::TypedValue<::mlir::TensorType> getRhsZeroPoints(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + ::mlir::OpOperand &getRhsScalesMutable(); + ::mlir::OpOperand &getRhsZeroPointsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getRhsQuantizationAxisAttr(); + uint64_t getRhsQuantizationAxis(); + ::mlir::IntegerAttr getRhsQuantizationMinValAttr(); + uint64_t getRhsQuantizationMinVal(); + ::mlir::IntegerAttr getRhsQuantizationMaxValAttr(); + uint64_t getRhsQuantizationMaxVal(); + ::mlir::Type getTlhs(); + ::mlir::Type getTrhs(); + ::mlir::Type getTout(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setRhsQuantizationAxisAttr(::mlir::IntegerAttr attr); + void setRhsQuantizationAxis(::std::optional attrValue); + void setRhsQuantizationMinValAttr(::mlir::IntegerAttr attr); + void setRhsQuantizationMinVal(uint64_t attrValue); + void setRhsQuantizationMaxValAttr(::mlir::IntegerAttr attr); + void setRhsQuantizationMaxVal(uint64_t attrValue); + ::mlir::Attribute removeRhsQuantizationAxisAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value rhs_scales, ::mlir::Value rhs_zero_points, /*optional*/::mlir::IntegerAttr rhs_quantization_axis, ::mlir::IntegerAttr rhs_quantization_min_val, ::mlir::IntegerAttr rhs_quantization_max_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value rhs_scales, ::mlir::Value rhs_zero_points, /*optional*/::mlir::IntegerAttr rhs_quantization_axis, ::mlir::IntegerAttr rhs_quantization_min_val, ::mlir::IntegerAttr rhs_quantization_max_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value rhs_scales, ::mlir::Value rhs_zero_points, /*optional*/uint64_t rhs_quantization_axis, uint64_t rhs_quantization_min_val, uint64_t rhs_quantization_max_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value rhs_scales, ::mlir::Value rhs_zero_points, /*optional*/uint64_t rhs_quantization_axis, uint64_t rhs_quantization_min_val, uint64_t rhs_quantization_max_val); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::UniformQuantizedDotHybridOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::UniformQuantizedDotOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class UniformQuantizedDotOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + UniformQuantizedDotOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + UniformQuantizedDotOpGenericAdaptorBase(UniformQuantizedDotOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getLhsQuantizationAxisAttr(); + uint64_t getLhsQuantizationAxis(); + ::mlir::IntegerAttr getLhsQuantizationMinValAttr(); + uint64_t getLhsQuantizationMinVal(); + ::mlir::IntegerAttr getLhsQuantizationMaxValAttr(); + uint64_t getLhsQuantizationMaxVal(); + ::mlir::IntegerAttr getRhsQuantizationAxisAttr(); + uint64_t getRhsQuantizationAxis(); + ::mlir::IntegerAttr getRhsQuantizationMinValAttr(); + uint64_t getRhsQuantizationMinVal(); + ::mlir::IntegerAttr getRhsQuantizationMaxValAttr(); + uint64_t getRhsQuantizationMaxVal(); + ::mlir::IntegerAttr getOutputQuantizationAxisAttr(); + uint64_t getOutputQuantizationAxis(); + ::mlir::IntegerAttr getOutputQuantizationMinValAttr(); + uint64_t getOutputQuantizationMinVal(); + ::mlir::IntegerAttr getOutputQuantizationMaxValAttr(); + uint64_t getOutputQuantizationMaxVal(); +}; +} // namespace detail +template +class UniformQuantizedDotOpGenericAdaptor : public detail::UniformQuantizedDotOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::UniformQuantizedDotOpGenericAdaptorBase; +public: + UniformQuantizedDotOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + UniformQuantizedDotOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : UniformQuantizedDotOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + UniformQuantizedDotOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + ValueT getLhsScales() { + return (*getODSOperands(2).begin()); + } + + ValueT getLhsZeroPoints() { + return (*getODSOperands(3).begin()); + } + + ValueT getRhsScales() { + return (*getODSOperands(4).begin()); + } + + ValueT getRhsZeroPoints() { + return (*getODSOperands(5).begin()); + } + + ValueT getOutputScales() { + return (*getODSOperands(6).begin()); + } + + ValueT getOutputZeroPoints() { + return (*getODSOperands(7).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class UniformQuantizedDotOpAdaptor : public UniformQuantizedDotOpGenericAdaptor<::mlir::ValueRange> { +public: + using UniformQuantizedDotOpGenericAdaptor::UniformQuantizedDotOpGenericAdaptor; + UniformQuantizedDotOpAdaptor(UniformQuantizedDotOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class UniformQuantizedDotOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<8>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = UniformQuantizedDotOpAdaptor; + template + using GenericAdaptor = UniformQuantizedDotOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tin"), ::llvm::StringRef("Tout"), ::llvm::StringRef("lhs_quantization_axis"), ::llvm::StringRef("lhs_quantization_max_val"), ::llvm::StringRef("lhs_quantization_min_val"), ::llvm::StringRef("output_quantization_axis"), ::llvm::StringRef("output_quantization_max_val"), ::llvm::StringRef("output_quantization_min_val"), ::llvm::StringRef("rhs_quantization_axis"), ::llvm::StringRef("rhs_quantization_max_val"), ::llvm::StringRef("rhs_quantization_min_val")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTinAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTinAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getToutAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getToutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getLhsQuantizationAxisAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getLhsQuantizationAxisAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getLhsQuantizationMaxValAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getLhsQuantizationMaxValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getLhsQuantizationMinValAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getLhsQuantizationMinValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getOutputQuantizationAxisAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getOutputQuantizationAxisAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getOutputQuantizationMaxValAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getOutputQuantizationMaxValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getOutputQuantizationMinValAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getOutputQuantizationMinValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getRhsQuantizationAxisAttrName() { + return getAttributeNameForIndex(8); + } + + static ::mlir::StringAttr getRhsQuantizationAxisAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 8); + } + + ::mlir::StringAttr getRhsQuantizationMaxValAttrName() { + return getAttributeNameForIndex(9); + } + + static ::mlir::StringAttr getRhsQuantizationMaxValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 9); + } + + ::mlir::StringAttr getRhsQuantizationMinValAttrName() { + return getAttributeNameForIndex(10); + } + + static ::mlir::StringAttr getRhsQuantizationMinValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 10); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.UniformQuantizedDot"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLhs(); + ::mlir::TypedValue<::mlir::TensorType> getRhs(); + ::mlir::TypedValue<::mlir::TensorType> getLhsScales(); + ::mlir::TypedValue<::mlir::TensorType> getLhsZeroPoints(); + ::mlir::TypedValue<::mlir::TensorType> getRhsScales(); + ::mlir::TypedValue<::mlir::TensorType> getRhsZeroPoints(); + ::mlir::TypedValue<::mlir::TensorType> getOutputScales(); + ::mlir::TypedValue<::mlir::TensorType> getOutputZeroPoints(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + ::mlir::OpOperand &getLhsScalesMutable(); + ::mlir::OpOperand &getLhsZeroPointsMutable(); + ::mlir::OpOperand &getRhsScalesMutable(); + ::mlir::OpOperand &getRhsZeroPointsMutable(); + ::mlir::OpOperand &getOutputScalesMutable(); + ::mlir::OpOperand &getOutputZeroPointsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getLhsQuantizationAxisAttr(); + uint64_t getLhsQuantizationAxis(); + ::mlir::IntegerAttr getLhsQuantizationMinValAttr(); + uint64_t getLhsQuantizationMinVal(); + ::mlir::IntegerAttr getLhsQuantizationMaxValAttr(); + uint64_t getLhsQuantizationMaxVal(); + ::mlir::IntegerAttr getRhsQuantizationAxisAttr(); + uint64_t getRhsQuantizationAxis(); + ::mlir::IntegerAttr getRhsQuantizationMinValAttr(); + uint64_t getRhsQuantizationMinVal(); + ::mlir::IntegerAttr getRhsQuantizationMaxValAttr(); + uint64_t getRhsQuantizationMaxVal(); + ::mlir::IntegerAttr getOutputQuantizationAxisAttr(); + uint64_t getOutputQuantizationAxis(); + ::mlir::IntegerAttr getOutputQuantizationMinValAttr(); + uint64_t getOutputQuantizationMinVal(); + ::mlir::IntegerAttr getOutputQuantizationMaxValAttr(); + uint64_t getOutputQuantizationMaxVal(); + ::mlir::Type getTin(); + ::mlir::Type getTout(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setLhsQuantizationAxisAttr(::mlir::IntegerAttr attr); + void setLhsQuantizationAxis(::std::optional attrValue); + void setLhsQuantizationMinValAttr(::mlir::IntegerAttr attr); + void setLhsQuantizationMinVal(uint64_t attrValue); + void setLhsQuantizationMaxValAttr(::mlir::IntegerAttr attr); + void setLhsQuantizationMaxVal(uint64_t attrValue); + void setRhsQuantizationAxisAttr(::mlir::IntegerAttr attr); + void setRhsQuantizationAxis(::std::optional attrValue); + void setRhsQuantizationMinValAttr(::mlir::IntegerAttr attr); + void setRhsQuantizationMinVal(uint64_t attrValue); + void setRhsQuantizationMaxValAttr(::mlir::IntegerAttr attr); + void setRhsQuantizationMaxVal(uint64_t attrValue); + void setOutputQuantizationAxisAttr(::mlir::IntegerAttr attr); + void setOutputQuantizationAxis(::std::optional attrValue); + void setOutputQuantizationMinValAttr(::mlir::IntegerAttr attr); + void setOutputQuantizationMinVal(uint64_t attrValue); + void setOutputQuantizationMaxValAttr(::mlir::IntegerAttr attr); + void setOutputQuantizationMaxVal(uint64_t attrValue); + ::mlir::Attribute removeLhsQuantizationAxisAttr(); + ::mlir::Attribute removeRhsQuantizationAxisAttr(); + ::mlir::Attribute removeOutputQuantizationAxisAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value lhs_scales, ::mlir::Value lhs_zero_points, ::mlir::Value rhs_scales, ::mlir::Value rhs_zero_points, ::mlir::Value output_scales, ::mlir::Value output_zero_points, /*optional*/::mlir::IntegerAttr lhs_quantization_axis, ::mlir::IntegerAttr lhs_quantization_min_val, ::mlir::IntegerAttr lhs_quantization_max_val, /*optional*/::mlir::IntegerAttr rhs_quantization_axis, ::mlir::IntegerAttr rhs_quantization_min_val, ::mlir::IntegerAttr rhs_quantization_max_val, /*optional*/::mlir::IntegerAttr output_quantization_axis, ::mlir::IntegerAttr output_quantization_min_val, ::mlir::IntegerAttr output_quantization_max_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value lhs_scales, ::mlir::Value lhs_zero_points, ::mlir::Value rhs_scales, ::mlir::Value rhs_zero_points, ::mlir::Value output_scales, ::mlir::Value output_zero_points, /*optional*/::mlir::IntegerAttr lhs_quantization_axis, ::mlir::IntegerAttr lhs_quantization_min_val, ::mlir::IntegerAttr lhs_quantization_max_val, /*optional*/::mlir::IntegerAttr rhs_quantization_axis, ::mlir::IntegerAttr rhs_quantization_min_val, ::mlir::IntegerAttr rhs_quantization_max_val, /*optional*/::mlir::IntegerAttr output_quantization_axis, ::mlir::IntegerAttr output_quantization_min_val, ::mlir::IntegerAttr output_quantization_max_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value lhs_scales, ::mlir::Value lhs_zero_points, ::mlir::Value rhs_scales, ::mlir::Value rhs_zero_points, ::mlir::Value output_scales, ::mlir::Value output_zero_points, /*optional*/uint64_t lhs_quantization_axis, uint64_t lhs_quantization_min_val, uint64_t lhs_quantization_max_val, /*optional*/uint64_t rhs_quantization_axis, uint64_t rhs_quantization_min_val, uint64_t rhs_quantization_max_val, /*optional*/uint64_t output_quantization_axis, uint64_t output_quantization_min_val, uint64_t output_quantization_max_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value lhs_scales, ::mlir::Value lhs_zero_points, ::mlir::Value rhs_scales, ::mlir::Value rhs_zero_points, ::mlir::Value output_scales, ::mlir::Value output_zero_points, /*optional*/uint64_t lhs_quantization_axis, uint64_t lhs_quantization_min_val, uint64_t lhs_quantization_max_val, /*optional*/uint64_t rhs_quantization_axis, uint64_t rhs_quantization_min_val, uint64_t rhs_quantization_max_val, /*optional*/uint64_t output_quantization_axis, uint64_t output_quantization_min_val, uint64_t output_quantization_max_val); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 11 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::UniformQuantizedDotOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::UniformRequantizeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class UniformRequantizeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + UniformRequantizeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + UniformRequantizeOpGenericAdaptorBase(UniformRequantizeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getInputQuantizationAxisAttr(); + uint64_t getInputQuantizationAxis(); + ::mlir::IntegerAttr getInputQuantizationMinValAttr(); + uint64_t getInputQuantizationMinVal(); + ::mlir::IntegerAttr getInputQuantizationMaxValAttr(); + uint64_t getInputQuantizationMaxVal(); + ::mlir::IntegerAttr getOutputQuantizationAxisAttr(); + uint64_t getOutputQuantizationAxis(); + ::mlir::IntegerAttr getOutputQuantizationMinValAttr(); + uint64_t getOutputQuantizationMinVal(); + ::mlir::IntegerAttr getOutputQuantizationMaxValAttr(); + uint64_t getOutputQuantizationMaxVal(); +}; +} // namespace detail +template +class UniformRequantizeOpGenericAdaptor : public detail::UniformRequantizeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::UniformRequantizeOpGenericAdaptorBase; +public: + UniformRequantizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + UniformRequantizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : UniformRequantizeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + UniformRequantizeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getInputScales() { + return (*getODSOperands(1).begin()); + } + + ValueT getInputZeroPoints() { + return (*getODSOperands(2).begin()); + } + + ValueT getOutputScales() { + return (*getODSOperands(3).begin()); + } + + ValueT getOutputZeroPoints() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class UniformRequantizeOpAdaptor : public UniformRequantizeOpGenericAdaptor<::mlir::ValueRange> { +public: + using UniformRequantizeOpGenericAdaptor::UniformRequantizeOpGenericAdaptor; + UniformRequantizeOpAdaptor(UniformRequantizeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class UniformRequantizeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<5>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = UniformRequantizeOpAdaptor; + template + using GenericAdaptor = UniformRequantizeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tin"), ::llvm::StringRef("Tout"), ::llvm::StringRef("input_quantization_axis"), ::llvm::StringRef("input_quantization_max_val"), ::llvm::StringRef("input_quantization_min_val"), ::llvm::StringRef("output_quantization_axis"), ::llvm::StringRef("output_quantization_max_val"), ::llvm::StringRef("output_quantization_min_val")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTinAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTinAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getToutAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getToutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getInputQuantizationAxisAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getInputQuantizationAxisAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getInputQuantizationMaxValAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getInputQuantizationMaxValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getInputQuantizationMinValAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getInputQuantizationMinValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getOutputQuantizationAxisAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getOutputQuantizationAxisAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getOutputQuantizationMaxValAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getOutputQuantizationMaxValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getOutputQuantizationMinValAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getOutputQuantizationMinValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.UniformRequantize"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getInputScales(); + ::mlir::TypedValue<::mlir::TensorType> getInputZeroPoints(); + ::mlir::TypedValue<::mlir::TensorType> getOutputScales(); + ::mlir::TypedValue<::mlir::TensorType> getOutputZeroPoints(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getInputScalesMutable(); + ::mlir::OpOperand &getInputZeroPointsMutable(); + ::mlir::OpOperand &getOutputScalesMutable(); + ::mlir::OpOperand &getOutputZeroPointsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getInputQuantizationAxisAttr(); + uint64_t getInputQuantizationAxis(); + ::mlir::IntegerAttr getInputQuantizationMinValAttr(); + uint64_t getInputQuantizationMinVal(); + ::mlir::IntegerAttr getInputQuantizationMaxValAttr(); + uint64_t getInputQuantizationMaxVal(); + ::mlir::IntegerAttr getOutputQuantizationAxisAttr(); + uint64_t getOutputQuantizationAxis(); + ::mlir::IntegerAttr getOutputQuantizationMinValAttr(); + uint64_t getOutputQuantizationMinVal(); + ::mlir::IntegerAttr getOutputQuantizationMaxValAttr(); + uint64_t getOutputQuantizationMaxVal(); + ::mlir::Type getTin(); + ::mlir::Type getTout(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setInputQuantizationAxisAttr(::mlir::IntegerAttr attr); + void setInputQuantizationAxis(::std::optional attrValue); + void setInputQuantizationMinValAttr(::mlir::IntegerAttr attr); + void setInputQuantizationMinVal(uint64_t attrValue); + void setInputQuantizationMaxValAttr(::mlir::IntegerAttr attr); + void setInputQuantizationMaxVal(uint64_t attrValue); + void setOutputQuantizationAxisAttr(::mlir::IntegerAttr attr); + void setOutputQuantizationAxis(::std::optional attrValue); + void setOutputQuantizationMinValAttr(::mlir::IntegerAttr attr); + void setOutputQuantizationMinVal(uint64_t attrValue); + void setOutputQuantizationMaxValAttr(::mlir::IntegerAttr attr); + void setOutputQuantizationMaxVal(uint64_t attrValue); + ::mlir::Attribute removeInputQuantizationAxisAttr(); + ::mlir::Attribute removeOutputQuantizationAxisAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value input_scales, ::mlir::Value input_zero_points, ::mlir::Value output_scales, ::mlir::Value output_zero_points, /*optional*/::mlir::IntegerAttr input_quantization_axis, ::mlir::IntegerAttr input_quantization_min_val, ::mlir::IntegerAttr input_quantization_max_val, /*optional*/::mlir::IntegerAttr output_quantization_axis, ::mlir::IntegerAttr output_quantization_min_val, ::mlir::IntegerAttr output_quantization_max_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value input_scales, ::mlir::Value input_zero_points, ::mlir::Value output_scales, ::mlir::Value output_zero_points, /*optional*/::mlir::IntegerAttr input_quantization_axis, ::mlir::IntegerAttr input_quantization_min_val, ::mlir::IntegerAttr input_quantization_max_val, /*optional*/::mlir::IntegerAttr output_quantization_axis, ::mlir::IntegerAttr output_quantization_min_val, ::mlir::IntegerAttr output_quantization_max_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value input_scales, ::mlir::Value input_zero_points, ::mlir::Value output_scales, ::mlir::Value output_zero_points, /*optional*/uint64_t input_quantization_axis, uint64_t input_quantization_min_val, uint64_t input_quantization_max_val, /*optional*/uint64_t output_quantization_axis, uint64_t output_quantization_min_val, uint64_t output_quantization_max_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value input_scales, ::mlir::Value input_zero_points, ::mlir::Value output_scales, ::mlir::Value output_zero_points, /*optional*/uint64_t input_quantization_axis, uint64_t input_quantization_min_val, uint64_t input_quantization_max_val, /*optional*/uint64_t output_quantization_axis, uint64_t output_quantization_min_val, uint64_t output_quantization_max_val); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 8 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::UniformRequantizeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::UniqueOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class UniqueOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + UniqueOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + UniqueOpGenericAdaptorBase(UniqueOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class UniqueOpGenericAdaptor : public detail::UniqueOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::UniqueOpGenericAdaptorBase; +public: + UniqueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + UniqueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : UniqueOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + UniqueOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class UniqueOpAdaptor : public UniqueOpGenericAdaptor<::mlir::ValueRange> { +public: + using UniqueOpGenericAdaptor::UniqueOpGenericAdaptor; + UniqueOpAdaptor(UniqueOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class UniqueOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = UniqueOpAdaptor; + template + using GenericAdaptor = UniqueOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("out_idx")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutIdxAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutIdxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Unique"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::TypedValue<::mlir::TensorType> getIdx(); + ::mlir::Type getT(); + ::mlir::Type getOutIdx(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Type idx, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::UniqueOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::UniqueV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class UniqueV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + UniqueV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + UniqueV2OpGenericAdaptorBase(UniqueV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class UniqueV2OpGenericAdaptor : public detail::UniqueV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::UniqueV2OpGenericAdaptorBase; +public: + UniqueV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + UniqueV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : UniqueV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + UniqueV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getAxis() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class UniqueV2OpAdaptor : public UniqueV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using UniqueV2OpGenericAdaptor::UniqueV2OpGenericAdaptor; + UniqueV2OpAdaptor(UniqueV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class UniqueV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = UniqueV2OpAdaptor; + template + using GenericAdaptor = UniqueV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Taxis"), ::llvm::StringRef("out_idx")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTaxisAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTaxisAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOutIdxAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOutIdxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.UniqueV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getAxis(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getAxisMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::TypedValue<::mlir::TensorType> getIdx(); + ::mlir::Type getT(); + ::mlir::Type getTaxis(); + ::mlir::Type getOutIdx(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Type idx, ::mlir::Value x, ::mlir::Value axis); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value axis); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::UniqueV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::UnpackOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class UnpackOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + UnpackOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + UnpackOpGenericAdaptorBase(UnpackOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getAxisAttr(); + uint64_t getAxis(); +}; +} // namespace detail +template +class UnpackOpGenericAdaptor : public detail::UnpackOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::UnpackOpGenericAdaptorBase; +public: + UnpackOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + UnpackOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : UnpackOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + UnpackOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getValue() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class UnpackOpAdaptor : public UnpackOpGenericAdaptor<::mlir::ValueRange> { +public: + using UnpackOpGenericAdaptor::UnpackOpGenericAdaptor; + UnpackOpAdaptor(UnpackOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class UnpackOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = UnpackOpAdaptor; + template + using GenericAdaptor = UnpackOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("axis"), ::llvm::StringRef("num")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAxisAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAxisAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getNumAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getNumAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Unpack"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getValue(); + ::mlir::OpOperand &getValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutput(); + ::mlir::IntegerAttr getAxisAttr(); + uint64_t getAxis(); + ::mlir::Type getT(); + size_t getNum(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setAxisAttr(::mlir::IntegerAttr attr); + void setAxis(::std::optional attrValue); + ::mlir::Attribute removeAxisAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::Value value, /*optional*/::mlir::IntegerAttr axis); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::Value value, /*optional*/uint64_t axis = 0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::UnpackOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::UnsortedSegmentMaxOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class UnsortedSegmentMaxOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + UnsortedSegmentMaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + UnsortedSegmentMaxOpGenericAdaptorBase(UnsortedSegmentMaxOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class UnsortedSegmentMaxOpGenericAdaptor : public detail::UnsortedSegmentMaxOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::UnsortedSegmentMaxOpGenericAdaptorBase; +public: + UnsortedSegmentMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + UnsortedSegmentMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : UnsortedSegmentMaxOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + UnsortedSegmentMaxOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getData() { + return (*getODSOperands(0).begin()); + } + + ValueT getSegmentIds() { + return (*getODSOperands(1).begin()); + } + + ValueT getNumSegments() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class UnsortedSegmentMaxOpAdaptor : public UnsortedSegmentMaxOpGenericAdaptor<::mlir::ValueRange> { +public: + using UnsortedSegmentMaxOpGenericAdaptor::UnsortedSegmentMaxOpGenericAdaptor; + UnsortedSegmentMaxOpAdaptor(UnsortedSegmentMaxOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class UnsortedSegmentMaxOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = UnsortedSegmentMaxOpAdaptor; + template + using GenericAdaptor = UnsortedSegmentMaxOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices"), ::llvm::StringRef("Tnumsegments")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTnumsegmentsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTnumsegmentsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.UnsortedSegmentMax"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getData(); + ::mlir::TypedValue<::mlir::TensorType> getSegmentIds(); + ::mlir::TypedValue<::mlir::TensorType> getNumSegments(); + ::mlir::OpOperand &getDataMutable(); + ::mlir::OpOperand &getSegmentIdsMutable(); + ::mlir::OpOperand &getNumSegmentsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + ::mlir::Type getTnumsegments(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value data, ::mlir::Value segment_ids, ::mlir::Value num_segments); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value data, ::mlir::Value segment_ids, ::mlir::Value num_segments); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::UnsortedSegmentMaxOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::UnsortedSegmentMinOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class UnsortedSegmentMinOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + UnsortedSegmentMinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + UnsortedSegmentMinOpGenericAdaptorBase(UnsortedSegmentMinOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class UnsortedSegmentMinOpGenericAdaptor : public detail::UnsortedSegmentMinOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::UnsortedSegmentMinOpGenericAdaptorBase; +public: + UnsortedSegmentMinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + UnsortedSegmentMinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : UnsortedSegmentMinOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + UnsortedSegmentMinOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getData() { + return (*getODSOperands(0).begin()); + } + + ValueT getSegmentIds() { + return (*getODSOperands(1).begin()); + } + + ValueT getNumSegments() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class UnsortedSegmentMinOpAdaptor : public UnsortedSegmentMinOpGenericAdaptor<::mlir::ValueRange> { +public: + using UnsortedSegmentMinOpGenericAdaptor::UnsortedSegmentMinOpGenericAdaptor; + UnsortedSegmentMinOpAdaptor(UnsortedSegmentMinOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class UnsortedSegmentMinOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = UnsortedSegmentMinOpAdaptor; + template + using GenericAdaptor = UnsortedSegmentMinOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices"), ::llvm::StringRef("Tnumsegments")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTnumsegmentsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTnumsegmentsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.UnsortedSegmentMin"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getData(); + ::mlir::TypedValue<::mlir::TensorType> getSegmentIds(); + ::mlir::TypedValue<::mlir::TensorType> getNumSegments(); + ::mlir::OpOperand &getDataMutable(); + ::mlir::OpOperand &getSegmentIdsMutable(); + ::mlir::OpOperand &getNumSegmentsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + ::mlir::Type getTnumsegments(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value data, ::mlir::Value segment_ids, ::mlir::Value num_segments); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value data, ::mlir::Value segment_ids, ::mlir::Value num_segments); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::UnsortedSegmentMinOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::UnsortedSegmentProdOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class UnsortedSegmentProdOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + UnsortedSegmentProdOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + UnsortedSegmentProdOpGenericAdaptorBase(UnsortedSegmentProdOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class UnsortedSegmentProdOpGenericAdaptor : public detail::UnsortedSegmentProdOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::UnsortedSegmentProdOpGenericAdaptorBase; +public: + UnsortedSegmentProdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + UnsortedSegmentProdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : UnsortedSegmentProdOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + UnsortedSegmentProdOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getData() { + return (*getODSOperands(0).begin()); + } + + ValueT getSegmentIds() { + return (*getODSOperands(1).begin()); + } + + ValueT getNumSegments() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class UnsortedSegmentProdOpAdaptor : public UnsortedSegmentProdOpGenericAdaptor<::mlir::ValueRange> { +public: + using UnsortedSegmentProdOpGenericAdaptor::UnsortedSegmentProdOpGenericAdaptor; + UnsortedSegmentProdOpAdaptor(UnsortedSegmentProdOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class UnsortedSegmentProdOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = UnsortedSegmentProdOpAdaptor; + template + using GenericAdaptor = UnsortedSegmentProdOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices"), ::llvm::StringRef("Tnumsegments")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTnumsegmentsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTnumsegmentsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.UnsortedSegmentProd"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getData(); + ::mlir::TypedValue<::mlir::TensorType> getSegmentIds(); + ::mlir::TypedValue<::mlir::TensorType> getNumSegments(); + ::mlir::OpOperand &getDataMutable(); + ::mlir::OpOperand &getSegmentIdsMutable(); + ::mlir::OpOperand &getNumSegmentsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + ::mlir::Type getTnumsegments(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value data, ::mlir::Value segment_ids, ::mlir::Value num_segments); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value data, ::mlir::Value segment_ids, ::mlir::Value num_segments); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::UnsortedSegmentProdOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::UnsortedSegmentSumOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class UnsortedSegmentSumOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + UnsortedSegmentSumOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + UnsortedSegmentSumOpGenericAdaptorBase(UnsortedSegmentSumOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class UnsortedSegmentSumOpGenericAdaptor : public detail::UnsortedSegmentSumOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::UnsortedSegmentSumOpGenericAdaptorBase; +public: + UnsortedSegmentSumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + UnsortedSegmentSumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : UnsortedSegmentSumOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + UnsortedSegmentSumOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getData() { + return (*getODSOperands(0).begin()); + } + + ValueT getSegmentIds() { + return (*getODSOperands(1).begin()); + } + + ValueT getNumSegments() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class UnsortedSegmentSumOpAdaptor : public UnsortedSegmentSumOpGenericAdaptor<::mlir::ValueRange> { +public: + using UnsortedSegmentSumOpGenericAdaptor::UnsortedSegmentSumOpGenericAdaptor; + UnsortedSegmentSumOpAdaptor(UnsortedSegmentSumOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class UnsortedSegmentSumOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = UnsortedSegmentSumOpAdaptor; + template + using GenericAdaptor = UnsortedSegmentSumOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices"), ::llvm::StringRef("Tnumsegments")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTnumsegmentsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTnumsegmentsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.UnsortedSegmentSum"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getData(); + ::mlir::TypedValue<::mlir::TensorType> getSegmentIds(); + ::mlir::TypedValue<::mlir::TensorType> getNumSegments(); + ::mlir::OpOperand &getDataMutable(); + ::mlir::OpOperand &getSegmentIdsMutable(); + ::mlir::OpOperand &getNumSegmentsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + ::mlir::Type getTnumsegments(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value data, ::mlir::Value segment_ids, ::mlir::Value num_segments); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value data, ::mlir::Value segment_ids, ::mlir::Value num_segments); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::UnsortedSegmentSumOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::UpperBoundOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class UpperBoundOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + UpperBoundOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + UpperBoundOpGenericAdaptorBase(UpperBoundOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class UpperBoundOpGenericAdaptor : public detail::UpperBoundOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::UpperBoundOpGenericAdaptorBase; +public: + UpperBoundOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + UpperBoundOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : UpperBoundOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + UpperBoundOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSortedInputs() { + return (*getODSOperands(0).begin()); + } + + ValueT getValues() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class UpperBoundOpAdaptor : public UpperBoundOpGenericAdaptor<::mlir::ValueRange> { +public: + using UpperBoundOpGenericAdaptor::UpperBoundOpGenericAdaptor; + UpperBoundOpAdaptor(UpperBoundOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class UpperBoundOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = UpperBoundOpAdaptor; + template + using GenericAdaptor = UpperBoundOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("out_type")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutTypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.UpperBound"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSortedInputs(); + ::mlir::TypedValue<::mlir::TensorType> getValues(); + ::mlir::OpOperand &getSortedInputsMutable(); + ::mlir::OpOperand &getValuesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getOutType(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value sorted_inputs, ::mlir::Value values); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value sorted_inputs, ::mlir::Value values); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::UpperBoundOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::VarHandleOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VarHandleOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VarHandleOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VarHandleOpGenericAdaptorBase(VarHandleOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getContainerAttr(); + ::llvm::StringRef getContainer(); + ::mlir::StringAttr getSharedNameAttr(); + ::llvm::StringRef getSharedName(); +}; +} // namespace detail +template +class VarHandleOpGenericAdaptor : public detail::VarHandleOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VarHandleOpGenericAdaptorBase; +public: + VarHandleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VarHandleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VarHandleOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VarHandleOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VarHandleOpAdaptor : public VarHandleOpGenericAdaptor<::mlir::ValueRange> { +public: + using VarHandleOpGenericAdaptor::VarHandleOpGenericAdaptor; + VarHandleOpAdaptor(VarHandleOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VarHandleOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ResourceHandleAllocatorInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = VarHandleOpAdaptor; + template + using GenericAdaptor = VarHandleOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("container"), ::llvm::StringRef("dtype"), ::llvm::StringRef("shape"), ::llvm::StringRef("shared_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getContainerAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getContainerAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShapeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSharedNameAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSharedNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.VarHandleOp"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResource(); + ::mlir::StringAttr getContainerAttr(); + ::llvm::StringRef getContainer(); + ::mlir::StringAttr getSharedNameAttr(); + ::llvm::StringRef getSharedName(); + ::mlir::Type getDtype(); + ShapedType getShape(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setContainerAttr(::mlir::StringAttr attr); + void setContainer(::llvm::StringRef attrValue); + void setSharedNameAttr(::mlir::StringAttr attr); + void setSharedName(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resource, ::mlir::StringAttr container, ::mlir::StringAttr shared_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr container, ::mlir::StringAttr shared_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resource, ::llvm::StringRef container = "", ::llvm::StringRef shared_name = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef container = "", ::llvm::StringRef shared_name = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultAttrs(const ::mlir::OperationName &opName, ::mlir::NamedAttrList &attributes); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + llvm::SmallVector GetResourceHandleValueAndIdList(llvm::SmallDenseMap&resource_handle_id_map, int64_t&next_id); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + TensorType resource_subtype() { return resource_type().getSubtypes()[0]; } + + ResourceType resource_type() { + return getElementTypeOrSelf(getResource()).cast(); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::VarHandleOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::VarIsInitializedOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VarIsInitializedOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VarIsInitializedOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VarIsInitializedOpGenericAdaptorBase(VarIsInitializedOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class VarIsInitializedOpGenericAdaptor : public detail::VarIsInitializedOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VarIsInitializedOpGenericAdaptorBase; +public: + VarIsInitializedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VarIsInitializedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VarIsInitializedOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VarIsInitializedOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getResource() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VarIsInitializedOpAdaptor : public VarIsInitializedOpGenericAdaptor<::mlir::ValueRange> { +public: + using VarIsInitializedOpGenericAdaptor::VarIsInitializedOpGenericAdaptor; + VarIsInitializedOpAdaptor(VarIsInitializedOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VarIsInitializedOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = VarIsInitializedOpAdaptor; + template + using GenericAdaptor = VarIsInitializedOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.VarIsInitializedOp"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResource(); + ::mlir::OpOperand &getResourceMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getIsInitialized(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type is_initialized, ::mlir::Value resource); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value resource); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::VarIsInitializedOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::VariableOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VariableOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VariableOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VariableOpGenericAdaptorBase(VariableOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Attribute getShapeAttr(); + std::optional> getShape(); + ::mlir::StringAttr getContainerAttr(); + ::llvm::StringRef getContainer(); + ::mlir::StringAttr getSharedNameAttr(); + ::llvm::StringRef getSharedName(); +}; +} // namespace detail +template +class VariableOpGenericAdaptor : public detail::VariableOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VariableOpGenericAdaptorBase; +public: + VariableOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VariableOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VariableOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VariableOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VariableOpAdaptor : public VariableOpGenericAdaptor<::mlir::ValueRange> { +public: + using VariableOpGenericAdaptor::VariableOpGenericAdaptor; + VariableOpAdaptor(VariableOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VariableOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = VariableOpAdaptor; + template + using GenericAdaptor = VariableOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("container"), ::llvm::StringRef("dtype"), ::llvm::StringRef("shape"), ::llvm::StringRef("shared_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getContainerAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getContainerAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShapeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSharedNameAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSharedNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Variable"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getRef(); + ::mlir::Attribute getShapeAttr(); + std::optional> getShape(); + ::mlir::StringAttr getContainerAttr(); + ::llvm::StringRef getContainer(); + ::mlir::StringAttr getSharedNameAttr(); + ::llvm::StringRef getSharedName(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setShapeAttr(::mlir::Attribute attr); + void setShape(std::optional> attrValue); + void setContainerAttr(::mlir::StringAttr attr); + void setContainer(::std::optional<::llvm::StringRef> attrValue); + void setSharedNameAttr(::mlir::StringAttr attr); + void setSharedName(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeContainerAttr(); + ::mlir::Attribute removeSharedNameAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type ref, ::mlir::Attribute shape, /*optional*/::mlir::StringAttr container, /*optional*/::mlir::StringAttr shared_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Attribute shape, /*optional*/::mlir::StringAttr container, /*optional*/::mlir::StringAttr shared_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type ref, std::optional> shape, /*optional*/::llvm::StringRef container = "", /*optional*/::llvm::StringRef shared_name = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, std::optional> shape, /*optional*/::llvm::StringRef container = "", /*optional*/::llvm::StringRef shared_name = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::VariableOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::VariableShapeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VariableShapeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VariableShapeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VariableShapeOpGenericAdaptorBase(VariableShapeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class VariableShapeOpGenericAdaptor : public detail::VariableShapeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VariableShapeOpGenericAdaptorBase; +public: + VariableShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VariableShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VariableShapeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VariableShapeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VariableShapeOpAdaptor : public VariableShapeOpGenericAdaptor<::mlir::ValueRange> { +public: + using VariableShapeOpGenericAdaptor::VariableShapeOpGenericAdaptor; + VariableShapeOpAdaptor(VariableShapeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VariableShapeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = VariableShapeOpAdaptor; + template + using GenericAdaptor = VariableShapeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("out_type")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOutTypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getOutTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.VariableShape"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getOutType(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::VariableShapeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::VariableV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VariableV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VariableV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VariableV2OpGenericAdaptorBase(VariableV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Attribute getShapeAttr(); + std::optional> getShape(); + ::mlir::StringAttr getContainerAttr(); + ::llvm::StringRef getContainer(); + ::mlir::StringAttr getSharedNameAttr(); + ::llvm::StringRef getSharedName(); +}; +} // namespace detail +template +class VariableV2OpGenericAdaptor : public detail::VariableV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VariableV2OpGenericAdaptorBase; +public: + VariableV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VariableV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VariableV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VariableV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VariableV2OpAdaptor : public VariableV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using VariableV2OpGenericAdaptor::VariableV2OpGenericAdaptor; + VariableV2OpAdaptor(VariableV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VariableV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = VariableV2OpAdaptor; + template + using GenericAdaptor = VariableV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("container"), ::llvm::StringRef("dtype"), ::llvm::StringRef("shape"), ::llvm::StringRef("shared_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getContainerAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getContainerAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShapeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSharedNameAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSharedNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.VariableV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getRef(); + ::mlir::Attribute getShapeAttr(); + std::optional> getShape(); + ::mlir::StringAttr getContainerAttr(); + ::llvm::StringRef getContainer(); + ::mlir::StringAttr getSharedNameAttr(); + ::llvm::StringRef getSharedName(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setShapeAttr(::mlir::Attribute attr); + void setShape(std::optional> attrValue); + void setContainerAttr(::mlir::StringAttr attr); + void setContainer(::std::optional<::llvm::StringRef> attrValue); + void setSharedNameAttr(::mlir::StringAttr attr); + void setSharedName(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeContainerAttr(); + ::mlir::Attribute removeSharedNameAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type ref, ::mlir::Attribute shape, /*optional*/::mlir::StringAttr container, /*optional*/::mlir::StringAttr shared_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Attribute shape, /*optional*/::mlir::StringAttr container, /*optional*/::mlir::StringAttr shared_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type ref, std::optional> shape, /*optional*/::llvm::StringRef container = "", /*optional*/::llvm::StringRef shared_name = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, std::optional> shape, /*optional*/::llvm::StringRef container = "", /*optional*/::llvm::StringRef shared_name = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::VariableV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::WhereOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class WhereOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + WhereOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + WhereOpGenericAdaptorBase(WhereOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class WhereOpGenericAdaptor : public detail::WhereOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::WhereOpGenericAdaptorBase; +public: + WhereOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + WhereOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : WhereOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + WhereOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class WhereOpAdaptor : public WhereOpGenericAdaptor<::mlir::ValueRange> { +public: + using WhereOpGenericAdaptor::WhereOpGenericAdaptor; + WhereOpAdaptor(WhereOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class WhereOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = WhereOpAdaptor; + template + using GenericAdaptor = WhereOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Where"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getIndex(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type index, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::WhereOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::WhileOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class WhileOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + WhileOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + WhileOpGenericAdaptorBase(WhileOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::FlatSymbolRefAttr getCondAttr(); + ::llvm::StringRef getCond(); + ::mlir::FlatSymbolRefAttr getBodyAttr(); + ::llvm::StringRef getBody(); + ::mlir::IntegerAttr getParallelIterationsAttr(); + uint64_t getParallelIterations(); + ::mlir::BoolAttr getIsStatelessAttr(); + bool getIsStateless(); + ::mlir::UnitAttr getShapeInvariantAttr(); + bool getShapeInvariant(); +}; +} // namespace detail +template +class WhileOpGenericAdaptor : public detail::WhileOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::WhileOpGenericAdaptorBase; +public: + WhileOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + WhileOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : WhileOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + WhileOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInput() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class WhileOpAdaptor : public WhileOpGenericAdaptor<::mlir::ValueRange> { +public: + using WhileOpGenericAdaptor::WhileOpGenericAdaptor; + WhileOpAdaptor(WhileOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class WhileOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = WhileOpAdaptor; + template + using GenericAdaptor = WhileOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("body"), ::llvm::StringRef("cond"), ::llvm::StringRef("is_stateless"), ::llvm::StringRef("output_shapes"), ::llvm::StringRef("parallel_iterations"), ::llvm::StringRef("shape_invariant")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getBodyAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getBodyAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getCondAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getCondAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getIsStatelessAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getIsStatelessAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getParallelIterationsAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getParallelIterationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getShapeInvariantAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getShapeInvariantAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.While"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInput(); + ::mlir::MutableOperandRange getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutput(); + ::mlir::FlatSymbolRefAttr getCondAttr(); + ::llvm::StringRef getCond(); + ::mlir::FlatSymbolRefAttr getBodyAttr(); + ::llvm::StringRef getBody(); + ::mlir::IntegerAttr getParallelIterationsAttr(); + uint64_t getParallelIterations(); + ::mlir::BoolAttr getIsStatelessAttr(); + bool getIsStateless(); + ::mlir::UnitAttr getShapeInvariantAttr(); + bool getShapeInvariant(); + mlir::OperandElementTypeRange getT(); + mlir::TF::ResultShapeRange getOutputShapes(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setCondAttr(::mlir::FlatSymbolRefAttr attr); + void setCond(::llvm::StringRef attrValue); + void setBodyAttr(::mlir::FlatSymbolRefAttr attr); + void setBody(::llvm::StringRef attrValue); + void setParallelIterationsAttr(::mlir::IntegerAttr attr); + void setParallelIterations(::std::optional attrValue); + void setIsStatelessAttr(::mlir::BoolAttr attr); + void setIsStateless(bool attrValue); + void setShapeInvariantAttr(::mlir::UnitAttr attr); + void setShapeInvariant(bool attrValue); + ::mlir::Attribute removeParallelIterationsAttr(); + ::mlir::Attribute removeShapeInvariantAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::ValueRange input, ::mlir::FlatSymbolRefAttr cond, ::mlir::FlatSymbolRefAttr body, /*optional*/::mlir::IntegerAttr parallel_iterations, ::mlir::BoolAttr is_stateless, /*optional*/::mlir::UnitAttr shape_invariant); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::ValueRange input, ::llvm::StringRef cond, ::llvm::StringRef body, /*optional*/uint64_t parallel_iterations, bool is_stateless, /*optional*/bool shape_invariant = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verifySymbolUses(::mlir::SymbolTableCollection &symbolTable); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 7 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Get the condition function. + // Prefer passing in SymbolTableCollection to reduce lookup costs by + // enabling reusing cached symbol table lookup. + func::FuncOp ResolveCondFunction(::mlir::SymbolTableCollection* table) { + if (table) + return table->lookupNearestSymbolFrom(*this, getCondAttr()); + return SymbolTable::lookupNearestSymbolFrom(*this, getCondAttr()); + } + // TODO(b/204997177): Deprecate and remove. + func::FuncOp cond_function() { return ResolveCondFunction(nullptr); } + + // Get the body function. + // Prefer passing in SymbolTableCollection to reduce lookup costs by + // enabling reusing cached symbol table lookup. + func::FuncOp ResolveBodyFunction(::mlir::SymbolTableCollection* table) { + if (table) + return table->lookupNearestSymbolFrom(*this, getBodyAttr()); + return SymbolTable::lookupNearestSymbolFrom(*this, getBodyAttr()); + } + // TODO(b/204997177): Deprecate and remove. + func::FuncOp body_function() { return ResolveBodyFunction(nullptr); } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::WhileOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::WhileRegionOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class WhileRegionOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + WhileRegionOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + WhileRegionOpGenericAdaptorBase(WhileRegionOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getParallelIterationsAttr(); + uint64_t getParallelIterations(); + ::mlir::BoolAttr getIsStatelessAttr(); + bool getIsStateless(); + ::mlir::UnitAttr getShapeInvariantAttr(); + bool getShapeInvariant(); + ::mlir::Region &getCond(); + ::mlir::Region &getBody(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class WhileRegionOpGenericAdaptor : public detail::WhileRegionOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::WhileRegionOpGenericAdaptorBase; +public: + WhileRegionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + WhileRegionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : WhileRegionOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + WhileRegionOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInput() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class WhileRegionOpAdaptor : public WhileRegionOpGenericAdaptor<::mlir::ValueRange> { +public: + using WhileRegionOpGenericAdaptor::WhileRegionOpGenericAdaptor; + WhileRegionOpAdaptor(WhileRegionOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class WhileRegionOp : public ::mlir::Op::Impl, ::mlir::OpTrait::VariadicResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::SingleBlock, ::mlir::OpTrait::SingleBlockImplicitTerminator::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::LoopLikeOpInterface::Trait, ::mlir::RegionBranchOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = WhileRegionOpAdaptor; + template + using GenericAdaptor = WhileRegionOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("is_stateless"), ::llvm::StringRef("parallel_iterations"), ::llvm::StringRef("shape_invariant")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getIsStatelessAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getIsStatelessAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getParallelIterationsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getParallelIterationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShapeInvariantAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShapeInvariantAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.WhileRegion"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInput(); + ::mlir::MutableOperandRange getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutput(); + ::mlir::Region &getCond(); + ::mlir::Region &getBody(); + ::mlir::IntegerAttr getParallelIterationsAttr(); + uint64_t getParallelIterations(); + ::mlir::BoolAttr getIsStatelessAttr(); + bool getIsStateless(); + ::mlir::UnitAttr getShapeInvariantAttr(); + bool getShapeInvariant(); + void setParallelIterationsAttr(::mlir::IntegerAttr attr); + void setParallelIterations(::std::optional attrValue); + void setIsStatelessAttr(::mlir::BoolAttr attr); + void setIsStateless(bool attrValue); + void setShapeInvariantAttr(::mlir::UnitAttr attr); + void setShapeInvariant(bool attrValue); + ::mlir::Attribute removeParallelIterationsAttr(); + ::mlir::Attribute removeShapeInvariantAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::ValueRange input, /*optional*/::mlir::IntegerAttr parallel_iterations, ::mlir::BoolAttr is_stateless, /*optional*/::mlir::UnitAttr shape_invariant); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::ValueRange input, /*optional*/uint64_t parallel_iterations, bool is_stateless, /*optional*/bool shape_invariant = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::llvm::SmallVector<::mlir::Region *> getLoopRegions(); + ::mlir::OperandRange getEntrySuccessorOperands(::mlir::RegionBranchPoint point); + void getSuccessorRegions(::mlir::RegionBranchPoint point, ::llvm::SmallVectorImpl<::mlir::RegionSuccessor> ®ions); + void getRegionInvocationBounds(::llvm::ArrayRef<::mlir::Attribute> operands, ::llvm::SmallVectorImpl<::mlir::InvocationBounds> &invocationBounds); + bool areTypesCompatible(::mlir::Type lhs, ::mlir::Type rhs); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::WhileRegionOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::WriteAudioSummaryOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class WriteAudioSummaryOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + WriteAudioSummaryOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + WriteAudioSummaryOpGenericAdaptorBase(WriteAudioSummaryOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getMaxOutputsAttr(); + uint64_t getMaxOutputs(); +}; +} // namespace detail +template +class WriteAudioSummaryOpGenericAdaptor : public detail::WriteAudioSummaryOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::WriteAudioSummaryOpGenericAdaptorBase; +public: + WriteAudioSummaryOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + WriteAudioSummaryOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : WriteAudioSummaryOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + WriteAudioSummaryOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getWriter() { + return (*getODSOperands(0).begin()); + } + + ValueT getStep() { + return (*getODSOperands(1).begin()); + } + + ValueT getTag() { + return (*getODSOperands(2).begin()); + } + + ValueT getTensor() { + return (*getODSOperands(3).begin()); + } + + ValueT getSampleRate() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class WriteAudioSummaryOpAdaptor : public WriteAudioSummaryOpGenericAdaptor<::mlir::ValueRange> { +public: + using WriteAudioSummaryOpGenericAdaptor::WriteAudioSummaryOpGenericAdaptor; + WriteAudioSummaryOpAdaptor(WriteAudioSummaryOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class WriteAudioSummaryOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = WriteAudioSummaryOpAdaptor; + template + using GenericAdaptor = WriteAudioSummaryOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("max_outputs")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getMaxOutputsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getMaxOutputsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.WriteAudioSummary"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getWriter(); + ::mlir::TypedValue<::mlir::TensorType> getStep(); + ::mlir::TypedValue<::mlir::TensorType> getTag(); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::TypedValue<::mlir::TensorType> getSampleRate(); + ::mlir::OpOperand &getWriterMutable(); + ::mlir::OpOperand &getStepMutable(); + ::mlir::OpOperand &getTagMutable(); + ::mlir::OpOperand &getTensorMutable(); + ::mlir::OpOperand &getSampleRateMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getMaxOutputsAttr(); + uint64_t getMaxOutputs(); + void setMaxOutputsAttr(::mlir::IntegerAttr attr); + void setMaxOutputs(::std::optional attrValue); + ::mlir::Attribute removeMaxOutputsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value writer, ::mlir::Value step, ::mlir::Value tag, ::mlir::Value tensor, ::mlir::Value sample_rate, /*optional*/::mlir::IntegerAttr max_outputs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value writer, ::mlir::Value step, ::mlir::Value tag, ::mlir::Value tensor, ::mlir::Value sample_rate, /*optional*/::mlir::IntegerAttr max_outputs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value writer, ::mlir::Value step, ::mlir::Value tag, ::mlir::Value tensor, ::mlir::Value sample_rate, /*optional*/uint64_t max_outputs = 3); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value writer, ::mlir::Value step, ::mlir::Value tag, ::mlir::Value tensor, ::mlir::Value sample_rate, /*optional*/uint64_t max_outputs = 3); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::WriteAudioSummaryOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::WriteGraphSummaryOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class WriteGraphSummaryOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + WriteGraphSummaryOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + WriteGraphSummaryOpGenericAdaptorBase(WriteGraphSummaryOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class WriteGraphSummaryOpGenericAdaptor : public detail::WriteGraphSummaryOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::WriteGraphSummaryOpGenericAdaptorBase; +public: + WriteGraphSummaryOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + WriteGraphSummaryOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : WriteGraphSummaryOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + WriteGraphSummaryOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getWriter() { + return (*getODSOperands(0).begin()); + } + + ValueT getStep() { + return (*getODSOperands(1).begin()); + } + + ValueT getTensor() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class WriteGraphSummaryOpAdaptor : public WriteGraphSummaryOpGenericAdaptor<::mlir::ValueRange> { +public: + using WriteGraphSummaryOpGenericAdaptor::WriteGraphSummaryOpGenericAdaptor; + WriteGraphSummaryOpAdaptor(WriteGraphSummaryOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class WriteGraphSummaryOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = WriteGraphSummaryOpAdaptor; + template + using GenericAdaptor = WriteGraphSummaryOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.WriteGraphSummary"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getWriter(); + ::mlir::TypedValue<::mlir::TensorType> getStep(); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::OpOperand &getWriterMutable(); + ::mlir::OpOperand &getStepMutable(); + ::mlir::OpOperand &getTensorMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value writer, ::mlir::Value step, ::mlir::Value tensor); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value writer, ::mlir::Value step, ::mlir::Value tensor); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::WriteGraphSummaryOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::WriteHistogramSummaryOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class WriteHistogramSummaryOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + WriteHistogramSummaryOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + WriteHistogramSummaryOpGenericAdaptorBase(WriteHistogramSummaryOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class WriteHistogramSummaryOpGenericAdaptor : public detail::WriteHistogramSummaryOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::WriteHistogramSummaryOpGenericAdaptorBase; +public: + WriteHistogramSummaryOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + WriteHistogramSummaryOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : WriteHistogramSummaryOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + WriteHistogramSummaryOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getWriter() { + return (*getODSOperands(0).begin()); + } + + ValueT getStep() { + return (*getODSOperands(1).begin()); + } + + ValueT getTag() { + return (*getODSOperands(2).begin()); + } + + ValueT getValues() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class WriteHistogramSummaryOpAdaptor : public WriteHistogramSummaryOpGenericAdaptor<::mlir::ValueRange> { +public: + using WriteHistogramSummaryOpGenericAdaptor::WriteHistogramSummaryOpGenericAdaptor; + WriteHistogramSummaryOpAdaptor(WriteHistogramSummaryOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class WriteHistogramSummaryOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = WriteHistogramSummaryOpAdaptor; + template + using GenericAdaptor = WriteHistogramSummaryOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.WriteHistogramSummary"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getWriter(); + ::mlir::TypedValue<::mlir::TensorType> getStep(); + ::mlir::TypedValue<::mlir::TensorType> getTag(); + ::mlir::TypedValue<::mlir::TensorType> getValues(); + ::mlir::OpOperand &getWriterMutable(); + ::mlir::OpOperand &getStepMutable(); + ::mlir::OpOperand &getTagMutable(); + ::mlir::OpOperand &getValuesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value writer, ::mlir::Value step, ::mlir::Value tag, ::mlir::Value values); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value writer, ::mlir::Value step, ::mlir::Value tag, ::mlir::Value values); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::WriteHistogramSummaryOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::WriteImageSummaryOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class WriteImageSummaryOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + WriteImageSummaryOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + WriteImageSummaryOpGenericAdaptorBase(WriteImageSummaryOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getMaxImagesAttr(); + uint64_t getMaxImages(); +}; +} // namespace detail +template +class WriteImageSummaryOpGenericAdaptor : public detail::WriteImageSummaryOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::WriteImageSummaryOpGenericAdaptorBase; +public: + WriteImageSummaryOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + WriteImageSummaryOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : WriteImageSummaryOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + WriteImageSummaryOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getWriter() { + return (*getODSOperands(0).begin()); + } + + ValueT getStep() { + return (*getODSOperands(1).begin()); + } + + ValueT getTag() { + return (*getODSOperands(2).begin()); + } + + ValueT getTensor() { + return (*getODSOperands(3).begin()); + } + + ValueT getBadColor() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class WriteImageSummaryOpAdaptor : public WriteImageSummaryOpGenericAdaptor<::mlir::ValueRange> { +public: + using WriteImageSummaryOpGenericAdaptor::WriteImageSummaryOpGenericAdaptor; + WriteImageSummaryOpAdaptor(WriteImageSummaryOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class WriteImageSummaryOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = WriteImageSummaryOpAdaptor; + template + using GenericAdaptor = WriteImageSummaryOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("max_images")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getMaxImagesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getMaxImagesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.WriteImageSummary"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getWriter(); + ::mlir::TypedValue<::mlir::TensorType> getStep(); + ::mlir::TypedValue<::mlir::TensorType> getTag(); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::TypedValue<::mlir::TensorType> getBadColor(); + ::mlir::OpOperand &getWriterMutable(); + ::mlir::OpOperand &getStepMutable(); + ::mlir::OpOperand &getTagMutable(); + ::mlir::OpOperand &getTensorMutable(); + ::mlir::OpOperand &getBadColorMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getMaxImagesAttr(); + uint64_t getMaxImages(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setMaxImagesAttr(::mlir::IntegerAttr attr); + void setMaxImages(::std::optional attrValue); + ::mlir::Attribute removeMaxImagesAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value writer, ::mlir::Value step, ::mlir::Value tag, ::mlir::Value tensor, ::mlir::Value bad_color, /*optional*/::mlir::IntegerAttr max_images); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value writer, ::mlir::Value step, ::mlir::Value tag, ::mlir::Value tensor, ::mlir::Value bad_color, /*optional*/::mlir::IntegerAttr max_images); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value writer, ::mlir::Value step, ::mlir::Value tag, ::mlir::Value tensor, ::mlir::Value bad_color, /*optional*/uint64_t max_images = 3); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value writer, ::mlir::Value step, ::mlir::Value tag, ::mlir::Value tensor, ::mlir::Value bad_color, /*optional*/uint64_t max_images = 3); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::WriteImageSummaryOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::WriteRawProtoSummaryOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class WriteRawProtoSummaryOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + WriteRawProtoSummaryOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + WriteRawProtoSummaryOpGenericAdaptorBase(WriteRawProtoSummaryOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class WriteRawProtoSummaryOpGenericAdaptor : public detail::WriteRawProtoSummaryOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::WriteRawProtoSummaryOpGenericAdaptorBase; +public: + WriteRawProtoSummaryOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + WriteRawProtoSummaryOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : WriteRawProtoSummaryOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + WriteRawProtoSummaryOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getWriter() { + return (*getODSOperands(0).begin()); + } + + ValueT getStep() { + return (*getODSOperands(1).begin()); + } + + ValueT getTensor() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class WriteRawProtoSummaryOpAdaptor : public WriteRawProtoSummaryOpGenericAdaptor<::mlir::ValueRange> { +public: + using WriteRawProtoSummaryOpGenericAdaptor::WriteRawProtoSummaryOpGenericAdaptor; + WriteRawProtoSummaryOpAdaptor(WriteRawProtoSummaryOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class WriteRawProtoSummaryOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = WriteRawProtoSummaryOpAdaptor; + template + using GenericAdaptor = WriteRawProtoSummaryOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.WriteRawProtoSummary"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getWriter(); + ::mlir::TypedValue<::mlir::TensorType> getStep(); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::OpOperand &getWriterMutable(); + ::mlir::OpOperand &getStepMutable(); + ::mlir::OpOperand &getTensorMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value writer, ::mlir::Value step, ::mlir::Value tensor); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value writer, ::mlir::Value step, ::mlir::Value tensor); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::WriteRawProtoSummaryOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::WriteScalarSummaryOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class WriteScalarSummaryOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + WriteScalarSummaryOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + WriteScalarSummaryOpGenericAdaptorBase(WriteScalarSummaryOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class WriteScalarSummaryOpGenericAdaptor : public detail::WriteScalarSummaryOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::WriteScalarSummaryOpGenericAdaptorBase; +public: + WriteScalarSummaryOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + WriteScalarSummaryOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : WriteScalarSummaryOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + WriteScalarSummaryOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getWriter() { + return (*getODSOperands(0).begin()); + } + + ValueT getStep() { + return (*getODSOperands(1).begin()); + } + + ValueT getTag() { + return (*getODSOperands(2).begin()); + } + + ValueT getValue() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class WriteScalarSummaryOpAdaptor : public WriteScalarSummaryOpGenericAdaptor<::mlir::ValueRange> { +public: + using WriteScalarSummaryOpGenericAdaptor::WriteScalarSummaryOpGenericAdaptor; + WriteScalarSummaryOpAdaptor(WriteScalarSummaryOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class WriteScalarSummaryOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = WriteScalarSummaryOpAdaptor; + template + using GenericAdaptor = WriteScalarSummaryOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.WriteScalarSummary"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getWriter(); + ::mlir::TypedValue<::mlir::TensorType> getStep(); + ::mlir::TypedValue<::mlir::TensorType> getTag(); + ::mlir::TypedValue<::mlir::TensorType> getValue(); + ::mlir::OpOperand &getWriterMutable(); + ::mlir::OpOperand &getStepMutable(); + ::mlir::OpOperand &getTagMutable(); + ::mlir::OpOperand &getValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value writer, ::mlir::Value step, ::mlir::Value tag, ::mlir::Value value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value writer, ::mlir::Value step, ::mlir::Value tag, ::mlir::Value value); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::WriteScalarSummaryOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::WriteSummaryOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class WriteSummaryOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + WriteSummaryOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + WriteSummaryOpGenericAdaptorBase(WriteSummaryOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class WriteSummaryOpGenericAdaptor : public detail::WriteSummaryOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::WriteSummaryOpGenericAdaptorBase; +public: + WriteSummaryOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + WriteSummaryOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : WriteSummaryOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + WriteSummaryOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getWriter() { + return (*getODSOperands(0).begin()); + } + + ValueT getStep() { + return (*getODSOperands(1).begin()); + } + + ValueT getTensor() { + return (*getODSOperands(2).begin()); + } + + ValueT getTag() { + return (*getODSOperands(3).begin()); + } + + ValueT getSummaryMetadata() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class WriteSummaryOpAdaptor : public WriteSummaryOpGenericAdaptor<::mlir::ValueRange> { +public: + using WriteSummaryOpGenericAdaptor::WriteSummaryOpGenericAdaptor; + WriteSummaryOpAdaptor(WriteSummaryOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class WriteSummaryOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = WriteSummaryOpAdaptor; + template + using GenericAdaptor = WriteSummaryOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.WriteSummary"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getWriter(); + ::mlir::TypedValue<::mlir::TensorType> getStep(); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::TypedValue<::mlir::TensorType> getTag(); + ::mlir::TypedValue<::mlir::TensorType> getSummaryMetadata(); + ::mlir::OpOperand &getWriterMutable(); + ::mlir::OpOperand &getStepMutable(); + ::mlir::OpOperand &getTensorMutable(); + ::mlir::OpOperand &getTagMutable(); + ::mlir::OpOperand &getSummaryMetadataMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value writer, ::mlir::Value step, ::mlir::Value tensor, ::mlir::Value tag, ::mlir::Value summary_metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value writer, ::mlir::Value step, ::mlir::Value tensor, ::mlir::Value tag, ::mlir::Value summary_metadata); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::WriteSummaryOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::WriteTrainingPredictionsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class WriteTrainingPredictionsOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + WriteTrainingPredictionsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + WriteTrainingPredictionsOpGenericAdaptorBase(WriteTrainingPredictionsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getPredictionNamesAttr(); + ::mlir::ArrayAttr getPredictionNames(); + ::mlir::BoolAttr getTrainingAttr(); + bool getTraining(); + ::mlir::StringAttr getFilePathAttr(); + ::llvm::StringRef getFilePath(); +}; +} // namespace detail +template +class WriteTrainingPredictionsOpGenericAdaptor : public detail::WriteTrainingPredictionsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::WriteTrainingPredictionsOpGenericAdaptorBase; +public: + WriteTrainingPredictionsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + WriteTrainingPredictionsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : WriteTrainingPredictionsOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + WriteTrainingPredictionsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getKeys() { + return (*getODSOperands(0).begin()); + } + + RangeT getPredictionsList() { + return getODSOperands(1); + } + + ValueT getStep() { + return (*getODSOperands(2).begin()); + } + + ValueT getTimestampUsec() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class WriteTrainingPredictionsOpAdaptor : public WriteTrainingPredictionsOpGenericAdaptor<::mlir::ValueRange> { +public: + using WriteTrainingPredictionsOpGenericAdaptor::WriteTrainingPredictionsOpGenericAdaptor; + WriteTrainingPredictionsOpAdaptor(WriteTrainingPredictionsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class WriteTrainingPredictionsOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = WriteTrainingPredictionsOpAdaptor; + template + using GenericAdaptor = WriteTrainingPredictionsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("file_path"), ::llvm::StringRef("num_predictions"), ::llvm::StringRef("prediction_names"), ::llvm::StringRef("training")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFilePathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFilePathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumPredictionsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumPredictionsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getPredictionNamesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getPredictionNamesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTrainingAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTrainingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.WriteTrainingPredictions"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getKeys(); + ::mlir::Operation::operand_range getPredictionsList(); + ::mlir::TypedValue<::mlir::TensorType> getStep(); + ::mlir::TypedValue<::mlir::TensorType> getTimestampUsec(); + ::mlir::OpOperand &getKeysMutable(); + ::mlir::MutableOperandRange getPredictionsListMutable(); + ::mlir::OpOperand &getStepMutable(); + ::mlir::OpOperand &getTimestampUsecMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::ArrayAttr getPredictionNamesAttr(); + ::mlir::ArrayAttr getPredictionNames(); + ::mlir::BoolAttr getTrainingAttr(); + bool getTraining(); + ::mlir::StringAttr getFilePathAttr(); + ::llvm::StringRef getFilePath(); + size_t getNumPredictions(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setPredictionNamesAttr(::mlir::ArrayAttr attr); + void setTrainingAttr(::mlir::BoolAttr attr); + void setTraining(bool attrValue); + void setFilePathAttr(::mlir::StringAttr attr); + void setFilePath(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value keys, ::mlir::ValueRange predictions_list, ::mlir::Value step, ::mlir::Value timestamp_usec, ::mlir::ArrayAttr prediction_names, ::mlir::BoolAttr training, ::mlir::StringAttr file_path); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value keys, ::mlir::ValueRange predictions_list, ::mlir::Value step, ::mlir::Value timestamp_usec, ::mlir::ArrayAttr prediction_names, ::mlir::BoolAttr training, ::mlir::StringAttr file_path); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value keys, ::mlir::ValueRange predictions_list, ::mlir::Value step, ::mlir::Value timestamp_usec, ::mlir::ArrayAttr prediction_names, bool training, ::llvm::StringRef file_path); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value keys, ::mlir::ValueRange predictions_list, ::mlir::Value step, ::mlir::Value timestamp_usec, ::mlir::ArrayAttr prediction_names, bool training, ::llvm::StringRef file_path); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::WriteTrainingPredictionsOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XdivyOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XdivyOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XdivyOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XdivyOpGenericAdaptorBase(XdivyOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class XdivyOpGenericAdaptor : public detail::XdivyOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XdivyOpGenericAdaptorBase; +public: + XdivyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XdivyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XdivyOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XdivyOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XdivyOpAdaptor : public XdivyOpGenericAdaptor<::mlir::ValueRange> { +public: + using XdivyOpGenericAdaptor::XdivyOpGenericAdaptor; + XdivyOpAdaptor(XdivyOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XdivyOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::OpTrait::TF::SameOperandsAndResultElementTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XdivyOpAdaptor; + template + using GenericAdaptor = XdivyOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Xdivy"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XdivyOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaAllReduceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaAllReduceOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaAllReduceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaAllReduceOpGenericAdaptorBase(XlaAllReduceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getReduceOpAttr(); + ::llvm::StringRef getReduceOp(); + ::mlir::StringAttr getModeAttr(); + ::llvm::StringRef getMode(); +}; +} // namespace detail +template +class XlaAllReduceOpGenericAdaptor : public detail::XlaAllReduceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaAllReduceOpGenericAdaptorBase; +public: + XlaAllReduceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaAllReduceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaAllReduceOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaAllReduceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getGroupAssignment() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaAllReduceOpAdaptor : public XlaAllReduceOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaAllReduceOpGenericAdaptor::XlaAllReduceOpGenericAdaptor; + XlaAllReduceOpAdaptor(XlaAllReduceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaAllReduceOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaAllReduceOpAdaptor; + template + using GenericAdaptor = XlaAllReduceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("mode"), ::llvm::StringRef("reduce_op")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getModeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getModeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getReduceOpAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getReduceOpAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaAllReduce"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getGroupAssignment(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getGroupAssignmentMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::StringAttr getReduceOpAttr(); + ::llvm::StringRef getReduceOp(); + ::mlir::StringAttr getModeAttr(); + ::llvm::StringRef getMode(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setReduceOpAttr(::mlir::StringAttr attr); + void setReduceOp(::llvm::StringRef attrValue); + void setModeAttr(::mlir::StringAttr attr); + void setMode(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value group_assignment, ::mlir::StringAttr reduce_op, ::mlir::StringAttr mode); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value group_assignment, ::mlir::StringAttr reduce_op, ::mlir::StringAttr mode); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value group_assignment, ::llvm::StringRef reduce_op, ::llvm::StringRef mode); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value group_assignment, ::llvm::StringRef reduce_op, ::llvm::StringRef mode); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaAllReduceOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaBroadcastHelperOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaBroadcastHelperOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaBroadcastHelperOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaBroadcastHelperOpGenericAdaptorBase(XlaBroadcastHelperOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class XlaBroadcastHelperOpGenericAdaptor : public detail::XlaBroadcastHelperOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaBroadcastHelperOpGenericAdaptorBase; +public: + XlaBroadcastHelperOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaBroadcastHelperOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaBroadcastHelperOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaBroadcastHelperOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + ValueT getBroadcastDims() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaBroadcastHelperOpAdaptor : public XlaBroadcastHelperOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaBroadcastHelperOpGenericAdaptor::XlaBroadcastHelperOpGenericAdaptor; + XlaBroadcastHelperOpAdaptor(XlaBroadcastHelperOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaBroadcastHelperOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaBroadcastHelperOpAdaptor; + template + using GenericAdaptor = XlaBroadcastHelperOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaBroadcastHelper"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLhs(); + ::mlir::TypedValue<::mlir::TensorType> getRhs(); + ::mlir::TypedValue<::mlir::TensorType> getBroadcastDims(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + ::mlir::OpOperand &getBroadcastDimsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLhsOutput(); + ::mlir::TypedValue<::mlir::TensorType> getRhsOutput(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type lhs_output, ::mlir::Type rhs_output, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value broadcast_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value broadcast_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value broadcast_dims); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // InferTypeOpInterface: + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return ArraysAreCastCompatible(l, r); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaBroadcastHelperOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaCallModuleOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaCallModuleOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaCallModuleOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaCallModuleOpGenericAdaptorBase(XlaCallModuleOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getVersionAttr(); + uint64_t getVersion(); + ::mlir::StringAttr getModuleAttr(); + ::llvm::StringRef getModule(); + ::mlir::ArrayAttr getSoutAttr(); + ::mlir::ArrayAttr getSout(); + ::mlir::ArrayAttr getDimArgsSpecAttr(); + ::mlir::ArrayAttr getDimArgsSpec(); + ::mlir::ArrayAttr getPlatformsAttr(); + ::mlir::ArrayAttr getPlatforms(); + ::mlir::ArrayAttr getFunctionListAttr(); + ::mlir::ArrayAttr getFunctionList(); + ::mlir::BoolAttr getHasTokenInputOutputAttr(); + bool getHasTokenInputOutput(); + ::mlir::ArrayAttr getDisabledChecksAttr(); + ::mlir::ArrayAttr getDisabledChecks(); +}; +} // namespace detail +template +class XlaCallModuleOpGenericAdaptor : public detail::XlaCallModuleOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaCallModuleOpGenericAdaptorBase; +public: + XlaCallModuleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaCallModuleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaCallModuleOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaCallModuleOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaCallModuleOpAdaptor : public XlaCallModuleOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaCallModuleOpGenericAdaptor::XlaCallModuleOpGenericAdaptor; + XlaCallModuleOpAdaptor(XlaCallModuleOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaCallModuleOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaCallModuleOpAdaptor; + template + using GenericAdaptor = XlaCallModuleOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Sout"), ::llvm::StringRef("Tin"), ::llvm::StringRef("Tout"), ::llvm::StringRef("dim_args_spec"), ::llvm::StringRef("disabled_checks"), ::llvm::StringRef("function_list"), ::llvm::StringRef("has_token_input_output"), ::llvm::StringRef("module"), ::llvm::StringRef("platforms"), ::llvm::StringRef("version")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getSoutAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getSoutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTinAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTinAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getToutAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getToutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getDimArgsSpecAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getDimArgsSpecAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getDisabledChecksAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getDisabledChecksAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getFunctionListAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getFunctionListAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getHasTokenInputOutputAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getHasTokenInputOutputAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getModuleAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getModuleAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getPlatformsAttrName() { + return getAttributeNameForIndex(8); + } + + static ::mlir::StringAttr getPlatformsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 8); + } + + ::mlir::StringAttr getVersionAttrName() { + return getAttributeNameForIndex(9); + } + + static ::mlir::StringAttr getVersionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 9); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaCallModule"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutput(); + ::mlir::IntegerAttr getVersionAttr(); + uint64_t getVersion(); + ::mlir::StringAttr getModuleAttr(); + ::llvm::StringRef getModule(); + ::mlir::ArrayAttr getSoutAttr(); + ::mlir::ArrayAttr getSout(); + ::mlir::ArrayAttr getDimArgsSpecAttr(); + ::mlir::ArrayAttr getDimArgsSpec(); + ::mlir::ArrayAttr getPlatformsAttr(); + ::mlir::ArrayAttr getPlatforms(); + ::mlir::ArrayAttr getFunctionListAttr(); + ::mlir::ArrayAttr getFunctionList(); + ::mlir::BoolAttr getHasTokenInputOutputAttr(); + bool getHasTokenInputOutput(); + ::mlir::ArrayAttr getDisabledChecksAttr(); + ::mlir::ArrayAttr getDisabledChecks(); + mlir::OperandElementTypeRange getTin(); + mlir::ResultElementTypeRange getTout(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setVersionAttr(::mlir::IntegerAttr attr); + void setVersion(uint64_t attrValue); + void setModuleAttr(::mlir::StringAttr attr); + void setModule(::llvm::StringRef attrValue); + void setSoutAttr(::mlir::ArrayAttr attr); + void setDimArgsSpecAttr(::mlir::ArrayAttr attr); + void setPlatformsAttr(::mlir::ArrayAttr attr); + void setFunctionListAttr(::mlir::ArrayAttr attr); + void setHasTokenInputOutputAttr(::mlir::BoolAttr attr); + void setHasTokenInputOutput(::std::optional attrValue); + void setDisabledChecksAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeDimArgsSpecAttr(); + ::mlir::Attribute removePlatformsAttr(); + ::mlir::Attribute removeFunctionListAttr(); + ::mlir::Attribute removeHasTokenInputOutputAttr(); + ::mlir::Attribute removeDisabledChecksAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::ValueRange args, ::mlir::IntegerAttr version, ::mlir::StringAttr module, ::mlir::ArrayAttr Sout, /*optional*/::mlir::ArrayAttr dim_args_spec, /*optional*/::mlir::ArrayAttr platforms, /*optional*/::mlir::ArrayAttr function_list, /*optional*/::mlir::BoolAttr has_token_input_output, /*optional*/::mlir::ArrayAttr disabled_checks); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::ValueRange args, uint64_t version, ::llvm::StringRef module, ::mlir::ArrayAttr Sout, /*optional*/::mlir::ArrayAttr dim_args_spec, /*optional*/::mlir::ArrayAttr platforms, /*optional*/::mlir::ArrayAttr function_list, /*optional*/bool has_token_input_output, /*optional*/::mlir::ArrayAttr disabled_checks); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); + ::mlir::LogicalResult verifySymbolUses(::mlir::SymbolTableCollection &symbolTable); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 10 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaCallModuleOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaClusterOutputOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaClusterOutputOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaClusterOutputOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaClusterOutputOpGenericAdaptorBase(XlaClusterOutputOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class XlaClusterOutputOpGenericAdaptor : public detail::XlaClusterOutputOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaClusterOutputOpGenericAdaptorBase; +public: + XlaClusterOutputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaClusterOutputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaClusterOutputOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaClusterOutputOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaClusterOutputOpAdaptor : public XlaClusterOutputOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaClusterOutputOpGenericAdaptor::XlaClusterOutputOpGenericAdaptor; + XlaClusterOutputOpAdaptor(XlaClusterOutputOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaClusterOutputOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaClusterOutputOpAdaptor; + template + using GenericAdaptor = XlaClusterOutputOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaClusterOutput"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutputs(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type outputs, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaClusterOutputOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaConvOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaConvOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaConvOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaConvOpGenericAdaptorBase(XlaConvOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getDimensionNumbersAttr(); + ::llvm::StringRef getDimensionNumbers(); + ::mlir::StringAttr getPrecisionConfigAttr(); + ::llvm::StringRef getPrecisionConfig(); +}; +} // namespace detail +template +class XlaConvOpGenericAdaptor : public detail::XlaConvOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaConvOpGenericAdaptorBase; +public: + XlaConvOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaConvOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaConvOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaConvOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + ValueT getWindowStrides() { + return (*getODSOperands(2).begin()); + } + + ValueT getPadding() { + return (*getODSOperands(3).begin()); + } + + ValueT getLhsDilation() { + return (*getODSOperands(4).begin()); + } + + ValueT getRhsDilation() { + return (*getODSOperands(5).begin()); + } + + ValueT getFeatureGroupCount() { + return (*getODSOperands(6).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaConvOpAdaptor : public XlaConvOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaConvOpGenericAdaptor::XlaConvOpGenericAdaptor; + XlaConvOpAdaptor(XlaConvOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaConvOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<7>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaConvOpAdaptor; + template + using GenericAdaptor = XlaConvOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices"), ::llvm::StringRef("dimension_numbers"), ::llvm::StringRef("precision_config")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDimensionNumbersAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDimensionNumbersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getPrecisionConfigAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getPrecisionConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaConv"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLhs(); + ::mlir::TypedValue<::mlir::TensorType> getRhs(); + ::mlir::TypedValue<::mlir::TensorType> getWindowStrides(); + ::mlir::TypedValue<::mlir::TensorType> getPadding(); + ::mlir::TypedValue<::mlir::TensorType> getLhsDilation(); + ::mlir::TypedValue<::mlir::TensorType> getRhsDilation(); + ::mlir::TypedValue<::mlir::TensorType> getFeatureGroupCount(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + ::mlir::OpOperand &getWindowStridesMutable(); + ::mlir::OpOperand &getPaddingMutable(); + ::mlir::OpOperand &getLhsDilationMutable(); + ::mlir::OpOperand &getRhsDilationMutable(); + ::mlir::OpOperand &getFeatureGroupCountMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::StringAttr getDimensionNumbersAttr(); + ::llvm::StringRef getDimensionNumbers(); + ::mlir::StringAttr getPrecisionConfigAttr(); + ::llvm::StringRef getPrecisionConfig(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setDimensionNumbersAttr(::mlir::StringAttr attr); + void setDimensionNumbers(::llvm::StringRef attrValue); + void setPrecisionConfigAttr(::mlir::StringAttr attr); + void setPrecisionConfig(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value window_strides, ::mlir::Value padding, ::mlir::Value lhs_dilation, ::mlir::Value rhs_dilation, ::mlir::Value feature_group_count, ::mlir::StringAttr dimension_numbers, ::mlir::StringAttr precision_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value window_strides, ::mlir::Value padding, ::mlir::Value lhs_dilation, ::mlir::Value rhs_dilation, ::mlir::Value feature_group_count, ::mlir::StringAttr dimension_numbers, ::mlir::StringAttr precision_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value window_strides, ::mlir::Value padding, ::mlir::Value lhs_dilation, ::mlir::Value rhs_dilation, ::mlir::Value feature_group_count, ::llvm::StringRef dimension_numbers, ::llvm::StringRef precision_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value window_strides, ::mlir::Value padding, ::mlir::Value lhs_dilation, ::mlir::Value rhs_dilation, ::mlir::Value feature_group_count, ::llvm::StringRef dimension_numbers, ::llvm::StringRef precision_config); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaConvOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaConvV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaConvV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaConvV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaConvV2OpGenericAdaptorBase(XlaConvV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getDimensionNumbersAttr(); + ::llvm::StringRef getDimensionNumbers(); + ::mlir::StringAttr getPrecisionConfigAttr(); + ::llvm::StringRef getPrecisionConfig(); + ::mlir::IntegerAttr getBatchGroupCountAttr(); + uint64_t getBatchGroupCount(); +}; +} // namespace detail +template +class XlaConvV2OpGenericAdaptor : public detail::XlaConvV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaConvV2OpGenericAdaptorBase; +public: + XlaConvV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaConvV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaConvV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaConvV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + ValueT getWindowStrides() { + return (*getODSOperands(2).begin()); + } + + ValueT getPadding() { + return (*getODSOperands(3).begin()); + } + + ValueT getLhsDilation() { + return (*getODSOperands(4).begin()); + } + + ValueT getRhsDilation() { + return (*getODSOperands(5).begin()); + } + + ValueT getFeatureGroupCount() { + return (*getODSOperands(6).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaConvV2OpAdaptor : public XlaConvV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaConvV2OpGenericAdaptor::XlaConvV2OpGenericAdaptor; + XlaConvV2OpAdaptor(XlaConvV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaConvV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<7>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaConvV2OpAdaptor; + template + using GenericAdaptor = XlaConvV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("LhsT"), ::llvm::StringRef("RhsT"), ::llvm::StringRef("Tindices"), ::llvm::StringRef("batch_group_count"), ::llvm::StringRef("dimension_numbers"), ::llvm::StringRef("precision_config"), ::llvm::StringRef("preferred_element_type")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getLhsTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getLhsTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getRhsTAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getRhsTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getBatchGroupCountAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getBatchGroupCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getDimensionNumbersAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getDimensionNumbersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getPrecisionConfigAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getPrecisionConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getPreferredElementTypeAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getPreferredElementTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaConvV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLhs(); + ::mlir::TypedValue<::mlir::TensorType> getRhs(); + ::mlir::TypedValue<::mlir::TensorType> getWindowStrides(); + ::mlir::TypedValue<::mlir::TensorType> getPadding(); + ::mlir::TypedValue<::mlir::TensorType> getLhsDilation(); + ::mlir::TypedValue<::mlir::TensorType> getRhsDilation(); + ::mlir::TypedValue<::mlir::TensorType> getFeatureGroupCount(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + ::mlir::OpOperand &getWindowStridesMutable(); + ::mlir::OpOperand &getPaddingMutable(); + ::mlir::OpOperand &getLhsDilationMutable(); + ::mlir::OpOperand &getRhsDilationMutable(); + ::mlir::OpOperand &getFeatureGroupCountMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::StringAttr getDimensionNumbersAttr(); + ::llvm::StringRef getDimensionNumbers(); + ::mlir::StringAttr getPrecisionConfigAttr(); + ::llvm::StringRef getPrecisionConfig(); + ::mlir::IntegerAttr getBatchGroupCountAttr(); + uint64_t getBatchGroupCount(); + ::mlir::Type getLhsT(); + ::mlir::Type getRhsT(); + ::mlir::Type getTindices(); + ::mlir::Type getPreferredElementType(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setDimensionNumbersAttr(::mlir::StringAttr attr); + void setDimensionNumbers(::llvm::StringRef attrValue); + void setPrecisionConfigAttr(::mlir::StringAttr attr); + void setPrecisionConfig(::llvm::StringRef attrValue); + void setBatchGroupCountAttr(::mlir::IntegerAttr attr); + void setBatchGroupCount(::std::optional attrValue); + ::mlir::Attribute removeBatchGroupCountAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value window_strides, ::mlir::Value padding, ::mlir::Value lhs_dilation, ::mlir::Value rhs_dilation, ::mlir::Value feature_group_count, ::mlir::StringAttr dimension_numbers, ::mlir::StringAttr precision_config, /*optional*/::mlir::IntegerAttr batch_group_count); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value window_strides, ::mlir::Value padding, ::mlir::Value lhs_dilation, ::mlir::Value rhs_dilation, ::mlir::Value feature_group_count, ::mlir::StringAttr dimension_numbers, ::mlir::StringAttr precision_config, /*optional*/::mlir::IntegerAttr batch_group_count); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value window_strides, ::mlir::Value padding, ::mlir::Value lhs_dilation, ::mlir::Value rhs_dilation, ::mlir::Value feature_group_count, ::llvm::StringRef dimension_numbers, ::llvm::StringRef precision_config, /*optional*/uint64_t batch_group_count = 1); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value window_strides, ::mlir::Value padding, ::mlir::Value lhs_dilation, ::mlir::Value rhs_dilation, ::mlir::Value feature_group_count, ::llvm::StringRef dimension_numbers, ::llvm::StringRef precision_config, /*optional*/uint64_t batch_group_count = 1); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 7 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaConvV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaCustomCallV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaCustomCallV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaCustomCallV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaCustomCallV2OpGenericAdaptorBase(XlaCustomCallV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getCallTargetNameAttr(); + ::llvm::StringRef getCallTargetName(); + ::mlir::StringAttr getBackendConfigAttr(); + ::llvm::StringRef getBackendConfig(); + ::mlir::BoolAttr getHasSideEffectAttr(); + bool getHasSideEffect(); + ::mlir::ArrayAttr getResultShapesAttr(); + ::mlir::ArrayAttr getResultShapes(); +}; +} // namespace detail +template +class XlaCustomCallV2OpGenericAdaptor : public detail::XlaCustomCallV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaCustomCallV2OpGenericAdaptorBase; +public: + XlaCustomCallV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaCustomCallV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaCustomCallV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaCustomCallV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return getODSOperands(0); + } + +private: + RangeT odsOperands; +}; +class XlaCustomCallV2OpAdaptor : public XlaCustomCallV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaCustomCallV2OpGenericAdaptor::XlaCustomCallV2OpGenericAdaptor; + XlaCustomCallV2OpAdaptor(XlaCustomCallV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaCustomCallV2Op : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaCustomCallV2OpAdaptor; + template + using GenericAdaptor = XlaCustomCallV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("backend_config"), ::llvm::StringRef("call_target_name"), ::llvm::StringRef("has_side_effect"), ::llvm::StringRef("operand_dtypes"), ::llvm::StringRef("result_dtypes"), ::llvm::StringRef("result_shapes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBackendConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBackendConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getCallTargetNameAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getCallTargetNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getHasSideEffectAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getHasSideEffectAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getOperandDtypesAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getOperandDtypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getResultDtypesAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getResultDtypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getResultShapesAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getResultShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaCustomCallV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getOperands(); + ::mlir::MutableOperandRange getOperandsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResults(); + ::mlir::StringAttr getCallTargetNameAttr(); + ::llvm::StringRef getCallTargetName(); + ::mlir::StringAttr getBackendConfigAttr(); + ::llvm::StringRef getBackendConfig(); + ::mlir::BoolAttr getHasSideEffectAttr(); + bool getHasSideEffect(); + ::mlir::ArrayAttr getResultShapesAttr(); + ::mlir::ArrayAttr getResultShapes(); + mlir::OperandElementTypeRange getOperandDtypes(); + mlir::ResultElementTypeRange getResultDtypes(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setCallTargetNameAttr(::mlir::StringAttr attr); + void setCallTargetName(::llvm::StringRef attrValue); + void setBackendConfigAttr(::mlir::StringAttr attr); + void setBackendConfig(::llvm::StringRef attrValue); + void setHasSideEffectAttr(::mlir::BoolAttr attr); + void setHasSideEffect(bool attrValue); + void setResultShapesAttr(::mlir::ArrayAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange results, ::mlir::ValueRange operands, ::mlir::StringAttr call_target_name, ::mlir::StringAttr backend_config, ::mlir::BoolAttr has_side_effect, ::mlir::ArrayAttr result_shapes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange results, ::mlir::ValueRange operands, ::llvm::StringRef call_target_name, ::llvm::StringRef backend_config, bool has_side_effect, ::mlir::ArrayAttr result_shapes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaCustomCallV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaDotOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaDotOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaDotOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaDotOpGenericAdaptorBase(XlaDotOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getDimensionNumbersAttr(); + ::llvm::StringRef getDimensionNumbers(); + ::mlir::StringAttr getPrecisionConfigAttr(); + ::llvm::StringRef getPrecisionConfig(); +}; +} // namespace detail +template +class XlaDotOpGenericAdaptor : public detail::XlaDotOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaDotOpGenericAdaptorBase; +public: + XlaDotOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaDotOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaDotOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaDotOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaDotOpAdaptor : public XlaDotOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaDotOpGenericAdaptor::XlaDotOpGenericAdaptor; + XlaDotOpAdaptor(XlaDotOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaDotOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaDotOpAdaptor; + template + using GenericAdaptor = XlaDotOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("dimension_numbers"), ::llvm::StringRef("precision_config")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDimensionNumbersAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDimensionNumbersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getPrecisionConfigAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getPrecisionConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaDot"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLhs(); + ::mlir::TypedValue<::mlir::TensorType> getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::StringAttr getDimensionNumbersAttr(); + ::llvm::StringRef getDimensionNumbers(); + ::mlir::StringAttr getPrecisionConfigAttr(); + ::llvm::StringRef getPrecisionConfig(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setDimensionNumbersAttr(::mlir::StringAttr attr); + void setDimensionNumbers(::llvm::StringRef attrValue); + void setPrecisionConfigAttr(::mlir::StringAttr attr); + void setPrecisionConfig(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::StringAttr dimension_numbers, ::mlir::StringAttr precision_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::StringAttr dimension_numbers, ::mlir::StringAttr precision_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value lhs, ::mlir::Value rhs, ::llvm::StringRef dimension_numbers, ::llvm::StringRef precision_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::llvm::StringRef dimension_numbers, ::llvm::StringRef precision_config); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaDotOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaDotV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaDotV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaDotV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaDotV2OpGenericAdaptorBase(XlaDotV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getDimensionNumbersAttr(); + ::llvm::StringRef getDimensionNumbers(); + ::mlir::StringAttr getPrecisionConfigAttr(); + ::llvm::StringRef getPrecisionConfig(); +}; +} // namespace detail +template +class XlaDotV2OpGenericAdaptor : public detail::XlaDotV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaDotV2OpGenericAdaptorBase; +public: + XlaDotV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaDotV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaDotV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaDotV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaDotV2OpAdaptor : public XlaDotV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaDotV2OpGenericAdaptor::XlaDotV2OpGenericAdaptor; + XlaDotV2OpAdaptor(XlaDotV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaDotV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaDotV2OpAdaptor; + template + using GenericAdaptor = XlaDotV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("LhsT"), ::llvm::StringRef("RhsT"), ::llvm::StringRef("dimension_numbers"), ::llvm::StringRef("precision_config"), ::llvm::StringRef("preferred_element_type")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getLhsTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getLhsTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getRhsTAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getRhsTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDimensionNumbersAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDimensionNumbersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getPrecisionConfigAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getPrecisionConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getPreferredElementTypeAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getPreferredElementTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaDotV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLhs(); + ::mlir::TypedValue<::mlir::TensorType> getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::StringAttr getDimensionNumbersAttr(); + ::llvm::StringRef getDimensionNumbers(); + ::mlir::StringAttr getPrecisionConfigAttr(); + ::llvm::StringRef getPrecisionConfig(); + ::mlir::Type getLhsT(); + ::mlir::Type getRhsT(); + ::mlir::Type getPreferredElementType(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setDimensionNumbersAttr(::mlir::StringAttr attr); + void setDimensionNumbers(::llvm::StringRef attrValue); + void setPrecisionConfigAttr(::mlir::StringAttr attr); + void setPrecisionConfig(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::StringAttr dimension_numbers, ::mlir::StringAttr precision_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::StringAttr dimension_numbers, ::mlir::StringAttr precision_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value lhs, ::mlir::Value rhs, ::llvm::StringRef dimension_numbers, ::llvm::StringRef precision_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::llvm::StringRef dimension_numbers, ::llvm::StringRef precision_config); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaDotV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaDynamicSliceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaDynamicSliceOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaDynamicSliceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaDynamicSliceOpGenericAdaptorBase(XlaDynamicSliceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class XlaDynamicSliceOpGenericAdaptor : public detail::XlaDynamicSliceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaDynamicSliceOpGenericAdaptorBase; +public: + XlaDynamicSliceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaDynamicSliceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaDynamicSliceOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaDynamicSliceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getStartIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getSizeIndices() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaDynamicSliceOpAdaptor : public XlaDynamicSliceOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaDynamicSliceOpGenericAdaptor::XlaDynamicSliceOpGenericAdaptor; + XlaDynamicSliceOpAdaptor(XlaDynamicSliceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaDynamicSliceOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaDynamicSliceOpAdaptor; + template + using GenericAdaptor = XlaDynamicSliceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaDynamicSlice"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getStartIndices(); + ::mlir::TypedValue<::mlir::TensorType> getSizeIndices(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getStartIndicesMutable(); + ::mlir::OpOperand &getSizeIndicesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value start_indices, ::mlir::Value size_indices); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value start_indices, ::mlir::Value size_indices); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaDynamicSliceOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaDynamicUpdateSliceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaDynamicUpdateSliceOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaDynamicUpdateSliceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaDynamicUpdateSliceOpGenericAdaptorBase(XlaDynamicUpdateSliceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class XlaDynamicUpdateSliceOpGenericAdaptor : public detail::XlaDynamicUpdateSliceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaDynamicUpdateSliceOpGenericAdaptorBase; +public: + XlaDynamicUpdateSliceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaDynamicUpdateSliceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaDynamicUpdateSliceOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaDynamicUpdateSliceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getUpdate() { + return (*getODSOperands(1).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaDynamicUpdateSliceOpAdaptor : public XlaDynamicUpdateSliceOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaDynamicUpdateSliceOpGenericAdaptor::XlaDynamicUpdateSliceOpGenericAdaptor; + XlaDynamicUpdateSliceOpAdaptor(XlaDynamicUpdateSliceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaDynamicUpdateSliceOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaDynamicUpdateSliceOpAdaptor; + template + using GenericAdaptor = XlaDynamicUpdateSliceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaDynamicUpdateSlice"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getUpdate(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getUpdateMutable(); + ::mlir::OpOperand &getIndicesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value update, ::mlir::Value indices); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value update, ::mlir::Value indices); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaDynamicUpdateSliceOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaEinsumOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaEinsumOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaEinsumOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaEinsumOpGenericAdaptorBase(XlaEinsumOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getEquationAttr(); + ::llvm::StringRef getEquation(); +}; +} // namespace detail +template +class XlaEinsumOpGenericAdaptor : public detail::XlaEinsumOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaEinsumOpGenericAdaptorBase; +public: + XlaEinsumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaEinsumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaEinsumOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaEinsumOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + ValueT getB() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaEinsumOpAdaptor : public XlaEinsumOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaEinsumOpGenericAdaptor::XlaEinsumOpGenericAdaptor; + XlaEinsumOpAdaptor(XlaEinsumOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaEinsumOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaEinsumOpAdaptor; + template + using GenericAdaptor = XlaEinsumOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("equation")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getEquationAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getEquationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaEinsum"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getA(); + ::mlir::TypedValue<::mlir::TensorType> getB(); + ::mlir::OpOperand &getAMutable(); + ::mlir::OpOperand &getBMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getProduct(); + ::mlir::StringAttr getEquationAttr(); + ::llvm::StringRef getEquation(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setEquationAttr(::mlir::StringAttr attr); + void setEquation(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type product, ::mlir::Value a, ::mlir::Value b, ::mlir::StringAttr equation); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::StringAttr equation); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type product, ::mlir::Value a, ::mlir::Value b, ::llvm::StringRef equation); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::llvm::StringRef equation); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaEinsumOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaGatherOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaGatherOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaGatherOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaGatherOpGenericAdaptorBase(XlaGatherOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getDimensionNumbersAttr(); + ::llvm::StringRef getDimensionNumbers(); + ::mlir::BoolAttr getIndicesAreSortedAttr(); + bool getIndicesAreSorted(); +}; +} // namespace detail +template +class XlaGatherOpGenericAdaptor : public detail::XlaGatherOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaGatherOpGenericAdaptorBase; +public: + XlaGatherOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaGatherOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaGatherOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaGatherOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + ValueT getStartIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getSliceSizes() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaGatherOpAdaptor : public XlaGatherOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaGatherOpGenericAdaptor::XlaGatherOpGenericAdaptor; + XlaGatherOpAdaptor(XlaGatherOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaGatherOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaGatherOpAdaptor; + template + using GenericAdaptor = XlaGatherOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices"), ::llvm::StringRef("dimension_numbers"), ::llvm::StringRef("indices_are_sorted")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDimensionNumbersAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDimensionNumbersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getIndicesAreSortedAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getIndicesAreSortedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaGather"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::TypedValue<::mlir::TensorType> getStartIndices(); + ::mlir::TypedValue<::mlir::TensorType> getSliceSizes(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::OpOperand &getStartIndicesMutable(); + ::mlir::OpOperand &getSliceSizesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::StringAttr getDimensionNumbersAttr(); + ::llvm::StringRef getDimensionNumbers(); + ::mlir::BoolAttr getIndicesAreSortedAttr(); + bool getIndicesAreSorted(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setDimensionNumbersAttr(::mlir::StringAttr attr); + void setDimensionNumbers(::llvm::StringRef attrValue); + void setIndicesAreSortedAttr(::mlir::BoolAttr attr); + void setIndicesAreSorted(bool attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value operand, ::mlir::Value start_indices, ::mlir::Value slice_sizes, ::mlir::StringAttr dimension_numbers, ::mlir::BoolAttr indices_are_sorted); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value start_indices, ::mlir::Value slice_sizes, ::mlir::StringAttr dimension_numbers, ::mlir::BoolAttr indices_are_sorted); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value operand, ::mlir::Value start_indices, ::mlir::Value slice_sizes, ::llvm::StringRef dimension_numbers, bool indices_are_sorted); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value start_indices, ::mlir::Value slice_sizes, ::llvm::StringRef dimension_numbers, bool indices_are_sorted); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaGatherOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaHostComputeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaHostComputeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaHostComputeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaHostComputeOpGenericAdaptorBase(XlaHostComputeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getAncestorsAttr(); + ::mlir::ArrayAttr getAncestors(); + ::mlir::ArrayAttr getShapesAttr(); + ::mlir::ArrayAttr getShapes(); + ::mlir::SymbolRefAttr getShapeInferenceGraphAttr(); + ::std::optional< ::mlir::SymbolRefAttr > getShapeInferenceGraph(); + ::mlir::StringAttr getKeyAttr(); + ::llvm::StringRef getKey(); + ::mlir::StringAttr getSendKeyAttr(); + ::llvm::StringRef getSendKey(); + ::mlir::StringAttr getRecvKeyAttr(); + ::llvm::StringRef getRecvKey(); + ::mlir::IntegerAttr getCostEstimateNsAttr(); + uint64_t getCostEstimateNs(); + ::mlir::IntegerAttr getTpuCoreAttr(); + uint64_t getTpuCore(); +}; +} // namespace detail +template +class XlaHostComputeOpGenericAdaptor : public detail::XlaHostComputeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaHostComputeOpGenericAdaptorBase; +public: + XlaHostComputeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaHostComputeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaHostComputeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaHostComputeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaHostComputeOpAdaptor : public XlaHostComputeOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaHostComputeOpGenericAdaptor::XlaHostComputeOpGenericAdaptor; + XlaHostComputeOpAdaptor(XlaHostComputeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaHostComputeOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaHostComputeOpAdaptor; + template + using GenericAdaptor = XlaHostComputeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tinputs"), ::llvm::StringRef("Toutputs"), ::llvm::StringRef("ancestors"), ::llvm::StringRef("cost_estimate_ns"), ::llvm::StringRef("key"), ::llvm::StringRef("recv_key"), ::llvm::StringRef("send_key"), ::llvm::StringRef("shape_inference_graph"), ::llvm::StringRef("shapes"), ::llvm::StringRef("tpu_core")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTinputsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTinputsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getToutputsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getToutputsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getAncestorsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getAncestorsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getCostEstimateNsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getCostEstimateNsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getKeyAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getKeyAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getRecvKeyAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getRecvKeyAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getSendKeyAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getSendKeyAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getShapeInferenceGraphAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getShapeInferenceGraphAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getShapesAttrName() { + return getAttributeNameForIndex(8); + } + + static ::mlir::StringAttr getShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 8); + } + + ::mlir::StringAttr getTpuCoreAttrName() { + return getAttributeNameForIndex(9); + } + + static ::mlir::StringAttr getTpuCoreAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 9); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaHostCompute"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::MutableOperandRange getInputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutputs(); + ::mlir::ArrayAttr getAncestorsAttr(); + ::mlir::ArrayAttr getAncestors(); + ::mlir::ArrayAttr getShapesAttr(); + ::mlir::ArrayAttr getShapes(); + ::mlir::SymbolRefAttr getShapeInferenceGraphAttr(); + ::std::optional< ::mlir::SymbolRefAttr > getShapeInferenceGraph(); + ::mlir::StringAttr getKeyAttr(); + ::llvm::StringRef getKey(); + ::mlir::StringAttr getSendKeyAttr(); + ::llvm::StringRef getSendKey(); + ::mlir::StringAttr getRecvKeyAttr(); + ::llvm::StringRef getRecvKey(); + ::mlir::IntegerAttr getCostEstimateNsAttr(); + uint64_t getCostEstimateNs(); + ::mlir::IntegerAttr getTpuCoreAttr(); + uint64_t getTpuCore(); + mlir::OperandElementTypeRange getTinputs(); + mlir::ResultElementTypeRange getToutputs(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setAncestorsAttr(::mlir::ArrayAttr attr); + void setShapesAttr(::mlir::ArrayAttr attr); + void setShapeInferenceGraphAttr(::mlir::SymbolRefAttr attr); + void setKeyAttr(::mlir::StringAttr attr); + void setKey(::llvm::StringRef attrValue); + void setSendKeyAttr(::mlir::StringAttr attr); + void setSendKey(::llvm::StringRef attrValue); + void setRecvKeyAttr(::mlir::StringAttr attr); + void setRecvKey(::llvm::StringRef attrValue); + void setCostEstimateNsAttr(::mlir::IntegerAttr attr); + void setCostEstimateNs(::std::optional attrValue); + void setTpuCoreAttr(::mlir::IntegerAttr attr); + void setTpuCore(::std::optional attrValue); + ::mlir::Attribute removeShapeInferenceGraphAttr(); + ::mlir::Attribute removeCostEstimateNsAttr(); + ::mlir::Attribute removeTpuCoreAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outputs, ::mlir::ValueRange inputs, ::mlir::ArrayAttr ancestors, ::mlir::ArrayAttr shapes, /*optional*/::mlir::SymbolRefAttr shape_inference_graph, ::mlir::StringAttr key, ::mlir::StringAttr send_key, ::mlir::StringAttr recv_key, /*optional*/::mlir::IntegerAttr cost_estimate_ns, /*optional*/::mlir::IntegerAttr tpu_core); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outputs, ::mlir::ValueRange inputs, ::mlir::ArrayAttr ancestors, ::mlir::ArrayAttr shapes, /*optional*/::mlir::SymbolRefAttr shape_inference_graph, ::llvm::StringRef key, ::llvm::StringRef send_key = "", ::llvm::StringRef recv_key = "", /*optional*/uint64_t cost_estimate_ns = 1000000, /*optional*/uint64_t tpu_core = 0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultAttrs(const ::mlir::OperationName &opName, ::mlir::NamedAttrList &attributes); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 10 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaHostComputeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaKeyValueSortOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaKeyValueSortOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaKeyValueSortOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaKeyValueSortOpGenericAdaptorBase(XlaKeyValueSortOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class XlaKeyValueSortOpGenericAdaptor : public detail::XlaKeyValueSortOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaKeyValueSortOpGenericAdaptorBase; +public: + XlaKeyValueSortOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaKeyValueSortOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaKeyValueSortOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaKeyValueSortOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getKeys() { + return (*getODSOperands(0).begin()); + } + + ValueT getValues() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaKeyValueSortOpAdaptor : public XlaKeyValueSortOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaKeyValueSortOpGenericAdaptor::XlaKeyValueSortOpGenericAdaptor; + XlaKeyValueSortOpAdaptor(XlaKeyValueSortOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaKeyValueSortOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaKeyValueSortOpAdaptor; + template + using GenericAdaptor = XlaKeyValueSortOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("K"), ::llvm::StringRef("V")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getKAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getKAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getVAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getVAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaKeyValueSort"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getKeys(); + ::mlir::TypedValue<::mlir::TensorType> getValues(); + ::mlir::OpOperand &getKeysMutable(); + ::mlir::OpOperand &getValuesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSortedKeys(); + ::mlir::TypedValue<::mlir::TensorType> getSortedValues(); + ::mlir::Type getK(); + ::mlir::Type getV(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type sorted_keys, ::mlir::Type sorted_values, ::mlir::Value keys, ::mlir::Value values); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value keys, ::mlir::Value values); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaKeyValueSortOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaLaunchOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaLaunchOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaLaunchOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaLaunchOpGenericAdaptorBase(XlaLaunchOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::SymbolRefAttr getFunctionAttr(); + ::mlir::SymbolRefAttr getFunction(); +}; +} // namespace detail +template +class XlaLaunchOpGenericAdaptor : public detail::XlaLaunchOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaLaunchOpGenericAdaptorBase; +public: + XlaLaunchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaLaunchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaLaunchOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaLaunchOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getConstants() { + return getODSOperands(0); + } + + RangeT getArgs() { + return getODSOperands(1); + } + + RangeT getResources() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaLaunchOpAdaptor : public XlaLaunchOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaLaunchOpGenericAdaptor::XlaLaunchOpGenericAdaptor; + XlaLaunchOpAdaptor(XlaLaunchOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaLaunchOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaLaunchOpAdaptor; + template + using GenericAdaptor = XlaLaunchOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Nresources"), ::llvm::StringRef("Targs"), ::llvm::StringRef("Tconstants"), ::llvm::StringRef("Tresults"), ::llvm::StringRef("function"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNresourcesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNresourcesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTargsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTargsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTconstantsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTconstantsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTresultsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTresultsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getFunctionAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getFunctionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaLaunch"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getConstants(); + ::mlir::Operation::operand_range getArgs(); + ::mlir::Operation::operand_range getResources(); + ::mlir::MutableOperandRange getConstantsMutable(); + ::mlir::MutableOperandRange getArgsMutable(); + ::mlir::MutableOperandRange getResourcesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResults(); + ::mlir::SymbolRefAttr getFunctionAttr(); + ::mlir::SymbolRefAttr getFunction(); + size_t getNresources(); + mlir::OperandElementTypeRange getTargs(); + mlir::OperandElementTypeRange getTconstants(); + mlir::ResultElementTypeRange getTresults(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setFunctionAttr(::mlir::SymbolRefAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange results, ::mlir::ValueRange constants, ::mlir::ValueRange args, ::mlir::ValueRange resources, ::mlir::SymbolRefAttr function); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); + std::optional GetResourceInstanceStr(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaLaunchOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaLaunchV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaLaunchV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaLaunchV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaLaunchV2OpGenericAdaptorBase(XlaLaunchV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getConstantsAttr(); + ::mlir::ArrayAttr getConstants(); + ::mlir::ArrayAttr getResourcesAttr(); + ::mlir::ArrayAttr getResources(); + ::mlir::SymbolRefAttr getFunctionAttr(); + ::mlir::SymbolRefAttr getFunction(); +}; +} // namespace detail +template +class XlaLaunchV2OpGenericAdaptor : public detail::XlaLaunchV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaLaunchV2OpGenericAdaptorBase; +public: + XlaLaunchV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaLaunchV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaLaunchV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaLaunchV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaLaunchV2OpAdaptor : public XlaLaunchV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaLaunchV2OpGenericAdaptor::XlaLaunchV2OpGenericAdaptor; + XlaLaunchV2OpAdaptor(XlaLaunchV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaLaunchV2Op : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaLaunchV2OpAdaptor; + template + using GenericAdaptor = XlaLaunchV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Targs"), ::llvm::StringRef("Tresults"), ::llvm::StringRef("constants"), ::llvm::StringRef("function"), ::llvm::StringRef("resources")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTargsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTargsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTresultsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTresultsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getConstantsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getConstantsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getFunctionAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getFunctionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getResourcesAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getResourcesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaLaunchV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResults(); + ::mlir::ArrayAttr getConstantsAttr(); + ::mlir::ArrayAttr getConstants(); + ::mlir::ArrayAttr getResourcesAttr(); + ::mlir::ArrayAttr getResources(); + ::mlir::SymbolRefAttr getFunctionAttr(); + ::mlir::SymbolRefAttr getFunction(); + mlir::OperandElementTypeRange getTargs(); + mlir::ResultElementTypeRange getTresults(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setConstantsAttr(::mlir::ArrayAttr attr); + void setResourcesAttr(::mlir::ArrayAttr attr); + void setFunctionAttr(::mlir::SymbolRefAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange results, ::mlir::ValueRange args, ::mlir::ArrayAttr constants, ::mlir::ArrayAttr resources, ::mlir::SymbolRefAttr function); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaLaunchV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaOptimizationBarrierOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaOptimizationBarrierOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaOptimizationBarrierOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaOptimizationBarrierOpGenericAdaptorBase(XlaOptimizationBarrierOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class XlaOptimizationBarrierOpGenericAdaptor : public detail::XlaOptimizationBarrierOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaOptimizationBarrierOpGenericAdaptorBase; +public: + XlaOptimizationBarrierOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaOptimizationBarrierOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaOptimizationBarrierOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaOptimizationBarrierOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInput() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaOptimizationBarrierOpAdaptor : public XlaOptimizationBarrierOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaOptimizationBarrierOpGenericAdaptor::XlaOptimizationBarrierOpGenericAdaptor; + XlaOptimizationBarrierOpAdaptor(XlaOptimizationBarrierOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaOptimizationBarrierOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaOptimizationBarrierOpAdaptor; + template + using GenericAdaptor = XlaOptimizationBarrierOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaOptimizationBarrier"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInput(); + ::mlir::MutableOperandRange getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutput(); + mlir::OperandElementTypeRange getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaOptimizationBarrierOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaPadOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaPadOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaPadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaPadOpGenericAdaptorBase(XlaPadOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class XlaPadOpGenericAdaptor : public detail::XlaPadOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaPadOpGenericAdaptorBase; +public: + XlaPadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaPadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaPadOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaPadOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getPaddingValue() { + return (*getODSOperands(1).begin()); + } + + ValueT getPaddingLow() { + return (*getODSOperands(2).begin()); + } + + ValueT getPaddingHigh() { + return (*getODSOperands(3).begin()); + } + + ValueT getPaddingInterior() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaPadOpAdaptor : public XlaPadOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaPadOpGenericAdaptor::XlaPadOpGenericAdaptor; + XlaPadOpAdaptor(XlaPadOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaPadOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<5>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaPadOpAdaptor; + template + using GenericAdaptor = XlaPadOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaPad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getPaddingValue(); + ::mlir::TypedValue<::mlir::TensorType> getPaddingLow(); + ::mlir::TypedValue<::mlir::TensorType> getPaddingHigh(); + ::mlir::TypedValue<::mlir::TensorType> getPaddingInterior(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getPaddingValueMutable(); + ::mlir::OpOperand &getPaddingLowMutable(); + ::mlir::OpOperand &getPaddingHighMutable(); + ::mlir::OpOperand &getPaddingInteriorMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value padding_value, ::mlir::Value padding_low, ::mlir::Value padding_high, ::mlir::Value padding_interior); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value padding_value, ::mlir::Value padding_low, ::mlir::Value padding_high, ::mlir::Value padding_interior); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaPadOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaRecvFromHostOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaRecvFromHostOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaRecvFromHostOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaRecvFromHostOpGenericAdaptorBase(XlaRecvFromHostOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Attribute getShapeAttr(); + std::optional> getShape(); + ::mlir::StringAttr getKeyAttr(); + ::llvm::StringRef getKey(); +}; +} // namespace detail +template +class XlaRecvFromHostOpGenericAdaptor : public detail::XlaRecvFromHostOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaRecvFromHostOpGenericAdaptorBase; +public: + XlaRecvFromHostOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaRecvFromHostOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaRecvFromHostOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaRecvFromHostOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaRecvFromHostOpAdaptor : public XlaRecvFromHostOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaRecvFromHostOpGenericAdaptor::XlaRecvFromHostOpGenericAdaptor; + XlaRecvFromHostOpAdaptor(XlaRecvFromHostOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaRecvFromHostOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaRecvFromHostOpAdaptor; + template + using GenericAdaptor = XlaRecvFromHostOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Toutput"), ::llvm::StringRef("key"), ::llvm::StringRef("shape")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getToutputAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getToutputAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getKeyAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getKeyAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShapeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaRecvFromHost"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Attribute getShapeAttr(); + std::optional> getShape(); + ::mlir::StringAttr getKeyAttr(); + ::llvm::StringRef getKey(); + ::mlir::Type getToutput(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setShapeAttr(::mlir::Attribute attr); + void setShape(std::optional> attrValue); + void setKeyAttr(::mlir::StringAttr attr); + void setKey(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Attribute shape, ::mlir::StringAttr key); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Attribute shape, ::mlir::StringAttr key); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, std::optional> shape, ::llvm::StringRef key); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, std::optional> shape, ::llvm::StringRef key); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaRecvFromHostOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaRecvOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaRecvOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaRecvOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaRecvOpGenericAdaptorBase(XlaRecvOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getTensorNameAttr(); + ::llvm::StringRef getTensorName(); + ::mlir::Attribute getShapeAttr(); + std::optional> getShape(); +}; +} // namespace detail +template +class XlaRecvOpGenericAdaptor : public detail::XlaRecvOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaRecvOpGenericAdaptorBase; +public: + XlaRecvOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaRecvOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaRecvOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaRecvOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaRecvOpAdaptor : public XlaRecvOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaRecvOpGenericAdaptor::XlaRecvOpGenericAdaptor; + XlaRecvOpAdaptor(XlaRecvOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaRecvOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaRecvOpAdaptor; + template + using GenericAdaptor = XlaRecvOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dtype"), ::llvm::StringRef("shape"), ::llvm::StringRef("tensor_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getShapeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getShapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTensorNameAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTensorNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaRecv"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::StringAttr getTensorNameAttr(); + ::llvm::StringRef getTensorName(); + ::mlir::Attribute getShapeAttr(); + std::optional> getShape(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setTensorNameAttr(::mlir::StringAttr attr); + void setTensorName(::llvm::StringRef attrValue); + void setShapeAttr(::mlir::Attribute attr); + void setShape(std::optional> attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type tensor, ::mlir::StringAttr tensor_name, ::mlir::Attribute shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr tensor_name, ::mlir::Attribute shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type tensor, ::llvm::StringRef tensor_name, std::optional> shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef tensor_name, std::optional> shape); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaRecvOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaRecvTPUEmbeddingActivationsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaRecvTPUEmbeddingActivationsOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaRecvTPUEmbeddingActivationsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaRecvTPUEmbeddingActivationsOpGenericAdaptorBase(XlaRecvTPUEmbeddingActivationsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class XlaRecvTPUEmbeddingActivationsOpGenericAdaptor : public detail::XlaRecvTPUEmbeddingActivationsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaRecvTPUEmbeddingActivationsOpGenericAdaptorBase; +public: + XlaRecvTPUEmbeddingActivationsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaRecvTPUEmbeddingActivationsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaRecvTPUEmbeddingActivationsOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaRecvTPUEmbeddingActivationsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getDeduplicationData() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaRecvTPUEmbeddingActivationsOpAdaptor : public XlaRecvTPUEmbeddingActivationsOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaRecvTPUEmbeddingActivationsOpGenericAdaptor::XlaRecvTPUEmbeddingActivationsOpGenericAdaptor; + XlaRecvTPUEmbeddingActivationsOpAdaptor(XlaRecvTPUEmbeddingActivationsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaRecvTPUEmbeddingActivationsOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaRecvTPUEmbeddingActivationsOpAdaptor; + template + using GenericAdaptor = XlaRecvTPUEmbeddingActivationsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_tables")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumTablesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumTablesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaRecvTPUEmbeddingActivations"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getDeduplicationData(); + ::mlir::OpOperand &getDeduplicationDataMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutputs(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + size_t getNumTables(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outputs, ::mlir::Value deduplication_data, ::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outputs, ::mlir::Value deduplication_data, ::llvm::StringRef config); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaRecvTPUEmbeddingActivationsOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaRecvTPUEmbeddingDeduplicationDataOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaRecvTPUEmbeddingDeduplicationDataOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaRecvTPUEmbeddingDeduplicationDataOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaRecvTPUEmbeddingDeduplicationDataOpGenericAdaptorBase(XlaRecvTPUEmbeddingDeduplicationDataOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class XlaRecvTPUEmbeddingDeduplicationDataOpGenericAdaptor : public detail::XlaRecvTPUEmbeddingDeduplicationDataOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaRecvTPUEmbeddingDeduplicationDataOpGenericAdaptorBase; +public: + XlaRecvTPUEmbeddingDeduplicationDataOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaRecvTPUEmbeddingDeduplicationDataOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaRecvTPUEmbeddingDeduplicationDataOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaRecvTPUEmbeddingDeduplicationDataOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaRecvTPUEmbeddingDeduplicationDataOpAdaptor : public XlaRecvTPUEmbeddingDeduplicationDataOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaRecvTPUEmbeddingDeduplicationDataOpGenericAdaptor::XlaRecvTPUEmbeddingDeduplicationDataOpGenericAdaptor; + XlaRecvTPUEmbeddingDeduplicationDataOpAdaptor(XlaRecvTPUEmbeddingDeduplicationDataOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaRecvTPUEmbeddingDeduplicationDataOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaRecvTPUEmbeddingDeduplicationDataOpAdaptor; + template + using GenericAdaptor = XlaRecvTPUEmbeddingDeduplicationDataOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaRecvTPUEmbeddingDeduplicationData"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::llvm::StringRef config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef config); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaRecvTPUEmbeddingDeduplicationDataOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaReduceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaReduceOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaReduceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaReduceOpGenericAdaptorBase(XlaReduceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getDimensionsToReduceAttr(); + ::mlir::ArrayAttr getDimensionsToReduce(); + ::mlir::SymbolRefAttr getReducerAttr(); + ::mlir::SymbolRefAttr getReducer(); +}; +} // namespace detail +template +class XlaReduceOpGenericAdaptor : public detail::XlaReduceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaReduceOpGenericAdaptorBase; +public: + XlaReduceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaReduceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaReduceOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaReduceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getInitValue() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaReduceOpAdaptor : public XlaReduceOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaReduceOpGenericAdaptor::XlaReduceOpGenericAdaptor; + XlaReduceOpAdaptor(XlaReduceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaReduceOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaReduceOpAdaptor; + template + using GenericAdaptor = XlaReduceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("dimensions_to_reduce"), ::llvm::StringRef("reducer")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDimensionsToReduceAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDimensionsToReduceAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getReducerAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getReducerAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaReduce"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getInitValue(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getInitValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ArrayAttr getDimensionsToReduceAttr(); + ::mlir::ArrayAttr getDimensionsToReduce(); + ::mlir::SymbolRefAttr getReducerAttr(); + ::mlir::SymbolRefAttr getReducer(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setDimensionsToReduceAttr(::mlir::ArrayAttr attr); + void setReducerAttr(::mlir::SymbolRefAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value init_value, ::mlir::ArrayAttr dimensions_to_reduce, ::mlir::SymbolRefAttr reducer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value init_value, ::mlir::ArrayAttr dimensions_to_reduce, ::mlir::SymbolRefAttr reducer); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaReduceOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaReducePrecisionOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaReducePrecisionOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaReducePrecisionOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaReducePrecisionOpGenericAdaptorBase(XlaReducePrecisionOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getExponentBitsAttr(); + uint64_t getExponentBits(); + ::mlir::IntegerAttr getMantissaBitsAttr(); + uint64_t getMantissaBits(); +}; +} // namespace detail +template +class XlaReducePrecisionOpGenericAdaptor : public detail::XlaReducePrecisionOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaReducePrecisionOpGenericAdaptorBase; +public: + XlaReducePrecisionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaReducePrecisionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaReducePrecisionOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaReducePrecisionOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaReducePrecisionOpAdaptor : public XlaReducePrecisionOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaReducePrecisionOpGenericAdaptor::XlaReducePrecisionOpGenericAdaptor; + XlaReducePrecisionOpAdaptor(XlaReducePrecisionOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaReducePrecisionOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaReducePrecisionOpAdaptor; + template + using GenericAdaptor = XlaReducePrecisionOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("exponent_bits"), ::llvm::StringRef("mantissa_bits")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getExponentBitsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getExponentBitsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getMantissaBitsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getMantissaBitsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaReducePrecision"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getExponentBitsAttr(); + uint64_t getExponentBits(); + ::mlir::IntegerAttr getMantissaBitsAttr(); + uint64_t getMantissaBits(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setExponentBitsAttr(::mlir::IntegerAttr attr); + void setExponentBits(uint64_t attrValue); + void setMantissaBitsAttr(::mlir::IntegerAttr attr); + void setMantissaBits(uint64_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value operand, ::mlir::IntegerAttr exponent_bits, ::mlir::IntegerAttr mantissa_bits); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::IntegerAttr exponent_bits, ::mlir::IntegerAttr mantissa_bits); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value operand, uint64_t exponent_bits, uint64_t mantissa_bits); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, uint64_t exponent_bits, uint64_t mantissa_bits); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaReducePrecisionOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaReduceScatterOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaReduceScatterOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaReduceScatterOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaReduceScatterOpGenericAdaptorBase(XlaReduceScatterOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getReduceOpAttr(); + ::llvm::StringRef getReduceOp(); +}; +} // namespace detail +template +class XlaReduceScatterOpGenericAdaptor : public detail::XlaReduceScatterOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaReduceScatterOpGenericAdaptorBase; +public: + XlaReduceScatterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaReduceScatterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaReduceScatterOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaReduceScatterOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getGroupAssignment() { + return (*getODSOperands(1).begin()); + } + + ValueT getScatterDimension() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaReduceScatterOpAdaptor : public XlaReduceScatterOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaReduceScatterOpGenericAdaptor::XlaReduceScatterOpGenericAdaptor; + XlaReduceScatterOpAdaptor(XlaReduceScatterOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaReduceScatterOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaReduceScatterOpAdaptor; + template + using GenericAdaptor = XlaReduceScatterOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("reduce_op")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getReduceOpAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getReduceOpAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaReduceScatter"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getGroupAssignment(); + ::mlir::TypedValue<::mlir::TensorType> getScatterDimension(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getGroupAssignmentMutable(); + ::mlir::OpOperand &getScatterDimensionMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::StringAttr getReduceOpAttr(); + ::llvm::StringRef getReduceOp(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setReduceOpAttr(::mlir::StringAttr attr); + void setReduceOp(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value group_assignment, ::mlir::Value scatter_dimension, ::mlir::StringAttr reduce_op); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value group_assignment, ::mlir::Value scatter_dimension, ::mlir::StringAttr reduce_op); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value group_assignment, ::mlir::Value scatter_dimension, ::llvm::StringRef reduce_op); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value group_assignment, ::mlir::Value scatter_dimension, ::llvm::StringRef reduce_op); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaReduceScatterOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaReduceWindowOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaReduceWindowOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaReduceWindowOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaReduceWindowOpGenericAdaptorBase(XlaReduceWindowOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::SymbolRefAttr getComputationAttr(); + ::mlir::SymbolRefAttr getComputation(); +}; +} // namespace detail +template +class XlaReduceWindowOpGenericAdaptor : public detail::XlaReduceWindowOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaReduceWindowOpGenericAdaptorBase; +public: + XlaReduceWindowOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaReduceWindowOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaReduceWindowOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaReduceWindowOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getInitValue() { + return (*getODSOperands(1).begin()); + } + + ValueT getWindowDimensions() { + return (*getODSOperands(2).begin()); + } + + ValueT getWindowStrides() { + return (*getODSOperands(3).begin()); + } + + ValueT getBaseDilations() { + return (*getODSOperands(4).begin()); + } + + ValueT getWindowDilations() { + return (*getODSOperands(5).begin()); + } + + ValueT getPadding() { + return (*getODSOperands(6).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaReduceWindowOpAdaptor : public XlaReduceWindowOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaReduceWindowOpGenericAdaptor::XlaReduceWindowOpGenericAdaptor; + XlaReduceWindowOpAdaptor(XlaReduceWindowOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaReduceWindowOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<7>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaReduceWindowOpAdaptor; + template + using GenericAdaptor = XlaReduceWindowOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices"), ::llvm::StringRef("computation")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getComputationAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getComputationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaReduceWindow"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getInitValue(); + ::mlir::TypedValue<::mlir::TensorType> getWindowDimensions(); + ::mlir::TypedValue<::mlir::TensorType> getWindowStrides(); + ::mlir::TypedValue<::mlir::TensorType> getBaseDilations(); + ::mlir::TypedValue<::mlir::TensorType> getWindowDilations(); + ::mlir::TypedValue<::mlir::TensorType> getPadding(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getInitValueMutable(); + ::mlir::OpOperand &getWindowDimensionsMutable(); + ::mlir::OpOperand &getWindowStridesMutable(); + ::mlir::OpOperand &getBaseDilationsMutable(); + ::mlir::OpOperand &getWindowDilationsMutable(); + ::mlir::OpOperand &getPaddingMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::SymbolRefAttr getComputationAttr(); + ::mlir::SymbolRefAttr getComputation(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setComputationAttr(::mlir::SymbolRefAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value init_value, ::mlir::Value window_dimensions, ::mlir::Value window_strides, ::mlir::Value base_dilations, ::mlir::Value window_dilations, ::mlir::Value padding, ::mlir::SymbolRefAttr computation); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value init_value, ::mlir::Value window_dimensions, ::mlir::Value window_strides, ::mlir::Value base_dilations, ::mlir::Value window_dilations, ::mlir::Value padding, ::mlir::SymbolRefAttr computation); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaReduceWindowOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaRemoveDynamicDimensionSizeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaRemoveDynamicDimensionSizeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaRemoveDynamicDimensionSizeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaRemoveDynamicDimensionSizeOpGenericAdaptorBase(XlaRemoveDynamicDimensionSizeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class XlaRemoveDynamicDimensionSizeOpGenericAdaptor : public detail::XlaRemoveDynamicDimensionSizeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaRemoveDynamicDimensionSizeOpGenericAdaptorBase; +public: + XlaRemoveDynamicDimensionSizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaRemoveDynamicDimensionSizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaRemoveDynamicDimensionSizeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaRemoveDynamicDimensionSizeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getDimIndex() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaRemoveDynamicDimensionSizeOpAdaptor : public XlaRemoveDynamicDimensionSizeOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaRemoveDynamicDimensionSizeOpGenericAdaptor::XlaRemoveDynamicDimensionSizeOpGenericAdaptor; + XlaRemoveDynamicDimensionSizeOpAdaptor(XlaRemoveDynamicDimensionSizeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaRemoveDynamicDimensionSizeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaRemoveDynamicDimensionSizeOpAdaptor; + template + using GenericAdaptor = XlaRemoveDynamicDimensionSizeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaRemoveDynamicDimensionSize"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getDimIndex(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getDimIndexMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value dim_index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value dim_index); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaRemoveDynamicDimensionSizeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaReplicaIdOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaReplicaIdOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaReplicaIdOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaReplicaIdOpGenericAdaptorBase(XlaReplicaIdOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class XlaReplicaIdOpGenericAdaptor : public detail::XlaReplicaIdOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaReplicaIdOpGenericAdaptorBase; +public: + XlaReplicaIdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaReplicaIdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaReplicaIdOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaReplicaIdOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaReplicaIdOpAdaptor : public XlaReplicaIdOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaReplicaIdOpGenericAdaptor::XlaReplicaIdOpGenericAdaptor; + XlaReplicaIdOpAdaptor(XlaReplicaIdOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaReplicaIdOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaReplicaIdOpAdaptor; + template + using GenericAdaptor = XlaReplicaIdOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaReplicaId"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getId(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type id); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaReplicaIdOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaRngBitGeneratorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaRngBitGeneratorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaRngBitGeneratorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaRngBitGeneratorOpGenericAdaptorBase(XlaRngBitGeneratorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class XlaRngBitGeneratorOpGenericAdaptor : public detail::XlaRngBitGeneratorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaRngBitGeneratorOpGenericAdaptorBase; +public: + XlaRngBitGeneratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaRngBitGeneratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaRngBitGeneratorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaRngBitGeneratorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getAlgorithm() { + return (*getODSOperands(0).begin()); + } + + ValueT getInitialState() { + return (*getODSOperands(1).begin()); + } + + ValueT getShape() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaRngBitGeneratorOpAdaptor : public XlaRngBitGeneratorOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaRngBitGeneratorOpGenericAdaptor::XlaRngBitGeneratorOpGenericAdaptor; + XlaRngBitGeneratorOpAdaptor(XlaRngBitGeneratorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaRngBitGeneratorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaRngBitGeneratorOpAdaptor; + template + using GenericAdaptor = XlaRngBitGeneratorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tshape"), ::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTshapeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTshapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaRngBitGenerator"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getAlgorithm(); + ::mlir::TypedValue<::mlir::TensorType> getInitialState(); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::OpOperand &getAlgorithmMutable(); + ::mlir::OpOperand &getInitialStateMutable(); + ::mlir::OpOperand &getShapeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutputKey(); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getTshape(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output_key, ::mlir::Type output, ::mlir::Value algorithm, ::mlir::Value initial_state, ::mlir::Value shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value algorithm, ::mlir::Value initial_state, ::mlir::Value shape); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaRngBitGeneratorOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaScatterOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaScatterOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaScatterOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaScatterOpGenericAdaptorBase(XlaScatterOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::SymbolRefAttr getUpdateComputationAttr(); + ::mlir::SymbolRefAttr getUpdateComputation(); + ::mlir::StringAttr getDimensionNumbersAttr(); + ::llvm::StringRef getDimensionNumbers(); + ::mlir::BoolAttr getIndicesAreSortedAttr(); + bool getIndicesAreSorted(); +}; +} // namespace detail +template +class XlaScatterOpGenericAdaptor : public detail::XlaScatterOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaScatterOpGenericAdaptorBase; +public: + XlaScatterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaScatterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaScatterOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaScatterOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + ValueT getScatterIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getUpdates() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaScatterOpAdaptor : public XlaScatterOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaScatterOpGenericAdaptor::XlaScatterOpGenericAdaptor; + XlaScatterOpAdaptor(XlaScatterOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaScatterOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaScatterOpAdaptor; + template + using GenericAdaptor = XlaScatterOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices"), ::llvm::StringRef("dimension_numbers"), ::llvm::StringRef("indices_are_sorted"), ::llvm::StringRef("update_computation")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDimensionNumbersAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDimensionNumbersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getIndicesAreSortedAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getIndicesAreSortedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getUpdateComputationAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getUpdateComputationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaScatter"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::TypedValue<::mlir::TensorType> getScatterIndices(); + ::mlir::TypedValue<::mlir::TensorType> getUpdates(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::OpOperand &getScatterIndicesMutable(); + ::mlir::OpOperand &getUpdatesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::SymbolRefAttr getUpdateComputationAttr(); + ::mlir::SymbolRefAttr getUpdateComputation(); + ::mlir::StringAttr getDimensionNumbersAttr(); + ::llvm::StringRef getDimensionNumbers(); + ::mlir::BoolAttr getIndicesAreSortedAttr(); + bool getIndicesAreSorted(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setUpdateComputationAttr(::mlir::SymbolRefAttr attr); + void setDimensionNumbersAttr(::mlir::StringAttr attr); + void setDimensionNumbers(::llvm::StringRef attrValue); + void setIndicesAreSortedAttr(::mlir::BoolAttr attr); + void setIndicesAreSorted(bool attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value operand, ::mlir::Value scatter_indices, ::mlir::Value updates, ::mlir::SymbolRefAttr update_computation, ::mlir::StringAttr dimension_numbers, ::mlir::BoolAttr indices_are_sorted); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value scatter_indices, ::mlir::Value updates, ::mlir::SymbolRefAttr update_computation, ::mlir::StringAttr dimension_numbers, ::mlir::BoolAttr indices_are_sorted); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value operand, ::mlir::Value scatter_indices, ::mlir::Value updates, ::mlir::SymbolRefAttr update_computation, ::llvm::StringRef dimension_numbers, bool indices_are_sorted); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value scatter_indices, ::mlir::Value updates, ::mlir::SymbolRefAttr update_computation, ::llvm::StringRef dimension_numbers, bool indices_are_sorted); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaScatterOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaSelectAndScatterOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaSelectAndScatterOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaSelectAndScatterOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaSelectAndScatterOpGenericAdaptorBase(XlaSelectAndScatterOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::SymbolRefAttr getSelectAttr(); + ::mlir::SymbolRefAttr getSelect(); + ::mlir::SymbolRefAttr getScatterAttr(); + ::mlir::SymbolRefAttr getScatter(); +}; +} // namespace detail +template +class XlaSelectAndScatterOpGenericAdaptor : public detail::XlaSelectAndScatterOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaSelectAndScatterOpGenericAdaptorBase; +public: + XlaSelectAndScatterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaSelectAndScatterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaSelectAndScatterOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaSelectAndScatterOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + ValueT getWindowDimensions() { + return (*getODSOperands(1).begin()); + } + + ValueT getWindowStrides() { + return (*getODSOperands(2).begin()); + } + + ValueT getPadding() { + return (*getODSOperands(3).begin()); + } + + ValueT getSource() { + return (*getODSOperands(4).begin()); + } + + ValueT getInitValue() { + return (*getODSOperands(5).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaSelectAndScatterOpAdaptor : public XlaSelectAndScatterOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaSelectAndScatterOpGenericAdaptor::XlaSelectAndScatterOpGenericAdaptor; + XlaSelectAndScatterOpAdaptor(XlaSelectAndScatterOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaSelectAndScatterOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<6>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaSelectAndScatterOpAdaptor; + template + using GenericAdaptor = XlaSelectAndScatterOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices"), ::llvm::StringRef("scatter"), ::llvm::StringRef("select")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getScatterAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getScatterAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSelectAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSelectAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaSelectAndScatter"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::TypedValue<::mlir::TensorType> getWindowDimensions(); + ::mlir::TypedValue<::mlir::TensorType> getWindowStrides(); + ::mlir::TypedValue<::mlir::TensorType> getPadding(); + ::mlir::TypedValue<::mlir::TensorType> getSource(); + ::mlir::TypedValue<::mlir::TensorType> getInitValue(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::OpOperand &getWindowDimensionsMutable(); + ::mlir::OpOperand &getWindowStridesMutable(); + ::mlir::OpOperand &getPaddingMutable(); + ::mlir::OpOperand &getSourceMutable(); + ::mlir::OpOperand &getInitValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::SymbolRefAttr getSelectAttr(); + ::mlir::SymbolRefAttr getSelect(); + ::mlir::SymbolRefAttr getScatterAttr(); + ::mlir::SymbolRefAttr getScatter(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setSelectAttr(::mlir::SymbolRefAttr attr); + void setScatterAttr(::mlir::SymbolRefAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value operand, ::mlir::Value window_dimensions, ::mlir::Value window_strides, ::mlir::Value padding, ::mlir::Value source, ::mlir::Value init_value, ::mlir::SymbolRefAttr select, ::mlir::SymbolRefAttr scatter); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value window_dimensions, ::mlir::Value window_strides, ::mlir::Value padding, ::mlir::Value source, ::mlir::Value init_value, ::mlir::SymbolRefAttr select, ::mlir::SymbolRefAttr scatter); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaSelectAndScatterOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaSelfAdjointEigOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaSelfAdjointEigOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaSelfAdjointEigOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaSelfAdjointEigOpGenericAdaptorBase(XlaSelfAdjointEigOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getLowerAttr(); + bool getLower(); + ::mlir::IntegerAttr getMaxIterAttr(); + uint64_t getMaxIter(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); +}; +} // namespace detail +template +class XlaSelfAdjointEigOpGenericAdaptor : public detail::XlaSelfAdjointEigOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaSelfAdjointEigOpGenericAdaptorBase; +public: + XlaSelfAdjointEigOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaSelfAdjointEigOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaSelfAdjointEigOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaSelfAdjointEigOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaSelfAdjointEigOpAdaptor : public XlaSelfAdjointEigOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaSelfAdjointEigOpGenericAdaptor::XlaSelfAdjointEigOpGenericAdaptor; + XlaSelfAdjointEigOpAdaptor(XlaSelfAdjointEigOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaSelfAdjointEigOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaSelfAdjointEigOpAdaptor; + template + using GenericAdaptor = XlaSelfAdjointEigOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("epsilon"), ::llvm::StringRef("lower"), ::llvm::StringRef("max_iter")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getEpsilonAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getEpsilonAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getLowerAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getLowerAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getMaxIterAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getMaxIterAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaSelfAdjointEig"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getA(); + ::mlir::OpOperand &getAMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getW(); + ::mlir::TypedValue<::mlir::TensorType> getV(); + ::mlir::BoolAttr getLowerAttr(); + bool getLower(); + ::mlir::IntegerAttr getMaxIterAttr(); + uint64_t getMaxIter(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setLowerAttr(::mlir::BoolAttr attr); + void setLower(bool attrValue); + void setMaxIterAttr(::mlir::IntegerAttr attr); + void setMaxIter(uint64_t attrValue); + void setEpsilonAttr(::mlir::FloatAttr attr); + void setEpsilon(::llvm::APFloat attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type w, ::mlir::Type v, ::mlir::Value a, ::mlir::BoolAttr lower, ::mlir::IntegerAttr max_iter, ::mlir::FloatAttr epsilon); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::BoolAttr lower, ::mlir::IntegerAttr max_iter, ::mlir::FloatAttr epsilon); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type w, ::mlir::Type v, ::mlir::Value a, bool lower, uint64_t max_iter, ::llvm::APFloat epsilon); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, bool lower, uint64_t max_iter, ::llvm::APFloat epsilon); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaSelfAdjointEigOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaSendOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaSendOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaSendOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaSendOpGenericAdaptorBase(XlaSendOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getTensorNameAttr(); + ::llvm::StringRef getTensorName(); +}; +} // namespace detail +template +class XlaSendOpGenericAdaptor : public detail::XlaSendOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaSendOpGenericAdaptorBase; +public: + XlaSendOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaSendOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaSendOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaSendOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTensor() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaSendOpAdaptor : public XlaSendOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaSendOpGenericAdaptor::XlaSendOpGenericAdaptor; + XlaSendOpAdaptor(XlaSendOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaSendOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaSendOpAdaptor; + template + using GenericAdaptor = XlaSendOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("tensor_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTensorNameAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTensorNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaSend"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::OpOperand &getTensorMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::StringAttr getTensorNameAttr(); + ::llvm::StringRef getTensorName(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setTensorNameAttr(::mlir::StringAttr attr); + void setTensorName(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value tensor, ::mlir::StringAttr tensor_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tensor, ::mlir::StringAttr tensor_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value tensor, ::llvm::StringRef tensor_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tensor, ::llvm::StringRef tensor_name); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaSendOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaSendTPUEmbeddingGradientsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaSendTPUEmbeddingGradientsOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaSendTPUEmbeddingGradientsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaSendTPUEmbeddingGradientsOpGenericAdaptorBase(XlaSendTPUEmbeddingGradientsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class XlaSendTPUEmbeddingGradientsOpGenericAdaptor : public detail::XlaSendTPUEmbeddingGradientsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaSendTPUEmbeddingGradientsOpGenericAdaptorBase; +public: + XlaSendTPUEmbeddingGradientsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaSendTPUEmbeddingGradientsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaSendTPUEmbeddingGradientsOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaSendTPUEmbeddingGradientsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getGradients() { + return getODSOperands(0); + } + + RangeT getLearningRates() { + return getODSOperands(1); + } + + ValueT getDeduplicationData() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaSendTPUEmbeddingGradientsOpAdaptor : public XlaSendTPUEmbeddingGradientsOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaSendTPUEmbeddingGradientsOpGenericAdaptor::XlaSendTPUEmbeddingGradientsOpGenericAdaptor; + XlaSendTPUEmbeddingGradientsOpAdaptor(XlaSendTPUEmbeddingGradientsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaSendTPUEmbeddingGradientsOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaSendTPUEmbeddingGradientsOpAdaptor; + template + using GenericAdaptor = XlaSendTPUEmbeddingGradientsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("NumLearningRateTags"), ::llvm::StringRef("NumTables"), ::llvm::StringRef("config"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNumLearningRateTagsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNumLearningRateTagsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumTablesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumTablesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaSendTPUEmbeddingGradients"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getGradients(); + ::mlir::Operation::operand_range getLearningRates(); + ::mlir::TypedValue<::mlir::TensorType> getDeduplicationData(); + ::mlir::MutableOperandRange getGradientsMutable(); + ::mlir::MutableOperandRange getLearningRatesMutable(); + ::mlir::OpOperand &getDeduplicationDataMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + size_t getNumLearningRateTags(); + size_t getNumTables(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange gradients, ::mlir::ValueRange learning_rates, ::mlir::Value deduplication_data, ::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange gradients, ::mlir::ValueRange learning_rates, ::mlir::Value deduplication_data, ::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange gradients, ::mlir::ValueRange learning_rates, ::mlir::Value deduplication_data, ::llvm::StringRef config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange gradients, ::mlir::ValueRange learning_rates, ::mlir::Value deduplication_data, ::llvm::StringRef config); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaSendTPUEmbeddingGradientsOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaSendToHostOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaSendToHostOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaSendToHostOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaSendToHostOpGenericAdaptorBase(XlaSendToHostOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getKeyAttr(); + ::llvm::StringRef getKey(); +}; +} // namespace detail +template +class XlaSendToHostOpGenericAdaptor : public detail::XlaSendToHostOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaSendToHostOpGenericAdaptorBase; +public: + XlaSendToHostOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaSendToHostOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaSendToHostOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaSendToHostOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaSendToHostOpAdaptor : public XlaSendToHostOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaSendToHostOpGenericAdaptor::XlaSendToHostOpGenericAdaptor; + XlaSendToHostOpAdaptor(XlaSendToHostOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaSendToHostOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaSendToHostOpAdaptor; + template + using GenericAdaptor = XlaSendToHostOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tinput"), ::llvm::StringRef("key")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTinputAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTinputAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getKeyAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getKeyAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaSendToHost"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::StringAttr getKeyAttr(); + ::llvm::StringRef getKey(); + ::mlir::Type getTinput(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setKeyAttr(::mlir::StringAttr attr); + void setKey(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::StringAttr key); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::StringAttr key); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::llvm::StringRef key); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::llvm::StringRef key); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaSendToHostOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaSetBoundOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaSetBoundOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaSetBoundOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaSetBoundOpGenericAdaptorBase(XlaSetBoundOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class XlaSetBoundOpGenericAdaptor : public detail::XlaSetBoundOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaSetBoundOpGenericAdaptorBase; +public: + XlaSetBoundOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaSetBoundOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaSetBoundOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaSetBoundOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getBound() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaSetBoundOpAdaptor : public XlaSetBoundOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaSetBoundOpGenericAdaptor::XlaSetBoundOpGenericAdaptor; + XlaSetBoundOpAdaptor(XlaSetBoundOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaSetBoundOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaSetBoundOpAdaptor; + template + using GenericAdaptor = XlaSetBoundOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaSetBound"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getBound(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getBoundMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value bound); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value bound); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaSetBoundOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaSetDynamicDimensionSizeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaSetDynamicDimensionSizeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaSetDynamicDimensionSizeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaSetDynamicDimensionSizeOpGenericAdaptorBase(XlaSetDynamicDimensionSizeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class XlaSetDynamicDimensionSizeOpGenericAdaptor : public detail::XlaSetDynamicDimensionSizeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaSetDynamicDimensionSizeOpGenericAdaptorBase; +public: + XlaSetDynamicDimensionSizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaSetDynamicDimensionSizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaSetDynamicDimensionSizeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaSetDynamicDimensionSizeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getDimIndex() { + return (*getODSOperands(1).begin()); + } + + ValueT getSize() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaSetDynamicDimensionSizeOpAdaptor : public XlaSetDynamicDimensionSizeOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaSetDynamicDimensionSizeOpGenericAdaptor::XlaSetDynamicDimensionSizeOpGenericAdaptor; + XlaSetDynamicDimensionSizeOpAdaptor(XlaSetDynamicDimensionSizeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaSetDynamicDimensionSizeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaSetDynamicDimensionSizeOpAdaptor; + template + using GenericAdaptor = XlaSetDynamicDimensionSizeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaSetDynamicDimensionSize"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getDimIndex(); + ::mlir::TypedValue<::mlir::TensorType> getSize(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getDimIndexMutable(); + ::mlir::OpOperand &getSizeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value dim_index, ::mlir::Value size); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value dim_index, ::mlir::Value size); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value dim_index, ::mlir::Value size); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // InferTypeOpInterface: + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return ArraysAreCastCompatible(l, r); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaSetDynamicDimensionSizeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaShardingOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaShardingOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaShardingOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaShardingOpGenericAdaptorBase(XlaShardingOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getShardingAttr(); + ::llvm::StringRef getSharding(); + ::mlir::StringAttr get_XlaShardingAttr(); + ::std::optional< ::llvm::StringRef > get_XlaSharding(); +}; +} // namespace detail +template +class XlaShardingOpGenericAdaptor : public detail::XlaShardingOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaShardingOpGenericAdaptorBase; +public: + XlaShardingOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaShardingOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaShardingOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaShardingOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaShardingOpAdaptor : public XlaShardingOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaShardingOpGenericAdaptor::XlaShardingOpGenericAdaptor; + XlaShardingOpAdaptor(XlaShardingOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaShardingOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaShardingOpAdaptor; + template + using GenericAdaptor = XlaShardingOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("_XlaSharding"), ::llvm::StringRef("sharding")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr get_XlaShardingAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr get_XlaShardingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardingAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaSharding"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::StringAttr getShardingAttr(); + ::llvm::StringRef getSharding(); + ::mlir::StringAttr get_XlaShardingAttr(); + ::std::optional< ::llvm::StringRef > get_XlaSharding(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setShardingAttr(::mlir::StringAttr attr); + void setSharding(::llvm::StringRef attrValue); + void set_XlaShardingAttr(::mlir::StringAttr attr); + void set_XlaSharding(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute remove_XlaShardingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::StringAttr sharding, /*optional*/::mlir::StringAttr _XlaSharding); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::StringAttr sharding, /*optional*/::mlir::StringAttr _XlaSharding); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::llvm::StringRef sharding, /*optional*/::mlir::StringAttr _XlaSharding); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::llvm::StringRef sharding, /*optional*/::mlir::StringAttr _XlaSharding); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultAttrs(const ::mlir::OperationName &opName, ::mlir::NamedAttrList &attributes); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaShardingOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaSortOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaSortOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaSortOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaSortOpGenericAdaptorBase(XlaSortOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class XlaSortOpGenericAdaptor : public detail::XlaSortOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaSortOpGenericAdaptorBase; +public: + XlaSortOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaSortOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaSortOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaSortOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaSortOpAdaptor : public XlaSortOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaSortOpGenericAdaptor::XlaSortOpGenericAdaptor; + XlaSortOpAdaptor(XlaSortOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaSortOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaSortOpAdaptor; + template + using GenericAdaptor = XlaSortOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaSort"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaSortOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaSparseCoreAdagradMomentumOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaSparseCoreAdagradMomentumOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaSparseCoreAdagradMomentumOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaSparseCoreAdagradMomentumOpGenericAdaptorBase(XlaSparseCoreAdagradMomentumOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getFeatureWidthAttr(); + uint64_t getFeatureWidth(); + ::mlir::BoolAttr getUseNesterovAttr(); + bool getUseNesterov(); + ::mlir::FloatAttr getBeta_2Attr(); + ::llvm::APFloat getBeta_2(); + ::mlir::FloatAttr getExponentAttr(); + ::llvm::APFloat getExponent(); +}; +} // namespace detail +template +class XlaSparseCoreAdagradMomentumOpGenericAdaptor : public detail::XlaSparseCoreAdagradMomentumOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaSparseCoreAdagradMomentumOpGenericAdaptorBase; +public: + XlaSparseCoreAdagradMomentumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaSparseCoreAdagradMomentumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaSparseCoreAdagradMomentumOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaSparseCoreAdagradMomentumOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIndices() { + return (*getODSOperands(0).begin()); + } + + ValueT getGradient() { + return (*getODSOperands(1).begin()); + } + + ValueT getLearningRate() { + return (*getODSOperands(2).begin()); + } + + ValueT getBeta_1() { + return (*getODSOperands(3).begin()); + } + + ValueT getEpsilon() { + return (*getODSOperands(4).begin()); + } + + ValueT getAccumulator() { + return (*getODSOperands(5).begin()); + } + + ValueT getMomentum() { + return (*getODSOperands(6).begin()); + } + + ValueT getEmbeddingTable() { + return (*getODSOperands(7).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaSparseCoreAdagradMomentumOpAdaptor : public XlaSparseCoreAdagradMomentumOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaSparseCoreAdagradMomentumOpGenericAdaptor::XlaSparseCoreAdagradMomentumOpGenericAdaptor; + XlaSparseCoreAdagradMomentumOpAdaptor(XlaSparseCoreAdagradMomentumOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaSparseCoreAdagradMomentumOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<8>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaSparseCoreAdagradMomentumOpAdaptor; + template + using GenericAdaptor = XlaSparseCoreAdagradMomentumOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("beta_2"), ::llvm::StringRef("exponent"), ::llvm::StringRef("feature_width"), ::llvm::StringRef("use_nesterov")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBeta_2AttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBeta_2AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getExponentAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getExponentAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getFeatureWidthAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getFeatureWidthAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getUseNesterovAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getUseNesterovAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaSparseCoreAdagradMomentum"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getGradient(); + ::mlir::TypedValue<::mlir::TensorType> getLearningRate(); + ::mlir::TypedValue<::mlir::TensorType> getBeta_1(); + ::mlir::TypedValue<::mlir::TensorType> getEpsilon(); + ::mlir::TypedValue<::mlir::TensorType> getAccumulator(); + ::mlir::TypedValue<::mlir::TensorType> getMomentum(); + ::mlir::TypedValue<::mlir::TensorType> getEmbeddingTable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getGradientMutable(); + ::mlir::OpOperand &getLearningRateMutable(); + ::mlir::OpOperand &getBeta_1Mutable(); + ::mlir::OpOperand &getEpsilonMutable(); + ::mlir::OpOperand &getAccumulatorMutable(); + ::mlir::OpOperand &getMomentumMutable(); + ::mlir::OpOperand &getEmbeddingTableMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getUpdatedEmbeddingTable(); + ::mlir::TypedValue<::mlir::TensorType> getUpdatedAccumulator(); + ::mlir::TypedValue<::mlir::TensorType> getUpdatedMomentum(); + ::mlir::IntegerAttr getFeatureWidthAttr(); + uint64_t getFeatureWidth(); + ::mlir::BoolAttr getUseNesterovAttr(); + bool getUseNesterov(); + ::mlir::FloatAttr getBeta_2Attr(); + ::llvm::APFloat getBeta_2(); + ::mlir::FloatAttr getExponentAttr(); + ::llvm::APFloat getExponent(); + void setFeatureWidthAttr(::mlir::IntegerAttr attr); + void setFeatureWidth(uint64_t attrValue); + void setUseNesterovAttr(::mlir::BoolAttr attr); + void setUseNesterov(bool attrValue); + void setBeta_2Attr(::mlir::FloatAttr attr); + void setBeta_2(::llvm::APFloat attrValue); + void setExponentAttr(::mlir::FloatAttr attr); + void setExponent(::llvm::APFloat attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type updated_embedding_table, ::mlir::Type updated_accumulator, ::mlir::Type updated_momentum, ::mlir::Value indices, ::mlir::Value gradient, ::mlir::Value learning_rate, ::mlir::Value beta_1, ::mlir::Value epsilon, ::mlir::Value accumulator, ::mlir::Value momentum, ::mlir::Value embedding_table, ::mlir::IntegerAttr feature_width, ::mlir::BoolAttr use_nesterov, ::mlir::FloatAttr beta_2, ::mlir::FloatAttr exponent); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value indices, ::mlir::Value gradient, ::mlir::Value learning_rate, ::mlir::Value beta_1, ::mlir::Value epsilon, ::mlir::Value accumulator, ::mlir::Value momentum, ::mlir::Value embedding_table, ::mlir::IntegerAttr feature_width, ::mlir::BoolAttr use_nesterov, ::mlir::FloatAttr beta_2, ::mlir::FloatAttr exponent); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type updated_embedding_table, ::mlir::Type updated_accumulator, ::mlir::Type updated_momentum, ::mlir::Value indices, ::mlir::Value gradient, ::mlir::Value learning_rate, ::mlir::Value beta_1, ::mlir::Value epsilon, ::mlir::Value accumulator, ::mlir::Value momentum, ::mlir::Value embedding_table, uint64_t feature_width, bool use_nesterov, ::llvm::APFloat beta_2, ::llvm::APFloat exponent); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value indices, ::mlir::Value gradient, ::mlir::Value learning_rate, ::mlir::Value beta_1, ::mlir::Value epsilon, ::mlir::Value accumulator, ::mlir::Value momentum, ::mlir::Value embedding_table, uint64_t feature_width, bool use_nesterov, ::llvm::APFloat beta_2, ::llvm::APFloat exponent); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaSparseCoreAdagradMomentumOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaSparseCoreAdagradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaSparseCoreAdagradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaSparseCoreAdagradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaSparseCoreAdagradOpGenericAdaptorBase(XlaSparseCoreAdagradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getFeatureWidthAttr(); + uint64_t getFeatureWidth(); +}; +} // namespace detail +template +class XlaSparseCoreAdagradOpGenericAdaptor : public detail::XlaSparseCoreAdagradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaSparseCoreAdagradOpGenericAdaptorBase; +public: + XlaSparseCoreAdagradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaSparseCoreAdagradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaSparseCoreAdagradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaSparseCoreAdagradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIndices() { + return (*getODSOperands(0).begin()); + } + + ValueT getGradient() { + return (*getODSOperands(1).begin()); + } + + ValueT getLearningRate() { + return (*getODSOperands(2).begin()); + } + + ValueT getAccumulator() { + return (*getODSOperands(3).begin()); + } + + ValueT getEmbeddingTable() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaSparseCoreAdagradOpAdaptor : public XlaSparseCoreAdagradOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaSparseCoreAdagradOpGenericAdaptor::XlaSparseCoreAdagradOpGenericAdaptor; + XlaSparseCoreAdagradOpAdaptor(XlaSparseCoreAdagradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaSparseCoreAdagradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<5>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaSparseCoreAdagradOpAdaptor; + template + using GenericAdaptor = XlaSparseCoreAdagradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("feature_width")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFeatureWidthAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFeatureWidthAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaSparseCoreAdagrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getGradient(); + ::mlir::TypedValue<::mlir::TensorType> getLearningRate(); + ::mlir::TypedValue<::mlir::TensorType> getAccumulator(); + ::mlir::TypedValue<::mlir::TensorType> getEmbeddingTable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getGradientMutable(); + ::mlir::OpOperand &getLearningRateMutable(); + ::mlir::OpOperand &getAccumulatorMutable(); + ::mlir::OpOperand &getEmbeddingTableMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getUpdatedEmbeddingTable(); + ::mlir::TypedValue<::mlir::TensorType> getUpdatedAccumulator(); + ::mlir::IntegerAttr getFeatureWidthAttr(); + uint64_t getFeatureWidth(); + void setFeatureWidthAttr(::mlir::IntegerAttr attr); + void setFeatureWidth(uint64_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type updated_embedding_table, ::mlir::Type updated_accumulator, ::mlir::Value indices, ::mlir::Value gradient, ::mlir::Value learning_rate, ::mlir::Value accumulator, ::mlir::Value embedding_table, ::mlir::IntegerAttr feature_width); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value indices, ::mlir::Value gradient, ::mlir::Value learning_rate, ::mlir::Value accumulator, ::mlir::Value embedding_table, ::mlir::IntegerAttr feature_width); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type updated_embedding_table, ::mlir::Type updated_accumulator, ::mlir::Value indices, ::mlir::Value gradient, ::mlir::Value learning_rate, ::mlir::Value accumulator, ::mlir::Value embedding_table, uint64_t feature_width); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value indices, ::mlir::Value gradient, ::mlir::Value learning_rate, ::mlir::Value accumulator, ::mlir::Value embedding_table, uint64_t feature_width); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaSparseCoreAdagradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaSparseCoreAdamOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaSparseCoreAdamOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaSparseCoreAdamOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaSparseCoreAdamOpGenericAdaptorBase(XlaSparseCoreAdamOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getFeatureWidthAttr(); + uint64_t getFeatureWidth(); + ::mlir::BoolAttr getUseSumInsideSqrtAttr(); + bool getUseSumInsideSqrt(); +}; +} // namespace detail +template +class XlaSparseCoreAdamOpGenericAdaptor : public detail::XlaSparseCoreAdamOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaSparseCoreAdamOpGenericAdaptorBase; +public: + XlaSparseCoreAdamOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaSparseCoreAdamOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaSparseCoreAdamOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaSparseCoreAdamOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getEmbeddingTable() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getGradient() { + return (*getODSOperands(2).begin()); + } + + ValueT getLearningRate() { + return (*getODSOperands(3).begin()); + } + + ValueT getMomentum() { + return (*getODSOperands(4).begin()); + } + + ValueT getVelocity() { + return (*getODSOperands(5).begin()); + } + + ValueT getBeta_1() { + return (*getODSOperands(6).begin()); + } + + ValueT getBeta_2() { + return (*getODSOperands(7).begin()); + } + + ValueT getEpsilon() { + return (*getODSOperands(8).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaSparseCoreAdamOpAdaptor : public XlaSparseCoreAdamOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaSparseCoreAdamOpGenericAdaptor::XlaSparseCoreAdamOpGenericAdaptor; + XlaSparseCoreAdamOpAdaptor(XlaSparseCoreAdamOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaSparseCoreAdamOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<9>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaSparseCoreAdamOpAdaptor; + template + using GenericAdaptor = XlaSparseCoreAdamOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("feature_width"), ::llvm::StringRef("use_sum_inside_sqrt")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFeatureWidthAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFeatureWidthAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getUseSumInsideSqrtAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getUseSumInsideSqrtAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaSparseCoreAdam"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getEmbeddingTable(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getGradient(); + ::mlir::TypedValue<::mlir::TensorType> getLearningRate(); + ::mlir::TypedValue<::mlir::TensorType> getMomentum(); + ::mlir::TypedValue<::mlir::TensorType> getVelocity(); + ::mlir::TypedValue<::mlir::TensorType> getBeta_1(); + ::mlir::TypedValue<::mlir::TensorType> getBeta_2(); + ::mlir::TypedValue<::mlir::TensorType> getEpsilon(); + ::mlir::OpOperand &getEmbeddingTableMutable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getGradientMutable(); + ::mlir::OpOperand &getLearningRateMutable(); + ::mlir::OpOperand &getMomentumMutable(); + ::mlir::OpOperand &getVelocityMutable(); + ::mlir::OpOperand &getBeta_1Mutable(); + ::mlir::OpOperand &getBeta_2Mutable(); + ::mlir::OpOperand &getEpsilonMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getUpdatedEmbeddingTable(); + ::mlir::TypedValue<::mlir::TensorType> getUpdatedVelocity(); + ::mlir::TypedValue<::mlir::TensorType> getUpdatedMomentum(); + ::mlir::IntegerAttr getFeatureWidthAttr(); + uint64_t getFeatureWidth(); + ::mlir::BoolAttr getUseSumInsideSqrtAttr(); + bool getUseSumInsideSqrt(); + void setFeatureWidthAttr(::mlir::IntegerAttr attr); + void setFeatureWidth(uint64_t attrValue); + void setUseSumInsideSqrtAttr(::mlir::BoolAttr attr); + void setUseSumInsideSqrt(bool attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type updated_embedding_table, ::mlir::Type updated_velocity, ::mlir::Type updated_momentum, ::mlir::Value embedding_table, ::mlir::Value indices, ::mlir::Value gradient, ::mlir::Value learning_rate, ::mlir::Value momentum, ::mlir::Value velocity, ::mlir::Value beta_1, ::mlir::Value beta_2, ::mlir::Value epsilon, ::mlir::IntegerAttr feature_width, ::mlir::BoolAttr use_sum_inside_sqrt); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value embedding_table, ::mlir::Value indices, ::mlir::Value gradient, ::mlir::Value learning_rate, ::mlir::Value momentum, ::mlir::Value velocity, ::mlir::Value beta_1, ::mlir::Value beta_2, ::mlir::Value epsilon, ::mlir::IntegerAttr feature_width, ::mlir::BoolAttr use_sum_inside_sqrt); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type updated_embedding_table, ::mlir::Type updated_velocity, ::mlir::Type updated_momentum, ::mlir::Value embedding_table, ::mlir::Value indices, ::mlir::Value gradient, ::mlir::Value learning_rate, ::mlir::Value momentum, ::mlir::Value velocity, ::mlir::Value beta_1, ::mlir::Value beta_2, ::mlir::Value epsilon, uint64_t feature_width, bool use_sum_inside_sqrt); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value embedding_table, ::mlir::Value indices, ::mlir::Value gradient, ::mlir::Value learning_rate, ::mlir::Value momentum, ::mlir::Value velocity, ::mlir::Value beta_1, ::mlir::Value beta_2, ::mlir::Value epsilon, uint64_t feature_width, bool use_sum_inside_sqrt); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaSparseCoreAdamOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaSparseCoreFtrlOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaSparseCoreFtrlOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaSparseCoreFtrlOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaSparseCoreFtrlOpGenericAdaptorBase(XlaSparseCoreFtrlOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getFeatureWidthAttr(); + uint64_t getFeatureWidth(); + ::mlir::BoolAttr getMultiplyLinearByLearningRateAttr(); + bool getMultiplyLinearByLearningRate(); + ::mlir::FloatAttr getL1RegularizationStrengthAttr(); + ::llvm::APFloat getL1RegularizationStrength(); +}; +} // namespace detail +template +class XlaSparseCoreFtrlOpGenericAdaptor : public detail::XlaSparseCoreFtrlOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaSparseCoreFtrlOpGenericAdaptorBase; +public: + XlaSparseCoreFtrlOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaSparseCoreFtrlOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaSparseCoreFtrlOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaSparseCoreFtrlOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getEmbeddingTable() { + return (*getODSOperands(0).begin()); + } + + ValueT getAccumulator() { + return (*getODSOperands(1).begin()); + } + + ValueT getLinear() { + return (*getODSOperands(2).begin()); + } + + ValueT getLearningRate() { + return (*getODSOperands(3).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(4).begin()); + } + + ValueT getGradient() { + return (*getODSOperands(5).begin()); + } + + ValueT getBeta() { + return (*getODSOperands(6).begin()); + } + + ValueT getLearningRatePower() { + return (*getODSOperands(7).begin()); + } + + ValueT getL2RegularizationStrength() { + return (*getODSOperands(8).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaSparseCoreFtrlOpAdaptor : public XlaSparseCoreFtrlOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaSparseCoreFtrlOpGenericAdaptor::XlaSparseCoreFtrlOpGenericAdaptor; + XlaSparseCoreFtrlOpAdaptor(XlaSparseCoreFtrlOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaSparseCoreFtrlOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<9>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaSparseCoreFtrlOpAdaptor; + template + using GenericAdaptor = XlaSparseCoreFtrlOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("feature_width"), ::llvm::StringRef("l1_regularization_strength"), ::llvm::StringRef("multiply_linear_by_learning_rate")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFeatureWidthAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFeatureWidthAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getL1RegularizationStrengthAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getL1RegularizationStrengthAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getMultiplyLinearByLearningRateAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getMultiplyLinearByLearningRateAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaSparseCoreFtrl"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getEmbeddingTable(); + ::mlir::TypedValue<::mlir::TensorType> getAccumulator(); + ::mlir::TypedValue<::mlir::TensorType> getLinear(); + ::mlir::TypedValue<::mlir::TensorType> getLearningRate(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getGradient(); + ::mlir::TypedValue<::mlir::TensorType> getBeta(); + ::mlir::TypedValue<::mlir::TensorType> getLearningRatePower(); + ::mlir::TypedValue<::mlir::TensorType> getL2RegularizationStrength(); + ::mlir::OpOperand &getEmbeddingTableMutable(); + ::mlir::OpOperand &getAccumulatorMutable(); + ::mlir::OpOperand &getLinearMutable(); + ::mlir::OpOperand &getLearningRateMutable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getGradientMutable(); + ::mlir::OpOperand &getBetaMutable(); + ::mlir::OpOperand &getLearningRatePowerMutable(); + ::mlir::OpOperand &getL2RegularizationStrengthMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getUpdatedEmbeddingTable(); + ::mlir::TypedValue<::mlir::TensorType> getUpdatedAccumulator(); + ::mlir::TypedValue<::mlir::TensorType> getUpdatedLinear(); + ::mlir::IntegerAttr getFeatureWidthAttr(); + uint64_t getFeatureWidth(); + ::mlir::BoolAttr getMultiplyLinearByLearningRateAttr(); + bool getMultiplyLinearByLearningRate(); + ::mlir::FloatAttr getL1RegularizationStrengthAttr(); + ::llvm::APFloat getL1RegularizationStrength(); + void setFeatureWidthAttr(::mlir::IntegerAttr attr); + void setFeatureWidth(uint64_t attrValue); + void setMultiplyLinearByLearningRateAttr(::mlir::BoolAttr attr); + void setMultiplyLinearByLearningRate(bool attrValue); + void setL1RegularizationStrengthAttr(::mlir::FloatAttr attr); + void setL1RegularizationStrength(::llvm::APFloat attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type updated_embedding_table, ::mlir::Type updated_accumulator, ::mlir::Type updated_linear, ::mlir::Value embedding_table, ::mlir::Value accumulator, ::mlir::Value linear, ::mlir::Value learning_rate, ::mlir::Value indices, ::mlir::Value gradient, ::mlir::Value beta, ::mlir::Value learning_rate_power, ::mlir::Value l2_regularization_strength, ::mlir::IntegerAttr feature_width, ::mlir::BoolAttr multiply_linear_by_learning_rate, ::mlir::FloatAttr l1_regularization_strength); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value embedding_table, ::mlir::Value accumulator, ::mlir::Value linear, ::mlir::Value learning_rate, ::mlir::Value indices, ::mlir::Value gradient, ::mlir::Value beta, ::mlir::Value learning_rate_power, ::mlir::Value l2_regularization_strength, ::mlir::IntegerAttr feature_width, ::mlir::BoolAttr multiply_linear_by_learning_rate, ::mlir::FloatAttr l1_regularization_strength); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type updated_embedding_table, ::mlir::Type updated_accumulator, ::mlir::Type updated_linear, ::mlir::Value embedding_table, ::mlir::Value accumulator, ::mlir::Value linear, ::mlir::Value learning_rate, ::mlir::Value indices, ::mlir::Value gradient, ::mlir::Value beta, ::mlir::Value learning_rate_power, ::mlir::Value l2_regularization_strength, uint64_t feature_width, bool multiply_linear_by_learning_rate, ::llvm::APFloat l1_regularization_strength); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value embedding_table, ::mlir::Value accumulator, ::mlir::Value linear, ::mlir::Value learning_rate, ::mlir::Value indices, ::mlir::Value gradient, ::mlir::Value beta, ::mlir::Value learning_rate_power, ::mlir::Value l2_regularization_strength, uint64_t feature_width, bool multiply_linear_by_learning_rate, ::llvm::APFloat l1_regularization_strength); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaSparseCoreFtrlOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaSparseCoreSgdOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaSparseCoreSgdOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaSparseCoreSgdOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaSparseCoreSgdOpGenericAdaptorBase(XlaSparseCoreSgdOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getFeatureWidthAttr(); + uint64_t getFeatureWidth(); +}; +} // namespace detail +template +class XlaSparseCoreSgdOpGenericAdaptor : public detail::XlaSparseCoreSgdOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaSparseCoreSgdOpGenericAdaptorBase; +public: + XlaSparseCoreSgdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaSparseCoreSgdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaSparseCoreSgdOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaSparseCoreSgdOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIndices() { + return (*getODSOperands(0).begin()); + } + + ValueT getGradient() { + return (*getODSOperands(1).begin()); + } + + ValueT getLearningRate() { + return (*getODSOperands(2).begin()); + } + + ValueT getEmbeddingTable() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaSparseCoreSgdOpAdaptor : public XlaSparseCoreSgdOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaSparseCoreSgdOpGenericAdaptor::XlaSparseCoreSgdOpGenericAdaptor; + XlaSparseCoreSgdOpAdaptor(XlaSparseCoreSgdOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaSparseCoreSgdOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaSparseCoreSgdOpAdaptor; + template + using GenericAdaptor = XlaSparseCoreSgdOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("feature_width")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFeatureWidthAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFeatureWidthAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaSparseCoreSgd"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getGradient(); + ::mlir::TypedValue<::mlir::TensorType> getLearningRate(); + ::mlir::TypedValue<::mlir::TensorType> getEmbeddingTable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getGradientMutable(); + ::mlir::OpOperand &getLearningRateMutable(); + ::mlir::OpOperand &getEmbeddingTableMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getUpdatedEmbeddingTable(); + ::mlir::IntegerAttr getFeatureWidthAttr(); + uint64_t getFeatureWidth(); + void setFeatureWidthAttr(::mlir::IntegerAttr attr); + void setFeatureWidth(uint64_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type updated_embedding_table, ::mlir::Value indices, ::mlir::Value gradient, ::mlir::Value learning_rate, ::mlir::Value embedding_table, ::mlir::IntegerAttr feature_width); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value indices, ::mlir::Value gradient, ::mlir::Value learning_rate, ::mlir::Value embedding_table, ::mlir::IntegerAttr feature_width); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type updated_embedding_table, ::mlir::Value indices, ::mlir::Value gradient, ::mlir::Value learning_rate, ::mlir::Value embedding_table, uint64_t feature_width); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value indices, ::mlir::Value gradient, ::mlir::Value learning_rate, ::mlir::Value embedding_table, uint64_t feature_width); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaSparseCoreSgdOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaSparseDenseMatmulGradWithSgdAndCsrInputOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaSparseDenseMatmulGradWithSgdAndCsrInputOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaSparseDenseMatmulGradWithSgdAndCsrInputOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaSparseDenseMatmulGradWithSgdAndCsrInputOpGenericAdaptorBase(XlaSparseDenseMatmulGradWithSgdAndCsrInputOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); +}; +} // namespace detail +template +class XlaSparseDenseMatmulGradWithSgdAndCsrInputOpGenericAdaptor : public detail::XlaSparseDenseMatmulGradWithSgdAndCsrInputOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaSparseDenseMatmulGradWithSgdAndCsrInputOpGenericAdaptorBase; +public: + XlaSparseDenseMatmulGradWithSgdAndCsrInputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaSparseDenseMatmulGradWithSgdAndCsrInputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaSparseDenseMatmulGradWithSgdAndCsrInputOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaSparseDenseMatmulGradWithSgdAndCsrInputOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getRowPointers() { + return (*getODSOperands(0).begin()); + } + + ValueT getSortedSampleIds() { + return (*getODSOperands(1).begin()); + } + + ValueT getSortedTokenIds() { + return (*getODSOperands(2).begin()); + } + + ValueT getSortedGains() { + return (*getODSOperands(3).begin()); + } + + ValueT getActivationGradients() { + return (*getODSOperands(4).begin()); + } + + ValueT getLearningRate() { + return (*getODSOperands(5).begin()); + } + + ValueT getEmbeddingTable() { + return (*getODSOperands(6).begin()); + } + + ValueT getNumMinibatchesPerPhysicalSparseCore() { + return (*getODSOperands(7).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaSparseDenseMatmulGradWithSgdAndCsrInputOpAdaptor : public XlaSparseDenseMatmulGradWithSgdAndCsrInputOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaSparseDenseMatmulGradWithSgdAndCsrInputOpGenericAdaptor::XlaSparseDenseMatmulGradWithSgdAndCsrInputOpGenericAdaptor; + XlaSparseDenseMatmulGradWithSgdAndCsrInputOpAdaptor(XlaSparseDenseMatmulGradWithSgdAndCsrInputOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaSparseDenseMatmulGradWithSgdAndCsrInputOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<8>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaSparseDenseMatmulGradWithSgdAndCsrInputOpAdaptor; + template + using GenericAdaptor = XlaSparseDenseMatmulGradWithSgdAndCsrInputOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaSparseDenseMatmulGradWithSgdAndCsrInput"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getRowPointers(); + ::mlir::TypedValue<::mlir::TensorType> getSortedSampleIds(); + ::mlir::TypedValue<::mlir::TensorType> getSortedTokenIds(); + ::mlir::TypedValue<::mlir::TensorType> getSortedGains(); + ::mlir::TypedValue<::mlir::TensorType> getActivationGradients(); + ::mlir::TypedValue<::mlir::TensorType> getLearningRate(); + ::mlir::TypedValue<::mlir::TensorType> getEmbeddingTable(); + ::mlir::TypedValue<::mlir::TensorType> getNumMinibatchesPerPhysicalSparseCore(); + ::mlir::OpOperand &getRowPointersMutable(); + ::mlir::OpOperand &getSortedSampleIdsMutable(); + ::mlir::OpOperand &getSortedTokenIdsMutable(); + ::mlir::OpOperand &getSortedGainsMutable(); + ::mlir::OpOperand &getActivationGradientsMutable(); + ::mlir::OpOperand &getLearningRateMutable(); + ::mlir::OpOperand &getEmbeddingTableMutable(); + ::mlir::OpOperand &getNumMinibatchesPerPhysicalSparseCoreMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getUpdatedEmbeddingTable(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type updated_embedding_table, ::mlir::Value row_pointers, ::mlir::Value sorted_sample_ids, ::mlir::Value sorted_token_ids, ::mlir::Value sorted_gains, ::mlir::Value activation_gradients, ::mlir::Value learning_rate, ::mlir::Value embedding_table, ::mlir::Value num_minibatches_per_physical_sparse_core, ::mlir::StringAttr table_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value row_pointers, ::mlir::Value sorted_sample_ids, ::mlir::Value sorted_token_ids, ::mlir::Value sorted_gains, ::mlir::Value activation_gradients, ::mlir::Value learning_rate, ::mlir::Value embedding_table, ::mlir::Value num_minibatches_per_physical_sparse_core, ::mlir::StringAttr table_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type updated_embedding_table, ::mlir::Value row_pointers, ::mlir::Value sorted_sample_ids, ::mlir::Value sorted_token_ids, ::mlir::Value sorted_gains, ::mlir::Value activation_gradients, ::mlir::Value learning_rate, ::mlir::Value embedding_table, ::mlir::Value num_minibatches_per_physical_sparse_core, ::llvm::StringRef table_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value row_pointers, ::mlir::Value sorted_sample_ids, ::mlir::Value sorted_token_ids, ::mlir::Value sorted_gains, ::mlir::Value activation_gradients, ::mlir::Value learning_rate, ::mlir::Value embedding_table, ::mlir::Value num_minibatches_per_physical_sparse_core, ::llvm::StringRef table_name); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaSparseDenseMatmulGradWithSgdAndCsrInputOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaSparseDenseMatmulWithCsrInputOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaSparseDenseMatmulWithCsrInputOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaSparseDenseMatmulWithCsrInputOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaSparseDenseMatmulWithCsrInputOpGenericAdaptorBase(XlaSparseDenseMatmulWithCsrInputOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getInputSizeAttr(); + uint64_t getInputSize(); + ::mlir::FloatAttr getQuantizationConfigLowAttr(); + ::std::optional< ::llvm::APFloat > getQuantizationConfigLow(); + ::mlir::FloatAttr getQuantizationConfigHighAttr(); + ::std::optional< ::llvm::APFloat > getQuantizationConfigHigh(); + ::mlir::IntegerAttr getQuantizationConfigNumBucketsAttr(); + ::std::optional getQuantizationConfigNumBuckets(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); +}; +} // namespace detail +template +class XlaSparseDenseMatmulWithCsrInputOpGenericAdaptor : public detail::XlaSparseDenseMatmulWithCsrInputOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaSparseDenseMatmulWithCsrInputOpGenericAdaptorBase; +public: + XlaSparseDenseMatmulWithCsrInputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaSparseDenseMatmulWithCsrInputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaSparseDenseMatmulWithCsrInputOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaSparseDenseMatmulWithCsrInputOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getRowPointers() { + return (*getODSOperands(0).begin()); + } + + ValueT getSortedSampleIds() { + return (*getODSOperands(1).begin()); + } + + ValueT getSortedTokenIds() { + return (*getODSOperands(2).begin()); + } + + ValueT getSortedGains() { + return (*getODSOperands(3).begin()); + } + + ValueT getEmbeddingTable() { + return (*getODSOperands(4).begin()); + } + + ValueT getNumMinibatchesPerPhysicalSparseCore() { + return (*getODSOperands(5).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaSparseDenseMatmulWithCsrInputOpAdaptor : public XlaSparseDenseMatmulWithCsrInputOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaSparseDenseMatmulWithCsrInputOpGenericAdaptor::XlaSparseDenseMatmulWithCsrInputOpGenericAdaptor; + XlaSparseDenseMatmulWithCsrInputOpAdaptor(XlaSparseDenseMatmulWithCsrInputOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaSparseDenseMatmulWithCsrInputOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<6>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaSparseDenseMatmulWithCsrInputOpAdaptor; + template + using GenericAdaptor = XlaSparseDenseMatmulWithCsrInputOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("input_size"), ::llvm::StringRef("quantization_config_high"), ::llvm::StringRef("quantization_config_low"), ::llvm::StringRef("quantization_config_num_buckets"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getInputSizeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getInputSizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getQuantizationConfigHighAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getQuantizationConfigHighAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getQuantizationConfigLowAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getQuantizationConfigLowAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getQuantizationConfigNumBucketsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getQuantizationConfigNumBucketsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaSparseDenseMatmulWithCsrInput"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getRowPointers(); + ::mlir::TypedValue<::mlir::TensorType> getSortedSampleIds(); + ::mlir::TypedValue<::mlir::TensorType> getSortedTokenIds(); + ::mlir::TypedValue<::mlir::TensorType> getSortedGains(); + ::mlir::TypedValue<::mlir::TensorType> getEmbeddingTable(); + ::mlir::TypedValue<::mlir::TensorType> getNumMinibatchesPerPhysicalSparseCore(); + ::mlir::OpOperand &getRowPointersMutable(); + ::mlir::OpOperand &getSortedSampleIdsMutable(); + ::mlir::OpOperand &getSortedTokenIdsMutable(); + ::mlir::OpOperand &getSortedGainsMutable(); + ::mlir::OpOperand &getEmbeddingTableMutable(); + ::mlir::OpOperand &getNumMinibatchesPerPhysicalSparseCoreMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getActivations(); + ::mlir::IntegerAttr getInputSizeAttr(); + uint64_t getInputSize(); + ::mlir::FloatAttr getQuantizationConfigLowAttr(); + ::std::optional< ::llvm::APFloat > getQuantizationConfigLow(); + ::mlir::FloatAttr getQuantizationConfigHighAttr(); + ::std::optional< ::llvm::APFloat > getQuantizationConfigHigh(); + ::mlir::IntegerAttr getQuantizationConfigNumBucketsAttr(); + ::std::optional getQuantizationConfigNumBuckets(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + void setInputSizeAttr(::mlir::IntegerAttr attr); + void setInputSize(uint64_t attrValue); + void setQuantizationConfigLowAttr(::mlir::FloatAttr attr); + void setQuantizationConfigLow(::std::optional<::llvm::APFloat> attrValue); + void setQuantizationConfigHighAttr(::mlir::FloatAttr attr); + void setQuantizationConfigHigh(::std::optional<::llvm::APFloat> attrValue); + void setQuantizationConfigNumBucketsAttr(::mlir::IntegerAttr attr); + void setQuantizationConfigNumBuckets(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::llvm::StringRef attrValue); + ::mlir::Attribute removeQuantizationConfigLowAttr(); + ::mlir::Attribute removeQuantizationConfigHighAttr(); + ::mlir::Attribute removeQuantizationConfigNumBucketsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type activations, ::mlir::Value row_pointers, ::mlir::Value sorted_sample_ids, ::mlir::Value sorted_token_ids, ::mlir::Value sorted_gains, ::mlir::Value embedding_table, ::mlir::Value num_minibatches_per_physical_sparse_core, ::mlir::IntegerAttr input_size, /*optional*/::mlir::FloatAttr quantization_config_low, /*optional*/::mlir::FloatAttr quantization_config_high, /*optional*/::mlir::IntegerAttr quantization_config_num_buckets, ::mlir::StringAttr table_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value row_pointers, ::mlir::Value sorted_sample_ids, ::mlir::Value sorted_token_ids, ::mlir::Value sorted_gains, ::mlir::Value embedding_table, ::mlir::Value num_minibatches_per_physical_sparse_core, ::mlir::IntegerAttr input_size, /*optional*/::mlir::FloatAttr quantization_config_low, /*optional*/::mlir::FloatAttr quantization_config_high, /*optional*/::mlir::IntegerAttr quantization_config_num_buckets, ::mlir::StringAttr table_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type activations, ::mlir::Value row_pointers, ::mlir::Value sorted_sample_ids, ::mlir::Value sorted_token_ids, ::mlir::Value sorted_gains, ::mlir::Value embedding_table, ::mlir::Value num_minibatches_per_physical_sparse_core, uint64_t input_size, /*optional*/::mlir::FloatAttr quantization_config_low, /*optional*/::mlir::FloatAttr quantization_config_high, /*optional*/::mlir::IntegerAttr quantization_config_num_buckets, ::llvm::StringRef table_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value row_pointers, ::mlir::Value sorted_sample_ids, ::mlir::Value sorted_token_ids, ::mlir::Value sorted_gains, ::mlir::Value embedding_table, ::mlir::Value num_minibatches_per_physical_sparse_core, uint64_t input_size, /*optional*/::mlir::FloatAttr quantization_config_low, /*optional*/::mlir::FloatAttr quantization_config_high, /*optional*/::mlir::IntegerAttr quantization_config_num_buckets, ::llvm::StringRef table_name); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaSparseDenseMatmulWithCsrInputOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaSpmdFullToShardShapeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaSpmdFullToShardShapeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaSpmdFullToShardShapeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaSpmdFullToShardShapeOpGenericAdaptorBase(XlaSpmdFullToShardShapeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getManualShardingAttr(); + ::llvm::StringRef getManualSharding(); + ::mlir::IntegerAttr getDimAttr(); + uint64_t getDim(); + ::mlir::ArrayAttr getUnspecifiedDimsAttr(); + ::mlir::ArrayAttr getUnspecifiedDims(); +}; +} // namespace detail +template +class XlaSpmdFullToShardShapeOpGenericAdaptor : public detail::XlaSpmdFullToShardShapeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaSpmdFullToShardShapeOpGenericAdaptorBase; +public: + XlaSpmdFullToShardShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaSpmdFullToShardShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaSpmdFullToShardShapeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaSpmdFullToShardShapeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaSpmdFullToShardShapeOpAdaptor : public XlaSpmdFullToShardShapeOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaSpmdFullToShardShapeOpGenericAdaptor::XlaSpmdFullToShardShapeOpGenericAdaptor; + XlaSpmdFullToShardShapeOpAdaptor(XlaSpmdFullToShardShapeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaSpmdFullToShardShapeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaSpmdFullToShardShapeOpAdaptor; + template + using GenericAdaptor = XlaSpmdFullToShardShapeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("dim"), ::llvm::StringRef("manual_sharding"), ::llvm::StringRef("unspecified_dims")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDimAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDimAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getManualShardingAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getManualShardingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getUnspecifiedDimsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getUnspecifiedDimsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaSpmdFullToShardShape"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::StringAttr getManualShardingAttr(); + ::llvm::StringRef getManualSharding(); + ::mlir::IntegerAttr getDimAttr(); + uint64_t getDim(); + ::mlir::ArrayAttr getUnspecifiedDimsAttr(); + ::mlir::ArrayAttr getUnspecifiedDims(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setManualShardingAttr(::mlir::StringAttr attr); + void setManualSharding(::llvm::StringRef attrValue); + void setDimAttr(::mlir::IntegerAttr attr); + void setDim(::std::optional attrValue); + void setUnspecifiedDimsAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeDimAttr(); + ::mlir::Attribute removeUnspecifiedDimsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::StringAttr manual_sharding, /*optional*/::mlir::IntegerAttr dim, /*optional*/::mlir::ArrayAttr unspecified_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::StringAttr manual_sharding, /*optional*/::mlir::IntegerAttr dim, /*optional*/::mlir::ArrayAttr unspecified_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::llvm::StringRef manual_sharding, /*optional*/uint64_t dim, /*optional*/::mlir::ArrayAttr unspecified_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::llvm::StringRef manual_sharding, /*optional*/uint64_t dim, /*optional*/::mlir::ArrayAttr unspecified_dims); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaSpmdFullToShardShapeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaSpmdShardToFullShapeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaSpmdShardToFullShapeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaSpmdShardToFullShapeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaSpmdShardToFullShapeOpGenericAdaptorBase(XlaSpmdShardToFullShapeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getManualShardingAttr(); + ::llvm::StringRef getManualSharding(); + ::mlir::Attribute getFullShapeAttr(); + std::optional> getFullShape(); + ::mlir::IntegerAttr getDimAttr(); + uint64_t getDim(); + ::mlir::ArrayAttr getUnspecifiedDimsAttr(); + ::mlir::ArrayAttr getUnspecifiedDims(); +}; +} // namespace detail +template +class XlaSpmdShardToFullShapeOpGenericAdaptor : public detail::XlaSpmdShardToFullShapeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaSpmdShardToFullShapeOpGenericAdaptorBase; +public: + XlaSpmdShardToFullShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaSpmdShardToFullShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaSpmdShardToFullShapeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaSpmdShardToFullShapeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaSpmdShardToFullShapeOpAdaptor : public XlaSpmdShardToFullShapeOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaSpmdShardToFullShapeOpGenericAdaptor::XlaSpmdShardToFullShapeOpGenericAdaptor; + XlaSpmdShardToFullShapeOpAdaptor(XlaSpmdShardToFullShapeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaSpmdShardToFullShapeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaSpmdShardToFullShapeOpAdaptor; + template + using GenericAdaptor = XlaSpmdShardToFullShapeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("dim"), ::llvm::StringRef("full_shape"), ::llvm::StringRef("manual_sharding"), ::llvm::StringRef("unspecified_dims")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDimAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDimAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getFullShapeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getFullShapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getManualShardingAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getManualShardingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getUnspecifiedDimsAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getUnspecifiedDimsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaSpmdShardToFullShape"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::StringAttr getManualShardingAttr(); + ::llvm::StringRef getManualSharding(); + ::mlir::Attribute getFullShapeAttr(); + std::optional> getFullShape(); + ::mlir::IntegerAttr getDimAttr(); + uint64_t getDim(); + ::mlir::ArrayAttr getUnspecifiedDimsAttr(); + ::mlir::ArrayAttr getUnspecifiedDims(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setManualShardingAttr(::mlir::StringAttr attr); + void setManualSharding(::llvm::StringRef attrValue); + void setFullShapeAttr(::mlir::Attribute attr); + void setFullShape(std::optional> attrValue); + void setDimAttr(::mlir::IntegerAttr attr); + void setDim(::std::optional attrValue); + void setUnspecifiedDimsAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeDimAttr(); + ::mlir::Attribute removeUnspecifiedDimsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::StringAttr manual_sharding, ::mlir::Attribute full_shape, /*optional*/::mlir::IntegerAttr dim, /*optional*/::mlir::ArrayAttr unspecified_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::StringAttr manual_sharding, ::mlir::Attribute full_shape, /*optional*/::mlir::IntegerAttr dim, /*optional*/::mlir::ArrayAttr unspecified_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::llvm::StringRef manual_sharding, std::optional> full_shape, /*optional*/uint64_t dim, /*optional*/::mlir::ArrayAttr unspecified_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::llvm::StringRef manual_sharding, std::optional> full_shape, /*optional*/uint64_t dim, /*optional*/::mlir::ArrayAttr unspecified_dims); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaSpmdShardToFullShapeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaSvdOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaSvdOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaSvdOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaSvdOpGenericAdaptorBase(XlaSvdOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getMaxIterAttr(); + uint64_t getMaxIter(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::StringAttr getPrecisionConfigAttr(); + ::llvm::StringRef getPrecisionConfig(); +}; +} // namespace detail +template +class XlaSvdOpGenericAdaptor : public detail::XlaSvdOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaSvdOpGenericAdaptorBase; +public: + XlaSvdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaSvdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaSvdOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaSvdOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaSvdOpAdaptor : public XlaSvdOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaSvdOpGenericAdaptor::XlaSvdOpGenericAdaptor; + XlaSvdOpAdaptor(XlaSvdOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaSvdOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaSvdOpAdaptor; + template + using GenericAdaptor = XlaSvdOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("epsilon"), ::llvm::StringRef("max_iter"), ::llvm::StringRef("precision_config")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getEpsilonAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getEpsilonAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getMaxIterAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getMaxIterAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getPrecisionConfigAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getPrecisionConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaSvd"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getA(); + ::mlir::OpOperand &getAMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getS(); + ::mlir::TypedValue<::mlir::TensorType> getU(); + ::mlir::TypedValue<::mlir::TensorType> getV(); + ::mlir::IntegerAttr getMaxIterAttr(); + uint64_t getMaxIter(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::StringAttr getPrecisionConfigAttr(); + ::llvm::StringRef getPrecisionConfig(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setMaxIterAttr(::mlir::IntegerAttr attr); + void setMaxIter(uint64_t attrValue); + void setEpsilonAttr(::mlir::FloatAttr attr); + void setEpsilon(::llvm::APFloat attrValue); + void setPrecisionConfigAttr(::mlir::StringAttr attr); + void setPrecisionConfig(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type s, ::mlir::Type u, ::mlir::Type v, ::mlir::Value a, ::mlir::IntegerAttr max_iter, ::mlir::FloatAttr epsilon, ::mlir::StringAttr precision_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::IntegerAttr max_iter, ::mlir::FloatAttr epsilon, ::mlir::StringAttr precision_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type s, ::mlir::Type u, ::mlir::Type v, ::mlir::Value a, uint64_t max_iter, ::llvm::APFloat epsilon, ::llvm::StringRef precision_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, uint64_t max_iter, ::llvm::APFloat epsilon, ::llvm::StringRef precision_config); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaSvdOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaVariadicReduceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaVariadicReduceOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaVariadicReduceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaVariadicReduceOpGenericAdaptorBase(XlaVariadicReduceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getDimensionsToReduceAttr(); + ::mlir::ArrayAttr getDimensionsToReduce(); + ::mlir::SymbolRefAttr getReducerAttr(); + ::mlir::SymbolRefAttr getReducer(); +}; +} // namespace detail +template +class XlaVariadicReduceOpGenericAdaptor : public detail::XlaVariadicReduceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaVariadicReduceOpGenericAdaptorBase; +public: + XlaVariadicReduceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaVariadicReduceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaVariadicReduceOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaVariadicReduceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInput() { + return getODSOperands(0); + } + + RangeT getInitValue() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaVariadicReduceOpAdaptor : public XlaVariadicReduceOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaVariadicReduceOpGenericAdaptor::XlaVariadicReduceOpGenericAdaptor; + XlaVariadicReduceOpAdaptor(XlaVariadicReduceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaVariadicReduceOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaVariadicReduceOpAdaptor; + template + using GenericAdaptor = XlaVariadicReduceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("N"), ::llvm::StringRef("T"), ::llvm::StringRef("dimensions_to_reduce"), ::llvm::StringRef("reducer")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDimensionsToReduceAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDimensionsToReduceAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getReducerAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getReducerAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaVariadicReduce"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInput(); + ::mlir::Operation::operand_range getInitValue(); + ::mlir::MutableOperandRange getInputMutable(); + ::mlir::MutableOperandRange getInitValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutput(); + ::mlir::ArrayAttr getDimensionsToReduceAttr(); + ::mlir::ArrayAttr getDimensionsToReduce(); + ::mlir::SymbolRefAttr getReducerAttr(); + ::mlir::SymbolRefAttr getReducer(); + size_t getN(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setDimensionsToReduceAttr(::mlir::ArrayAttr attr); + void setReducerAttr(::mlir::SymbolRefAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::ValueRange input, ::mlir::ValueRange init_value, ::mlir::ArrayAttr dimensions_to_reduce, ::mlir::SymbolRefAttr reducer); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaVariadicReduceOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaVariadicReduceV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaVariadicReduceV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaVariadicReduceV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaVariadicReduceV2OpGenericAdaptorBase(XlaVariadicReduceV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getDimensionsToReduceAttr(); + ::mlir::ArrayAttr getDimensionsToReduce(); + ::mlir::SymbolRefAttr getReducerAttr(); + ::mlir::SymbolRefAttr getReducer(); +}; +} // namespace detail +template +class XlaVariadicReduceV2OpGenericAdaptor : public detail::XlaVariadicReduceV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaVariadicReduceV2OpGenericAdaptorBase; +public: + XlaVariadicReduceV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaVariadicReduceV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaVariadicReduceV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaVariadicReduceV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getInitValues() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaVariadicReduceV2OpAdaptor : public XlaVariadicReduceV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaVariadicReduceV2OpGenericAdaptor::XlaVariadicReduceV2OpGenericAdaptor; + XlaVariadicReduceV2OpAdaptor(XlaVariadicReduceV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaVariadicReduceV2Op : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaVariadicReduceV2OpAdaptor; + template + using GenericAdaptor = XlaVariadicReduceV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("dimensions_to_reduce"), ::llvm::StringRef("operandSegmentSizes"), ::llvm::StringRef("reducer")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDimensionsToReduceAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDimensionsToReduceAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getReducerAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getReducerAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaVariadicReduceV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getInitValues(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getInitValuesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutputs(); + ::mlir::ArrayAttr getDimensionsToReduceAttr(); + ::mlir::ArrayAttr getDimensionsToReduce(); + ::mlir::SymbolRefAttr getReducerAttr(); + ::mlir::SymbolRefAttr getReducer(); + mlir::OperandElementTypeRange getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setDimensionsToReduceAttr(::mlir::ArrayAttr attr); + void setReducerAttr(::mlir::SymbolRefAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outputs, ::mlir::ValueRange inputs, ::mlir::ValueRange init_values, ::mlir::ArrayAttr dimensions_to_reduce, ::mlir::SymbolRefAttr reducer); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaVariadicReduceV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaVariadicSortOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaVariadicSortOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaVariadicSortOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaVariadicSortOpGenericAdaptorBase(XlaVariadicSortOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::SymbolRefAttr getComparatorAttr(); + ::mlir::SymbolRefAttr getComparator(); + ::mlir::BoolAttr getIsStableAttr(); + bool getIsStable(); +}; +} // namespace detail +template +class XlaVariadicSortOpGenericAdaptor : public detail::XlaVariadicSortOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaVariadicSortOpGenericAdaptorBase; +public: + XlaVariadicSortOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaVariadicSortOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaVariadicSortOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaVariadicSortOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + ValueT getDimension() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaVariadicSortOpAdaptor : public XlaVariadicSortOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaVariadicSortOpGenericAdaptor::XlaVariadicSortOpGenericAdaptor; + XlaVariadicSortOpAdaptor(XlaVariadicSortOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaVariadicSortOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaVariadicSortOpAdaptor; + template + using GenericAdaptor = XlaVariadicSortOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("comparator"), ::llvm::StringRef("is_stable")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getComparatorAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getComparatorAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getIsStableAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getIsStableAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaVariadicSort"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::TypedValue<::mlir::TensorType> getDimension(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::OpOperand &getDimensionMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutputs(); + ::mlir::SymbolRefAttr getComparatorAttr(); + ::mlir::SymbolRefAttr getComparator(); + ::mlir::BoolAttr getIsStableAttr(); + bool getIsStable(); + mlir::OperandElementTypeRange getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setComparatorAttr(::mlir::SymbolRefAttr attr); + void setIsStableAttr(::mlir::BoolAttr attr); + void setIsStable(bool attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outputs, ::mlir::ValueRange inputs, ::mlir::Value dimension, ::mlir::SymbolRefAttr comparator, ::mlir::BoolAttr is_stable); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outputs, ::mlir::ValueRange inputs, ::mlir::Value dimension, ::mlir::SymbolRefAttr comparator, bool is_stable); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaVariadicSortOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::Xlog1pyOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Xlog1pyOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + Xlog1pyOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + Xlog1pyOpGenericAdaptorBase(Xlog1pyOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class Xlog1pyOpGenericAdaptor : public detail::Xlog1pyOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Xlog1pyOpGenericAdaptorBase; +public: + Xlog1pyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Xlog1pyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Xlog1pyOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + Xlog1pyOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Xlog1pyOpAdaptor : public Xlog1pyOpGenericAdaptor<::mlir::ValueRange> { +public: + using Xlog1pyOpGenericAdaptor::Xlog1pyOpGenericAdaptor; + Xlog1pyOpAdaptor(Xlog1pyOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Xlog1pyOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::SameOperandsAndResultElementTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = Xlog1pyOpAdaptor; + template + using GenericAdaptor = Xlog1pyOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Xlog1py"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::Xlog1pyOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlogyOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlogyOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlogyOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlogyOpGenericAdaptorBase(XlogyOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class XlogyOpGenericAdaptor : public detail::XlogyOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlogyOpGenericAdaptorBase; +public: + XlogyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlogyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlogyOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlogyOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlogyOpAdaptor : public XlogyOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlogyOpGenericAdaptor::XlogyOpGenericAdaptor; + XlogyOpAdaptor(XlogyOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlogyOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::OpTrait::TF::SameOperandsAndResultElementTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlogyOpAdaptor; + template + using GenericAdaptor = XlogyOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Xlogy"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlogyOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::YieldOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class YieldOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + YieldOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + YieldOpGenericAdaptorBase(YieldOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class YieldOpGenericAdaptor : public detail::YieldOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::YieldOpGenericAdaptorBase; +public: + YieldOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + YieldOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : YieldOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + YieldOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class YieldOpAdaptor : public YieldOpGenericAdaptor<::mlir::ValueRange> { +public: + using YieldOpGenericAdaptor::YieldOpGenericAdaptor; + YieldOpAdaptor(YieldOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class YieldOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsTerminator, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ReturnLike, ::mlir::RegionBranchTerminatorOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = YieldOpAdaptor; + template + using GenericAdaptor = YieldOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Yield"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange odsArg_0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::MutableOperandRange getMutableSuccessorOperands(::mlir::RegionBranchPoint point); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::YieldOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ZerosLikeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ZerosLikeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ZerosLikeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ZerosLikeOpGenericAdaptorBase(ZerosLikeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ZerosLikeOpGenericAdaptor : public detail::ZerosLikeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ZerosLikeOpGenericAdaptorBase; +public: + ZerosLikeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ZerosLikeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ZerosLikeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ZerosLikeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ZerosLikeOpAdaptor : public ZerosLikeOpGenericAdaptor<::mlir::ValueRange> { +public: + using ZerosLikeOpGenericAdaptor::ZerosLikeOpGenericAdaptor; + ZerosLikeOpAdaptor(ZerosLikeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ZerosLikeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::IsIdempotent, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ZerosLikeOpAdaptor; + template + using GenericAdaptor = ZerosLikeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ZerosLike"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ZerosLikeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ZetaOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ZetaOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ZetaOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ZetaOpGenericAdaptorBase(ZetaOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ZetaOpGenericAdaptor : public detail::ZetaOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ZetaOpGenericAdaptorBase; +public: + ZetaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ZetaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ZetaOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ZetaOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getQ() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ZetaOpAdaptor : public ZetaOpGenericAdaptor<::mlir::ValueRange> { +public: + using ZetaOpGenericAdaptor::ZetaOpGenericAdaptor; + ZetaOpAdaptor(ZetaOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ZetaOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ZetaOpAdaptor; + template + using GenericAdaptor = ZetaOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Zeta"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getQ(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getQMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value q); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value q); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ZetaOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::_ArrayToListOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class _ArrayToListOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + _ArrayToListOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + _ArrayToListOpGenericAdaptorBase(_ArrayToListOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class _ArrayToListOpGenericAdaptor : public detail::_ArrayToListOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::_ArrayToListOpGenericAdaptorBase; +public: + _ArrayToListOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + _ArrayToListOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : _ArrayToListOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + _ArrayToListOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInput() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class _ArrayToListOpAdaptor : public _ArrayToListOpGenericAdaptor<::mlir::ValueRange> { +public: + using _ArrayToListOpGenericAdaptor::_ArrayToListOpGenericAdaptor; + _ArrayToListOpAdaptor(_ArrayToListOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class _ArrayToListOp : public ::mlir::Op<_ArrayToListOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::VariadicResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = _ArrayToListOpAdaptor; + template + using GenericAdaptor = _ArrayToListOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("N"), ::llvm::StringRef("T"), ::llvm::StringRef("out_types")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOutTypesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOutTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf._ArrayToList"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInput(); + ::mlir::MutableOperandRange getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutput(); + size_t getN(); + ::mlir::Type getT(); + mlir::ResultElementTypeRange getOutTypes(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::_ArrayToListOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::_EagerConstOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class _EagerConstOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + _EagerConstOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + _EagerConstOpGenericAdaptorBase(_EagerConstOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class _EagerConstOpGenericAdaptor : public detail::_EagerConstOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::_EagerConstOpGenericAdaptorBase; +public: + _EagerConstOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + _EagerConstOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : _EagerConstOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + _EagerConstOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class _EagerConstOpAdaptor : public _EagerConstOpGenericAdaptor<::mlir::ValueRange> { +public: + using _EagerConstOpGenericAdaptor::_EagerConstOpGenericAdaptor; + _EagerConstOpAdaptor(_EagerConstOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class _EagerConstOp : public ::mlir::Op<_EagerConstOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = _EagerConstOpAdaptor; + template + using GenericAdaptor = _EagerConstOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf._EagerConst"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::_EagerConstOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::_FusedBatchNormExOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class _FusedBatchNormExOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + _FusedBatchNormExOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + _FusedBatchNormExOpGenericAdaptorBase(_FusedBatchNormExOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::FloatAttr getExponentialAvgFactorAttr(); + ::llvm::APFloat getExponentialAvgFactor(); + ::mlir::StringAttr getActivationModeAttr(); + ::llvm::StringRef getActivationMode(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::BoolAttr getIsTrainingAttr(); + bool getIsTraining(); +}; +} // namespace detail +template +class _FusedBatchNormExOpGenericAdaptor : public detail::_FusedBatchNormExOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::_FusedBatchNormExOpGenericAdaptorBase; +public: + _FusedBatchNormExOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + _FusedBatchNormExOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : _FusedBatchNormExOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + _FusedBatchNormExOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getScale() { + return (*getODSOperands(1).begin()); + } + + ValueT getOffset() { + return (*getODSOperands(2).begin()); + } + + ValueT getMean() { + return (*getODSOperands(3).begin()); + } + + ValueT getVariance() { + return (*getODSOperands(4).begin()); + } + + RangeT getSideInput() { + return getODSOperands(5); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class _FusedBatchNormExOpAdaptor : public _FusedBatchNormExOpGenericAdaptor<::mlir::ValueRange> { +public: + using _FusedBatchNormExOpGenericAdaptor::_FusedBatchNormExOpGenericAdaptor; + _FusedBatchNormExOpAdaptor(_FusedBatchNormExOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class _FusedBatchNormExOp : public ::mlir::Op<_FusedBatchNormExOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::NResults<6>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<5>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = _FusedBatchNormExOpAdaptor; + template + using GenericAdaptor = _FusedBatchNormExOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("U"), ::llvm::StringRef("activation_mode"), ::llvm::StringRef("data_format"), ::llvm::StringRef("epsilon"), ::llvm::StringRef("exponential_avg_factor"), ::llvm::StringRef("is_training"), ::llvm::StringRef("num_side_inputs")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getUAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getUAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getActivationModeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getActivationModeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getEpsilonAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getEpsilonAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getExponentialAvgFactorAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getExponentialAvgFactorAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getIsTrainingAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getIsTrainingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getNumSideInputsAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getNumSideInputsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf._FusedBatchNormEx"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getScale(); + ::mlir::TypedValue<::mlir::TensorType> getOffset(); + ::mlir::TypedValue<::mlir::TensorType> getMean(); + ::mlir::TypedValue<::mlir::TensorType> getVariance(); + ::mlir::Operation::operand_range getSideInput(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getScaleMutable(); + ::mlir::OpOperand &getOffsetMutable(); + ::mlir::OpOperand &getMeanMutable(); + ::mlir::OpOperand &getVarianceMutable(); + ::mlir::MutableOperandRange getSideInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::TypedValue<::mlir::TensorType> getBatchMean(); + ::mlir::TypedValue<::mlir::TensorType> getBatchVariance(); + ::mlir::TypedValue<::mlir::TensorType> getReserveSpace_1(); + ::mlir::TypedValue<::mlir::TensorType> getReserveSpace_2(); + ::mlir::TypedValue<::mlir::TensorType> getReserveSpace_3(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::FloatAttr getExponentialAvgFactorAttr(); + ::llvm::APFloat getExponentialAvgFactor(); + ::mlir::StringAttr getActivationModeAttr(); + ::llvm::StringRef getActivationMode(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::BoolAttr getIsTrainingAttr(); + bool getIsTraining(); + size_t getNumSideInputs(); + ::mlir::Type getT(); + ::mlir::Type getU(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setEpsilonAttr(::mlir::FloatAttr attr); + void setEpsilon(::std::optional<::llvm::APFloat> attrValue); + void setExponentialAvgFactorAttr(::mlir::FloatAttr attr); + void setExponentialAvgFactor(::std::optional<::llvm::APFloat> attrValue); + void setActivationModeAttr(::mlir::StringAttr attr); + void setActivationMode(::std::optional<::llvm::StringRef> attrValue); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + void setIsTrainingAttr(::mlir::BoolAttr attr); + void setIsTraining(::std::optional attrValue); + ::mlir::Attribute removeEpsilonAttr(); + ::mlir::Attribute removeExponentialAvgFactorAttr(); + ::mlir::Attribute removeActivationModeAttr(); + ::mlir::Attribute removeDataFormatAttr(); + ::mlir::Attribute removeIsTrainingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Type batch_mean, ::mlir::Type batch_variance, ::mlir::Type reserve_space_1, ::mlir::Type reserve_space_2, ::mlir::Type reserve_space_3, ::mlir::Value x, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value mean, ::mlir::Value variance, ::mlir::ValueRange side_input, /*optional*/::mlir::FloatAttr epsilon, /*optional*/::mlir::FloatAttr exponential_avg_factor, /*optional*/::mlir::StringAttr activation_mode, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::BoolAttr is_training); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value mean, ::mlir::Value variance, ::mlir::ValueRange side_input, /*optional*/::mlir::FloatAttr epsilon, /*optional*/::mlir::FloatAttr exponential_avg_factor, /*optional*/::mlir::StringAttr activation_mode, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::BoolAttr is_training); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Type batch_mean, ::mlir::Type batch_variance, ::mlir::Type reserve_space_1, ::mlir::Type reserve_space_2, ::mlir::Type reserve_space_3, ::mlir::Value x, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value mean, ::mlir::Value variance, ::mlir::ValueRange side_input, /*optional*/::llvm::APFloat epsilon, /*optional*/::llvm::APFloat exponential_avg_factor, /*optional*/::llvm::StringRef activation_mode = "Identity", /*optional*/::llvm::StringRef data_format = "NHWC", /*optional*/bool is_training = true); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value mean, ::mlir::Value variance, ::mlir::ValueRange side_input, /*optional*/::llvm::APFloat epsilon, /*optional*/::llvm::APFloat exponential_avg_factor, /*optional*/::llvm::StringRef activation_mode = "Identity", /*optional*/::llvm::StringRef data_format = "NHWC", /*optional*/bool is_training = true); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 8 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::_FusedBatchNormExOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::_FusedConv2DOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class _FusedConv2DOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + _FusedConv2DOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + _FusedConv2DOpGenericAdaptorBase(_FusedConv2DOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getNumArgsAttr(); + uint64_t getNumArgs(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getExplicitPaddingsAttr(); + ::mlir::ArrayAttr getExplicitPaddings(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::StringAttr getFilterFormatAttr(); + ::llvm::StringRef getFilterFormat(); + ::mlir::ArrayAttr getDilationsAttr(); + ::mlir::ArrayAttr getDilations(); + ::mlir::BoolAttr getUseCudnnOnGpuAttr(); + bool getUseCudnnOnGpu(); + ::mlir::ArrayAttr getFusedOpsAttr(); + ::mlir::ArrayAttr getFusedOps(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::FloatAttr getLeakyreluAlphaAttr(); + ::llvm::APFloat getLeakyreluAlpha(); +}; +} // namespace detail +template +class _FusedConv2DOpGenericAdaptor : public detail::_FusedConv2DOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::_FusedConv2DOpGenericAdaptorBase; +public: + _FusedConv2DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + _FusedConv2DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : _FusedConv2DOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + _FusedConv2DOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getFilter() { + return (*getODSOperands(1).begin()); + } + + RangeT getArgs() { + return getODSOperands(2); + } + + RangeT getHostArgs() { + return getODSOperands(3); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class _FusedConv2DOpAdaptor : public _FusedConv2DOpGenericAdaptor<::mlir::ValueRange> { +public: + using _FusedConv2DOpGenericAdaptor::_FusedConv2DOpGenericAdaptor; + _FusedConv2DOpAdaptor(_FusedConv2DOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class _FusedConv2DOp : public ::mlir::Op<_FusedConv2DOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<2>::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = _FusedConv2DOpAdaptor; + template + using GenericAdaptor = _FusedConv2DOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("TArgs"), ::llvm::StringRef("data_format"), ::llvm::StringRef("dilations"), ::llvm::StringRef("epsilon"), ::llvm::StringRef("explicit_paddings"), ::llvm::StringRef("filter_format"), ::llvm::StringRef("fused_ops"), ::llvm::StringRef("leakyrelu_alpha"), ::llvm::StringRef("num_args"), ::llvm::StringRef("num_host_args"), ::llvm::StringRef("operandSegmentSizes"), ::llvm::StringRef("padding"), ::llvm::StringRef("strides"), ::llvm::StringRef("use_cudnn_on_gpu")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTArgsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTArgsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getEpsilonAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getEpsilonAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getExplicitPaddingsAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getExplicitPaddingsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getFilterFormatAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getFilterFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getFusedOpsAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getFusedOpsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getLeakyreluAlphaAttrName() { + return getAttributeNameForIndex(8); + } + + static ::mlir::StringAttr getLeakyreluAlphaAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 8); + } + + ::mlir::StringAttr getNumArgsAttrName() { + return getAttributeNameForIndex(9); + } + + static ::mlir::StringAttr getNumArgsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 9); + } + + ::mlir::StringAttr getNumHostArgsAttrName() { + return getAttributeNameForIndex(10); + } + + static ::mlir::StringAttr getNumHostArgsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 10); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return getAttributeNameForIndex(11); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 11); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(12); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 12); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(13); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 13); + } + + ::mlir::StringAttr getUseCudnnOnGpuAttrName() { + return getAttributeNameForIndex(14); + } + + static ::mlir::StringAttr getUseCudnnOnGpuAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 14); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf._FusedConv2D"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getFilter(); + ::mlir::Operation::operand_range getArgs(); + ::mlir::Operation::operand_range getHostArgs(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getFilterMutable(); + ::mlir::MutableOperandRange getArgsMutable(); + ::mlir::MutableOperandRange getHostArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getNumArgsAttr(); + uint64_t getNumArgs(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getExplicitPaddingsAttr(); + ::mlir::ArrayAttr getExplicitPaddings(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::StringAttr getFilterFormatAttr(); + ::llvm::StringRef getFilterFormat(); + ::mlir::ArrayAttr getDilationsAttr(); + ::mlir::ArrayAttr getDilations(); + ::mlir::BoolAttr getUseCudnnOnGpuAttr(); + bool getUseCudnnOnGpu(); + ::mlir::ArrayAttr getFusedOpsAttr(); + ::mlir::ArrayAttr getFusedOps(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::FloatAttr getLeakyreluAlphaAttr(); + ::llvm::APFloat getLeakyreluAlpha(); + size_t getNumHostArgs(); + ::mlir::Type getT(); + mlir::OperandElementTypeRange getTArgs(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setNumArgsAttr(::mlir::IntegerAttr attr); + void setNumArgs(uint64_t attrValue); + void setStridesAttr(::mlir::ArrayAttr attr); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + void setExplicitPaddingsAttr(::mlir::ArrayAttr attr); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + void setFilterFormatAttr(::mlir::StringAttr attr); + void setFilterFormat(::std::optional<::llvm::StringRef> attrValue); + void setDilationsAttr(::mlir::ArrayAttr attr); + void setUseCudnnOnGpuAttr(::mlir::BoolAttr attr); + void setUseCudnnOnGpu(::std::optional attrValue); + void setFusedOpsAttr(::mlir::ArrayAttr attr); + void setEpsilonAttr(::mlir::FloatAttr attr); + void setEpsilon(::std::optional<::llvm::APFloat> attrValue); + void setLeakyreluAlphaAttr(::mlir::FloatAttr attr); + void setLeakyreluAlpha(::std::optional<::llvm::APFloat> attrValue); + ::mlir::Attribute removeExplicitPaddingsAttr(); + ::mlir::Attribute removeDataFormatAttr(); + ::mlir::Attribute removeFilterFormatAttr(); + ::mlir::Attribute removeDilationsAttr(); + ::mlir::Attribute removeUseCudnnOnGpuAttr(); + ::mlir::Attribute removeFusedOpsAttr(); + ::mlir::Attribute removeEpsilonAttr(); + ::mlir::Attribute removeLeakyreluAlphaAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value filter, ::mlir::ValueRange args, ::mlir::ValueRange host_args, ::mlir::IntegerAttr num_args, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::StringAttr filter_format, /*optional*/::mlir::ArrayAttr dilations, /*optional*/::mlir::BoolAttr use_cudnn_on_gpu, /*optional*/::mlir::ArrayAttr fused_ops, /*optional*/::mlir::FloatAttr epsilon, /*optional*/::mlir::FloatAttr leakyrelu_alpha); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter, ::mlir::ValueRange args, ::mlir::ValueRange host_args, ::mlir::IntegerAttr num_args, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::StringAttr filter_format, /*optional*/::mlir::ArrayAttr dilations, /*optional*/::mlir::BoolAttr use_cudnn_on_gpu, /*optional*/::mlir::ArrayAttr fused_ops, /*optional*/::mlir::FloatAttr epsilon, /*optional*/::mlir::FloatAttr leakyrelu_alpha); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value filter, ::mlir::ValueRange args, ::mlir::ValueRange host_args, uint64_t num_args, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::llvm::StringRef data_format, /*optional*/::llvm::StringRef filter_format, /*optional*/::mlir::ArrayAttr dilations, /*optional*/bool use_cudnn_on_gpu, /*optional*/::mlir::ArrayAttr fused_ops, /*optional*/::llvm::APFloat epsilon, /*optional*/::llvm::APFloat leakyrelu_alpha); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter, ::mlir::ValueRange args, ::mlir::ValueRange host_args, uint64_t num_args, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::llvm::StringRef data_format, /*optional*/::llvm::StringRef filter_format, /*optional*/::mlir::ArrayAttr dilations, /*optional*/bool use_cudnn_on_gpu, /*optional*/::mlir::ArrayAttr fused_ops, /*optional*/::llvm::APFloat epsilon, /*optional*/::llvm::APFloat leakyrelu_alpha); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 15 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::_FusedConv2DOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::_FusedMatMulOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class _FusedMatMulOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + _FusedMatMulOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + _FusedMatMulOpGenericAdaptorBase(_FusedMatMulOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getTransposeAAttr(); + bool getTransposeA(); + ::mlir::BoolAttr getTransposeBAttr(); + bool getTransposeB(); + ::mlir::ArrayAttr getFusedOpsAttr(); + ::mlir::ArrayAttr getFusedOps(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::FloatAttr getLeakyreluAlphaAttr(); + ::llvm::APFloat getLeakyreluAlpha(); +}; +} // namespace detail +template +class _FusedMatMulOpGenericAdaptor : public detail::_FusedMatMulOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::_FusedMatMulOpGenericAdaptorBase; +public: + _FusedMatMulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + _FusedMatMulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : _FusedMatMulOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + _FusedMatMulOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + ValueT getB() { + return (*getODSOperands(1).begin()); + } + + RangeT getArgs() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class _FusedMatMulOpAdaptor : public _FusedMatMulOpGenericAdaptor<::mlir::ValueRange> { +public: + using _FusedMatMulOpGenericAdaptor::_FusedMatMulOpGenericAdaptor; + _FusedMatMulOpAdaptor(_FusedMatMulOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class _FusedMatMulOp : public ::mlir::Op<_FusedMatMulOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::SameOperandsAndResultElementTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = _FusedMatMulOpAdaptor; + template + using GenericAdaptor = _FusedMatMulOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("epsilon"), ::llvm::StringRef("fused_ops"), ::llvm::StringRef("leakyrelu_alpha"), ::llvm::StringRef("num_args"), ::llvm::StringRef("transpose_a"), ::llvm::StringRef("transpose_b")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getEpsilonAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getEpsilonAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getFusedOpsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getFusedOpsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getLeakyreluAlphaAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getLeakyreluAlphaAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getNumArgsAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getNumArgsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getTransposeAAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getTransposeAAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getTransposeBAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getTransposeBAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf._FusedMatMul"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getA(); + ::mlir::TypedValue<::mlir::TensorType> getB(); + ::mlir::Operation::operand_range getArgs(); + ::mlir::OpOperand &getAMutable(); + ::mlir::OpOperand &getBMutable(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getProduct(); + ::mlir::BoolAttr getTransposeAAttr(); + bool getTransposeA(); + ::mlir::BoolAttr getTransposeBAttr(); + bool getTransposeB(); + ::mlir::ArrayAttr getFusedOpsAttr(); + ::mlir::ArrayAttr getFusedOps(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::FloatAttr getLeakyreluAlphaAttr(); + ::llvm::APFloat getLeakyreluAlpha(); + size_t getNumArgs(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setTransposeAAttr(::mlir::BoolAttr attr); + void setTransposeA(::std::optional attrValue); + void setTransposeBAttr(::mlir::BoolAttr attr); + void setTransposeB(::std::optional attrValue); + void setFusedOpsAttr(::mlir::ArrayAttr attr); + void setEpsilonAttr(::mlir::FloatAttr attr); + void setEpsilon(::std::optional<::llvm::APFloat> attrValue); + void setLeakyreluAlphaAttr(::mlir::FloatAttr attr); + void setLeakyreluAlpha(::std::optional<::llvm::APFloat> attrValue); + ::mlir::Attribute removeTransposeAAttr(); + ::mlir::Attribute removeTransposeBAttr(); + ::mlir::Attribute removeFusedOpsAttr(); + ::mlir::Attribute removeEpsilonAttr(); + ::mlir::Attribute removeLeakyreluAlphaAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type product, ::mlir::Value a, ::mlir::Value b, ::mlir::ValueRange args, /*optional*/::mlir::BoolAttr transpose_a, /*optional*/::mlir::BoolAttr transpose_b, /*optional*/::mlir::ArrayAttr fused_ops, /*optional*/::mlir::FloatAttr epsilon, /*optional*/::mlir::FloatAttr leakyrelu_alpha); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::ValueRange args, /*optional*/::mlir::BoolAttr transpose_a, /*optional*/::mlir::BoolAttr transpose_b, /*optional*/::mlir::ArrayAttr fused_ops, /*optional*/::mlir::FloatAttr epsilon, /*optional*/::mlir::FloatAttr leakyrelu_alpha); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type product, ::mlir::Value a, ::mlir::Value b, ::mlir::ValueRange args, /*optional*/bool transpose_a, /*optional*/bool transpose_b, /*optional*/::mlir::ArrayAttr fused_ops, /*optional*/::llvm::APFloat epsilon, /*optional*/::llvm::APFloat leakyrelu_alpha); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::ValueRange args, /*optional*/bool transpose_a, /*optional*/bool transpose_b, /*optional*/::mlir::ArrayAttr fused_ops, /*optional*/::llvm::APFloat epsilon, /*optional*/::llvm::APFloat leakyrelu_alpha); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 7 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::_FusedMatMulOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::_HostRecvOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class _HostRecvOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + _HostRecvOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + _HostRecvOpGenericAdaptorBase(_HostRecvOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getTensorNameAttr(); + ::llvm::StringRef getTensorName(); + ::mlir::StringAttr getSendDeviceAttr(); + ::llvm::StringRef getSendDevice(); + ::mlir::IntegerAttr getSendDeviceIncarnationAttr(); + uint64_t getSendDeviceIncarnation(); + ::mlir::StringAttr getRecvDeviceAttr(); + ::llvm::StringRef getRecvDevice(); + ::mlir::BoolAttr getClientTerminatedAttr(); + bool getClientTerminated(); +}; +} // namespace detail +template +class _HostRecvOpGenericAdaptor : public detail::_HostRecvOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::_HostRecvOpGenericAdaptorBase; +public: + _HostRecvOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + _HostRecvOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : _HostRecvOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + _HostRecvOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class _HostRecvOpAdaptor : public _HostRecvOpGenericAdaptor<::mlir::ValueRange> { +public: + using _HostRecvOpGenericAdaptor::_HostRecvOpGenericAdaptor; + _HostRecvOpAdaptor(_HostRecvOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class _HostRecvOp : public ::mlir::Op<_HostRecvOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, GetResourceInstanceInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = _HostRecvOpAdaptor; + template + using GenericAdaptor = _HostRecvOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("client_terminated"), ::llvm::StringRef("recv_device"), ::llvm::StringRef("send_device"), ::llvm::StringRef("send_device_incarnation"), ::llvm::StringRef("tensor_name"), ::llvm::StringRef("tensor_type")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getClientTerminatedAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getClientTerminatedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getRecvDeviceAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getRecvDeviceAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getSendDeviceAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getSendDeviceAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSendDeviceIncarnationAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSendDeviceIncarnationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTensorNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTensorNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getTensorTypeAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getTensorTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf._HostRecv"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::StringAttr getTensorNameAttr(); + ::llvm::StringRef getTensorName(); + ::mlir::StringAttr getSendDeviceAttr(); + ::llvm::StringRef getSendDevice(); + ::mlir::IntegerAttr getSendDeviceIncarnationAttr(); + uint64_t getSendDeviceIncarnation(); + ::mlir::StringAttr getRecvDeviceAttr(); + ::llvm::StringRef getRecvDevice(); + ::mlir::BoolAttr getClientTerminatedAttr(); + bool getClientTerminated(); + ::mlir::Type getTensorType(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setTensorNameAttr(::mlir::StringAttr attr); + void setTensorName(::llvm::StringRef attrValue); + void setSendDeviceAttr(::mlir::StringAttr attr); + void setSendDevice(::llvm::StringRef attrValue); + void setSendDeviceIncarnationAttr(::mlir::IntegerAttr attr); + void setSendDeviceIncarnation(uint64_t attrValue); + void setRecvDeviceAttr(::mlir::StringAttr attr); + void setRecvDevice(::llvm::StringRef attrValue); + void setClientTerminatedAttr(::mlir::BoolAttr attr); + void setClientTerminated(::std::optional attrValue); + ::mlir::Attribute removeClientTerminatedAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type tensor, ::mlir::StringAttr tensor_name, ::mlir::StringAttr send_device, ::mlir::IntegerAttr send_device_incarnation, ::mlir::StringAttr recv_device, /*optional*/::mlir::BoolAttr client_terminated); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr tensor_name, ::mlir::StringAttr send_device, ::mlir::IntegerAttr send_device_incarnation, ::mlir::StringAttr recv_device, /*optional*/::mlir::BoolAttr client_terminated); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type tensor, ::llvm::StringRef tensor_name, ::llvm::StringRef send_device, uint64_t send_device_incarnation, ::llvm::StringRef recv_device, /*optional*/bool client_terminated = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef tensor_name, ::llvm::StringRef send_device, uint64_t send_device_incarnation, ::llvm::StringRef recv_device, /*optional*/bool client_terminated = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + std::optional GetResourceInstanceStr(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::_HostRecvOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::_HostSendOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class _HostSendOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + _HostSendOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + _HostSendOpGenericAdaptorBase(_HostSendOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getTensorNameAttr(); + ::llvm::StringRef getTensorName(); + ::mlir::StringAttr getSendDeviceAttr(); + ::llvm::StringRef getSendDevice(); + ::mlir::IntegerAttr getSendDeviceIncarnationAttr(); + uint64_t getSendDeviceIncarnation(); + ::mlir::StringAttr getRecvDeviceAttr(); + ::llvm::StringRef getRecvDevice(); + ::mlir::BoolAttr getClientTerminatedAttr(); + bool getClientTerminated(); +}; +} // namespace detail +template +class _HostSendOpGenericAdaptor : public detail::_HostSendOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::_HostSendOpGenericAdaptorBase; +public: + _HostSendOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + _HostSendOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : _HostSendOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + _HostSendOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTensor() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class _HostSendOpAdaptor : public _HostSendOpGenericAdaptor<::mlir::ValueRange> { +public: + using _HostSendOpGenericAdaptor::_HostSendOpGenericAdaptor; + _HostSendOpAdaptor(_HostSendOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class _HostSendOp : public ::mlir::Op<_HostSendOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::ZeroResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, GetResourceInstanceInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = _HostSendOpAdaptor; + template + using GenericAdaptor = _HostSendOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("client_terminated"), ::llvm::StringRef("recv_device"), ::llvm::StringRef("send_device"), ::llvm::StringRef("send_device_incarnation"), ::llvm::StringRef("tensor_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getClientTerminatedAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getClientTerminatedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getRecvDeviceAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getRecvDeviceAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSendDeviceAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSendDeviceAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getSendDeviceIncarnationAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getSendDeviceIncarnationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getTensorNameAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getTensorNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf._HostSend"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::OpOperand &getTensorMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::StringAttr getTensorNameAttr(); + ::llvm::StringRef getTensorName(); + ::mlir::StringAttr getSendDeviceAttr(); + ::llvm::StringRef getSendDevice(); + ::mlir::IntegerAttr getSendDeviceIncarnationAttr(); + uint64_t getSendDeviceIncarnation(); + ::mlir::StringAttr getRecvDeviceAttr(); + ::llvm::StringRef getRecvDevice(); + ::mlir::BoolAttr getClientTerminatedAttr(); + bool getClientTerminated(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setTensorNameAttr(::mlir::StringAttr attr); + void setTensorName(::llvm::StringRef attrValue); + void setSendDeviceAttr(::mlir::StringAttr attr); + void setSendDevice(::llvm::StringRef attrValue); + void setSendDeviceIncarnationAttr(::mlir::IntegerAttr attr); + void setSendDeviceIncarnation(uint64_t attrValue); + void setRecvDeviceAttr(::mlir::StringAttr attr); + void setRecvDevice(::llvm::StringRef attrValue); + void setClientTerminatedAttr(::mlir::BoolAttr attr); + void setClientTerminated(::std::optional attrValue); + ::mlir::Attribute removeClientTerminatedAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value tensor, ::mlir::StringAttr tensor_name, ::mlir::StringAttr send_device, ::mlir::IntegerAttr send_device_incarnation, ::mlir::StringAttr recv_device, /*optional*/::mlir::BoolAttr client_terminated); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tensor, ::mlir::StringAttr tensor_name, ::mlir::StringAttr send_device, ::mlir::IntegerAttr send_device_incarnation, ::mlir::StringAttr recv_device, /*optional*/::mlir::BoolAttr client_terminated); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value tensor, ::llvm::StringRef tensor_name, ::llvm::StringRef send_device, uint64_t send_device_incarnation, ::llvm::StringRef recv_device, /*optional*/bool client_terminated = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tensor, ::llvm::StringRef tensor_name, ::llvm::StringRef send_device, uint64_t send_device_incarnation, ::llvm::StringRef recv_device, /*optional*/bool client_terminated = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + std::optional GetResourceInstanceStr(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::_HostSendOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::_InternalTestMustExecuteTrait_ declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class _InternalTestMustExecuteTrait_GenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + _InternalTestMustExecuteTrait_GenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + _InternalTestMustExecuteTrait_GenericAdaptorBase(_InternalTestMustExecuteTrait_ op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class _InternalTestMustExecuteTrait_GenericAdaptor : public detail::_InternalTestMustExecuteTrait_GenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::_InternalTestMustExecuteTrait_GenericAdaptorBase; +public: + _InternalTestMustExecuteTrait_GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + _InternalTestMustExecuteTrait_GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : _InternalTestMustExecuteTrait_GenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + _InternalTestMustExecuteTrait_GenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class _InternalTestMustExecuteTrait_Adaptor : public _InternalTestMustExecuteTrait_GenericAdaptor<::mlir::ValueRange> { +public: + using _InternalTestMustExecuteTrait_GenericAdaptor::_InternalTestMustExecuteTrait_GenericAdaptor; + _InternalTestMustExecuteTrait_Adaptor(_InternalTestMustExecuteTrait_ op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class _InternalTestMustExecuteTrait_ : public ::mlir::Op<_InternalTestMustExecuteTrait_, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::ZeroResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = _InternalTestMustExecuteTrait_Adaptor; + template + using GenericAdaptor = _InternalTestMustExecuteTrait_GenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf._InternalTestMustExecuteTrait_"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::_InternalTestMustExecuteTrait_) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::_InternalTestNonResourceValueSideEffects_ declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class _InternalTestNonResourceValueSideEffects_GenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + _InternalTestNonResourceValueSideEffects_GenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + _InternalTestNonResourceValueSideEffects_GenericAdaptorBase(_InternalTestNonResourceValueSideEffects_ op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class _InternalTestNonResourceValueSideEffects_GenericAdaptor : public detail::_InternalTestNonResourceValueSideEffects_GenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::_InternalTestNonResourceValueSideEffects_GenericAdaptorBase; +public: + _InternalTestNonResourceValueSideEffects_GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + _InternalTestNonResourceValueSideEffects_GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : _InternalTestNonResourceValueSideEffects_GenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + _InternalTestNonResourceValueSideEffects_GenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getKey() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class _InternalTestNonResourceValueSideEffects_Adaptor : public _InternalTestNonResourceValueSideEffects_GenericAdaptor<::mlir::ValueRange> { +public: + using _InternalTestNonResourceValueSideEffects_GenericAdaptor::_InternalTestNonResourceValueSideEffects_GenericAdaptor; + _InternalTestNonResourceValueSideEffects_Adaptor(_InternalTestNonResourceValueSideEffects_ op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class _InternalTestNonResourceValueSideEffects_ : public ::mlir::Op<_InternalTestNonResourceValueSideEffects_, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::ZeroResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = _InternalTestNonResourceValueSideEffects_Adaptor; + template + using GenericAdaptor = _InternalTestNonResourceValueSideEffects_GenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf._InternalTestNonResourceValueSideEffects_"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getKey(); + ::mlir::OpOperand &getKeyMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value key); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value key); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::_InternalTestNonResourceValueSideEffects_) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::_ListToArrayOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class _ListToArrayOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + _ListToArrayOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + _ListToArrayOpGenericAdaptorBase(_ListToArrayOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class _ListToArrayOpGenericAdaptor : public detail::_ListToArrayOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::_ListToArrayOpGenericAdaptorBase; +public: + _ListToArrayOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + _ListToArrayOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : _ListToArrayOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + _ListToArrayOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInput() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class _ListToArrayOpAdaptor : public _ListToArrayOpGenericAdaptor<::mlir::ValueRange> { +public: + using _ListToArrayOpGenericAdaptor::_ListToArrayOpGenericAdaptor; + _ListToArrayOpAdaptor(_ListToArrayOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class _ListToArrayOp : public ::mlir::Op<_ListToArrayOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::VariadicResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = _ListToArrayOpAdaptor; + template + using GenericAdaptor = _ListToArrayOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("N"), ::llvm::StringRef("T"), ::llvm::StringRef("Tin")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTinAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTinAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf._ListToArray"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInput(); + ::mlir::MutableOperandRange getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutput(); + mlir::OperandElementTypeRange getTin(); + size_t getN(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::_ListToArrayOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::_RecvOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class _RecvOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + _RecvOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + _RecvOpGenericAdaptorBase(_RecvOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getTensorNameAttr(); + ::llvm::StringRef getTensorName(); + ::mlir::StringAttr getSendDeviceAttr(); + ::llvm::StringRef getSendDevice(); + ::mlir::IntegerAttr getSendDeviceIncarnationAttr(); + uint64_t getSendDeviceIncarnation(); + ::mlir::StringAttr getRecvDeviceAttr(); + ::llvm::StringRef getRecvDevice(); + ::mlir::BoolAttr getClientTerminatedAttr(); + bool getClientTerminated(); +}; +} // namespace detail +template +class _RecvOpGenericAdaptor : public detail::_RecvOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::_RecvOpGenericAdaptorBase; +public: + _RecvOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + _RecvOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : _RecvOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + _RecvOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class _RecvOpAdaptor : public _RecvOpGenericAdaptor<::mlir::ValueRange> { +public: + using _RecvOpGenericAdaptor::_RecvOpGenericAdaptor; + _RecvOpAdaptor(_RecvOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class _RecvOp : public ::mlir::Op<_RecvOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, GetResourceInstanceInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = _RecvOpAdaptor; + template + using GenericAdaptor = _RecvOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("client_terminated"), ::llvm::StringRef("recv_device"), ::llvm::StringRef("send_device"), ::llvm::StringRef("send_device_incarnation"), ::llvm::StringRef("tensor_name"), ::llvm::StringRef("tensor_type")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getClientTerminatedAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getClientTerminatedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getRecvDeviceAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getRecvDeviceAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getSendDeviceAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getSendDeviceAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSendDeviceIncarnationAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSendDeviceIncarnationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTensorNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTensorNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getTensorTypeAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getTensorTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf._Recv"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::StringAttr getTensorNameAttr(); + ::llvm::StringRef getTensorName(); + ::mlir::StringAttr getSendDeviceAttr(); + ::llvm::StringRef getSendDevice(); + ::mlir::IntegerAttr getSendDeviceIncarnationAttr(); + uint64_t getSendDeviceIncarnation(); + ::mlir::StringAttr getRecvDeviceAttr(); + ::llvm::StringRef getRecvDevice(); + ::mlir::BoolAttr getClientTerminatedAttr(); + bool getClientTerminated(); + ::mlir::Type getTensorType(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setTensorNameAttr(::mlir::StringAttr attr); + void setTensorName(::llvm::StringRef attrValue); + void setSendDeviceAttr(::mlir::StringAttr attr); + void setSendDevice(::llvm::StringRef attrValue); + void setSendDeviceIncarnationAttr(::mlir::IntegerAttr attr); + void setSendDeviceIncarnation(uint64_t attrValue); + void setRecvDeviceAttr(::mlir::StringAttr attr); + void setRecvDevice(::llvm::StringRef attrValue); + void setClientTerminatedAttr(::mlir::BoolAttr attr); + void setClientTerminated(::std::optional attrValue); + ::mlir::Attribute removeClientTerminatedAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type tensor, ::mlir::StringAttr tensor_name, ::mlir::StringAttr send_device, ::mlir::IntegerAttr send_device_incarnation, ::mlir::StringAttr recv_device, /*optional*/::mlir::BoolAttr client_terminated); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr tensor_name, ::mlir::StringAttr send_device, ::mlir::IntegerAttr send_device_incarnation, ::mlir::StringAttr recv_device, /*optional*/::mlir::BoolAttr client_terminated); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type tensor, ::llvm::StringRef tensor_name, ::llvm::StringRef send_device, uint64_t send_device_incarnation, ::llvm::StringRef recv_device, /*optional*/bool client_terminated = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef tensor_name, ::llvm::StringRef send_device, uint64_t send_device_incarnation, ::llvm::StringRef recv_device, /*optional*/bool client_terminated = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + std::optional GetResourceInstanceStr(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::_RecvOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::_SendOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class _SendOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + _SendOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + _SendOpGenericAdaptorBase(_SendOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getTensorNameAttr(); + ::llvm::StringRef getTensorName(); + ::mlir::StringAttr getSendDeviceAttr(); + ::llvm::StringRef getSendDevice(); + ::mlir::IntegerAttr getSendDeviceIncarnationAttr(); + uint64_t getSendDeviceIncarnation(); + ::mlir::StringAttr getRecvDeviceAttr(); + ::llvm::StringRef getRecvDevice(); + ::mlir::BoolAttr getClientTerminatedAttr(); + bool getClientTerminated(); +}; +} // namespace detail +template +class _SendOpGenericAdaptor : public detail::_SendOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::_SendOpGenericAdaptorBase; +public: + _SendOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + _SendOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : _SendOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + _SendOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTensor() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class _SendOpAdaptor : public _SendOpGenericAdaptor<::mlir::ValueRange> { +public: + using _SendOpGenericAdaptor::_SendOpGenericAdaptor; + _SendOpAdaptor(_SendOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class _SendOp : public ::mlir::Op<_SendOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::ZeroResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, GetResourceInstanceInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = _SendOpAdaptor; + template + using GenericAdaptor = _SendOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("client_terminated"), ::llvm::StringRef("recv_device"), ::llvm::StringRef("send_device"), ::llvm::StringRef("send_device_incarnation"), ::llvm::StringRef("tensor_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getClientTerminatedAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getClientTerminatedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getRecvDeviceAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getRecvDeviceAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSendDeviceAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSendDeviceAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getSendDeviceIncarnationAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getSendDeviceIncarnationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getTensorNameAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getTensorNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf._Send"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::OpOperand &getTensorMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::StringAttr getTensorNameAttr(); + ::llvm::StringRef getTensorName(); + ::mlir::StringAttr getSendDeviceAttr(); + ::llvm::StringRef getSendDevice(); + ::mlir::IntegerAttr getSendDeviceIncarnationAttr(); + uint64_t getSendDeviceIncarnation(); + ::mlir::StringAttr getRecvDeviceAttr(); + ::llvm::StringRef getRecvDevice(); + ::mlir::BoolAttr getClientTerminatedAttr(); + bool getClientTerminated(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setTensorNameAttr(::mlir::StringAttr attr); + void setTensorName(::llvm::StringRef attrValue); + void setSendDeviceAttr(::mlir::StringAttr attr); + void setSendDevice(::llvm::StringRef attrValue); + void setSendDeviceIncarnationAttr(::mlir::IntegerAttr attr); + void setSendDeviceIncarnation(uint64_t attrValue); + void setRecvDeviceAttr(::mlir::StringAttr attr); + void setRecvDevice(::llvm::StringRef attrValue); + void setClientTerminatedAttr(::mlir::BoolAttr attr); + void setClientTerminated(::std::optional attrValue); + ::mlir::Attribute removeClientTerminatedAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value tensor, ::mlir::StringAttr tensor_name, ::mlir::StringAttr send_device, ::mlir::IntegerAttr send_device_incarnation, ::mlir::StringAttr recv_device, /*optional*/::mlir::BoolAttr client_terminated); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tensor, ::mlir::StringAttr tensor_name, ::mlir::StringAttr send_device, ::mlir::IntegerAttr send_device_incarnation, ::mlir::StringAttr recv_device, /*optional*/::mlir::BoolAttr client_terminated); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value tensor, ::llvm::StringRef tensor_name, ::llvm::StringRef send_device, uint64_t send_device_incarnation, ::llvm::StringRef recv_device, /*optional*/bool client_terminated = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tensor, ::llvm::StringRef tensor_name, ::llvm::StringRef send_device, uint64_t send_device_incarnation, ::llvm::StringRef recv_device, /*optional*/bool client_terminated = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + std::optional GetResourceInstanceStr(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::_SendOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::_TPUCompileMlirOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class _TPUCompileMlirOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + _TPUCompileMlirOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + _TPUCompileMlirOpGenericAdaptorBase(_TPUCompileMlirOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getMlirModuleAttr(); + ::llvm::StringRef getMlirModule(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); +}; +} // namespace detail +template +class _TPUCompileMlirOpGenericAdaptor : public detail::_TPUCompileMlirOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::_TPUCompileMlirOpGenericAdaptorBase; +public: + _TPUCompileMlirOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + _TPUCompileMlirOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : _TPUCompileMlirOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + _TPUCompileMlirOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getDynamicShapes() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class _TPUCompileMlirOpAdaptor : public _TPUCompileMlirOpGenericAdaptor<::mlir::ValueRange> { +public: + using _TPUCompileMlirOpGenericAdaptor::_TPUCompileMlirOpGenericAdaptor; + _TPUCompileMlirOpAdaptor(_TPUCompileMlirOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class _TPUCompileMlirOp : public ::mlir::Op<_TPUCompileMlirOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::AtLeastNResults<1>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = _TPUCompileMlirOpAdaptor; + template + using GenericAdaptor = _TPUCompileMlirOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("NumDynamicShapes"), ::llvm::StringRef("metadata"), ::llvm::StringRef("mlir_module"), ::llvm::StringRef("num_computations")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNumDynamicShapesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNumDynamicShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getMetadataAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getMetadataAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getMlirModuleAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getMlirModuleAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getNumComputationsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getNumComputationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf._TPUCompileMlir"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getDynamicShapes(); + ::mlir::MutableOperandRange getDynamicShapesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getCompilationStatus(); + ::mlir::Operation::result_range getProgram(); + ::mlir::StringAttr getMlirModuleAttr(); + ::llvm::StringRef getMlirModule(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); + size_t getNumDynamicShapes(); + size_t getNumComputations(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setMlirModuleAttr(::mlir::StringAttr attr); + void setMlirModule(::std::optional<::llvm::StringRef> attrValue); + void setMetadataAttr(::mlir::StringAttr attr); + void setMetadata(::llvm::StringRef attrValue); + ::mlir::Attribute removeMlirModuleAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type compilation_status, ::mlir::TypeRange program, ::mlir::ValueRange dynamic_shapes, /*optional*/::mlir::StringAttr mlir_module, ::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange dynamic_shapes, /*optional*/::mlir::StringAttr mlir_module, ::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type compilation_status, ::mlir::TypeRange program, ::mlir::ValueRange dynamic_shapes, /*optional*/::llvm::StringRef mlir_module, ::llvm::StringRef metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange dynamic_shapes, /*optional*/::llvm::StringRef mlir_module, ::llvm::StringRef metadata); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::_TPUCompileMlirOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::_TPUDeviceOrdinalPlaceholderOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class _TPUDeviceOrdinalPlaceholderOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + _TPUDeviceOrdinalPlaceholderOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + _TPUDeviceOrdinalPlaceholderOpGenericAdaptorBase(_TPUDeviceOrdinalPlaceholderOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getLogicalCoreAttr(); + uint64_t getLogicalCore(); +}; +} // namespace detail +template +class _TPUDeviceOrdinalPlaceholderOpGenericAdaptor : public detail::_TPUDeviceOrdinalPlaceholderOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::_TPUDeviceOrdinalPlaceholderOpGenericAdaptorBase; +public: + _TPUDeviceOrdinalPlaceholderOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + _TPUDeviceOrdinalPlaceholderOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : _TPUDeviceOrdinalPlaceholderOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + _TPUDeviceOrdinalPlaceholderOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class _TPUDeviceOrdinalPlaceholderOpAdaptor : public _TPUDeviceOrdinalPlaceholderOpGenericAdaptor<::mlir::ValueRange> { +public: + using _TPUDeviceOrdinalPlaceholderOpGenericAdaptor::_TPUDeviceOrdinalPlaceholderOpGenericAdaptor; + _TPUDeviceOrdinalPlaceholderOpAdaptor(_TPUDeviceOrdinalPlaceholderOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class _TPUDeviceOrdinalPlaceholderOp : public ::mlir::Op<_TPUDeviceOrdinalPlaceholderOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = _TPUDeviceOrdinalPlaceholderOpAdaptor; + template + using GenericAdaptor = _TPUDeviceOrdinalPlaceholderOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("logical_core")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getLogicalCoreAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getLogicalCoreAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf._TPUDeviceOrdinalPlaceholder"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getDeviceOrdinal(); + ::mlir::IntegerAttr getLogicalCoreAttr(); + uint64_t getLogicalCore(); + void setLogicalCoreAttr(::mlir::IntegerAttr attr); + void setLogicalCore(uint64_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type device_ordinal, ::mlir::IntegerAttr logical_core); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr logical_core); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type device_ordinal, uint64_t logical_core); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, uint64_t logical_core); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::_TPUDeviceOrdinalPlaceholderOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::_UnaryOpsCompositionOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class _UnaryOpsCompositionOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + _UnaryOpsCompositionOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + _UnaryOpsCompositionOpGenericAdaptorBase(_UnaryOpsCompositionOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getOpNamesAttr(); + ::mlir::ArrayAttr getOpNames(); +}; +} // namespace detail +template +class _UnaryOpsCompositionOpGenericAdaptor : public detail::_UnaryOpsCompositionOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::_UnaryOpsCompositionOpGenericAdaptorBase; +public: + _UnaryOpsCompositionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + _UnaryOpsCompositionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : _UnaryOpsCompositionOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + _UnaryOpsCompositionOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class _UnaryOpsCompositionOpAdaptor : public _UnaryOpsCompositionOpGenericAdaptor<::mlir::ValueRange> { +public: + using _UnaryOpsCompositionOpGenericAdaptor::_UnaryOpsCompositionOpGenericAdaptor; + _UnaryOpsCompositionOpAdaptor(_UnaryOpsCompositionOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class _UnaryOpsCompositionOp : public ::mlir::Op<_UnaryOpsCompositionOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = _UnaryOpsCompositionOpAdaptor; + template + using GenericAdaptor = _UnaryOpsCompositionOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("op_names")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOpNamesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOpNamesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf._UnaryOpsComposition"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::ArrayAttr getOpNamesAttr(); + ::mlir::ArrayAttr getOpNames(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setOpNamesAttr(::mlir::ArrayAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x, ::mlir::ArrayAttr op_names); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x, ::mlir::ArrayAttr op_names); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::ArrayAttr op_names); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::_UnaryOpsCompositionOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::_XlaCompileMlirPlaceholderProgramKeyOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class _XlaCompileMlirPlaceholderProgramKeyOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + _XlaCompileMlirPlaceholderProgramKeyOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + _XlaCompileMlirPlaceholderProgramKeyOpGenericAdaptorBase(_XlaCompileMlirPlaceholderProgramKeyOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class _XlaCompileMlirPlaceholderProgramKeyOpGenericAdaptor : public detail::_XlaCompileMlirPlaceholderProgramKeyOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::_XlaCompileMlirPlaceholderProgramKeyOpGenericAdaptorBase; +public: + _XlaCompileMlirPlaceholderProgramKeyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + _XlaCompileMlirPlaceholderProgramKeyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : _XlaCompileMlirPlaceholderProgramKeyOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + _XlaCompileMlirPlaceholderProgramKeyOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class _XlaCompileMlirPlaceholderProgramKeyOpAdaptor : public _XlaCompileMlirPlaceholderProgramKeyOpGenericAdaptor<::mlir::ValueRange> { +public: + using _XlaCompileMlirPlaceholderProgramKeyOpGenericAdaptor::_XlaCompileMlirPlaceholderProgramKeyOpGenericAdaptor; + _XlaCompileMlirPlaceholderProgramKeyOpAdaptor(_XlaCompileMlirPlaceholderProgramKeyOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class _XlaCompileMlirPlaceholderProgramKeyOp : public ::mlir::Op<_XlaCompileMlirPlaceholderProgramKeyOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = _XlaCompileMlirPlaceholderProgramKeyOpAdaptor; + template + using GenericAdaptor = _XlaCompileMlirPlaceholderProgramKeyOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf._XlaCompileMlirPlaceholderProgramKey"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getProgram(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type program); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::_XlaCompileMlirPlaceholderProgramKeyOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::_XlaCompileOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class _XlaCompileOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + _XlaCompileOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + _XlaCompileOpGenericAdaptorBase(_XlaCompileOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getMustCompileAttr(); + bool getMustCompile(); + ::mlir::SymbolRefAttr getFunctionAttr(); + ::mlir::SymbolRefAttr getFunction(); +}; +} // namespace detail +template +class _XlaCompileOpGenericAdaptor : public detail::_XlaCompileOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::_XlaCompileOpGenericAdaptorBase; +public: + _XlaCompileOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + _XlaCompileOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : _XlaCompileOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + _XlaCompileOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getConstants() { + return getODSOperands(0); + } + + RangeT getArgs() { + return getODSOperands(1); + } + + RangeT getResources() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class _XlaCompileOpAdaptor : public _XlaCompileOpGenericAdaptor<::mlir::ValueRange> { +public: + using _XlaCompileOpGenericAdaptor::_XlaCompileOpGenericAdaptor; + _XlaCompileOpAdaptor(_XlaCompileOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class _XlaCompileOp : public ::mlir::Op<_XlaCompileOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::NResults<2>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = _XlaCompileOpAdaptor; + template + using GenericAdaptor = _XlaCompileOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Nresources"), ::llvm::StringRef("Targs"), ::llvm::StringRef("Tconstants"), ::llvm::StringRef("function"), ::llvm::StringRef("must_compile"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNresourcesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNresourcesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTargsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTargsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTconstantsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTconstantsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getFunctionAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getFunctionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getMustCompileAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getMustCompileAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf._XlaCompile"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getConstants(); + ::mlir::Operation::operand_range getArgs(); + ::mlir::Operation::operand_range getResources(); + ::mlir::MutableOperandRange getConstantsMutable(); + ::mlir::MutableOperandRange getArgsMutable(); + ::mlir::MutableOperandRange getResourcesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getKey(); + ::mlir::TypedValue<::mlir::TensorType> getCompilationSuccessful(); + ::mlir::BoolAttr getMustCompileAttr(); + bool getMustCompile(); + ::mlir::SymbolRefAttr getFunctionAttr(); + ::mlir::SymbolRefAttr getFunction(); + size_t getNresources(); + mlir::OperandElementTypeRange getTargs(); + mlir::OperandElementTypeRange getTconstants(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setMustCompileAttr(::mlir::BoolAttr attr); + void setMustCompile(bool attrValue); + void setFunctionAttr(::mlir::SymbolRefAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type key, ::mlir::Type compilation_successful, ::mlir::ValueRange constants, ::mlir::ValueRange args, ::mlir::ValueRange resources, ::mlir::BoolAttr must_compile, ::mlir::SymbolRefAttr function); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange constants, ::mlir::ValueRange args, ::mlir::ValueRange resources, ::mlir::BoolAttr must_compile, ::mlir::SymbolRefAttr function); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type key, ::mlir::Type compilation_successful, ::mlir::ValueRange constants, ::mlir::ValueRange args, ::mlir::ValueRange resources, bool must_compile, ::mlir::SymbolRefAttr function); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange constants, ::mlir::ValueRange args, ::mlir::ValueRange resources, bool must_compile, ::mlir::SymbolRefAttr function); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::_XlaCompileOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::_XlaHostComputeMlirOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class _XlaHostComputeMlirOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + _XlaHostComputeMlirOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + _XlaHostComputeMlirOpGenericAdaptorBase(_XlaHostComputeMlirOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getSendKeyAttr(); + ::llvm::StringRef getSendKey(); + ::mlir::StringAttr getRecvKeyAttr(); + ::llvm::StringRef getRecvKey(); + ::mlir::StringAttr getHostMlirModuleAttr(); + ::llvm::StringRef getHostMlirModule(); + ::mlir::BoolAttr getManualShardingAttr(); + bool getManualSharding(); +}; +} // namespace detail +template +class _XlaHostComputeMlirOpGenericAdaptor : public detail::_XlaHostComputeMlirOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::_XlaHostComputeMlirOpGenericAdaptorBase; +public: + _XlaHostComputeMlirOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + _XlaHostComputeMlirOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : _XlaHostComputeMlirOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + _XlaHostComputeMlirOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class _XlaHostComputeMlirOpAdaptor : public _XlaHostComputeMlirOpGenericAdaptor<::mlir::ValueRange> { +public: + using _XlaHostComputeMlirOpGenericAdaptor::_XlaHostComputeMlirOpGenericAdaptor; + _XlaHostComputeMlirOpAdaptor(_XlaHostComputeMlirOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class _XlaHostComputeMlirOp : public ::mlir::Op<_XlaHostComputeMlirOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::VariadicResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = _XlaHostComputeMlirOpAdaptor; + template + using GenericAdaptor = _XlaHostComputeMlirOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tinputs"), ::llvm::StringRef("Toutputs"), ::llvm::StringRef("host_mlir_module"), ::llvm::StringRef("manual_sharding"), ::llvm::StringRef("recv_key"), ::llvm::StringRef("send_key")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTinputsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTinputsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getToutputsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getToutputsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getHostMlirModuleAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getHostMlirModuleAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getManualShardingAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getManualShardingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getRecvKeyAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getRecvKeyAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getSendKeyAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getSendKeyAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf._XlaHostComputeMlir"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::MutableOperandRange getInputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutputs(); + ::mlir::StringAttr getSendKeyAttr(); + ::llvm::StringRef getSendKey(); + ::mlir::StringAttr getRecvKeyAttr(); + ::llvm::StringRef getRecvKey(); + ::mlir::StringAttr getHostMlirModuleAttr(); + ::llvm::StringRef getHostMlirModule(); + ::mlir::BoolAttr getManualShardingAttr(); + bool getManualSharding(); + mlir::OperandElementTypeRange getTinputs(); + mlir::ResultElementTypeRange getToutputs(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setSendKeyAttr(::mlir::StringAttr attr); + void setSendKey(::llvm::StringRef attrValue); + void setRecvKeyAttr(::mlir::StringAttr attr); + void setRecvKey(::llvm::StringRef attrValue); + void setHostMlirModuleAttr(::mlir::StringAttr attr); + void setHostMlirModule(::std::optional<::llvm::StringRef> attrValue); + void setManualShardingAttr(::mlir::BoolAttr attr); + void setManualSharding(::std::optional attrValue); + ::mlir::Attribute removeHostMlirModuleAttr(); + ::mlir::Attribute removeManualShardingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outputs, ::mlir::ValueRange inputs, ::mlir::StringAttr send_key, ::mlir::StringAttr recv_key, /*optional*/::mlir::StringAttr host_mlir_module, /*optional*/::mlir::BoolAttr manual_sharding); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outputs, ::mlir::ValueRange inputs, ::llvm::StringRef send_key, ::llvm::StringRef recv_key, /*optional*/::llvm::StringRef host_mlir_module = "", /*optional*/bool manual_sharding = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + func::FuncOp GetHostFunc(mlir::OwningOpRef* mlir_module); +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::_XlaHostComputeMlirOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::_XlaRecvAtHostOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class _XlaRecvAtHostOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + _XlaRecvAtHostOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + _XlaRecvAtHostOpGenericAdaptorBase(_XlaRecvAtHostOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getKeyAttr(); + ::llvm::StringRef getKey(); + ::mlir::IntegerAttr getDeviceOrdinalAttr(); + uint64_t getDeviceOrdinal(); + ::mlir::StringAttr getDeviceTypeAttr(); + ::llvm::StringRef getDeviceType(); +}; +} // namespace detail +template +class _XlaRecvAtHostOpGenericAdaptor : public detail::_XlaRecvAtHostOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::_XlaRecvAtHostOpGenericAdaptorBase; +public: + _XlaRecvAtHostOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + _XlaRecvAtHostOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : _XlaRecvAtHostOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + _XlaRecvAtHostOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getDynamicKey() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class _XlaRecvAtHostOpAdaptor : public _XlaRecvAtHostOpGenericAdaptor<::mlir::ValueRange> { +public: + using _XlaRecvAtHostOpGenericAdaptor::_XlaRecvAtHostOpGenericAdaptor; + _XlaRecvAtHostOpAdaptor(_XlaRecvAtHostOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class _XlaRecvAtHostOp : public ::mlir::Op<_XlaRecvAtHostOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::VariadicResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, GetResourceInstanceInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = _XlaRecvAtHostOpAdaptor; + template + using GenericAdaptor = _XlaRecvAtHostOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Toutputs"), ::llvm::StringRef("device_ordinal"), ::llvm::StringRef("device_type"), ::llvm::StringRef("key")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getToutputsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getToutputsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDeviceOrdinalAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDeviceOrdinalAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDeviceTypeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDeviceTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getKeyAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getKeyAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf._XlaRecvAtHost"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getDynamicKey(); + ::mlir::OpOperand &getDynamicKeyMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutputs(); + ::mlir::StringAttr getKeyAttr(); + ::llvm::StringRef getKey(); + ::mlir::IntegerAttr getDeviceOrdinalAttr(); + uint64_t getDeviceOrdinal(); + ::mlir::StringAttr getDeviceTypeAttr(); + ::llvm::StringRef getDeviceType(); + mlir::ResultElementTypeRange getToutputs(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setKeyAttr(::mlir::StringAttr attr); + void setKey(::llvm::StringRef attrValue); + void setDeviceOrdinalAttr(::mlir::IntegerAttr attr); + void setDeviceOrdinal(uint64_t attrValue); + void setDeviceTypeAttr(::mlir::StringAttr attr); + void setDeviceType(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeDeviceTypeAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outputs, ::mlir::Value dynamic_key, ::mlir::StringAttr key, ::mlir::IntegerAttr device_ordinal, /*optional*/::mlir::StringAttr device_type); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outputs, ::mlir::Value dynamic_key, ::llvm::StringRef key, uint64_t device_ordinal, /*optional*/::llvm::StringRef device_type = "TPU"); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + std::optional GetResourceInstanceStr(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::_XlaRecvAtHostOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::_XlaRecvAtHostV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class _XlaRecvAtHostV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + _XlaRecvAtHostV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + _XlaRecvAtHostV2OpGenericAdaptorBase(_XlaRecvAtHostV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getKeyAttr(); + ::llvm::StringRef getKey(); + ::mlir::StringAttr getDeviceTypeAttr(); + ::llvm::StringRef getDeviceType(); +}; +} // namespace detail +template +class _XlaRecvAtHostV2OpGenericAdaptor : public detail::_XlaRecvAtHostV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::_XlaRecvAtHostV2OpGenericAdaptorBase; +public: + _XlaRecvAtHostV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + _XlaRecvAtHostV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : _XlaRecvAtHostV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + _XlaRecvAtHostV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getDynamicKey() { + return (*getODSOperands(0).begin()); + } + + ValueT getDeviceOrdinal() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class _XlaRecvAtHostV2OpAdaptor : public _XlaRecvAtHostV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using _XlaRecvAtHostV2OpGenericAdaptor::_XlaRecvAtHostV2OpGenericAdaptor; + _XlaRecvAtHostV2OpAdaptor(_XlaRecvAtHostV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class _XlaRecvAtHostV2Op : public ::mlir::Op<_XlaRecvAtHostV2Op, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::VariadicResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, GetResourceInstanceInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = _XlaRecvAtHostV2OpAdaptor; + template + using GenericAdaptor = _XlaRecvAtHostV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Toutputs"), ::llvm::StringRef("device_type"), ::llvm::StringRef("key")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getToutputsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getToutputsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDeviceTypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDeviceTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getKeyAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getKeyAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf._XlaRecvAtHostV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getDynamicKey(); + ::mlir::TypedValue<::mlir::TensorType> getDeviceOrdinal(); + ::mlir::OpOperand &getDynamicKeyMutable(); + ::mlir::OpOperand &getDeviceOrdinalMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutputs(); + ::mlir::StringAttr getKeyAttr(); + ::llvm::StringRef getKey(); + ::mlir::StringAttr getDeviceTypeAttr(); + ::llvm::StringRef getDeviceType(); + mlir::ResultElementTypeRange getToutputs(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setKeyAttr(::mlir::StringAttr attr); + void setKey(::llvm::StringRef attrValue); + void setDeviceTypeAttr(::mlir::StringAttr attr); + void setDeviceType(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeDeviceTypeAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outputs, ::mlir::Value dynamic_key, ::mlir::Value device_ordinal, ::mlir::StringAttr key, /*optional*/::mlir::StringAttr device_type); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outputs, ::mlir::Value dynamic_key, ::mlir::Value device_ordinal, ::llvm::StringRef key, /*optional*/::llvm::StringRef device_type = "TPU"); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + std::optional GetResourceInstanceStr(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::_XlaRecvAtHostV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::_XlaRunOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class _XlaRunOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + _XlaRunOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + _XlaRunOpGenericAdaptorBase(_XlaRunOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class _XlaRunOpGenericAdaptor : public detail::_XlaRunOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::_XlaRunOpGenericAdaptorBase; +public: + _XlaRunOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + _XlaRunOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : _XlaRunOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + _XlaRunOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + ValueT getKey() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class _XlaRunOpAdaptor : public _XlaRunOpGenericAdaptor<::mlir::ValueRange> { +public: + using _XlaRunOpGenericAdaptor::_XlaRunOpGenericAdaptor; + _XlaRunOpAdaptor(_XlaRunOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class _XlaRunOp : public ::mlir::Op<_XlaRunOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::VariadicResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = _XlaRunOpAdaptor; + template + using GenericAdaptor = _XlaRunOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Targs"), ::llvm::StringRef("Tresults")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTargsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTargsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTresultsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTresultsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf._XlaRun"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::TypedValue<::mlir::TensorType> getKey(); + ::mlir::MutableOperandRange getArgsMutable(); + ::mlir::OpOperand &getKeyMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResults(); + mlir::OperandElementTypeRange getTargs(); + mlir::ResultElementTypeRange getTresults(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange results, ::mlir::ValueRange args, ::mlir::Value key); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::_XlaRunOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::_XlaSendFromHostOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class _XlaSendFromHostOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + _XlaSendFromHostOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + _XlaSendFromHostOpGenericAdaptorBase(_XlaSendFromHostOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getKeyAttr(); + ::llvm::StringRef getKey(); + ::mlir::IntegerAttr getDeviceOrdinalAttr(); + uint64_t getDeviceOrdinal(); + ::mlir::StringAttr getDeviceTypeAttr(); + ::llvm::StringRef getDeviceType(); +}; +} // namespace detail +template +class _XlaSendFromHostOpGenericAdaptor : public detail::_XlaSendFromHostOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::_XlaSendFromHostOpGenericAdaptorBase; +public: + _XlaSendFromHostOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + _XlaSendFromHostOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : _XlaSendFromHostOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + _XlaSendFromHostOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + ValueT getDynamicKey() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class _XlaSendFromHostOpAdaptor : public _XlaSendFromHostOpGenericAdaptor<::mlir::ValueRange> { +public: + using _XlaSendFromHostOpGenericAdaptor::_XlaSendFromHostOpGenericAdaptor; + _XlaSendFromHostOpAdaptor(_XlaSendFromHostOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class _XlaSendFromHostOp : public ::mlir::Op<_XlaSendFromHostOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::ZeroResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::OpInvariants, GetResourceInstanceInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = _XlaSendFromHostOpAdaptor; + template + using GenericAdaptor = _XlaSendFromHostOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tinputs"), ::llvm::StringRef("device_ordinal"), ::llvm::StringRef("device_type"), ::llvm::StringRef("key")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTinputsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTinputsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDeviceOrdinalAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDeviceOrdinalAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDeviceTypeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDeviceTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getKeyAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getKeyAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf._XlaSendFromHost"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::TypedValue<::mlir::TensorType> getDynamicKey(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::OpOperand &getDynamicKeyMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::StringAttr getKeyAttr(); + ::llvm::StringRef getKey(); + ::mlir::IntegerAttr getDeviceOrdinalAttr(); + uint64_t getDeviceOrdinal(); + ::mlir::StringAttr getDeviceTypeAttr(); + ::llvm::StringRef getDeviceType(); + mlir::OperandElementTypeRange getTinputs(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setKeyAttr(::mlir::StringAttr attr); + void setKey(::llvm::StringRef attrValue); + void setDeviceOrdinalAttr(::mlir::IntegerAttr attr); + void setDeviceOrdinal(uint64_t attrValue); + void setDeviceTypeAttr(::mlir::StringAttr attr); + void setDeviceType(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeDeviceTypeAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange inputs, ::mlir::Value dynamic_key, ::mlir::StringAttr key, ::mlir::IntegerAttr device_ordinal, /*optional*/::mlir::StringAttr device_type); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::mlir::Value dynamic_key, ::mlir::StringAttr key, ::mlir::IntegerAttr device_ordinal, /*optional*/::mlir::StringAttr device_type); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange inputs, ::mlir::Value dynamic_key, ::llvm::StringRef key, uint64_t device_ordinal, /*optional*/::llvm::StringRef device_type = "TPU"); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::mlir::Value dynamic_key, ::llvm::StringRef key, uint64_t device_ordinal, /*optional*/::llvm::StringRef device_type = "TPU"); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + std::optional GetResourceInstanceStr(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::_XlaSendFromHostOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::_XlaSendFromHostV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class _XlaSendFromHostV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + _XlaSendFromHostV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + _XlaSendFromHostV2OpGenericAdaptorBase(_XlaSendFromHostV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getKeyAttr(); + ::llvm::StringRef getKey(); + ::mlir::StringAttr getDeviceTypeAttr(); + ::llvm::StringRef getDeviceType(); +}; +} // namespace detail +template +class _XlaSendFromHostV2OpGenericAdaptor : public detail::_XlaSendFromHostV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::_XlaSendFromHostV2OpGenericAdaptorBase; +public: + _XlaSendFromHostV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + _XlaSendFromHostV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : _XlaSendFromHostV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + _XlaSendFromHostV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + ValueT getDynamicKey() { + return (*getODSOperands(1).begin()); + } + + ValueT getDeviceOrdinal() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class _XlaSendFromHostV2OpAdaptor : public _XlaSendFromHostV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using _XlaSendFromHostV2OpGenericAdaptor::_XlaSendFromHostV2OpGenericAdaptor; + _XlaSendFromHostV2OpAdaptor(_XlaSendFromHostV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class _XlaSendFromHostV2Op : public ::mlir::Op<_XlaSendFromHostV2Op, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::ZeroResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, GetResourceInstanceInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = _XlaSendFromHostV2OpAdaptor; + template + using GenericAdaptor = _XlaSendFromHostV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tinputs"), ::llvm::StringRef("device_type"), ::llvm::StringRef("key")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTinputsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTinputsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDeviceTypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDeviceTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getKeyAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getKeyAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf._XlaSendFromHostV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::TypedValue<::mlir::TensorType> getDynamicKey(); + ::mlir::TypedValue<::mlir::TensorType> getDeviceOrdinal(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::OpOperand &getDynamicKeyMutable(); + ::mlir::OpOperand &getDeviceOrdinalMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::StringAttr getKeyAttr(); + ::llvm::StringRef getKey(); + ::mlir::StringAttr getDeviceTypeAttr(); + ::llvm::StringRef getDeviceType(); + mlir::OperandElementTypeRange getTinputs(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setKeyAttr(::mlir::StringAttr attr); + void setKey(::llvm::StringRef attrValue); + void setDeviceTypeAttr(::mlir::StringAttr attr); + void setDeviceType(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeDeviceTypeAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange inputs, ::mlir::Value dynamic_key, ::mlir::Value device_ordinal, ::mlir::StringAttr key, /*optional*/::mlir::StringAttr device_type); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::mlir::Value dynamic_key, ::mlir::Value device_ordinal, ::mlir::StringAttr key, /*optional*/::mlir::StringAttr device_type); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange inputs, ::mlir::Value dynamic_key, ::mlir::Value device_ordinal, ::llvm::StringRef key, /*optional*/::llvm::StringRef device_type = "TPU"); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::mlir::Value dynamic_key, ::mlir::Value device_ordinal, ::llvm::StringRef key, /*optional*/::llvm::StringRef device_type = "TPU"); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + std::optional GetResourceInstanceStr(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::_XlaSendFromHostV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaSparseDenseMatmulGradWithAdagradAndCsrInputOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaSparseDenseMatmulGradWithAdagradAndCsrInputOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaSparseDenseMatmulGradWithAdagradAndCsrInputOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaSparseDenseMatmulGradWithAdagradAndCsrInputOpGenericAdaptorBase(XlaSparseDenseMatmulGradWithAdagradAndCsrInputOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); +}; +} // namespace detail +template +class XlaSparseDenseMatmulGradWithAdagradAndCsrInputOpGenericAdaptor : public detail::XlaSparseDenseMatmulGradWithAdagradAndCsrInputOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaSparseDenseMatmulGradWithAdagradAndCsrInputOpGenericAdaptorBase; +public: + XlaSparseDenseMatmulGradWithAdagradAndCsrInputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaSparseDenseMatmulGradWithAdagradAndCsrInputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaSparseDenseMatmulGradWithAdagradAndCsrInputOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaSparseDenseMatmulGradWithAdagradAndCsrInputOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getRowPointers() { + return (*getODSOperands(0).begin()); + } + + ValueT getSortedSampleIds() { + return (*getODSOperands(1).begin()); + } + + ValueT getSortedTokenIds() { + return (*getODSOperands(2).begin()); + } + + ValueT getSortedGains() { + return (*getODSOperands(3).begin()); + } + + ValueT getActivationGradients() { + return (*getODSOperands(4).begin()); + } + + ValueT getLearningRate() { + return (*getODSOperands(5).begin()); + } + + ValueT getEmbeddingTable() { + return (*getODSOperands(6).begin()); + } + + ValueT getAccumulator() { + return (*getODSOperands(7).begin()); + } + + ValueT getNumMinibatchesPerPhysicalSparseCore() { + return (*getODSOperands(8).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaSparseDenseMatmulGradWithAdagradAndCsrInputOpAdaptor : public XlaSparseDenseMatmulGradWithAdagradAndCsrInputOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaSparseDenseMatmulGradWithAdagradAndCsrInputOpGenericAdaptor::XlaSparseDenseMatmulGradWithAdagradAndCsrInputOpGenericAdaptor; + XlaSparseDenseMatmulGradWithAdagradAndCsrInputOpAdaptor(XlaSparseDenseMatmulGradWithAdagradAndCsrInputOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaSparseDenseMatmulGradWithAdagradAndCsrInputOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<9>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaSparseDenseMatmulGradWithAdagradAndCsrInputOpAdaptor; + template + using GenericAdaptor = XlaSparseDenseMatmulGradWithAdagradAndCsrInputOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaSparseDenseMatmulGradWithAdagradAndCsrInput"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getRowPointers(); + ::mlir::TypedValue<::mlir::TensorType> getSortedSampleIds(); + ::mlir::TypedValue<::mlir::TensorType> getSortedTokenIds(); + ::mlir::TypedValue<::mlir::TensorType> getSortedGains(); + ::mlir::TypedValue<::mlir::TensorType> getActivationGradients(); + ::mlir::TypedValue<::mlir::TensorType> getLearningRate(); + ::mlir::TypedValue<::mlir::TensorType> getEmbeddingTable(); + ::mlir::TypedValue<::mlir::TensorType> getAccumulator(); + ::mlir::TypedValue<::mlir::TensorType> getNumMinibatchesPerPhysicalSparseCore(); + ::mlir::OpOperand &getRowPointersMutable(); + ::mlir::OpOperand &getSortedSampleIdsMutable(); + ::mlir::OpOperand &getSortedTokenIdsMutable(); + ::mlir::OpOperand &getSortedGainsMutable(); + ::mlir::OpOperand &getActivationGradientsMutable(); + ::mlir::OpOperand &getLearningRateMutable(); + ::mlir::OpOperand &getEmbeddingTableMutable(); + ::mlir::OpOperand &getAccumulatorMutable(); + ::mlir::OpOperand &getNumMinibatchesPerPhysicalSparseCoreMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getUpdatedEmbeddingTable(); + ::mlir::TypedValue<::mlir::TensorType> getUpdatedAccumulator(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type updated_embedding_table, ::mlir::Type updated_accumulator, ::mlir::Value row_pointers, ::mlir::Value sorted_sample_ids, ::mlir::Value sorted_token_ids, ::mlir::Value sorted_gains, ::mlir::Value activation_gradients, ::mlir::Value learning_rate, ::mlir::Value embedding_table, ::mlir::Value accumulator, ::mlir::Value num_minibatches_per_physical_sparse_core, ::mlir::StringAttr table_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value row_pointers, ::mlir::Value sorted_sample_ids, ::mlir::Value sorted_token_ids, ::mlir::Value sorted_gains, ::mlir::Value activation_gradients, ::mlir::Value learning_rate, ::mlir::Value embedding_table, ::mlir::Value accumulator, ::mlir::Value num_minibatches_per_physical_sparse_core, ::mlir::StringAttr table_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type updated_embedding_table, ::mlir::Type updated_accumulator, ::mlir::Value row_pointers, ::mlir::Value sorted_sample_ids, ::mlir::Value sorted_token_ids, ::mlir::Value sorted_gains, ::mlir::Value activation_gradients, ::mlir::Value learning_rate, ::mlir::Value embedding_table, ::mlir::Value accumulator, ::mlir::Value num_minibatches_per_physical_sparse_core, ::llvm::StringRef table_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value row_pointers, ::mlir::Value sorted_sample_ids, ::mlir::Value sorted_token_ids, ::mlir::Value sorted_gains, ::mlir::Value activation_gradients, ::mlir::Value learning_rate, ::mlir::Value embedding_table, ::mlir::Value accumulator, ::mlir::Value num_minibatches_per_physical_sparse_core, ::llvm::StringRef table_name); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaSparseDenseMatmulGradWithAdagradAndCsrInputOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaSparseDenseMatmulGradWithAdagradMomentumAndCsrInputOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaSparseDenseMatmulGradWithAdagradMomentumAndCsrInputOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaSparseDenseMatmulGradWithAdagradMomentumAndCsrInputOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaSparseDenseMatmulGradWithAdagradMomentumAndCsrInputOpGenericAdaptorBase(XlaSparseDenseMatmulGradWithAdagradMomentumAndCsrInputOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getUseNesterovAttr(); + bool getUseNesterov(); + ::mlir::FloatAttr getExponentAttr(); + ::llvm::APFloat getExponent(); + ::mlir::FloatAttr getBeta1Attr(); + ::llvm::APFloat getBeta1(); + ::mlir::FloatAttr getBeta2Attr(); + ::llvm::APFloat getBeta2(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); +}; +} // namespace detail +template +class XlaSparseDenseMatmulGradWithAdagradMomentumAndCsrInputOpGenericAdaptor : public detail::XlaSparseDenseMatmulGradWithAdagradMomentumAndCsrInputOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaSparseDenseMatmulGradWithAdagradMomentumAndCsrInputOpGenericAdaptorBase; +public: + XlaSparseDenseMatmulGradWithAdagradMomentumAndCsrInputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaSparseDenseMatmulGradWithAdagradMomentumAndCsrInputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaSparseDenseMatmulGradWithAdagradMomentumAndCsrInputOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaSparseDenseMatmulGradWithAdagradMomentumAndCsrInputOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getRowPointers() { + return (*getODSOperands(0).begin()); + } + + ValueT getSortedSampleIds() { + return (*getODSOperands(1).begin()); + } + + ValueT getSortedTokenIds() { + return (*getODSOperands(2).begin()); + } + + ValueT getSortedGains() { + return (*getODSOperands(3).begin()); + } + + ValueT getActivationGradients() { + return (*getODSOperands(4).begin()); + } + + ValueT getLearningRate() { + return (*getODSOperands(5).begin()); + } + + ValueT getEmbeddingTable() { + return (*getODSOperands(6).begin()); + } + + ValueT getAccumulator() { + return (*getODSOperands(7).begin()); + } + + ValueT getMomenta() { + return (*getODSOperands(8).begin()); + } + + ValueT getNumMinibatchesPerPhysicalSparseCore() { + return (*getODSOperands(9).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaSparseDenseMatmulGradWithAdagradMomentumAndCsrInputOpAdaptor : public XlaSparseDenseMatmulGradWithAdagradMomentumAndCsrInputOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaSparseDenseMatmulGradWithAdagradMomentumAndCsrInputOpGenericAdaptor::XlaSparseDenseMatmulGradWithAdagradMomentumAndCsrInputOpGenericAdaptor; + XlaSparseDenseMatmulGradWithAdagradMomentumAndCsrInputOpAdaptor(XlaSparseDenseMatmulGradWithAdagradMomentumAndCsrInputOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaSparseDenseMatmulGradWithAdagradMomentumAndCsrInputOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<10>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaSparseDenseMatmulGradWithAdagradMomentumAndCsrInputOpAdaptor; + template + using GenericAdaptor = XlaSparseDenseMatmulGradWithAdagradMomentumAndCsrInputOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("beta1"), ::llvm::StringRef("beta2"), ::llvm::StringRef("epsilon"), ::llvm::StringRef("exponent"), ::llvm::StringRef("table_name"), ::llvm::StringRef("use_nesterov")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBeta1AttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBeta1AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getBeta2AttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getBeta2AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getEpsilonAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getEpsilonAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getExponentAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getExponentAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getUseNesterovAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getUseNesterovAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaSparseDenseMatmulGradWithAdagradMomentumAndCsrInput"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getRowPointers(); + ::mlir::TypedValue<::mlir::TensorType> getSortedSampleIds(); + ::mlir::TypedValue<::mlir::TensorType> getSortedTokenIds(); + ::mlir::TypedValue<::mlir::TensorType> getSortedGains(); + ::mlir::TypedValue<::mlir::TensorType> getActivationGradients(); + ::mlir::TypedValue<::mlir::TensorType> getLearningRate(); + ::mlir::TypedValue<::mlir::TensorType> getEmbeddingTable(); + ::mlir::TypedValue<::mlir::TensorType> getAccumulator(); + ::mlir::TypedValue<::mlir::TensorType> getMomenta(); + ::mlir::TypedValue<::mlir::TensorType> getNumMinibatchesPerPhysicalSparseCore(); + ::mlir::OpOperand &getRowPointersMutable(); + ::mlir::OpOperand &getSortedSampleIdsMutable(); + ::mlir::OpOperand &getSortedTokenIdsMutable(); + ::mlir::OpOperand &getSortedGainsMutable(); + ::mlir::OpOperand &getActivationGradientsMutable(); + ::mlir::OpOperand &getLearningRateMutable(); + ::mlir::OpOperand &getEmbeddingTableMutable(); + ::mlir::OpOperand &getAccumulatorMutable(); + ::mlir::OpOperand &getMomentaMutable(); + ::mlir::OpOperand &getNumMinibatchesPerPhysicalSparseCoreMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getUpdatedEmbeddingTable(); + ::mlir::TypedValue<::mlir::TensorType> getUpdatedAccumulator(); + ::mlir::TypedValue<::mlir::TensorType> getUpdatedMomenta(); + ::mlir::BoolAttr getUseNesterovAttr(); + bool getUseNesterov(); + ::mlir::FloatAttr getExponentAttr(); + ::llvm::APFloat getExponent(); + ::mlir::FloatAttr getBeta1Attr(); + ::llvm::APFloat getBeta1(); + ::mlir::FloatAttr getBeta2Attr(); + ::llvm::APFloat getBeta2(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + void setUseNesterovAttr(::mlir::BoolAttr attr); + void setUseNesterov(bool attrValue); + void setExponentAttr(::mlir::FloatAttr attr); + void setExponent(::llvm::APFloat attrValue); + void setBeta1Attr(::mlir::FloatAttr attr); + void setBeta1(::llvm::APFloat attrValue); + void setBeta2Attr(::mlir::FloatAttr attr); + void setBeta2(::llvm::APFloat attrValue); + void setEpsilonAttr(::mlir::FloatAttr attr); + void setEpsilon(::llvm::APFloat attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type updated_embedding_table, ::mlir::Type updated_accumulator, ::mlir::Type updated_momenta, ::mlir::Value row_pointers, ::mlir::Value sorted_sample_ids, ::mlir::Value sorted_token_ids, ::mlir::Value sorted_gains, ::mlir::Value activation_gradients, ::mlir::Value learning_rate, ::mlir::Value embedding_table, ::mlir::Value accumulator, ::mlir::Value momenta, ::mlir::Value num_minibatches_per_physical_sparse_core, ::mlir::BoolAttr use_nesterov, ::mlir::FloatAttr exponent, ::mlir::FloatAttr beta1, ::mlir::FloatAttr beta2, ::mlir::FloatAttr epsilon, ::mlir::StringAttr table_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value row_pointers, ::mlir::Value sorted_sample_ids, ::mlir::Value sorted_token_ids, ::mlir::Value sorted_gains, ::mlir::Value activation_gradients, ::mlir::Value learning_rate, ::mlir::Value embedding_table, ::mlir::Value accumulator, ::mlir::Value momenta, ::mlir::Value num_minibatches_per_physical_sparse_core, ::mlir::BoolAttr use_nesterov, ::mlir::FloatAttr exponent, ::mlir::FloatAttr beta1, ::mlir::FloatAttr beta2, ::mlir::FloatAttr epsilon, ::mlir::StringAttr table_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type updated_embedding_table, ::mlir::Type updated_accumulator, ::mlir::Type updated_momenta, ::mlir::Value row_pointers, ::mlir::Value sorted_sample_ids, ::mlir::Value sorted_token_ids, ::mlir::Value sorted_gains, ::mlir::Value activation_gradients, ::mlir::Value learning_rate, ::mlir::Value embedding_table, ::mlir::Value accumulator, ::mlir::Value momenta, ::mlir::Value num_minibatches_per_physical_sparse_core, bool use_nesterov, ::llvm::APFloat exponent, ::llvm::APFloat beta1, ::llvm::APFloat beta2, ::llvm::APFloat epsilon, ::llvm::StringRef table_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value row_pointers, ::mlir::Value sorted_sample_ids, ::mlir::Value sorted_token_ids, ::mlir::Value sorted_gains, ::mlir::Value activation_gradients, ::mlir::Value learning_rate, ::mlir::Value embedding_table, ::mlir::Value accumulator, ::mlir::Value momenta, ::mlir::Value num_minibatches_per_physical_sparse_core, bool use_nesterov, ::llvm::APFloat exponent, ::llvm::APFloat beta1, ::llvm::APFloat beta2, ::llvm::APFloat epsilon, ::llvm::StringRef table_name); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaSparseDenseMatmulGradWithAdagradMomentumAndCsrInputOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaSparseDenseMatmulGradWithAdamAndCsrInputOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaSparseDenseMatmulGradWithAdamAndCsrInputOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaSparseDenseMatmulGradWithAdamAndCsrInputOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaSparseDenseMatmulGradWithAdamAndCsrInputOpGenericAdaptorBase(XlaSparseDenseMatmulGradWithAdamAndCsrInputOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getUseSumInsideSqrtAttr(); + bool getUseSumInsideSqrt(); + ::mlir::FloatAttr getBeta1Attr(); + ::llvm::APFloat getBeta1(); + ::mlir::FloatAttr getBeta2Attr(); + ::llvm::APFloat getBeta2(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); +}; +} // namespace detail +template +class XlaSparseDenseMatmulGradWithAdamAndCsrInputOpGenericAdaptor : public detail::XlaSparseDenseMatmulGradWithAdamAndCsrInputOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaSparseDenseMatmulGradWithAdamAndCsrInputOpGenericAdaptorBase; +public: + XlaSparseDenseMatmulGradWithAdamAndCsrInputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaSparseDenseMatmulGradWithAdamAndCsrInputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaSparseDenseMatmulGradWithAdamAndCsrInputOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaSparseDenseMatmulGradWithAdamAndCsrInputOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getRowPointers() { + return (*getODSOperands(0).begin()); + } + + ValueT getSortedSampleIds() { + return (*getODSOperands(1).begin()); + } + + ValueT getSortedTokenIds() { + return (*getODSOperands(2).begin()); + } + + ValueT getSortedGains() { + return (*getODSOperands(3).begin()); + } + + ValueT getActivationGradients() { + return (*getODSOperands(4).begin()); + } + + ValueT getLearningRate() { + return (*getODSOperands(5).begin()); + } + + ValueT getEmbeddingTable() { + return (*getODSOperands(6).begin()); + } + + ValueT getMomenta() { + return (*getODSOperands(7).begin()); + } + + ValueT getVelocity() { + return (*getODSOperands(8).begin()); + } + + ValueT getNumMinibatchesPerPhysicalSparseCore() { + return (*getODSOperands(9).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaSparseDenseMatmulGradWithAdamAndCsrInputOpAdaptor : public XlaSparseDenseMatmulGradWithAdamAndCsrInputOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaSparseDenseMatmulGradWithAdamAndCsrInputOpGenericAdaptor::XlaSparseDenseMatmulGradWithAdamAndCsrInputOpGenericAdaptor; + XlaSparseDenseMatmulGradWithAdamAndCsrInputOpAdaptor(XlaSparseDenseMatmulGradWithAdamAndCsrInputOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaSparseDenseMatmulGradWithAdamAndCsrInputOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<10>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaSparseDenseMatmulGradWithAdamAndCsrInputOpAdaptor; + template + using GenericAdaptor = XlaSparseDenseMatmulGradWithAdamAndCsrInputOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("beta1"), ::llvm::StringRef("beta2"), ::llvm::StringRef("epsilon"), ::llvm::StringRef("table_name"), ::llvm::StringRef("use_sum_inside_sqrt")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBeta1AttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBeta1AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getBeta2AttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getBeta2AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getEpsilonAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getEpsilonAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getUseSumInsideSqrtAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getUseSumInsideSqrtAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaSparseDenseMatmulGradWithAdamAndCsrInput"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getRowPointers(); + ::mlir::TypedValue<::mlir::TensorType> getSortedSampleIds(); + ::mlir::TypedValue<::mlir::TensorType> getSortedTokenIds(); + ::mlir::TypedValue<::mlir::TensorType> getSortedGains(); + ::mlir::TypedValue<::mlir::TensorType> getActivationGradients(); + ::mlir::TypedValue<::mlir::TensorType> getLearningRate(); + ::mlir::TypedValue<::mlir::TensorType> getEmbeddingTable(); + ::mlir::TypedValue<::mlir::TensorType> getMomenta(); + ::mlir::TypedValue<::mlir::TensorType> getVelocity(); + ::mlir::TypedValue<::mlir::TensorType> getNumMinibatchesPerPhysicalSparseCore(); + ::mlir::OpOperand &getRowPointersMutable(); + ::mlir::OpOperand &getSortedSampleIdsMutable(); + ::mlir::OpOperand &getSortedTokenIdsMutable(); + ::mlir::OpOperand &getSortedGainsMutable(); + ::mlir::OpOperand &getActivationGradientsMutable(); + ::mlir::OpOperand &getLearningRateMutable(); + ::mlir::OpOperand &getEmbeddingTableMutable(); + ::mlir::OpOperand &getMomentaMutable(); + ::mlir::OpOperand &getVelocityMutable(); + ::mlir::OpOperand &getNumMinibatchesPerPhysicalSparseCoreMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getUpdatedEmbeddingTable(); + ::mlir::TypedValue<::mlir::TensorType> getUpdatedMomenta(); + ::mlir::TypedValue<::mlir::TensorType> getUpdatedVelocity(); + ::mlir::BoolAttr getUseSumInsideSqrtAttr(); + bool getUseSumInsideSqrt(); + ::mlir::FloatAttr getBeta1Attr(); + ::llvm::APFloat getBeta1(); + ::mlir::FloatAttr getBeta2Attr(); + ::llvm::APFloat getBeta2(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + void setUseSumInsideSqrtAttr(::mlir::BoolAttr attr); + void setUseSumInsideSqrt(bool attrValue); + void setBeta1Attr(::mlir::FloatAttr attr); + void setBeta1(::llvm::APFloat attrValue); + void setBeta2Attr(::mlir::FloatAttr attr); + void setBeta2(::llvm::APFloat attrValue); + void setEpsilonAttr(::mlir::FloatAttr attr); + void setEpsilon(::llvm::APFloat attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type updated_embedding_table, ::mlir::Type updated_momenta, ::mlir::Type updated_velocity, ::mlir::Value row_pointers, ::mlir::Value sorted_sample_ids, ::mlir::Value sorted_token_ids, ::mlir::Value sorted_gains, ::mlir::Value activation_gradients, ::mlir::Value learning_rate, ::mlir::Value embedding_table, ::mlir::Value momenta, ::mlir::Value velocity, ::mlir::Value num_minibatches_per_physical_sparse_core, ::mlir::BoolAttr use_sum_inside_sqrt, ::mlir::FloatAttr beta1, ::mlir::FloatAttr beta2, ::mlir::FloatAttr epsilon, ::mlir::StringAttr table_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value row_pointers, ::mlir::Value sorted_sample_ids, ::mlir::Value sorted_token_ids, ::mlir::Value sorted_gains, ::mlir::Value activation_gradients, ::mlir::Value learning_rate, ::mlir::Value embedding_table, ::mlir::Value momenta, ::mlir::Value velocity, ::mlir::Value num_minibatches_per_physical_sparse_core, ::mlir::BoolAttr use_sum_inside_sqrt, ::mlir::FloatAttr beta1, ::mlir::FloatAttr beta2, ::mlir::FloatAttr epsilon, ::mlir::StringAttr table_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type updated_embedding_table, ::mlir::Type updated_momenta, ::mlir::Type updated_velocity, ::mlir::Value row_pointers, ::mlir::Value sorted_sample_ids, ::mlir::Value sorted_token_ids, ::mlir::Value sorted_gains, ::mlir::Value activation_gradients, ::mlir::Value learning_rate, ::mlir::Value embedding_table, ::mlir::Value momenta, ::mlir::Value velocity, ::mlir::Value num_minibatches_per_physical_sparse_core, bool use_sum_inside_sqrt, ::llvm::APFloat beta1, ::llvm::APFloat beta2, ::llvm::APFloat epsilon, ::llvm::StringRef table_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value row_pointers, ::mlir::Value sorted_sample_ids, ::mlir::Value sorted_token_ids, ::mlir::Value sorted_gains, ::mlir::Value activation_gradients, ::mlir::Value learning_rate, ::mlir::Value embedding_table, ::mlir::Value momenta, ::mlir::Value velocity, ::mlir::Value num_minibatches_per_physical_sparse_core, bool use_sum_inside_sqrt, ::llvm::APFloat beta1, ::llvm::APFloat beta2, ::llvm::APFloat epsilon, ::llvm::StringRef table_name); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaSparseDenseMatmulGradWithAdamAndCsrInputOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaSparseDenseMatmulGradWithFtrlAndCsrInputOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaSparseDenseMatmulGradWithFtrlAndCsrInputOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaSparseDenseMatmulGradWithFtrlAndCsrInputOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaSparseDenseMatmulGradWithFtrlAndCsrInputOpGenericAdaptorBase(XlaSparseDenseMatmulGradWithFtrlAndCsrInputOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getMultiplyLinearByLearningRateAttr(); + bool getMultiplyLinearByLearningRate(); + ::mlir::FloatAttr getBetaAttr(); + ::llvm::APFloat getBeta(); + ::mlir::FloatAttr getLearningRatePowerAttr(); + ::llvm::APFloat getLearningRatePower(); + ::mlir::FloatAttr getL1RegularizationStrengthAttr(); + ::llvm::APFloat getL1RegularizationStrength(); + ::mlir::FloatAttr getL2RegularizationStrengthAttr(); + ::llvm::APFloat getL2RegularizationStrength(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); +}; +} // namespace detail +template +class XlaSparseDenseMatmulGradWithFtrlAndCsrInputOpGenericAdaptor : public detail::XlaSparseDenseMatmulGradWithFtrlAndCsrInputOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaSparseDenseMatmulGradWithFtrlAndCsrInputOpGenericAdaptorBase; +public: + XlaSparseDenseMatmulGradWithFtrlAndCsrInputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaSparseDenseMatmulGradWithFtrlAndCsrInputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaSparseDenseMatmulGradWithFtrlAndCsrInputOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaSparseDenseMatmulGradWithFtrlAndCsrInputOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getRowPointers() { + return (*getODSOperands(0).begin()); + } + + ValueT getSortedSampleIds() { + return (*getODSOperands(1).begin()); + } + + ValueT getSortedTokenIds() { + return (*getODSOperands(2).begin()); + } + + ValueT getSortedGains() { + return (*getODSOperands(3).begin()); + } + + ValueT getActivationGradients() { + return (*getODSOperands(4).begin()); + } + + ValueT getLearningRate() { + return (*getODSOperands(5).begin()); + } + + ValueT getEmbeddingTable() { + return (*getODSOperands(6).begin()); + } + + ValueT getAccumulator() { + return (*getODSOperands(7).begin()); + } + + ValueT getLinear() { + return (*getODSOperands(8).begin()); + } + + ValueT getNumMinibatchesPerPhysicalSparseCore() { + return (*getODSOperands(9).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaSparseDenseMatmulGradWithFtrlAndCsrInputOpAdaptor : public XlaSparseDenseMatmulGradWithFtrlAndCsrInputOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaSparseDenseMatmulGradWithFtrlAndCsrInputOpGenericAdaptor::XlaSparseDenseMatmulGradWithFtrlAndCsrInputOpGenericAdaptor; + XlaSparseDenseMatmulGradWithFtrlAndCsrInputOpAdaptor(XlaSparseDenseMatmulGradWithFtrlAndCsrInputOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaSparseDenseMatmulGradWithFtrlAndCsrInputOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<10>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaSparseDenseMatmulGradWithFtrlAndCsrInputOpAdaptor; + template + using GenericAdaptor = XlaSparseDenseMatmulGradWithFtrlAndCsrInputOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("beta"), ::llvm::StringRef("l1_regularization_strength"), ::llvm::StringRef("l2_regularization_strength"), ::llvm::StringRef("learning_rate_power"), ::llvm::StringRef("multiply_linear_by_learning_rate"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBetaAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBetaAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getL1RegularizationStrengthAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getL1RegularizationStrengthAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getL2RegularizationStrengthAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getL2RegularizationStrengthAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getLearningRatePowerAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getLearningRatePowerAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getMultiplyLinearByLearningRateAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getMultiplyLinearByLearningRateAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaSparseDenseMatmulGradWithFtrlAndCsrInput"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getRowPointers(); + ::mlir::TypedValue<::mlir::TensorType> getSortedSampleIds(); + ::mlir::TypedValue<::mlir::TensorType> getSortedTokenIds(); + ::mlir::TypedValue<::mlir::TensorType> getSortedGains(); + ::mlir::TypedValue<::mlir::TensorType> getActivationGradients(); + ::mlir::TypedValue<::mlir::TensorType> getLearningRate(); + ::mlir::TypedValue<::mlir::TensorType> getEmbeddingTable(); + ::mlir::TypedValue<::mlir::TensorType> getAccumulator(); + ::mlir::TypedValue<::mlir::TensorType> getLinear(); + ::mlir::TypedValue<::mlir::TensorType> getNumMinibatchesPerPhysicalSparseCore(); + ::mlir::OpOperand &getRowPointersMutable(); + ::mlir::OpOperand &getSortedSampleIdsMutable(); + ::mlir::OpOperand &getSortedTokenIdsMutable(); + ::mlir::OpOperand &getSortedGainsMutable(); + ::mlir::OpOperand &getActivationGradientsMutable(); + ::mlir::OpOperand &getLearningRateMutable(); + ::mlir::OpOperand &getEmbeddingTableMutable(); + ::mlir::OpOperand &getAccumulatorMutable(); + ::mlir::OpOperand &getLinearMutable(); + ::mlir::OpOperand &getNumMinibatchesPerPhysicalSparseCoreMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getUpdatedEmbeddingTable(); + ::mlir::TypedValue<::mlir::TensorType> getUpdatedAccumulator(); + ::mlir::TypedValue<::mlir::TensorType> getUpdatedLinear(); + ::mlir::BoolAttr getMultiplyLinearByLearningRateAttr(); + bool getMultiplyLinearByLearningRate(); + ::mlir::FloatAttr getBetaAttr(); + ::llvm::APFloat getBeta(); + ::mlir::FloatAttr getLearningRatePowerAttr(); + ::llvm::APFloat getLearningRatePower(); + ::mlir::FloatAttr getL1RegularizationStrengthAttr(); + ::llvm::APFloat getL1RegularizationStrength(); + ::mlir::FloatAttr getL2RegularizationStrengthAttr(); + ::llvm::APFloat getL2RegularizationStrength(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + void setMultiplyLinearByLearningRateAttr(::mlir::BoolAttr attr); + void setMultiplyLinearByLearningRate(bool attrValue); + void setBetaAttr(::mlir::FloatAttr attr); + void setBeta(::llvm::APFloat attrValue); + void setLearningRatePowerAttr(::mlir::FloatAttr attr); + void setLearningRatePower(::llvm::APFloat attrValue); + void setL1RegularizationStrengthAttr(::mlir::FloatAttr attr); + void setL1RegularizationStrength(::llvm::APFloat attrValue); + void setL2RegularizationStrengthAttr(::mlir::FloatAttr attr); + void setL2RegularizationStrength(::llvm::APFloat attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type updated_embedding_table, ::mlir::Type updated_accumulator, ::mlir::Type updated_linear, ::mlir::Value row_pointers, ::mlir::Value sorted_sample_ids, ::mlir::Value sorted_token_ids, ::mlir::Value sorted_gains, ::mlir::Value activation_gradients, ::mlir::Value learning_rate, ::mlir::Value embedding_table, ::mlir::Value accumulator, ::mlir::Value linear, ::mlir::Value num_minibatches_per_physical_sparse_core, ::mlir::BoolAttr multiply_linear_by_learning_rate, ::mlir::FloatAttr beta, ::mlir::FloatAttr learning_rate_power, ::mlir::FloatAttr l1_regularization_strength, ::mlir::FloatAttr l2_regularization_strength, ::mlir::StringAttr table_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value row_pointers, ::mlir::Value sorted_sample_ids, ::mlir::Value sorted_token_ids, ::mlir::Value sorted_gains, ::mlir::Value activation_gradients, ::mlir::Value learning_rate, ::mlir::Value embedding_table, ::mlir::Value accumulator, ::mlir::Value linear, ::mlir::Value num_minibatches_per_physical_sparse_core, ::mlir::BoolAttr multiply_linear_by_learning_rate, ::mlir::FloatAttr beta, ::mlir::FloatAttr learning_rate_power, ::mlir::FloatAttr l1_regularization_strength, ::mlir::FloatAttr l2_regularization_strength, ::mlir::StringAttr table_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type updated_embedding_table, ::mlir::Type updated_accumulator, ::mlir::Type updated_linear, ::mlir::Value row_pointers, ::mlir::Value sorted_sample_ids, ::mlir::Value sorted_token_ids, ::mlir::Value sorted_gains, ::mlir::Value activation_gradients, ::mlir::Value learning_rate, ::mlir::Value embedding_table, ::mlir::Value accumulator, ::mlir::Value linear, ::mlir::Value num_minibatches_per_physical_sparse_core, bool multiply_linear_by_learning_rate, ::llvm::APFloat beta, ::llvm::APFloat learning_rate_power, ::llvm::APFloat l1_regularization_strength, ::llvm::APFloat l2_regularization_strength, ::llvm::StringRef table_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value row_pointers, ::mlir::Value sorted_sample_ids, ::mlir::Value sorted_token_ids, ::mlir::Value sorted_gains, ::mlir::Value activation_gradients, ::mlir::Value learning_rate, ::mlir::Value embedding_table, ::mlir::Value accumulator, ::mlir::Value linear, ::mlir::Value num_minibatches_per_physical_sparse_core, bool multiply_linear_by_learning_rate, ::llvm::APFloat beta, ::llvm::APFloat learning_rate_power, ::llvm::APFloat l1_regularization_strength, ::llvm::APFloat l2_regularization_strength, ::llvm::StringRef table_name); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaSparseDenseMatmulGradWithFtrlAndCsrInputOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_arith_ops_folder.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_arith_ops_folder.h new file mode 100644 index 0000000000000000000000000000000000000000..aa0f84eb122e2ba630166f4ca60aac0eefc9ced0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_arith_ops_folder.h @@ -0,0 +1,132 @@ +/* Copyright 2021 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_ARITH_OPS_FOLDER_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_ARITH_OPS_FOLDER_H_ + +#include + +#include "llvm/ADT/StringRef.h" +#include "mlir/Dialect/Traits.h" // from @llvm-project +#include "mlir/IR/Attributes.h" // from @llvm-project +#include "mlir/IR/BuiltinAttributes.h" // from @llvm-project +#include "mlir/IR/BuiltinTypes.h" // from @llvm-project +#include "mlir/IR/Location.h" // from @llvm-project +#include "mlir/IR/OpDefinition.h" // from @llvm-project +#include "mlir/IR/TypeRange.h" // from @llvm-project +#include "mlir/IR/Value.h" // from @llvm-project + +namespace mlir { + +class Operation; + +namespace TF { + +class AddV2Op; +class SubOp; +class MulOp; +class DivOp; +class RealDivOp; + +// Verifies an reduction op's `input` and reduction `dims`. +LogicalResult VerifyReductionInputAndDims(Value input, Value dims, + Location loc); + +// A type range with description (in singular form) attached to it. +using TypeRangeWithDesc = std::pair; + +LogicalResult VerifyTypeRangesAreCompatible(Operation *op, + TypeRangeWithDesc range0, + TypeRangeWithDesc range1); + +// Fold Arithmetic Op if one of the operands is a constant known to be an +// Identity (e.g. X+0, X*1, etc...). For commutative operations fold if +// known identity value is either lhs or rhs. +template < + typename OpT, + typename std::enable_if::value>::type * = nullptr> +OpFoldResult IdentityArithmeticOpFolder(OpT arithmetic_op, + ArrayRef operands) { + auto lhs_type = arithmetic_op.getX().getType().template cast(); + auto rhs_type = arithmetic_op.getY().getType().template cast(); + auto result_type = + arithmetic_op.getResult().getType().template cast(); + + // We can fold arithmetic operation only of we can prove that we will not + // accidentally hide a broadcasting error. + auto is_valid_broadcasting = [](ShapedType operand_ty, ShapedType identity_ty, + ShapedType result_ty) -> bool { + // Scalar identity is broadcastable to any operand shape, we only need to + // check that operand has the same shape as a result. + bool scalar_identity = identity_ty.hasRank() && identity_ty.getRank() == 0; + if (scalar_identity) return operand_ty == result_ty; + + // If identity is not a scalar, we must verify that identity shape is + // statically known to be broadcastable to the operand shape and the operand + // and result shape are equal. + return operand_ty == result_ty && identity_ty.hasStaticShape() && + result_ty.hasStaticShape() && + OpTrait::util::staticallyKnownBroadcastable(operand_ty.getShape(), + identity_ty.getShape()); + }; + + // Check that we have a constant operand on one side (candidate for identity). + const bool is_commutative = + (std::is_same::value || std::is_same::value); + auto lhs_attr = operands[0].dyn_cast_or_null(); + auto rhs_attr = operands[1].dyn_cast_or_null(); + if (!rhs_attr && !(is_commutative && lhs_attr)) return {}; + + // Mul and Div ops have identity value one while AddV2 and SubOp have identity + // value zero. + const int identity = + (std::is_same::value || std::is_same::value || + std::is_same::value) + ? 1 + : 0; + + Type element_ty = lhs_type.getElementType(); + Attribute identity_attr; + if (auto ty = element_ty.template dyn_cast()) { + identity_attr = FloatAttr::get(ty, static_cast(identity)); + } else if (auto ty = element_ty.template dyn_cast()) { + identity_attr = IntegerAttr::get(ty, static_cast(identity)); + } else { + return {}; + } + + // Fold: Op(Operand, Identity) -> Operand. + if (rhs_attr && is_valid_broadcasting(lhs_type, rhs_type, result_type)) { + if (rhs_attr.isSplat() && + rhs_attr.getSplatValue() == identity_attr) + return arithmetic_op.getX(); + } + + // Fold: Op(Identity, Operand) -> Operand for commutative operations. + if (lhs_attr && is_commutative && + is_valid_broadcasting(rhs_type, lhs_type, result_type)) { + if (lhs_attr.isSplat() && + lhs_attr.getSplatValue() == identity_attr) + return arithmetic_op.getY(); + } + + return {}; +} + +} // namespace TF +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_ARITH_OPS_FOLDER_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_attributes.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_attributes.h new file mode 100644 index 0000000000000000000000000000000000000000..d5223870aba363f13ce7bfea7e8dc0c22bca81c4 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_attributes.h @@ -0,0 +1,36 @@ +/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +// This file defines the attributes used in the TensorFlow dialect. + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_ATTRIBUTES_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_ATTRIBUTES_H_ + +#include "tensorflow/core/ir/types/dialect.h" + +namespace mlir { +namespace TF { + +// This all moved under tensorflow/core/ir/types and these using declaration are +// to help with the transition. +using mlir::tf_type::FuncAttr; // NOLINT +using mlir::tf_type::PlaceholderAttr; // NOLINT +using mlir::tf_type::ShapeAttr; // NOLINT +using mlir::tf_type::TensorProtoAttr; // NOLINT + +} // end namespace TF +} // end namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_ATTRIBUTES_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_device.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_device.h new file mode 100644 index 0000000000000000000000000000000000000000..0c7ff33e817dd27ba4c2d6b3f1d3412882ba8cd7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_device.h @@ -0,0 +1,54 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +// This file defines the tf_device dialect: it contains operations that model +// TensorFlow's actions to launch computations on accelerator devices. + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_DEVICE_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_DEVICE_H_ + +#include "mlir/Dialect/Func/IR/FuncOps.h" // from @llvm-project +#include "mlir/IR/Builders.h" // from @llvm-project +#include "mlir/IR/BuiltinOps.h" // from @llvm-project +#include "mlir/IR/Dialect.h" // from @llvm-project +#include "mlir/IR/OpDefinition.h" // from @llvm-project +#include "mlir/IR/Value.h" // from @llvm-project +#include "mlir/Interfaces/ControlFlowInterfaces.h" // from @llvm-project +#include "mlir/Interfaces/SideEffectInterfaces.h" // from @llvm-project + +namespace mlir { +namespace tf_device { + +// The TensorFlow Device dialect. +// +// This dialect contains operations to describe/launch computations on devices. +// These operations do not map 1-1 to TensorFlow ops and requires a lowering +// pass later to transform them into Compile/Run op pairs, like XlaCompile and +// XlaRun. +class TensorFlowDeviceDialect : public Dialect { + public: + static StringRef getDialectNamespace() { return "tf_device"; } + // Constructing TensorFlowDevice dialect under an non-null MLIRContext. + explicit TensorFlowDeviceDialect(MLIRContext* context); +}; + +} // namespace tf_device +} // namespace mlir + +// Declares the operations for this dialect using the generated header. +#define GET_OP_CLASSES +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_device.h.inc" + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_DEVICE_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_device.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_device.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..fc8bca789e75cc3a27a9181a10f4e5d3fecd0e81 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_device.h.inc @@ -0,0 +1,1364 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: tf_device_ops.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#if defined(GET_OP_CLASSES) || defined(GET_OP_FWD_DEFINES) +#undef GET_OP_FWD_DEFINES +namespace mlir { +namespace tf_device { +class ClusterFuncOp; +} // namespace tf_device +} // namespace mlir +namespace mlir { +namespace tf_device { +class ClusterOp; +} // namespace tf_device +} // namespace mlir +namespace mlir { +namespace tf_device { +class LaunchFuncOp; +} // namespace tf_device +} // namespace mlir +namespace mlir { +namespace tf_device { +class LaunchOp; +} // namespace tf_device +} // namespace mlir +namespace mlir { +namespace tf_device { +class ParallelExecuteOp; +} // namespace tf_device +} // namespace mlir +namespace mlir { +namespace tf_device { +class ReceiveOp; +} // namespace tf_device +} // namespace mlir +namespace mlir { +namespace tf_device { +class RemoteRunOp; +} // namespace tf_device +} // namespace mlir +namespace mlir { +namespace tf_device { +class ReplicateOp; +} // namespace tf_device +} // namespace mlir +namespace mlir { +namespace tf_device { +class ReturnOp; +} // namespace tf_device +} // namespace mlir +namespace mlir { +namespace tf_device { +class SendOp; +} // namespace tf_device +} // namespace mlir +#endif + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace tf_device { + +//===----------------------------------------------------------------------===// +// ::mlir::tf_device::ClusterFuncOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ClusterFuncOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ClusterFuncOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ClusterFuncOpGenericAdaptorBase(ClusterFuncOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::FlatSymbolRefAttr getFuncAttr(); + ::llvm::StringRef getFunc(); +}; +} // namespace detail +template +class ClusterFuncOpGenericAdaptor : public detail::ClusterFuncOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ClusterFuncOpGenericAdaptorBase; +public: + ClusterFuncOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ClusterFuncOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ClusterFuncOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ClusterFuncOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ClusterFuncOpAdaptor : public ClusterFuncOpGenericAdaptor<::mlir::ValueRange> { +public: + using ClusterFuncOpGenericAdaptor::ClusterFuncOpGenericAdaptor; + ClusterFuncOpAdaptor(ClusterFuncOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ClusterFuncOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = ClusterFuncOpAdaptor; + template + using GenericAdaptor = ClusterFuncOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("func")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFuncAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFuncAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf_device.cluster_func"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResults(); + ::mlir::FlatSymbolRefAttr getFuncAttr(); + ::llvm::StringRef getFunc(); + void setFuncAttr(::mlir::FlatSymbolRefAttr attr); + void setFunc(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange results, ::mlir::FlatSymbolRefAttr func, ::mlir::ValueRange odsArg_0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange results, ::llvm::StringRef func, ::mlir::ValueRange odsArg_0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // returns the function that this operation will launch. + func::FuncOp getFuncOp() { + return SymbolTable::lookupNearestSymbolFrom(*this, getFuncAttr()); + } +}; +} // namespace tf_device +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::tf_device::ClusterFuncOp) + +namespace mlir { +namespace tf_device { + +//===----------------------------------------------------------------------===// +// ::mlir::tf_device::ClusterOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ClusterOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ClusterOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ClusterOpGenericAdaptorBase(ClusterOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getPolicyAttr(); + ::std::optional< ::llvm::StringRef > getPolicy(); + ::mlir::Region &getBody(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class ClusterOpGenericAdaptor : public detail::ClusterOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ClusterOpGenericAdaptorBase; +public: + ClusterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ClusterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ClusterOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ClusterOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ClusterOpAdaptor : public ClusterOpGenericAdaptor<::mlir::ValueRange> { +public: + using ClusterOpGenericAdaptor::ClusterOpGenericAdaptor; + ClusterOpAdaptor(ClusterOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ClusterOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = ClusterOpAdaptor; + template + using GenericAdaptor = ClusterOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("policy")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getPolicyAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getPolicyAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf_device.cluster"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResults(); + ::mlir::Region &getBody(); + ::mlir::StringAttr getPolicyAttr(); + ::std::optional< ::llvm::StringRef > getPolicy(); + void setPolicyAttr(::mlir::StringAttr attr); + void setPolicy(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removePolicyAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTypes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange results, /*optional*/::mlir::StringAttr policy); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + Block &GetBody() { return getOperation()->getRegion(0).front(); } +}; +} // namespace tf_device +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::tf_device::ClusterOp) + +namespace mlir { +namespace tf_device { + +//===----------------------------------------------------------------------===// +// ::mlir::tf_device::LaunchFuncOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LaunchFuncOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LaunchFuncOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LaunchFuncOpGenericAdaptorBase(LaunchFuncOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getDeviceAttr(); + ::llvm::StringRef getDevice(); + ::mlir::FlatSymbolRefAttr getFuncAttr(); + ::llvm::StringRef getFunc(); +}; +} // namespace detail +template +class LaunchFuncOpGenericAdaptor : public detail::LaunchFuncOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LaunchFuncOpGenericAdaptorBase; +public: + LaunchFuncOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LaunchFuncOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LaunchFuncOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LaunchFuncOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LaunchFuncOpAdaptor : public LaunchFuncOpGenericAdaptor<::mlir::ValueRange> { +public: + using LaunchFuncOpGenericAdaptor::LaunchFuncOpGenericAdaptor; + LaunchFuncOpAdaptor(LaunchFuncOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LaunchFuncOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = LaunchFuncOpAdaptor; + template + using GenericAdaptor = LaunchFuncOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("device"), ::llvm::StringRef("func")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDeviceAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDeviceAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getFuncAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getFuncAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf_device.launch_func"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResults(); + ::mlir::StringAttr getDeviceAttr(); + ::llvm::StringRef getDevice(); + ::mlir::FlatSymbolRefAttr getFuncAttr(); + ::llvm::StringRef getFunc(); + void setDeviceAttr(::mlir::StringAttr attr); + void setDevice(::llvm::StringRef attrValue); + void setFuncAttr(::mlir::FlatSymbolRefAttr attr); + void setFunc(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange results, ::mlir::StringAttr device, ::mlir::FlatSymbolRefAttr func, ::mlir::ValueRange odsArg_0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange results, ::llvm::StringRef device, ::llvm::StringRef func, ::mlir::ValueRange odsArg_0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace tf_device +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::tf_device::LaunchFuncOp) + +namespace mlir { +namespace tf_device { + +//===----------------------------------------------------------------------===// +// ::mlir::tf_device::LaunchOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LaunchOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LaunchOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LaunchOpGenericAdaptorBase(LaunchOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getDeviceAttr(); + ::llvm::StringRef getDevice(); + ::mlir::Region &getBody(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class LaunchOpGenericAdaptor : public detail::LaunchOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LaunchOpGenericAdaptorBase; +public: + LaunchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LaunchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LaunchOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LaunchOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LaunchOpAdaptor : public LaunchOpGenericAdaptor<::mlir::ValueRange> { +public: + using LaunchOpGenericAdaptor::LaunchOpGenericAdaptor; + LaunchOpAdaptor(LaunchOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LaunchOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = LaunchOpAdaptor; + template + using GenericAdaptor = LaunchOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("device")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDeviceAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDeviceAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf_device.launch"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResults(); + ::mlir::Region &getBody(); + ::mlir::StringAttr getDeviceAttr(); + ::llvm::StringRef getDevice(); + void setDeviceAttr(::mlir::StringAttr attr); + void setDevice(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, StringAttr device, TypeRange result_types); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange results, ::mlir::StringAttr device); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange results, ::llvm::StringRef device); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + Block &GetBody() { return getOperation()->getRegion(0).front(); } + bool WrapsSingleOp(); +}; +} // namespace tf_device +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::tf_device::LaunchOp) + +namespace mlir { +namespace tf_device { + +//===----------------------------------------------------------------------===// +// ::mlir::tf_device::ParallelExecuteOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ParallelExecuteOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ParallelExecuteOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ParallelExecuteOpGenericAdaptorBase(ParallelExecuteOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class ParallelExecuteOpGenericAdaptor : public detail::ParallelExecuteOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ParallelExecuteOpGenericAdaptorBase; +public: + ParallelExecuteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ParallelExecuteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ParallelExecuteOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ParallelExecuteOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ParallelExecuteOpAdaptor : public ParallelExecuteOpGenericAdaptor<::mlir::ValueRange> { +public: + using ParallelExecuteOpGenericAdaptor::ParallelExecuteOpGenericAdaptor; + ParallelExecuteOpAdaptor(ParallelExecuteOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ParallelExecuteOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = ParallelExecuteOpAdaptor; + template + using GenericAdaptor = ParallelExecuteOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf_device.parallel_execute"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getExecuteOutputs(); + ::mlir::MutableArrayRef<::mlir::Region> getRegions(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, int num_regions, TypeRange output_types); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange execute_outputs, unsigned regionsCount); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes, unsigned numRegions); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); +public: + Block& GetRegionBlockWithIndex(unsigned index); + Operation::result_range GetRegionOutputs(unsigned region_index); + + // Checks if a tf_device.parallel_execute index'th region block wraps a + // single operation and the single operation results are perfectly forwarded + // to the region block's return. + bool RegionWrapsSingleOp(unsigned index); +}; +} // namespace tf_device +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::tf_device::ParallelExecuteOp) + +namespace mlir { +namespace tf_device { + +//===----------------------------------------------------------------------===// +// ::mlir::tf_device::ReceiveOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReceiveOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ReceiveOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ReceiveOpGenericAdaptorBase(ReceiveOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getKeyAttr(); + ::llvm::StringRef getKey(); + ::mlir::StringAttr getSrcHostAttr(); + ::llvm::StringRef getSrcHost(); +}; +} // namespace detail +template +class ReceiveOpGenericAdaptor : public detail::ReceiveOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReceiveOpGenericAdaptorBase; +public: + ReceiveOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReceiveOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReceiveOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ReceiveOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ReceiveOpAdaptor : public ReceiveOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReceiveOpGenericAdaptor::ReceiveOpGenericAdaptor; + ReceiveOpAdaptor(ReceiveOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReceiveOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = ReceiveOpAdaptor; + template + using GenericAdaptor = ReceiveOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("key"), ::llvm::StringRef("src_host")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getKeyAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getKeyAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getSrcHostAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getSrcHostAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf_device.receive"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + ::mlir::StringAttr getKeyAttr(); + ::llvm::StringRef getKey(); + ::mlir::StringAttr getSrcHostAttr(); + ::llvm::StringRef getSrcHost(); + void setKeyAttr(::mlir::StringAttr attr); + void setKey(::llvm::StringRef attrValue); + void setSrcHostAttr(::mlir::StringAttr attr); + void setSrcHost(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::StringAttr key, ::mlir::StringAttr src_host); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr key, ::mlir::StringAttr src_host); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::llvm::StringRef key, ::llvm::StringRef src_host); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef key, ::llvm::StringRef src_host); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace tf_device +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::tf_device::ReceiveOp) + +namespace mlir { +namespace tf_device { + +//===----------------------------------------------------------------------===// +// ::mlir::tf_device::RemoteRunOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RemoteRunOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RemoteRunOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RemoteRunOpGenericAdaptorBase(RemoteRunOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getHostAttr(); + ::llvm::StringRef getHost(); + ::mlir::FlatSymbolRefAttr getCalleeAttr(); + ::llvm::StringRef getCallee(); +}; +} // namespace detail +template +class RemoteRunOpGenericAdaptor : public detail::RemoteRunOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RemoteRunOpGenericAdaptorBase; +public: + RemoteRunOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RemoteRunOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RemoteRunOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RemoteRunOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getCalleeArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RemoteRunOpAdaptor : public RemoteRunOpGenericAdaptor<::mlir::ValueRange> { +public: + using RemoteRunOpGenericAdaptor::RemoteRunOpGenericAdaptor; + RemoteRunOpAdaptor(RemoteRunOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RemoteRunOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = RemoteRunOpAdaptor; + template + using GenericAdaptor = RemoteRunOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("callee"), ::llvm::StringRef("host")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getCalleeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getCalleeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getHostAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getHostAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf_device.remote_run"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getCalleeArgs(); + ::mlir::MutableOperandRange getCalleeArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResults(); + ::mlir::StringAttr getHostAttr(); + ::llvm::StringRef getHost(); + ::mlir::FlatSymbolRefAttr getCalleeAttr(); + ::llvm::StringRef getCallee(); + void setHostAttr(::mlir::StringAttr attr); + void setHost(::llvm::StringRef attrValue); + void setCalleeAttr(::mlir::FlatSymbolRefAttr attr); + void setCallee(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange results, ::mlir::StringAttr host, ::mlir::FlatSymbolRefAttr callee, ::mlir::ValueRange callee_args); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange results, ::llvm::StringRef host, ::llvm::StringRef callee, ::mlir::ValueRange callee_args); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace tf_device +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::tf_device::RemoteRunOp) + +namespace mlir { +namespace tf_device { + +//===----------------------------------------------------------------------===// +// ::mlir::tf_device::ReplicateOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReplicateOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ReplicateOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ReplicateOpGenericAdaptorBase(ReplicateOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseI32ArrayAttr getOperandSegmentSizesAttr(); + ::llvm::ArrayRef getOperandSegmentSizes(); + ::mlir::IntegerAttr getNAttr(); + uint32_t getN(); + ::mlir::DictionaryAttr getDevicesAttr(); + ::std::optional< ::mlir::DictionaryAttr > getDevices(); + ::mlir::Region &getBody(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class ReplicateOpGenericAdaptor : public detail::ReplicateOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReplicateOpGenericAdaptorBase; +public: + ReplicateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReplicateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReplicateOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ReplicateOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getReplicatedInputs() { + return getODSOperands(0); + } + + RangeT getPackedInputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ReplicateOpAdaptor : public ReplicateOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReplicateOpGenericAdaptor::ReplicateOpGenericAdaptor; + ReplicateOpAdaptor(ReplicateOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReplicateOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = ReplicateOpAdaptor; + template + using GenericAdaptor = ReplicateOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("devices"), ::llvm::StringRef("n"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDevicesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDevicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf_device.replicate"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getReplicatedInputs(); + ::mlir::Operation::operand_range getPackedInputs(); + ::mlir::MutableOperandRange getReplicatedInputsMutable(); + ::mlir::MutableOperandRange getPackedInputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getReplicatedOutputs(); + ::mlir::Region &getBody(); + ::mlir::DenseI32ArrayAttr getOperandSegmentSizesAttr(); + ::llvm::ArrayRef getOperandSegmentSizes(); + ::mlir::IntegerAttr getNAttr(); + uint32_t getN(); + ::mlir::DictionaryAttr getDevicesAttr(); + ::std::optional< ::mlir::DictionaryAttr > getDevices(); + void setOperandSegmentSizesAttr(::mlir::DenseI32ArrayAttr attr); + void setOperandSegmentSizes(::llvm::ArrayRef attrValue); + void setNAttr(::mlir::IntegerAttr attr); + void setN(uint32_t attrValue); + void setDevicesAttr(::mlir::DictionaryAttr attr); + ::mlir::Attribute removeDevicesAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, int n, const llvm::SmallDenseMap>&devices, llvm::ArrayRef> replicated_inputs, ValueRange packed_inputs, TypeRange replica_output_types); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, int n, std::optional devices, llvm::ArrayRef> replicated_inputs, ValueRange packed_inputs, TypeRange replica_output_types); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange replicated_outputs, ::mlir::ValueRange replicated_inputs, ::mlir::ValueRange packed_inputs, ::mlir::DenseI32ArrayAttr operandSegmentSizes, ::mlir::IntegerAttr n, /*optional*/::mlir::DictionaryAttr devices); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange replicated_outputs, ::mlir::ValueRange replicated_inputs, ::mlir::ValueRange packed_inputs, ::llvm::ArrayRef operandSegmentSizes, uint32_t n, /*optional*/::mlir::DictionaryAttr devices); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + Block &GetBody() { return getOperation()->getRegion(0).front(); } + unsigned GetNumReplicatedBlockArguments(); + unsigned GetNumPackedBlockArguments(); + llvm::ArrayRef GetPackedBlockArguments(); + llvm::ArrayRef GetReplicatedBlockArguments(); + bool IsReplicatedBlockArgument(BlockArgument block_arg); + bool IsPackedBlockArgument(BlockArgument block_arg); + unsigned GetReplicaOperandIndexForBlockArgument(BlockArgument block_arg, unsigned replica); + Value GetReplicaOperandForBlockArgument(BlockArgument block_arg, unsigned replica); + MutableArrayRef GetOperandsForBlockArgument(BlockArgument block_arg); + bool WrapsSingleOp(); +}; +} // namespace tf_device +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::tf_device::ReplicateOp) + +namespace mlir { +namespace tf_device { + +//===----------------------------------------------------------------------===// +// ::mlir::tf_device::ReturnOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReturnOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ReturnOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ReturnOpGenericAdaptorBase(ReturnOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ReturnOpGenericAdaptor : public detail::ReturnOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReturnOpGenericAdaptorBase; +public: + ReturnOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReturnOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReturnOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ReturnOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getResults() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ReturnOpAdaptor : public ReturnOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReturnOpGenericAdaptor::ReturnOpGenericAdaptor; + ReturnOpAdaptor(ReturnOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReturnOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = ReturnOpAdaptor; + template + using GenericAdaptor = ReturnOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf_device.return"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getResults(); + ::mlir::MutableOperandRange getResultsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange results); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::MutableOperandRange getMutableSuccessorOperands(::mlir::RegionBranchPoint point); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace tf_device +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::tf_device::ReturnOp) + +namespace mlir { +namespace tf_device { + +//===----------------------------------------------------------------------===// +// ::mlir::tf_device::SendOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SendOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SendOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SendOpGenericAdaptorBase(SendOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getKeyAttr(); + ::llvm::StringRef getKey(); + ::mlir::StringAttr getDstHostAttr(); + ::llvm::StringRef getDstHost(); +}; +} // namespace detail +template +class SendOpGenericAdaptor : public detail::SendOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SendOpGenericAdaptorBase; +public: + SendOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SendOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SendOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SendOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getValue() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SendOpAdaptor : public SendOpGenericAdaptor<::mlir::ValueRange> { +public: + using SendOpGenericAdaptor::SendOpGenericAdaptor; + SendOpAdaptor(SendOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SendOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = SendOpAdaptor; + template + using GenericAdaptor = SendOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dst_host"), ::llvm::StringRef("key")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDstHostAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDstHostAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getKeyAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getKeyAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf_device.send"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getValue(); + ::mlir::OpOperand &getValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::StringAttr getKeyAttr(); + ::llvm::StringRef getKey(); + ::mlir::StringAttr getDstHostAttr(); + ::llvm::StringRef getDstHost(); + void setKeyAttr(::mlir::StringAttr attr); + void setKey(::llvm::StringRef attrValue); + void setDstHostAttr(::mlir::StringAttr attr); + void setDstHost(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::mlir::StringAttr key, ::mlir::StringAttr dst_host); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::StringAttr key, ::mlir::StringAttr dst_host); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, ::llvm::StringRef key, ::llvm::StringRef dst_host); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::llvm::StringRef key, ::llvm::StringRef dst_host); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace tf_device +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::tf_device::SendOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_dialect.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_dialect.h new file mode 100644 index 0000000000000000000000000000000000000000..cad01806953a1be313430995e2ad355ffbe53655 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_dialect.h @@ -0,0 +1,120 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +// This file defines the standard MLIR TensorFlow dialect after control +// dependences are raise to the standard form. + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_DIALECT_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_DIALECT_H_ + +#include +#include + +#include "mlir/IR/BuiltinAttributes.h" // from @llvm-project +#include "mlir/IR/Dialect.h" // from @llvm-project +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_types.h" + +namespace mlir { +namespace TF { + +class TensorFlowRegistryEffectInterfaceFallback; + +class TensorFlowDialect final : public Dialect { + public: + explicit TensorFlowDialect(MLIRContext *context); + ~TensorFlowDialect() override; + + static StringRef getDialectNamespace() { return "tf"; } + + // Overrides to redirect to tf_type dialect. + Attribute parseAttribute(DialectAsmParser &parser, Type type) const override; + Type parseType(DialectAsmParser &parser) const override; + + // Gradient attribute ("tf.gradient") in the list of NamedAttributes in a + // function references to its gradient function. This attribute in TensorFlow + // Dialect is used to model TF GradientDef. GetGradientAttrName() returns the + // string description of gradient attribute. + static StringRef GetGradientAttrName() { return "tf.gradient"; } + + // This attribute marks if a function is stateful. + // Returns the string description of stateful attribute. + static StringRef GetStatefulAttrName() { return "tf.signature.is_stateful"; } + + // Returns true if the op can be duplicated during transformations. + static bool CanDuplicate(Operation *op); + + // Returns true if the op can have side effects. + static bool CanHaveSideEffects(Operation *op); + + // Registered hook to materialize a constant operation from a given attribute + // value with the desired resultant type. + Operation *materializeConstant(OpBuilder &builder, Attribute value, Type type, + Location loc) override; + + typedef std::function AdditionalOpFunction; + + // Register an op registration hook which is invoked during construction. + // + // A hook may use the public addOperations() method to add additional + // operations to the dialect. Hooks will only apply to subsequent + // instantations of the Dialect/MLIRContext. + static void RegisterAdditionalOperationHook(TypeID uniqueId, + AdditionalOpFunction fn); + + // Re-define publicly the protected addOperations() method from the Dialect + // class, usually used in a Dialect constructor. This allows hook + // functions to register operations on the TensorFlow dialect using the + // same interface. + template + void addOperations() { + Dialect::addOperations(); + } + + using ConstantFoldHook = LogicalResult (*)(Operation *, ArrayRef, + SmallVectorImpl &); + static void RegisterConstantFoldHook(ConstantFoldHook fn) { + constant_fold_hook_ = std::move(fn); + } + + static LogicalResult constantFold(Operation *op, ArrayRef operands, + SmallVectorImpl &results) { + if (constant_fold_hook_) return constant_fold_hook_(op, operands, results); + return failure(); + } + + static bool HasConstantFoldHook() { return constant_fold_hook_; } + + // Provides a hook for op interface. + void *getRegisteredInterfaceForOp(mlir::TypeID interface, + mlir::OperationName opName) override; + + private: + static ConstantFoldHook constant_fold_hook_; + + // Storage for a custom fallback interface. + TensorFlowRegistryEffectInterfaceFallback *fallback_effect_op_interface_; +}; + +} // namespace TF +} // namespace mlir + +#define TF_DIALECT_REGISTER_ADDITIONAL_OPERATIONS(hookFn) \ + { \ + static bool key; \ + ::mlir::TF::TensorFlowDialect::RegisterAdditionalOperationHook( \ + ::mlir::TypeID::getFromOpaquePointer(&key), hookFn); \ + } + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_DIALECT_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_executor.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_executor.h new file mode 100644 index 0000000000000000000000000000000000000000..95d766359b1d059509baad40d863adae13128dfe --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_executor.h @@ -0,0 +1,69 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +// This file defines the tf_executor dialect: it models the TensorFlow executor +// semantics and can represent arbitrary TensorFlow graphs. As such it follows +// the existing execution model that includes deadness propagation, concurrent +// semantics, and control dependencies. + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_EXECUTOR_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_EXECUTOR_H_ + +#include "mlir/Bytecode/BytecodeOpInterface.h" // from @llvm-project // IWYU pragma: keep +#include "mlir/Dialect/Traits.h" // from @llvm-project +#include "mlir/IR/Attributes.h" // from @llvm-project +#include "mlir/IR/Builders.h" // from @llvm-project +#include "mlir/IR/BuiltinTypes.h" // from @llvm-project +#include "mlir/IR/Dialect.h" // from @llvm-project +#include "mlir/IR/Matchers.h" // from @llvm-project +#include "mlir/IR/OpImplementation.h" // from @llvm-project +#include "mlir/Interfaces/InferTypeOpInterface.h" // from @llvm-project +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_types.h" + +namespace mlir { +namespace tf_executor { + +class TensorFlowExecutorDialect : public Dialect { + public: + static StringRef getDialectNamespace() { return "tf_executor"; } + explicit TensorFlowExecutorDialect(MLIRContext *context); + + // Parses a type registered to this dialect. + Type parseType(DialectAsmParser &parser) const override; + + // Prints a type registered to this dialect. + void printType(Type type, DialectAsmPrinter &os) const override; +}; + +// The Control type is a token-like value that models control dependencies from +// TensorFlow graphs. +class ControlType : public Type::TypeBase { + public: + using Base::Base; +}; + +class TokenType : public Type::TypeBase { + public: + using Base::Base; +}; + +} // namespace tf_executor +} // namespace mlir + +// Declares the operations for this dialect using the generated header. +#define GET_OP_CLASSES +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_executor.h.inc" + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_EXECUTOR_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_executor.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_executor.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..f2f8f7056bdfbb3ac0a88398e923c92ddc05f4c1 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_executor.h.inc @@ -0,0 +1,1638 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: tf_executor_ops.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#if defined(GET_OP_CLASSES) || defined(GET_OP_FWD_DEFINES) +#undef GET_OP_FWD_DEFINES +namespace mlir { +namespace tf_executor { +class ControlTriggerOp; +} // namespace tf_executor +} // namespace mlir +namespace mlir { +namespace tf_executor { +class EnterOp; +} // namespace tf_executor +} // namespace mlir +namespace mlir { +namespace tf_executor { +class ExitOp; +} // namespace tf_executor +} // namespace mlir +namespace mlir { +namespace tf_executor { +class FetchOp; +} // namespace tf_executor +} // namespace mlir +namespace mlir { +namespace tf_executor { +class GraphOp; +} // namespace tf_executor +} // namespace mlir +namespace mlir { +namespace tf_executor { +class IslandOp; +} // namespace tf_executor +} // namespace mlir +namespace mlir { +namespace tf_executor { +class LoopCondOp; +} // namespace tf_executor +} // namespace mlir +namespace mlir { +namespace tf_executor { +class MergeOp; +} // namespace tf_executor +} // namespace mlir +namespace mlir { +namespace tf_executor { +class NextIterationSinkOp; +} // namespace tf_executor +} // namespace mlir +namespace mlir { +namespace tf_executor { +class NextIterationSourceOp; +} // namespace tf_executor +} // namespace mlir +namespace mlir { +namespace tf_executor { +class SwitchNOp; +} // namespace tf_executor +} // namespace mlir +namespace mlir { +namespace tf_executor { +class SwitchOp; +} // namespace tf_executor +} // namespace mlir +namespace mlir { +namespace tf_executor { +class YieldOp; +} // namespace tf_executor +} // namespace mlir +#endif + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace tf_executor { + +//===----------------------------------------------------------------------===// +// ::mlir::tf_executor::ControlTriggerOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ControlTriggerOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ControlTriggerOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ControlTriggerOpGenericAdaptorBase(ControlTriggerOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ControlTriggerOpGenericAdaptor : public detail::ControlTriggerOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ControlTriggerOpGenericAdaptorBase; +public: + ControlTriggerOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ControlTriggerOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ControlTriggerOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ControlTriggerOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getControlInputs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ControlTriggerOpAdaptor : public ControlTriggerOpGenericAdaptor<::mlir::ValueRange> { +public: + using ControlTriggerOpGenericAdaptor::ControlTriggerOpGenericAdaptor; + ControlTriggerOpAdaptor(ControlTriggerOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ControlTriggerOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::HasParent::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ControlTriggerOpAdaptor; + template + using GenericAdaptor = ControlTriggerOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf_executor.ControlTrigger"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getControlInputs(); + ::mlir::MutableOperandRange getControlInputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getControl(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ArrayRef operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type control, ::mlir::ValueRange controlInputs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace tf_executor +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::tf_executor::ControlTriggerOp) + +namespace mlir { +namespace tf_executor { + +//===----------------------------------------------------------------------===// +// ::mlir::tf_executor::EnterOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class EnterOpGenericAdaptorBase { +public: + struct Properties { + using frame_nameTy = ::mlir::StringAttr; + frame_nameTy frame_name; + + auto getFrameName() { + auto &propStorage = this->frame_name; + return ::llvm::cast<::mlir::StringAttr>(propStorage); + } + void setFrameName(const ::mlir::StringAttr &propValue) { + this->frame_name = propValue; + } + using is_constantTy = ::mlir::BoolAttr; + is_constantTy is_constant; + + auto getIsConstant() { + auto &propStorage = this->is_constant; + return ::llvm::dyn_cast_or_null<::mlir::BoolAttr>(propStorage); + } + void setIsConstant(const ::mlir::BoolAttr &propValue) { + this->is_constant = propValue; + } + using parallel_iterationsTy = ::mlir::IntegerAttr; + parallel_iterationsTy parallel_iterations; + + auto getParallelIterations() { + auto &propStorage = this->parallel_iterations; + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(propStorage); + } + void setParallelIterations(const ::mlir::IntegerAttr &propValue) { + this->parallel_iterations = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.frame_name == this->frame_name && + rhs.is_constant == this->is_constant && + rhs.parallel_iterations == this->parallel_iterations && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + EnterOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + EnterOpGenericAdaptorBase(EnterOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getFrameNameAttr(); + ::llvm::StringRef getFrameName(); + ::mlir::BoolAttr getIsConstantAttr(); + bool getIsConstant(); + ::mlir::IntegerAttr getParallelIterationsAttr(); + uint64_t getParallelIterations(); +}; +} // namespace detail +template +class EnterOpGenericAdaptor : public detail::EnterOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::EnterOpGenericAdaptorBase; +public: + EnterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + EnterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : EnterOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + EnterOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getData() { + return (*getODSOperands(0).begin()); + } + + RangeT getControlInputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class EnterOpAdaptor : public EnterOpGenericAdaptor<::mlir::ValueRange> { +public: + using EnterOpGenericAdaptor::EnterOpGenericAdaptor; + EnterOpAdaptor(EnterOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class EnterOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::HasParent::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = EnterOpAdaptor; + template + using GenericAdaptor = EnterOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("frame_name"), ::llvm::StringRef("is_constant"), ::llvm::StringRef("parallel_iterations")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFrameNameAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFrameNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getIsConstantAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getIsConstantAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getParallelIterationsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getParallelIterationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf_executor.Enter"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getData(); + ::mlir::Operation::operand_range getControlInputs(); + ::mlir::OpOperand &getDataMutable(); + ::mlir::MutableOperandRange getControlInputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getOutput(); + ::mlir::Value getControl(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::StringAttr getFrameNameAttr(); + ::llvm::StringRef getFrameName(); + ::mlir::BoolAttr getIsConstantAttr(); + bool getIsConstant(); + ::mlir::IntegerAttr getParallelIterationsAttr(); + uint64_t getParallelIterations(); + void setFrameNameAttr(::mlir::StringAttr attr); + void setFrameName(::llvm::StringRef attrValue); + void setIsConstantAttr(::mlir::BoolAttr attr); + void setIsConstant(::std::optional attrValue); + void setParallelIterationsAttr(::mlir::IntegerAttr attr); + void setParallelIterations(::std::optional attrValue); + ::mlir::Attribute removeIsConstantAttr(); + ::mlir::Attribute removeParallelIterationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Type control, ::mlir::Value data, ::mlir::StringAttr frame_name, /*optional*/::mlir::BoolAttr is_constant, /*optional*/::mlir::IntegerAttr parallel_iterations, ::mlir::ValueRange controlInputs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value data, ::mlir::StringAttr frame_name, /*optional*/::mlir::BoolAttr is_constant, /*optional*/::mlir::IntegerAttr parallel_iterations, ::mlir::ValueRange controlInputs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Type control, ::mlir::Value data, ::llvm::StringRef frame_name, /*optional*/bool is_constant, /*optional*/uint64_t parallel_iterations, ::mlir::ValueRange controlInputs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value data, ::llvm::StringRef frame_name, /*optional*/bool is_constant, /*optional*/uint64_t parallel_iterations, ::mlir::ValueRange controlInputs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace tf_executor +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::tf_executor::EnterOp) + +namespace mlir { +namespace tf_executor { + +//===----------------------------------------------------------------------===// +// ::mlir::tf_executor::ExitOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ExitOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ExitOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ExitOpGenericAdaptorBase(ExitOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ExitOpGenericAdaptor : public detail::ExitOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ExitOpGenericAdaptorBase; +public: + ExitOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ExitOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ExitOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ExitOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getData() { + return (*getODSOperands(0).begin()); + } + + RangeT getControlInputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ExitOpAdaptor : public ExitOpGenericAdaptor<::mlir::ValueRange> { +public: + using ExitOpGenericAdaptor::ExitOpGenericAdaptor; + ExitOpAdaptor(ExitOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ExitOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::HasParent::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ExitOpAdaptor; + template + using GenericAdaptor = ExitOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf_executor.Exit"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getData(); + ::mlir::Operation::operand_range getControlInputs(); + ::mlir::OpOperand &getDataMutable(); + ::mlir::MutableOperandRange getControlInputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getOutput(); + ::mlir::Value getControl(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Type control, ::mlir::Value data, ::mlir::ValueRange controlInputs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value data, ::mlir::ValueRange controlInputs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace tf_executor +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::tf_executor::ExitOp) + +namespace mlir { +namespace tf_executor { + +//===----------------------------------------------------------------------===// +// ::mlir::tf_executor::FetchOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FetchOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FetchOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FetchOpGenericAdaptorBase(FetchOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class FetchOpGenericAdaptor : public detail::FetchOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FetchOpGenericAdaptorBase; +public: + FetchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FetchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FetchOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FetchOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getFetches() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FetchOpAdaptor : public FetchOpGenericAdaptor<::mlir::ValueRange> { +public: + using FetchOpGenericAdaptor::FetchOpGenericAdaptor; + FetchOpAdaptor(FetchOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FetchOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsTerminator> { +public: + using Op::Op; + using Op::print; + using Adaptor = FetchOpAdaptor; + template + using GenericAdaptor = FetchOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf_executor.fetch"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getFetches(); + ::mlir::MutableOperandRange getFetchesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange fetches); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace tf_executor +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::tf_executor::FetchOp) + +namespace mlir { +namespace tf_executor { + +//===----------------------------------------------------------------------===// +// ::mlir::tf_executor::GraphOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GraphOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + GraphOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + GraphOpGenericAdaptorBase(GraphOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Region &getBody(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class GraphOpGenericAdaptor : public detail::GraphOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GraphOpGenericAdaptorBase; +public: + GraphOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GraphOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GraphOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + GraphOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GraphOpAdaptor : public GraphOpGenericAdaptor<::mlir::ValueRange> { +public: + using GraphOpGenericAdaptor::GraphOpGenericAdaptor; + GraphOpAdaptor(GraphOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GraphOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = GraphOpAdaptor; + template + using GenericAdaptor = GraphOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf_executor.graph"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResults(); + ::mlir::Region &getBody(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange results); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); +public: + Block &GetBody() { return getOperation()->getRegion(0).front(); } + FetchOp GetFetch(); +}; +} // namespace tf_executor +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::tf_executor::GraphOp) + +namespace mlir { +namespace tf_executor { + +//===----------------------------------------------------------------------===// +// ::mlir::tf_executor::IslandOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IslandOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IslandOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IslandOpGenericAdaptorBase(IslandOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Region &getBody(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class IslandOpGenericAdaptor : public detail::IslandOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IslandOpGenericAdaptorBase; +public: + IslandOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IslandOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IslandOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IslandOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getControlInputs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IslandOpAdaptor : public IslandOpGenericAdaptor<::mlir::ValueRange> { +public: + using IslandOpGenericAdaptor::IslandOpGenericAdaptor; + IslandOpAdaptor(IslandOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IslandOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::HasParent::Impl, ::mlir::OpTrait::SingleBlock, ::mlir::OpTrait::SingleBlockImplicitTerminator::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = IslandOpAdaptor; + template + using GenericAdaptor = IslandOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf_executor.island"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getControlInputs(); + ::mlir::MutableOperandRange getControlInputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutputs(); + ::mlir::Value getControl(); + ::mlir::Region &getBody(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outputs, ::mlir::Type control, ::mlir::ValueRange controlInputs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); +public: + Block &GetBody() { return getOperation()->getRegion(0).front(); } + YieldOp GetYield(); + bool WrapsSingleOp(); +}; +} // namespace tf_executor +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::tf_executor::IslandOp) + +namespace mlir { +namespace tf_executor { + +//===----------------------------------------------------------------------===// +// ::mlir::tf_executor::LoopCondOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LoopCondOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LoopCondOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LoopCondOpGenericAdaptorBase(LoopCondOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class LoopCondOpGenericAdaptor : public detail::LoopCondOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LoopCondOpGenericAdaptorBase; +public: + LoopCondOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LoopCondOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LoopCondOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LoopCondOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getControlInputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LoopCondOpAdaptor : public LoopCondOpGenericAdaptor<::mlir::ValueRange> { +public: + using LoopCondOpGenericAdaptor::LoopCondOpGenericAdaptor; + LoopCondOpAdaptor(LoopCondOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LoopCondOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::HasParent::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LoopCondOpAdaptor; + template + using GenericAdaptor = LoopCondOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf_executor.LoopCond"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::Operation::operand_range getControlInputs(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::MutableOperandRange getControlInputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Value getControl(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Type control, ::mlir::Value input, ::mlir::ValueRange controlInputs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::ValueRange controlInputs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace tf_executor +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::tf_executor::LoopCondOp) + +namespace mlir { +namespace tf_executor { + +//===----------------------------------------------------------------------===// +// ::mlir::tf_executor::MergeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MergeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MergeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MergeOpGenericAdaptorBase(MergeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MergeOpGenericAdaptor : public detail::MergeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MergeOpGenericAdaptorBase; +public: + MergeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MergeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MergeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MergeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputsAndControl() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MergeOpAdaptor : public MergeOpGenericAdaptor<::mlir::ValueRange> { +public: + using MergeOpGenericAdaptor::MergeOpGenericAdaptor; + MergeOpAdaptor(MergeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MergeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::HasParent::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MergeOpAdaptor; + template + using GenericAdaptor = MergeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf_executor.Merge"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputsAndControl(); + ::mlir::MutableOperandRange getInputsAndControlMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::TypedValue<::mlir::TensorType> getValueIndex(); + ::mlir::Value getControl(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Type value_index, ::mlir::Type control, ::mlir::ValueRange inputs_and_control); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); +public: +}; +} // namespace tf_executor +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::tf_executor::MergeOp) + +namespace mlir { +namespace tf_executor { + +//===----------------------------------------------------------------------===// +// ::mlir::tf_executor::NextIterationSinkOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class NextIterationSinkOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + NextIterationSinkOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + NextIterationSinkOpGenericAdaptorBase(NextIterationSinkOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class NextIterationSinkOpGenericAdaptor : public detail::NextIterationSinkOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::NextIterationSinkOpGenericAdaptorBase; +public: + NextIterationSinkOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + NextIterationSinkOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : NextIterationSinkOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + NextIterationSinkOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getToken() { + return (*getODSOperands(0).begin()); + } + + ValueT getInput() { + return (*getODSOperands(1).begin()); + } + + RangeT getControlInputs() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class NextIterationSinkOpAdaptor : public NextIterationSinkOpGenericAdaptor<::mlir::ValueRange> { +public: + using NextIterationSinkOpGenericAdaptor::NextIterationSinkOpGenericAdaptor; + NextIterationSinkOpAdaptor(NextIterationSinkOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class NextIterationSinkOp : public ::mlir::Op::Impl, ::mlir::OpTrait::HasParent::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = NextIterationSinkOpAdaptor; + template + using GenericAdaptor = NextIterationSinkOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf_executor.NextIteration.Sink"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getToken(); + ::mlir::Value getInput(); + ::mlir::Operation::operand_range getControlInputs(); + ::mlir::OpOperand &getTokenMutable(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::MutableOperandRange getControlInputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value token, ArrayRef operands, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value token, ::mlir::Value input, ::mlir::ValueRange controlInputs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value token, ::mlir::Value input, ::mlir::ValueRange controlInputs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: + NextIterationSourceOp GetSource(); +}; +} // namespace tf_executor +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::tf_executor::NextIterationSinkOp) + +namespace mlir { +namespace tf_executor { + +//===----------------------------------------------------------------------===// +// ::mlir::tf_executor::NextIterationSourceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class NextIterationSourceOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + NextIterationSourceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + NextIterationSourceOpGenericAdaptorBase(NextIterationSourceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class NextIterationSourceOpGenericAdaptor : public detail::NextIterationSourceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::NextIterationSourceOpGenericAdaptorBase; +public: + NextIterationSourceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + NextIterationSourceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : NextIterationSourceOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + NextIterationSourceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class NextIterationSourceOpAdaptor : public NextIterationSourceOpGenericAdaptor<::mlir::ValueRange> { +public: + using NextIterationSourceOpGenericAdaptor::NextIterationSourceOpGenericAdaptor; + NextIterationSourceOpAdaptor(NextIterationSourceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class NextIterationSourceOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::HasParent::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = NextIterationSourceOpAdaptor; + template + using GenericAdaptor = NextIterationSourceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf_executor.NextIteration.Source"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getOutput(); + ::mlir::Value getToken(); + ::mlir::Value getControl(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type result_type, ArrayRef attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Type token, ::mlir::Type control); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: + NextIterationSinkOp GetSink() { + return cast(*getToken().user_begin()); + } +}; +} // namespace tf_executor +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::tf_executor::NextIterationSourceOp) + +namespace mlir { +namespace tf_executor { + +//===----------------------------------------------------------------------===// +// ::mlir::tf_executor::SwitchNOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SwitchNOpGenericAdaptorBase { +public: + struct Properties { + using num_outsTy = ::mlir::IntegerAttr; + num_outsTy num_outs; + + auto getNumOuts() { + auto &propStorage = this->num_outs; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setNumOuts(const ::mlir::IntegerAttr &propValue) { + this->num_outs = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.num_outs == this->num_outs && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + SwitchNOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + SwitchNOpGenericAdaptorBase(SwitchNOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getNumOutsAttr(); + uint64_t getNumOuts(); +}; +} // namespace detail +template +class SwitchNOpGenericAdaptor : public detail::SwitchNOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SwitchNOpGenericAdaptorBase; +public: + SwitchNOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SwitchNOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SwitchNOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + SwitchNOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getData() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndex() { + return (*getODSOperands(1).begin()); + } + + RangeT getControlInputs() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SwitchNOpAdaptor : public SwitchNOpGenericAdaptor<::mlir::ValueRange> { +public: + using SwitchNOpGenericAdaptor::SwitchNOpGenericAdaptor; + SwitchNOpAdaptor(SwitchNOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SwitchNOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<2>::Impl, ::mlir::OpTrait::HasParent::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SwitchNOpAdaptor; + template + using GenericAdaptor = SwitchNOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("num_outs")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNumOutsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNumOutsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf_executor._SwitchN"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getData(); + ::mlir::TypedValue<::mlir::TensorType> getIndex(); + ::mlir::Operation::operand_range getControlInputs(); + ::mlir::OpOperand &getDataMutable(); + ::mlir::OpOperand &getIndexMutable(); + ::mlir::MutableOperandRange getControlInputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutputs(); + ::mlir::Value getControl(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getNumOutsAttr(); + uint64_t getNumOuts(); + void setNumOutsAttr(::mlir::IntegerAttr attr); + void setNumOuts(uint64_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outputs, ::mlir::Type control, ::mlir::Value data, ::mlir::Value index, ::mlir::ValueRange controlInputs, ::mlir::IntegerAttr num_outs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value data, ::mlir::Value index, ::mlir::ValueRange controlInputs, ::mlir::IntegerAttr num_outs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outputs, ::mlir::Type control, ::mlir::Value data, ::mlir::Value index, ::mlir::ValueRange controlInputs, uint64_t num_outs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value data, ::mlir::Value index, ::mlir::ValueRange controlInputs, uint64_t num_outs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace tf_executor +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::tf_executor::SwitchNOp) + +namespace mlir { +namespace tf_executor { + +//===----------------------------------------------------------------------===// +// ::mlir::tf_executor::SwitchOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SwitchOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SwitchOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SwitchOpGenericAdaptorBase(SwitchOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SwitchOpGenericAdaptor : public detail::SwitchOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SwitchOpGenericAdaptorBase; +public: + SwitchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SwitchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SwitchOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SwitchOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getData() { + return (*getODSOperands(0).begin()); + } + + ValueT getPredicate() { + return (*getODSOperands(1).begin()); + } + + RangeT getControlInputs() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SwitchOpAdaptor : public SwitchOpGenericAdaptor<::mlir::ValueRange> { +public: + using SwitchOpGenericAdaptor::SwitchOpGenericAdaptor; + SwitchOpAdaptor(SwitchOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SwitchOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<2>::Impl, ::mlir::OpTrait::HasParent::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SwitchOpAdaptor; + template + using GenericAdaptor = SwitchOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf_executor.Switch"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getData(); + ::mlir::TypedValue<::mlir::TensorType> getPredicate(); + ::mlir::Operation::operand_range getControlInputs(); + ::mlir::OpOperand &getDataMutable(); + ::mlir::OpOperand &getPredicateMutable(); + ::mlir::MutableOperandRange getControlInputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getFalseOutput(); + ::mlir::Value getTrueOutput(); + ::mlir::Value getControl(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type falseOutput, ::mlir::Type trueOutput, ::mlir::Type control, ::mlir::Value data, ::mlir::Value predicate, ::mlir::ValueRange controlInputs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value data, ::mlir::Value predicate, ::mlir::ValueRange controlInputs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace tf_executor +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::tf_executor::SwitchOp) + +namespace mlir { +namespace tf_executor { + +//===----------------------------------------------------------------------===// +// ::mlir::tf_executor::YieldOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class YieldOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + YieldOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + YieldOpGenericAdaptorBase(YieldOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class YieldOpGenericAdaptor : public detail::YieldOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::YieldOpGenericAdaptorBase; +public: + YieldOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + YieldOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : YieldOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + YieldOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getFetches() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class YieldOpAdaptor : public YieldOpGenericAdaptor<::mlir::ValueRange> { +public: + using YieldOpGenericAdaptor::YieldOpGenericAdaptor; + YieldOpAdaptor(YieldOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class YieldOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsTerminator> { +public: + using Op::Op; + using Op::print; + using Adaptor = YieldOpAdaptor; + template + using GenericAdaptor = YieldOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf_executor.yield"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getFetches(); + ::mlir::MutableOperandRange getFetchesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange fetches); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace tf_executor +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::tf_executor::YieldOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_op_interfaces.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_op_interfaces.h new file mode 100644 index 0000000000000000000000000000000000000000..db8208893e73513e0ad81225fc35c24292adb1a9 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_op_interfaces.h @@ -0,0 +1,166 @@ +/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_OP_INTERFACES_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_OP_INTERFACES_H_ + +#include + +#include "llvm/ADT/DenseMapInfo.h" +#include "llvm/ADT/Hashing.h" +#include "llvm/ADT/StringRef.h" +#include "mlir/IR/Attributes.h" // from @llvm-project +#include "mlir/IR/OpImplementation.h" // from @llvm-project +#include "mlir/IR/Operation.h" // from @llvm-project +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_structs.h" +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_verifiers.h" +#include "tensorflow/core/framework/resource_mgr.h" + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// TensorFlow Contraction Fusion. +//===----------------------------------------------------------------------===// + +struct ContractionFusion { + explicit ContractionFusion( + StringRef output_kernel, ArrayRef additional_arguments = {}, + ArrayRef additional_attributes = {}) + : output_kernel(output_kernel.str()), + additional_arguments(additional_arguments.begin(), + additional_arguments.end()), + additional_attributes(additional_attributes.begin(), + additional_attributes.end()) {} + + // Name of the output kernel implementing the contraction fusion. + std::string output_kernel; + + // Indices of additional arguments that will be forwarded to the fused + // operation (e.g. forward bias vector if fusing BiasAdd operation). + SmallVector additional_arguments; + + // Add additional attributes to the fused node. + SmallVector additional_attributes; +}; + +//===----------------------------------------------------------------------===// +// TensorFlow Resource Handles. +//===----------------------------------------------------------------------===// + +inline bool IsResourceHandleAnonymous(StringRef name) { + return name == ::tensorflow::ResourceHandle::ANONYMOUS_NAME; +} + +// Helper struct representing an identifier for a resource handle. For resource +// handles created explicitly and shared across resource allocator ops, +// `container`, `name`, and `device` can be set. If an resource handle is tied +// to an instance of an operation (e.g. TensorFlow runtime operation caching), +// `op` can be set instead. +struct ResourceHandle { + ResourceHandle(StringRef container, StringRef name, StringRef device, + Operation* op) + : container(container), name(name), device(device), op(op) {} + + bool operator==(const ResourceHandle& rhs) const { + return container == rhs.container && name == rhs.name && + device == rhs.device && op == rhs.op; + } + + // Make ResourceHandle hashable. + friend ::llvm::hash_code hash_value(const ResourceHandle& resource_handle); + + StringRef container; + StringRef name; + StringRef device; + Operation* op = nullptr; +}; + +// Make ResourceHandle hashable. +inline ::llvm::hash_code hash_value(const ResourceHandle& resource_handle) { + return ::llvm::hash_combine(resource_handle.container, resource_handle.name, + resource_handle.device, resource_handle.op); +} + +// Helper struct holding a resource handle value and unique id associated to the +// resource handle. +struct ResourceHandleValueAndId { + ResourceHandleValueAndId(Value value, int64_t id) : value(value), id(id) {} + + Value value; + int64_t id = -1; +}; + +//===----------------------------------------------------------------------===// +// TF op helper functions for handling resource handles and ids. +//===----------------------------------------------------------------------===// + +// Returns device of op if present. If op has no device set, an empty string ref +// is returned instead. +llvm::StringRef GetDeviceOrEmpty(Operation* op); + +// Returns resource handle value and id for resource op based on attributes. If +// a resource handle is anonymous, a new id is always returned. +ResourceHandleValueAndId GetResourceHandleValueAndIdBase( + llvm::StringRef container, llvm::StringRef shared_name, + llvm::StringRef device, Value resource, + llvm::SmallDenseMap& resource_handle_id_map, + int64_t& next_id); + +// Shape functions for ops that are using TF_SameOperandsAndResultTypeResolveRef +// and have at least one operand, result type can be inferred using the first +// operand's type. + +#define INFER_RETURN_TYPE_COMPONENTS_FROM_OPERANDS(Op) \ + LogicalResult Op::inferReturnTypeComponents( \ + MLIRContext* context, std::optional location, \ + ValueShapeRange operands, DictionaryAttr attributes, \ + OpaqueProperties properties, RegionRange regions, \ + SmallVectorImpl& inferredReturnShapes) { \ + return inferReturnTypeComponentsFromOperands( \ + context, location, operands, attributes, properties, regions, \ + inferredReturnShapes); \ + } + +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_op_interfaces.h.inc" +} // namespace TF +} // namespace mlir + +namespace llvm { +template <> +struct DenseMapInfo { + static mlir::TF::ResourceHandle getEmptyKey() { + return {/*container=*/"", /*name=*/"", /*device=*/"", + /*op=*/DenseMapInfo::getEmptyKey()}; + } + + static mlir::TF::ResourceHandle getTombstoneKey() { + return {/*container=*/"", /*name=*/"", /*device=*/"", + /*op=*/DenseMapInfo::getTombstoneKey()}; + } + + static unsigned getHashValue( + const mlir::TF::ResourceHandle& resource_handle) { + return mlir::TF::hash_value(resource_handle); + } + + static bool isEqual(const mlir::TF::ResourceHandle& lhs, + const mlir::TF::ResourceHandle& rhs) { + return lhs == rhs; + } +}; +} // namespace llvm + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_OP_INTERFACES_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_op_interfaces.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_op_interfaces.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..5f3072e6db504da2f352c6654b8bca6af227dd5e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_op_interfaces.h.inc @@ -0,0 +1,333 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Interface Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +class LayoutSensitiveInterface; +namespace detail { +struct LayoutSensitiveInterfaceInterfaceTraits { + struct Concept { + /// The methods defined by the interface. + StringRef (*getDataFormat)(const Concept *impl, ::mlir::Operation *); + StringRef (*data_format)(const Concept *impl, ::mlir::Operation *); + SmallVector (*GetLayoutDependentArgs)(const Concept *impl, ::mlir::Operation *); + SmallVector (*GetLayoutDependentResults)(const Concept *impl, ::mlir::Operation *); + StringRef (*GetOptimalLayout)(const Concept *impl, ::mlir::Operation *, const RuntimeDevices&); + LogicalResult (*UpdateDataFormat)(const Concept *impl, ::mlir::Operation *, StringRef); + }; + template + class Model : public Concept { + public: + using Interface = LayoutSensitiveInterface; + Model() : Concept{getDataFormat, data_format, GetLayoutDependentArgs, GetLayoutDependentResults, GetOptimalLayout, UpdateDataFormat} {} + + static inline StringRef getDataFormat(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline StringRef data_format(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline SmallVector GetLayoutDependentArgs(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline SmallVector GetLayoutDependentResults(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline StringRef GetOptimalLayout(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, const RuntimeDevices& devices); + static inline LogicalResult UpdateDataFormat(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, StringRef data_format); + }; + template + class FallbackModel : public Concept { + public: + using Interface = LayoutSensitiveInterface; + FallbackModel() : Concept{getDataFormat, data_format, GetLayoutDependentArgs, GetLayoutDependentResults, GetOptimalLayout, UpdateDataFormat} {} + + static inline StringRef getDataFormat(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline StringRef data_format(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline SmallVector GetLayoutDependentArgs(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline SmallVector GetLayoutDependentResults(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline StringRef GetOptimalLayout(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, const RuntimeDevices& devices); + static inline LogicalResult UpdateDataFormat(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, StringRef data_format); + }; + template + class ExternalModel : public FallbackModel { + public: + using ConcreteEntity = ConcreteOp; + }; +};template +struct LayoutSensitiveInterfaceTrait; + +} // namespace detail +class LayoutSensitiveInterface : public ::mlir::OpInterface { +public: + using ::mlir::OpInterface::OpInterface; + template + struct Trait : public detail::LayoutSensitiveInterfaceTrait {}; + /// Returns current operation data format (data layout). + StringRef getDataFormat(); + /// Deprecated method that returns current operation data format (data layout). + StringRef data_format(); + /// Returns indices of layout dependent arguments. + SmallVector GetLayoutDependentArgs(); + /// Returns indices of layout dependent results. + SmallVector GetLayoutDependentResults(); + /// Returns the optimal data layout based on the available devices. + StringRef GetOptimalLayout(const RuntimeDevices& devices); + /// Updates operation attributes and operands to account for the updated + /// data format. If data format is not supported, must return failure. + LogicalResult UpdateDataFormat(StringRef data_format); +}; +namespace detail { + template + struct LayoutSensitiveInterfaceTrait : public ::mlir::OpInterface::Trait { + static ::mlir::LogicalResult verifyTrait(::mlir::Operation *op) { + return VerifyLayoutSensitiveInterface(op); + } + }; +}// namespace detail +class FoldOperandsTransposeInterface; +namespace detail { +struct FoldOperandsTransposeInterfaceInterfaceTraits { + struct Concept { + /// The methods defined by the interface. + SmallVector (*GetLayoutDependentArgs)(const Concept *impl, ::mlir::Operation *); + SmallVector (*GetLayoutDependentResults)(const Concept *impl, ::mlir::Operation *); + LogicalResult (*FoldOperandsPermutation)(const Concept *impl, ::mlir::Operation *, ArrayRef); + }; + template + class Model : public Concept { + public: + using Interface = FoldOperandsTransposeInterface; + Model() : Concept{GetLayoutDependentArgs, GetLayoutDependentResults, FoldOperandsPermutation} {} + + static inline SmallVector GetLayoutDependentArgs(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline SmallVector GetLayoutDependentResults(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline LogicalResult FoldOperandsPermutation(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ArrayRef permutation); + }; + template + class FallbackModel : public Concept { + public: + using Interface = FoldOperandsTransposeInterface; + FallbackModel() : Concept{GetLayoutDependentArgs, GetLayoutDependentResults, FoldOperandsPermutation} {} + + static inline SmallVector GetLayoutDependentArgs(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline SmallVector GetLayoutDependentResults(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + static inline LogicalResult FoldOperandsPermutation(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ArrayRef permutation); + }; + template + class ExternalModel : public FallbackModel { + public: + using ConcreteEntity = ConcreteOp; + }; +};template +struct FoldOperandsTransposeInterfaceTrait; + +} // namespace detail +class FoldOperandsTransposeInterface : public ::mlir::OpInterface { +public: + using ::mlir::OpInterface::OpInterface; + template + struct Trait : public detail::FoldOperandsTransposeInterfaceTrait {}; + /// Returns indices of layout dependent arguments. + SmallVector GetLayoutDependentArgs(); + /// Returns indices of layout dependent results. + SmallVector GetLayoutDependentResults(); + /// Updates operation attributes and operands to account for the folded + /// permutation. If folding of permutation is not possible, must return + /// failure. + LogicalResult FoldOperandsPermutation(ArrayRef permutation); +}; +namespace detail { + template + struct FoldOperandsTransposeInterfaceTrait : public ::mlir::OpInterface::Trait { + static ::mlir::LogicalResult verifyTrait(::mlir::Operation *op) { + return VerifyFoldOperandsTransposeInterface(op); + } + }; +}// namespace detail +class ResourceHandleAllocatorInterface; +namespace detail { +struct ResourceHandleAllocatorInterfaceInterfaceTraits { + struct Concept { + /// The methods defined by the interface. + llvm::SmallVector (*GetResourceHandleValueAndIdList)(const Concept *impl, ::mlir::Operation *, llvm::SmallDenseMap&, int64_t&); + }; + template + class Model : public Concept { + public: + using Interface = ResourceHandleAllocatorInterface; + Model() : Concept{GetResourceHandleValueAndIdList} {} + + static inline llvm::SmallVector GetResourceHandleValueAndIdList(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, llvm::SmallDenseMap& resource_handle_id_map, int64_t& next_id); + }; + template + class FallbackModel : public Concept { + public: + using Interface = ResourceHandleAllocatorInterface; + FallbackModel() : Concept{GetResourceHandleValueAndIdList} {} + + static inline llvm::SmallVector GetResourceHandleValueAndIdList(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, llvm::SmallDenseMap& resource_handle_id_map, int64_t& next_id); + }; + template + class ExternalModel : public FallbackModel { + public: + using ConcreteEntity = ConcreteOp; + }; +};template +struct ResourceHandleAllocatorInterfaceTrait; + +} // namespace detail +class ResourceHandleAllocatorInterface : public ::mlir::OpInterface { +public: + using ::mlir::OpInterface::OpInterface; + template + struct Trait : public detail::ResourceHandleAllocatorInterfaceTrait {}; + /// Returns resource handle values and the unique ids associated with + /// the resource handles for this op. The handles should be created + /// for only the resource tensors in the results of the op. If a + /// resource handle is reused, then an existing id will be + /// returned. The order of the resource handles in the returned + /// vector are the order of those resources in the results of the + /// op. + llvm::SmallVector GetResourceHandleValueAndIdList(llvm::SmallDenseMap& resource_handle_id_map, int64_t& next_id); +}; +namespace detail { + template + struct ResourceHandleAllocatorInterfaceTrait : public ::mlir::OpInterface::Trait { + }; +}// namespace detail +class GetResourceInstanceInterface; +namespace detail { +struct GetResourceInstanceInterfaceInterfaceTraits { + struct Concept { + /// The methods defined by the interface. + std::optional (*GetResourceInstanceStr)(const Concept *impl, ::mlir::Operation *); + }; + template + class Model : public Concept { + public: + using Interface = GetResourceInstanceInterface; + Model() : Concept{GetResourceInstanceStr} {} + + static inline std::optional GetResourceInstanceStr(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + }; + template + class FallbackModel : public Concept { + public: + using Interface = GetResourceInstanceInterface; + FallbackModel() : Concept{GetResourceInstanceStr} {} + + static inline std::optional GetResourceInstanceStr(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + }; + template + class ExternalModel : public FallbackModel { + public: + using ConcreteEntity = ConcreteOp; + }; +};template +struct GetResourceInstanceInterfaceTrait; + +} // namespace detail +class GetResourceInstanceInterface : public ::mlir::OpInterface { +public: + using ::mlir::OpInterface::OpInterface; + template + struct Trait : public detail::GetResourceInstanceInterfaceTrait {}; + /// Returns a string corresponding to the resource instance + /// accessed by this op, or `std::nullopt` if the resource should + /// be ignored. The implementation must guarantee that the + /// mapping between resource instances and strings is bijective, + /// i.e., two op instances should return the same string if and + /// only if they access the same resource. The interface should + /// only be used for ops that access exactly one op-based resource + /// (see `tf_op_base.td` for details). + std::optional GetResourceInstanceStr(); +}; +namespace detail { + template + struct GetResourceInstanceInterfaceTrait : public ::mlir::OpInterface::Trait { + }; +}// namespace detail +template +StringRef detail::LayoutSensitiveInterfaceInterfaceTraits::Model::getDataFormat(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getDataFormat(); +} +template +StringRef detail::LayoutSensitiveInterfaceInterfaceTraits::Model::data_format(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getDataFormat(); +} +template +SmallVector detail::LayoutSensitiveInterfaceInterfaceTraits::Model::GetLayoutDependentArgs(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).GetLayoutDependentArgs(); +} +template +SmallVector detail::LayoutSensitiveInterfaceInterfaceTraits::Model::GetLayoutDependentResults(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).GetLayoutDependentResults(); +} +template +StringRef detail::LayoutSensitiveInterfaceInterfaceTraits::Model::GetOptimalLayout(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, const RuntimeDevices& devices) { + return (llvm::cast(tablegen_opaque_val)).GetOptimalLayout(devices); +} +template +LogicalResult detail::LayoutSensitiveInterfaceInterfaceTraits::Model::UpdateDataFormat(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, StringRef data_format) { + return (llvm::cast(tablegen_opaque_val)).UpdateDataFormat(data_format); +} +template +StringRef detail::LayoutSensitiveInterfaceInterfaceTraits::FallbackModel::getDataFormat(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getDataFormat(tablegen_opaque_val); +} +template +StringRef detail::LayoutSensitiveInterfaceInterfaceTraits::FallbackModel::data_format(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->data_format(tablegen_opaque_val); +} +template +SmallVector detail::LayoutSensitiveInterfaceInterfaceTraits::FallbackModel::GetLayoutDependentArgs(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->GetLayoutDependentArgs(tablegen_opaque_val); +} +template +SmallVector detail::LayoutSensitiveInterfaceInterfaceTraits::FallbackModel::GetLayoutDependentResults(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->GetLayoutDependentResults(tablegen_opaque_val); +} +template +StringRef detail::LayoutSensitiveInterfaceInterfaceTraits::FallbackModel::GetOptimalLayout(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, const RuntimeDevices& devices) { + return static_cast(impl)->GetOptimalLayout(tablegen_opaque_val, devices); +} +template +LogicalResult detail::LayoutSensitiveInterfaceInterfaceTraits::FallbackModel::UpdateDataFormat(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, StringRef data_format) { + return static_cast(impl)->UpdateDataFormat(tablegen_opaque_val, data_format); +} +template +SmallVector detail::FoldOperandsTransposeInterfaceInterfaceTraits::Model::GetLayoutDependentArgs(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).GetLayoutDependentArgs(); +} +template +SmallVector detail::FoldOperandsTransposeInterfaceInterfaceTraits::Model::GetLayoutDependentResults(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).GetLayoutDependentResults(); +} +template +LogicalResult detail::FoldOperandsTransposeInterfaceInterfaceTraits::Model::FoldOperandsPermutation(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ArrayRef permutation) { + return (llvm::cast(tablegen_opaque_val)).FoldOperandsPermutation(permutation); +} +template +SmallVector detail::FoldOperandsTransposeInterfaceInterfaceTraits::FallbackModel::GetLayoutDependentArgs(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->GetLayoutDependentArgs(tablegen_opaque_val); +} +template +SmallVector detail::FoldOperandsTransposeInterfaceInterfaceTraits::FallbackModel::GetLayoutDependentResults(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->GetLayoutDependentResults(tablegen_opaque_val); +} +template +LogicalResult detail::FoldOperandsTransposeInterfaceInterfaceTraits::FallbackModel::FoldOperandsPermutation(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, ArrayRef permutation) { + return static_cast(impl)->FoldOperandsPermutation(tablegen_opaque_val, permutation); +} +template +llvm::SmallVector detail::ResourceHandleAllocatorInterfaceInterfaceTraits::Model::GetResourceHandleValueAndIdList(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, llvm::SmallDenseMap& resource_handle_id_map, int64_t& next_id) { + return (llvm::cast(tablegen_opaque_val)).GetResourceHandleValueAndIdList(resource_handle_id_map, next_id); +} +template +llvm::SmallVector detail::ResourceHandleAllocatorInterfaceInterfaceTraits::FallbackModel::GetResourceHandleValueAndIdList(const Concept *impl, ::mlir::Operation *tablegen_opaque_val, llvm::SmallDenseMap& resource_handle_id_map, int64_t& next_id) { + return static_cast(impl)->GetResourceHandleValueAndIdList(tablegen_opaque_val, resource_handle_id_map, next_id); +} +template +std::optional detail::GetResourceInstanceInterfaceInterfaceTraits::Model::GetResourceInstanceStr(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).GetResourceInstanceStr(); +} +template +std::optional detail::GetResourceInstanceInterfaceInterfaceTraits::FallbackModel::GetResourceInstanceStr(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->GetResourceInstanceStr(tablegen_opaque_val); +} diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_ops.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_ops.h new file mode 100644 index 0000000000000000000000000000000000000000..f9fa3d13732451242efb9facb0cfcc6284105616 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_ops.h @@ -0,0 +1,50 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +// This file defines the operations used in the standard MLIR TensorFlow dialect +// after control dependences are raise to the standard form. + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_OPS_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_OPS_H_ + +#include "mlir/Dialect/Func/IR/FuncOps.h" // from @llvm-project +#include "mlir/Dialect/Traits.h" // from @llvm-project +#include "mlir/IR/Attributes.h" // from @llvm-project +#include "mlir/IR/Builders.h" // from @llvm-project +#include "mlir/IR/BuiltinOps.h" // from @llvm-project +#include "mlir/IR/BuiltinTypes.h" // from @llvm-project +#include "mlir/IR/Dialect.h" // from @llvm-project +#include "mlir/IR/Matchers.h" // from @llvm-project +#include "mlir/IR/OpImplementation.h" // from @llvm-project +#include "mlir/IR/TypeUtilities.h" // from @llvm-project +#include "mlir/Interfaces/CallInterfaces.h" // from @llvm-project +#include "mlir/Interfaces/ControlFlowInterfaces.h" // from @llvm-project +#include "mlir/Interfaces/DerivedAttributeOpInterface.h" // from @llvm-project +#include "mlir/Interfaces/InferTypeOpInterface.h" // from @llvm-project +#include "mlir/Interfaces/LoopLikeInterface.h" // from @llvm-project +#include "mlir/Interfaces/SideEffectInterfaces.h" // from @llvm-project +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_attributes.h" +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_dialect.h" +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_op_interfaces.h" +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_ops_a_m.h" +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_ops_n_z.h" +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_remaining_ops.h" +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_structs.h" +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_traits.h" +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_types.h" +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_verifiers.h" +#include "tensorflow/compiler/mlir/tensorflow/ir/tfrt_ops.h" + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_OPS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_ops_a_m.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_ops_a_m.h new file mode 100644 index 0000000000000000000000000000000000000000..2956174fa20c3c6eb8e94e41313f811e42ff2f0b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_ops_a_m.h @@ -0,0 +1,65 @@ +/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_OPS_A_M_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_OPS_A_M_H_ + +#include "mlir/Dialect/Func/IR/FuncOps.h" // from @llvm-project +#include "mlir/Dialect/Traits.h" // from @llvm-project +#include "mlir/IR/Attributes.h" // from @llvm-project +#include "mlir/IR/Builders.h" // from @llvm-project +#include "mlir/IR/BuiltinOps.h" // from @llvm-project +#include "mlir/IR/BuiltinTypes.h" // from @llvm-project +#include "mlir/IR/Dialect.h" // from @llvm-project +#include "mlir/IR/Matchers.h" // from @llvm-project +#include "mlir/IR/OpImplementation.h" // from @llvm-project +#include "mlir/IR/TypeUtilities.h" // from @llvm-project +#include "mlir/Interfaces/CallInterfaces.h" // from @llvm-project +#include "mlir/Interfaces/ControlFlowInterfaces.h" // from @llvm-project +#include "mlir/Interfaces/DerivedAttributeOpInterface.h" // from @llvm-project +#include "mlir/Interfaces/InferTypeOpInterface.h" // from @llvm-project +#include "mlir/Interfaces/LoopLikeInterface.h" // from @llvm-project +#include "mlir/Interfaces/SideEffectInterfaces.h" // from @llvm-project +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_attributes.h" +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_op_interfaces.h" +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_structs.h" +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_traits.h" +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_types.h" +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_verifiers.h" + +// IWYU pragma: private, include "third_party/tensorflow/compiler/mlir/tensorflow/ir/tf_ops.h" + +namespace mlir { +namespace TF { + +class YieldOp; + +} // namespace TF +} // namespace mlir + +// TODO(b/131258166): TensorFlow's mutex.h defines a `mutex_lock` macro, whose +// purpose is to catch bug on `tensorflow::mutex_lock`. We don't use +// `tensorflow::mutex_lock` here but we have ops (`tf.MutexLock` and +// `tf.ConsumeMutexLock`) with getter methods named as `mutex_lock()`. Need to +// undefine here to avoid expanding the getter symbol as macro when including +// both mutex.h and this header file. +#undef mutex_lock + +#define GET_OP_FWD_DEFINES +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_all_ops.h.inc" +#define GET_OP_CLASSES +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_ops_a_m.h.inc" + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_OPS_A_M_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_ops_a_m.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_ops_a_m.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..feb598771f30ce681b0d85a0655f4b009442dc37 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_ops_a_m.h.inc @@ -0,0 +1,54597 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: tf_ops.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#if defined(GET_OP_CLASSES) || defined(GET_OP_FWD_DEFINES) +#undef GET_OP_FWD_DEFINES +namespace mlir { +namespace TF { +class AbsOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AcosOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AcoshOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AddNOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AddOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AddV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AdjustContrastv2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AdjustHueOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AdjustSaturationOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AllOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AllToAllOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AngleOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AnonymousIteratorOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AnonymousIteratorV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AnonymousIteratorV3Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AnonymousMemoryCacheOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AnonymousMultiDeviceIteratorOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AnonymousMultiDeviceIteratorV3Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AnonymousRandomSeedGeneratorOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AnonymousSeedGeneratorOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AnyOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ApproxTopKOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ApproximateEqualOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ArgMaxOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ArgMinOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AsStringOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AsinOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AsinhOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AssertOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AssignAddVariableOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AssignOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AssignSubVariableOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AssignVariableOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class Atan2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AtanOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AtanhOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AvgPool3DGradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AvgPool3DOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AvgPoolGradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class AvgPoolOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class BatchDatasetV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class BatchFunctionOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class BatchMatMulOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class BatchMatMulV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class BatchMatMulV3Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class BatchNormWithGlobalNormalizationOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class BatchToSpaceNDOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class BatchToSpaceOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class BesselI0eOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class BesselI1eOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class BetaincOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class BiasAddGradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class BiasAddOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class BiasAddV1Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class BincountOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class BitcastOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class BitwiseAndOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class BitwiseOrOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class BitwiseXorOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class BoostedTreesBucketizeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class BroadcastArgsOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class BroadcastGradientArgsOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class BroadcastToOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class BucketizeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class CacheDatasetV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class CaseOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class CaseRegionOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class CastOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class CeilOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class CheckNumericsOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class CholeskyOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ClipByValueOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class CloseSummaryWriterOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class CollateTPUEmbeddingMemoryOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class CollectiveAllToAllV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class CollectiveAssignGroupV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class CollectiveBcastRecvOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class CollectiveBcastSendOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class CollectiveGatherOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class CollectiveGatherV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class CollectivePermuteOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class CollectiveReduceOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class CollectiveReduceScatterV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class CollectiveReduceV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ComplexAbsOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ComplexOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ConcatOffsetOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ConcatOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ConcatV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ConfigureAndInitializeGlobalTPUOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ConfigureDistributedTPUOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ConfigureTPUEmbeddingHostOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ConfigureTPUEmbeddingMemoryOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ConfigureTPUEmbeddingOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ConjOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ConjugateTransposeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ConnectTPUEmbeddingHostsOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ConstOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class Conv2DBackpropFilterOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class Conv2DBackpropFilterV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class Conv2DBackpropInputOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class Conv2DBackpropInputV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class Conv2DOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class Conv3DBackpropFilterOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class Conv3DBackpropFilterV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class Conv3DBackpropInputOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class Conv3DBackpropInputV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class Conv3DOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ConvOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ConvertToCooTensorOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class CosOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class CoshOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class CreateSummaryDbWriterOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class CreateSummaryFileWriterOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class CrossOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class CrossReplicaSumOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class CumprodOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class CumsumOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class CumulativeLogsumexpOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DataFormatDimMapOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DataFormatVecPermuteOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DebugIdentityV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DecodeAndCropJpegOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DecodeGifOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DecodeJpegOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DecodePaddedRawOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DecodePngOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DeleteIteratorOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DeleteMemoryCacheOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DeleteMultiDeviceIteratorOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DeleteRandomSeedGeneratorOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DeleteSeedGeneratorOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DepthToSpaceOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DepthwiseConv2dNativeBackpropFilterOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DepthwiseConv2dNativeBackpropInputOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DepthwiseConv2dNativeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DequantizeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DeserializeIteratorOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DeserializeSparseOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DestroyResourceOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DeviceIndexOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DiagOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DiagPartOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DigammaOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DisableCopyOnReadOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DivNoNanOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DivOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DummyMemoryCacheOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DummySeedGeneratorOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DynamicEnqueueTPUEmbeddingArbitraryTensorBatchOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DynamicPartitionOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class DynamicStitchOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class EinsumOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class EluGradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class EluOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class EmptyOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class EmptyTensorListOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class EncodePngOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class EnqueueTPUEmbeddingArbitraryTensorBatchOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class EnqueueTPUEmbeddingBatchOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class EnqueueTPUEmbeddingIntegerBatchOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class EnqueueTPUEmbeddingRaggedTensorBatchOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class EnqueueTPUEmbeddingSparseBatchOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class EnqueueTPUEmbeddingSparseTensorBatchOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class EnsureShapeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class EqualOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ErfOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ErfcOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ErfinvOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ExecuteTPUEmbeddingPartitionerOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ExpOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ExpandDimsOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class Expm1Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ExtractImagePatchesOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class FFT2DOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class FFT3DOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class FFTOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class FakeParamOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class FakeQuantWithMinMaxArgsGradientOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class FakeQuantWithMinMaxArgsOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class FakeQuantWithMinMaxVarsGradientOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class FakeQuantWithMinMaxVarsOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class FakeQuantWithMinMaxVarsPerChannelGradientOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class FakeQuantWithMinMaxVarsPerChannelOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class FillOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class FinalizeDatasetOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class FinalizeTPUEmbeddingOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class FlatMapDatasetOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class FloorDivOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class FloorModOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class FloorOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class FlushSummaryWriterOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class FusedBatchNormGradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class FusedBatchNormGradV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class FusedBatchNormGradV3Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class FusedBatchNormOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class FusedBatchNormV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class FusedBatchNormV3Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class GatherNdOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class GatherOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class GatherV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class GeneratorDatasetOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class GetMinibatchSplitsWithPhysicalReplicaOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class GetMinibatchesInCsrWithPhysicalReplicaOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class GlobalIterIdOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class GreaterEqualOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class GreaterOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class HSVToRGBOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class HashTableOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class HashTableV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class IFFT2DOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class IFFT3DOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class IFFTOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class IRFFT2DOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class IRFFT3DOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class IRFFTOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class IdentityNOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class IdentityOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class IfOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class IfRegionOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class IgammaGradAOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class IgammaOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class IgammacOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ImagOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ImportEventOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class InTopKV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class InfeedDequeueOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class InfeedDequeueTupleOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class InfeedEnqueueTupleOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class InitializeTableFromDatasetOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class InitializeTableFromTextFileOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class InitializeTableFromTextFileV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class InitializeTableOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class InitializeTableV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class InplaceAddOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class InplaceUpdateOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class InvOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class InvertOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class InvertPermutationOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class IsFiniteOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class IsInfOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class IsNanOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class IteratorFromStringHandleOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class IteratorFromStringHandleV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class IteratorGetNextAsOptionalOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class IteratorGetNextOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class IteratorGetNextSyncOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class IteratorOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class IteratorToStringHandleOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class IteratorV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class KthOrderStatisticOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class L2LossOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LRNGradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LRNOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LeakyReluGradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LeakyReluOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LeftShiftOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LegacyCallOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LessEqualOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LessOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LgammaOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LinSpaceOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ListDiffOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LoadTPUEmbeddingADAMParametersGradAccumDebugOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LoadTPUEmbeddingADAMParametersOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LoadTPUEmbeddingAdadeltaParametersGradAccumDebugOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LoadTPUEmbeddingAdadeltaParametersOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LoadTPUEmbeddingAdagradParametersGradAccumDebugOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LoadTPUEmbeddingAdagradParametersOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LoadTPUEmbeddingCenteredRMSPropParametersOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LoadTPUEmbeddingFTRLParametersGradAccumDebugOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LoadTPUEmbeddingFTRLParametersOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LoadTPUEmbeddingMDLAdagradLightParametersOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LoadTPUEmbeddingMomentumParametersGradAccumDebugOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LoadTPUEmbeddingMomentumParametersOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LoadTPUEmbeddingProximalAdagradParametersGradAccumDebugOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LoadTPUEmbeddingProximalAdagradParametersOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LoadTPUEmbeddingProximalYogiParametersGradAccumDebugOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LoadTPUEmbeddingProximalYogiParametersOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LoadTPUEmbeddingRMSPropParametersGradAccumDebugOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LoadTPUEmbeddingRMSPropParametersOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LoadTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LoadTPUEmbeddingStochasticGradientDescentParametersOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class Log1pOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LogOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LogSoftmaxOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LogicalAndOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LogicalNotOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LogicalOrOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LookupTableExportV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LookupTableFindOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LookupTableFindV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LookupTableImportV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LookupTableInsertV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LookupTableRemoveV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LookupTableSizeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LookupTableSizeV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class LowerBoundOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MakeIteratorOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MakeUniqueOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MapAndBatchDatasetOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MapDatasetOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MatMulOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MatrixBandPartOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MatrixDiagOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MatrixDiagPartV3Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MatrixDiagV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MatrixDiagV3Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MatrixInverseOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MatrixSetDiagOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MatrixSetDiagV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MatrixSetDiagV3Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MatrixSolveOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MatrixTriangularSolveOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MaxOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MaxPool3DGradGradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MaxPool3DGradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MaxPool3DOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MaxPoolGradGradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MaxPoolGradGradV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MaxPoolGradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MaxPoolGradV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MaxPoolOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MaxPoolV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MaximumOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MeanOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MergeSummaryOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MergeV2CheckpointsOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MinOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MinimumOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MirrorPadGradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MirrorPadOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MlirLocalVarOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MlirPassthroughOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ModOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ModelDatasetOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MulNoNanOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MulOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MultiDeviceIteratorFromStringHandleOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MultiDeviceIteratorGetNextFromShardOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MultiDeviceIteratorInitOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MultiDeviceIteratorOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MultiDeviceIteratorToStringHandleOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MultinomialOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MutableDenseHashTableV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MutableHashTableOfTensorsV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class MutableHashTableV2Op; +} // namespace TF +} // namespace mlir +#endif + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AbsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AbsOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AbsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AbsOpGenericAdaptorBase(AbsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AbsOpGenericAdaptor : public detail::AbsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AbsOpGenericAdaptorBase; +public: + AbsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AbsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AbsOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AbsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AbsOpAdaptor : public AbsOpGenericAdaptor<::mlir::ValueRange> { +public: + using AbsOpGenericAdaptor::AbsOpGenericAdaptor; + AbsOpAdaptor(AbsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AbsOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::IsIdempotent, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AbsOpAdaptor; + template + using GenericAdaptor = AbsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Abs"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AbsOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AcosOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AcosOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AcosOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AcosOpGenericAdaptorBase(AcosOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AcosOpGenericAdaptor : public detail::AcosOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AcosOpGenericAdaptorBase; +public: + AcosOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AcosOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AcosOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AcosOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AcosOpAdaptor : public AcosOpGenericAdaptor<::mlir::ValueRange> { +public: + using AcosOpGenericAdaptor::AcosOpGenericAdaptor; + AcosOpAdaptor(AcosOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AcosOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AcosOpAdaptor; + template + using GenericAdaptor = AcosOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Acos"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AcosOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AcoshOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AcoshOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AcoshOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AcoshOpGenericAdaptorBase(AcoshOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AcoshOpGenericAdaptor : public detail::AcoshOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AcoshOpGenericAdaptorBase; +public: + AcoshOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AcoshOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AcoshOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AcoshOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AcoshOpAdaptor : public AcoshOpGenericAdaptor<::mlir::ValueRange> { +public: + using AcoshOpGenericAdaptor::AcoshOpGenericAdaptor; + AcoshOpAdaptor(AcoshOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AcoshOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AcoshOpAdaptor; + template + using GenericAdaptor = AcoshOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Acosh"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AcoshOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AddNOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AddNOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AddNOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AddNOpGenericAdaptorBase(AddNOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AddNOpGenericAdaptor : public detail::AddNOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AddNOpGenericAdaptorBase; +public: + AddNOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AddNOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AddNOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AddNOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AddNOpAdaptor : public AddNOpGenericAdaptor<::mlir::ValueRange> { +public: + using AddNOpGenericAdaptor::AddNOpGenericAdaptor; + AddNOpAdaptor(AddNOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AddNOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsCommutative, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AddNOpAdaptor; + template + using GenericAdaptor = AddNOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("N"), ::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.AddN"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::MutableOperandRange getInputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSum(); + size_t getN(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type sum, ::mlir::ValueRange inputs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AddNOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AddOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AddOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AddOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AddOpGenericAdaptorBase(AddOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AddOpGenericAdaptor : public detail::AddOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AddOpGenericAdaptorBase; +public: + AddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AddOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AddOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AddOpAdaptor : public AddOpGenericAdaptor<::mlir::ValueRange> { +public: + using AddOpGenericAdaptor::AddOpGenericAdaptor; + AddOpAdaptor(AddOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AddOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::OpTrait::TF::LayoutAgnostic, ::mlir::OpTrait::TF::SameOperandsAndResultElementTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AddOpAdaptor; + template + using GenericAdaptor = AddOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Add"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AddOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AddV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AddV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AddV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AddV2OpGenericAdaptorBase(AddV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AddV2OpGenericAdaptor : public detail::AddV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AddV2OpGenericAdaptorBase; +public: + AddV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AddV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AddV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AddV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AddV2OpAdaptor : public AddV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using AddV2OpGenericAdaptor::AddV2OpGenericAdaptor; + AddV2OpAdaptor(AddV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AddV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsCommutative, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::OpTrait::TF::CwiseBinary, ::mlir::OpTrait::TF::LayoutAgnostic, ::mlir::OpTrait::TF::SameOperandsAndResultElementTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AddV2OpAdaptor; + template + using GenericAdaptor = AddV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.AddV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AddV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AdjustContrastv2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AdjustContrastv2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AdjustContrastv2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AdjustContrastv2OpGenericAdaptorBase(AdjustContrastv2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AdjustContrastv2OpGenericAdaptor : public detail::AdjustContrastv2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AdjustContrastv2OpGenericAdaptorBase; +public: + AdjustContrastv2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AdjustContrastv2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AdjustContrastv2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AdjustContrastv2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getImages() { + return (*getODSOperands(0).begin()); + } + + ValueT getContrastFactor() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AdjustContrastv2OpAdaptor : public AdjustContrastv2OpGenericAdaptor<::mlir::ValueRange> { +public: + using AdjustContrastv2OpGenericAdaptor::AdjustContrastv2OpGenericAdaptor; + AdjustContrastv2OpAdaptor(AdjustContrastv2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AdjustContrastv2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AdjustContrastv2OpAdaptor; + template + using GenericAdaptor = AdjustContrastv2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.AdjustContrastv2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getImages(); + ::mlir::TypedValue<::mlir::TensorType> getContrastFactor(); + ::mlir::OpOperand &getImagesMutable(); + ::mlir::OpOperand &getContrastFactorMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value images, ::mlir::Value contrast_factor); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value images, ::mlir::Value contrast_factor); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AdjustContrastv2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AdjustHueOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AdjustHueOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AdjustHueOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AdjustHueOpGenericAdaptorBase(AdjustHueOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AdjustHueOpGenericAdaptor : public detail::AdjustHueOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AdjustHueOpGenericAdaptorBase; +public: + AdjustHueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AdjustHueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AdjustHueOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AdjustHueOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getImages() { + return (*getODSOperands(0).begin()); + } + + ValueT getDelta() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AdjustHueOpAdaptor : public AdjustHueOpGenericAdaptor<::mlir::ValueRange> { +public: + using AdjustHueOpGenericAdaptor::AdjustHueOpGenericAdaptor; + AdjustHueOpAdaptor(AdjustHueOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AdjustHueOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AdjustHueOpAdaptor; + template + using GenericAdaptor = AdjustHueOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.AdjustHue"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getImages(); + ::mlir::TypedValue<::mlir::TensorType> getDelta(); + ::mlir::OpOperand &getImagesMutable(); + ::mlir::OpOperand &getDeltaMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value images, ::mlir::Value delta); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value images, ::mlir::Value delta); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AdjustHueOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AdjustSaturationOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AdjustSaturationOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AdjustSaturationOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AdjustSaturationOpGenericAdaptorBase(AdjustSaturationOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AdjustSaturationOpGenericAdaptor : public detail::AdjustSaturationOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AdjustSaturationOpGenericAdaptorBase; +public: + AdjustSaturationOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AdjustSaturationOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AdjustSaturationOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AdjustSaturationOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getImages() { + return (*getODSOperands(0).begin()); + } + + ValueT getScale() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AdjustSaturationOpAdaptor : public AdjustSaturationOpGenericAdaptor<::mlir::ValueRange> { +public: + using AdjustSaturationOpGenericAdaptor::AdjustSaturationOpGenericAdaptor; + AdjustSaturationOpAdaptor(AdjustSaturationOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AdjustSaturationOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AdjustSaturationOpAdaptor; + template + using GenericAdaptor = AdjustSaturationOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.AdjustSaturation"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getImages(); + ::mlir::TypedValue<::mlir::TensorType> getScale(); + ::mlir::OpOperand &getImagesMutable(); + ::mlir::OpOperand &getScaleMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value images, ::mlir::Value scale); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value images, ::mlir::Value scale); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AdjustSaturationOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AllOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AllOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AllOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AllOpGenericAdaptorBase(AllOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getKeepDimsAttr(); + bool getKeepDims(); +}; +} // namespace detail +template +class AllOpGenericAdaptor : public detail::AllOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AllOpGenericAdaptorBase; +public: + AllOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AllOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AllOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AllOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getReductionIndices() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AllOpAdaptor : public AllOpGenericAdaptor<::mlir::ValueRange> { +public: + using AllOpGenericAdaptor::AllOpGenericAdaptor; + AllOpAdaptor(AllOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AllOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AllOpAdaptor; + template + using GenericAdaptor = AllOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tidx"), ::llvm::StringRef("keep_dims")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTidxAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTidxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getKeepDimsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getKeepDimsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.All"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getReductionIndices(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getReductionIndicesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getKeepDimsAttr(); + bool getKeepDims(); + ::mlir::Type getTidx(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setKeepDimsAttr(::mlir::BoolAttr attr); + void setKeepDims(::std::optional attrValue); + ::mlir::Attribute removeKeepDimsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value reduction_indices, /*optional*/::mlir::BoolAttr keep_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value reduction_indices, /*optional*/::mlir::BoolAttr keep_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value reduction_indices, /*optional*/bool keep_dims = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value reduction_indices, /*optional*/bool keep_dims = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AllOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AllToAllOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AllToAllOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AllToAllOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AllToAllOpGenericAdaptorBase(AllToAllOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getConcatDimensionAttr(); + uint64_t getConcatDimension(); + ::mlir::IntegerAttr getSplitDimensionAttr(); + uint64_t getSplitDimension(); + ::mlir::IntegerAttr getSplitCountAttr(); + uint64_t getSplitCount(); +}; +} // namespace detail +template +class AllToAllOpGenericAdaptor : public detail::AllToAllOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AllToAllOpGenericAdaptorBase; +public: + AllToAllOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AllToAllOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AllToAllOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AllToAllOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getGroupAssignment() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AllToAllOpAdaptor : public AllToAllOpGenericAdaptor<::mlir::ValueRange> { +public: + using AllToAllOpGenericAdaptor::AllToAllOpGenericAdaptor; + AllToAllOpAdaptor(AllToAllOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AllToAllOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AllToAllOpAdaptor; + template + using GenericAdaptor = AllToAllOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("concat_dimension"), ::llvm::StringRef("split_count"), ::llvm::StringRef("split_dimension")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getConcatDimensionAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getConcatDimensionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getSplitCountAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getSplitCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSplitDimensionAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSplitDimensionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.AllToAll"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getGroupAssignment(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getGroupAssignmentMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getConcatDimensionAttr(); + uint64_t getConcatDimension(); + ::mlir::IntegerAttr getSplitDimensionAttr(); + uint64_t getSplitDimension(); + ::mlir::IntegerAttr getSplitCountAttr(); + uint64_t getSplitCount(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setConcatDimensionAttr(::mlir::IntegerAttr attr); + void setConcatDimension(uint64_t attrValue); + void setSplitDimensionAttr(::mlir::IntegerAttr attr); + void setSplitDimension(uint64_t attrValue); + void setSplitCountAttr(::mlir::IntegerAttr attr); + void setSplitCount(uint64_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value group_assignment, ::mlir::IntegerAttr concat_dimension, ::mlir::IntegerAttr split_dimension, ::mlir::IntegerAttr split_count); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value group_assignment, ::mlir::IntegerAttr concat_dimension, ::mlir::IntegerAttr split_dimension, ::mlir::IntegerAttr split_count); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value group_assignment, uint64_t concat_dimension, uint64_t split_dimension, uint64_t split_count); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value group_assignment, uint64_t concat_dimension, uint64_t split_dimension, uint64_t split_count); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AllToAllOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AngleOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AngleOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AngleOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AngleOpGenericAdaptorBase(AngleOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AngleOpGenericAdaptor : public detail::AngleOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AngleOpGenericAdaptorBase; +public: + AngleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AngleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AngleOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AngleOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AngleOpAdaptor : public AngleOpGenericAdaptor<::mlir::ValueRange> { +public: + using AngleOpGenericAdaptor::AngleOpGenericAdaptor; + AngleOpAdaptor(AngleOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AngleOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AngleOpAdaptor; + template + using GenericAdaptor = AngleOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tout")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getToutAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getToutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Angle"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTout(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AngleOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AnonymousIteratorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AnonymousIteratorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AnonymousIteratorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AnonymousIteratorOpGenericAdaptorBase(AnonymousIteratorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); +}; +} // namespace detail +template +class AnonymousIteratorOpGenericAdaptor : public detail::AnonymousIteratorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AnonymousIteratorOpGenericAdaptorBase; +public: + AnonymousIteratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AnonymousIteratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AnonymousIteratorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AnonymousIteratorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AnonymousIteratorOpAdaptor : public AnonymousIteratorOpGenericAdaptor<::mlir::ValueRange> { +public: + using AnonymousIteratorOpGenericAdaptor::AnonymousIteratorOpGenericAdaptor; + AnonymousIteratorOpAdaptor(AnonymousIteratorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AnonymousIteratorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ResourceHandleAllocatorInterface::Trait, ::mlir::OpTrait::TF::UniqueResourceAllocation, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AnonymousIteratorOpAdaptor; + template + using GenericAdaptor = AnonymousIteratorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.AnonymousIterator"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AnonymousIteratorOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AnonymousIteratorV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AnonymousIteratorV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AnonymousIteratorV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AnonymousIteratorV2OpGenericAdaptorBase(AnonymousIteratorV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); +}; +} // namespace detail +template +class AnonymousIteratorV2OpGenericAdaptor : public detail::AnonymousIteratorV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AnonymousIteratorV2OpGenericAdaptorBase; +public: + AnonymousIteratorV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AnonymousIteratorV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AnonymousIteratorV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AnonymousIteratorV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AnonymousIteratorV2OpAdaptor : public AnonymousIteratorV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using AnonymousIteratorV2OpGenericAdaptor::AnonymousIteratorV2OpGenericAdaptor; + AnonymousIteratorV2OpAdaptor(AnonymousIteratorV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AnonymousIteratorV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ResourceHandleAllocatorInterface::Trait, ::mlir::OpTrait::TF::UniqueResourceAllocation, ::mlir::OpAsmOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AnonymousIteratorV2OpAdaptor; + template + using GenericAdaptor = AnonymousIteratorV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.AnonymousIteratorV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::TypedValue<::mlir::TensorType> getDeleter(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Type deleter, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AnonymousIteratorV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AnonymousIteratorV3Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AnonymousIteratorV3OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AnonymousIteratorV3OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AnonymousIteratorV3OpGenericAdaptorBase(AnonymousIteratorV3Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); +}; +} // namespace detail +template +class AnonymousIteratorV3OpGenericAdaptor : public detail::AnonymousIteratorV3OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AnonymousIteratorV3OpGenericAdaptorBase; +public: + AnonymousIteratorV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AnonymousIteratorV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AnonymousIteratorV3OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AnonymousIteratorV3OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AnonymousIteratorV3OpAdaptor : public AnonymousIteratorV3OpGenericAdaptor<::mlir::ValueRange> { +public: + using AnonymousIteratorV3OpGenericAdaptor::AnonymousIteratorV3OpGenericAdaptor; + AnonymousIteratorV3OpAdaptor(AnonymousIteratorV3Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AnonymousIteratorV3Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ResourceHandleAllocatorInterface::Trait, ::mlir::OpTrait::TF::UniqueResourceAllocation, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AnonymousIteratorV3OpAdaptor; + template + using GenericAdaptor = AnonymousIteratorV3OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.AnonymousIteratorV3"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AnonymousIteratorV3Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AnonymousMemoryCacheOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AnonymousMemoryCacheOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AnonymousMemoryCacheOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AnonymousMemoryCacheOpGenericAdaptorBase(AnonymousMemoryCacheOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AnonymousMemoryCacheOpGenericAdaptor : public detail::AnonymousMemoryCacheOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AnonymousMemoryCacheOpGenericAdaptorBase; +public: + AnonymousMemoryCacheOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AnonymousMemoryCacheOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AnonymousMemoryCacheOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AnonymousMemoryCacheOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AnonymousMemoryCacheOpAdaptor : public AnonymousMemoryCacheOpGenericAdaptor<::mlir::ValueRange> { +public: + using AnonymousMemoryCacheOpGenericAdaptor::AnonymousMemoryCacheOpGenericAdaptor; + AnonymousMemoryCacheOpAdaptor(AnonymousMemoryCacheOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AnonymousMemoryCacheOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ResourceHandleAllocatorInterface::Trait, ::mlir::OpTrait::TF::UniqueResourceAllocation, ::mlir::OpAsmOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AnonymousMemoryCacheOpAdaptor; + template + using GenericAdaptor = AnonymousMemoryCacheOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.AnonymousMemoryCache"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::TypedValue<::mlir::TensorType> getDeleter(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Type deleter); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AnonymousMemoryCacheOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AnonymousMultiDeviceIteratorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AnonymousMultiDeviceIteratorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AnonymousMultiDeviceIteratorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AnonymousMultiDeviceIteratorOpGenericAdaptorBase(AnonymousMultiDeviceIteratorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getDevicesAttr(); + ::mlir::ArrayAttr getDevices(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); +}; +} // namespace detail +template +class AnonymousMultiDeviceIteratorOpGenericAdaptor : public detail::AnonymousMultiDeviceIteratorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AnonymousMultiDeviceIteratorOpGenericAdaptorBase; +public: + AnonymousMultiDeviceIteratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AnonymousMultiDeviceIteratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AnonymousMultiDeviceIteratorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AnonymousMultiDeviceIteratorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AnonymousMultiDeviceIteratorOpAdaptor : public AnonymousMultiDeviceIteratorOpGenericAdaptor<::mlir::ValueRange> { +public: + using AnonymousMultiDeviceIteratorOpGenericAdaptor::AnonymousMultiDeviceIteratorOpGenericAdaptor; + AnonymousMultiDeviceIteratorOpAdaptor(AnonymousMultiDeviceIteratorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AnonymousMultiDeviceIteratorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ResourceHandleAllocatorInterface::Trait, ::mlir::OpTrait::TF::UniqueResourceAllocation, ::mlir::OpAsmOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AnonymousMultiDeviceIteratorOpAdaptor; + template + using GenericAdaptor = AnonymousMultiDeviceIteratorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("devices"), ::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDevicesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDevicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.AnonymousMultiDeviceIterator"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::TypedValue<::mlir::TensorType> getDeleter(); + ::mlir::ArrayAttr getDevicesAttr(); + ::mlir::ArrayAttr getDevices(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + void setDevicesAttr(::mlir::ArrayAttr attr); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Type deleter, ::mlir::ArrayAttr devices, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ArrayAttr devices, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AnonymousMultiDeviceIteratorOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AnonymousMultiDeviceIteratorV3Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AnonymousMultiDeviceIteratorV3OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AnonymousMultiDeviceIteratorV3OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AnonymousMultiDeviceIteratorV3OpGenericAdaptorBase(AnonymousMultiDeviceIteratorV3Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getDevicesAttr(); + ::mlir::ArrayAttr getDevices(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); +}; +} // namespace detail +template +class AnonymousMultiDeviceIteratorV3OpGenericAdaptor : public detail::AnonymousMultiDeviceIteratorV3OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AnonymousMultiDeviceIteratorV3OpGenericAdaptorBase; +public: + AnonymousMultiDeviceIteratorV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AnonymousMultiDeviceIteratorV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AnonymousMultiDeviceIteratorV3OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AnonymousMultiDeviceIteratorV3OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AnonymousMultiDeviceIteratorV3OpAdaptor : public AnonymousMultiDeviceIteratorV3OpGenericAdaptor<::mlir::ValueRange> { +public: + using AnonymousMultiDeviceIteratorV3OpGenericAdaptor::AnonymousMultiDeviceIteratorV3OpGenericAdaptor; + AnonymousMultiDeviceIteratorV3OpAdaptor(AnonymousMultiDeviceIteratorV3Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AnonymousMultiDeviceIteratorV3Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ResourceHandleAllocatorInterface::Trait, ::mlir::OpTrait::TF::UniqueResourceAllocation, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AnonymousMultiDeviceIteratorV3OpAdaptor; + template + using GenericAdaptor = AnonymousMultiDeviceIteratorV3OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("devices"), ::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDevicesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDevicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.AnonymousMultiDeviceIteratorV3"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::ArrayAttr getDevicesAttr(); + ::mlir::ArrayAttr getDevices(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + void setDevicesAttr(::mlir::ArrayAttr attr); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::ArrayAttr devices, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ArrayAttr devices, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AnonymousMultiDeviceIteratorV3Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AnonymousRandomSeedGeneratorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AnonymousRandomSeedGeneratorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AnonymousRandomSeedGeneratorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AnonymousRandomSeedGeneratorOpGenericAdaptorBase(AnonymousRandomSeedGeneratorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AnonymousRandomSeedGeneratorOpGenericAdaptor : public detail::AnonymousRandomSeedGeneratorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AnonymousRandomSeedGeneratorOpGenericAdaptorBase; +public: + AnonymousRandomSeedGeneratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AnonymousRandomSeedGeneratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AnonymousRandomSeedGeneratorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AnonymousRandomSeedGeneratorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSeed() { + return (*getODSOperands(0).begin()); + } + + ValueT getSeed2() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AnonymousRandomSeedGeneratorOpAdaptor : public AnonymousRandomSeedGeneratorOpGenericAdaptor<::mlir::ValueRange> { +public: + using AnonymousRandomSeedGeneratorOpGenericAdaptor::AnonymousRandomSeedGeneratorOpGenericAdaptor; + AnonymousRandomSeedGeneratorOpAdaptor(AnonymousRandomSeedGeneratorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AnonymousRandomSeedGeneratorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ResourceHandleAllocatorInterface::Trait, ::mlir::OpTrait::TF::UniqueResourceAllocation, ::mlir::OpAsmOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AnonymousRandomSeedGeneratorOpAdaptor; + template + using GenericAdaptor = AnonymousRandomSeedGeneratorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.AnonymousRandomSeedGenerator"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSeed(); + ::mlir::TypedValue<::mlir::TensorType> getSeed2(); + ::mlir::OpOperand &getSeedMutable(); + ::mlir::OpOperand &getSeed2Mutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::TypedValue<::mlir::TensorType> getDeleter(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Type deleter, ::mlir::Value seed, ::mlir::Value seed2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value seed, ::mlir::Value seed2); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AnonymousRandomSeedGeneratorOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AnonymousSeedGeneratorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AnonymousSeedGeneratorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AnonymousSeedGeneratorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AnonymousSeedGeneratorOpGenericAdaptorBase(AnonymousSeedGeneratorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AnonymousSeedGeneratorOpGenericAdaptor : public detail::AnonymousSeedGeneratorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AnonymousSeedGeneratorOpGenericAdaptorBase; +public: + AnonymousSeedGeneratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AnonymousSeedGeneratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AnonymousSeedGeneratorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AnonymousSeedGeneratorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSeed() { + return (*getODSOperands(0).begin()); + } + + ValueT getSeed2() { + return (*getODSOperands(1).begin()); + } + + ValueT getReshuffle() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AnonymousSeedGeneratorOpAdaptor : public AnonymousSeedGeneratorOpGenericAdaptor<::mlir::ValueRange> { +public: + using AnonymousSeedGeneratorOpGenericAdaptor::AnonymousSeedGeneratorOpGenericAdaptor; + AnonymousSeedGeneratorOpAdaptor(AnonymousSeedGeneratorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AnonymousSeedGeneratorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ResourceHandleAllocatorInterface::Trait, ::mlir::OpTrait::TF::UniqueResourceAllocation, ::mlir::OpAsmOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AnonymousSeedGeneratorOpAdaptor; + template + using GenericAdaptor = AnonymousSeedGeneratorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.AnonymousSeedGenerator"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSeed(); + ::mlir::TypedValue<::mlir::TensorType> getSeed2(); + ::mlir::TypedValue<::mlir::TensorType> getReshuffle(); + ::mlir::OpOperand &getSeedMutable(); + ::mlir::OpOperand &getSeed2Mutable(); + ::mlir::OpOperand &getReshuffleMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::TypedValue<::mlir::TensorType> getDeleter(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Type deleter, ::mlir::Value seed, ::mlir::Value seed2, ::mlir::Value reshuffle); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value seed, ::mlir::Value seed2, ::mlir::Value reshuffle); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AnonymousSeedGeneratorOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AnyOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AnyOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AnyOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AnyOpGenericAdaptorBase(AnyOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getKeepDimsAttr(); + bool getKeepDims(); +}; +} // namespace detail +template +class AnyOpGenericAdaptor : public detail::AnyOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AnyOpGenericAdaptorBase; +public: + AnyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AnyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AnyOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AnyOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getReductionIndices() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AnyOpAdaptor : public AnyOpGenericAdaptor<::mlir::ValueRange> { +public: + using AnyOpGenericAdaptor::AnyOpGenericAdaptor; + AnyOpAdaptor(AnyOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AnyOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AnyOpAdaptor; + template + using GenericAdaptor = AnyOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tidx"), ::llvm::StringRef("keep_dims")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTidxAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTidxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getKeepDimsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getKeepDimsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Any"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getReductionIndices(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getReductionIndicesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getKeepDimsAttr(); + bool getKeepDims(); + ::mlir::Type getTidx(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setKeepDimsAttr(::mlir::BoolAttr attr); + void setKeepDims(::std::optional attrValue); + ::mlir::Attribute removeKeepDimsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value reduction_indices, /*optional*/::mlir::BoolAttr keep_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value reduction_indices, /*optional*/::mlir::BoolAttr keep_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value reduction_indices, /*optional*/bool keep_dims = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value reduction_indices, /*optional*/bool keep_dims = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AnyOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ApproxTopKOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ApproxTopKOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ApproxTopKOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ApproxTopKOpGenericAdaptorBase(ApproxTopKOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getKAttr(); + uint64_t getK(); + ::mlir::IntegerAttr getReductionDimensionAttr(); + uint64_t getReductionDimension(); + ::mlir::FloatAttr getRecallTargetAttr(); + ::llvm::APFloat getRecallTarget(); + ::mlir::BoolAttr getIsMaxKAttr(); + bool getIsMaxK(); + ::mlir::IntegerAttr getReductionInputSizeOverrideAttr(); + uint64_t getReductionInputSizeOverride(); + ::mlir::BoolAttr getAggregateToTopkAttr(); + bool getAggregateToTopk(); +}; +} // namespace detail +template +class ApproxTopKOpGenericAdaptor : public detail::ApproxTopKOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ApproxTopKOpGenericAdaptorBase; +public: + ApproxTopKOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ApproxTopKOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ApproxTopKOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ApproxTopKOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ApproxTopKOpAdaptor : public ApproxTopKOpGenericAdaptor<::mlir::ValueRange> { +public: + using ApproxTopKOpGenericAdaptor::ApproxTopKOpGenericAdaptor; + ApproxTopKOpAdaptor(ApproxTopKOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ApproxTopKOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ApproxTopKOpAdaptor; + template + using GenericAdaptor = ApproxTopKOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("aggregate_to_topk"), ::llvm::StringRef("is_max_k"), ::llvm::StringRef("k"), ::llvm::StringRef("recall_target"), ::llvm::StringRef("reduction_dimension"), ::llvm::StringRef("reduction_input_size_override")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAggregateToTopkAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAggregateToTopkAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getIsMaxKAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getIsMaxKAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getKAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getKAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getRecallTargetAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getRecallTargetAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getReductionDimensionAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getReductionDimensionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getReductionInputSizeOverrideAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getReductionInputSizeOverrideAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ApproxTopK"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getValues(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::IntegerAttr getKAttr(); + uint64_t getK(); + ::mlir::IntegerAttr getReductionDimensionAttr(); + uint64_t getReductionDimension(); + ::mlir::FloatAttr getRecallTargetAttr(); + ::llvm::APFloat getRecallTarget(); + ::mlir::BoolAttr getIsMaxKAttr(); + bool getIsMaxK(); + ::mlir::IntegerAttr getReductionInputSizeOverrideAttr(); + uint64_t getReductionInputSizeOverride(); + ::mlir::BoolAttr getAggregateToTopkAttr(); + bool getAggregateToTopk(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setKAttr(::mlir::IntegerAttr attr); + void setK(uint64_t attrValue); + void setReductionDimensionAttr(::mlir::IntegerAttr attr); + void setReductionDimension(::std::optional attrValue); + void setRecallTargetAttr(::mlir::FloatAttr attr); + void setRecallTarget(::std::optional<::llvm::APFloat> attrValue); + void setIsMaxKAttr(::mlir::BoolAttr attr); + void setIsMaxK(::std::optional attrValue); + void setReductionInputSizeOverrideAttr(::mlir::IntegerAttr attr); + void setReductionInputSizeOverride(::std::optional attrValue); + void setAggregateToTopkAttr(::mlir::BoolAttr attr); + void setAggregateToTopk(::std::optional attrValue); + ::mlir::Attribute removeReductionDimensionAttr(); + ::mlir::Attribute removeRecallTargetAttr(); + ::mlir::Attribute removeIsMaxKAttr(); + ::mlir::Attribute removeReductionInputSizeOverrideAttr(); + ::mlir::Attribute removeAggregateToTopkAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type values, ::mlir::Type indices, ::mlir::Value input, ::mlir::IntegerAttr k, /*optional*/::mlir::IntegerAttr reduction_dimension, /*optional*/::mlir::FloatAttr recall_target, /*optional*/::mlir::BoolAttr is_max_k, /*optional*/::mlir::IntegerAttr reduction_input_size_override, /*optional*/::mlir::BoolAttr aggregate_to_topk); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::IntegerAttr k, /*optional*/::mlir::IntegerAttr reduction_dimension, /*optional*/::mlir::FloatAttr recall_target, /*optional*/::mlir::BoolAttr is_max_k, /*optional*/::mlir::IntegerAttr reduction_input_size_override, /*optional*/::mlir::BoolAttr aggregate_to_topk); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type values, ::mlir::Type indices, ::mlir::Value input, uint64_t k, /*optional*/uint64_t reduction_dimension, /*optional*/::llvm::APFloat recall_target, /*optional*/bool is_max_k = true, /*optional*/uint64_t reduction_input_size_override = -1, /*optional*/bool aggregate_to_topk = true); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, uint64_t k, /*optional*/uint64_t reduction_dimension, /*optional*/::llvm::APFloat recall_target, /*optional*/bool is_max_k = true, /*optional*/uint64_t reduction_input_size_override = -1, /*optional*/bool aggregate_to_topk = true); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 7 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ApproxTopKOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ApproximateEqualOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ApproximateEqualOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ApproximateEqualOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ApproximateEqualOpGenericAdaptorBase(ApproximateEqualOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::FloatAttr getToleranceAttr(); + ::llvm::APFloat getTolerance(); +}; +} // namespace detail +template +class ApproximateEqualOpGenericAdaptor : public detail::ApproximateEqualOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ApproximateEqualOpGenericAdaptorBase; +public: + ApproximateEqualOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ApproximateEqualOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ApproximateEqualOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ApproximateEqualOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ApproximateEqualOpAdaptor : public ApproximateEqualOpGenericAdaptor<::mlir::ValueRange> { +public: + using ApproximateEqualOpGenericAdaptor::ApproximateEqualOpGenericAdaptor; + ApproximateEqualOpAdaptor(ApproximateEqualOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ApproximateEqualOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsCommutative, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ApproximateEqualOpAdaptor; + template + using GenericAdaptor = ApproximateEqualOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("tolerance")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getToleranceAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getToleranceAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ApproximateEqual"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::FloatAttr getToleranceAttr(); + ::llvm::APFloat getTolerance(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setToleranceAttr(::mlir::FloatAttr attr); + void setTolerance(::std::optional<::llvm::APFloat> attrValue); + ::mlir::Attribute removeToleranceAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y, /*optional*/::mlir::FloatAttr tolerance); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y, /*optional*/::mlir::FloatAttr tolerance); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y, /*optional*/::llvm::APFloat tolerance); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y, /*optional*/::llvm::APFloat tolerance); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ApproximateEqualOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ArgMaxOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ArgMaxOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ArgMaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ArgMaxOpGenericAdaptorBase(ArgMaxOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ArgMaxOpGenericAdaptor : public detail::ArgMaxOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ArgMaxOpGenericAdaptorBase; +public: + ArgMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ArgMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ArgMaxOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ArgMaxOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getDimension() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ArgMaxOpAdaptor : public ArgMaxOpGenericAdaptor<::mlir::ValueRange> { +public: + using ArgMaxOpGenericAdaptor::ArgMaxOpGenericAdaptor; + ArgMaxOpAdaptor(ArgMaxOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ArgMaxOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ArgMaxOpAdaptor; + template + using GenericAdaptor = ArgMaxOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tidx"), ::llvm::StringRef("output_type")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTidxAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTidxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOutputTypeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOutputTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ArgMax"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getDimension(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getDimensionMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTidx(); + ::mlir::Type getOutputType(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value dimension); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ArgMaxOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ArgMinOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ArgMinOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ArgMinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ArgMinOpGenericAdaptorBase(ArgMinOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ArgMinOpGenericAdaptor : public detail::ArgMinOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ArgMinOpGenericAdaptorBase; +public: + ArgMinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ArgMinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ArgMinOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ArgMinOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getDimension() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ArgMinOpAdaptor : public ArgMinOpGenericAdaptor<::mlir::ValueRange> { +public: + using ArgMinOpGenericAdaptor::ArgMinOpGenericAdaptor; + ArgMinOpAdaptor(ArgMinOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ArgMinOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ArgMinOpAdaptor; + template + using GenericAdaptor = ArgMinOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tidx"), ::llvm::StringRef("output_type")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTidxAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTidxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOutputTypeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOutputTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ArgMin"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getDimension(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getDimensionMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTidx(); + ::mlir::Type getOutputType(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value dimension); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ArgMinOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AsStringOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AsStringOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AsStringOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AsStringOpGenericAdaptorBase(AsStringOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getPrecisionAttr(); + uint64_t getPrecision(); + ::mlir::BoolAttr getScientificAttr(); + bool getScientific(); + ::mlir::BoolAttr getShortestAttr(); + bool getShortest(); + ::mlir::IntegerAttr getWidthAttr(); + uint64_t getWidth(); + ::mlir::StringAttr getFillAttr(); + ::llvm::StringRef getFill(); +}; +} // namespace detail +template +class AsStringOpGenericAdaptor : public detail::AsStringOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AsStringOpGenericAdaptorBase; +public: + AsStringOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AsStringOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AsStringOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AsStringOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AsStringOpAdaptor : public AsStringOpGenericAdaptor<::mlir::ValueRange> { +public: + using AsStringOpGenericAdaptor::AsStringOpGenericAdaptor; + AsStringOpAdaptor(AsStringOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AsStringOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AsStringOpAdaptor; + template + using GenericAdaptor = AsStringOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("fill"), ::llvm::StringRef("precision"), ::llvm::StringRef("scientific"), ::llvm::StringRef("shortest"), ::llvm::StringRef("width")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getFillAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getFillAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getPrecisionAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getPrecisionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getScientificAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getScientificAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getShortestAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getShortestAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getWidthAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getWidthAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.AsString"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getPrecisionAttr(); + uint64_t getPrecision(); + ::mlir::BoolAttr getScientificAttr(); + bool getScientific(); + ::mlir::BoolAttr getShortestAttr(); + bool getShortest(); + ::mlir::IntegerAttr getWidthAttr(); + uint64_t getWidth(); + ::mlir::StringAttr getFillAttr(); + ::llvm::StringRef getFill(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setPrecisionAttr(::mlir::IntegerAttr attr); + void setPrecision(::std::optional attrValue); + void setScientificAttr(::mlir::BoolAttr attr); + void setScientific(::std::optional attrValue); + void setShortestAttr(::mlir::BoolAttr attr); + void setShortest(::std::optional attrValue); + void setWidthAttr(::mlir::IntegerAttr attr); + void setWidth(::std::optional attrValue); + void setFillAttr(::mlir::StringAttr attr); + void setFill(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removePrecisionAttr(); + ::mlir::Attribute removeScientificAttr(); + ::mlir::Attribute removeShortestAttr(); + ::mlir::Attribute removeWidthAttr(); + ::mlir::Attribute removeFillAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, /*optional*/::mlir::IntegerAttr precision, /*optional*/::mlir::BoolAttr scientific, /*optional*/::mlir::BoolAttr shortest, /*optional*/::mlir::IntegerAttr width, /*optional*/::mlir::StringAttr fill); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, /*optional*/::mlir::IntegerAttr precision, /*optional*/::mlir::BoolAttr scientific, /*optional*/::mlir::BoolAttr shortest, /*optional*/::mlir::IntegerAttr width, /*optional*/::mlir::StringAttr fill); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, /*optional*/uint64_t precision = -1, /*optional*/bool scientific = false, /*optional*/bool shortest = false, /*optional*/uint64_t width = -1, /*optional*/::llvm::StringRef fill = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, /*optional*/uint64_t precision = -1, /*optional*/bool scientific = false, /*optional*/bool shortest = false, /*optional*/uint64_t width = -1, /*optional*/::llvm::StringRef fill = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AsStringOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AsinOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AsinOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AsinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AsinOpGenericAdaptorBase(AsinOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AsinOpGenericAdaptor : public detail::AsinOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AsinOpGenericAdaptorBase; +public: + AsinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AsinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AsinOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AsinOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AsinOpAdaptor : public AsinOpGenericAdaptor<::mlir::ValueRange> { +public: + using AsinOpGenericAdaptor::AsinOpGenericAdaptor; + AsinOpAdaptor(AsinOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AsinOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AsinOpAdaptor; + template + using GenericAdaptor = AsinOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Asin"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AsinOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AsinhOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AsinhOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AsinhOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AsinhOpGenericAdaptorBase(AsinhOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AsinhOpGenericAdaptor : public detail::AsinhOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AsinhOpGenericAdaptorBase; +public: + AsinhOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AsinhOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AsinhOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AsinhOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AsinhOpAdaptor : public AsinhOpGenericAdaptor<::mlir::ValueRange> { +public: + using AsinhOpGenericAdaptor::AsinhOpGenericAdaptor; + AsinhOpAdaptor(AsinhOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AsinhOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AsinhOpAdaptor; + template + using GenericAdaptor = AsinhOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Asinh"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AsinhOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AssertOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AssertOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AssertOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AssertOpGenericAdaptorBase(AssertOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getSummarizeAttr(); + uint64_t getSummarize(); +}; +} // namespace detail +template +class AssertOpGenericAdaptor : public detail::AssertOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AssertOpGenericAdaptorBase; +public: + AssertOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AssertOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AssertOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AssertOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getCondition() { + return (*getODSOperands(0).begin()); + } + + RangeT getData() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AssertOpAdaptor : public AssertOpGenericAdaptor<::mlir::ValueRange> { +public: + using AssertOpGenericAdaptor::AssertOpGenericAdaptor; + AssertOpAdaptor(AssertOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AssertOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AssertOpAdaptor; + template + using GenericAdaptor = AssertOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("summarize")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getSummarizeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getSummarizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Assert"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getCondition(); + ::mlir::Operation::operand_range getData(); + ::mlir::OpOperand &getConditionMutable(); + ::mlir::MutableOperandRange getDataMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getSummarizeAttr(); + uint64_t getSummarize(); + mlir::OperandElementTypeRange getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setSummarizeAttr(::mlir::IntegerAttr attr); + void setSummarize(::std::optional attrValue); + ::mlir::Attribute removeSummarizeAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value condition, ::mlir::ValueRange data, /*optional*/::mlir::IntegerAttr summarize); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value condition, ::mlir::ValueRange data, /*optional*/::mlir::IntegerAttr summarize); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value condition, ::mlir::ValueRange data, /*optional*/uint64_t summarize = 3); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value condition, ::mlir::ValueRange data, /*optional*/uint64_t summarize = 3); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AssertOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AssignAddVariableOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AssignAddVariableOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AssignAddVariableOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AssignAddVariableOpGenericAdaptorBase(AssignAddVariableOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AssignAddVariableOpGenericAdaptor : public detail::AssignAddVariableOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AssignAddVariableOpGenericAdaptorBase; +public: + AssignAddVariableOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AssignAddVariableOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AssignAddVariableOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AssignAddVariableOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getResource() { + return (*getODSOperands(0).begin()); + } + + ValueT getValue() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AssignAddVariableOpAdaptor : public AssignAddVariableOpGenericAdaptor<::mlir::ValueRange> { +public: + using AssignAddVariableOpGenericAdaptor::AssignAddVariableOpGenericAdaptor; + AssignAddVariableOpAdaptor(AssignAddVariableOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AssignAddVariableOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AssignAddVariableOpAdaptor; + template + using GenericAdaptor = AssignAddVariableOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.AssignAddVariableOp"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResource(); + ::mlir::TypedValue<::mlir::TensorType> getValue(); + ::mlir::OpOperand &getResourceMutable(); + ::mlir::OpOperand &getValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value resource, ::mlir::Value value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value resource, ::mlir::Value value); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AssignAddVariableOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AssignOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AssignOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AssignOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AssignOpGenericAdaptorBase(AssignOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getValidateShapeAttr(); + bool getValidateShape(); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); +}; +} // namespace detail +template +class AssignOpGenericAdaptor : public detail::AssignOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AssignOpGenericAdaptorBase; +public: + AssignOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AssignOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AssignOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AssignOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getRef() { + return (*getODSOperands(0).begin()); + } + + ValueT getValue() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AssignOpAdaptor : public AssignOpGenericAdaptor<::mlir::ValueRange> { +public: + using AssignOpGenericAdaptor::AssignOpGenericAdaptor; + AssignOpAdaptor(AssignOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AssignOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AssignOpAdaptor; + template + using GenericAdaptor = AssignOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("use_locking"), ::llvm::StringRef("validate_shape")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getUseLockingAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getUseLockingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getValidateShapeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getValidateShapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Assign"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getRef(); + ::mlir::TypedValue<::mlir::TensorType> getValue(); + ::mlir::OpOperand &getRefMutable(); + ::mlir::OpOperand &getValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutputRef(); + ::mlir::BoolAttr getValidateShapeAttr(); + bool getValidateShape(); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setValidateShapeAttr(::mlir::BoolAttr attr); + void setValidateShape(::std::optional attrValue); + void setUseLockingAttr(::mlir::BoolAttr attr); + void setUseLocking(::std::optional attrValue); + ::mlir::Attribute removeValidateShapeAttr(); + ::mlir::Attribute removeUseLockingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output_ref, ::mlir::Value ref, ::mlir::Value value, /*optional*/::mlir::BoolAttr validate_shape, /*optional*/::mlir::BoolAttr use_locking); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ref, ::mlir::Value value, /*optional*/::mlir::BoolAttr validate_shape, /*optional*/::mlir::BoolAttr use_locking); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output_ref, ::mlir::Value ref, ::mlir::Value value, /*optional*/bool validate_shape = true, /*optional*/bool use_locking = true); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ref, ::mlir::Value value, /*optional*/bool validate_shape = true, /*optional*/bool use_locking = true); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AssignOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AssignSubVariableOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AssignSubVariableOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AssignSubVariableOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AssignSubVariableOpGenericAdaptorBase(AssignSubVariableOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AssignSubVariableOpGenericAdaptor : public detail::AssignSubVariableOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AssignSubVariableOpGenericAdaptorBase; +public: + AssignSubVariableOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AssignSubVariableOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AssignSubVariableOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AssignSubVariableOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getResource() { + return (*getODSOperands(0).begin()); + } + + ValueT getValue() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AssignSubVariableOpAdaptor : public AssignSubVariableOpGenericAdaptor<::mlir::ValueRange> { +public: + using AssignSubVariableOpGenericAdaptor::AssignSubVariableOpGenericAdaptor; + AssignSubVariableOpAdaptor(AssignSubVariableOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AssignSubVariableOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AssignSubVariableOpAdaptor; + template + using GenericAdaptor = AssignSubVariableOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.AssignSubVariableOp"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResource(); + ::mlir::TypedValue<::mlir::TensorType> getValue(); + ::mlir::OpOperand &getResourceMutable(); + ::mlir::OpOperand &getValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value resource, ::mlir::Value value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value resource, ::mlir::Value value); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AssignSubVariableOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AssignVariableOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AssignVariableOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AssignVariableOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AssignVariableOpGenericAdaptorBase(AssignVariableOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getValidateShapeAttr(); + bool getValidateShape(); +}; +} // namespace detail +template +class AssignVariableOpGenericAdaptor : public detail::AssignVariableOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AssignVariableOpGenericAdaptorBase; +public: + AssignVariableOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AssignVariableOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AssignVariableOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AssignVariableOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getResource() { + return (*getODSOperands(0).begin()); + } + + ValueT getValue() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AssignVariableOpAdaptor : public AssignVariableOpGenericAdaptor<::mlir::ValueRange> { +public: + using AssignVariableOpGenericAdaptor::AssignVariableOpGenericAdaptor; + AssignVariableOpAdaptor(AssignVariableOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AssignVariableOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AssignVariableOpAdaptor; + template + using GenericAdaptor = AssignVariableOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dtype"), ::llvm::StringRef("validate_shape")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getValidateShapeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getValidateShapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.AssignVariableOp"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResource(); + ::mlir::TypedValue<::mlir::TensorType> getValue(); + ::mlir::OpOperand &getResourceMutable(); + ::mlir::OpOperand &getValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::BoolAttr getValidateShapeAttr(); + bool getValidateShape(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setValidateShapeAttr(::mlir::BoolAttr attr); + void setValidateShape(::std::optional attrValue); + ::mlir::Attribute removeValidateShapeAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value resource, ::mlir::Value value, /*optional*/::mlir::BoolAttr validate_shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value resource, ::mlir::Value value, /*optional*/::mlir::BoolAttr validate_shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value resource, ::mlir::Value value, /*optional*/bool validate_shape = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value resource, ::mlir::Value value, /*optional*/bool validate_shape = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AssignVariableOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::Atan2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Atan2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + Atan2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + Atan2OpGenericAdaptorBase(Atan2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class Atan2OpGenericAdaptor : public detail::Atan2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Atan2OpGenericAdaptorBase; +public: + Atan2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Atan2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Atan2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + Atan2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getY() { + return (*getODSOperands(0).begin()); + } + + ValueT getX() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Atan2OpAdaptor : public Atan2OpGenericAdaptor<::mlir::ValueRange> { +public: + using Atan2OpGenericAdaptor::Atan2OpGenericAdaptor; + Atan2OpAdaptor(Atan2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Atan2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::OpTrait::TF::SameOperandsAndResultElementTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = Atan2OpAdaptor; + template + using GenericAdaptor = Atan2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Atan2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getYMutable(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value y, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::Atan2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AtanOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AtanOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AtanOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AtanOpGenericAdaptorBase(AtanOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AtanOpGenericAdaptor : public detail::AtanOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AtanOpGenericAdaptorBase; +public: + AtanOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AtanOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AtanOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AtanOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AtanOpAdaptor : public AtanOpGenericAdaptor<::mlir::ValueRange> { +public: + using AtanOpGenericAdaptor::AtanOpGenericAdaptor; + AtanOpAdaptor(AtanOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AtanOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AtanOpAdaptor; + template + using GenericAdaptor = AtanOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Atan"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AtanOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AtanhOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AtanhOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AtanhOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AtanhOpGenericAdaptorBase(AtanhOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AtanhOpGenericAdaptor : public detail::AtanhOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AtanhOpGenericAdaptorBase; +public: + AtanhOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AtanhOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AtanhOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AtanhOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AtanhOpAdaptor : public AtanhOpGenericAdaptor<::mlir::ValueRange> { +public: + using AtanhOpGenericAdaptor::AtanhOpGenericAdaptor; + AtanhOpAdaptor(AtanhOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AtanhOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AtanhOpAdaptor; + template + using GenericAdaptor = AtanhOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Atanh"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AtanhOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AvgPool3DGradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AvgPool3DGradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AvgPool3DGradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AvgPool3DGradOpGenericAdaptorBase(AvgPool3DGradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getKsizeAttr(); + ::mlir::ArrayAttr getKsize(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); +}; +} // namespace detail +template +class AvgPool3DGradOpGenericAdaptor : public detail::AvgPool3DGradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AvgPool3DGradOpGenericAdaptorBase; +public: + AvgPool3DGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AvgPool3DGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AvgPool3DGradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AvgPool3DGradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOrigInputShape() { + return (*getODSOperands(0).begin()); + } + + ValueT getGrad() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AvgPool3DGradOpAdaptor : public AvgPool3DGradOpGenericAdaptor<::mlir::ValueRange> { +public: + using AvgPool3DGradOpGenericAdaptor::AvgPool3DGradOpGenericAdaptor; + AvgPool3DGradOpAdaptor(AvgPool3DGradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AvgPool3DGradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AvgPool3DGradOpAdaptor; + template + using GenericAdaptor = AvgPool3DGradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("data_format"), ::llvm::StringRef("ksize"), ::llvm::StringRef("padding"), ::llvm::StringRef("strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getKsizeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getKsizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.AvgPool3DGrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOrigInputShape(); + ::mlir::TypedValue<::mlir::TensorType> getGrad(); + ::mlir::OpOperand &getOrigInputShapeMutable(); + ::mlir::OpOperand &getGradMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ArrayAttr getKsizeAttr(); + ::mlir::ArrayAttr getKsize(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setKsizeAttr(::mlir::ArrayAttr attr); + void setStridesAttr(::mlir::ArrayAttr attr); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeDataFormatAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value orig_input_shape, ::mlir::Value grad, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value orig_input_shape, ::mlir::Value grad, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value orig_input_shape, ::mlir::Value grad, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::llvm::StringRef data_format = "NDHWC"); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value orig_input_shape, ::mlir::Value grad, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::llvm::StringRef data_format = "NDHWC"); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AvgPool3DGradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AvgPool3DOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AvgPool3DOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AvgPool3DOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AvgPool3DOpGenericAdaptorBase(AvgPool3DOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getKsizeAttr(); + ::mlir::ArrayAttr getKsize(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); +}; +} // namespace detail +template +class AvgPool3DOpGenericAdaptor : public detail::AvgPool3DOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AvgPool3DOpGenericAdaptorBase; +public: + AvgPool3DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AvgPool3DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AvgPool3DOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AvgPool3DOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AvgPool3DOpAdaptor : public AvgPool3DOpGenericAdaptor<::mlir::ValueRange> { +public: + using AvgPool3DOpGenericAdaptor::AvgPool3DOpGenericAdaptor; + AvgPool3DOpAdaptor(AvgPool3DOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AvgPool3DOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AvgPool3DOpAdaptor; + template + using GenericAdaptor = AvgPool3DOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("data_format"), ::llvm::StringRef("ksize"), ::llvm::StringRef("padding"), ::llvm::StringRef("strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getKsizeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getKsizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.AvgPool3D"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ArrayAttr getKsizeAttr(); + ::mlir::ArrayAttr getKsize(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setKsizeAttr(::mlir::ArrayAttr attr); + void setStridesAttr(::mlir::ArrayAttr attr); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeDataFormatAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::llvm::StringRef data_format = "NDHWC"); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::llvm::StringRef data_format = "NDHWC"); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AvgPool3DOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AvgPoolGradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AvgPoolGradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AvgPoolGradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AvgPoolGradOpGenericAdaptorBase(AvgPoolGradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getKsizeAttr(); + ::mlir::ArrayAttr getKsize(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); +}; +} // namespace detail +template +class AvgPoolGradOpGenericAdaptor : public detail::AvgPoolGradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AvgPoolGradOpGenericAdaptorBase; +public: + AvgPoolGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AvgPoolGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AvgPoolGradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AvgPoolGradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOrigInputShape() { + return (*getODSOperands(0).begin()); + } + + ValueT getGrad() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AvgPoolGradOpAdaptor : public AvgPoolGradOpGenericAdaptor<::mlir::ValueRange> { +public: + using AvgPoolGradOpGenericAdaptor::AvgPoolGradOpGenericAdaptor; + AvgPoolGradOpAdaptor(AvgPoolGradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AvgPoolGradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AvgPoolGradOpAdaptor; + template + using GenericAdaptor = AvgPoolGradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("data_format"), ::llvm::StringRef("ksize"), ::llvm::StringRef("padding"), ::llvm::StringRef("strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getKsizeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getKsizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.AvgPoolGrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOrigInputShape(); + ::mlir::TypedValue<::mlir::TensorType> getGrad(); + ::mlir::OpOperand &getOrigInputShapeMutable(); + ::mlir::OpOperand &getGradMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ArrayAttr getKsizeAttr(); + ::mlir::ArrayAttr getKsize(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setKsizeAttr(::mlir::ArrayAttr attr); + void setStridesAttr(::mlir::ArrayAttr attr); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeDataFormatAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value orig_input_shape, ::mlir::Value grad, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value orig_input_shape, ::mlir::Value grad, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value orig_input_shape, ::mlir::Value grad, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::llvm::StringRef data_format = "NHWC"); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value orig_input_shape, ::mlir::Value grad, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::llvm::StringRef data_format = "NHWC"); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AvgPoolGradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::AvgPoolOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AvgPoolOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AvgPoolOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AvgPoolOpGenericAdaptorBase(AvgPoolOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getKsizeAttr(); + ::mlir::ArrayAttr getKsize(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); +}; +} // namespace detail +template +class AvgPoolOpGenericAdaptor : public detail::AvgPoolOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AvgPoolOpGenericAdaptorBase; +public: + AvgPoolOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AvgPoolOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AvgPoolOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AvgPoolOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getValue() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AvgPoolOpAdaptor : public AvgPoolOpGenericAdaptor<::mlir::ValueRange> { +public: + using AvgPoolOpGenericAdaptor::AvgPoolOpGenericAdaptor; + AvgPoolOpAdaptor(AvgPoolOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AvgPoolOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AvgPoolOpAdaptor; + template + using GenericAdaptor = AvgPoolOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("data_format"), ::llvm::StringRef("ksize"), ::llvm::StringRef("padding"), ::llvm::StringRef("strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getKsizeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getKsizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.AvgPool"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getValue(); + ::mlir::OpOperand &getValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ArrayAttr getKsizeAttr(); + ::mlir::ArrayAttr getKsize(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setKsizeAttr(::mlir::ArrayAttr attr); + void setStridesAttr(::mlir::ArrayAttr attr); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeDataFormatAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value value, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value value, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::llvm::StringRef data_format = "NHWC"); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::llvm::StringRef data_format = "NHWC"); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::AvgPoolOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::BatchDatasetV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BatchDatasetV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BatchDatasetV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BatchDatasetV2OpGenericAdaptorBase(BatchDatasetV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getParallelCopyAttr(); + bool getParallelCopy(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); +}; +} // namespace detail +template +class BatchDatasetV2OpGenericAdaptor : public detail::BatchDatasetV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BatchDatasetV2OpGenericAdaptorBase; +public: + BatchDatasetV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BatchDatasetV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BatchDatasetV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BatchDatasetV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputDataset() { + return (*getODSOperands(0).begin()); + } + + ValueT getBatchSize() { + return (*getODSOperands(1).begin()); + } + + ValueT getDropRemainder() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BatchDatasetV2OpAdaptor : public BatchDatasetV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using BatchDatasetV2OpGenericAdaptor::BatchDatasetV2OpGenericAdaptor; + BatchDatasetV2OpAdaptor(BatchDatasetV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BatchDatasetV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BatchDatasetV2OpAdaptor; + template + using GenericAdaptor = BatchDatasetV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("metadata"), ::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types"), ::llvm::StringRef("parallel_copy")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getMetadataAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getMetadataAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getParallelCopyAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getParallelCopyAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.BatchDatasetV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputDataset(); + ::mlir::TypedValue<::mlir::TensorType> getBatchSize(); + ::mlir::TypedValue<::mlir::TensorType> getDropRemainder(); + ::mlir::OpOperand &getInputDatasetMutable(); + ::mlir::OpOperand &getBatchSizeMutable(); + ::mlir::OpOperand &getDropRemainderMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::BoolAttr getParallelCopyAttr(); + bool getParallelCopy(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); + void setParallelCopyAttr(::mlir::BoolAttr attr); + void setParallelCopy(::std::optional attrValue); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + void setMetadataAttr(::mlir::StringAttr attr); + void setMetadata(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeParallelCopyAttr(); + ::mlir::Attribute removeMetadataAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, ::mlir::Value batch_size, ::mlir::Value drop_remainder, /*optional*/::mlir::BoolAttr parallel_copy, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, ::mlir::Value batch_size, ::mlir::Value drop_remainder, /*optional*/::mlir::BoolAttr parallel_copy, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, ::mlir::Value batch_size, ::mlir::Value drop_remainder, /*optional*/bool parallel_copy, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::llvm::StringRef metadata = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, ::mlir::Value batch_size, ::mlir::Value drop_remainder, /*optional*/bool parallel_copy, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::llvm::StringRef metadata = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::BatchDatasetV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::BatchFunctionOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BatchFunctionOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BatchFunctionOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BatchFunctionOpGenericAdaptorBase(BatchFunctionOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::SymbolRefAttr getFAttr(); + ::mlir::SymbolRefAttr getF(); + ::mlir::IntegerAttr getNumBatchThreadsAttr(); + uint64_t getNumBatchThreads(); + ::mlir::IntegerAttr getMaxBatchSizeAttr(); + uint64_t getMaxBatchSize(); + ::mlir::IntegerAttr getBatchTimeoutMicrosAttr(); + uint64_t getBatchTimeoutMicros(); + ::mlir::IntegerAttr getMaxEnqueuedBatchesAttr(); + uint64_t getMaxEnqueuedBatches(); + ::mlir::ArrayAttr getAllowedBatchSizesAttr(); + ::mlir::ArrayAttr getAllowedBatchSizes(); + ::mlir::StringAttr getContainerAttr(); + ::llvm::StringRef getContainer(); + ::mlir::StringAttr getSharedNameAttr(); + ::llvm::StringRef getSharedName(); + ::mlir::StringAttr getBatchingQueueAttr(); + ::llvm::StringRef getBatchingQueue(); + ::mlir::IntegerAttr getLowPriorityMaxBatchSizeAttr(); + uint64_t getLowPriorityMaxBatchSize(); + ::mlir::IntegerAttr getLowPriorityBatchTimeoutMicrosAttr(); + uint64_t getLowPriorityBatchTimeoutMicros(); + ::mlir::ArrayAttr getLowPriorityAllowedBatchSizesAttr(); + ::mlir::ArrayAttr getLowPriorityAllowedBatchSizes(); + ::mlir::IntegerAttr getLowPriorityMaxEnqueuedBatchesAttr(); + uint64_t getLowPriorityMaxEnqueuedBatches(); + ::mlir::BoolAttr getEnableLargeBatchSplittingAttr(); + bool getEnableLargeBatchSplitting(); +}; +} // namespace detail +template +class BatchFunctionOpGenericAdaptor : public detail::BatchFunctionOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BatchFunctionOpGenericAdaptorBase; +public: + BatchFunctionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BatchFunctionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BatchFunctionOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BatchFunctionOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInTensors() { + return getODSOperands(0); + } + + RangeT getCapturedTensors() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BatchFunctionOpAdaptor : public BatchFunctionOpGenericAdaptor<::mlir::ValueRange> { +public: + using BatchFunctionOpGenericAdaptor::BatchFunctionOpGenericAdaptor; + BatchFunctionOpAdaptor(BatchFunctionOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BatchFunctionOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = BatchFunctionOpAdaptor; + template + using GenericAdaptor = BatchFunctionOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tcaptured"), ::llvm::StringRef("Tin"), ::llvm::StringRef("Tout"), ::llvm::StringRef("allowed_batch_sizes"), ::llvm::StringRef("batch_timeout_micros"), ::llvm::StringRef("batching_queue"), ::llvm::StringRef("container"), ::llvm::StringRef("enable_large_batch_splitting"), ::llvm::StringRef("f"), ::llvm::StringRef("low_priority_allowed_batch_sizes"), ::llvm::StringRef("low_priority_batch_timeout_micros"), ::llvm::StringRef("low_priority_max_batch_size"), ::llvm::StringRef("low_priority_max_enqueued_batches"), ::llvm::StringRef("max_batch_size"), ::llvm::StringRef("max_enqueued_batches"), ::llvm::StringRef("num_batch_threads"), ::llvm::StringRef("operandSegmentSizes"), ::llvm::StringRef("shared_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTcapturedAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTcapturedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTinAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTinAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getToutAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getToutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getAllowedBatchSizesAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getAllowedBatchSizesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getBatchTimeoutMicrosAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getBatchTimeoutMicrosAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getBatchingQueueAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getBatchingQueueAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getContainerAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getContainerAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getEnableLargeBatchSplittingAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getEnableLargeBatchSplittingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getFAttrName() { + return getAttributeNameForIndex(8); + } + + static ::mlir::StringAttr getFAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 8); + } + + ::mlir::StringAttr getLowPriorityAllowedBatchSizesAttrName() { + return getAttributeNameForIndex(9); + } + + static ::mlir::StringAttr getLowPriorityAllowedBatchSizesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 9); + } + + ::mlir::StringAttr getLowPriorityBatchTimeoutMicrosAttrName() { + return getAttributeNameForIndex(10); + } + + static ::mlir::StringAttr getLowPriorityBatchTimeoutMicrosAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 10); + } + + ::mlir::StringAttr getLowPriorityMaxBatchSizeAttrName() { + return getAttributeNameForIndex(11); + } + + static ::mlir::StringAttr getLowPriorityMaxBatchSizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 11); + } + + ::mlir::StringAttr getLowPriorityMaxEnqueuedBatchesAttrName() { + return getAttributeNameForIndex(12); + } + + static ::mlir::StringAttr getLowPriorityMaxEnqueuedBatchesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 12); + } + + ::mlir::StringAttr getMaxBatchSizeAttrName() { + return getAttributeNameForIndex(13); + } + + static ::mlir::StringAttr getMaxBatchSizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 13); + } + + ::mlir::StringAttr getMaxEnqueuedBatchesAttrName() { + return getAttributeNameForIndex(14); + } + + static ::mlir::StringAttr getMaxEnqueuedBatchesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 14); + } + + ::mlir::StringAttr getNumBatchThreadsAttrName() { + return getAttributeNameForIndex(15); + } + + static ::mlir::StringAttr getNumBatchThreadsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 15); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return getAttributeNameForIndex(16); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 16); + } + + ::mlir::StringAttr getSharedNameAttrName() { + return getAttributeNameForIndex(17); + } + + static ::mlir::StringAttr getSharedNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 17); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.BatchFunction"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInTensors(); + ::mlir::Operation::operand_range getCapturedTensors(); + ::mlir::MutableOperandRange getInTensorsMutable(); + ::mlir::MutableOperandRange getCapturedTensorsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutTensors(); + ::mlir::SymbolRefAttr getFAttr(); + ::mlir::SymbolRefAttr getF(); + ::mlir::IntegerAttr getNumBatchThreadsAttr(); + uint64_t getNumBatchThreads(); + ::mlir::IntegerAttr getMaxBatchSizeAttr(); + uint64_t getMaxBatchSize(); + ::mlir::IntegerAttr getBatchTimeoutMicrosAttr(); + uint64_t getBatchTimeoutMicros(); + ::mlir::IntegerAttr getMaxEnqueuedBatchesAttr(); + uint64_t getMaxEnqueuedBatches(); + ::mlir::ArrayAttr getAllowedBatchSizesAttr(); + ::mlir::ArrayAttr getAllowedBatchSizes(); + ::mlir::StringAttr getContainerAttr(); + ::llvm::StringRef getContainer(); + ::mlir::StringAttr getSharedNameAttr(); + ::llvm::StringRef getSharedName(); + ::mlir::StringAttr getBatchingQueueAttr(); + ::llvm::StringRef getBatchingQueue(); + ::mlir::IntegerAttr getLowPriorityMaxBatchSizeAttr(); + uint64_t getLowPriorityMaxBatchSize(); + ::mlir::IntegerAttr getLowPriorityBatchTimeoutMicrosAttr(); + uint64_t getLowPriorityBatchTimeoutMicros(); + ::mlir::ArrayAttr getLowPriorityAllowedBatchSizesAttr(); + ::mlir::ArrayAttr getLowPriorityAllowedBatchSizes(); + ::mlir::IntegerAttr getLowPriorityMaxEnqueuedBatchesAttr(); + uint64_t getLowPriorityMaxEnqueuedBatches(); + ::mlir::BoolAttr getEnableLargeBatchSplittingAttr(); + bool getEnableLargeBatchSplitting(); + mlir::OperandElementTypeRange getTcaptured(); + mlir::OperandElementTypeRange getTin(); + mlir::ResultElementTypeRange getTout(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setFAttr(::mlir::SymbolRefAttr attr); + void setNumBatchThreadsAttr(::mlir::IntegerAttr attr); + void setNumBatchThreads(uint64_t attrValue); + void setMaxBatchSizeAttr(::mlir::IntegerAttr attr); + void setMaxBatchSize(uint64_t attrValue); + void setBatchTimeoutMicrosAttr(::mlir::IntegerAttr attr); + void setBatchTimeoutMicros(uint64_t attrValue); + void setMaxEnqueuedBatchesAttr(::mlir::IntegerAttr attr); + void setMaxEnqueuedBatches(::std::optional attrValue); + void setAllowedBatchSizesAttr(::mlir::ArrayAttr attr); + void setContainerAttr(::mlir::StringAttr attr); + void setContainer(::std::optional<::llvm::StringRef> attrValue); + void setSharedNameAttr(::mlir::StringAttr attr); + void setSharedName(::std::optional<::llvm::StringRef> attrValue); + void setBatchingQueueAttr(::mlir::StringAttr attr); + void setBatchingQueue(::std::optional<::llvm::StringRef> attrValue); + void setLowPriorityMaxBatchSizeAttr(::mlir::IntegerAttr attr); + void setLowPriorityMaxBatchSize(::std::optional attrValue); + void setLowPriorityBatchTimeoutMicrosAttr(::mlir::IntegerAttr attr); + void setLowPriorityBatchTimeoutMicros(::std::optional attrValue); + void setLowPriorityAllowedBatchSizesAttr(::mlir::ArrayAttr attr); + void setLowPriorityMaxEnqueuedBatchesAttr(::mlir::IntegerAttr attr); + void setLowPriorityMaxEnqueuedBatches(::std::optional attrValue); + void setEnableLargeBatchSplittingAttr(::mlir::BoolAttr attr); + void setEnableLargeBatchSplitting(::std::optional attrValue); + ::mlir::Attribute removeMaxEnqueuedBatchesAttr(); + ::mlir::Attribute removeAllowedBatchSizesAttr(); + ::mlir::Attribute removeContainerAttr(); + ::mlir::Attribute removeSharedNameAttr(); + ::mlir::Attribute removeBatchingQueueAttr(); + ::mlir::Attribute removeLowPriorityMaxBatchSizeAttr(); + ::mlir::Attribute removeLowPriorityBatchTimeoutMicrosAttr(); + ::mlir::Attribute removeLowPriorityAllowedBatchSizesAttr(); + ::mlir::Attribute removeLowPriorityMaxEnqueuedBatchesAttr(); + ::mlir::Attribute removeEnableLargeBatchSplittingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange out_tensors, ::mlir::ValueRange in_tensors, ::mlir::ValueRange captured_tensors, ::mlir::SymbolRefAttr f, ::mlir::IntegerAttr num_batch_threads, ::mlir::IntegerAttr max_batch_size, ::mlir::IntegerAttr batch_timeout_micros, /*optional*/::mlir::IntegerAttr max_enqueued_batches, /*optional*/::mlir::ArrayAttr allowed_batch_sizes, /*optional*/::mlir::StringAttr container, /*optional*/::mlir::StringAttr shared_name, /*optional*/::mlir::StringAttr batching_queue, /*optional*/::mlir::IntegerAttr low_priority_max_batch_size, /*optional*/::mlir::IntegerAttr low_priority_batch_timeout_micros, /*optional*/::mlir::ArrayAttr low_priority_allowed_batch_sizes, /*optional*/::mlir::IntegerAttr low_priority_max_enqueued_batches, /*optional*/::mlir::BoolAttr enable_large_batch_splitting); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange out_tensors, ::mlir::ValueRange in_tensors, ::mlir::ValueRange captured_tensors, ::mlir::SymbolRefAttr f, uint64_t num_batch_threads, uint64_t max_batch_size, uint64_t batch_timeout_micros, /*optional*/uint64_t max_enqueued_batches, /*optional*/::mlir::ArrayAttr allowed_batch_sizes, /*optional*/::llvm::StringRef container, /*optional*/::llvm::StringRef shared_name, /*optional*/::llvm::StringRef batching_queue, /*optional*/uint64_t low_priority_max_batch_size, /*optional*/uint64_t low_priority_batch_timeout_micros, /*optional*/::mlir::ArrayAttr low_priority_allowed_batch_sizes, /*optional*/uint64_t low_priority_max_enqueued_batches = 0, /*optional*/bool enable_large_batch_splitting = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verifySymbolUses(::mlir::SymbolTableCollection &symbolTable); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 18 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Returns the callee of this operation. + func::FuncOp func() { + return SymbolTable::lookupNearestSymbolFrom(*this, getF()); + } + + // Erases variable arguments from `batch_func_op`. `erase_indices` contains + // the indices of the arguments to erase. + void eraseArguments(const BitVector& erase_indices); + + // Gets the argument operands to the called function. + operand_range getArgOperands() { + // Merge `in_tensors` and `captured_tensors`. `operandSegmentSizes` + // has two elements, so it will be merging two operand ranges (the two + // variadic arguments). Attributes like `batch_timeout_micros` will not + // make it to the return array. + auto segment_sizes = getOperation()->getAttrOfType(getOperandSegmentSizeAttr()); + return OperandRangeRange(getOperands(), segment_sizes).join(); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::BatchFunctionOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::BatchMatMulOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BatchMatMulOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BatchMatMulOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BatchMatMulOpGenericAdaptorBase(BatchMatMulOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getAdjXAttr(); + bool getAdjX(); + ::mlir::BoolAttr getAdjYAttr(); + bool getAdjY(); +}; +} // namespace detail +template +class BatchMatMulOpGenericAdaptor : public detail::BatchMatMulOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BatchMatMulOpGenericAdaptorBase; +public: + BatchMatMulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BatchMatMulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BatchMatMulOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BatchMatMulOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BatchMatMulOpAdaptor : public BatchMatMulOpGenericAdaptor<::mlir::ValueRange> { +public: + using BatchMatMulOpGenericAdaptor::BatchMatMulOpGenericAdaptor; + BatchMatMulOpAdaptor(BatchMatMulOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BatchMatMulOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::SameOperandsAndResultElementTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BatchMatMulOpAdaptor; + template + using GenericAdaptor = BatchMatMulOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("adj_x"), ::llvm::StringRef("adj_y")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAdjXAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAdjXAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getAdjYAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getAdjYAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.BatchMatMul"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getAdjXAttr(); + bool getAdjX(); + ::mlir::BoolAttr getAdjYAttr(); + bool getAdjY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setAdjXAttr(::mlir::BoolAttr attr); + void setAdjX(::std::optional attrValue); + void setAdjYAttr(::mlir::BoolAttr attr); + void setAdjY(::std::optional attrValue); + ::mlir::Attribute removeAdjXAttr(); + ::mlir::Attribute removeAdjYAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value x, ::mlir::Value y, /*optional*/::mlir::BoolAttr adj_x, /*optional*/::mlir::BoolAttr adj_y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y, /*optional*/::mlir::BoolAttr adj_x, /*optional*/::mlir::BoolAttr adj_y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value x, ::mlir::Value y, /*optional*/bool adj_x = false, /*optional*/bool adj_y = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y, /*optional*/bool adj_x = false, /*optional*/bool adj_y = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::BatchMatMulOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::BatchMatMulV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BatchMatMulV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BatchMatMulV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BatchMatMulV2OpGenericAdaptorBase(BatchMatMulV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getAdjXAttr(); + bool getAdjX(); + ::mlir::BoolAttr getAdjYAttr(); + bool getAdjY(); +}; +} // namespace detail +template +class BatchMatMulV2OpGenericAdaptor : public detail::BatchMatMulV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BatchMatMulV2OpGenericAdaptorBase; +public: + BatchMatMulV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BatchMatMulV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BatchMatMulV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BatchMatMulV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BatchMatMulV2OpAdaptor : public BatchMatMulV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using BatchMatMulV2OpGenericAdaptor::BatchMatMulV2OpGenericAdaptor; + BatchMatMulV2OpAdaptor(BatchMatMulV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BatchMatMulV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::SameOperandsAndResultElementTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BatchMatMulV2OpAdaptor; + template + using GenericAdaptor = BatchMatMulV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("adj_x"), ::llvm::StringRef("adj_y")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAdjXAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAdjXAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getAdjYAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getAdjYAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.BatchMatMulV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getAdjXAttr(); + bool getAdjX(); + ::mlir::BoolAttr getAdjYAttr(); + bool getAdjY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setAdjXAttr(::mlir::BoolAttr attr); + void setAdjX(::std::optional attrValue); + void setAdjYAttr(::mlir::BoolAttr attr); + void setAdjY(::std::optional attrValue); + ::mlir::Attribute removeAdjXAttr(); + ::mlir::Attribute removeAdjYAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value x, ::mlir::Value y, /*optional*/::mlir::BoolAttr adj_x, /*optional*/::mlir::BoolAttr adj_y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y, /*optional*/::mlir::BoolAttr adj_x, /*optional*/::mlir::BoolAttr adj_y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value x, ::mlir::Value y, /*optional*/bool adj_x = false, /*optional*/bool adj_y = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y, /*optional*/bool adj_x = false, /*optional*/bool adj_y = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::BatchMatMulV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::BatchMatMulV3Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BatchMatMulV3OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BatchMatMulV3OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BatchMatMulV3OpGenericAdaptorBase(BatchMatMulV3Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getAdjXAttr(); + bool getAdjX(); + ::mlir::BoolAttr getAdjYAttr(); + bool getAdjY(); +}; +} // namespace detail +template +class BatchMatMulV3OpGenericAdaptor : public detail::BatchMatMulV3OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BatchMatMulV3OpGenericAdaptorBase; +public: + BatchMatMulV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BatchMatMulV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BatchMatMulV3OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BatchMatMulV3OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BatchMatMulV3OpAdaptor : public BatchMatMulV3OpGenericAdaptor<::mlir::ValueRange> { +public: + using BatchMatMulV3OpGenericAdaptor::BatchMatMulV3OpGenericAdaptor; + BatchMatMulV3OpAdaptor(BatchMatMulV3Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BatchMatMulV3Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BatchMatMulV3OpAdaptor; + template + using GenericAdaptor = BatchMatMulV3OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Ta"), ::llvm::StringRef("Tb"), ::llvm::StringRef("Tout"), ::llvm::StringRef("adj_x"), ::llvm::StringRef("adj_y")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTaAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTaAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTbAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTbAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getToutAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getToutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getAdjXAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getAdjXAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getAdjYAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getAdjYAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.BatchMatMulV3"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getAdjXAttr(); + bool getAdjX(); + ::mlir::BoolAttr getAdjYAttr(); + bool getAdjY(); + ::mlir::Type getTa(); + ::mlir::Type getTb(); + ::mlir::Type getTout(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setAdjXAttr(::mlir::BoolAttr attr); + void setAdjX(::std::optional attrValue); + void setAdjYAttr(::mlir::BoolAttr attr); + void setAdjY(::std::optional attrValue); + ::mlir::Attribute removeAdjXAttr(); + ::mlir::Attribute removeAdjYAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value x, ::mlir::Value y, /*optional*/::mlir::BoolAttr adj_x, /*optional*/::mlir::BoolAttr adj_y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y, /*optional*/::mlir::BoolAttr adj_x, /*optional*/::mlir::BoolAttr adj_y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value x, ::mlir::Value y, /*optional*/bool adj_x = false, /*optional*/bool adj_y = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y, /*optional*/bool adj_x = false, /*optional*/bool adj_y = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::BatchMatMulV3Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::BatchNormWithGlobalNormalizationOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BatchNormWithGlobalNormalizationOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BatchNormWithGlobalNormalizationOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BatchNormWithGlobalNormalizationOpGenericAdaptorBase(BatchNormWithGlobalNormalizationOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::FloatAttr getVarianceEpsilonAttr(); + ::llvm::APFloat getVarianceEpsilon(); + ::mlir::BoolAttr getScaleAfterNormalizationAttr(); + bool getScaleAfterNormalization(); +}; +} // namespace detail +template +class BatchNormWithGlobalNormalizationOpGenericAdaptor : public detail::BatchNormWithGlobalNormalizationOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BatchNormWithGlobalNormalizationOpGenericAdaptorBase; +public: + BatchNormWithGlobalNormalizationOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BatchNormWithGlobalNormalizationOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BatchNormWithGlobalNormalizationOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BatchNormWithGlobalNormalizationOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getM() { + return (*getODSOperands(1).begin()); + } + + ValueT getV() { + return (*getODSOperands(2).begin()); + } + + ValueT getBeta() { + return (*getODSOperands(3).begin()); + } + + ValueT getGamma() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BatchNormWithGlobalNormalizationOpAdaptor : public BatchNormWithGlobalNormalizationOpGenericAdaptor<::mlir::ValueRange> { +public: + using BatchNormWithGlobalNormalizationOpGenericAdaptor::BatchNormWithGlobalNormalizationOpGenericAdaptor; + BatchNormWithGlobalNormalizationOpAdaptor(BatchNormWithGlobalNormalizationOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BatchNormWithGlobalNormalizationOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<5>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BatchNormWithGlobalNormalizationOpAdaptor; + template + using GenericAdaptor = BatchNormWithGlobalNormalizationOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("scale_after_normalization"), ::llvm::StringRef("variance_epsilon")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getScaleAfterNormalizationAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getScaleAfterNormalizationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getVarianceEpsilonAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getVarianceEpsilonAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.BatchNormWithGlobalNormalization"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getM(); + ::mlir::TypedValue<::mlir::TensorType> getV(); + ::mlir::TypedValue<::mlir::TensorType> getBeta(); + ::mlir::TypedValue<::mlir::TensorType> getGamma(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getMMutable(); + ::mlir::OpOperand &getVMutable(); + ::mlir::OpOperand &getBetaMutable(); + ::mlir::OpOperand &getGammaMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResult(); + ::mlir::FloatAttr getVarianceEpsilonAttr(); + ::llvm::APFloat getVarianceEpsilon(); + ::mlir::BoolAttr getScaleAfterNormalizationAttr(); + bool getScaleAfterNormalization(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setVarianceEpsilonAttr(::mlir::FloatAttr attr); + void setVarianceEpsilon(::llvm::APFloat attrValue); + void setScaleAfterNormalizationAttr(::mlir::BoolAttr attr); + void setScaleAfterNormalization(bool attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value x, ::mlir::Value m, ::mlir::Value v, ::mlir::Value beta, ::mlir::Value gamma, ::mlir::FloatAttr variance_epsilon, ::mlir::BoolAttr scale_after_normalization); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value m, ::mlir::Value v, ::mlir::Value beta, ::mlir::Value gamma, ::mlir::FloatAttr variance_epsilon, ::mlir::BoolAttr scale_after_normalization); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value x, ::mlir::Value m, ::mlir::Value v, ::mlir::Value beta, ::mlir::Value gamma, ::llvm::APFloat variance_epsilon, bool scale_after_normalization); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value m, ::mlir::Value v, ::mlir::Value beta, ::mlir::Value gamma, ::llvm::APFloat variance_epsilon, bool scale_after_normalization); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::BatchNormWithGlobalNormalizationOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::BatchToSpaceNDOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BatchToSpaceNDOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BatchToSpaceNDOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BatchToSpaceNDOpGenericAdaptorBase(BatchToSpaceNDOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class BatchToSpaceNDOpGenericAdaptor : public detail::BatchToSpaceNDOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BatchToSpaceNDOpGenericAdaptorBase; +public: + BatchToSpaceNDOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BatchToSpaceNDOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BatchToSpaceNDOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BatchToSpaceNDOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getBlockShape() { + return (*getODSOperands(1).begin()); + } + + ValueT getCrops() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BatchToSpaceNDOpAdaptor : public BatchToSpaceNDOpGenericAdaptor<::mlir::ValueRange> { +public: + using BatchToSpaceNDOpGenericAdaptor::BatchToSpaceNDOpGenericAdaptor; + BatchToSpaceNDOpAdaptor(BatchToSpaceNDOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BatchToSpaceNDOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BatchToSpaceNDOpAdaptor; + template + using GenericAdaptor = BatchToSpaceNDOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tblock_shape"), ::llvm::StringRef("Tcrops")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTblockShapeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTblockShapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTcropsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTcropsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.BatchToSpaceND"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getBlockShape(); + ::mlir::TypedValue<::mlir::TensorType> getCrops(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getBlockShapeMutable(); + ::mlir::OpOperand &getCropsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTblockShape(); + ::mlir::Type getTcrops(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value block_shape, ::mlir::Value crops); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value block_shape, ::mlir::Value crops); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::BatchToSpaceNDOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::BatchToSpaceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BatchToSpaceOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BatchToSpaceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BatchToSpaceOpGenericAdaptorBase(BatchToSpaceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getBlockSizeAttr(); + uint64_t getBlockSize(); +}; +} // namespace detail +template +class BatchToSpaceOpGenericAdaptor : public detail::BatchToSpaceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BatchToSpaceOpGenericAdaptorBase; +public: + BatchToSpaceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BatchToSpaceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BatchToSpaceOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BatchToSpaceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getCrops() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BatchToSpaceOpAdaptor : public BatchToSpaceOpGenericAdaptor<::mlir::ValueRange> { +public: + using BatchToSpaceOpGenericAdaptor::BatchToSpaceOpGenericAdaptor; + BatchToSpaceOpAdaptor(BatchToSpaceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BatchToSpaceOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BatchToSpaceOpAdaptor; + template + using GenericAdaptor = BatchToSpaceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tidx"), ::llvm::StringRef("block_size")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTidxAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTidxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getBlockSizeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getBlockSizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.BatchToSpace"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getCrops(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getCropsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getBlockSizeAttr(); + uint64_t getBlockSize(); + ::mlir::Type getT(); + ::mlir::Type getTidx(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setBlockSizeAttr(::mlir::IntegerAttr attr); + void setBlockSize(uint64_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value crops, ::mlir::IntegerAttr block_size); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value crops, ::mlir::IntegerAttr block_size); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value crops, uint64_t block_size); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value crops, uint64_t block_size); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::BatchToSpaceOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::BesselI0eOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BesselI0eOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BesselI0eOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BesselI0eOpGenericAdaptorBase(BesselI0eOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class BesselI0eOpGenericAdaptor : public detail::BesselI0eOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BesselI0eOpGenericAdaptorBase; +public: + BesselI0eOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BesselI0eOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BesselI0eOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BesselI0eOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BesselI0eOpAdaptor : public BesselI0eOpGenericAdaptor<::mlir::ValueRange> { +public: + using BesselI0eOpGenericAdaptor::BesselI0eOpGenericAdaptor; + BesselI0eOpAdaptor(BesselI0eOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BesselI0eOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BesselI0eOpAdaptor; + template + using GenericAdaptor = BesselI0eOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.BesselI0e"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::BesselI0eOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::BesselI1eOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BesselI1eOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BesselI1eOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BesselI1eOpGenericAdaptorBase(BesselI1eOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class BesselI1eOpGenericAdaptor : public detail::BesselI1eOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BesselI1eOpGenericAdaptorBase; +public: + BesselI1eOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BesselI1eOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BesselI1eOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BesselI1eOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BesselI1eOpAdaptor : public BesselI1eOpGenericAdaptor<::mlir::ValueRange> { +public: + using BesselI1eOpGenericAdaptor::BesselI1eOpGenericAdaptor; + BesselI1eOpAdaptor(BesselI1eOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BesselI1eOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BesselI1eOpAdaptor; + template + using GenericAdaptor = BesselI1eOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.BesselI1e"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::BesselI1eOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::BetaincOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BetaincOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BetaincOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BetaincOpGenericAdaptorBase(BetaincOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class BetaincOpGenericAdaptor : public detail::BetaincOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BetaincOpGenericAdaptorBase; +public: + BetaincOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BetaincOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BetaincOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BetaincOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + ValueT getB() { + return (*getODSOperands(1).begin()); + } + + ValueT getX() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BetaincOpAdaptor : public BetaincOpGenericAdaptor<::mlir::ValueRange> { +public: + using BetaincOpGenericAdaptor::BetaincOpGenericAdaptor; + BetaincOpAdaptor(BetaincOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BetaincOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BetaincOpAdaptor; + template + using GenericAdaptor = BetaincOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Betainc"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getA(); + ::mlir::TypedValue<::mlir::TensorType> getB(); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getAMutable(); + ::mlir::OpOperand &getBMutable(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value a, ::mlir::Value b, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::BetaincOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::BiasAddGradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BiasAddGradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BiasAddGradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BiasAddGradOpGenericAdaptorBase(BiasAddGradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); +}; +} // namespace detail +template +class BiasAddGradOpGenericAdaptor : public detail::BiasAddGradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BiasAddGradOpGenericAdaptorBase; +public: + BiasAddGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BiasAddGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BiasAddGradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BiasAddGradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOutBackprop() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BiasAddGradOpAdaptor : public BiasAddGradOpGenericAdaptor<::mlir::ValueRange> { +public: + using BiasAddGradOpGenericAdaptor::BiasAddGradOpGenericAdaptor; + BiasAddGradOpAdaptor(BiasAddGradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BiasAddGradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BiasAddGradOpAdaptor; + template + using GenericAdaptor = BiasAddGradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("data_format")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.BiasAddGrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutBackprop(); + ::mlir::OpOperand &getOutBackpropMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeDataFormatAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value out_backprop, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value out_backprop, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value out_backprop, /*optional*/::llvm::StringRef data_format = "NHWC"); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value out_backprop, /*optional*/::llvm::StringRef data_format = "NHWC"); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::BiasAddGradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::BiasAddOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BiasAddOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BiasAddOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BiasAddOpGenericAdaptorBase(BiasAddOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); +}; +} // namespace detail +template +class BiasAddOpGenericAdaptor : public detail::BiasAddOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BiasAddOpGenericAdaptorBase; +public: + BiasAddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BiasAddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BiasAddOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BiasAddOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getValue() { + return (*getODSOperands(0).begin()); + } + + ValueT getBias() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BiasAddOpAdaptor : public BiasAddOpGenericAdaptor<::mlir::ValueRange> { +public: + using BiasAddOpGenericAdaptor::BiasAddOpGenericAdaptor; + BiasAddOpAdaptor(BiasAddOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BiasAddOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, LayoutSensitiveInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BiasAddOpAdaptor; + template + using GenericAdaptor = BiasAddOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("data_format")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.BiasAdd"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getValue(); + ::mlir::TypedValue<::mlir::TensorType> getBias(); + ::mlir::OpOperand &getValueMutable(); + ::mlir::OpOperand &getBiasMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeDataFormatAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value value, ::mlir::Value bias, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value bias, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value value, ::mlir::Value bias, /*optional*/::llvm::StringRef data_format = "NHWC"); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value bias, /*optional*/::llvm::StringRef data_format = "NHWC"); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // TF_LayoutSensitiveInterface: + SmallVector GetLayoutDependentArgs() { return {0}; } + SmallVector GetLayoutDependentResults() { return {0}; } + StringRef GetOptimalLayout(const RuntimeDevices& devices); + LogicalResult UpdateDataFormat(StringRef data_format); +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::BiasAddOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::BiasAddV1Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BiasAddV1OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BiasAddV1OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BiasAddV1OpGenericAdaptorBase(BiasAddV1Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class BiasAddV1OpGenericAdaptor : public detail::BiasAddV1OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BiasAddV1OpGenericAdaptorBase; +public: + BiasAddV1OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BiasAddV1OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BiasAddV1OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BiasAddV1OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getValue() { + return (*getODSOperands(0).begin()); + } + + ValueT getBias() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BiasAddV1OpAdaptor : public BiasAddV1OpGenericAdaptor<::mlir::ValueRange> { +public: + using BiasAddV1OpGenericAdaptor::BiasAddV1OpGenericAdaptor; + BiasAddV1OpAdaptor(BiasAddV1Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BiasAddV1Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BiasAddV1OpAdaptor; + template + using GenericAdaptor = BiasAddV1OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.BiasAddV1"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getValue(); + ::mlir::TypedValue<::mlir::TensorType> getBias(); + ::mlir::OpOperand &getValueMutable(); + ::mlir::OpOperand &getBiasMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value value, ::mlir::Value bias); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, ::mlir::Value bias); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::BiasAddV1Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::BincountOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BincountOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BincountOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BincountOpGenericAdaptorBase(BincountOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class BincountOpGenericAdaptor : public detail::BincountOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BincountOpGenericAdaptorBase; +public: + BincountOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BincountOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BincountOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BincountOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getArr() { + return (*getODSOperands(0).begin()); + } + + ValueT getSize() { + return (*getODSOperands(1).begin()); + } + + ValueT getWeights() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BincountOpAdaptor : public BincountOpGenericAdaptor<::mlir::ValueRange> { +public: + using BincountOpGenericAdaptor::BincountOpGenericAdaptor; + BincountOpAdaptor(BincountOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BincountOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BincountOpAdaptor; + template + using GenericAdaptor = BincountOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Bincount"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getArr(); + ::mlir::TypedValue<::mlir::TensorType> getSize(); + ::mlir::TypedValue<::mlir::TensorType> getWeights(); + ::mlir::OpOperand &getArrMutable(); + ::mlir::OpOperand &getSizeMutable(); + ::mlir::OpOperand &getWeightsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getBins(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type bins, ::mlir::Value arr, ::mlir::Value size, ::mlir::Value weights); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arr, ::mlir::Value size, ::mlir::Value weights); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::BincountOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::BitcastOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BitcastOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BitcastOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BitcastOpGenericAdaptorBase(BitcastOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class BitcastOpGenericAdaptor : public detail::BitcastOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BitcastOpGenericAdaptorBase; +public: + BitcastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BitcastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BitcastOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BitcastOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BitcastOpAdaptor : public BitcastOpGenericAdaptor<::mlir::ValueRange> { +public: + using BitcastOpGenericAdaptor::BitcastOpGenericAdaptor; + BitcastOpAdaptor(BitcastOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BitcastOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BitcastOpAdaptor; + template + using GenericAdaptor = BitcastOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("type")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Bitcast"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getType(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::BitcastOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::BitwiseAndOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BitwiseAndOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BitwiseAndOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BitwiseAndOpGenericAdaptorBase(BitwiseAndOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class BitwiseAndOpGenericAdaptor : public detail::BitwiseAndOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BitwiseAndOpGenericAdaptorBase; +public: + BitwiseAndOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BitwiseAndOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BitwiseAndOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BitwiseAndOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BitwiseAndOpAdaptor : public BitwiseAndOpGenericAdaptor<::mlir::ValueRange> { +public: + using BitwiseAndOpGenericAdaptor::BitwiseAndOpGenericAdaptor; + BitwiseAndOpAdaptor(BitwiseAndOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BitwiseAndOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsCommutative, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BitwiseAndOpAdaptor; + template + using GenericAdaptor = BitwiseAndOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.BitwiseAnd"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::BitwiseAndOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::BitwiseOrOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BitwiseOrOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BitwiseOrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BitwiseOrOpGenericAdaptorBase(BitwiseOrOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class BitwiseOrOpGenericAdaptor : public detail::BitwiseOrOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BitwiseOrOpGenericAdaptorBase; +public: + BitwiseOrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BitwiseOrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BitwiseOrOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BitwiseOrOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BitwiseOrOpAdaptor : public BitwiseOrOpGenericAdaptor<::mlir::ValueRange> { +public: + using BitwiseOrOpGenericAdaptor::BitwiseOrOpGenericAdaptor; + BitwiseOrOpAdaptor(BitwiseOrOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BitwiseOrOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsCommutative, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BitwiseOrOpAdaptor; + template + using GenericAdaptor = BitwiseOrOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.BitwiseOr"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::BitwiseOrOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::BitwiseXorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BitwiseXorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BitwiseXorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BitwiseXorOpGenericAdaptorBase(BitwiseXorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class BitwiseXorOpGenericAdaptor : public detail::BitwiseXorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BitwiseXorOpGenericAdaptorBase; +public: + BitwiseXorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BitwiseXorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BitwiseXorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BitwiseXorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BitwiseXorOpAdaptor : public BitwiseXorOpGenericAdaptor<::mlir::ValueRange> { +public: + using BitwiseXorOpGenericAdaptor::BitwiseXorOpGenericAdaptor; + BitwiseXorOpAdaptor(BitwiseXorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BitwiseXorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsCommutative, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BitwiseXorOpAdaptor; + template + using GenericAdaptor = BitwiseXorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.BitwiseXor"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::BitwiseXorOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::BoostedTreesBucketizeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BoostedTreesBucketizeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BoostedTreesBucketizeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BoostedTreesBucketizeOpGenericAdaptorBase(BoostedTreesBucketizeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class BoostedTreesBucketizeOpGenericAdaptor : public detail::BoostedTreesBucketizeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BoostedTreesBucketizeOpGenericAdaptorBase; +public: + BoostedTreesBucketizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BoostedTreesBucketizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BoostedTreesBucketizeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BoostedTreesBucketizeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getFloatValues() { + return getODSOperands(0); + } + + RangeT getBucketBoundaries() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BoostedTreesBucketizeOpAdaptor : public BoostedTreesBucketizeOpGenericAdaptor<::mlir::ValueRange> { +public: + using BoostedTreesBucketizeOpGenericAdaptor::BoostedTreesBucketizeOpGenericAdaptor; + BoostedTreesBucketizeOpAdaptor(BoostedTreesBucketizeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BoostedTreesBucketizeOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = BoostedTreesBucketizeOpAdaptor; + template + using GenericAdaptor = BoostedTreesBucketizeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("num_features")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNumFeaturesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNumFeaturesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.BoostedTreesBucketize"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getFloatValues(); + ::mlir::Operation::operand_range getBucketBoundaries(); + ::mlir::MutableOperandRange getFloatValuesMutable(); + ::mlir::MutableOperandRange getBucketBoundariesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getBuckets(); + size_t getNumFeatures(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange buckets, ::mlir::ValueRange float_values, ::mlir::ValueRange bucket_boundaries); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::BoostedTreesBucketizeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::BroadcastArgsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BroadcastArgsOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BroadcastArgsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BroadcastArgsOpGenericAdaptorBase(BroadcastArgsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class BroadcastArgsOpGenericAdaptor : public detail::BroadcastArgsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BroadcastArgsOpGenericAdaptorBase; +public: + BroadcastArgsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BroadcastArgsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BroadcastArgsOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BroadcastArgsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getS0() { + return (*getODSOperands(0).begin()); + } + + ValueT getS1() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BroadcastArgsOpAdaptor : public BroadcastArgsOpGenericAdaptor<::mlir::ValueRange> { +public: + using BroadcastArgsOpGenericAdaptor::BroadcastArgsOpGenericAdaptor; + BroadcastArgsOpAdaptor(BroadcastArgsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BroadcastArgsOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BroadcastArgsOpAdaptor; + template + using GenericAdaptor = BroadcastArgsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.BroadcastArgs"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getS0(); + ::mlir::TypedValue<::mlir::TensorType> getS1(); + ::mlir::OpOperand &getS0Mutable(); + ::mlir::OpOperand &getS1Mutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getR0(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type r0, ::mlir::Value s0, ::mlir::Value s1); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value s0, ::mlir::Value s1); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::BroadcastArgsOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::BroadcastGradientArgsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BroadcastGradientArgsOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BroadcastGradientArgsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BroadcastGradientArgsOpGenericAdaptorBase(BroadcastGradientArgsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class BroadcastGradientArgsOpGenericAdaptor : public detail::BroadcastGradientArgsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BroadcastGradientArgsOpGenericAdaptorBase; +public: + BroadcastGradientArgsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BroadcastGradientArgsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BroadcastGradientArgsOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BroadcastGradientArgsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getS0() { + return (*getODSOperands(0).begin()); + } + + ValueT getS1() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BroadcastGradientArgsOpAdaptor : public BroadcastGradientArgsOpGenericAdaptor<::mlir::ValueRange> { +public: + using BroadcastGradientArgsOpGenericAdaptor::BroadcastGradientArgsOpGenericAdaptor; + BroadcastGradientArgsOpAdaptor(BroadcastGradientArgsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BroadcastGradientArgsOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultElementType, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BroadcastGradientArgsOpAdaptor; + template + using GenericAdaptor = BroadcastGradientArgsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.BroadcastGradientArgs"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getS0(); + ::mlir::TypedValue<::mlir::TensorType> getS1(); + ::mlir::OpOperand &getS0Mutable(); + ::mlir::OpOperand &getS1Mutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getR0(); + ::mlir::TypedValue<::mlir::TensorType> getR1(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type r0, ::mlir::Type r1, ::mlir::Value s0, ::mlir::Value s1); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value s0, ::mlir::Value s1); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::BroadcastGradientArgsOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::BroadcastToOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BroadcastToOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BroadcastToOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BroadcastToOpGenericAdaptorBase(BroadcastToOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class BroadcastToOpGenericAdaptor : public detail::BroadcastToOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BroadcastToOpGenericAdaptorBase; +public: + BroadcastToOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BroadcastToOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BroadcastToOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BroadcastToOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getShape() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BroadcastToOpAdaptor : public BroadcastToOpGenericAdaptor<::mlir::ValueRange> { +public: + using BroadcastToOpGenericAdaptor::BroadcastToOpGenericAdaptor; + BroadcastToOpAdaptor(BroadcastToOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BroadcastToOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BroadcastToOpAdaptor; + template + using GenericAdaptor = BroadcastToOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tidx")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTidxAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTidxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.BroadcastTo"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getShapeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTidx(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value shape); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::BroadcastToOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::BucketizeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BucketizeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BucketizeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BucketizeOpGenericAdaptorBase(BucketizeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getBoundariesAttr(); + ::mlir::ArrayAttr getBoundaries(); +}; +} // namespace detail +template +class BucketizeOpGenericAdaptor : public detail::BucketizeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BucketizeOpGenericAdaptorBase; +public: + BucketizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BucketizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BucketizeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BucketizeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BucketizeOpAdaptor : public BucketizeOpGenericAdaptor<::mlir::ValueRange> { +public: + using BucketizeOpGenericAdaptor::BucketizeOpGenericAdaptor; + BucketizeOpAdaptor(BucketizeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BucketizeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BucketizeOpAdaptor; + template + using GenericAdaptor = BucketizeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("boundaries")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getBoundariesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getBoundariesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Bucketize"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ArrayAttr getBoundariesAttr(); + ::mlir::ArrayAttr getBoundaries(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setBoundariesAttr(::mlir::ArrayAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::ArrayAttr boundaries); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::ArrayAttr boundaries); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::BucketizeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::CacheDatasetV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CacheDatasetV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CacheDatasetV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CacheDatasetV2OpGenericAdaptorBase(CacheDatasetV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); +}; +} // namespace detail +template +class CacheDatasetV2OpGenericAdaptor : public detail::CacheDatasetV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CacheDatasetV2OpGenericAdaptorBase; +public: + CacheDatasetV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CacheDatasetV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CacheDatasetV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CacheDatasetV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputDataset() { + return (*getODSOperands(0).begin()); + } + + ValueT getFilename() { + return (*getODSOperands(1).begin()); + } + + ValueT getCache() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CacheDatasetV2OpAdaptor : public CacheDatasetV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using CacheDatasetV2OpGenericAdaptor::CacheDatasetV2OpGenericAdaptor; + CacheDatasetV2OpAdaptor(CacheDatasetV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CacheDatasetV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CacheDatasetV2OpAdaptor; + template + using GenericAdaptor = CacheDatasetV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("metadata"), ::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getMetadataAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getMetadataAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.CacheDatasetV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputDataset(); + ::mlir::TypedValue<::mlir::TensorType> getFilename(); + ::mlir::TypedValue<::mlir::TensorType> getCache(); + ::mlir::OpOperand &getInputDatasetMutable(); + ::mlir::OpOperand &getFilenameMutable(); + ::mlir::OpOperand &getCacheMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + void setMetadataAttr(::mlir::StringAttr attr); + void setMetadata(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeMetadataAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, ::mlir::Value filename, ::mlir::Value cache, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, ::mlir::Value filename, ::mlir::Value cache, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, ::mlir::Value filename, ::mlir::Value cache, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::llvm::StringRef metadata = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, ::mlir::Value filename, ::mlir::Value cache, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::llvm::StringRef metadata = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::CacheDatasetV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::CaseOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CaseOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CaseOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CaseOpGenericAdaptorBase(CaseOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getBranchesAttr(); + ::mlir::ArrayAttr getBranches(); + ::mlir::BoolAttr getIsStatelessAttr(); + bool getIsStateless(); +}; +} // namespace detail +template +class CaseOpGenericAdaptor : public detail::CaseOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CaseOpGenericAdaptorBase; +public: + CaseOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CaseOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CaseOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CaseOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getBranchIndex() { + return (*getODSOperands(0).begin()); + } + + RangeT getInput() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CaseOpAdaptor : public CaseOpGenericAdaptor<::mlir::ValueRange> { +public: + using CaseOpGenericAdaptor::CaseOpGenericAdaptor; + CaseOpAdaptor(CaseOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CaseOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::SymbolUserOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CaseOpAdaptor; + template + using GenericAdaptor = CaseOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tin"), ::llvm::StringRef("Tout"), ::llvm::StringRef("branches"), ::llvm::StringRef("is_stateless"), ::llvm::StringRef("output_shapes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTinAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTinAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getToutAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getToutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getBranchesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getBranchesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getIsStatelessAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getIsStatelessAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Case"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getBranchIndex(); + ::mlir::Operation::operand_range getInput(); + ::mlir::OpOperand &getBranchIndexMutable(); + ::mlir::MutableOperandRange getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutput(); + ::mlir::ArrayAttr getBranchesAttr(); + ::mlir::ArrayAttr getBranches(); + ::mlir::BoolAttr getIsStatelessAttr(); + bool getIsStateless(); + mlir::OperandElementTypeRange getTin(); + mlir::ResultElementTypeRange getTout(); + mlir::TF::ResultShapeRange getOutputShapes(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setBranchesAttr(::mlir::ArrayAttr attr); + void setIsStatelessAttr(::mlir::BoolAttr attr); + void setIsStateless(bool attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::Value branch_index, ::mlir::ValueRange input, ::mlir::ArrayAttr branches, ::mlir::BoolAttr is_stateless); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::Value branch_index, ::mlir::ValueRange input, ::mlir::ArrayAttr branches, bool is_stateless); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::LogicalResult verifySymbolUses(::mlir::SymbolTableCollection &symbolTable); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + int num_branches() { return getBranches().size(); } + + // Gets function corresponding branch # `index`. + // Prefer passing in SymbolTableCollection to reduce lookup costs by + // enabling reusing cached symbol table lookup. + func::FuncOp ResolveBranchFunction(::mlir::SymbolTableCollection* table, int index) { + auto flat_sym_ref = getBranches()[index].cast(); + if (table) + return table->lookupNearestSymbolFrom(*this, flat_sym_ref); + return SymbolTable::lookupNearestSymbolFrom(*this, flat_sym_ref); + } + // TODO(b/204997177): Deprecate and remove. + func::FuncOp branch_function(int index) { return ResolveBranchFunction(nullptr, index); } + + // Resolve all branch functions. + // Prefer passing in SymbolTableCollection to reduce lookup costs by + // enabling reusing cached symbol table lookup. + void ResolveBranchFunctions(::mlir::SymbolTableCollection* table, + SmallVectorImpl &functions) { + functions.reserve(num_branches()); + for (int idx : llvm::seq(0, num_branches())) + functions.push_back(ResolveBranchFunction(table, idx)); + } + // TODO(b/204997177): Deprecate and remove. + void get_branch_functions(SmallVectorImpl &functions) { + return ResolveBranchFunctions(nullptr, functions); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::CaseOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::CaseRegionOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CaseRegionOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CaseRegionOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CaseRegionOpGenericAdaptorBase(CaseRegionOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getIsStatelessAttr(); + bool getIsStateless(); + ::mlir::RegionRange getBranches(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class CaseRegionOpGenericAdaptor : public detail::CaseRegionOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CaseRegionOpGenericAdaptorBase; +public: + CaseRegionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CaseRegionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CaseRegionOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CaseRegionOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getBranchIndex() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CaseRegionOpAdaptor : public CaseRegionOpGenericAdaptor<::mlir::ValueRange> { +public: + using CaseRegionOpGenericAdaptor::CaseRegionOpGenericAdaptor; + CaseRegionOpAdaptor(CaseRegionOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CaseRegionOp : public ::mlir::Op::Impl, ::mlir::OpTrait::NoRegionArguments, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = CaseRegionOpAdaptor; + template + using GenericAdaptor = CaseRegionOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("is_stateless")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getIsStatelessAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getIsStatelessAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.CaseRegion"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getBranchIndex(); + ::mlir::OpOperand &getBranchIndexMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutput(); + ::mlir::MutableArrayRef<::mlir::Region> getBranches(); + ::mlir::BoolAttr getIsStatelessAttr(); + bool getIsStateless(); + void setIsStatelessAttr(::mlir::BoolAttr attr); + void setIsStateless(bool attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::Value branch_index, ::mlir::BoolAttr is_stateless, unsigned branchesCount); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::Value branch_index, bool is_stateless, unsigned branchesCount); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes, unsigned numRegions); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::CaseRegionOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::CastOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CastOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CastOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CastOpGenericAdaptorBase(CastOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getTruncateAttr(); + bool getTruncate(); +}; +} // namespace detail +template +class CastOpGenericAdaptor : public detail::CastOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CastOpGenericAdaptorBase; +public: + CastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CastOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CastOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CastOpAdaptor : public CastOpGenericAdaptor<::mlir::ValueRange> { +public: + using CastOpGenericAdaptor::CastOpGenericAdaptor; + CastOpAdaptor(CastOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CastOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CastOpAdaptor; + template + using GenericAdaptor = CastOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("DstT"), ::llvm::StringRef("SrcT"), ::llvm::StringRef("Truncate")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDstTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDstTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getSrcTAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getSrcTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTruncateAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTruncateAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Cast"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::BoolAttr getTruncateAttr(); + bool getTruncate(); + ::mlir::Type getSrcT(); + ::mlir::Type getDstT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setTruncateAttr(::mlir::BoolAttr attr); + void setTruncate(::std::optional attrValue); + ::mlir::Attribute removeTruncateAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x, /*optional*/::mlir::BoolAttr Truncate); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, /*optional*/::mlir::BoolAttr Truncate); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x, /*optional*/bool Truncate = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, /*optional*/bool Truncate = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::CastOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::CeilOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CeilOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CeilOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CeilOpGenericAdaptorBase(CeilOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CeilOpGenericAdaptor : public detail::CeilOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CeilOpGenericAdaptorBase; +public: + CeilOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CeilOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CeilOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CeilOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CeilOpAdaptor : public CeilOpGenericAdaptor<::mlir::ValueRange> { +public: + using CeilOpGenericAdaptor::CeilOpGenericAdaptor; + CeilOpAdaptor(CeilOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CeilOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::IsIdempotent, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CeilOpAdaptor; + template + using GenericAdaptor = CeilOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Ceil"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::CeilOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::CheckNumericsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CheckNumericsOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CheckNumericsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CheckNumericsOpGenericAdaptorBase(CheckNumericsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getMessageAttr(); + ::llvm::StringRef getMessage(); +}; +} // namespace detail +template +class CheckNumericsOpGenericAdaptor : public detail::CheckNumericsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CheckNumericsOpGenericAdaptorBase; +public: + CheckNumericsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CheckNumericsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CheckNumericsOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CheckNumericsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTensor() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CheckNumericsOpAdaptor : public CheckNumericsOpGenericAdaptor<::mlir::ValueRange> { +public: + using CheckNumericsOpGenericAdaptor::CheckNumericsOpGenericAdaptor; + CheckNumericsOpAdaptor(CheckNumericsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CheckNumericsOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CheckNumericsOpAdaptor; + template + using GenericAdaptor = CheckNumericsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("message")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getMessageAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getMessageAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.CheckNumerics"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::OpOperand &getTensorMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::StringAttr getMessageAttr(); + ::llvm::StringRef getMessage(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setMessageAttr(::mlir::StringAttr attr); + void setMessage(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value tensor, ::mlir::StringAttr message); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value tensor, ::mlir::StringAttr message); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tensor, ::mlir::StringAttr message); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value tensor, ::llvm::StringRef message); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value tensor, ::llvm::StringRef message); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tensor, ::llvm::StringRef message); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::CheckNumericsOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::CholeskyOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CholeskyOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CholeskyOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CholeskyOpGenericAdaptorBase(CholeskyOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CholeskyOpGenericAdaptor : public detail::CholeskyOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CholeskyOpGenericAdaptorBase; +public: + CholeskyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CholeskyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CholeskyOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CholeskyOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CholeskyOpAdaptor : public CholeskyOpGenericAdaptor<::mlir::ValueRange> { +public: + using CholeskyOpGenericAdaptor::CholeskyOpGenericAdaptor; + CholeskyOpAdaptor(CholeskyOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CholeskyOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CholeskyOpAdaptor; + template + using GenericAdaptor = CholeskyOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Cholesky"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::CholeskyOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ClipByValueOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ClipByValueOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ClipByValueOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ClipByValueOpGenericAdaptorBase(ClipByValueOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ClipByValueOpGenericAdaptor : public detail::ClipByValueOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ClipByValueOpGenericAdaptorBase; +public: + ClipByValueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ClipByValueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ClipByValueOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ClipByValueOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getClipValueMin() { + return (*getODSOperands(1).begin()); + } + + ValueT getClipValueMax() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ClipByValueOpAdaptor : public ClipByValueOpGenericAdaptor<::mlir::ValueRange> { +public: + using ClipByValueOpGenericAdaptor::ClipByValueOpGenericAdaptor; + ClipByValueOpAdaptor(ClipByValueOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ClipByValueOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::SameOperandsAndResultElementTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ClipByValueOpAdaptor; + template + using GenericAdaptor = ClipByValueOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ClipByValue"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getClipValueMin(); + ::mlir::TypedValue<::mlir::TensorType> getClipValueMax(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getClipValueMinMutable(); + ::mlir::OpOperand &getClipValueMaxMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value x, ::mlir::Value clip_value_min, ::mlir::Value clip_value_max); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value clip_value_min, ::mlir::Value clip_value_max); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ClipByValueOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::CloseSummaryWriterOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CloseSummaryWriterOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CloseSummaryWriterOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CloseSummaryWriterOpGenericAdaptorBase(CloseSummaryWriterOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CloseSummaryWriterOpGenericAdaptor : public detail::CloseSummaryWriterOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CloseSummaryWriterOpGenericAdaptorBase; +public: + CloseSummaryWriterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CloseSummaryWriterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CloseSummaryWriterOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CloseSummaryWriterOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getWriter() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CloseSummaryWriterOpAdaptor : public CloseSummaryWriterOpGenericAdaptor<::mlir::ValueRange> { +public: + using CloseSummaryWriterOpGenericAdaptor::CloseSummaryWriterOpGenericAdaptor; + CloseSummaryWriterOpAdaptor(CloseSummaryWriterOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CloseSummaryWriterOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = CloseSummaryWriterOpAdaptor; + template + using GenericAdaptor = CloseSummaryWriterOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.CloseSummaryWriter"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getWriter(); + ::mlir::OpOperand &getWriterMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value writer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value writer); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::CloseSummaryWriterOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::CollateTPUEmbeddingMemoryOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CollateTPUEmbeddingMemoryOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CollateTPUEmbeddingMemoryOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CollateTPUEmbeddingMemoryOpGenericAdaptorBase(CollateTPUEmbeddingMemoryOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CollateTPUEmbeddingMemoryOpGenericAdaptor : public detail::CollateTPUEmbeddingMemoryOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CollateTPUEmbeddingMemoryOpGenericAdaptorBase; +public: + CollateTPUEmbeddingMemoryOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CollateTPUEmbeddingMemoryOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CollateTPUEmbeddingMemoryOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CollateTPUEmbeddingMemoryOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getMemoryConfigs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CollateTPUEmbeddingMemoryOpAdaptor : public CollateTPUEmbeddingMemoryOpGenericAdaptor<::mlir::ValueRange> { +public: + using CollateTPUEmbeddingMemoryOpGenericAdaptor::CollateTPUEmbeddingMemoryOpGenericAdaptor; + CollateTPUEmbeddingMemoryOpAdaptor(CollateTPUEmbeddingMemoryOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CollateTPUEmbeddingMemoryOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CollateTPUEmbeddingMemoryOpAdaptor; + template + using GenericAdaptor = CollateTPUEmbeddingMemoryOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("N")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.CollateTPUEmbeddingMemory"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getMemoryConfigs(); + ::mlir::MutableOperandRange getMemoryConfigsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getMergedMemoryConfig(); + size_t getN(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type merged_memory_config, ::mlir::ValueRange memory_configs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::CollateTPUEmbeddingMemoryOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::CollectiveAllToAllV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CollectiveAllToAllV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CollectiveAllToAllV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CollectiveAllToAllV2OpGenericAdaptorBase(CollectiveAllToAllV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getCommunicationHintAttr(); + ::llvm::StringRef getCommunicationHint(); + ::mlir::FloatAttr getTimeoutSecondsAttr(); + ::llvm::APFloat getTimeoutSeconds(); + ::mlir::BoolAttr getIsStatelessAttr(); + bool getIsStateless(); +}; +} // namespace detail +template +class CollectiveAllToAllV2OpGenericAdaptor : public detail::CollectiveAllToAllV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CollectiveAllToAllV2OpGenericAdaptorBase; +public: + CollectiveAllToAllV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CollectiveAllToAllV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CollectiveAllToAllV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CollectiveAllToAllV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getGroupSize() { + return (*getODSOperands(1).begin()); + } + + ValueT getGroupKey() { + return (*getODSOperands(2).begin()); + } + + ValueT getInstanceKey() { + return (*getODSOperands(3).begin()); + } + + RangeT getOrderingToken() { + return getODSOperands(4); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CollectiveAllToAllV2OpAdaptor : public CollectiveAllToAllV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using CollectiveAllToAllV2OpGenericAdaptor::CollectiveAllToAllV2OpGenericAdaptor; + CollectiveAllToAllV2OpAdaptor(CollectiveAllToAllV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CollectiveAllToAllV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, GetResourceInstanceInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CollectiveAllToAllV2OpAdaptor; + template + using GenericAdaptor = CollectiveAllToAllV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Nordering_token"), ::llvm::StringRef("T"), ::llvm::StringRef("communication_hint"), ::llvm::StringRef("is_stateless"), ::llvm::StringRef("timeout_seconds")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNorderingTokenAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNorderingTokenAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getCommunicationHintAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getCommunicationHintAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getIsStatelessAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getIsStatelessAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTimeoutSecondsAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTimeoutSecondsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.CollectiveAllToAllV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getGroupSize(); + ::mlir::TypedValue<::mlir::TensorType> getGroupKey(); + ::mlir::TypedValue<::mlir::TensorType> getInstanceKey(); + ::mlir::Operation::operand_range getOrderingToken(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getGroupSizeMutable(); + ::mlir::OpOperand &getGroupKeyMutable(); + ::mlir::OpOperand &getInstanceKeyMutable(); + ::mlir::MutableOperandRange getOrderingTokenMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getData(); + ::mlir::StringAttr getCommunicationHintAttr(); + ::llvm::StringRef getCommunicationHint(); + ::mlir::FloatAttr getTimeoutSecondsAttr(); + ::llvm::APFloat getTimeoutSeconds(); + ::mlir::BoolAttr getIsStatelessAttr(); + bool getIsStateless(); + size_t getNorderingToken(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setCommunicationHintAttr(::mlir::StringAttr attr); + void setCommunicationHint(::std::optional<::llvm::StringRef> attrValue); + void setTimeoutSecondsAttr(::mlir::FloatAttr attr); + void setTimeoutSeconds(::std::optional<::llvm::APFloat> attrValue); + void setIsStatelessAttr(::mlir::BoolAttr attr); + void setIsStateless(::std::optional attrValue); + ::mlir::Attribute removeCommunicationHintAttr(); + ::mlir::Attribute removeTimeoutSecondsAttr(); + ::mlir::Attribute removeIsStatelessAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type data, ::mlir::Value input, ::mlir::Value group_size, ::mlir::Value group_key, ::mlir::Value instance_key, ::mlir::ValueRange ordering_token, /*optional*/::mlir::StringAttr communication_hint, /*optional*/::mlir::FloatAttr timeout_seconds, /*optional*/::mlir::BoolAttr is_stateless); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value group_size, ::mlir::Value group_key, ::mlir::Value instance_key, ::mlir::ValueRange ordering_token, /*optional*/::mlir::StringAttr communication_hint, /*optional*/::mlir::FloatAttr timeout_seconds, /*optional*/::mlir::BoolAttr is_stateless); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type data, ::mlir::Value input, ::mlir::Value group_size, ::mlir::Value group_key, ::mlir::Value instance_key, ::mlir::ValueRange ordering_token, /*optional*/::llvm::StringRef communication_hint, /*optional*/::llvm::APFloat timeout_seconds, /*optional*/bool is_stateless = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value group_size, ::mlir::Value group_key, ::mlir::Value instance_key, ::mlir::ValueRange ordering_token, /*optional*/::llvm::StringRef communication_hint, /*optional*/::llvm::APFloat timeout_seconds, /*optional*/bool is_stateless = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + std::optional GetResourceInstanceStr(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::CollectiveAllToAllV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::CollectiveAssignGroupV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CollectiveAssignGroupV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CollectiveAssignGroupV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CollectiveAssignGroupV2OpGenericAdaptorBase(CollectiveAssignGroupV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CollectiveAssignGroupV2OpGenericAdaptor : public detail::CollectiveAssignGroupV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CollectiveAssignGroupV2OpGenericAdaptorBase; +public: + CollectiveAssignGroupV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CollectiveAssignGroupV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CollectiveAssignGroupV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CollectiveAssignGroupV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getGroupAssignment() { + return (*getODSOperands(0).begin()); + } + + ValueT getDeviceIndex() { + return (*getODSOperands(1).begin()); + } + + ValueT getBaseKey() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CollectiveAssignGroupV2OpAdaptor : public CollectiveAssignGroupV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using CollectiveAssignGroupV2OpGenericAdaptor::CollectiveAssignGroupV2OpGenericAdaptor; + CollectiveAssignGroupV2OpAdaptor(CollectiveAssignGroupV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CollectiveAssignGroupV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CollectiveAssignGroupV2OpAdaptor; + template + using GenericAdaptor = CollectiveAssignGroupV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.CollectiveAssignGroupV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getGroupAssignment(); + ::mlir::TypedValue<::mlir::TensorType> getDeviceIndex(); + ::mlir::TypedValue<::mlir::TensorType> getBaseKey(); + ::mlir::OpOperand &getGroupAssignmentMutable(); + ::mlir::OpOperand &getDeviceIndexMutable(); + ::mlir::OpOperand &getBaseKeyMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getGroupSize(); + ::mlir::TypedValue<::mlir::TensorType> getGroupKey(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type group_size, ::mlir::Type group_key, ::mlir::Value group_assignment, ::mlir::Value device_index, ::mlir::Value base_key); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value group_assignment, ::mlir::Value device_index, ::mlir::Value base_key); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::CollectiveAssignGroupV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::CollectiveBcastRecvOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CollectiveBcastRecvOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CollectiveBcastRecvOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CollectiveBcastRecvOpGenericAdaptorBase(CollectiveBcastRecvOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getGroupSizeAttr(); + uint64_t getGroupSize(); + ::mlir::IntegerAttr getGroupKeyAttr(); + uint64_t getGroupKey(); + ::mlir::IntegerAttr getInstanceKeyAttr(); + uint64_t getInstanceKey(); + ::mlir::Attribute getShapeAttr(); + std::optional> getShape(); + ::mlir::StringAttr getCommunicationHintAttr(); + ::llvm::StringRef getCommunicationHint(); + ::mlir::FloatAttr getTimeoutSecondsAttr(); + ::llvm::APFloat getTimeoutSeconds(); +}; +} // namespace detail +template +class CollectiveBcastRecvOpGenericAdaptor : public detail::CollectiveBcastRecvOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CollectiveBcastRecvOpGenericAdaptorBase; +public: + CollectiveBcastRecvOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CollectiveBcastRecvOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CollectiveBcastRecvOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CollectiveBcastRecvOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CollectiveBcastRecvOpAdaptor : public CollectiveBcastRecvOpGenericAdaptor<::mlir::ValueRange> { +public: + using CollectiveBcastRecvOpGenericAdaptor::CollectiveBcastRecvOpGenericAdaptor; + CollectiveBcastRecvOpAdaptor(CollectiveBcastRecvOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CollectiveBcastRecvOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CollectiveBcastRecvOpAdaptor; + template + using GenericAdaptor = CollectiveBcastRecvOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("communication_hint"), ::llvm::StringRef("group_key"), ::llvm::StringRef("group_size"), ::llvm::StringRef("instance_key"), ::llvm::StringRef("shape"), ::llvm::StringRef("timeout_seconds")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getCommunicationHintAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getCommunicationHintAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getGroupKeyAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getGroupKeyAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getGroupSizeAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getGroupSizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getInstanceKeyAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getInstanceKeyAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getShapeAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getShapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getTimeoutSecondsAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getTimeoutSecondsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.CollectiveBcastRecv"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getData(); + ::mlir::IntegerAttr getGroupSizeAttr(); + uint64_t getGroupSize(); + ::mlir::IntegerAttr getGroupKeyAttr(); + uint64_t getGroupKey(); + ::mlir::IntegerAttr getInstanceKeyAttr(); + uint64_t getInstanceKey(); + ::mlir::Attribute getShapeAttr(); + std::optional> getShape(); + ::mlir::StringAttr getCommunicationHintAttr(); + ::llvm::StringRef getCommunicationHint(); + ::mlir::FloatAttr getTimeoutSecondsAttr(); + ::llvm::APFloat getTimeoutSeconds(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setGroupSizeAttr(::mlir::IntegerAttr attr); + void setGroupSize(uint64_t attrValue); + void setGroupKeyAttr(::mlir::IntegerAttr attr); + void setGroupKey(uint64_t attrValue); + void setInstanceKeyAttr(::mlir::IntegerAttr attr); + void setInstanceKey(uint64_t attrValue); + void setShapeAttr(::mlir::Attribute attr); + void setShape(std::optional> attrValue); + void setCommunicationHintAttr(::mlir::StringAttr attr); + void setCommunicationHint(::std::optional<::llvm::StringRef> attrValue); + void setTimeoutSecondsAttr(::mlir::FloatAttr attr); + void setTimeoutSeconds(::std::optional<::llvm::APFloat> attrValue); + ::mlir::Attribute removeCommunicationHintAttr(); + ::mlir::Attribute removeTimeoutSecondsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type data, ::mlir::IntegerAttr group_size, ::mlir::IntegerAttr group_key, ::mlir::IntegerAttr instance_key, ::mlir::Attribute shape, /*optional*/::mlir::StringAttr communication_hint, /*optional*/::mlir::FloatAttr timeout_seconds); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr group_size, ::mlir::IntegerAttr group_key, ::mlir::IntegerAttr instance_key, ::mlir::Attribute shape, /*optional*/::mlir::StringAttr communication_hint, /*optional*/::mlir::FloatAttr timeout_seconds); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type data, uint64_t group_size, uint64_t group_key, uint64_t instance_key, std::optional> shape, /*optional*/::llvm::StringRef communication_hint, /*optional*/::llvm::APFloat timeout_seconds); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, uint64_t group_size, uint64_t group_key, uint64_t instance_key, std::optional> shape, /*optional*/::llvm::StringRef communication_hint, /*optional*/::llvm::APFloat timeout_seconds); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 7 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::CollectiveBcastRecvOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::CollectiveBcastSendOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CollectiveBcastSendOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CollectiveBcastSendOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CollectiveBcastSendOpGenericAdaptorBase(CollectiveBcastSendOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getGroupSizeAttr(); + uint64_t getGroupSize(); + ::mlir::IntegerAttr getGroupKeyAttr(); + uint64_t getGroupKey(); + ::mlir::IntegerAttr getInstanceKeyAttr(); + uint64_t getInstanceKey(); + ::mlir::Attribute getShapeAttr(); + std::optional> getShape(); + ::mlir::StringAttr getCommunicationHintAttr(); + ::llvm::StringRef getCommunicationHint(); + ::mlir::FloatAttr getTimeoutSecondsAttr(); + ::llvm::APFloat getTimeoutSeconds(); +}; +} // namespace detail +template +class CollectiveBcastSendOpGenericAdaptor : public detail::CollectiveBcastSendOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CollectiveBcastSendOpGenericAdaptorBase; +public: + CollectiveBcastSendOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CollectiveBcastSendOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CollectiveBcastSendOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CollectiveBcastSendOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CollectiveBcastSendOpAdaptor : public CollectiveBcastSendOpGenericAdaptor<::mlir::ValueRange> { +public: + using CollectiveBcastSendOpGenericAdaptor::CollectiveBcastSendOpGenericAdaptor; + CollectiveBcastSendOpAdaptor(CollectiveBcastSendOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CollectiveBcastSendOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CollectiveBcastSendOpAdaptor; + template + using GenericAdaptor = CollectiveBcastSendOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("communication_hint"), ::llvm::StringRef("group_key"), ::llvm::StringRef("group_size"), ::llvm::StringRef("instance_key"), ::llvm::StringRef("shape"), ::llvm::StringRef("timeout_seconds")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getCommunicationHintAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getCommunicationHintAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getGroupKeyAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getGroupKeyAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getGroupSizeAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getGroupSizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getInstanceKeyAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getInstanceKeyAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getShapeAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getShapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getTimeoutSecondsAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getTimeoutSecondsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.CollectiveBcastSend"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getData(); + ::mlir::IntegerAttr getGroupSizeAttr(); + uint64_t getGroupSize(); + ::mlir::IntegerAttr getGroupKeyAttr(); + uint64_t getGroupKey(); + ::mlir::IntegerAttr getInstanceKeyAttr(); + uint64_t getInstanceKey(); + ::mlir::Attribute getShapeAttr(); + std::optional> getShape(); + ::mlir::StringAttr getCommunicationHintAttr(); + ::llvm::StringRef getCommunicationHint(); + ::mlir::FloatAttr getTimeoutSecondsAttr(); + ::llvm::APFloat getTimeoutSeconds(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setGroupSizeAttr(::mlir::IntegerAttr attr); + void setGroupSize(uint64_t attrValue); + void setGroupKeyAttr(::mlir::IntegerAttr attr); + void setGroupKey(uint64_t attrValue); + void setInstanceKeyAttr(::mlir::IntegerAttr attr); + void setInstanceKey(uint64_t attrValue); + void setShapeAttr(::mlir::Attribute attr); + void setShape(std::optional> attrValue); + void setCommunicationHintAttr(::mlir::StringAttr attr); + void setCommunicationHint(::std::optional<::llvm::StringRef> attrValue); + void setTimeoutSecondsAttr(::mlir::FloatAttr attr); + void setTimeoutSeconds(::std::optional<::llvm::APFloat> attrValue); + ::mlir::Attribute removeCommunicationHintAttr(); + ::mlir::Attribute removeTimeoutSecondsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type data, ::mlir::Value input, ::mlir::IntegerAttr group_size, ::mlir::IntegerAttr group_key, ::mlir::IntegerAttr instance_key, ::mlir::Attribute shape, /*optional*/::mlir::StringAttr communication_hint, /*optional*/::mlir::FloatAttr timeout_seconds); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::IntegerAttr group_size, ::mlir::IntegerAttr group_key, ::mlir::IntegerAttr instance_key, ::mlir::Attribute shape, /*optional*/::mlir::StringAttr communication_hint, /*optional*/::mlir::FloatAttr timeout_seconds); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type data, ::mlir::Value input, uint64_t group_size, uint64_t group_key, uint64_t instance_key, std::optional> shape, /*optional*/::llvm::StringRef communication_hint, /*optional*/::llvm::APFloat timeout_seconds); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, uint64_t group_size, uint64_t group_key, uint64_t instance_key, std::optional> shape, /*optional*/::llvm::StringRef communication_hint, /*optional*/::llvm::APFloat timeout_seconds); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 7 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::CollectiveBcastSendOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::CollectiveGatherOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CollectiveGatherOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CollectiveGatherOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CollectiveGatherOpGenericAdaptorBase(CollectiveGatherOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getGroupSizeAttr(); + uint64_t getGroupSize(); + ::mlir::IntegerAttr getGroupKeyAttr(); + uint64_t getGroupKey(); + ::mlir::IntegerAttr getInstanceKeyAttr(); + uint64_t getInstanceKey(); + ::mlir::Attribute getShapeAttr(); + std::optional> getShape(); + ::mlir::StringAttr getCommunicationHintAttr(); + ::llvm::StringRef getCommunicationHint(); + ::mlir::FloatAttr getTimeoutSecondsAttr(); + ::llvm::APFloat getTimeoutSeconds(); +}; +} // namespace detail +template +class CollectiveGatherOpGenericAdaptor : public detail::CollectiveGatherOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CollectiveGatherOpGenericAdaptorBase; +public: + CollectiveGatherOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CollectiveGatherOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CollectiveGatherOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CollectiveGatherOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CollectiveGatherOpAdaptor : public CollectiveGatherOpGenericAdaptor<::mlir::ValueRange> { +public: + using CollectiveGatherOpGenericAdaptor::CollectiveGatherOpGenericAdaptor; + CollectiveGatherOpAdaptor(CollectiveGatherOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CollectiveGatherOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CollectiveGatherOpAdaptor; + template + using GenericAdaptor = CollectiveGatherOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("communication_hint"), ::llvm::StringRef("group_key"), ::llvm::StringRef("group_size"), ::llvm::StringRef("instance_key"), ::llvm::StringRef("shape"), ::llvm::StringRef("timeout_seconds")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getCommunicationHintAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getCommunicationHintAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getGroupKeyAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getGroupKeyAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getGroupSizeAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getGroupSizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getInstanceKeyAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getInstanceKeyAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getShapeAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getShapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getTimeoutSecondsAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getTimeoutSecondsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.CollectiveGather"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getData(); + ::mlir::IntegerAttr getGroupSizeAttr(); + uint64_t getGroupSize(); + ::mlir::IntegerAttr getGroupKeyAttr(); + uint64_t getGroupKey(); + ::mlir::IntegerAttr getInstanceKeyAttr(); + uint64_t getInstanceKey(); + ::mlir::Attribute getShapeAttr(); + std::optional> getShape(); + ::mlir::StringAttr getCommunicationHintAttr(); + ::llvm::StringRef getCommunicationHint(); + ::mlir::FloatAttr getTimeoutSecondsAttr(); + ::llvm::APFloat getTimeoutSeconds(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setGroupSizeAttr(::mlir::IntegerAttr attr); + void setGroupSize(uint64_t attrValue); + void setGroupKeyAttr(::mlir::IntegerAttr attr); + void setGroupKey(uint64_t attrValue); + void setInstanceKeyAttr(::mlir::IntegerAttr attr); + void setInstanceKey(uint64_t attrValue); + void setShapeAttr(::mlir::Attribute attr); + void setShape(std::optional> attrValue); + void setCommunicationHintAttr(::mlir::StringAttr attr); + void setCommunicationHint(::std::optional<::llvm::StringRef> attrValue); + void setTimeoutSecondsAttr(::mlir::FloatAttr attr); + void setTimeoutSeconds(::std::optional<::llvm::APFloat> attrValue); + ::mlir::Attribute removeCommunicationHintAttr(); + ::mlir::Attribute removeTimeoutSecondsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type data, ::mlir::Value input, ::mlir::IntegerAttr group_size, ::mlir::IntegerAttr group_key, ::mlir::IntegerAttr instance_key, ::mlir::Attribute shape, /*optional*/::mlir::StringAttr communication_hint, /*optional*/::mlir::FloatAttr timeout_seconds); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::IntegerAttr group_size, ::mlir::IntegerAttr group_key, ::mlir::IntegerAttr instance_key, ::mlir::Attribute shape, /*optional*/::mlir::StringAttr communication_hint, /*optional*/::mlir::FloatAttr timeout_seconds); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type data, ::mlir::Value input, uint64_t group_size, uint64_t group_key, uint64_t instance_key, std::optional> shape, /*optional*/::llvm::StringRef communication_hint, /*optional*/::llvm::APFloat timeout_seconds); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, uint64_t group_size, uint64_t group_key, uint64_t instance_key, std::optional> shape, /*optional*/::llvm::StringRef communication_hint, /*optional*/::llvm::APFloat timeout_seconds); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 7 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::CollectiveGatherOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::CollectiveGatherV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CollectiveGatherV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CollectiveGatherV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CollectiveGatherV2OpGenericAdaptorBase(CollectiveGatherV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getCommunicationHintAttr(); + ::llvm::StringRef getCommunicationHint(); + ::mlir::FloatAttr getTimeoutSecondsAttr(); + ::llvm::APFloat getTimeoutSeconds(); + ::mlir::BoolAttr getIsStatelessAttr(); + bool getIsStateless(); +}; +} // namespace detail +template +class CollectiveGatherV2OpGenericAdaptor : public detail::CollectiveGatherV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CollectiveGatherV2OpGenericAdaptorBase; +public: + CollectiveGatherV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CollectiveGatherV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CollectiveGatherV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CollectiveGatherV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getGroupSize() { + return (*getODSOperands(1).begin()); + } + + ValueT getGroupKey() { + return (*getODSOperands(2).begin()); + } + + ValueT getInstanceKey() { + return (*getODSOperands(3).begin()); + } + + RangeT getOrderingToken() { + return getODSOperands(4); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CollectiveGatherV2OpAdaptor : public CollectiveGatherV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using CollectiveGatherV2OpGenericAdaptor::CollectiveGatherV2OpGenericAdaptor; + CollectiveGatherV2OpAdaptor(CollectiveGatherV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CollectiveGatherV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, GetResourceInstanceInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CollectiveGatherV2OpAdaptor; + template + using GenericAdaptor = CollectiveGatherV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Nordering_token"), ::llvm::StringRef("T"), ::llvm::StringRef("communication_hint"), ::llvm::StringRef("is_stateless"), ::llvm::StringRef("timeout_seconds")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNorderingTokenAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNorderingTokenAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getCommunicationHintAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getCommunicationHintAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getIsStatelessAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getIsStatelessAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTimeoutSecondsAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTimeoutSecondsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.CollectiveGatherV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getGroupSize(); + ::mlir::TypedValue<::mlir::TensorType> getGroupKey(); + ::mlir::TypedValue<::mlir::TensorType> getInstanceKey(); + ::mlir::Operation::operand_range getOrderingToken(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getGroupSizeMutable(); + ::mlir::OpOperand &getGroupKeyMutable(); + ::mlir::OpOperand &getInstanceKeyMutable(); + ::mlir::MutableOperandRange getOrderingTokenMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getData(); + ::mlir::StringAttr getCommunicationHintAttr(); + ::llvm::StringRef getCommunicationHint(); + ::mlir::FloatAttr getTimeoutSecondsAttr(); + ::llvm::APFloat getTimeoutSeconds(); + ::mlir::BoolAttr getIsStatelessAttr(); + bool getIsStateless(); + size_t getNorderingToken(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setCommunicationHintAttr(::mlir::StringAttr attr); + void setCommunicationHint(::std::optional<::llvm::StringRef> attrValue); + void setTimeoutSecondsAttr(::mlir::FloatAttr attr); + void setTimeoutSeconds(::std::optional<::llvm::APFloat> attrValue); + void setIsStatelessAttr(::mlir::BoolAttr attr); + void setIsStateless(::std::optional attrValue); + ::mlir::Attribute removeCommunicationHintAttr(); + ::mlir::Attribute removeTimeoutSecondsAttr(); + ::mlir::Attribute removeIsStatelessAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type data, ::mlir::Value input, ::mlir::Value group_size, ::mlir::Value group_key, ::mlir::Value instance_key, ::mlir::ValueRange ordering_token, /*optional*/::mlir::StringAttr communication_hint, /*optional*/::mlir::FloatAttr timeout_seconds, /*optional*/::mlir::BoolAttr is_stateless); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value group_size, ::mlir::Value group_key, ::mlir::Value instance_key, ::mlir::ValueRange ordering_token, /*optional*/::mlir::StringAttr communication_hint, /*optional*/::mlir::FloatAttr timeout_seconds, /*optional*/::mlir::BoolAttr is_stateless); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type data, ::mlir::Value input, ::mlir::Value group_size, ::mlir::Value group_key, ::mlir::Value instance_key, ::mlir::ValueRange ordering_token, /*optional*/::llvm::StringRef communication_hint, /*optional*/::llvm::APFloat timeout_seconds, /*optional*/bool is_stateless = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value group_size, ::mlir::Value group_key, ::mlir::Value instance_key, ::mlir::ValueRange ordering_token, /*optional*/::llvm::StringRef communication_hint, /*optional*/::llvm::APFloat timeout_seconds, /*optional*/bool is_stateless = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + std::optional GetResourceInstanceStr(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::CollectiveGatherV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::CollectivePermuteOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CollectivePermuteOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CollectivePermuteOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CollectivePermuteOpGenericAdaptorBase(CollectivePermuteOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CollectivePermuteOpGenericAdaptor : public detail::CollectivePermuteOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CollectivePermuteOpGenericAdaptorBase; +public: + CollectivePermuteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CollectivePermuteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CollectivePermuteOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CollectivePermuteOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getSourceTargetPairs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CollectivePermuteOpAdaptor : public CollectivePermuteOpGenericAdaptor<::mlir::ValueRange> { +public: + using CollectivePermuteOpGenericAdaptor::CollectivePermuteOpGenericAdaptor; + CollectivePermuteOpAdaptor(CollectivePermuteOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CollectivePermuteOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CollectivePermuteOpAdaptor; + template + using GenericAdaptor = CollectivePermuteOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.CollectivePermute"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getSourceTargetPairs(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getSourceTargetPairsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value source_target_pairs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value source_target_pairs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::CollectivePermuteOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::CollectiveReduceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CollectiveReduceOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CollectiveReduceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CollectiveReduceOpGenericAdaptorBase(CollectiveReduceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getGroupSizeAttr(); + uint64_t getGroupSize(); + ::mlir::IntegerAttr getGroupKeyAttr(); + uint64_t getGroupKey(); + ::mlir::IntegerAttr getInstanceKeyAttr(); + uint64_t getInstanceKey(); + ::mlir::StringAttr getMergeOpAttr(); + ::llvm::StringRef getMergeOp(); + ::mlir::StringAttr getFinalOpAttr(); + ::llvm::StringRef getFinalOp(); + ::mlir::ArrayAttr getSubdivOffsetsAttr(); + ::mlir::ArrayAttr getSubdivOffsets(); + ::mlir::ArrayAttr getWaitForAttr(); + ::mlir::ArrayAttr getWaitFor(); + ::mlir::StringAttr getCommunicationHintAttr(); + ::llvm::StringRef getCommunicationHint(); + ::mlir::FloatAttr getTimeoutSecondsAttr(); + ::llvm::APFloat getTimeoutSeconds(); +}; +} // namespace detail +template +class CollectiveReduceOpGenericAdaptor : public detail::CollectiveReduceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CollectiveReduceOpGenericAdaptorBase; +public: + CollectiveReduceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CollectiveReduceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CollectiveReduceOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CollectiveReduceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CollectiveReduceOpAdaptor : public CollectiveReduceOpGenericAdaptor<::mlir::ValueRange> { +public: + using CollectiveReduceOpGenericAdaptor::CollectiveReduceOpGenericAdaptor; + CollectiveReduceOpAdaptor(CollectiveReduceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CollectiveReduceOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CollectiveReduceOpAdaptor; + template + using GenericAdaptor = CollectiveReduceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("communication_hint"), ::llvm::StringRef("final_op"), ::llvm::StringRef("group_key"), ::llvm::StringRef("group_size"), ::llvm::StringRef("instance_key"), ::llvm::StringRef("merge_op"), ::llvm::StringRef("subdiv_offsets"), ::llvm::StringRef("timeout_seconds"), ::llvm::StringRef("wait_for")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getCommunicationHintAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getCommunicationHintAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getFinalOpAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getFinalOpAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getGroupKeyAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getGroupKeyAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getGroupSizeAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getGroupSizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getInstanceKeyAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getInstanceKeyAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getMergeOpAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getMergeOpAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getSubdivOffsetsAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getSubdivOffsetsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getTimeoutSecondsAttrName() { + return getAttributeNameForIndex(8); + } + + static ::mlir::StringAttr getTimeoutSecondsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 8); + } + + ::mlir::StringAttr getWaitForAttrName() { + return getAttributeNameForIndex(9); + } + + static ::mlir::StringAttr getWaitForAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 9); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.CollectiveReduce"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getData(); + ::mlir::IntegerAttr getGroupSizeAttr(); + uint64_t getGroupSize(); + ::mlir::IntegerAttr getGroupKeyAttr(); + uint64_t getGroupKey(); + ::mlir::IntegerAttr getInstanceKeyAttr(); + uint64_t getInstanceKey(); + ::mlir::StringAttr getMergeOpAttr(); + ::llvm::StringRef getMergeOp(); + ::mlir::StringAttr getFinalOpAttr(); + ::llvm::StringRef getFinalOp(); + ::mlir::ArrayAttr getSubdivOffsetsAttr(); + ::mlir::ArrayAttr getSubdivOffsets(); + ::mlir::ArrayAttr getWaitForAttr(); + ::mlir::ArrayAttr getWaitFor(); + ::mlir::StringAttr getCommunicationHintAttr(); + ::llvm::StringRef getCommunicationHint(); + ::mlir::FloatAttr getTimeoutSecondsAttr(); + ::llvm::APFloat getTimeoutSeconds(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setGroupSizeAttr(::mlir::IntegerAttr attr); + void setGroupSize(uint64_t attrValue); + void setGroupKeyAttr(::mlir::IntegerAttr attr); + void setGroupKey(uint64_t attrValue); + void setInstanceKeyAttr(::mlir::IntegerAttr attr); + void setInstanceKey(uint64_t attrValue); + void setMergeOpAttr(::mlir::StringAttr attr); + void setMergeOp(::llvm::StringRef attrValue); + void setFinalOpAttr(::mlir::StringAttr attr); + void setFinalOp(::llvm::StringRef attrValue); + void setSubdivOffsetsAttr(::mlir::ArrayAttr attr); + void setWaitForAttr(::mlir::ArrayAttr attr); + void setCommunicationHintAttr(::mlir::StringAttr attr); + void setCommunicationHint(::std::optional<::llvm::StringRef> attrValue); + void setTimeoutSecondsAttr(::mlir::FloatAttr attr); + void setTimeoutSeconds(::std::optional<::llvm::APFloat> attrValue); + ::mlir::Attribute removeWaitForAttr(); + ::mlir::Attribute removeCommunicationHintAttr(); + ::mlir::Attribute removeTimeoutSecondsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type data, ::mlir::Value input, ::mlir::IntegerAttr group_size, ::mlir::IntegerAttr group_key, ::mlir::IntegerAttr instance_key, ::mlir::StringAttr merge_op, ::mlir::StringAttr final_op, ::mlir::ArrayAttr subdiv_offsets, /*optional*/::mlir::ArrayAttr wait_for, /*optional*/::mlir::StringAttr communication_hint, /*optional*/::mlir::FloatAttr timeout_seconds); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::IntegerAttr group_size, ::mlir::IntegerAttr group_key, ::mlir::IntegerAttr instance_key, ::mlir::StringAttr merge_op, ::mlir::StringAttr final_op, ::mlir::ArrayAttr subdiv_offsets, /*optional*/::mlir::ArrayAttr wait_for, /*optional*/::mlir::StringAttr communication_hint, /*optional*/::mlir::FloatAttr timeout_seconds); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::IntegerAttr group_size, ::mlir::IntegerAttr group_key, ::mlir::IntegerAttr instance_key, ::mlir::StringAttr merge_op, ::mlir::StringAttr final_op, ::mlir::ArrayAttr subdiv_offsets, /*optional*/::mlir::ArrayAttr wait_for, /*optional*/::mlir::StringAttr communication_hint, /*optional*/::mlir::FloatAttr timeout_seconds); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type data, ::mlir::Value input, uint64_t group_size, uint64_t group_key, uint64_t instance_key, ::llvm::StringRef merge_op, ::llvm::StringRef final_op, ::mlir::ArrayAttr subdiv_offsets, /*optional*/::mlir::ArrayAttr wait_for, /*optional*/::llvm::StringRef communication_hint, /*optional*/::llvm::APFloat timeout_seconds); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, uint64_t group_size, uint64_t group_key, uint64_t instance_key, ::llvm::StringRef merge_op, ::llvm::StringRef final_op, ::mlir::ArrayAttr subdiv_offsets, /*optional*/::mlir::ArrayAttr wait_for, /*optional*/::llvm::StringRef communication_hint, /*optional*/::llvm::APFloat timeout_seconds); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, uint64_t group_size, uint64_t group_key, uint64_t instance_key, ::llvm::StringRef merge_op, ::llvm::StringRef final_op, ::mlir::ArrayAttr subdiv_offsets, /*optional*/::mlir::ArrayAttr wait_for, /*optional*/::llvm::StringRef communication_hint, /*optional*/::llvm::APFloat timeout_seconds); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 10 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::CollectiveReduceOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::CollectiveReduceScatterV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CollectiveReduceScatterV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CollectiveReduceScatterV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CollectiveReduceScatterV2OpGenericAdaptorBase(CollectiveReduceScatterV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getMergeOpAttr(); + ::llvm::StringRef getMergeOp(); + ::mlir::StringAttr getFinalOpAttr(); + ::llvm::StringRef getFinalOp(); + ::mlir::StringAttr getCommunicationHintAttr(); + ::llvm::StringRef getCommunicationHint(); + ::mlir::FloatAttr getTimeoutSecondsAttr(); + ::llvm::APFloat getTimeoutSeconds(); + ::mlir::BoolAttr getIsStatelessAttr(); + bool getIsStateless(); + ::mlir::IntegerAttr getMaxSubdivsPerDeviceAttr(); + uint64_t getMaxSubdivsPerDevice(); +}; +} // namespace detail +template +class CollectiveReduceScatterV2OpGenericAdaptor : public detail::CollectiveReduceScatterV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CollectiveReduceScatterV2OpGenericAdaptorBase; +public: + CollectiveReduceScatterV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CollectiveReduceScatterV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CollectiveReduceScatterV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CollectiveReduceScatterV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getGroupSize() { + return (*getODSOperands(1).begin()); + } + + ValueT getGroupKey() { + return (*getODSOperands(2).begin()); + } + + ValueT getInstanceKey() { + return (*getODSOperands(3).begin()); + } + + RangeT getOrderingToken() { + return getODSOperands(4); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CollectiveReduceScatterV2OpAdaptor : public CollectiveReduceScatterV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using CollectiveReduceScatterV2OpGenericAdaptor::CollectiveReduceScatterV2OpGenericAdaptor; + CollectiveReduceScatterV2OpAdaptor(CollectiveReduceScatterV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CollectiveReduceScatterV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, GetResourceInstanceInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CollectiveReduceScatterV2OpAdaptor; + template + using GenericAdaptor = CollectiveReduceScatterV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Nordering_token"), ::llvm::StringRef("T"), ::llvm::StringRef("communication_hint"), ::llvm::StringRef("final_op"), ::llvm::StringRef("is_stateless"), ::llvm::StringRef("max_subdivs_per_device"), ::llvm::StringRef("merge_op"), ::llvm::StringRef("timeout_seconds")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNorderingTokenAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNorderingTokenAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getCommunicationHintAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getCommunicationHintAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getFinalOpAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getFinalOpAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getIsStatelessAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getIsStatelessAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getMaxSubdivsPerDeviceAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getMaxSubdivsPerDeviceAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getMergeOpAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getMergeOpAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getTimeoutSecondsAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getTimeoutSecondsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.CollectiveReduceScatterV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getGroupSize(); + ::mlir::TypedValue<::mlir::TensorType> getGroupKey(); + ::mlir::TypedValue<::mlir::TensorType> getInstanceKey(); + ::mlir::Operation::operand_range getOrderingToken(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getGroupSizeMutable(); + ::mlir::OpOperand &getGroupKeyMutable(); + ::mlir::OpOperand &getInstanceKeyMutable(); + ::mlir::MutableOperandRange getOrderingTokenMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getData(); + ::mlir::StringAttr getMergeOpAttr(); + ::llvm::StringRef getMergeOp(); + ::mlir::StringAttr getFinalOpAttr(); + ::llvm::StringRef getFinalOp(); + ::mlir::StringAttr getCommunicationHintAttr(); + ::llvm::StringRef getCommunicationHint(); + ::mlir::FloatAttr getTimeoutSecondsAttr(); + ::llvm::APFloat getTimeoutSeconds(); + ::mlir::BoolAttr getIsStatelessAttr(); + bool getIsStateless(); + ::mlir::IntegerAttr getMaxSubdivsPerDeviceAttr(); + uint64_t getMaxSubdivsPerDevice(); + size_t getNorderingToken(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setMergeOpAttr(::mlir::StringAttr attr); + void setMergeOp(::llvm::StringRef attrValue); + void setFinalOpAttr(::mlir::StringAttr attr); + void setFinalOp(::llvm::StringRef attrValue); + void setCommunicationHintAttr(::mlir::StringAttr attr); + void setCommunicationHint(::std::optional<::llvm::StringRef> attrValue); + void setTimeoutSecondsAttr(::mlir::FloatAttr attr); + void setTimeoutSeconds(::std::optional<::llvm::APFloat> attrValue); + void setIsStatelessAttr(::mlir::BoolAttr attr); + void setIsStateless(::std::optional attrValue); + void setMaxSubdivsPerDeviceAttr(::mlir::IntegerAttr attr); + void setMaxSubdivsPerDevice(::std::optional attrValue); + ::mlir::Attribute removeCommunicationHintAttr(); + ::mlir::Attribute removeTimeoutSecondsAttr(); + ::mlir::Attribute removeIsStatelessAttr(); + ::mlir::Attribute removeMaxSubdivsPerDeviceAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type data, ::mlir::Value input, ::mlir::Value group_size, ::mlir::Value group_key, ::mlir::Value instance_key, ::mlir::ValueRange ordering_token, ::mlir::StringAttr merge_op, ::mlir::StringAttr final_op, /*optional*/::mlir::StringAttr communication_hint, /*optional*/::mlir::FloatAttr timeout_seconds, /*optional*/::mlir::BoolAttr is_stateless, /*optional*/::mlir::IntegerAttr max_subdivs_per_device); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value group_size, ::mlir::Value group_key, ::mlir::Value instance_key, ::mlir::ValueRange ordering_token, ::mlir::StringAttr merge_op, ::mlir::StringAttr final_op, /*optional*/::mlir::StringAttr communication_hint, /*optional*/::mlir::FloatAttr timeout_seconds, /*optional*/::mlir::BoolAttr is_stateless, /*optional*/::mlir::IntegerAttr max_subdivs_per_device); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type data, ::mlir::Value input, ::mlir::Value group_size, ::mlir::Value group_key, ::mlir::Value instance_key, ::mlir::ValueRange ordering_token, ::llvm::StringRef merge_op, ::llvm::StringRef final_op, /*optional*/::llvm::StringRef communication_hint, /*optional*/::llvm::APFloat timeout_seconds, /*optional*/bool is_stateless = false, /*optional*/uint64_t max_subdivs_per_device = -1); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value group_size, ::mlir::Value group_key, ::mlir::Value instance_key, ::mlir::ValueRange ordering_token, ::llvm::StringRef merge_op, ::llvm::StringRef final_op, /*optional*/::llvm::StringRef communication_hint, /*optional*/::llvm::APFloat timeout_seconds, /*optional*/bool is_stateless = false, /*optional*/uint64_t max_subdivs_per_device = -1); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + std::optional GetResourceInstanceStr(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 8 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::CollectiveReduceScatterV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::CollectiveReduceV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CollectiveReduceV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CollectiveReduceV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CollectiveReduceV2OpGenericAdaptorBase(CollectiveReduceV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getMergeOpAttr(); + ::llvm::StringRef getMergeOp(); + ::mlir::StringAttr getFinalOpAttr(); + ::llvm::StringRef getFinalOp(); + ::mlir::StringAttr getCommunicationHintAttr(); + ::llvm::StringRef getCommunicationHint(); + ::mlir::FloatAttr getTimeoutSecondsAttr(); + ::llvm::APFloat getTimeoutSeconds(); + ::mlir::BoolAttr getIsStatelessAttr(); + bool getIsStateless(); + ::mlir::IntegerAttr getMaxSubdivsPerDeviceAttr(); + uint64_t getMaxSubdivsPerDevice(); +}; +} // namespace detail +template +class CollectiveReduceV2OpGenericAdaptor : public detail::CollectiveReduceV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CollectiveReduceV2OpGenericAdaptorBase; +public: + CollectiveReduceV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CollectiveReduceV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CollectiveReduceV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CollectiveReduceV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getGroupSize() { + return (*getODSOperands(1).begin()); + } + + ValueT getGroupKey() { + return (*getODSOperands(2).begin()); + } + + ValueT getInstanceKey() { + return (*getODSOperands(3).begin()); + } + + RangeT getOrderingToken() { + return getODSOperands(4); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CollectiveReduceV2OpAdaptor : public CollectiveReduceV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using CollectiveReduceV2OpGenericAdaptor::CollectiveReduceV2OpGenericAdaptor; + CollectiveReduceV2OpAdaptor(CollectiveReduceV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CollectiveReduceV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, GetResourceInstanceInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CollectiveReduceV2OpAdaptor; + template + using GenericAdaptor = CollectiveReduceV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Nordering_token"), ::llvm::StringRef("T"), ::llvm::StringRef("communication_hint"), ::llvm::StringRef("final_op"), ::llvm::StringRef("is_stateless"), ::llvm::StringRef("max_subdivs_per_device"), ::llvm::StringRef("merge_op"), ::llvm::StringRef("timeout_seconds")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNorderingTokenAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNorderingTokenAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getCommunicationHintAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getCommunicationHintAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getFinalOpAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getFinalOpAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getIsStatelessAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getIsStatelessAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getMaxSubdivsPerDeviceAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getMaxSubdivsPerDeviceAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getMergeOpAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getMergeOpAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getTimeoutSecondsAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getTimeoutSecondsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.CollectiveReduceV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getGroupSize(); + ::mlir::TypedValue<::mlir::TensorType> getGroupKey(); + ::mlir::TypedValue<::mlir::TensorType> getInstanceKey(); + ::mlir::Operation::operand_range getOrderingToken(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getGroupSizeMutable(); + ::mlir::OpOperand &getGroupKeyMutable(); + ::mlir::OpOperand &getInstanceKeyMutable(); + ::mlir::MutableOperandRange getOrderingTokenMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getData(); + ::mlir::StringAttr getMergeOpAttr(); + ::llvm::StringRef getMergeOp(); + ::mlir::StringAttr getFinalOpAttr(); + ::llvm::StringRef getFinalOp(); + ::mlir::StringAttr getCommunicationHintAttr(); + ::llvm::StringRef getCommunicationHint(); + ::mlir::FloatAttr getTimeoutSecondsAttr(); + ::llvm::APFloat getTimeoutSeconds(); + ::mlir::BoolAttr getIsStatelessAttr(); + bool getIsStateless(); + ::mlir::IntegerAttr getMaxSubdivsPerDeviceAttr(); + uint64_t getMaxSubdivsPerDevice(); + size_t getNorderingToken(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setMergeOpAttr(::mlir::StringAttr attr); + void setMergeOp(::llvm::StringRef attrValue); + void setFinalOpAttr(::mlir::StringAttr attr); + void setFinalOp(::llvm::StringRef attrValue); + void setCommunicationHintAttr(::mlir::StringAttr attr); + void setCommunicationHint(::std::optional<::llvm::StringRef> attrValue); + void setTimeoutSecondsAttr(::mlir::FloatAttr attr); + void setTimeoutSeconds(::std::optional<::llvm::APFloat> attrValue); + void setIsStatelessAttr(::mlir::BoolAttr attr); + void setIsStateless(::std::optional attrValue); + void setMaxSubdivsPerDeviceAttr(::mlir::IntegerAttr attr); + void setMaxSubdivsPerDevice(::std::optional attrValue); + ::mlir::Attribute removeCommunicationHintAttr(); + ::mlir::Attribute removeTimeoutSecondsAttr(); + ::mlir::Attribute removeIsStatelessAttr(); + ::mlir::Attribute removeMaxSubdivsPerDeviceAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type data, ::mlir::Value input, ::mlir::Value group_size, ::mlir::Value group_key, ::mlir::Value instance_key, ::mlir::ValueRange ordering_token, ::mlir::StringAttr merge_op, ::mlir::StringAttr final_op, /*optional*/::mlir::StringAttr communication_hint, /*optional*/::mlir::FloatAttr timeout_seconds, /*optional*/::mlir::BoolAttr is_stateless, /*optional*/::mlir::IntegerAttr max_subdivs_per_device); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value group_size, ::mlir::Value group_key, ::mlir::Value instance_key, ::mlir::ValueRange ordering_token, ::mlir::StringAttr merge_op, ::mlir::StringAttr final_op, /*optional*/::mlir::StringAttr communication_hint, /*optional*/::mlir::FloatAttr timeout_seconds, /*optional*/::mlir::BoolAttr is_stateless, /*optional*/::mlir::IntegerAttr max_subdivs_per_device); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type data, ::mlir::Value input, ::mlir::Value group_size, ::mlir::Value group_key, ::mlir::Value instance_key, ::mlir::ValueRange ordering_token, ::llvm::StringRef merge_op, ::llvm::StringRef final_op, /*optional*/::llvm::StringRef communication_hint, /*optional*/::llvm::APFloat timeout_seconds, /*optional*/bool is_stateless = false, /*optional*/uint64_t max_subdivs_per_device = -1); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value group_size, ::mlir::Value group_key, ::mlir::Value instance_key, ::mlir::ValueRange ordering_token, ::llvm::StringRef merge_op, ::llvm::StringRef final_op, /*optional*/::llvm::StringRef communication_hint, /*optional*/::llvm::APFloat timeout_seconds, /*optional*/bool is_stateless = false, /*optional*/uint64_t max_subdivs_per_device = -1); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + std::optional GetResourceInstanceStr(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 8 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::CollectiveReduceV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ComplexAbsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ComplexAbsOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ComplexAbsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ComplexAbsOpGenericAdaptorBase(ComplexAbsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ComplexAbsOpGenericAdaptor : public detail::ComplexAbsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ComplexAbsOpGenericAdaptorBase; +public: + ComplexAbsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ComplexAbsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ComplexAbsOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ComplexAbsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ComplexAbsOpAdaptor : public ComplexAbsOpGenericAdaptor<::mlir::ValueRange> { +public: + using ComplexAbsOpGenericAdaptor::ComplexAbsOpGenericAdaptor; + ComplexAbsOpAdaptor(ComplexAbsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ComplexAbsOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ComplexAbsOpAdaptor; + template + using GenericAdaptor = ComplexAbsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tout")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getToutAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getToutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ComplexAbs"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + ::mlir::Type getTout(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ComplexAbsOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ComplexOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ComplexOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ComplexOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ComplexOpGenericAdaptorBase(ComplexOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ComplexOpGenericAdaptor : public detail::ComplexOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ComplexOpGenericAdaptorBase; +public: + ComplexOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ComplexOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ComplexOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ComplexOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getReal() { + return (*getODSOperands(0).begin()); + } + + ValueT getImag() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ComplexOpAdaptor : public ComplexOpGenericAdaptor<::mlir::ValueRange> { +public: + using ComplexOpGenericAdaptor::ComplexOpGenericAdaptor; + ComplexOpAdaptor(ComplexOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ComplexOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ComplexOpAdaptor; + template + using GenericAdaptor = ComplexOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tout")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getToutAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getToutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Complex"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getReal(); + ::mlir::TypedValue<::mlir::TensorType> getImag(); + ::mlir::OpOperand &getRealMutable(); + ::mlir::OpOperand &getImagMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOut(); + ::mlir::Type getT(); + ::mlir::Type getTout(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, ::mlir::Value real, ::mlir::Value imag); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value real, ::mlir::Value imag); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ComplexOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ConcatOffsetOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConcatOffsetOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ConcatOffsetOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ConcatOffsetOpGenericAdaptorBase(ConcatOffsetOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ConcatOffsetOpGenericAdaptor : public detail::ConcatOffsetOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConcatOffsetOpGenericAdaptorBase; +public: + ConcatOffsetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConcatOffsetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConcatOffsetOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ConcatOffsetOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getConcatDim() { + return (*getODSOperands(0).begin()); + } + + RangeT getShape() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConcatOffsetOpAdaptor : public ConcatOffsetOpGenericAdaptor<::mlir::ValueRange> { +public: + using ConcatOffsetOpGenericAdaptor::ConcatOffsetOpGenericAdaptor; + ConcatOffsetOpAdaptor(ConcatOffsetOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConcatOffsetOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ConcatOffsetOpAdaptor; + template + using GenericAdaptor = ConcatOffsetOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("N"), ::llvm::StringRef("shape_type")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getShapeTypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getShapeTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ConcatOffset"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getConcatDim(); + ::mlir::Operation::operand_range getShape(); + ::mlir::OpOperand &getConcatDimMutable(); + ::mlir::MutableOperandRange getShapeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOffset(); + size_t getN(); + ::mlir::Type getShapeType(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange offset, ::mlir::Value concat_dim, ::mlir::ValueRange shape); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ConcatOffsetOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ConcatOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConcatOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ConcatOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ConcatOpGenericAdaptorBase(ConcatOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ConcatOpGenericAdaptor : public detail::ConcatOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConcatOpGenericAdaptorBase; +public: + ConcatOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConcatOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConcatOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ConcatOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getConcatDim() { + return (*getODSOperands(0).begin()); + } + + RangeT getValues() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConcatOpAdaptor : public ConcatOpGenericAdaptor<::mlir::ValueRange> { +public: + using ConcatOpGenericAdaptor::ConcatOpGenericAdaptor; + ConcatOpAdaptor(ConcatOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConcatOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ConcatOpAdaptor; + template + using GenericAdaptor = ConcatOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("N"), ::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Concat"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getConcatDim(); + ::mlir::Operation::operand_range getValues(); + ::mlir::OpOperand &getConcatDimMutable(); + ::mlir::MutableOperandRange getValuesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + size_t getN(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value concat_dim, ::mlir::ValueRange values); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value concat_dim, ::mlir::ValueRange values); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ConcatOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ConcatV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConcatV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ConcatV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ConcatV2OpGenericAdaptorBase(ConcatV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ConcatV2OpGenericAdaptor : public detail::ConcatV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConcatV2OpGenericAdaptorBase; +public: + ConcatV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConcatV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConcatV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ConcatV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getValues() { + return getODSOperands(0); + } + + ValueT getAxis() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConcatV2OpAdaptor : public ConcatV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using ConcatV2OpGenericAdaptor::ConcatV2OpGenericAdaptor; + ConcatV2OpAdaptor(ConcatV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConcatV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ConcatV2OpAdaptor; + template + using GenericAdaptor = ConcatV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("N"), ::llvm::StringRef("T"), ::llvm::StringRef("Tidx")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTidxAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTidxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ConcatV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getValues(); + ::mlir::TypedValue<::mlir::TensorType> getAxis(); + ::mlir::MutableOperandRange getValuesMutable(); + ::mlir::OpOperand &getAxisMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + size_t getN(); + ::mlir::Type getT(); + ::mlir::Type getTidx(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::ValueRange values, ::mlir::Value axis); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange values, ::mlir::Value axis); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ConcatV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ConfigureAndInitializeGlobalTPUOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConfigureAndInitializeGlobalTPUOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ConfigureAndInitializeGlobalTPUOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ConfigureAndInitializeGlobalTPUOpGenericAdaptorBase(ConfigureAndInitializeGlobalTPUOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ConfigureAndInitializeGlobalTPUOpGenericAdaptor : public detail::ConfigureAndInitializeGlobalTPUOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConfigureAndInitializeGlobalTPUOpGenericAdaptorBase; +public: + ConfigureAndInitializeGlobalTPUOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConfigureAndInitializeGlobalTPUOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConfigureAndInitializeGlobalTPUOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ConfigureAndInitializeGlobalTPUOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConfigureAndInitializeGlobalTPUOpAdaptor : public ConfigureAndInitializeGlobalTPUOpGenericAdaptor<::mlir::ValueRange> { +public: + using ConfigureAndInitializeGlobalTPUOpGenericAdaptor::ConfigureAndInitializeGlobalTPUOpGenericAdaptor; + ConfigureAndInitializeGlobalTPUOpAdaptor(ConfigureAndInitializeGlobalTPUOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConfigureAndInitializeGlobalTPUOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = ConfigureAndInitializeGlobalTPUOpAdaptor; + template + using GenericAdaptor = ConfigureAndInitializeGlobalTPUOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ConfigureAndInitializeGlobalTPU"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ConfigureAndInitializeGlobalTPUOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ConfigureDistributedTPUOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConfigureDistributedTPUOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ConfigureDistributedTPUOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ConfigureDistributedTPUOpGenericAdaptorBase(ConfigureDistributedTPUOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getEmbeddingConfigAttr(); + ::llvm::StringRef getEmbeddingConfig(); + ::mlir::StringAttr getTpuEmbeddingConfigAttr(); + ::llvm::StringRef getTpuEmbeddingConfig(); + ::mlir::BoolAttr getIsGlobalInitAttr(); + bool getIsGlobalInit(); + ::mlir::BoolAttr getEnableWholeMeshCompilationsAttr(); + bool getEnableWholeMeshCompilations(); + ::mlir::BoolAttr getCompilationFailureClosesChipsAttr(); + bool getCompilationFailureClosesChips(); + ::mlir::IntegerAttr getTpuCancellationClosesChipsAttr(); + uint64_t getTpuCancellationClosesChips(); +}; +} // namespace detail +template +class ConfigureDistributedTPUOpGenericAdaptor : public detail::ConfigureDistributedTPUOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConfigureDistributedTPUOpGenericAdaptorBase; +public: + ConfigureDistributedTPUOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConfigureDistributedTPUOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConfigureDistributedTPUOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ConfigureDistributedTPUOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConfigureDistributedTPUOpAdaptor : public ConfigureDistributedTPUOpGenericAdaptor<::mlir::ValueRange> { +public: + using ConfigureDistributedTPUOpGenericAdaptor::ConfigureDistributedTPUOpGenericAdaptor; + ConfigureDistributedTPUOpAdaptor(ConfigureDistributedTPUOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConfigureDistributedTPUOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = ConfigureDistributedTPUOpAdaptor; + template + using GenericAdaptor = ConfigureDistributedTPUOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("compilation_failure_closes_chips"), ::llvm::StringRef("embedding_config"), ::llvm::StringRef("enable_whole_mesh_compilations"), ::llvm::StringRef("is_global_init"), ::llvm::StringRef("tpu_cancellation_closes_chips"), ::llvm::StringRef("tpu_embedding_config")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getCompilationFailureClosesChipsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getCompilationFailureClosesChipsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getEmbeddingConfigAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getEmbeddingConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getEnableWholeMeshCompilationsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getEnableWholeMeshCompilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getIsGlobalInitAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getIsGlobalInitAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTpuCancellationClosesChipsAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTpuCancellationClosesChipsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getTpuEmbeddingConfigAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getTpuEmbeddingConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ConfigureDistributedTPU"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTopology(); + ::mlir::StringAttr getEmbeddingConfigAttr(); + ::llvm::StringRef getEmbeddingConfig(); + ::mlir::StringAttr getTpuEmbeddingConfigAttr(); + ::llvm::StringRef getTpuEmbeddingConfig(); + ::mlir::BoolAttr getIsGlobalInitAttr(); + bool getIsGlobalInit(); + ::mlir::BoolAttr getEnableWholeMeshCompilationsAttr(); + bool getEnableWholeMeshCompilations(); + ::mlir::BoolAttr getCompilationFailureClosesChipsAttr(); + bool getCompilationFailureClosesChips(); + ::mlir::IntegerAttr getTpuCancellationClosesChipsAttr(); + uint64_t getTpuCancellationClosesChips(); + void setEmbeddingConfigAttr(::mlir::StringAttr attr); + void setEmbeddingConfig(::std::optional<::llvm::StringRef> attrValue); + void setTpuEmbeddingConfigAttr(::mlir::StringAttr attr); + void setTpuEmbeddingConfig(::std::optional<::llvm::StringRef> attrValue); + void setIsGlobalInitAttr(::mlir::BoolAttr attr); + void setIsGlobalInit(::std::optional attrValue); + void setEnableWholeMeshCompilationsAttr(::mlir::BoolAttr attr); + void setEnableWholeMeshCompilations(::std::optional attrValue); + void setCompilationFailureClosesChipsAttr(::mlir::BoolAttr attr); + void setCompilationFailureClosesChips(::std::optional attrValue); + void setTpuCancellationClosesChipsAttr(::mlir::IntegerAttr attr); + void setTpuCancellationClosesChips(::std::optional attrValue); + ::mlir::Attribute removeEmbeddingConfigAttr(); + ::mlir::Attribute removeTpuEmbeddingConfigAttr(); + ::mlir::Attribute removeIsGlobalInitAttr(); + ::mlir::Attribute removeEnableWholeMeshCompilationsAttr(); + ::mlir::Attribute removeCompilationFailureClosesChipsAttr(); + ::mlir::Attribute removeTpuCancellationClosesChipsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type topology, /*optional*/::mlir::StringAttr embedding_config, /*optional*/::mlir::StringAttr tpu_embedding_config, /*optional*/::mlir::BoolAttr is_global_init, /*optional*/::mlir::BoolAttr enable_whole_mesh_compilations, /*optional*/::mlir::BoolAttr compilation_failure_closes_chips, /*optional*/::mlir::IntegerAttr tpu_cancellation_closes_chips); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::StringAttr embedding_config, /*optional*/::mlir::StringAttr tpu_embedding_config, /*optional*/::mlir::BoolAttr is_global_init, /*optional*/::mlir::BoolAttr enable_whole_mesh_compilations, /*optional*/::mlir::BoolAttr compilation_failure_closes_chips, /*optional*/::mlir::IntegerAttr tpu_cancellation_closes_chips); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type topology, /*optional*/::llvm::StringRef embedding_config = "", /*optional*/::llvm::StringRef tpu_embedding_config = "", /*optional*/bool is_global_init = false, /*optional*/bool enable_whole_mesh_compilations = false, /*optional*/bool compilation_failure_closes_chips = true, /*optional*/uint64_t tpu_cancellation_closes_chips = 0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::llvm::StringRef embedding_config = "", /*optional*/::llvm::StringRef tpu_embedding_config = "", /*optional*/bool is_global_init = false, /*optional*/bool enable_whole_mesh_compilations = false, /*optional*/bool compilation_failure_closes_chips = true, /*optional*/uint64_t tpu_cancellation_closes_chips = 0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ConfigureDistributedTPUOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ConfigureTPUEmbeddingHostOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConfigureTPUEmbeddingHostOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ConfigureTPUEmbeddingHostOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ConfigureTPUEmbeddingHostOpGenericAdaptorBase(ConfigureTPUEmbeddingHostOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class ConfigureTPUEmbeddingHostOpGenericAdaptor : public detail::ConfigureTPUEmbeddingHostOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConfigureTPUEmbeddingHostOpGenericAdaptorBase; +public: + ConfigureTPUEmbeddingHostOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConfigureTPUEmbeddingHostOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConfigureTPUEmbeddingHostOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ConfigureTPUEmbeddingHostOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getCommonConfig() { + return (*getODSOperands(0).begin()); + } + + ValueT getMemoryConfig() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConfigureTPUEmbeddingHostOpAdaptor : public ConfigureTPUEmbeddingHostOpGenericAdaptor<::mlir::ValueRange> { +public: + using ConfigureTPUEmbeddingHostOpGenericAdaptor::ConfigureTPUEmbeddingHostOpGenericAdaptor; + ConfigureTPUEmbeddingHostOpAdaptor(ConfigureTPUEmbeddingHostOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConfigureTPUEmbeddingHostOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = ConfigureTPUEmbeddingHostOpAdaptor; + template + using GenericAdaptor = ConfigureTPUEmbeddingHostOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ConfigureTPUEmbeddingHost"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getCommonConfig(); + ::mlir::TypedValue<::mlir::TensorType> getMemoryConfig(); + ::mlir::OpOperand &getCommonConfigMutable(); + ::mlir::OpOperand &getMemoryConfigMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getNetworkConfig(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type network_config, ::mlir::Value common_config, ::mlir::Value memory_config, ::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value common_config, ::mlir::Value memory_config, ::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type network_config, ::mlir::Value common_config, ::mlir::Value memory_config, ::llvm::StringRef config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value common_config, ::mlir::Value memory_config, ::llvm::StringRef config); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ConfigureTPUEmbeddingHostOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ConfigureTPUEmbeddingMemoryOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConfigureTPUEmbeddingMemoryOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ConfigureTPUEmbeddingMemoryOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ConfigureTPUEmbeddingMemoryOpGenericAdaptorBase(ConfigureTPUEmbeddingMemoryOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ConfigureTPUEmbeddingMemoryOpGenericAdaptor : public detail::ConfigureTPUEmbeddingMemoryOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConfigureTPUEmbeddingMemoryOpGenericAdaptorBase; +public: + ConfigureTPUEmbeddingMemoryOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConfigureTPUEmbeddingMemoryOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConfigureTPUEmbeddingMemoryOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ConfigureTPUEmbeddingMemoryOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getCommonConfig() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConfigureTPUEmbeddingMemoryOpAdaptor : public ConfigureTPUEmbeddingMemoryOpGenericAdaptor<::mlir::ValueRange> { +public: + using ConfigureTPUEmbeddingMemoryOpGenericAdaptor::ConfigureTPUEmbeddingMemoryOpGenericAdaptor; + ConfigureTPUEmbeddingMemoryOpAdaptor(ConfigureTPUEmbeddingMemoryOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConfigureTPUEmbeddingMemoryOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = ConfigureTPUEmbeddingMemoryOpAdaptor; + template + using GenericAdaptor = ConfigureTPUEmbeddingMemoryOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ConfigureTPUEmbeddingMemory"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getCommonConfig(); + ::mlir::OpOperand &getCommonConfigMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getMemoryConfig(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type memory_config, ::mlir::Value common_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value common_config); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ConfigureTPUEmbeddingMemoryOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ConfigureTPUEmbeddingOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConfigureTPUEmbeddingOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ConfigureTPUEmbeddingOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ConfigureTPUEmbeddingOpGenericAdaptorBase(ConfigureTPUEmbeddingOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class ConfigureTPUEmbeddingOpGenericAdaptor : public detail::ConfigureTPUEmbeddingOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConfigureTPUEmbeddingOpGenericAdaptorBase; +public: + ConfigureTPUEmbeddingOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConfigureTPUEmbeddingOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConfigureTPUEmbeddingOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ConfigureTPUEmbeddingOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConfigureTPUEmbeddingOpAdaptor : public ConfigureTPUEmbeddingOpGenericAdaptor<::mlir::ValueRange> { +public: + using ConfigureTPUEmbeddingOpGenericAdaptor::ConfigureTPUEmbeddingOpGenericAdaptor; + ConfigureTPUEmbeddingOpAdaptor(ConfigureTPUEmbeddingOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConfigureTPUEmbeddingOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = ConfigureTPUEmbeddingOpAdaptor; + template + using GenericAdaptor = ConfigureTPUEmbeddingOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ConfigureTPUEmbedding"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef config); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ConfigureTPUEmbeddingOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ConjOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConjOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ConjOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ConjOpGenericAdaptorBase(ConjOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ConjOpGenericAdaptor : public detail::ConjOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConjOpGenericAdaptorBase; +public: + ConjOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConjOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConjOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ConjOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConjOpAdaptor : public ConjOpGenericAdaptor<::mlir::ValueRange> { +public: + using ConjOpGenericAdaptor::ConjOpGenericAdaptor; + ConjOpAdaptor(ConjOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConjOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::IsInvolution, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ConjOpAdaptor; + template + using GenericAdaptor = ConjOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Conj"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ConjOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ConjugateTransposeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConjugateTransposeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ConjugateTransposeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ConjugateTransposeOpGenericAdaptorBase(ConjugateTransposeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ConjugateTransposeOpGenericAdaptor : public detail::ConjugateTransposeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConjugateTransposeOpGenericAdaptorBase; +public: + ConjugateTransposeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConjugateTransposeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConjugateTransposeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ConjugateTransposeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getPerm() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConjugateTransposeOpAdaptor : public ConjugateTransposeOpGenericAdaptor<::mlir::ValueRange> { +public: + using ConjugateTransposeOpGenericAdaptor::ConjugateTransposeOpGenericAdaptor; + ConjugateTransposeOpAdaptor(ConjugateTransposeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConjugateTransposeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ConjugateTransposeOpAdaptor; + template + using GenericAdaptor = ConjugateTransposeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tperm")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTpermAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTpermAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ConjugateTranspose"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getPerm(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getPermMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + ::mlir::Type getTperm(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x, ::mlir::Value perm); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value perm); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ConjugateTransposeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ConnectTPUEmbeddingHostsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConnectTPUEmbeddingHostsOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ConnectTPUEmbeddingHostsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ConnectTPUEmbeddingHostsOpGenericAdaptorBase(ConnectTPUEmbeddingHostsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ConnectTPUEmbeddingHostsOpGenericAdaptor : public detail::ConnectTPUEmbeddingHostsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConnectTPUEmbeddingHostsOpGenericAdaptorBase; +public: + ConnectTPUEmbeddingHostsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConnectTPUEmbeddingHostsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConnectTPUEmbeddingHostsOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ConnectTPUEmbeddingHostsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getNetworkConfigs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConnectTPUEmbeddingHostsOpAdaptor : public ConnectTPUEmbeddingHostsOpGenericAdaptor<::mlir::ValueRange> { +public: + using ConnectTPUEmbeddingHostsOpGenericAdaptor::ConnectTPUEmbeddingHostsOpGenericAdaptor; + ConnectTPUEmbeddingHostsOpAdaptor(ConnectTPUEmbeddingHostsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConnectTPUEmbeddingHostsOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = ConnectTPUEmbeddingHostsOpAdaptor; + template + using GenericAdaptor = ConnectTPUEmbeddingHostsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("N")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ConnectTPUEmbeddingHosts"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getNetworkConfigs(); + ::mlir::MutableOperandRange getNetworkConfigsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + size_t getN(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange network_configs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ConnectTPUEmbeddingHostsOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ConstOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConstOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ConstOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ConstOpGenericAdaptorBase(ConstOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ElementsAttr getValueAttr(); + ::mlir::ElementsAttr getValue(); +}; +} // namespace detail +template +class ConstOpGenericAdaptor : public detail::ConstOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConstOpGenericAdaptorBase; +public: + ConstOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConstOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConstOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ConstOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConstOpAdaptor : public ConstOpGenericAdaptor<::mlir::ValueRange> { +public: + using ConstOpGenericAdaptor::ConstOpGenericAdaptor; + ConstOpAdaptor(ConstOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConstOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::ConstantLike, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ConstOpAdaptor; + template + using GenericAdaptor = ConstOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dtype"), ::llvm::StringRef("value")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getValueAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getValueAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Const"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ElementsAttr getValueAttr(); + ::mlir::ElementsAttr getValue(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setValueAttr(::mlir::ElementsAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Attribute value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type type, Attribute value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::ElementsAttr value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ElementsAttr value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ElementsAttr value); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return BroadcastCompatible(l, r); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ConstOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::Conv2DBackpropFilterOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Conv2DBackpropFilterOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + Conv2DBackpropFilterOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + Conv2DBackpropFilterOpGenericAdaptorBase(Conv2DBackpropFilterOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::BoolAttr getUseCudnnOnGpuAttr(); + bool getUseCudnnOnGpu(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getExplicitPaddingsAttr(); + ::mlir::ArrayAttr getExplicitPaddings(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::ArrayAttr getDilationsAttr(); + ::mlir::ArrayAttr getDilations(); +}; +} // namespace detail +template +class Conv2DBackpropFilterOpGenericAdaptor : public detail::Conv2DBackpropFilterOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Conv2DBackpropFilterOpGenericAdaptorBase; +public: + Conv2DBackpropFilterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Conv2DBackpropFilterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Conv2DBackpropFilterOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + Conv2DBackpropFilterOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getFilterSizes() { + return (*getODSOperands(1).begin()); + } + + ValueT getOutBackprop() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Conv2DBackpropFilterOpAdaptor : public Conv2DBackpropFilterOpGenericAdaptor<::mlir::ValueRange> { +public: + using Conv2DBackpropFilterOpGenericAdaptor::Conv2DBackpropFilterOpGenericAdaptor; + Conv2DBackpropFilterOpAdaptor(Conv2DBackpropFilterOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Conv2DBackpropFilterOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, LayoutSensitiveInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = Conv2DBackpropFilterOpAdaptor; + template + using GenericAdaptor = Conv2DBackpropFilterOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("data_format"), ::llvm::StringRef("dilations"), ::llvm::StringRef("explicit_paddings"), ::llvm::StringRef("padding"), ::llvm::StringRef("strides"), ::llvm::StringRef("use_cudnn_on_gpu")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getExplicitPaddingsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getExplicitPaddingsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getUseCudnnOnGpuAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getUseCudnnOnGpuAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Conv2DBackpropFilter"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getFilterSizes(); + ::mlir::TypedValue<::mlir::TensorType> getOutBackprop(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getFilterSizesMutable(); + ::mlir::OpOperand &getOutBackpropMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::BoolAttr getUseCudnnOnGpuAttr(); + bool getUseCudnnOnGpu(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getExplicitPaddingsAttr(); + ::mlir::ArrayAttr getExplicitPaddings(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::ArrayAttr getDilationsAttr(); + ::mlir::ArrayAttr getDilations(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setStridesAttr(::mlir::ArrayAttr attr); + void setUseCudnnOnGpuAttr(::mlir::BoolAttr attr); + void setUseCudnnOnGpu(::std::optional attrValue); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + void setExplicitPaddingsAttr(::mlir::ArrayAttr attr); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + void setDilationsAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeUseCudnnOnGpuAttr(); + ::mlir::Attribute removeExplicitPaddingsAttr(); + ::mlir::Attribute removeDataFormatAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value filter_sizes, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, /*optional*/::mlir::BoolAttr use_cudnn_on_gpu, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter_sizes, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, /*optional*/::mlir::BoolAttr use_cudnn_on_gpu, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value filter_sizes, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, /*optional*/bool use_cudnn_on_gpu, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::llvm::StringRef data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter_sizes, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, /*optional*/bool use_cudnn_on_gpu, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::llvm::StringRef data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 7 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // TF_LayoutSensitiveInterface: + SmallVector GetLayoutDependentArgs() { return {0, 2}; } + SmallVector GetLayoutDependentResults() { return {}; } + StringRef GetOptimalLayout(const RuntimeDevices& devices); + LogicalResult UpdateDataFormat(StringRef data_format); +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::Conv2DBackpropFilterOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::Conv2DBackpropFilterV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Conv2DBackpropFilterV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + Conv2DBackpropFilterV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + Conv2DBackpropFilterV2OpGenericAdaptorBase(Conv2DBackpropFilterV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::BoolAttr getUseCudnnOnGpuAttr(); + bool getUseCudnnOnGpu(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getExplicitPaddingsAttr(); + ::mlir::ArrayAttr getExplicitPaddings(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::ArrayAttr getDilationsAttr(); + ::mlir::ArrayAttr getDilations(); +}; +} // namespace detail +template +class Conv2DBackpropFilterV2OpGenericAdaptor : public detail::Conv2DBackpropFilterV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Conv2DBackpropFilterV2OpGenericAdaptorBase; +public: + Conv2DBackpropFilterV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Conv2DBackpropFilterV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Conv2DBackpropFilterV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + Conv2DBackpropFilterV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getFilter() { + return (*getODSOperands(1).begin()); + } + + ValueT getOutBackprop() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Conv2DBackpropFilterV2OpAdaptor : public Conv2DBackpropFilterV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using Conv2DBackpropFilterV2OpGenericAdaptor::Conv2DBackpropFilterV2OpGenericAdaptor; + Conv2DBackpropFilterV2OpAdaptor(Conv2DBackpropFilterV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Conv2DBackpropFilterV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = Conv2DBackpropFilterV2OpAdaptor; + template + using GenericAdaptor = Conv2DBackpropFilterV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("data_format"), ::llvm::StringRef("dilations"), ::llvm::StringRef("explicit_paddings"), ::llvm::StringRef("padding"), ::llvm::StringRef("strides"), ::llvm::StringRef("use_cudnn_on_gpu")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getExplicitPaddingsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getExplicitPaddingsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getUseCudnnOnGpuAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getUseCudnnOnGpuAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Conv2DBackpropFilterV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getFilter(); + ::mlir::TypedValue<::mlir::TensorType> getOutBackprop(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getFilterMutable(); + ::mlir::OpOperand &getOutBackpropMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::BoolAttr getUseCudnnOnGpuAttr(); + bool getUseCudnnOnGpu(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getExplicitPaddingsAttr(); + ::mlir::ArrayAttr getExplicitPaddings(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::ArrayAttr getDilationsAttr(); + ::mlir::ArrayAttr getDilations(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setStridesAttr(::mlir::ArrayAttr attr); + void setUseCudnnOnGpuAttr(::mlir::BoolAttr attr); + void setUseCudnnOnGpu(::std::optional attrValue); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + void setExplicitPaddingsAttr(::mlir::ArrayAttr attr); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + void setDilationsAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeUseCudnnOnGpuAttr(); + ::mlir::Attribute removeExplicitPaddingsAttr(); + ::mlir::Attribute removeDataFormatAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value filter, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, /*optional*/::mlir::BoolAttr use_cudnn_on_gpu, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, /*optional*/::mlir::BoolAttr use_cudnn_on_gpu, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value filter, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, /*optional*/bool use_cudnn_on_gpu, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::llvm::StringRef data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, /*optional*/bool use_cudnn_on_gpu, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::llvm::StringRef data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 7 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::Conv2DBackpropFilterV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::Conv2DBackpropInputOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Conv2DBackpropInputOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + Conv2DBackpropInputOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + Conv2DBackpropInputOpGenericAdaptorBase(Conv2DBackpropInputOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::BoolAttr getUseCudnnOnGpuAttr(); + bool getUseCudnnOnGpu(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getExplicitPaddingsAttr(); + ::mlir::ArrayAttr getExplicitPaddings(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::ArrayAttr getDilationsAttr(); + ::mlir::ArrayAttr getDilations(); +}; +} // namespace detail +template +class Conv2DBackpropInputOpGenericAdaptor : public detail::Conv2DBackpropInputOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Conv2DBackpropInputOpGenericAdaptorBase; +public: + Conv2DBackpropInputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Conv2DBackpropInputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Conv2DBackpropInputOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + Conv2DBackpropInputOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputSizes() { + return (*getODSOperands(0).begin()); + } + + ValueT getFilter() { + return (*getODSOperands(1).begin()); + } + + ValueT getOutBackprop() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Conv2DBackpropInputOpAdaptor : public Conv2DBackpropInputOpGenericAdaptor<::mlir::ValueRange> { +public: + using Conv2DBackpropInputOpGenericAdaptor::Conv2DBackpropInputOpGenericAdaptor; + Conv2DBackpropInputOpAdaptor(Conv2DBackpropInputOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Conv2DBackpropInputOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, LayoutSensitiveInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = Conv2DBackpropInputOpAdaptor; + template + using GenericAdaptor = Conv2DBackpropInputOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("data_format"), ::llvm::StringRef("dilations"), ::llvm::StringRef("explicit_paddings"), ::llvm::StringRef("padding"), ::llvm::StringRef("strides"), ::llvm::StringRef("use_cudnn_on_gpu")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getExplicitPaddingsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getExplicitPaddingsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getUseCudnnOnGpuAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getUseCudnnOnGpuAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Conv2DBackpropInput"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputSizes(); + ::mlir::TypedValue<::mlir::TensorType> getFilter(); + ::mlir::TypedValue<::mlir::TensorType> getOutBackprop(); + ::mlir::OpOperand &getInputSizesMutable(); + ::mlir::OpOperand &getFilterMutable(); + ::mlir::OpOperand &getOutBackpropMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::BoolAttr getUseCudnnOnGpuAttr(); + bool getUseCudnnOnGpu(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getExplicitPaddingsAttr(); + ::mlir::ArrayAttr getExplicitPaddings(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::ArrayAttr getDilationsAttr(); + ::mlir::ArrayAttr getDilations(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setStridesAttr(::mlir::ArrayAttr attr); + void setUseCudnnOnGpuAttr(::mlir::BoolAttr attr); + void setUseCudnnOnGpu(::std::optional attrValue); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + void setExplicitPaddingsAttr(::mlir::ArrayAttr attr); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + void setDilationsAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeUseCudnnOnGpuAttr(); + ::mlir::Attribute removeExplicitPaddingsAttr(); + ::mlir::Attribute removeDataFormatAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input_sizes, ::mlir::Value filter, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, /*optional*/::mlir::BoolAttr use_cudnn_on_gpu, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_sizes, ::mlir::Value filter, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, /*optional*/::mlir::BoolAttr use_cudnn_on_gpu, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input_sizes, ::mlir::Value filter, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, /*optional*/bool use_cudnn_on_gpu, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::llvm::StringRef data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_sizes, ::mlir::Value filter, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, /*optional*/bool use_cudnn_on_gpu, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::llvm::StringRef data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 7 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // TF_LayoutSensitiveInterface: + SmallVector GetLayoutDependentArgs() { return {2}; } + SmallVector GetLayoutDependentResults() { return {0}; } + StringRef GetOptimalLayout(const RuntimeDevices& devices); + LogicalResult UpdateDataFormat(StringRef data_format); +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::Conv2DBackpropInputOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::Conv2DBackpropInputV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Conv2DBackpropInputV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + Conv2DBackpropInputV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + Conv2DBackpropInputV2OpGenericAdaptorBase(Conv2DBackpropInputV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::BoolAttr getUseCudnnOnGpuAttr(); + bool getUseCudnnOnGpu(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getExplicitPaddingsAttr(); + ::mlir::ArrayAttr getExplicitPaddings(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::ArrayAttr getDilationsAttr(); + ::mlir::ArrayAttr getDilations(); +}; +} // namespace detail +template +class Conv2DBackpropInputV2OpGenericAdaptor : public detail::Conv2DBackpropInputV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Conv2DBackpropInputV2OpGenericAdaptorBase; +public: + Conv2DBackpropInputV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Conv2DBackpropInputV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Conv2DBackpropInputV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + Conv2DBackpropInputV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getFilter() { + return (*getODSOperands(1).begin()); + } + + ValueT getOutBackprop() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Conv2DBackpropInputV2OpAdaptor : public Conv2DBackpropInputV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using Conv2DBackpropInputV2OpGenericAdaptor::Conv2DBackpropInputV2OpGenericAdaptor; + Conv2DBackpropInputV2OpAdaptor(Conv2DBackpropInputV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Conv2DBackpropInputV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = Conv2DBackpropInputV2OpAdaptor; + template + using GenericAdaptor = Conv2DBackpropInputV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("data_format"), ::llvm::StringRef("dilations"), ::llvm::StringRef("explicit_paddings"), ::llvm::StringRef("padding"), ::llvm::StringRef("strides"), ::llvm::StringRef("use_cudnn_on_gpu")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getExplicitPaddingsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getExplicitPaddingsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getUseCudnnOnGpuAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getUseCudnnOnGpuAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Conv2DBackpropInputV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getFilter(); + ::mlir::TypedValue<::mlir::TensorType> getOutBackprop(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getFilterMutable(); + ::mlir::OpOperand &getOutBackpropMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::BoolAttr getUseCudnnOnGpuAttr(); + bool getUseCudnnOnGpu(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getExplicitPaddingsAttr(); + ::mlir::ArrayAttr getExplicitPaddings(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::ArrayAttr getDilationsAttr(); + ::mlir::ArrayAttr getDilations(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setStridesAttr(::mlir::ArrayAttr attr); + void setUseCudnnOnGpuAttr(::mlir::BoolAttr attr); + void setUseCudnnOnGpu(::std::optional attrValue); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + void setExplicitPaddingsAttr(::mlir::ArrayAttr attr); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + void setDilationsAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeUseCudnnOnGpuAttr(); + ::mlir::Attribute removeExplicitPaddingsAttr(); + ::mlir::Attribute removeDataFormatAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value filter, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, /*optional*/::mlir::BoolAttr use_cudnn_on_gpu, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, /*optional*/::mlir::BoolAttr use_cudnn_on_gpu, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value filter, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, /*optional*/bool use_cudnn_on_gpu, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::llvm::StringRef data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, /*optional*/bool use_cudnn_on_gpu, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::llvm::StringRef data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 7 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::Conv2DBackpropInputV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::Conv2DOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Conv2DOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + Conv2DOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + Conv2DOpGenericAdaptorBase(Conv2DOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::BoolAttr getUseCudnnOnGpuAttr(); + bool getUseCudnnOnGpu(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getExplicitPaddingsAttr(); + ::mlir::ArrayAttr getExplicitPaddings(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::ArrayAttr getDilationsAttr(); + ::mlir::ArrayAttr getDilations(); +}; +} // namespace detail +template +class Conv2DOpGenericAdaptor : public detail::Conv2DOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Conv2DOpGenericAdaptorBase; +public: + Conv2DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Conv2DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Conv2DOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + Conv2DOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getFilter() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Conv2DOpAdaptor : public Conv2DOpGenericAdaptor<::mlir::ValueRange> { +public: + using Conv2DOpGenericAdaptor::Conv2DOpGenericAdaptor; + Conv2DOpAdaptor(Conv2DOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Conv2DOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, LayoutSensitiveInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = Conv2DOpAdaptor; + template + using GenericAdaptor = Conv2DOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("data_format"), ::llvm::StringRef("dilations"), ::llvm::StringRef("explicit_paddings"), ::llvm::StringRef("padding"), ::llvm::StringRef("strides"), ::llvm::StringRef("use_cudnn_on_gpu")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getExplicitPaddingsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getExplicitPaddingsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getUseCudnnOnGpuAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getUseCudnnOnGpuAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Conv2D"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getFilter(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getFilterMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::BoolAttr getUseCudnnOnGpuAttr(); + bool getUseCudnnOnGpu(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getExplicitPaddingsAttr(); + ::mlir::ArrayAttr getExplicitPaddings(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::ArrayAttr getDilationsAttr(); + ::mlir::ArrayAttr getDilations(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setStridesAttr(::mlir::ArrayAttr attr); + void setUseCudnnOnGpuAttr(::mlir::BoolAttr attr); + void setUseCudnnOnGpu(::std::optional attrValue); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + void setExplicitPaddingsAttr(::mlir::ArrayAttr attr); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + void setDilationsAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeUseCudnnOnGpuAttr(); + ::mlir::Attribute removeExplicitPaddingsAttr(); + ::mlir::Attribute removeDataFormatAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value filter, ::mlir::ArrayAttr strides, /*optional*/::mlir::BoolAttr use_cudnn_on_gpu, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value filter, ::mlir::ArrayAttr strides, /*optional*/::mlir::BoolAttr use_cudnn_on_gpu, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter, ::mlir::ArrayAttr strides, /*optional*/::mlir::BoolAttr use_cudnn_on_gpu, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value filter, ::mlir::ArrayAttr strides, /*optional*/bool use_cudnn_on_gpu, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::llvm::StringRef data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value filter, ::mlir::ArrayAttr strides, /*optional*/bool use_cudnn_on_gpu, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::llvm::StringRef data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter, ::mlir::ArrayAttr strides, /*optional*/bool use_cudnn_on_gpu, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::llvm::StringRef data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 7 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // TF_LayoutSensitiveInterface: + SmallVector GetLayoutDependentArgs() { return {0}; } + SmallVector GetLayoutDependentResults() { return {0}; } + StringRef GetOptimalLayout(const RuntimeDevices& devices); + LogicalResult UpdateDataFormat(StringRef data_format); + // InferTypeOpInterface: + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return ArraysAreCastCompatible(l, r); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::Conv2DOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::Conv3DBackpropFilterOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Conv3DBackpropFilterOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + Conv3DBackpropFilterOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + Conv3DBackpropFilterOpGenericAdaptorBase(Conv3DBackpropFilterOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getDilationsAttr(); + ::mlir::ArrayAttr getDilations(); +}; +} // namespace detail +template +class Conv3DBackpropFilterOpGenericAdaptor : public detail::Conv3DBackpropFilterOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Conv3DBackpropFilterOpGenericAdaptorBase; +public: + Conv3DBackpropFilterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Conv3DBackpropFilterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Conv3DBackpropFilterOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + Conv3DBackpropFilterOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getFilter() { + return (*getODSOperands(1).begin()); + } + + ValueT getOutBackprop() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Conv3DBackpropFilterOpAdaptor : public Conv3DBackpropFilterOpGenericAdaptor<::mlir::ValueRange> { +public: + using Conv3DBackpropFilterOpGenericAdaptor::Conv3DBackpropFilterOpGenericAdaptor; + Conv3DBackpropFilterOpAdaptor(Conv3DBackpropFilterOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Conv3DBackpropFilterOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = Conv3DBackpropFilterOpAdaptor; + template + using GenericAdaptor = Conv3DBackpropFilterOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("dilations"), ::llvm::StringRef("padding"), ::llvm::StringRef("strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Conv3DBackpropFilter"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getFilter(); + ::mlir::TypedValue<::mlir::TensorType> getOutBackprop(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getFilterMutable(); + ::mlir::OpOperand &getOutBackpropMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getDilationsAttr(); + ::mlir::ArrayAttr getDilations(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setStridesAttr(::mlir::ArrayAttr attr); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + void setDilationsAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value filter, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value filter, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::Conv3DBackpropFilterOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::Conv3DBackpropFilterV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Conv3DBackpropFilterV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + Conv3DBackpropFilterV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + Conv3DBackpropFilterV2OpGenericAdaptorBase(Conv3DBackpropFilterV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::ArrayAttr getDilationsAttr(); + ::mlir::ArrayAttr getDilations(); +}; +} // namespace detail +template +class Conv3DBackpropFilterV2OpGenericAdaptor : public detail::Conv3DBackpropFilterV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Conv3DBackpropFilterV2OpGenericAdaptorBase; +public: + Conv3DBackpropFilterV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Conv3DBackpropFilterV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Conv3DBackpropFilterV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + Conv3DBackpropFilterV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getFilterSizes() { + return (*getODSOperands(1).begin()); + } + + ValueT getOutBackprop() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Conv3DBackpropFilterV2OpAdaptor : public Conv3DBackpropFilterV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using Conv3DBackpropFilterV2OpGenericAdaptor::Conv3DBackpropFilterV2OpGenericAdaptor; + Conv3DBackpropFilterV2OpAdaptor(Conv3DBackpropFilterV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Conv3DBackpropFilterV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = Conv3DBackpropFilterV2OpAdaptor; + template + using GenericAdaptor = Conv3DBackpropFilterV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("data_format"), ::llvm::StringRef("dilations"), ::llvm::StringRef("padding"), ::llvm::StringRef("strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Conv3DBackpropFilterV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getFilterSizes(); + ::mlir::TypedValue<::mlir::TensorType> getOutBackprop(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getFilterSizesMutable(); + ::mlir::OpOperand &getOutBackpropMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::ArrayAttr getDilationsAttr(); + ::mlir::ArrayAttr getDilations(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setStridesAttr(::mlir::ArrayAttr attr); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + void setDilationsAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeDataFormatAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value filter_sizes, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter_sizes, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value filter_sizes, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::llvm::StringRef data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter_sizes, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::llvm::StringRef data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::Conv3DBackpropFilterV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::Conv3DBackpropInputOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Conv3DBackpropInputOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + Conv3DBackpropInputOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + Conv3DBackpropInputOpGenericAdaptorBase(Conv3DBackpropInputOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getDilationsAttr(); + ::mlir::ArrayAttr getDilations(); +}; +} // namespace detail +template +class Conv3DBackpropInputOpGenericAdaptor : public detail::Conv3DBackpropInputOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Conv3DBackpropInputOpGenericAdaptorBase; +public: + Conv3DBackpropInputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Conv3DBackpropInputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Conv3DBackpropInputOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + Conv3DBackpropInputOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getFilter() { + return (*getODSOperands(1).begin()); + } + + ValueT getOutBackprop() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Conv3DBackpropInputOpAdaptor : public Conv3DBackpropInputOpGenericAdaptor<::mlir::ValueRange> { +public: + using Conv3DBackpropInputOpGenericAdaptor::Conv3DBackpropInputOpGenericAdaptor; + Conv3DBackpropInputOpAdaptor(Conv3DBackpropInputOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Conv3DBackpropInputOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = Conv3DBackpropInputOpAdaptor; + template + using GenericAdaptor = Conv3DBackpropInputOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("dilations"), ::llvm::StringRef("padding"), ::llvm::StringRef("strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Conv3DBackpropInput"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getFilter(); + ::mlir::TypedValue<::mlir::TensorType> getOutBackprop(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getFilterMutable(); + ::mlir::OpOperand &getOutBackpropMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getDilationsAttr(); + ::mlir::ArrayAttr getDilations(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setStridesAttr(::mlir::ArrayAttr attr); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + void setDilationsAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value filter, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value filter, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::Conv3DBackpropInputOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::Conv3DBackpropInputV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Conv3DBackpropInputV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + Conv3DBackpropInputV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + Conv3DBackpropInputV2OpGenericAdaptorBase(Conv3DBackpropInputV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::ArrayAttr getDilationsAttr(); + ::mlir::ArrayAttr getDilations(); +}; +} // namespace detail +template +class Conv3DBackpropInputV2OpGenericAdaptor : public detail::Conv3DBackpropInputV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Conv3DBackpropInputV2OpGenericAdaptorBase; +public: + Conv3DBackpropInputV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Conv3DBackpropInputV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Conv3DBackpropInputV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + Conv3DBackpropInputV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputSizes() { + return (*getODSOperands(0).begin()); + } + + ValueT getFilter() { + return (*getODSOperands(1).begin()); + } + + ValueT getOutBackprop() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Conv3DBackpropInputV2OpAdaptor : public Conv3DBackpropInputV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using Conv3DBackpropInputV2OpGenericAdaptor::Conv3DBackpropInputV2OpGenericAdaptor; + Conv3DBackpropInputV2OpAdaptor(Conv3DBackpropInputV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Conv3DBackpropInputV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = Conv3DBackpropInputV2OpAdaptor; + template + using GenericAdaptor = Conv3DBackpropInputV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tshape"), ::llvm::StringRef("data_format"), ::llvm::StringRef("dilations"), ::llvm::StringRef("padding"), ::llvm::StringRef("strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTshapeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTshapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Conv3DBackpropInputV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputSizes(); + ::mlir::TypedValue<::mlir::TensorType> getFilter(); + ::mlir::TypedValue<::mlir::TensorType> getOutBackprop(); + ::mlir::OpOperand &getInputSizesMutable(); + ::mlir::OpOperand &getFilterMutable(); + ::mlir::OpOperand &getOutBackpropMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::ArrayAttr getDilationsAttr(); + ::mlir::ArrayAttr getDilations(); + ::mlir::Type getT(); + ::mlir::Type getTshape(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setStridesAttr(::mlir::ArrayAttr attr); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + void setDilationsAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeDataFormatAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input_sizes, ::mlir::Value filter, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_sizes, ::mlir::Value filter, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input_sizes, ::mlir::Value filter, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::llvm::StringRef data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_sizes, ::mlir::Value filter, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::llvm::StringRef data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::Conv3DBackpropInputV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::Conv3DOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Conv3DOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + Conv3DOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + Conv3DOpGenericAdaptorBase(Conv3DOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::ArrayAttr getDilationsAttr(); + ::mlir::ArrayAttr getDilations(); +}; +} // namespace detail +template +class Conv3DOpGenericAdaptor : public detail::Conv3DOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Conv3DOpGenericAdaptorBase; +public: + Conv3DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Conv3DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Conv3DOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + Conv3DOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getFilter() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Conv3DOpAdaptor : public Conv3DOpGenericAdaptor<::mlir::ValueRange> { +public: + using Conv3DOpGenericAdaptor::Conv3DOpGenericAdaptor; + Conv3DOpAdaptor(Conv3DOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Conv3DOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = Conv3DOpAdaptor; + template + using GenericAdaptor = Conv3DOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("data_format"), ::llvm::StringRef("dilations"), ::llvm::StringRef("padding"), ::llvm::StringRef("strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Conv3D"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getFilter(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getFilterMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::ArrayAttr getDilationsAttr(); + ::mlir::ArrayAttr getDilations(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setStridesAttr(::mlir::ArrayAttr attr); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + void setDilationsAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeDataFormatAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value filter, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value filter, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value filter, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::llvm::StringRef data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value filter, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::llvm::StringRef data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::llvm::StringRef data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // InferTypeOpInterface: + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return ArraysAreCastCompatible(l, r); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::Conv3DOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ConvOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConvOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ConvOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ConvOpGenericAdaptorBase(ConvOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getExplicitPaddingsAttr(); + ::mlir::ArrayAttr getExplicitPaddings(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::ArrayAttr getDilationsAttr(); + ::mlir::ArrayAttr getDilations(); + ::mlir::IntegerAttr getBatchDimsAttr(); + uint64_t getBatchDims(); + ::mlir::IntegerAttr getGroupsAttr(); + uint64_t getGroups(); +}; +} // namespace detail +template +class ConvOpGenericAdaptor : public detail::ConvOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConvOpGenericAdaptorBase; +public: + ConvOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConvOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConvOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ConvOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getFilter() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConvOpAdaptor : public ConvOpGenericAdaptor<::mlir::ValueRange> { +public: + using ConvOpGenericAdaptor::ConvOpGenericAdaptor; + ConvOpAdaptor(ConvOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConvOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ConvOpAdaptor; + template + using GenericAdaptor = ConvOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("batch_dims"), ::llvm::StringRef("data_format"), ::llvm::StringRef("dilations"), ::llvm::StringRef("explicit_paddings"), ::llvm::StringRef("groups"), ::llvm::StringRef("padding"), ::llvm::StringRef("strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getBatchDimsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getBatchDimsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getExplicitPaddingsAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getExplicitPaddingsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getGroupsAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getGroupsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Conv"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getFilter(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getFilterMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getExplicitPaddingsAttr(); + ::mlir::ArrayAttr getExplicitPaddings(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::ArrayAttr getDilationsAttr(); + ::mlir::ArrayAttr getDilations(); + ::mlir::IntegerAttr getBatchDimsAttr(); + uint64_t getBatchDims(); + ::mlir::IntegerAttr getGroupsAttr(); + uint64_t getGroups(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setStridesAttr(::mlir::ArrayAttr attr); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + void setExplicitPaddingsAttr(::mlir::ArrayAttr attr); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + void setDilationsAttr(::mlir::ArrayAttr attr); + void setBatchDimsAttr(::mlir::IntegerAttr attr); + void setBatchDims(::std::optional attrValue); + void setGroupsAttr(::mlir::IntegerAttr attr); + void setGroups(::std::optional attrValue); + ::mlir::Attribute removeExplicitPaddingsAttr(); + ::mlir::Attribute removeDataFormatAttr(); + ::mlir::Attribute removeDilationsAttr(); + ::mlir::Attribute removeBatchDimsAttr(); + ::mlir::Attribute removeGroupsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value filter, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::ArrayAttr dilations, /*optional*/::mlir::IntegerAttr batch_dims, /*optional*/::mlir::IntegerAttr groups); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::ArrayAttr dilations, /*optional*/::mlir::IntegerAttr batch_dims, /*optional*/::mlir::IntegerAttr groups); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value filter, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::llvm::StringRef data_format, /*optional*/::mlir::ArrayAttr dilations, /*optional*/uint64_t batch_dims = 1, /*optional*/uint64_t groups = 1); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::llvm::StringRef data_format, /*optional*/::mlir::ArrayAttr dilations, /*optional*/uint64_t batch_dims = 1, /*optional*/uint64_t groups = 1); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 8 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ConvOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ConvertToCooTensorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConvertToCooTensorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ConvertToCooTensorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ConvertToCooTensorOpGenericAdaptorBase(ConvertToCooTensorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getSampleCountAttr(); + uint64_t getSampleCount(); + ::mlir::StringAttr getCombinerAttr(); + ::llvm::StringRef getCombiner(); +}; +} // namespace detail +template +class ConvertToCooTensorOpGenericAdaptor : public detail::ConvertToCooTensorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConvertToCooTensorOpGenericAdaptorBase; +public: + ConvertToCooTensorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConvertToCooTensorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConvertToCooTensorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ConvertToCooTensorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIndicesOrRowSplits() { + return (*getODSOperands(0).begin()); + } + + ValueT getValues() { + return (*getODSOperands(1).begin()); + } + + ValueT getWeights() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConvertToCooTensorOpAdaptor : public ConvertToCooTensorOpGenericAdaptor<::mlir::ValueRange> { +public: + using ConvertToCooTensorOpGenericAdaptor::ConvertToCooTensorOpGenericAdaptor; + ConvertToCooTensorOpAdaptor(ConvertToCooTensorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConvertToCooTensorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ConvertToCooTensorOpAdaptor; + template + using GenericAdaptor = ConvertToCooTensorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("combiner"), ::llvm::StringRef("sample_count")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getCombinerAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getCombinerAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getSampleCountAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getSampleCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ConvertToCooTensor"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getIndicesOrRowSplits(); + ::mlir::TypedValue<::mlir::TensorType> getValues(); + ::mlir::TypedValue<::mlir::TensorType> getWeights(); + ::mlir::OpOperand &getIndicesOrRowSplitsMutable(); + ::mlir::OpOperand &getValuesMutable(); + ::mlir::OpOperand &getWeightsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getRowIds(); + ::mlir::TypedValue<::mlir::TensorType> getColIds(); + ::mlir::TypedValue<::mlir::TensorType> getGains(); + ::mlir::IntegerAttr getSampleCountAttr(); + uint64_t getSampleCount(); + ::mlir::StringAttr getCombinerAttr(); + ::llvm::StringRef getCombiner(); + void setSampleCountAttr(::mlir::IntegerAttr attr); + void setSampleCount(uint64_t attrValue); + void setCombinerAttr(::mlir::StringAttr attr); + void setCombiner(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type row_ids, ::mlir::Type col_ids, ::mlir::Type gains, ::mlir::Value indices_or_row_splits, ::mlir::Value values, ::mlir::Value weights, ::mlir::IntegerAttr sample_count, ::mlir::StringAttr combiner); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value indices_or_row_splits, ::mlir::Value values, ::mlir::Value weights, ::mlir::IntegerAttr sample_count, ::mlir::StringAttr combiner); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type row_ids, ::mlir::Type col_ids, ::mlir::Type gains, ::mlir::Value indices_or_row_splits, ::mlir::Value values, ::mlir::Value weights, uint64_t sample_count, ::llvm::StringRef combiner); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value indices_or_row_splits, ::mlir::Value values, ::mlir::Value weights, uint64_t sample_count, ::llvm::StringRef combiner); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ConvertToCooTensorOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::CosOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CosOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CosOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CosOpGenericAdaptorBase(CosOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CosOpGenericAdaptor : public detail::CosOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CosOpGenericAdaptorBase; +public: + CosOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CosOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CosOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CosOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CosOpAdaptor : public CosOpGenericAdaptor<::mlir::ValueRange> { +public: + using CosOpGenericAdaptor::CosOpGenericAdaptor; + CosOpAdaptor(CosOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CosOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CosOpAdaptor; + template + using GenericAdaptor = CosOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Cos"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::CosOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::CoshOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CoshOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CoshOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CoshOpGenericAdaptorBase(CoshOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CoshOpGenericAdaptor : public detail::CoshOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CoshOpGenericAdaptorBase; +public: + CoshOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CoshOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CoshOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CoshOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CoshOpAdaptor : public CoshOpGenericAdaptor<::mlir::ValueRange> { +public: + using CoshOpGenericAdaptor::CoshOpGenericAdaptor; + CoshOpAdaptor(CoshOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CoshOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CoshOpAdaptor; + template + using GenericAdaptor = CoshOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Cosh"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::CoshOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::CreateSummaryDbWriterOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CreateSummaryDbWriterOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CreateSummaryDbWriterOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CreateSummaryDbWriterOpGenericAdaptorBase(CreateSummaryDbWriterOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CreateSummaryDbWriterOpGenericAdaptor : public detail::CreateSummaryDbWriterOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CreateSummaryDbWriterOpGenericAdaptorBase; +public: + CreateSummaryDbWriterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CreateSummaryDbWriterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CreateSummaryDbWriterOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CreateSummaryDbWriterOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getWriter() { + return (*getODSOperands(0).begin()); + } + + ValueT getDbUri() { + return (*getODSOperands(1).begin()); + } + + ValueT getExperimentName() { + return (*getODSOperands(2).begin()); + } + + ValueT getRunName() { + return (*getODSOperands(3).begin()); + } + + ValueT getUserName() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CreateSummaryDbWriterOpAdaptor : public CreateSummaryDbWriterOpGenericAdaptor<::mlir::ValueRange> { +public: + using CreateSummaryDbWriterOpGenericAdaptor::CreateSummaryDbWriterOpGenericAdaptor; + CreateSummaryDbWriterOpAdaptor(CreateSummaryDbWriterOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CreateSummaryDbWriterOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CreateSummaryDbWriterOpAdaptor; + template + using GenericAdaptor = CreateSummaryDbWriterOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.CreateSummaryDbWriter"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getWriter(); + ::mlir::TypedValue<::mlir::TensorType> getDbUri(); + ::mlir::TypedValue<::mlir::TensorType> getExperimentName(); + ::mlir::TypedValue<::mlir::TensorType> getRunName(); + ::mlir::TypedValue<::mlir::TensorType> getUserName(); + ::mlir::OpOperand &getWriterMutable(); + ::mlir::OpOperand &getDbUriMutable(); + ::mlir::OpOperand &getExperimentNameMutable(); + ::mlir::OpOperand &getRunNameMutable(); + ::mlir::OpOperand &getUserNameMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value writer, ::mlir::Value db_uri, ::mlir::Value experiment_name, ::mlir::Value run_name, ::mlir::Value user_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value writer, ::mlir::Value db_uri, ::mlir::Value experiment_name, ::mlir::Value run_name, ::mlir::Value user_name); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::CreateSummaryDbWriterOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::CreateSummaryFileWriterOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CreateSummaryFileWriterOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CreateSummaryFileWriterOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CreateSummaryFileWriterOpGenericAdaptorBase(CreateSummaryFileWriterOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CreateSummaryFileWriterOpGenericAdaptor : public detail::CreateSummaryFileWriterOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CreateSummaryFileWriterOpGenericAdaptorBase; +public: + CreateSummaryFileWriterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CreateSummaryFileWriterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CreateSummaryFileWriterOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CreateSummaryFileWriterOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getWriter() { + return (*getODSOperands(0).begin()); + } + + ValueT getLogdir() { + return (*getODSOperands(1).begin()); + } + + ValueT getMaxQueue() { + return (*getODSOperands(2).begin()); + } + + ValueT getFlushMillis() { + return (*getODSOperands(3).begin()); + } + + ValueT getFilenameSuffix() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CreateSummaryFileWriterOpAdaptor : public CreateSummaryFileWriterOpGenericAdaptor<::mlir::ValueRange> { +public: + using CreateSummaryFileWriterOpGenericAdaptor::CreateSummaryFileWriterOpGenericAdaptor; + CreateSummaryFileWriterOpAdaptor(CreateSummaryFileWriterOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CreateSummaryFileWriterOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CreateSummaryFileWriterOpAdaptor; + template + using GenericAdaptor = CreateSummaryFileWriterOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.CreateSummaryFileWriter"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getWriter(); + ::mlir::TypedValue<::mlir::TensorType> getLogdir(); + ::mlir::TypedValue<::mlir::TensorType> getMaxQueue(); + ::mlir::TypedValue<::mlir::TensorType> getFlushMillis(); + ::mlir::TypedValue<::mlir::TensorType> getFilenameSuffix(); + ::mlir::OpOperand &getWriterMutable(); + ::mlir::OpOperand &getLogdirMutable(); + ::mlir::OpOperand &getMaxQueueMutable(); + ::mlir::OpOperand &getFlushMillisMutable(); + ::mlir::OpOperand &getFilenameSuffixMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value writer, ::mlir::Value logdir, ::mlir::Value max_queue, ::mlir::Value flush_millis, ::mlir::Value filename_suffix); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value writer, ::mlir::Value logdir, ::mlir::Value max_queue, ::mlir::Value flush_millis, ::mlir::Value filename_suffix); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::CreateSummaryFileWriterOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::CrossOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CrossOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CrossOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CrossOpGenericAdaptorBase(CrossOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CrossOpGenericAdaptor : public detail::CrossOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CrossOpGenericAdaptorBase; +public: + CrossOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CrossOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CrossOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CrossOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + ValueT getB() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CrossOpAdaptor : public CrossOpGenericAdaptor<::mlir::ValueRange> { +public: + using CrossOpGenericAdaptor::CrossOpGenericAdaptor; + CrossOpAdaptor(CrossOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CrossOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CrossOpAdaptor; + template + using GenericAdaptor = CrossOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Cross"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getA(); + ::mlir::TypedValue<::mlir::TensorType> getB(); + ::mlir::OpOperand &getAMutable(); + ::mlir::OpOperand &getBMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getProduct(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type product, ::mlir::Value a, ::mlir::Value b); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::CrossOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::CrossReplicaSumOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CrossReplicaSumOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CrossReplicaSumOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CrossReplicaSumOpGenericAdaptorBase(CrossReplicaSumOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CrossReplicaSumOpGenericAdaptor : public detail::CrossReplicaSumOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CrossReplicaSumOpGenericAdaptorBase; +public: + CrossReplicaSumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CrossReplicaSumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CrossReplicaSumOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CrossReplicaSumOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getGroupAssignment() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CrossReplicaSumOpAdaptor : public CrossReplicaSumOpGenericAdaptor<::mlir::ValueRange> { +public: + using CrossReplicaSumOpGenericAdaptor::CrossReplicaSumOpGenericAdaptor; + CrossReplicaSumOpAdaptor(CrossReplicaSumOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CrossReplicaSumOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CrossReplicaSumOpAdaptor; + template + using GenericAdaptor = CrossReplicaSumOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.CrossReplicaSum"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getGroupAssignment(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getGroupAssignmentMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value group_assignment); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value group_assignment); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::CrossReplicaSumOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::CumprodOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CumprodOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CumprodOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CumprodOpGenericAdaptorBase(CumprodOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getExclusiveAttr(); + bool getExclusive(); + ::mlir::BoolAttr getReverseAttr(); + bool getReverse(); +}; +} // namespace detail +template +class CumprodOpGenericAdaptor : public detail::CumprodOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CumprodOpGenericAdaptorBase; +public: + CumprodOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CumprodOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CumprodOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CumprodOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getAxis() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CumprodOpAdaptor : public CumprodOpGenericAdaptor<::mlir::ValueRange> { +public: + using CumprodOpGenericAdaptor::CumprodOpGenericAdaptor; + CumprodOpAdaptor(CumprodOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CumprodOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CumprodOpAdaptor; + template + using GenericAdaptor = CumprodOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tidx"), ::llvm::StringRef("exclusive"), ::llvm::StringRef("reverse")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTidxAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTidxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getExclusiveAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getExclusiveAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getReverseAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getReverseAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Cumprod"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getAxis(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getAxisMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOut(); + ::mlir::BoolAttr getExclusiveAttr(); + bool getExclusive(); + ::mlir::BoolAttr getReverseAttr(); + bool getReverse(); + ::mlir::Type getT(); + ::mlir::Type getTidx(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setExclusiveAttr(::mlir::BoolAttr attr); + void setExclusive(::std::optional attrValue); + void setReverseAttr(::mlir::BoolAttr attr); + void setReverse(::std::optional attrValue); + ::mlir::Attribute removeExclusiveAttr(); + ::mlir::Attribute removeReverseAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, ::mlir::Value x, ::mlir::Value axis, /*optional*/::mlir::BoolAttr exclusive, /*optional*/::mlir::BoolAttr reverse); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value axis, /*optional*/::mlir::BoolAttr exclusive, /*optional*/::mlir::BoolAttr reverse); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, ::mlir::Value x, ::mlir::Value axis, /*optional*/bool exclusive = false, /*optional*/bool reverse = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value axis, /*optional*/bool exclusive = false, /*optional*/bool reverse = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::CumprodOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::CumsumOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CumsumOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CumsumOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CumsumOpGenericAdaptorBase(CumsumOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getExclusiveAttr(); + bool getExclusive(); + ::mlir::BoolAttr getReverseAttr(); + bool getReverse(); +}; +} // namespace detail +template +class CumsumOpGenericAdaptor : public detail::CumsumOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CumsumOpGenericAdaptorBase; +public: + CumsumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CumsumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CumsumOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CumsumOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getAxis() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CumsumOpAdaptor : public CumsumOpGenericAdaptor<::mlir::ValueRange> { +public: + using CumsumOpGenericAdaptor::CumsumOpGenericAdaptor; + CumsumOpAdaptor(CumsumOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CumsumOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CumsumOpAdaptor; + template + using GenericAdaptor = CumsumOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tidx"), ::llvm::StringRef("exclusive"), ::llvm::StringRef("reverse")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTidxAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTidxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getExclusiveAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getExclusiveAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getReverseAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getReverseAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Cumsum"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getAxis(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getAxisMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOut(); + ::mlir::BoolAttr getExclusiveAttr(); + bool getExclusive(); + ::mlir::BoolAttr getReverseAttr(); + bool getReverse(); + ::mlir::Type getT(); + ::mlir::Type getTidx(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setExclusiveAttr(::mlir::BoolAttr attr); + void setExclusive(::std::optional attrValue); + void setReverseAttr(::mlir::BoolAttr attr); + void setReverse(::std::optional attrValue); + ::mlir::Attribute removeExclusiveAttr(); + ::mlir::Attribute removeReverseAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, ::mlir::Value x, ::mlir::Value axis, /*optional*/::mlir::BoolAttr exclusive, /*optional*/::mlir::BoolAttr reverse); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value axis, /*optional*/::mlir::BoolAttr exclusive, /*optional*/::mlir::BoolAttr reverse); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, ::mlir::Value x, ::mlir::Value axis, /*optional*/bool exclusive = false, /*optional*/bool reverse = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value axis, /*optional*/bool exclusive = false, /*optional*/bool reverse = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::CumsumOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::CumulativeLogsumexpOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CumulativeLogsumexpOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CumulativeLogsumexpOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CumulativeLogsumexpOpGenericAdaptorBase(CumulativeLogsumexpOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getExclusiveAttr(); + bool getExclusive(); + ::mlir::BoolAttr getReverseAttr(); + bool getReverse(); +}; +} // namespace detail +template +class CumulativeLogsumexpOpGenericAdaptor : public detail::CumulativeLogsumexpOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CumulativeLogsumexpOpGenericAdaptorBase; +public: + CumulativeLogsumexpOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CumulativeLogsumexpOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CumulativeLogsumexpOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CumulativeLogsumexpOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getAxis() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CumulativeLogsumexpOpAdaptor : public CumulativeLogsumexpOpGenericAdaptor<::mlir::ValueRange> { +public: + using CumulativeLogsumexpOpGenericAdaptor::CumulativeLogsumexpOpGenericAdaptor; + CumulativeLogsumexpOpAdaptor(CumulativeLogsumexpOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CumulativeLogsumexpOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CumulativeLogsumexpOpAdaptor; + template + using GenericAdaptor = CumulativeLogsumexpOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tidx"), ::llvm::StringRef("exclusive"), ::llvm::StringRef("reverse")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTidxAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTidxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getExclusiveAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getExclusiveAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getReverseAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getReverseAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.CumulativeLogsumexp"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getAxis(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getAxisMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOut(); + ::mlir::BoolAttr getExclusiveAttr(); + bool getExclusive(); + ::mlir::BoolAttr getReverseAttr(); + bool getReverse(); + ::mlir::Type getT(); + ::mlir::Type getTidx(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setExclusiveAttr(::mlir::BoolAttr attr); + void setExclusive(::std::optional attrValue); + void setReverseAttr(::mlir::BoolAttr attr); + void setReverse(::std::optional attrValue); + ::mlir::Attribute removeExclusiveAttr(); + ::mlir::Attribute removeReverseAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, ::mlir::Value x, ::mlir::Value axis, /*optional*/::mlir::BoolAttr exclusive, /*optional*/::mlir::BoolAttr reverse); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value axis, /*optional*/::mlir::BoolAttr exclusive, /*optional*/::mlir::BoolAttr reverse); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, ::mlir::Value x, ::mlir::Value axis, /*optional*/bool exclusive = false, /*optional*/bool reverse = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value axis, /*optional*/bool exclusive = false, /*optional*/bool reverse = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::CumulativeLogsumexpOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DataFormatDimMapOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DataFormatDimMapOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DataFormatDimMapOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DataFormatDimMapOpGenericAdaptorBase(DataFormatDimMapOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getSrcFormatAttr(); + ::llvm::StringRef getSrcFormat(); + ::mlir::StringAttr getDstFormatAttr(); + ::llvm::StringRef getDstFormat(); +}; +} // namespace detail +template +class DataFormatDimMapOpGenericAdaptor : public detail::DataFormatDimMapOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DataFormatDimMapOpGenericAdaptorBase; +public: + DataFormatDimMapOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DataFormatDimMapOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DataFormatDimMapOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DataFormatDimMapOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DataFormatDimMapOpAdaptor : public DataFormatDimMapOpGenericAdaptor<::mlir::ValueRange> { +public: + using DataFormatDimMapOpGenericAdaptor::DataFormatDimMapOpGenericAdaptor; + DataFormatDimMapOpAdaptor(DataFormatDimMapOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DataFormatDimMapOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DataFormatDimMapOpAdaptor; + template + using GenericAdaptor = DataFormatDimMapOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("dst_format"), ::llvm::StringRef("src_format")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDstFormatAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDstFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getSrcFormatAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getSrcFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.DataFormatDimMap"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::StringAttr getSrcFormatAttr(); + ::llvm::StringRef getSrcFormat(); + ::mlir::StringAttr getDstFormatAttr(); + ::llvm::StringRef getDstFormat(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setSrcFormatAttr(::mlir::StringAttr attr); + void setSrcFormat(::std::optional<::llvm::StringRef> attrValue); + void setDstFormatAttr(::mlir::StringAttr attr); + void setDstFormat(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeSrcFormatAttr(); + ::mlir::Attribute removeDstFormatAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x, /*optional*/::mlir::StringAttr src_format, /*optional*/::mlir::StringAttr dst_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x, /*optional*/::mlir::StringAttr src_format, /*optional*/::mlir::StringAttr dst_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, /*optional*/::mlir::StringAttr src_format, /*optional*/::mlir::StringAttr dst_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x, /*optional*/::llvm::StringRef src_format = "NHWC", /*optional*/::llvm::StringRef dst_format = "NCHW"); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x, /*optional*/::llvm::StringRef src_format = "NHWC", /*optional*/::llvm::StringRef dst_format = "NCHW"); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, /*optional*/::llvm::StringRef src_format = "NHWC", /*optional*/::llvm::StringRef dst_format = "NCHW"); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DataFormatDimMapOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DataFormatVecPermuteOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DataFormatVecPermuteOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DataFormatVecPermuteOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DataFormatVecPermuteOpGenericAdaptorBase(DataFormatVecPermuteOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getSrcFormatAttr(); + ::llvm::StringRef getSrcFormat(); + ::mlir::StringAttr getDstFormatAttr(); + ::llvm::StringRef getDstFormat(); +}; +} // namespace detail +template +class DataFormatVecPermuteOpGenericAdaptor : public detail::DataFormatVecPermuteOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DataFormatVecPermuteOpGenericAdaptorBase; +public: + DataFormatVecPermuteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DataFormatVecPermuteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DataFormatVecPermuteOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DataFormatVecPermuteOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DataFormatVecPermuteOpAdaptor : public DataFormatVecPermuteOpGenericAdaptor<::mlir::ValueRange> { +public: + using DataFormatVecPermuteOpGenericAdaptor::DataFormatVecPermuteOpGenericAdaptor; + DataFormatVecPermuteOpAdaptor(DataFormatVecPermuteOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DataFormatVecPermuteOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DataFormatVecPermuteOpAdaptor; + template + using GenericAdaptor = DataFormatVecPermuteOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("dst_format"), ::llvm::StringRef("src_format")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDstFormatAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDstFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getSrcFormatAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getSrcFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.DataFormatVecPermute"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::StringAttr getSrcFormatAttr(); + ::llvm::StringRef getSrcFormat(); + ::mlir::StringAttr getDstFormatAttr(); + ::llvm::StringRef getDstFormat(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setSrcFormatAttr(::mlir::StringAttr attr); + void setSrcFormat(::std::optional<::llvm::StringRef> attrValue); + void setDstFormatAttr(::mlir::StringAttr attr); + void setDstFormat(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeSrcFormatAttr(); + ::mlir::Attribute removeDstFormatAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x, /*optional*/::mlir::StringAttr src_format, /*optional*/::mlir::StringAttr dst_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x, /*optional*/::mlir::StringAttr src_format, /*optional*/::mlir::StringAttr dst_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, /*optional*/::mlir::StringAttr src_format, /*optional*/::mlir::StringAttr dst_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x, /*optional*/::llvm::StringRef src_format = "NHWC", /*optional*/::llvm::StringRef dst_format = "NCHW"); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x, /*optional*/::llvm::StringRef src_format = "NHWC", /*optional*/::llvm::StringRef dst_format = "NCHW"); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, /*optional*/::llvm::StringRef src_format = "NHWC", /*optional*/::llvm::StringRef dst_format = "NCHW"); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DataFormatVecPermuteOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DebugIdentityV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DebugIdentityV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DebugIdentityV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DebugIdentityV2OpGenericAdaptorBase(DebugIdentityV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getTfdbgContextIdAttr(); + ::llvm::StringRef getTfdbgContextId(); + ::mlir::StringAttr getOpNameAttr(); + ::llvm::StringRef getOpName(); + ::mlir::IntegerAttr getOutputSlotAttr(); + uint64_t getOutputSlot(); + ::mlir::IntegerAttr getTensorDebugModeAttr(); + uint64_t getTensorDebugMode(); + ::mlir::ArrayAttr getDebugUrlsAttr(); + ::mlir::ArrayAttr getDebugUrls(); + ::mlir::IntegerAttr getCircularBufferSizeAttr(); + uint64_t getCircularBufferSize(); + ::mlir::StringAttr getTfdbgRunIdAttr(); + ::llvm::StringRef getTfdbgRunId(); +}; +} // namespace detail +template +class DebugIdentityV2OpGenericAdaptor : public detail::DebugIdentityV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DebugIdentityV2OpGenericAdaptorBase; +public: + DebugIdentityV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DebugIdentityV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DebugIdentityV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DebugIdentityV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DebugIdentityV2OpAdaptor : public DebugIdentityV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using DebugIdentityV2OpGenericAdaptor::DebugIdentityV2OpGenericAdaptor; + DebugIdentityV2OpAdaptor(DebugIdentityV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DebugIdentityV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DebugIdentityV2OpAdaptor; + template + using GenericAdaptor = DebugIdentityV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("circular_buffer_size"), ::llvm::StringRef("debug_urls"), ::llvm::StringRef("op_name"), ::llvm::StringRef("output_slot"), ::llvm::StringRef("tensor_debug_mode"), ::llvm::StringRef("tfdbg_context_id"), ::llvm::StringRef("tfdbg_run_id")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getCircularBufferSizeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getCircularBufferSizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDebugUrlsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDebugUrlsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getOpNameAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getOpNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getOutputSlotAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getOutputSlotAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getTensorDebugModeAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getTensorDebugModeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getTfdbgContextIdAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getTfdbgContextIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getTfdbgRunIdAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getTfdbgRunIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.DebugIdentityV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::StringAttr getTfdbgContextIdAttr(); + ::llvm::StringRef getTfdbgContextId(); + ::mlir::StringAttr getOpNameAttr(); + ::llvm::StringRef getOpName(); + ::mlir::IntegerAttr getOutputSlotAttr(); + uint64_t getOutputSlot(); + ::mlir::IntegerAttr getTensorDebugModeAttr(); + uint64_t getTensorDebugMode(); + ::mlir::ArrayAttr getDebugUrlsAttr(); + ::mlir::ArrayAttr getDebugUrls(); + ::mlir::IntegerAttr getCircularBufferSizeAttr(); + uint64_t getCircularBufferSize(); + ::mlir::StringAttr getTfdbgRunIdAttr(); + ::llvm::StringRef getTfdbgRunId(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setTfdbgContextIdAttr(::mlir::StringAttr attr); + void setTfdbgContextId(::std::optional<::llvm::StringRef> attrValue); + void setOpNameAttr(::mlir::StringAttr attr); + void setOpName(::std::optional<::llvm::StringRef> attrValue); + void setOutputSlotAttr(::mlir::IntegerAttr attr); + void setOutputSlot(::std::optional attrValue); + void setTensorDebugModeAttr(::mlir::IntegerAttr attr); + void setTensorDebugMode(::std::optional attrValue); + void setDebugUrlsAttr(::mlir::ArrayAttr attr); + void setCircularBufferSizeAttr(::mlir::IntegerAttr attr); + void setCircularBufferSize(::std::optional attrValue); + void setTfdbgRunIdAttr(::mlir::StringAttr attr); + void setTfdbgRunId(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTfdbgContextIdAttr(); + ::mlir::Attribute removeOpNameAttr(); + ::mlir::Attribute removeOutputSlotAttr(); + ::mlir::Attribute removeTensorDebugModeAttr(); + ::mlir::Attribute removeDebugUrlsAttr(); + ::mlir::Attribute removeCircularBufferSizeAttr(); + ::mlir::Attribute removeTfdbgRunIdAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, /*optional*/::mlir::StringAttr tfdbg_context_id, /*optional*/::mlir::StringAttr op_name, /*optional*/::mlir::IntegerAttr output_slot, /*optional*/::mlir::IntegerAttr tensor_debug_mode, /*optional*/::mlir::ArrayAttr debug_urls, /*optional*/::mlir::IntegerAttr circular_buffer_size, /*optional*/::mlir::StringAttr tfdbg_run_id); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, /*optional*/::mlir::StringAttr tfdbg_context_id, /*optional*/::mlir::StringAttr op_name, /*optional*/::mlir::IntegerAttr output_slot, /*optional*/::mlir::IntegerAttr tensor_debug_mode, /*optional*/::mlir::ArrayAttr debug_urls, /*optional*/::mlir::IntegerAttr circular_buffer_size, /*optional*/::mlir::StringAttr tfdbg_run_id); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, /*optional*/::llvm::StringRef tfdbg_context_id, /*optional*/::llvm::StringRef op_name, /*optional*/uint64_t output_slot, /*optional*/uint64_t tensor_debug_mode, /*optional*/::mlir::ArrayAttr debug_urls, /*optional*/uint64_t circular_buffer_size = 1000, /*optional*/::llvm::StringRef tfdbg_run_id = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, /*optional*/::llvm::StringRef tfdbg_context_id, /*optional*/::llvm::StringRef op_name, /*optional*/uint64_t output_slot, /*optional*/uint64_t tensor_debug_mode, /*optional*/::mlir::ArrayAttr debug_urls, /*optional*/uint64_t circular_buffer_size = 1000, /*optional*/::llvm::StringRef tfdbg_run_id = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 8 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DebugIdentityV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DecodeAndCropJpegOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DecodeAndCropJpegOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DecodeAndCropJpegOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DecodeAndCropJpegOpGenericAdaptorBase(DecodeAndCropJpegOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getChannelsAttr(); + uint64_t getChannels(); + ::mlir::IntegerAttr getRatioAttr(); + uint64_t getRatio(); + ::mlir::BoolAttr getFancyUpscalingAttr(); + bool getFancyUpscaling(); + ::mlir::BoolAttr getTryRecoverTruncatedAttr(); + bool getTryRecoverTruncated(); + ::mlir::FloatAttr getAcceptableFractionAttr(); + ::llvm::APFloat getAcceptableFraction(); + ::mlir::StringAttr getDctMethodAttr(); + ::llvm::StringRef getDctMethod(); +}; +} // namespace detail +template +class DecodeAndCropJpegOpGenericAdaptor : public detail::DecodeAndCropJpegOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DecodeAndCropJpegOpGenericAdaptorBase; +public: + DecodeAndCropJpegOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DecodeAndCropJpegOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DecodeAndCropJpegOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DecodeAndCropJpegOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getContents() { + return (*getODSOperands(0).begin()); + } + + ValueT getCropWindow() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DecodeAndCropJpegOpAdaptor : public DecodeAndCropJpegOpGenericAdaptor<::mlir::ValueRange> { +public: + using DecodeAndCropJpegOpGenericAdaptor::DecodeAndCropJpegOpGenericAdaptor; + DecodeAndCropJpegOpAdaptor(DecodeAndCropJpegOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DecodeAndCropJpegOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DecodeAndCropJpegOpAdaptor; + template + using GenericAdaptor = DecodeAndCropJpegOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("acceptable_fraction"), ::llvm::StringRef("channels"), ::llvm::StringRef("dct_method"), ::llvm::StringRef("fancy_upscaling"), ::llvm::StringRef("ratio"), ::llvm::StringRef("try_recover_truncated")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAcceptableFractionAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAcceptableFractionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getChannelsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getChannelsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDctMethodAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDctMethodAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getFancyUpscalingAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getFancyUpscalingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getRatioAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getRatioAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getTryRecoverTruncatedAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getTryRecoverTruncatedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.DecodeAndCropJpeg"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getContents(); + ::mlir::TypedValue<::mlir::TensorType> getCropWindow(); + ::mlir::OpOperand &getContentsMutable(); + ::mlir::OpOperand &getCropWindowMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getImage(); + ::mlir::IntegerAttr getChannelsAttr(); + uint64_t getChannels(); + ::mlir::IntegerAttr getRatioAttr(); + uint64_t getRatio(); + ::mlir::BoolAttr getFancyUpscalingAttr(); + bool getFancyUpscaling(); + ::mlir::BoolAttr getTryRecoverTruncatedAttr(); + bool getTryRecoverTruncated(); + ::mlir::FloatAttr getAcceptableFractionAttr(); + ::llvm::APFloat getAcceptableFraction(); + ::mlir::StringAttr getDctMethodAttr(); + ::llvm::StringRef getDctMethod(); + void setChannelsAttr(::mlir::IntegerAttr attr); + void setChannels(::std::optional attrValue); + void setRatioAttr(::mlir::IntegerAttr attr); + void setRatio(::std::optional attrValue); + void setFancyUpscalingAttr(::mlir::BoolAttr attr); + void setFancyUpscaling(::std::optional attrValue); + void setTryRecoverTruncatedAttr(::mlir::BoolAttr attr); + void setTryRecoverTruncated(::std::optional attrValue); + void setAcceptableFractionAttr(::mlir::FloatAttr attr); + void setAcceptableFraction(::std::optional<::llvm::APFloat> attrValue); + void setDctMethodAttr(::mlir::StringAttr attr); + void setDctMethod(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeChannelsAttr(); + ::mlir::Attribute removeRatioAttr(); + ::mlir::Attribute removeFancyUpscalingAttr(); + ::mlir::Attribute removeTryRecoverTruncatedAttr(); + ::mlir::Attribute removeAcceptableFractionAttr(); + ::mlir::Attribute removeDctMethodAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type image, ::mlir::Value contents, ::mlir::Value crop_window, /*optional*/::mlir::IntegerAttr channels, /*optional*/::mlir::IntegerAttr ratio, /*optional*/::mlir::BoolAttr fancy_upscaling, /*optional*/::mlir::BoolAttr try_recover_truncated, /*optional*/::mlir::FloatAttr acceptable_fraction, /*optional*/::mlir::StringAttr dct_method); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value contents, ::mlir::Value crop_window, /*optional*/::mlir::IntegerAttr channels, /*optional*/::mlir::IntegerAttr ratio, /*optional*/::mlir::BoolAttr fancy_upscaling, /*optional*/::mlir::BoolAttr try_recover_truncated, /*optional*/::mlir::FloatAttr acceptable_fraction, /*optional*/::mlir::StringAttr dct_method); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type image, ::mlir::Value contents, ::mlir::Value crop_window, /*optional*/uint64_t channels, /*optional*/uint64_t ratio, /*optional*/bool fancy_upscaling, /*optional*/bool try_recover_truncated, /*optional*/::llvm::APFloat acceptable_fraction, /*optional*/::llvm::StringRef dct_method = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value contents, ::mlir::Value crop_window, /*optional*/uint64_t channels, /*optional*/uint64_t ratio, /*optional*/bool fancy_upscaling, /*optional*/bool try_recover_truncated, /*optional*/::llvm::APFloat acceptable_fraction, /*optional*/::llvm::StringRef dct_method = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DecodeAndCropJpegOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DecodeGifOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DecodeGifOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DecodeGifOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DecodeGifOpGenericAdaptorBase(DecodeGifOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DecodeGifOpGenericAdaptor : public detail::DecodeGifOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DecodeGifOpGenericAdaptorBase; +public: + DecodeGifOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DecodeGifOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DecodeGifOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DecodeGifOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getContents() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DecodeGifOpAdaptor : public DecodeGifOpGenericAdaptor<::mlir::ValueRange> { +public: + using DecodeGifOpGenericAdaptor::DecodeGifOpGenericAdaptor; + DecodeGifOpAdaptor(DecodeGifOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DecodeGifOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DecodeGifOpAdaptor; + template + using GenericAdaptor = DecodeGifOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.DecodeGif"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getContents(); + ::mlir::OpOperand &getContentsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getImage(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type image, ::mlir::Value contents); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value contents); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DecodeGifOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DecodeJpegOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DecodeJpegOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DecodeJpegOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DecodeJpegOpGenericAdaptorBase(DecodeJpegOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getChannelsAttr(); + uint64_t getChannels(); + ::mlir::IntegerAttr getRatioAttr(); + uint64_t getRatio(); + ::mlir::BoolAttr getFancyUpscalingAttr(); + bool getFancyUpscaling(); + ::mlir::BoolAttr getTryRecoverTruncatedAttr(); + bool getTryRecoverTruncated(); + ::mlir::FloatAttr getAcceptableFractionAttr(); + ::llvm::APFloat getAcceptableFraction(); + ::mlir::StringAttr getDctMethodAttr(); + ::llvm::StringRef getDctMethod(); +}; +} // namespace detail +template +class DecodeJpegOpGenericAdaptor : public detail::DecodeJpegOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DecodeJpegOpGenericAdaptorBase; +public: + DecodeJpegOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DecodeJpegOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DecodeJpegOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DecodeJpegOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getContents() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DecodeJpegOpAdaptor : public DecodeJpegOpGenericAdaptor<::mlir::ValueRange> { +public: + using DecodeJpegOpGenericAdaptor::DecodeJpegOpGenericAdaptor; + DecodeJpegOpAdaptor(DecodeJpegOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DecodeJpegOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DecodeJpegOpAdaptor; + template + using GenericAdaptor = DecodeJpegOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("acceptable_fraction"), ::llvm::StringRef("channels"), ::llvm::StringRef("dct_method"), ::llvm::StringRef("fancy_upscaling"), ::llvm::StringRef("ratio"), ::llvm::StringRef("try_recover_truncated")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAcceptableFractionAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAcceptableFractionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getChannelsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getChannelsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDctMethodAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDctMethodAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getFancyUpscalingAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getFancyUpscalingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getRatioAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getRatioAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getTryRecoverTruncatedAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getTryRecoverTruncatedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.DecodeJpeg"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getContents(); + ::mlir::OpOperand &getContentsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getImage(); + ::mlir::IntegerAttr getChannelsAttr(); + uint64_t getChannels(); + ::mlir::IntegerAttr getRatioAttr(); + uint64_t getRatio(); + ::mlir::BoolAttr getFancyUpscalingAttr(); + bool getFancyUpscaling(); + ::mlir::BoolAttr getTryRecoverTruncatedAttr(); + bool getTryRecoverTruncated(); + ::mlir::FloatAttr getAcceptableFractionAttr(); + ::llvm::APFloat getAcceptableFraction(); + ::mlir::StringAttr getDctMethodAttr(); + ::llvm::StringRef getDctMethod(); + void setChannelsAttr(::mlir::IntegerAttr attr); + void setChannels(::std::optional attrValue); + void setRatioAttr(::mlir::IntegerAttr attr); + void setRatio(::std::optional attrValue); + void setFancyUpscalingAttr(::mlir::BoolAttr attr); + void setFancyUpscaling(::std::optional attrValue); + void setTryRecoverTruncatedAttr(::mlir::BoolAttr attr); + void setTryRecoverTruncated(::std::optional attrValue); + void setAcceptableFractionAttr(::mlir::FloatAttr attr); + void setAcceptableFraction(::std::optional<::llvm::APFloat> attrValue); + void setDctMethodAttr(::mlir::StringAttr attr); + void setDctMethod(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeChannelsAttr(); + ::mlir::Attribute removeRatioAttr(); + ::mlir::Attribute removeFancyUpscalingAttr(); + ::mlir::Attribute removeTryRecoverTruncatedAttr(); + ::mlir::Attribute removeAcceptableFractionAttr(); + ::mlir::Attribute removeDctMethodAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type image, ::mlir::Value contents, /*optional*/::mlir::IntegerAttr channels, /*optional*/::mlir::IntegerAttr ratio, /*optional*/::mlir::BoolAttr fancy_upscaling, /*optional*/::mlir::BoolAttr try_recover_truncated, /*optional*/::mlir::FloatAttr acceptable_fraction, /*optional*/::mlir::StringAttr dct_method); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value contents, /*optional*/::mlir::IntegerAttr channels, /*optional*/::mlir::IntegerAttr ratio, /*optional*/::mlir::BoolAttr fancy_upscaling, /*optional*/::mlir::BoolAttr try_recover_truncated, /*optional*/::mlir::FloatAttr acceptable_fraction, /*optional*/::mlir::StringAttr dct_method); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type image, ::mlir::Value contents, /*optional*/uint64_t channels, /*optional*/uint64_t ratio, /*optional*/bool fancy_upscaling, /*optional*/bool try_recover_truncated, /*optional*/::llvm::APFloat acceptable_fraction, /*optional*/::llvm::StringRef dct_method = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value contents, /*optional*/uint64_t channels, /*optional*/uint64_t ratio, /*optional*/bool fancy_upscaling, /*optional*/bool try_recover_truncated, /*optional*/::llvm::APFloat acceptable_fraction, /*optional*/::llvm::StringRef dct_method = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DecodeJpegOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DecodePaddedRawOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DecodePaddedRawOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DecodePaddedRawOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DecodePaddedRawOpGenericAdaptorBase(DecodePaddedRawOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getLittleEndianAttr(); + bool getLittleEndian(); +}; +} // namespace detail +template +class DecodePaddedRawOpGenericAdaptor : public detail::DecodePaddedRawOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DecodePaddedRawOpGenericAdaptorBase; +public: + DecodePaddedRawOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DecodePaddedRawOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DecodePaddedRawOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DecodePaddedRawOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputBytes() { + return (*getODSOperands(0).begin()); + } + + ValueT getFixedLength() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DecodePaddedRawOpAdaptor : public DecodePaddedRawOpGenericAdaptor<::mlir::ValueRange> { +public: + using DecodePaddedRawOpGenericAdaptor::DecodePaddedRawOpGenericAdaptor; + DecodePaddedRawOpAdaptor(DecodePaddedRawOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DecodePaddedRawOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DecodePaddedRawOpAdaptor; + template + using GenericAdaptor = DecodePaddedRawOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("little_endian"), ::llvm::StringRef("out_type")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getLittleEndianAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getLittleEndianAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutTypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.DecodePaddedRaw"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputBytes(); + ::mlir::TypedValue<::mlir::TensorType> getFixedLength(); + ::mlir::OpOperand &getInputBytesMutable(); + ::mlir::OpOperand &getFixedLengthMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getLittleEndianAttr(); + bool getLittleEndian(); + ::mlir::Type getOutType(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setLittleEndianAttr(::mlir::BoolAttr attr); + void setLittleEndian(::std::optional attrValue); + ::mlir::Attribute removeLittleEndianAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input_bytes, ::mlir::Value fixed_length, /*optional*/::mlir::BoolAttr little_endian); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_bytes, ::mlir::Value fixed_length, /*optional*/::mlir::BoolAttr little_endian); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input_bytes, ::mlir::Value fixed_length, /*optional*/bool little_endian = true); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_bytes, ::mlir::Value fixed_length, /*optional*/bool little_endian = true); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DecodePaddedRawOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DecodePngOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DecodePngOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DecodePngOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DecodePngOpGenericAdaptorBase(DecodePngOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getChannelsAttr(); + uint64_t getChannels(); +}; +} // namespace detail +template +class DecodePngOpGenericAdaptor : public detail::DecodePngOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DecodePngOpGenericAdaptorBase; +public: + DecodePngOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DecodePngOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DecodePngOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DecodePngOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getContents() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DecodePngOpAdaptor : public DecodePngOpGenericAdaptor<::mlir::ValueRange> { +public: + using DecodePngOpGenericAdaptor::DecodePngOpGenericAdaptor; + DecodePngOpAdaptor(DecodePngOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DecodePngOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DecodePngOpAdaptor; + template + using GenericAdaptor = DecodePngOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("channels"), ::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getChannelsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getChannelsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.DecodePng"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getContents(); + ::mlir::OpOperand &getContentsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getImage(); + ::mlir::IntegerAttr getChannelsAttr(); + uint64_t getChannels(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setChannelsAttr(::mlir::IntegerAttr attr); + void setChannels(::std::optional attrValue); + ::mlir::Attribute removeChannelsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type image, ::mlir::Value contents, /*optional*/::mlir::IntegerAttr channels); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value contents, /*optional*/::mlir::IntegerAttr channels); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type image, ::mlir::Value contents, /*optional*/uint64_t channels = 0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value contents, /*optional*/uint64_t channels = 0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DecodePngOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DeleteIteratorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DeleteIteratorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DeleteIteratorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DeleteIteratorOpGenericAdaptorBase(DeleteIteratorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DeleteIteratorOpGenericAdaptor : public detail::DeleteIteratorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DeleteIteratorOpGenericAdaptorBase; +public: + DeleteIteratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DeleteIteratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DeleteIteratorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DeleteIteratorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getDeleter() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DeleteIteratorOpAdaptor : public DeleteIteratorOpGenericAdaptor<::mlir::ValueRange> { +public: + using DeleteIteratorOpGenericAdaptor::DeleteIteratorOpGenericAdaptor; + DeleteIteratorOpAdaptor(DeleteIteratorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DeleteIteratorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DeleteIteratorOpAdaptor; + template + using GenericAdaptor = DeleteIteratorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.DeleteIterator"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::TypedValue<::mlir::TensorType> getDeleter(); + ::mlir::OpOperand &getHandleMutable(); + ::mlir::OpOperand &getDeleterMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value handle, ::mlir::Value deleter); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value handle, ::mlir::Value deleter); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DeleteIteratorOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DeleteMemoryCacheOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DeleteMemoryCacheOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DeleteMemoryCacheOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DeleteMemoryCacheOpGenericAdaptorBase(DeleteMemoryCacheOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DeleteMemoryCacheOpGenericAdaptor : public detail::DeleteMemoryCacheOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DeleteMemoryCacheOpGenericAdaptorBase; +public: + DeleteMemoryCacheOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DeleteMemoryCacheOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DeleteMemoryCacheOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DeleteMemoryCacheOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getDeleter() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DeleteMemoryCacheOpAdaptor : public DeleteMemoryCacheOpGenericAdaptor<::mlir::ValueRange> { +public: + using DeleteMemoryCacheOpGenericAdaptor::DeleteMemoryCacheOpGenericAdaptor; + DeleteMemoryCacheOpAdaptor(DeleteMemoryCacheOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DeleteMemoryCacheOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DeleteMemoryCacheOpAdaptor; + template + using GenericAdaptor = DeleteMemoryCacheOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.DeleteMemoryCache"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::TypedValue<::mlir::TensorType> getDeleter(); + ::mlir::OpOperand &getHandleMutable(); + ::mlir::OpOperand &getDeleterMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value handle, ::mlir::Value deleter); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value handle, ::mlir::Value deleter); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DeleteMemoryCacheOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DeleteMultiDeviceIteratorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DeleteMultiDeviceIteratorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DeleteMultiDeviceIteratorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DeleteMultiDeviceIteratorOpGenericAdaptorBase(DeleteMultiDeviceIteratorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DeleteMultiDeviceIteratorOpGenericAdaptor : public detail::DeleteMultiDeviceIteratorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DeleteMultiDeviceIteratorOpGenericAdaptorBase; +public: + DeleteMultiDeviceIteratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DeleteMultiDeviceIteratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DeleteMultiDeviceIteratorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DeleteMultiDeviceIteratorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getMultiDeviceIterator() { + return (*getODSOperands(0).begin()); + } + + RangeT getIterators() { + return getODSOperands(1); + } + + ValueT getDeleter() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DeleteMultiDeviceIteratorOpAdaptor : public DeleteMultiDeviceIteratorOpGenericAdaptor<::mlir::ValueRange> { +public: + using DeleteMultiDeviceIteratorOpGenericAdaptor::DeleteMultiDeviceIteratorOpGenericAdaptor; + DeleteMultiDeviceIteratorOpAdaptor(DeleteMultiDeviceIteratorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DeleteMultiDeviceIteratorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DeleteMultiDeviceIteratorOpAdaptor; + template + using GenericAdaptor = DeleteMultiDeviceIteratorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("N")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.DeleteMultiDeviceIterator"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getMultiDeviceIterator(); + ::mlir::Operation::operand_range getIterators(); + ::mlir::TypedValue<::mlir::TensorType> getDeleter(); + ::mlir::OpOperand &getMultiDeviceIteratorMutable(); + ::mlir::MutableOperandRange getIteratorsMutable(); + ::mlir::OpOperand &getDeleterMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + size_t getN(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value multi_device_iterator, ::mlir::ValueRange iterators, ::mlir::Value deleter); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value multi_device_iterator, ::mlir::ValueRange iterators, ::mlir::Value deleter); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DeleteMultiDeviceIteratorOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DeleteRandomSeedGeneratorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DeleteRandomSeedGeneratorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DeleteRandomSeedGeneratorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DeleteRandomSeedGeneratorOpGenericAdaptorBase(DeleteRandomSeedGeneratorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DeleteRandomSeedGeneratorOpGenericAdaptor : public detail::DeleteRandomSeedGeneratorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DeleteRandomSeedGeneratorOpGenericAdaptorBase; +public: + DeleteRandomSeedGeneratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DeleteRandomSeedGeneratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DeleteRandomSeedGeneratorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DeleteRandomSeedGeneratorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getDeleter() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DeleteRandomSeedGeneratorOpAdaptor : public DeleteRandomSeedGeneratorOpGenericAdaptor<::mlir::ValueRange> { +public: + using DeleteRandomSeedGeneratorOpGenericAdaptor::DeleteRandomSeedGeneratorOpGenericAdaptor; + DeleteRandomSeedGeneratorOpAdaptor(DeleteRandomSeedGeneratorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DeleteRandomSeedGeneratorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DeleteRandomSeedGeneratorOpAdaptor; + template + using GenericAdaptor = DeleteRandomSeedGeneratorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.DeleteRandomSeedGenerator"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::TypedValue<::mlir::TensorType> getDeleter(); + ::mlir::OpOperand &getHandleMutable(); + ::mlir::OpOperand &getDeleterMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value handle, ::mlir::Value deleter); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value handle, ::mlir::Value deleter); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DeleteRandomSeedGeneratorOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DeleteSeedGeneratorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DeleteSeedGeneratorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DeleteSeedGeneratorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DeleteSeedGeneratorOpGenericAdaptorBase(DeleteSeedGeneratorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DeleteSeedGeneratorOpGenericAdaptor : public detail::DeleteSeedGeneratorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DeleteSeedGeneratorOpGenericAdaptorBase; +public: + DeleteSeedGeneratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DeleteSeedGeneratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DeleteSeedGeneratorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DeleteSeedGeneratorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getDeleter() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DeleteSeedGeneratorOpAdaptor : public DeleteSeedGeneratorOpGenericAdaptor<::mlir::ValueRange> { +public: + using DeleteSeedGeneratorOpGenericAdaptor::DeleteSeedGeneratorOpGenericAdaptor; + DeleteSeedGeneratorOpAdaptor(DeleteSeedGeneratorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DeleteSeedGeneratorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DeleteSeedGeneratorOpAdaptor; + template + using GenericAdaptor = DeleteSeedGeneratorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.DeleteSeedGenerator"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::TypedValue<::mlir::TensorType> getDeleter(); + ::mlir::OpOperand &getHandleMutable(); + ::mlir::OpOperand &getDeleterMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value handle, ::mlir::Value deleter); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value handle, ::mlir::Value deleter); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DeleteSeedGeneratorOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DepthToSpaceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DepthToSpaceOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DepthToSpaceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DepthToSpaceOpGenericAdaptorBase(DepthToSpaceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getBlockSizeAttr(); + uint64_t getBlockSize(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); +}; +} // namespace detail +template +class DepthToSpaceOpGenericAdaptor : public detail::DepthToSpaceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DepthToSpaceOpGenericAdaptorBase; +public: + DepthToSpaceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DepthToSpaceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DepthToSpaceOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DepthToSpaceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DepthToSpaceOpAdaptor : public DepthToSpaceOpGenericAdaptor<::mlir::ValueRange> { +public: + using DepthToSpaceOpGenericAdaptor::DepthToSpaceOpGenericAdaptor; + DepthToSpaceOpAdaptor(DepthToSpaceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DepthToSpaceOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DepthToSpaceOpAdaptor; + template + using GenericAdaptor = DepthToSpaceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("block_size"), ::llvm::StringRef("data_format")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getBlockSizeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getBlockSizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.DepthToSpace"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getBlockSizeAttr(); + uint64_t getBlockSize(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setBlockSizeAttr(::mlir::IntegerAttr attr); + void setBlockSize(uint64_t attrValue); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeDataFormatAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::IntegerAttr block_size, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::IntegerAttr block_size, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, uint64_t block_size, /*optional*/::llvm::StringRef data_format = "NHWC"); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, uint64_t block_size, /*optional*/::llvm::StringRef data_format = "NHWC"); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DepthToSpaceOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DepthwiseConv2dNativeBackpropFilterOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DepthwiseConv2dNativeBackpropFilterOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DepthwiseConv2dNativeBackpropFilterOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DepthwiseConv2dNativeBackpropFilterOpGenericAdaptorBase(DepthwiseConv2dNativeBackpropFilterOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getExplicitPaddingsAttr(); + ::mlir::ArrayAttr getExplicitPaddings(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::ArrayAttr getDilationsAttr(); + ::mlir::ArrayAttr getDilations(); +}; +} // namespace detail +template +class DepthwiseConv2dNativeBackpropFilterOpGenericAdaptor : public detail::DepthwiseConv2dNativeBackpropFilterOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DepthwiseConv2dNativeBackpropFilterOpGenericAdaptorBase; +public: + DepthwiseConv2dNativeBackpropFilterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DepthwiseConv2dNativeBackpropFilterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DepthwiseConv2dNativeBackpropFilterOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DepthwiseConv2dNativeBackpropFilterOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getFilterSizes() { + return (*getODSOperands(1).begin()); + } + + ValueT getOutBackprop() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DepthwiseConv2dNativeBackpropFilterOpAdaptor : public DepthwiseConv2dNativeBackpropFilterOpGenericAdaptor<::mlir::ValueRange> { +public: + using DepthwiseConv2dNativeBackpropFilterOpGenericAdaptor::DepthwiseConv2dNativeBackpropFilterOpGenericAdaptor; + DepthwiseConv2dNativeBackpropFilterOpAdaptor(DepthwiseConv2dNativeBackpropFilterOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DepthwiseConv2dNativeBackpropFilterOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DepthwiseConv2dNativeBackpropFilterOpAdaptor; + template + using GenericAdaptor = DepthwiseConv2dNativeBackpropFilterOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("data_format"), ::llvm::StringRef("dilations"), ::llvm::StringRef("explicit_paddings"), ::llvm::StringRef("padding"), ::llvm::StringRef("strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getExplicitPaddingsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getExplicitPaddingsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.DepthwiseConv2dNativeBackpropFilter"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getFilterSizes(); + ::mlir::TypedValue<::mlir::TensorType> getOutBackprop(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getFilterSizesMutable(); + ::mlir::OpOperand &getOutBackpropMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getExplicitPaddingsAttr(); + ::mlir::ArrayAttr getExplicitPaddings(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::ArrayAttr getDilationsAttr(); + ::mlir::ArrayAttr getDilations(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setStridesAttr(::mlir::ArrayAttr attr); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + void setExplicitPaddingsAttr(::mlir::ArrayAttr attr); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + void setDilationsAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeExplicitPaddingsAttr(); + ::mlir::Attribute removeDataFormatAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value filter_sizes, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter_sizes, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value filter_sizes, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::llvm::StringRef data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter_sizes, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::llvm::StringRef data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DepthwiseConv2dNativeBackpropFilterOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DepthwiseConv2dNativeBackpropInputOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DepthwiseConv2dNativeBackpropInputOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DepthwiseConv2dNativeBackpropInputOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DepthwiseConv2dNativeBackpropInputOpGenericAdaptorBase(DepthwiseConv2dNativeBackpropInputOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getExplicitPaddingsAttr(); + ::mlir::ArrayAttr getExplicitPaddings(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::ArrayAttr getDilationsAttr(); + ::mlir::ArrayAttr getDilations(); +}; +} // namespace detail +template +class DepthwiseConv2dNativeBackpropInputOpGenericAdaptor : public detail::DepthwiseConv2dNativeBackpropInputOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DepthwiseConv2dNativeBackpropInputOpGenericAdaptorBase; +public: + DepthwiseConv2dNativeBackpropInputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DepthwiseConv2dNativeBackpropInputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DepthwiseConv2dNativeBackpropInputOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DepthwiseConv2dNativeBackpropInputOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputSizes() { + return (*getODSOperands(0).begin()); + } + + ValueT getFilter() { + return (*getODSOperands(1).begin()); + } + + ValueT getOutBackprop() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DepthwiseConv2dNativeBackpropInputOpAdaptor : public DepthwiseConv2dNativeBackpropInputOpGenericAdaptor<::mlir::ValueRange> { +public: + using DepthwiseConv2dNativeBackpropInputOpGenericAdaptor::DepthwiseConv2dNativeBackpropInputOpGenericAdaptor; + DepthwiseConv2dNativeBackpropInputOpAdaptor(DepthwiseConv2dNativeBackpropInputOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DepthwiseConv2dNativeBackpropInputOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DepthwiseConv2dNativeBackpropInputOpAdaptor; + template + using GenericAdaptor = DepthwiseConv2dNativeBackpropInputOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("data_format"), ::llvm::StringRef("dilations"), ::llvm::StringRef("explicit_paddings"), ::llvm::StringRef("padding"), ::llvm::StringRef("strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getExplicitPaddingsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getExplicitPaddingsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.DepthwiseConv2dNativeBackpropInput"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputSizes(); + ::mlir::TypedValue<::mlir::TensorType> getFilter(); + ::mlir::TypedValue<::mlir::TensorType> getOutBackprop(); + ::mlir::OpOperand &getInputSizesMutable(); + ::mlir::OpOperand &getFilterMutable(); + ::mlir::OpOperand &getOutBackpropMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getExplicitPaddingsAttr(); + ::mlir::ArrayAttr getExplicitPaddings(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::ArrayAttr getDilationsAttr(); + ::mlir::ArrayAttr getDilations(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setStridesAttr(::mlir::ArrayAttr attr); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + void setExplicitPaddingsAttr(::mlir::ArrayAttr attr); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + void setDilationsAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeExplicitPaddingsAttr(); + ::mlir::Attribute removeDataFormatAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input_sizes, ::mlir::Value filter, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_sizes, ::mlir::Value filter, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input_sizes, ::mlir::Value filter, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::llvm::StringRef data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_sizes, ::mlir::Value filter, ::mlir::Value out_backprop, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::llvm::StringRef data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DepthwiseConv2dNativeBackpropInputOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DepthwiseConv2dNativeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DepthwiseConv2dNativeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DepthwiseConv2dNativeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DepthwiseConv2dNativeOpGenericAdaptorBase(DepthwiseConv2dNativeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getExplicitPaddingsAttr(); + ::mlir::ArrayAttr getExplicitPaddings(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::ArrayAttr getDilationsAttr(); + ::mlir::ArrayAttr getDilations(); +}; +} // namespace detail +template +class DepthwiseConv2dNativeOpGenericAdaptor : public detail::DepthwiseConv2dNativeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DepthwiseConv2dNativeOpGenericAdaptorBase; +public: + DepthwiseConv2dNativeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DepthwiseConv2dNativeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DepthwiseConv2dNativeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DepthwiseConv2dNativeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getFilter() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DepthwiseConv2dNativeOpAdaptor : public DepthwiseConv2dNativeOpGenericAdaptor<::mlir::ValueRange> { +public: + using DepthwiseConv2dNativeOpGenericAdaptor::DepthwiseConv2dNativeOpGenericAdaptor; + DepthwiseConv2dNativeOpAdaptor(DepthwiseConv2dNativeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DepthwiseConv2dNativeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DepthwiseConv2dNativeOpAdaptor; + template + using GenericAdaptor = DepthwiseConv2dNativeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("data_format"), ::llvm::StringRef("dilations"), ::llvm::StringRef("explicit_paddings"), ::llvm::StringRef("padding"), ::llvm::StringRef("strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getExplicitPaddingsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getExplicitPaddingsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.DepthwiseConv2dNative"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getFilter(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getFilterMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getExplicitPaddingsAttr(); + ::mlir::ArrayAttr getExplicitPaddings(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::ArrayAttr getDilationsAttr(); + ::mlir::ArrayAttr getDilations(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setStridesAttr(::mlir::ArrayAttr attr); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + void setExplicitPaddingsAttr(::mlir::ArrayAttr attr); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + void setDilationsAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeExplicitPaddingsAttr(); + ::mlir::Attribute removeDataFormatAttr(); + ::mlir::Attribute removeDilationsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value filter, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value filter, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::llvm::StringRef data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::llvm::StringRef data_format, /*optional*/::mlir::ArrayAttr dilations); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DepthwiseConv2dNativeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DequantizeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DequantizeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DequantizeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DequantizeOpGenericAdaptorBase(DequantizeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getModeAttr(); + ::llvm::StringRef getMode(); + ::mlir::BoolAttr getNarrowRangeAttr(); + bool getNarrowRange(); + ::mlir::IntegerAttr getAxisAttr(); + uint64_t getAxis(); +}; +} // namespace detail +template +class DequantizeOpGenericAdaptor : public detail::DequantizeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DequantizeOpGenericAdaptorBase; +public: + DequantizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DequantizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DequantizeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DequantizeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getMinRange() { + return (*getODSOperands(1).begin()); + } + + ValueT getMaxRange() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DequantizeOpAdaptor : public DequantizeOpGenericAdaptor<::mlir::ValueRange> { +public: + using DequantizeOpGenericAdaptor::DequantizeOpGenericAdaptor; + DequantizeOpAdaptor(DequantizeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DequantizeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DequantizeOpAdaptor; + template + using GenericAdaptor = DequantizeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("axis"), ::llvm::StringRef("dtype"), ::llvm::StringRef("mode"), ::llvm::StringRef("narrow_range")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAxisAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAxisAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getModeAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getModeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getNarrowRangeAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getNarrowRangeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Dequantize"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getMinRange(); + ::mlir::TypedValue<::mlir::TensorType> getMaxRange(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getMinRangeMutable(); + ::mlir::OpOperand &getMaxRangeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::StringAttr getModeAttr(); + ::llvm::StringRef getMode(); + ::mlir::BoolAttr getNarrowRangeAttr(); + bool getNarrowRange(); + ::mlir::IntegerAttr getAxisAttr(); + uint64_t getAxis(); + ::mlir::Type getT(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setModeAttr(::mlir::StringAttr attr); + void setMode(::std::optional<::llvm::StringRef> attrValue); + void setNarrowRangeAttr(::mlir::BoolAttr attr); + void setNarrowRange(::std::optional attrValue); + void setAxisAttr(::mlir::IntegerAttr attr); + void setAxis(::std::optional attrValue); + ::mlir::Attribute removeModeAttr(); + ::mlir::Attribute removeNarrowRangeAttr(); + ::mlir::Attribute removeAxisAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value min_range, ::mlir::Value max_range, /*optional*/::mlir::StringAttr mode, /*optional*/::mlir::BoolAttr narrow_range, /*optional*/::mlir::IntegerAttr axis); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value min_range, ::mlir::Value max_range, /*optional*/::mlir::StringAttr mode, /*optional*/::mlir::BoolAttr narrow_range, /*optional*/::mlir::IntegerAttr axis); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value min_range, ::mlir::Value max_range, /*optional*/::llvm::StringRef mode = "MIN_COMBINED", /*optional*/bool narrow_range = false, /*optional*/uint64_t axis = -1); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value min_range, ::mlir::Value max_range, /*optional*/::llvm::StringRef mode = "MIN_COMBINED", /*optional*/bool narrow_range = false, /*optional*/uint64_t axis = -1); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DequantizeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DeserializeIteratorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DeserializeIteratorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DeserializeIteratorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DeserializeIteratorOpGenericAdaptorBase(DeserializeIteratorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DeserializeIteratorOpGenericAdaptor : public detail::DeserializeIteratorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DeserializeIteratorOpGenericAdaptorBase; +public: + DeserializeIteratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DeserializeIteratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DeserializeIteratorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DeserializeIteratorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getResourceHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getSerialized() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DeserializeIteratorOpAdaptor : public DeserializeIteratorOpGenericAdaptor<::mlir::ValueRange> { +public: + using DeserializeIteratorOpGenericAdaptor::DeserializeIteratorOpGenericAdaptor; + DeserializeIteratorOpAdaptor(DeserializeIteratorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DeserializeIteratorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DeserializeIteratorOpAdaptor; + template + using GenericAdaptor = DeserializeIteratorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.DeserializeIterator"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResourceHandle(); + ::mlir::TypedValue<::mlir::TensorType> getSerialized(); + ::mlir::OpOperand &getResourceHandleMutable(); + ::mlir::OpOperand &getSerializedMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value resource_handle, ::mlir::Value serialized); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value resource_handle, ::mlir::Value serialized); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DeserializeIteratorOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DeserializeSparseOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DeserializeSparseOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DeserializeSparseOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DeserializeSparseOpGenericAdaptorBase(DeserializeSparseOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DeserializeSparseOpGenericAdaptor : public detail::DeserializeSparseOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DeserializeSparseOpGenericAdaptorBase; +public: + DeserializeSparseOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DeserializeSparseOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DeserializeSparseOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DeserializeSparseOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSerializedSparse() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DeserializeSparseOpAdaptor : public DeserializeSparseOpGenericAdaptor<::mlir::ValueRange> { +public: + using DeserializeSparseOpGenericAdaptor::DeserializeSparseOpGenericAdaptor; + DeserializeSparseOpAdaptor(DeserializeSparseOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DeserializeSparseOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DeserializeSparseOpAdaptor; + template + using GenericAdaptor = DeserializeSparseOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tserialized"), ::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTserializedAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTserializedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.DeserializeSparse"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSerializedSparse(); + ::mlir::OpOperand &getSerializedSparseMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSparseIndices(); + ::mlir::TypedValue<::mlir::TensorType> getSparseValues(); + ::mlir::TypedValue<::mlir::TensorType> getSparseShape(); + ::mlir::Type getTserialized(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type sparse_indices, ::mlir::Type sparse_values, ::mlir::Type sparse_shape, ::mlir::Value serialized_sparse); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value serialized_sparse); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DeserializeSparseOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DestroyResourceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DestroyResourceOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DestroyResourceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DestroyResourceOpGenericAdaptorBase(DestroyResourceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getIgnoreLookupErrorAttr(); + bool getIgnoreLookupError(); +}; +} // namespace detail +template +class DestroyResourceOpGenericAdaptor : public detail::DestroyResourceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DestroyResourceOpGenericAdaptorBase; +public: + DestroyResourceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DestroyResourceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DestroyResourceOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DestroyResourceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getResource() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DestroyResourceOpAdaptor : public DestroyResourceOpGenericAdaptor<::mlir::ValueRange> { +public: + using DestroyResourceOpGenericAdaptor::DestroyResourceOpGenericAdaptor; + DestroyResourceOpAdaptor(DestroyResourceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DestroyResourceOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = DestroyResourceOpAdaptor; + template + using GenericAdaptor = DestroyResourceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("ignore_lookup_error")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getIgnoreLookupErrorAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getIgnoreLookupErrorAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.DestroyResourceOp"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResource(); + ::mlir::OpOperand &getResourceMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::BoolAttr getIgnoreLookupErrorAttr(); + bool getIgnoreLookupError(); + void setIgnoreLookupErrorAttr(::mlir::BoolAttr attr); + void setIgnoreLookupError(::std::optional attrValue); + ::mlir::Attribute removeIgnoreLookupErrorAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value resource, /*optional*/::mlir::BoolAttr ignore_lookup_error); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value resource, /*optional*/::mlir::BoolAttr ignore_lookup_error); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value resource, /*optional*/bool ignore_lookup_error = true); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value resource, /*optional*/bool ignore_lookup_error = true); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DestroyResourceOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DeviceIndexOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DeviceIndexOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DeviceIndexOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DeviceIndexOpGenericAdaptorBase(DeviceIndexOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getDeviceNamesAttr(); + ::mlir::ArrayAttr getDeviceNames(); +}; +} // namespace detail +template +class DeviceIndexOpGenericAdaptor : public detail::DeviceIndexOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DeviceIndexOpGenericAdaptorBase; +public: + DeviceIndexOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DeviceIndexOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DeviceIndexOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DeviceIndexOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DeviceIndexOpAdaptor : public DeviceIndexOpGenericAdaptor<::mlir::ValueRange> { +public: + using DeviceIndexOpGenericAdaptor::DeviceIndexOpGenericAdaptor; + DeviceIndexOpAdaptor(DeviceIndexOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DeviceIndexOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold> { +public: + using Op::Op; + using Op::print; + using Adaptor = DeviceIndexOpAdaptor; + template + using GenericAdaptor = DeviceIndexOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("device_names")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDeviceNamesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDeviceNamesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.DeviceIndex"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getIndex(); + ::mlir::ArrayAttr getDeviceNamesAttr(); + ::mlir::ArrayAttr getDeviceNames(); + void setDeviceNamesAttr(::mlir::ArrayAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type index, ::mlir::ArrayAttr device_names); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ArrayAttr device_names); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DeviceIndexOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DiagOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DiagOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DiagOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DiagOpGenericAdaptorBase(DiagOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DiagOpGenericAdaptor : public detail::DiagOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DiagOpGenericAdaptorBase; +public: + DiagOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DiagOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DiagOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DiagOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getDiagonal() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DiagOpAdaptor : public DiagOpGenericAdaptor<::mlir::ValueRange> { +public: + using DiagOpGenericAdaptor::DiagOpGenericAdaptor; + DiagOpAdaptor(DiagOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DiagOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::SameOperandsAndResultElementTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DiagOpAdaptor; + template + using GenericAdaptor = DiagOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Diag"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getDiagonal(); + ::mlir::OpOperand &getDiagonalMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value diagonal); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value diagonal); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DiagOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DiagPartOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DiagPartOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DiagPartOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DiagPartOpGenericAdaptorBase(DiagPartOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DiagPartOpGenericAdaptor : public detail::DiagPartOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DiagPartOpGenericAdaptorBase; +public: + DiagPartOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DiagPartOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DiagPartOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DiagPartOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DiagPartOpAdaptor : public DiagPartOpGenericAdaptor<::mlir::ValueRange> { +public: + using DiagPartOpGenericAdaptor::DiagPartOpGenericAdaptor; + DiagPartOpAdaptor(DiagPartOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DiagPartOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DiagPartOpAdaptor; + template + using GenericAdaptor = DiagPartOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.DiagPart"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getDiagonal(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type diagonal, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DiagPartOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DigammaOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DigammaOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DigammaOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DigammaOpGenericAdaptorBase(DigammaOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DigammaOpGenericAdaptor : public detail::DigammaOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DigammaOpGenericAdaptorBase; +public: + DigammaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DigammaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DigammaOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DigammaOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DigammaOpAdaptor : public DigammaOpGenericAdaptor<::mlir::ValueRange> { +public: + using DigammaOpGenericAdaptor::DigammaOpGenericAdaptor; + DigammaOpAdaptor(DigammaOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DigammaOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DigammaOpAdaptor; + template + using GenericAdaptor = DigammaOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Digamma"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DigammaOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DisableCopyOnReadOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DisableCopyOnReadOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DisableCopyOnReadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DisableCopyOnReadOpGenericAdaptorBase(DisableCopyOnReadOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DisableCopyOnReadOpGenericAdaptor : public detail::DisableCopyOnReadOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DisableCopyOnReadOpGenericAdaptorBase; +public: + DisableCopyOnReadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DisableCopyOnReadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DisableCopyOnReadOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DisableCopyOnReadOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getResource() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DisableCopyOnReadOpAdaptor : public DisableCopyOnReadOpGenericAdaptor<::mlir::ValueRange> { +public: + using DisableCopyOnReadOpGenericAdaptor::DisableCopyOnReadOpGenericAdaptor; + DisableCopyOnReadOpAdaptor(DisableCopyOnReadOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DisableCopyOnReadOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = DisableCopyOnReadOpAdaptor; + template + using GenericAdaptor = DisableCopyOnReadOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.DisableCopyOnRead"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResource(); + ::mlir::OpOperand &getResourceMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value resource); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value resource); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DisableCopyOnReadOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DivNoNanOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DivNoNanOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DivNoNanOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DivNoNanOpGenericAdaptorBase(DivNoNanOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DivNoNanOpGenericAdaptor : public detail::DivNoNanOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DivNoNanOpGenericAdaptorBase; +public: + DivNoNanOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DivNoNanOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DivNoNanOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DivNoNanOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DivNoNanOpAdaptor : public DivNoNanOpGenericAdaptor<::mlir::ValueRange> { +public: + using DivNoNanOpGenericAdaptor::DivNoNanOpGenericAdaptor; + DivNoNanOpAdaptor(DivNoNanOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DivNoNanOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::OpTrait::TF::SameOperandsAndResultElementTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DivNoNanOpAdaptor; + template + using GenericAdaptor = DivNoNanOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.DivNoNan"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DivNoNanOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DivOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DivOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DivOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DivOpGenericAdaptorBase(DivOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DivOpGenericAdaptor : public detail::DivOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DivOpGenericAdaptorBase; +public: + DivOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DivOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DivOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DivOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DivOpAdaptor : public DivOpGenericAdaptor<::mlir::ValueRange> { +public: + using DivOpGenericAdaptor::DivOpGenericAdaptor; + DivOpAdaptor(DivOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DivOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::OpTrait::TF::SameOperandsAndResultElementTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DivOpAdaptor; + template + using GenericAdaptor = DivOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Div"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DivOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DummyMemoryCacheOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DummyMemoryCacheOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DummyMemoryCacheOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DummyMemoryCacheOpGenericAdaptorBase(DummyMemoryCacheOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DummyMemoryCacheOpGenericAdaptor : public detail::DummyMemoryCacheOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DummyMemoryCacheOpGenericAdaptorBase; +public: + DummyMemoryCacheOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DummyMemoryCacheOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DummyMemoryCacheOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DummyMemoryCacheOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DummyMemoryCacheOpAdaptor : public DummyMemoryCacheOpGenericAdaptor<::mlir::ValueRange> { +public: + using DummyMemoryCacheOpGenericAdaptor::DummyMemoryCacheOpGenericAdaptor; + DummyMemoryCacheOpAdaptor(DummyMemoryCacheOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DummyMemoryCacheOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DummyMemoryCacheOpAdaptor; + template + using GenericAdaptor = DummyMemoryCacheOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.DummyMemoryCache"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DummyMemoryCacheOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DummySeedGeneratorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DummySeedGeneratorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DummySeedGeneratorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DummySeedGeneratorOpGenericAdaptorBase(DummySeedGeneratorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DummySeedGeneratorOpGenericAdaptor : public detail::DummySeedGeneratorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DummySeedGeneratorOpGenericAdaptorBase; +public: + DummySeedGeneratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DummySeedGeneratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DummySeedGeneratorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DummySeedGeneratorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DummySeedGeneratorOpAdaptor : public DummySeedGeneratorOpGenericAdaptor<::mlir::ValueRange> { +public: + using DummySeedGeneratorOpGenericAdaptor::DummySeedGeneratorOpGenericAdaptor; + DummySeedGeneratorOpAdaptor(DummySeedGeneratorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DummySeedGeneratorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DummySeedGeneratorOpAdaptor; + template + using GenericAdaptor = DummySeedGeneratorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.DummySeedGenerator"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DummySeedGeneratorOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DynamicEnqueueTPUEmbeddingArbitraryTensorBatchOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DynamicEnqueueTPUEmbeddingArbitraryTensorBatchOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DynamicEnqueueTPUEmbeddingArbitraryTensorBatchOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DynamicEnqueueTPUEmbeddingArbitraryTensorBatchOpGenericAdaptorBase(DynamicEnqueueTPUEmbeddingArbitraryTensorBatchOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getCombinersAttr(); + ::mlir::ArrayAttr getCombiners(); +}; +} // namespace detail +template +class DynamicEnqueueTPUEmbeddingArbitraryTensorBatchOpGenericAdaptor : public detail::DynamicEnqueueTPUEmbeddingArbitraryTensorBatchOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DynamicEnqueueTPUEmbeddingArbitraryTensorBatchOpGenericAdaptorBase; +public: + DynamicEnqueueTPUEmbeddingArbitraryTensorBatchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DynamicEnqueueTPUEmbeddingArbitraryTensorBatchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DynamicEnqueueTPUEmbeddingArbitraryTensorBatchOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DynamicEnqueueTPUEmbeddingArbitraryTensorBatchOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getSampleIndicesOrRowSplits() { + return getODSOperands(0); + } + + RangeT getEmbeddingIndices() { + return getODSOperands(1); + } + + RangeT getAggregationWeights() { + return getODSOperands(2); + } + + ValueT getModeOverride() { + return (*getODSOperands(3).begin()); + } + + ValueT getDeviceOrdinal() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DynamicEnqueueTPUEmbeddingArbitraryTensorBatchOpAdaptor : public DynamicEnqueueTPUEmbeddingArbitraryTensorBatchOpGenericAdaptor<::mlir::ValueRange> { +public: + using DynamicEnqueueTPUEmbeddingArbitraryTensorBatchOpGenericAdaptor::DynamicEnqueueTPUEmbeddingArbitraryTensorBatchOpGenericAdaptor; + DynamicEnqueueTPUEmbeddingArbitraryTensorBatchOpAdaptor(DynamicEnqueueTPUEmbeddingArbitraryTensorBatchOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DynamicEnqueueTPUEmbeddingArbitraryTensorBatchOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DynamicEnqueueTPUEmbeddingArbitraryTensorBatchOpAdaptor; + template + using GenericAdaptor = DynamicEnqueueTPUEmbeddingArbitraryTensorBatchOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("N"), ::llvm::StringRef("T1"), ::llvm::StringRef("T2"), ::llvm::StringRef("T3"), ::llvm::StringRef("combiners")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getT1AttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getT1AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getT2AttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getT2AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getT3AttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getT3AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getCombinersAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getCombinersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.DynamicEnqueueTPUEmbeddingArbitraryTensorBatch"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getSampleIndicesOrRowSplits(); + ::mlir::Operation::operand_range getEmbeddingIndices(); + ::mlir::Operation::operand_range getAggregationWeights(); + ::mlir::TypedValue<::mlir::TensorType> getModeOverride(); + ::mlir::TypedValue<::mlir::TensorType> getDeviceOrdinal(); + ::mlir::MutableOperandRange getSampleIndicesOrRowSplitsMutable(); + ::mlir::MutableOperandRange getEmbeddingIndicesMutable(); + ::mlir::MutableOperandRange getAggregationWeightsMutable(); + ::mlir::OpOperand &getModeOverrideMutable(); + ::mlir::OpOperand &getDeviceOrdinalMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::ArrayAttr getCombinersAttr(); + ::mlir::ArrayAttr getCombiners(); + size_t getN(); + ::mlir::Type getT1(); + ::mlir::Type getT2(); + ::mlir::Type getT3(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setCombinersAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeCombinersAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange sample_indices_or_row_splits, ::mlir::ValueRange embedding_indices, ::mlir::ValueRange aggregation_weights, ::mlir::Value mode_override, ::mlir::Value device_ordinal, /*optional*/::mlir::ArrayAttr combiners); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange sample_indices_or_row_splits, ::mlir::ValueRange embedding_indices, ::mlir::ValueRange aggregation_weights, ::mlir::Value mode_override, ::mlir::Value device_ordinal, /*optional*/::mlir::ArrayAttr combiners); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DynamicEnqueueTPUEmbeddingArbitraryTensorBatchOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DynamicPartitionOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DynamicPartitionOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DynamicPartitionOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DynamicPartitionOpGenericAdaptorBase(DynamicPartitionOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DynamicPartitionOpGenericAdaptor : public detail::DynamicPartitionOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DynamicPartitionOpGenericAdaptorBase; +public: + DynamicPartitionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DynamicPartitionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DynamicPartitionOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DynamicPartitionOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getData() { + return (*getODSOperands(0).begin()); + } + + ValueT getPartitions() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DynamicPartitionOpAdaptor : public DynamicPartitionOpGenericAdaptor<::mlir::ValueRange> { +public: + using DynamicPartitionOpGenericAdaptor::DynamicPartitionOpGenericAdaptor; + DynamicPartitionOpAdaptor(DynamicPartitionOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DynamicPartitionOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DynamicPartitionOpAdaptor; + template + using GenericAdaptor = DynamicPartitionOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("num_partitions")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumPartitionsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumPartitionsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.DynamicPartition"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getData(); + ::mlir::TypedValue<::mlir::TensorType> getPartitions(); + ::mlir::OpOperand &getDataMutable(); + ::mlir::OpOperand &getPartitionsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutputs(); + ::mlir::Type getT(); + size_t getNumPartitions(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outputs, ::mlir::Value data, ::mlir::Value partitions); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DynamicPartitionOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::DynamicStitchOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DynamicStitchOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DynamicStitchOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DynamicStitchOpGenericAdaptorBase(DynamicStitchOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DynamicStitchOpGenericAdaptor : public detail::DynamicStitchOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DynamicStitchOpGenericAdaptorBase; +public: + DynamicStitchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DynamicStitchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DynamicStitchOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DynamicStitchOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getIndices() { + return getODSOperands(0); + } + + RangeT getData() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DynamicStitchOpAdaptor : public DynamicStitchOpGenericAdaptor<::mlir::ValueRange> { +public: + using DynamicStitchOpGenericAdaptor::DynamicStitchOpGenericAdaptor; + DynamicStitchOpAdaptor(DynamicStitchOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DynamicStitchOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DynamicStitchOpAdaptor; + template + using GenericAdaptor = DynamicStitchOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("N"), ::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.DynamicStitch"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getIndices(); + ::mlir::Operation::operand_range getData(); + ::mlir::MutableOperandRange getIndicesMutable(); + ::mlir::MutableOperandRange getDataMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getMerged(); + size_t getN(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type merged, ::mlir::ValueRange indices, ::mlir::ValueRange data); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange indices, ::mlir::ValueRange data); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::DynamicStitchOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::EinsumOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class EinsumOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + EinsumOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + EinsumOpGenericAdaptorBase(EinsumOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getEquationAttr(); + ::llvm::StringRef getEquation(); +}; +} // namespace detail +template +class EinsumOpGenericAdaptor : public detail::EinsumOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::EinsumOpGenericAdaptorBase; +public: + EinsumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + EinsumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : EinsumOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + EinsumOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class EinsumOpAdaptor : public EinsumOpGenericAdaptor<::mlir::ValueRange> { +public: + using EinsumOpGenericAdaptor::EinsumOpGenericAdaptor; + EinsumOpAdaptor(EinsumOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class EinsumOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = EinsumOpAdaptor; + template + using GenericAdaptor = EinsumOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("N"), ::llvm::StringRef("T"), ::llvm::StringRef("equation")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getEquationAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getEquationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Einsum"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::MutableOperandRange getInputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::StringAttr getEquationAttr(); + ::llvm::StringRef getEquation(); + size_t getN(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setEquationAttr(::mlir::StringAttr attr); + void setEquation(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::ValueRange inputs, ::mlir::StringAttr equation); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::mlir::StringAttr equation); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::ValueRange inputs, ::llvm::StringRef equation); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::llvm::StringRef equation); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::EinsumOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::EluGradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class EluGradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + EluGradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + EluGradOpGenericAdaptorBase(EluGradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class EluGradOpGenericAdaptor : public detail::EluGradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::EluGradOpGenericAdaptorBase; +public: + EluGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + EluGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : EluGradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + EluGradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getGradients() { + return (*getODSOperands(0).begin()); + } + + ValueT getOutputs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class EluGradOpAdaptor : public EluGradOpGenericAdaptor<::mlir::ValueRange> { +public: + using EluGradOpGenericAdaptor::EluGradOpGenericAdaptor; + EluGradOpAdaptor(EluGradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class EluGradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = EluGradOpAdaptor; + template + using GenericAdaptor = EluGradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.EluGrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getGradients(); + ::mlir::TypedValue<::mlir::TensorType> getOutputs(); + ::mlir::OpOperand &getGradientsMutable(); + ::mlir::OpOperand &getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getBackprops(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type backprops, ::mlir::Value gradients, ::mlir::Value outputs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value gradients, ::mlir::Value outputs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value gradients, ::mlir::Value outputs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::EluGradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::EluOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class EluOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + EluOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + EluOpGenericAdaptorBase(EluOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class EluOpGenericAdaptor : public detail::EluOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::EluOpGenericAdaptorBase; +public: + EluOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + EluOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : EluOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + EluOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getFeatures() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class EluOpAdaptor : public EluOpGenericAdaptor<::mlir::ValueRange> { +public: + using EluOpGenericAdaptor::EluOpGenericAdaptor; + EluOpAdaptor(EluOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class EluOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = EluOpAdaptor; + template + using GenericAdaptor = EluOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Elu"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getFeatures(); + ::mlir::OpOperand &getFeaturesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getActivations(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type activations, ::mlir::Value features); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value features); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value features); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::EluOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::EmptyOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class EmptyOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + EmptyOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + EmptyOpGenericAdaptorBase(EmptyOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getInitAttr(); + bool getInit(); +}; +} // namespace detail +template +class EmptyOpGenericAdaptor : public detail::EmptyOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::EmptyOpGenericAdaptorBase; +public: + EmptyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + EmptyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : EmptyOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + EmptyOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getShape() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class EmptyOpAdaptor : public EmptyOpGenericAdaptor<::mlir::ValueRange> { +public: + using EmptyOpGenericAdaptor::EmptyOpGenericAdaptor; + EmptyOpAdaptor(EmptyOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class EmptyOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = EmptyOpAdaptor; + template + using GenericAdaptor = EmptyOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dtype"), ::llvm::StringRef("init")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getInitAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getInitAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Empty"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::OpOperand &getShapeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getInitAttr(); + bool getInit(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setInitAttr(::mlir::BoolAttr attr); + void setInit(::std::optional attrValue); + ::mlir::Attribute removeInitAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, /*optional*/::mlir::BoolAttr init); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, /*optional*/::mlir::BoolAttr init); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, /*optional*/bool init = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, /*optional*/bool init = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::EmptyOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::EmptyTensorListOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class EmptyTensorListOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + EmptyTensorListOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + EmptyTensorListOpGenericAdaptorBase(EmptyTensorListOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class EmptyTensorListOpGenericAdaptor : public detail::EmptyTensorListOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::EmptyTensorListOpGenericAdaptorBase; +public: + EmptyTensorListOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + EmptyTensorListOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : EmptyTensorListOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + EmptyTensorListOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getElementShape() { + return (*getODSOperands(0).begin()); + } + + ValueT getMaxNumElements() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class EmptyTensorListOpAdaptor : public EmptyTensorListOpGenericAdaptor<::mlir::ValueRange> { +public: + using EmptyTensorListOpGenericAdaptor::EmptyTensorListOpGenericAdaptor; + EmptyTensorListOpAdaptor(EmptyTensorListOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class EmptyTensorListOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = EmptyTensorListOpAdaptor; + template + using GenericAdaptor = EmptyTensorListOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("element_dtype"), ::llvm::StringRef("shape_type")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getElementDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getElementDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getShapeTypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getShapeTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.EmptyTensorList"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getElementShape(); + ::mlir::TypedValue<::mlir::TensorType> getMaxNumElements(); + ::mlir::OpOperand &getElementShapeMutable(); + ::mlir::OpOperand &getMaxNumElementsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::Type getShapeType(); + ::mlir::Type getElementDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value element_shape, ::mlir::Value max_num_elements); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value element_shape, ::mlir::Value max_num_elements); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Returns type of the TensorList element produced by this op. + TensorType element_type() { return handle_dtype().getSubtypes()[0]; } + + // Returns data type of the result handle. Returned type contains type of + // the TensorList element as a subtype. + VariantType handle_dtype() { + return getElementTypeOrSelf(getHandle().getType()).cast(); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::EmptyTensorListOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::EncodePngOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class EncodePngOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + EncodePngOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + EncodePngOpGenericAdaptorBase(EncodePngOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getCompressionAttr(); + uint64_t getCompression(); +}; +} // namespace detail +template +class EncodePngOpGenericAdaptor : public detail::EncodePngOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::EncodePngOpGenericAdaptorBase; +public: + EncodePngOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + EncodePngOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : EncodePngOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + EncodePngOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getImage() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class EncodePngOpAdaptor : public EncodePngOpGenericAdaptor<::mlir::ValueRange> { +public: + using EncodePngOpGenericAdaptor::EncodePngOpGenericAdaptor; + EncodePngOpAdaptor(EncodePngOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class EncodePngOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = EncodePngOpAdaptor; + template + using GenericAdaptor = EncodePngOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("compression")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getCompressionAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getCompressionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.EncodePng"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getImage(); + ::mlir::OpOperand &getImageMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getContents(); + ::mlir::IntegerAttr getCompressionAttr(); + uint64_t getCompression(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setCompressionAttr(::mlir::IntegerAttr attr); + void setCompression(::std::optional attrValue); + ::mlir::Attribute removeCompressionAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type contents, ::mlir::Value image, /*optional*/::mlir::IntegerAttr compression); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value image, /*optional*/::mlir::IntegerAttr compression); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type contents, ::mlir::Value image, /*optional*/uint64_t compression = -1); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value image, /*optional*/uint64_t compression = -1); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::EncodePngOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::EnqueueTPUEmbeddingArbitraryTensorBatchOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class EnqueueTPUEmbeddingArbitraryTensorBatchOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + EnqueueTPUEmbeddingArbitraryTensorBatchOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + EnqueueTPUEmbeddingArbitraryTensorBatchOpGenericAdaptorBase(EnqueueTPUEmbeddingArbitraryTensorBatchOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getDeviceOrdinalAttr(); + uint64_t getDeviceOrdinal(); + ::mlir::ArrayAttr getCombinersAttr(); + ::mlir::ArrayAttr getCombiners(); +}; +} // namespace detail +template +class EnqueueTPUEmbeddingArbitraryTensorBatchOpGenericAdaptor : public detail::EnqueueTPUEmbeddingArbitraryTensorBatchOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::EnqueueTPUEmbeddingArbitraryTensorBatchOpGenericAdaptorBase; +public: + EnqueueTPUEmbeddingArbitraryTensorBatchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + EnqueueTPUEmbeddingArbitraryTensorBatchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : EnqueueTPUEmbeddingArbitraryTensorBatchOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + EnqueueTPUEmbeddingArbitraryTensorBatchOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getSampleIndicesOrRowSplits() { + return getODSOperands(0); + } + + RangeT getEmbeddingIndices() { + return getODSOperands(1); + } + + RangeT getAggregationWeights() { + return getODSOperands(2); + } + + ValueT getModeOverride() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class EnqueueTPUEmbeddingArbitraryTensorBatchOpAdaptor : public EnqueueTPUEmbeddingArbitraryTensorBatchOpGenericAdaptor<::mlir::ValueRange> { +public: + using EnqueueTPUEmbeddingArbitraryTensorBatchOpGenericAdaptor::EnqueueTPUEmbeddingArbitraryTensorBatchOpGenericAdaptor; + EnqueueTPUEmbeddingArbitraryTensorBatchOpAdaptor(EnqueueTPUEmbeddingArbitraryTensorBatchOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class EnqueueTPUEmbeddingArbitraryTensorBatchOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, GetResourceInstanceInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = EnqueueTPUEmbeddingArbitraryTensorBatchOpAdaptor; + template + using GenericAdaptor = EnqueueTPUEmbeddingArbitraryTensorBatchOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("N"), ::llvm::StringRef("T1"), ::llvm::StringRef("T2"), ::llvm::StringRef("T3"), ::llvm::StringRef("combiners"), ::llvm::StringRef("device_ordinal")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getT1AttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getT1AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getT2AttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getT2AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getT3AttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getT3AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getCombinersAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getCombinersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getDeviceOrdinalAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getDeviceOrdinalAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.EnqueueTPUEmbeddingArbitraryTensorBatch"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getSampleIndicesOrRowSplits(); + ::mlir::Operation::operand_range getEmbeddingIndices(); + ::mlir::Operation::operand_range getAggregationWeights(); + ::mlir::TypedValue<::mlir::TensorType> getModeOverride(); + ::mlir::MutableOperandRange getSampleIndicesOrRowSplitsMutable(); + ::mlir::MutableOperandRange getEmbeddingIndicesMutable(); + ::mlir::MutableOperandRange getAggregationWeightsMutable(); + ::mlir::OpOperand &getModeOverrideMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getDeviceOrdinalAttr(); + uint64_t getDeviceOrdinal(); + ::mlir::ArrayAttr getCombinersAttr(); + ::mlir::ArrayAttr getCombiners(); + size_t getN(); + ::mlir::Type getT1(); + ::mlir::Type getT2(); + ::mlir::Type getT3(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setDeviceOrdinalAttr(::mlir::IntegerAttr attr); + void setDeviceOrdinal(::std::optional attrValue); + void setCombinersAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeDeviceOrdinalAttr(); + ::mlir::Attribute removeCombinersAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange sample_indices_or_row_splits, ::mlir::ValueRange embedding_indices, ::mlir::ValueRange aggregation_weights, ::mlir::Value mode_override, /*optional*/::mlir::IntegerAttr device_ordinal, /*optional*/::mlir::ArrayAttr combiners); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange sample_indices_or_row_splits, ::mlir::ValueRange embedding_indices, ::mlir::ValueRange aggregation_weights, ::mlir::Value mode_override, /*optional*/::mlir::IntegerAttr device_ordinal, /*optional*/::mlir::ArrayAttr combiners); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange sample_indices_or_row_splits, ::mlir::ValueRange embedding_indices, ::mlir::ValueRange aggregation_weights, ::mlir::Value mode_override, /*optional*/uint64_t device_ordinal, /*optional*/::mlir::ArrayAttr combiners); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange sample_indices_or_row_splits, ::mlir::ValueRange embedding_indices, ::mlir::ValueRange aggregation_weights, ::mlir::Value mode_override, /*optional*/uint64_t device_ordinal, /*optional*/::mlir::ArrayAttr combiners); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + std::optional GetResourceInstanceStr(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::EnqueueTPUEmbeddingArbitraryTensorBatchOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::EnqueueTPUEmbeddingBatchOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class EnqueueTPUEmbeddingBatchOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + EnqueueTPUEmbeddingBatchOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + EnqueueTPUEmbeddingBatchOpGenericAdaptorBase(EnqueueTPUEmbeddingBatchOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getDeviceOrdinalAttr(); + uint64_t getDeviceOrdinal(); + ::mlir::ArrayAttr getCombinersAttr(); + ::mlir::ArrayAttr getCombiners(); +}; +} // namespace detail +template +class EnqueueTPUEmbeddingBatchOpGenericAdaptor : public detail::EnqueueTPUEmbeddingBatchOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::EnqueueTPUEmbeddingBatchOpGenericAdaptorBase; +public: + EnqueueTPUEmbeddingBatchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + EnqueueTPUEmbeddingBatchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : EnqueueTPUEmbeddingBatchOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + EnqueueTPUEmbeddingBatchOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getBatch() { + return getODSOperands(0); + } + + ValueT getModeOverride() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class EnqueueTPUEmbeddingBatchOpAdaptor : public EnqueueTPUEmbeddingBatchOpGenericAdaptor<::mlir::ValueRange> { +public: + using EnqueueTPUEmbeddingBatchOpGenericAdaptor::EnqueueTPUEmbeddingBatchOpGenericAdaptor; + EnqueueTPUEmbeddingBatchOpAdaptor(EnqueueTPUEmbeddingBatchOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class EnqueueTPUEmbeddingBatchOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, GetResourceInstanceInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = EnqueueTPUEmbeddingBatchOpAdaptor; + template + using GenericAdaptor = EnqueueTPUEmbeddingBatchOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("N"), ::llvm::StringRef("combiners"), ::llvm::StringRef("device_ordinal")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getCombinersAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getCombinersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDeviceOrdinalAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDeviceOrdinalAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.EnqueueTPUEmbeddingBatch"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getBatch(); + ::mlir::TypedValue<::mlir::TensorType> getModeOverride(); + ::mlir::MutableOperandRange getBatchMutable(); + ::mlir::OpOperand &getModeOverrideMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getDeviceOrdinalAttr(); + uint64_t getDeviceOrdinal(); + ::mlir::ArrayAttr getCombinersAttr(); + ::mlir::ArrayAttr getCombiners(); + size_t getN(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setDeviceOrdinalAttr(::mlir::IntegerAttr attr); + void setDeviceOrdinal(::std::optional attrValue); + void setCombinersAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeDeviceOrdinalAttr(); + ::mlir::Attribute removeCombinersAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange batch, ::mlir::Value mode_override, /*optional*/::mlir::IntegerAttr device_ordinal, /*optional*/::mlir::ArrayAttr combiners); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange batch, ::mlir::Value mode_override, /*optional*/::mlir::IntegerAttr device_ordinal, /*optional*/::mlir::ArrayAttr combiners); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange batch, ::mlir::Value mode_override, /*optional*/uint64_t device_ordinal, /*optional*/::mlir::ArrayAttr combiners); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange batch, ::mlir::Value mode_override, /*optional*/uint64_t device_ordinal, /*optional*/::mlir::ArrayAttr combiners); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + std::optional GetResourceInstanceStr(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::EnqueueTPUEmbeddingBatchOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::EnqueueTPUEmbeddingIntegerBatchOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class EnqueueTPUEmbeddingIntegerBatchOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + EnqueueTPUEmbeddingIntegerBatchOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + EnqueueTPUEmbeddingIntegerBatchOpGenericAdaptorBase(EnqueueTPUEmbeddingIntegerBatchOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getDeviceOrdinalAttr(); + uint64_t getDeviceOrdinal(); +}; +} // namespace detail +template +class EnqueueTPUEmbeddingIntegerBatchOpGenericAdaptor : public detail::EnqueueTPUEmbeddingIntegerBatchOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::EnqueueTPUEmbeddingIntegerBatchOpGenericAdaptorBase; +public: + EnqueueTPUEmbeddingIntegerBatchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + EnqueueTPUEmbeddingIntegerBatchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : EnqueueTPUEmbeddingIntegerBatchOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + EnqueueTPUEmbeddingIntegerBatchOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getBatch() { + return getODSOperands(0); + } + + ValueT getModeOverride() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class EnqueueTPUEmbeddingIntegerBatchOpAdaptor : public EnqueueTPUEmbeddingIntegerBatchOpGenericAdaptor<::mlir::ValueRange> { +public: + using EnqueueTPUEmbeddingIntegerBatchOpGenericAdaptor::EnqueueTPUEmbeddingIntegerBatchOpGenericAdaptor; + EnqueueTPUEmbeddingIntegerBatchOpAdaptor(EnqueueTPUEmbeddingIntegerBatchOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class EnqueueTPUEmbeddingIntegerBatchOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, GetResourceInstanceInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = EnqueueTPUEmbeddingIntegerBatchOpAdaptor; + template + using GenericAdaptor = EnqueueTPUEmbeddingIntegerBatchOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("N"), ::llvm::StringRef("device_ordinal")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDeviceOrdinalAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDeviceOrdinalAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.EnqueueTPUEmbeddingIntegerBatch"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getBatch(); + ::mlir::TypedValue<::mlir::TensorType> getModeOverride(); + ::mlir::MutableOperandRange getBatchMutable(); + ::mlir::OpOperand &getModeOverrideMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getDeviceOrdinalAttr(); + uint64_t getDeviceOrdinal(); + size_t getN(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setDeviceOrdinalAttr(::mlir::IntegerAttr attr); + void setDeviceOrdinal(::std::optional attrValue); + ::mlir::Attribute removeDeviceOrdinalAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange batch, ::mlir::Value mode_override, /*optional*/::mlir::IntegerAttr device_ordinal); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange batch, ::mlir::Value mode_override, /*optional*/::mlir::IntegerAttr device_ordinal); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange batch, ::mlir::Value mode_override, /*optional*/uint64_t device_ordinal = -1); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange batch, ::mlir::Value mode_override, /*optional*/uint64_t device_ordinal = -1); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + std::optional GetResourceInstanceStr(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::EnqueueTPUEmbeddingIntegerBatchOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::EnqueueTPUEmbeddingRaggedTensorBatchOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class EnqueueTPUEmbeddingRaggedTensorBatchOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + EnqueueTPUEmbeddingRaggedTensorBatchOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + EnqueueTPUEmbeddingRaggedTensorBatchOpGenericAdaptorBase(EnqueueTPUEmbeddingRaggedTensorBatchOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getDeviceOrdinalAttr(); + uint64_t getDeviceOrdinal(); + ::mlir::ArrayAttr getCombinersAttr(); + ::mlir::ArrayAttr getCombiners(); + ::mlir::ArrayAttr getTableIdsAttr(); + ::mlir::ArrayAttr getTableIds(); + ::mlir::ArrayAttr getMaxSequenceLengthsAttr(); + ::mlir::ArrayAttr getMaxSequenceLengths(); + ::mlir::ArrayAttr getNumFeaturesAttr(); + ::mlir::ArrayAttr getNumFeatures(); +}; +} // namespace detail +template +class EnqueueTPUEmbeddingRaggedTensorBatchOpGenericAdaptor : public detail::EnqueueTPUEmbeddingRaggedTensorBatchOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::EnqueueTPUEmbeddingRaggedTensorBatchOpGenericAdaptorBase; +public: + EnqueueTPUEmbeddingRaggedTensorBatchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + EnqueueTPUEmbeddingRaggedTensorBatchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : EnqueueTPUEmbeddingRaggedTensorBatchOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + EnqueueTPUEmbeddingRaggedTensorBatchOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getSampleSplits() { + return getODSOperands(0); + } + + RangeT getEmbeddingIndices() { + return getODSOperands(1); + } + + RangeT getAggregationWeights() { + return getODSOperands(2); + } + + ValueT getModeOverride() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class EnqueueTPUEmbeddingRaggedTensorBatchOpAdaptor : public EnqueueTPUEmbeddingRaggedTensorBatchOpGenericAdaptor<::mlir::ValueRange> { +public: + using EnqueueTPUEmbeddingRaggedTensorBatchOpGenericAdaptor::EnqueueTPUEmbeddingRaggedTensorBatchOpGenericAdaptor; + EnqueueTPUEmbeddingRaggedTensorBatchOpAdaptor(EnqueueTPUEmbeddingRaggedTensorBatchOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class EnqueueTPUEmbeddingRaggedTensorBatchOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, GetResourceInstanceInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = EnqueueTPUEmbeddingRaggedTensorBatchOpAdaptor; + template + using GenericAdaptor = EnqueueTPUEmbeddingRaggedTensorBatchOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("N"), ::llvm::StringRef("T1"), ::llvm::StringRef("T2"), ::llvm::StringRef("T3"), ::llvm::StringRef("combiners"), ::llvm::StringRef("device_ordinal"), ::llvm::StringRef("max_sequence_lengths"), ::llvm::StringRef("num_features"), ::llvm::StringRef("table_ids")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getT1AttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getT1AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getT2AttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getT2AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getT3AttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getT3AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getCombinersAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getCombinersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getDeviceOrdinalAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getDeviceOrdinalAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getMaxSequenceLengthsAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getMaxSequenceLengthsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getNumFeaturesAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getNumFeaturesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getTableIdsAttrName() { + return getAttributeNameForIndex(8); + } + + static ::mlir::StringAttr getTableIdsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 8); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.EnqueueTPUEmbeddingRaggedTensorBatch"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getSampleSplits(); + ::mlir::Operation::operand_range getEmbeddingIndices(); + ::mlir::Operation::operand_range getAggregationWeights(); + ::mlir::TypedValue<::mlir::TensorType> getModeOverride(); + ::mlir::MutableOperandRange getSampleSplitsMutable(); + ::mlir::MutableOperandRange getEmbeddingIndicesMutable(); + ::mlir::MutableOperandRange getAggregationWeightsMutable(); + ::mlir::OpOperand &getModeOverrideMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getDeviceOrdinalAttr(); + uint64_t getDeviceOrdinal(); + ::mlir::ArrayAttr getCombinersAttr(); + ::mlir::ArrayAttr getCombiners(); + ::mlir::ArrayAttr getTableIdsAttr(); + ::mlir::ArrayAttr getTableIds(); + ::mlir::ArrayAttr getMaxSequenceLengthsAttr(); + ::mlir::ArrayAttr getMaxSequenceLengths(); + ::mlir::ArrayAttr getNumFeaturesAttr(); + ::mlir::ArrayAttr getNumFeatures(); + size_t getN(); + ::mlir::Type getT1(); + ::mlir::Type getT2(); + ::mlir::Type getT3(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setDeviceOrdinalAttr(::mlir::IntegerAttr attr); + void setDeviceOrdinal(::std::optional attrValue); + void setCombinersAttr(::mlir::ArrayAttr attr); + void setTableIdsAttr(::mlir::ArrayAttr attr); + void setMaxSequenceLengthsAttr(::mlir::ArrayAttr attr); + void setNumFeaturesAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeDeviceOrdinalAttr(); + ::mlir::Attribute removeCombinersAttr(); + ::mlir::Attribute removeMaxSequenceLengthsAttr(); + ::mlir::Attribute removeNumFeaturesAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange sample_splits, ::mlir::ValueRange embedding_indices, ::mlir::ValueRange aggregation_weights, ::mlir::Value mode_override, /*optional*/::mlir::IntegerAttr device_ordinal, /*optional*/::mlir::ArrayAttr combiners, ::mlir::ArrayAttr table_ids, /*optional*/::mlir::ArrayAttr max_sequence_lengths, /*optional*/::mlir::ArrayAttr num_features); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange sample_splits, ::mlir::ValueRange embedding_indices, ::mlir::ValueRange aggregation_weights, ::mlir::Value mode_override, /*optional*/::mlir::IntegerAttr device_ordinal, /*optional*/::mlir::ArrayAttr combiners, ::mlir::ArrayAttr table_ids, /*optional*/::mlir::ArrayAttr max_sequence_lengths, /*optional*/::mlir::ArrayAttr num_features); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange sample_splits, ::mlir::ValueRange embedding_indices, ::mlir::ValueRange aggregation_weights, ::mlir::Value mode_override, /*optional*/uint64_t device_ordinal, /*optional*/::mlir::ArrayAttr combiners, ::mlir::ArrayAttr table_ids, /*optional*/::mlir::ArrayAttr max_sequence_lengths, /*optional*/::mlir::ArrayAttr num_features); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange sample_splits, ::mlir::ValueRange embedding_indices, ::mlir::ValueRange aggregation_weights, ::mlir::Value mode_override, /*optional*/uint64_t device_ordinal, /*optional*/::mlir::ArrayAttr combiners, ::mlir::ArrayAttr table_ids, /*optional*/::mlir::ArrayAttr max_sequence_lengths, /*optional*/::mlir::ArrayAttr num_features); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + std::optional GetResourceInstanceStr(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 9 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::EnqueueTPUEmbeddingRaggedTensorBatchOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::EnqueueTPUEmbeddingSparseBatchOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class EnqueueTPUEmbeddingSparseBatchOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + EnqueueTPUEmbeddingSparseBatchOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + EnqueueTPUEmbeddingSparseBatchOpGenericAdaptorBase(EnqueueTPUEmbeddingSparseBatchOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getDeviceOrdinalAttr(); + uint64_t getDeviceOrdinal(); + ::mlir::ArrayAttr getCombinersAttr(); + ::mlir::ArrayAttr getCombiners(); +}; +} // namespace detail +template +class EnqueueTPUEmbeddingSparseBatchOpGenericAdaptor : public detail::EnqueueTPUEmbeddingSparseBatchOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::EnqueueTPUEmbeddingSparseBatchOpGenericAdaptorBase; +public: + EnqueueTPUEmbeddingSparseBatchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + EnqueueTPUEmbeddingSparseBatchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : EnqueueTPUEmbeddingSparseBatchOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + EnqueueTPUEmbeddingSparseBatchOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getSampleIndices() { + return getODSOperands(0); + } + + RangeT getEmbeddingIndices() { + return getODSOperands(1); + } + + RangeT getAggregationWeights() { + return getODSOperands(2); + } + + ValueT getModeOverride() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class EnqueueTPUEmbeddingSparseBatchOpAdaptor : public EnqueueTPUEmbeddingSparseBatchOpGenericAdaptor<::mlir::ValueRange> { +public: + using EnqueueTPUEmbeddingSparseBatchOpGenericAdaptor::EnqueueTPUEmbeddingSparseBatchOpGenericAdaptor; + EnqueueTPUEmbeddingSparseBatchOpAdaptor(EnqueueTPUEmbeddingSparseBatchOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class EnqueueTPUEmbeddingSparseBatchOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, GetResourceInstanceInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = EnqueueTPUEmbeddingSparseBatchOpAdaptor; + template + using GenericAdaptor = EnqueueTPUEmbeddingSparseBatchOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("N"), ::llvm::StringRef("T1"), ::llvm::StringRef("T2"), ::llvm::StringRef("T3"), ::llvm::StringRef("combiners"), ::llvm::StringRef("device_ordinal")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getT1AttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getT1AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getT2AttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getT2AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getT3AttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getT3AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getCombinersAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getCombinersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getDeviceOrdinalAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getDeviceOrdinalAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.EnqueueTPUEmbeddingSparseBatch"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getSampleIndices(); + ::mlir::Operation::operand_range getEmbeddingIndices(); + ::mlir::Operation::operand_range getAggregationWeights(); + ::mlir::TypedValue<::mlir::TensorType> getModeOverride(); + ::mlir::MutableOperandRange getSampleIndicesMutable(); + ::mlir::MutableOperandRange getEmbeddingIndicesMutable(); + ::mlir::MutableOperandRange getAggregationWeightsMutable(); + ::mlir::OpOperand &getModeOverrideMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getDeviceOrdinalAttr(); + uint64_t getDeviceOrdinal(); + ::mlir::ArrayAttr getCombinersAttr(); + ::mlir::ArrayAttr getCombiners(); + size_t getN(); + ::mlir::Type getT1(); + ::mlir::Type getT2(); + ::mlir::Type getT3(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setDeviceOrdinalAttr(::mlir::IntegerAttr attr); + void setDeviceOrdinal(::std::optional attrValue); + void setCombinersAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeDeviceOrdinalAttr(); + ::mlir::Attribute removeCombinersAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange sample_indices, ::mlir::ValueRange embedding_indices, ::mlir::ValueRange aggregation_weights, ::mlir::Value mode_override, /*optional*/::mlir::IntegerAttr device_ordinal, /*optional*/::mlir::ArrayAttr combiners); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange sample_indices, ::mlir::ValueRange embedding_indices, ::mlir::ValueRange aggregation_weights, ::mlir::Value mode_override, /*optional*/::mlir::IntegerAttr device_ordinal, /*optional*/::mlir::ArrayAttr combiners); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange sample_indices, ::mlir::ValueRange embedding_indices, ::mlir::ValueRange aggregation_weights, ::mlir::Value mode_override, /*optional*/uint64_t device_ordinal, /*optional*/::mlir::ArrayAttr combiners); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange sample_indices, ::mlir::ValueRange embedding_indices, ::mlir::ValueRange aggregation_weights, ::mlir::Value mode_override, /*optional*/uint64_t device_ordinal, /*optional*/::mlir::ArrayAttr combiners); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + std::optional GetResourceInstanceStr(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::EnqueueTPUEmbeddingSparseBatchOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::EnqueueTPUEmbeddingSparseTensorBatchOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class EnqueueTPUEmbeddingSparseTensorBatchOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + EnqueueTPUEmbeddingSparseTensorBatchOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + EnqueueTPUEmbeddingSparseTensorBatchOpGenericAdaptorBase(EnqueueTPUEmbeddingSparseTensorBatchOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getDeviceOrdinalAttr(); + uint64_t getDeviceOrdinal(); + ::mlir::ArrayAttr getCombinersAttr(); + ::mlir::ArrayAttr getCombiners(); + ::mlir::ArrayAttr getTableIdsAttr(); + ::mlir::ArrayAttr getTableIds(); + ::mlir::ArrayAttr getMaxSequenceLengthsAttr(); + ::mlir::ArrayAttr getMaxSequenceLengths(); + ::mlir::ArrayAttr getNumFeaturesAttr(); + ::mlir::ArrayAttr getNumFeatures(); +}; +} // namespace detail +template +class EnqueueTPUEmbeddingSparseTensorBatchOpGenericAdaptor : public detail::EnqueueTPUEmbeddingSparseTensorBatchOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::EnqueueTPUEmbeddingSparseTensorBatchOpGenericAdaptorBase; +public: + EnqueueTPUEmbeddingSparseTensorBatchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + EnqueueTPUEmbeddingSparseTensorBatchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : EnqueueTPUEmbeddingSparseTensorBatchOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + EnqueueTPUEmbeddingSparseTensorBatchOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getSampleIndices() { + return getODSOperands(0); + } + + RangeT getEmbeddingIndices() { + return getODSOperands(1); + } + + RangeT getAggregationWeights() { + return getODSOperands(2); + } + + ValueT getModeOverride() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class EnqueueTPUEmbeddingSparseTensorBatchOpAdaptor : public EnqueueTPUEmbeddingSparseTensorBatchOpGenericAdaptor<::mlir::ValueRange> { +public: + using EnqueueTPUEmbeddingSparseTensorBatchOpGenericAdaptor::EnqueueTPUEmbeddingSparseTensorBatchOpGenericAdaptor; + EnqueueTPUEmbeddingSparseTensorBatchOpAdaptor(EnqueueTPUEmbeddingSparseTensorBatchOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class EnqueueTPUEmbeddingSparseTensorBatchOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, GetResourceInstanceInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = EnqueueTPUEmbeddingSparseTensorBatchOpAdaptor; + template + using GenericAdaptor = EnqueueTPUEmbeddingSparseTensorBatchOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("N"), ::llvm::StringRef("T1"), ::llvm::StringRef("T2"), ::llvm::StringRef("T3"), ::llvm::StringRef("combiners"), ::llvm::StringRef("device_ordinal"), ::llvm::StringRef("max_sequence_lengths"), ::llvm::StringRef("num_features"), ::llvm::StringRef("table_ids")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getT1AttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getT1AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getT2AttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getT2AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getT3AttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getT3AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getCombinersAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getCombinersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getDeviceOrdinalAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getDeviceOrdinalAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getMaxSequenceLengthsAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getMaxSequenceLengthsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getNumFeaturesAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getNumFeaturesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getTableIdsAttrName() { + return getAttributeNameForIndex(8); + } + + static ::mlir::StringAttr getTableIdsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 8); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.EnqueueTPUEmbeddingSparseTensorBatch"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getSampleIndices(); + ::mlir::Operation::operand_range getEmbeddingIndices(); + ::mlir::Operation::operand_range getAggregationWeights(); + ::mlir::TypedValue<::mlir::TensorType> getModeOverride(); + ::mlir::MutableOperandRange getSampleIndicesMutable(); + ::mlir::MutableOperandRange getEmbeddingIndicesMutable(); + ::mlir::MutableOperandRange getAggregationWeightsMutable(); + ::mlir::OpOperand &getModeOverrideMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getDeviceOrdinalAttr(); + uint64_t getDeviceOrdinal(); + ::mlir::ArrayAttr getCombinersAttr(); + ::mlir::ArrayAttr getCombiners(); + ::mlir::ArrayAttr getTableIdsAttr(); + ::mlir::ArrayAttr getTableIds(); + ::mlir::ArrayAttr getMaxSequenceLengthsAttr(); + ::mlir::ArrayAttr getMaxSequenceLengths(); + ::mlir::ArrayAttr getNumFeaturesAttr(); + ::mlir::ArrayAttr getNumFeatures(); + size_t getN(); + ::mlir::Type getT1(); + ::mlir::Type getT2(); + ::mlir::Type getT3(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setDeviceOrdinalAttr(::mlir::IntegerAttr attr); + void setDeviceOrdinal(::std::optional attrValue); + void setCombinersAttr(::mlir::ArrayAttr attr); + void setTableIdsAttr(::mlir::ArrayAttr attr); + void setMaxSequenceLengthsAttr(::mlir::ArrayAttr attr); + void setNumFeaturesAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeDeviceOrdinalAttr(); + ::mlir::Attribute removeCombinersAttr(); + ::mlir::Attribute removeMaxSequenceLengthsAttr(); + ::mlir::Attribute removeNumFeaturesAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange sample_indices, ::mlir::ValueRange embedding_indices, ::mlir::ValueRange aggregation_weights, ::mlir::Value mode_override, /*optional*/::mlir::IntegerAttr device_ordinal, /*optional*/::mlir::ArrayAttr combiners, ::mlir::ArrayAttr table_ids, /*optional*/::mlir::ArrayAttr max_sequence_lengths, /*optional*/::mlir::ArrayAttr num_features); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange sample_indices, ::mlir::ValueRange embedding_indices, ::mlir::ValueRange aggregation_weights, ::mlir::Value mode_override, /*optional*/::mlir::IntegerAttr device_ordinal, /*optional*/::mlir::ArrayAttr combiners, ::mlir::ArrayAttr table_ids, /*optional*/::mlir::ArrayAttr max_sequence_lengths, /*optional*/::mlir::ArrayAttr num_features); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange sample_indices, ::mlir::ValueRange embedding_indices, ::mlir::ValueRange aggregation_weights, ::mlir::Value mode_override, /*optional*/uint64_t device_ordinal, /*optional*/::mlir::ArrayAttr combiners, ::mlir::ArrayAttr table_ids, /*optional*/::mlir::ArrayAttr max_sequence_lengths, /*optional*/::mlir::ArrayAttr num_features); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange sample_indices, ::mlir::ValueRange embedding_indices, ::mlir::ValueRange aggregation_weights, ::mlir::Value mode_override, /*optional*/uint64_t device_ordinal, /*optional*/::mlir::ArrayAttr combiners, ::mlir::ArrayAttr table_ids, /*optional*/::mlir::ArrayAttr max_sequence_lengths, /*optional*/::mlir::ArrayAttr num_features); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + std::optional GetResourceInstanceStr(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 9 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::EnqueueTPUEmbeddingSparseTensorBatchOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::EnsureShapeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class EnsureShapeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + EnsureShapeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + EnsureShapeOpGenericAdaptorBase(EnsureShapeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Attribute getShapeAttr(); + std::optional> getShape(); +}; +} // namespace detail +template +class EnsureShapeOpGenericAdaptor : public detail::EnsureShapeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::EnsureShapeOpGenericAdaptorBase; +public: + EnsureShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + EnsureShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : EnsureShapeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + EnsureShapeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class EnsureShapeOpAdaptor : public EnsureShapeOpGenericAdaptor<::mlir::ValueRange> { +public: + using EnsureShapeOpGenericAdaptor::EnsureShapeOpGenericAdaptor; + EnsureShapeOpAdaptor(EnsureShapeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class EnsureShapeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = EnsureShapeOpAdaptor; + template + using GenericAdaptor = EnsureShapeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("shape")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getShapeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getShapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.EnsureShape"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Attribute getShapeAttr(); + std::optional> getShape(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setShapeAttr(::mlir::Attribute attr); + void setShape(std::optional> attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Attribute shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Attribute shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, std::optional> shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, std::optional> shape); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::EnsureShapeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::EqualOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class EqualOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + EqualOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + EqualOpGenericAdaptorBase(EqualOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getIncompatibleShapeErrorAttr(); + bool getIncompatibleShapeError(); +}; +} // namespace detail +template +class EqualOpGenericAdaptor : public detail::EqualOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::EqualOpGenericAdaptorBase; +public: + EqualOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + EqualOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : EqualOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + EqualOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class EqualOpAdaptor : public EqualOpGenericAdaptor<::mlir::ValueRange> { +public: + using EqualOpGenericAdaptor::EqualOpGenericAdaptor; + EqualOpAdaptor(EqualOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class EqualOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsCommutative, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = EqualOpAdaptor; + template + using GenericAdaptor = EqualOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("incompatible_shape_error")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getIncompatibleShapeErrorAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getIncompatibleShapeErrorAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Equal"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::BoolAttr getIncompatibleShapeErrorAttr(); + bool getIncompatibleShapeError(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setIncompatibleShapeErrorAttr(::mlir::BoolAttr attr); + void setIncompatibleShapeError(::std::optional attrValue); + ::mlir::Attribute removeIncompatibleShapeErrorAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y, BoolAttr incompatible_shape_error); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y, /*optional*/::mlir::BoolAttr incompatible_shape_error); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y, /*optional*/::mlir::BoolAttr incompatible_shape_error); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y, /*optional*/bool incompatible_shape_error = true); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y, /*optional*/bool incompatible_shape_error = true); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::EqualOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ErfOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ErfOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ErfOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ErfOpGenericAdaptorBase(ErfOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ErfOpGenericAdaptor : public detail::ErfOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ErfOpGenericAdaptorBase; +public: + ErfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ErfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ErfOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ErfOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ErfOpAdaptor : public ErfOpGenericAdaptor<::mlir::ValueRange> { +public: + using ErfOpGenericAdaptor::ErfOpGenericAdaptor; + ErfOpAdaptor(ErfOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ErfOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ErfOpAdaptor; + template + using GenericAdaptor = ErfOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Erf"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ErfOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ErfcOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ErfcOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ErfcOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ErfcOpGenericAdaptorBase(ErfcOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ErfcOpGenericAdaptor : public detail::ErfcOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ErfcOpGenericAdaptorBase; +public: + ErfcOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ErfcOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ErfcOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ErfcOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ErfcOpAdaptor : public ErfcOpGenericAdaptor<::mlir::ValueRange> { +public: + using ErfcOpGenericAdaptor::ErfcOpGenericAdaptor; + ErfcOpAdaptor(ErfcOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ErfcOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ErfcOpAdaptor; + template + using GenericAdaptor = ErfcOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Erfc"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ErfcOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ErfinvOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ErfinvOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ErfinvOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ErfinvOpGenericAdaptorBase(ErfinvOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ErfinvOpGenericAdaptor : public detail::ErfinvOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ErfinvOpGenericAdaptorBase; +public: + ErfinvOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ErfinvOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ErfinvOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ErfinvOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ErfinvOpAdaptor : public ErfinvOpGenericAdaptor<::mlir::ValueRange> { +public: + using ErfinvOpGenericAdaptor::ErfinvOpGenericAdaptor; + ErfinvOpAdaptor(ErfinvOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ErfinvOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ErfinvOpAdaptor; + template + using GenericAdaptor = ErfinvOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Erfinv"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ErfinvOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ExecuteTPUEmbeddingPartitionerOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ExecuteTPUEmbeddingPartitionerOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ExecuteTPUEmbeddingPartitionerOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ExecuteTPUEmbeddingPartitionerOpGenericAdaptorBase(ExecuteTPUEmbeddingPartitionerOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class ExecuteTPUEmbeddingPartitionerOpGenericAdaptor : public detail::ExecuteTPUEmbeddingPartitionerOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ExecuteTPUEmbeddingPartitionerOpGenericAdaptorBase; +public: + ExecuteTPUEmbeddingPartitionerOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ExecuteTPUEmbeddingPartitionerOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ExecuteTPUEmbeddingPartitionerOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ExecuteTPUEmbeddingPartitionerOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ExecuteTPUEmbeddingPartitionerOpAdaptor : public ExecuteTPUEmbeddingPartitionerOpGenericAdaptor<::mlir::ValueRange> { +public: + using ExecuteTPUEmbeddingPartitionerOpGenericAdaptor::ExecuteTPUEmbeddingPartitionerOpGenericAdaptor; + ExecuteTPUEmbeddingPartitionerOpAdaptor(ExecuteTPUEmbeddingPartitionerOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ExecuteTPUEmbeddingPartitionerOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = ExecuteTPUEmbeddingPartitionerOpAdaptor; + template + using GenericAdaptor = ExecuteTPUEmbeddingPartitionerOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ExecuteTPUEmbeddingPartitioner"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getCommonConfig(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type common_config, ::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type common_config, ::llvm::StringRef config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef config); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ExecuteTPUEmbeddingPartitionerOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ExpOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ExpOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ExpOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ExpOpGenericAdaptorBase(ExpOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ExpOpGenericAdaptor : public detail::ExpOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ExpOpGenericAdaptorBase; +public: + ExpOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ExpOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ExpOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ExpOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ExpOpAdaptor : public ExpOpGenericAdaptor<::mlir::ValueRange> { +public: + using ExpOpGenericAdaptor::ExpOpGenericAdaptor; + ExpOpAdaptor(ExpOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ExpOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ExpOpAdaptor; + template + using GenericAdaptor = ExpOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Exp"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ExpOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ExpandDimsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ExpandDimsOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ExpandDimsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ExpandDimsOpGenericAdaptorBase(ExpandDimsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ExpandDimsOpGenericAdaptor : public detail::ExpandDimsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ExpandDimsOpGenericAdaptorBase; +public: + ExpandDimsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ExpandDimsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ExpandDimsOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ExpandDimsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getDim() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ExpandDimsOpAdaptor : public ExpandDimsOpGenericAdaptor<::mlir::ValueRange> { +public: + using ExpandDimsOpGenericAdaptor::ExpandDimsOpGenericAdaptor; + ExpandDimsOpAdaptor(ExpandDimsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ExpandDimsOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ExpandDimsOpAdaptor; + template + using GenericAdaptor = ExpandDimsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tdim")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTdimAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTdimAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ExpandDims"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getDim(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getDimMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTdim(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value condition, Value dim); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value dim); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value dim); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ExpandDimsOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::Expm1Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Expm1OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + Expm1OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + Expm1OpGenericAdaptorBase(Expm1Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class Expm1OpGenericAdaptor : public detail::Expm1OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Expm1OpGenericAdaptorBase; +public: + Expm1OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Expm1OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Expm1OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + Expm1OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Expm1OpAdaptor : public Expm1OpGenericAdaptor<::mlir::ValueRange> { +public: + using Expm1OpGenericAdaptor::Expm1OpGenericAdaptor; + Expm1OpAdaptor(Expm1Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Expm1Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = Expm1OpAdaptor; + template + using GenericAdaptor = Expm1OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Expm1"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::Expm1Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ExtractImagePatchesOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ExtractImagePatchesOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ExtractImagePatchesOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ExtractImagePatchesOpGenericAdaptorBase(ExtractImagePatchesOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getKsizesAttr(); + ::mlir::ArrayAttr getKsizes(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::ArrayAttr getRatesAttr(); + ::mlir::ArrayAttr getRates(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); +}; +} // namespace detail +template +class ExtractImagePatchesOpGenericAdaptor : public detail::ExtractImagePatchesOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ExtractImagePatchesOpGenericAdaptorBase; +public: + ExtractImagePatchesOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ExtractImagePatchesOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ExtractImagePatchesOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ExtractImagePatchesOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getImages() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ExtractImagePatchesOpAdaptor : public ExtractImagePatchesOpGenericAdaptor<::mlir::ValueRange> { +public: + using ExtractImagePatchesOpGenericAdaptor::ExtractImagePatchesOpGenericAdaptor; + ExtractImagePatchesOpAdaptor(ExtractImagePatchesOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ExtractImagePatchesOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ExtractImagePatchesOpAdaptor; + template + using GenericAdaptor = ExtractImagePatchesOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("ksizes"), ::llvm::StringRef("padding"), ::llvm::StringRef("rates"), ::llvm::StringRef("strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getKsizesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getKsizesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getRatesAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getRatesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ExtractImagePatches"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getImages(); + ::mlir::OpOperand &getImagesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getPatches(); + ::mlir::ArrayAttr getKsizesAttr(); + ::mlir::ArrayAttr getKsizes(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::ArrayAttr getRatesAttr(); + ::mlir::ArrayAttr getRates(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setKsizesAttr(::mlir::ArrayAttr attr); + void setStridesAttr(::mlir::ArrayAttr attr); + void setRatesAttr(::mlir::ArrayAttr attr); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type patches, ::mlir::Value images, ::mlir::ArrayAttr ksizes, ::mlir::ArrayAttr strides, ::mlir::ArrayAttr rates, ::mlir::StringAttr padding); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value images, ::mlir::ArrayAttr ksizes, ::mlir::ArrayAttr strides, ::mlir::ArrayAttr rates, ::mlir::StringAttr padding); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type patches, ::mlir::Value images, ::mlir::ArrayAttr ksizes, ::mlir::ArrayAttr strides, ::mlir::ArrayAttr rates, ::llvm::StringRef padding); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value images, ::mlir::ArrayAttr ksizes, ::mlir::ArrayAttr strides, ::mlir::ArrayAttr rates, ::llvm::StringRef padding); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ExtractImagePatchesOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::FFT2DOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FFT2DOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FFT2DOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FFT2DOpGenericAdaptorBase(FFT2DOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class FFT2DOpGenericAdaptor : public detail::FFT2DOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FFT2DOpGenericAdaptorBase; +public: + FFT2DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FFT2DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FFT2DOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FFT2DOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FFT2DOpAdaptor : public FFT2DOpGenericAdaptor<::mlir::ValueRange> { +public: + using FFT2DOpGenericAdaptor::FFT2DOpGenericAdaptor; + FFT2DOpAdaptor(FFT2DOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FFT2DOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FFT2DOpAdaptor; + template + using GenericAdaptor = FFT2DOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tcomplex")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTcomplexAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTcomplexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.FFT2D"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getTcomplex(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::FFT2DOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::FFT3DOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FFT3DOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FFT3DOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FFT3DOpGenericAdaptorBase(FFT3DOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class FFT3DOpGenericAdaptor : public detail::FFT3DOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FFT3DOpGenericAdaptorBase; +public: + FFT3DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FFT3DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FFT3DOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FFT3DOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FFT3DOpAdaptor : public FFT3DOpGenericAdaptor<::mlir::ValueRange> { +public: + using FFT3DOpGenericAdaptor::FFT3DOpGenericAdaptor; + FFT3DOpAdaptor(FFT3DOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FFT3DOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FFT3DOpAdaptor; + template + using GenericAdaptor = FFT3DOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tcomplex")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTcomplexAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTcomplexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.FFT3D"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getTcomplex(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::FFT3DOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::FFTOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FFTOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FFTOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FFTOpGenericAdaptorBase(FFTOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class FFTOpGenericAdaptor : public detail::FFTOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FFTOpGenericAdaptorBase; +public: + FFTOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FFTOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FFTOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FFTOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FFTOpAdaptor : public FFTOpGenericAdaptor<::mlir::ValueRange> { +public: + using FFTOpGenericAdaptor::FFTOpGenericAdaptor; + FFTOpAdaptor(FFTOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FFTOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FFTOpAdaptor; + template + using GenericAdaptor = FFTOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tcomplex")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTcomplexAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTcomplexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.FFT"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getTcomplex(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::FFTOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::FakeParamOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FakeParamOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FakeParamOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FakeParamOpGenericAdaptorBase(FakeParamOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Attribute getShapeAttr(); + std::optional> getShape(); +}; +} // namespace detail +template +class FakeParamOpGenericAdaptor : public detail::FakeParamOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FakeParamOpGenericAdaptorBase; +public: + FakeParamOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FakeParamOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FakeParamOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FakeParamOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FakeParamOpAdaptor : public FakeParamOpGenericAdaptor<::mlir::ValueRange> { +public: + using FakeParamOpGenericAdaptor::FakeParamOpGenericAdaptor; + FakeParamOpAdaptor(FakeParamOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FakeParamOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FakeParamOpAdaptor; + template + using GenericAdaptor = FakeParamOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dtype"), ::llvm::StringRef("shape")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getShapeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getShapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.FakeParam"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Attribute getShapeAttr(); + std::optional> getShape(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setShapeAttr(::mlir::Attribute attr); + void setShape(std::optional> attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Attribute shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Attribute shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, std::optional> shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, std::optional> shape); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::FakeParamOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::FakeQuantWithMinMaxArgsGradientOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FakeQuantWithMinMaxArgsGradientOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FakeQuantWithMinMaxArgsGradientOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FakeQuantWithMinMaxArgsGradientOpGenericAdaptorBase(FakeQuantWithMinMaxArgsGradientOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::FloatAttr getMinAttr(); + ::llvm::APFloat getMin(); + ::mlir::FloatAttr getMaxAttr(); + ::llvm::APFloat getMax(); + ::mlir::IntegerAttr getNumBitsAttr(); + uint64_t getNumBits(); + ::mlir::BoolAttr getNarrowRangeAttr(); + bool getNarrowRange(); +}; +} // namespace detail +template +class FakeQuantWithMinMaxArgsGradientOpGenericAdaptor : public detail::FakeQuantWithMinMaxArgsGradientOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FakeQuantWithMinMaxArgsGradientOpGenericAdaptorBase; +public: + FakeQuantWithMinMaxArgsGradientOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FakeQuantWithMinMaxArgsGradientOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FakeQuantWithMinMaxArgsGradientOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FakeQuantWithMinMaxArgsGradientOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getGradients() { + return (*getODSOperands(0).begin()); + } + + ValueT getInputs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FakeQuantWithMinMaxArgsGradientOpAdaptor : public FakeQuantWithMinMaxArgsGradientOpGenericAdaptor<::mlir::ValueRange> { +public: + using FakeQuantWithMinMaxArgsGradientOpGenericAdaptor::FakeQuantWithMinMaxArgsGradientOpGenericAdaptor; + FakeQuantWithMinMaxArgsGradientOpAdaptor(FakeQuantWithMinMaxArgsGradientOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FakeQuantWithMinMaxArgsGradientOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef> { +public: + using Op::Op; + using Op::print; + using Adaptor = FakeQuantWithMinMaxArgsGradientOpAdaptor; + template + using GenericAdaptor = FakeQuantWithMinMaxArgsGradientOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("max"), ::llvm::StringRef("min"), ::llvm::StringRef("narrow_range"), ::llvm::StringRef("num_bits")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getMaxAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getMaxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getMinAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getMinAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getNarrowRangeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getNarrowRangeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getNumBitsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getNumBitsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.FakeQuantWithMinMaxArgsGradient"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getGradients(); + ::mlir::TypedValue<::mlir::TensorType> getInputs(); + ::mlir::OpOperand &getGradientsMutable(); + ::mlir::OpOperand &getInputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getBackprops(); + ::mlir::FloatAttr getMinAttr(); + ::llvm::APFloat getMin(); + ::mlir::FloatAttr getMaxAttr(); + ::llvm::APFloat getMax(); + ::mlir::IntegerAttr getNumBitsAttr(); + uint64_t getNumBits(); + ::mlir::BoolAttr getNarrowRangeAttr(); + bool getNarrowRange(); + void setMinAttr(::mlir::FloatAttr attr); + void setMin(::std::optional<::llvm::APFloat> attrValue); + void setMaxAttr(::mlir::FloatAttr attr); + void setMax(::std::optional<::llvm::APFloat> attrValue); + void setNumBitsAttr(::mlir::IntegerAttr attr); + void setNumBits(::std::optional attrValue); + void setNarrowRangeAttr(::mlir::BoolAttr attr); + void setNarrowRange(::std::optional attrValue); + ::mlir::Attribute removeMinAttr(); + ::mlir::Attribute removeMaxAttr(); + ::mlir::Attribute removeNumBitsAttr(); + ::mlir::Attribute removeNarrowRangeAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type backprops, ::mlir::Value gradients, ::mlir::Value inputs, /*optional*/::mlir::FloatAttr min, /*optional*/::mlir::FloatAttr max, /*optional*/::mlir::IntegerAttr num_bits, /*optional*/::mlir::BoolAttr narrow_range); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value gradients, ::mlir::Value inputs, /*optional*/::mlir::FloatAttr min, /*optional*/::mlir::FloatAttr max, /*optional*/::mlir::IntegerAttr num_bits, /*optional*/::mlir::BoolAttr narrow_range); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value gradients, ::mlir::Value inputs, /*optional*/::mlir::FloatAttr min, /*optional*/::mlir::FloatAttr max, /*optional*/::mlir::IntegerAttr num_bits, /*optional*/::mlir::BoolAttr narrow_range); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type backprops, ::mlir::Value gradients, ::mlir::Value inputs, /*optional*/::llvm::APFloat min, /*optional*/::llvm::APFloat max, /*optional*/uint64_t num_bits = 8, /*optional*/bool narrow_range = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value gradients, ::mlir::Value inputs, /*optional*/::llvm::APFloat min, /*optional*/::llvm::APFloat max, /*optional*/uint64_t num_bits = 8, /*optional*/bool narrow_range = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value gradients, ::mlir::Value inputs, /*optional*/::llvm::APFloat min, /*optional*/::llvm::APFloat max, /*optional*/uint64_t num_bits = 8, /*optional*/bool narrow_range = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::FakeQuantWithMinMaxArgsGradientOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::FakeQuantWithMinMaxArgsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FakeQuantWithMinMaxArgsOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FakeQuantWithMinMaxArgsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FakeQuantWithMinMaxArgsOpGenericAdaptorBase(FakeQuantWithMinMaxArgsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::FloatAttr getMinAttr(); + ::llvm::APFloat getMin(); + ::mlir::FloatAttr getMaxAttr(); + ::llvm::APFloat getMax(); + ::mlir::IntegerAttr getNumBitsAttr(); + uint64_t getNumBits(); + ::mlir::BoolAttr getNarrowRangeAttr(); + bool getNarrowRange(); +}; +} // namespace detail +template +class FakeQuantWithMinMaxArgsOpGenericAdaptor : public detail::FakeQuantWithMinMaxArgsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FakeQuantWithMinMaxArgsOpGenericAdaptorBase; +public: + FakeQuantWithMinMaxArgsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FakeQuantWithMinMaxArgsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FakeQuantWithMinMaxArgsOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FakeQuantWithMinMaxArgsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputs() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FakeQuantWithMinMaxArgsOpAdaptor : public FakeQuantWithMinMaxArgsOpGenericAdaptor<::mlir::ValueRange> { +public: + using FakeQuantWithMinMaxArgsOpGenericAdaptor::FakeQuantWithMinMaxArgsOpGenericAdaptor; + FakeQuantWithMinMaxArgsOpAdaptor(FakeQuantWithMinMaxArgsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FakeQuantWithMinMaxArgsOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef> { +public: + using Op::Op; + using Op::print; + using Adaptor = FakeQuantWithMinMaxArgsOpAdaptor; + template + using GenericAdaptor = FakeQuantWithMinMaxArgsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("max"), ::llvm::StringRef("min"), ::llvm::StringRef("narrow_range"), ::llvm::StringRef("num_bits")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getMaxAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getMaxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getMinAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getMinAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getNarrowRangeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getNarrowRangeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getNumBitsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getNumBitsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.FakeQuantWithMinMaxArgs"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputs(); + ::mlir::OpOperand &getInputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutputs(); + ::mlir::FloatAttr getMinAttr(); + ::llvm::APFloat getMin(); + ::mlir::FloatAttr getMaxAttr(); + ::llvm::APFloat getMax(); + ::mlir::IntegerAttr getNumBitsAttr(); + uint64_t getNumBits(); + ::mlir::BoolAttr getNarrowRangeAttr(); + bool getNarrowRange(); + void setMinAttr(::mlir::FloatAttr attr); + void setMin(::std::optional<::llvm::APFloat> attrValue); + void setMaxAttr(::mlir::FloatAttr attr); + void setMax(::std::optional<::llvm::APFloat> attrValue); + void setNumBitsAttr(::mlir::IntegerAttr attr); + void setNumBits(::std::optional attrValue); + void setNarrowRangeAttr(::mlir::BoolAttr attr); + void setNarrowRange(::std::optional attrValue); + ::mlir::Attribute removeMinAttr(); + ::mlir::Attribute removeMaxAttr(); + ::mlir::Attribute removeNumBitsAttr(); + ::mlir::Attribute removeNarrowRangeAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type outputs, ::mlir::Value inputs, /*optional*/::mlir::FloatAttr min, /*optional*/::mlir::FloatAttr max, /*optional*/::mlir::IntegerAttr num_bits, /*optional*/::mlir::BoolAttr narrow_range); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value inputs, /*optional*/::mlir::FloatAttr min, /*optional*/::mlir::FloatAttr max, /*optional*/::mlir::IntegerAttr num_bits, /*optional*/::mlir::BoolAttr narrow_range); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inputs, /*optional*/::mlir::FloatAttr min, /*optional*/::mlir::FloatAttr max, /*optional*/::mlir::IntegerAttr num_bits, /*optional*/::mlir::BoolAttr narrow_range); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type outputs, ::mlir::Value inputs, /*optional*/::llvm::APFloat min, /*optional*/::llvm::APFloat max, /*optional*/uint64_t num_bits = 8, /*optional*/bool narrow_range = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value inputs, /*optional*/::llvm::APFloat min, /*optional*/::llvm::APFloat max, /*optional*/uint64_t num_bits = 8, /*optional*/bool narrow_range = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inputs, /*optional*/::llvm::APFloat min, /*optional*/::llvm::APFloat max, /*optional*/uint64_t num_bits = 8, /*optional*/bool narrow_range = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::FakeQuantWithMinMaxArgsOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::FakeQuantWithMinMaxVarsGradientOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FakeQuantWithMinMaxVarsGradientOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FakeQuantWithMinMaxVarsGradientOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FakeQuantWithMinMaxVarsGradientOpGenericAdaptorBase(FakeQuantWithMinMaxVarsGradientOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getNumBitsAttr(); + uint64_t getNumBits(); + ::mlir::BoolAttr getNarrowRangeAttr(); + bool getNarrowRange(); +}; +} // namespace detail +template +class FakeQuantWithMinMaxVarsGradientOpGenericAdaptor : public detail::FakeQuantWithMinMaxVarsGradientOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FakeQuantWithMinMaxVarsGradientOpGenericAdaptorBase; +public: + FakeQuantWithMinMaxVarsGradientOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FakeQuantWithMinMaxVarsGradientOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FakeQuantWithMinMaxVarsGradientOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FakeQuantWithMinMaxVarsGradientOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getGradients() { + return (*getODSOperands(0).begin()); + } + + ValueT getInputs() { + return (*getODSOperands(1).begin()); + } + + ValueT getMin() { + return (*getODSOperands(2).begin()); + } + + ValueT getMax() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FakeQuantWithMinMaxVarsGradientOpAdaptor : public FakeQuantWithMinMaxVarsGradientOpGenericAdaptor<::mlir::ValueRange> { +public: + using FakeQuantWithMinMaxVarsGradientOpGenericAdaptor::FakeQuantWithMinMaxVarsGradientOpGenericAdaptor; + FakeQuantWithMinMaxVarsGradientOpAdaptor(FakeQuantWithMinMaxVarsGradientOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FakeQuantWithMinMaxVarsGradientOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FakeQuantWithMinMaxVarsGradientOpAdaptor; + template + using GenericAdaptor = FakeQuantWithMinMaxVarsGradientOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("narrow_range"), ::llvm::StringRef("num_bits")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNarrowRangeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNarrowRangeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumBitsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumBitsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.FakeQuantWithMinMaxVarsGradient"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getGradients(); + ::mlir::TypedValue<::mlir::TensorType> getInputs(); + ::mlir::TypedValue<::mlir::TensorType> getMin(); + ::mlir::TypedValue<::mlir::TensorType> getMax(); + ::mlir::OpOperand &getGradientsMutable(); + ::mlir::OpOperand &getInputsMutable(); + ::mlir::OpOperand &getMinMutable(); + ::mlir::OpOperand &getMaxMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getBackpropsWrtInput(); + ::mlir::TypedValue<::mlir::TensorType> getBackpropWrtMin(); + ::mlir::TypedValue<::mlir::TensorType> getBackpropWrtMax(); + ::mlir::IntegerAttr getNumBitsAttr(); + uint64_t getNumBits(); + ::mlir::BoolAttr getNarrowRangeAttr(); + bool getNarrowRange(); + void setNumBitsAttr(::mlir::IntegerAttr attr); + void setNumBits(::std::optional attrValue); + void setNarrowRangeAttr(::mlir::BoolAttr attr); + void setNarrowRange(::std::optional attrValue); + ::mlir::Attribute removeNumBitsAttr(); + ::mlir::Attribute removeNarrowRangeAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type backprops_wrt_input, ::mlir::Type backprop_wrt_min, ::mlir::Type backprop_wrt_max, ::mlir::Value gradients, ::mlir::Value inputs, ::mlir::Value min, ::mlir::Value max, /*optional*/::mlir::IntegerAttr num_bits, /*optional*/::mlir::BoolAttr narrow_range); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value gradients, ::mlir::Value inputs, ::mlir::Value min, ::mlir::Value max, /*optional*/::mlir::IntegerAttr num_bits, /*optional*/::mlir::BoolAttr narrow_range); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type backprops_wrt_input, ::mlir::Type backprop_wrt_min, ::mlir::Type backprop_wrt_max, ::mlir::Value gradients, ::mlir::Value inputs, ::mlir::Value min, ::mlir::Value max, /*optional*/uint64_t num_bits = 8, /*optional*/bool narrow_range = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value gradients, ::mlir::Value inputs, ::mlir::Value min, ::mlir::Value max, /*optional*/uint64_t num_bits = 8, /*optional*/bool narrow_range = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::FakeQuantWithMinMaxVarsGradientOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::FakeQuantWithMinMaxVarsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FakeQuantWithMinMaxVarsOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FakeQuantWithMinMaxVarsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FakeQuantWithMinMaxVarsOpGenericAdaptorBase(FakeQuantWithMinMaxVarsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getNumBitsAttr(); + uint64_t getNumBits(); + ::mlir::BoolAttr getNarrowRangeAttr(); + bool getNarrowRange(); +}; +} // namespace detail +template +class FakeQuantWithMinMaxVarsOpGenericAdaptor : public detail::FakeQuantWithMinMaxVarsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FakeQuantWithMinMaxVarsOpGenericAdaptorBase; +public: + FakeQuantWithMinMaxVarsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FakeQuantWithMinMaxVarsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FakeQuantWithMinMaxVarsOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FakeQuantWithMinMaxVarsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputs() { + return (*getODSOperands(0).begin()); + } + + ValueT getMin() { + return (*getODSOperands(1).begin()); + } + + ValueT getMax() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FakeQuantWithMinMaxVarsOpAdaptor : public FakeQuantWithMinMaxVarsOpGenericAdaptor<::mlir::ValueRange> { +public: + using FakeQuantWithMinMaxVarsOpGenericAdaptor::FakeQuantWithMinMaxVarsOpGenericAdaptor; + FakeQuantWithMinMaxVarsOpAdaptor(FakeQuantWithMinMaxVarsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FakeQuantWithMinMaxVarsOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FakeQuantWithMinMaxVarsOpAdaptor; + template + using GenericAdaptor = FakeQuantWithMinMaxVarsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("narrow_range"), ::llvm::StringRef("num_bits")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNarrowRangeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNarrowRangeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumBitsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumBitsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.FakeQuantWithMinMaxVars"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputs(); + ::mlir::TypedValue<::mlir::TensorType> getMin(); + ::mlir::TypedValue<::mlir::TensorType> getMax(); + ::mlir::OpOperand &getInputsMutable(); + ::mlir::OpOperand &getMinMutable(); + ::mlir::OpOperand &getMaxMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutputs(); + ::mlir::IntegerAttr getNumBitsAttr(); + uint64_t getNumBits(); + ::mlir::BoolAttr getNarrowRangeAttr(); + bool getNarrowRange(); + void setNumBitsAttr(::mlir::IntegerAttr attr); + void setNumBits(::std::optional attrValue); + void setNarrowRangeAttr(::mlir::BoolAttr attr); + void setNarrowRange(::std::optional attrValue); + ::mlir::Attribute removeNumBitsAttr(); + ::mlir::Attribute removeNarrowRangeAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type outputs, ::mlir::Value inputs, ::mlir::Value min, ::mlir::Value max, /*optional*/::mlir::IntegerAttr num_bits, /*optional*/::mlir::BoolAttr narrow_range); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inputs, ::mlir::Value min, ::mlir::Value max, /*optional*/::mlir::IntegerAttr num_bits, /*optional*/::mlir::BoolAttr narrow_range); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type outputs, ::mlir::Value inputs, ::mlir::Value min, ::mlir::Value max, /*optional*/uint64_t num_bits = 8, /*optional*/bool narrow_range = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inputs, ::mlir::Value min, ::mlir::Value max, /*optional*/uint64_t num_bits = 8, /*optional*/bool narrow_range = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::FakeQuantWithMinMaxVarsOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::FakeQuantWithMinMaxVarsPerChannelGradientOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FakeQuantWithMinMaxVarsPerChannelGradientOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FakeQuantWithMinMaxVarsPerChannelGradientOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FakeQuantWithMinMaxVarsPerChannelGradientOpGenericAdaptorBase(FakeQuantWithMinMaxVarsPerChannelGradientOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getNumBitsAttr(); + uint64_t getNumBits(); + ::mlir::BoolAttr getNarrowRangeAttr(); + bool getNarrowRange(); +}; +} // namespace detail +template +class FakeQuantWithMinMaxVarsPerChannelGradientOpGenericAdaptor : public detail::FakeQuantWithMinMaxVarsPerChannelGradientOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FakeQuantWithMinMaxVarsPerChannelGradientOpGenericAdaptorBase; +public: + FakeQuantWithMinMaxVarsPerChannelGradientOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FakeQuantWithMinMaxVarsPerChannelGradientOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FakeQuantWithMinMaxVarsPerChannelGradientOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FakeQuantWithMinMaxVarsPerChannelGradientOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getGradients() { + return (*getODSOperands(0).begin()); + } + + ValueT getInputs() { + return (*getODSOperands(1).begin()); + } + + ValueT getMin() { + return (*getODSOperands(2).begin()); + } + + ValueT getMax() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FakeQuantWithMinMaxVarsPerChannelGradientOpAdaptor : public FakeQuantWithMinMaxVarsPerChannelGradientOpGenericAdaptor<::mlir::ValueRange> { +public: + using FakeQuantWithMinMaxVarsPerChannelGradientOpGenericAdaptor::FakeQuantWithMinMaxVarsPerChannelGradientOpGenericAdaptor; + FakeQuantWithMinMaxVarsPerChannelGradientOpAdaptor(FakeQuantWithMinMaxVarsPerChannelGradientOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FakeQuantWithMinMaxVarsPerChannelGradientOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FakeQuantWithMinMaxVarsPerChannelGradientOpAdaptor; + template + using GenericAdaptor = FakeQuantWithMinMaxVarsPerChannelGradientOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("narrow_range"), ::llvm::StringRef("num_bits")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNarrowRangeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNarrowRangeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumBitsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumBitsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.FakeQuantWithMinMaxVarsPerChannelGradient"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getGradients(); + ::mlir::TypedValue<::mlir::TensorType> getInputs(); + ::mlir::TypedValue<::mlir::TensorType> getMin(); + ::mlir::TypedValue<::mlir::TensorType> getMax(); + ::mlir::OpOperand &getGradientsMutable(); + ::mlir::OpOperand &getInputsMutable(); + ::mlir::OpOperand &getMinMutable(); + ::mlir::OpOperand &getMaxMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getBackpropsWrtInput(); + ::mlir::TypedValue<::mlir::TensorType> getBackpropWrtMin(); + ::mlir::TypedValue<::mlir::TensorType> getBackpropWrtMax(); + ::mlir::IntegerAttr getNumBitsAttr(); + uint64_t getNumBits(); + ::mlir::BoolAttr getNarrowRangeAttr(); + bool getNarrowRange(); + void setNumBitsAttr(::mlir::IntegerAttr attr); + void setNumBits(::std::optional attrValue); + void setNarrowRangeAttr(::mlir::BoolAttr attr); + void setNarrowRange(::std::optional attrValue); + ::mlir::Attribute removeNumBitsAttr(); + ::mlir::Attribute removeNarrowRangeAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type backprops_wrt_input, ::mlir::Type backprop_wrt_min, ::mlir::Type backprop_wrt_max, ::mlir::Value gradients, ::mlir::Value inputs, ::mlir::Value min, ::mlir::Value max, /*optional*/::mlir::IntegerAttr num_bits, /*optional*/::mlir::BoolAttr narrow_range); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value gradients, ::mlir::Value inputs, ::mlir::Value min, ::mlir::Value max, /*optional*/::mlir::IntegerAttr num_bits, /*optional*/::mlir::BoolAttr narrow_range); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type backprops_wrt_input, ::mlir::Type backprop_wrt_min, ::mlir::Type backprop_wrt_max, ::mlir::Value gradients, ::mlir::Value inputs, ::mlir::Value min, ::mlir::Value max, /*optional*/uint64_t num_bits = 8, /*optional*/bool narrow_range = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value gradients, ::mlir::Value inputs, ::mlir::Value min, ::mlir::Value max, /*optional*/uint64_t num_bits = 8, /*optional*/bool narrow_range = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::FakeQuantWithMinMaxVarsPerChannelGradientOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::FakeQuantWithMinMaxVarsPerChannelOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FakeQuantWithMinMaxVarsPerChannelOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FakeQuantWithMinMaxVarsPerChannelOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FakeQuantWithMinMaxVarsPerChannelOpGenericAdaptorBase(FakeQuantWithMinMaxVarsPerChannelOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getNumBitsAttr(); + uint64_t getNumBits(); + ::mlir::BoolAttr getNarrowRangeAttr(); + bool getNarrowRange(); +}; +} // namespace detail +template +class FakeQuantWithMinMaxVarsPerChannelOpGenericAdaptor : public detail::FakeQuantWithMinMaxVarsPerChannelOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FakeQuantWithMinMaxVarsPerChannelOpGenericAdaptorBase; +public: + FakeQuantWithMinMaxVarsPerChannelOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FakeQuantWithMinMaxVarsPerChannelOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FakeQuantWithMinMaxVarsPerChannelOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FakeQuantWithMinMaxVarsPerChannelOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputs() { + return (*getODSOperands(0).begin()); + } + + ValueT getMin() { + return (*getODSOperands(1).begin()); + } + + ValueT getMax() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FakeQuantWithMinMaxVarsPerChannelOpAdaptor : public FakeQuantWithMinMaxVarsPerChannelOpGenericAdaptor<::mlir::ValueRange> { +public: + using FakeQuantWithMinMaxVarsPerChannelOpGenericAdaptor::FakeQuantWithMinMaxVarsPerChannelOpGenericAdaptor; + FakeQuantWithMinMaxVarsPerChannelOpAdaptor(FakeQuantWithMinMaxVarsPerChannelOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FakeQuantWithMinMaxVarsPerChannelOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FakeQuantWithMinMaxVarsPerChannelOpAdaptor; + template + using GenericAdaptor = FakeQuantWithMinMaxVarsPerChannelOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("narrow_range"), ::llvm::StringRef("num_bits")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNarrowRangeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNarrowRangeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumBitsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumBitsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.FakeQuantWithMinMaxVarsPerChannel"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputs(); + ::mlir::TypedValue<::mlir::TensorType> getMin(); + ::mlir::TypedValue<::mlir::TensorType> getMax(); + ::mlir::OpOperand &getInputsMutable(); + ::mlir::OpOperand &getMinMutable(); + ::mlir::OpOperand &getMaxMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutputs(); + ::mlir::IntegerAttr getNumBitsAttr(); + uint64_t getNumBits(); + ::mlir::BoolAttr getNarrowRangeAttr(); + bool getNarrowRange(); + void setNumBitsAttr(::mlir::IntegerAttr attr); + void setNumBits(::std::optional attrValue); + void setNarrowRangeAttr(::mlir::BoolAttr attr); + void setNarrowRange(::std::optional attrValue); + ::mlir::Attribute removeNumBitsAttr(); + ::mlir::Attribute removeNarrowRangeAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type outputs, ::mlir::Value inputs, ::mlir::Value min, ::mlir::Value max, /*optional*/::mlir::IntegerAttr num_bits, /*optional*/::mlir::BoolAttr narrow_range); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inputs, ::mlir::Value min, ::mlir::Value max, /*optional*/::mlir::IntegerAttr num_bits, /*optional*/::mlir::BoolAttr narrow_range); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type outputs, ::mlir::Value inputs, ::mlir::Value min, ::mlir::Value max, /*optional*/uint64_t num_bits = 8, /*optional*/bool narrow_range = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inputs, ::mlir::Value min, ::mlir::Value max, /*optional*/uint64_t num_bits = 8, /*optional*/bool narrow_range = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::FakeQuantWithMinMaxVarsPerChannelOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::FillOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FillOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FillOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FillOpGenericAdaptorBase(FillOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class FillOpGenericAdaptor : public detail::FillOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FillOpGenericAdaptorBase; +public: + FillOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FillOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FillOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FillOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getDims() { + return (*getODSOperands(0).begin()); + } + + ValueT getValue() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FillOpAdaptor : public FillOpGenericAdaptor<::mlir::ValueRange> { +public: + using FillOpGenericAdaptor::FillOpGenericAdaptor; + FillOpAdaptor(FillOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FillOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FillOpAdaptor; + template + using GenericAdaptor = FillOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("index_type")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getIndexTypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getIndexTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Fill"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getDims(); + ::mlir::TypedValue<::mlir::TensorType> getValue(); + ::mlir::OpOperand &getDimsMutable(); + ::mlir::OpOperand &getValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getIndexType(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value dims, Value value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value dims, ::mlir::Value value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value dims, ::mlir::Value value); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::FillOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::FinalizeDatasetOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FinalizeDatasetOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FinalizeDatasetOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FinalizeDatasetOpGenericAdaptorBase(FinalizeDatasetOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getHasCapturedRefAttr(); + bool getHasCapturedRef(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); +}; +} // namespace detail +template +class FinalizeDatasetOpGenericAdaptor : public detail::FinalizeDatasetOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FinalizeDatasetOpGenericAdaptorBase; +public: + FinalizeDatasetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FinalizeDatasetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FinalizeDatasetOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FinalizeDatasetOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputDataset() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FinalizeDatasetOpAdaptor : public FinalizeDatasetOpGenericAdaptor<::mlir::ValueRange> { +public: + using FinalizeDatasetOpGenericAdaptor::FinalizeDatasetOpGenericAdaptor; + FinalizeDatasetOpAdaptor(FinalizeDatasetOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FinalizeDatasetOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FinalizeDatasetOpAdaptor; + template + using GenericAdaptor = FinalizeDatasetOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("has_captured_ref"), ::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getHasCapturedRefAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getHasCapturedRefAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.FinalizeDataset"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputDataset(); + ::mlir::OpOperand &getInputDatasetMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::BoolAttr getHasCapturedRefAttr(); + bool getHasCapturedRef(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + void setHasCapturedRefAttr(::mlir::BoolAttr attr); + void setHasCapturedRef(::std::optional attrValue); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeHasCapturedRefAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, /*optional*/::mlir::BoolAttr has_captured_ref, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, /*optional*/::mlir::BoolAttr has_captured_ref, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, /*optional*/bool has_captured_ref, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, /*optional*/bool has_captured_ref, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::FinalizeDatasetOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::FinalizeTPUEmbeddingOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FinalizeTPUEmbeddingOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FinalizeTPUEmbeddingOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FinalizeTPUEmbeddingOpGenericAdaptorBase(FinalizeTPUEmbeddingOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class FinalizeTPUEmbeddingOpGenericAdaptor : public detail::FinalizeTPUEmbeddingOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FinalizeTPUEmbeddingOpGenericAdaptorBase; +public: + FinalizeTPUEmbeddingOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FinalizeTPUEmbeddingOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FinalizeTPUEmbeddingOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FinalizeTPUEmbeddingOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getCommonConfig() { + return (*getODSOperands(0).begin()); + } + + ValueT getMemoryConfig() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FinalizeTPUEmbeddingOpAdaptor : public FinalizeTPUEmbeddingOpGenericAdaptor<::mlir::ValueRange> { +public: + using FinalizeTPUEmbeddingOpGenericAdaptor::FinalizeTPUEmbeddingOpGenericAdaptor; + FinalizeTPUEmbeddingOpAdaptor(FinalizeTPUEmbeddingOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FinalizeTPUEmbeddingOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = FinalizeTPUEmbeddingOpAdaptor; + template + using GenericAdaptor = FinalizeTPUEmbeddingOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.FinalizeTPUEmbedding"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getCommonConfig(); + ::mlir::TypedValue<::mlir::TensorType> getMemoryConfig(); + ::mlir::OpOperand &getCommonConfigMutable(); + ::mlir::OpOperand &getMemoryConfigMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value common_config, ::mlir::Value memory_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value common_config, ::mlir::Value memory_config); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::FinalizeTPUEmbeddingOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::FlatMapDatasetOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FlatMapDatasetOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FlatMapDatasetOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FlatMapDatasetOpGenericAdaptorBase(FlatMapDatasetOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::SymbolRefAttr getFAttr(); + ::mlir::SymbolRefAttr getF(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); +}; +} // namespace detail +template +class FlatMapDatasetOpGenericAdaptor : public detail::FlatMapDatasetOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FlatMapDatasetOpGenericAdaptorBase; +public: + FlatMapDatasetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FlatMapDatasetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FlatMapDatasetOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FlatMapDatasetOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputDataset() { + return (*getODSOperands(0).begin()); + } + + RangeT getOtherArguments() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FlatMapDatasetOpAdaptor : public FlatMapDatasetOpGenericAdaptor<::mlir::ValueRange> { +public: + using FlatMapDatasetOpGenericAdaptor::FlatMapDatasetOpGenericAdaptor; + FlatMapDatasetOpAdaptor(FlatMapDatasetOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FlatMapDatasetOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FlatMapDatasetOpAdaptor; + template + using GenericAdaptor = FlatMapDatasetOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Targuments"), ::llvm::StringRef("f"), ::llvm::StringRef("metadata"), ::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTargumentsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTargumentsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getFAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getFAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getMetadataAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getMetadataAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.FlatMapDataset"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputDataset(); + ::mlir::Operation::operand_range getOtherArguments(); + ::mlir::OpOperand &getInputDatasetMutable(); + ::mlir::MutableOperandRange getOtherArgumentsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::SymbolRefAttr getFAttr(); + ::mlir::SymbolRefAttr getF(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); + mlir::OperandElementTypeRange getTarguments(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setFAttr(::mlir::SymbolRefAttr attr); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + void setMetadataAttr(::mlir::StringAttr attr); + void setMetadata(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeMetadataAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, ::mlir::ValueRange other_arguments, ::mlir::SymbolRefAttr f, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, ::mlir::ValueRange other_arguments, ::mlir::SymbolRefAttr f, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, ::mlir::ValueRange other_arguments, ::mlir::SymbolRefAttr f, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::llvm::StringRef metadata = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, ::mlir::ValueRange other_arguments, ::mlir::SymbolRefAttr f, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::llvm::StringRef metadata = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::FlatMapDatasetOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::FloorDivOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FloorDivOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FloorDivOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FloorDivOpGenericAdaptorBase(FloorDivOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class FloorDivOpGenericAdaptor : public detail::FloorDivOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FloorDivOpGenericAdaptorBase; +public: + FloorDivOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FloorDivOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FloorDivOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FloorDivOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FloorDivOpAdaptor : public FloorDivOpGenericAdaptor<::mlir::ValueRange> { +public: + using FloorDivOpGenericAdaptor::FloorDivOpGenericAdaptor; + FloorDivOpAdaptor(FloorDivOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FloorDivOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FloorDivOpAdaptor; + template + using GenericAdaptor = FloorDivOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.FloorDiv"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::FloorDivOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::FloorModOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FloorModOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FloorModOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FloorModOpGenericAdaptorBase(FloorModOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class FloorModOpGenericAdaptor : public detail::FloorModOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FloorModOpGenericAdaptorBase; +public: + FloorModOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FloorModOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FloorModOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FloorModOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FloorModOpAdaptor : public FloorModOpGenericAdaptor<::mlir::ValueRange> { +public: + using FloorModOpGenericAdaptor::FloorModOpGenericAdaptor; + FloorModOpAdaptor(FloorModOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FloorModOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::OpTrait::TF::SameOperandsAndResultElementTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FloorModOpAdaptor; + template + using GenericAdaptor = FloorModOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.FloorMod"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::FloorModOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::FloorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FloorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FloorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FloorOpGenericAdaptorBase(FloorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class FloorOpGenericAdaptor : public detail::FloorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FloorOpGenericAdaptorBase; +public: + FloorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FloorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FloorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FloorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FloorOpAdaptor : public FloorOpGenericAdaptor<::mlir::ValueRange> { +public: + using FloorOpGenericAdaptor::FloorOpGenericAdaptor; + FloorOpAdaptor(FloorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FloorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::IsIdempotent, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FloorOpAdaptor; + template + using GenericAdaptor = FloorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Floor"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::FloorOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::FlushSummaryWriterOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FlushSummaryWriterOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FlushSummaryWriterOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FlushSummaryWriterOpGenericAdaptorBase(FlushSummaryWriterOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class FlushSummaryWriterOpGenericAdaptor : public detail::FlushSummaryWriterOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FlushSummaryWriterOpGenericAdaptorBase; +public: + FlushSummaryWriterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FlushSummaryWriterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FlushSummaryWriterOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FlushSummaryWriterOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getWriter() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FlushSummaryWriterOpAdaptor : public FlushSummaryWriterOpGenericAdaptor<::mlir::ValueRange> { +public: + using FlushSummaryWriterOpGenericAdaptor::FlushSummaryWriterOpGenericAdaptor; + FlushSummaryWriterOpAdaptor(FlushSummaryWriterOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FlushSummaryWriterOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = FlushSummaryWriterOpAdaptor; + template + using GenericAdaptor = FlushSummaryWriterOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.FlushSummaryWriter"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getWriter(); + ::mlir::OpOperand &getWriterMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value writer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value writer); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::FlushSummaryWriterOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::FusedBatchNormGradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FusedBatchNormGradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FusedBatchNormGradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FusedBatchNormGradOpGenericAdaptorBase(FusedBatchNormGradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::BoolAttr getIsTrainingAttr(); + bool getIsTraining(); +}; +} // namespace detail +template +class FusedBatchNormGradOpGenericAdaptor : public detail::FusedBatchNormGradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FusedBatchNormGradOpGenericAdaptorBase; +public: + FusedBatchNormGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FusedBatchNormGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FusedBatchNormGradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FusedBatchNormGradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getYBackprop() { + return (*getODSOperands(0).begin()); + } + + ValueT getX() { + return (*getODSOperands(1).begin()); + } + + ValueT getScale() { + return (*getODSOperands(2).begin()); + } + + ValueT getReserveSpace_1() { + return (*getODSOperands(3).begin()); + } + + ValueT getReserveSpace_2() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FusedBatchNormGradOpAdaptor : public FusedBatchNormGradOpGenericAdaptor<::mlir::ValueRange> { +public: + using FusedBatchNormGradOpGenericAdaptor::FusedBatchNormGradOpGenericAdaptor; + FusedBatchNormGradOpAdaptor(FusedBatchNormGradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FusedBatchNormGradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<5>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FusedBatchNormGradOpAdaptor; + template + using GenericAdaptor = FusedBatchNormGradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("data_format"), ::llvm::StringRef("epsilon"), ::llvm::StringRef("is_training")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getEpsilonAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getEpsilonAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getIsTrainingAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getIsTrainingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.FusedBatchNormGrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getYBackprop(); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getScale(); + ::mlir::TypedValue<::mlir::TensorType> getReserveSpace_1(); + ::mlir::TypedValue<::mlir::TensorType> getReserveSpace_2(); + ::mlir::OpOperand &getYBackpropMutable(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getScaleMutable(); + ::mlir::OpOperand &getReserveSpace_1Mutable(); + ::mlir::OpOperand &getReserveSpace_2Mutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getXBackprop(); + ::mlir::TypedValue<::mlir::TensorType> getScaleBackprop(); + ::mlir::TypedValue<::mlir::TensorType> getOffsetBackprop(); + ::mlir::TypedValue<::mlir::TensorType> getReserveSpace_3(); + ::mlir::TypedValue<::mlir::TensorType> getReserveSpace_4(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::BoolAttr getIsTrainingAttr(); + bool getIsTraining(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setEpsilonAttr(::mlir::FloatAttr attr); + void setEpsilon(::std::optional<::llvm::APFloat> attrValue); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + void setIsTrainingAttr(::mlir::BoolAttr attr); + void setIsTraining(::std::optional attrValue); + ::mlir::Attribute removeEpsilonAttr(); + ::mlir::Attribute removeDataFormatAttr(); + ::mlir::Attribute removeIsTrainingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type x_backprop, ::mlir::Type scale_backprop, ::mlir::Type offset_backprop, ::mlir::Type reserve_space_3, ::mlir::Type reserve_space_4, ::mlir::Value y_backprop, ::mlir::Value x, ::mlir::Value scale, ::mlir::Value reserve_space_1, ::mlir::Value reserve_space_2, /*optional*/::mlir::FloatAttr epsilon, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::BoolAttr is_training); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value y_backprop, ::mlir::Value x, ::mlir::Value scale, ::mlir::Value reserve_space_1, ::mlir::Value reserve_space_2, /*optional*/::mlir::FloatAttr epsilon, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::BoolAttr is_training); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type x_backprop, ::mlir::Type scale_backprop, ::mlir::Type offset_backprop, ::mlir::Type reserve_space_3, ::mlir::Type reserve_space_4, ::mlir::Value y_backprop, ::mlir::Value x, ::mlir::Value scale, ::mlir::Value reserve_space_1, ::mlir::Value reserve_space_2, /*optional*/::llvm::APFloat epsilon, /*optional*/::llvm::StringRef data_format = "NHWC", /*optional*/bool is_training = true); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value y_backprop, ::mlir::Value x, ::mlir::Value scale, ::mlir::Value reserve_space_1, ::mlir::Value reserve_space_2, /*optional*/::llvm::APFloat epsilon, /*optional*/::llvm::StringRef data_format = "NHWC", /*optional*/bool is_training = true); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::FusedBatchNormGradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::FusedBatchNormGradV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FusedBatchNormGradV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FusedBatchNormGradV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FusedBatchNormGradV2OpGenericAdaptorBase(FusedBatchNormGradV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::BoolAttr getIsTrainingAttr(); + bool getIsTraining(); +}; +} // namespace detail +template +class FusedBatchNormGradV2OpGenericAdaptor : public detail::FusedBatchNormGradV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FusedBatchNormGradV2OpGenericAdaptorBase; +public: + FusedBatchNormGradV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FusedBatchNormGradV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FusedBatchNormGradV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FusedBatchNormGradV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getYBackprop() { + return (*getODSOperands(0).begin()); + } + + ValueT getX() { + return (*getODSOperands(1).begin()); + } + + ValueT getScale() { + return (*getODSOperands(2).begin()); + } + + ValueT getReserveSpace_1() { + return (*getODSOperands(3).begin()); + } + + ValueT getReserveSpace_2() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FusedBatchNormGradV2OpAdaptor : public FusedBatchNormGradV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using FusedBatchNormGradV2OpGenericAdaptor::FusedBatchNormGradV2OpGenericAdaptor; + FusedBatchNormGradV2OpAdaptor(FusedBatchNormGradV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FusedBatchNormGradV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<5>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FusedBatchNormGradV2OpAdaptor; + template + using GenericAdaptor = FusedBatchNormGradV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("U"), ::llvm::StringRef("data_format"), ::llvm::StringRef("epsilon"), ::llvm::StringRef("is_training")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getUAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getUAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getEpsilonAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getEpsilonAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getIsTrainingAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getIsTrainingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.FusedBatchNormGradV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getYBackprop(); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getScale(); + ::mlir::TypedValue<::mlir::TensorType> getReserveSpace_1(); + ::mlir::TypedValue<::mlir::TensorType> getReserveSpace_2(); + ::mlir::OpOperand &getYBackpropMutable(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getScaleMutable(); + ::mlir::OpOperand &getReserveSpace_1Mutable(); + ::mlir::OpOperand &getReserveSpace_2Mutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getXBackprop(); + ::mlir::TypedValue<::mlir::TensorType> getScaleBackprop(); + ::mlir::TypedValue<::mlir::TensorType> getOffsetBackprop(); + ::mlir::TypedValue<::mlir::TensorType> getReserveSpace_3(); + ::mlir::TypedValue<::mlir::TensorType> getReserveSpace_4(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::BoolAttr getIsTrainingAttr(); + bool getIsTraining(); + ::mlir::Type getT(); + ::mlir::Type getU(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setEpsilonAttr(::mlir::FloatAttr attr); + void setEpsilon(::std::optional<::llvm::APFloat> attrValue); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + void setIsTrainingAttr(::mlir::BoolAttr attr); + void setIsTraining(::std::optional attrValue); + ::mlir::Attribute removeEpsilonAttr(); + ::mlir::Attribute removeDataFormatAttr(); + ::mlir::Attribute removeIsTrainingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type x_backprop, ::mlir::Type scale_backprop, ::mlir::Type offset_backprop, ::mlir::Type reserve_space_3, ::mlir::Type reserve_space_4, ::mlir::Value y_backprop, ::mlir::Value x, ::mlir::Value scale, ::mlir::Value reserve_space_1, ::mlir::Value reserve_space_2, /*optional*/::mlir::FloatAttr epsilon, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::BoolAttr is_training); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value y_backprop, ::mlir::Value x, ::mlir::Value scale, ::mlir::Value reserve_space_1, ::mlir::Value reserve_space_2, /*optional*/::mlir::FloatAttr epsilon, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::BoolAttr is_training); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type x_backprop, ::mlir::Type scale_backprop, ::mlir::Type offset_backprop, ::mlir::Type reserve_space_3, ::mlir::Type reserve_space_4, ::mlir::Value y_backprop, ::mlir::Value x, ::mlir::Value scale, ::mlir::Value reserve_space_1, ::mlir::Value reserve_space_2, /*optional*/::llvm::APFloat epsilon, /*optional*/::llvm::StringRef data_format = "NHWC", /*optional*/bool is_training = true); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value y_backprop, ::mlir::Value x, ::mlir::Value scale, ::mlir::Value reserve_space_1, ::mlir::Value reserve_space_2, /*optional*/::llvm::APFloat epsilon, /*optional*/::llvm::StringRef data_format = "NHWC", /*optional*/bool is_training = true); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::FusedBatchNormGradV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::FusedBatchNormGradV3Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FusedBatchNormGradV3OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FusedBatchNormGradV3OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FusedBatchNormGradV3OpGenericAdaptorBase(FusedBatchNormGradV3Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::BoolAttr getIsTrainingAttr(); + bool getIsTraining(); +}; +} // namespace detail +template +class FusedBatchNormGradV3OpGenericAdaptor : public detail::FusedBatchNormGradV3OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FusedBatchNormGradV3OpGenericAdaptorBase; +public: + FusedBatchNormGradV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FusedBatchNormGradV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FusedBatchNormGradV3OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FusedBatchNormGradV3OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getYBackprop() { + return (*getODSOperands(0).begin()); + } + + ValueT getX() { + return (*getODSOperands(1).begin()); + } + + ValueT getScale() { + return (*getODSOperands(2).begin()); + } + + ValueT getReserveSpace_1() { + return (*getODSOperands(3).begin()); + } + + ValueT getReserveSpace_2() { + return (*getODSOperands(4).begin()); + } + + ValueT getReserveSpace_3() { + return (*getODSOperands(5).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FusedBatchNormGradV3OpAdaptor : public FusedBatchNormGradV3OpGenericAdaptor<::mlir::ValueRange> { +public: + using FusedBatchNormGradV3OpGenericAdaptor::FusedBatchNormGradV3OpGenericAdaptor; + FusedBatchNormGradV3OpAdaptor(FusedBatchNormGradV3Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FusedBatchNormGradV3Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<6>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, LayoutSensitiveInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FusedBatchNormGradV3OpAdaptor; + template + using GenericAdaptor = FusedBatchNormGradV3OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("U"), ::llvm::StringRef("data_format"), ::llvm::StringRef("epsilon"), ::llvm::StringRef("is_training")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getUAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getUAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getEpsilonAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getEpsilonAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getIsTrainingAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getIsTrainingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.FusedBatchNormGradV3"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getYBackprop(); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getScale(); + ::mlir::TypedValue<::mlir::TensorType> getReserveSpace_1(); + ::mlir::TypedValue<::mlir::TensorType> getReserveSpace_2(); + ::mlir::TypedValue<::mlir::TensorType> getReserveSpace_3(); + ::mlir::OpOperand &getYBackpropMutable(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getScaleMutable(); + ::mlir::OpOperand &getReserveSpace_1Mutable(); + ::mlir::OpOperand &getReserveSpace_2Mutable(); + ::mlir::OpOperand &getReserveSpace_3Mutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getXBackprop(); + ::mlir::TypedValue<::mlir::TensorType> getScaleBackprop(); + ::mlir::TypedValue<::mlir::TensorType> getOffsetBackprop(); + ::mlir::TypedValue<::mlir::TensorType> getReserveSpace_4(); + ::mlir::TypedValue<::mlir::TensorType> getReserveSpace_5(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::BoolAttr getIsTrainingAttr(); + bool getIsTraining(); + ::mlir::Type getT(); + ::mlir::Type getU(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setEpsilonAttr(::mlir::FloatAttr attr); + void setEpsilon(::std::optional<::llvm::APFloat> attrValue); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + void setIsTrainingAttr(::mlir::BoolAttr attr); + void setIsTraining(::std::optional attrValue); + ::mlir::Attribute removeEpsilonAttr(); + ::mlir::Attribute removeDataFormatAttr(); + ::mlir::Attribute removeIsTrainingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type x_backprop, ::mlir::Type scale_backprop, ::mlir::Type offset_backprop, ::mlir::Type reserve_space_4, ::mlir::Type reserve_space_5, ::mlir::Value y_backprop, ::mlir::Value x, ::mlir::Value scale, ::mlir::Value reserve_space_1, ::mlir::Value reserve_space_2, ::mlir::Value reserve_space_3, /*optional*/::mlir::FloatAttr epsilon, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::BoolAttr is_training); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value y_backprop, ::mlir::Value x, ::mlir::Value scale, ::mlir::Value reserve_space_1, ::mlir::Value reserve_space_2, ::mlir::Value reserve_space_3, /*optional*/::mlir::FloatAttr epsilon, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::BoolAttr is_training); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type x_backprop, ::mlir::Type scale_backprop, ::mlir::Type offset_backprop, ::mlir::Type reserve_space_4, ::mlir::Type reserve_space_5, ::mlir::Value y_backprop, ::mlir::Value x, ::mlir::Value scale, ::mlir::Value reserve_space_1, ::mlir::Value reserve_space_2, ::mlir::Value reserve_space_3, /*optional*/::llvm::APFloat epsilon, /*optional*/::llvm::StringRef data_format = "NHWC", /*optional*/bool is_training = true); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value y_backprop, ::mlir::Value x, ::mlir::Value scale, ::mlir::Value reserve_space_1, ::mlir::Value reserve_space_2, ::mlir::Value reserve_space_3, /*optional*/::llvm::APFloat epsilon, /*optional*/::llvm::StringRef data_format = "NHWC", /*optional*/bool is_training = true); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // TF_LayoutSensitiveInterface: + SmallVector GetLayoutDependentArgs() { return {0, 1}; } + SmallVector GetLayoutDependentResults() { return {0}; } + StringRef GetOptimalLayout(const RuntimeDevices& devices); + LogicalResult UpdateDataFormat(StringRef data_format); +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::FusedBatchNormGradV3Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::FusedBatchNormOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FusedBatchNormOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FusedBatchNormOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FusedBatchNormOpGenericAdaptorBase(FusedBatchNormOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::FloatAttr getExponentialAvgFactorAttr(); + ::llvm::APFloat getExponentialAvgFactor(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::BoolAttr getIsTrainingAttr(); + bool getIsTraining(); +}; +} // namespace detail +template +class FusedBatchNormOpGenericAdaptor : public detail::FusedBatchNormOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FusedBatchNormOpGenericAdaptorBase; +public: + FusedBatchNormOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FusedBatchNormOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FusedBatchNormOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FusedBatchNormOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getScale() { + return (*getODSOperands(1).begin()); + } + + ValueT getOffset() { + return (*getODSOperands(2).begin()); + } + + ValueT getMean() { + return (*getODSOperands(3).begin()); + } + + ValueT getVariance() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FusedBatchNormOpAdaptor : public FusedBatchNormOpGenericAdaptor<::mlir::ValueRange> { +public: + using FusedBatchNormOpGenericAdaptor::FusedBatchNormOpGenericAdaptor; + FusedBatchNormOpAdaptor(FusedBatchNormOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FusedBatchNormOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<5>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FusedBatchNormOpAdaptor; + template + using GenericAdaptor = FusedBatchNormOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("data_format"), ::llvm::StringRef("epsilon"), ::llvm::StringRef("exponential_avg_factor"), ::llvm::StringRef("is_training")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getEpsilonAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getEpsilonAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getExponentialAvgFactorAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getExponentialAvgFactorAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getIsTrainingAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getIsTrainingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.FusedBatchNorm"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getScale(); + ::mlir::TypedValue<::mlir::TensorType> getOffset(); + ::mlir::TypedValue<::mlir::TensorType> getMean(); + ::mlir::TypedValue<::mlir::TensorType> getVariance(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getScaleMutable(); + ::mlir::OpOperand &getOffsetMutable(); + ::mlir::OpOperand &getMeanMutable(); + ::mlir::OpOperand &getVarianceMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::TypedValue<::mlir::TensorType> getBatchMean(); + ::mlir::TypedValue<::mlir::TensorType> getBatchVariance(); + ::mlir::TypedValue<::mlir::TensorType> getReserveSpace_1(); + ::mlir::TypedValue<::mlir::TensorType> getReserveSpace_2(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::FloatAttr getExponentialAvgFactorAttr(); + ::llvm::APFloat getExponentialAvgFactor(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::BoolAttr getIsTrainingAttr(); + bool getIsTraining(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setEpsilonAttr(::mlir::FloatAttr attr); + void setEpsilon(::std::optional<::llvm::APFloat> attrValue); + void setExponentialAvgFactorAttr(::mlir::FloatAttr attr); + void setExponentialAvgFactor(::std::optional<::llvm::APFloat> attrValue); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + void setIsTrainingAttr(::mlir::BoolAttr attr); + void setIsTraining(::std::optional attrValue); + ::mlir::Attribute removeEpsilonAttr(); + ::mlir::Attribute removeExponentialAvgFactorAttr(); + ::mlir::Attribute removeDataFormatAttr(); + ::mlir::Attribute removeIsTrainingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Type batch_mean, ::mlir::Type batch_variance, ::mlir::Type reserve_space_1, ::mlir::Type reserve_space_2, ::mlir::Value x, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value mean, ::mlir::Value variance, /*optional*/::mlir::FloatAttr epsilon, /*optional*/::mlir::FloatAttr exponential_avg_factor, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::BoolAttr is_training); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value mean, ::mlir::Value variance, /*optional*/::mlir::FloatAttr epsilon, /*optional*/::mlir::FloatAttr exponential_avg_factor, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::BoolAttr is_training); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Type batch_mean, ::mlir::Type batch_variance, ::mlir::Type reserve_space_1, ::mlir::Type reserve_space_2, ::mlir::Value x, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value mean, ::mlir::Value variance, /*optional*/::llvm::APFloat epsilon, /*optional*/::llvm::APFloat exponential_avg_factor, /*optional*/::llvm::StringRef data_format = "NHWC", /*optional*/bool is_training = true); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value mean, ::mlir::Value variance, /*optional*/::llvm::APFloat epsilon, /*optional*/::llvm::APFloat exponential_avg_factor, /*optional*/::llvm::StringRef data_format = "NHWC", /*optional*/bool is_training = true); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::FusedBatchNormOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::FusedBatchNormV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FusedBatchNormV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FusedBatchNormV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FusedBatchNormV2OpGenericAdaptorBase(FusedBatchNormV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::FloatAttr getExponentialAvgFactorAttr(); + ::llvm::APFloat getExponentialAvgFactor(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::BoolAttr getIsTrainingAttr(); + bool getIsTraining(); +}; +} // namespace detail +template +class FusedBatchNormV2OpGenericAdaptor : public detail::FusedBatchNormV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FusedBatchNormV2OpGenericAdaptorBase; +public: + FusedBatchNormV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FusedBatchNormV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FusedBatchNormV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FusedBatchNormV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getScale() { + return (*getODSOperands(1).begin()); + } + + ValueT getOffset() { + return (*getODSOperands(2).begin()); + } + + ValueT getMean() { + return (*getODSOperands(3).begin()); + } + + ValueT getVariance() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FusedBatchNormV2OpAdaptor : public FusedBatchNormV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using FusedBatchNormV2OpGenericAdaptor::FusedBatchNormV2OpGenericAdaptor; + FusedBatchNormV2OpAdaptor(FusedBatchNormV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FusedBatchNormV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<5>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, FoldOperandsTransposeInterface::Trait, LayoutSensitiveInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FusedBatchNormV2OpAdaptor; + template + using GenericAdaptor = FusedBatchNormV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("U"), ::llvm::StringRef("data_format"), ::llvm::StringRef("epsilon"), ::llvm::StringRef("exponential_avg_factor"), ::llvm::StringRef("is_training")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getUAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getUAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getEpsilonAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getEpsilonAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getExponentialAvgFactorAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getExponentialAvgFactorAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getIsTrainingAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getIsTrainingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.FusedBatchNormV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getScale(); + ::mlir::TypedValue<::mlir::TensorType> getOffset(); + ::mlir::TypedValue<::mlir::TensorType> getMean(); + ::mlir::TypedValue<::mlir::TensorType> getVariance(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getScaleMutable(); + ::mlir::OpOperand &getOffsetMutable(); + ::mlir::OpOperand &getMeanMutable(); + ::mlir::OpOperand &getVarianceMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::TypedValue<::mlir::TensorType> getBatchMean(); + ::mlir::TypedValue<::mlir::TensorType> getBatchVariance(); + ::mlir::TypedValue<::mlir::TensorType> getReserveSpace_1(); + ::mlir::TypedValue<::mlir::TensorType> getReserveSpace_2(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::FloatAttr getExponentialAvgFactorAttr(); + ::llvm::APFloat getExponentialAvgFactor(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::BoolAttr getIsTrainingAttr(); + bool getIsTraining(); + ::mlir::Type getT(); + ::mlir::Type getU(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setEpsilonAttr(::mlir::FloatAttr attr); + void setEpsilon(::std::optional<::llvm::APFloat> attrValue); + void setExponentialAvgFactorAttr(::mlir::FloatAttr attr); + void setExponentialAvgFactor(::std::optional<::llvm::APFloat> attrValue); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + void setIsTrainingAttr(::mlir::BoolAttr attr); + void setIsTraining(::std::optional attrValue); + ::mlir::Attribute removeEpsilonAttr(); + ::mlir::Attribute removeExponentialAvgFactorAttr(); + ::mlir::Attribute removeDataFormatAttr(); + ::mlir::Attribute removeIsTrainingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Type batch_mean, ::mlir::Type batch_variance, ::mlir::Type reserve_space_1, ::mlir::Type reserve_space_2, ::mlir::Value x, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value mean, ::mlir::Value variance, /*optional*/::mlir::FloatAttr epsilon, /*optional*/::mlir::FloatAttr exponential_avg_factor, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::BoolAttr is_training); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value mean, ::mlir::Value variance, /*optional*/::mlir::FloatAttr epsilon, /*optional*/::mlir::FloatAttr exponential_avg_factor, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::BoolAttr is_training); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Type batch_mean, ::mlir::Type batch_variance, ::mlir::Type reserve_space_1, ::mlir::Type reserve_space_2, ::mlir::Value x, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value mean, ::mlir::Value variance, /*optional*/::llvm::APFloat epsilon, /*optional*/::llvm::APFloat exponential_avg_factor, /*optional*/::llvm::StringRef data_format = "NHWC", /*optional*/bool is_training = true); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value mean, ::mlir::Value variance, /*optional*/::llvm::APFloat epsilon, /*optional*/::llvm::APFloat exponential_avg_factor, /*optional*/::llvm::StringRef data_format = "NHWC", /*optional*/bool is_training = true); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // TF_FoldOperandsTransposeInterface: + SmallVector GetLayoutDependentArgs() { return {0}; } + SmallVector GetLayoutDependentResults() { return {0}; } + LogicalResult FoldOperandsPermutation(ArrayRef permutation); + + // TF_LayoutSensitiveInterface: + StringRef GetOptimalLayout(const RuntimeDevices& devices); + LogicalResult UpdateDataFormat(StringRef data_format); +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::FusedBatchNormV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::FusedBatchNormV3Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FusedBatchNormV3OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FusedBatchNormV3OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FusedBatchNormV3OpGenericAdaptorBase(FusedBatchNormV3Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::FloatAttr getExponentialAvgFactorAttr(); + ::llvm::APFloat getExponentialAvgFactor(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::BoolAttr getIsTrainingAttr(); + bool getIsTraining(); +}; +} // namespace detail +template +class FusedBatchNormV3OpGenericAdaptor : public detail::FusedBatchNormV3OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FusedBatchNormV3OpGenericAdaptorBase; +public: + FusedBatchNormV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FusedBatchNormV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FusedBatchNormV3OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FusedBatchNormV3OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getScale() { + return (*getODSOperands(1).begin()); + } + + ValueT getOffset() { + return (*getODSOperands(2).begin()); + } + + ValueT getMean() { + return (*getODSOperands(3).begin()); + } + + ValueT getVariance() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FusedBatchNormV3OpAdaptor : public FusedBatchNormV3OpGenericAdaptor<::mlir::ValueRange> { +public: + using FusedBatchNormV3OpGenericAdaptor::FusedBatchNormV3OpGenericAdaptor; + FusedBatchNormV3OpAdaptor(FusedBatchNormV3Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FusedBatchNormV3Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<5>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, FoldOperandsTransposeInterface::Trait, LayoutSensitiveInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FusedBatchNormV3OpAdaptor; + template + using GenericAdaptor = FusedBatchNormV3OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("U"), ::llvm::StringRef("data_format"), ::llvm::StringRef("epsilon"), ::llvm::StringRef("exponential_avg_factor"), ::llvm::StringRef("is_training")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getUAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getUAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getEpsilonAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getEpsilonAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getExponentialAvgFactorAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getExponentialAvgFactorAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getIsTrainingAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getIsTrainingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.FusedBatchNormV3"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getScale(); + ::mlir::TypedValue<::mlir::TensorType> getOffset(); + ::mlir::TypedValue<::mlir::TensorType> getMean(); + ::mlir::TypedValue<::mlir::TensorType> getVariance(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getScaleMutable(); + ::mlir::OpOperand &getOffsetMutable(); + ::mlir::OpOperand &getMeanMutable(); + ::mlir::OpOperand &getVarianceMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::TypedValue<::mlir::TensorType> getBatchMean(); + ::mlir::TypedValue<::mlir::TensorType> getBatchVariance(); + ::mlir::TypedValue<::mlir::TensorType> getReserveSpace_1(); + ::mlir::TypedValue<::mlir::TensorType> getReserveSpace_2(); + ::mlir::TypedValue<::mlir::TensorType> getReserveSpace_3(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::FloatAttr getExponentialAvgFactorAttr(); + ::llvm::APFloat getExponentialAvgFactor(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::BoolAttr getIsTrainingAttr(); + bool getIsTraining(); + ::mlir::Type getT(); + ::mlir::Type getU(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setEpsilonAttr(::mlir::FloatAttr attr); + void setEpsilon(::std::optional<::llvm::APFloat> attrValue); + void setExponentialAvgFactorAttr(::mlir::FloatAttr attr); + void setExponentialAvgFactor(::std::optional<::llvm::APFloat> attrValue); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + void setIsTrainingAttr(::mlir::BoolAttr attr); + void setIsTraining(::std::optional attrValue); + ::mlir::Attribute removeEpsilonAttr(); + ::mlir::Attribute removeExponentialAvgFactorAttr(); + ::mlir::Attribute removeDataFormatAttr(); + ::mlir::Attribute removeIsTrainingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Type batch_mean, ::mlir::Type batch_variance, ::mlir::Type reserve_space_1, ::mlir::Type reserve_space_2, ::mlir::Type reserve_space_3, ::mlir::Value x, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value mean, ::mlir::Value variance, /*optional*/::mlir::FloatAttr epsilon, /*optional*/::mlir::FloatAttr exponential_avg_factor, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::BoolAttr is_training); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value mean, ::mlir::Value variance, /*optional*/::mlir::FloatAttr epsilon, /*optional*/::mlir::FloatAttr exponential_avg_factor, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::BoolAttr is_training); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Type batch_mean, ::mlir::Type batch_variance, ::mlir::Type reserve_space_1, ::mlir::Type reserve_space_2, ::mlir::Type reserve_space_3, ::mlir::Value x, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value mean, ::mlir::Value variance, /*optional*/::llvm::APFloat epsilon, /*optional*/::llvm::APFloat exponential_avg_factor, /*optional*/::llvm::StringRef data_format = "NHWC", /*optional*/bool is_training = true); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value mean, ::mlir::Value variance, /*optional*/::llvm::APFloat epsilon, /*optional*/::llvm::APFloat exponential_avg_factor, /*optional*/::llvm::StringRef data_format = "NHWC", /*optional*/bool is_training = true); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // TF_FoldOperandsTransposeInterface: + SmallVector GetLayoutDependentArgs() { return {0}; } + SmallVector GetLayoutDependentResults() { return {0}; } + LogicalResult FoldOperandsPermutation(ArrayRef permutation); + + // TF_LayoutSensitiveInterface: + StringRef GetOptimalLayout(const RuntimeDevices& devices); + LogicalResult UpdateDataFormat(StringRef data_format); +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::FusedBatchNormV3Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::GatherNdOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GatherNdOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + GatherNdOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + GatherNdOpGenericAdaptorBase(GatherNdOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class GatherNdOpGenericAdaptor : public detail::GatherNdOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GatherNdOpGenericAdaptorBase; +public: + GatherNdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GatherNdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GatherNdOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + GatherNdOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getParams() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GatherNdOpAdaptor : public GatherNdOpGenericAdaptor<::mlir::ValueRange> { +public: + using GatherNdOpGenericAdaptor::GatherNdOpGenericAdaptor; + GatherNdOpAdaptor(GatherNdOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GatherNdOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = GatherNdOpAdaptor; + template + using GenericAdaptor = GatherNdOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tindices"), ::llvm::StringRef("Tparams")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTparamsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTparamsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.GatherNd"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParams(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::OpOperand &getParamsMutable(); + ::mlir::OpOperand &getIndicesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getTindices(); + ::mlir::Type getTparams(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value params, ::mlir::Value indices); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value params, ::mlir::Value indices); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::GatherNdOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::GatherOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GatherOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + GatherOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + GatherOpGenericAdaptorBase(GatherOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getValidateIndicesAttr(); + bool getValidateIndices(); +}; +} // namespace detail +template +class GatherOpGenericAdaptor : public detail::GatherOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GatherOpGenericAdaptorBase; +public: + GatherOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GatherOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GatherOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + GatherOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getParams() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GatherOpAdaptor : public GatherOpGenericAdaptor<::mlir::ValueRange> { +public: + using GatherOpGenericAdaptor::GatherOpGenericAdaptor; + GatherOpAdaptor(GatherOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GatherOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = GatherOpAdaptor; + template + using GenericAdaptor = GatherOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tindices"), ::llvm::StringRef("Tparams"), ::llvm::StringRef("validate_indices")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTparamsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTparamsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getValidateIndicesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getValidateIndicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Gather"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParams(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::OpOperand &getParamsMutable(); + ::mlir::OpOperand &getIndicesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getValidateIndicesAttr(); + bool getValidateIndices(); + ::mlir::Type getTindices(); + ::mlir::Type getTparams(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setValidateIndicesAttr(::mlir::BoolAttr attr); + void setValidateIndices(::std::optional attrValue); + ::mlir::Attribute removeValidateIndicesAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value params, ::mlir::Value indices, /*optional*/::mlir::BoolAttr validate_indices); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value params, ::mlir::Value indices, /*optional*/::mlir::BoolAttr validate_indices); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value params, ::mlir::Value indices, /*optional*/bool validate_indices = true); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value params, ::mlir::Value indices, /*optional*/bool validate_indices = true); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::GatherOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::GatherV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GatherV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + GatherV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + GatherV2OpGenericAdaptorBase(GatherV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getBatchDimsAttr(); + uint64_t getBatchDims(); +}; +} // namespace detail +template +class GatherV2OpGenericAdaptor : public detail::GatherV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GatherV2OpGenericAdaptorBase; +public: + GatherV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GatherV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GatherV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + GatherV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getParams() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getAxis() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GatherV2OpAdaptor : public GatherV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using GatherV2OpGenericAdaptor::GatherV2OpGenericAdaptor; + GatherV2OpAdaptor(GatherV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GatherV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = GatherV2OpAdaptor; + template + using GenericAdaptor = GatherV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Taxis"), ::llvm::StringRef("Tindices"), ::llvm::StringRef("Tparams"), ::llvm::StringRef("batch_dims")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTaxisAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTaxisAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTparamsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTparamsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getBatchDimsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getBatchDimsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.GatherV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParams(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getAxis(); + ::mlir::OpOperand &getParamsMutable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getAxisMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getBatchDimsAttr(); + uint64_t getBatchDims(); + ::mlir::Type getTaxis(); + ::mlir::Type getTindices(); + ::mlir::Type getTparams(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setBatchDimsAttr(::mlir::IntegerAttr attr); + void setBatchDims(::std::optional attrValue); + ::mlir::Attribute removeBatchDimsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value params, ::mlir::Value indices, ::mlir::Value axis, /*optional*/::mlir::IntegerAttr batch_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value params, ::mlir::Value indices, ::mlir::Value axis, /*optional*/::mlir::IntegerAttr batch_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value params, ::mlir::Value indices, ::mlir::Value axis, /*optional*/uint64_t batch_dims = 0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value params, ::mlir::Value indices, ::mlir::Value axis, /*optional*/uint64_t batch_dims = 0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::GatherV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::GeneratorDatasetOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GeneratorDatasetOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + GeneratorDatasetOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + GeneratorDatasetOpGenericAdaptorBase(GeneratorDatasetOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::SymbolRefAttr getInitFuncAttr(); + ::mlir::SymbolRefAttr getInitFunc(); + ::mlir::SymbolRefAttr getNextFuncAttr(); + ::mlir::SymbolRefAttr getNextFunc(); + ::mlir::SymbolRefAttr getFinalizeFuncAttr(); + ::mlir::SymbolRefAttr getFinalizeFunc(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); +}; +} // namespace detail +template +class GeneratorDatasetOpGenericAdaptor : public detail::GeneratorDatasetOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GeneratorDatasetOpGenericAdaptorBase; +public: + GeneratorDatasetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GeneratorDatasetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GeneratorDatasetOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + GeneratorDatasetOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInitFuncOtherArgs() { + return getODSOperands(0); + } + + RangeT getNextFuncOtherArgs() { + return getODSOperands(1); + } + + RangeT getFinalizeFuncOtherArgs() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GeneratorDatasetOpAdaptor : public GeneratorDatasetOpGenericAdaptor<::mlir::ValueRange> { +public: + using GeneratorDatasetOpGenericAdaptor::GeneratorDatasetOpGenericAdaptor; + GeneratorDatasetOpAdaptor(GeneratorDatasetOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GeneratorDatasetOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = GeneratorDatasetOpAdaptor; + template + using GenericAdaptor = GeneratorDatasetOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tfinalize_func_args"), ::llvm::StringRef("Tinit_func_args"), ::llvm::StringRef("Tnext_func_args"), ::llvm::StringRef("finalize_func"), ::llvm::StringRef("init_func"), ::llvm::StringRef("metadata"), ::llvm::StringRef("next_func"), ::llvm::StringRef("operandSegmentSizes"), ::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTfinalizeFuncArgsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTfinalizeFuncArgsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTinitFuncArgsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTinitFuncArgsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTnextFuncArgsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTnextFuncArgsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getFinalizeFuncAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getFinalizeFuncAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getInitFuncAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getInitFuncAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getMetadataAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getMetadataAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getNextFuncAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getNextFuncAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(8); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 8); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(9); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 9); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.GeneratorDataset"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInitFuncOtherArgs(); + ::mlir::Operation::operand_range getNextFuncOtherArgs(); + ::mlir::Operation::operand_range getFinalizeFuncOtherArgs(); + ::mlir::MutableOperandRange getInitFuncOtherArgsMutable(); + ::mlir::MutableOperandRange getNextFuncOtherArgsMutable(); + ::mlir::MutableOperandRange getFinalizeFuncOtherArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::SymbolRefAttr getInitFuncAttr(); + ::mlir::SymbolRefAttr getInitFunc(); + ::mlir::SymbolRefAttr getNextFuncAttr(); + ::mlir::SymbolRefAttr getNextFunc(); + ::mlir::SymbolRefAttr getFinalizeFuncAttr(); + ::mlir::SymbolRefAttr getFinalizeFunc(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); + mlir::OperandElementTypeRange getTfinalizeFuncArgs(); + mlir::OperandElementTypeRange getTinitFuncArgs(); + mlir::OperandElementTypeRange getTnextFuncArgs(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setInitFuncAttr(::mlir::SymbolRefAttr attr); + void setNextFuncAttr(::mlir::SymbolRefAttr attr); + void setFinalizeFuncAttr(::mlir::SymbolRefAttr attr); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + void setMetadataAttr(::mlir::StringAttr attr); + void setMetadata(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeMetadataAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::ValueRange init_func_other_args, ::mlir::ValueRange next_func_other_args, ::mlir::ValueRange finalize_func_other_args, ::mlir::SymbolRefAttr init_func, ::mlir::SymbolRefAttr next_func, ::mlir::SymbolRefAttr finalize_func, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange init_func_other_args, ::mlir::ValueRange next_func_other_args, ::mlir::ValueRange finalize_func_other_args, ::mlir::SymbolRefAttr init_func, ::mlir::SymbolRefAttr next_func, ::mlir::SymbolRefAttr finalize_func, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::ValueRange init_func_other_args, ::mlir::ValueRange next_func_other_args, ::mlir::ValueRange finalize_func_other_args, ::mlir::SymbolRefAttr init_func, ::mlir::SymbolRefAttr next_func, ::mlir::SymbolRefAttr finalize_func, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::llvm::StringRef metadata = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange init_func_other_args, ::mlir::ValueRange next_func_other_args, ::mlir::ValueRange finalize_func_other_args, ::mlir::SymbolRefAttr init_func, ::mlir::SymbolRefAttr next_func, ::mlir::SymbolRefAttr finalize_func, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::llvm::StringRef metadata = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 10 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::GeneratorDatasetOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::GetMinibatchSplitsWithPhysicalReplicaOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GetMinibatchSplitsWithPhysicalReplicaOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + GetMinibatchSplitsWithPhysicalReplicaOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + GetMinibatchSplitsWithPhysicalReplicaOpGenericAdaptorBase(GetMinibatchSplitsWithPhysicalReplicaOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getSampleCountAttr(); + uint64_t getSampleCount(); + ::mlir::IntegerAttr getNumReplicaAttr(); + uint64_t getNumReplica(); + ::mlir::IntegerAttr getTableVocabSizeAttr(); + uint64_t getTableVocabSize(); + ::mlir::IntegerAttr getFeatureWidthAttr(); + uint64_t getFeatureWidth(); + ::mlir::IntegerAttr getNumScPerChipAttr(); + uint64_t getNumScPerChip(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::StringAttr getMiniBatchSplitsAttr(); + ::llvm::StringRef getMiniBatchSplits(); +}; +} // namespace detail +template +class GetMinibatchSplitsWithPhysicalReplicaOpGenericAdaptor : public detail::GetMinibatchSplitsWithPhysicalReplicaOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GetMinibatchSplitsWithPhysicalReplicaOpGenericAdaptorBase; +public: + GetMinibatchSplitsWithPhysicalReplicaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GetMinibatchSplitsWithPhysicalReplicaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GetMinibatchSplitsWithPhysicalReplicaOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + GetMinibatchSplitsWithPhysicalReplicaOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getProgramKey() { + return (*getODSOperands(0).begin()); + } + + ValueT getRowIds() { + return (*getODSOperands(1).begin()); + } + + ValueT getColIds() { + return (*getODSOperands(2).begin()); + } + + ValueT getGains() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GetMinibatchSplitsWithPhysicalReplicaOpAdaptor : public GetMinibatchSplitsWithPhysicalReplicaOpGenericAdaptor<::mlir::ValueRange> { +public: + using GetMinibatchSplitsWithPhysicalReplicaOpGenericAdaptor::GetMinibatchSplitsWithPhysicalReplicaOpGenericAdaptor; + GetMinibatchSplitsWithPhysicalReplicaOpAdaptor(GetMinibatchSplitsWithPhysicalReplicaOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GetMinibatchSplitsWithPhysicalReplicaOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = GetMinibatchSplitsWithPhysicalReplicaOpAdaptor; + template + using GenericAdaptor = GetMinibatchSplitsWithPhysicalReplicaOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("feature_width"), ::llvm::StringRef("mini_batch_splits"), ::llvm::StringRef("num_replica"), ::llvm::StringRef("num_sc_per_chip"), ::llvm::StringRef("sample_count"), ::llvm::StringRef("table_name"), ::llvm::StringRef("table_vocab_size")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFeatureWidthAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFeatureWidthAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getMiniBatchSplitsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getMiniBatchSplitsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getNumReplicaAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getNumReplicaAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getNumScPerChipAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getNumScPerChipAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getSampleCountAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getSampleCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getTableVocabSizeAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getTableVocabSizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.GetMinibatchSplitsWithPhysicalReplica"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getProgramKey(); + ::mlir::TypedValue<::mlir::TensorType> getRowIds(); + ::mlir::TypedValue<::mlir::TensorType> getColIds(); + ::mlir::TypedValue<::mlir::TensorType> getGains(); + ::mlir::OpOperand &getProgramKeyMutable(); + ::mlir::OpOperand &getRowIdsMutable(); + ::mlir::OpOperand &getColIdsMutable(); + ::mlir::OpOperand &getGainsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSortedRowIds(); + ::mlir::TypedValue<::mlir::TensorType> getSortedColIds(); + ::mlir::TypedValue<::mlir::TensorType> getSortedGains(); + ::mlir::TypedValue<::mlir::TensorType> getSplits(); + ::mlir::TypedValue<::mlir::TensorType> getIdCounts(); + ::mlir::TypedValue<::mlir::TensorType> getMaxIds(); + ::mlir::TypedValue<::mlir::TensorType> getMaxUniques(); + ::mlir::IntegerAttr getSampleCountAttr(); + uint64_t getSampleCount(); + ::mlir::IntegerAttr getNumReplicaAttr(); + uint64_t getNumReplica(); + ::mlir::IntegerAttr getTableVocabSizeAttr(); + uint64_t getTableVocabSize(); + ::mlir::IntegerAttr getFeatureWidthAttr(); + uint64_t getFeatureWidth(); + ::mlir::IntegerAttr getNumScPerChipAttr(); + uint64_t getNumScPerChip(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::StringAttr getMiniBatchSplitsAttr(); + ::llvm::StringRef getMiniBatchSplits(); + void setSampleCountAttr(::mlir::IntegerAttr attr); + void setSampleCount(uint64_t attrValue); + void setNumReplicaAttr(::mlir::IntegerAttr attr); + void setNumReplica(uint64_t attrValue); + void setTableVocabSizeAttr(::mlir::IntegerAttr attr); + void setTableVocabSize(uint64_t attrValue); + void setFeatureWidthAttr(::mlir::IntegerAttr attr); + void setFeatureWidth(uint64_t attrValue); + void setNumScPerChipAttr(::mlir::IntegerAttr attr); + void setNumScPerChip(uint64_t attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::llvm::StringRef attrValue); + void setMiniBatchSplitsAttr(::mlir::StringAttr attr); + void setMiniBatchSplits(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type sorted_row_ids, ::mlir::Type sorted_col_ids, ::mlir::Type sorted_gains, ::mlir::Type splits, ::mlir::Type id_counts, ::mlir::Type max_ids, ::mlir::Type max_uniques, ::mlir::Value program_key, ::mlir::Value row_ids, ::mlir::Value col_ids, ::mlir::Value gains, ::mlir::IntegerAttr sample_count, ::mlir::IntegerAttr num_replica, ::mlir::IntegerAttr table_vocab_size, ::mlir::IntegerAttr feature_width, ::mlir::IntegerAttr num_sc_per_chip, ::mlir::StringAttr table_name, ::mlir::StringAttr mini_batch_splits); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value program_key, ::mlir::Value row_ids, ::mlir::Value col_ids, ::mlir::Value gains, ::mlir::IntegerAttr sample_count, ::mlir::IntegerAttr num_replica, ::mlir::IntegerAttr table_vocab_size, ::mlir::IntegerAttr feature_width, ::mlir::IntegerAttr num_sc_per_chip, ::mlir::StringAttr table_name, ::mlir::StringAttr mini_batch_splits); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type sorted_row_ids, ::mlir::Type sorted_col_ids, ::mlir::Type sorted_gains, ::mlir::Type splits, ::mlir::Type id_counts, ::mlir::Type max_ids, ::mlir::Type max_uniques, ::mlir::Value program_key, ::mlir::Value row_ids, ::mlir::Value col_ids, ::mlir::Value gains, uint64_t sample_count, uint64_t num_replica, uint64_t table_vocab_size, uint64_t feature_width, uint64_t num_sc_per_chip, ::llvm::StringRef table_name, ::llvm::StringRef mini_batch_splits); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value program_key, ::mlir::Value row_ids, ::mlir::Value col_ids, ::mlir::Value gains, uint64_t sample_count, uint64_t num_replica, uint64_t table_vocab_size, uint64_t feature_width, uint64_t num_sc_per_chip, ::llvm::StringRef table_name, ::llvm::StringRef mini_batch_splits); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 7 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::GetMinibatchSplitsWithPhysicalReplicaOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::GetMinibatchesInCsrWithPhysicalReplicaOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GetMinibatchesInCsrWithPhysicalReplicaOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + GetMinibatchesInCsrWithPhysicalReplicaOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + GetMinibatchesInCsrWithPhysicalReplicaOpGenericAdaptorBase(GetMinibatchesInCsrWithPhysicalReplicaOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getSampleCountAttr(); + uint64_t getSampleCount(); + ::mlir::IntegerAttr getNumReplicaAttr(); + uint64_t getNumReplica(); + ::mlir::IntegerAttr getMaxMinibatchesPerScAttr(); + uint64_t getMaxMinibatchesPerSc(); + ::mlir::IntegerAttr getMaxIdsPerChipPerSampleAttr(); + uint64_t getMaxIdsPerChipPerSample(); + ::mlir::IntegerAttr getTableVocabSizeAttr(); + uint64_t getTableVocabSize(); + ::mlir::IntegerAttr getFeatureWidthAttr(); + uint64_t getFeatureWidth(); + ::mlir::IntegerAttr getNumScPerChipAttr(); + uint64_t getNumScPerChip(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::StringAttr getMiniBatchInCsrAttr(); + ::llvm::StringRef getMiniBatchInCsr(); +}; +} // namespace detail +template +class GetMinibatchesInCsrWithPhysicalReplicaOpGenericAdaptor : public detail::GetMinibatchesInCsrWithPhysicalReplicaOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GetMinibatchesInCsrWithPhysicalReplicaOpGenericAdaptorBase; +public: + GetMinibatchesInCsrWithPhysicalReplicaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GetMinibatchesInCsrWithPhysicalReplicaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GetMinibatchesInCsrWithPhysicalReplicaOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + GetMinibatchesInCsrWithPhysicalReplicaOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getProgramKey() { + return (*getODSOperands(0).begin()); + } + + ValueT getRowIds() { + return (*getODSOperands(1).begin()); + } + + ValueT getColIds() { + return (*getODSOperands(2).begin()); + } + + ValueT getGains() { + return (*getODSOperands(3).begin()); + } + + ValueT getSplits() { + return (*getODSOperands(4).begin()); + } + + ValueT getIdCounts() { + return (*getODSOperands(5).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GetMinibatchesInCsrWithPhysicalReplicaOpAdaptor : public GetMinibatchesInCsrWithPhysicalReplicaOpGenericAdaptor<::mlir::ValueRange> { +public: + using GetMinibatchesInCsrWithPhysicalReplicaOpGenericAdaptor::GetMinibatchesInCsrWithPhysicalReplicaOpGenericAdaptor; + GetMinibatchesInCsrWithPhysicalReplicaOpAdaptor(GetMinibatchesInCsrWithPhysicalReplicaOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GetMinibatchesInCsrWithPhysicalReplicaOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<6>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = GetMinibatchesInCsrWithPhysicalReplicaOpAdaptor; + template + using GenericAdaptor = GetMinibatchesInCsrWithPhysicalReplicaOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("feature_width"), ::llvm::StringRef("max_ids_per_chip_per_sample"), ::llvm::StringRef("max_minibatches_per_sc"), ::llvm::StringRef("mini_batch_in_csr"), ::llvm::StringRef("num_replica"), ::llvm::StringRef("num_sc_per_chip"), ::llvm::StringRef("sample_count"), ::llvm::StringRef("table_name"), ::llvm::StringRef("table_vocab_size")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFeatureWidthAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFeatureWidthAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getMaxIdsPerChipPerSampleAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getMaxIdsPerChipPerSampleAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getMaxMinibatchesPerScAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getMaxMinibatchesPerScAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getMiniBatchInCsrAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getMiniBatchInCsrAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getNumReplicaAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getNumReplicaAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getNumScPerChipAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getNumScPerChipAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getSampleCountAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getSampleCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getTableVocabSizeAttrName() { + return getAttributeNameForIndex(8); + } + + static ::mlir::StringAttr getTableVocabSizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 8); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.GetMinibatchesInCsrWithPhysicalReplica"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getProgramKey(); + ::mlir::TypedValue<::mlir::TensorType> getRowIds(); + ::mlir::TypedValue<::mlir::TensorType> getColIds(); + ::mlir::TypedValue<::mlir::TensorType> getGains(); + ::mlir::TypedValue<::mlir::TensorType> getSplits(); + ::mlir::TypedValue<::mlir::TensorType> getIdCounts(); + ::mlir::OpOperand &getProgramKeyMutable(); + ::mlir::OpOperand &getRowIdsMutable(); + ::mlir::OpOperand &getColIdsMutable(); + ::mlir::OpOperand &getGainsMutable(); + ::mlir::OpOperand &getSplitsMutable(); + ::mlir::OpOperand &getIdCountsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getRowPointers(); + ::mlir::TypedValue<::mlir::TensorType> getSortedSampleIds(); + ::mlir::TypedValue<::mlir::TensorType> getSortedTokenIds(); + ::mlir::TypedValue<::mlir::TensorType> getSortedGains(); + ::mlir::TypedValue<::mlir::TensorType> getRowPointersUnpaddedSize(); + ::mlir::TypedValue<::mlir::TensorType> getIdsUnpaddedSize(); + ::mlir::TypedValue<::mlir::TensorType> getNumMinibatchesPerPhysicalSparseCore(); + ::mlir::IntegerAttr getSampleCountAttr(); + uint64_t getSampleCount(); + ::mlir::IntegerAttr getNumReplicaAttr(); + uint64_t getNumReplica(); + ::mlir::IntegerAttr getMaxMinibatchesPerScAttr(); + uint64_t getMaxMinibatchesPerSc(); + ::mlir::IntegerAttr getMaxIdsPerChipPerSampleAttr(); + uint64_t getMaxIdsPerChipPerSample(); + ::mlir::IntegerAttr getTableVocabSizeAttr(); + uint64_t getTableVocabSize(); + ::mlir::IntegerAttr getFeatureWidthAttr(); + uint64_t getFeatureWidth(); + ::mlir::IntegerAttr getNumScPerChipAttr(); + uint64_t getNumScPerChip(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::StringAttr getMiniBatchInCsrAttr(); + ::llvm::StringRef getMiniBatchInCsr(); + void setSampleCountAttr(::mlir::IntegerAttr attr); + void setSampleCount(uint64_t attrValue); + void setNumReplicaAttr(::mlir::IntegerAttr attr); + void setNumReplica(uint64_t attrValue); + void setMaxMinibatchesPerScAttr(::mlir::IntegerAttr attr); + void setMaxMinibatchesPerSc(uint64_t attrValue); + void setMaxIdsPerChipPerSampleAttr(::mlir::IntegerAttr attr); + void setMaxIdsPerChipPerSample(uint64_t attrValue); + void setTableVocabSizeAttr(::mlir::IntegerAttr attr); + void setTableVocabSize(uint64_t attrValue); + void setFeatureWidthAttr(::mlir::IntegerAttr attr); + void setFeatureWidth(uint64_t attrValue); + void setNumScPerChipAttr(::mlir::IntegerAttr attr); + void setNumScPerChip(uint64_t attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::llvm::StringRef attrValue); + void setMiniBatchInCsrAttr(::mlir::StringAttr attr); + void setMiniBatchInCsr(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type row_pointers, ::mlir::Type sorted_sample_ids, ::mlir::Type sorted_token_ids, ::mlir::Type sorted_gains, ::mlir::Type row_pointers_unpadded_size, ::mlir::Type ids_unpadded_size, ::mlir::Type num_minibatches_per_physical_sparse_core, ::mlir::Value program_key, ::mlir::Value row_ids, ::mlir::Value col_ids, ::mlir::Value gains, ::mlir::Value splits, ::mlir::Value id_counts, ::mlir::IntegerAttr sample_count, ::mlir::IntegerAttr num_replica, ::mlir::IntegerAttr max_minibatches_per_sc, ::mlir::IntegerAttr max_ids_per_chip_per_sample, ::mlir::IntegerAttr table_vocab_size, ::mlir::IntegerAttr feature_width, ::mlir::IntegerAttr num_sc_per_chip, ::mlir::StringAttr table_name, ::mlir::StringAttr mini_batch_in_csr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value program_key, ::mlir::Value row_ids, ::mlir::Value col_ids, ::mlir::Value gains, ::mlir::Value splits, ::mlir::Value id_counts, ::mlir::IntegerAttr sample_count, ::mlir::IntegerAttr num_replica, ::mlir::IntegerAttr max_minibatches_per_sc, ::mlir::IntegerAttr max_ids_per_chip_per_sample, ::mlir::IntegerAttr table_vocab_size, ::mlir::IntegerAttr feature_width, ::mlir::IntegerAttr num_sc_per_chip, ::mlir::StringAttr table_name, ::mlir::StringAttr mini_batch_in_csr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type row_pointers, ::mlir::Type sorted_sample_ids, ::mlir::Type sorted_token_ids, ::mlir::Type sorted_gains, ::mlir::Type row_pointers_unpadded_size, ::mlir::Type ids_unpadded_size, ::mlir::Type num_minibatches_per_physical_sparse_core, ::mlir::Value program_key, ::mlir::Value row_ids, ::mlir::Value col_ids, ::mlir::Value gains, ::mlir::Value splits, ::mlir::Value id_counts, uint64_t sample_count, uint64_t num_replica, uint64_t max_minibatches_per_sc, uint64_t max_ids_per_chip_per_sample, uint64_t table_vocab_size, uint64_t feature_width, uint64_t num_sc_per_chip, ::llvm::StringRef table_name, ::llvm::StringRef mini_batch_in_csr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value program_key, ::mlir::Value row_ids, ::mlir::Value col_ids, ::mlir::Value gains, ::mlir::Value splits, ::mlir::Value id_counts, uint64_t sample_count, uint64_t num_replica, uint64_t max_minibatches_per_sc, uint64_t max_ids_per_chip_per_sample, uint64_t table_vocab_size, uint64_t feature_width, uint64_t num_sc_per_chip, ::llvm::StringRef table_name, ::llvm::StringRef mini_batch_in_csr); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 9 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::GetMinibatchesInCsrWithPhysicalReplicaOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::GlobalIterIdOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GlobalIterIdOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + GlobalIterIdOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + GlobalIterIdOpGenericAdaptorBase(GlobalIterIdOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class GlobalIterIdOpGenericAdaptor : public detail::GlobalIterIdOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GlobalIterIdOpGenericAdaptorBase; +public: + GlobalIterIdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GlobalIterIdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GlobalIterIdOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + GlobalIterIdOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GlobalIterIdOpAdaptor : public GlobalIterIdOpGenericAdaptor<::mlir::ValueRange> { +public: + using GlobalIterIdOpGenericAdaptor::GlobalIterIdOpGenericAdaptor; + GlobalIterIdOpAdaptor(GlobalIterIdOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GlobalIterIdOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, GetResourceInstanceInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = GlobalIterIdOpAdaptor; + template + using GenericAdaptor = GlobalIterIdOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.GlobalIterId"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getIterId(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type iter_id); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + std::optional GetResourceInstanceStr(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::GlobalIterIdOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::GreaterEqualOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GreaterEqualOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + GreaterEqualOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + GreaterEqualOpGenericAdaptorBase(GreaterEqualOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class GreaterEqualOpGenericAdaptor : public detail::GreaterEqualOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GreaterEqualOpGenericAdaptorBase; +public: + GreaterEqualOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GreaterEqualOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GreaterEqualOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + GreaterEqualOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GreaterEqualOpAdaptor : public GreaterEqualOpGenericAdaptor<::mlir::ValueRange> { +public: + using GreaterEqualOpGenericAdaptor::GreaterEqualOpGenericAdaptor; + GreaterEqualOpAdaptor(GreaterEqualOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GreaterEqualOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = GreaterEqualOpAdaptor; + template + using GenericAdaptor = GreaterEqualOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.GreaterEqual"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::GreaterEqualOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::GreaterOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GreaterOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + GreaterOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + GreaterOpGenericAdaptorBase(GreaterOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class GreaterOpGenericAdaptor : public detail::GreaterOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GreaterOpGenericAdaptorBase; +public: + GreaterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GreaterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GreaterOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + GreaterOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GreaterOpAdaptor : public GreaterOpGenericAdaptor<::mlir::ValueRange> { +public: + using GreaterOpGenericAdaptor::GreaterOpGenericAdaptor; + GreaterOpAdaptor(GreaterOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GreaterOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = GreaterOpAdaptor; + template + using GenericAdaptor = GreaterOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Greater"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::GreaterOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::HSVToRGBOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class HSVToRGBOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + HSVToRGBOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + HSVToRGBOpGenericAdaptorBase(HSVToRGBOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class HSVToRGBOpGenericAdaptor : public detail::HSVToRGBOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::HSVToRGBOpGenericAdaptorBase; +public: + HSVToRGBOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + HSVToRGBOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : HSVToRGBOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + HSVToRGBOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getImages() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class HSVToRGBOpAdaptor : public HSVToRGBOpGenericAdaptor<::mlir::ValueRange> { +public: + using HSVToRGBOpGenericAdaptor::HSVToRGBOpGenericAdaptor; + HSVToRGBOpAdaptor(HSVToRGBOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class HSVToRGBOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = HSVToRGBOpAdaptor; + template + using GenericAdaptor = HSVToRGBOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.HSVToRGB"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getImages(); + ::mlir::OpOperand &getImagesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value images); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value images); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::HSVToRGBOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::HashTableOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class HashTableOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + HashTableOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + HashTableOpGenericAdaptorBase(HashTableOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getContainerAttr(); + ::llvm::StringRef getContainer(); + ::mlir::StringAttr getSharedNameAttr(); + ::llvm::StringRef getSharedName(); + ::mlir::BoolAttr getUseNodeNameSharingAttr(); + bool getUseNodeNameSharing(); + ::mlir::TypeAttr getKeyDtypeAttr(); + ::mlir::Type getKeyDtype(); + ::mlir::TypeAttr getValueDtypeAttr(); + ::mlir::Type getValueDtype(); +}; +} // namespace detail +template +class HashTableOpGenericAdaptor : public detail::HashTableOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::HashTableOpGenericAdaptorBase; +public: + HashTableOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + HashTableOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : HashTableOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + HashTableOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class HashTableOpAdaptor : public HashTableOpGenericAdaptor<::mlir::ValueRange> { +public: + using HashTableOpGenericAdaptor::HashTableOpGenericAdaptor; + HashTableOpAdaptor(HashTableOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class HashTableOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = HashTableOpAdaptor; + template + using GenericAdaptor = HashTableOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("container"), ::llvm::StringRef("key_dtype"), ::llvm::StringRef("shared_name"), ::llvm::StringRef("use_node_name_sharing"), ::llvm::StringRef("value_dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getContainerAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getContainerAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getKeyDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getKeyDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getSharedNameAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getSharedNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getUseNodeNameSharingAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getUseNodeNameSharingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getValueDtypeAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getValueDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.HashTable"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTableHandle(); + ::mlir::StringAttr getContainerAttr(); + ::llvm::StringRef getContainer(); + ::mlir::StringAttr getSharedNameAttr(); + ::llvm::StringRef getSharedName(); + ::mlir::BoolAttr getUseNodeNameSharingAttr(); + bool getUseNodeNameSharing(); + ::mlir::TypeAttr getKeyDtypeAttr(); + ::mlir::Type getKeyDtype(); + ::mlir::TypeAttr getValueDtypeAttr(); + ::mlir::Type getValueDtype(); + void setContainerAttr(::mlir::StringAttr attr); + void setContainer(::std::optional<::llvm::StringRef> attrValue); + void setSharedNameAttr(::mlir::StringAttr attr); + void setSharedName(::std::optional<::llvm::StringRef> attrValue); + void setUseNodeNameSharingAttr(::mlir::BoolAttr attr); + void setUseNodeNameSharing(::std::optional attrValue); + void setKeyDtypeAttr(::mlir::TypeAttr attr); + void setKeyDtype(::mlir::Type attrValue); + void setValueDtypeAttr(::mlir::TypeAttr attr); + void setValueDtype(::mlir::Type attrValue); + ::mlir::Attribute removeContainerAttr(); + ::mlir::Attribute removeSharedNameAttr(); + ::mlir::Attribute removeUseNodeNameSharingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type table_handle, /*optional*/::mlir::StringAttr container, /*optional*/::mlir::StringAttr shared_name, /*optional*/::mlir::BoolAttr use_node_name_sharing, ::mlir::TypeAttr key_dtype, ::mlir::TypeAttr value_dtype); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::StringAttr container, /*optional*/::mlir::StringAttr shared_name, /*optional*/::mlir::BoolAttr use_node_name_sharing, ::mlir::TypeAttr key_dtype, ::mlir::TypeAttr value_dtype); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type table_handle, /*optional*/::llvm::StringRef container, /*optional*/::llvm::StringRef shared_name, /*optional*/bool use_node_name_sharing, ::mlir::Type key_dtype, ::mlir::Type value_dtype); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::llvm::StringRef container, /*optional*/::llvm::StringRef shared_name, /*optional*/bool use_node_name_sharing, ::mlir::Type key_dtype, ::mlir::Type value_dtype); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::HashTableOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::HashTableV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class HashTableV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + HashTableV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + HashTableV2OpGenericAdaptorBase(HashTableV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getContainerAttr(); + ::llvm::StringRef getContainer(); + ::mlir::StringAttr getSharedNameAttr(); + ::llvm::StringRef getSharedName(); + ::mlir::BoolAttr getUseNodeNameSharingAttr(); + bool getUseNodeNameSharing(); + ::mlir::TypeAttr getKeyDtypeAttr(); + ::mlir::Type getKeyDtype(); + ::mlir::TypeAttr getValueDtypeAttr(); + ::mlir::Type getValueDtype(); +}; +} // namespace detail +template +class HashTableV2OpGenericAdaptor : public detail::HashTableV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::HashTableV2OpGenericAdaptorBase; +public: + HashTableV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + HashTableV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : HashTableV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + HashTableV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class HashTableV2OpAdaptor : public HashTableV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using HashTableV2OpGenericAdaptor::HashTableV2OpGenericAdaptor; + HashTableV2OpAdaptor(HashTableV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class HashTableV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = HashTableV2OpAdaptor; + template + using GenericAdaptor = HashTableV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("container"), ::llvm::StringRef("key_dtype"), ::llvm::StringRef("shared_name"), ::llvm::StringRef("use_node_name_sharing"), ::llvm::StringRef("value_dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getContainerAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getContainerAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getKeyDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getKeyDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getSharedNameAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getSharedNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getUseNodeNameSharingAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getUseNodeNameSharingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getValueDtypeAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getValueDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.HashTableV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTableHandle(); + ::mlir::StringAttr getContainerAttr(); + ::llvm::StringRef getContainer(); + ::mlir::StringAttr getSharedNameAttr(); + ::llvm::StringRef getSharedName(); + ::mlir::BoolAttr getUseNodeNameSharingAttr(); + bool getUseNodeNameSharing(); + ::mlir::TypeAttr getKeyDtypeAttr(); + ::mlir::Type getKeyDtype(); + ::mlir::TypeAttr getValueDtypeAttr(); + ::mlir::Type getValueDtype(); + void setContainerAttr(::mlir::StringAttr attr); + void setContainer(::std::optional<::llvm::StringRef> attrValue); + void setSharedNameAttr(::mlir::StringAttr attr); + void setSharedName(::std::optional<::llvm::StringRef> attrValue); + void setUseNodeNameSharingAttr(::mlir::BoolAttr attr); + void setUseNodeNameSharing(::std::optional attrValue); + void setKeyDtypeAttr(::mlir::TypeAttr attr); + void setKeyDtype(::mlir::Type attrValue); + void setValueDtypeAttr(::mlir::TypeAttr attr); + void setValueDtype(::mlir::Type attrValue); + ::mlir::Attribute removeContainerAttr(); + ::mlir::Attribute removeSharedNameAttr(); + ::mlir::Attribute removeUseNodeNameSharingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, StringAttr container, StringAttr shared_name, BoolAttr use_node_name_sharing, TypeAttr key_dtype, TypeAttr value_dtype); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type table_handle, /*optional*/::mlir::StringAttr container, /*optional*/::mlir::StringAttr shared_name, /*optional*/::mlir::BoolAttr use_node_name_sharing, ::mlir::TypeAttr key_dtype, ::mlir::TypeAttr value_dtype); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::StringAttr container, /*optional*/::mlir::StringAttr shared_name, /*optional*/::mlir::BoolAttr use_node_name_sharing, ::mlir::TypeAttr key_dtype, ::mlir::TypeAttr value_dtype); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type table_handle, /*optional*/::llvm::StringRef container, /*optional*/::llvm::StringRef shared_name, /*optional*/bool use_node_name_sharing, ::mlir::Type key_dtype, ::mlir::Type value_dtype); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::llvm::StringRef container, /*optional*/::llvm::StringRef shared_name, /*optional*/bool use_node_name_sharing, ::mlir::Type key_dtype, ::mlir::Type value_dtype); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::HashTableV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::IFFT2DOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IFFT2DOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IFFT2DOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IFFT2DOpGenericAdaptorBase(IFFT2DOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class IFFT2DOpGenericAdaptor : public detail::IFFT2DOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IFFT2DOpGenericAdaptorBase; +public: + IFFT2DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IFFT2DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IFFT2DOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IFFT2DOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IFFT2DOpAdaptor : public IFFT2DOpGenericAdaptor<::mlir::ValueRange> { +public: + using IFFT2DOpGenericAdaptor::IFFT2DOpGenericAdaptor; + IFFT2DOpAdaptor(IFFT2DOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IFFT2DOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = IFFT2DOpAdaptor; + template + using GenericAdaptor = IFFT2DOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tcomplex")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTcomplexAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTcomplexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.IFFT2D"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getTcomplex(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::IFFT2DOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::IFFT3DOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IFFT3DOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IFFT3DOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IFFT3DOpGenericAdaptorBase(IFFT3DOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class IFFT3DOpGenericAdaptor : public detail::IFFT3DOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IFFT3DOpGenericAdaptorBase; +public: + IFFT3DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IFFT3DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IFFT3DOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IFFT3DOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IFFT3DOpAdaptor : public IFFT3DOpGenericAdaptor<::mlir::ValueRange> { +public: + using IFFT3DOpGenericAdaptor::IFFT3DOpGenericAdaptor; + IFFT3DOpAdaptor(IFFT3DOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IFFT3DOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = IFFT3DOpAdaptor; + template + using GenericAdaptor = IFFT3DOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tcomplex")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTcomplexAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTcomplexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.IFFT3D"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getTcomplex(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::IFFT3DOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::IFFTOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IFFTOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IFFTOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IFFTOpGenericAdaptorBase(IFFTOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class IFFTOpGenericAdaptor : public detail::IFFTOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IFFTOpGenericAdaptorBase; +public: + IFFTOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IFFTOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IFFTOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IFFTOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IFFTOpAdaptor : public IFFTOpGenericAdaptor<::mlir::ValueRange> { +public: + using IFFTOpGenericAdaptor::IFFTOpGenericAdaptor; + IFFTOpAdaptor(IFFTOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IFFTOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = IFFTOpAdaptor; + template + using GenericAdaptor = IFFTOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tcomplex")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTcomplexAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTcomplexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.IFFT"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getTcomplex(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::IFFTOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::IRFFT2DOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IRFFT2DOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IRFFT2DOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IRFFT2DOpGenericAdaptorBase(IRFFT2DOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class IRFFT2DOpGenericAdaptor : public detail::IRFFT2DOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IRFFT2DOpGenericAdaptorBase; +public: + IRFFT2DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IRFFT2DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IRFFT2DOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IRFFT2DOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getFftLength() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IRFFT2DOpAdaptor : public IRFFT2DOpGenericAdaptor<::mlir::ValueRange> { +public: + using IRFFT2DOpGenericAdaptor::IRFFT2DOpGenericAdaptor; + IRFFT2DOpAdaptor(IRFFT2DOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IRFFT2DOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = IRFFT2DOpAdaptor; + template + using GenericAdaptor = IRFFT2DOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tcomplex"), ::llvm::StringRef("Treal")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTcomplexAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTcomplexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTrealAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTrealAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.IRFFT2D"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getFftLength(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getFftLengthMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getTcomplex(); + ::mlir::Type getTreal(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value fft_length); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value fft_length); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::IRFFT2DOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::IRFFT3DOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IRFFT3DOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IRFFT3DOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IRFFT3DOpGenericAdaptorBase(IRFFT3DOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class IRFFT3DOpGenericAdaptor : public detail::IRFFT3DOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IRFFT3DOpGenericAdaptorBase; +public: + IRFFT3DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IRFFT3DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IRFFT3DOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IRFFT3DOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getFftLength() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IRFFT3DOpAdaptor : public IRFFT3DOpGenericAdaptor<::mlir::ValueRange> { +public: + using IRFFT3DOpGenericAdaptor::IRFFT3DOpGenericAdaptor; + IRFFT3DOpAdaptor(IRFFT3DOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IRFFT3DOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = IRFFT3DOpAdaptor; + template + using GenericAdaptor = IRFFT3DOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tcomplex"), ::llvm::StringRef("Treal")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTcomplexAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTcomplexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTrealAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTrealAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.IRFFT3D"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getFftLength(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getFftLengthMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getTcomplex(); + ::mlir::Type getTreal(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value fft_length); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value fft_length); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::IRFFT3DOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::IRFFTOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IRFFTOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IRFFTOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IRFFTOpGenericAdaptorBase(IRFFTOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class IRFFTOpGenericAdaptor : public detail::IRFFTOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IRFFTOpGenericAdaptorBase; +public: + IRFFTOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IRFFTOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IRFFTOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IRFFTOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getFftLength() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IRFFTOpAdaptor : public IRFFTOpGenericAdaptor<::mlir::ValueRange> { +public: + using IRFFTOpGenericAdaptor::IRFFTOpGenericAdaptor; + IRFFTOpAdaptor(IRFFTOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IRFFTOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = IRFFTOpAdaptor; + template + using GenericAdaptor = IRFFTOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tcomplex"), ::llvm::StringRef("Treal")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTcomplexAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTcomplexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTrealAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTrealAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.IRFFT"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getFftLength(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getFftLengthMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getTcomplex(); + ::mlir::Type getTreal(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value fft_length); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value fft_length); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::IRFFTOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::IdentityNOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IdentityNOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IdentityNOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IdentityNOpGenericAdaptorBase(IdentityNOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class IdentityNOpGenericAdaptor : public detail::IdentityNOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IdentityNOpGenericAdaptorBase; +public: + IdentityNOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IdentityNOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IdentityNOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IdentityNOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInput() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IdentityNOpAdaptor : public IdentityNOpGenericAdaptor<::mlir::ValueRange> { +public: + using IdentityNOpGenericAdaptor::IdentityNOpGenericAdaptor; + IdentityNOpAdaptor(IdentityNOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IdentityNOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = IdentityNOpAdaptor; + template + using GenericAdaptor = IdentityNOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.IdentityN"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInput(); + ::mlir::MutableOperandRange getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutput(); + mlir::OperandElementTypeRange getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::IdentityNOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::IdentityOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IdentityOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IdentityOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IdentityOpGenericAdaptorBase(IdentityOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class IdentityOpGenericAdaptor : public detail::IdentityOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IdentityOpGenericAdaptorBase; +public: + IdentityOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IdentityOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IdentityOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IdentityOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IdentityOpAdaptor : public IdentityOpGenericAdaptor<::mlir::ValueRange> { +public: + using IdentityOpGenericAdaptor::IdentityOpGenericAdaptor; + IdentityOpAdaptor(IdentityOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IdentityOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::OpTrait::TF::OperandsSameAsResultsTypeOrRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = IdentityOpAdaptor; + template + using GenericAdaptor = IdentityOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Identity"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::IdentityOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::IfOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IfOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IfOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IfOpGenericAdaptorBase(IfOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::FlatSymbolRefAttr getThenBranchAttr(); + ::llvm::StringRef getThenBranch(); + ::mlir::FlatSymbolRefAttr getElseBranchAttr(); + ::llvm::StringRef getElseBranch(); + ::mlir::BoolAttr getIsStatelessAttr(); + bool getIsStateless(); +}; +} // namespace detail +template +class IfOpGenericAdaptor : public detail::IfOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IfOpGenericAdaptorBase; +public: + IfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IfOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IfOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getCond() { + return (*getODSOperands(0).begin()); + } + + RangeT getInput() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IfOpAdaptor : public IfOpGenericAdaptor<::mlir::ValueRange> { +public: + using IfOpGenericAdaptor::IfOpGenericAdaptor; + IfOpAdaptor(IfOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IfOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::SymbolUserOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = IfOpAdaptor; + template + using GenericAdaptor = IfOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tcond"), ::llvm::StringRef("Tin"), ::llvm::StringRef("Tout"), ::llvm::StringRef("else_branch"), ::llvm::StringRef("is_stateless"), ::llvm::StringRef("output_shapes"), ::llvm::StringRef("then_branch")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTcondAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTcondAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTinAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTinAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getToutAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getToutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getElseBranchAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getElseBranchAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getIsStatelessAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getIsStatelessAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getThenBranchAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getThenBranchAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.If"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getCond(); + ::mlir::Operation::operand_range getInput(); + ::mlir::OpOperand &getCondMutable(); + ::mlir::MutableOperandRange getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutput(); + ::mlir::FlatSymbolRefAttr getThenBranchAttr(); + ::llvm::StringRef getThenBranch(); + ::mlir::FlatSymbolRefAttr getElseBranchAttr(); + ::llvm::StringRef getElseBranch(); + ::mlir::BoolAttr getIsStatelessAttr(); + bool getIsStateless(); + ::mlir::Type getTcond(); + mlir::OperandElementTypeRange getTin(); + mlir::ResultElementTypeRange getTout(); + mlir::TF::ResultShapeRange getOutputShapes(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setThenBranchAttr(::mlir::FlatSymbolRefAttr attr); + void setThenBranch(::llvm::StringRef attrValue); + void setElseBranchAttr(::mlir::FlatSymbolRefAttr attr); + void setElseBranch(::llvm::StringRef attrValue); + void setIsStatelessAttr(::mlir::BoolAttr attr); + void setIsStateless(bool attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::Value cond, ::mlir::ValueRange input, ::mlir::FlatSymbolRefAttr then_branch, ::mlir::FlatSymbolRefAttr else_branch, ::mlir::BoolAttr is_stateless); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::Value cond, ::mlir::ValueRange input, ::llvm::StringRef then_branch, ::llvm::StringRef else_branch, bool is_stateless); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::LogicalResult verifySymbolUses(::mlir::SymbolTableCollection &symbolTable); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 7 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Resolve the then branch function. + // Prefer passing in SymbolTableCollection to reduce lookup costs by + // enabling reusing cached symbol table lookup. + func::FuncOp ResolveThenFunction(::mlir::SymbolTableCollection* table) { + if (table) + return table->lookupNearestSymbolFrom(*this, getThenBranchAttr()); + return SymbolTable::lookupNearestSymbolFrom( + *this, getThenBranchAttr()); + } + // TODO(b/204997177): Deprecate and remove. + func::FuncOp then_function(::mlir::SymbolTableCollection* table = nullptr) { + return ResolveThenFunction(table); + } + + // Resolve the else branch function. + // Prefer passing in SymbolTableCollection to reduce lookup costs by + // enabling reusing cached symbol table lookup. + func::FuncOp ResolveElseFunction(::mlir::SymbolTableCollection* table) { + if (table) + return table->lookupNearestSymbolFrom(*this, getElseBranchAttr()); + return SymbolTable::lookupNearestSymbolFrom( + *this, getElseBranchAttr()); + } + // TODO(b/204997177): Deprecate and remove. + func::FuncOp else_function(::mlir::SymbolTableCollection* table = nullptr) { + return ResolveElseFunction(table); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::IfOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::IfRegionOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IfRegionOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IfRegionOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IfRegionOpGenericAdaptorBase(IfRegionOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getIsStatelessAttr(); + bool getIsStateless(); + ::mlir::StringAttr get_thenFuncNameAttr(); + ::std::optional< ::llvm::StringRef > get_thenFuncName(); + ::mlir::StringAttr get_elseFuncNameAttr(); + ::std::optional< ::llvm::StringRef > get_elseFuncName(); + ::mlir::Region &getThenBranch(); + ::mlir::Region &getElseBranch(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class IfRegionOpGenericAdaptor : public detail::IfRegionOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IfRegionOpGenericAdaptorBase; +public: + IfRegionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IfRegionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IfRegionOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IfRegionOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getCond() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IfRegionOpAdaptor : public IfRegionOpGenericAdaptor<::mlir::ValueRange> { +public: + using IfRegionOpGenericAdaptor::IfRegionOpGenericAdaptor; + IfRegionOpAdaptor(IfRegionOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IfRegionOp : public ::mlir::Op::Impl, ::mlir::OpTrait::VariadicResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::SingleBlock, ::mlir::OpTrait::SingleBlockImplicitTerminator::Impl, ::mlir::OpTrait::NoRegionArguments, ::mlir::OpTrait::OpInvariants, ::mlir::RegionBranchOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = IfRegionOpAdaptor; + template + using GenericAdaptor = IfRegionOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("_else_func_name"), ::llvm::StringRef("_then_func_name"), ::llvm::StringRef("is_stateless")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr get_elseFuncNameAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr get_elseFuncNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr get_thenFuncNameAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr get_thenFuncNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getIsStatelessAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getIsStatelessAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.IfRegion"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::RankedTensorType> getCond(); + ::mlir::OpOperand &getCondMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutput(); + ::mlir::Region &getThenBranch(); + ::mlir::Region &getElseBranch(); + ::mlir::BoolAttr getIsStatelessAttr(); + bool getIsStateless(); + ::mlir::StringAttr get_thenFuncNameAttr(); + ::std::optional< ::llvm::StringRef > get_thenFuncName(); + ::mlir::StringAttr get_elseFuncNameAttr(); + ::std::optional< ::llvm::StringRef > get_elseFuncName(); + void setIsStatelessAttr(::mlir::BoolAttr attr); + void setIsStateless(bool attrValue); + void set_thenFuncNameAttr(::mlir::StringAttr attr); + void set_thenFuncName(::std::optional<::llvm::StringRef> attrValue); + void set_elseFuncNameAttr(::mlir::StringAttr attr); + void set_elseFuncName(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute remove_thenFuncNameAttr(); + ::mlir::Attribute remove_elseFuncNameAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, TypeRange resultTypes, ValueRange operands, llvm::ArrayRef<::mlir::NamedAttribute> attributes, unsigned numRegions); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::Value cond, ::mlir::BoolAttr is_stateless, /*optional*/::mlir::StringAttr _then_func_name, /*optional*/::mlir::StringAttr _else_func_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::Value cond, bool is_stateless, /*optional*/::mlir::StringAttr _then_func_name, /*optional*/::mlir::StringAttr _else_func_name); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verifyRegions(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::OperandRange getEntrySuccessorOperands(::mlir::RegionBranchPoint point); + void getSuccessorRegions(::mlir::RegionBranchPoint point, ::llvm::SmallVectorImpl<::mlir::RegionSuccessor> ®ions); + void getRegionInvocationBounds(::llvm::ArrayRef<::mlir::Attribute> operands, ::llvm::SmallVectorImpl<::mlir::InvocationBounds> &invocationBounds); + bool areTypesCompatible(::mlir::Type lhs, ::mlir::Type rhs); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::IfRegionOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::IgammaGradAOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IgammaGradAOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IgammaGradAOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IgammaGradAOpGenericAdaptorBase(IgammaGradAOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class IgammaGradAOpGenericAdaptor : public detail::IgammaGradAOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IgammaGradAOpGenericAdaptorBase; +public: + IgammaGradAOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IgammaGradAOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IgammaGradAOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IgammaGradAOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + ValueT getX() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IgammaGradAOpAdaptor : public IgammaGradAOpGenericAdaptor<::mlir::ValueRange> { +public: + using IgammaGradAOpGenericAdaptor::IgammaGradAOpGenericAdaptor; + IgammaGradAOpAdaptor(IgammaGradAOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IgammaGradAOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::OpTrait::TF::SameOperandsAndResultElementTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = IgammaGradAOpAdaptor; + template + using GenericAdaptor = IgammaGradAOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.IgammaGradA"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getA(); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getAMutable(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value a, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::IgammaGradAOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::IgammaOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IgammaOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IgammaOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IgammaOpGenericAdaptorBase(IgammaOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class IgammaOpGenericAdaptor : public detail::IgammaOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IgammaOpGenericAdaptorBase; +public: + IgammaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IgammaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IgammaOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IgammaOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + ValueT getX() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IgammaOpAdaptor : public IgammaOpGenericAdaptor<::mlir::ValueRange> { +public: + using IgammaOpGenericAdaptor::IgammaOpGenericAdaptor; + IgammaOpAdaptor(IgammaOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IgammaOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::OpTrait::TF::SameOperandsAndResultElementTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = IgammaOpAdaptor; + template + using GenericAdaptor = IgammaOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Igamma"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getA(); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getAMutable(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value a, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::IgammaOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::IgammacOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IgammacOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IgammacOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IgammacOpGenericAdaptorBase(IgammacOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class IgammacOpGenericAdaptor : public detail::IgammacOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IgammacOpGenericAdaptorBase; +public: + IgammacOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IgammacOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IgammacOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IgammacOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + ValueT getX() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IgammacOpAdaptor : public IgammacOpGenericAdaptor<::mlir::ValueRange> { +public: + using IgammacOpGenericAdaptor::IgammacOpGenericAdaptor; + IgammacOpAdaptor(IgammacOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IgammacOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::OpTrait::TF::SameOperandsAndResultElementTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = IgammacOpAdaptor; + template + using GenericAdaptor = IgammacOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Igammac"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getA(); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getAMutable(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value a, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::IgammacOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ImagOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ImagOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ImagOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ImagOpGenericAdaptorBase(ImagOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ImagOpGenericAdaptor : public detail::ImagOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ImagOpGenericAdaptorBase; +public: + ImagOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ImagOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ImagOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ImagOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ImagOpAdaptor : public ImagOpGenericAdaptor<::mlir::ValueRange> { +public: + using ImagOpGenericAdaptor::ImagOpGenericAdaptor; + ImagOpAdaptor(ImagOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ImagOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ImagOpAdaptor; + template + using GenericAdaptor = ImagOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tout")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getToutAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getToutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Imag"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTout(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ImagOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ImportEventOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ImportEventOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ImportEventOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ImportEventOpGenericAdaptorBase(ImportEventOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ImportEventOpGenericAdaptor : public detail::ImportEventOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ImportEventOpGenericAdaptorBase; +public: + ImportEventOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ImportEventOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ImportEventOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ImportEventOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getWriter() { + return (*getODSOperands(0).begin()); + } + + ValueT getEvent() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ImportEventOpAdaptor : public ImportEventOpGenericAdaptor<::mlir::ValueRange> { +public: + using ImportEventOpGenericAdaptor::ImportEventOpGenericAdaptor; + ImportEventOpAdaptor(ImportEventOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ImportEventOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ImportEventOpAdaptor; + template + using GenericAdaptor = ImportEventOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ImportEvent"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getWriter(); + ::mlir::TypedValue<::mlir::TensorType> getEvent(); + ::mlir::OpOperand &getWriterMutable(); + ::mlir::OpOperand &getEventMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value writer, ::mlir::Value event); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value writer, ::mlir::Value event); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ImportEventOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::InTopKV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class InTopKV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + InTopKV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + InTopKV2OpGenericAdaptorBase(InTopKV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class InTopKV2OpGenericAdaptor : public detail::InTopKV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::InTopKV2OpGenericAdaptorBase; +public: + InTopKV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + InTopKV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : InTopKV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + InTopKV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getPredictions() { + return (*getODSOperands(0).begin()); + } + + ValueT getTargets() { + return (*getODSOperands(1).begin()); + } + + ValueT getK() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class InTopKV2OpAdaptor : public InTopKV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using InTopKV2OpGenericAdaptor::InTopKV2OpGenericAdaptor; + InTopKV2OpAdaptor(InTopKV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class InTopKV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = InTopKV2OpAdaptor; + template + using GenericAdaptor = InTopKV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.InTopKV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getPredictions(); + ::mlir::TypedValue<::mlir::TensorType> getTargets(); + ::mlir::TypedValue<::mlir::TensorType> getK(); + ::mlir::OpOperand &getPredictionsMutable(); + ::mlir::OpOperand &getTargetsMutable(); + ::mlir::OpOperand &getKMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getPrecision(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type precision, ::mlir::Value predictions, ::mlir::Value targets, ::mlir::Value k); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value predictions, ::mlir::Value targets, ::mlir::Value k); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::InTopKV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::InfeedDequeueOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class InfeedDequeueOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + InfeedDequeueOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + InfeedDequeueOpGenericAdaptorBase(InfeedDequeueOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Attribute getShapeAttr(); + std::optional> getShape(); +}; +} // namespace detail +template +class InfeedDequeueOpGenericAdaptor : public detail::InfeedDequeueOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::InfeedDequeueOpGenericAdaptorBase; +public: + InfeedDequeueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + InfeedDequeueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : InfeedDequeueOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + InfeedDequeueOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class InfeedDequeueOpAdaptor : public InfeedDequeueOpGenericAdaptor<::mlir::ValueRange> { +public: + using InfeedDequeueOpGenericAdaptor::InfeedDequeueOpGenericAdaptor; + InfeedDequeueOpAdaptor(InfeedDequeueOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class InfeedDequeueOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = InfeedDequeueOpAdaptor; + template + using GenericAdaptor = InfeedDequeueOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dtype"), ::llvm::StringRef("shape")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getShapeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getShapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.InfeedDequeue"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Attribute getShapeAttr(); + std::optional> getShape(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setShapeAttr(::mlir::Attribute attr); + void setShape(std::optional> attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Attribute shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Attribute shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, std::optional> shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, std::optional> shape); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::InfeedDequeueOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::InfeedDequeueTupleOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class InfeedDequeueTupleOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + InfeedDequeueTupleOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + InfeedDequeueTupleOpGenericAdaptorBase(InfeedDequeueTupleOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr get_XlaShardingAttr(); + ::std::optional< ::llvm::StringRef > get_XlaSharding(); + ::mlir::ArrayAttr getLayoutsAttr(); + ::std::optional< ::mlir::ArrayAttr > getLayouts(); +}; +} // namespace detail +template +class InfeedDequeueTupleOpGenericAdaptor : public detail::InfeedDequeueTupleOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::InfeedDequeueTupleOpGenericAdaptorBase; +public: + InfeedDequeueTupleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + InfeedDequeueTupleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : InfeedDequeueTupleOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + InfeedDequeueTupleOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class InfeedDequeueTupleOpAdaptor : public InfeedDequeueTupleOpGenericAdaptor<::mlir::ValueRange> { +public: + using InfeedDequeueTupleOpGenericAdaptor::InfeedDequeueTupleOpGenericAdaptor; + InfeedDequeueTupleOpAdaptor(InfeedDequeueTupleOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class InfeedDequeueTupleOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = InfeedDequeueTupleOpAdaptor; + template + using GenericAdaptor = InfeedDequeueTupleOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("_XlaSharding"), ::llvm::StringRef("dtypes"), ::llvm::StringRef("layouts"), ::llvm::StringRef("shapes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr get_XlaShardingAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr get_XlaShardingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDtypesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDtypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getLayoutsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getLayoutsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getShapesAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.InfeedDequeueTuple"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutputs(); + ::mlir::StringAttr get_XlaShardingAttr(); + ::std::optional< ::llvm::StringRef > get_XlaSharding(); + ::mlir::ArrayAttr getLayoutsAttr(); + ::std::optional< ::mlir::ArrayAttr > getLayouts(); + mlir::TF::ResultShapeRange getShapes(); + mlir::ResultElementTypeRange getDtypes(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void set_XlaShardingAttr(::mlir::StringAttr attr); + void set_XlaSharding(::std::optional<::llvm::StringRef> attrValue); + void setLayoutsAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute remove_XlaShardingAttr(); + ::mlir::Attribute removeLayoutsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outputs, /*optional*/::mlir::StringAttr _XlaSharding, /*optional*/::mlir::ArrayAttr layouts); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::InfeedDequeueTupleOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::InfeedEnqueueTupleOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class InfeedEnqueueTupleOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + InfeedEnqueueTupleOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + InfeedEnqueueTupleOpGenericAdaptorBase(InfeedEnqueueTupleOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getDtypesAttr(); + ::mlir::ArrayAttr getDtypes(); + ::mlir::ArrayAttr getShapesAttr(); + ::mlir::ArrayAttr getShapes(); + ::mlir::ArrayAttr getLayoutsAttr(); + ::mlir::ArrayAttr getLayouts(); + ::mlir::IntegerAttr getDeviceOrdinalAttr(); + uint64_t getDeviceOrdinal(); +}; +} // namespace detail +template +class InfeedEnqueueTupleOpGenericAdaptor : public detail::InfeedEnqueueTupleOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::InfeedEnqueueTupleOpGenericAdaptorBase; +public: + InfeedEnqueueTupleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + InfeedEnqueueTupleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : InfeedEnqueueTupleOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + InfeedEnqueueTupleOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class InfeedEnqueueTupleOpAdaptor : public InfeedEnqueueTupleOpGenericAdaptor<::mlir::ValueRange> { +public: + using InfeedEnqueueTupleOpGenericAdaptor::InfeedEnqueueTupleOpGenericAdaptor; + InfeedEnqueueTupleOpAdaptor(InfeedEnqueueTupleOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class InfeedEnqueueTupleOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = InfeedEnqueueTupleOpAdaptor; + template + using GenericAdaptor = InfeedEnqueueTupleOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("device_ordinal"), ::llvm::StringRef("dtypes"), ::llvm::StringRef("layouts"), ::llvm::StringRef("shapes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDeviceOrdinalAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDeviceOrdinalAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDtypesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDtypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getLayoutsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getLayoutsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getShapesAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.InfeedEnqueueTuple"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::MutableOperandRange getInputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::ArrayAttr getDtypesAttr(); + ::mlir::ArrayAttr getDtypes(); + ::mlir::ArrayAttr getShapesAttr(); + ::mlir::ArrayAttr getShapes(); + ::mlir::ArrayAttr getLayoutsAttr(); + ::mlir::ArrayAttr getLayouts(); + ::mlir::IntegerAttr getDeviceOrdinalAttr(); + uint64_t getDeviceOrdinal(); + void setDtypesAttr(::mlir::ArrayAttr attr); + void setShapesAttr(::mlir::ArrayAttr attr); + void setLayoutsAttr(::mlir::ArrayAttr attr); + void setDeviceOrdinalAttr(::mlir::IntegerAttr attr); + void setDeviceOrdinal(::std::optional attrValue); + ::mlir::Attribute removeLayoutsAttr(); + ::mlir::Attribute removeDeviceOrdinalAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange inputs, ::mlir::ArrayAttr dtypes, ::mlir::ArrayAttr shapes, /*optional*/::mlir::ArrayAttr layouts, /*optional*/::mlir::IntegerAttr device_ordinal); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::mlir::ArrayAttr dtypes, ::mlir::ArrayAttr shapes, /*optional*/::mlir::ArrayAttr layouts, /*optional*/::mlir::IntegerAttr device_ordinal); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange inputs, ::mlir::ArrayAttr dtypes, ::mlir::ArrayAttr shapes, /*optional*/::mlir::ArrayAttr layouts, /*optional*/uint64_t device_ordinal = -1); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::mlir::ArrayAttr dtypes, ::mlir::ArrayAttr shapes, /*optional*/::mlir::ArrayAttr layouts, /*optional*/uint64_t device_ordinal = -1); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::InfeedEnqueueTupleOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::InitializeTableFromDatasetOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class InitializeTableFromDatasetOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + InitializeTableFromDatasetOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + InitializeTableFromDatasetOpGenericAdaptorBase(InitializeTableFromDatasetOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class InitializeTableFromDatasetOpGenericAdaptor : public detail::InitializeTableFromDatasetOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::InitializeTableFromDatasetOpGenericAdaptorBase; +public: + InitializeTableFromDatasetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + InitializeTableFromDatasetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : InitializeTableFromDatasetOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + InitializeTableFromDatasetOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTableHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getDataset() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class InitializeTableFromDatasetOpAdaptor : public InitializeTableFromDatasetOpGenericAdaptor<::mlir::ValueRange> { +public: + using InitializeTableFromDatasetOpGenericAdaptor::InitializeTableFromDatasetOpGenericAdaptor; + InitializeTableFromDatasetOpAdaptor(InitializeTableFromDatasetOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class InitializeTableFromDatasetOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = InitializeTableFromDatasetOpAdaptor; + template + using GenericAdaptor = InitializeTableFromDatasetOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.InitializeTableFromDataset"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTableHandle(); + ::mlir::TypedValue<::mlir::TensorType> getDataset(); + ::mlir::OpOperand &getTableHandleMutable(); + ::mlir::OpOperand &getDatasetMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value table_handle, ::mlir::Value dataset); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value table_handle, ::mlir::Value dataset); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::InitializeTableFromDatasetOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::InitializeTableFromTextFileOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class InitializeTableFromTextFileOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + InitializeTableFromTextFileOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + InitializeTableFromTextFileOpGenericAdaptorBase(InitializeTableFromTextFileOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getKeyIndexAttr(); + uint64_t getKeyIndex(); + ::mlir::IntegerAttr getValueIndexAttr(); + uint64_t getValueIndex(); + ::mlir::IntegerAttr getVocabSizeAttr(); + uint64_t getVocabSize(); + ::mlir::StringAttr getDelimiterAttr(); + ::llvm::StringRef getDelimiter(); + ::mlir::IntegerAttr getOffsetAttr(); + uint64_t getOffset(); +}; +} // namespace detail +template +class InitializeTableFromTextFileOpGenericAdaptor : public detail::InitializeTableFromTextFileOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::InitializeTableFromTextFileOpGenericAdaptorBase; +public: + InitializeTableFromTextFileOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + InitializeTableFromTextFileOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : InitializeTableFromTextFileOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + InitializeTableFromTextFileOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTableHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getFilename() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class InitializeTableFromTextFileOpAdaptor : public InitializeTableFromTextFileOpGenericAdaptor<::mlir::ValueRange> { +public: + using InitializeTableFromTextFileOpGenericAdaptor::InitializeTableFromTextFileOpGenericAdaptor; + InitializeTableFromTextFileOpAdaptor(InitializeTableFromTextFileOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class InitializeTableFromTextFileOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = InitializeTableFromTextFileOpAdaptor; + template + using GenericAdaptor = InitializeTableFromTextFileOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("delimiter"), ::llvm::StringRef("key_index"), ::llvm::StringRef("offset"), ::llvm::StringRef("value_index"), ::llvm::StringRef("vocab_size")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDelimiterAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDelimiterAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getKeyIndexAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getKeyIndexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOffsetAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOffsetAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getValueIndexAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getValueIndexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getVocabSizeAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getVocabSizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.InitializeTableFromTextFile"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTableHandle(); + ::mlir::TypedValue<::mlir::TensorType> getFilename(); + ::mlir::OpOperand &getTableHandleMutable(); + ::mlir::OpOperand &getFilenameMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getKeyIndexAttr(); + uint64_t getKeyIndex(); + ::mlir::IntegerAttr getValueIndexAttr(); + uint64_t getValueIndex(); + ::mlir::IntegerAttr getVocabSizeAttr(); + uint64_t getVocabSize(); + ::mlir::StringAttr getDelimiterAttr(); + ::llvm::StringRef getDelimiter(); + ::mlir::IntegerAttr getOffsetAttr(); + uint64_t getOffset(); + void setKeyIndexAttr(::mlir::IntegerAttr attr); + void setKeyIndex(uint64_t attrValue); + void setValueIndexAttr(::mlir::IntegerAttr attr); + void setValueIndex(uint64_t attrValue); + void setVocabSizeAttr(::mlir::IntegerAttr attr); + void setVocabSize(::std::optional attrValue); + void setDelimiterAttr(::mlir::StringAttr attr); + void setDelimiter(::std::optional<::llvm::StringRef> attrValue); + void setOffsetAttr(::mlir::IntegerAttr attr); + void setOffset(::std::optional attrValue); + ::mlir::Attribute removeVocabSizeAttr(); + ::mlir::Attribute removeDelimiterAttr(); + ::mlir::Attribute removeOffsetAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value table_handle, ::mlir::Value filename, ::mlir::IntegerAttr key_index, ::mlir::IntegerAttr value_index, /*optional*/::mlir::IntegerAttr vocab_size, /*optional*/::mlir::StringAttr delimiter, /*optional*/::mlir::IntegerAttr offset); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value table_handle, ::mlir::Value filename, ::mlir::IntegerAttr key_index, ::mlir::IntegerAttr value_index, /*optional*/::mlir::IntegerAttr vocab_size, /*optional*/::mlir::StringAttr delimiter, /*optional*/::mlir::IntegerAttr offset); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value table_handle, ::mlir::Value filename, uint64_t key_index, uint64_t value_index, /*optional*/uint64_t vocab_size = -1, /*optional*/::llvm::StringRef delimiter = "\t", /*optional*/uint64_t offset = 0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value table_handle, ::mlir::Value filename, uint64_t key_index, uint64_t value_index, /*optional*/uint64_t vocab_size = -1, /*optional*/::llvm::StringRef delimiter = "\t", /*optional*/uint64_t offset = 0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::InitializeTableFromTextFileOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::InitializeTableFromTextFileV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class InitializeTableFromTextFileV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + InitializeTableFromTextFileV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + InitializeTableFromTextFileV2OpGenericAdaptorBase(InitializeTableFromTextFileV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getKeyIndexAttr(); + uint64_t getKeyIndex(); + ::mlir::IntegerAttr getValueIndexAttr(); + uint64_t getValueIndex(); + ::mlir::IntegerAttr getVocabSizeAttr(); + uint64_t getVocabSize(); + ::mlir::StringAttr getDelimiterAttr(); + ::llvm::StringRef getDelimiter(); + ::mlir::IntegerAttr getOffsetAttr(); + uint64_t getOffset(); +}; +} // namespace detail +template +class InitializeTableFromTextFileV2OpGenericAdaptor : public detail::InitializeTableFromTextFileV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::InitializeTableFromTextFileV2OpGenericAdaptorBase; +public: + InitializeTableFromTextFileV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + InitializeTableFromTextFileV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : InitializeTableFromTextFileV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + InitializeTableFromTextFileV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTableHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getFilename() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class InitializeTableFromTextFileV2OpAdaptor : public InitializeTableFromTextFileV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using InitializeTableFromTextFileV2OpGenericAdaptor::InitializeTableFromTextFileV2OpGenericAdaptor; + InitializeTableFromTextFileV2OpAdaptor(InitializeTableFromTextFileV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class InitializeTableFromTextFileV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = InitializeTableFromTextFileV2OpAdaptor; + template + using GenericAdaptor = InitializeTableFromTextFileV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("delimiter"), ::llvm::StringRef("key_index"), ::llvm::StringRef("offset"), ::llvm::StringRef("value_index"), ::llvm::StringRef("vocab_size")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDelimiterAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDelimiterAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getKeyIndexAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getKeyIndexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOffsetAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOffsetAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getValueIndexAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getValueIndexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getVocabSizeAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getVocabSizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.InitializeTableFromTextFileV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTableHandle(); + ::mlir::TypedValue<::mlir::TensorType> getFilename(); + ::mlir::OpOperand &getTableHandleMutable(); + ::mlir::OpOperand &getFilenameMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getKeyIndexAttr(); + uint64_t getKeyIndex(); + ::mlir::IntegerAttr getValueIndexAttr(); + uint64_t getValueIndex(); + ::mlir::IntegerAttr getVocabSizeAttr(); + uint64_t getVocabSize(); + ::mlir::StringAttr getDelimiterAttr(); + ::llvm::StringRef getDelimiter(); + ::mlir::IntegerAttr getOffsetAttr(); + uint64_t getOffset(); + void setKeyIndexAttr(::mlir::IntegerAttr attr); + void setKeyIndex(uint64_t attrValue); + void setValueIndexAttr(::mlir::IntegerAttr attr); + void setValueIndex(uint64_t attrValue); + void setVocabSizeAttr(::mlir::IntegerAttr attr); + void setVocabSize(::std::optional attrValue); + void setDelimiterAttr(::mlir::StringAttr attr); + void setDelimiter(::std::optional<::llvm::StringRef> attrValue); + void setOffsetAttr(::mlir::IntegerAttr attr); + void setOffset(::std::optional attrValue); + ::mlir::Attribute removeVocabSizeAttr(); + ::mlir::Attribute removeDelimiterAttr(); + ::mlir::Attribute removeOffsetAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value table_handle, ::mlir::Value filename, ::mlir::IntegerAttr key_index, ::mlir::IntegerAttr value_index, /*optional*/::mlir::IntegerAttr vocab_size, /*optional*/::mlir::StringAttr delimiter, /*optional*/::mlir::IntegerAttr offset); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value table_handle, ::mlir::Value filename, ::mlir::IntegerAttr key_index, ::mlir::IntegerAttr value_index, /*optional*/::mlir::IntegerAttr vocab_size, /*optional*/::mlir::StringAttr delimiter, /*optional*/::mlir::IntegerAttr offset); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value table_handle, ::mlir::Value filename, uint64_t key_index, uint64_t value_index, /*optional*/uint64_t vocab_size = -1, /*optional*/::llvm::StringRef delimiter = "\t", /*optional*/uint64_t offset = 0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value table_handle, ::mlir::Value filename, uint64_t key_index, uint64_t value_index, /*optional*/uint64_t vocab_size = -1, /*optional*/::llvm::StringRef delimiter = "\t", /*optional*/uint64_t offset = 0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::InitializeTableFromTextFileV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::InitializeTableOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class InitializeTableOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + InitializeTableOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + InitializeTableOpGenericAdaptorBase(InitializeTableOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class InitializeTableOpGenericAdaptor : public detail::InitializeTableOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::InitializeTableOpGenericAdaptorBase; +public: + InitializeTableOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + InitializeTableOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : InitializeTableOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + InitializeTableOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTableHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getKeys() { + return (*getODSOperands(1).begin()); + } + + ValueT getValues() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class InitializeTableOpAdaptor : public InitializeTableOpGenericAdaptor<::mlir::ValueRange> { +public: + using InitializeTableOpGenericAdaptor::InitializeTableOpGenericAdaptor; + InitializeTableOpAdaptor(InitializeTableOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class InitializeTableOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = InitializeTableOpAdaptor; + template + using GenericAdaptor = InitializeTableOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tkey"), ::llvm::StringRef("Tval")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTkeyAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTkeyAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTvalAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTvalAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.InitializeTable"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTableHandle(); + ::mlir::TypedValue<::mlir::TensorType> getKeys(); + ::mlir::TypedValue<::mlir::TensorType> getValues(); + ::mlir::OpOperand &getTableHandleMutable(); + ::mlir::OpOperand &getKeysMutable(); + ::mlir::OpOperand &getValuesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Type getTkey(); + ::mlir::Type getTval(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value table_handle, ::mlir::Value keys, ::mlir::Value values); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value table_handle, ::mlir::Value keys, ::mlir::Value values); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::InitializeTableOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::InitializeTableV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class InitializeTableV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + InitializeTableV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + InitializeTableV2OpGenericAdaptorBase(InitializeTableV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class InitializeTableV2OpGenericAdaptor : public detail::InitializeTableV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::InitializeTableV2OpGenericAdaptorBase; +public: + InitializeTableV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + InitializeTableV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : InitializeTableV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + InitializeTableV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTableHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getKeys() { + return (*getODSOperands(1).begin()); + } + + ValueT getValues() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class InitializeTableV2OpAdaptor : public InitializeTableV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using InitializeTableV2OpGenericAdaptor::InitializeTableV2OpGenericAdaptor; + InitializeTableV2OpAdaptor(InitializeTableV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class InitializeTableV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = InitializeTableV2OpAdaptor; + template + using GenericAdaptor = InitializeTableV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tkey"), ::llvm::StringRef("Tval")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTkeyAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTkeyAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTvalAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTvalAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.InitializeTableV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTableHandle(); + ::mlir::TypedValue<::mlir::TensorType> getKeys(); + ::mlir::TypedValue<::mlir::TensorType> getValues(); + ::mlir::OpOperand &getTableHandleMutable(); + ::mlir::OpOperand &getKeysMutable(); + ::mlir::OpOperand &getValuesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Type getTkey(); + ::mlir::Type getTval(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value table_handle, ::mlir::Value keys, ::mlir::Value values); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value table_handle, ::mlir::Value keys, ::mlir::Value values); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::InitializeTableV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::InplaceAddOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class InplaceAddOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + InplaceAddOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + InplaceAddOpGenericAdaptorBase(InplaceAddOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class InplaceAddOpGenericAdaptor : public detail::InplaceAddOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::InplaceAddOpGenericAdaptorBase; +public: + InplaceAddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + InplaceAddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : InplaceAddOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + InplaceAddOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getI() { + return (*getODSOperands(1).begin()); + } + + ValueT getV() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class InplaceAddOpAdaptor : public InplaceAddOpGenericAdaptor<::mlir::ValueRange> { +public: + using InplaceAddOpGenericAdaptor::InplaceAddOpGenericAdaptor; + InplaceAddOpAdaptor(InplaceAddOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class InplaceAddOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = InplaceAddOpAdaptor; + template + using GenericAdaptor = InplaceAddOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.InplaceAdd"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getI(); + ::mlir::TypedValue<::mlir::TensorType> getV(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getIMutable(); + ::mlir::OpOperand &getVMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x, ::mlir::Value i, ::mlir::Value v); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value i, ::mlir::Value v); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::InplaceAddOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::InplaceUpdateOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class InplaceUpdateOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + InplaceUpdateOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + InplaceUpdateOpGenericAdaptorBase(InplaceUpdateOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class InplaceUpdateOpGenericAdaptor : public detail::InplaceUpdateOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::InplaceUpdateOpGenericAdaptorBase; +public: + InplaceUpdateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + InplaceUpdateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : InplaceUpdateOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + InplaceUpdateOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getI() { + return (*getODSOperands(1).begin()); + } + + ValueT getV() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class InplaceUpdateOpAdaptor : public InplaceUpdateOpGenericAdaptor<::mlir::ValueRange> { +public: + using InplaceUpdateOpGenericAdaptor::InplaceUpdateOpGenericAdaptor; + InplaceUpdateOpAdaptor(InplaceUpdateOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class InplaceUpdateOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = InplaceUpdateOpAdaptor; + template + using GenericAdaptor = InplaceUpdateOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.InplaceUpdate"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getI(); + ::mlir::TypedValue<::mlir::TensorType> getV(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getIMutable(); + ::mlir::OpOperand &getVMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x, ::mlir::Value i, ::mlir::Value v); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value i, ::mlir::Value v); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::InplaceUpdateOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::InvOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class InvOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + InvOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + InvOpGenericAdaptorBase(InvOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class InvOpGenericAdaptor : public detail::InvOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::InvOpGenericAdaptorBase; +public: + InvOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + InvOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : InvOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + InvOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class InvOpAdaptor : public InvOpGenericAdaptor<::mlir::ValueRange> { +public: + using InvOpGenericAdaptor::InvOpGenericAdaptor; + InvOpAdaptor(InvOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class InvOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = InvOpAdaptor; + template + using GenericAdaptor = InvOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Inv"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::InvOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::InvertOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class InvertOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + InvertOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + InvertOpGenericAdaptorBase(InvertOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class InvertOpGenericAdaptor : public detail::InvertOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::InvertOpGenericAdaptorBase; +public: + InvertOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + InvertOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : InvertOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + InvertOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class InvertOpAdaptor : public InvertOpGenericAdaptor<::mlir::ValueRange> { +public: + using InvertOpGenericAdaptor::InvertOpGenericAdaptor; + InvertOpAdaptor(InvertOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class InvertOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::IsInvolution, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = InvertOpAdaptor; + template + using GenericAdaptor = InvertOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Invert"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::InvertOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::InvertPermutationOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class InvertPermutationOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + InvertPermutationOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + InvertPermutationOpGenericAdaptorBase(InvertPermutationOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class InvertPermutationOpGenericAdaptor : public detail::InvertPermutationOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::InvertPermutationOpGenericAdaptorBase; +public: + InvertPermutationOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + InvertPermutationOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : InvertPermutationOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + InvertPermutationOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class InvertPermutationOpAdaptor : public InvertPermutationOpGenericAdaptor<::mlir::ValueRange> { +public: + using InvertPermutationOpGenericAdaptor::InvertPermutationOpGenericAdaptor; + InvertPermutationOpAdaptor(InvertPermutationOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class InvertPermutationOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = InvertPermutationOpAdaptor; + template + using GenericAdaptor = InvertPermutationOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.InvertPermutation"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::InvertPermutationOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::IsFiniteOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IsFiniteOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IsFiniteOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IsFiniteOpGenericAdaptorBase(IsFiniteOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class IsFiniteOpGenericAdaptor : public detail::IsFiniteOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IsFiniteOpGenericAdaptorBase; +public: + IsFiniteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IsFiniteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IsFiniteOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IsFiniteOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IsFiniteOpAdaptor : public IsFiniteOpGenericAdaptor<::mlir::ValueRange> { +public: + using IsFiniteOpGenericAdaptor::IsFiniteOpGenericAdaptor; + IsFiniteOpAdaptor(IsFiniteOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IsFiniteOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = IsFiniteOpAdaptor; + template + using GenericAdaptor = IsFiniteOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.IsFinite"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::IsFiniteOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::IsInfOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IsInfOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IsInfOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IsInfOpGenericAdaptorBase(IsInfOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class IsInfOpGenericAdaptor : public detail::IsInfOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IsInfOpGenericAdaptorBase; +public: + IsInfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IsInfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IsInfOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IsInfOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IsInfOpAdaptor : public IsInfOpGenericAdaptor<::mlir::ValueRange> { +public: + using IsInfOpGenericAdaptor::IsInfOpGenericAdaptor; + IsInfOpAdaptor(IsInfOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IsInfOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = IsInfOpAdaptor; + template + using GenericAdaptor = IsInfOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.IsInf"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::IsInfOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::IsNanOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IsNanOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IsNanOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IsNanOpGenericAdaptorBase(IsNanOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class IsNanOpGenericAdaptor : public detail::IsNanOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IsNanOpGenericAdaptorBase; +public: + IsNanOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IsNanOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IsNanOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IsNanOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IsNanOpAdaptor : public IsNanOpGenericAdaptor<::mlir::ValueRange> { +public: + using IsNanOpGenericAdaptor::IsNanOpGenericAdaptor; + IsNanOpAdaptor(IsNanOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IsNanOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = IsNanOpAdaptor; + template + using GenericAdaptor = IsNanOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.IsNan"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::IsNanOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::IteratorFromStringHandleOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IteratorFromStringHandleOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IteratorFromStringHandleOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IteratorFromStringHandleOpGenericAdaptorBase(IteratorFromStringHandleOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); +}; +} // namespace detail +template +class IteratorFromStringHandleOpGenericAdaptor : public detail::IteratorFromStringHandleOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IteratorFromStringHandleOpGenericAdaptorBase; +public: + IteratorFromStringHandleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IteratorFromStringHandleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IteratorFromStringHandleOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IteratorFromStringHandleOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getStringHandle() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IteratorFromStringHandleOpAdaptor : public IteratorFromStringHandleOpGenericAdaptor<::mlir::ValueRange> { +public: + using IteratorFromStringHandleOpGenericAdaptor::IteratorFromStringHandleOpGenericAdaptor; + IteratorFromStringHandleOpAdaptor(IteratorFromStringHandleOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IteratorFromStringHandleOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = IteratorFromStringHandleOpAdaptor; + template + using GenericAdaptor = IteratorFromStringHandleOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.IteratorFromStringHandle"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getStringHandle(); + ::mlir::OpOperand &getStringHandleMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResourceHandle(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeOutputTypesAttr(); + ::mlir::Attribute removeOutputShapesAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resource_handle, ::mlir::Value string_handle, /*optional*/::mlir::ArrayAttr output_types, /*optional*/::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value string_handle, /*optional*/::mlir::ArrayAttr output_types, /*optional*/::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::IteratorFromStringHandleOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::IteratorFromStringHandleV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IteratorFromStringHandleV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IteratorFromStringHandleV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IteratorFromStringHandleV2OpGenericAdaptorBase(IteratorFromStringHandleV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); +}; +} // namespace detail +template +class IteratorFromStringHandleV2OpGenericAdaptor : public detail::IteratorFromStringHandleV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IteratorFromStringHandleV2OpGenericAdaptorBase; +public: + IteratorFromStringHandleV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IteratorFromStringHandleV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IteratorFromStringHandleV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IteratorFromStringHandleV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getStringHandle() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IteratorFromStringHandleV2OpAdaptor : public IteratorFromStringHandleV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using IteratorFromStringHandleV2OpGenericAdaptor::IteratorFromStringHandleV2OpGenericAdaptor; + IteratorFromStringHandleV2OpAdaptor(IteratorFromStringHandleV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IteratorFromStringHandleV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = IteratorFromStringHandleV2OpAdaptor; + template + using GenericAdaptor = IteratorFromStringHandleV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.IteratorFromStringHandleV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getStringHandle(); + ::mlir::OpOperand &getStringHandleMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResourceHandle(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeOutputTypesAttr(); + ::mlir::Attribute removeOutputShapesAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resource_handle, ::mlir::Value string_handle, /*optional*/::mlir::ArrayAttr output_types, /*optional*/::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value string_handle, /*optional*/::mlir::ArrayAttr output_types, /*optional*/::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::IteratorFromStringHandleV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::IteratorGetNextAsOptionalOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IteratorGetNextAsOptionalOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IteratorGetNextAsOptionalOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IteratorGetNextAsOptionalOpGenericAdaptorBase(IteratorGetNextAsOptionalOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); +}; +} // namespace detail +template +class IteratorGetNextAsOptionalOpGenericAdaptor : public detail::IteratorGetNextAsOptionalOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IteratorGetNextAsOptionalOpGenericAdaptorBase; +public: + IteratorGetNextAsOptionalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IteratorGetNextAsOptionalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IteratorGetNextAsOptionalOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IteratorGetNextAsOptionalOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIterator() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IteratorGetNextAsOptionalOpAdaptor : public IteratorGetNextAsOptionalOpGenericAdaptor<::mlir::ValueRange> { +public: + using IteratorGetNextAsOptionalOpGenericAdaptor::IteratorGetNextAsOptionalOpGenericAdaptor; + IteratorGetNextAsOptionalOpAdaptor(IteratorGetNextAsOptionalOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IteratorGetNextAsOptionalOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = IteratorGetNextAsOptionalOpAdaptor; + template + using GenericAdaptor = IteratorGetNextAsOptionalOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.IteratorGetNextAsOptional"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getIterator(); + ::mlir::OpOperand &getIteratorMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOptional(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type optional, ::mlir::Value iterator, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value iterator, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::IteratorGetNextAsOptionalOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::IteratorGetNextOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IteratorGetNextOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IteratorGetNextOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IteratorGetNextOpGenericAdaptorBase(IteratorGetNextOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class IteratorGetNextOpGenericAdaptor : public detail::IteratorGetNextOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IteratorGetNextOpGenericAdaptorBase; +public: + IteratorGetNextOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IteratorGetNextOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IteratorGetNextOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IteratorGetNextOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIterator() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IteratorGetNextOpAdaptor : public IteratorGetNextOpGenericAdaptor<::mlir::ValueRange> { +public: + using IteratorGetNextOpGenericAdaptor::IteratorGetNextOpGenericAdaptor; + IteratorGetNextOpAdaptor(IteratorGetNextOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IteratorGetNextOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = IteratorGetNextOpAdaptor; + template + using GenericAdaptor = IteratorGetNextOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.IteratorGetNext"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getIterator(); + ::mlir::OpOperand &getIteratorMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getComponents(); + mlir::TF::ResultShapeRange getOutputShapes(); + mlir::ResultElementTypeRange getOutputTypes(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange components, ::mlir::Value iterator); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::IteratorGetNextOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::IteratorGetNextSyncOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IteratorGetNextSyncOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IteratorGetNextSyncOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IteratorGetNextSyncOpGenericAdaptorBase(IteratorGetNextSyncOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class IteratorGetNextSyncOpGenericAdaptor : public detail::IteratorGetNextSyncOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IteratorGetNextSyncOpGenericAdaptorBase; +public: + IteratorGetNextSyncOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IteratorGetNextSyncOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IteratorGetNextSyncOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IteratorGetNextSyncOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIterator() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IteratorGetNextSyncOpAdaptor : public IteratorGetNextSyncOpGenericAdaptor<::mlir::ValueRange> { +public: + using IteratorGetNextSyncOpGenericAdaptor::IteratorGetNextSyncOpGenericAdaptor; + IteratorGetNextSyncOpAdaptor(IteratorGetNextSyncOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IteratorGetNextSyncOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = IteratorGetNextSyncOpAdaptor; + template + using GenericAdaptor = IteratorGetNextSyncOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.IteratorGetNextSync"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getIterator(); + ::mlir::OpOperand &getIteratorMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getComponents(); + mlir::TF::ResultShapeRange getOutputShapes(); + mlir::ResultElementTypeRange getOutputTypes(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange components, ::mlir::Value iterator); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::IteratorGetNextSyncOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::IteratorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IteratorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IteratorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IteratorOpGenericAdaptorBase(IteratorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getSharedNameAttr(); + ::llvm::StringRef getSharedName(); + ::mlir::StringAttr getContainerAttr(); + ::llvm::StringRef getContainer(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); +}; +} // namespace detail +template +class IteratorOpGenericAdaptor : public detail::IteratorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IteratorOpGenericAdaptorBase; +public: + IteratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IteratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IteratorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IteratorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IteratorOpAdaptor : public IteratorOpGenericAdaptor<::mlir::ValueRange> { +public: + using IteratorOpGenericAdaptor::IteratorOpGenericAdaptor; + IteratorOpAdaptor(IteratorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IteratorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = IteratorOpAdaptor; + template + using GenericAdaptor = IteratorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("container"), ::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types"), ::llvm::StringRef("shared_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getContainerAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getContainerAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSharedNameAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSharedNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Iterator"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::StringAttr getSharedNameAttr(); + ::llvm::StringRef getSharedName(); + ::mlir::StringAttr getContainerAttr(); + ::llvm::StringRef getContainer(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + void setSharedNameAttr(::mlir::StringAttr attr); + void setSharedName(::llvm::StringRef attrValue); + void setContainerAttr(::mlir::StringAttr attr); + void setContainer(::llvm::StringRef attrValue); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::StringAttr shared_name, ::mlir::StringAttr container, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr shared_name, ::mlir::StringAttr container, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::llvm::StringRef shared_name, ::llvm::StringRef container, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef shared_name, ::llvm::StringRef container, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::IteratorOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::IteratorToStringHandleOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IteratorToStringHandleOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IteratorToStringHandleOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IteratorToStringHandleOpGenericAdaptorBase(IteratorToStringHandleOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class IteratorToStringHandleOpGenericAdaptor : public detail::IteratorToStringHandleOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IteratorToStringHandleOpGenericAdaptorBase; +public: + IteratorToStringHandleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IteratorToStringHandleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IteratorToStringHandleOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IteratorToStringHandleOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getResourceHandle() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IteratorToStringHandleOpAdaptor : public IteratorToStringHandleOpGenericAdaptor<::mlir::ValueRange> { +public: + using IteratorToStringHandleOpGenericAdaptor::IteratorToStringHandleOpGenericAdaptor; + IteratorToStringHandleOpAdaptor(IteratorToStringHandleOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IteratorToStringHandleOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = IteratorToStringHandleOpAdaptor; + template + using GenericAdaptor = IteratorToStringHandleOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.IteratorToStringHandle"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResourceHandle(); + ::mlir::OpOperand &getResourceHandleMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getStringHandle(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type string_handle, ::mlir::Value resource_handle); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value resource_handle); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::IteratorToStringHandleOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::IteratorV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IteratorV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IteratorV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IteratorV2OpGenericAdaptorBase(IteratorV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getSharedNameAttr(); + ::llvm::StringRef getSharedName(); + ::mlir::StringAttr getContainerAttr(); + ::llvm::StringRef getContainer(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); +}; +} // namespace detail +template +class IteratorV2OpGenericAdaptor : public detail::IteratorV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IteratorV2OpGenericAdaptorBase; +public: + IteratorV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IteratorV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IteratorV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IteratorV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IteratorV2OpAdaptor : public IteratorV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using IteratorV2OpGenericAdaptor::IteratorV2OpGenericAdaptor; + IteratorV2OpAdaptor(IteratorV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IteratorV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = IteratorV2OpAdaptor; + template + using GenericAdaptor = IteratorV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("container"), ::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types"), ::llvm::StringRef("shared_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getContainerAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getContainerAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSharedNameAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSharedNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.IteratorV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::StringAttr getSharedNameAttr(); + ::llvm::StringRef getSharedName(); + ::mlir::StringAttr getContainerAttr(); + ::llvm::StringRef getContainer(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + void setSharedNameAttr(::mlir::StringAttr attr); + void setSharedName(::llvm::StringRef attrValue); + void setContainerAttr(::mlir::StringAttr attr); + void setContainer(::llvm::StringRef attrValue); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::StringAttr shared_name, ::mlir::StringAttr container, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr shared_name, ::mlir::StringAttr container, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::llvm::StringRef shared_name, ::llvm::StringRef container, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef shared_name, ::llvm::StringRef container, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::IteratorV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::KthOrderStatisticOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class KthOrderStatisticOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + KthOrderStatisticOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + KthOrderStatisticOpGenericAdaptorBase(KthOrderStatisticOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getKAttr(); + uint64_t getK(); +}; +} // namespace detail +template +class KthOrderStatisticOpGenericAdaptor : public detail::KthOrderStatisticOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::KthOrderStatisticOpGenericAdaptorBase; +public: + KthOrderStatisticOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + KthOrderStatisticOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : KthOrderStatisticOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + KthOrderStatisticOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class KthOrderStatisticOpAdaptor : public KthOrderStatisticOpGenericAdaptor<::mlir::ValueRange> { +public: + using KthOrderStatisticOpGenericAdaptor::KthOrderStatisticOpGenericAdaptor; + KthOrderStatisticOpAdaptor(KthOrderStatisticOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class KthOrderStatisticOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = KthOrderStatisticOpAdaptor; + template + using GenericAdaptor = KthOrderStatisticOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("k")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getKAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getKAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.KthOrderStatistic"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getKAttr(); + uint64_t getK(); + void setKAttr(::mlir::IntegerAttr attr); + void setK(uint64_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::IntegerAttr k); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::IntegerAttr k); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, uint64_t k); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, uint64_t k); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::KthOrderStatisticOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::L2LossOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class L2LossOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + L2LossOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + L2LossOpGenericAdaptorBase(L2LossOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class L2LossOpGenericAdaptor : public detail::L2LossOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::L2LossOpGenericAdaptorBase; +public: + L2LossOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + L2LossOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : L2LossOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + L2LossOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class L2LossOpAdaptor : public L2LossOpGenericAdaptor<::mlir::ValueRange> { +public: + using L2LossOpGenericAdaptor::L2LossOpGenericAdaptor; + L2LossOpAdaptor(L2LossOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class L2LossOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = L2LossOpAdaptor; + template + using GenericAdaptor = L2LossOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.L2Loss"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::L2LossOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LRNGradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LRNGradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LRNGradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LRNGradOpGenericAdaptorBase(LRNGradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getDepthRadiusAttr(); + uint64_t getDepthRadius(); + ::mlir::FloatAttr getBiasAttr(); + ::llvm::APFloat getBias(); + ::mlir::FloatAttr getAlphaAttr(); + ::llvm::APFloat getAlpha(); + ::mlir::FloatAttr getBetaAttr(); + ::llvm::APFloat getBeta(); +}; +} // namespace detail +template +class LRNGradOpGenericAdaptor : public detail::LRNGradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LRNGradOpGenericAdaptorBase; +public: + LRNGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LRNGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LRNGradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LRNGradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputGrads() { + return (*getODSOperands(0).begin()); + } + + ValueT getInputImage() { + return (*getODSOperands(1).begin()); + } + + ValueT getOutputImage() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LRNGradOpAdaptor : public LRNGradOpGenericAdaptor<::mlir::ValueRange> { +public: + using LRNGradOpGenericAdaptor::LRNGradOpGenericAdaptor; + LRNGradOpAdaptor(LRNGradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LRNGradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LRNGradOpAdaptor; + template + using GenericAdaptor = LRNGradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("alpha"), ::llvm::StringRef("beta"), ::llvm::StringRef("bias"), ::llvm::StringRef("depth_radius")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAlphaAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAlphaAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getBetaAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getBetaAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getBiasAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getBiasAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getDepthRadiusAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getDepthRadiusAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LRNGrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputGrads(); + ::mlir::TypedValue<::mlir::TensorType> getInputImage(); + ::mlir::TypedValue<::mlir::TensorType> getOutputImage(); + ::mlir::OpOperand &getInputGradsMutable(); + ::mlir::OpOperand &getInputImageMutable(); + ::mlir::OpOperand &getOutputImageMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getDepthRadiusAttr(); + uint64_t getDepthRadius(); + ::mlir::FloatAttr getBiasAttr(); + ::llvm::APFloat getBias(); + ::mlir::FloatAttr getAlphaAttr(); + ::llvm::APFloat getAlpha(); + ::mlir::FloatAttr getBetaAttr(); + ::llvm::APFloat getBeta(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setDepthRadiusAttr(::mlir::IntegerAttr attr); + void setDepthRadius(::std::optional attrValue); + void setBiasAttr(::mlir::FloatAttr attr); + void setBias(::std::optional<::llvm::APFloat> attrValue); + void setAlphaAttr(::mlir::FloatAttr attr); + void setAlpha(::std::optional<::llvm::APFloat> attrValue); + void setBetaAttr(::mlir::FloatAttr attr); + void setBeta(::std::optional<::llvm::APFloat> attrValue); + ::mlir::Attribute removeDepthRadiusAttr(); + ::mlir::Attribute removeBiasAttr(); + ::mlir::Attribute removeAlphaAttr(); + ::mlir::Attribute removeBetaAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input_grads, ::mlir::Value input_image, ::mlir::Value output_image, /*optional*/::mlir::IntegerAttr depth_radius, /*optional*/::mlir::FloatAttr bias, /*optional*/::mlir::FloatAttr alpha, /*optional*/::mlir::FloatAttr beta); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_grads, ::mlir::Value input_image, ::mlir::Value output_image, /*optional*/::mlir::IntegerAttr depth_radius, /*optional*/::mlir::FloatAttr bias, /*optional*/::mlir::FloatAttr alpha, /*optional*/::mlir::FloatAttr beta); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input_grads, ::mlir::Value input_image, ::mlir::Value output_image, /*optional*/uint64_t depth_radius, /*optional*/::llvm::APFloat bias, /*optional*/::llvm::APFloat alpha, /*optional*/::llvm::APFloat beta); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_grads, ::mlir::Value input_image, ::mlir::Value output_image, /*optional*/uint64_t depth_radius, /*optional*/::llvm::APFloat bias, /*optional*/::llvm::APFloat alpha, /*optional*/::llvm::APFloat beta); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LRNGradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LRNOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LRNOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LRNOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LRNOpGenericAdaptorBase(LRNOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getDepthRadiusAttr(); + uint64_t getDepthRadius(); + ::mlir::FloatAttr getBiasAttr(); + ::llvm::APFloat getBias(); + ::mlir::FloatAttr getAlphaAttr(); + ::llvm::APFloat getAlpha(); + ::mlir::FloatAttr getBetaAttr(); + ::llvm::APFloat getBeta(); +}; +} // namespace detail +template +class LRNOpGenericAdaptor : public detail::LRNOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LRNOpGenericAdaptorBase; +public: + LRNOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LRNOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LRNOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LRNOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LRNOpAdaptor : public LRNOpGenericAdaptor<::mlir::ValueRange> { +public: + using LRNOpGenericAdaptor::LRNOpGenericAdaptor; + LRNOpAdaptor(LRNOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LRNOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LRNOpAdaptor; + template + using GenericAdaptor = LRNOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("alpha"), ::llvm::StringRef("beta"), ::llvm::StringRef("bias"), ::llvm::StringRef("depth_radius")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAlphaAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAlphaAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getBetaAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getBetaAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getBiasAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getBiasAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getDepthRadiusAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getDepthRadiusAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LRN"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getDepthRadiusAttr(); + uint64_t getDepthRadius(); + ::mlir::FloatAttr getBiasAttr(); + ::llvm::APFloat getBias(); + ::mlir::FloatAttr getAlphaAttr(); + ::llvm::APFloat getAlpha(); + ::mlir::FloatAttr getBetaAttr(); + ::llvm::APFloat getBeta(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setDepthRadiusAttr(::mlir::IntegerAttr attr); + void setDepthRadius(::std::optional attrValue); + void setBiasAttr(::mlir::FloatAttr attr); + void setBias(::std::optional<::llvm::APFloat> attrValue); + void setAlphaAttr(::mlir::FloatAttr attr); + void setAlpha(::std::optional<::llvm::APFloat> attrValue); + void setBetaAttr(::mlir::FloatAttr attr); + void setBeta(::std::optional<::llvm::APFloat> attrValue); + ::mlir::Attribute removeDepthRadiusAttr(); + ::mlir::Attribute removeBiasAttr(); + ::mlir::Attribute removeAlphaAttr(); + ::mlir::Attribute removeBetaAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, /*optional*/::mlir::IntegerAttr depth_radius, /*optional*/::mlir::FloatAttr bias, /*optional*/::mlir::FloatAttr alpha, /*optional*/::mlir::FloatAttr beta); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, /*optional*/::mlir::IntegerAttr depth_radius, /*optional*/::mlir::FloatAttr bias, /*optional*/::mlir::FloatAttr alpha, /*optional*/::mlir::FloatAttr beta); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, /*optional*/uint64_t depth_radius, /*optional*/::llvm::APFloat bias, /*optional*/::llvm::APFloat alpha, /*optional*/::llvm::APFloat beta); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, /*optional*/uint64_t depth_radius, /*optional*/::llvm::APFloat bias, /*optional*/::llvm::APFloat alpha, /*optional*/::llvm::APFloat beta); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LRNOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LeakyReluGradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LeakyReluGradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LeakyReluGradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LeakyReluGradOpGenericAdaptorBase(LeakyReluGradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::FloatAttr getAlphaAttr(); + ::llvm::APFloat getAlpha(); +}; +} // namespace detail +template +class LeakyReluGradOpGenericAdaptor : public detail::LeakyReluGradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LeakyReluGradOpGenericAdaptorBase; +public: + LeakyReluGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LeakyReluGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LeakyReluGradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LeakyReluGradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getGradients() { + return (*getODSOperands(0).begin()); + } + + ValueT getFeatures() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LeakyReluGradOpAdaptor : public LeakyReluGradOpGenericAdaptor<::mlir::ValueRange> { +public: + using LeakyReluGradOpGenericAdaptor::LeakyReluGradOpGenericAdaptor; + LeakyReluGradOpAdaptor(LeakyReluGradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LeakyReluGradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LeakyReluGradOpAdaptor; + template + using GenericAdaptor = LeakyReluGradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("alpha")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAlphaAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAlphaAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LeakyReluGrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getGradients(); + ::mlir::TypedValue<::mlir::TensorType> getFeatures(); + ::mlir::OpOperand &getGradientsMutable(); + ::mlir::OpOperand &getFeaturesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getBackprops(); + ::mlir::FloatAttr getAlphaAttr(); + ::llvm::APFloat getAlpha(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setAlphaAttr(::mlir::FloatAttr attr); + void setAlpha(::std::optional<::llvm::APFloat> attrValue); + ::mlir::Attribute removeAlphaAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type backprops, ::mlir::Value gradients, ::mlir::Value features, /*optional*/::mlir::FloatAttr alpha); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value gradients, ::mlir::Value features, /*optional*/::mlir::FloatAttr alpha); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value gradients, ::mlir::Value features, /*optional*/::mlir::FloatAttr alpha); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type backprops, ::mlir::Value gradients, ::mlir::Value features, /*optional*/::llvm::APFloat alpha); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value gradients, ::mlir::Value features, /*optional*/::llvm::APFloat alpha); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value gradients, ::mlir::Value features, /*optional*/::llvm::APFloat alpha); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LeakyReluGradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LeakyReluOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LeakyReluOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LeakyReluOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LeakyReluOpGenericAdaptorBase(LeakyReluOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::FloatAttr getAlphaAttr(); + ::llvm::APFloat getAlpha(); +}; +} // namespace detail +template +class LeakyReluOpGenericAdaptor : public detail::LeakyReluOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LeakyReluOpGenericAdaptorBase; +public: + LeakyReluOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LeakyReluOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LeakyReluOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LeakyReluOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getFeatures() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LeakyReluOpAdaptor : public LeakyReluOpGenericAdaptor<::mlir::ValueRange> { +public: + using LeakyReluOpGenericAdaptor::LeakyReluOpGenericAdaptor; + LeakyReluOpAdaptor(LeakyReluOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LeakyReluOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LeakyReluOpAdaptor; + template + using GenericAdaptor = LeakyReluOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("alpha")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAlphaAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAlphaAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LeakyRelu"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getFeatures(); + ::mlir::OpOperand &getFeaturesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getActivations(); + ::mlir::FloatAttr getAlphaAttr(); + ::llvm::APFloat getAlpha(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setAlphaAttr(::mlir::FloatAttr attr); + void setAlpha(::std::optional<::llvm::APFloat> attrValue); + ::mlir::Attribute removeAlphaAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type activations, ::mlir::Value features, /*optional*/::mlir::FloatAttr alpha); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value features, /*optional*/::mlir::FloatAttr alpha); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value features, /*optional*/::mlir::FloatAttr alpha); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type activations, ::mlir::Value features, /*optional*/::llvm::APFloat alpha); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value features, /*optional*/::llvm::APFloat alpha); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value features, /*optional*/::llvm::APFloat alpha); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LeakyReluOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LeftShiftOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LeftShiftOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LeftShiftOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LeftShiftOpGenericAdaptorBase(LeftShiftOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class LeftShiftOpGenericAdaptor : public detail::LeftShiftOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LeftShiftOpGenericAdaptorBase; +public: + LeftShiftOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LeftShiftOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LeftShiftOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LeftShiftOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LeftShiftOpAdaptor : public LeftShiftOpGenericAdaptor<::mlir::ValueRange> { +public: + using LeftShiftOpGenericAdaptor::LeftShiftOpGenericAdaptor; + LeftShiftOpAdaptor(LeftShiftOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LeftShiftOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LeftShiftOpAdaptor; + template + using GenericAdaptor = LeftShiftOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LeftShift"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LeftShiftOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LegacyCallOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LegacyCallOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LegacyCallOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LegacyCallOpGenericAdaptorBase(LegacyCallOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::FlatSymbolRefAttr getFAttr(); + ::llvm::StringRef getF(); + ::mlir::BoolAttr get_disableCallShapeInferenceAttr(); + bool get_disableCallShapeInference(); +}; +} // namespace detail +template +class LegacyCallOpGenericAdaptor : public detail::LegacyCallOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LegacyCallOpGenericAdaptorBase; +public: + LegacyCallOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LegacyCallOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LegacyCallOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LegacyCallOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LegacyCallOpAdaptor : public LegacyCallOpGenericAdaptor<::mlir::ValueRange> { +public: + using LegacyCallOpGenericAdaptor::LegacyCallOpGenericAdaptor; + LegacyCallOpAdaptor(LegacyCallOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LegacyCallOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = LegacyCallOpAdaptor; + template + using GenericAdaptor = LegacyCallOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("_disable_call_shape_inference"), ::llvm::StringRef("f")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr get_disableCallShapeInferenceAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr get_disableCallShapeInferenceAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getFAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getFAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LegacyCall"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutput(); + ::mlir::FlatSymbolRefAttr getFAttr(); + ::llvm::StringRef getF(); + ::mlir::BoolAttr get_disableCallShapeInferenceAttr(); + bool get_disableCallShapeInference(); + void setFAttr(::mlir::FlatSymbolRefAttr attr); + void setF(::llvm::StringRef attrValue); + void set_disableCallShapeInferenceAttr(::mlir::BoolAttr attr); + void set_disableCallShapeInference(::std::optional attrValue); + ::mlir::Attribute remove_disableCallShapeInferenceAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::ValueRange args, ::mlir::FlatSymbolRefAttr f, /*optional*/::mlir::BoolAttr _disable_call_shape_inference); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::ValueRange args, ::llvm::StringRef f, /*optional*/bool _disable_call_shape_inference = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verifySymbolUses(::mlir::SymbolTableCollection &symbolTable); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Gets the argument operands to the called function. + operand_range getArgOperands() { return getArgs(); } + MutableOperandRange getArgOperandsMutable() { + return getArgsMutable(); + } + + // Returns the callee of this operation. + CallInterfaceCallable getCallableForCallee() { return getFAttr(); } + // Sets the callee from the callable + void setCalleeFromCallable(::mlir::CallInterfaceCallable callee); + + // Returns the resolved callee function of this operation. + // Prefer passing in SymbolTableCollection to reduce lookup costs by + // enabling reusing cached symbol table lookup. + func::FuncOp ResolveFunc(::mlir::SymbolTableCollection* table) { + if (table) + return table->lookupNearestSymbolFrom(*this, getFAttr()); + return SymbolTable::lookupNearestSymbolFrom(*this, getFAttr()); + } + // TODO(b/204997177): Deprecate and remove. + func::FuncOp func() { return ResolveFunc(nullptr); } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LegacyCallOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LessEqualOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LessEqualOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LessEqualOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LessEqualOpGenericAdaptorBase(LessEqualOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class LessEqualOpGenericAdaptor : public detail::LessEqualOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LessEqualOpGenericAdaptorBase; +public: + LessEqualOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LessEqualOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LessEqualOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LessEqualOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LessEqualOpAdaptor : public LessEqualOpGenericAdaptor<::mlir::ValueRange> { +public: + using LessEqualOpGenericAdaptor::LessEqualOpGenericAdaptor; + LessEqualOpAdaptor(LessEqualOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LessEqualOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LessEqualOpAdaptor; + template + using GenericAdaptor = LessEqualOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LessEqual"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LessEqualOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LessOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LessOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LessOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LessOpGenericAdaptorBase(LessOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class LessOpGenericAdaptor : public detail::LessOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LessOpGenericAdaptorBase; +public: + LessOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LessOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LessOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LessOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LessOpAdaptor : public LessOpGenericAdaptor<::mlir::ValueRange> { +public: + using LessOpGenericAdaptor::LessOpGenericAdaptor; + LessOpAdaptor(LessOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LessOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LessOpAdaptor; + template + using GenericAdaptor = LessOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Less"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LessOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LgammaOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LgammaOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LgammaOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LgammaOpGenericAdaptorBase(LgammaOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class LgammaOpGenericAdaptor : public detail::LgammaOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LgammaOpGenericAdaptorBase; +public: + LgammaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LgammaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LgammaOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LgammaOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LgammaOpAdaptor : public LgammaOpGenericAdaptor<::mlir::ValueRange> { +public: + using LgammaOpGenericAdaptor::LgammaOpGenericAdaptor; + LgammaOpAdaptor(LgammaOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LgammaOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LgammaOpAdaptor; + template + using GenericAdaptor = LgammaOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Lgamma"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LgammaOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LinSpaceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LinSpaceOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LinSpaceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LinSpaceOpGenericAdaptorBase(LinSpaceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class LinSpaceOpGenericAdaptor : public detail::LinSpaceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LinSpaceOpGenericAdaptorBase; +public: + LinSpaceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LinSpaceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LinSpaceOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LinSpaceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getStart() { + return (*getODSOperands(0).begin()); + } + + ValueT getStop() { + return (*getODSOperands(1).begin()); + } + + ValueT getNum() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LinSpaceOpAdaptor : public LinSpaceOpGenericAdaptor<::mlir::ValueRange> { +public: + using LinSpaceOpGenericAdaptor::LinSpaceOpGenericAdaptor; + LinSpaceOpAdaptor(LinSpaceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LinSpaceOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LinSpaceOpAdaptor; + template + using GenericAdaptor = LinSpaceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tidx")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTidxAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTidxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LinSpace"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getStart(); + ::mlir::TypedValue<::mlir::TensorType> getStop(); + ::mlir::TypedValue<::mlir::TensorType> getNum(); + ::mlir::OpOperand &getStartMutable(); + ::mlir::OpOperand &getStopMutable(); + ::mlir::OpOperand &getNumMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTidx(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value start, ::mlir::Value stop, ::mlir::Value num); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value start, ::mlir::Value stop, ::mlir::Value num); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LinSpaceOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ListDiffOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ListDiffOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ListDiffOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ListDiffOpGenericAdaptorBase(ListDiffOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ListDiffOpGenericAdaptor : public detail::ListDiffOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ListDiffOpGenericAdaptorBase; +public: + ListDiffOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ListDiffOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ListDiffOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ListDiffOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ListDiffOpAdaptor : public ListDiffOpGenericAdaptor<::mlir::ValueRange> { +public: + using ListDiffOpGenericAdaptor::ListDiffOpGenericAdaptor; + ListDiffOpAdaptor(ListDiffOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ListDiffOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ListDiffOpAdaptor; + template + using GenericAdaptor = ListDiffOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("out_idx")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutIdxAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutIdxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ListDiff"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOut(); + ::mlir::TypedValue<::mlir::TensorType> getIdx(); + ::mlir::Type getT(); + ::mlir::Type getOutIdx(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, ::mlir::Type idx, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ListDiffOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LoadTPUEmbeddingADAMParametersGradAccumDebugOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LoadTPUEmbeddingADAMParametersGradAccumDebugOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LoadTPUEmbeddingADAMParametersGradAccumDebugOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LoadTPUEmbeddingADAMParametersGradAccumDebugOpGenericAdaptorBase(LoadTPUEmbeddingADAMParametersGradAccumDebugOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class LoadTPUEmbeddingADAMParametersGradAccumDebugOpGenericAdaptor : public detail::LoadTPUEmbeddingADAMParametersGradAccumDebugOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LoadTPUEmbeddingADAMParametersGradAccumDebugOpGenericAdaptorBase; +public: + LoadTPUEmbeddingADAMParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LoadTPUEmbeddingADAMParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LoadTPUEmbeddingADAMParametersGradAccumDebugOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LoadTPUEmbeddingADAMParametersGradAccumDebugOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getParameters() { + return (*getODSOperands(0).begin()); + } + + ValueT getMomenta() { + return (*getODSOperands(1).begin()); + } + + ValueT getVelocities() { + return (*getODSOperands(2).begin()); + } + + ValueT getGradientAccumulators() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LoadTPUEmbeddingADAMParametersGradAccumDebugOpAdaptor : public LoadTPUEmbeddingADAMParametersGradAccumDebugOpGenericAdaptor<::mlir::ValueRange> { +public: + using LoadTPUEmbeddingADAMParametersGradAccumDebugOpGenericAdaptor::LoadTPUEmbeddingADAMParametersGradAccumDebugOpGenericAdaptor; + LoadTPUEmbeddingADAMParametersGradAccumDebugOpAdaptor(LoadTPUEmbeddingADAMParametersGradAccumDebugOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LoadTPUEmbeddingADAMParametersGradAccumDebugOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LoadTPUEmbeddingADAMParametersGradAccumDebugOpAdaptor; + template + using GenericAdaptor = LoadTPUEmbeddingADAMParametersGradAccumDebugOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LoadTPUEmbeddingADAMParametersGradAccumDebug"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getMomenta(); + ::mlir::TypedValue<::mlir::TensorType> getVelocities(); + ::mlir::TypedValue<::mlir::TensorType> getGradientAccumulators(); + ::mlir::OpOperand &getParametersMutable(); + ::mlir::OpOperand &getMomentaMutable(); + ::mlir::OpOperand &getVelocitiesMutable(); + ::mlir::OpOperand &getGradientAccumulatorsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value momenta, ::mlir::Value velocities, ::mlir::Value gradient_accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value momenta, ::mlir::Value velocities, ::mlir::Value gradient_accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value momenta, ::mlir::Value velocities, ::mlir::Value gradient_accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value momenta, ::mlir::Value velocities, ::mlir::Value gradient_accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LoadTPUEmbeddingADAMParametersGradAccumDebugOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LoadTPUEmbeddingADAMParametersOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LoadTPUEmbeddingADAMParametersOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LoadTPUEmbeddingADAMParametersOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LoadTPUEmbeddingADAMParametersOpGenericAdaptorBase(LoadTPUEmbeddingADAMParametersOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class LoadTPUEmbeddingADAMParametersOpGenericAdaptor : public detail::LoadTPUEmbeddingADAMParametersOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LoadTPUEmbeddingADAMParametersOpGenericAdaptorBase; +public: + LoadTPUEmbeddingADAMParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LoadTPUEmbeddingADAMParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LoadTPUEmbeddingADAMParametersOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LoadTPUEmbeddingADAMParametersOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getParameters() { + return (*getODSOperands(0).begin()); + } + + ValueT getMomenta() { + return (*getODSOperands(1).begin()); + } + + ValueT getVelocities() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LoadTPUEmbeddingADAMParametersOpAdaptor : public LoadTPUEmbeddingADAMParametersOpGenericAdaptor<::mlir::ValueRange> { +public: + using LoadTPUEmbeddingADAMParametersOpGenericAdaptor::LoadTPUEmbeddingADAMParametersOpGenericAdaptor; + LoadTPUEmbeddingADAMParametersOpAdaptor(LoadTPUEmbeddingADAMParametersOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LoadTPUEmbeddingADAMParametersOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LoadTPUEmbeddingADAMParametersOpAdaptor; + template + using GenericAdaptor = LoadTPUEmbeddingADAMParametersOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LoadTPUEmbeddingADAMParameters"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getMomenta(); + ::mlir::TypedValue<::mlir::TensorType> getVelocities(); + ::mlir::OpOperand &getParametersMutable(); + ::mlir::OpOperand &getMomentaMutable(); + ::mlir::OpOperand &getVelocitiesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value momenta, ::mlir::Value velocities, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value momenta, ::mlir::Value velocities, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value momenta, ::mlir::Value velocities, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value momenta, ::mlir::Value velocities, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LoadTPUEmbeddingADAMParametersOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LoadTPUEmbeddingAdadeltaParametersGradAccumDebugOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LoadTPUEmbeddingAdadeltaParametersGradAccumDebugOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LoadTPUEmbeddingAdadeltaParametersGradAccumDebugOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LoadTPUEmbeddingAdadeltaParametersGradAccumDebugOpGenericAdaptorBase(LoadTPUEmbeddingAdadeltaParametersGradAccumDebugOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class LoadTPUEmbeddingAdadeltaParametersGradAccumDebugOpGenericAdaptor : public detail::LoadTPUEmbeddingAdadeltaParametersGradAccumDebugOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LoadTPUEmbeddingAdadeltaParametersGradAccumDebugOpGenericAdaptorBase; +public: + LoadTPUEmbeddingAdadeltaParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LoadTPUEmbeddingAdadeltaParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LoadTPUEmbeddingAdadeltaParametersGradAccumDebugOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LoadTPUEmbeddingAdadeltaParametersGradAccumDebugOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getParameters() { + return (*getODSOperands(0).begin()); + } + + ValueT getAccumulators() { + return (*getODSOperands(1).begin()); + } + + ValueT getUpdates() { + return (*getODSOperands(2).begin()); + } + + ValueT getGradientAccumulators() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LoadTPUEmbeddingAdadeltaParametersGradAccumDebugOpAdaptor : public LoadTPUEmbeddingAdadeltaParametersGradAccumDebugOpGenericAdaptor<::mlir::ValueRange> { +public: + using LoadTPUEmbeddingAdadeltaParametersGradAccumDebugOpGenericAdaptor::LoadTPUEmbeddingAdadeltaParametersGradAccumDebugOpGenericAdaptor; + LoadTPUEmbeddingAdadeltaParametersGradAccumDebugOpAdaptor(LoadTPUEmbeddingAdadeltaParametersGradAccumDebugOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LoadTPUEmbeddingAdadeltaParametersGradAccumDebugOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LoadTPUEmbeddingAdadeltaParametersGradAccumDebugOpAdaptor; + template + using GenericAdaptor = LoadTPUEmbeddingAdadeltaParametersGradAccumDebugOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LoadTPUEmbeddingAdadeltaParametersGradAccumDebug"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getAccumulators(); + ::mlir::TypedValue<::mlir::TensorType> getUpdates(); + ::mlir::TypedValue<::mlir::TensorType> getGradientAccumulators(); + ::mlir::OpOperand &getParametersMutable(); + ::mlir::OpOperand &getAccumulatorsMutable(); + ::mlir::OpOperand &getUpdatesMutable(); + ::mlir::OpOperand &getGradientAccumulatorsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value accumulators, ::mlir::Value updates, ::mlir::Value gradient_accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value accumulators, ::mlir::Value updates, ::mlir::Value gradient_accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value accumulators, ::mlir::Value updates, ::mlir::Value gradient_accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value accumulators, ::mlir::Value updates, ::mlir::Value gradient_accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LoadTPUEmbeddingAdadeltaParametersGradAccumDebugOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LoadTPUEmbeddingAdadeltaParametersOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LoadTPUEmbeddingAdadeltaParametersOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LoadTPUEmbeddingAdadeltaParametersOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LoadTPUEmbeddingAdadeltaParametersOpGenericAdaptorBase(LoadTPUEmbeddingAdadeltaParametersOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class LoadTPUEmbeddingAdadeltaParametersOpGenericAdaptor : public detail::LoadTPUEmbeddingAdadeltaParametersOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LoadTPUEmbeddingAdadeltaParametersOpGenericAdaptorBase; +public: + LoadTPUEmbeddingAdadeltaParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LoadTPUEmbeddingAdadeltaParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LoadTPUEmbeddingAdadeltaParametersOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LoadTPUEmbeddingAdadeltaParametersOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getParameters() { + return (*getODSOperands(0).begin()); + } + + ValueT getAccumulators() { + return (*getODSOperands(1).begin()); + } + + ValueT getUpdates() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LoadTPUEmbeddingAdadeltaParametersOpAdaptor : public LoadTPUEmbeddingAdadeltaParametersOpGenericAdaptor<::mlir::ValueRange> { +public: + using LoadTPUEmbeddingAdadeltaParametersOpGenericAdaptor::LoadTPUEmbeddingAdadeltaParametersOpGenericAdaptor; + LoadTPUEmbeddingAdadeltaParametersOpAdaptor(LoadTPUEmbeddingAdadeltaParametersOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LoadTPUEmbeddingAdadeltaParametersOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LoadTPUEmbeddingAdadeltaParametersOpAdaptor; + template + using GenericAdaptor = LoadTPUEmbeddingAdadeltaParametersOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LoadTPUEmbeddingAdadeltaParameters"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getAccumulators(); + ::mlir::TypedValue<::mlir::TensorType> getUpdates(); + ::mlir::OpOperand &getParametersMutable(); + ::mlir::OpOperand &getAccumulatorsMutable(); + ::mlir::OpOperand &getUpdatesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value accumulators, ::mlir::Value updates, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value accumulators, ::mlir::Value updates, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value accumulators, ::mlir::Value updates, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value accumulators, ::mlir::Value updates, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LoadTPUEmbeddingAdadeltaParametersOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LoadTPUEmbeddingAdagradParametersGradAccumDebugOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LoadTPUEmbeddingAdagradParametersGradAccumDebugOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LoadTPUEmbeddingAdagradParametersGradAccumDebugOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LoadTPUEmbeddingAdagradParametersGradAccumDebugOpGenericAdaptorBase(LoadTPUEmbeddingAdagradParametersGradAccumDebugOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class LoadTPUEmbeddingAdagradParametersGradAccumDebugOpGenericAdaptor : public detail::LoadTPUEmbeddingAdagradParametersGradAccumDebugOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LoadTPUEmbeddingAdagradParametersGradAccumDebugOpGenericAdaptorBase; +public: + LoadTPUEmbeddingAdagradParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LoadTPUEmbeddingAdagradParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LoadTPUEmbeddingAdagradParametersGradAccumDebugOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LoadTPUEmbeddingAdagradParametersGradAccumDebugOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getParameters() { + return (*getODSOperands(0).begin()); + } + + ValueT getAccumulators() { + return (*getODSOperands(1).begin()); + } + + ValueT getGradientAccumulators() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LoadTPUEmbeddingAdagradParametersGradAccumDebugOpAdaptor : public LoadTPUEmbeddingAdagradParametersGradAccumDebugOpGenericAdaptor<::mlir::ValueRange> { +public: + using LoadTPUEmbeddingAdagradParametersGradAccumDebugOpGenericAdaptor::LoadTPUEmbeddingAdagradParametersGradAccumDebugOpGenericAdaptor; + LoadTPUEmbeddingAdagradParametersGradAccumDebugOpAdaptor(LoadTPUEmbeddingAdagradParametersGradAccumDebugOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LoadTPUEmbeddingAdagradParametersGradAccumDebugOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LoadTPUEmbeddingAdagradParametersGradAccumDebugOpAdaptor; + template + using GenericAdaptor = LoadTPUEmbeddingAdagradParametersGradAccumDebugOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LoadTPUEmbeddingAdagradParametersGradAccumDebug"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getAccumulators(); + ::mlir::TypedValue<::mlir::TensorType> getGradientAccumulators(); + ::mlir::OpOperand &getParametersMutable(); + ::mlir::OpOperand &getAccumulatorsMutable(); + ::mlir::OpOperand &getGradientAccumulatorsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value accumulators, ::mlir::Value gradient_accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value accumulators, ::mlir::Value gradient_accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value accumulators, ::mlir::Value gradient_accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value accumulators, ::mlir::Value gradient_accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LoadTPUEmbeddingAdagradParametersGradAccumDebugOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LoadTPUEmbeddingAdagradParametersOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LoadTPUEmbeddingAdagradParametersOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LoadTPUEmbeddingAdagradParametersOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LoadTPUEmbeddingAdagradParametersOpGenericAdaptorBase(LoadTPUEmbeddingAdagradParametersOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class LoadTPUEmbeddingAdagradParametersOpGenericAdaptor : public detail::LoadTPUEmbeddingAdagradParametersOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LoadTPUEmbeddingAdagradParametersOpGenericAdaptorBase; +public: + LoadTPUEmbeddingAdagradParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LoadTPUEmbeddingAdagradParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LoadTPUEmbeddingAdagradParametersOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LoadTPUEmbeddingAdagradParametersOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getParameters() { + return (*getODSOperands(0).begin()); + } + + ValueT getAccumulators() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LoadTPUEmbeddingAdagradParametersOpAdaptor : public LoadTPUEmbeddingAdagradParametersOpGenericAdaptor<::mlir::ValueRange> { +public: + using LoadTPUEmbeddingAdagradParametersOpGenericAdaptor::LoadTPUEmbeddingAdagradParametersOpGenericAdaptor; + LoadTPUEmbeddingAdagradParametersOpAdaptor(LoadTPUEmbeddingAdagradParametersOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LoadTPUEmbeddingAdagradParametersOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LoadTPUEmbeddingAdagradParametersOpAdaptor; + template + using GenericAdaptor = LoadTPUEmbeddingAdagradParametersOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LoadTPUEmbeddingAdagradParameters"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getAccumulators(); + ::mlir::OpOperand &getParametersMutable(); + ::mlir::OpOperand &getAccumulatorsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LoadTPUEmbeddingAdagradParametersOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LoadTPUEmbeddingCenteredRMSPropParametersOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LoadTPUEmbeddingCenteredRMSPropParametersOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LoadTPUEmbeddingCenteredRMSPropParametersOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LoadTPUEmbeddingCenteredRMSPropParametersOpGenericAdaptorBase(LoadTPUEmbeddingCenteredRMSPropParametersOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class LoadTPUEmbeddingCenteredRMSPropParametersOpGenericAdaptor : public detail::LoadTPUEmbeddingCenteredRMSPropParametersOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LoadTPUEmbeddingCenteredRMSPropParametersOpGenericAdaptorBase; +public: + LoadTPUEmbeddingCenteredRMSPropParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LoadTPUEmbeddingCenteredRMSPropParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LoadTPUEmbeddingCenteredRMSPropParametersOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LoadTPUEmbeddingCenteredRMSPropParametersOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getParameters() { + return (*getODSOperands(0).begin()); + } + + ValueT getMs() { + return (*getODSOperands(1).begin()); + } + + ValueT getMom() { + return (*getODSOperands(2).begin()); + } + + ValueT getMg() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LoadTPUEmbeddingCenteredRMSPropParametersOpAdaptor : public LoadTPUEmbeddingCenteredRMSPropParametersOpGenericAdaptor<::mlir::ValueRange> { +public: + using LoadTPUEmbeddingCenteredRMSPropParametersOpGenericAdaptor::LoadTPUEmbeddingCenteredRMSPropParametersOpGenericAdaptor; + LoadTPUEmbeddingCenteredRMSPropParametersOpAdaptor(LoadTPUEmbeddingCenteredRMSPropParametersOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LoadTPUEmbeddingCenteredRMSPropParametersOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LoadTPUEmbeddingCenteredRMSPropParametersOpAdaptor; + template + using GenericAdaptor = LoadTPUEmbeddingCenteredRMSPropParametersOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LoadTPUEmbeddingCenteredRMSPropParameters"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getMs(); + ::mlir::TypedValue<::mlir::TensorType> getMom(); + ::mlir::TypedValue<::mlir::TensorType> getMg(); + ::mlir::OpOperand &getParametersMutable(); + ::mlir::OpOperand &getMsMutable(); + ::mlir::OpOperand &getMomMutable(); + ::mlir::OpOperand &getMgMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value ms, ::mlir::Value mom, ::mlir::Value mg, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value ms, ::mlir::Value mom, ::mlir::Value mg, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value ms, ::mlir::Value mom, ::mlir::Value mg, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value ms, ::mlir::Value mom, ::mlir::Value mg, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LoadTPUEmbeddingCenteredRMSPropParametersOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LoadTPUEmbeddingFTRLParametersGradAccumDebugOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LoadTPUEmbeddingFTRLParametersGradAccumDebugOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LoadTPUEmbeddingFTRLParametersGradAccumDebugOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LoadTPUEmbeddingFTRLParametersGradAccumDebugOpGenericAdaptorBase(LoadTPUEmbeddingFTRLParametersGradAccumDebugOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class LoadTPUEmbeddingFTRLParametersGradAccumDebugOpGenericAdaptor : public detail::LoadTPUEmbeddingFTRLParametersGradAccumDebugOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LoadTPUEmbeddingFTRLParametersGradAccumDebugOpGenericAdaptorBase; +public: + LoadTPUEmbeddingFTRLParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LoadTPUEmbeddingFTRLParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LoadTPUEmbeddingFTRLParametersGradAccumDebugOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LoadTPUEmbeddingFTRLParametersGradAccumDebugOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getParameters() { + return (*getODSOperands(0).begin()); + } + + ValueT getAccumulators() { + return (*getODSOperands(1).begin()); + } + + ValueT getLinears() { + return (*getODSOperands(2).begin()); + } + + ValueT getGradientAccumulators() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LoadTPUEmbeddingFTRLParametersGradAccumDebugOpAdaptor : public LoadTPUEmbeddingFTRLParametersGradAccumDebugOpGenericAdaptor<::mlir::ValueRange> { +public: + using LoadTPUEmbeddingFTRLParametersGradAccumDebugOpGenericAdaptor::LoadTPUEmbeddingFTRLParametersGradAccumDebugOpGenericAdaptor; + LoadTPUEmbeddingFTRLParametersGradAccumDebugOpAdaptor(LoadTPUEmbeddingFTRLParametersGradAccumDebugOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LoadTPUEmbeddingFTRLParametersGradAccumDebugOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LoadTPUEmbeddingFTRLParametersGradAccumDebugOpAdaptor; + template + using GenericAdaptor = LoadTPUEmbeddingFTRLParametersGradAccumDebugOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LoadTPUEmbeddingFTRLParametersGradAccumDebug"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getAccumulators(); + ::mlir::TypedValue<::mlir::TensorType> getLinears(); + ::mlir::TypedValue<::mlir::TensorType> getGradientAccumulators(); + ::mlir::OpOperand &getParametersMutable(); + ::mlir::OpOperand &getAccumulatorsMutable(); + ::mlir::OpOperand &getLinearsMutable(); + ::mlir::OpOperand &getGradientAccumulatorsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value accumulators, ::mlir::Value linears, ::mlir::Value gradient_accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value accumulators, ::mlir::Value linears, ::mlir::Value gradient_accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value accumulators, ::mlir::Value linears, ::mlir::Value gradient_accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value accumulators, ::mlir::Value linears, ::mlir::Value gradient_accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LoadTPUEmbeddingFTRLParametersGradAccumDebugOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LoadTPUEmbeddingFTRLParametersOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LoadTPUEmbeddingFTRLParametersOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LoadTPUEmbeddingFTRLParametersOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LoadTPUEmbeddingFTRLParametersOpGenericAdaptorBase(LoadTPUEmbeddingFTRLParametersOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class LoadTPUEmbeddingFTRLParametersOpGenericAdaptor : public detail::LoadTPUEmbeddingFTRLParametersOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LoadTPUEmbeddingFTRLParametersOpGenericAdaptorBase; +public: + LoadTPUEmbeddingFTRLParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LoadTPUEmbeddingFTRLParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LoadTPUEmbeddingFTRLParametersOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LoadTPUEmbeddingFTRLParametersOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getParameters() { + return (*getODSOperands(0).begin()); + } + + ValueT getAccumulators() { + return (*getODSOperands(1).begin()); + } + + ValueT getLinears() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LoadTPUEmbeddingFTRLParametersOpAdaptor : public LoadTPUEmbeddingFTRLParametersOpGenericAdaptor<::mlir::ValueRange> { +public: + using LoadTPUEmbeddingFTRLParametersOpGenericAdaptor::LoadTPUEmbeddingFTRLParametersOpGenericAdaptor; + LoadTPUEmbeddingFTRLParametersOpAdaptor(LoadTPUEmbeddingFTRLParametersOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LoadTPUEmbeddingFTRLParametersOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LoadTPUEmbeddingFTRLParametersOpAdaptor; + template + using GenericAdaptor = LoadTPUEmbeddingFTRLParametersOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LoadTPUEmbeddingFTRLParameters"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getAccumulators(); + ::mlir::TypedValue<::mlir::TensorType> getLinears(); + ::mlir::OpOperand &getParametersMutable(); + ::mlir::OpOperand &getAccumulatorsMutable(); + ::mlir::OpOperand &getLinearsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value accumulators, ::mlir::Value linears, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value accumulators, ::mlir::Value linears, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value accumulators, ::mlir::Value linears, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value accumulators, ::mlir::Value linears, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LoadTPUEmbeddingFTRLParametersOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LoadTPUEmbeddingMDLAdagradLightParametersOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LoadTPUEmbeddingMDLAdagradLightParametersOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LoadTPUEmbeddingMDLAdagradLightParametersOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LoadTPUEmbeddingMDLAdagradLightParametersOpGenericAdaptorBase(LoadTPUEmbeddingMDLAdagradLightParametersOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class LoadTPUEmbeddingMDLAdagradLightParametersOpGenericAdaptor : public detail::LoadTPUEmbeddingMDLAdagradLightParametersOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LoadTPUEmbeddingMDLAdagradLightParametersOpGenericAdaptorBase; +public: + LoadTPUEmbeddingMDLAdagradLightParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LoadTPUEmbeddingMDLAdagradLightParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LoadTPUEmbeddingMDLAdagradLightParametersOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LoadTPUEmbeddingMDLAdagradLightParametersOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getParameters() { + return (*getODSOperands(0).begin()); + } + + ValueT getAccumulators() { + return (*getODSOperands(1).begin()); + } + + ValueT getWeights() { + return (*getODSOperands(2).begin()); + } + + ValueT getBenefits() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LoadTPUEmbeddingMDLAdagradLightParametersOpAdaptor : public LoadTPUEmbeddingMDLAdagradLightParametersOpGenericAdaptor<::mlir::ValueRange> { +public: + using LoadTPUEmbeddingMDLAdagradLightParametersOpGenericAdaptor::LoadTPUEmbeddingMDLAdagradLightParametersOpGenericAdaptor; + LoadTPUEmbeddingMDLAdagradLightParametersOpAdaptor(LoadTPUEmbeddingMDLAdagradLightParametersOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LoadTPUEmbeddingMDLAdagradLightParametersOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LoadTPUEmbeddingMDLAdagradLightParametersOpAdaptor; + template + using GenericAdaptor = LoadTPUEmbeddingMDLAdagradLightParametersOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LoadTPUEmbeddingMDLAdagradLightParameters"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getAccumulators(); + ::mlir::TypedValue<::mlir::TensorType> getWeights(); + ::mlir::TypedValue<::mlir::TensorType> getBenefits(); + ::mlir::OpOperand &getParametersMutable(); + ::mlir::OpOperand &getAccumulatorsMutable(); + ::mlir::OpOperand &getWeightsMutable(); + ::mlir::OpOperand &getBenefitsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value accumulators, ::mlir::Value weights, ::mlir::Value benefits, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value accumulators, ::mlir::Value weights, ::mlir::Value benefits, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value accumulators, ::mlir::Value weights, ::mlir::Value benefits, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value accumulators, ::mlir::Value weights, ::mlir::Value benefits, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LoadTPUEmbeddingMDLAdagradLightParametersOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LoadTPUEmbeddingMomentumParametersGradAccumDebugOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LoadTPUEmbeddingMomentumParametersGradAccumDebugOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LoadTPUEmbeddingMomentumParametersGradAccumDebugOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LoadTPUEmbeddingMomentumParametersGradAccumDebugOpGenericAdaptorBase(LoadTPUEmbeddingMomentumParametersGradAccumDebugOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class LoadTPUEmbeddingMomentumParametersGradAccumDebugOpGenericAdaptor : public detail::LoadTPUEmbeddingMomentumParametersGradAccumDebugOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LoadTPUEmbeddingMomentumParametersGradAccumDebugOpGenericAdaptorBase; +public: + LoadTPUEmbeddingMomentumParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LoadTPUEmbeddingMomentumParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LoadTPUEmbeddingMomentumParametersGradAccumDebugOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LoadTPUEmbeddingMomentumParametersGradAccumDebugOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getParameters() { + return (*getODSOperands(0).begin()); + } + + ValueT getMomenta() { + return (*getODSOperands(1).begin()); + } + + ValueT getGradientAccumulators() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LoadTPUEmbeddingMomentumParametersGradAccumDebugOpAdaptor : public LoadTPUEmbeddingMomentumParametersGradAccumDebugOpGenericAdaptor<::mlir::ValueRange> { +public: + using LoadTPUEmbeddingMomentumParametersGradAccumDebugOpGenericAdaptor::LoadTPUEmbeddingMomentumParametersGradAccumDebugOpGenericAdaptor; + LoadTPUEmbeddingMomentumParametersGradAccumDebugOpAdaptor(LoadTPUEmbeddingMomentumParametersGradAccumDebugOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LoadTPUEmbeddingMomentumParametersGradAccumDebugOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LoadTPUEmbeddingMomentumParametersGradAccumDebugOpAdaptor; + template + using GenericAdaptor = LoadTPUEmbeddingMomentumParametersGradAccumDebugOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LoadTPUEmbeddingMomentumParametersGradAccumDebug"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getMomenta(); + ::mlir::TypedValue<::mlir::TensorType> getGradientAccumulators(); + ::mlir::OpOperand &getParametersMutable(); + ::mlir::OpOperand &getMomentaMutable(); + ::mlir::OpOperand &getGradientAccumulatorsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value momenta, ::mlir::Value gradient_accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value momenta, ::mlir::Value gradient_accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value momenta, ::mlir::Value gradient_accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value momenta, ::mlir::Value gradient_accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LoadTPUEmbeddingMomentumParametersGradAccumDebugOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LoadTPUEmbeddingMomentumParametersOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LoadTPUEmbeddingMomentumParametersOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LoadTPUEmbeddingMomentumParametersOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LoadTPUEmbeddingMomentumParametersOpGenericAdaptorBase(LoadTPUEmbeddingMomentumParametersOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class LoadTPUEmbeddingMomentumParametersOpGenericAdaptor : public detail::LoadTPUEmbeddingMomentumParametersOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LoadTPUEmbeddingMomentumParametersOpGenericAdaptorBase; +public: + LoadTPUEmbeddingMomentumParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LoadTPUEmbeddingMomentumParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LoadTPUEmbeddingMomentumParametersOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LoadTPUEmbeddingMomentumParametersOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getParameters() { + return (*getODSOperands(0).begin()); + } + + ValueT getMomenta() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LoadTPUEmbeddingMomentumParametersOpAdaptor : public LoadTPUEmbeddingMomentumParametersOpGenericAdaptor<::mlir::ValueRange> { +public: + using LoadTPUEmbeddingMomentumParametersOpGenericAdaptor::LoadTPUEmbeddingMomentumParametersOpGenericAdaptor; + LoadTPUEmbeddingMomentumParametersOpAdaptor(LoadTPUEmbeddingMomentumParametersOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LoadTPUEmbeddingMomentumParametersOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LoadTPUEmbeddingMomentumParametersOpAdaptor; + template + using GenericAdaptor = LoadTPUEmbeddingMomentumParametersOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LoadTPUEmbeddingMomentumParameters"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getMomenta(); + ::mlir::OpOperand &getParametersMutable(); + ::mlir::OpOperand &getMomentaMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value momenta, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value momenta, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value momenta, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value momenta, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LoadTPUEmbeddingMomentumParametersOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LoadTPUEmbeddingProximalAdagradParametersGradAccumDebugOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LoadTPUEmbeddingProximalAdagradParametersGradAccumDebugOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LoadTPUEmbeddingProximalAdagradParametersGradAccumDebugOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LoadTPUEmbeddingProximalAdagradParametersGradAccumDebugOpGenericAdaptorBase(LoadTPUEmbeddingProximalAdagradParametersGradAccumDebugOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class LoadTPUEmbeddingProximalAdagradParametersGradAccumDebugOpGenericAdaptor : public detail::LoadTPUEmbeddingProximalAdagradParametersGradAccumDebugOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LoadTPUEmbeddingProximalAdagradParametersGradAccumDebugOpGenericAdaptorBase; +public: + LoadTPUEmbeddingProximalAdagradParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LoadTPUEmbeddingProximalAdagradParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LoadTPUEmbeddingProximalAdagradParametersGradAccumDebugOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LoadTPUEmbeddingProximalAdagradParametersGradAccumDebugOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getParameters() { + return (*getODSOperands(0).begin()); + } + + ValueT getAccumulators() { + return (*getODSOperands(1).begin()); + } + + ValueT getGradientAccumulators() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LoadTPUEmbeddingProximalAdagradParametersGradAccumDebugOpAdaptor : public LoadTPUEmbeddingProximalAdagradParametersGradAccumDebugOpGenericAdaptor<::mlir::ValueRange> { +public: + using LoadTPUEmbeddingProximalAdagradParametersGradAccumDebugOpGenericAdaptor::LoadTPUEmbeddingProximalAdagradParametersGradAccumDebugOpGenericAdaptor; + LoadTPUEmbeddingProximalAdagradParametersGradAccumDebugOpAdaptor(LoadTPUEmbeddingProximalAdagradParametersGradAccumDebugOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LoadTPUEmbeddingProximalAdagradParametersGradAccumDebugOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LoadTPUEmbeddingProximalAdagradParametersGradAccumDebugOpAdaptor; + template + using GenericAdaptor = LoadTPUEmbeddingProximalAdagradParametersGradAccumDebugOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LoadTPUEmbeddingProximalAdagradParametersGradAccumDebug"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getAccumulators(); + ::mlir::TypedValue<::mlir::TensorType> getGradientAccumulators(); + ::mlir::OpOperand &getParametersMutable(); + ::mlir::OpOperand &getAccumulatorsMutable(); + ::mlir::OpOperand &getGradientAccumulatorsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value accumulators, ::mlir::Value gradient_accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value accumulators, ::mlir::Value gradient_accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value accumulators, ::mlir::Value gradient_accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value accumulators, ::mlir::Value gradient_accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LoadTPUEmbeddingProximalAdagradParametersGradAccumDebugOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LoadTPUEmbeddingProximalAdagradParametersOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LoadTPUEmbeddingProximalAdagradParametersOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LoadTPUEmbeddingProximalAdagradParametersOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LoadTPUEmbeddingProximalAdagradParametersOpGenericAdaptorBase(LoadTPUEmbeddingProximalAdagradParametersOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class LoadTPUEmbeddingProximalAdagradParametersOpGenericAdaptor : public detail::LoadTPUEmbeddingProximalAdagradParametersOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LoadTPUEmbeddingProximalAdagradParametersOpGenericAdaptorBase; +public: + LoadTPUEmbeddingProximalAdagradParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LoadTPUEmbeddingProximalAdagradParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LoadTPUEmbeddingProximalAdagradParametersOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LoadTPUEmbeddingProximalAdagradParametersOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getParameters() { + return (*getODSOperands(0).begin()); + } + + ValueT getAccumulators() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LoadTPUEmbeddingProximalAdagradParametersOpAdaptor : public LoadTPUEmbeddingProximalAdagradParametersOpGenericAdaptor<::mlir::ValueRange> { +public: + using LoadTPUEmbeddingProximalAdagradParametersOpGenericAdaptor::LoadTPUEmbeddingProximalAdagradParametersOpGenericAdaptor; + LoadTPUEmbeddingProximalAdagradParametersOpAdaptor(LoadTPUEmbeddingProximalAdagradParametersOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LoadTPUEmbeddingProximalAdagradParametersOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LoadTPUEmbeddingProximalAdagradParametersOpAdaptor; + template + using GenericAdaptor = LoadTPUEmbeddingProximalAdagradParametersOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LoadTPUEmbeddingProximalAdagradParameters"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getAccumulators(); + ::mlir::OpOperand &getParametersMutable(); + ::mlir::OpOperand &getAccumulatorsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LoadTPUEmbeddingProximalAdagradParametersOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LoadTPUEmbeddingProximalYogiParametersGradAccumDebugOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LoadTPUEmbeddingProximalYogiParametersGradAccumDebugOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LoadTPUEmbeddingProximalYogiParametersGradAccumDebugOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LoadTPUEmbeddingProximalYogiParametersGradAccumDebugOpGenericAdaptorBase(LoadTPUEmbeddingProximalYogiParametersGradAccumDebugOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class LoadTPUEmbeddingProximalYogiParametersGradAccumDebugOpGenericAdaptor : public detail::LoadTPUEmbeddingProximalYogiParametersGradAccumDebugOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LoadTPUEmbeddingProximalYogiParametersGradAccumDebugOpGenericAdaptorBase; +public: + LoadTPUEmbeddingProximalYogiParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LoadTPUEmbeddingProximalYogiParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LoadTPUEmbeddingProximalYogiParametersGradAccumDebugOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LoadTPUEmbeddingProximalYogiParametersGradAccumDebugOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getParameters() { + return (*getODSOperands(0).begin()); + } + + ValueT getV() { + return (*getODSOperands(1).begin()); + } + + ValueT getM() { + return (*getODSOperands(2).begin()); + } + + ValueT getGradientAccumulators() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LoadTPUEmbeddingProximalYogiParametersGradAccumDebugOpAdaptor : public LoadTPUEmbeddingProximalYogiParametersGradAccumDebugOpGenericAdaptor<::mlir::ValueRange> { +public: + using LoadTPUEmbeddingProximalYogiParametersGradAccumDebugOpGenericAdaptor::LoadTPUEmbeddingProximalYogiParametersGradAccumDebugOpGenericAdaptor; + LoadTPUEmbeddingProximalYogiParametersGradAccumDebugOpAdaptor(LoadTPUEmbeddingProximalYogiParametersGradAccumDebugOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LoadTPUEmbeddingProximalYogiParametersGradAccumDebugOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LoadTPUEmbeddingProximalYogiParametersGradAccumDebugOpAdaptor; + template + using GenericAdaptor = LoadTPUEmbeddingProximalYogiParametersGradAccumDebugOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LoadTPUEmbeddingProximalYogiParametersGradAccumDebug"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getV(); + ::mlir::TypedValue<::mlir::TensorType> getM(); + ::mlir::TypedValue<::mlir::TensorType> getGradientAccumulators(); + ::mlir::OpOperand &getParametersMutable(); + ::mlir::OpOperand &getVMutable(); + ::mlir::OpOperand &getMMutable(); + ::mlir::OpOperand &getGradientAccumulatorsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value v, ::mlir::Value m, ::mlir::Value gradient_accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value v, ::mlir::Value m, ::mlir::Value gradient_accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value v, ::mlir::Value m, ::mlir::Value gradient_accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value v, ::mlir::Value m, ::mlir::Value gradient_accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LoadTPUEmbeddingProximalYogiParametersGradAccumDebugOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LoadTPUEmbeddingProximalYogiParametersOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LoadTPUEmbeddingProximalYogiParametersOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LoadTPUEmbeddingProximalYogiParametersOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LoadTPUEmbeddingProximalYogiParametersOpGenericAdaptorBase(LoadTPUEmbeddingProximalYogiParametersOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class LoadTPUEmbeddingProximalYogiParametersOpGenericAdaptor : public detail::LoadTPUEmbeddingProximalYogiParametersOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LoadTPUEmbeddingProximalYogiParametersOpGenericAdaptorBase; +public: + LoadTPUEmbeddingProximalYogiParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LoadTPUEmbeddingProximalYogiParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LoadTPUEmbeddingProximalYogiParametersOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LoadTPUEmbeddingProximalYogiParametersOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getParameters() { + return (*getODSOperands(0).begin()); + } + + ValueT getV() { + return (*getODSOperands(1).begin()); + } + + ValueT getM() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LoadTPUEmbeddingProximalYogiParametersOpAdaptor : public LoadTPUEmbeddingProximalYogiParametersOpGenericAdaptor<::mlir::ValueRange> { +public: + using LoadTPUEmbeddingProximalYogiParametersOpGenericAdaptor::LoadTPUEmbeddingProximalYogiParametersOpGenericAdaptor; + LoadTPUEmbeddingProximalYogiParametersOpAdaptor(LoadTPUEmbeddingProximalYogiParametersOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LoadTPUEmbeddingProximalYogiParametersOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LoadTPUEmbeddingProximalYogiParametersOpAdaptor; + template + using GenericAdaptor = LoadTPUEmbeddingProximalYogiParametersOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LoadTPUEmbeddingProximalYogiParameters"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getV(); + ::mlir::TypedValue<::mlir::TensorType> getM(); + ::mlir::OpOperand &getParametersMutable(); + ::mlir::OpOperand &getVMutable(); + ::mlir::OpOperand &getMMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value v, ::mlir::Value m, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value v, ::mlir::Value m, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value v, ::mlir::Value m, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value v, ::mlir::Value m, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LoadTPUEmbeddingProximalYogiParametersOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LoadTPUEmbeddingRMSPropParametersGradAccumDebugOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LoadTPUEmbeddingRMSPropParametersGradAccumDebugOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LoadTPUEmbeddingRMSPropParametersGradAccumDebugOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LoadTPUEmbeddingRMSPropParametersGradAccumDebugOpGenericAdaptorBase(LoadTPUEmbeddingRMSPropParametersGradAccumDebugOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class LoadTPUEmbeddingRMSPropParametersGradAccumDebugOpGenericAdaptor : public detail::LoadTPUEmbeddingRMSPropParametersGradAccumDebugOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LoadTPUEmbeddingRMSPropParametersGradAccumDebugOpGenericAdaptorBase; +public: + LoadTPUEmbeddingRMSPropParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LoadTPUEmbeddingRMSPropParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LoadTPUEmbeddingRMSPropParametersGradAccumDebugOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LoadTPUEmbeddingRMSPropParametersGradAccumDebugOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getParameters() { + return (*getODSOperands(0).begin()); + } + + ValueT getMs() { + return (*getODSOperands(1).begin()); + } + + ValueT getMom() { + return (*getODSOperands(2).begin()); + } + + ValueT getGradientAccumulators() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LoadTPUEmbeddingRMSPropParametersGradAccumDebugOpAdaptor : public LoadTPUEmbeddingRMSPropParametersGradAccumDebugOpGenericAdaptor<::mlir::ValueRange> { +public: + using LoadTPUEmbeddingRMSPropParametersGradAccumDebugOpGenericAdaptor::LoadTPUEmbeddingRMSPropParametersGradAccumDebugOpGenericAdaptor; + LoadTPUEmbeddingRMSPropParametersGradAccumDebugOpAdaptor(LoadTPUEmbeddingRMSPropParametersGradAccumDebugOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LoadTPUEmbeddingRMSPropParametersGradAccumDebugOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LoadTPUEmbeddingRMSPropParametersGradAccumDebugOpAdaptor; + template + using GenericAdaptor = LoadTPUEmbeddingRMSPropParametersGradAccumDebugOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LoadTPUEmbeddingRMSPropParametersGradAccumDebug"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getMs(); + ::mlir::TypedValue<::mlir::TensorType> getMom(); + ::mlir::TypedValue<::mlir::TensorType> getGradientAccumulators(); + ::mlir::OpOperand &getParametersMutable(); + ::mlir::OpOperand &getMsMutable(); + ::mlir::OpOperand &getMomMutable(); + ::mlir::OpOperand &getGradientAccumulatorsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value ms, ::mlir::Value mom, ::mlir::Value gradient_accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value ms, ::mlir::Value mom, ::mlir::Value gradient_accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value ms, ::mlir::Value mom, ::mlir::Value gradient_accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value ms, ::mlir::Value mom, ::mlir::Value gradient_accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LoadTPUEmbeddingRMSPropParametersGradAccumDebugOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LoadTPUEmbeddingRMSPropParametersOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LoadTPUEmbeddingRMSPropParametersOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LoadTPUEmbeddingRMSPropParametersOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LoadTPUEmbeddingRMSPropParametersOpGenericAdaptorBase(LoadTPUEmbeddingRMSPropParametersOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class LoadTPUEmbeddingRMSPropParametersOpGenericAdaptor : public detail::LoadTPUEmbeddingRMSPropParametersOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LoadTPUEmbeddingRMSPropParametersOpGenericAdaptorBase; +public: + LoadTPUEmbeddingRMSPropParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LoadTPUEmbeddingRMSPropParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LoadTPUEmbeddingRMSPropParametersOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LoadTPUEmbeddingRMSPropParametersOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getParameters() { + return (*getODSOperands(0).begin()); + } + + ValueT getMs() { + return (*getODSOperands(1).begin()); + } + + ValueT getMom() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LoadTPUEmbeddingRMSPropParametersOpAdaptor : public LoadTPUEmbeddingRMSPropParametersOpGenericAdaptor<::mlir::ValueRange> { +public: + using LoadTPUEmbeddingRMSPropParametersOpGenericAdaptor::LoadTPUEmbeddingRMSPropParametersOpGenericAdaptor; + LoadTPUEmbeddingRMSPropParametersOpAdaptor(LoadTPUEmbeddingRMSPropParametersOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LoadTPUEmbeddingRMSPropParametersOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LoadTPUEmbeddingRMSPropParametersOpAdaptor; + template + using GenericAdaptor = LoadTPUEmbeddingRMSPropParametersOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LoadTPUEmbeddingRMSPropParameters"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getMs(); + ::mlir::TypedValue<::mlir::TensorType> getMom(); + ::mlir::OpOperand &getParametersMutable(); + ::mlir::OpOperand &getMsMutable(); + ::mlir::OpOperand &getMomMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value ms, ::mlir::Value mom, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value ms, ::mlir::Value mom, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value ms, ::mlir::Value mom, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value ms, ::mlir::Value mom, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LoadTPUEmbeddingRMSPropParametersOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LoadTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LoadTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LoadTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LoadTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpGenericAdaptorBase(LoadTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class LoadTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpGenericAdaptor : public detail::LoadTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LoadTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpGenericAdaptorBase; +public: + LoadTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LoadTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LoadTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LoadTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getParameters() { + return (*getODSOperands(0).begin()); + } + + ValueT getGradientAccumulators() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LoadTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpAdaptor : public LoadTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpGenericAdaptor<::mlir::ValueRange> { +public: + using LoadTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpGenericAdaptor::LoadTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpGenericAdaptor; + LoadTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpAdaptor(LoadTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LoadTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LoadTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpAdaptor; + template + using GenericAdaptor = LoadTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LoadTPUEmbeddingStochasticGradientDescentParametersGradAccumDebug"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getGradientAccumulators(); + ::mlir::OpOperand &getParametersMutable(); + ::mlir::OpOperand &getGradientAccumulatorsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value gradient_accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value gradient_accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, ::mlir::Value gradient_accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, ::mlir::Value gradient_accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LoadTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LoadTPUEmbeddingStochasticGradientDescentParametersOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LoadTPUEmbeddingStochasticGradientDescentParametersOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LoadTPUEmbeddingStochasticGradientDescentParametersOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LoadTPUEmbeddingStochasticGradientDescentParametersOpGenericAdaptorBase(LoadTPUEmbeddingStochasticGradientDescentParametersOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class LoadTPUEmbeddingStochasticGradientDescentParametersOpGenericAdaptor : public detail::LoadTPUEmbeddingStochasticGradientDescentParametersOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LoadTPUEmbeddingStochasticGradientDescentParametersOpGenericAdaptorBase; +public: + LoadTPUEmbeddingStochasticGradientDescentParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LoadTPUEmbeddingStochasticGradientDescentParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LoadTPUEmbeddingStochasticGradientDescentParametersOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LoadTPUEmbeddingStochasticGradientDescentParametersOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getParameters() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LoadTPUEmbeddingStochasticGradientDescentParametersOpAdaptor : public LoadTPUEmbeddingStochasticGradientDescentParametersOpGenericAdaptor<::mlir::ValueRange> { +public: + using LoadTPUEmbeddingStochasticGradientDescentParametersOpGenericAdaptor::LoadTPUEmbeddingStochasticGradientDescentParametersOpGenericAdaptor; + LoadTPUEmbeddingStochasticGradientDescentParametersOpAdaptor(LoadTPUEmbeddingStochasticGradientDescentParametersOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LoadTPUEmbeddingStochasticGradientDescentParametersOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = LoadTPUEmbeddingStochasticGradientDescentParametersOpAdaptor; + template + using GenericAdaptor = LoadTPUEmbeddingStochasticGradientDescentParametersOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LoadTPUEmbeddingStochasticGradientDescentParameters"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::OpOperand &getParametersMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value parameters, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value parameters, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LoadTPUEmbeddingStochasticGradientDescentParametersOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::Log1pOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Log1pOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + Log1pOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + Log1pOpGenericAdaptorBase(Log1pOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class Log1pOpGenericAdaptor : public detail::Log1pOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Log1pOpGenericAdaptorBase; +public: + Log1pOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Log1pOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Log1pOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + Log1pOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Log1pOpAdaptor : public Log1pOpGenericAdaptor<::mlir::ValueRange> { +public: + using Log1pOpGenericAdaptor::Log1pOpGenericAdaptor; + Log1pOpAdaptor(Log1pOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Log1pOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::CwiseUnary, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = Log1pOpAdaptor; + template + using GenericAdaptor = Log1pOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Log1p"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::Log1pOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LogOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LogOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LogOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LogOpGenericAdaptorBase(LogOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class LogOpGenericAdaptor : public detail::LogOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LogOpGenericAdaptorBase; +public: + LogOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LogOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LogOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LogOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LogOpAdaptor : public LogOpGenericAdaptor<::mlir::ValueRange> { +public: + using LogOpGenericAdaptor::LogOpGenericAdaptor; + LogOpAdaptor(LogOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LogOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LogOpAdaptor; + template + using GenericAdaptor = LogOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Log"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LogOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LogSoftmaxOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LogSoftmaxOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LogSoftmaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LogSoftmaxOpGenericAdaptorBase(LogSoftmaxOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class LogSoftmaxOpGenericAdaptor : public detail::LogSoftmaxOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LogSoftmaxOpGenericAdaptorBase; +public: + LogSoftmaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LogSoftmaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LogSoftmaxOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LogSoftmaxOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLogits() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LogSoftmaxOpAdaptor : public LogSoftmaxOpGenericAdaptor<::mlir::ValueRange> { +public: + using LogSoftmaxOpGenericAdaptor::LogSoftmaxOpGenericAdaptor; + LogSoftmaxOpAdaptor(LogSoftmaxOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LogSoftmaxOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LogSoftmaxOpAdaptor; + template + using GenericAdaptor = LogSoftmaxOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LogSoftmax"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLogits(); + ::mlir::OpOperand &getLogitsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLogsoftmax(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type logsoftmax, ::mlir::Value logits); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value logits); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value logits); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LogSoftmaxOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LogicalAndOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LogicalAndOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LogicalAndOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LogicalAndOpGenericAdaptorBase(LogicalAndOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class LogicalAndOpGenericAdaptor : public detail::LogicalAndOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LogicalAndOpGenericAdaptorBase; +public: + LogicalAndOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LogicalAndOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LogicalAndOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LogicalAndOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LogicalAndOpAdaptor : public LogicalAndOpGenericAdaptor<::mlir::ValueRange> { +public: + using LogicalAndOpGenericAdaptor::LogicalAndOpGenericAdaptor; + LogicalAndOpAdaptor(LogicalAndOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LogicalAndOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsCommutative, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape> { +public: + using Op::Op; + using Op::print; + using Adaptor = LogicalAndOpAdaptor; + template + using GenericAdaptor = LogicalAndOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LogicalAnd"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LogicalAndOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LogicalNotOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LogicalNotOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LogicalNotOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LogicalNotOpGenericAdaptorBase(LogicalNotOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class LogicalNotOpGenericAdaptor : public detail::LogicalNotOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LogicalNotOpGenericAdaptorBase; +public: + LogicalNotOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LogicalNotOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LogicalNotOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LogicalNotOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LogicalNotOpAdaptor : public LogicalNotOpGenericAdaptor<::mlir::ValueRange> { +public: + using LogicalNotOpGenericAdaptor::LogicalNotOpGenericAdaptor; + LogicalNotOpAdaptor(LogicalNotOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LogicalNotOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::IsInvolution, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef> { +public: + using Op::Op; + using Op::print; + using Adaptor = LogicalNotOpAdaptor; + template + using GenericAdaptor = LogicalNotOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LogicalNot"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LogicalNotOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LogicalOrOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LogicalOrOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LogicalOrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LogicalOrOpGenericAdaptorBase(LogicalOrOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class LogicalOrOpGenericAdaptor : public detail::LogicalOrOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LogicalOrOpGenericAdaptorBase; +public: + LogicalOrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LogicalOrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LogicalOrOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LogicalOrOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LogicalOrOpAdaptor : public LogicalOrOpGenericAdaptor<::mlir::ValueRange> { +public: + using LogicalOrOpGenericAdaptor::LogicalOrOpGenericAdaptor; + LogicalOrOpAdaptor(LogicalOrOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LogicalOrOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsCommutative, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape> { +public: + using Op::Op; + using Op::print; + using Adaptor = LogicalOrOpAdaptor; + template + using GenericAdaptor = LogicalOrOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LogicalOr"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LogicalOrOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LookupTableExportV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LookupTableExportV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LookupTableExportV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LookupTableExportV2OpGenericAdaptorBase(LookupTableExportV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class LookupTableExportV2OpGenericAdaptor : public detail::LookupTableExportV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LookupTableExportV2OpGenericAdaptorBase; +public: + LookupTableExportV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LookupTableExportV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LookupTableExportV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LookupTableExportV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTableHandle() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LookupTableExportV2OpAdaptor : public LookupTableExportV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using LookupTableExportV2OpGenericAdaptor::LookupTableExportV2OpGenericAdaptor; + LookupTableExportV2OpAdaptor(LookupTableExportV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LookupTableExportV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LookupTableExportV2OpAdaptor; + template + using GenericAdaptor = LookupTableExportV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tkeys"), ::llvm::StringRef("Tvalues")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTkeysAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTkeysAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTvaluesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTvaluesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LookupTableExportV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTableHandle(); + ::mlir::OpOperand &getTableHandleMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getKeys(); + ::mlir::TypedValue<::mlir::TensorType> getValues(); + ::mlir::Type getTkeys(); + ::mlir::Type getTvalues(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type keys, ::mlir::Type values, ::mlir::Value table_handle); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value table_handle); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LookupTableExportV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LookupTableFindOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LookupTableFindOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LookupTableFindOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LookupTableFindOpGenericAdaptorBase(LookupTableFindOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class LookupTableFindOpGenericAdaptor : public detail::LookupTableFindOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LookupTableFindOpGenericAdaptorBase; +public: + LookupTableFindOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LookupTableFindOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LookupTableFindOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LookupTableFindOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTableHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getKeys() { + return (*getODSOperands(1).begin()); + } + + ValueT getDefaultValue() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LookupTableFindOpAdaptor : public LookupTableFindOpGenericAdaptor<::mlir::ValueRange> { +public: + using LookupTableFindOpGenericAdaptor::LookupTableFindOpGenericAdaptor; + LookupTableFindOpAdaptor(LookupTableFindOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LookupTableFindOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LookupTableFindOpAdaptor; + template + using GenericAdaptor = LookupTableFindOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tin"), ::llvm::StringRef("Tout")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTinAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTinAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getToutAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getToutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LookupTableFind"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTableHandle(); + ::mlir::TypedValue<::mlir::TensorType> getKeys(); + ::mlir::TypedValue<::mlir::TensorType> getDefaultValue(); + ::mlir::OpOperand &getTableHandleMutable(); + ::mlir::OpOperand &getKeysMutable(); + ::mlir::OpOperand &getDefaultValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getValues(); + ::mlir::Type getTin(); + ::mlir::Type getTout(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type values, ::mlir::Value table_handle, ::mlir::Value keys, ::mlir::Value default_value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value table_handle, ::mlir::Value keys, ::mlir::Value default_value); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LookupTableFindOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LookupTableFindV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LookupTableFindV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LookupTableFindV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LookupTableFindV2OpGenericAdaptorBase(LookupTableFindV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class LookupTableFindV2OpGenericAdaptor : public detail::LookupTableFindV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LookupTableFindV2OpGenericAdaptorBase; +public: + LookupTableFindV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LookupTableFindV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LookupTableFindV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LookupTableFindV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTableHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getKeys() { + return (*getODSOperands(1).begin()); + } + + ValueT getDefaultValue() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LookupTableFindV2OpAdaptor : public LookupTableFindV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using LookupTableFindV2OpGenericAdaptor::LookupTableFindV2OpGenericAdaptor; + LookupTableFindV2OpAdaptor(LookupTableFindV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LookupTableFindV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LookupTableFindV2OpAdaptor; + template + using GenericAdaptor = LookupTableFindV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tin"), ::llvm::StringRef("Tout")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTinAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTinAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getToutAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getToutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LookupTableFindV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTableHandle(); + ::mlir::TypedValue<::mlir::TensorType> getKeys(); + ::mlir::TypedValue<::mlir::TensorType> getDefaultValue(); + ::mlir::OpOperand &getTableHandleMutable(); + ::mlir::OpOperand &getKeysMutable(); + ::mlir::OpOperand &getDefaultValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getValues(); + ::mlir::Type getTin(); + ::mlir::Type getTout(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type values, ::mlir::Value table_handle, ::mlir::Value keys, ::mlir::Value default_value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value table_handle, ::mlir::Value keys, ::mlir::Value default_value); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LookupTableFindV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LookupTableImportV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LookupTableImportV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LookupTableImportV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LookupTableImportV2OpGenericAdaptorBase(LookupTableImportV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class LookupTableImportV2OpGenericAdaptor : public detail::LookupTableImportV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LookupTableImportV2OpGenericAdaptorBase; +public: + LookupTableImportV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LookupTableImportV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LookupTableImportV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LookupTableImportV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTableHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getKeys() { + return (*getODSOperands(1).begin()); + } + + ValueT getValues() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LookupTableImportV2OpAdaptor : public LookupTableImportV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using LookupTableImportV2OpGenericAdaptor::LookupTableImportV2OpGenericAdaptor; + LookupTableImportV2OpAdaptor(LookupTableImportV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LookupTableImportV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LookupTableImportV2OpAdaptor; + template + using GenericAdaptor = LookupTableImportV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tin"), ::llvm::StringRef("Tout")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTinAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTinAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getToutAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getToutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LookupTableImportV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTableHandle(); + ::mlir::TypedValue<::mlir::TensorType> getKeys(); + ::mlir::TypedValue<::mlir::TensorType> getValues(); + ::mlir::OpOperand &getTableHandleMutable(); + ::mlir::OpOperand &getKeysMutable(); + ::mlir::OpOperand &getValuesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Type getTin(); + ::mlir::Type getTout(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value table_handle, ::mlir::Value keys, ::mlir::Value values); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value table_handle, ::mlir::Value keys, ::mlir::Value values); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LookupTableImportV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LookupTableInsertV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LookupTableInsertV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LookupTableInsertV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LookupTableInsertV2OpGenericAdaptorBase(LookupTableInsertV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class LookupTableInsertV2OpGenericAdaptor : public detail::LookupTableInsertV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LookupTableInsertV2OpGenericAdaptorBase; +public: + LookupTableInsertV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LookupTableInsertV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LookupTableInsertV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LookupTableInsertV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTableHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getKeys() { + return (*getODSOperands(1).begin()); + } + + ValueT getValues() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LookupTableInsertV2OpAdaptor : public LookupTableInsertV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using LookupTableInsertV2OpGenericAdaptor::LookupTableInsertV2OpGenericAdaptor; + LookupTableInsertV2OpAdaptor(LookupTableInsertV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LookupTableInsertV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LookupTableInsertV2OpAdaptor; + template + using GenericAdaptor = LookupTableInsertV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tin"), ::llvm::StringRef("Tout")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTinAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTinAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getToutAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getToutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LookupTableInsertV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTableHandle(); + ::mlir::TypedValue<::mlir::TensorType> getKeys(); + ::mlir::TypedValue<::mlir::TensorType> getValues(); + ::mlir::OpOperand &getTableHandleMutable(); + ::mlir::OpOperand &getKeysMutable(); + ::mlir::OpOperand &getValuesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Type getTin(); + ::mlir::Type getTout(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value table_handle, ::mlir::Value keys, ::mlir::Value values); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value table_handle, ::mlir::Value keys, ::mlir::Value values); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LookupTableInsertV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LookupTableRemoveV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LookupTableRemoveV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LookupTableRemoveV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LookupTableRemoveV2OpGenericAdaptorBase(LookupTableRemoveV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class LookupTableRemoveV2OpGenericAdaptor : public detail::LookupTableRemoveV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LookupTableRemoveV2OpGenericAdaptorBase; +public: + LookupTableRemoveV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LookupTableRemoveV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LookupTableRemoveV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LookupTableRemoveV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTableHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getKeys() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LookupTableRemoveV2OpAdaptor : public LookupTableRemoveV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using LookupTableRemoveV2OpGenericAdaptor::LookupTableRemoveV2OpGenericAdaptor; + LookupTableRemoveV2OpAdaptor(LookupTableRemoveV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LookupTableRemoveV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LookupTableRemoveV2OpAdaptor; + template + using GenericAdaptor = LookupTableRemoveV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tin")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTinAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTinAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LookupTableRemoveV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTableHandle(); + ::mlir::TypedValue<::mlir::TensorType> getKeys(); + ::mlir::OpOperand &getTableHandleMutable(); + ::mlir::OpOperand &getKeysMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Type getTin(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value table_handle, ::mlir::Value keys); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value table_handle, ::mlir::Value keys); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LookupTableRemoveV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LookupTableSizeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LookupTableSizeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LookupTableSizeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LookupTableSizeOpGenericAdaptorBase(LookupTableSizeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class LookupTableSizeOpGenericAdaptor : public detail::LookupTableSizeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LookupTableSizeOpGenericAdaptorBase; +public: + LookupTableSizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LookupTableSizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LookupTableSizeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LookupTableSizeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTableHandle() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LookupTableSizeOpAdaptor : public LookupTableSizeOpGenericAdaptor<::mlir::ValueRange> { +public: + using LookupTableSizeOpGenericAdaptor::LookupTableSizeOpGenericAdaptor; + LookupTableSizeOpAdaptor(LookupTableSizeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LookupTableSizeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LookupTableSizeOpAdaptor; + template + using GenericAdaptor = LookupTableSizeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LookupTableSize"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTableHandle(); + ::mlir::OpOperand &getTableHandleMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSize(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type size, ::mlir::Value table_handle); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value table_handle); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LookupTableSizeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LookupTableSizeV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LookupTableSizeV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LookupTableSizeV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LookupTableSizeV2OpGenericAdaptorBase(LookupTableSizeV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class LookupTableSizeV2OpGenericAdaptor : public detail::LookupTableSizeV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LookupTableSizeV2OpGenericAdaptorBase; +public: + LookupTableSizeV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LookupTableSizeV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LookupTableSizeV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LookupTableSizeV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTableHandle() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LookupTableSizeV2OpAdaptor : public LookupTableSizeV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using LookupTableSizeV2OpGenericAdaptor::LookupTableSizeV2OpGenericAdaptor; + LookupTableSizeV2OpAdaptor(LookupTableSizeV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LookupTableSizeV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LookupTableSizeV2OpAdaptor; + template + using GenericAdaptor = LookupTableSizeV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LookupTableSizeV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTableHandle(); + ::mlir::OpOperand &getTableHandleMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSize(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type size, ::mlir::Value table_handle); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value table_handle); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LookupTableSizeV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::LowerBoundOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LowerBoundOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LowerBoundOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LowerBoundOpGenericAdaptorBase(LowerBoundOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class LowerBoundOpGenericAdaptor : public detail::LowerBoundOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LowerBoundOpGenericAdaptorBase; +public: + LowerBoundOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LowerBoundOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LowerBoundOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LowerBoundOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSortedInputs() { + return (*getODSOperands(0).begin()); + } + + ValueT getValues() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LowerBoundOpAdaptor : public LowerBoundOpGenericAdaptor<::mlir::ValueRange> { +public: + using LowerBoundOpGenericAdaptor::LowerBoundOpGenericAdaptor; + LowerBoundOpAdaptor(LowerBoundOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LowerBoundOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = LowerBoundOpAdaptor; + template + using GenericAdaptor = LowerBoundOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("out_type")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutTypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.LowerBound"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSortedInputs(); + ::mlir::TypedValue<::mlir::TensorType> getValues(); + ::mlir::OpOperand &getSortedInputsMutable(); + ::mlir::OpOperand &getValuesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getOutType(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value sorted_inputs, ::mlir::Value values); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value sorted_inputs, ::mlir::Value values); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::LowerBoundOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MakeIteratorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MakeIteratorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MakeIteratorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MakeIteratorOpGenericAdaptorBase(MakeIteratorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MakeIteratorOpGenericAdaptor : public detail::MakeIteratorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MakeIteratorOpGenericAdaptorBase; +public: + MakeIteratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MakeIteratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MakeIteratorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MakeIteratorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getDataset() { + return (*getODSOperands(0).begin()); + } + + ValueT getIterator() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MakeIteratorOpAdaptor : public MakeIteratorOpGenericAdaptor<::mlir::ValueRange> { +public: + using MakeIteratorOpGenericAdaptor::MakeIteratorOpGenericAdaptor; + MakeIteratorOpAdaptor(MakeIteratorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MakeIteratorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MakeIteratorOpAdaptor; + template + using GenericAdaptor = MakeIteratorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MakeIterator"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getDataset(); + ::mlir::TypedValue<::mlir::TensorType> getIterator(); + ::mlir::OpOperand &getDatasetMutable(); + ::mlir::OpOperand &getIteratorMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value dataset, ::mlir::Value iterator); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value dataset, ::mlir::Value iterator); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MakeIteratorOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MakeUniqueOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MakeUniqueOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MakeUniqueOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MakeUniqueOpGenericAdaptorBase(MakeUniqueOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MakeUniqueOpGenericAdaptor : public detail::MakeUniqueOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MakeUniqueOpGenericAdaptorBase; +public: + MakeUniqueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MakeUniqueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MakeUniqueOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MakeUniqueOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MakeUniqueOpAdaptor : public MakeUniqueOpGenericAdaptor<::mlir::ValueRange> { +public: + using MakeUniqueOpGenericAdaptor::MakeUniqueOpGenericAdaptor; + MakeUniqueOpAdaptor(MakeUniqueOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MakeUniqueOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MakeUniqueOpAdaptor; + template + using GenericAdaptor = MakeUniqueOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MakeUnique"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MakeUniqueOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MapAndBatchDatasetOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MapAndBatchDatasetOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MapAndBatchDatasetOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MapAndBatchDatasetOpGenericAdaptorBase(MapAndBatchDatasetOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::SymbolRefAttr getFAttr(); + ::mlir::SymbolRefAttr getF(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::BoolAttr getPreserveCardinalityAttr(); + bool getPreserveCardinality(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); +}; +} // namespace detail +template +class MapAndBatchDatasetOpGenericAdaptor : public detail::MapAndBatchDatasetOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MapAndBatchDatasetOpGenericAdaptorBase; +public: + MapAndBatchDatasetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MapAndBatchDatasetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MapAndBatchDatasetOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MapAndBatchDatasetOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputDataset() { + return (*getODSOperands(0).begin()); + } + + RangeT getOtherArguments() { + return getODSOperands(1); + } + + ValueT getBatchSize() { + return (*getODSOperands(2).begin()); + } + + ValueT getNumParallelCalls() { + return (*getODSOperands(3).begin()); + } + + ValueT getDropRemainder() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MapAndBatchDatasetOpAdaptor : public MapAndBatchDatasetOpGenericAdaptor<::mlir::ValueRange> { +public: + using MapAndBatchDatasetOpGenericAdaptor::MapAndBatchDatasetOpGenericAdaptor; + MapAndBatchDatasetOpAdaptor(MapAndBatchDatasetOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MapAndBatchDatasetOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MapAndBatchDatasetOpAdaptor; + template + using GenericAdaptor = MapAndBatchDatasetOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Targuments"), ::llvm::StringRef("f"), ::llvm::StringRef("metadata"), ::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types"), ::llvm::StringRef("preserve_cardinality")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTargumentsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTargumentsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getFAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getFAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getMetadataAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getMetadataAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getPreserveCardinalityAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getPreserveCardinalityAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MapAndBatchDataset"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputDataset(); + ::mlir::Operation::operand_range getOtherArguments(); + ::mlir::TypedValue<::mlir::TensorType> getBatchSize(); + ::mlir::TypedValue<::mlir::TensorType> getNumParallelCalls(); + ::mlir::TypedValue<::mlir::TensorType> getDropRemainder(); + ::mlir::OpOperand &getInputDatasetMutable(); + ::mlir::MutableOperandRange getOtherArgumentsMutable(); + ::mlir::OpOperand &getBatchSizeMutable(); + ::mlir::OpOperand &getNumParallelCallsMutable(); + ::mlir::OpOperand &getDropRemainderMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::SymbolRefAttr getFAttr(); + ::mlir::SymbolRefAttr getF(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::BoolAttr getPreserveCardinalityAttr(); + bool getPreserveCardinality(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); + mlir::OperandElementTypeRange getTarguments(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setFAttr(::mlir::SymbolRefAttr attr); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + void setPreserveCardinalityAttr(::mlir::BoolAttr attr); + void setPreserveCardinality(::std::optional attrValue); + void setMetadataAttr(::mlir::StringAttr attr); + void setMetadata(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removePreserveCardinalityAttr(); + ::mlir::Attribute removeMetadataAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, ::mlir::ValueRange other_arguments, ::mlir::Value batch_size, ::mlir::Value num_parallel_calls, ::mlir::Value drop_remainder, ::mlir::SymbolRefAttr f, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::BoolAttr preserve_cardinality, /*optional*/::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, ::mlir::ValueRange other_arguments, ::mlir::Value batch_size, ::mlir::Value num_parallel_calls, ::mlir::Value drop_remainder, ::mlir::SymbolRefAttr f, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::BoolAttr preserve_cardinality, /*optional*/::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, ::mlir::ValueRange other_arguments, ::mlir::Value batch_size, ::mlir::Value num_parallel_calls, ::mlir::Value drop_remainder, ::mlir::SymbolRefAttr f, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/bool preserve_cardinality = false, /*optional*/::llvm::StringRef metadata = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, ::mlir::ValueRange other_arguments, ::mlir::Value batch_size, ::mlir::Value num_parallel_calls, ::mlir::Value drop_remainder, ::mlir::SymbolRefAttr f, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/bool preserve_cardinality = false, /*optional*/::llvm::StringRef metadata = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MapAndBatchDatasetOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MapDatasetOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MapDatasetOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MapDatasetOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MapDatasetOpGenericAdaptorBase(MapDatasetOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::SymbolRefAttr getFAttr(); + ::mlir::SymbolRefAttr getF(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::BoolAttr getUseInterOpParallelismAttr(); + bool getUseInterOpParallelism(); + ::mlir::BoolAttr getPreserveCardinalityAttr(); + bool getPreserveCardinality(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); +}; +} // namespace detail +template +class MapDatasetOpGenericAdaptor : public detail::MapDatasetOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MapDatasetOpGenericAdaptorBase; +public: + MapDatasetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MapDatasetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MapDatasetOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MapDatasetOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputDataset() { + return (*getODSOperands(0).begin()); + } + + RangeT getOtherArguments() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MapDatasetOpAdaptor : public MapDatasetOpGenericAdaptor<::mlir::ValueRange> { +public: + using MapDatasetOpGenericAdaptor::MapDatasetOpGenericAdaptor; + MapDatasetOpAdaptor(MapDatasetOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MapDatasetOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MapDatasetOpAdaptor; + template + using GenericAdaptor = MapDatasetOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Targuments"), ::llvm::StringRef("f"), ::llvm::StringRef("metadata"), ::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types"), ::llvm::StringRef("preserve_cardinality"), ::llvm::StringRef("use_inter_op_parallelism")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTargumentsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTargumentsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getFAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getFAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getMetadataAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getMetadataAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getPreserveCardinalityAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getPreserveCardinalityAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getUseInterOpParallelismAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getUseInterOpParallelismAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MapDataset"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputDataset(); + ::mlir::Operation::operand_range getOtherArguments(); + ::mlir::OpOperand &getInputDatasetMutable(); + ::mlir::MutableOperandRange getOtherArgumentsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::SymbolRefAttr getFAttr(); + ::mlir::SymbolRefAttr getF(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::BoolAttr getUseInterOpParallelismAttr(); + bool getUseInterOpParallelism(); + ::mlir::BoolAttr getPreserveCardinalityAttr(); + bool getPreserveCardinality(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); + mlir::OperandElementTypeRange getTarguments(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setFAttr(::mlir::SymbolRefAttr attr); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + void setUseInterOpParallelismAttr(::mlir::BoolAttr attr); + void setUseInterOpParallelism(::std::optional attrValue); + void setPreserveCardinalityAttr(::mlir::BoolAttr attr); + void setPreserveCardinality(::std::optional attrValue); + void setMetadataAttr(::mlir::StringAttr attr); + void setMetadata(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeUseInterOpParallelismAttr(); + ::mlir::Attribute removePreserveCardinalityAttr(); + ::mlir::Attribute removeMetadataAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, ::mlir::ValueRange other_arguments, ::mlir::SymbolRefAttr f, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::BoolAttr use_inter_op_parallelism, /*optional*/::mlir::BoolAttr preserve_cardinality, /*optional*/::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, ::mlir::ValueRange other_arguments, ::mlir::SymbolRefAttr f, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::BoolAttr use_inter_op_parallelism, /*optional*/::mlir::BoolAttr preserve_cardinality, /*optional*/::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, ::mlir::ValueRange other_arguments, ::mlir::SymbolRefAttr f, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/bool use_inter_op_parallelism = true, /*optional*/bool preserve_cardinality = false, /*optional*/::llvm::StringRef metadata = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, ::mlir::ValueRange other_arguments, ::mlir::SymbolRefAttr f, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/bool use_inter_op_parallelism = true, /*optional*/bool preserve_cardinality = false, /*optional*/::llvm::StringRef metadata = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 7 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MapDatasetOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MatMulOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MatMulOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MatMulOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MatMulOpGenericAdaptorBase(MatMulOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getTransposeAAttr(); + bool getTransposeA(); + ::mlir::BoolAttr getTransposeBAttr(); + bool getTransposeB(); +}; +} // namespace detail +template +class MatMulOpGenericAdaptor : public detail::MatMulOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MatMulOpGenericAdaptorBase; +public: + MatMulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MatMulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MatMulOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MatMulOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + ValueT getB() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MatMulOpAdaptor : public MatMulOpGenericAdaptor<::mlir::ValueRange> { +public: + using MatMulOpGenericAdaptor::MatMulOpGenericAdaptor; + MatMulOpAdaptor(MatMulOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MatMulOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::SameOperandsAndResultElementTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MatMulOpAdaptor; + template + using GenericAdaptor = MatMulOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("transpose_a"), ::llvm::StringRef("transpose_b")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTransposeAAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTransposeAAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTransposeBAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTransposeBAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MatMul"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getA(); + ::mlir::TypedValue<::mlir::TensorType> getB(); + ::mlir::OpOperand &getAMutable(); + ::mlir::OpOperand &getBMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getProduct(); + ::mlir::BoolAttr getTransposeAAttr(); + bool getTransposeA(); + ::mlir::BoolAttr getTransposeBAttr(); + bool getTransposeB(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setTransposeAAttr(::mlir::BoolAttr attr); + void setTransposeA(::std::optional attrValue); + void setTransposeBAttr(::mlir::BoolAttr attr); + void setTransposeB(::std::optional attrValue); + ::mlir::Attribute removeTransposeAAttr(); + ::mlir::Attribute removeTransposeBAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type product, ::mlir::Value a, ::mlir::Value b, /*optional*/::mlir::BoolAttr transpose_a, /*optional*/::mlir::BoolAttr transpose_b); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, /*optional*/::mlir::BoolAttr transpose_a, /*optional*/::mlir::BoolAttr transpose_b); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type product, ::mlir::Value a, ::mlir::Value b, /*optional*/bool transpose_a = false, /*optional*/bool transpose_b = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, /*optional*/bool transpose_a = false, /*optional*/bool transpose_b = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MatMulOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MatrixBandPartOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MatrixBandPartOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MatrixBandPartOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MatrixBandPartOpGenericAdaptorBase(MatrixBandPartOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MatrixBandPartOpGenericAdaptor : public detail::MatrixBandPartOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MatrixBandPartOpGenericAdaptorBase; +public: + MatrixBandPartOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MatrixBandPartOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MatrixBandPartOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MatrixBandPartOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getNumLower() { + return (*getODSOperands(1).begin()); + } + + ValueT getNumUpper() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MatrixBandPartOpAdaptor : public MatrixBandPartOpGenericAdaptor<::mlir::ValueRange> { +public: + using MatrixBandPartOpGenericAdaptor::MatrixBandPartOpGenericAdaptor; + MatrixBandPartOpAdaptor(MatrixBandPartOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MatrixBandPartOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MatrixBandPartOpAdaptor; + template + using GenericAdaptor = MatrixBandPartOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindex")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindexAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MatrixBandPart"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getNumLower(); + ::mlir::TypedValue<::mlir::TensorType> getNumUpper(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getNumLowerMutable(); + ::mlir::OpOperand &getNumUpperMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getBand(); + ::mlir::Type getT(); + ::mlir::Type getTindex(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type band, ::mlir::Value input, ::mlir::Value num_lower, ::mlir::Value num_upper); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value num_lower, ::mlir::Value num_upper); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MatrixBandPartOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MatrixDiagOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MatrixDiagOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MatrixDiagOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MatrixDiagOpGenericAdaptorBase(MatrixDiagOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MatrixDiagOpGenericAdaptor : public detail::MatrixDiagOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MatrixDiagOpGenericAdaptorBase; +public: + MatrixDiagOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MatrixDiagOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MatrixDiagOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MatrixDiagOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getDiagonal() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MatrixDiagOpAdaptor : public MatrixDiagOpGenericAdaptor<::mlir::ValueRange> { +public: + using MatrixDiagOpGenericAdaptor::MatrixDiagOpGenericAdaptor; + MatrixDiagOpAdaptor(MatrixDiagOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MatrixDiagOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MatrixDiagOpAdaptor; + template + using GenericAdaptor = MatrixDiagOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MatrixDiag"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getDiagonal(); + ::mlir::OpOperand &getDiagonalMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value diagonal); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value diagonal); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MatrixDiagOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MatrixDiagPartV3Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MatrixDiagPartV3OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MatrixDiagPartV3OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MatrixDiagPartV3OpGenericAdaptorBase(MatrixDiagPartV3Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getAlignAttr(); + ::llvm::StringRef getAlign(); +}; +} // namespace detail +template +class MatrixDiagPartV3OpGenericAdaptor : public detail::MatrixDiagPartV3OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MatrixDiagPartV3OpGenericAdaptorBase; +public: + MatrixDiagPartV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MatrixDiagPartV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MatrixDiagPartV3OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MatrixDiagPartV3OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getK() { + return (*getODSOperands(1).begin()); + } + + ValueT getPaddingValue() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MatrixDiagPartV3OpAdaptor : public MatrixDiagPartV3OpGenericAdaptor<::mlir::ValueRange> { +public: + using MatrixDiagPartV3OpGenericAdaptor::MatrixDiagPartV3OpGenericAdaptor; + MatrixDiagPartV3OpAdaptor(MatrixDiagPartV3Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MatrixDiagPartV3Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MatrixDiagPartV3OpAdaptor; + template + using GenericAdaptor = MatrixDiagPartV3OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("align")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAlignAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAlignAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MatrixDiagPartV3"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getK(); + ::mlir::TypedValue<::mlir::TensorType> getPaddingValue(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getKMutable(); + ::mlir::OpOperand &getPaddingValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getDiagonal(); + ::mlir::StringAttr getAlignAttr(); + ::llvm::StringRef getAlign(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setAlignAttr(::mlir::StringAttr attr); + void setAlign(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeAlignAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type diagonal, ::mlir::Value input, ::mlir::Value k, ::mlir::Value padding_value, /*optional*/::mlir::StringAttr align); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value k, ::mlir::Value padding_value, /*optional*/::mlir::StringAttr align); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type diagonal, ::mlir::Value input, ::mlir::Value k, ::mlir::Value padding_value, /*optional*/::llvm::StringRef align = "RIGHT_LEFT"); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value k, ::mlir::Value padding_value, /*optional*/::llvm::StringRef align = "RIGHT_LEFT"); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MatrixDiagPartV3Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MatrixDiagV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MatrixDiagV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MatrixDiagV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MatrixDiagV2OpGenericAdaptorBase(MatrixDiagV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MatrixDiagV2OpGenericAdaptor : public detail::MatrixDiagV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MatrixDiagV2OpGenericAdaptorBase; +public: + MatrixDiagV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MatrixDiagV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MatrixDiagV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MatrixDiagV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getDiagonal() { + return (*getODSOperands(0).begin()); + } + + ValueT getK() { + return (*getODSOperands(1).begin()); + } + + ValueT getNumRows() { + return (*getODSOperands(2).begin()); + } + + ValueT getNumCols() { + return (*getODSOperands(3).begin()); + } + + ValueT getPaddingValue() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MatrixDiagV2OpAdaptor : public MatrixDiagV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using MatrixDiagV2OpGenericAdaptor::MatrixDiagV2OpGenericAdaptor; + MatrixDiagV2OpAdaptor(MatrixDiagV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MatrixDiagV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<5>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MatrixDiagV2OpAdaptor; + template + using GenericAdaptor = MatrixDiagV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MatrixDiagV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getDiagonal(); + ::mlir::TypedValue<::mlir::TensorType> getK(); + ::mlir::TypedValue<::mlir::TensorType> getNumRows(); + ::mlir::TypedValue<::mlir::TensorType> getNumCols(); + ::mlir::TypedValue<::mlir::TensorType> getPaddingValue(); + ::mlir::OpOperand &getDiagonalMutable(); + ::mlir::OpOperand &getKMutable(); + ::mlir::OpOperand &getNumRowsMutable(); + ::mlir::OpOperand &getNumColsMutable(); + ::mlir::OpOperand &getPaddingValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value diagonal, ::mlir::Value k, ::mlir::Value num_rows, ::mlir::Value num_cols, ::mlir::Value padding_value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value diagonal, ::mlir::Value k, ::mlir::Value num_rows, ::mlir::Value num_cols, ::mlir::Value padding_value); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MatrixDiagV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MatrixDiagV3Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MatrixDiagV3OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MatrixDiagV3OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MatrixDiagV3OpGenericAdaptorBase(MatrixDiagV3Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getAlignAttr(); + ::llvm::StringRef getAlign(); +}; +} // namespace detail +template +class MatrixDiagV3OpGenericAdaptor : public detail::MatrixDiagV3OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MatrixDiagV3OpGenericAdaptorBase; +public: + MatrixDiagV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MatrixDiagV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MatrixDiagV3OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MatrixDiagV3OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getDiagonal() { + return (*getODSOperands(0).begin()); + } + + ValueT getK() { + return (*getODSOperands(1).begin()); + } + + ValueT getNumRows() { + return (*getODSOperands(2).begin()); + } + + ValueT getNumCols() { + return (*getODSOperands(3).begin()); + } + + ValueT getPaddingValue() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MatrixDiagV3OpAdaptor : public MatrixDiagV3OpGenericAdaptor<::mlir::ValueRange> { +public: + using MatrixDiagV3OpGenericAdaptor::MatrixDiagV3OpGenericAdaptor; + MatrixDiagV3OpAdaptor(MatrixDiagV3Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MatrixDiagV3Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<5>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MatrixDiagV3OpAdaptor; + template + using GenericAdaptor = MatrixDiagV3OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("align")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAlignAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAlignAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MatrixDiagV3"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getDiagonal(); + ::mlir::TypedValue<::mlir::TensorType> getK(); + ::mlir::TypedValue<::mlir::TensorType> getNumRows(); + ::mlir::TypedValue<::mlir::TensorType> getNumCols(); + ::mlir::TypedValue<::mlir::TensorType> getPaddingValue(); + ::mlir::OpOperand &getDiagonalMutable(); + ::mlir::OpOperand &getKMutable(); + ::mlir::OpOperand &getNumRowsMutable(); + ::mlir::OpOperand &getNumColsMutable(); + ::mlir::OpOperand &getPaddingValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::StringAttr getAlignAttr(); + ::llvm::StringRef getAlign(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setAlignAttr(::mlir::StringAttr attr); + void setAlign(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeAlignAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value diagonal, ::mlir::Value k, ::mlir::Value num_rows, ::mlir::Value num_cols, ::mlir::Value padding_value, /*optional*/::mlir::StringAttr align); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value diagonal, ::mlir::Value k, ::mlir::Value num_rows, ::mlir::Value num_cols, ::mlir::Value padding_value, /*optional*/::mlir::StringAttr align); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value diagonal, ::mlir::Value k, ::mlir::Value num_rows, ::mlir::Value num_cols, ::mlir::Value padding_value, /*optional*/::llvm::StringRef align = "RIGHT_LEFT"); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value diagonal, ::mlir::Value k, ::mlir::Value num_rows, ::mlir::Value num_cols, ::mlir::Value padding_value, /*optional*/::llvm::StringRef align = "RIGHT_LEFT"); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MatrixDiagV3Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MatrixInverseOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MatrixInverseOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MatrixInverseOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MatrixInverseOpGenericAdaptorBase(MatrixInverseOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getAdjointAttr(); + bool getAdjoint(); +}; +} // namespace detail +template +class MatrixInverseOpGenericAdaptor : public detail::MatrixInverseOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MatrixInverseOpGenericAdaptorBase; +public: + MatrixInverseOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MatrixInverseOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MatrixInverseOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MatrixInverseOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MatrixInverseOpAdaptor : public MatrixInverseOpGenericAdaptor<::mlir::ValueRange> { +public: + using MatrixInverseOpGenericAdaptor::MatrixInverseOpGenericAdaptor; + MatrixInverseOpAdaptor(MatrixInverseOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MatrixInverseOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MatrixInverseOpAdaptor; + template + using GenericAdaptor = MatrixInverseOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("adjoint")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAdjointAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAdjointAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MatrixInverse"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getAdjointAttr(); + bool getAdjoint(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setAdjointAttr(::mlir::BoolAttr attr); + void setAdjoint(::std::optional attrValue); + ::mlir::Attribute removeAdjointAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, /*optional*/::mlir::BoolAttr adjoint); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, /*optional*/::mlir::BoolAttr adjoint); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, /*optional*/bool adjoint = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, /*optional*/bool adjoint = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MatrixInverseOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MatrixSetDiagOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MatrixSetDiagOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MatrixSetDiagOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MatrixSetDiagOpGenericAdaptorBase(MatrixSetDiagOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MatrixSetDiagOpGenericAdaptor : public detail::MatrixSetDiagOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MatrixSetDiagOpGenericAdaptorBase; +public: + MatrixSetDiagOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MatrixSetDiagOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MatrixSetDiagOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MatrixSetDiagOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getDiagonal() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MatrixSetDiagOpAdaptor : public MatrixSetDiagOpGenericAdaptor<::mlir::ValueRange> { +public: + using MatrixSetDiagOpGenericAdaptor::MatrixSetDiagOpGenericAdaptor; + MatrixSetDiagOpAdaptor(MatrixSetDiagOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MatrixSetDiagOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MatrixSetDiagOpAdaptor; + template + using GenericAdaptor = MatrixSetDiagOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MatrixSetDiag"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getDiagonal(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getDiagonalMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value diagonal); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value diagonal); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MatrixSetDiagOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MatrixSetDiagV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MatrixSetDiagV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MatrixSetDiagV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MatrixSetDiagV2OpGenericAdaptorBase(MatrixSetDiagV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MatrixSetDiagV2OpGenericAdaptor : public detail::MatrixSetDiagV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MatrixSetDiagV2OpGenericAdaptorBase; +public: + MatrixSetDiagV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MatrixSetDiagV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MatrixSetDiagV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MatrixSetDiagV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getDiagonal() { + return (*getODSOperands(1).begin()); + } + + ValueT getK() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MatrixSetDiagV2OpAdaptor : public MatrixSetDiagV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using MatrixSetDiagV2OpGenericAdaptor::MatrixSetDiagV2OpGenericAdaptor; + MatrixSetDiagV2OpAdaptor(MatrixSetDiagV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MatrixSetDiagV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MatrixSetDiagV2OpAdaptor; + template + using GenericAdaptor = MatrixSetDiagV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MatrixSetDiagV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getDiagonal(); + ::mlir::TypedValue<::mlir::TensorType> getK(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getDiagonalMutable(); + ::mlir::OpOperand &getKMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value diagonal, ::mlir::Value k); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value diagonal, ::mlir::Value k); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MatrixSetDiagV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MatrixSetDiagV3Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MatrixSetDiagV3OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MatrixSetDiagV3OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MatrixSetDiagV3OpGenericAdaptorBase(MatrixSetDiagV3Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getAlignAttr(); + ::llvm::StringRef getAlign(); +}; +} // namespace detail +template +class MatrixSetDiagV3OpGenericAdaptor : public detail::MatrixSetDiagV3OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MatrixSetDiagV3OpGenericAdaptorBase; +public: + MatrixSetDiagV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MatrixSetDiagV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MatrixSetDiagV3OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MatrixSetDiagV3OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getDiagonal() { + return (*getODSOperands(1).begin()); + } + + ValueT getK() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MatrixSetDiagV3OpAdaptor : public MatrixSetDiagV3OpGenericAdaptor<::mlir::ValueRange> { +public: + using MatrixSetDiagV3OpGenericAdaptor::MatrixSetDiagV3OpGenericAdaptor; + MatrixSetDiagV3OpAdaptor(MatrixSetDiagV3Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MatrixSetDiagV3Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MatrixSetDiagV3OpAdaptor; + template + using GenericAdaptor = MatrixSetDiagV3OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("align")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAlignAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAlignAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MatrixSetDiagV3"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getDiagonal(); + ::mlir::TypedValue<::mlir::TensorType> getK(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getDiagonalMutable(); + ::mlir::OpOperand &getKMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::StringAttr getAlignAttr(); + ::llvm::StringRef getAlign(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setAlignAttr(::mlir::StringAttr attr); + void setAlign(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeAlignAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value diagonal, ::mlir::Value k, /*optional*/::mlir::StringAttr align); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value diagonal, ::mlir::Value k, /*optional*/::mlir::StringAttr align); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value diagonal, ::mlir::Value k, /*optional*/::llvm::StringRef align = "RIGHT_LEFT"); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value diagonal, ::mlir::Value k, /*optional*/::llvm::StringRef align = "RIGHT_LEFT"); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MatrixSetDiagV3Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MatrixSolveOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MatrixSolveOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MatrixSolveOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MatrixSolveOpGenericAdaptorBase(MatrixSolveOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getAdjointAttr(); + bool getAdjoint(); +}; +} // namespace detail +template +class MatrixSolveOpGenericAdaptor : public detail::MatrixSolveOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MatrixSolveOpGenericAdaptorBase; +public: + MatrixSolveOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MatrixSolveOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MatrixSolveOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MatrixSolveOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getMatrix() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MatrixSolveOpAdaptor : public MatrixSolveOpGenericAdaptor<::mlir::ValueRange> { +public: + using MatrixSolveOpGenericAdaptor::MatrixSolveOpGenericAdaptor; + MatrixSolveOpAdaptor(MatrixSolveOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MatrixSolveOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MatrixSolveOpAdaptor; + template + using GenericAdaptor = MatrixSolveOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("adjoint")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAdjointAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAdjointAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MatrixSolve"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getMatrix(); + ::mlir::TypedValue<::mlir::TensorType> getRhs(); + ::mlir::OpOperand &getMatrixMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getAdjointAttr(); + bool getAdjoint(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setAdjointAttr(::mlir::BoolAttr attr); + void setAdjoint(::std::optional attrValue); + ::mlir::Attribute removeAdjointAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value matrix, ::mlir::Value rhs, /*optional*/::mlir::BoolAttr adjoint); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value matrix, ::mlir::Value rhs, /*optional*/::mlir::BoolAttr adjoint); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value matrix, ::mlir::Value rhs, /*optional*/bool adjoint = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value matrix, ::mlir::Value rhs, /*optional*/bool adjoint = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MatrixSolveOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MatrixTriangularSolveOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MatrixTriangularSolveOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MatrixTriangularSolveOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MatrixTriangularSolveOpGenericAdaptorBase(MatrixTriangularSolveOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getLowerAttr(); + bool getLower(); + ::mlir::BoolAttr getAdjointAttr(); + bool getAdjoint(); +}; +} // namespace detail +template +class MatrixTriangularSolveOpGenericAdaptor : public detail::MatrixTriangularSolveOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MatrixTriangularSolveOpGenericAdaptorBase; +public: + MatrixTriangularSolveOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MatrixTriangularSolveOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MatrixTriangularSolveOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MatrixTriangularSolveOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getMatrix() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MatrixTriangularSolveOpAdaptor : public MatrixTriangularSolveOpGenericAdaptor<::mlir::ValueRange> { +public: + using MatrixTriangularSolveOpGenericAdaptor::MatrixTriangularSolveOpGenericAdaptor; + MatrixTriangularSolveOpAdaptor(MatrixTriangularSolveOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MatrixTriangularSolveOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MatrixTriangularSolveOpAdaptor; + template + using GenericAdaptor = MatrixTriangularSolveOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("adjoint"), ::llvm::StringRef("lower")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAdjointAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAdjointAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getLowerAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getLowerAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MatrixTriangularSolve"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getMatrix(); + ::mlir::TypedValue<::mlir::TensorType> getRhs(); + ::mlir::OpOperand &getMatrixMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getLowerAttr(); + bool getLower(); + ::mlir::BoolAttr getAdjointAttr(); + bool getAdjoint(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setLowerAttr(::mlir::BoolAttr attr); + void setLower(::std::optional attrValue); + void setAdjointAttr(::mlir::BoolAttr attr); + void setAdjoint(::std::optional attrValue); + ::mlir::Attribute removeLowerAttr(); + ::mlir::Attribute removeAdjointAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value matrix, ::mlir::Value rhs, /*optional*/::mlir::BoolAttr lower, /*optional*/::mlir::BoolAttr adjoint); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value matrix, ::mlir::Value rhs, /*optional*/::mlir::BoolAttr lower, /*optional*/::mlir::BoolAttr adjoint); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value matrix, ::mlir::Value rhs, /*optional*/bool lower = true, /*optional*/bool adjoint = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value matrix, ::mlir::Value rhs, /*optional*/bool lower = true, /*optional*/bool adjoint = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MatrixTriangularSolveOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MaxOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MaxOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MaxOpGenericAdaptorBase(MaxOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getKeepDimsAttr(); + bool getKeepDims(); +}; +} // namespace detail +template +class MaxOpGenericAdaptor : public detail::MaxOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MaxOpGenericAdaptorBase; +public: + MaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MaxOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MaxOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getReductionIndices() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MaxOpAdaptor : public MaxOpGenericAdaptor<::mlir::ValueRange> { +public: + using MaxOpGenericAdaptor::MaxOpGenericAdaptor; + MaxOpAdaptor(MaxOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MaxOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MaxOpAdaptor; + template + using GenericAdaptor = MaxOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tidx"), ::llvm::StringRef("keep_dims")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTidxAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTidxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getKeepDimsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getKeepDimsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Max"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getReductionIndices(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getReductionIndicesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getKeepDimsAttr(); + bool getKeepDims(); + ::mlir::Type getT(); + ::mlir::Type getTidx(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setKeepDimsAttr(::mlir::BoolAttr attr); + void setKeepDims(::std::optional attrValue); + ::mlir::Attribute removeKeepDimsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value input, Value reduction_indices, BoolAttr keep_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value reduction_indices, /*optional*/::mlir::BoolAttr keep_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value reduction_indices, /*optional*/::mlir::BoolAttr keep_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value reduction_indices, /*optional*/bool keep_dims = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value reduction_indices, /*optional*/bool keep_dims = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MaxOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MaxPool3DGradGradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MaxPool3DGradGradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MaxPool3DGradGradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MaxPool3DGradGradOpGenericAdaptorBase(MaxPool3DGradGradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getKsizeAttr(); + ::mlir::ArrayAttr getKsize(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); +}; +} // namespace detail +template +class MaxPool3DGradGradOpGenericAdaptor : public detail::MaxPool3DGradGradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MaxPool3DGradGradOpGenericAdaptorBase; +public: + MaxPool3DGradGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MaxPool3DGradGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MaxPool3DGradGradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MaxPool3DGradGradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOrigInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getOrigOutput() { + return (*getODSOperands(1).begin()); + } + + ValueT getGrad() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MaxPool3DGradGradOpAdaptor : public MaxPool3DGradGradOpGenericAdaptor<::mlir::ValueRange> { +public: + using MaxPool3DGradGradOpGenericAdaptor::MaxPool3DGradGradOpGenericAdaptor; + MaxPool3DGradGradOpAdaptor(MaxPool3DGradGradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MaxPool3DGradGradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MaxPool3DGradGradOpAdaptor; + template + using GenericAdaptor = MaxPool3DGradGradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("data_format"), ::llvm::StringRef("ksize"), ::llvm::StringRef("padding"), ::llvm::StringRef("strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getKsizeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getKsizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MaxPool3DGradGrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOrigInput(); + ::mlir::TypedValue<::mlir::TensorType> getOrigOutput(); + ::mlir::TypedValue<::mlir::TensorType> getGrad(); + ::mlir::OpOperand &getOrigInputMutable(); + ::mlir::OpOperand &getOrigOutputMutable(); + ::mlir::OpOperand &getGradMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ArrayAttr getKsizeAttr(); + ::mlir::ArrayAttr getKsize(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setKsizeAttr(::mlir::ArrayAttr attr); + void setStridesAttr(::mlir::ArrayAttr attr); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeDataFormatAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value orig_input, ::mlir::Value orig_output, ::mlir::Value grad, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value orig_input, ::mlir::Value orig_output, ::mlir::Value grad, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value orig_input, ::mlir::Value orig_output, ::mlir::Value grad, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::llvm::StringRef data_format = "NDHWC"); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value orig_input, ::mlir::Value orig_output, ::mlir::Value grad, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::llvm::StringRef data_format = "NDHWC"); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MaxPool3DGradGradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MaxPool3DGradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MaxPool3DGradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MaxPool3DGradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MaxPool3DGradOpGenericAdaptorBase(MaxPool3DGradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getKsizeAttr(); + ::mlir::ArrayAttr getKsize(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); +}; +} // namespace detail +template +class MaxPool3DGradOpGenericAdaptor : public detail::MaxPool3DGradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MaxPool3DGradOpGenericAdaptorBase; +public: + MaxPool3DGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MaxPool3DGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MaxPool3DGradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MaxPool3DGradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOrigInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getOrigOutput() { + return (*getODSOperands(1).begin()); + } + + ValueT getGrad() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MaxPool3DGradOpAdaptor : public MaxPool3DGradOpGenericAdaptor<::mlir::ValueRange> { +public: + using MaxPool3DGradOpGenericAdaptor::MaxPool3DGradOpGenericAdaptor; + MaxPool3DGradOpAdaptor(MaxPool3DGradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MaxPool3DGradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MaxPool3DGradOpAdaptor; + template + using GenericAdaptor = MaxPool3DGradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("TInput"), ::llvm::StringRef("data_format"), ::llvm::StringRef("ksize"), ::llvm::StringRef("padding"), ::llvm::StringRef("strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTInputAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTInputAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getKsizeAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getKsizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MaxPool3DGrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOrigInput(); + ::mlir::TypedValue<::mlir::TensorType> getOrigOutput(); + ::mlir::TypedValue<::mlir::TensorType> getGrad(); + ::mlir::OpOperand &getOrigInputMutable(); + ::mlir::OpOperand &getOrigOutputMutable(); + ::mlir::OpOperand &getGradMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ArrayAttr getKsizeAttr(); + ::mlir::ArrayAttr getKsize(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::Type getT(); + ::mlir::Type getTInput(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setKsizeAttr(::mlir::ArrayAttr attr); + void setStridesAttr(::mlir::ArrayAttr attr); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeDataFormatAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value orig_input, ::mlir::Value orig_output, ::mlir::Value grad, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value orig_input, ::mlir::Value orig_output, ::mlir::Value grad, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value orig_input, ::mlir::Value orig_output, ::mlir::Value grad, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::llvm::StringRef data_format = "NDHWC"); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value orig_input, ::mlir::Value orig_output, ::mlir::Value grad, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::llvm::StringRef data_format = "NDHWC"); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MaxPool3DGradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MaxPool3DOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MaxPool3DOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MaxPool3DOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MaxPool3DOpGenericAdaptorBase(MaxPool3DOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getKsizeAttr(); + ::mlir::ArrayAttr getKsize(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); +}; +} // namespace detail +template +class MaxPool3DOpGenericAdaptor : public detail::MaxPool3DOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MaxPool3DOpGenericAdaptorBase; +public: + MaxPool3DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MaxPool3DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MaxPool3DOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MaxPool3DOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MaxPool3DOpAdaptor : public MaxPool3DOpGenericAdaptor<::mlir::ValueRange> { +public: + using MaxPool3DOpGenericAdaptor::MaxPool3DOpGenericAdaptor; + MaxPool3DOpAdaptor(MaxPool3DOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MaxPool3DOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MaxPool3DOpAdaptor; + template + using GenericAdaptor = MaxPool3DOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("data_format"), ::llvm::StringRef("ksize"), ::llvm::StringRef("padding"), ::llvm::StringRef("strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getKsizeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getKsizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MaxPool3D"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ArrayAttr getKsizeAttr(); + ::mlir::ArrayAttr getKsize(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setKsizeAttr(::mlir::ArrayAttr attr); + void setStridesAttr(::mlir::ArrayAttr attr); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeDataFormatAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::llvm::StringRef data_format = "NDHWC"); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::llvm::StringRef data_format = "NDHWC"); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MaxPool3DOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MaxPoolGradGradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MaxPoolGradGradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MaxPoolGradGradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MaxPoolGradGradOpGenericAdaptorBase(MaxPoolGradGradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getKsizeAttr(); + ::mlir::ArrayAttr getKsize(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); +}; +} // namespace detail +template +class MaxPoolGradGradOpGenericAdaptor : public detail::MaxPoolGradGradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MaxPoolGradGradOpGenericAdaptorBase; +public: + MaxPoolGradGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MaxPoolGradGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MaxPoolGradGradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MaxPoolGradGradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOrigInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getOrigOutput() { + return (*getODSOperands(1).begin()); + } + + ValueT getGrad() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MaxPoolGradGradOpAdaptor : public MaxPoolGradGradOpGenericAdaptor<::mlir::ValueRange> { +public: + using MaxPoolGradGradOpGenericAdaptor::MaxPoolGradGradOpGenericAdaptor; + MaxPoolGradGradOpAdaptor(MaxPoolGradGradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MaxPoolGradGradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MaxPoolGradGradOpAdaptor; + template + using GenericAdaptor = MaxPoolGradGradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("data_format"), ::llvm::StringRef("ksize"), ::llvm::StringRef("padding"), ::llvm::StringRef("strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getKsizeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getKsizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MaxPoolGradGrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOrigInput(); + ::mlir::TypedValue<::mlir::TensorType> getOrigOutput(); + ::mlir::TypedValue<::mlir::TensorType> getGrad(); + ::mlir::OpOperand &getOrigInputMutable(); + ::mlir::OpOperand &getOrigOutputMutable(); + ::mlir::OpOperand &getGradMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ArrayAttr getKsizeAttr(); + ::mlir::ArrayAttr getKsize(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setKsizeAttr(::mlir::ArrayAttr attr); + void setStridesAttr(::mlir::ArrayAttr attr); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeDataFormatAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value orig_input, ::mlir::Value orig_output, ::mlir::Value grad, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value orig_input, ::mlir::Value orig_output, ::mlir::Value grad, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value orig_input, ::mlir::Value orig_output, ::mlir::Value grad, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::llvm::StringRef data_format = "NHWC"); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value orig_input, ::mlir::Value orig_output, ::mlir::Value grad, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::llvm::StringRef data_format = "NHWC"); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MaxPoolGradGradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MaxPoolGradGradV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MaxPoolGradGradV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MaxPoolGradGradV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MaxPoolGradGradV2OpGenericAdaptorBase(MaxPoolGradGradV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); +}; +} // namespace detail +template +class MaxPoolGradGradV2OpGenericAdaptor : public detail::MaxPoolGradGradV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MaxPoolGradGradV2OpGenericAdaptorBase; +public: + MaxPoolGradGradV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MaxPoolGradGradV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MaxPoolGradGradV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MaxPoolGradGradV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOrigInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getOrigOutput() { + return (*getODSOperands(1).begin()); + } + + ValueT getGrad() { + return (*getODSOperands(2).begin()); + } + + ValueT getKsize() { + return (*getODSOperands(3).begin()); + } + + ValueT getStrides() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MaxPoolGradGradV2OpAdaptor : public MaxPoolGradGradV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using MaxPoolGradGradV2OpGenericAdaptor::MaxPoolGradGradV2OpGenericAdaptor; + MaxPoolGradGradV2OpAdaptor(MaxPoolGradGradV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MaxPoolGradGradV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<5>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MaxPoolGradGradV2OpAdaptor; + template + using GenericAdaptor = MaxPoolGradGradV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("data_format"), ::llvm::StringRef("padding")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MaxPoolGradGradV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOrigInput(); + ::mlir::TypedValue<::mlir::TensorType> getOrigOutput(); + ::mlir::TypedValue<::mlir::TensorType> getGrad(); + ::mlir::TypedValue<::mlir::TensorType> getKsize(); + ::mlir::TypedValue<::mlir::TensorType> getStrides(); + ::mlir::OpOperand &getOrigInputMutable(); + ::mlir::OpOperand &getOrigOutputMutable(); + ::mlir::OpOperand &getGradMutable(); + ::mlir::OpOperand &getKsizeMutable(); + ::mlir::OpOperand &getStridesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeDataFormatAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value orig_input, ::mlir::Value orig_output, ::mlir::Value grad, ::mlir::Value ksize, ::mlir::Value strides, ::mlir::StringAttr padding, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value orig_input, ::mlir::Value orig_output, ::mlir::Value grad, ::mlir::Value ksize, ::mlir::Value strides, ::mlir::StringAttr padding, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value orig_input, ::mlir::Value orig_output, ::mlir::Value grad, ::mlir::Value ksize, ::mlir::Value strides, ::llvm::StringRef padding, /*optional*/::llvm::StringRef data_format = "NHWC"); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value orig_input, ::mlir::Value orig_output, ::mlir::Value grad, ::mlir::Value ksize, ::mlir::Value strides, ::llvm::StringRef padding, /*optional*/::llvm::StringRef data_format = "NHWC"); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MaxPoolGradGradV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MaxPoolGradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MaxPoolGradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MaxPoolGradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MaxPoolGradOpGenericAdaptorBase(MaxPoolGradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getKsizeAttr(); + ::mlir::ArrayAttr getKsize(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getExplicitPaddingsAttr(); + ::mlir::ArrayAttr getExplicitPaddings(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); +}; +} // namespace detail +template +class MaxPoolGradOpGenericAdaptor : public detail::MaxPoolGradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MaxPoolGradOpGenericAdaptorBase; +public: + MaxPoolGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MaxPoolGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MaxPoolGradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MaxPoolGradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOrigInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getOrigOutput() { + return (*getODSOperands(1).begin()); + } + + ValueT getGrad() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MaxPoolGradOpAdaptor : public MaxPoolGradOpGenericAdaptor<::mlir::ValueRange> { +public: + using MaxPoolGradOpGenericAdaptor::MaxPoolGradOpGenericAdaptor; + MaxPoolGradOpAdaptor(MaxPoolGradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MaxPoolGradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MaxPoolGradOpAdaptor; + template + using GenericAdaptor = MaxPoolGradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("data_format"), ::llvm::StringRef("explicit_paddings"), ::llvm::StringRef("ksize"), ::llvm::StringRef("padding"), ::llvm::StringRef("strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getExplicitPaddingsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getExplicitPaddingsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getKsizeAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getKsizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MaxPoolGrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOrigInput(); + ::mlir::TypedValue<::mlir::TensorType> getOrigOutput(); + ::mlir::TypedValue<::mlir::TensorType> getGrad(); + ::mlir::OpOperand &getOrigInputMutable(); + ::mlir::OpOperand &getOrigOutputMutable(); + ::mlir::OpOperand &getGradMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ArrayAttr getKsizeAttr(); + ::mlir::ArrayAttr getKsize(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getExplicitPaddingsAttr(); + ::mlir::ArrayAttr getExplicitPaddings(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setKsizeAttr(::mlir::ArrayAttr attr); + void setStridesAttr(::mlir::ArrayAttr attr); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + void setExplicitPaddingsAttr(::mlir::ArrayAttr attr); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeExplicitPaddingsAttr(); + ::mlir::Attribute removeDataFormatAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value orig_input, ::mlir::Value orig_output, ::mlir::Value grad, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value orig_input, ::mlir::Value orig_output, ::mlir::Value grad, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value orig_input, ::mlir::Value orig_output, ::mlir::Value grad, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::llvm::StringRef data_format = "NHWC"); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value orig_input, ::mlir::Value orig_output, ::mlir::Value grad, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::llvm::StringRef data_format = "NHWC"); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MaxPoolGradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MaxPoolGradV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MaxPoolGradV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MaxPoolGradV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MaxPoolGradV2OpGenericAdaptorBase(MaxPoolGradV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); +}; +} // namespace detail +template +class MaxPoolGradV2OpGenericAdaptor : public detail::MaxPoolGradV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MaxPoolGradV2OpGenericAdaptorBase; +public: + MaxPoolGradV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MaxPoolGradV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MaxPoolGradV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MaxPoolGradV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOrigInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getOrigOutput() { + return (*getODSOperands(1).begin()); + } + + ValueT getGrad() { + return (*getODSOperands(2).begin()); + } + + ValueT getKsize() { + return (*getODSOperands(3).begin()); + } + + ValueT getStrides() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MaxPoolGradV2OpAdaptor : public MaxPoolGradV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using MaxPoolGradV2OpGenericAdaptor::MaxPoolGradV2OpGenericAdaptor; + MaxPoolGradV2OpAdaptor(MaxPoolGradV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MaxPoolGradV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<5>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MaxPoolGradV2OpAdaptor; + template + using GenericAdaptor = MaxPoolGradV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("data_format"), ::llvm::StringRef("padding")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MaxPoolGradV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOrigInput(); + ::mlir::TypedValue<::mlir::TensorType> getOrigOutput(); + ::mlir::TypedValue<::mlir::TensorType> getGrad(); + ::mlir::TypedValue<::mlir::TensorType> getKsize(); + ::mlir::TypedValue<::mlir::TensorType> getStrides(); + ::mlir::OpOperand &getOrigInputMutable(); + ::mlir::OpOperand &getOrigOutputMutable(); + ::mlir::OpOperand &getGradMutable(); + ::mlir::OpOperand &getKsizeMutable(); + ::mlir::OpOperand &getStridesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeDataFormatAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value orig_input, ::mlir::Value orig_output, ::mlir::Value grad, ::mlir::Value ksize, ::mlir::Value strides, ::mlir::StringAttr padding, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value orig_input, ::mlir::Value orig_output, ::mlir::Value grad, ::mlir::Value ksize, ::mlir::Value strides, ::mlir::StringAttr padding, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value orig_input, ::mlir::Value orig_output, ::mlir::Value grad, ::mlir::Value ksize, ::mlir::Value strides, ::llvm::StringRef padding, /*optional*/::llvm::StringRef data_format = "NHWC"); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value orig_input, ::mlir::Value orig_output, ::mlir::Value grad, ::mlir::Value ksize, ::mlir::Value strides, ::llvm::StringRef padding, /*optional*/::llvm::StringRef data_format = "NHWC"); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MaxPoolGradV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MaxPoolOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MaxPoolOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MaxPoolOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MaxPoolOpGenericAdaptorBase(MaxPoolOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getKsizeAttr(); + ::mlir::ArrayAttr getKsize(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getExplicitPaddingsAttr(); + ::mlir::ArrayAttr getExplicitPaddings(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); +}; +} // namespace detail +template +class MaxPoolOpGenericAdaptor : public detail::MaxPoolOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MaxPoolOpGenericAdaptorBase; +public: + MaxPoolOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MaxPoolOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MaxPoolOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MaxPoolOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MaxPoolOpAdaptor : public MaxPoolOpGenericAdaptor<::mlir::ValueRange> { +public: + using MaxPoolOpGenericAdaptor::MaxPoolOpGenericAdaptor; + MaxPoolOpAdaptor(MaxPoolOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MaxPoolOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, FoldOperandsTransposeInterface::Trait, LayoutSensitiveInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MaxPoolOpAdaptor; + template + using GenericAdaptor = MaxPoolOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("data_format"), ::llvm::StringRef("explicit_paddings"), ::llvm::StringRef("ksize"), ::llvm::StringRef("padding"), ::llvm::StringRef("strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getExplicitPaddingsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getExplicitPaddingsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getKsizeAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getKsizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MaxPool"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ArrayAttr getKsizeAttr(); + ::mlir::ArrayAttr getKsize(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getExplicitPaddingsAttr(); + ::mlir::ArrayAttr getExplicitPaddings(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setKsizeAttr(::mlir::ArrayAttr attr); + void setStridesAttr(::mlir::ArrayAttr attr); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + void setExplicitPaddingsAttr(::mlir::ArrayAttr attr); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeExplicitPaddingsAttr(); + ::mlir::Attribute removeDataFormatAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::llvm::StringRef data_format = "NHWC"); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::ArrayAttr ksize, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::llvm::StringRef data_format = "NHWC"); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // TF_FoldOperandsTransposeInterface: + SmallVector GetLayoutDependentArgs() { return {0}; } + SmallVector GetLayoutDependentResults() { return {0}; } + LogicalResult FoldOperandsPermutation(ArrayRef permutation); + // TF_LayoutSensitiveInterface: + StringRef GetOptimalLayout(const RuntimeDevices& devices); + LogicalResult UpdateDataFormat(StringRef data_format); +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MaxPoolOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MaxPoolV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MaxPoolV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MaxPoolV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MaxPoolV2OpGenericAdaptorBase(MaxPoolV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); +}; +} // namespace detail +template +class MaxPoolV2OpGenericAdaptor : public detail::MaxPoolV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MaxPoolV2OpGenericAdaptorBase; +public: + MaxPoolV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MaxPoolV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MaxPoolV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MaxPoolV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getKsize() { + return (*getODSOperands(1).begin()); + } + + ValueT getStrides() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MaxPoolV2OpAdaptor : public MaxPoolV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using MaxPoolV2OpGenericAdaptor::MaxPoolV2OpGenericAdaptor; + MaxPoolV2OpAdaptor(MaxPoolV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MaxPoolV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MaxPoolV2OpAdaptor; + template + using GenericAdaptor = MaxPoolV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("data_format"), ::llvm::StringRef("padding")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MaxPoolV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getKsize(); + ::mlir::TypedValue<::mlir::TensorType> getStrides(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getKsizeMutable(); + ::mlir::OpOperand &getStridesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeDataFormatAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value ksize, ::mlir::Value strides, ::mlir::StringAttr padding, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value ksize, ::mlir::Value strides, ::mlir::StringAttr padding, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value ksize, ::mlir::Value strides, ::llvm::StringRef padding, /*optional*/::llvm::StringRef data_format = "NHWC"); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value ksize, ::mlir::Value strides, ::llvm::StringRef padding, /*optional*/::llvm::StringRef data_format = "NHWC"); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MaxPoolV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MaximumOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MaximumOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MaximumOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MaximumOpGenericAdaptorBase(MaximumOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MaximumOpGenericAdaptor : public detail::MaximumOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MaximumOpGenericAdaptorBase; +public: + MaximumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MaximumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MaximumOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MaximumOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MaximumOpAdaptor : public MaximumOpGenericAdaptor<::mlir::ValueRange> { +public: + using MaximumOpGenericAdaptor::MaximumOpGenericAdaptor; + MaximumOpAdaptor(MaximumOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MaximumOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::OpTrait::TF::SameOperandsAndResultElementTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MaximumOpAdaptor; + template + using GenericAdaptor = MaximumOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Maximum"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MaximumOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MeanOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MeanOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MeanOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MeanOpGenericAdaptorBase(MeanOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getKeepDimsAttr(); + bool getKeepDims(); +}; +} // namespace detail +template +class MeanOpGenericAdaptor : public detail::MeanOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MeanOpGenericAdaptorBase; +public: + MeanOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MeanOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MeanOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MeanOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getReductionIndices() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MeanOpAdaptor : public MeanOpGenericAdaptor<::mlir::ValueRange> { +public: + using MeanOpGenericAdaptor::MeanOpGenericAdaptor; + MeanOpAdaptor(MeanOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MeanOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, FoldOperandsTransposeInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MeanOpAdaptor; + template + using GenericAdaptor = MeanOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tidx"), ::llvm::StringRef("keep_dims")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTidxAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTidxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getKeepDimsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getKeepDimsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Mean"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getReductionIndices(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getReductionIndicesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getKeepDimsAttr(); + bool getKeepDims(); + ::mlir::Type getT(); + ::mlir::Type getTidx(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setKeepDimsAttr(::mlir::BoolAttr attr); + void setKeepDims(::std::optional attrValue); + ::mlir::Attribute removeKeepDimsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value reduction_indices, /*optional*/::mlir::BoolAttr keep_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value reduction_indices, /*optional*/::mlir::BoolAttr keep_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value reduction_indices, /*optional*/bool keep_dims = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value reduction_indices, /*optional*/bool keep_dims = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // TF_FoldOperandsTransposeInterface: + SmallVector GetLayoutDependentArgs() { return {0}; } + SmallVector GetLayoutDependentResults() { return {}; } + LogicalResult FoldOperandsPermutation(ArrayRef permutation); +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MeanOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MergeSummaryOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MergeSummaryOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MergeSummaryOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MergeSummaryOpGenericAdaptorBase(MergeSummaryOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MergeSummaryOpGenericAdaptor : public detail::MergeSummaryOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MergeSummaryOpGenericAdaptorBase; +public: + MergeSummaryOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MergeSummaryOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MergeSummaryOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MergeSummaryOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MergeSummaryOpAdaptor : public MergeSummaryOpGenericAdaptor<::mlir::ValueRange> { +public: + using MergeSummaryOpGenericAdaptor::MergeSummaryOpGenericAdaptor; + MergeSummaryOpAdaptor(MergeSummaryOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MergeSummaryOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MergeSummaryOpAdaptor; + template + using GenericAdaptor = MergeSummaryOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("N")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MergeSummary"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::MutableOperandRange getInputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSummary(); + size_t getN(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type summary, ::mlir::ValueRange inputs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MergeSummaryOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MergeV2CheckpointsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MergeV2CheckpointsOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MergeV2CheckpointsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MergeV2CheckpointsOpGenericAdaptorBase(MergeV2CheckpointsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getDeleteOldDirsAttr(); + bool getDeleteOldDirs(); + ::mlir::BoolAttr getAllowMissingFilesAttr(); + bool getAllowMissingFiles(); +}; +} // namespace detail +template +class MergeV2CheckpointsOpGenericAdaptor : public detail::MergeV2CheckpointsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MergeV2CheckpointsOpGenericAdaptorBase; +public: + MergeV2CheckpointsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MergeV2CheckpointsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MergeV2CheckpointsOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MergeV2CheckpointsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getCheckpointPrefixes() { + return (*getODSOperands(0).begin()); + } + + ValueT getDestinationPrefix() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MergeV2CheckpointsOpAdaptor : public MergeV2CheckpointsOpGenericAdaptor<::mlir::ValueRange> { +public: + using MergeV2CheckpointsOpGenericAdaptor::MergeV2CheckpointsOpGenericAdaptor; + MergeV2CheckpointsOpAdaptor(MergeV2CheckpointsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MergeV2CheckpointsOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = MergeV2CheckpointsOpAdaptor; + template + using GenericAdaptor = MergeV2CheckpointsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("allow_missing_files"), ::llvm::StringRef("delete_old_dirs")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAllowMissingFilesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAllowMissingFilesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDeleteOldDirsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDeleteOldDirsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MergeV2Checkpoints"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getCheckpointPrefixes(); + ::mlir::TypedValue<::mlir::TensorType> getDestinationPrefix(); + ::mlir::OpOperand &getCheckpointPrefixesMutable(); + ::mlir::OpOperand &getDestinationPrefixMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::BoolAttr getDeleteOldDirsAttr(); + bool getDeleteOldDirs(); + ::mlir::BoolAttr getAllowMissingFilesAttr(); + bool getAllowMissingFiles(); + void setDeleteOldDirsAttr(::mlir::BoolAttr attr); + void setDeleteOldDirs(::std::optional attrValue); + void setAllowMissingFilesAttr(::mlir::BoolAttr attr); + void setAllowMissingFiles(::std::optional attrValue); + ::mlir::Attribute removeDeleteOldDirsAttr(); + ::mlir::Attribute removeAllowMissingFilesAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value checkpoint_prefixes, ::mlir::Value destination_prefix, /*optional*/::mlir::BoolAttr delete_old_dirs, /*optional*/::mlir::BoolAttr allow_missing_files); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value checkpoint_prefixes, ::mlir::Value destination_prefix, /*optional*/::mlir::BoolAttr delete_old_dirs, /*optional*/::mlir::BoolAttr allow_missing_files); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value checkpoint_prefixes, ::mlir::Value destination_prefix, /*optional*/bool delete_old_dirs = true, /*optional*/bool allow_missing_files = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value checkpoint_prefixes, ::mlir::Value destination_prefix, /*optional*/bool delete_old_dirs = true, /*optional*/bool allow_missing_files = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MergeV2CheckpointsOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MinOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MinOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MinOpGenericAdaptorBase(MinOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getKeepDimsAttr(); + bool getKeepDims(); +}; +} // namespace detail +template +class MinOpGenericAdaptor : public detail::MinOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MinOpGenericAdaptorBase; +public: + MinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MinOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MinOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getReductionIndices() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MinOpAdaptor : public MinOpGenericAdaptor<::mlir::ValueRange> { +public: + using MinOpGenericAdaptor::MinOpGenericAdaptor; + MinOpAdaptor(MinOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MinOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MinOpAdaptor; + template + using GenericAdaptor = MinOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tidx"), ::llvm::StringRef("keep_dims")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTidxAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTidxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getKeepDimsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getKeepDimsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Min"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getReductionIndices(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getReductionIndicesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getKeepDimsAttr(); + bool getKeepDims(); + ::mlir::Type getT(); + ::mlir::Type getTidx(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setKeepDimsAttr(::mlir::BoolAttr attr); + void setKeepDims(::std::optional attrValue); + ::mlir::Attribute removeKeepDimsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value reduction_indices, /*optional*/::mlir::BoolAttr keep_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value reduction_indices, /*optional*/::mlir::BoolAttr keep_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value reduction_indices, /*optional*/bool keep_dims = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value reduction_indices, /*optional*/bool keep_dims = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MinOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MinimumOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MinimumOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MinimumOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MinimumOpGenericAdaptorBase(MinimumOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MinimumOpGenericAdaptor : public detail::MinimumOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MinimumOpGenericAdaptorBase; +public: + MinimumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MinimumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MinimumOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MinimumOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MinimumOpAdaptor : public MinimumOpGenericAdaptor<::mlir::ValueRange> { +public: + using MinimumOpGenericAdaptor::MinimumOpGenericAdaptor; + MinimumOpAdaptor(MinimumOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MinimumOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::OpTrait::TF::SameOperandsAndResultElementTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MinimumOpAdaptor; + template + using GenericAdaptor = MinimumOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Minimum"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MinimumOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MirrorPadGradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MirrorPadGradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MirrorPadGradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MirrorPadGradOpGenericAdaptorBase(MirrorPadGradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getModeAttr(); + ::llvm::StringRef getMode(); +}; +} // namespace detail +template +class MirrorPadGradOpGenericAdaptor : public detail::MirrorPadGradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MirrorPadGradOpGenericAdaptorBase; +public: + MirrorPadGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MirrorPadGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MirrorPadGradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MirrorPadGradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getPaddings() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MirrorPadGradOpAdaptor : public MirrorPadGradOpGenericAdaptor<::mlir::ValueRange> { +public: + using MirrorPadGradOpGenericAdaptor::MirrorPadGradOpGenericAdaptor; + MirrorPadGradOpAdaptor(MirrorPadGradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MirrorPadGradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MirrorPadGradOpAdaptor; + template + using GenericAdaptor = MirrorPadGradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tpaddings"), ::llvm::StringRef("mode")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTpaddingsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTpaddingsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getModeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getModeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MirrorPadGrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getPaddings(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getPaddingsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::StringAttr getModeAttr(); + ::llvm::StringRef getMode(); + ::mlir::Type getT(); + ::mlir::Type getTpaddings(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setModeAttr(::mlir::StringAttr attr); + void setMode(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value paddings, ::mlir::StringAttr mode); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value paddings, ::mlir::StringAttr mode); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value paddings, ::llvm::StringRef mode); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value paddings, ::llvm::StringRef mode); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MirrorPadGradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MirrorPadOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MirrorPadOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MirrorPadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MirrorPadOpGenericAdaptorBase(MirrorPadOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getModeAttr(); + ::llvm::StringRef getMode(); +}; +} // namespace detail +template +class MirrorPadOpGenericAdaptor : public detail::MirrorPadOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MirrorPadOpGenericAdaptorBase; +public: + MirrorPadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MirrorPadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MirrorPadOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MirrorPadOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getPaddings() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MirrorPadOpAdaptor : public MirrorPadOpGenericAdaptor<::mlir::ValueRange> { +public: + using MirrorPadOpGenericAdaptor::MirrorPadOpGenericAdaptor; + MirrorPadOpAdaptor(MirrorPadOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MirrorPadOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MirrorPadOpAdaptor; + template + using GenericAdaptor = MirrorPadOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tpaddings"), ::llvm::StringRef("mode")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTpaddingsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTpaddingsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getModeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getModeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MirrorPad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getPaddings(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getPaddingsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::StringAttr getModeAttr(); + ::llvm::StringRef getMode(); + ::mlir::Type getT(); + ::mlir::Type getTpaddings(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setModeAttr(::mlir::StringAttr attr); + void setMode(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value paddings, ::mlir::StringAttr mode); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value paddings, ::mlir::StringAttr mode); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value paddings, ::llvm::StringRef mode); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value paddings, ::llvm::StringRef mode); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MirrorPadOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MlirLocalVarOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MlirLocalVarOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MlirLocalVarOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MlirLocalVarOpGenericAdaptorBase(MlirLocalVarOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MlirLocalVarOpGenericAdaptor : public detail::MlirLocalVarOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MlirLocalVarOpGenericAdaptorBase; +public: + MlirLocalVarOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MlirLocalVarOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MlirLocalVarOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MlirLocalVarOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MlirLocalVarOpAdaptor : public MlirLocalVarOpGenericAdaptor<::mlir::ValueRange> { +public: + using MlirLocalVarOpGenericAdaptor::MlirLocalVarOpGenericAdaptor; + MlirLocalVarOpAdaptor(MlirLocalVarOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MlirLocalVarOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MlirLocalVarOpAdaptor; + template + using GenericAdaptor = MlirLocalVarOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MlirLocalVarOp"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResource(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resource); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MlirLocalVarOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MlirPassthroughOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MlirPassthroughOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MlirPassthroughOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MlirPassthroughOpGenericAdaptorBase(MlirPassthroughOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getMlirModuleAttr(); + ::llvm::StringRef getMlirModule(); +}; +} // namespace detail +template +class MlirPassthroughOpGenericAdaptor : public detail::MlirPassthroughOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MlirPassthroughOpGenericAdaptorBase; +public: + MlirPassthroughOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MlirPassthroughOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MlirPassthroughOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MlirPassthroughOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MlirPassthroughOpAdaptor : public MlirPassthroughOpGenericAdaptor<::mlir::ValueRange> { +public: + using MlirPassthroughOpGenericAdaptor::MlirPassthroughOpGenericAdaptor; + MlirPassthroughOpAdaptor(MlirPassthroughOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MlirPassthroughOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = MlirPassthroughOpAdaptor; + template + using GenericAdaptor = MlirPassthroughOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tinputs"), ::llvm::StringRef("Toutputs"), ::llvm::StringRef("mlir_module")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTinputsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTinputsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getToutputsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getToutputsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getMlirModuleAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getMlirModuleAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MlirPassthroughOp"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::MutableOperandRange getInputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutputs(); + ::mlir::StringAttr getMlirModuleAttr(); + ::llvm::StringRef getMlirModule(); + mlir::OperandElementTypeRange getTinputs(); + mlir::ResultElementTypeRange getToutputs(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setMlirModuleAttr(::mlir::StringAttr attr); + void setMlirModule(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outputs, ::mlir::ValueRange inputs, ::mlir::StringAttr mlir_module); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outputs, ::mlir::ValueRange inputs, ::llvm::StringRef mlir_module); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MlirPassthroughOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ModOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ModOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ModOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ModOpGenericAdaptorBase(ModOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ModOpGenericAdaptor : public detail::ModOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ModOpGenericAdaptorBase; +public: + ModOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ModOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ModOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ModOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ModOpAdaptor : public ModOpGenericAdaptor<::mlir::ValueRange> { +public: + using ModOpGenericAdaptor::ModOpGenericAdaptor; + ModOpAdaptor(ModOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ModOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::OpTrait::TF::SameOperandsAndResultElementTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ModOpAdaptor; + template + using GenericAdaptor = ModOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Mod"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ModOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ModelDatasetOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ModelDatasetOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ModelDatasetOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ModelDatasetOpGenericAdaptorBase(ModelDatasetOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getAlgorithmAttr(); + uint64_t getAlgorithm(); + ::mlir::IntegerAttr getCpuBudgetAttr(); + uint64_t getCpuBudget(); + ::mlir::IntegerAttr getRamBudgetAttr(); + uint64_t getRamBudget(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); +}; +} // namespace detail +template +class ModelDatasetOpGenericAdaptor : public detail::ModelDatasetOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ModelDatasetOpGenericAdaptorBase; +public: + ModelDatasetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ModelDatasetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ModelDatasetOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ModelDatasetOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputDataset() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ModelDatasetOpAdaptor : public ModelDatasetOpGenericAdaptor<::mlir::ValueRange> { +public: + using ModelDatasetOpGenericAdaptor::ModelDatasetOpGenericAdaptor; + ModelDatasetOpAdaptor(ModelDatasetOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ModelDatasetOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ModelDatasetOpAdaptor; + template + using GenericAdaptor = ModelDatasetOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("algorithm"), ::llvm::StringRef("cpu_budget"), ::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types"), ::llvm::StringRef("ram_budget")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAlgorithmAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAlgorithmAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getCpuBudgetAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getCpuBudgetAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getRamBudgetAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getRamBudgetAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ModelDataset"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputDataset(); + ::mlir::OpOperand &getInputDatasetMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::IntegerAttr getAlgorithmAttr(); + uint64_t getAlgorithm(); + ::mlir::IntegerAttr getCpuBudgetAttr(); + uint64_t getCpuBudget(); + ::mlir::IntegerAttr getRamBudgetAttr(); + uint64_t getRamBudget(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + void setAlgorithmAttr(::mlir::IntegerAttr attr); + void setAlgorithm(::std::optional attrValue); + void setCpuBudgetAttr(::mlir::IntegerAttr attr); + void setCpuBudget(::std::optional attrValue); + void setRamBudgetAttr(::mlir::IntegerAttr attr); + void setRamBudget(::std::optional attrValue); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeAlgorithmAttr(); + ::mlir::Attribute removeCpuBudgetAttr(); + ::mlir::Attribute removeRamBudgetAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, /*optional*/::mlir::IntegerAttr algorithm, /*optional*/::mlir::IntegerAttr cpu_budget, /*optional*/::mlir::IntegerAttr ram_budget, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, /*optional*/::mlir::IntegerAttr algorithm, /*optional*/::mlir::IntegerAttr cpu_budget, /*optional*/::mlir::IntegerAttr ram_budget, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, /*optional*/uint64_t algorithm, /*optional*/uint64_t cpu_budget, /*optional*/uint64_t ram_budget, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, /*optional*/uint64_t algorithm, /*optional*/uint64_t cpu_budget, /*optional*/uint64_t ram_budget, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ModelDatasetOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MulNoNanOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MulNoNanOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MulNoNanOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MulNoNanOpGenericAdaptorBase(MulNoNanOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MulNoNanOpGenericAdaptor : public detail::MulNoNanOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MulNoNanOpGenericAdaptorBase; +public: + MulNoNanOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MulNoNanOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MulNoNanOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MulNoNanOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MulNoNanOpAdaptor : public MulNoNanOpGenericAdaptor<::mlir::ValueRange> { +public: + using MulNoNanOpGenericAdaptor::MulNoNanOpGenericAdaptor; + MulNoNanOpAdaptor(MulNoNanOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MulNoNanOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MulNoNanOpAdaptor; + template + using GenericAdaptor = MulNoNanOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MulNoNan"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MulNoNanOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MulOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MulOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MulOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MulOpGenericAdaptorBase(MulOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MulOpGenericAdaptor : public detail::MulOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MulOpGenericAdaptorBase; +public: + MulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MulOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MulOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MulOpAdaptor : public MulOpGenericAdaptor<::mlir::ValueRange> { +public: + using MulOpGenericAdaptor::MulOpGenericAdaptor; + MulOpAdaptor(MulOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MulOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsCommutative, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::OpTrait::TF::CwiseBinary, ::mlir::OpTrait::TF::SameOperandsAndResultElementTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MulOpAdaptor; + template + using GenericAdaptor = MulOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Mul"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MulOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MultiDeviceIteratorFromStringHandleOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MultiDeviceIteratorFromStringHandleOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MultiDeviceIteratorFromStringHandleOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MultiDeviceIteratorFromStringHandleOpGenericAdaptorBase(MultiDeviceIteratorFromStringHandleOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); +}; +} // namespace detail +template +class MultiDeviceIteratorFromStringHandleOpGenericAdaptor : public detail::MultiDeviceIteratorFromStringHandleOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MultiDeviceIteratorFromStringHandleOpGenericAdaptorBase; +public: + MultiDeviceIteratorFromStringHandleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MultiDeviceIteratorFromStringHandleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MultiDeviceIteratorFromStringHandleOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MultiDeviceIteratorFromStringHandleOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getStringHandle() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MultiDeviceIteratorFromStringHandleOpAdaptor : public MultiDeviceIteratorFromStringHandleOpGenericAdaptor<::mlir::ValueRange> { +public: + using MultiDeviceIteratorFromStringHandleOpGenericAdaptor::MultiDeviceIteratorFromStringHandleOpGenericAdaptor; + MultiDeviceIteratorFromStringHandleOpAdaptor(MultiDeviceIteratorFromStringHandleOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MultiDeviceIteratorFromStringHandleOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MultiDeviceIteratorFromStringHandleOpAdaptor; + template + using GenericAdaptor = MultiDeviceIteratorFromStringHandleOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MultiDeviceIteratorFromStringHandle"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getStringHandle(); + ::mlir::OpOperand &getStringHandleMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getMultiDeviceIterator(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeOutputTypesAttr(); + ::mlir::Attribute removeOutputShapesAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type multi_device_iterator, ::mlir::Value string_handle, /*optional*/::mlir::ArrayAttr output_types, /*optional*/::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value string_handle, /*optional*/::mlir::ArrayAttr output_types, /*optional*/::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MultiDeviceIteratorFromStringHandleOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MultiDeviceIteratorGetNextFromShardOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MultiDeviceIteratorGetNextFromShardOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MultiDeviceIteratorGetNextFromShardOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MultiDeviceIteratorGetNextFromShardOpGenericAdaptorBase(MultiDeviceIteratorGetNextFromShardOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MultiDeviceIteratorGetNextFromShardOpGenericAdaptor : public detail::MultiDeviceIteratorGetNextFromShardOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MultiDeviceIteratorGetNextFromShardOpGenericAdaptorBase; +public: + MultiDeviceIteratorGetNextFromShardOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MultiDeviceIteratorGetNextFromShardOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MultiDeviceIteratorGetNextFromShardOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MultiDeviceIteratorGetNextFromShardOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getMultiDeviceIterator() { + return (*getODSOperands(0).begin()); + } + + ValueT getShardNum() { + return (*getODSOperands(1).begin()); + } + + ValueT getIncarnationId() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MultiDeviceIteratorGetNextFromShardOpAdaptor : public MultiDeviceIteratorGetNextFromShardOpGenericAdaptor<::mlir::ValueRange> { +public: + using MultiDeviceIteratorGetNextFromShardOpGenericAdaptor::MultiDeviceIteratorGetNextFromShardOpGenericAdaptor; + MultiDeviceIteratorGetNextFromShardOpAdaptor(MultiDeviceIteratorGetNextFromShardOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MultiDeviceIteratorGetNextFromShardOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MultiDeviceIteratorGetNextFromShardOpAdaptor; + template + using GenericAdaptor = MultiDeviceIteratorGetNextFromShardOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MultiDeviceIteratorGetNextFromShard"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getMultiDeviceIterator(); + ::mlir::TypedValue<::mlir::TensorType> getShardNum(); + ::mlir::TypedValue<::mlir::TensorType> getIncarnationId(); + ::mlir::OpOperand &getMultiDeviceIteratorMutable(); + ::mlir::OpOperand &getShardNumMutable(); + ::mlir::OpOperand &getIncarnationIdMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getComponents(); + mlir::TF::ResultShapeRange getOutputShapes(); + mlir::ResultElementTypeRange getOutputTypes(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange components, ::mlir::Value multi_device_iterator, ::mlir::Value shard_num, ::mlir::Value incarnation_id); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MultiDeviceIteratorGetNextFromShardOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MultiDeviceIteratorInitOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MultiDeviceIteratorInitOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MultiDeviceIteratorInitOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MultiDeviceIteratorInitOpGenericAdaptorBase(MultiDeviceIteratorInitOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MultiDeviceIteratorInitOpGenericAdaptor : public detail::MultiDeviceIteratorInitOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MultiDeviceIteratorInitOpGenericAdaptorBase; +public: + MultiDeviceIteratorInitOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MultiDeviceIteratorInitOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MultiDeviceIteratorInitOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MultiDeviceIteratorInitOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getDataset() { + return (*getODSOperands(0).begin()); + } + + ValueT getMultiDeviceIterator() { + return (*getODSOperands(1).begin()); + } + + ValueT getMaxBufferSize() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MultiDeviceIteratorInitOpAdaptor : public MultiDeviceIteratorInitOpGenericAdaptor<::mlir::ValueRange> { +public: + using MultiDeviceIteratorInitOpGenericAdaptor::MultiDeviceIteratorInitOpGenericAdaptor; + MultiDeviceIteratorInitOpAdaptor(MultiDeviceIteratorInitOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MultiDeviceIteratorInitOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MultiDeviceIteratorInitOpAdaptor; + template + using GenericAdaptor = MultiDeviceIteratorInitOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MultiDeviceIteratorInit"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getDataset(); + ::mlir::TypedValue<::mlir::TensorType> getMultiDeviceIterator(); + ::mlir::TypedValue<::mlir::TensorType> getMaxBufferSize(); + ::mlir::OpOperand &getDatasetMutable(); + ::mlir::OpOperand &getMultiDeviceIteratorMutable(); + ::mlir::OpOperand &getMaxBufferSizeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getIncarnationId(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type incarnation_id, ::mlir::Value dataset, ::mlir::Value multi_device_iterator, ::mlir::Value max_buffer_size); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value dataset, ::mlir::Value multi_device_iterator, ::mlir::Value max_buffer_size); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MultiDeviceIteratorInitOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MultiDeviceIteratorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MultiDeviceIteratorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MultiDeviceIteratorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MultiDeviceIteratorOpGenericAdaptorBase(MultiDeviceIteratorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getDevicesAttr(); + ::mlir::ArrayAttr getDevices(); + ::mlir::StringAttr getSharedNameAttr(); + ::llvm::StringRef getSharedName(); + ::mlir::StringAttr getContainerAttr(); + ::llvm::StringRef getContainer(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); +}; +} // namespace detail +template +class MultiDeviceIteratorOpGenericAdaptor : public detail::MultiDeviceIteratorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MultiDeviceIteratorOpGenericAdaptorBase; +public: + MultiDeviceIteratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MultiDeviceIteratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MultiDeviceIteratorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MultiDeviceIteratorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MultiDeviceIteratorOpAdaptor : public MultiDeviceIteratorOpGenericAdaptor<::mlir::ValueRange> { +public: + using MultiDeviceIteratorOpGenericAdaptor::MultiDeviceIteratorOpGenericAdaptor; + MultiDeviceIteratorOpAdaptor(MultiDeviceIteratorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MultiDeviceIteratorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MultiDeviceIteratorOpAdaptor; + template + using GenericAdaptor = MultiDeviceIteratorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("container"), ::llvm::StringRef("devices"), ::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types"), ::llvm::StringRef("shared_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getContainerAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getContainerAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDevicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDevicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getSharedNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getSharedNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MultiDeviceIterator"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::ArrayAttr getDevicesAttr(); + ::mlir::ArrayAttr getDevices(); + ::mlir::StringAttr getSharedNameAttr(); + ::llvm::StringRef getSharedName(); + ::mlir::StringAttr getContainerAttr(); + ::llvm::StringRef getContainer(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + void setDevicesAttr(::mlir::ArrayAttr attr); + void setSharedNameAttr(::mlir::StringAttr attr); + void setSharedName(::llvm::StringRef attrValue); + void setContainerAttr(::mlir::StringAttr attr); + void setContainer(::llvm::StringRef attrValue); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::ArrayAttr devices, ::mlir::StringAttr shared_name, ::mlir::StringAttr container, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ArrayAttr devices, ::mlir::StringAttr shared_name, ::mlir::StringAttr container, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::ArrayAttr devices, ::llvm::StringRef shared_name, ::llvm::StringRef container, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ArrayAttr devices, ::llvm::StringRef shared_name, ::llvm::StringRef container, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MultiDeviceIteratorOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MultiDeviceIteratorToStringHandleOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MultiDeviceIteratorToStringHandleOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MultiDeviceIteratorToStringHandleOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MultiDeviceIteratorToStringHandleOpGenericAdaptorBase(MultiDeviceIteratorToStringHandleOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MultiDeviceIteratorToStringHandleOpGenericAdaptor : public detail::MultiDeviceIteratorToStringHandleOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MultiDeviceIteratorToStringHandleOpGenericAdaptorBase; +public: + MultiDeviceIteratorToStringHandleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MultiDeviceIteratorToStringHandleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MultiDeviceIteratorToStringHandleOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MultiDeviceIteratorToStringHandleOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getMultiDeviceIterator() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MultiDeviceIteratorToStringHandleOpAdaptor : public MultiDeviceIteratorToStringHandleOpGenericAdaptor<::mlir::ValueRange> { +public: + using MultiDeviceIteratorToStringHandleOpGenericAdaptor::MultiDeviceIteratorToStringHandleOpGenericAdaptor; + MultiDeviceIteratorToStringHandleOpAdaptor(MultiDeviceIteratorToStringHandleOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MultiDeviceIteratorToStringHandleOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MultiDeviceIteratorToStringHandleOpAdaptor; + template + using GenericAdaptor = MultiDeviceIteratorToStringHandleOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MultiDeviceIteratorToStringHandle"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getMultiDeviceIterator(); + ::mlir::OpOperand &getMultiDeviceIteratorMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getStringHandle(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type string_handle, ::mlir::Value multi_device_iterator); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value multi_device_iterator); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MultiDeviceIteratorToStringHandleOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MultinomialOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MultinomialOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MultinomialOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MultinomialOpGenericAdaptorBase(MultinomialOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getSeedAttr(); + uint64_t getSeed(); + ::mlir::IntegerAttr getSeed2Attr(); + uint64_t getSeed2(); +}; +} // namespace detail +template +class MultinomialOpGenericAdaptor : public detail::MultinomialOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MultinomialOpGenericAdaptorBase; +public: + MultinomialOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MultinomialOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MultinomialOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MultinomialOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLogits() { + return (*getODSOperands(0).begin()); + } + + ValueT getNumSamples() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MultinomialOpAdaptor : public MultinomialOpGenericAdaptor<::mlir::ValueRange> { +public: + using MultinomialOpGenericAdaptor::MultinomialOpGenericAdaptor; + MultinomialOpAdaptor(MultinomialOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MultinomialOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::TF::CannotDuplicate, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MultinomialOpAdaptor; + template + using GenericAdaptor = MultinomialOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("output_dtype"), ::llvm::StringRef("seed"), ::llvm::StringRef("seed2")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutputDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutputDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getSeedAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getSeedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSeed2AttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSeed2AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Multinomial"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLogits(); + ::mlir::TypedValue<::mlir::TensorType> getNumSamples(); + ::mlir::OpOperand &getLogitsMutable(); + ::mlir::OpOperand &getNumSamplesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getSeedAttr(); + uint64_t getSeed(); + ::mlir::IntegerAttr getSeed2Attr(); + uint64_t getSeed2(); + ::mlir::Type getT(); + ::mlir::Type getOutputDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setSeedAttr(::mlir::IntegerAttr attr); + void setSeed(::std::optional attrValue); + void setSeed2Attr(::mlir::IntegerAttr attr); + void setSeed2(::std::optional attrValue); + ::mlir::Attribute removeSeedAttr(); + ::mlir::Attribute removeSeed2Attr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value logits, ::mlir::Value num_samples, /*optional*/::mlir::IntegerAttr seed, /*optional*/::mlir::IntegerAttr seed2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value logits, ::mlir::Value num_samples, /*optional*/::mlir::IntegerAttr seed, /*optional*/::mlir::IntegerAttr seed2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value logits, ::mlir::Value num_samples, /*optional*/uint64_t seed = 0, /*optional*/uint64_t seed2 = 0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value logits, ::mlir::Value num_samples, /*optional*/uint64_t seed = 0, /*optional*/uint64_t seed2 = 0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MultinomialOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MutableDenseHashTableV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MutableDenseHashTableV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MutableDenseHashTableV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MutableDenseHashTableV2OpGenericAdaptorBase(MutableDenseHashTableV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getContainerAttr(); + ::llvm::StringRef getContainer(); + ::mlir::StringAttr getSharedNameAttr(); + ::llvm::StringRef getSharedName(); + ::mlir::BoolAttr getUseNodeNameSharingAttr(); + bool getUseNodeNameSharing(); + ::mlir::TypeAttr getValueDtypeAttr(); + ::mlir::Type getValueDtype(); + ::mlir::Attribute getValueShapeAttr(); + std::optional> getValueShape(); + ::mlir::IntegerAttr getInitialNumBucketsAttr(); + uint64_t getInitialNumBuckets(); + ::mlir::FloatAttr getMaxLoadFactorAttr(); + ::llvm::APFloat getMaxLoadFactor(); +}; +} // namespace detail +template +class MutableDenseHashTableV2OpGenericAdaptor : public detail::MutableDenseHashTableV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MutableDenseHashTableV2OpGenericAdaptorBase; +public: + MutableDenseHashTableV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MutableDenseHashTableV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MutableDenseHashTableV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MutableDenseHashTableV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getEmptyKey() { + return (*getODSOperands(0).begin()); + } + + ValueT getDeletedKey() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MutableDenseHashTableV2OpAdaptor : public MutableDenseHashTableV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using MutableDenseHashTableV2OpGenericAdaptor::MutableDenseHashTableV2OpGenericAdaptor; + MutableDenseHashTableV2OpAdaptor(MutableDenseHashTableV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MutableDenseHashTableV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MutableDenseHashTableV2OpAdaptor; + template + using GenericAdaptor = MutableDenseHashTableV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("container"), ::llvm::StringRef("initial_num_buckets"), ::llvm::StringRef("key_dtype"), ::llvm::StringRef("max_load_factor"), ::llvm::StringRef("shared_name"), ::llvm::StringRef("use_node_name_sharing"), ::llvm::StringRef("value_dtype"), ::llvm::StringRef("value_shape")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getContainerAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getContainerAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getInitialNumBucketsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getInitialNumBucketsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getKeyDtypeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getKeyDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getMaxLoadFactorAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getMaxLoadFactorAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getSharedNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getSharedNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getUseNodeNameSharingAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getUseNodeNameSharingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getValueDtypeAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getValueDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getValueShapeAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getValueShapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MutableDenseHashTableV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getEmptyKey(); + ::mlir::TypedValue<::mlir::TensorType> getDeletedKey(); + ::mlir::OpOperand &getEmptyKeyMutable(); + ::mlir::OpOperand &getDeletedKeyMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTableHandle(); + ::mlir::StringAttr getContainerAttr(); + ::llvm::StringRef getContainer(); + ::mlir::StringAttr getSharedNameAttr(); + ::llvm::StringRef getSharedName(); + ::mlir::BoolAttr getUseNodeNameSharingAttr(); + bool getUseNodeNameSharing(); + ::mlir::TypeAttr getValueDtypeAttr(); + ::mlir::Type getValueDtype(); + ::mlir::Attribute getValueShapeAttr(); + std::optional> getValueShape(); + ::mlir::IntegerAttr getInitialNumBucketsAttr(); + uint64_t getInitialNumBuckets(); + ::mlir::FloatAttr getMaxLoadFactorAttr(); + ::llvm::APFloat getMaxLoadFactor(); + ::mlir::Type getKeyDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setContainerAttr(::mlir::StringAttr attr); + void setContainer(::std::optional<::llvm::StringRef> attrValue); + void setSharedNameAttr(::mlir::StringAttr attr); + void setSharedName(::std::optional<::llvm::StringRef> attrValue); + void setUseNodeNameSharingAttr(::mlir::BoolAttr attr); + void setUseNodeNameSharing(::std::optional attrValue); + void setValueDtypeAttr(::mlir::TypeAttr attr); + void setValueDtype(::mlir::Type attrValue); + void setValueShapeAttr(::mlir::Attribute attr); + void setValueShape(::std::optional>> attrValue); + void setInitialNumBucketsAttr(::mlir::IntegerAttr attr); + void setInitialNumBuckets(::std::optional attrValue); + void setMaxLoadFactorAttr(::mlir::FloatAttr attr); + void setMaxLoadFactor(::std::optional<::llvm::APFloat> attrValue); + ::mlir::Attribute removeContainerAttr(); + ::mlir::Attribute removeSharedNameAttr(); + ::mlir::Attribute removeUseNodeNameSharingAttr(); + ::mlir::Attribute removeValueShapeAttr(); + ::mlir::Attribute removeInitialNumBucketsAttr(); + ::mlir::Attribute removeMaxLoadFactorAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type table_handle, ::mlir::Value empty_key, ::mlir::Value deleted_key, /*optional*/::mlir::StringAttr container, /*optional*/::mlir::StringAttr shared_name, /*optional*/::mlir::BoolAttr use_node_name_sharing, ::mlir::TypeAttr value_dtype, /*optional*/::mlir::Attribute value_shape, /*optional*/::mlir::IntegerAttr initial_num_buckets, /*optional*/::mlir::FloatAttr max_load_factor); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value empty_key, ::mlir::Value deleted_key, /*optional*/::mlir::StringAttr container, /*optional*/::mlir::StringAttr shared_name, /*optional*/::mlir::BoolAttr use_node_name_sharing, ::mlir::TypeAttr value_dtype, /*optional*/::mlir::Attribute value_shape, /*optional*/::mlir::IntegerAttr initial_num_buckets, /*optional*/::mlir::FloatAttr max_load_factor); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type table_handle, ::mlir::Value empty_key, ::mlir::Value deleted_key, /*optional*/::llvm::StringRef container, /*optional*/::llvm::StringRef shared_name, /*optional*/bool use_node_name_sharing, ::mlir::Type value_dtype, /*optional*/std::optional> value_shape, /*optional*/uint64_t initial_num_buckets, /*optional*/::llvm::APFloat max_load_factor); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value empty_key, ::mlir::Value deleted_key, /*optional*/::llvm::StringRef container, /*optional*/::llvm::StringRef shared_name, /*optional*/bool use_node_name_sharing, ::mlir::Type value_dtype, /*optional*/std::optional> value_shape, /*optional*/uint64_t initial_num_buckets, /*optional*/::llvm::APFloat max_load_factor); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 8 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MutableDenseHashTableV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MutableHashTableOfTensorsV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MutableHashTableOfTensorsV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MutableHashTableOfTensorsV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MutableHashTableOfTensorsV2OpGenericAdaptorBase(MutableHashTableOfTensorsV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getContainerAttr(); + ::llvm::StringRef getContainer(); + ::mlir::StringAttr getSharedNameAttr(); + ::llvm::StringRef getSharedName(); + ::mlir::BoolAttr getUseNodeNameSharingAttr(); + bool getUseNodeNameSharing(); + ::mlir::TypeAttr getKeyDtypeAttr(); + ::mlir::Type getKeyDtype(); + ::mlir::TypeAttr getValueDtypeAttr(); + ::mlir::Type getValueDtype(); + ::mlir::Attribute getValueShapeAttr(); + std::optional> getValueShape(); +}; +} // namespace detail +template +class MutableHashTableOfTensorsV2OpGenericAdaptor : public detail::MutableHashTableOfTensorsV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MutableHashTableOfTensorsV2OpGenericAdaptorBase; +public: + MutableHashTableOfTensorsV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MutableHashTableOfTensorsV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MutableHashTableOfTensorsV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MutableHashTableOfTensorsV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MutableHashTableOfTensorsV2OpAdaptor : public MutableHashTableOfTensorsV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using MutableHashTableOfTensorsV2OpGenericAdaptor::MutableHashTableOfTensorsV2OpGenericAdaptor; + MutableHashTableOfTensorsV2OpAdaptor(MutableHashTableOfTensorsV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MutableHashTableOfTensorsV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MutableHashTableOfTensorsV2OpAdaptor; + template + using GenericAdaptor = MutableHashTableOfTensorsV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("container"), ::llvm::StringRef("key_dtype"), ::llvm::StringRef("shared_name"), ::llvm::StringRef("use_node_name_sharing"), ::llvm::StringRef("value_dtype"), ::llvm::StringRef("value_shape")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getContainerAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getContainerAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getKeyDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getKeyDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getSharedNameAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getSharedNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getUseNodeNameSharingAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getUseNodeNameSharingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getValueDtypeAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getValueDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getValueShapeAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getValueShapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MutableHashTableOfTensorsV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTableHandle(); + ::mlir::StringAttr getContainerAttr(); + ::llvm::StringRef getContainer(); + ::mlir::StringAttr getSharedNameAttr(); + ::llvm::StringRef getSharedName(); + ::mlir::BoolAttr getUseNodeNameSharingAttr(); + bool getUseNodeNameSharing(); + ::mlir::TypeAttr getKeyDtypeAttr(); + ::mlir::Type getKeyDtype(); + ::mlir::TypeAttr getValueDtypeAttr(); + ::mlir::Type getValueDtype(); + ::mlir::Attribute getValueShapeAttr(); + std::optional> getValueShape(); + void setContainerAttr(::mlir::StringAttr attr); + void setContainer(::std::optional<::llvm::StringRef> attrValue); + void setSharedNameAttr(::mlir::StringAttr attr); + void setSharedName(::std::optional<::llvm::StringRef> attrValue); + void setUseNodeNameSharingAttr(::mlir::BoolAttr attr); + void setUseNodeNameSharing(::std::optional attrValue); + void setKeyDtypeAttr(::mlir::TypeAttr attr); + void setKeyDtype(::mlir::Type attrValue); + void setValueDtypeAttr(::mlir::TypeAttr attr); + void setValueDtype(::mlir::Type attrValue); + void setValueShapeAttr(::mlir::Attribute attr); + void setValueShape(::std::optional>> attrValue); + ::mlir::Attribute removeContainerAttr(); + ::mlir::Attribute removeSharedNameAttr(); + ::mlir::Attribute removeUseNodeNameSharingAttr(); + ::mlir::Attribute removeValueShapeAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type table_handle, /*optional*/::mlir::StringAttr container, /*optional*/::mlir::StringAttr shared_name, /*optional*/::mlir::BoolAttr use_node_name_sharing, ::mlir::TypeAttr key_dtype, ::mlir::TypeAttr value_dtype, /*optional*/::mlir::Attribute value_shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::StringAttr container, /*optional*/::mlir::StringAttr shared_name, /*optional*/::mlir::BoolAttr use_node_name_sharing, ::mlir::TypeAttr key_dtype, ::mlir::TypeAttr value_dtype, /*optional*/::mlir::Attribute value_shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type table_handle, /*optional*/::llvm::StringRef container, /*optional*/::llvm::StringRef shared_name, /*optional*/bool use_node_name_sharing, ::mlir::Type key_dtype, ::mlir::Type value_dtype, /*optional*/std::optional> value_shape = llvm::ArrayRef({})); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::llvm::StringRef container, /*optional*/::llvm::StringRef shared_name, /*optional*/bool use_node_name_sharing, ::mlir::Type key_dtype, ::mlir::Type value_dtype, /*optional*/std::optional> value_shape = llvm::ArrayRef({})); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MutableHashTableOfTensorsV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::MutableHashTableV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MutableHashTableV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MutableHashTableV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MutableHashTableV2OpGenericAdaptorBase(MutableHashTableV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getContainerAttr(); + ::llvm::StringRef getContainer(); + ::mlir::StringAttr getSharedNameAttr(); + ::llvm::StringRef getSharedName(); + ::mlir::BoolAttr getUseNodeNameSharingAttr(); + bool getUseNodeNameSharing(); + ::mlir::TypeAttr getKeyDtypeAttr(); + ::mlir::Type getKeyDtype(); + ::mlir::TypeAttr getValueDtypeAttr(); + ::mlir::Type getValueDtype(); +}; +} // namespace detail +template +class MutableHashTableV2OpGenericAdaptor : public detail::MutableHashTableV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MutableHashTableV2OpGenericAdaptorBase; +public: + MutableHashTableV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MutableHashTableV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MutableHashTableV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MutableHashTableV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MutableHashTableV2OpAdaptor : public MutableHashTableV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using MutableHashTableV2OpGenericAdaptor::MutableHashTableV2OpGenericAdaptor; + MutableHashTableV2OpAdaptor(MutableHashTableV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MutableHashTableV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = MutableHashTableV2OpAdaptor; + template + using GenericAdaptor = MutableHashTableV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("container"), ::llvm::StringRef("key_dtype"), ::llvm::StringRef("shared_name"), ::llvm::StringRef("use_node_name_sharing"), ::llvm::StringRef("value_dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getContainerAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getContainerAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getKeyDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getKeyDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getSharedNameAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getSharedNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getUseNodeNameSharingAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getUseNodeNameSharingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getValueDtypeAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getValueDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.MutableHashTableV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTableHandle(); + ::mlir::StringAttr getContainerAttr(); + ::llvm::StringRef getContainer(); + ::mlir::StringAttr getSharedNameAttr(); + ::llvm::StringRef getSharedName(); + ::mlir::BoolAttr getUseNodeNameSharingAttr(); + bool getUseNodeNameSharing(); + ::mlir::TypeAttr getKeyDtypeAttr(); + ::mlir::Type getKeyDtype(); + ::mlir::TypeAttr getValueDtypeAttr(); + ::mlir::Type getValueDtype(); + void setContainerAttr(::mlir::StringAttr attr); + void setContainer(::std::optional<::llvm::StringRef> attrValue); + void setSharedNameAttr(::mlir::StringAttr attr); + void setSharedName(::std::optional<::llvm::StringRef> attrValue); + void setUseNodeNameSharingAttr(::mlir::BoolAttr attr); + void setUseNodeNameSharing(::std::optional attrValue); + void setKeyDtypeAttr(::mlir::TypeAttr attr); + void setKeyDtype(::mlir::Type attrValue); + void setValueDtypeAttr(::mlir::TypeAttr attr); + void setValueDtype(::mlir::Type attrValue); + ::mlir::Attribute removeContainerAttr(); + ::mlir::Attribute removeSharedNameAttr(); + ::mlir::Attribute removeUseNodeNameSharingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type table_handle, /*optional*/::mlir::StringAttr container, /*optional*/::mlir::StringAttr shared_name, /*optional*/::mlir::BoolAttr use_node_name_sharing, ::mlir::TypeAttr key_dtype, ::mlir::TypeAttr value_dtype); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::StringAttr container, /*optional*/::mlir::StringAttr shared_name, /*optional*/::mlir::BoolAttr use_node_name_sharing, ::mlir::TypeAttr key_dtype, ::mlir::TypeAttr value_dtype); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type table_handle, /*optional*/::llvm::StringRef container, /*optional*/::llvm::StringRef shared_name, /*optional*/bool use_node_name_sharing, ::mlir::Type key_dtype, ::mlir::Type value_dtype); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::llvm::StringRef container, /*optional*/::llvm::StringRef shared_name, /*optional*/bool use_node_name_sharing, ::mlir::Type key_dtype, ::mlir::Type value_dtype); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::MutableHashTableV2Op) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_ops_canonicalization_helper.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_ops_canonicalization_helper.h new file mode 100644 index 0000000000000000000000000000000000000000..fa171a008908bedfcf0cb65ce568ff80597ff03f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_ops_canonicalization_helper.h @@ -0,0 +1,62 @@ +/* Copyright 2021 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_OPS_CANONICALIZATION_HELPER_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_OPS_CANONICALIZATION_HELPER_H_ + +#include "mlir/IR/PatternMatch.h" // from @llvm-project +#include "tensorflow/compiler/mlir/tensorflow/utils/attribute_utils.h" + +namespace mlir { +namespace TF { + +// Eliminate attributes that are not needed, but can get attached to Ops +// during import. +template +struct DropAttributes : public OpRewritePattern { + using OpRewritePattern::OpRewritePattern; + + // Drop the "output_shapes" attribute. + LogicalResult matchAndRewrite(Op op, + PatternRewriter &rewriter) const override { + bool found = !!op->removeAttr("output_shapes"); + return success(found); + } +}; + +// Helper function to create TF op while copying all underscore attributes from +// another TF op. +// TODO(jpienaar): This is a workaround until behavior is established. +template +OpTy CreateTfOp(RewriterBase &b, Operation *op, Args &&...args) { + auto ret = b.create(op->getLoc(), std::forward(args)...); + CopyDeviceAndUnderscoredAttributes(op, ret.getOperation()); + return ret; +} + +// Helper function to replace TF op with another op while copying all underscore +// attributes from the TF op. +// TODO(jpienaar): This is a workaround until behavior is established. +template +OpTy ReplaceTfOpWithNewOp(RewriterBase &b, Operation *op, Args &&...args) { + auto ret = CreateTfOp(b, op, std::forward(args)...); + b.replaceOp(op, ret.getOperation()->getResults()); + return ret; +} + +} // namespace TF +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_OPS_CANONICALIZATION_HELPER_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_ops_device_helper.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_ops_device_helper.h new file mode 100644 index 0000000000000000000000000000000000000000..4657fb18d4f5dbf391bf89491afd84a73f113070 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_ops_device_helper.h @@ -0,0 +1,41 @@ +/* Copyright 2021 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_OPS_DEVICE_HELPER_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_OPS_DEVICE_HELPER_H_ + +namespace mlir { + +class Operation; + +namespace TF { + +class RuntimeDevices; + +// Returns true if at least one GPU device is available at runtime. +bool CanUseGpuDevice(const RuntimeDevices &devices); + +// Returns true if all of the GPUs available at runtime support TensorCores +// (NVIDIA compute capability >= 7.0). +bool CanUseTensorCores(const RuntimeDevices &devices); + +// Returns true if operation does not have explicit device placement that would +// prevent it from running on GPU device. +bool CanUseGpuDevice(Operation *op); + +} // namespace TF +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_OPS_DEVICE_HELPER_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_ops_layout_helper.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_ops_layout_helper.h new file mode 100644 index 0000000000000000000000000000000000000000..29dae2715a6e781e57d0039dc4cc1bdac8b828d5 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_ops_layout_helper.h @@ -0,0 +1,137 @@ +/* Copyright 2021 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_OPS_LAYOUT_HELPER_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_OPS_LAYOUT_HELPER_H_ + +#include +#include + +#include "llvm/ADT/ArrayRef.h" +#include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/StringRef.h" +#include "mlir/Dialect/Func/IR/FuncOps.h" // from @llvm-project +#include "mlir/IR/BuiltinAttributes.h" // from @llvm-project +#include "mlir/IR/BuiltinOps.h" // from @llvm-project +#include "mlir/IR/Types.h" // from @llvm-project +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_op_interfaces.h" + +namespace mlir { + +class MLIRContext; + +namespace TF { + +SmallVector ReversePermutation(ArrayRef permutation); + +SmallVector GetDataFormatPermutation(StringRef from, StringRef to); + +// Shuffle elements in the `attr` according to the permutation. Optional +// `inner_size` allows to shuffle array attributes created from rank 2 tensors +// on outer dimension only. +ArrayAttr ShuffleArrayAttr(ArrayAttr attr, ArrayRef permutation, + int inner_size = 1); + +// Shuffle ranked tensor dimensions according to the permutation. +Type ShuffleRankedTensorType(Type type, ArrayRef permutation); + +bool AreCancellablePermutations(DenseIntElementsAttr perm0, + DenseIntElementsAttr perm1); + +// Default implementation of `LayoutSensitiveInterface::UpdateDataFormat` for +// layout sensitive operations that do not have any additional layout dependent +// attributes besides `data_format` string. +template +LogicalResult UpdateDataFormat(StringRef data_format, Op *op) { + auto perm = GetDataFormatPermutation(op->getDataFormat(), data_format); + if (perm.empty()) return failure(); + + // Update data format attribute. + (*op)->setAttr("data_format", StringAttr::get(op->getContext(), data_format)); + + // Update types for all layout sensitive results. + auto layout_sensitive = cast(op->getOperation()); + for (unsigned idx : layout_sensitive.GetLayoutDependentResults()) { + OpResult result = op->getOperation()->getResult(idx); + result.setType(ShuffleRankedTensorType(result.getType(), perm)); + } + + return success(); +} + +// Default implementation for folding operand transpose into the operation. +// See `FoldOperandsTransposeInterface::FoldOperandsPermutation`. +template +LogicalResult FoldOperandsPermutation( + ArrayRef permutation, Op *op, + ArrayRef> shuffle_attrs = {}) { + MLIRContext *context = + (*op)->template getParentOfType().getContext(); + + // We only support NHWC <-> NCHW permutations. + static constexpr std::array kNchwToNhwc = {0, 2, 3, 1}; + static constexpr std::array kNhwcToNchw = {0, 3, 1, 2}; + + // Operation data format after folding `permutation`. + StringRef target_data_format = [&]() -> StringRef { + if (op->getDataFormat() == "NHWC" && permutation.equals(kNchwToNhwc)) { + return "NCHW"; // cancel NCHW->NHWC operand permutation + } else if (op->getDataFormat() == "NCHW" && + permutation.equals(kNhwcToNchw)) { + return "NHWC"; // cancel NHWC->NCHW operand permutation + } else { + return ""; + } + }(); + if (target_data_format.empty()) return failure(); + + // To fold operand `permutation` into the `op` we need shuffle all layout + // dependent attributes and types with a reverse permutation, and change + // operation data format to `target_data_format`. + // + // Example: + // %1 = SomeOp(...) {data_format = NHWC} + // %2 = Transpose(%1) {permutation = NHWC->NCHW} + // %3 = Op(%2) {data_format = NCHW} + // + // To bypass %2 we have to change data format to shuffle data format from NCHW + // to NHWC, which is the reverse of operand permutation (function argument). + auto reverse_permutation = + GetDataFormatPermutation(op->getDataFormat(), target_data_format); + if (reverse_permutation.empty()) return failure(); + + (*op)->setAttr("data_format", StringAttr::get(context, target_data_format)); + + for (auto pair : shuffle_attrs) { + StringRef attr_name = pair.first; + ArrayAttr attr_value = pair.second; + (*op)->setAttr(attr_name, + ShuffleArrayAttr(attr_value, reverse_permutation)); + } + + auto fold = cast(op->getOperation()); + for (unsigned idx : fold.GetLayoutDependentResults()) { + OpResult result = op->getOperation()->getResult(idx); + result.setType( + ShuffleRankedTensorType(result.getType(), reverse_permutation)); + } + + return success(); +} + +} // namespace TF +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_OPS_LAYOUT_HELPER_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_ops_n_z.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_ops_n_z.h new file mode 100644 index 0000000000000000000000000000000000000000..7812cc4c7bfc5c81bf481d444587c9c9189afbe0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_ops_n_z.h @@ -0,0 +1,49 @@ +/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_OPS_N_Z_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_OPS_N_Z_H_ + +#include "mlir/Dialect/Func/IR/FuncOps.h" // from @llvm-project +#include "mlir/Dialect/Traits.h" // from @llvm-project +#include "mlir/IR/Attributes.h" // from @llvm-project +#include "mlir/IR/Builders.h" // from @llvm-project +#include "mlir/IR/BuiltinOps.h" // from @llvm-project +#include "mlir/IR/BuiltinTypes.h" // from @llvm-project +#include "mlir/IR/Dialect.h" // from @llvm-project +#include "mlir/IR/Matchers.h" // from @llvm-project +#include "mlir/IR/OpImplementation.h" // from @llvm-project +#include "mlir/IR/TypeUtilities.h" // from @llvm-project +#include "mlir/Interfaces/CallInterfaces.h" // from @llvm-project +#include "mlir/Interfaces/ControlFlowInterfaces.h" // from @llvm-project +#include "mlir/Interfaces/DerivedAttributeOpInterface.h" // from @llvm-project +#include "mlir/Interfaces/InferTypeOpInterface.h" // from @llvm-project +#include "mlir/Interfaces/LoopLikeInterface.h" // from @llvm-project +#include "mlir/Interfaces/SideEffectInterfaces.h" // from @llvm-project +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_attributes.h" +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_op_interfaces.h" +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_structs.h" +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_traits.h" +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_types.h" +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_verifiers.h" + +// IWYU pragma: private, include "third_party/tensorflow/compiler/mlir/tensorflow/ir/tf_ops.h" + +#define GET_OP_FWD_DEFINES +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_all_ops.h.inc" +#define GET_OP_CLASSES +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_ops_n_z.h.inc" + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_OPS_N_Z_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_ops_n_z.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_ops_n_z.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..03a1d1504d093f6ea53141570f01d52d66c44411 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_ops_n_z.h.inc @@ -0,0 +1,68196 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: tf_ops.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#if defined(GET_OP_CLASSES) || defined(GET_OP_FWD_DEFINES) +#undef GET_OP_FWD_DEFINES +namespace mlir { +namespace TF { +class NcclAllReduceOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class NdtriOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class NegOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class NextAfterOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class NoOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class NonMaxSuppressionV3Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class NonMaxSuppressionV4Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class NonMaxSuppressionV5Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class NotEqualOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class OneHotOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class OneShotIteratorOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class OnesLikeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class OptimizeDatasetV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class OptionalFromValueOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class OptionalGetValueOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class OptionalHasValueOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class OptionalNoneOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class OutfeedEnqueueOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class OutfeedEnqueueTupleOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class PackOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class PadOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class PadV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ParallelDynamicStitchOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ParallelMapDatasetOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ParallelMapDatasetV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ParameterizedTruncatedNormalOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ParseExampleOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ParseExampleV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class PartitionedCallOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class PlaceholderOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class PlaceholderWithDefaultOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class PolygammaOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class PopulationCountOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class PowOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class PrefetchDatasetOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class PreventGradientOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class PrintOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class PrintV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ProdOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class QrOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class QuantizeAndDequantizeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class QuantizeAndDequantizeV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class QuantizeAndDequantizeV3Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class QuantizeAndDequantizeV4Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class QuantizeV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class QueueDequeueV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RFFT2DOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RFFT3DOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RFFTOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RGBToHSVOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RaggedGatherOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RaggedRangeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RandomGammaGradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RandomGammaOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RandomPoissonOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RandomPoissonV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RandomShuffleOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RandomStandardNormalOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RandomUniformIntOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RandomUniformOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RangeDatasetOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RangeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RankOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ReadVariableOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RealDivOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RealOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ReciprocalGradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ReciprocalOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RecvOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RecvTPUEmbeddingActivationsOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ReduceDatasetOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ReduceJoinOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class Relu6GradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class Relu6Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ReluGradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ReluOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RemoteCallOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RepeatDatasetOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ReshapeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResizeBilinearGradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResizeBilinearOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResizeNearestNeighborGradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResizeNearestNeighborOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceApplyAdaMaxOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceApplyAdadeltaOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceApplyAdagradDAOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceApplyAdagradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceApplyAdagradV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceApplyAdamOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceApplyAddSignOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceApplyCenteredRMSPropOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceApplyFtrlOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceApplyFtrlV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceApplyGradientDescentOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceApplyKerasMomentumOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceApplyMomentumOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceApplyPowerSignOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceApplyProximalAdagradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceApplyProximalGradientDescentOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceApplyRMSPropOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceGatherNdOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceGatherOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceScatterAddOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceScatterDivOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceScatterMaxOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceScatterMinOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceScatterMulOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceScatterNdAddOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceScatterNdSubOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceScatterNdUpdateOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceScatterSubOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceScatterUpdateOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceSparseApplyAdagradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceSparseApplyAdagradV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceSparseApplyFtrlOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ResourceStridedSliceAssignOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RestoreOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RestoreV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RetrieveTPUEmbeddingADAMParametersGradAccumDebugOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RetrieveTPUEmbeddingADAMParametersOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebugOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RetrieveTPUEmbeddingAdadeltaParametersOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RetrieveTPUEmbeddingAdagradParametersGradAccumDebugOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RetrieveTPUEmbeddingAdagradParametersOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RetrieveTPUEmbeddingCenteredRMSPropParametersOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RetrieveTPUEmbeddingFTRLParametersGradAccumDebugOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RetrieveTPUEmbeddingFTRLParametersOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RetrieveTPUEmbeddingMDLAdagradLightParametersOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RetrieveTPUEmbeddingMomentumParametersGradAccumDebugOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RetrieveTPUEmbeddingMomentumParametersOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebugOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RetrieveTPUEmbeddingProximalAdagradParametersOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RetrieveTPUEmbeddingProximalYogiParametersGradAccumDebugOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RetrieveTPUEmbeddingProximalYogiParametersOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RetrieveTPUEmbeddingRMSPropParametersGradAccumDebugOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RetrieveTPUEmbeddingRMSPropParametersOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RetrieveTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RetrieveTPUEmbeddingStochasticGradientDescentParametersOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ReverseOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ReverseSequenceOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ReverseV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RightShiftOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RintOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RiscAddOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RiscDotOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RngReadAndSkipOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RollOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RoundOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RsqrtGradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class RsqrtOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SaveOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SaveSlicesOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SaveV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ScatterNdOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SegmentMaxOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SegmentMaxV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SegmentMeanOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SegmentMinOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SegmentMinV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SegmentProdOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SegmentProdV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SegmentSumOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SegmentSumV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SelectOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SelectV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SelfAdjointEigV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SeluGradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SeluOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SendOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SendTPUEmbeddingGradientsOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SerializeIteratorOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SerializeSparseOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SetStaticDimensionBoundsOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ShapeNOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ShapeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ShardedFilenameOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ShuffleAndRepeatDatasetV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ShuffleDatasetV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ShuffleDatasetV3Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ShutdownDistributedTPUOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ShutdownTPUSystemOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SigmoidGradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SigmoidOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SignOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SinOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SinhOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SizeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SliceOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SnapshotOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SoftmaxCrossEntropyWithLogitsOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SoftmaxOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SoftplusGradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SoftplusOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SoftsignGradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SoftsignOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SpaceToBatchNDOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SpaceToBatchOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SpaceToDepthOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SparseAddOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SparseFillEmptyRowsOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SparseMatMulOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SparseReduceSumOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SparseReshapeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SparseSegmentMeanGradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SparseSegmentMeanOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SparseSegmentMeanWithNumSegmentsOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SparseSegmentSqrtNGradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SparseSegmentSqrtNOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SparseSegmentSqrtNWithNumSegmentsOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SparseSegmentSumOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SparseSoftmaxCrossEntropyWithLogitsOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SparseTensorDenseMatMulOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SparseToDenseOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SplitOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SplitVOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SqrtGradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SqrtOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SquareOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SquaredDifferenceOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SqueezeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StackCloseV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StackPopV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StackPushV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StackV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StatefulPartitionedCallOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StatefulStandardNormalV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StatefulTruncatedNormalOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StatefulUniformFullIntOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StatefulUniformIntOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StatefulUniformOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StatelessMultinomialOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StatelessParameterizedTruncatedNormalOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StatelessRandomBinomialOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StatelessRandomGammaV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StatelessRandomGetAlgOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StatelessRandomGetKeyCounterAlgOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StatelessRandomGetKeyCounterOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StatelessRandomNormalOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StatelessRandomNormalV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StatelessRandomPoissonOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StatelessRandomUniformFullIntOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StatelessRandomUniformFullIntV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StatelessRandomUniformIntOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StatelessRandomUniformIntV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StatelessRandomUniformOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StatelessRandomUniformV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StatelessTruncatedNormalOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StatelessTruncatedNormalV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StaticRegexFullMatchOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StopGradientOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StoreMinibatchStatisticsInFdoOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StridedSliceGradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StridedSliceOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StringFormatOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StringJoinOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StringStripOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class StringToHashBucketFastOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SubOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SumOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SummaryWriterOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SvdOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class SymbolicGradientOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TPUAnnotateTensorsWithDynamicShapeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TPUCompilationResultOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TPUCompileMlirAndExecuteOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TPUCompileSucceededAssertOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TPUCopyWithDynamicShapeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TPUCopyWithLayoutOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TPUEmbeddingActivationsOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TPUExecuteAndUpdateVariablesOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TPUExecuteOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TPUGetLayoutOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TPUOrdinalSelectorOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TPUPartitionedCallOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TPUPartitionedInputOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TPUPartitionedInputV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TPUPartitionedOutputOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TPUPartitionedOutputV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TPUReplicateMetadataOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TPUReplicatedInputOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TPUReplicatedOutputOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TPUReshardVariablesOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TPURoundRobinOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TakeDatasetOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TakeWhileDatasetOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TanOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TanhGradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TanhOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TensorArrayCloseV3Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TensorArrayConcatV3Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TensorArrayGatherV3Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TensorArrayGradV3Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TensorArrayReadV3Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TensorArrayScatterV3Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TensorArraySizeV3Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TensorArraySplitV3Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TensorArrayV3Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TensorArrayWriteV3Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TensorListConcatV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TensorListElementShapeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TensorListFromTensorOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TensorListGatherOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TensorListGetItemOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TensorListLengthOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TensorListPopBackOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TensorListPushBackOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TensorListReserveOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TensorListResizeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TensorListScatterIntoExistingListOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TensorListSetItemOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TensorListStackOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TensorScatterAddOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TensorScatterMaxOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TensorScatterMinOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TensorScatterSubOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TensorScatterUpdateOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TensorSliceDatasetOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TensorStridedSliceUpdateOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TileOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TimestampOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ToBoolOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TopKUniqueOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TopKV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TopKWithUniqueOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TransposeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TridiagonalMatMulOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TridiagonalSolveOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TruncateDivOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TruncateModOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class TruncatedNormalOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class UncompressElementOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class UniformDequantizeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class UniformQuantizeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class UniformQuantizedAddOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class UniformQuantizedClipByValueOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class UniformQuantizedConvolutionHybridOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class UniformQuantizedConvolutionOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class UniformQuantizedDotHybridOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class UniformQuantizedDotOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class UniformRequantizeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class UniqueOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class UniqueV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class UnpackOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class UnsortedSegmentMaxOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class UnsortedSegmentMinOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class UnsortedSegmentProdOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class UnsortedSegmentSumOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class UpperBoundOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class VarHandleOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class VarIsInitializedOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class VariableOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class VariableShapeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class VariableV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class WhereOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class WhileOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class WhileRegionOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class WriteAudioSummaryOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class WriteGraphSummaryOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class WriteHistogramSummaryOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class WriteImageSummaryOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class WriteRawProtoSummaryOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class WriteScalarSummaryOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class WriteSummaryOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class WriteTrainingPredictionsOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XdivyOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaAllReduceOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaBroadcastHelperOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaCallModuleOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaClusterOutputOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaConvOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaConvV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaCustomCallV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaDotOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaDotV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaDynamicSliceOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaDynamicUpdateSliceOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaEinsumOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaGatherOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaHostComputeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaKeyValueSortOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaLaunchOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaLaunchV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaOptimizationBarrierOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaPadOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaRecvFromHostOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaRecvOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaRecvTPUEmbeddingActivationsOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaRecvTPUEmbeddingDeduplicationDataOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaReduceOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaReducePrecisionOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaReduceScatterOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaReduceWindowOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaRemoveDynamicDimensionSizeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaReplicaIdOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaRngBitGeneratorOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaScatterOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaSelectAndScatterOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaSelfAdjointEigOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaSendOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaSendTPUEmbeddingGradientsOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaSendToHostOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaSetBoundOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaSetDynamicDimensionSizeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaShardingOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaSortOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaSparseCoreAdagradMomentumOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaSparseCoreAdagradOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaSparseCoreAdamOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaSparseCoreFtrlOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaSparseCoreSgdOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaSparseDenseMatmulGradWithSgdAndCsrInputOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaSparseDenseMatmulWithCsrInputOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaSpmdFullToShardShapeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaSpmdShardToFullShapeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaSvdOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaVariadicReduceOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaVariadicReduceV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaVariadicSortOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class Xlog1pyOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlogyOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class YieldOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ZerosLikeOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class ZetaOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaSparseDenseMatmulGradWithAdagradAndCsrInputOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaSparseDenseMatmulGradWithAdagradMomentumAndCsrInputOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaSparseDenseMatmulGradWithAdamAndCsrInputOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class XlaSparseDenseMatmulGradWithFtrlAndCsrInputOp; +} // namespace TF +} // namespace mlir +#endif + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::NcclAllReduceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class NcclAllReduceOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + NcclAllReduceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + NcclAllReduceOpGenericAdaptorBase(NcclAllReduceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getReductionAttr(); + ::llvm::StringRef getReduction(); + ::mlir::IntegerAttr getNumDevicesAttr(); + uint64_t getNumDevices(); + ::mlir::StringAttr getSharedNameAttr(); + ::llvm::StringRef getSharedName(); +}; +} // namespace detail +template +class NcclAllReduceOpGenericAdaptor : public detail::NcclAllReduceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::NcclAllReduceOpGenericAdaptorBase; +public: + NcclAllReduceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + NcclAllReduceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : NcclAllReduceOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + NcclAllReduceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class NcclAllReduceOpAdaptor : public NcclAllReduceOpGenericAdaptor<::mlir::ValueRange> { +public: + using NcclAllReduceOpGenericAdaptor::NcclAllReduceOpGenericAdaptor; + NcclAllReduceOpAdaptor(NcclAllReduceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class NcclAllReduceOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, GetResourceInstanceInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = NcclAllReduceOpAdaptor; + template + using GenericAdaptor = NcclAllReduceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("num_devices"), ::llvm::StringRef("reduction"), ::llvm::StringRef("shared_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumDevicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumDevicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getReductionAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getReductionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSharedNameAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSharedNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.NcclAllReduce"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getData(); + ::mlir::StringAttr getReductionAttr(); + ::llvm::StringRef getReduction(); + ::mlir::IntegerAttr getNumDevicesAttr(); + uint64_t getNumDevices(); + ::mlir::StringAttr getSharedNameAttr(); + ::llvm::StringRef getSharedName(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setReductionAttr(::mlir::StringAttr attr); + void setReduction(::llvm::StringRef attrValue); + void setNumDevicesAttr(::mlir::IntegerAttr attr); + void setNumDevices(uint64_t attrValue); + void setSharedNameAttr(::mlir::StringAttr attr); + void setSharedName(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type data, ::mlir::Value input, ::mlir::StringAttr reduction, ::mlir::IntegerAttr num_devices, ::mlir::StringAttr shared_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::StringAttr reduction, ::mlir::IntegerAttr num_devices, ::mlir::StringAttr shared_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::StringAttr reduction, ::mlir::IntegerAttr num_devices, ::mlir::StringAttr shared_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type data, ::mlir::Value input, ::llvm::StringRef reduction, uint64_t num_devices, ::llvm::StringRef shared_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::llvm::StringRef reduction, uint64_t num_devices, ::llvm::StringRef shared_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::llvm::StringRef reduction, uint64_t num_devices, ::llvm::StringRef shared_name); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + std::optional GetResourceInstanceStr(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::NcclAllReduceOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::NdtriOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class NdtriOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + NdtriOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + NdtriOpGenericAdaptorBase(NdtriOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class NdtriOpGenericAdaptor : public detail::NdtriOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::NdtriOpGenericAdaptorBase; +public: + NdtriOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + NdtriOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : NdtriOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + NdtriOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class NdtriOpAdaptor : public NdtriOpGenericAdaptor<::mlir::ValueRange> { +public: + using NdtriOpGenericAdaptor::NdtriOpGenericAdaptor; + NdtriOpAdaptor(NdtriOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class NdtriOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = NdtriOpAdaptor; + template + using GenericAdaptor = NdtriOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Ndtri"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::NdtriOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::NegOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class NegOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + NegOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + NegOpGenericAdaptorBase(NegOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class NegOpGenericAdaptor : public detail::NegOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::NegOpGenericAdaptorBase; +public: + NegOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + NegOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : NegOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + NegOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class NegOpAdaptor : public NegOpGenericAdaptor<::mlir::ValueRange> { +public: + using NegOpGenericAdaptor::NegOpGenericAdaptor; + NegOpAdaptor(NegOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class NegOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::CwiseUnary, ::mlir::OpTrait::TF::IsInvolution, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = NegOpAdaptor; + template + using GenericAdaptor = NegOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Neg"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::NegOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::NextAfterOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class NextAfterOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + NextAfterOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + NextAfterOpGenericAdaptorBase(NextAfterOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class NextAfterOpGenericAdaptor : public detail::NextAfterOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::NextAfterOpGenericAdaptorBase; +public: + NextAfterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + NextAfterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : NextAfterOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + NextAfterOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX1() { + return (*getODSOperands(0).begin()); + } + + ValueT getX2() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class NextAfterOpAdaptor : public NextAfterOpGenericAdaptor<::mlir::ValueRange> { +public: + using NextAfterOpGenericAdaptor::NextAfterOpGenericAdaptor; + NextAfterOpAdaptor(NextAfterOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class NextAfterOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = NextAfterOpAdaptor; + template + using GenericAdaptor = NextAfterOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.NextAfter"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX1(); + ::mlir::TypedValue<::mlir::TensorType> getX2(); + ::mlir::OpOperand &getX1Mutable(); + ::mlir::OpOperand &getX2Mutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value x1, ::mlir::Value x2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x1, ::mlir::Value x2); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::NextAfterOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::NoOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class NoOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + NoOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + NoOpGenericAdaptorBase(NoOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class NoOpGenericAdaptor : public detail::NoOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::NoOpGenericAdaptorBase; +public: + NoOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + NoOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : NoOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + NoOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class NoOpAdaptor : public NoOpGenericAdaptor<::mlir::ValueRange> { +public: + using NoOpGenericAdaptor::NoOpGenericAdaptor; + NoOpAdaptor(NoOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class NoOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = NoOpAdaptor; + template + using GenericAdaptor = NoOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.NoOp"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::NoOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::NonMaxSuppressionV3Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class NonMaxSuppressionV3OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + NonMaxSuppressionV3OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + NonMaxSuppressionV3OpGenericAdaptorBase(NonMaxSuppressionV3Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class NonMaxSuppressionV3OpGenericAdaptor : public detail::NonMaxSuppressionV3OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::NonMaxSuppressionV3OpGenericAdaptorBase; +public: + NonMaxSuppressionV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + NonMaxSuppressionV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : NonMaxSuppressionV3OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + NonMaxSuppressionV3OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getBoxes() { + return (*getODSOperands(0).begin()); + } + + ValueT getScores() { + return (*getODSOperands(1).begin()); + } + + ValueT getMaxOutputSize() { + return (*getODSOperands(2).begin()); + } + + ValueT getIouThreshold() { + return (*getODSOperands(3).begin()); + } + + ValueT getScoreThreshold() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class NonMaxSuppressionV3OpAdaptor : public NonMaxSuppressionV3OpGenericAdaptor<::mlir::ValueRange> { +public: + using NonMaxSuppressionV3OpGenericAdaptor::NonMaxSuppressionV3OpGenericAdaptor; + NonMaxSuppressionV3OpAdaptor(NonMaxSuppressionV3Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class NonMaxSuppressionV3Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<5>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = NonMaxSuppressionV3OpAdaptor; + template + using GenericAdaptor = NonMaxSuppressionV3OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("T_threshold")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTThresholdAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTThresholdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.NonMaxSuppressionV3"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getBoxes(); + ::mlir::TypedValue<::mlir::TensorType> getScores(); + ::mlir::TypedValue<::mlir::TensorType> getMaxOutputSize(); + ::mlir::TypedValue<::mlir::TensorType> getIouThreshold(); + ::mlir::TypedValue<::mlir::TensorType> getScoreThreshold(); + ::mlir::OpOperand &getBoxesMutable(); + ::mlir::OpOperand &getScoresMutable(); + ::mlir::OpOperand &getMaxOutputSizeMutable(); + ::mlir::OpOperand &getIouThresholdMutable(); + ::mlir::OpOperand &getScoreThresholdMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSelectedIndices(); + ::mlir::Type getT(); + ::mlir::Type getTThreshold(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type selected_indices, ::mlir::Value boxes, ::mlir::Value scores, ::mlir::Value max_output_size, ::mlir::Value iou_threshold, ::mlir::Value score_threshold); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value boxes, ::mlir::Value scores, ::mlir::Value max_output_size, ::mlir::Value iou_threshold, ::mlir::Value score_threshold); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::NonMaxSuppressionV3Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::NonMaxSuppressionV4Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class NonMaxSuppressionV4OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + NonMaxSuppressionV4OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + NonMaxSuppressionV4OpGenericAdaptorBase(NonMaxSuppressionV4Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getPadToMaxOutputSizeAttr(); + bool getPadToMaxOutputSize(); +}; +} // namespace detail +template +class NonMaxSuppressionV4OpGenericAdaptor : public detail::NonMaxSuppressionV4OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::NonMaxSuppressionV4OpGenericAdaptorBase; +public: + NonMaxSuppressionV4OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + NonMaxSuppressionV4OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : NonMaxSuppressionV4OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + NonMaxSuppressionV4OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getBoxes() { + return (*getODSOperands(0).begin()); + } + + ValueT getScores() { + return (*getODSOperands(1).begin()); + } + + ValueT getMaxOutputSize() { + return (*getODSOperands(2).begin()); + } + + ValueT getIouThreshold() { + return (*getODSOperands(3).begin()); + } + + ValueT getScoreThreshold() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class NonMaxSuppressionV4OpAdaptor : public NonMaxSuppressionV4OpGenericAdaptor<::mlir::ValueRange> { +public: + using NonMaxSuppressionV4OpGenericAdaptor::NonMaxSuppressionV4OpGenericAdaptor; + NonMaxSuppressionV4OpAdaptor(NonMaxSuppressionV4Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class NonMaxSuppressionV4Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<5>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = NonMaxSuppressionV4OpAdaptor; + template + using GenericAdaptor = NonMaxSuppressionV4OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("T_threshold"), ::llvm::StringRef("pad_to_max_output_size")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTThresholdAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTThresholdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getPadToMaxOutputSizeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getPadToMaxOutputSizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.NonMaxSuppressionV4"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getBoxes(); + ::mlir::TypedValue<::mlir::TensorType> getScores(); + ::mlir::TypedValue<::mlir::TensorType> getMaxOutputSize(); + ::mlir::TypedValue<::mlir::TensorType> getIouThreshold(); + ::mlir::TypedValue<::mlir::TensorType> getScoreThreshold(); + ::mlir::OpOperand &getBoxesMutable(); + ::mlir::OpOperand &getScoresMutable(); + ::mlir::OpOperand &getMaxOutputSizeMutable(); + ::mlir::OpOperand &getIouThresholdMutable(); + ::mlir::OpOperand &getScoreThresholdMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSelectedIndices(); + ::mlir::TypedValue<::mlir::TensorType> getValidOutputs(); + ::mlir::BoolAttr getPadToMaxOutputSizeAttr(); + bool getPadToMaxOutputSize(); + ::mlir::Type getT(); + ::mlir::Type getTThreshold(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setPadToMaxOutputSizeAttr(::mlir::BoolAttr attr); + void setPadToMaxOutputSize(::std::optional attrValue); + ::mlir::Attribute removePadToMaxOutputSizeAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type selected_indices, ::mlir::Type valid_outputs, ::mlir::Value boxes, ::mlir::Value scores, ::mlir::Value max_output_size, ::mlir::Value iou_threshold, ::mlir::Value score_threshold, /*optional*/::mlir::BoolAttr pad_to_max_output_size); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value boxes, ::mlir::Value scores, ::mlir::Value max_output_size, ::mlir::Value iou_threshold, ::mlir::Value score_threshold, /*optional*/::mlir::BoolAttr pad_to_max_output_size); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type selected_indices, ::mlir::Type valid_outputs, ::mlir::Value boxes, ::mlir::Value scores, ::mlir::Value max_output_size, ::mlir::Value iou_threshold, ::mlir::Value score_threshold, /*optional*/bool pad_to_max_output_size = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value boxes, ::mlir::Value scores, ::mlir::Value max_output_size, ::mlir::Value iou_threshold, ::mlir::Value score_threshold, /*optional*/bool pad_to_max_output_size = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::NonMaxSuppressionV4Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::NonMaxSuppressionV5Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class NonMaxSuppressionV5OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + NonMaxSuppressionV5OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + NonMaxSuppressionV5OpGenericAdaptorBase(NonMaxSuppressionV5Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getPadToMaxOutputSizeAttr(); + bool getPadToMaxOutputSize(); +}; +} // namespace detail +template +class NonMaxSuppressionV5OpGenericAdaptor : public detail::NonMaxSuppressionV5OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::NonMaxSuppressionV5OpGenericAdaptorBase; +public: + NonMaxSuppressionV5OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + NonMaxSuppressionV5OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : NonMaxSuppressionV5OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + NonMaxSuppressionV5OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getBoxes() { + return (*getODSOperands(0).begin()); + } + + ValueT getScores() { + return (*getODSOperands(1).begin()); + } + + ValueT getMaxOutputSize() { + return (*getODSOperands(2).begin()); + } + + ValueT getIouThreshold() { + return (*getODSOperands(3).begin()); + } + + ValueT getScoreThreshold() { + return (*getODSOperands(4).begin()); + } + + ValueT getSoftNmsSigma() { + return (*getODSOperands(5).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class NonMaxSuppressionV5OpAdaptor : public NonMaxSuppressionV5OpGenericAdaptor<::mlir::ValueRange> { +public: + using NonMaxSuppressionV5OpGenericAdaptor::NonMaxSuppressionV5OpGenericAdaptor; + NonMaxSuppressionV5OpAdaptor(NonMaxSuppressionV5Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class NonMaxSuppressionV5Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<6>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = NonMaxSuppressionV5OpAdaptor; + template + using GenericAdaptor = NonMaxSuppressionV5OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("pad_to_max_output_size")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getPadToMaxOutputSizeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getPadToMaxOutputSizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.NonMaxSuppressionV5"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getBoxes(); + ::mlir::TypedValue<::mlir::TensorType> getScores(); + ::mlir::TypedValue<::mlir::TensorType> getMaxOutputSize(); + ::mlir::TypedValue<::mlir::TensorType> getIouThreshold(); + ::mlir::TypedValue<::mlir::TensorType> getScoreThreshold(); + ::mlir::TypedValue<::mlir::TensorType> getSoftNmsSigma(); + ::mlir::OpOperand &getBoxesMutable(); + ::mlir::OpOperand &getScoresMutable(); + ::mlir::OpOperand &getMaxOutputSizeMutable(); + ::mlir::OpOperand &getIouThresholdMutable(); + ::mlir::OpOperand &getScoreThresholdMutable(); + ::mlir::OpOperand &getSoftNmsSigmaMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSelectedIndices(); + ::mlir::TypedValue<::mlir::TensorType> getSelectedScores(); + ::mlir::TypedValue<::mlir::TensorType> getValidOutputs(); + ::mlir::BoolAttr getPadToMaxOutputSizeAttr(); + bool getPadToMaxOutputSize(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setPadToMaxOutputSizeAttr(::mlir::BoolAttr attr); + void setPadToMaxOutputSize(::std::optional attrValue); + ::mlir::Attribute removePadToMaxOutputSizeAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type selected_indices, ::mlir::Type selected_scores, ::mlir::Type valid_outputs, ::mlir::Value boxes, ::mlir::Value scores, ::mlir::Value max_output_size, ::mlir::Value iou_threshold, ::mlir::Value score_threshold, ::mlir::Value soft_nms_sigma, /*optional*/::mlir::BoolAttr pad_to_max_output_size); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value boxes, ::mlir::Value scores, ::mlir::Value max_output_size, ::mlir::Value iou_threshold, ::mlir::Value score_threshold, ::mlir::Value soft_nms_sigma, /*optional*/::mlir::BoolAttr pad_to_max_output_size); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type selected_indices, ::mlir::Type selected_scores, ::mlir::Type valid_outputs, ::mlir::Value boxes, ::mlir::Value scores, ::mlir::Value max_output_size, ::mlir::Value iou_threshold, ::mlir::Value score_threshold, ::mlir::Value soft_nms_sigma, /*optional*/bool pad_to_max_output_size = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value boxes, ::mlir::Value scores, ::mlir::Value max_output_size, ::mlir::Value iou_threshold, ::mlir::Value score_threshold, ::mlir::Value soft_nms_sigma, /*optional*/bool pad_to_max_output_size = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::NonMaxSuppressionV5Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::NotEqualOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class NotEqualOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + NotEqualOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + NotEqualOpGenericAdaptorBase(NotEqualOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getIncompatibleShapeErrorAttr(); + bool getIncompatibleShapeError(); +}; +} // namespace detail +template +class NotEqualOpGenericAdaptor : public detail::NotEqualOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::NotEqualOpGenericAdaptorBase; +public: + NotEqualOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + NotEqualOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : NotEqualOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + NotEqualOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class NotEqualOpAdaptor : public NotEqualOpGenericAdaptor<::mlir::ValueRange> { +public: + using NotEqualOpGenericAdaptor::NotEqualOpGenericAdaptor; + NotEqualOpAdaptor(NotEqualOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class NotEqualOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsCommutative, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = NotEqualOpAdaptor; + template + using GenericAdaptor = NotEqualOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("incompatible_shape_error")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getIncompatibleShapeErrorAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getIncompatibleShapeErrorAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.NotEqual"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::BoolAttr getIncompatibleShapeErrorAttr(); + bool getIncompatibleShapeError(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setIncompatibleShapeErrorAttr(::mlir::BoolAttr attr); + void setIncompatibleShapeError(::std::optional attrValue); + ::mlir::Attribute removeIncompatibleShapeErrorAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y, BoolAttr incompatible_shape_error); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y, /*optional*/::mlir::BoolAttr incompatible_shape_error); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y, /*optional*/::mlir::BoolAttr incompatible_shape_error); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y, /*optional*/bool incompatible_shape_error = true); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y, /*optional*/bool incompatible_shape_error = true); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::NotEqualOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::OneHotOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class OneHotOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + OneHotOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + OneHotOpGenericAdaptorBase(OneHotOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getAxisAttr(); + uint64_t getAxis(); +}; +} // namespace detail +template +class OneHotOpGenericAdaptor : public detail::OneHotOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::OneHotOpGenericAdaptorBase; +public: + OneHotOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + OneHotOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : OneHotOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + OneHotOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIndices() { + return (*getODSOperands(0).begin()); + } + + ValueT getDepth() { + return (*getODSOperands(1).begin()); + } + + ValueT getOnValue() { + return (*getODSOperands(2).begin()); + } + + ValueT getOffValue() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class OneHotOpAdaptor : public OneHotOpGenericAdaptor<::mlir::ValueRange> { +public: + using OneHotOpGenericAdaptor::OneHotOpGenericAdaptor; + OneHotOpAdaptor(OneHotOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class OneHotOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = OneHotOpAdaptor; + template + using GenericAdaptor = OneHotOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("TI"), ::llvm::StringRef("axis")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTIAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTIAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getAxisAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getAxisAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.OneHot"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getDepth(); + ::mlir::TypedValue<::mlir::TensorType> getOnValue(); + ::mlir::TypedValue<::mlir::TensorType> getOffValue(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getDepthMutable(); + ::mlir::OpOperand &getOnValueMutable(); + ::mlir::OpOperand &getOffValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getAxisAttr(); + uint64_t getAxis(); + ::mlir::Type getT(); + ::mlir::Type getTI(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setAxisAttr(::mlir::IntegerAttr attr); + void setAxis(::std::optional attrValue); + ::mlir::Attribute removeAxisAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value indices, Value depth, Value on_value, Value off_value, IntegerAttr axis); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value indices, ::mlir::Value depth, ::mlir::Value on_value, ::mlir::Value off_value, /*optional*/::mlir::IntegerAttr axis); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value indices, ::mlir::Value depth, ::mlir::Value on_value, ::mlir::Value off_value, /*optional*/::mlir::IntegerAttr axis); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value indices, ::mlir::Value depth, ::mlir::Value on_value, ::mlir::Value off_value, /*optional*/uint64_t axis = -1); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value indices, ::mlir::Value depth, ::mlir::Value on_value, ::mlir::Value off_value, /*optional*/uint64_t axis = -1); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::OneHotOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::OneShotIteratorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class OneShotIteratorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + OneShotIteratorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + OneShotIteratorOpGenericAdaptorBase(OneShotIteratorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::SymbolRefAttr getDatasetFactoryAttr(); + ::mlir::SymbolRefAttr getDatasetFactory(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::StringAttr getContainerAttr(); + ::llvm::StringRef getContainer(); + ::mlir::StringAttr getSharedNameAttr(); + ::llvm::StringRef getSharedName(); +}; +} // namespace detail +template +class OneShotIteratorOpGenericAdaptor : public detail::OneShotIteratorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::OneShotIteratorOpGenericAdaptorBase; +public: + OneShotIteratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + OneShotIteratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : OneShotIteratorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + OneShotIteratorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class OneShotIteratorOpAdaptor : public OneShotIteratorOpGenericAdaptor<::mlir::ValueRange> { +public: + using OneShotIteratorOpGenericAdaptor::OneShotIteratorOpGenericAdaptor; + OneShotIteratorOpAdaptor(OneShotIteratorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class OneShotIteratorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = OneShotIteratorOpAdaptor; + template + using GenericAdaptor = OneShotIteratorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("container"), ::llvm::StringRef("dataset_factory"), ::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types"), ::llvm::StringRef("shared_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getContainerAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getContainerAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDatasetFactoryAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDatasetFactoryAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getSharedNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getSharedNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.OneShotIterator"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::SymbolRefAttr getDatasetFactoryAttr(); + ::mlir::SymbolRefAttr getDatasetFactory(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::StringAttr getContainerAttr(); + ::llvm::StringRef getContainer(); + ::mlir::StringAttr getSharedNameAttr(); + ::llvm::StringRef getSharedName(); + void setDatasetFactoryAttr(::mlir::SymbolRefAttr attr); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + void setContainerAttr(::mlir::StringAttr attr); + void setContainer(::std::optional<::llvm::StringRef> attrValue); + void setSharedNameAttr(::mlir::StringAttr attr); + void setSharedName(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeContainerAttr(); + ::mlir::Attribute removeSharedNameAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::SymbolRefAttr dataset_factory, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::StringAttr container, /*optional*/::mlir::StringAttr shared_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::SymbolRefAttr dataset_factory, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::StringAttr container, /*optional*/::mlir::StringAttr shared_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::SymbolRefAttr dataset_factory, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::llvm::StringRef container = "", /*optional*/::llvm::StringRef shared_name = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::SymbolRefAttr dataset_factory, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::llvm::StringRef container = "", /*optional*/::llvm::StringRef shared_name = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::OneShotIteratorOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::OnesLikeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class OnesLikeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + OnesLikeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + OnesLikeOpGenericAdaptorBase(OnesLikeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class OnesLikeOpGenericAdaptor : public detail::OnesLikeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::OnesLikeOpGenericAdaptorBase; +public: + OnesLikeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + OnesLikeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : OnesLikeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + OnesLikeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class OnesLikeOpAdaptor : public OnesLikeOpGenericAdaptor<::mlir::ValueRange> { +public: + using OnesLikeOpGenericAdaptor::OnesLikeOpGenericAdaptor; + OnesLikeOpAdaptor(OnesLikeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class OnesLikeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::IsIdempotent, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = OnesLikeOpAdaptor; + template + using GenericAdaptor = OnesLikeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.OnesLike"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::OnesLikeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::OptimizeDatasetV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class OptimizeDatasetV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + OptimizeDatasetV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + OptimizeDatasetV2OpGenericAdaptorBase(OptimizeDatasetV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::ArrayAttr getOptimizationConfigsAttr(); + ::mlir::ArrayAttr getOptimizationConfigs(); +}; +} // namespace detail +template +class OptimizeDatasetV2OpGenericAdaptor : public detail::OptimizeDatasetV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::OptimizeDatasetV2OpGenericAdaptorBase; +public: + OptimizeDatasetV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + OptimizeDatasetV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : OptimizeDatasetV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + OptimizeDatasetV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputDataset() { + return (*getODSOperands(0).begin()); + } + + ValueT getOptimizationsEnabled() { + return (*getODSOperands(1).begin()); + } + + ValueT getOptimizationsDisabled() { + return (*getODSOperands(2).begin()); + } + + ValueT getOptimizationsDefault() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class OptimizeDatasetV2OpAdaptor : public OptimizeDatasetV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using OptimizeDatasetV2OpGenericAdaptor::OptimizeDatasetV2OpGenericAdaptor; + OptimizeDatasetV2OpAdaptor(OptimizeDatasetV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class OptimizeDatasetV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = OptimizeDatasetV2OpAdaptor; + template + using GenericAdaptor = OptimizeDatasetV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("optimization_configs"), ::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOptimizationConfigsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getOptimizationConfigsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.OptimizeDatasetV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputDataset(); + ::mlir::TypedValue<::mlir::TensorType> getOptimizationsEnabled(); + ::mlir::TypedValue<::mlir::TensorType> getOptimizationsDisabled(); + ::mlir::TypedValue<::mlir::TensorType> getOptimizationsDefault(); + ::mlir::OpOperand &getInputDatasetMutable(); + ::mlir::OpOperand &getOptimizationsEnabledMutable(); + ::mlir::OpOperand &getOptimizationsDisabledMutable(); + ::mlir::OpOperand &getOptimizationsDefaultMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::ArrayAttr getOptimizationConfigsAttr(); + ::mlir::ArrayAttr getOptimizationConfigs(); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + void setOptimizationConfigsAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeOptimizationConfigsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, ::mlir::Value optimizations_enabled, ::mlir::Value optimizations_disabled, ::mlir::Value optimizations_default, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::ArrayAttr optimization_configs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, ::mlir::Value optimizations_enabled, ::mlir::Value optimizations_disabled, ::mlir::Value optimizations_default, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::ArrayAttr optimization_configs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::OptimizeDatasetV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::OptionalFromValueOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class OptionalFromValueOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + OptionalFromValueOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + OptionalFromValueOpGenericAdaptorBase(OptionalFromValueOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class OptionalFromValueOpGenericAdaptor : public detail::OptionalFromValueOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::OptionalFromValueOpGenericAdaptorBase; +public: + OptionalFromValueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + OptionalFromValueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : OptionalFromValueOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + OptionalFromValueOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getComponents() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class OptionalFromValueOpAdaptor : public OptionalFromValueOpGenericAdaptor<::mlir::ValueRange> { +public: + using OptionalFromValueOpGenericAdaptor::OptionalFromValueOpGenericAdaptor; + OptionalFromValueOpAdaptor(OptionalFromValueOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class OptionalFromValueOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = OptionalFromValueOpAdaptor; + template + using GenericAdaptor = OptionalFromValueOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Toutput_types")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getToutputTypesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getToutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.OptionalFromValue"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getComponents(); + ::mlir::MutableOperandRange getComponentsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOptional(); + mlir::OperandElementTypeRange getToutputTypes(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type optional, ::mlir::ValueRange components); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::OptionalFromValueOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::OptionalGetValueOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class OptionalGetValueOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + OptionalGetValueOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + OptionalGetValueOpGenericAdaptorBase(OptionalGetValueOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class OptionalGetValueOpGenericAdaptor : public detail::OptionalGetValueOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::OptionalGetValueOpGenericAdaptorBase; +public: + OptionalGetValueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + OptionalGetValueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : OptionalGetValueOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + OptionalGetValueOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOptional() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class OptionalGetValueOpAdaptor : public OptionalGetValueOpGenericAdaptor<::mlir::ValueRange> { +public: + using OptionalGetValueOpGenericAdaptor::OptionalGetValueOpGenericAdaptor; + OptionalGetValueOpAdaptor(OptionalGetValueOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class OptionalGetValueOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = OptionalGetValueOpAdaptor; + template + using GenericAdaptor = OptionalGetValueOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.OptionalGetValue"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOptional(); + ::mlir::OpOperand &getOptionalMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getComponents(); + mlir::TF::ResultShapeRange getOutputShapes(); + mlir::ResultElementTypeRange getOutputTypes(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange components, ::mlir::Value optional); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::OptionalGetValueOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::OptionalHasValueOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class OptionalHasValueOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + OptionalHasValueOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + OptionalHasValueOpGenericAdaptorBase(OptionalHasValueOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class OptionalHasValueOpGenericAdaptor : public detail::OptionalHasValueOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::OptionalHasValueOpGenericAdaptorBase; +public: + OptionalHasValueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + OptionalHasValueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : OptionalHasValueOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + OptionalHasValueOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOptional() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class OptionalHasValueOpAdaptor : public OptionalHasValueOpGenericAdaptor<::mlir::ValueRange> { +public: + using OptionalHasValueOpGenericAdaptor::OptionalHasValueOpGenericAdaptor; + OptionalHasValueOpAdaptor(OptionalHasValueOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class OptionalHasValueOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = OptionalHasValueOpAdaptor; + template + using GenericAdaptor = OptionalHasValueOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.OptionalHasValue"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOptional(); + ::mlir::OpOperand &getOptionalMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHasValue(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type has_value, ::mlir::Value optional); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value optional); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::OptionalHasValueOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::OptionalNoneOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class OptionalNoneOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + OptionalNoneOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + OptionalNoneOpGenericAdaptorBase(OptionalNoneOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class OptionalNoneOpGenericAdaptor : public detail::OptionalNoneOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::OptionalNoneOpGenericAdaptorBase; +public: + OptionalNoneOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + OptionalNoneOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : OptionalNoneOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + OptionalNoneOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class OptionalNoneOpAdaptor : public OptionalNoneOpGenericAdaptor<::mlir::ValueRange> { +public: + using OptionalNoneOpGenericAdaptor::OptionalNoneOpGenericAdaptor; + OptionalNoneOpAdaptor(OptionalNoneOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class OptionalNoneOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = OptionalNoneOpAdaptor; + template + using GenericAdaptor = OptionalNoneOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.OptionalNone"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOptional(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type optional); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::OptionalNoneOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::OutfeedEnqueueOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class OutfeedEnqueueOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + OutfeedEnqueueOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + OutfeedEnqueueOpGenericAdaptorBase(OutfeedEnqueueOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class OutfeedEnqueueOpGenericAdaptor : public detail::OutfeedEnqueueOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::OutfeedEnqueueOpGenericAdaptorBase; +public: + OutfeedEnqueueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + OutfeedEnqueueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : OutfeedEnqueueOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + OutfeedEnqueueOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class OutfeedEnqueueOpAdaptor : public OutfeedEnqueueOpGenericAdaptor<::mlir::ValueRange> { +public: + using OutfeedEnqueueOpGenericAdaptor::OutfeedEnqueueOpGenericAdaptor; + OutfeedEnqueueOpAdaptor(OutfeedEnqueueOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class OutfeedEnqueueOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = OutfeedEnqueueOpAdaptor; + template + using GenericAdaptor = OutfeedEnqueueOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.OutfeedEnqueue"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::OutfeedEnqueueOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::OutfeedEnqueueTupleOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class OutfeedEnqueueTupleOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + OutfeedEnqueueTupleOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + OutfeedEnqueueTupleOpGenericAdaptorBase(OutfeedEnqueueTupleOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class OutfeedEnqueueTupleOpGenericAdaptor : public detail::OutfeedEnqueueTupleOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::OutfeedEnqueueTupleOpGenericAdaptorBase; +public: + OutfeedEnqueueTupleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + OutfeedEnqueueTupleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : OutfeedEnqueueTupleOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + OutfeedEnqueueTupleOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class OutfeedEnqueueTupleOpAdaptor : public OutfeedEnqueueTupleOpGenericAdaptor<::mlir::ValueRange> { +public: + using OutfeedEnqueueTupleOpGenericAdaptor::OutfeedEnqueueTupleOpGenericAdaptor; + OutfeedEnqueueTupleOpAdaptor(OutfeedEnqueueTupleOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class OutfeedEnqueueTupleOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = OutfeedEnqueueTupleOpAdaptor; + template + using GenericAdaptor = OutfeedEnqueueTupleOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dtypes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDtypesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDtypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.OutfeedEnqueueTuple"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::MutableOperandRange getInputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + mlir::OperandElementTypeRange getDtypes(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange inputs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::OutfeedEnqueueTupleOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::PackOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PackOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + PackOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + PackOpGenericAdaptorBase(PackOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getAxisAttr(); + uint64_t getAxis(); +}; +} // namespace detail +template +class PackOpGenericAdaptor : public detail::PackOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PackOpGenericAdaptorBase; +public: + PackOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PackOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PackOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + PackOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getValues() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PackOpAdaptor : public PackOpGenericAdaptor<::mlir::ValueRange> { +public: + using PackOpGenericAdaptor::PackOpGenericAdaptor; + PackOpAdaptor(PackOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PackOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = PackOpAdaptor; + template + using GenericAdaptor = PackOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("N"), ::llvm::StringRef("T"), ::llvm::StringRef("axis")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getAxisAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getAxisAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Pack"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getValues(); + ::mlir::MutableOperandRange getValuesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getAxisAttr(); + uint64_t getAxis(); + size_t getN(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setAxisAttr(::mlir::IntegerAttr attr); + void setAxis(::std::optional attrValue); + ::mlir::Attribute removeAxisAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::ValueRange values, /*optional*/::mlir::IntegerAttr axis); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange values, /*optional*/::mlir::IntegerAttr axis); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::ValueRange values, /*optional*/uint64_t axis = 0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange values, /*optional*/uint64_t axis = 0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::PackOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::PadOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PadOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + PadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + PadOpGenericAdaptorBase(PadOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class PadOpGenericAdaptor : public detail::PadOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PadOpGenericAdaptorBase; +public: + PadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PadOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + PadOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getPaddings() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PadOpAdaptor : public PadOpGenericAdaptor<::mlir::ValueRange> { +public: + using PadOpGenericAdaptor::PadOpGenericAdaptor; + PadOpAdaptor(PadOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PadOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, FoldOperandsTransposeInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = PadOpAdaptor; + template + using GenericAdaptor = PadOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tpaddings")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTpaddingsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTpaddingsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Pad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getPaddings(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getPaddingsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTpaddings(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value paddings); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value paddings); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // TF_FoldOperandsTransposeInterface: + SmallVector GetLayoutDependentArgs() { return {0}; } + SmallVector GetLayoutDependentResults() { return {0}; } + LogicalResult FoldOperandsPermutation(ArrayRef permutation); +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::PadOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::PadV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PadV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + PadV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + PadV2OpGenericAdaptorBase(PadV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class PadV2OpGenericAdaptor : public detail::PadV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PadV2OpGenericAdaptorBase; +public: + PadV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PadV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PadV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + PadV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getPaddings() { + return (*getODSOperands(1).begin()); + } + + ValueT getConstantValues() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PadV2OpAdaptor : public PadV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using PadV2OpGenericAdaptor::PadV2OpGenericAdaptor; + PadV2OpAdaptor(PadV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PadV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = PadV2OpAdaptor; + template + using GenericAdaptor = PadV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tpaddings")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTpaddingsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTpaddingsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.PadV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getPaddings(); + ::mlir::TypedValue<::mlir::TensorType> getConstantValues(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getPaddingsMutable(); + ::mlir::OpOperand &getConstantValuesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTpaddings(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value paddings, ::mlir::Value constant_values); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value paddings, ::mlir::Value constant_values); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::PadV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ParallelDynamicStitchOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ParallelDynamicStitchOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ParallelDynamicStitchOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ParallelDynamicStitchOpGenericAdaptorBase(ParallelDynamicStitchOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ParallelDynamicStitchOpGenericAdaptor : public detail::ParallelDynamicStitchOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ParallelDynamicStitchOpGenericAdaptorBase; +public: + ParallelDynamicStitchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ParallelDynamicStitchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ParallelDynamicStitchOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ParallelDynamicStitchOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getIndices() { + return getODSOperands(0); + } + + RangeT getData() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ParallelDynamicStitchOpAdaptor : public ParallelDynamicStitchOpGenericAdaptor<::mlir::ValueRange> { +public: + using ParallelDynamicStitchOpGenericAdaptor::ParallelDynamicStitchOpGenericAdaptor; + ParallelDynamicStitchOpAdaptor(ParallelDynamicStitchOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ParallelDynamicStitchOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ParallelDynamicStitchOpAdaptor; + template + using GenericAdaptor = ParallelDynamicStitchOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("N"), ::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ParallelDynamicStitch"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getIndices(); + ::mlir::Operation::operand_range getData(); + ::mlir::MutableOperandRange getIndicesMutable(); + ::mlir::MutableOperandRange getDataMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getMerged(); + size_t getN(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type merged, ::mlir::ValueRange indices, ::mlir::ValueRange data); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange indices, ::mlir::ValueRange data); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ParallelDynamicStitchOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ParallelMapDatasetOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ParallelMapDatasetOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ParallelMapDatasetOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ParallelMapDatasetOpGenericAdaptorBase(ParallelMapDatasetOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::SymbolRefAttr getFAttr(); + ::mlir::SymbolRefAttr getF(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::BoolAttr getUseInterOpParallelismAttr(); + bool getUseInterOpParallelism(); + ::mlir::BoolAttr getSloppyAttr(); + bool getSloppy(); + ::mlir::BoolAttr getPreserveCardinalityAttr(); + bool getPreserveCardinality(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); +}; +} // namespace detail +template +class ParallelMapDatasetOpGenericAdaptor : public detail::ParallelMapDatasetOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ParallelMapDatasetOpGenericAdaptorBase; +public: + ParallelMapDatasetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ParallelMapDatasetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ParallelMapDatasetOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ParallelMapDatasetOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputDataset() { + return (*getODSOperands(0).begin()); + } + + RangeT getOtherArguments() { + return getODSOperands(1); + } + + ValueT getNumParallelCalls() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ParallelMapDatasetOpAdaptor : public ParallelMapDatasetOpGenericAdaptor<::mlir::ValueRange> { +public: + using ParallelMapDatasetOpGenericAdaptor::ParallelMapDatasetOpGenericAdaptor; + ParallelMapDatasetOpAdaptor(ParallelMapDatasetOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ParallelMapDatasetOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ParallelMapDatasetOpAdaptor; + template + using GenericAdaptor = ParallelMapDatasetOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Targuments"), ::llvm::StringRef("f"), ::llvm::StringRef("metadata"), ::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types"), ::llvm::StringRef("preserve_cardinality"), ::llvm::StringRef("sloppy"), ::llvm::StringRef("use_inter_op_parallelism")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTargumentsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTargumentsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getFAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getFAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getMetadataAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getMetadataAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getPreserveCardinalityAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getPreserveCardinalityAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getSloppyAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getSloppyAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getUseInterOpParallelismAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getUseInterOpParallelismAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ParallelMapDataset"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputDataset(); + ::mlir::Operation::operand_range getOtherArguments(); + ::mlir::TypedValue<::mlir::TensorType> getNumParallelCalls(); + ::mlir::OpOperand &getInputDatasetMutable(); + ::mlir::MutableOperandRange getOtherArgumentsMutable(); + ::mlir::OpOperand &getNumParallelCallsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::SymbolRefAttr getFAttr(); + ::mlir::SymbolRefAttr getF(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::BoolAttr getUseInterOpParallelismAttr(); + bool getUseInterOpParallelism(); + ::mlir::BoolAttr getSloppyAttr(); + bool getSloppy(); + ::mlir::BoolAttr getPreserveCardinalityAttr(); + bool getPreserveCardinality(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); + mlir::OperandElementTypeRange getTarguments(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setFAttr(::mlir::SymbolRefAttr attr); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + void setUseInterOpParallelismAttr(::mlir::BoolAttr attr); + void setUseInterOpParallelism(::std::optional attrValue); + void setSloppyAttr(::mlir::BoolAttr attr); + void setSloppy(::std::optional attrValue); + void setPreserveCardinalityAttr(::mlir::BoolAttr attr); + void setPreserveCardinality(::std::optional attrValue); + void setMetadataAttr(::mlir::StringAttr attr); + void setMetadata(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeUseInterOpParallelismAttr(); + ::mlir::Attribute removeSloppyAttr(); + ::mlir::Attribute removePreserveCardinalityAttr(); + ::mlir::Attribute removeMetadataAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, ::mlir::ValueRange other_arguments, ::mlir::Value num_parallel_calls, ::mlir::SymbolRefAttr f, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::BoolAttr use_inter_op_parallelism, /*optional*/::mlir::BoolAttr sloppy, /*optional*/::mlir::BoolAttr preserve_cardinality, /*optional*/::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, ::mlir::ValueRange other_arguments, ::mlir::Value num_parallel_calls, ::mlir::SymbolRefAttr f, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::BoolAttr use_inter_op_parallelism, /*optional*/::mlir::BoolAttr sloppy, /*optional*/::mlir::BoolAttr preserve_cardinality, /*optional*/::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, ::mlir::ValueRange other_arguments, ::mlir::Value num_parallel_calls, ::mlir::SymbolRefAttr f, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/bool use_inter_op_parallelism = true, /*optional*/bool sloppy = false, /*optional*/bool preserve_cardinality = false, /*optional*/::llvm::StringRef metadata = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, ::mlir::ValueRange other_arguments, ::mlir::Value num_parallel_calls, ::mlir::SymbolRefAttr f, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/bool use_inter_op_parallelism = true, /*optional*/bool sloppy = false, /*optional*/bool preserve_cardinality = false, /*optional*/::llvm::StringRef metadata = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 8 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ParallelMapDatasetOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ParallelMapDatasetV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ParallelMapDatasetV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ParallelMapDatasetV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ParallelMapDatasetV2OpGenericAdaptorBase(ParallelMapDatasetV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::SymbolRefAttr getFAttr(); + ::mlir::SymbolRefAttr getF(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::BoolAttr getUseInterOpParallelismAttr(); + bool getUseInterOpParallelism(); + ::mlir::StringAttr getDeterministicAttr(); + ::llvm::StringRef getDeterministic(); + ::mlir::BoolAttr getPreserveCardinalityAttr(); + bool getPreserveCardinality(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); +}; +} // namespace detail +template +class ParallelMapDatasetV2OpGenericAdaptor : public detail::ParallelMapDatasetV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ParallelMapDatasetV2OpGenericAdaptorBase; +public: + ParallelMapDatasetV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ParallelMapDatasetV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ParallelMapDatasetV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ParallelMapDatasetV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputDataset() { + return (*getODSOperands(0).begin()); + } + + RangeT getOtherArguments() { + return getODSOperands(1); + } + + ValueT getNumParallelCalls() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ParallelMapDatasetV2OpAdaptor : public ParallelMapDatasetV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using ParallelMapDatasetV2OpGenericAdaptor::ParallelMapDatasetV2OpGenericAdaptor; + ParallelMapDatasetV2OpAdaptor(ParallelMapDatasetV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ParallelMapDatasetV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ParallelMapDatasetV2OpAdaptor; + template + using GenericAdaptor = ParallelMapDatasetV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Targuments"), ::llvm::StringRef("deterministic"), ::llvm::StringRef("f"), ::llvm::StringRef("metadata"), ::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types"), ::llvm::StringRef("preserve_cardinality"), ::llvm::StringRef("use_inter_op_parallelism")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTargumentsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTargumentsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDeterministicAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDeterministicAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getFAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getFAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getMetadataAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getMetadataAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getPreserveCardinalityAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getPreserveCardinalityAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getUseInterOpParallelismAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getUseInterOpParallelismAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ParallelMapDatasetV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputDataset(); + ::mlir::Operation::operand_range getOtherArguments(); + ::mlir::TypedValue<::mlir::TensorType> getNumParallelCalls(); + ::mlir::OpOperand &getInputDatasetMutable(); + ::mlir::MutableOperandRange getOtherArgumentsMutable(); + ::mlir::OpOperand &getNumParallelCallsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::SymbolRefAttr getFAttr(); + ::mlir::SymbolRefAttr getF(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::BoolAttr getUseInterOpParallelismAttr(); + bool getUseInterOpParallelism(); + ::mlir::StringAttr getDeterministicAttr(); + ::llvm::StringRef getDeterministic(); + ::mlir::BoolAttr getPreserveCardinalityAttr(); + bool getPreserveCardinality(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); + mlir::OperandElementTypeRange getTarguments(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setFAttr(::mlir::SymbolRefAttr attr); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + void setUseInterOpParallelismAttr(::mlir::BoolAttr attr); + void setUseInterOpParallelism(::std::optional attrValue); + void setDeterministicAttr(::mlir::StringAttr attr); + void setDeterministic(::std::optional<::llvm::StringRef> attrValue); + void setPreserveCardinalityAttr(::mlir::BoolAttr attr); + void setPreserveCardinality(::std::optional attrValue); + void setMetadataAttr(::mlir::StringAttr attr); + void setMetadata(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeUseInterOpParallelismAttr(); + ::mlir::Attribute removeDeterministicAttr(); + ::mlir::Attribute removePreserveCardinalityAttr(); + ::mlir::Attribute removeMetadataAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, ::mlir::ValueRange other_arguments, ::mlir::Value num_parallel_calls, ::mlir::SymbolRefAttr f, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::BoolAttr use_inter_op_parallelism, /*optional*/::mlir::StringAttr deterministic, /*optional*/::mlir::BoolAttr preserve_cardinality, /*optional*/::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, ::mlir::ValueRange other_arguments, ::mlir::Value num_parallel_calls, ::mlir::SymbolRefAttr f, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::BoolAttr use_inter_op_parallelism, /*optional*/::mlir::StringAttr deterministic, /*optional*/::mlir::BoolAttr preserve_cardinality, /*optional*/::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, ::mlir::ValueRange other_arguments, ::mlir::Value num_parallel_calls, ::mlir::SymbolRefAttr f, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/bool use_inter_op_parallelism = true, /*optional*/::llvm::StringRef deterministic = "default", /*optional*/bool preserve_cardinality = false, /*optional*/::llvm::StringRef metadata = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, ::mlir::ValueRange other_arguments, ::mlir::Value num_parallel_calls, ::mlir::SymbolRefAttr f, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/bool use_inter_op_parallelism = true, /*optional*/::llvm::StringRef deterministic = "default", /*optional*/bool preserve_cardinality = false, /*optional*/::llvm::StringRef metadata = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 8 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ParallelMapDatasetV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ParameterizedTruncatedNormalOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ParameterizedTruncatedNormalOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ParameterizedTruncatedNormalOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ParameterizedTruncatedNormalOpGenericAdaptorBase(ParameterizedTruncatedNormalOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getSeedAttr(); + uint64_t getSeed(); + ::mlir::IntegerAttr getSeed2Attr(); + uint64_t getSeed2(); +}; +} // namespace detail +template +class ParameterizedTruncatedNormalOpGenericAdaptor : public detail::ParameterizedTruncatedNormalOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ParameterizedTruncatedNormalOpGenericAdaptorBase; +public: + ParameterizedTruncatedNormalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ParameterizedTruncatedNormalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ParameterizedTruncatedNormalOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ParameterizedTruncatedNormalOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getShape() { + return (*getODSOperands(0).begin()); + } + + ValueT getMeans() { + return (*getODSOperands(1).begin()); + } + + ValueT getStdevs() { + return (*getODSOperands(2).begin()); + } + + ValueT getMinvals() { + return (*getODSOperands(3).begin()); + } + + ValueT getMaxvals() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ParameterizedTruncatedNormalOpAdaptor : public ParameterizedTruncatedNormalOpGenericAdaptor<::mlir::ValueRange> { +public: + using ParameterizedTruncatedNormalOpGenericAdaptor::ParameterizedTruncatedNormalOpGenericAdaptor; + ParameterizedTruncatedNormalOpAdaptor(ParameterizedTruncatedNormalOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ParameterizedTruncatedNormalOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<5>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::TF::CannotDuplicate, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ParameterizedTruncatedNormalOpAdaptor; + template + using GenericAdaptor = ParameterizedTruncatedNormalOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("dtype"), ::llvm::StringRef("seed"), ::llvm::StringRef("seed2")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getSeedAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getSeedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSeed2AttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSeed2AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ParameterizedTruncatedNormal"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::TypedValue<::mlir::TensorType> getMeans(); + ::mlir::TypedValue<::mlir::TensorType> getStdevs(); + ::mlir::TypedValue<::mlir::TensorType> getMinvals(); + ::mlir::TypedValue<::mlir::TensorType> getMaxvals(); + ::mlir::OpOperand &getShapeMutable(); + ::mlir::OpOperand &getMeansMutable(); + ::mlir::OpOperand &getStdevsMutable(); + ::mlir::OpOperand &getMinvalsMutable(); + ::mlir::OpOperand &getMaxvalsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getSeedAttr(); + uint64_t getSeed(); + ::mlir::IntegerAttr getSeed2Attr(); + uint64_t getSeed2(); + ::mlir::Type getT(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setSeedAttr(::mlir::IntegerAttr attr); + void setSeed(::std::optional attrValue); + void setSeed2Attr(::mlir::IntegerAttr attr); + void setSeed2(::std::optional attrValue); + ::mlir::Attribute removeSeedAttr(); + ::mlir::Attribute removeSeed2Attr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, ::mlir::Value means, ::mlir::Value stdevs, ::mlir::Value minvals, ::mlir::Value maxvals, /*optional*/::mlir::IntegerAttr seed, /*optional*/::mlir::IntegerAttr seed2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, ::mlir::Value means, ::mlir::Value stdevs, ::mlir::Value minvals, ::mlir::Value maxvals, /*optional*/::mlir::IntegerAttr seed, /*optional*/::mlir::IntegerAttr seed2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, ::mlir::Value means, ::mlir::Value stdevs, ::mlir::Value minvals, ::mlir::Value maxvals, /*optional*/uint64_t seed = 0, /*optional*/uint64_t seed2 = 0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, ::mlir::Value means, ::mlir::Value stdevs, ::mlir::Value minvals, ::mlir::Value maxvals, /*optional*/uint64_t seed = 0, /*optional*/uint64_t seed2 = 0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ParameterizedTruncatedNormalOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ParseExampleOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ParseExampleOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ParseExampleOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ParseExampleOpGenericAdaptorBase(ParseExampleOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getDenseShapesAttr(); + ::mlir::ArrayAttr getDenseShapes(); + ::mlir::DenseI32ArrayAttr getResultSegmentSizesAttr(); + ::llvm::ArrayRef getResultSegmentSizes(); + ::mlir::DenseI32ArrayAttr getOperandSegmentSizesAttr(); + ::llvm::ArrayRef getOperandSegmentSizes(); +}; +} // namespace detail +template +class ParseExampleOpGenericAdaptor : public detail::ParseExampleOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ParseExampleOpGenericAdaptorBase; +public: + ParseExampleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ParseExampleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ParseExampleOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ParseExampleOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSerialized() { + return (*getODSOperands(0).begin()); + } + + ValueT getNames() { + return (*getODSOperands(1).begin()); + } + + RangeT getSparseKeys() { + return getODSOperands(2); + } + + RangeT getDenseKeys() { + return getODSOperands(3); + } + + RangeT getDenseDefaults() { + return getODSOperands(4); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ParseExampleOpAdaptor : public ParseExampleOpGenericAdaptor<::mlir::ValueRange> { +public: + using ParseExampleOpGenericAdaptor::ParseExampleOpGenericAdaptor; + ParseExampleOpAdaptor(ParseExampleOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ParseExampleOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedResultSegments, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ParseExampleOpAdaptor; + template + using GenericAdaptor = ParseExampleOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Ndense"), ::llvm::StringRef("Nsparse"), ::llvm::StringRef("Tdense"), ::llvm::StringRef("dense_shapes"), ::llvm::StringRef("operandSegmentSizes"), ::llvm::StringRef("resultSegmentSizes"), ::llvm::StringRef("sparse_types")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNdenseAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNdenseAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNsparseAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNsparseAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTdenseAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTdenseAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getDenseShapesAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getDenseShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getResultSegmentSizesAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getResultSegmentSizesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getSparseTypesAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getSparseTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ParseExample"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSerialized(); + ::mlir::TypedValue<::mlir::TensorType> getNames(); + ::mlir::Operation::operand_range getSparseKeys(); + ::mlir::Operation::operand_range getDenseKeys(); + ::mlir::Operation::operand_range getDenseDefaults(); + ::mlir::OpOperand &getSerializedMutable(); + ::mlir::OpOperand &getNamesMutable(); + ::mlir::MutableOperandRange getSparseKeysMutable(); + ::mlir::MutableOperandRange getDenseKeysMutable(); + ::mlir::MutableOperandRange getDenseDefaultsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getSparseIndices(); + ::mlir::Operation::result_range getSparseValues(); + ::mlir::Operation::result_range getSparseShapes(); + ::mlir::Operation::result_range getDenseValues(); + ::mlir::ArrayAttr getDenseShapesAttr(); + ::mlir::ArrayAttr getDenseShapes(); + ::mlir::DenseI32ArrayAttr getResultSegmentSizesAttr(); + ::llvm::ArrayRef getResultSegmentSizes(); + ::mlir::DenseI32ArrayAttr getOperandSegmentSizesAttr(); + ::llvm::ArrayRef getOperandSegmentSizes(); + size_t getNsparse(); + size_t getNdense(); + mlir::OperandElementTypeRange getTdense(); + mlir::ResultElementTypeRange getSparseTypes(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setDenseShapesAttr(::mlir::ArrayAttr attr); + void setResultSegmentSizesAttr(::mlir::DenseI32ArrayAttr attr); + void setResultSegmentSizes(::llvm::ArrayRef attrValue); + void setOperandSegmentSizesAttr(::mlir::DenseI32ArrayAttr attr); + void setOperandSegmentSizes(::llvm::ArrayRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange sparse_indices, ::mlir::TypeRange sparse_values, ::mlir::TypeRange sparse_shapes, ::mlir::TypeRange dense_values, ::mlir::Value serialized, ::mlir::Value names, ::mlir::ValueRange sparse_keys, ::mlir::ValueRange dense_keys, ::mlir::ValueRange dense_defaults, ::mlir::ArrayAttr dense_shapes, ::mlir::DenseI32ArrayAttr resultSegmentSizes, ::mlir::DenseI32ArrayAttr operandSegmentSizes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value serialized, ::mlir::Value names, ::mlir::ValueRange sparse_keys, ::mlir::ValueRange dense_keys, ::mlir::ValueRange dense_defaults, ::mlir::ArrayAttr dense_shapes, ::mlir::DenseI32ArrayAttr resultSegmentSizes, ::mlir::DenseI32ArrayAttr operandSegmentSizes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange sparse_indices, ::mlir::TypeRange sparse_values, ::mlir::TypeRange sparse_shapes, ::mlir::TypeRange dense_values, ::mlir::Value serialized, ::mlir::Value names, ::mlir::ValueRange sparse_keys, ::mlir::ValueRange dense_keys, ::mlir::ValueRange dense_defaults, ::mlir::ArrayAttr dense_shapes, ::llvm::ArrayRef resultSegmentSizes, ::llvm::ArrayRef operandSegmentSizes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value serialized, ::mlir::Value names, ::mlir::ValueRange sparse_keys, ::mlir::ValueRange dense_keys, ::mlir::ValueRange dense_defaults, ::mlir::ArrayAttr dense_shapes, ::llvm::ArrayRef resultSegmentSizes, ::llvm::ArrayRef operandSegmentSizes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 7 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ParseExampleOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ParseExampleV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ParseExampleV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ParseExampleV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ParseExampleV2OpGenericAdaptorBase(ParseExampleV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getNumSparseAttr(); + uint64_t getNumSparse(); + ::mlir::ArrayAttr getDenseShapesAttr(); + ::mlir::ArrayAttr getDenseShapes(); + ::mlir::DenseI32ArrayAttr getResultSegmentSizesAttr(); + ::llvm::ArrayRef getResultSegmentSizes(); +}; +} // namespace detail +template +class ParseExampleV2OpGenericAdaptor : public detail::ParseExampleV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ParseExampleV2OpGenericAdaptorBase; +public: + ParseExampleV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ParseExampleV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ParseExampleV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ParseExampleV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSerialized() { + return (*getODSOperands(0).begin()); + } + + ValueT getNames() { + return (*getODSOperands(1).begin()); + } + + ValueT getSparseKeys() { + return (*getODSOperands(2).begin()); + } + + ValueT getDenseKeys() { + return (*getODSOperands(3).begin()); + } + + ValueT getRaggedKeys() { + return (*getODSOperands(4).begin()); + } + + RangeT getDenseDefaults() { + return getODSOperands(5); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ParseExampleV2OpAdaptor : public ParseExampleV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using ParseExampleV2OpGenericAdaptor::ParseExampleV2OpGenericAdaptor; + ParseExampleV2OpAdaptor(ParseExampleV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ParseExampleV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedResultSegments, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ParseExampleV2OpAdaptor; + template + using GenericAdaptor = ParseExampleV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tdense"), ::llvm::StringRef("dense_shapes"), ::llvm::StringRef("num_sparse"), ::llvm::StringRef("ragged_split_types"), ::llvm::StringRef("ragged_value_types"), ::llvm::StringRef("resultSegmentSizes"), ::llvm::StringRef("sparse_types")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTdenseAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTdenseAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDenseShapesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDenseShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getNumSparseAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getNumSparseAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getRaggedSplitTypesAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getRaggedSplitTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getRaggedValueTypesAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getRaggedValueTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getResultSegmentSizesAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getResultSegmentSizesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getSparseTypesAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getSparseTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ParseExampleV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSerialized(); + ::mlir::TypedValue<::mlir::TensorType> getNames(); + ::mlir::TypedValue<::mlir::TensorType> getSparseKeys(); + ::mlir::TypedValue<::mlir::TensorType> getDenseKeys(); + ::mlir::TypedValue<::mlir::TensorType> getRaggedKeys(); + ::mlir::Operation::operand_range getDenseDefaults(); + ::mlir::OpOperand &getSerializedMutable(); + ::mlir::OpOperand &getNamesMutable(); + ::mlir::OpOperand &getSparseKeysMutable(); + ::mlir::OpOperand &getDenseKeysMutable(); + ::mlir::OpOperand &getRaggedKeysMutable(); + ::mlir::MutableOperandRange getDenseDefaultsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getSparseIndices(); + ::mlir::Operation::result_range getSparseValues(); + ::mlir::Operation::result_range getSparseShapes(); + ::mlir::Operation::result_range getDenseValues(); + ::mlir::Operation::result_range getRaggedValues(); + ::mlir::Operation::result_range getRaggedRowSplits(); + ::mlir::IntegerAttr getNumSparseAttr(); + uint64_t getNumSparse(); + ::mlir::ArrayAttr getDenseShapesAttr(); + ::mlir::ArrayAttr getDenseShapes(); + ::mlir::DenseI32ArrayAttr getResultSegmentSizesAttr(); + ::llvm::ArrayRef getResultSegmentSizes(); + mlir::OperandElementTypeRange getTdense(); + mlir::ResultElementTypeRange getSparseTypes(); + mlir::ResultElementTypeRange getRaggedValueTypes(); + mlir::ResultElementTypeRange getRaggedSplitTypes(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setNumSparseAttr(::mlir::IntegerAttr attr); + void setNumSparse(uint64_t attrValue); + void setDenseShapesAttr(::mlir::ArrayAttr attr); + void setResultSegmentSizesAttr(::mlir::DenseI32ArrayAttr attr); + void setResultSegmentSizes(::llvm::ArrayRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange sparse_indices, ::mlir::TypeRange sparse_values, ::mlir::TypeRange sparse_shapes, ::mlir::TypeRange dense_values, ::mlir::TypeRange ragged_values, ::mlir::TypeRange ragged_row_splits, ::mlir::Value serialized, ::mlir::Value names, ::mlir::Value sparse_keys, ::mlir::Value dense_keys, ::mlir::Value ragged_keys, ::mlir::ValueRange dense_defaults, ::mlir::IntegerAttr num_sparse, ::mlir::ArrayAttr dense_shapes, ::mlir::DenseI32ArrayAttr resultSegmentSizes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value serialized, ::mlir::Value names, ::mlir::Value sparse_keys, ::mlir::Value dense_keys, ::mlir::Value ragged_keys, ::mlir::ValueRange dense_defaults, ::mlir::IntegerAttr num_sparse, ::mlir::ArrayAttr dense_shapes, ::mlir::DenseI32ArrayAttr resultSegmentSizes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange sparse_indices, ::mlir::TypeRange sparse_values, ::mlir::TypeRange sparse_shapes, ::mlir::TypeRange dense_values, ::mlir::TypeRange ragged_values, ::mlir::TypeRange ragged_row_splits, ::mlir::Value serialized, ::mlir::Value names, ::mlir::Value sparse_keys, ::mlir::Value dense_keys, ::mlir::Value ragged_keys, ::mlir::ValueRange dense_defaults, uint64_t num_sparse, ::mlir::ArrayAttr dense_shapes, ::llvm::ArrayRef resultSegmentSizes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value serialized, ::mlir::Value names, ::mlir::Value sparse_keys, ::mlir::Value dense_keys, ::mlir::Value ragged_keys, ::mlir::ValueRange dense_defaults, uint64_t num_sparse, ::mlir::ArrayAttr dense_shapes, ::llvm::ArrayRef resultSegmentSizes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 7 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ParseExampleV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::PartitionedCallOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PartitionedCallOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + PartitionedCallOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + PartitionedCallOpGenericAdaptorBase(PartitionedCallOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::SymbolRefAttr getFAttr(); + ::mlir::SymbolRefAttr getF(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + ::mlir::StringAttr getConfigProtoAttr(); + ::llvm::StringRef getConfigProto(); + ::mlir::StringAttr getExecutorTypeAttr(); + ::llvm::StringRef getExecutorType(); +}; +} // namespace detail +template +class PartitionedCallOpGenericAdaptor : public detail::PartitionedCallOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PartitionedCallOpGenericAdaptorBase; +public: + PartitionedCallOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PartitionedCallOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PartitionedCallOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + PartitionedCallOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PartitionedCallOpAdaptor : public PartitionedCallOpGenericAdaptor<::mlir::ValueRange> { +public: + using PartitionedCallOpGenericAdaptor::PartitionedCallOpGenericAdaptor; + PartitionedCallOpAdaptor(PartitionedCallOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PartitionedCallOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = PartitionedCallOpAdaptor; + template + using GenericAdaptor = PartitionedCallOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tin"), ::llvm::StringRef("Tout"), ::llvm::StringRef("config"), ::llvm::StringRef("config_proto"), ::llvm::StringRef("executor_type"), ::llvm::StringRef("f")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTinAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTinAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getToutAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getToutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getConfigProtoAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getConfigProtoAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getExecutorTypeAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getExecutorTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getFAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getFAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.PartitionedCall"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutput(); + ::mlir::SymbolRefAttr getFAttr(); + ::mlir::SymbolRefAttr getF(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + ::mlir::StringAttr getConfigProtoAttr(); + ::llvm::StringRef getConfigProto(); + ::mlir::StringAttr getExecutorTypeAttr(); + ::llvm::StringRef getExecutorType(); + mlir::OperandElementTypeRange getTin(); + mlir::ResultElementTypeRange getTout(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setFAttr(::mlir::SymbolRefAttr attr); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + void setConfigProtoAttr(::mlir::StringAttr attr); + void setConfigProto(::std::optional<::llvm::StringRef> attrValue); + void setExecutorTypeAttr(::mlir::StringAttr attr); + void setExecutorType(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeConfigAttr(); + ::mlir::Attribute removeConfigProtoAttr(); + ::mlir::Attribute removeExecutorTypeAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::ValueRange args, ::mlir::SymbolRefAttr f, /*optional*/::mlir::StringAttr config, /*optional*/::mlir::StringAttr config_proto, /*optional*/::mlir::StringAttr executor_type); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::ValueRange args, ::mlir::SymbolRefAttr f, /*optional*/::llvm::StringRef config = "", /*optional*/::llvm::StringRef config_proto = "", /*optional*/::llvm::StringRef executor_type = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verifySymbolUses(::mlir::SymbolTableCollection &symbolTable); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Gets the argument operands to the called function. + operand_range getArgOperands() { return getArgs(); } + MutableOperandRange getArgOperandsMutable() { + return getArgsMutable(); + } + + // Returns the callee of this operation. + CallInterfaceCallable getCallableForCallee() { return getFAttr(); } + // Sets the callee from the callable. + void setCalleeFromCallable(CallInterfaceCallable callee); + + // returns the callee of this operation. + func::FuncOp func() { + return SymbolTable::lookupNearestSymbolFrom(*this, getF()); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::PartitionedCallOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::PlaceholderOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PlaceholderOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + PlaceholderOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + PlaceholderOpGenericAdaptorBase(PlaceholderOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class PlaceholderOpGenericAdaptor : public detail::PlaceholderOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PlaceholderOpGenericAdaptorBase; +public: + PlaceholderOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PlaceholderOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PlaceholderOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + PlaceholderOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PlaceholderOpAdaptor : public PlaceholderOpGenericAdaptor<::mlir::ValueRange> { +public: + using PlaceholderOpGenericAdaptor::PlaceholderOpGenericAdaptor; + PlaceholderOpAdaptor(PlaceholderOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PlaceholderOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = PlaceholderOpAdaptor; + template + using GenericAdaptor = PlaceholderOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Placeholder"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::PlaceholderOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::PlaceholderWithDefaultOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PlaceholderWithDefaultOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + PlaceholderWithDefaultOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + PlaceholderWithDefaultOpGenericAdaptorBase(PlaceholderWithDefaultOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class PlaceholderWithDefaultOpGenericAdaptor : public detail::PlaceholderWithDefaultOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PlaceholderWithDefaultOpGenericAdaptorBase; +public: + PlaceholderWithDefaultOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PlaceholderWithDefaultOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PlaceholderWithDefaultOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + PlaceholderWithDefaultOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PlaceholderWithDefaultOpAdaptor : public PlaceholderWithDefaultOpGenericAdaptor<::mlir::ValueRange> { +public: + using PlaceholderWithDefaultOpGenericAdaptor::PlaceholderWithDefaultOpGenericAdaptor; + PlaceholderWithDefaultOpAdaptor(PlaceholderWithDefaultOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PlaceholderWithDefaultOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = PlaceholderWithDefaultOpAdaptor; + template + using GenericAdaptor = PlaceholderWithDefaultOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dtype"), ::llvm::StringRef("shape")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getShapeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getShapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.PlaceholderWithDefault"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getDtype(); + ShapedType getShape(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::PlaceholderWithDefaultOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::PolygammaOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PolygammaOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + PolygammaOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + PolygammaOpGenericAdaptorBase(PolygammaOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class PolygammaOpGenericAdaptor : public detail::PolygammaOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PolygammaOpGenericAdaptorBase; +public: + PolygammaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PolygammaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PolygammaOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + PolygammaOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + ValueT getX() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PolygammaOpAdaptor : public PolygammaOpGenericAdaptor<::mlir::ValueRange> { +public: + using PolygammaOpGenericAdaptor::PolygammaOpGenericAdaptor; + PolygammaOpAdaptor(PolygammaOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PolygammaOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = PolygammaOpAdaptor; + template + using GenericAdaptor = PolygammaOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Polygamma"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getA(); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getAMutable(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value a, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::PolygammaOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::PopulationCountOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PopulationCountOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + PopulationCountOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + PopulationCountOpGenericAdaptorBase(PopulationCountOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class PopulationCountOpGenericAdaptor : public detail::PopulationCountOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PopulationCountOpGenericAdaptorBase; +public: + PopulationCountOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PopulationCountOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PopulationCountOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + PopulationCountOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PopulationCountOpAdaptor : public PopulationCountOpGenericAdaptor<::mlir::ValueRange> { +public: + using PopulationCountOpGenericAdaptor::PopulationCountOpGenericAdaptor; + PopulationCountOpAdaptor(PopulationCountOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PopulationCountOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = PopulationCountOpAdaptor; + template + using GenericAdaptor = PopulationCountOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.PopulationCount"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::PopulationCountOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::PowOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PowOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + PowOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + PowOpGenericAdaptorBase(PowOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class PowOpGenericAdaptor : public detail::PowOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PowOpGenericAdaptorBase; +public: + PowOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PowOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PowOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + PowOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PowOpAdaptor : public PowOpGenericAdaptor<::mlir::ValueRange> { +public: + using PowOpGenericAdaptor::PowOpGenericAdaptor; + PowOpAdaptor(PowOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PowOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::OpTrait::TF::SameOperandsAndResultElementTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = PowOpAdaptor; + template + using GenericAdaptor = PowOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Pow"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::PowOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::PrefetchDatasetOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PrefetchDatasetOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + PrefetchDatasetOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + PrefetchDatasetOpGenericAdaptorBase(PrefetchDatasetOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::IntegerAttr getSlackPeriodAttr(); + uint64_t getSlackPeriod(); + ::mlir::BoolAttr getLegacyAutotuneAttr(); + bool getLegacyAutotune(); + ::mlir::IntegerAttr getBufferSizeMinAttr(); + uint64_t getBufferSizeMin(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); +}; +} // namespace detail +template +class PrefetchDatasetOpGenericAdaptor : public detail::PrefetchDatasetOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PrefetchDatasetOpGenericAdaptorBase; +public: + PrefetchDatasetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PrefetchDatasetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PrefetchDatasetOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + PrefetchDatasetOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputDataset() { + return (*getODSOperands(0).begin()); + } + + ValueT getBufferSize() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PrefetchDatasetOpAdaptor : public PrefetchDatasetOpGenericAdaptor<::mlir::ValueRange> { +public: + using PrefetchDatasetOpGenericAdaptor::PrefetchDatasetOpGenericAdaptor; + PrefetchDatasetOpAdaptor(PrefetchDatasetOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PrefetchDatasetOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = PrefetchDatasetOpAdaptor; + template + using GenericAdaptor = PrefetchDatasetOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("buffer_size_min"), ::llvm::StringRef("legacy_autotune"), ::llvm::StringRef("metadata"), ::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types"), ::llvm::StringRef("slack_period")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBufferSizeMinAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBufferSizeMinAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getLegacyAutotuneAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getLegacyAutotuneAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getMetadataAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getMetadataAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getSlackPeriodAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getSlackPeriodAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.PrefetchDataset"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputDataset(); + ::mlir::TypedValue<::mlir::TensorType> getBufferSize(); + ::mlir::OpOperand &getInputDatasetMutable(); + ::mlir::OpOperand &getBufferSizeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::IntegerAttr getSlackPeriodAttr(); + uint64_t getSlackPeriod(); + ::mlir::BoolAttr getLegacyAutotuneAttr(); + bool getLegacyAutotune(); + ::mlir::IntegerAttr getBufferSizeMinAttr(); + uint64_t getBufferSizeMin(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + void setSlackPeriodAttr(::mlir::IntegerAttr attr); + void setSlackPeriod(::std::optional attrValue); + void setLegacyAutotuneAttr(::mlir::BoolAttr attr); + void setLegacyAutotune(::std::optional attrValue); + void setBufferSizeMinAttr(::mlir::IntegerAttr attr); + void setBufferSizeMin(::std::optional attrValue); + void setMetadataAttr(::mlir::StringAttr attr); + void setMetadata(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeSlackPeriodAttr(); + ::mlir::Attribute removeLegacyAutotuneAttr(); + ::mlir::Attribute removeBufferSizeMinAttr(); + ::mlir::Attribute removeMetadataAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, ::mlir::Value buffer_size, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::IntegerAttr slack_period, /*optional*/::mlir::BoolAttr legacy_autotune, /*optional*/::mlir::IntegerAttr buffer_size_min, /*optional*/::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, ::mlir::Value buffer_size, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::IntegerAttr slack_period, /*optional*/::mlir::BoolAttr legacy_autotune, /*optional*/::mlir::IntegerAttr buffer_size_min, /*optional*/::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, ::mlir::Value buffer_size, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/uint64_t slack_period = 0, /*optional*/bool legacy_autotune = true, /*optional*/uint64_t buffer_size_min = 0, /*optional*/::llvm::StringRef metadata = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, ::mlir::Value buffer_size, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/uint64_t slack_period = 0, /*optional*/bool legacy_autotune = true, /*optional*/uint64_t buffer_size_min = 0, /*optional*/::llvm::StringRef metadata = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::PrefetchDatasetOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::PreventGradientOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PreventGradientOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + PreventGradientOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + PreventGradientOpGenericAdaptorBase(PreventGradientOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getMessageAttr(); + ::llvm::StringRef getMessage(); +}; +} // namespace detail +template +class PreventGradientOpGenericAdaptor : public detail::PreventGradientOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PreventGradientOpGenericAdaptorBase; +public: + PreventGradientOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PreventGradientOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PreventGradientOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + PreventGradientOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PreventGradientOpAdaptor : public PreventGradientOpGenericAdaptor<::mlir::ValueRange> { +public: + using PreventGradientOpGenericAdaptor::PreventGradientOpGenericAdaptor; + PreventGradientOpAdaptor(PreventGradientOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PreventGradientOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = PreventGradientOpAdaptor; + template + using GenericAdaptor = PreventGradientOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("message")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getMessageAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getMessageAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.PreventGradient"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::StringAttr getMessageAttr(); + ::llvm::StringRef getMessage(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setMessageAttr(::mlir::StringAttr attr); + void setMessage(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeMessageAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, /*optional*/::mlir::StringAttr message); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, /*optional*/::mlir::StringAttr message); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, /*optional*/::mlir::StringAttr message); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, /*optional*/::llvm::StringRef message = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, /*optional*/::llvm::StringRef message = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, /*optional*/::llvm::StringRef message = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::PreventGradientOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::PrintOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PrintOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + PrintOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + PrintOpGenericAdaptorBase(PrintOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getMessageAttr(); + ::llvm::StringRef getMessage(); + ::mlir::IntegerAttr getFirstNAttr(); + uint64_t getFirstN(); + ::mlir::IntegerAttr getSummarizeAttr(); + uint64_t getSummarize(); +}; +} // namespace detail +template +class PrintOpGenericAdaptor : public detail::PrintOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PrintOpGenericAdaptorBase; +public: + PrintOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PrintOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PrintOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + PrintOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getData() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PrintOpAdaptor : public PrintOpGenericAdaptor<::mlir::ValueRange> { +public: + using PrintOpGenericAdaptor::PrintOpGenericAdaptor; + PrintOpAdaptor(PrintOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PrintOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = PrintOpAdaptor; + template + using GenericAdaptor = PrintOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("U"), ::llvm::StringRef("first_n"), ::llvm::StringRef("message"), ::llvm::StringRef("summarize")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getUAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getUAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getFirstNAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getFirstNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getMessageAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getMessageAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getSummarizeAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getSummarizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Print"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::Operation::operand_range getData(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::MutableOperandRange getDataMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::StringAttr getMessageAttr(); + ::llvm::StringRef getMessage(); + ::mlir::IntegerAttr getFirstNAttr(); + uint64_t getFirstN(); + ::mlir::IntegerAttr getSummarizeAttr(); + uint64_t getSummarize(); + ::mlir::Type getT(); + mlir::OperandElementTypeRange getU(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setMessageAttr(::mlir::StringAttr attr); + void setMessage(::std::optional<::llvm::StringRef> attrValue); + void setFirstNAttr(::mlir::IntegerAttr attr); + void setFirstN(::std::optional attrValue); + void setSummarizeAttr(::mlir::IntegerAttr attr); + void setSummarize(::std::optional attrValue); + ::mlir::Attribute removeMessageAttr(); + ::mlir::Attribute removeFirstNAttr(); + ::mlir::Attribute removeSummarizeAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::ValueRange data, /*optional*/::mlir::StringAttr message, /*optional*/::mlir::IntegerAttr first_n, /*optional*/::mlir::IntegerAttr summarize); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::ValueRange data, /*optional*/::mlir::StringAttr message, /*optional*/::mlir::IntegerAttr first_n, /*optional*/::mlir::IntegerAttr summarize); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::ValueRange data, /*optional*/::llvm::StringRef message = "", /*optional*/uint64_t first_n = -1, /*optional*/uint64_t summarize = 3); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::ValueRange data, /*optional*/::llvm::StringRef message = "", /*optional*/uint64_t first_n = -1, /*optional*/uint64_t summarize = 3); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::PrintOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::PrintV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PrintV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + PrintV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + PrintV2OpGenericAdaptorBase(PrintV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getOutputStreamAttr(); + ::llvm::StringRef getOutputStream(); + ::mlir::StringAttr getEndAttr(); + ::llvm::StringRef getEnd(); +}; +} // namespace detail +template +class PrintV2OpGenericAdaptor : public detail::PrintV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PrintV2OpGenericAdaptorBase; +public: + PrintV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PrintV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PrintV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + PrintV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PrintV2OpAdaptor : public PrintV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using PrintV2OpGenericAdaptor::PrintV2OpGenericAdaptor; + PrintV2OpAdaptor(PrintV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PrintV2Op : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = PrintV2OpAdaptor; + template + using GenericAdaptor = PrintV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("end"), ::llvm::StringRef("output_stream")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getEndAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getEndAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutputStreamAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutputStreamAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.PrintV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::StringAttr getOutputStreamAttr(); + ::llvm::StringRef getOutputStream(); + ::mlir::StringAttr getEndAttr(); + ::llvm::StringRef getEnd(); + void setOutputStreamAttr(::mlir::StringAttr attr); + void setOutputStream(::std::optional<::llvm::StringRef> attrValue); + void setEndAttr(::mlir::StringAttr attr); + void setEnd(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeOutputStreamAttr(); + ::mlir::Attribute removeEndAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, /*optional*/::mlir::StringAttr output_stream, /*optional*/::mlir::StringAttr end); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, /*optional*/::mlir::StringAttr output_stream, /*optional*/::mlir::StringAttr end); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, /*optional*/::llvm::StringRef output_stream = "stderr", /*optional*/::llvm::StringRef end = "\n"); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, /*optional*/::llvm::StringRef output_stream = "stderr", /*optional*/::llvm::StringRef end = "\n"); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::PrintV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ProdOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ProdOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ProdOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ProdOpGenericAdaptorBase(ProdOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getKeepDimsAttr(); + bool getKeepDims(); +}; +} // namespace detail +template +class ProdOpGenericAdaptor : public detail::ProdOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ProdOpGenericAdaptorBase; +public: + ProdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ProdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ProdOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ProdOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getReductionIndices() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ProdOpAdaptor : public ProdOpGenericAdaptor<::mlir::ValueRange> { +public: + using ProdOpGenericAdaptor::ProdOpGenericAdaptor; + ProdOpAdaptor(ProdOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ProdOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ProdOpAdaptor; + template + using GenericAdaptor = ProdOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tidx"), ::llvm::StringRef("keep_dims")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTidxAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTidxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getKeepDimsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getKeepDimsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Prod"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getReductionIndices(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getReductionIndicesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getKeepDimsAttr(); + bool getKeepDims(); + ::mlir::Type getT(); + ::mlir::Type getTidx(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setKeepDimsAttr(::mlir::BoolAttr attr); + void setKeepDims(::std::optional attrValue); + ::mlir::Attribute removeKeepDimsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value reduction_indices, /*optional*/::mlir::BoolAttr keep_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value reduction_indices, /*optional*/::mlir::BoolAttr keep_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value reduction_indices, /*optional*/bool keep_dims = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value reduction_indices, /*optional*/bool keep_dims = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ProdOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::QrOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class QrOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + QrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + QrOpGenericAdaptorBase(QrOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getFullMatricesAttr(); + bool getFullMatrices(); +}; +} // namespace detail +template +class QrOpGenericAdaptor : public detail::QrOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::QrOpGenericAdaptorBase; +public: + QrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + QrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : QrOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + QrOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class QrOpAdaptor : public QrOpGenericAdaptor<::mlir::ValueRange> { +public: + using QrOpGenericAdaptor::QrOpGenericAdaptor; + QrOpAdaptor(QrOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class QrOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = QrOpAdaptor; + template + using GenericAdaptor = QrOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("full_matrices")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getFullMatricesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getFullMatricesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Qr"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getQ(); + ::mlir::TypedValue<::mlir::TensorType> getR(); + ::mlir::BoolAttr getFullMatricesAttr(); + bool getFullMatrices(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setFullMatricesAttr(::mlir::BoolAttr attr); + void setFullMatrices(::std::optional attrValue); + ::mlir::Attribute removeFullMatricesAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type q, ::mlir::Type r, ::mlir::Value input, /*optional*/::mlir::BoolAttr full_matrices); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, /*optional*/::mlir::BoolAttr full_matrices); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type q, ::mlir::Type r, ::mlir::Value input, /*optional*/bool full_matrices = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, /*optional*/bool full_matrices = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::QrOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::QuantizeAndDequantizeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class QuantizeAndDequantizeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + QuantizeAndDequantizeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + QuantizeAndDequantizeOpGenericAdaptorBase(QuantizeAndDequantizeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getSignedInputAttr(); + bool getSignedInput(); + ::mlir::IntegerAttr getNumBitsAttr(); + uint64_t getNumBits(); + ::mlir::BoolAttr getRangeGivenAttr(); + bool getRangeGiven(); + ::mlir::FloatAttr getInputMinAttr(); + ::llvm::APFloat getInputMin(); + ::mlir::FloatAttr getInputMaxAttr(); + ::llvm::APFloat getInputMax(); +}; +} // namespace detail +template +class QuantizeAndDequantizeOpGenericAdaptor : public detail::QuantizeAndDequantizeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::QuantizeAndDequantizeOpGenericAdaptorBase; +public: + QuantizeAndDequantizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + QuantizeAndDequantizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : QuantizeAndDequantizeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + QuantizeAndDequantizeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class QuantizeAndDequantizeOpAdaptor : public QuantizeAndDequantizeOpGenericAdaptor<::mlir::ValueRange> { +public: + using QuantizeAndDequantizeOpGenericAdaptor::QuantizeAndDequantizeOpGenericAdaptor; + QuantizeAndDequantizeOpAdaptor(QuantizeAndDequantizeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class QuantizeAndDequantizeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = QuantizeAndDequantizeOpAdaptor; + template + using GenericAdaptor = QuantizeAndDequantizeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("input_max"), ::llvm::StringRef("input_min"), ::llvm::StringRef("num_bits"), ::llvm::StringRef("range_given"), ::llvm::StringRef("signed_input")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getInputMaxAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getInputMaxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getInputMinAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getInputMinAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getNumBitsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getNumBitsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getRangeGivenAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getRangeGivenAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getSignedInputAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getSignedInputAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.QuantizeAndDequantize"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getSignedInputAttr(); + bool getSignedInput(); + ::mlir::IntegerAttr getNumBitsAttr(); + uint64_t getNumBits(); + ::mlir::BoolAttr getRangeGivenAttr(); + bool getRangeGiven(); + ::mlir::FloatAttr getInputMinAttr(); + ::llvm::APFloat getInputMin(); + ::mlir::FloatAttr getInputMaxAttr(); + ::llvm::APFloat getInputMax(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setSignedInputAttr(::mlir::BoolAttr attr); + void setSignedInput(::std::optional attrValue); + void setNumBitsAttr(::mlir::IntegerAttr attr); + void setNumBits(::std::optional attrValue); + void setRangeGivenAttr(::mlir::BoolAttr attr); + void setRangeGiven(::std::optional attrValue); + void setInputMinAttr(::mlir::FloatAttr attr); + void setInputMin(::std::optional<::llvm::APFloat> attrValue); + void setInputMaxAttr(::mlir::FloatAttr attr); + void setInputMax(::std::optional<::llvm::APFloat> attrValue); + ::mlir::Attribute removeSignedInputAttr(); + ::mlir::Attribute removeNumBitsAttr(); + ::mlir::Attribute removeRangeGivenAttr(); + ::mlir::Attribute removeInputMinAttr(); + ::mlir::Attribute removeInputMaxAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, /*optional*/::mlir::BoolAttr signed_input, /*optional*/::mlir::IntegerAttr num_bits, /*optional*/::mlir::BoolAttr range_given, /*optional*/::mlir::FloatAttr input_min, /*optional*/::mlir::FloatAttr input_max); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, /*optional*/::mlir::BoolAttr signed_input, /*optional*/::mlir::IntegerAttr num_bits, /*optional*/::mlir::BoolAttr range_given, /*optional*/::mlir::FloatAttr input_min, /*optional*/::mlir::FloatAttr input_max); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, /*optional*/::mlir::BoolAttr signed_input, /*optional*/::mlir::IntegerAttr num_bits, /*optional*/::mlir::BoolAttr range_given, /*optional*/::mlir::FloatAttr input_min, /*optional*/::mlir::FloatAttr input_max); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, /*optional*/bool signed_input, /*optional*/uint64_t num_bits, /*optional*/bool range_given, /*optional*/::llvm::APFloat input_min, /*optional*/::llvm::APFloat input_max); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, /*optional*/bool signed_input, /*optional*/uint64_t num_bits, /*optional*/bool range_given, /*optional*/::llvm::APFloat input_min, /*optional*/::llvm::APFloat input_max); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, /*optional*/bool signed_input, /*optional*/uint64_t num_bits, /*optional*/bool range_given, /*optional*/::llvm::APFloat input_min, /*optional*/::llvm::APFloat input_max); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::QuantizeAndDequantizeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::QuantizeAndDequantizeV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class QuantizeAndDequantizeV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + QuantizeAndDequantizeV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + QuantizeAndDequantizeV2OpGenericAdaptorBase(QuantizeAndDequantizeV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getSignedInputAttr(); + bool getSignedInput(); + ::mlir::IntegerAttr getNumBitsAttr(); + uint64_t getNumBits(); + ::mlir::BoolAttr getRangeGivenAttr(); + bool getRangeGiven(); + ::mlir::StringAttr getRoundModeAttr(); + ::llvm::StringRef getRoundMode(); + ::mlir::BoolAttr getNarrowRangeAttr(); + bool getNarrowRange(); + ::mlir::IntegerAttr getAxisAttr(); + uint64_t getAxis(); +}; +} // namespace detail +template +class QuantizeAndDequantizeV2OpGenericAdaptor : public detail::QuantizeAndDequantizeV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::QuantizeAndDequantizeV2OpGenericAdaptorBase; +public: + QuantizeAndDequantizeV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + QuantizeAndDequantizeV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : QuantizeAndDequantizeV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + QuantizeAndDequantizeV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getInputMin() { + return (*getODSOperands(1).begin()); + } + + ValueT getInputMax() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class QuantizeAndDequantizeV2OpAdaptor : public QuantizeAndDequantizeV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using QuantizeAndDequantizeV2OpGenericAdaptor::QuantizeAndDequantizeV2OpGenericAdaptor; + QuantizeAndDequantizeV2OpAdaptor(QuantizeAndDequantizeV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class QuantizeAndDequantizeV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = QuantizeAndDequantizeV2OpAdaptor; + template + using GenericAdaptor = QuantizeAndDequantizeV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("axis"), ::llvm::StringRef("narrow_range"), ::llvm::StringRef("num_bits"), ::llvm::StringRef("range_given"), ::llvm::StringRef("round_mode"), ::llvm::StringRef("signed_input")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAxisAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAxisAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getNarrowRangeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getNarrowRangeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getNumBitsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getNumBitsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getRangeGivenAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getRangeGivenAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getRoundModeAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getRoundModeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getSignedInputAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getSignedInputAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.QuantizeAndDequantizeV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getInputMin(); + ::mlir::TypedValue<::mlir::TensorType> getInputMax(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getInputMinMutable(); + ::mlir::OpOperand &getInputMaxMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getSignedInputAttr(); + bool getSignedInput(); + ::mlir::IntegerAttr getNumBitsAttr(); + uint64_t getNumBits(); + ::mlir::BoolAttr getRangeGivenAttr(); + bool getRangeGiven(); + ::mlir::StringAttr getRoundModeAttr(); + ::llvm::StringRef getRoundMode(); + ::mlir::BoolAttr getNarrowRangeAttr(); + bool getNarrowRange(); + ::mlir::IntegerAttr getAxisAttr(); + uint64_t getAxis(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setSignedInputAttr(::mlir::BoolAttr attr); + void setSignedInput(::std::optional attrValue); + void setNumBitsAttr(::mlir::IntegerAttr attr); + void setNumBits(::std::optional attrValue); + void setRangeGivenAttr(::mlir::BoolAttr attr); + void setRangeGiven(::std::optional attrValue); + void setRoundModeAttr(::mlir::StringAttr attr); + void setRoundMode(::std::optional<::llvm::StringRef> attrValue); + void setNarrowRangeAttr(::mlir::BoolAttr attr); + void setNarrowRange(::std::optional attrValue); + void setAxisAttr(::mlir::IntegerAttr attr); + void setAxis(::std::optional attrValue); + ::mlir::Attribute removeSignedInputAttr(); + ::mlir::Attribute removeNumBitsAttr(); + ::mlir::Attribute removeRangeGivenAttr(); + ::mlir::Attribute removeRoundModeAttr(); + ::mlir::Attribute removeNarrowRangeAttr(); + ::mlir::Attribute removeAxisAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value input_min, ::mlir::Value input_max, /*optional*/::mlir::BoolAttr signed_input, /*optional*/::mlir::IntegerAttr num_bits, /*optional*/::mlir::BoolAttr range_given, /*optional*/::mlir::StringAttr round_mode, /*optional*/::mlir::BoolAttr narrow_range, /*optional*/::mlir::IntegerAttr axis); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value input_min, ::mlir::Value input_max, /*optional*/::mlir::BoolAttr signed_input, /*optional*/::mlir::IntegerAttr num_bits, /*optional*/::mlir::BoolAttr range_given, /*optional*/::mlir::StringAttr round_mode, /*optional*/::mlir::BoolAttr narrow_range, /*optional*/::mlir::IntegerAttr axis); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value input_min, ::mlir::Value input_max, /*optional*/bool signed_input = true, /*optional*/uint64_t num_bits = 8, /*optional*/bool range_given = false, /*optional*/::llvm::StringRef round_mode = "HALF_TO_EVEN", /*optional*/bool narrow_range = false, /*optional*/uint64_t axis = -1); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value input_min, ::mlir::Value input_max, /*optional*/bool signed_input = true, /*optional*/uint64_t num_bits = 8, /*optional*/bool range_given = false, /*optional*/::llvm::StringRef round_mode = "HALF_TO_EVEN", /*optional*/bool narrow_range = false, /*optional*/uint64_t axis = -1); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 7 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::QuantizeAndDequantizeV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::QuantizeAndDequantizeV3Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class QuantizeAndDequantizeV3OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + QuantizeAndDequantizeV3OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + QuantizeAndDequantizeV3OpGenericAdaptorBase(QuantizeAndDequantizeV3Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getSignedInputAttr(); + bool getSignedInput(); + ::mlir::BoolAttr getRangeGivenAttr(); + bool getRangeGiven(); + ::mlir::BoolAttr getNarrowRangeAttr(); + bool getNarrowRange(); + ::mlir::IntegerAttr getAxisAttr(); + uint64_t getAxis(); +}; +} // namespace detail +template +class QuantizeAndDequantizeV3OpGenericAdaptor : public detail::QuantizeAndDequantizeV3OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::QuantizeAndDequantizeV3OpGenericAdaptorBase; +public: + QuantizeAndDequantizeV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + QuantizeAndDequantizeV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : QuantizeAndDequantizeV3OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + QuantizeAndDequantizeV3OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getInputMin() { + return (*getODSOperands(1).begin()); + } + + ValueT getInputMax() { + return (*getODSOperands(2).begin()); + } + + ValueT getNumBits() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class QuantizeAndDequantizeV3OpAdaptor : public QuantizeAndDequantizeV3OpGenericAdaptor<::mlir::ValueRange> { +public: + using QuantizeAndDequantizeV3OpGenericAdaptor::QuantizeAndDequantizeV3OpGenericAdaptor; + QuantizeAndDequantizeV3OpAdaptor(QuantizeAndDequantizeV3Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class QuantizeAndDequantizeV3Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = QuantizeAndDequantizeV3OpAdaptor; + template + using GenericAdaptor = QuantizeAndDequantizeV3OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("axis"), ::llvm::StringRef("narrow_range"), ::llvm::StringRef("range_given"), ::llvm::StringRef("signed_input")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAxisAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAxisAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getNarrowRangeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getNarrowRangeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getRangeGivenAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getRangeGivenAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getSignedInputAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getSignedInputAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.QuantizeAndDequantizeV3"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getInputMin(); + ::mlir::TypedValue<::mlir::TensorType> getInputMax(); + ::mlir::TypedValue<::mlir::TensorType> getNumBits(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getInputMinMutable(); + ::mlir::OpOperand &getInputMaxMutable(); + ::mlir::OpOperand &getNumBitsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getSignedInputAttr(); + bool getSignedInput(); + ::mlir::BoolAttr getRangeGivenAttr(); + bool getRangeGiven(); + ::mlir::BoolAttr getNarrowRangeAttr(); + bool getNarrowRange(); + ::mlir::IntegerAttr getAxisAttr(); + uint64_t getAxis(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setSignedInputAttr(::mlir::BoolAttr attr); + void setSignedInput(::std::optional attrValue); + void setRangeGivenAttr(::mlir::BoolAttr attr); + void setRangeGiven(::std::optional attrValue); + void setNarrowRangeAttr(::mlir::BoolAttr attr); + void setNarrowRange(::std::optional attrValue); + void setAxisAttr(::mlir::IntegerAttr attr); + void setAxis(::std::optional attrValue); + ::mlir::Attribute removeSignedInputAttr(); + ::mlir::Attribute removeRangeGivenAttr(); + ::mlir::Attribute removeNarrowRangeAttr(); + ::mlir::Attribute removeAxisAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value input_min, ::mlir::Value input_max, ::mlir::Value num_bits, /*optional*/::mlir::BoolAttr signed_input, /*optional*/::mlir::BoolAttr range_given, /*optional*/::mlir::BoolAttr narrow_range, /*optional*/::mlir::IntegerAttr axis); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value input_min, ::mlir::Value input_max, ::mlir::Value num_bits, /*optional*/::mlir::BoolAttr signed_input, /*optional*/::mlir::BoolAttr range_given, /*optional*/::mlir::BoolAttr narrow_range, /*optional*/::mlir::IntegerAttr axis); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value input_min, ::mlir::Value input_max, ::mlir::Value num_bits, /*optional*/bool signed_input = true, /*optional*/bool range_given = true, /*optional*/bool narrow_range = false, /*optional*/uint64_t axis = -1); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value input_min, ::mlir::Value input_max, ::mlir::Value num_bits, /*optional*/bool signed_input = true, /*optional*/bool range_given = true, /*optional*/bool narrow_range = false, /*optional*/uint64_t axis = -1); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::QuantizeAndDequantizeV3Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::QuantizeAndDequantizeV4Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class QuantizeAndDequantizeV4OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + QuantizeAndDequantizeV4OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + QuantizeAndDequantizeV4OpGenericAdaptorBase(QuantizeAndDequantizeV4Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getSignedInputAttr(); + bool getSignedInput(); + ::mlir::IntegerAttr getNumBitsAttr(); + uint64_t getNumBits(); + ::mlir::BoolAttr getRangeGivenAttr(); + bool getRangeGiven(); + ::mlir::StringAttr getRoundModeAttr(); + ::llvm::StringRef getRoundMode(); + ::mlir::BoolAttr getNarrowRangeAttr(); + bool getNarrowRange(); + ::mlir::IntegerAttr getAxisAttr(); + uint64_t getAxis(); +}; +} // namespace detail +template +class QuantizeAndDequantizeV4OpGenericAdaptor : public detail::QuantizeAndDequantizeV4OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::QuantizeAndDequantizeV4OpGenericAdaptorBase; +public: + QuantizeAndDequantizeV4OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + QuantizeAndDequantizeV4OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : QuantizeAndDequantizeV4OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + QuantizeAndDequantizeV4OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getInputMin() { + return (*getODSOperands(1).begin()); + } + + ValueT getInputMax() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class QuantizeAndDequantizeV4OpAdaptor : public QuantizeAndDequantizeV4OpGenericAdaptor<::mlir::ValueRange> { +public: + using QuantizeAndDequantizeV4OpGenericAdaptor::QuantizeAndDequantizeV4OpGenericAdaptor; + QuantizeAndDequantizeV4OpAdaptor(QuantizeAndDequantizeV4Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class QuantizeAndDequantizeV4Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = QuantizeAndDequantizeV4OpAdaptor; + template + using GenericAdaptor = QuantizeAndDequantizeV4OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("axis"), ::llvm::StringRef("narrow_range"), ::llvm::StringRef("num_bits"), ::llvm::StringRef("range_given"), ::llvm::StringRef("round_mode"), ::llvm::StringRef("signed_input")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAxisAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAxisAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getNarrowRangeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getNarrowRangeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getNumBitsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getNumBitsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getRangeGivenAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getRangeGivenAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getRoundModeAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getRoundModeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getSignedInputAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getSignedInputAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.QuantizeAndDequantizeV4"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getInputMin(); + ::mlir::TypedValue<::mlir::TensorType> getInputMax(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getInputMinMutable(); + ::mlir::OpOperand &getInputMaxMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getSignedInputAttr(); + bool getSignedInput(); + ::mlir::IntegerAttr getNumBitsAttr(); + uint64_t getNumBits(); + ::mlir::BoolAttr getRangeGivenAttr(); + bool getRangeGiven(); + ::mlir::StringAttr getRoundModeAttr(); + ::llvm::StringRef getRoundMode(); + ::mlir::BoolAttr getNarrowRangeAttr(); + bool getNarrowRange(); + ::mlir::IntegerAttr getAxisAttr(); + uint64_t getAxis(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setSignedInputAttr(::mlir::BoolAttr attr); + void setSignedInput(::std::optional attrValue); + void setNumBitsAttr(::mlir::IntegerAttr attr); + void setNumBits(::std::optional attrValue); + void setRangeGivenAttr(::mlir::BoolAttr attr); + void setRangeGiven(::std::optional attrValue); + void setRoundModeAttr(::mlir::StringAttr attr); + void setRoundMode(::std::optional<::llvm::StringRef> attrValue); + void setNarrowRangeAttr(::mlir::BoolAttr attr); + void setNarrowRange(::std::optional attrValue); + void setAxisAttr(::mlir::IntegerAttr attr); + void setAxis(::std::optional attrValue); + ::mlir::Attribute removeSignedInputAttr(); + ::mlir::Attribute removeNumBitsAttr(); + ::mlir::Attribute removeRangeGivenAttr(); + ::mlir::Attribute removeRoundModeAttr(); + ::mlir::Attribute removeNarrowRangeAttr(); + ::mlir::Attribute removeAxisAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value input_min, ::mlir::Value input_max, /*optional*/::mlir::BoolAttr signed_input, /*optional*/::mlir::IntegerAttr num_bits, /*optional*/::mlir::BoolAttr range_given, /*optional*/::mlir::StringAttr round_mode, /*optional*/::mlir::BoolAttr narrow_range, /*optional*/::mlir::IntegerAttr axis); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value input_min, ::mlir::Value input_max, /*optional*/::mlir::BoolAttr signed_input, /*optional*/::mlir::IntegerAttr num_bits, /*optional*/::mlir::BoolAttr range_given, /*optional*/::mlir::StringAttr round_mode, /*optional*/::mlir::BoolAttr narrow_range, /*optional*/::mlir::IntegerAttr axis); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value input_min, ::mlir::Value input_max, /*optional*/bool signed_input = true, /*optional*/uint64_t num_bits = 8, /*optional*/bool range_given = false, /*optional*/::llvm::StringRef round_mode = "HALF_TO_EVEN", /*optional*/bool narrow_range = false, /*optional*/uint64_t axis = -1); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value input_min, ::mlir::Value input_max, /*optional*/bool signed_input = true, /*optional*/uint64_t num_bits = 8, /*optional*/bool range_given = false, /*optional*/::llvm::StringRef round_mode = "HALF_TO_EVEN", /*optional*/bool narrow_range = false, /*optional*/uint64_t axis = -1); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 7 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::QuantizeAndDequantizeV4Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::QuantizeV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class QuantizeV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + QuantizeV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + QuantizeV2OpGenericAdaptorBase(QuantizeV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getModeAttr(); + ::llvm::StringRef getMode(); + ::mlir::StringAttr getRoundModeAttr(); + ::llvm::StringRef getRoundMode(); + ::mlir::BoolAttr getNarrowRangeAttr(); + bool getNarrowRange(); + ::mlir::IntegerAttr getAxisAttr(); + uint64_t getAxis(); + ::mlir::FloatAttr getEnsureMinimumRangeAttr(); + ::llvm::APFloat getEnsureMinimumRange(); +}; +} // namespace detail +template +class QuantizeV2OpGenericAdaptor : public detail::QuantizeV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::QuantizeV2OpGenericAdaptorBase; +public: + QuantizeV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + QuantizeV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : QuantizeV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + QuantizeV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getMinRange() { + return (*getODSOperands(1).begin()); + } + + ValueT getMaxRange() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class QuantizeV2OpAdaptor : public QuantizeV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using QuantizeV2OpGenericAdaptor::QuantizeV2OpGenericAdaptor; + QuantizeV2OpAdaptor(QuantizeV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class QuantizeV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = QuantizeV2OpAdaptor; + template + using GenericAdaptor = QuantizeV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("axis"), ::llvm::StringRef("ensure_minimum_range"), ::llvm::StringRef("mode"), ::llvm::StringRef("narrow_range"), ::llvm::StringRef("round_mode")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAxisAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAxisAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getEnsureMinimumRangeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getEnsureMinimumRangeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getModeAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getModeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getNarrowRangeAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getNarrowRangeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getRoundModeAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getRoundModeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.QuantizeV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getMinRange(); + ::mlir::TypedValue<::mlir::TensorType> getMaxRange(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getMinRangeMutable(); + ::mlir::OpOperand &getMaxRangeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::TypedValue<::mlir::TensorType> getOutputMin(); + ::mlir::TypedValue<::mlir::TensorType> getOutputMax(); + ::mlir::StringAttr getModeAttr(); + ::llvm::StringRef getMode(); + ::mlir::StringAttr getRoundModeAttr(); + ::llvm::StringRef getRoundMode(); + ::mlir::BoolAttr getNarrowRangeAttr(); + bool getNarrowRange(); + ::mlir::IntegerAttr getAxisAttr(); + uint64_t getAxis(); + ::mlir::FloatAttr getEnsureMinimumRangeAttr(); + ::llvm::APFloat getEnsureMinimumRange(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setModeAttr(::mlir::StringAttr attr); + void setMode(::std::optional<::llvm::StringRef> attrValue); + void setRoundModeAttr(::mlir::StringAttr attr); + void setRoundMode(::std::optional<::llvm::StringRef> attrValue); + void setNarrowRangeAttr(::mlir::BoolAttr attr); + void setNarrowRange(::std::optional attrValue); + void setAxisAttr(::mlir::IntegerAttr attr); + void setAxis(::std::optional attrValue); + void setEnsureMinimumRangeAttr(::mlir::FloatAttr attr); + void setEnsureMinimumRange(::std::optional<::llvm::APFloat> attrValue); + ::mlir::Attribute removeModeAttr(); + ::mlir::Attribute removeRoundModeAttr(); + ::mlir::Attribute removeNarrowRangeAttr(); + ::mlir::Attribute removeAxisAttr(); + ::mlir::Attribute removeEnsureMinimumRangeAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Type output_min, ::mlir::Type output_max, ::mlir::Value input, ::mlir::Value min_range, ::mlir::Value max_range, /*optional*/::mlir::StringAttr mode, /*optional*/::mlir::StringAttr round_mode, /*optional*/::mlir::BoolAttr narrow_range, /*optional*/::mlir::IntegerAttr axis, /*optional*/::mlir::FloatAttr ensure_minimum_range); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value min_range, ::mlir::Value max_range, /*optional*/::mlir::StringAttr mode, /*optional*/::mlir::StringAttr round_mode, /*optional*/::mlir::BoolAttr narrow_range, /*optional*/::mlir::IntegerAttr axis, /*optional*/::mlir::FloatAttr ensure_minimum_range); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Type output_min, ::mlir::Type output_max, ::mlir::Value input, ::mlir::Value min_range, ::mlir::Value max_range, /*optional*/::llvm::StringRef mode, /*optional*/::llvm::StringRef round_mode, /*optional*/bool narrow_range, /*optional*/uint64_t axis, /*optional*/::llvm::APFloat ensure_minimum_range); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value min_range, ::mlir::Value max_range, /*optional*/::llvm::StringRef mode, /*optional*/::llvm::StringRef round_mode, /*optional*/bool narrow_range, /*optional*/uint64_t axis, /*optional*/::llvm::APFloat ensure_minimum_range); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::QuantizeV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::QueueDequeueV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class QueueDequeueV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + QueueDequeueV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + QueueDequeueV2OpGenericAdaptorBase(QueueDequeueV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTimeoutMsAttr(); + uint64_t getTimeoutMs(); +}; +} // namespace detail +template +class QueueDequeueV2OpGenericAdaptor : public detail::QueueDequeueV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::QueueDequeueV2OpGenericAdaptorBase; +public: + QueueDequeueV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + QueueDequeueV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : QueueDequeueV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + QueueDequeueV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getHandle() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class QueueDequeueV2OpAdaptor : public QueueDequeueV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using QueueDequeueV2OpGenericAdaptor::QueueDequeueV2OpGenericAdaptor; + QueueDequeueV2OpAdaptor(QueueDequeueV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class QueueDequeueV2Op : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = QueueDequeueV2OpAdaptor; + template + using GenericAdaptor = QueueDequeueV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("component_types"), ::llvm::StringRef("timeout_ms")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getComponentTypesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getComponentTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTimeoutMsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTimeoutMsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.QueueDequeueV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::OpOperand &getHandleMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getComponents(); + ::mlir::IntegerAttr getTimeoutMsAttr(); + uint64_t getTimeoutMs(); + mlir::ResultElementTypeRange getComponentTypes(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setTimeoutMsAttr(::mlir::IntegerAttr attr); + void setTimeoutMs(::std::optional attrValue); + ::mlir::Attribute removeTimeoutMsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange components, ::mlir::Value handle, /*optional*/::mlir::IntegerAttr timeout_ms); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange components, ::mlir::Value handle, /*optional*/uint64_t timeout_ms = -1); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::QueueDequeueV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RFFT2DOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RFFT2DOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RFFT2DOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RFFT2DOpGenericAdaptorBase(RFFT2DOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RFFT2DOpGenericAdaptor : public detail::RFFT2DOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RFFT2DOpGenericAdaptorBase; +public: + RFFT2DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RFFT2DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RFFT2DOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RFFT2DOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getFftLength() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RFFT2DOpAdaptor : public RFFT2DOpGenericAdaptor<::mlir::ValueRange> { +public: + using RFFT2DOpGenericAdaptor::RFFT2DOpGenericAdaptor; + RFFT2DOpAdaptor(RFFT2DOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RFFT2DOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RFFT2DOpAdaptor; + template + using GenericAdaptor = RFFT2DOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tcomplex"), ::llvm::StringRef("Treal")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTcomplexAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTcomplexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTrealAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTrealAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RFFT2D"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getFftLength(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getFftLengthMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getTreal(); + ::mlir::Type getTcomplex(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value fft_length); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value fft_length); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RFFT2DOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RFFT3DOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RFFT3DOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RFFT3DOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RFFT3DOpGenericAdaptorBase(RFFT3DOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RFFT3DOpGenericAdaptor : public detail::RFFT3DOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RFFT3DOpGenericAdaptorBase; +public: + RFFT3DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RFFT3DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RFFT3DOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RFFT3DOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getFftLength() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RFFT3DOpAdaptor : public RFFT3DOpGenericAdaptor<::mlir::ValueRange> { +public: + using RFFT3DOpGenericAdaptor::RFFT3DOpGenericAdaptor; + RFFT3DOpAdaptor(RFFT3DOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RFFT3DOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RFFT3DOpAdaptor; + template + using GenericAdaptor = RFFT3DOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tcomplex"), ::llvm::StringRef("Treal")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTcomplexAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTcomplexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTrealAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTrealAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RFFT3D"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getFftLength(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getFftLengthMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getTreal(); + ::mlir::Type getTcomplex(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value fft_length); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value fft_length); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RFFT3DOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RFFTOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RFFTOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RFFTOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RFFTOpGenericAdaptorBase(RFFTOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RFFTOpGenericAdaptor : public detail::RFFTOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RFFTOpGenericAdaptorBase; +public: + RFFTOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RFFTOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RFFTOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RFFTOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getFftLength() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RFFTOpAdaptor : public RFFTOpGenericAdaptor<::mlir::ValueRange> { +public: + using RFFTOpGenericAdaptor::RFFTOpGenericAdaptor; + RFFTOpAdaptor(RFFTOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RFFTOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RFFTOpAdaptor; + template + using GenericAdaptor = RFFTOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tcomplex"), ::llvm::StringRef("Treal")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTcomplexAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTcomplexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTrealAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTrealAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RFFT"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getFftLength(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getFftLengthMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getTreal(); + ::mlir::Type getTcomplex(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value fft_length); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value fft_length); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RFFTOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RGBToHSVOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RGBToHSVOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RGBToHSVOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RGBToHSVOpGenericAdaptorBase(RGBToHSVOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RGBToHSVOpGenericAdaptor : public detail::RGBToHSVOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RGBToHSVOpGenericAdaptorBase; +public: + RGBToHSVOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RGBToHSVOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RGBToHSVOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RGBToHSVOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getImages() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RGBToHSVOpAdaptor : public RGBToHSVOpGenericAdaptor<::mlir::ValueRange> { +public: + using RGBToHSVOpGenericAdaptor::RGBToHSVOpGenericAdaptor; + RGBToHSVOpAdaptor(RGBToHSVOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RGBToHSVOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RGBToHSVOpAdaptor; + template + using GenericAdaptor = RGBToHSVOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RGBToHSV"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getImages(); + ::mlir::OpOperand &getImagesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value images); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value images); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RGBToHSVOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RaggedGatherOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RaggedGatherOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RaggedGatherOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RaggedGatherOpGenericAdaptorBase(RaggedGatherOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RaggedGatherOpGenericAdaptor : public detail::RaggedGatherOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RaggedGatherOpGenericAdaptorBase; +public: + RaggedGatherOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RaggedGatherOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RaggedGatherOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RaggedGatherOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getParamsNestedSplits() { + return getODSOperands(0); + } + + ValueT getParamsDenseValues() { + return (*getODSOperands(1).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RaggedGatherOpAdaptor : public RaggedGatherOpGenericAdaptor<::mlir::ValueRange> { +public: + using RaggedGatherOpGenericAdaptor::RaggedGatherOpGenericAdaptor; + RaggedGatherOpAdaptor(RaggedGatherOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RaggedGatherOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RaggedGatherOpAdaptor; + template + using GenericAdaptor = RaggedGatherOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("OUTPUT_RAGGED_RANK"), ::llvm::StringRef("PARAMS_RAGGED_RANK"), ::llvm::StringRef("Tindices"), ::llvm::StringRef("Tsplits"), ::llvm::StringRef("Tvalues")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOUTPUT_RAGGED_RANKAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getOUTPUT_RAGGED_RANKAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getPARAMS_RAGGED_RANKAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getPARAMS_RAGGED_RANKAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTsplitsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTsplitsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTvaluesAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTvaluesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RaggedGather"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getParamsNestedSplits(); + ::mlir::TypedValue<::mlir::TensorType> getParamsDenseValues(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::MutableOperandRange getParamsNestedSplitsMutable(); + ::mlir::OpOperand &getParamsDenseValuesMutable(); + ::mlir::OpOperand &getIndicesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutputNestedSplits(); + ::mlir::TypedValue<::mlir::TensorType> getOutputDenseValues(); + size_t getPARAMS_RAGGED_RANK(); + ::mlir::Type getTindices(); + ::mlir::Type getTsplits(); + ::mlir::Type getTvalues(); + size_t getOUTPUT_RAGGED_RANK(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output_nested_splits, ::mlir::Type output_dense_values, ::mlir::ValueRange params_nested_splits, ::mlir::Value params_dense_values, ::mlir::Value indices); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange params_nested_splits, ::mlir::Value params_dense_values, ::mlir::Value indices); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RaggedGatherOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RaggedRangeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RaggedRangeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RaggedRangeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RaggedRangeOpGenericAdaptorBase(RaggedRangeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RaggedRangeOpGenericAdaptor : public detail::RaggedRangeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RaggedRangeOpGenericAdaptorBase; +public: + RaggedRangeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RaggedRangeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RaggedRangeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RaggedRangeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getStarts() { + return (*getODSOperands(0).begin()); + } + + ValueT getLimits() { + return (*getODSOperands(1).begin()); + } + + ValueT getDeltas() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RaggedRangeOpAdaptor : public RaggedRangeOpGenericAdaptor<::mlir::ValueRange> { +public: + using RaggedRangeOpGenericAdaptor::RaggedRangeOpGenericAdaptor; + RaggedRangeOpAdaptor(RaggedRangeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RaggedRangeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RaggedRangeOpAdaptor; + template + using GenericAdaptor = RaggedRangeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tsplits")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTsplitsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTsplitsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RaggedRange"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getStarts(); + ::mlir::TypedValue<::mlir::TensorType> getLimits(); + ::mlir::TypedValue<::mlir::TensorType> getDeltas(); + ::mlir::OpOperand &getStartsMutable(); + ::mlir::OpOperand &getLimitsMutable(); + ::mlir::OpOperand &getDeltasMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getRtNestedSplits(); + ::mlir::TypedValue<::mlir::TensorType> getRtDenseValues(); + ::mlir::Type getT(); + ::mlir::Type getTsplits(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type rt_nested_splits, ::mlir::Type rt_dense_values, ::mlir::Value starts, ::mlir::Value limits, ::mlir::Value deltas); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value starts, ::mlir::Value limits, ::mlir::Value deltas); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RaggedRangeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RandomGammaGradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RandomGammaGradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RandomGammaGradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RandomGammaGradOpGenericAdaptorBase(RandomGammaGradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RandomGammaGradOpGenericAdaptor : public detail::RandomGammaGradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RandomGammaGradOpGenericAdaptorBase; +public: + RandomGammaGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RandomGammaGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RandomGammaGradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RandomGammaGradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getAlpha() { + return (*getODSOperands(0).begin()); + } + + ValueT getSample() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RandomGammaGradOpAdaptor : public RandomGammaGradOpGenericAdaptor<::mlir::ValueRange> { +public: + using RandomGammaGradOpGenericAdaptor::RandomGammaGradOpGenericAdaptor; + RandomGammaGradOpAdaptor(RandomGammaGradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RandomGammaGradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RandomGammaGradOpAdaptor; + template + using GenericAdaptor = RandomGammaGradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RandomGammaGrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getAlpha(); + ::mlir::TypedValue<::mlir::TensorType> getSample(); + ::mlir::OpOperand &getAlphaMutable(); + ::mlir::OpOperand &getSampleMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value alpha, ::mlir::Value sample); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value alpha, ::mlir::Value sample); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RandomGammaGradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RandomGammaOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RandomGammaOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RandomGammaOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RandomGammaOpGenericAdaptorBase(RandomGammaOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getSeedAttr(); + uint64_t getSeed(); + ::mlir::IntegerAttr getSeed2Attr(); + uint64_t getSeed2(); +}; +} // namespace detail +template +class RandomGammaOpGenericAdaptor : public detail::RandomGammaOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RandomGammaOpGenericAdaptorBase; +public: + RandomGammaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RandomGammaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RandomGammaOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RandomGammaOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getShape() { + return (*getODSOperands(0).begin()); + } + + ValueT getAlpha() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RandomGammaOpAdaptor : public RandomGammaOpGenericAdaptor<::mlir::ValueRange> { +public: + using RandomGammaOpGenericAdaptor::RandomGammaOpGenericAdaptor; + RandomGammaOpAdaptor(RandomGammaOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RandomGammaOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::TF::CannotDuplicate, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RandomGammaOpAdaptor; + template + using GenericAdaptor = RandomGammaOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("S"), ::llvm::StringRef("T"), ::llvm::StringRef("seed"), ::llvm::StringRef("seed2")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getSAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getSAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getSeedAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getSeedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSeed2AttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSeed2AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RandomGamma"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::TypedValue<::mlir::TensorType> getAlpha(); + ::mlir::OpOperand &getShapeMutable(); + ::mlir::OpOperand &getAlphaMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getSeedAttr(); + uint64_t getSeed(); + ::mlir::IntegerAttr getSeed2Attr(); + uint64_t getSeed2(); + ::mlir::Type getS(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setSeedAttr(::mlir::IntegerAttr attr); + void setSeed(::std::optional attrValue); + void setSeed2Attr(::mlir::IntegerAttr attr); + void setSeed2(::std::optional attrValue); + ::mlir::Attribute removeSeedAttr(); + ::mlir::Attribute removeSeed2Attr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, ::mlir::Value alpha, /*optional*/::mlir::IntegerAttr seed, /*optional*/::mlir::IntegerAttr seed2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, ::mlir::Value alpha, /*optional*/::mlir::IntegerAttr seed, /*optional*/::mlir::IntegerAttr seed2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, ::mlir::Value alpha, /*optional*/uint64_t seed = 0, /*optional*/uint64_t seed2 = 0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, ::mlir::Value alpha, /*optional*/uint64_t seed = 0, /*optional*/uint64_t seed2 = 0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RandomGammaOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RandomPoissonOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RandomPoissonOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RandomPoissonOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RandomPoissonOpGenericAdaptorBase(RandomPoissonOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getSeedAttr(); + uint64_t getSeed(); + ::mlir::IntegerAttr getSeed2Attr(); + uint64_t getSeed2(); +}; +} // namespace detail +template +class RandomPoissonOpGenericAdaptor : public detail::RandomPoissonOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RandomPoissonOpGenericAdaptorBase; +public: + RandomPoissonOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RandomPoissonOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RandomPoissonOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RandomPoissonOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getShape() { + return (*getODSOperands(0).begin()); + } + + ValueT getRate() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RandomPoissonOpAdaptor : public RandomPoissonOpGenericAdaptor<::mlir::ValueRange> { +public: + using RandomPoissonOpGenericAdaptor::RandomPoissonOpGenericAdaptor; + RandomPoissonOpAdaptor(RandomPoissonOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RandomPoissonOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::TF::CannotDuplicate, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RandomPoissonOpAdaptor; + template + using GenericAdaptor = RandomPoissonOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("S"), ::llvm::StringRef("dtype"), ::llvm::StringRef("seed"), ::llvm::StringRef("seed2")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getSAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getSAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getSeedAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getSeedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSeed2AttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSeed2AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RandomPoisson"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::TypedValue<::mlir::TensorType> getRate(); + ::mlir::OpOperand &getShapeMutable(); + ::mlir::OpOperand &getRateMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getSeedAttr(); + uint64_t getSeed(); + ::mlir::IntegerAttr getSeed2Attr(); + uint64_t getSeed2(); + ::mlir::Type getS(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setSeedAttr(::mlir::IntegerAttr attr); + void setSeed(::std::optional attrValue); + void setSeed2Attr(::mlir::IntegerAttr attr); + void setSeed2(::std::optional attrValue); + ::mlir::Attribute removeSeedAttr(); + ::mlir::Attribute removeSeed2Attr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, ::mlir::Value rate, /*optional*/::mlir::IntegerAttr seed, /*optional*/::mlir::IntegerAttr seed2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, ::mlir::Value rate, /*optional*/::mlir::IntegerAttr seed, /*optional*/::mlir::IntegerAttr seed2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, ::mlir::Value rate, /*optional*/uint64_t seed = 0, /*optional*/uint64_t seed2 = 0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, ::mlir::Value rate, /*optional*/uint64_t seed = 0, /*optional*/uint64_t seed2 = 0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RandomPoissonOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RandomPoissonV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RandomPoissonV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RandomPoissonV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RandomPoissonV2OpGenericAdaptorBase(RandomPoissonV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getSeedAttr(); + uint64_t getSeed(); + ::mlir::IntegerAttr getSeed2Attr(); + uint64_t getSeed2(); +}; +} // namespace detail +template +class RandomPoissonV2OpGenericAdaptor : public detail::RandomPoissonV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RandomPoissonV2OpGenericAdaptorBase; +public: + RandomPoissonV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RandomPoissonV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RandomPoissonV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RandomPoissonV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getShape() { + return (*getODSOperands(0).begin()); + } + + ValueT getRate() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RandomPoissonV2OpAdaptor : public RandomPoissonV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using RandomPoissonV2OpGenericAdaptor::RandomPoissonV2OpGenericAdaptor; + RandomPoissonV2OpAdaptor(RandomPoissonV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RandomPoissonV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::TF::CannotDuplicate, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RandomPoissonV2OpAdaptor; + template + using GenericAdaptor = RandomPoissonV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("R"), ::llvm::StringRef("S"), ::llvm::StringRef("dtype"), ::llvm::StringRef("seed"), ::llvm::StringRef("seed2")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getRAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getRAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getSAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getSAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSeedAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSeedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getSeed2AttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getSeed2AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RandomPoissonV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::TypedValue<::mlir::TensorType> getRate(); + ::mlir::OpOperand &getShapeMutable(); + ::mlir::OpOperand &getRateMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getSeedAttr(); + uint64_t getSeed(); + ::mlir::IntegerAttr getSeed2Attr(); + uint64_t getSeed2(); + ::mlir::Type getR(); + ::mlir::Type getS(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setSeedAttr(::mlir::IntegerAttr attr); + void setSeed(::std::optional attrValue); + void setSeed2Attr(::mlir::IntegerAttr attr); + void setSeed2(::std::optional attrValue); + ::mlir::Attribute removeSeedAttr(); + ::mlir::Attribute removeSeed2Attr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, ::mlir::Value rate, /*optional*/::mlir::IntegerAttr seed, /*optional*/::mlir::IntegerAttr seed2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, ::mlir::Value rate, /*optional*/::mlir::IntegerAttr seed, /*optional*/::mlir::IntegerAttr seed2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, ::mlir::Value rate, /*optional*/uint64_t seed = 0, /*optional*/uint64_t seed2 = 0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, ::mlir::Value rate, /*optional*/uint64_t seed = 0, /*optional*/uint64_t seed2 = 0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RandomPoissonV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RandomShuffleOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RandomShuffleOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RandomShuffleOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RandomShuffleOpGenericAdaptorBase(RandomShuffleOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getSeedAttr(); + uint64_t getSeed(); + ::mlir::IntegerAttr getSeed2Attr(); + uint64_t getSeed2(); +}; +} // namespace detail +template +class RandomShuffleOpGenericAdaptor : public detail::RandomShuffleOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RandomShuffleOpGenericAdaptorBase; +public: + RandomShuffleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RandomShuffleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RandomShuffleOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RandomShuffleOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getValue() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RandomShuffleOpAdaptor : public RandomShuffleOpGenericAdaptor<::mlir::ValueRange> { +public: + using RandomShuffleOpGenericAdaptor::RandomShuffleOpGenericAdaptor; + RandomShuffleOpAdaptor(RandomShuffleOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RandomShuffleOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::TF::CannotDuplicate, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RandomShuffleOpAdaptor; + template + using GenericAdaptor = RandomShuffleOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("seed"), ::llvm::StringRef("seed2")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getSeedAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getSeedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getSeed2AttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getSeed2AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RandomShuffle"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getValue(); + ::mlir::OpOperand &getValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getSeedAttr(); + uint64_t getSeed(); + ::mlir::IntegerAttr getSeed2Attr(); + uint64_t getSeed2(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setSeedAttr(::mlir::IntegerAttr attr); + void setSeed(::std::optional attrValue); + void setSeed2Attr(::mlir::IntegerAttr attr); + void setSeed2(::std::optional attrValue); + ::mlir::Attribute removeSeedAttr(); + ::mlir::Attribute removeSeed2Attr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value value, /*optional*/::mlir::IntegerAttr seed, /*optional*/::mlir::IntegerAttr seed2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, /*optional*/::mlir::IntegerAttr seed, /*optional*/::mlir::IntegerAttr seed2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, /*optional*/::mlir::IntegerAttr seed, /*optional*/::mlir::IntegerAttr seed2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value value, /*optional*/uint64_t seed = 0, /*optional*/uint64_t seed2 = 0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value value, /*optional*/uint64_t seed = 0, /*optional*/uint64_t seed2 = 0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value, /*optional*/uint64_t seed = 0, /*optional*/uint64_t seed2 = 0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RandomShuffleOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RandomStandardNormalOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RandomStandardNormalOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RandomStandardNormalOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RandomStandardNormalOpGenericAdaptorBase(RandomStandardNormalOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getSeedAttr(); + uint64_t getSeed(); + ::mlir::IntegerAttr getSeed2Attr(); + uint64_t getSeed2(); +}; +} // namespace detail +template +class RandomStandardNormalOpGenericAdaptor : public detail::RandomStandardNormalOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RandomStandardNormalOpGenericAdaptorBase; +public: + RandomStandardNormalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RandomStandardNormalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RandomStandardNormalOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RandomStandardNormalOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getShape() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RandomStandardNormalOpAdaptor : public RandomStandardNormalOpGenericAdaptor<::mlir::ValueRange> { +public: + using RandomStandardNormalOpGenericAdaptor::RandomStandardNormalOpGenericAdaptor; + RandomStandardNormalOpAdaptor(RandomStandardNormalOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RandomStandardNormalOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::TF::CannotDuplicate, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RandomStandardNormalOpAdaptor; + template + using GenericAdaptor = RandomStandardNormalOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("dtype"), ::llvm::StringRef("seed"), ::llvm::StringRef("seed2")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getSeedAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getSeedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSeed2AttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSeed2AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RandomStandardNormal"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::OpOperand &getShapeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getSeedAttr(); + uint64_t getSeed(); + ::mlir::IntegerAttr getSeed2Attr(); + uint64_t getSeed2(); + ::mlir::Type getT(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setSeedAttr(::mlir::IntegerAttr attr); + void setSeed(::std::optional attrValue); + void setSeed2Attr(::mlir::IntegerAttr attr); + void setSeed2(::std::optional attrValue); + ::mlir::Attribute removeSeedAttr(); + ::mlir::Attribute removeSeed2Attr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, /*optional*/::mlir::IntegerAttr seed, /*optional*/::mlir::IntegerAttr seed2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, /*optional*/::mlir::IntegerAttr seed, /*optional*/::mlir::IntegerAttr seed2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, /*optional*/uint64_t seed = 0, /*optional*/uint64_t seed2 = 0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, /*optional*/uint64_t seed = 0, /*optional*/uint64_t seed2 = 0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RandomStandardNormalOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RandomUniformIntOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RandomUniformIntOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RandomUniformIntOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RandomUniformIntOpGenericAdaptorBase(RandomUniformIntOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getSeedAttr(); + uint64_t getSeed(); + ::mlir::IntegerAttr getSeed2Attr(); + uint64_t getSeed2(); +}; +} // namespace detail +template +class RandomUniformIntOpGenericAdaptor : public detail::RandomUniformIntOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RandomUniformIntOpGenericAdaptorBase; +public: + RandomUniformIntOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RandomUniformIntOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RandomUniformIntOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RandomUniformIntOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getShape() { + return (*getODSOperands(0).begin()); + } + + ValueT getMinval() { + return (*getODSOperands(1).begin()); + } + + ValueT getMaxval() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RandomUniformIntOpAdaptor : public RandomUniformIntOpGenericAdaptor<::mlir::ValueRange> { +public: + using RandomUniformIntOpGenericAdaptor::RandomUniformIntOpGenericAdaptor; + RandomUniformIntOpAdaptor(RandomUniformIntOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RandomUniformIntOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::TF::CannotDuplicate, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RandomUniformIntOpAdaptor; + template + using GenericAdaptor = RandomUniformIntOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tout"), ::llvm::StringRef("seed"), ::llvm::StringRef("seed2")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getToutAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getToutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getSeedAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getSeedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSeed2AttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSeed2AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RandomUniformInt"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::TypedValue<::mlir::TensorType> getMinval(); + ::mlir::TypedValue<::mlir::TensorType> getMaxval(); + ::mlir::OpOperand &getShapeMutable(); + ::mlir::OpOperand &getMinvalMutable(); + ::mlir::OpOperand &getMaxvalMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getSeedAttr(); + uint64_t getSeed(); + ::mlir::IntegerAttr getSeed2Attr(); + uint64_t getSeed2(); + ::mlir::Type getT(); + ::mlir::Type getTout(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setSeedAttr(::mlir::IntegerAttr attr); + void setSeed(::std::optional attrValue); + void setSeed2Attr(::mlir::IntegerAttr attr); + void setSeed2(::std::optional attrValue); + ::mlir::Attribute removeSeedAttr(); + ::mlir::Attribute removeSeed2Attr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, ::mlir::Value minval, ::mlir::Value maxval, /*optional*/::mlir::IntegerAttr seed, /*optional*/::mlir::IntegerAttr seed2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, ::mlir::Value minval, ::mlir::Value maxval, /*optional*/::mlir::IntegerAttr seed, /*optional*/::mlir::IntegerAttr seed2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, ::mlir::Value minval, ::mlir::Value maxval, /*optional*/uint64_t seed = 0, /*optional*/uint64_t seed2 = 0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, ::mlir::Value minval, ::mlir::Value maxval, /*optional*/uint64_t seed = 0, /*optional*/uint64_t seed2 = 0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RandomUniformIntOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RandomUniformOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RandomUniformOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RandomUniformOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RandomUniformOpGenericAdaptorBase(RandomUniformOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getSeedAttr(); + uint64_t getSeed(); + ::mlir::IntegerAttr getSeed2Attr(); + uint64_t getSeed2(); +}; +} // namespace detail +template +class RandomUniformOpGenericAdaptor : public detail::RandomUniformOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RandomUniformOpGenericAdaptorBase; +public: + RandomUniformOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RandomUniformOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RandomUniformOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RandomUniformOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getShape() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RandomUniformOpAdaptor : public RandomUniformOpGenericAdaptor<::mlir::ValueRange> { +public: + using RandomUniformOpGenericAdaptor::RandomUniformOpGenericAdaptor; + RandomUniformOpAdaptor(RandomUniformOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RandomUniformOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::TF::CannotDuplicate, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RandomUniformOpAdaptor; + template + using GenericAdaptor = RandomUniformOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("dtype"), ::llvm::StringRef("seed"), ::llvm::StringRef("seed2")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getSeedAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getSeedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSeed2AttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSeed2AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RandomUniform"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::OpOperand &getShapeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getSeedAttr(); + uint64_t getSeed(); + ::mlir::IntegerAttr getSeed2Attr(); + uint64_t getSeed2(); + ::mlir::Type getT(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setSeedAttr(::mlir::IntegerAttr attr); + void setSeed(::std::optional attrValue); + void setSeed2Attr(::mlir::IntegerAttr attr); + void setSeed2(::std::optional attrValue); + ::mlir::Attribute removeSeedAttr(); + ::mlir::Attribute removeSeed2Attr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, /*optional*/::mlir::IntegerAttr seed, /*optional*/::mlir::IntegerAttr seed2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, /*optional*/::mlir::IntegerAttr seed, /*optional*/::mlir::IntegerAttr seed2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, /*optional*/uint64_t seed = 0, /*optional*/uint64_t seed2 = 0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, /*optional*/uint64_t seed = 0, /*optional*/uint64_t seed2 = 0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RandomUniformOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RangeDatasetOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RangeDatasetOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RangeDatasetOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RangeDatasetOpGenericAdaptorBase(RangeDatasetOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); + ::mlir::BoolAttr getReplicateOnSplitAttr(); + bool getReplicateOnSplit(); +}; +} // namespace detail +template +class RangeDatasetOpGenericAdaptor : public detail::RangeDatasetOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RangeDatasetOpGenericAdaptorBase; +public: + RangeDatasetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RangeDatasetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RangeDatasetOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RangeDatasetOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getStart() { + return (*getODSOperands(0).begin()); + } + + ValueT getStop() { + return (*getODSOperands(1).begin()); + } + + ValueT getStep() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RangeDatasetOpAdaptor : public RangeDatasetOpGenericAdaptor<::mlir::ValueRange> { +public: + using RangeDatasetOpGenericAdaptor::RangeDatasetOpGenericAdaptor; + RangeDatasetOpAdaptor(RangeDatasetOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RangeDatasetOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold> { +public: + using Op::Op; + using Op::print; + using Adaptor = RangeDatasetOpAdaptor; + template + using GenericAdaptor = RangeDatasetOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("metadata"), ::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types"), ::llvm::StringRef("replicate_on_split")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getMetadataAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getMetadataAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getReplicateOnSplitAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getReplicateOnSplitAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RangeDataset"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getStart(); + ::mlir::TypedValue<::mlir::TensorType> getStop(); + ::mlir::TypedValue<::mlir::TensorType> getStep(); + ::mlir::OpOperand &getStartMutable(); + ::mlir::OpOperand &getStopMutable(); + ::mlir::OpOperand &getStepMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); + ::mlir::BoolAttr getReplicateOnSplitAttr(); + bool getReplicateOnSplit(); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + void setMetadataAttr(::mlir::StringAttr attr); + void setMetadata(::std::optional<::llvm::StringRef> attrValue); + void setReplicateOnSplitAttr(::mlir::BoolAttr attr); + void setReplicateOnSplit(::std::optional attrValue); + ::mlir::Attribute removeMetadataAttr(); + ::mlir::Attribute removeReplicateOnSplitAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value start, ::mlir::Value stop, ::mlir::Value step, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::StringAttr metadata, /*optional*/::mlir::BoolAttr replicate_on_split); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value start, ::mlir::Value stop, ::mlir::Value step, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::StringAttr metadata, /*optional*/::mlir::BoolAttr replicate_on_split); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value start, ::mlir::Value stop, ::mlir::Value step, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::llvm::StringRef metadata = "", /*optional*/bool replicate_on_split = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value start, ::mlir::Value stop, ::mlir::Value step, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::llvm::StringRef metadata = "", /*optional*/bool replicate_on_split = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RangeDatasetOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RangeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RangeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RangeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RangeOpGenericAdaptorBase(RangeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RangeOpGenericAdaptor : public detail::RangeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RangeOpGenericAdaptorBase; +public: + RangeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RangeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RangeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RangeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getStart() { + return (*getODSOperands(0).begin()); + } + + ValueT getLimit() { + return (*getODSOperands(1).begin()); + } + + ValueT getDelta() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RangeOpAdaptor : public RangeOpGenericAdaptor<::mlir::ValueRange> { +public: + using RangeOpGenericAdaptor::RangeOpGenericAdaptor; + RangeOpAdaptor(RangeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RangeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::SameOperandsAndResultElementTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RangeOpAdaptor; + template + using GenericAdaptor = RangeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tidx")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTidxAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTidxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Range"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getStart(); + ::mlir::TypedValue<::mlir::TensorType> getLimit(); + ::mlir::TypedValue<::mlir::TensorType> getDelta(); + ::mlir::OpOperand &getStartMutable(); + ::mlir::OpOperand &getLimitMutable(); + ::mlir::OpOperand &getDeltaMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getTidx(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value start, Value limit, Value delta); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value start, ::mlir::Value limit, ::mlir::Value delta); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value start, ::mlir::Value limit, ::mlir::Value delta); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RangeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RankOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RankOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RankOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RankOpGenericAdaptorBase(RankOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RankOpGenericAdaptor : public detail::RankOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RankOpGenericAdaptorBase; +public: + RankOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RankOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RankOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RankOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RankOpAdaptor : public RankOpGenericAdaptor<::mlir::ValueRange> { +public: + using RankOpGenericAdaptor::RankOpGenericAdaptor; + RankOpAdaptor(RankOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RankOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RankOpAdaptor; + template + using GenericAdaptor = RankOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Rank"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RankOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ReadVariableOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReadVariableOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ReadVariableOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ReadVariableOpGenericAdaptorBase(ReadVariableOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ReadVariableOpGenericAdaptor : public detail::ReadVariableOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReadVariableOpGenericAdaptorBase; +public: + ReadVariableOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReadVariableOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReadVariableOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ReadVariableOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getResource() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ReadVariableOpAdaptor : public ReadVariableOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReadVariableOpGenericAdaptor::ReadVariableOpGenericAdaptor; + ReadVariableOpAdaptor(ReadVariableOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReadVariableOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ReadVariableOpAdaptor; + template + using GenericAdaptor = ReadVariableOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ReadVariableOp"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResource(); + ::mlir::OpOperand &getResourceMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getValue(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type value, ::mlir::Value resource); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value resource); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ReadVariableOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RealDivOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RealDivOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RealDivOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RealDivOpGenericAdaptorBase(RealDivOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RealDivOpGenericAdaptor : public detail::RealDivOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RealDivOpGenericAdaptorBase; +public: + RealDivOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RealDivOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RealDivOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RealDivOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RealDivOpAdaptor : public RealDivOpGenericAdaptor<::mlir::ValueRange> { +public: + using RealDivOpGenericAdaptor::RealDivOpGenericAdaptor; + RealDivOpAdaptor(RealDivOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RealDivOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::OpTrait::TF::CwiseBinary, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RealDivOpAdaptor; + template + using GenericAdaptor = RealDivOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RealDiv"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RealDivOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RealOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RealOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RealOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RealOpGenericAdaptorBase(RealOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RealOpGenericAdaptor : public detail::RealOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RealOpGenericAdaptorBase; +public: + RealOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RealOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RealOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RealOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RealOpAdaptor : public RealOpGenericAdaptor<::mlir::ValueRange> { +public: + using RealOpGenericAdaptor::RealOpGenericAdaptor; + RealOpAdaptor(RealOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RealOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RealOpAdaptor; + template + using GenericAdaptor = RealOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tout")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getToutAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getToutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Real"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTout(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RealOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ReciprocalGradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReciprocalGradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ReciprocalGradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ReciprocalGradOpGenericAdaptorBase(ReciprocalGradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ReciprocalGradOpGenericAdaptor : public detail::ReciprocalGradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReciprocalGradOpGenericAdaptorBase; +public: + ReciprocalGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReciprocalGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReciprocalGradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ReciprocalGradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getY() { + return (*getODSOperands(0).begin()); + } + + ValueT getDy() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ReciprocalGradOpAdaptor : public ReciprocalGradOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReciprocalGradOpGenericAdaptor::ReciprocalGradOpGenericAdaptor; + ReciprocalGradOpAdaptor(ReciprocalGradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReciprocalGradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ReciprocalGradOpAdaptor; + template + using GenericAdaptor = ReciprocalGradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ReciprocalGrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::TypedValue<::mlir::TensorType> getDy(); + ::mlir::OpOperand &getYMutable(); + ::mlir::OpOperand &getDyMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value y, ::mlir::Value dy); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value y, ::mlir::Value dy); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value y, ::mlir::Value dy); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ReciprocalGradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ReciprocalOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReciprocalOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ReciprocalOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ReciprocalOpGenericAdaptorBase(ReciprocalOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ReciprocalOpGenericAdaptor : public detail::ReciprocalOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReciprocalOpGenericAdaptorBase; +public: + ReciprocalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReciprocalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReciprocalOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ReciprocalOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ReciprocalOpAdaptor : public ReciprocalOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReciprocalOpGenericAdaptor::ReciprocalOpGenericAdaptor; + ReciprocalOpAdaptor(ReciprocalOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReciprocalOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::IsInvolution, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ReciprocalOpAdaptor; + template + using GenericAdaptor = ReciprocalOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Reciprocal"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ReciprocalOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RecvOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RecvOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RecvOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RecvOpGenericAdaptorBase(RecvOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getTensorNameAttr(); + ::llvm::StringRef getTensorName(); + ::mlir::StringAttr getSendDeviceAttr(); + ::llvm::StringRef getSendDevice(); + ::mlir::IntegerAttr getSendDeviceIncarnationAttr(); + uint64_t getSendDeviceIncarnation(); + ::mlir::StringAttr getRecvDeviceAttr(); + ::llvm::StringRef getRecvDevice(); + ::mlir::BoolAttr getClientTerminatedAttr(); + bool getClientTerminated(); +}; +} // namespace detail +template +class RecvOpGenericAdaptor : public detail::RecvOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RecvOpGenericAdaptorBase; +public: + RecvOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RecvOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RecvOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RecvOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RecvOpAdaptor : public RecvOpGenericAdaptor<::mlir::ValueRange> { +public: + using RecvOpGenericAdaptor::RecvOpGenericAdaptor; + RecvOpAdaptor(RecvOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RecvOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RecvOpAdaptor; + template + using GenericAdaptor = RecvOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("client_terminated"), ::llvm::StringRef("recv_device"), ::llvm::StringRef("send_device"), ::llvm::StringRef("send_device_incarnation"), ::llvm::StringRef("tensor_name"), ::llvm::StringRef("tensor_type")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getClientTerminatedAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getClientTerminatedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getRecvDeviceAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getRecvDeviceAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getSendDeviceAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getSendDeviceAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSendDeviceIncarnationAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSendDeviceIncarnationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTensorNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTensorNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getTensorTypeAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getTensorTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Recv"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::StringAttr getTensorNameAttr(); + ::llvm::StringRef getTensorName(); + ::mlir::StringAttr getSendDeviceAttr(); + ::llvm::StringRef getSendDevice(); + ::mlir::IntegerAttr getSendDeviceIncarnationAttr(); + uint64_t getSendDeviceIncarnation(); + ::mlir::StringAttr getRecvDeviceAttr(); + ::llvm::StringRef getRecvDevice(); + ::mlir::BoolAttr getClientTerminatedAttr(); + bool getClientTerminated(); + ::mlir::Type getTensorType(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setTensorNameAttr(::mlir::StringAttr attr); + void setTensorName(::llvm::StringRef attrValue); + void setSendDeviceAttr(::mlir::StringAttr attr); + void setSendDevice(::llvm::StringRef attrValue); + void setSendDeviceIncarnationAttr(::mlir::IntegerAttr attr); + void setSendDeviceIncarnation(uint64_t attrValue); + void setRecvDeviceAttr(::mlir::StringAttr attr); + void setRecvDevice(::llvm::StringRef attrValue); + void setClientTerminatedAttr(::mlir::BoolAttr attr); + void setClientTerminated(::std::optional attrValue); + ::mlir::Attribute removeClientTerminatedAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type tensor, ::mlir::StringAttr tensor_name, ::mlir::StringAttr send_device, ::mlir::IntegerAttr send_device_incarnation, ::mlir::StringAttr recv_device, /*optional*/::mlir::BoolAttr client_terminated); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr tensor_name, ::mlir::StringAttr send_device, ::mlir::IntegerAttr send_device_incarnation, ::mlir::StringAttr recv_device, /*optional*/::mlir::BoolAttr client_terminated); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type tensor, ::llvm::StringRef tensor_name, ::llvm::StringRef send_device, uint64_t send_device_incarnation, ::llvm::StringRef recv_device, /*optional*/bool client_terminated = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef tensor_name, ::llvm::StringRef send_device, uint64_t send_device_incarnation, ::llvm::StringRef recv_device, /*optional*/bool client_terminated = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RecvOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RecvTPUEmbeddingActivationsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RecvTPUEmbeddingActivationsOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RecvTPUEmbeddingActivationsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RecvTPUEmbeddingActivationsOpGenericAdaptorBase(RecvTPUEmbeddingActivationsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class RecvTPUEmbeddingActivationsOpGenericAdaptor : public detail::RecvTPUEmbeddingActivationsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RecvTPUEmbeddingActivationsOpGenericAdaptorBase; +public: + RecvTPUEmbeddingActivationsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RecvTPUEmbeddingActivationsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RecvTPUEmbeddingActivationsOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RecvTPUEmbeddingActivationsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RecvTPUEmbeddingActivationsOpAdaptor : public RecvTPUEmbeddingActivationsOpGenericAdaptor<::mlir::ValueRange> { +public: + using RecvTPUEmbeddingActivationsOpGenericAdaptor::RecvTPUEmbeddingActivationsOpGenericAdaptor; + RecvTPUEmbeddingActivationsOpAdaptor(RecvTPUEmbeddingActivationsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RecvTPUEmbeddingActivationsOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = RecvTPUEmbeddingActivationsOpAdaptor; + template + using GenericAdaptor = RecvTPUEmbeddingActivationsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_outputs")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumOutputsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumOutputsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RecvTPUEmbeddingActivations"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutputs(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + size_t getNumOutputs(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outputs, ::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outputs, ::llvm::StringRef config); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RecvTPUEmbeddingActivationsOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ReduceDatasetOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReduceDatasetOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ReduceDatasetOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ReduceDatasetOpGenericAdaptorBase(ReduceDatasetOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::SymbolRefAttr getFAttr(); + ::mlir::SymbolRefAttr getF(); + ::mlir::ArrayAttr getTstateAttr(); + ::mlir::ArrayAttr getTstate(); + ::mlir::ArrayAttr getTargumentsAttr(); + ::mlir::ArrayAttr getTarguments(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::BoolAttr getUseInterOpParallelismAttr(); + bool getUseInterOpParallelism(); +}; +} // namespace detail +template +class ReduceDatasetOpGenericAdaptor : public detail::ReduceDatasetOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReduceDatasetOpGenericAdaptorBase; +public: + ReduceDatasetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReduceDatasetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReduceDatasetOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ReduceDatasetOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputDataset() { + return (*getODSOperands(0).begin()); + } + + RangeT getInitialState() { + return getODSOperands(1); + } + + RangeT getOtherArguments() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ReduceDatasetOpAdaptor : public ReduceDatasetOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReduceDatasetOpGenericAdaptor::ReduceDatasetOpGenericAdaptor; + ReduceDatasetOpAdaptor(ReduceDatasetOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReduceDatasetOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = ReduceDatasetOpAdaptor; + template + using GenericAdaptor = ReduceDatasetOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Targuments"), ::llvm::StringRef("Tstate"), ::llvm::StringRef("f"), ::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types"), ::llvm::StringRef("use_inter_op_parallelism")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTargumentsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTargumentsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTstateAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTstateAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getFAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getFAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getUseInterOpParallelismAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getUseInterOpParallelismAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ReduceDataset"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputDataset(); + ::mlir::Operation::operand_range getInitialState(); + ::mlir::Operation::operand_range getOtherArguments(); + ::mlir::OpOperand &getInputDatasetMutable(); + ::mlir::MutableOperandRange getInitialStateMutable(); + ::mlir::MutableOperandRange getOtherArgumentsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getComponents(); + ::mlir::SymbolRefAttr getFAttr(); + ::mlir::SymbolRefAttr getF(); + ::mlir::ArrayAttr getTstateAttr(); + ::mlir::ArrayAttr getTstate(); + ::mlir::ArrayAttr getTargumentsAttr(); + ::mlir::ArrayAttr getTarguments(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::BoolAttr getUseInterOpParallelismAttr(); + bool getUseInterOpParallelism(); + void setFAttr(::mlir::SymbolRefAttr attr); + void setTstateAttr(::mlir::ArrayAttr attr); + void setTargumentsAttr(::mlir::ArrayAttr attr); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + void setUseInterOpParallelismAttr(::mlir::BoolAttr attr); + void setUseInterOpParallelism(::std::optional attrValue); + ::mlir::Attribute removeUseInterOpParallelismAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange components, ::mlir::Value input_dataset, ::mlir::ValueRange initial_state, ::mlir::ValueRange other_arguments, ::mlir::SymbolRefAttr f, ::mlir::ArrayAttr Tstate, ::mlir::ArrayAttr Targuments, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::BoolAttr use_inter_op_parallelism); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange components, ::mlir::Value input_dataset, ::mlir::ValueRange initial_state, ::mlir::ValueRange other_arguments, ::mlir::SymbolRefAttr f, ::mlir::ArrayAttr Tstate, ::mlir::ArrayAttr Targuments, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/bool use_inter_op_parallelism = true); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ReduceDatasetOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ReduceJoinOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReduceJoinOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ReduceJoinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ReduceJoinOpGenericAdaptorBase(ReduceJoinOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getKeepDimsAttr(); + bool getKeepDims(); + ::mlir::StringAttr getSeparatorAttr(); + ::llvm::StringRef getSeparator(); +}; +} // namespace detail +template +class ReduceJoinOpGenericAdaptor : public detail::ReduceJoinOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReduceJoinOpGenericAdaptorBase; +public: + ReduceJoinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReduceJoinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReduceJoinOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ReduceJoinOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputs() { + return (*getODSOperands(0).begin()); + } + + ValueT getReductionIndices() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ReduceJoinOpAdaptor : public ReduceJoinOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReduceJoinOpGenericAdaptor::ReduceJoinOpGenericAdaptor; + ReduceJoinOpAdaptor(ReduceJoinOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReduceJoinOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ReduceJoinOpAdaptor; + template + using GenericAdaptor = ReduceJoinOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("keep_dims"), ::llvm::StringRef("separator")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getKeepDimsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getKeepDimsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getSeparatorAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getSeparatorAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ReduceJoin"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputs(); + ::mlir::TypedValue<::mlir::TensorType> getReductionIndices(); + ::mlir::OpOperand &getInputsMutable(); + ::mlir::OpOperand &getReductionIndicesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getKeepDimsAttr(); + bool getKeepDims(); + ::mlir::StringAttr getSeparatorAttr(); + ::llvm::StringRef getSeparator(); + void setKeepDimsAttr(::mlir::BoolAttr attr); + void setKeepDims(::std::optional attrValue); + void setSeparatorAttr(::mlir::StringAttr attr); + void setSeparator(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeKeepDimsAttr(); + ::mlir::Attribute removeSeparatorAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value inputs, ::mlir::Value reduction_indices, /*optional*/::mlir::BoolAttr keep_dims, /*optional*/::mlir::StringAttr separator); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inputs, ::mlir::Value reduction_indices, /*optional*/::mlir::BoolAttr keep_dims, /*optional*/::mlir::StringAttr separator); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value inputs, ::mlir::Value reduction_indices, /*optional*/bool keep_dims = false, /*optional*/::llvm::StringRef separator = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value inputs, ::mlir::Value reduction_indices, /*optional*/bool keep_dims = false, /*optional*/::llvm::StringRef separator = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ReduceJoinOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::Relu6GradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Relu6GradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + Relu6GradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + Relu6GradOpGenericAdaptorBase(Relu6GradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class Relu6GradOpGenericAdaptor : public detail::Relu6GradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Relu6GradOpGenericAdaptorBase; +public: + Relu6GradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Relu6GradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Relu6GradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + Relu6GradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getGradients() { + return (*getODSOperands(0).begin()); + } + + ValueT getFeatures() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Relu6GradOpAdaptor : public Relu6GradOpGenericAdaptor<::mlir::ValueRange> { +public: + using Relu6GradOpGenericAdaptor::Relu6GradOpGenericAdaptor; + Relu6GradOpAdaptor(Relu6GradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Relu6GradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = Relu6GradOpAdaptor; + template + using GenericAdaptor = Relu6GradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Relu6Grad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getGradients(); + ::mlir::TypedValue<::mlir::TensorType> getFeatures(); + ::mlir::OpOperand &getGradientsMutable(); + ::mlir::OpOperand &getFeaturesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getBackprops(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type backprops, ::mlir::Value gradients, ::mlir::Value features); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value gradients, ::mlir::Value features); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value gradients, ::mlir::Value features); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::Relu6GradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::Relu6Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Relu6OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + Relu6OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + Relu6OpGenericAdaptorBase(Relu6Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class Relu6OpGenericAdaptor : public detail::Relu6OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Relu6OpGenericAdaptorBase; +public: + Relu6OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Relu6OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Relu6OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + Relu6OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getFeatures() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Relu6OpAdaptor : public Relu6OpGenericAdaptor<::mlir::ValueRange> { +public: + using Relu6OpGenericAdaptor::Relu6OpGenericAdaptor; + Relu6OpAdaptor(Relu6Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Relu6Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::IsIdempotent, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = Relu6OpAdaptor; + template + using GenericAdaptor = Relu6OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Relu6"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getFeatures(); + ::mlir::OpOperand &getFeaturesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getActivations(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type activations, ::mlir::Value features); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value features); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value features); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::Relu6Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ReluGradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReluGradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ReluGradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ReluGradOpGenericAdaptorBase(ReluGradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ReluGradOpGenericAdaptor : public detail::ReluGradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReluGradOpGenericAdaptorBase; +public: + ReluGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReluGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReluGradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ReluGradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getGradients() { + return (*getODSOperands(0).begin()); + } + + ValueT getFeatures() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ReluGradOpAdaptor : public ReluGradOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReluGradOpGenericAdaptor::ReluGradOpGenericAdaptor; + ReluGradOpAdaptor(ReluGradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReluGradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ReluGradOpAdaptor; + template + using GenericAdaptor = ReluGradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ReluGrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getGradients(); + ::mlir::TypedValue<::mlir::TensorType> getFeatures(); + ::mlir::OpOperand &getGradientsMutable(); + ::mlir::OpOperand &getFeaturesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getBackprops(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type backprops, ::mlir::Value gradients, ::mlir::Value features); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value gradients, ::mlir::Value features); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value gradients, ::mlir::Value features); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ReluGradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ReluOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReluOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ReluOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ReluOpGenericAdaptorBase(ReluOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ReluOpGenericAdaptor : public detail::ReluOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReluOpGenericAdaptorBase; +public: + ReluOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReluOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReluOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ReluOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getFeatures() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ReluOpAdaptor : public ReluOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReluOpGenericAdaptor::ReluOpGenericAdaptor; + ReluOpAdaptor(ReluOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReluOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::IsIdempotent, ::mlir::OpTrait::TF::LayoutAgnostic, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ReluOpAdaptor; + template + using GenericAdaptor = ReluOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Relu"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getFeatures(); + ::mlir::OpOperand &getFeaturesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getActivations(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type activations, ::mlir::Value features); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value features); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value features); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ReluOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RemoteCallOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RemoteCallOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RemoteCallOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RemoteCallOpGenericAdaptorBase(RemoteCallOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::SymbolRefAttr getFAttr(); + ::mlir::SymbolRefAttr getF(); +}; +} // namespace detail +template +class RemoteCallOpGenericAdaptor : public detail::RemoteCallOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RemoteCallOpGenericAdaptorBase; +public: + RemoteCallOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RemoteCallOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RemoteCallOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RemoteCallOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTarget() { + return (*getODSOperands(0).begin()); + } + + RangeT getArgs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RemoteCallOpAdaptor : public RemoteCallOpGenericAdaptor<::mlir::ValueRange> { +public: + using RemoteCallOpGenericAdaptor::RemoteCallOpGenericAdaptor; + RemoteCallOpAdaptor(RemoteCallOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RemoteCallOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::CallOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RemoteCallOpAdaptor; + template + using GenericAdaptor = RemoteCallOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tin"), ::llvm::StringRef("Tout"), ::llvm::StringRef("f")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTinAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTinAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getToutAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getToutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getFAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getFAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RemoteCall"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTarget(); + ::mlir::Operation::operand_range getArgs(); + ::mlir::OpOperand &getTargetMutable(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutput(); + ::mlir::SymbolRefAttr getFAttr(); + ::mlir::SymbolRefAttr getF(); + mlir::OperandElementTypeRange getTin(); + mlir::ResultElementTypeRange getTout(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setFAttr(::mlir::SymbolRefAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::Value target, ::mlir::ValueRange args, ::mlir::SymbolRefAttr f); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + /// Get the argument operands to the called function. + operand_range getArgOperands() { + return getArgs(); + } + + MutableOperandRange getArgOperandsMutable() { + return getArgsMutable(); + } + + /// Return the callee of this operation. + CallInterfaceCallable getCallableForCallee() { + return (*this)->getAttrOfType("f"); + } + + /// Set the callee for this operation. + void setCalleeFromCallable(CallInterfaceCallable callee) { + (*this)->setAttr("f", callee.get()); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RemoteCallOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RepeatDatasetOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RepeatDatasetOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RepeatDatasetOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RepeatDatasetOpGenericAdaptorBase(RepeatDatasetOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); +}; +} // namespace detail +template +class RepeatDatasetOpGenericAdaptor : public detail::RepeatDatasetOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RepeatDatasetOpGenericAdaptorBase; +public: + RepeatDatasetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RepeatDatasetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RepeatDatasetOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RepeatDatasetOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputDataset() { + return (*getODSOperands(0).begin()); + } + + ValueT getCount() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RepeatDatasetOpAdaptor : public RepeatDatasetOpGenericAdaptor<::mlir::ValueRange> { +public: + using RepeatDatasetOpGenericAdaptor::RepeatDatasetOpGenericAdaptor; + RepeatDatasetOpAdaptor(RepeatDatasetOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RepeatDatasetOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RepeatDatasetOpAdaptor; + template + using GenericAdaptor = RepeatDatasetOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("metadata"), ::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getMetadataAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getMetadataAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RepeatDataset"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputDataset(); + ::mlir::TypedValue<::mlir::TensorType> getCount(); + ::mlir::OpOperand &getInputDatasetMutable(); + ::mlir::OpOperand &getCountMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + void setMetadataAttr(::mlir::StringAttr attr); + void setMetadata(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeMetadataAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, ::mlir::Value count, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, ::mlir::Value count, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, ::mlir::Value count, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::llvm::StringRef metadata = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, ::mlir::Value count, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::llvm::StringRef metadata = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RepeatDatasetOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ReshapeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReshapeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ReshapeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ReshapeOpGenericAdaptorBase(ReshapeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ReshapeOpGenericAdaptor : public detail::ReshapeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReshapeOpGenericAdaptorBase; +public: + ReshapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReshapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReshapeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ReshapeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTensor() { + return (*getODSOperands(0).begin()); + } + + ValueT getShape() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ReshapeOpAdaptor : public ReshapeOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReshapeOpGenericAdaptor::ReshapeOpGenericAdaptor; + ReshapeOpAdaptor(ReshapeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReshapeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ReshapeOpAdaptor; + template + using GenericAdaptor = ReshapeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tshape")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTshapeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTshapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Reshape"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::OpOperand &getTensorMutable(); + ::mlir::OpOperand &getShapeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTshape(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value tensor, Value shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value tensor, ::mlir::Value shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tensor, ::mlir::Value shape); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ReshapeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResizeBilinearGradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResizeBilinearGradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResizeBilinearGradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResizeBilinearGradOpGenericAdaptorBase(ResizeBilinearGradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getAlignCornersAttr(); + bool getAlignCorners(); + ::mlir::BoolAttr getHalfPixelCentersAttr(); + bool getHalfPixelCenters(); +}; +} // namespace detail +template +class ResizeBilinearGradOpGenericAdaptor : public detail::ResizeBilinearGradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResizeBilinearGradOpGenericAdaptorBase; +public: + ResizeBilinearGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResizeBilinearGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResizeBilinearGradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResizeBilinearGradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getGrads() { + return (*getODSOperands(0).begin()); + } + + ValueT getOriginalImage() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResizeBilinearGradOpAdaptor : public ResizeBilinearGradOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResizeBilinearGradOpGenericAdaptor::ResizeBilinearGradOpGenericAdaptor; + ResizeBilinearGradOpAdaptor(ResizeBilinearGradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResizeBilinearGradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResizeBilinearGradOpAdaptor; + template + using GenericAdaptor = ResizeBilinearGradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("align_corners"), ::llvm::StringRef("half_pixel_centers")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAlignCornersAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAlignCornersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getHalfPixelCentersAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getHalfPixelCentersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResizeBilinearGrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getGrads(); + ::mlir::TypedValue<::mlir::TensorType> getOriginalImage(); + ::mlir::OpOperand &getGradsMutable(); + ::mlir::OpOperand &getOriginalImageMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getAlignCornersAttr(); + bool getAlignCorners(); + ::mlir::BoolAttr getHalfPixelCentersAttr(); + bool getHalfPixelCenters(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setAlignCornersAttr(::mlir::BoolAttr attr); + void setAlignCorners(::std::optional attrValue); + void setHalfPixelCentersAttr(::mlir::BoolAttr attr); + void setHalfPixelCenters(::std::optional attrValue); + ::mlir::Attribute removeAlignCornersAttr(); + ::mlir::Attribute removeHalfPixelCentersAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value grads, ::mlir::Value original_image, /*optional*/::mlir::BoolAttr align_corners, /*optional*/::mlir::BoolAttr half_pixel_centers); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value grads, ::mlir::Value original_image, /*optional*/::mlir::BoolAttr align_corners, /*optional*/::mlir::BoolAttr half_pixel_centers); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value grads, ::mlir::Value original_image, /*optional*/bool align_corners = false, /*optional*/bool half_pixel_centers = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value grads, ::mlir::Value original_image, /*optional*/bool align_corners = false, /*optional*/bool half_pixel_centers = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResizeBilinearGradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResizeBilinearOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResizeBilinearOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResizeBilinearOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResizeBilinearOpGenericAdaptorBase(ResizeBilinearOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getAlignCornersAttr(); + bool getAlignCorners(); + ::mlir::BoolAttr getHalfPixelCentersAttr(); + bool getHalfPixelCenters(); +}; +} // namespace detail +template +class ResizeBilinearOpGenericAdaptor : public detail::ResizeBilinearOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResizeBilinearOpGenericAdaptorBase; +public: + ResizeBilinearOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResizeBilinearOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResizeBilinearOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResizeBilinearOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getImages() { + return (*getODSOperands(0).begin()); + } + + ValueT getSize() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResizeBilinearOpAdaptor : public ResizeBilinearOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResizeBilinearOpGenericAdaptor::ResizeBilinearOpGenericAdaptor; + ResizeBilinearOpAdaptor(ResizeBilinearOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResizeBilinearOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResizeBilinearOpAdaptor; + template + using GenericAdaptor = ResizeBilinearOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("align_corners"), ::llvm::StringRef("half_pixel_centers")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAlignCornersAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAlignCornersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getHalfPixelCentersAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getHalfPixelCentersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResizeBilinear"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getImages(); + ::mlir::TypedValue<::mlir::TensorType> getSize(); + ::mlir::OpOperand &getImagesMutable(); + ::mlir::OpOperand &getSizeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResizedImages(); + ::mlir::BoolAttr getAlignCornersAttr(); + bool getAlignCorners(); + ::mlir::BoolAttr getHalfPixelCentersAttr(); + bool getHalfPixelCenters(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setAlignCornersAttr(::mlir::BoolAttr attr); + void setAlignCorners(::std::optional attrValue); + void setHalfPixelCentersAttr(::mlir::BoolAttr attr); + void setHalfPixelCenters(::std::optional attrValue); + ::mlir::Attribute removeAlignCornersAttr(); + ::mlir::Attribute removeHalfPixelCentersAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resized_images, ::mlir::Value images, ::mlir::Value size, /*optional*/::mlir::BoolAttr align_corners, /*optional*/::mlir::BoolAttr half_pixel_centers); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value images, ::mlir::Value size, /*optional*/::mlir::BoolAttr align_corners, /*optional*/::mlir::BoolAttr half_pixel_centers); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resized_images, ::mlir::Value images, ::mlir::Value size, /*optional*/bool align_corners = false, /*optional*/bool half_pixel_centers = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value images, ::mlir::Value size, /*optional*/bool align_corners = false, /*optional*/bool half_pixel_centers = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResizeBilinearOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResizeNearestNeighborGradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResizeNearestNeighborGradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResizeNearestNeighborGradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResizeNearestNeighborGradOpGenericAdaptorBase(ResizeNearestNeighborGradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getAlignCornersAttr(); + bool getAlignCorners(); + ::mlir::BoolAttr getHalfPixelCentersAttr(); + bool getHalfPixelCenters(); +}; +} // namespace detail +template +class ResizeNearestNeighborGradOpGenericAdaptor : public detail::ResizeNearestNeighborGradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResizeNearestNeighborGradOpGenericAdaptorBase; +public: + ResizeNearestNeighborGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResizeNearestNeighborGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResizeNearestNeighborGradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResizeNearestNeighborGradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getGrads() { + return (*getODSOperands(0).begin()); + } + + ValueT getSize() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResizeNearestNeighborGradOpAdaptor : public ResizeNearestNeighborGradOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResizeNearestNeighborGradOpGenericAdaptor::ResizeNearestNeighborGradOpGenericAdaptor; + ResizeNearestNeighborGradOpAdaptor(ResizeNearestNeighborGradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResizeNearestNeighborGradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResizeNearestNeighborGradOpAdaptor; + template + using GenericAdaptor = ResizeNearestNeighborGradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("align_corners"), ::llvm::StringRef("half_pixel_centers")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAlignCornersAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAlignCornersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getHalfPixelCentersAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getHalfPixelCentersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResizeNearestNeighborGrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getGrads(); + ::mlir::TypedValue<::mlir::TensorType> getSize(); + ::mlir::OpOperand &getGradsMutable(); + ::mlir::OpOperand &getSizeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getAlignCornersAttr(); + bool getAlignCorners(); + ::mlir::BoolAttr getHalfPixelCentersAttr(); + bool getHalfPixelCenters(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setAlignCornersAttr(::mlir::BoolAttr attr); + void setAlignCorners(::std::optional attrValue); + void setHalfPixelCentersAttr(::mlir::BoolAttr attr); + void setHalfPixelCenters(::std::optional attrValue); + ::mlir::Attribute removeAlignCornersAttr(); + ::mlir::Attribute removeHalfPixelCentersAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value grads, ::mlir::Value size, /*optional*/::mlir::BoolAttr align_corners, /*optional*/::mlir::BoolAttr half_pixel_centers); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value grads, ::mlir::Value size, /*optional*/::mlir::BoolAttr align_corners, /*optional*/::mlir::BoolAttr half_pixel_centers); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value grads, ::mlir::Value size, /*optional*/bool align_corners = false, /*optional*/bool half_pixel_centers = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value grads, ::mlir::Value size, /*optional*/bool align_corners = false, /*optional*/bool half_pixel_centers = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResizeNearestNeighborGradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResizeNearestNeighborOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResizeNearestNeighborOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResizeNearestNeighborOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResizeNearestNeighborOpGenericAdaptorBase(ResizeNearestNeighborOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getAlignCornersAttr(); + bool getAlignCorners(); + ::mlir::BoolAttr getHalfPixelCentersAttr(); + bool getHalfPixelCenters(); +}; +} // namespace detail +template +class ResizeNearestNeighborOpGenericAdaptor : public detail::ResizeNearestNeighborOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResizeNearestNeighborOpGenericAdaptorBase; +public: + ResizeNearestNeighborOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResizeNearestNeighborOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResizeNearestNeighborOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResizeNearestNeighborOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getImages() { + return (*getODSOperands(0).begin()); + } + + ValueT getSize() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResizeNearestNeighborOpAdaptor : public ResizeNearestNeighborOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResizeNearestNeighborOpGenericAdaptor::ResizeNearestNeighborOpGenericAdaptor; + ResizeNearestNeighborOpAdaptor(ResizeNearestNeighborOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResizeNearestNeighborOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResizeNearestNeighborOpAdaptor; + template + using GenericAdaptor = ResizeNearestNeighborOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("align_corners"), ::llvm::StringRef("half_pixel_centers")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAlignCornersAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAlignCornersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getHalfPixelCentersAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getHalfPixelCentersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResizeNearestNeighbor"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getImages(); + ::mlir::TypedValue<::mlir::TensorType> getSize(); + ::mlir::OpOperand &getImagesMutable(); + ::mlir::OpOperand &getSizeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResizedImages(); + ::mlir::BoolAttr getAlignCornersAttr(); + bool getAlignCorners(); + ::mlir::BoolAttr getHalfPixelCentersAttr(); + bool getHalfPixelCenters(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setAlignCornersAttr(::mlir::BoolAttr attr); + void setAlignCorners(::std::optional attrValue); + void setHalfPixelCentersAttr(::mlir::BoolAttr attr); + void setHalfPixelCenters(::std::optional attrValue); + ::mlir::Attribute removeAlignCornersAttr(); + ::mlir::Attribute removeHalfPixelCentersAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resized_images, ::mlir::Value images, ::mlir::Value size, /*optional*/::mlir::BoolAttr align_corners, /*optional*/::mlir::BoolAttr half_pixel_centers); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value images, ::mlir::Value size, /*optional*/::mlir::BoolAttr align_corners, /*optional*/::mlir::BoolAttr half_pixel_centers); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resized_images, ::mlir::Value images, ::mlir::Value size, /*optional*/bool align_corners = false, /*optional*/bool half_pixel_centers = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value images, ::mlir::Value size, /*optional*/bool align_corners = false, /*optional*/bool half_pixel_centers = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResizeNearestNeighborOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceApplyAdaMaxOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceApplyAdaMaxOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceApplyAdaMaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceApplyAdaMaxOpGenericAdaptorBase(ResourceApplyAdaMaxOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); +}; +} // namespace detail +template +class ResourceApplyAdaMaxOpGenericAdaptor : public detail::ResourceApplyAdaMaxOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceApplyAdaMaxOpGenericAdaptorBase; +public: + ResourceApplyAdaMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceApplyAdaMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceApplyAdaMaxOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceApplyAdaMaxOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVar() { + return (*getODSOperands(0).begin()); + } + + ValueT getM() { + return (*getODSOperands(1).begin()); + } + + ValueT getV() { + return (*getODSOperands(2).begin()); + } + + ValueT getBeta1Power() { + return (*getODSOperands(3).begin()); + } + + ValueT getLr() { + return (*getODSOperands(4).begin()); + } + + ValueT getBeta1() { + return (*getODSOperands(5).begin()); + } + + ValueT getBeta2() { + return (*getODSOperands(6).begin()); + } + + ValueT getEpsilon() { + return (*getODSOperands(7).begin()); + } + + ValueT getGrad() { + return (*getODSOperands(8).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceApplyAdaMaxOpAdaptor : public ResourceApplyAdaMaxOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceApplyAdaMaxOpGenericAdaptor::ResourceApplyAdaMaxOpGenericAdaptor; + ResourceApplyAdaMaxOpAdaptor(ResourceApplyAdaMaxOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceApplyAdaMaxOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceApplyAdaMaxOpAdaptor; + template + using GenericAdaptor = ResourceApplyAdaMaxOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("use_locking")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getUseLockingAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getUseLockingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceApplyAdaMax"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getVar(); + ::mlir::TypedValue<::mlir::TensorType> getM(); + ::mlir::TypedValue<::mlir::TensorType> getV(); + ::mlir::TypedValue<::mlir::TensorType> getBeta1Power(); + ::mlir::TypedValue<::mlir::TensorType> getLr(); + ::mlir::TypedValue<::mlir::TensorType> getBeta1(); + ::mlir::TypedValue<::mlir::TensorType> getBeta2(); + ::mlir::TypedValue<::mlir::TensorType> getEpsilon(); + ::mlir::TypedValue<::mlir::TensorType> getGrad(); + ::mlir::OpOperand &getVarMutable(); + ::mlir::OpOperand &getMMutable(); + ::mlir::OpOperand &getVMutable(); + ::mlir::OpOperand &getBeta1PowerMutable(); + ::mlir::OpOperand &getLrMutable(); + ::mlir::OpOperand &getBeta1Mutable(); + ::mlir::OpOperand &getBeta2Mutable(); + ::mlir::OpOperand &getEpsilonMutable(); + ::mlir::OpOperand &getGradMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setUseLockingAttr(::mlir::BoolAttr attr); + void setUseLocking(::std::optional attrValue); + ::mlir::Attribute removeUseLockingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value m, ::mlir::Value v, ::mlir::Value beta1_power, ::mlir::Value lr, ::mlir::Value beta1, ::mlir::Value beta2, ::mlir::Value epsilon, ::mlir::Value grad, /*optional*/::mlir::BoolAttr use_locking); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value m, ::mlir::Value v, ::mlir::Value beta1_power, ::mlir::Value lr, ::mlir::Value beta1, ::mlir::Value beta2, ::mlir::Value epsilon, ::mlir::Value grad, /*optional*/::mlir::BoolAttr use_locking); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value m, ::mlir::Value v, ::mlir::Value beta1_power, ::mlir::Value lr, ::mlir::Value beta1, ::mlir::Value beta2, ::mlir::Value epsilon, ::mlir::Value grad, /*optional*/bool use_locking = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value m, ::mlir::Value v, ::mlir::Value beta1_power, ::mlir::Value lr, ::mlir::Value beta1, ::mlir::Value beta2, ::mlir::Value epsilon, ::mlir::Value grad, /*optional*/bool use_locking = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceApplyAdaMaxOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceApplyAdadeltaOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceApplyAdadeltaOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceApplyAdadeltaOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceApplyAdadeltaOpGenericAdaptorBase(ResourceApplyAdadeltaOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); +}; +} // namespace detail +template +class ResourceApplyAdadeltaOpGenericAdaptor : public detail::ResourceApplyAdadeltaOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceApplyAdadeltaOpGenericAdaptorBase; +public: + ResourceApplyAdadeltaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceApplyAdadeltaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceApplyAdadeltaOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceApplyAdadeltaOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVar() { + return (*getODSOperands(0).begin()); + } + + ValueT getAccum() { + return (*getODSOperands(1).begin()); + } + + ValueT getAccumUpdate() { + return (*getODSOperands(2).begin()); + } + + ValueT getLr() { + return (*getODSOperands(3).begin()); + } + + ValueT getRho() { + return (*getODSOperands(4).begin()); + } + + ValueT getEpsilon() { + return (*getODSOperands(5).begin()); + } + + ValueT getGrad() { + return (*getODSOperands(6).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceApplyAdadeltaOpAdaptor : public ResourceApplyAdadeltaOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceApplyAdadeltaOpGenericAdaptor::ResourceApplyAdadeltaOpGenericAdaptor; + ResourceApplyAdadeltaOpAdaptor(ResourceApplyAdadeltaOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceApplyAdadeltaOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceApplyAdadeltaOpAdaptor; + template + using GenericAdaptor = ResourceApplyAdadeltaOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("use_locking")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getUseLockingAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getUseLockingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceApplyAdadelta"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getVar(); + ::mlir::TypedValue<::mlir::TensorType> getAccum(); + ::mlir::TypedValue<::mlir::TensorType> getAccumUpdate(); + ::mlir::TypedValue<::mlir::TensorType> getLr(); + ::mlir::TypedValue<::mlir::TensorType> getRho(); + ::mlir::TypedValue<::mlir::TensorType> getEpsilon(); + ::mlir::TypedValue<::mlir::TensorType> getGrad(); + ::mlir::OpOperand &getVarMutable(); + ::mlir::OpOperand &getAccumMutable(); + ::mlir::OpOperand &getAccumUpdateMutable(); + ::mlir::OpOperand &getLrMutable(); + ::mlir::OpOperand &getRhoMutable(); + ::mlir::OpOperand &getEpsilonMutable(); + ::mlir::OpOperand &getGradMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setUseLockingAttr(::mlir::BoolAttr attr); + void setUseLocking(::std::optional attrValue); + ::mlir::Attribute removeUseLockingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value accum_update, ::mlir::Value lr, ::mlir::Value rho, ::mlir::Value epsilon, ::mlir::Value grad, /*optional*/::mlir::BoolAttr use_locking); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value accum_update, ::mlir::Value lr, ::mlir::Value rho, ::mlir::Value epsilon, ::mlir::Value grad, /*optional*/::mlir::BoolAttr use_locking); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value accum_update, ::mlir::Value lr, ::mlir::Value rho, ::mlir::Value epsilon, ::mlir::Value grad, /*optional*/bool use_locking = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value accum_update, ::mlir::Value lr, ::mlir::Value rho, ::mlir::Value epsilon, ::mlir::Value grad, /*optional*/bool use_locking = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceApplyAdadeltaOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceApplyAdagradDAOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceApplyAdagradDAOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceApplyAdagradDAOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceApplyAdagradDAOpGenericAdaptorBase(ResourceApplyAdagradDAOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); +}; +} // namespace detail +template +class ResourceApplyAdagradDAOpGenericAdaptor : public detail::ResourceApplyAdagradDAOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceApplyAdagradDAOpGenericAdaptorBase; +public: + ResourceApplyAdagradDAOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceApplyAdagradDAOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceApplyAdagradDAOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceApplyAdagradDAOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVar() { + return (*getODSOperands(0).begin()); + } + + ValueT getGradientAccumulator() { + return (*getODSOperands(1).begin()); + } + + ValueT getGradientSquaredAccumulator() { + return (*getODSOperands(2).begin()); + } + + ValueT getGrad() { + return (*getODSOperands(3).begin()); + } + + ValueT getLr() { + return (*getODSOperands(4).begin()); + } + + ValueT getL1() { + return (*getODSOperands(5).begin()); + } + + ValueT getL2() { + return (*getODSOperands(6).begin()); + } + + ValueT getGlobalStep() { + return (*getODSOperands(7).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceApplyAdagradDAOpAdaptor : public ResourceApplyAdagradDAOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceApplyAdagradDAOpGenericAdaptor::ResourceApplyAdagradDAOpGenericAdaptor; + ResourceApplyAdagradDAOpAdaptor(ResourceApplyAdagradDAOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceApplyAdagradDAOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceApplyAdagradDAOpAdaptor; + template + using GenericAdaptor = ResourceApplyAdagradDAOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("use_locking")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getUseLockingAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getUseLockingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceApplyAdagradDA"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getVar(); + ::mlir::TypedValue<::mlir::TensorType> getGradientAccumulator(); + ::mlir::TypedValue<::mlir::TensorType> getGradientSquaredAccumulator(); + ::mlir::TypedValue<::mlir::TensorType> getGrad(); + ::mlir::TypedValue<::mlir::TensorType> getLr(); + ::mlir::TypedValue<::mlir::TensorType> getL1(); + ::mlir::TypedValue<::mlir::TensorType> getL2(); + ::mlir::TypedValue<::mlir::TensorType> getGlobalStep(); + ::mlir::OpOperand &getVarMutable(); + ::mlir::OpOperand &getGradientAccumulatorMutable(); + ::mlir::OpOperand &getGradientSquaredAccumulatorMutable(); + ::mlir::OpOperand &getGradMutable(); + ::mlir::OpOperand &getLrMutable(); + ::mlir::OpOperand &getL1Mutable(); + ::mlir::OpOperand &getL2Mutable(); + ::mlir::OpOperand &getGlobalStepMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setUseLockingAttr(::mlir::BoolAttr attr); + void setUseLocking(::std::optional attrValue); + ::mlir::Attribute removeUseLockingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value gradient_accumulator, ::mlir::Value gradient_squared_accumulator, ::mlir::Value grad, ::mlir::Value lr, ::mlir::Value l1, ::mlir::Value l2, ::mlir::Value global_step, /*optional*/::mlir::BoolAttr use_locking); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value gradient_accumulator, ::mlir::Value gradient_squared_accumulator, ::mlir::Value grad, ::mlir::Value lr, ::mlir::Value l1, ::mlir::Value l2, ::mlir::Value global_step, /*optional*/::mlir::BoolAttr use_locking); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value gradient_accumulator, ::mlir::Value gradient_squared_accumulator, ::mlir::Value grad, ::mlir::Value lr, ::mlir::Value l1, ::mlir::Value l2, ::mlir::Value global_step, /*optional*/bool use_locking = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value gradient_accumulator, ::mlir::Value gradient_squared_accumulator, ::mlir::Value grad, ::mlir::Value lr, ::mlir::Value l1, ::mlir::Value l2, ::mlir::Value global_step, /*optional*/bool use_locking = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceApplyAdagradDAOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceApplyAdagradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceApplyAdagradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceApplyAdagradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceApplyAdagradOpGenericAdaptorBase(ResourceApplyAdagradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::BoolAttr getUpdateSlotsAttr(); + bool getUpdateSlots(); +}; +} // namespace detail +template +class ResourceApplyAdagradOpGenericAdaptor : public detail::ResourceApplyAdagradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceApplyAdagradOpGenericAdaptorBase; +public: + ResourceApplyAdagradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceApplyAdagradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceApplyAdagradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceApplyAdagradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVar() { + return (*getODSOperands(0).begin()); + } + + ValueT getAccum() { + return (*getODSOperands(1).begin()); + } + + ValueT getLr() { + return (*getODSOperands(2).begin()); + } + + ValueT getGrad() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceApplyAdagradOpAdaptor : public ResourceApplyAdagradOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceApplyAdagradOpGenericAdaptor::ResourceApplyAdagradOpGenericAdaptor; + ResourceApplyAdagradOpAdaptor(ResourceApplyAdagradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceApplyAdagradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceApplyAdagradOpAdaptor; + template + using GenericAdaptor = ResourceApplyAdagradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("update_slots"), ::llvm::StringRef("use_locking")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getUpdateSlotsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getUpdateSlotsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getUseLockingAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getUseLockingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceApplyAdagrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getVar(); + ::mlir::TypedValue<::mlir::TensorType> getAccum(); + ::mlir::TypedValue<::mlir::TensorType> getLr(); + ::mlir::TypedValue<::mlir::TensorType> getGrad(); + ::mlir::OpOperand &getVarMutable(); + ::mlir::OpOperand &getAccumMutable(); + ::mlir::OpOperand &getLrMutable(); + ::mlir::OpOperand &getGradMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::BoolAttr getUpdateSlotsAttr(); + bool getUpdateSlots(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setUseLockingAttr(::mlir::BoolAttr attr); + void setUseLocking(::std::optional attrValue); + void setUpdateSlotsAttr(::mlir::BoolAttr attr); + void setUpdateSlots(::std::optional attrValue); + ::mlir::Attribute removeUseLockingAttr(); + ::mlir::Attribute removeUpdateSlotsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value lr, ::mlir::Value grad, /*optional*/::mlir::BoolAttr use_locking, /*optional*/::mlir::BoolAttr update_slots); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value lr, ::mlir::Value grad, /*optional*/::mlir::BoolAttr use_locking, /*optional*/::mlir::BoolAttr update_slots); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value lr, ::mlir::Value grad, /*optional*/bool use_locking = false, /*optional*/bool update_slots = true); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value lr, ::mlir::Value grad, /*optional*/bool use_locking = false, /*optional*/bool update_slots = true); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceApplyAdagradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceApplyAdagradV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceApplyAdagradV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceApplyAdagradV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceApplyAdagradV2OpGenericAdaptorBase(ResourceApplyAdagradV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::BoolAttr getUpdateSlotsAttr(); + bool getUpdateSlots(); +}; +} // namespace detail +template +class ResourceApplyAdagradV2OpGenericAdaptor : public detail::ResourceApplyAdagradV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceApplyAdagradV2OpGenericAdaptorBase; +public: + ResourceApplyAdagradV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceApplyAdagradV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceApplyAdagradV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceApplyAdagradV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVar() { + return (*getODSOperands(0).begin()); + } + + ValueT getAccum() { + return (*getODSOperands(1).begin()); + } + + ValueT getLr() { + return (*getODSOperands(2).begin()); + } + + ValueT getEpsilon() { + return (*getODSOperands(3).begin()); + } + + ValueT getGrad() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceApplyAdagradV2OpAdaptor : public ResourceApplyAdagradV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceApplyAdagradV2OpGenericAdaptor::ResourceApplyAdagradV2OpGenericAdaptor; + ResourceApplyAdagradV2OpAdaptor(ResourceApplyAdagradV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceApplyAdagradV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceApplyAdagradV2OpAdaptor; + template + using GenericAdaptor = ResourceApplyAdagradV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("update_slots"), ::llvm::StringRef("use_locking")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getUpdateSlotsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getUpdateSlotsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getUseLockingAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getUseLockingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceApplyAdagradV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getVar(); + ::mlir::TypedValue<::mlir::TensorType> getAccum(); + ::mlir::TypedValue<::mlir::TensorType> getLr(); + ::mlir::TypedValue<::mlir::TensorType> getEpsilon(); + ::mlir::TypedValue<::mlir::TensorType> getGrad(); + ::mlir::OpOperand &getVarMutable(); + ::mlir::OpOperand &getAccumMutable(); + ::mlir::OpOperand &getLrMutable(); + ::mlir::OpOperand &getEpsilonMutable(); + ::mlir::OpOperand &getGradMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::BoolAttr getUpdateSlotsAttr(); + bool getUpdateSlots(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setUseLockingAttr(::mlir::BoolAttr attr); + void setUseLocking(::std::optional attrValue); + void setUpdateSlotsAttr(::mlir::BoolAttr attr); + void setUpdateSlots(::std::optional attrValue); + ::mlir::Attribute removeUseLockingAttr(); + ::mlir::Attribute removeUpdateSlotsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value lr, ::mlir::Value epsilon, ::mlir::Value grad, /*optional*/::mlir::BoolAttr use_locking, /*optional*/::mlir::BoolAttr update_slots); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value lr, ::mlir::Value epsilon, ::mlir::Value grad, /*optional*/::mlir::BoolAttr use_locking, /*optional*/::mlir::BoolAttr update_slots); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value lr, ::mlir::Value epsilon, ::mlir::Value grad, /*optional*/bool use_locking = false, /*optional*/bool update_slots = true); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value lr, ::mlir::Value epsilon, ::mlir::Value grad, /*optional*/bool use_locking = false, /*optional*/bool update_slots = true); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceApplyAdagradV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceApplyAdamOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceApplyAdamOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceApplyAdamOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceApplyAdamOpGenericAdaptorBase(ResourceApplyAdamOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::BoolAttr getUseNesterovAttr(); + bool getUseNesterov(); +}; +} // namespace detail +template +class ResourceApplyAdamOpGenericAdaptor : public detail::ResourceApplyAdamOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceApplyAdamOpGenericAdaptorBase; +public: + ResourceApplyAdamOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceApplyAdamOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceApplyAdamOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceApplyAdamOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVar() { + return (*getODSOperands(0).begin()); + } + + ValueT getM() { + return (*getODSOperands(1).begin()); + } + + ValueT getV() { + return (*getODSOperands(2).begin()); + } + + ValueT getBeta1Power() { + return (*getODSOperands(3).begin()); + } + + ValueT getBeta2Power() { + return (*getODSOperands(4).begin()); + } + + ValueT getLr() { + return (*getODSOperands(5).begin()); + } + + ValueT getBeta1() { + return (*getODSOperands(6).begin()); + } + + ValueT getBeta2() { + return (*getODSOperands(7).begin()); + } + + ValueT getEpsilon() { + return (*getODSOperands(8).begin()); + } + + ValueT getGrad() { + return (*getODSOperands(9).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceApplyAdamOpAdaptor : public ResourceApplyAdamOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceApplyAdamOpGenericAdaptor::ResourceApplyAdamOpGenericAdaptor; + ResourceApplyAdamOpAdaptor(ResourceApplyAdamOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceApplyAdamOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceApplyAdamOpAdaptor; + template + using GenericAdaptor = ResourceApplyAdamOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("use_locking"), ::llvm::StringRef("use_nesterov")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getUseLockingAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getUseLockingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getUseNesterovAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getUseNesterovAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceApplyAdam"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getVar(); + ::mlir::TypedValue<::mlir::TensorType> getM(); + ::mlir::TypedValue<::mlir::TensorType> getV(); + ::mlir::TypedValue<::mlir::TensorType> getBeta1Power(); + ::mlir::TypedValue<::mlir::TensorType> getBeta2Power(); + ::mlir::TypedValue<::mlir::TensorType> getLr(); + ::mlir::TypedValue<::mlir::TensorType> getBeta1(); + ::mlir::TypedValue<::mlir::TensorType> getBeta2(); + ::mlir::TypedValue<::mlir::TensorType> getEpsilon(); + ::mlir::TypedValue<::mlir::TensorType> getGrad(); + ::mlir::OpOperand &getVarMutable(); + ::mlir::OpOperand &getMMutable(); + ::mlir::OpOperand &getVMutable(); + ::mlir::OpOperand &getBeta1PowerMutable(); + ::mlir::OpOperand &getBeta2PowerMutable(); + ::mlir::OpOperand &getLrMutable(); + ::mlir::OpOperand &getBeta1Mutable(); + ::mlir::OpOperand &getBeta2Mutable(); + ::mlir::OpOperand &getEpsilonMutable(); + ::mlir::OpOperand &getGradMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::BoolAttr getUseNesterovAttr(); + bool getUseNesterov(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setUseLockingAttr(::mlir::BoolAttr attr); + void setUseLocking(::std::optional attrValue); + void setUseNesterovAttr(::mlir::BoolAttr attr); + void setUseNesterov(::std::optional attrValue); + ::mlir::Attribute removeUseLockingAttr(); + ::mlir::Attribute removeUseNesterovAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value m, ::mlir::Value v, ::mlir::Value beta1_power, ::mlir::Value beta2_power, ::mlir::Value lr, ::mlir::Value beta1, ::mlir::Value beta2, ::mlir::Value epsilon, ::mlir::Value grad, /*optional*/::mlir::BoolAttr use_locking, /*optional*/::mlir::BoolAttr use_nesterov); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value m, ::mlir::Value v, ::mlir::Value beta1_power, ::mlir::Value beta2_power, ::mlir::Value lr, ::mlir::Value beta1, ::mlir::Value beta2, ::mlir::Value epsilon, ::mlir::Value grad, /*optional*/::mlir::BoolAttr use_locking, /*optional*/::mlir::BoolAttr use_nesterov); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value m, ::mlir::Value v, ::mlir::Value beta1_power, ::mlir::Value beta2_power, ::mlir::Value lr, ::mlir::Value beta1, ::mlir::Value beta2, ::mlir::Value epsilon, ::mlir::Value grad, /*optional*/bool use_locking = false, /*optional*/bool use_nesterov = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value m, ::mlir::Value v, ::mlir::Value beta1_power, ::mlir::Value beta2_power, ::mlir::Value lr, ::mlir::Value beta1, ::mlir::Value beta2, ::mlir::Value epsilon, ::mlir::Value grad, /*optional*/bool use_locking = false, /*optional*/bool use_nesterov = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceApplyAdamOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceApplyAddSignOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceApplyAddSignOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceApplyAddSignOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceApplyAddSignOpGenericAdaptorBase(ResourceApplyAddSignOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); +}; +} // namespace detail +template +class ResourceApplyAddSignOpGenericAdaptor : public detail::ResourceApplyAddSignOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceApplyAddSignOpGenericAdaptorBase; +public: + ResourceApplyAddSignOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceApplyAddSignOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceApplyAddSignOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceApplyAddSignOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVar() { + return (*getODSOperands(0).begin()); + } + + ValueT getM() { + return (*getODSOperands(1).begin()); + } + + ValueT getLr() { + return (*getODSOperands(2).begin()); + } + + ValueT getAlpha() { + return (*getODSOperands(3).begin()); + } + + ValueT getSignDecay() { + return (*getODSOperands(4).begin()); + } + + ValueT getBeta() { + return (*getODSOperands(5).begin()); + } + + ValueT getGrad() { + return (*getODSOperands(6).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceApplyAddSignOpAdaptor : public ResourceApplyAddSignOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceApplyAddSignOpGenericAdaptor::ResourceApplyAddSignOpGenericAdaptor; + ResourceApplyAddSignOpAdaptor(ResourceApplyAddSignOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceApplyAddSignOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceApplyAddSignOpAdaptor; + template + using GenericAdaptor = ResourceApplyAddSignOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("use_locking")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getUseLockingAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getUseLockingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceApplyAddSign"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getVar(); + ::mlir::TypedValue<::mlir::TensorType> getM(); + ::mlir::TypedValue<::mlir::TensorType> getLr(); + ::mlir::TypedValue<::mlir::TensorType> getAlpha(); + ::mlir::TypedValue<::mlir::TensorType> getSignDecay(); + ::mlir::TypedValue<::mlir::TensorType> getBeta(); + ::mlir::TypedValue<::mlir::TensorType> getGrad(); + ::mlir::OpOperand &getVarMutable(); + ::mlir::OpOperand &getMMutable(); + ::mlir::OpOperand &getLrMutable(); + ::mlir::OpOperand &getAlphaMutable(); + ::mlir::OpOperand &getSignDecayMutable(); + ::mlir::OpOperand &getBetaMutable(); + ::mlir::OpOperand &getGradMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setUseLockingAttr(::mlir::BoolAttr attr); + void setUseLocking(::std::optional attrValue); + ::mlir::Attribute removeUseLockingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value m, ::mlir::Value lr, ::mlir::Value alpha, ::mlir::Value sign_decay, ::mlir::Value beta, ::mlir::Value grad, /*optional*/::mlir::BoolAttr use_locking); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value m, ::mlir::Value lr, ::mlir::Value alpha, ::mlir::Value sign_decay, ::mlir::Value beta, ::mlir::Value grad, /*optional*/::mlir::BoolAttr use_locking); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value m, ::mlir::Value lr, ::mlir::Value alpha, ::mlir::Value sign_decay, ::mlir::Value beta, ::mlir::Value grad, /*optional*/bool use_locking = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value m, ::mlir::Value lr, ::mlir::Value alpha, ::mlir::Value sign_decay, ::mlir::Value beta, ::mlir::Value grad, /*optional*/bool use_locking = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceApplyAddSignOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceApplyCenteredRMSPropOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceApplyCenteredRMSPropOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceApplyCenteredRMSPropOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceApplyCenteredRMSPropOpGenericAdaptorBase(ResourceApplyCenteredRMSPropOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); +}; +} // namespace detail +template +class ResourceApplyCenteredRMSPropOpGenericAdaptor : public detail::ResourceApplyCenteredRMSPropOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceApplyCenteredRMSPropOpGenericAdaptorBase; +public: + ResourceApplyCenteredRMSPropOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceApplyCenteredRMSPropOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceApplyCenteredRMSPropOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceApplyCenteredRMSPropOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVar() { + return (*getODSOperands(0).begin()); + } + + ValueT getMg() { + return (*getODSOperands(1).begin()); + } + + ValueT getMs() { + return (*getODSOperands(2).begin()); + } + + ValueT getMom() { + return (*getODSOperands(3).begin()); + } + + ValueT getLr() { + return (*getODSOperands(4).begin()); + } + + ValueT getRho() { + return (*getODSOperands(5).begin()); + } + + ValueT getMomentum() { + return (*getODSOperands(6).begin()); + } + + ValueT getEpsilon() { + return (*getODSOperands(7).begin()); + } + + ValueT getGrad() { + return (*getODSOperands(8).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceApplyCenteredRMSPropOpAdaptor : public ResourceApplyCenteredRMSPropOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceApplyCenteredRMSPropOpGenericAdaptor::ResourceApplyCenteredRMSPropOpGenericAdaptor; + ResourceApplyCenteredRMSPropOpAdaptor(ResourceApplyCenteredRMSPropOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceApplyCenteredRMSPropOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceApplyCenteredRMSPropOpAdaptor; + template + using GenericAdaptor = ResourceApplyCenteredRMSPropOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("use_locking")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getUseLockingAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getUseLockingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceApplyCenteredRMSProp"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getVar(); + ::mlir::TypedValue<::mlir::TensorType> getMg(); + ::mlir::TypedValue<::mlir::TensorType> getMs(); + ::mlir::TypedValue<::mlir::TensorType> getMom(); + ::mlir::TypedValue<::mlir::TensorType> getLr(); + ::mlir::TypedValue<::mlir::TensorType> getRho(); + ::mlir::TypedValue<::mlir::TensorType> getMomentum(); + ::mlir::TypedValue<::mlir::TensorType> getEpsilon(); + ::mlir::TypedValue<::mlir::TensorType> getGrad(); + ::mlir::OpOperand &getVarMutable(); + ::mlir::OpOperand &getMgMutable(); + ::mlir::OpOperand &getMsMutable(); + ::mlir::OpOperand &getMomMutable(); + ::mlir::OpOperand &getLrMutable(); + ::mlir::OpOperand &getRhoMutable(); + ::mlir::OpOperand &getMomentumMutable(); + ::mlir::OpOperand &getEpsilonMutable(); + ::mlir::OpOperand &getGradMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setUseLockingAttr(::mlir::BoolAttr attr); + void setUseLocking(::std::optional attrValue); + ::mlir::Attribute removeUseLockingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value mg, ::mlir::Value ms, ::mlir::Value mom, ::mlir::Value lr, ::mlir::Value rho, ::mlir::Value momentum, ::mlir::Value epsilon, ::mlir::Value grad, /*optional*/::mlir::BoolAttr use_locking); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value mg, ::mlir::Value ms, ::mlir::Value mom, ::mlir::Value lr, ::mlir::Value rho, ::mlir::Value momentum, ::mlir::Value epsilon, ::mlir::Value grad, /*optional*/::mlir::BoolAttr use_locking); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value mg, ::mlir::Value ms, ::mlir::Value mom, ::mlir::Value lr, ::mlir::Value rho, ::mlir::Value momentum, ::mlir::Value epsilon, ::mlir::Value grad, /*optional*/bool use_locking = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value mg, ::mlir::Value ms, ::mlir::Value mom, ::mlir::Value lr, ::mlir::Value rho, ::mlir::Value momentum, ::mlir::Value epsilon, ::mlir::Value grad, /*optional*/bool use_locking = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceApplyCenteredRMSPropOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceApplyFtrlOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceApplyFtrlOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceApplyFtrlOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceApplyFtrlOpGenericAdaptorBase(ResourceApplyFtrlOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::BoolAttr getMultiplyLinearByLrAttr(); + bool getMultiplyLinearByLr(); +}; +} // namespace detail +template +class ResourceApplyFtrlOpGenericAdaptor : public detail::ResourceApplyFtrlOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceApplyFtrlOpGenericAdaptorBase; +public: + ResourceApplyFtrlOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceApplyFtrlOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceApplyFtrlOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceApplyFtrlOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVar() { + return (*getODSOperands(0).begin()); + } + + ValueT getAccum() { + return (*getODSOperands(1).begin()); + } + + ValueT getLinear() { + return (*getODSOperands(2).begin()); + } + + ValueT getGrad() { + return (*getODSOperands(3).begin()); + } + + ValueT getLr() { + return (*getODSOperands(4).begin()); + } + + ValueT getL1() { + return (*getODSOperands(5).begin()); + } + + ValueT getL2() { + return (*getODSOperands(6).begin()); + } + + ValueT getLrPower() { + return (*getODSOperands(7).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceApplyFtrlOpAdaptor : public ResourceApplyFtrlOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceApplyFtrlOpGenericAdaptor::ResourceApplyFtrlOpGenericAdaptor; + ResourceApplyFtrlOpAdaptor(ResourceApplyFtrlOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceApplyFtrlOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceApplyFtrlOpAdaptor; + template + using GenericAdaptor = ResourceApplyFtrlOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("multiply_linear_by_lr"), ::llvm::StringRef("use_locking")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getMultiplyLinearByLrAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getMultiplyLinearByLrAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getUseLockingAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getUseLockingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceApplyFtrl"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getVar(); + ::mlir::TypedValue<::mlir::TensorType> getAccum(); + ::mlir::TypedValue<::mlir::TensorType> getLinear(); + ::mlir::TypedValue<::mlir::TensorType> getGrad(); + ::mlir::TypedValue<::mlir::TensorType> getLr(); + ::mlir::TypedValue<::mlir::TensorType> getL1(); + ::mlir::TypedValue<::mlir::TensorType> getL2(); + ::mlir::TypedValue<::mlir::TensorType> getLrPower(); + ::mlir::OpOperand &getVarMutable(); + ::mlir::OpOperand &getAccumMutable(); + ::mlir::OpOperand &getLinearMutable(); + ::mlir::OpOperand &getGradMutable(); + ::mlir::OpOperand &getLrMutable(); + ::mlir::OpOperand &getL1Mutable(); + ::mlir::OpOperand &getL2Mutable(); + ::mlir::OpOperand &getLrPowerMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::BoolAttr getMultiplyLinearByLrAttr(); + bool getMultiplyLinearByLr(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setUseLockingAttr(::mlir::BoolAttr attr); + void setUseLocking(::std::optional attrValue); + void setMultiplyLinearByLrAttr(::mlir::BoolAttr attr); + void setMultiplyLinearByLr(::std::optional attrValue); + ::mlir::Attribute removeUseLockingAttr(); + ::mlir::Attribute removeMultiplyLinearByLrAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value linear, ::mlir::Value grad, ::mlir::Value lr, ::mlir::Value l1, ::mlir::Value l2, ::mlir::Value lr_power, /*optional*/::mlir::BoolAttr use_locking, /*optional*/::mlir::BoolAttr multiply_linear_by_lr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value linear, ::mlir::Value grad, ::mlir::Value lr, ::mlir::Value l1, ::mlir::Value l2, ::mlir::Value lr_power, /*optional*/::mlir::BoolAttr use_locking, /*optional*/::mlir::BoolAttr multiply_linear_by_lr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value linear, ::mlir::Value grad, ::mlir::Value lr, ::mlir::Value l1, ::mlir::Value l2, ::mlir::Value lr_power, /*optional*/bool use_locking = false, /*optional*/bool multiply_linear_by_lr = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value linear, ::mlir::Value grad, ::mlir::Value lr, ::mlir::Value l1, ::mlir::Value l2, ::mlir::Value lr_power, /*optional*/bool use_locking = false, /*optional*/bool multiply_linear_by_lr = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceApplyFtrlOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceApplyFtrlV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceApplyFtrlV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceApplyFtrlV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceApplyFtrlV2OpGenericAdaptorBase(ResourceApplyFtrlV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::BoolAttr getMultiplyLinearByLrAttr(); + bool getMultiplyLinearByLr(); +}; +} // namespace detail +template +class ResourceApplyFtrlV2OpGenericAdaptor : public detail::ResourceApplyFtrlV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceApplyFtrlV2OpGenericAdaptorBase; +public: + ResourceApplyFtrlV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceApplyFtrlV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceApplyFtrlV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceApplyFtrlV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVar() { + return (*getODSOperands(0).begin()); + } + + ValueT getAccum() { + return (*getODSOperands(1).begin()); + } + + ValueT getLinear() { + return (*getODSOperands(2).begin()); + } + + ValueT getGrad() { + return (*getODSOperands(3).begin()); + } + + ValueT getLr() { + return (*getODSOperands(4).begin()); + } + + ValueT getL1() { + return (*getODSOperands(5).begin()); + } + + ValueT getL2() { + return (*getODSOperands(6).begin()); + } + + ValueT getL2Shrinkage() { + return (*getODSOperands(7).begin()); + } + + ValueT getLrPower() { + return (*getODSOperands(8).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceApplyFtrlV2OpAdaptor : public ResourceApplyFtrlV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceApplyFtrlV2OpGenericAdaptor::ResourceApplyFtrlV2OpGenericAdaptor; + ResourceApplyFtrlV2OpAdaptor(ResourceApplyFtrlV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceApplyFtrlV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceApplyFtrlV2OpAdaptor; + template + using GenericAdaptor = ResourceApplyFtrlV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("multiply_linear_by_lr"), ::llvm::StringRef("use_locking")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getMultiplyLinearByLrAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getMultiplyLinearByLrAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getUseLockingAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getUseLockingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceApplyFtrlV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getVar(); + ::mlir::TypedValue<::mlir::TensorType> getAccum(); + ::mlir::TypedValue<::mlir::TensorType> getLinear(); + ::mlir::TypedValue<::mlir::TensorType> getGrad(); + ::mlir::TypedValue<::mlir::TensorType> getLr(); + ::mlir::TypedValue<::mlir::TensorType> getL1(); + ::mlir::TypedValue<::mlir::TensorType> getL2(); + ::mlir::TypedValue<::mlir::TensorType> getL2Shrinkage(); + ::mlir::TypedValue<::mlir::TensorType> getLrPower(); + ::mlir::OpOperand &getVarMutable(); + ::mlir::OpOperand &getAccumMutable(); + ::mlir::OpOperand &getLinearMutable(); + ::mlir::OpOperand &getGradMutable(); + ::mlir::OpOperand &getLrMutable(); + ::mlir::OpOperand &getL1Mutable(); + ::mlir::OpOperand &getL2Mutable(); + ::mlir::OpOperand &getL2ShrinkageMutable(); + ::mlir::OpOperand &getLrPowerMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::BoolAttr getMultiplyLinearByLrAttr(); + bool getMultiplyLinearByLr(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setUseLockingAttr(::mlir::BoolAttr attr); + void setUseLocking(::std::optional attrValue); + void setMultiplyLinearByLrAttr(::mlir::BoolAttr attr); + void setMultiplyLinearByLr(::std::optional attrValue); + ::mlir::Attribute removeUseLockingAttr(); + ::mlir::Attribute removeMultiplyLinearByLrAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value linear, ::mlir::Value grad, ::mlir::Value lr, ::mlir::Value l1, ::mlir::Value l2, ::mlir::Value l2_shrinkage, ::mlir::Value lr_power, /*optional*/::mlir::BoolAttr use_locking, /*optional*/::mlir::BoolAttr multiply_linear_by_lr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value linear, ::mlir::Value grad, ::mlir::Value lr, ::mlir::Value l1, ::mlir::Value l2, ::mlir::Value l2_shrinkage, ::mlir::Value lr_power, /*optional*/::mlir::BoolAttr use_locking, /*optional*/::mlir::BoolAttr multiply_linear_by_lr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value linear, ::mlir::Value grad, ::mlir::Value lr, ::mlir::Value l1, ::mlir::Value l2, ::mlir::Value l2_shrinkage, ::mlir::Value lr_power, /*optional*/bool use_locking = false, /*optional*/bool multiply_linear_by_lr = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value linear, ::mlir::Value grad, ::mlir::Value lr, ::mlir::Value l1, ::mlir::Value l2, ::mlir::Value l2_shrinkage, ::mlir::Value lr_power, /*optional*/bool use_locking = false, /*optional*/bool multiply_linear_by_lr = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceApplyFtrlV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceApplyGradientDescentOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceApplyGradientDescentOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceApplyGradientDescentOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceApplyGradientDescentOpGenericAdaptorBase(ResourceApplyGradientDescentOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); +}; +} // namespace detail +template +class ResourceApplyGradientDescentOpGenericAdaptor : public detail::ResourceApplyGradientDescentOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceApplyGradientDescentOpGenericAdaptorBase; +public: + ResourceApplyGradientDescentOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceApplyGradientDescentOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceApplyGradientDescentOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceApplyGradientDescentOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVar() { + return (*getODSOperands(0).begin()); + } + + ValueT getAlpha() { + return (*getODSOperands(1).begin()); + } + + ValueT getDelta() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceApplyGradientDescentOpAdaptor : public ResourceApplyGradientDescentOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceApplyGradientDescentOpGenericAdaptor::ResourceApplyGradientDescentOpGenericAdaptor; + ResourceApplyGradientDescentOpAdaptor(ResourceApplyGradientDescentOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceApplyGradientDescentOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceApplyGradientDescentOpAdaptor; + template + using GenericAdaptor = ResourceApplyGradientDescentOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("use_locking")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getUseLockingAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getUseLockingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceApplyGradientDescent"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getVar(); + ::mlir::TypedValue<::mlir::TensorType> getAlpha(); + ::mlir::TypedValue<::mlir::TensorType> getDelta(); + ::mlir::OpOperand &getVarMutable(); + ::mlir::OpOperand &getAlphaMutable(); + ::mlir::OpOperand &getDeltaMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setUseLockingAttr(::mlir::BoolAttr attr); + void setUseLocking(::std::optional attrValue); + ::mlir::Attribute removeUseLockingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value alpha, ::mlir::Value delta, /*optional*/::mlir::BoolAttr use_locking); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value alpha, ::mlir::Value delta, /*optional*/::mlir::BoolAttr use_locking); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value alpha, ::mlir::Value delta, /*optional*/bool use_locking = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value alpha, ::mlir::Value delta, /*optional*/bool use_locking = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceApplyGradientDescentOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceApplyKerasMomentumOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceApplyKerasMomentumOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceApplyKerasMomentumOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceApplyKerasMomentumOpGenericAdaptorBase(ResourceApplyKerasMomentumOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::BoolAttr getUseNesterovAttr(); + bool getUseNesterov(); +}; +} // namespace detail +template +class ResourceApplyKerasMomentumOpGenericAdaptor : public detail::ResourceApplyKerasMomentumOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceApplyKerasMomentumOpGenericAdaptorBase; +public: + ResourceApplyKerasMomentumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceApplyKerasMomentumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceApplyKerasMomentumOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceApplyKerasMomentumOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVar() { + return (*getODSOperands(0).begin()); + } + + ValueT getAccum() { + return (*getODSOperands(1).begin()); + } + + ValueT getLr() { + return (*getODSOperands(2).begin()); + } + + ValueT getGrad() { + return (*getODSOperands(3).begin()); + } + + ValueT getMomentum() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceApplyKerasMomentumOpAdaptor : public ResourceApplyKerasMomentumOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceApplyKerasMomentumOpGenericAdaptor::ResourceApplyKerasMomentumOpGenericAdaptor; + ResourceApplyKerasMomentumOpAdaptor(ResourceApplyKerasMomentumOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceApplyKerasMomentumOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceApplyKerasMomentumOpAdaptor; + template + using GenericAdaptor = ResourceApplyKerasMomentumOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("use_locking"), ::llvm::StringRef("use_nesterov")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getUseLockingAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getUseLockingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getUseNesterovAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getUseNesterovAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceApplyKerasMomentum"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getVar(); + ::mlir::TypedValue<::mlir::TensorType> getAccum(); + ::mlir::TypedValue<::mlir::TensorType> getLr(); + ::mlir::TypedValue<::mlir::TensorType> getGrad(); + ::mlir::TypedValue<::mlir::TensorType> getMomentum(); + ::mlir::OpOperand &getVarMutable(); + ::mlir::OpOperand &getAccumMutable(); + ::mlir::OpOperand &getLrMutable(); + ::mlir::OpOperand &getGradMutable(); + ::mlir::OpOperand &getMomentumMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::BoolAttr getUseNesterovAttr(); + bool getUseNesterov(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setUseLockingAttr(::mlir::BoolAttr attr); + void setUseLocking(::std::optional attrValue); + void setUseNesterovAttr(::mlir::BoolAttr attr); + void setUseNesterov(::std::optional attrValue); + ::mlir::Attribute removeUseLockingAttr(); + ::mlir::Attribute removeUseNesterovAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value lr, ::mlir::Value grad, ::mlir::Value momentum, /*optional*/::mlir::BoolAttr use_locking, /*optional*/::mlir::BoolAttr use_nesterov); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value lr, ::mlir::Value grad, ::mlir::Value momentum, /*optional*/::mlir::BoolAttr use_locking, /*optional*/::mlir::BoolAttr use_nesterov); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value lr, ::mlir::Value grad, ::mlir::Value momentum, /*optional*/bool use_locking = false, /*optional*/bool use_nesterov = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value lr, ::mlir::Value grad, ::mlir::Value momentum, /*optional*/bool use_locking = false, /*optional*/bool use_nesterov = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceApplyKerasMomentumOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceApplyMomentumOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceApplyMomentumOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceApplyMomentumOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceApplyMomentumOpGenericAdaptorBase(ResourceApplyMomentumOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::BoolAttr getUseNesterovAttr(); + bool getUseNesterov(); +}; +} // namespace detail +template +class ResourceApplyMomentumOpGenericAdaptor : public detail::ResourceApplyMomentumOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceApplyMomentumOpGenericAdaptorBase; +public: + ResourceApplyMomentumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceApplyMomentumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceApplyMomentumOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceApplyMomentumOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVar() { + return (*getODSOperands(0).begin()); + } + + ValueT getAccum() { + return (*getODSOperands(1).begin()); + } + + ValueT getLr() { + return (*getODSOperands(2).begin()); + } + + ValueT getGrad() { + return (*getODSOperands(3).begin()); + } + + ValueT getMomentum() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceApplyMomentumOpAdaptor : public ResourceApplyMomentumOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceApplyMomentumOpGenericAdaptor::ResourceApplyMomentumOpGenericAdaptor; + ResourceApplyMomentumOpAdaptor(ResourceApplyMomentumOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceApplyMomentumOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceApplyMomentumOpAdaptor; + template + using GenericAdaptor = ResourceApplyMomentumOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("use_locking"), ::llvm::StringRef("use_nesterov")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getUseLockingAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getUseLockingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getUseNesterovAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getUseNesterovAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceApplyMomentum"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getVar(); + ::mlir::TypedValue<::mlir::TensorType> getAccum(); + ::mlir::TypedValue<::mlir::TensorType> getLr(); + ::mlir::TypedValue<::mlir::TensorType> getGrad(); + ::mlir::TypedValue<::mlir::TensorType> getMomentum(); + ::mlir::OpOperand &getVarMutable(); + ::mlir::OpOperand &getAccumMutable(); + ::mlir::OpOperand &getLrMutable(); + ::mlir::OpOperand &getGradMutable(); + ::mlir::OpOperand &getMomentumMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::BoolAttr getUseNesterovAttr(); + bool getUseNesterov(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setUseLockingAttr(::mlir::BoolAttr attr); + void setUseLocking(::std::optional attrValue); + void setUseNesterovAttr(::mlir::BoolAttr attr); + void setUseNesterov(::std::optional attrValue); + ::mlir::Attribute removeUseLockingAttr(); + ::mlir::Attribute removeUseNesterovAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value lr, ::mlir::Value grad, ::mlir::Value momentum, /*optional*/::mlir::BoolAttr use_locking, /*optional*/::mlir::BoolAttr use_nesterov); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value lr, ::mlir::Value grad, ::mlir::Value momentum, /*optional*/::mlir::BoolAttr use_locking, /*optional*/::mlir::BoolAttr use_nesterov); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value lr, ::mlir::Value grad, ::mlir::Value momentum, /*optional*/bool use_locking = false, /*optional*/bool use_nesterov = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value lr, ::mlir::Value grad, ::mlir::Value momentum, /*optional*/bool use_locking = false, /*optional*/bool use_nesterov = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceApplyMomentumOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceApplyPowerSignOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceApplyPowerSignOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceApplyPowerSignOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceApplyPowerSignOpGenericAdaptorBase(ResourceApplyPowerSignOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); +}; +} // namespace detail +template +class ResourceApplyPowerSignOpGenericAdaptor : public detail::ResourceApplyPowerSignOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceApplyPowerSignOpGenericAdaptorBase; +public: + ResourceApplyPowerSignOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceApplyPowerSignOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceApplyPowerSignOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceApplyPowerSignOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVar() { + return (*getODSOperands(0).begin()); + } + + ValueT getM() { + return (*getODSOperands(1).begin()); + } + + ValueT getLr() { + return (*getODSOperands(2).begin()); + } + + ValueT getLogbase() { + return (*getODSOperands(3).begin()); + } + + ValueT getSignDecay() { + return (*getODSOperands(4).begin()); + } + + ValueT getBeta() { + return (*getODSOperands(5).begin()); + } + + ValueT getGrad() { + return (*getODSOperands(6).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceApplyPowerSignOpAdaptor : public ResourceApplyPowerSignOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceApplyPowerSignOpGenericAdaptor::ResourceApplyPowerSignOpGenericAdaptor; + ResourceApplyPowerSignOpAdaptor(ResourceApplyPowerSignOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceApplyPowerSignOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceApplyPowerSignOpAdaptor; + template + using GenericAdaptor = ResourceApplyPowerSignOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("use_locking")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getUseLockingAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getUseLockingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceApplyPowerSign"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getVar(); + ::mlir::TypedValue<::mlir::TensorType> getM(); + ::mlir::TypedValue<::mlir::TensorType> getLr(); + ::mlir::TypedValue<::mlir::TensorType> getLogbase(); + ::mlir::TypedValue<::mlir::TensorType> getSignDecay(); + ::mlir::TypedValue<::mlir::TensorType> getBeta(); + ::mlir::TypedValue<::mlir::TensorType> getGrad(); + ::mlir::OpOperand &getVarMutable(); + ::mlir::OpOperand &getMMutable(); + ::mlir::OpOperand &getLrMutable(); + ::mlir::OpOperand &getLogbaseMutable(); + ::mlir::OpOperand &getSignDecayMutable(); + ::mlir::OpOperand &getBetaMutable(); + ::mlir::OpOperand &getGradMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setUseLockingAttr(::mlir::BoolAttr attr); + void setUseLocking(::std::optional attrValue); + ::mlir::Attribute removeUseLockingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value m, ::mlir::Value lr, ::mlir::Value logbase, ::mlir::Value sign_decay, ::mlir::Value beta, ::mlir::Value grad, /*optional*/::mlir::BoolAttr use_locking); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value m, ::mlir::Value lr, ::mlir::Value logbase, ::mlir::Value sign_decay, ::mlir::Value beta, ::mlir::Value grad, /*optional*/::mlir::BoolAttr use_locking); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value m, ::mlir::Value lr, ::mlir::Value logbase, ::mlir::Value sign_decay, ::mlir::Value beta, ::mlir::Value grad, /*optional*/bool use_locking = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value m, ::mlir::Value lr, ::mlir::Value logbase, ::mlir::Value sign_decay, ::mlir::Value beta, ::mlir::Value grad, /*optional*/bool use_locking = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceApplyPowerSignOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceApplyProximalAdagradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceApplyProximalAdagradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceApplyProximalAdagradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceApplyProximalAdagradOpGenericAdaptorBase(ResourceApplyProximalAdagradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); +}; +} // namespace detail +template +class ResourceApplyProximalAdagradOpGenericAdaptor : public detail::ResourceApplyProximalAdagradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceApplyProximalAdagradOpGenericAdaptorBase; +public: + ResourceApplyProximalAdagradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceApplyProximalAdagradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceApplyProximalAdagradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceApplyProximalAdagradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVar() { + return (*getODSOperands(0).begin()); + } + + ValueT getAccum() { + return (*getODSOperands(1).begin()); + } + + ValueT getLr() { + return (*getODSOperands(2).begin()); + } + + ValueT getL1() { + return (*getODSOperands(3).begin()); + } + + ValueT getL2() { + return (*getODSOperands(4).begin()); + } + + ValueT getGrad() { + return (*getODSOperands(5).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceApplyProximalAdagradOpAdaptor : public ResourceApplyProximalAdagradOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceApplyProximalAdagradOpGenericAdaptor::ResourceApplyProximalAdagradOpGenericAdaptor; + ResourceApplyProximalAdagradOpAdaptor(ResourceApplyProximalAdagradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceApplyProximalAdagradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceApplyProximalAdagradOpAdaptor; + template + using GenericAdaptor = ResourceApplyProximalAdagradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("use_locking")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getUseLockingAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getUseLockingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceApplyProximalAdagrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getVar(); + ::mlir::TypedValue<::mlir::TensorType> getAccum(); + ::mlir::TypedValue<::mlir::TensorType> getLr(); + ::mlir::TypedValue<::mlir::TensorType> getL1(); + ::mlir::TypedValue<::mlir::TensorType> getL2(); + ::mlir::TypedValue<::mlir::TensorType> getGrad(); + ::mlir::OpOperand &getVarMutable(); + ::mlir::OpOperand &getAccumMutable(); + ::mlir::OpOperand &getLrMutable(); + ::mlir::OpOperand &getL1Mutable(); + ::mlir::OpOperand &getL2Mutable(); + ::mlir::OpOperand &getGradMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setUseLockingAttr(::mlir::BoolAttr attr); + void setUseLocking(::std::optional attrValue); + ::mlir::Attribute removeUseLockingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value lr, ::mlir::Value l1, ::mlir::Value l2, ::mlir::Value grad, /*optional*/::mlir::BoolAttr use_locking); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value lr, ::mlir::Value l1, ::mlir::Value l2, ::mlir::Value grad, /*optional*/::mlir::BoolAttr use_locking); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value lr, ::mlir::Value l1, ::mlir::Value l2, ::mlir::Value grad, /*optional*/bool use_locking = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value lr, ::mlir::Value l1, ::mlir::Value l2, ::mlir::Value grad, /*optional*/bool use_locking = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceApplyProximalAdagradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceApplyProximalGradientDescentOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceApplyProximalGradientDescentOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceApplyProximalGradientDescentOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceApplyProximalGradientDescentOpGenericAdaptorBase(ResourceApplyProximalGradientDescentOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); +}; +} // namespace detail +template +class ResourceApplyProximalGradientDescentOpGenericAdaptor : public detail::ResourceApplyProximalGradientDescentOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceApplyProximalGradientDescentOpGenericAdaptorBase; +public: + ResourceApplyProximalGradientDescentOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceApplyProximalGradientDescentOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceApplyProximalGradientDescentOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceApplyProximalGradientDescentOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVar() { + return (*getODSOperands(0).begin()); + } + + ValueT getAlpha() { + return (*getODSOperands(1).begin()); + } + + ValueT getL1() { + return (*getODSOperands(2).begin()); + } + + ValueT getL2() { + return (*getODSOperands(3).begin()); + } + + ValueT getDelta() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceApplyProximalGradientDescentOpAdaptor : public ResourceApplyProximalGradientDescentOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceApplyProximalGradientDescentOpGenericAdaptor::ResourceApplyProximalGradientDescentOpGenericAdaptor; + ResourceApplyProximalGradientDescentOpAdaptor(ResourceApplyProximalGradientDescentOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceApplyProximalGradientDescentOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceApplyProximalGradientDescentOpAdaptor; + template + using GenericAdaptor = ResourceApplyProximalGradientDescentOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("use_locking")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getUseLockingAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getUseLockingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceApplyProximalGradientDescent"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getVar(); + ::mlir::TypedValue<::mlir::TensorType> getAlpha(); + ::mlir::TypedValue<::mlir::TensorType> getL1(); + ::mlir::TypedValue<::mlir::TensorType> getL2(); + ::mlir::TypedValue<::mlir::TensorType> getDelta(); + ::mlir::OpOperand &getVarMutable(); + ::mlir::OpOperand &getAlphaMutable(); + ::mlir::OpOperand &getL1Mutable(); + ::mlir::OpOperand &getL2Mutable(); + ::mlir::OpOperand &getDeltaMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setUseLockingAttr(::mlir::BoolAttr attr); + void setUseLocking(::std::optional attrValue); + ::mlir::Attribute removeUseLockingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value alpha, ::mlir::Value l1, ::mlir::Value l2, ::mlir::Value delta, /*optional*/::mlir::BoolAttr use_locking); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value alpha, ::mlir::Value l1, ::mlir::Value l2, ::mlir::Value delta, /*optional*/::mlir::BoolAttr use_locking); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value alpha, ::mlir::Value l1, ::mlir::Value l2, ::mlir::Value delta, /*optional*/bool use_locking = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value alpha, ::mlir::Value l1, ::mlir::Value l2, ::mlir::Value delta, /*optional*/bool use_locking = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceApplyProximalGradientDescentOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceApplyRMSPropOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceApplyRMSPropOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceApplyRMSPropOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceApplyRMSPropOpGenericAdaptorBase(ResourceApplyRMSPropOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); +}; +} // namespace detail +template +class ResourceApplyRMSPropOpGenericAdaptor : public detail::ResourceApplyRMSPropOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceApplyRMSPropOpGenericAdaptorBase; +public: + ResourceApplyRMSPropOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceApplyRMSPropOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceApplyRMSPropOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceApplyRMSPropOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVar() { + return (*getODSOperands(0).begin()); + } + + ValueT getMs() { + return (*getODSOperands(1).begin()); + } + + ValueT getMom() { + return (*getODSOperands(2).begin()); + } + + ValueT getLr() { + return (*getODSOperands(3).begin()); + } + + ValueT getRho() { + return (*getODSOperands(4).begin()); + } + + ValueT getMomentum() { + return (*getODSOperands(5).begin()); + } + + ValueT getEpsilon() { + return (*getODSOperands(6).begin()); + } + + ValueT getGrad() { + return (*getODSOperands(7).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceApplyRMSPropOpAdaptor : public ResourceApplyRMSPropOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceApplyRMSPropOpGenericAdaptor::ResourceApplyRMSPropOpGenericAdaptor; + ResourceApplyRMSPropOpAdaptor(ResourceApplyRMSPropOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceApplyRMSPropOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceApplyRMSPropOpAdaptor; + template + using GenericAdaptor = ResourceApplyRMSPropOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("use_locking")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getUseLockingAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getUseLockingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceApplyRMSProp"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getVar(); + ::mlir::TypedValue<::mlir::TensorType> getMs(); + ::mlir::TypedValue<::mlir::TensorType> getMom(); + ::mlir::TypedValue<::mlir::TensorType> getLr(); + ::mlir::TypedValue<::mlir::TensorType> getRho(); + ::mlir::TypedValue<::mlir::TensorType> getMomentum(); + ::mlir::TypedValue<::mlir::TensorType> getEpsilon(); + ::mlir::TypedValue<::mlir::TensorType> getGrad(); + ::mlir::OpOperand &getVarMutable(); + ::mlir::OpOperand &getMsMutable(); + ::mlir::OpOperand &getMomMutable(); + ::mlir::OpOperand &getLrMutable(); + ::mlir::OpOperand &getRhoMutable(); + ::mlir::OpOperand &getMomentumMutable(); + ::mlir::OpOperand &getEpsilonMutable(); + ::mlir::OpOperand &getGradMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setUseLockingAttr(::mlir::BoolAttr attr); + void setUseLocking(::std::optional attrValue); + ::mlir::Attribute removeUseLockingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value ms, ::mlir::Value mom, ::mlir::Value lr, ::mlir::Value rho, ::mlir::Value momentum, ::mlir::Value epsilon, ::mlir::Value grad, /*optional*/::mlir::BoolAttr use_locking); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value ms, ::mlir::Value mom, ::mlir::Value lr, ::mlir::Value rho, ::mlir::Value momentum, ::mlir::Value epsilon, ::mlir::Value grad, /*optional*/::mlir::BoolAttr use_locking); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value ms, ::mlir::Value mom, ::mlir::Value lr, ::mlir::Value rho, ::mlir::Value momentum, ::mlir::Value epsilon, ::mlir::Value grad, /*optional*/bool use_locking = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value ms, ::mlir::Value mom, ::mlir::Value lr, ::mlir::Value rho, ::mlir::Value momentum, ::mlir::Value epsilon, ::mlir::Value grad, /*optional*/bool use_locking = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceApplyRMSPropOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceGatherNdOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceGatherNdOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceGatherNdOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceGatherNdOpGenericAdaptorBase(ResourceGatherNdOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ResourceGatherNdOpGenericAdaptor : public detail::ResourceGatherNdOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceGatherNdOpGenericAdaptorBase; +public: + ResourceGatherNdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceGatherNdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceGatherNdOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceGatherNdOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getResource() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceGatherNdOpAdaptor : public ResourceGatherNdOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceGatherNdOpGenericAdaptor::ResourceGatherNdOpGenericAdaptor; + ResourceGatherNdOpAdaptor(ResourceGatherNdOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceGatherNdOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceGatherNdOpAdaptor; + template + using GenericAdaptor = ResourceGatherNdOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tindices"), ::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceGatherNd"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResource(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::OpOperand &getResourceMutable(); + ::mlir::OpOperand &getIndicesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getTindices(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value resource, ::mlir::Value indices); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value resource, ::mlir::Value indices); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceGatherNdOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceGatherOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceGatherOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceGatherOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceGatherOpGenericAdaptorBase(ResourceGatherOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getBatchDimsAttr(); + uint64_t getBatchDims(); + ::mlir::BoolAttr getValidateIndicesAttr(); + bool getValidateIndices(); +}; +} // namespace detail +template +class ResourceGatherOpGenericAdaptor : public detail::ResourceGatherOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceGatherOpGenericAdaptorBase; +public: + ResourceGatherOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceGatherOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceGatherOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceGatherOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getResource() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceGatherOpAdaptor : public ResourceGatherOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceGatherOpGenericAdaptor::ResourceGatherOpGenericAdaptor; + ResourceGatherOpAdaptor(ResourceGatherOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceGatherOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceGatherOpAdaptor; + template + using GenericAdaptor = ResourceGatherOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tindices"), ::llvm::StringRef("batch_dims"), ::llvm::StringRef("dtype"), ::llvm::StringRef("validate_indices")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getBatchDimsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getBatchDimsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getValidateIndicesAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getValidateIndicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceGather"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResource(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::OpOperand &getResourceMutable(); + ::mlir::OpOperand &getIndicesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getBatchDimsAttr(); + uint64_t getBatchDims(); + ::mlir::BoolAttr getValidateIndicesAttr(); + bool getValidateIndices(); + ::mlir::Type getTindices(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setBatchDimsAttr(::mlir::IntegerAttr attr); + void setBatchDims(::std::optional attrValue); + void setValidateIndicesAttr(::mlir::BoolAttr attr); + void setValidateIndices(::std::optional attrValue); + ::mlir::Attribute removeBatchDimsAttr(); + ::mlir::Attribute removeValidateIndicesAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value resource, ::mlir::Value indices, /*optional*/::mlir::IntegerAttr batch_dims, /*optional*/::mlir::BoolAttr validate_indices); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value resource, ::mlir::Value indices, /*optional*/::mlir::IntegerAttr batch_dims, /*optional*/::mlir::BoolAttr validate_indices); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value resource, ::mlir::Value indices, /*optional*/uint64_t batch_dims = 0, /*optional*/bool validate_indices = true); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value resource, ::mlir::Value indices, /*optional*/uint64_t batch_dims = 0, /*optional*/bool validate_indices = true); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceGatherOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceScatterAddOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceScatterAddOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceScatterAddOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceScatterAddOpGenericAdaptorBase(ResourceScatterAddOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ResourceScatterAddOpGenericAdaptor : public detail::ResourceScatterAddOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceScatterAddOpGenericAdaptorBase; +public: + ResourceScatterAddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceScatterAddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceScatterAddOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceScatterAddOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getResource() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getUpdates() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceScatterAddOpAdaptor : public ResourceScatterAddOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceScatterAddOpGenericAdaptor::ResourceScatterAddOpGenericAdaptor; + ResourceScatterAddOpAdaptor(ResourceScatterAddOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceScatterAddOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceScatterAddOpAdaptor; + template + using GenericAdaptor = ResourceScatterAddOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tindices"), ::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceScatterAdd"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResource(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getUpdates(); + ::mlir::OpOperand &getResourceMutable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getUpdatesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Type getTindices(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value resource, ::mlir::Value indices, ::mlir::Value updates); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value resource, ::mlir::Value indices, ::mlir::Value updates); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceScatterAddOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceScatterDivOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceScatterDivOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceScatterDivOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceScatterDivOpGenericAdaptorBase(ResourceScatterDivOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ResourceScatterDivOpGenericAdaptor : public detail::ResourceScatterDivOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceScatterDivOpGenericAdaptorBase; +public: + ResourceScatterDivOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceScatterDivOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceScatterDivOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceScatterDivOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getResource() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getUpdates() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceScatterDivOpAdaptor : public ResourceScatterDivOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceScatterDivOpGenericAdaptor::ResourceScatterDivOpGenericAdaptor; + ResourceScatterDivOpAdaptor(ResourceScatterDivOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceScatterDivOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceScatterDivOpAdaptor; + template + using GenericAdaptor = ResourceScatterDivOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tindices"), ::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceScatterDiv"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResource(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getUpdates(); + ::mlir::OpOperand &getResourceMutable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getUpdatesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Type getTindices(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value resource, ::mlir::Value indices, ::mlir::Value updates); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value resource, ::mlir::Value indices, ::mlir::Value updates); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceScatterDivOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceScatterMaxOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceScatterMaxOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceScatterMaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceScatterMaxOpGenericAdaptorBase(ResourceScatterMaxOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ResourceScatterMaxOpGenericAdaptor : public detail::ResourceScatterMaxOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceScatterMaxOpGenericAdaptorBase; +public: + ResourceScatterMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceScatterMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceScatterMaxOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceScatterMaxOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getResource() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getUpdates() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceScatterMaxOpAdaptor : public ResourceScatterMaxOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceScatterMaxOpGenericAdaptor::ResourceScatterMaxOpGenericAdaptor; + ResourceScatterMaxOpAdaptor(ResourceScatterMaxOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceScatterMaxOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceScatterMaxOpAdaptor; + template + using GenericAdaptor = ResourceScatterMaxOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tindices"), ::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceScatterMax"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResource(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getUpdates(); + ::mlir::OpOperand &getResourceMutable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getUpdatesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Type getTindices(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value resource, ::mlir::Value indices, ::mlir::Value updates); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value resource, ::mlir::Value indices, ::mlir::Value updates); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceScatterMaxOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceScatterMinOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceScatterMinOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceScatterMinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceScatterMinOpGenericAdaptorBase(ResourceScatterMinOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ResourceScatterMinOpGenericAdaptor : public detail::ResourceScatterMinOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceScatterMinOpGenericAdaptorBase; +public: + ResourceScatterMinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceScatterMinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceScatterMinOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceScatterMinOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getResource() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getUpdates() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceScatterMinOpAdaptor : public ResourceScatterMinOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceScatterMinOpGenericAdaptor::ResourceScatterMinOpGenericAdaptor; + ResourceScatterMinOpAdaptor(ResourceScatterMinOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceScatterMinOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceScatterMinOpAdaptor; + template + using GenericAdaptor = ResourceScatterMinOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tindices"), ::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceScatterMin"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResource(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getUpdates(); + ::mlir::OpOperand &getResourceMutable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getUpdatesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Type getTindices(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value resource, ::mlir::Value indices, ::mlir::Value updates); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value resource, ::mlir::Value indices, ::mlir::Value updates); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceScatterMinOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceScatterMulOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceScatterMulOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceScatterMulOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceScatterMulOpGenericAdaptorBase(ResourceScatterMulOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ResourceScatterMulOpGenericAdaptor : public detail::ResourceScatterMulOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceScatterMulOpGenericAdaptorBase; +public: + ResourceScatterMulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceScatterMulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceScatterMulOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceScatterMulOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getResource() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getUpdates() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceScatterMulOpAdaptor : public ResourceScatterMulOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceScatterMulOpGenericAdaptor::ResourceScatterMulOpGenericAdaptor; + ResourceScatterMulOpAdaptor(ResourceScatterMulOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceScatterMulOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceScatterMulOpAdaptor; + template + using GenericAdaptor = ResourceScatterMulOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tindices"), ::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceScatterMul"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResource(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getUpdates(); + ::mlir::OpOperand &getResourceMutable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getUpdatesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Type getTindices(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value resource, ::mlir::Value indices, ::mlir::Value updates); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value resource, ::mlir::Value indices, ::mlir::Value updates); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceScatterMulOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceScatterNdAddOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceScatterNdAddOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceScatterNdAddOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceScatterNdAddOpGenericAdaptorBase(ResourceScatterNdAddOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); +}; +} // namespace detail +template +class ResourceScatterNdAddOpGenericAdaptor : public detail::ResourceScatterNdAddOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceScatterNdAddOpGenericAdaptorBase; +public: + ResourceScatterNdAddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceScatterNdAddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceScatterNdAddOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceScatterNdAddOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getRef() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getUpdates() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceScatterNdAddOpAdaptor : public ResourceScatterNdAddOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceScatterNdAddOpGenericAdaptor::ResourceScatterNdAddOpGenericAdaptor; + ResourceScatterNdAddOpAdaptor(ResourceScatterNdAddOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceScatterNdAddOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceScatterNdAddOpAdaptor; + template + using GenericAdaptor = ResourceScatterNdAddOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices"), ::llvm::StringRef("use_locking")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getUseLockingAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getUseLockingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceScatterNdAdd"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getRef(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getUpdates(); + ::mlir::OpOperand &getRefMutable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getUpdatesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setUseLockingAttr(::mlir::BoolAttr attr); + void setUseLocking(::std::optional attrValue); + ::mlir::Attribute removeUseLockingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value ref, ::mlir::Value indices, ::mlir::Value updates, /*optional*/::mlir::BoolAttr use_locking); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ref, ::mlir::Value indices, ::mlir::Value updates, /*optional*/::mlir::BoolAttr use_locking); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value ref, ::mlir::Value indices, ::mlir::Value updates, /*optional*/bool use_locking = true); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ref, ::mlir::Value indices, ::mlir::Value updates, /*optional*/bool use_locking = true); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceScatterNdAddOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceScatterNdSubOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceScatterNdSubOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceScatterNdSubOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceScatterNdSubOpGenericAdaptorBase(ResourceScatterNdSubOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); +}; +} // namespace detail +template +class ResourceScatterNdSubOpGenericAdaptor : public detail::ResourceScatterNdSubOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceScatterNdSubOpGenericAdaptorBase; +public: + ResourceScatterNdSubOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceScatterNdSubOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceScatterNdSubOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceScatterNdSubOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getRef() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getUpdates() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceScatterNdSubOpAdaptor : public ResourceScatterNdSubOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceScatterNdSubOpGenericAdaptor::ResourceScatterNdSubOpGenericAdaptor; + ResourceScatterNdSubOpAdaptor(ResourceScatterNdSubOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceScatterNdSubOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceScatterNdSubOpAdaptor; + template + using GenericAdaptor = ResourceScatterNdSubOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices"), ::llvm::StringRef("use_locking")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getUseLockingAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getUseLockingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceScatterNdSub"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getRef(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getUpdates(); + ::mlir::OpOperand &getRefMutable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getUpdatesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setUseLockingAttr(::mlir::BoolAttr attr); + void setUseLocking(::std::optional attrValue); + ::mlir::Attribute removeUseLockingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value ref, ::mlir::Value indices, ::mlir::Value updates, /*optional*/::mlir::BoolAttr use_locking); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ref, ::mlir::Value indices, ::mlir::Value updates, /*optional*/::mlir::BoolAttr use_locking); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value ref, ::mlir::Value indices, ::mlir::Value updates, /*optional*/bool use_locking = true); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ref, ::mlir::Value indices, ::mlir::Value updates, /*optional*/bool use_locking = true); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceScatterNdSubOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceScatterNdUpdateOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceScatterNdUpdateOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceScatterNdUpdateOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceScatterNdUpdateOpGenericAdaptorBase(ResourceScatterNdUpdateOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); +}; +} // namespace detail +template +class ResourceScatterNdUpdateOpGenericAdaptor : public detail::ResourceScatterNdUpdateOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceScatterNdUpdateOpGenericAdaptorBase; +public: + ResourceScatterNdUpdateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceScatterNdUpdateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceScatterNdUpdateOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceScatterNdUpdateOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getRef() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getUpdates() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceScatterNdUpdateOpAdaptor : public ResourceScatterNdUpdateOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceScatterNdUpdateOpGenericAdaptor::ResourceScatterNdUpdateOpGenericAdaptor; + ResourceScatterNdUpdateOpAdaptor(ResourceScatterNdUpdateOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceScatterNdUpdateOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceScatterNdUpdateOpAdaptor; + template + using GenericAdaptor = ResourceScatterNdUpdateOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices"), ::llvm::StringRef("use_locking")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getUseLockingAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getUseLockingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceScatterNdUpdate"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getRef(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getUpdates(); + ::mlir::OpOperand &getRefMutable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getUpdatesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setUseLockingAttr(::mlir::BoolAttr attr); + void setUseLocking(::std::optional attrValue); + ::mlir::Attribute removeUseLockingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value ref, ::mlir::Value indices, ::mlir::Value updates, /*optional*/::mlir::BoolAttr use_locking); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ref, ::mlir::Value indices, ::mlir::Value updates, /*optional*/::mlir::BoolAttr use_locking); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value ref, ::mlir::Value indices, ::mlir::Value updates, /*optional*/bool use_locking = true); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ref, ::mlir::Value indices, ::mlir::Value updates, /*optional*/bool use_locking = true); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceScatterNdUpdateOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceScatterSubOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceScatterSubOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceScatterSubOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceScatterSubOpGenericAdaptorBase(ResourceScatterSubOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ResourceScatterSubOpGenericAdaptor : public detail::ResourceScatterSubOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceScatterSubOpGenericAdaptorBase; +public: + ResourceScatterSubOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceScatterSubOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceScatterSubOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceScatterSubOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getResource() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getUpdates() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceScatterSubOpAdaptor : public ResourceScatterSubOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceScatterSubOpGenericAdaptor::ResourceScatterSubOpGenericAdaptor; + ResourceScatterSubOpAdaptor(ResourceScatterSubOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceScatterSubOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceScatterSubOpAdaptor; + template + using GenericAdaptor = ResourceScatterSubOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tindices"), ::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceScatterSub"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResource(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getUpdates(); + ::mlir::OpOperand &getResourceMutable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getUpdatesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Type getTindices(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value resource, ::mlir::Value indices, ::mlir::Value updates); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value resource, ::mlir::Value indices, ::mlir::Value updates); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceScatterSubOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceScatterUpdateOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceScatterUpdateOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceScatterUpdateOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceScatterUpdateOpGenericAdaptorBase(ResourceScatterUpdateOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ResourceScatterUpdateOpGenericAdaptor : public detail::ResourceScatterUpdateOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceScatterUpdateOpGenericAdaptorBase; +public: + ResourceScatterUpdateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceScatterUpdateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceScatterUpdateOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceScatterUpdateOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getResource() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getUpdates() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceScatterUpdateOpAdaptor : public ResourceScatterUpdateOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceScatterUpdateOpGenericAdaptor::ResourceScatterUpdateOpGenericAdaptor; + ResourceScatterUpdateOpAdaptor(ResourceScatterUpdateOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceScatterUpdateOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceScatterUpdateOpAdaptor; + template + using GenericAdaptor = ResourceScatterUpdateOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tindices"), ::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceScatterUpdate"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResource(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getUpdates(); + ::mlir::OpOperand &getResourceMutable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getUpdatesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Type getTindices(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value resource, ::mlir::Value indices, ::mlir::Value updates); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value resource, ::mlir::Value indices, ::mlir::Value updates); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceScatterUpdateOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceSparseApplyAdagradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceSparseApplyAdagradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceSparseApplyAdagradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceSparseApplyAdagradOpGenericAdaptorBase(ResourceSparseApplyAdagradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::BoolAttr getUpdateSlotsAttr(); + bool getUpdateSlots(); +}; +} // namespace detail +template +class ResourceSparseApplyAdagradOpGenericAdaptor : public detail::ResourceSparseApplyAdagradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceSparseApplyAdagradOpGenericAdaptorBase; +public: + ResourceSparseApplyAdagradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceSparseApplyAdagradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceSparseApplyAdagradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceSparseApplyAdagradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVar() { + return (*getODSOperands(0).begin()); + } + + ValueT getAccum() { + return (*getODSOperands(1).begin()); + } + + ValueT getLr() { + return (*getODSOperands(2).begin()); + } + + ValueT getGrad() { + return (*getODSOperands(3).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceSparseApplyAdagradOpAdaptor : public ResourceSparseApplyAdagradOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceSparseApplyAdagradOpGenericAdaptor::ResourceSparseApplyAdagradOpGenericAdaptor; + ResourceSparseApplyAdagradOpAdaptor(ResourceSparseApplyAdagradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceSparseApplyAdagradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceSparseApplyAdagradOpAdaptor; + template + using GenericAdaptor = ResourceSparseApplyAdagradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices"), ::llvm::StringRef("update_slots"), ::llvm::StringRef("use_locking")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getUpdateSlotsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getUpdateSlotsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getUseLockingAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getUseLockingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceSparseApplyAdagrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getVar(); + ::mlir::TypedValue<::mlir::TensorType> getAccum(); + ::mlir::TypedValue<::mlir::TensorType> getLr(); + ::mlir::TypedValue<::mlir::TensorType> getGrad(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::OpOperand &getVarMutable(); + ::mlir::OpOperand &getAccumMutable(); + ::mlir::OpOperand &getLrMutable(); + ::mlir::OpOperand &getGradMutable(); + ::mlir::OpOperand &getIndicesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::BoolAttr getUpdateSlotsAttr(); + bool getUpdateSlots(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setUseLockingAttr(::mlir::BoolAttr attr); + void setUseLocking(::std::optional attrValue); + void setUpdateSlotsAttr(::mlir::BoolAttr attr); + void setUpdateSlots(::std::optional attrValue); + ::mlir::Attribute removeUseLockingAttr(); + ::mlir::Attribute removeUpdateSlotsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value lr, ::mlir::Value grad, ::mlir::Value indices, /*optional*/::mlir::BoolAttr use_locking, /*optional*/::mlir::BoolAttr update_slots); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value lr, ::mlir::Value grad, ::mlir::Value indices, /*optional*/::mlir::BoolAttr use_locking, /*optional*/::mlir::BoolAttr update_slots); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value lr, ::mlir::Value grad, ::mlir::Value indices, /*optional*/bool use_locking = false, /*optional*/bool update_slots = true); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value lr, ::mlir::Value grad, ::mlir::Value indices, /*optional*/bool use_locking = false, /*optional*/bool update_slots = true); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceSparseApplyAdagradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceSparseApplyAdagradV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceSparseApplyAdagradV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceSparseApplyAdagradV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceSparseApplyAdagradV2OpGenericAdaptorBase(ResourceSparseApplyAdagradV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::BoolAttr getUpdateSlotsAttr(); + bool getUpdateSlots(); +}; +} // namespace detail +template +class ResourceSparseApplyAdagradV2OpGenericAdaptor : public detail::ResourceSparseApplyAdagradV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceSparseApplyAdagradV2OpGenericAdaptorBase; +public: + ResourceSparseApplyAdagradV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceSparseApplyAdagradV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceSparseApplyAdagradV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceSparseApplyAdagradV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVar() { + return (*getODSOperands(0).begin()); + } + + ValueT getAccum() { + return (*getODSOperands(1).begin()); + } + + ValueT getLr() { + return (*getODSOperands(2).begin()); + } + + ValueT getEpsilon() { + return (*getODSOperands(3).begin()); + } + + ValueT getGrad() { + return (*getODSOperands(4).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(5).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceSparseApplyAdagradV2OpAdaptor : public ResourceSparseApplyAdagradV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceSparseApplyAdagradV2OpGenericAdaptor::ResourceSparseApplyAdagradV2OpGenericAdaptor; + ResourceSparseApplyAdagradV2OpAdaptor(ResourceSparseApplyAdagradV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceSparseApplyAdagradV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceSparseApplyAdagradV2OpAdaptor; + template + using GenericAdaptor = ResourceSparseApplyAdagradV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices"), ::llvm::StringRef("update_slots"), ::llvm::StringRef("use_locking")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getUpdateSlotsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getUpdateSlotsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getUseLockingAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getUseLockingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceSparseApplyAdagradV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getVar(); + ::mlir::TypedValue<::mlir::TensorType> getAccum(); + ::mlir::TypedValue<::mlir::TensorType> getLr(); + ::mlir::TypedValue<::mlir::TensorType> getEpsilon(); + ::mlir::TypedValue<::mlir::TensorType> getGrad(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::OpOperand &getVarMutable(); + ::mlir::OpOperand &getAccumMutable(); + ::mlir::OpOperand &getLrMutable(); + ::mlir::OpOperand &getEpsilonMutable(); + ::mlir::OpOperand &getGradMutable(); + ::mlir::OpOperand &getIndicesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::BoolAttr getUpdateSlotsAttr(); + bool getUpdateSlots(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setUseLockingAttr(::mlir::BoolAttr attr); + void setUseLocking(::std::optional attrValue); + void setUpdateSlotsAttr(::mlir::BoolAttr attr); + void setUpdateSlots(::std::optional attrValue); + ::mlir::Attribute removeUseLockingAttr(); + ::mlir::Attribute removeUpdateSlotsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value lr, ::mlir::Value epsilon, ::mlir::Value grad, ::mlir::Value indices, /*optional*/::mlir::BoolAttr use_locking, /*optional*/::mlir::BoolAttr update_slots); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value lr, ::mlir::Value epsilon, ::mlir::Value grad, ::mlir::Value indices, /*optional*/::mlir::BoolAttr use_locking, /*optional*/::mlir::BoolAttr update_slots); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value lr, ::mlir::Value epsilon, ::mlir::Value grad, ::mlir::Value indices, /*optional*/bool use_locking = false, /*optional*/bool update_slots = true); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value lr, ::mlir::Value epsilon, ::mlir::Value grad, ::mlir::Value indices, /*optional*/bool use_locking = false, /*optional*/bool update_slots = true); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceSparseApplyAdagradV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceSparseApplyFtrlOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceSparseApplyFtrlOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceSparseApplyFtrlOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceSparseApplyFtrlOpGenericAdaptorBase(ResourceSparseApplyFtrlOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::BoolAttr getMultiplyLinearByLrAttr(); + bool getMultiplyLinearByLr(); +}; +} // namespace detail +template +class ResourceSparseApplyFtrlOpGenericAdaptor : public detail::ResourceSparseApplyFtrlOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceSparseApplyFtrlOpGenericAdaptorBase; +public: + ResourceSparseApplyFtrlOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceSparseApplyFtrlOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceSparseApplyFtrlOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceSparseApplyFtrlOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getVar() { + return (*getODSOperands(0).begin()); + } + + ValueT getAccum() { + return (*getODSOperands(1).begin()); + } + + ValueT getLinear() { + return (*getODSOperands(2).begin()); + } + + ValueT getGrad() { + return (*getODSOperands(3).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(4).begin()); + } + + ValueT getLr() { + return (*getODSOperands(5).begin()); + } + + ValueT getL1() { + return (*getODSOperands(6).begin()); + } + + ValueT getL2() { + return (*getODSOperands(7).begin()); + } + + ValueT getLrPower() { + return (*getODSOperands(8).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceSparseApplyFtrlOpAdaptor : public ResourceSparseApplyFtrlOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceSparseApplyFtrlOpGenericAdaptor::ResourceSparseApplyFtrlOpGenericAdaptor; + ResourceSparseApplyFtrlOpAdaptor(ResourceSparseApplyFtrlOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceSparseApplyFtrlOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceSparseApplyFtrlOpAdaptor; + template + using GenericAdaptor = ResourceSparseApplyFtrlOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices"), ::llvm::StringRef("multiply_linear_by_lr"), ::llvm::StringRef("use_locking")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getMultiplyLinearByLrAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getMultiplyLinearByLrAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getUseLockingAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getUseLockingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceSparseApplyFtrl"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getVar(); + ::mlir::TypedValue<::mlir::TensorType> getAccum(); + ::mlir::TypedValue<::mlir::TensorType> getLinear(); + ::mlir::TypedValue<::mlir::TensorType> getGrad(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getLr(); + ::mlir::TypedValue<::mlir::TensorType> getL1(); + ::mlir::TypedValue<::mlir::TensorType> getL2(); + ::mlir::TypedValue<::mlir::TensorType> getLrPower(); + ::mlir::OpOperand &getVarMutable(); + ::mlir::OpOperand &getAccumMutable(); + ::mlir::OpOperand &getLinearMutable(); + ::mlir::OpOperand &getGradMutable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getLrMutable(); + ::mlir::OpOperand &getL1Mutable(); + ::mlir::OpOperand &getL2Mutable(); + ::mlir::OpOperand &getLrPowerMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::BoolAttr getUseLockingAttr(); + bool getUseLocking(); + ::mlir::BoolAttr getMultiplyLinearByLrAttr(); + bool getMultiplyLinearByLr(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setUseLockingAttr(::mlir::BoolAttr attr); + void setUseLocking(::std::optional attrValue); + void setMultiplyLinearByLrAttr(::mlir::BoolAttr attr); + void setMultiplyLinearByLr(::std::optional attrValue); + ::mlir::Attribute removeUseLockingAttr(); + ::mlir::Attribute removeMultiplyLinearByLrAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value linear, ::mlir::Value grad, ::mlir::Value indices, ::mlir::Value lr, ::mlir::Value l1, ::mlir::Value l2, ::mlir::Value lr_power, /*optional*/::mlir::BoolAttr use_locking, /*optional*/::mlir::BoolAttr multiply_linear_by_lr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value linear, ::mlir::Value grad, ::mlir::Value indices, ::mlir::Value lr, ::mlir::Value l1, ::mlir::Value l2, ::mlir::Value lr_power, /*optional*/::mlir::BoolAttr use_locking, /*optional*/::mlir::BoolAttr multiply_linear_by_lr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value linear, ::mlir::Value grad, ::mlir::Value indices, ::mlir::Value lr, ::mlir::Value l1, ::mlir::Value l2, ::mlir::Value lr_power, /*optional*/bool use_locking = false, /*optional*/bool multiply_linear_by_lr = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value var, ::mlir::Value accum, ::mlir::Value linear, ::mlir::Value grad, ::mlir::Value indices, ::mlir::Value lr, ::mlir::Value l1, ::mlir::Value l2, ::mlir::Value lr_power, /*optional*/bool use_locking = false, /*optional*/bool multiply_linear_by_lr = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceSparseApplyFtrlOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ResourceStridedSliceAssignOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ResourceStridedSliceAssignOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ResourceStridedSliceAssignOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ResourceStridedSliceAssignOpGenericAdaptorBase(ResourceStridedSliceAssignOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getBeginMaskAttr(); + uint64_t getBeginMask(); + ::mlir::IntegerAttr getEndMaskAttr(); + uint64_t getEndMask(); + ::mlir::IntegerAttr getEllipsisMaskAttr(); + uint64_t getEllipsisMask(); + ::mlir::IntegerAttr getNewAxisMaskAttr(); + uint64_t getNewAxisMask(); + ::mlir::IntegerAttr getShrinkAxisMaskAttr(); + uint64_t getShrinkAxisMask(); +}; +} // namespace detail +template +class ResourceStridedSliceAssignOpGenericAdaptor : public detail::ResourceStridedSliceAssignOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ResourceStridedSliceAssignOpGenericAdaptorBase; +public: + ResourceStridedSliceAssignOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ResourceStridedSliceAssignOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ResourceStridedSliceAssignOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ResourceStridedSliceAssignOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getRef() { + return (*getODSOperands(0).begin()); + } + + ValueT getBegin() { + return (*getODSOperands(1).begin()); + } + + ValueT getEnd() { + return (*getODSOperands(2).begin()); + } + + ValueT getStrides() { + return (*getODSOperands(3).begin()); + } + + ValueT getValue() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ResourceStridedSliceAssignOpAdaptor : public ResourceStridedSliceAssignOpGenericAdaptor<::mlir::ValueRange> { +public: + using ResourceStridedSliceAssignOpGenericAdaptor::ResourceStridedSliceAssignOpGenericAdaptor; + ResourceStridedSliceAssignOpAdaptor(ResourceStridedSliceAssignOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ResourceStridedSliceAssignOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ResourceStridedSliceAssignOpAdaptor; + template + using GenericAdaptor = ResourceStridedSliceAssignOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Index"), ::llvm::StringRef("T"), ::llvm::StringRef("begin_mask"), ::llvm::StringRef("ellipsis_mask"), ::llvm::StringRef("end_mask"), ::llvm::StringRef("new_axis_mask"), ::llvm::StringRef("shrink_axis_mask")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getIndexAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getIndexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getBeginMaskAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getBeginMaskAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getEllipsisMaskAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getEllipsisMaskAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getEndMaskAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getEndMaskAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getNewAxisMaskAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getNewAxisMaskAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getShrinkAxisMaskAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getShrinkAxisMaskAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ResourceStridedSliceAssign"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getRef(); + ::mlir::TypedValue<::mlir::TensorType> getBegin(); + ::mlir::TypedValue<::mlir::TensorType> getEnd(); + ::mlir::TypedValue<::mlir::TensorType> getStrides(); + ::mlir::TypedValue<::mlir::TensorType> getValue(); + ::mlir::OpOperand &getRefMutable(); + ::mlir::OpOperand &getBeginMutable(); + ::mlir::OpOperand &getEndMutable(); + ::mlir::OpOperand &getStridesMutable(); + ::mlir::OpOperand &getValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getBeginMaskAttr(); + uint64_t getBeginMask(); + ::mlir::IntegerAttr getEndMaskAttr(); + uint64_t getEndMask(); + ::mlir::IntegerAttr getEllipsisMaskAttr(); + uint64_t getEllipsisMask(); + ::mlir::IntegerAttr getNewAxisMaskAttr(); + uint64_t getNewAxisMask(); + ::mlir::IntegerAttr getShrinkAxisMaskAttr(); + uint64_t getShrinkAxisMask(); + ::mlir::Type getIndex(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setBeginMaskAttr(::mlir::IntegerAttr attr); + void setBeginMask(::std::optional attrValue); + void setEndMaskAttr(::mlir::IntegerAttr attr); + void setEndMask(::std::optional attrValue); + void setEllipsisMaskAttr(::mlir::IntegerAttr attr); + void setEllipsisMask(::std::optional attrValue); + void setNewAxisMaskAttr(::mlir::IntegerAttr attr); + void setNewAxisMask(::std::optional attrValue); + void setShrinkAxisMaskAttr(::mlir::IntegerAttr attr); + void setShrinkAxisMask(::std::optional attrValue); + ::mlir::Attribute removeBeginMaskAttr(); + ::mlir::Attribute removeEndMaskAttr(); + ::mlir::Attribute removeEllipsisMaskAttr(); + ::mlir::Attribute removeNewAxisMaskAttr(); + ::mlir::Attribute removeShrinkAxisMaskAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value ref, ::mlir::Value begin, ::mlir::Value end, ::mlir::Value strides, ::mlir::Value value, /*optional*/::mlir::IntegerAttr begin_mask, /*optional*/::mlir::IntegerAttr end_mask, /*optional*/::mlir::IntegerAttr ellipsis_mask, /*optional*/::mlir::IntegerAttr new_axis_mask, /*optional*/::mlir::IntegerAttr shrink_axis_mask); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ref, ::mlir::Value begin, ::mlir::Value end, ::mlir::Value strides, ::mlir::Value value, /*optional*/::mlir::IntegerAttr begin_mask, /*optional*/::mlir::IntegerAttr end_mask, /*optional*/::mlir::IntegerAttr ellipsis_mask, /*optional*/::mlir::IntegerAttr new_axis_mask, /*optional*/::mlir::IntegerAttr shrink_axis_mask); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value ref, ::mlir::Value begin, ::mlir::Value end, ::mlir::Value strides, ::mlir::Value value, /*optional*/uint64_t begin_mask = 0, /*optional*/uint64_t end_mask = 0, /*optional*/uint64_t ellipsis_mask = 0, /*optional*/uint64_t new_axis_mask = 0, /*optional*/uint64_t shrink_axis_mask = 0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ref, ::mlir::Value begin, ::mlir::Value end, ::mlir::Value strides, ::mlir::Value value, /*optional*/uint64_t begin_mask = 0, /*optional*/uint64_t end_mask = 0, /*optional*/uint64_t ellipsis_mask = 0, /*optional*/uint64_t new_axis_mask = 0, /*optional*/uint64_t shrink_axis_mask = 0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 7 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ResourceStridedSliceAssignOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RestoreOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RestoreOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RestoreOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RestoreOpGenericAdaptorBase(RestoreOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getPreferredShardAttr(); + uint64_t getPreferredShard(); +}; +} // namespace detail +template +class RestoreOpGenericAdaptor : public detail::RestoreOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RestoreOpGenericAdaptorBase; +public: + RestoreOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RestoreOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RestoreOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RestoreOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getFilePattern() { + return (*getODSOperands(0).begin()); + } + + ValueT getTensorName() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RestoreOpAdaptor : public RestoreOpGenericAdaptor<::mlir::ValueRange> { +public: + using RestoreOpGenericAdaptor::RestoreOpGenericAdaptor; + RestoreOpAdaptor(RestoreOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RestoreOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RestoreOpAdaptor; + template + using GenericAdaptor = RestoreOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dt"), ::llvm::StringRef("preferred_shard")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDtAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDtAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getPreferredShardAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getPreferredShardAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Restore"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getFilePattern(); + ::mlir::TypedValue<::mlir::TensorType> getTensorName(); + ::mlir::OpOperand &getFilePatternMutable(); + ::mlir::OpOperand &getTensorNameMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::IntegerAttr getPreferredShardAttr(); + uint64_t getPreferredShard(); + ::mlir::Type getDt(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setPreferredShardAttr(::mlir::IntegerAttr attr); + void setPreferredShard(::std::optional attrValue); + ::mlir::Attribute removePreferredShardAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type tensor, ::mlir::Value file_pattern, ::mlir::Value tensor_name, /*optional*/::mlir::IntegerAttr preferred_shard); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value file_pattern, ::mlir::Value tensor_name, /*optional*/::mlir::IntegerAttr preferred_shard); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type tensor, ::mlir::Value file_pattern, ::mlir::Value tensor_name, /*optional*/uint64_t preferred_shard = -1); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value file_pattern, ::mlir::Value tensor_name, /*optional*/uint64_t preferred_shard = -1); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RestoreOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RestoreV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RestoreV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RestoreV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RestoreV2OpGenericAdaptorBase(RestoreV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RestoreV2OpGenericAdaptor : public detail::RestoreV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RestoreV2OpGenericAdaptorBase; +public: + RestoreV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RestoreV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RestoreV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RestoreV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getPrefix() { + return (*getODSOperands(0).begin()); + } + + ValueT getTensorNames() { + return (*getODSOperands(1).begin()); + } + + ValueT getShapeAndSlices() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RestoreV2OpAdaptor : public RestoreV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using RestoreV2OpGenericAdaptor::RestoreV2OpGenericAdaptor; + RestoreV2OpAdaptor(RestoreV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RestoreV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RestoreV2OpAdaptor; + template + using GenericAdaptor = RestoreV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dtypes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDtypesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDtypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RestoreV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getPrefix(); + ::mlir::TypedValue<::mlir::TensorType> getTensorNames(); + ::mlir::TypedValue<::mlir::TensorType> getShapeAndSlices(); + ::mlir::OpOperand &getPrefixMutable(); + ::mlir::OpOperand &getTensorNamesMutable(); + ::mlir::OpOperand &getShapeAndSlicesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getTensors(); + mlir::ResultElementTypeRange getDtypes(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange tensors, ::mlir::Value prefix, ::mlir::Value tensor_names, ::mlir::Value shape_and_slices); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RestoreV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RetrieveTPUEmbeddingADAMParametersGradAccumDebugOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RetrieveTPUEmbeddingADAMParametersGradAccumDebugOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RetrieveTPUEmbeddingADAMParametersGradAccumDebugOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RetrieveTPUEmbeddingADAMParametersGradAccumDebugOpGenericAdaptorBase(RetrieveTPUEmbeddingADAMParametersGradAccumDebugOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class RetrieveTPUEmbeddingADAMParametersGradAccumDebugOpGenericAdaptor : public detail::RetrieveTPUEmbeddingADAMParametersGradAccumDebugOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RetrieveTPUEmbeddingADAMParametersGradAccumDebugOpGenericAdaptorBase; +public: + RetrieveTPUEmbeddingADAMParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RetrieveTPUEmbeddingADAMParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RetrieveTPUEmbeddingADAMParametersGradAccumDebugOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RetrieveTPUEmbeddingADAMParametersGradAccumDebugOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RetrieveTPUEmbeddingADAMParametersGradAccumDebugOpAdaptor : public RetrieveTPUEmbeddingADAMParametersGradAccumDebugOpGenericAdaptor<::mlir::ValueRange> { +public: + using RetrieveTPUEmbeddingADAMParametersGradAccumDebugOpGenericAdaptor::RetrieveTPUEmbeddingADAMParametersGradAccumDebugOpGenericAdaptor; + RetrieveTPUEmbeddingADAMParametersGradAccumDebugOpAdaptor(RetrieveTPUEmbeddingADAMParametersGradAccumDebugOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RetrieveTPUEmbeddingADAMParametersGradAccumDebugOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RetrieveTPUEmbeddingADAMParametersGradAccumDebugOpAdaptor; + template + using GenericAdaptor = RetrieveTPUEmbeddingADAMParametersGradAccumDebugOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RetrieveTPUEmbeddingADAMParametersGradAccumDebug"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getMomenta(); + ::mlir::TypedValue<::mlir::TensorType> getVelocities(); + ::mlir::TypedValue<::mlir::TensorType> getGradientAccumulators(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type momenta, ::mlir::Type velocities, ::mlir::Type gradient_accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type momenta, ::mlir::Type velocities, ::mlir::Type gradient_accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RetrieveTPUEmbeddingADAMParametersGradAccumDebugOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RetrieveTPUEmbeddingADAMParametersOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RetrieveTPUEmbeddingADAMParametersOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RetrieveTPUEmbeddingADAMParametersOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RetrieveTPUEmbeddingADAMParametersOpGenericAdaptorBase(RetrieveTPUEmbeddingADAMParametersOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class RetrieveTPUEmbeddingADAMParametersOpGenericAdaptor : public detail::RetrieveTPUEmbeddingADAMParametersOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RetrieveTPUEmbeddingADAMParametersOpGenericAdaptorBase; +public: + RetrieveTPUEmbeddingADAMParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RetrieveTPUEmbeddingADAMParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RetrieveTPUEmbeddingADAMParametersOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RetrieveTPUEmbeddingADAMParametersOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RetrieveTPUEmbeddingADAMParametersOpAdaptor : public RetrieveTPUEmbeddingADAMParametersOpGenericAdaptor<::mlir::ValueRange> { +public: + using RetrieveTPUEmbeddingADAMParametersOpGenericAdaptor::RetrieveTPUEmbeddingADAMParametersOpGenericAdaptor; + RetrieveTPUEmbeddingADAMParametersOpAdaptor(RetrieveTPUEmbeddingADAMParametersOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RetrieveTPUEmbeddingADAMParametersOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RetrieveTPUEmbeddingADAMParametersOpAdaptor; + template + using GenericAdaptor = RetrieveTPUEmbeddingADAMParametersOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RetrieveTPUEmbeddingADAMParameters"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getMomenta(); + ::mlir::TypedValue<::mlir::TensorType> getVelocities(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type momenta, ::mlir::Type velocities, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type momenta, ::mlir::Type velocities, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RetrieveTPUEmbeddingADAMParametersOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebugOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebugOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebugOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebugOpGenericAdaptorBase(RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebugOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebugOpGenericAdaptor : public detail::RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebugOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebugOpGenericAdaptorBase; +public: + RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebugOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebugOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebugOpAdaptor : public RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebugOpGenericAdaptor<::mlir::ValueRange> { +public: + using RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebugOpGenericAdaptor::RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebugOpGenericAdaptor; + RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebugOpAdaptor(RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebugOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebugOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebugOpAdaptor; + template + using GenericAdaptor = RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebugOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebug"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getAccumulators(); + ::mlir::TypedValue<::mlir::TensorType> getUpdates(); + ::mlir::TypedValue<::mlir::TensorType> getGradientAccumulators(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type accumulators, ::mlir::Type updates, ::mlir::Type gradient_accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type accumulators, ::mlir::Type updates, ::mlir::Type gradient_accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RetrieveTPUEmbeddingAdadeltaParametersGradAccumDebugOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RetrieveTPUEmbeddingAdadeltaParametersOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RetrieveTPUEmbeddingAdadeltaParametersOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RetrieveTPUEmbeddingAdadeltaParametersOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RetrieveTPUEmbeddingAdadeltaParametersOpGenericAdaptorBase(RetrieveTPUEmbeddingAdadeltaParametersOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class RetrieveTPUEmbeddingAdadeltaParametersOpGenericAdaptor : public detail::RetrieveTPUEmbeddingAdadeltaParametersOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RetrieveTPUEmbeddingAdadeltaParametersOpGenericAdaptorBase; +public: + RetrieveTPUEmbeddingAdadeltaParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RetrieveTPUEmbeddingAdadeltaParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RetrieveTPUEmbeddingAdadeltaParametersOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RetrieveTPUEmbeddingAdadeltaParametersOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RetrieveTPUEmbeddingAdadeltaParametersOpAdaptor : public RetrieveTPUEmbeddingAdadeltaParametersOpGenericAdaptor<::mlir::ValueRange> { +public: + using RetrieveTPUEmbeddingAdadeltaParametersOpGenericAdaptor::RetrieveTPUEmbeddingAdadeltaParametersOpGenericAdaptor; + RetrieveTPUEmbeddingAdadeltaParametersOpAdaptor(RetrieveTPUEmbeddingAdadeltaParametersOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RetrieveTPUEmbeddingAdadeltaParametersOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RetrieveTPUEmbeddingAdadeltaParametersOpAdaptor; + template + using GenericAdaptor = RetrieveTPUEmbeddingAdadeltaParametersOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RetrieveTPUEmbeddingAdadeltaParameters"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getAccumulators(); + ::mlir::TypedValue<::mlir::TensorType> getUpdates(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type accumulators, ::mlir::Type updates, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type accumulators, ::mlir::Type updates, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RetrieveTPUEmbeddingAdadeltaParametersOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RetrieveTPUEmbeddingAdagradParametersGradAccumDebugOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RetrieveTPUEmbeddingAdagradParametersGradAccumDebugOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RetrieveTPUEmbeddingAdagradParametersGradAccumDebugOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RetrieveTPUEmbeddingAdagradParametersGradAccumDebugOpGenericAdaptorBase(RetrieveTPUEmbeddingAdagradParametersGradAccumDebugOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class RetrieveTPUEmbeddingAdagradParametersGradAccumDebugOpGenericAdaptor : public detail::RetrieveTPUEmbeddingAdagradParametersGradAccumDebugOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RetrieveTPUEmbeddingAdagradParametersGradAccumDebugOpGenericAdaptorBase; +public: + RetrieveTPUEmbeddingAdagradParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RetrieveTPUEmbeddingAdagradParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RetrieveTPUEmbeddingAdagradParametersGradAccumDebugOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RetrieveTPUEmbeddingAdagradParametersGradAccumDebugOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RetrieveTPUEmbeddingAdagradParametersGradAccumDebugOpAdaptor : public RetrieveTPUEmbeddingAdagradParametersGradAccumDebugOpGenericAdaptor<::mlir::ValueRange> { +public: + using RetrieveTPUEmbeddingAdagradParametersGradAccumDebugOpGenericAdaptor::RetrieveTPUEmbeddingAdagradParametersGradAccumDebugOpGenericAdaptor; + RetrieveTPUEmbeddingAdagradParametersGradAccumDebugOpAdaptor(RetrieveTPUEmbeddingAdagradParametersGradAccumDebugOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RetrieveTPUEmbeddingAdagradParametersGradAccumDebugOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RetrieveTPUEmbeddingAdagradParametersGradAccumDebugOpAdaptor; + template + using GenericAdaptor = RetrieveTPUEmbeddingAdagradParametersGradAccumDebugOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RetrieveTPUEmbeddingAdagradParametersGradAccumDebug"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getAccumulators(); + ::mlir::TypedValue<::mlir::TensorType> getGradientAccumulators(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type accumulators, ::mlir::Type gradient_accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type accumulators, ::mlir::Type gradient_accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RetrieveTPUEmbeddingAdagradParametersGradAccumDebugOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RetrieveTPUEmbeddingAdagradParametersOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RetrieveTPUEmbeddingAdagradParametersOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RetrieveTPUEmbeddingAdagradParametersOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RetrieveTPUEmbeddingAdagradParametersOpGenericAdaptorBase(RetrieveTPUEmbeddingAdagradParametersOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class RetrieveTPUEmbeddingAdagradParametersOpGenericAdaptor : public detail::RetrieveTPUEmbeddingAdagradParametersOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RetrieveTPUEmbeddingAdagradParametersOpGenericAdaptorBase; +public: + RetrieveTPUEmbeddingAdagradParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RetrieveTPUEmbeddingAdagradParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RetrieveTPUEmbeddingAdagradParametersOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RetrieveTPUEmbeddingAdagradParametersOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RetrieveTPUEmbeddingAdagradParametersOpAdaptor : public RetrieveTPUEmbeddingAdagradParametersOpGenericAdaptor<::mlir::ValueRange> { +public: + using RetrieveTPUEmbeddingAdagradParametersOpGenericAdaptor::RetrieveTPUEmbeddingAdagradParametersOpGenericAdaptor; + RetrieveTPUEmbeddingAdagradParametersOpAdaptor(RetrieveTPUEmbeddingAdagradParametersOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RetrieveTPUEmbeddingAdagradParametersOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RetrieveTPUEmbeddingAdagradParametersOpAdaptor; + template + using GenericAdaptor = RetrieveTPUEmbeddingAdagradParametersOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RetrieveTPUEmbeddingAdagradParameters"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getAccumulators(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RetrieveTPUEmbeddingAdagradParametersOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RetrieveTPUEmbeddingCenteredRMSPropParametersOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RetrieveTPUEmbeddingCenteredRMSPropParametersOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RetrieveTPUEmbeddingCenteredRMSPropParametersOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RetrieveTPUEmbeddingCenteredRMSPropParametersOpGenericAdaptorBase(RetrieveTPUEmbeddingCenteredRMSPropParametersOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class RetrieveTPUEmbeddingCenteredRMSPropParametersOpGenericAdaptor : public detail::RetrieveTPUEmbeddingCenteredRMSPropParametersOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RetrieveTPUEmbeddingCenteredRMSPropParametersOpGenericAdaptorBase; +public: + RetrieveTPUEmbeddingCenteredRMSPropParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RetrieveTPUEmbeddingCenteredRMSPropParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RetrieveTPUEmbeddingCenteredRMSPropParametersOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RetrieveTPUEmbeddingCenteredRMSPropParametersOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RetrieveTPUEmbeddingCenteredRMSPropParametersOpAdaptor : public RetrieveTPUEmbeddingCenteredRMSPropParametersOpGenericAdaptor<::mlir::ValueRange> { +public: + using RetrieveTPUEmbeddingCenteredRMSPropParametersOpGenericAdaptor::RetrieveTPUEmbeddingCenteredRMSPropParametersOpGenericAdaptor; + RetrieveTPUEmbeddingCenteredRMSPropParametersOpAdaptor(RetrieveTPUEmbeddingCenteredRMSPropParametersOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RetrieveTPUEmbeddingCenteredRMSPropParametersOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RetrieveTPUEmbeddingCenteredRMSPropParametersOpAdaptor; + template + using GenericAdaptor = RetrieveTPUEmbeddingCenteredRMSPropParametersOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RetrieveTPUEmbeddingCenteredRMSPropParameters"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getMs(); + ::mlir::TypedValue<::mlir::TensorType> getMom(); + ::mlir::TypedValue<::mlir::TensorType> getMg(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type ms, ::mlir::Type mom, ::mlir::Type mg, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type ms, ::mlir::Type mom, ::mlir::Type mg, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RetrieveTPUEmbeddingCenteredRMSPropParametersOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RetrieveTPUEmbeddingFTRLParametersGradAccumDebugOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RetrieveTPUEmbeddingFTRLParametersGradAccumDebugOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RetrieveTPUEmbeddingFTRLParametersGradAccumDebugOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RetrieveTPUEmbeddingFTRLParametersGradAccumDebugOpGenericAdaptorBase(RetrieveTPUEmbeddingFTRLParametersGradAccumDebugOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class RetrieveTPUEmbeddingFTRLParametersGradAccumDebugOpGenericAdaptor : public detail::RetrieveTPUEmbeddingFTRLParametersGradAccumDebugOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RetrieveTPUEmbeddingFTRLParametersGradAccumDebugOpGenericAdaptorBase; +public: + RetrieveTPUEmbeddingFTRLParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RetrieveTPUEmbeddingFTRLParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RetrieveTPUEmbeddingFTRLParametersGradAccumDebugOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RetrieveTPUEmbeddingFTRLParametersGradAccumDebugOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RetrieveTPUEmbeddingFTRLParametersGradAccumDebugOpAdaptor : public RetrieveTPUEmbeddingFTRLParametersGradAccumDebugOpGenericAdaptor<::mlir::ValueRange> { +public: + using RetrieveTPUEmbeddingFTRLParametersGradAccumDebugOpGenericAdaptor::RetrieveTPUEmbeddingFTRLParametersGradAccumDebugOpGenericAdaptor; + RetrieveTPUEmbeddingFTRLParametersGradAccumDebugOpAdaptor(RetrieveTPUEmbeddingFTRLParametersGradAccumDebugOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RetrieveTPUEmbeddingFTRLParametersGradAccumDebugOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RetrieveTPUEmbeddingFTRLParametersGradAccumDebugOpAdaptor; + template + using GenericAdaptor = RetrieveTPUEmbeddingFTRLParametersGradAccumDebugOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RetrieveTPUEmbeddingFTRLParametersGradAccumDebug"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getAccumulators(); + ::mlir::TypedValue<::mlir::TensorType> getLinears(); + ::mlir::TypedValue<::mlir::TensorType> getGradientAccumulators(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type accumulators, ::mlir::Type linears, ::mlir::Type gradient_accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type accumulators, ::mlir::Type linears, ::mlir::Type gradient_accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RetrieveTPUEmbeddingFTRLParametersGradAccumDebugOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RetrieveTPUEmbeddingFTRLParametersOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RetrieveTPUEmbeddingFTRLParametersOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RetrieveTPUEmbeddingFTRLParametersOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RetrieveTPUEmbeddingFTRLParametersOpGenericAdaptorBase(RetrieveTPUEmbeddingFTRLParametersOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class RetrieveTPUEmbeddingFTRLParametersOpGenericAdaptor : public detail::RetrieveTPUEmbeddingFTRLParametersOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RetrieveTPUEmbeddingFTRLParametersOpGenericAdaptorBase; +public: + RetrieveTPUEmbeddingFTRLParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RetrieveTPUEmbeddingFTRLParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RetrieveTPUEmbeddingFTRLParametersOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RetrieveTPUEmbeddingFTRLParametersOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RetrieveTPUEmbeddingFTRLParametersOpAdaptor : public RetrieveTPUEmbeddingFTRLParametersOpGenericAdaptor<::mlir::ValueRange> { +public: + using RetrieveTPUEmbeddingFTRLParametersOpGenericAdaptor::RetrieveTPUEmbeddingFTRLParametersOpGenericAdaptor; + RetrieveTPUEmbeddingFTRLParametersOpAdaptor(RetrieveTPUEmbeddingFTRLParametersOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RetrieveTPUEmbeddingFTRLParametersOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RetrieveTPUEmbeddingFTRLParametersOpAdaptor; + template + using GenericAdaptor = RetrieveTPUEmbeddingFTRLParametersOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RetrieveTPUEmbeddingFTRLParameters"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getAccumulators(); + ::mlir::TypedValue<::mlir::TensorType> getLinears(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type accumulators, ::mlir::Type linears, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type accumulators, ::mlir::Type linears, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RetrieveTPUEmbeddingFTRLParametersOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RetrieveTPUEmbeddingMDLAdagradLightParametersOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RetrieveTPUEmbeddingMDLAdagradLightParametersOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RetrieveTPUEmbeddingMDLAdagradLightParametersOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RetrieveTPUEmbeddingMDLAdagradLightParametersOpGenericAdaptorBase(RetrieveTPUEmbeddingMDLAdagradLightParametersOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class RetrieveTPUEmbeddingMDLAdagradLightParametersOpGenericAdaptor : public detail::RetrieveTPUEmbeddingMDLAdagradLightParametersOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RetrieveTPUEmbeddingMDLAdagradLightParametersOpGenericAdaptorBase; +public: + RetrieveTPUEmbeddingMDLAdagradLightParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RetrieveTPUEmbeddingMDLAdagradLightParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RetrieveTPUEmbeddingMDLAdagradLightParametersOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RetrieveTPUEmbeddingMDLAdagradLightParametersOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RetrieveTPUEmbeddingMDLAdagradLightParametersOpAdaptor : public RetrieveTPUEmbeddingMDLAdagradLightParametersOpGenericAdaptor<::mlir::ValueRange> { +public: + using RetrieveTPUEmbeddingMDLAdagradLightParametersOpGenericAdaptor::RetrieveTPUEmbeddingMDLAdagradLightParametersOpGenericAdaptor; + RetrieveTPUEmbeddingMDLAdagradLightParametersOpAdaptor(RetrieveTPUEmbeddingMDLAdagradLightParametersOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RetrieveTPUEmbeddingMDLAdagradLightParametersOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RetrieveTPUEmbeddingMDLAdagradLightParametersOpAdaptor; + template + using GenericAdaptor = RetrieveTPUEmbeddingMDLAdagradLightParametersOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RetrieveTPUEmbeddingMDLAdagradLightParameters"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getAccumulators(); + ::mlir::TypedValue<::mlir::TensorType> getWeights(); + ::mlir::TypedValue<::mlir::TensorType> getBenefits(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type accumulators, ::mlir::Type weights, ::mlir::Type benefits, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type accumulators, ::mlir::Type weights, ::mlir::Type benefits, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RetrieveTPUEmbeddingMDLAdagradLightParametersOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RetrieveTPUEmbeddingMomentumParametersGradAccumDebugOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RetrieveTPUEmbeddingMomentumParametersGradAccumDebugOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RetrieveTPUEmbeddingMomentumParametersGradAccumDebugOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RetrieveTPUEmbeddingMomentumParametersGradAccumDebugOpGenericAdaptorBase(RetrieveTPUEmbeddingMomentumParametersGradAccumDebugOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class RetrieveTPUEmbeddingMomentumParametersGradAccumDebugOpGenericAdaptor : public detail::RetrieveTPUEmbeddingMomentumParametersGradAccumDebugOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RetrieveTPUEmbeddingMomentumParametersGradAccumDebugOpGenericAdaptorBase; +public: + RetrieveTPUEmbeddingMomentumParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RetrieveTPUEmbeddingMomentumParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RetrieveTPUEmbeddingMomentumParametersGradAccumDebugOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RetrieveTPUEmbeddingMomentumParametersGradAccumDebugOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RetrieveTPUEmbeddingMomentumParametersGradAccumDebugOpAdaptor : public RetrieveTPUEmbeddingMomentumParametersGradAccumDebugOpGenericAdaptor<::mlir::ValueRange> { +public: + using RetrieveTPUEmbeddingMomentumParametersGradAccumDebugOpGenericAdaptor::RetrieveTPUEmbeddingMomentumParametersGradAccumDebugOpGenericAdaptor; + RetrieveTPUEmbeddingMomentumParametersGradAccumDebugOpAdaptor(RetrieveTPUEmbeddingMomentumParametersGradAccumDebugOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RetrieveTPUEmbeddingMomentumParametersGradAccumDebugOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RetrieveTPUEmbeddingMomentumParametersGradAccumDebugOpAdaptor; + template + using GenericAdaptor = RetrieveTPUEmbeddingMomentumParametersGradAccumDebugOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RetrieveTPUEmbeddingMomentumParametersGradAccumDebug"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getMomenta(); + ::mlir::TypedValue<::mlir::TensorType> getGradientAccumulators(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type momenta, ::mlir::Type gradient_accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type momenta, ::mlir::Type gradient_accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RetrieveTPUEmbeddingMomentumParametersGradAccumDebugOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RetrieveTPUEmbeddingMomentumParametersOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RetrieveTPUEmbeddingMomentumParametersOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RetrieveTPUEmbeddingMomentumParametersOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RetrieveTPUEmbeddingMomentumParametersOpGenericAdaptorBase(RetrieveTPUEmbeddingMomentumParametersOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class RetrieveTPUEmbeddingMomentumParametersOpGenericAdaptor : public detail::RetrieveTPUEmbeddingMomentumParametersOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RetrieveTPUEmbeddingMomentumParametersOpGenericAdaptorBase; +public: + RetrieveTPUEmbeddingMomentumParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RetrieveTPUEmbeddingMomentumParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RetrieveTPUEmbeddingMomentumParametersOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RetrieveTPUEmbeddingMomentumParametersOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RetrieveTPUEmbeddingMomentumParametersOpAdaptor : public RetrieveTPUEmbeddingMomentumParametersOpGenericAdaptor<::mlir::ValueRange> { +public: + using RetrieveTPUEmbeddingMomentumParametersOpGenericAdaptor::RetrieveTPUEmbeddingMomentumParametersOpGenericAdaptor; + RetrieveTPUEmbeddingMomentumParametersOpAdaptor(RetrieveTPUEmbeddingMomentumParametersOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RetrieveTPUEmbeddingMomentumParametersOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RetrieveTPUEmbeddingMomentumParametersOpAdaptor; + template + using GenericAdaptor = RetrieveTPUEmbeddingMomentumParametersOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RetrieveTPUEmbeddingMomentumParameters"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getMomenta(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type momenta, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type momenta, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RetrieveTPUEmbeddingMomentumParametersOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebugOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebugOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebugOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebugOpGenericAdaptorBase(RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebugOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebugOpGenericAdaptor : public detail::RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebugOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebugOpGenericAdaptorBase; +public: + RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebugOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebugOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebugOpAdaptor : public RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebugOpGenericAdaptor<::mlir::ValueRange> { +public: + using RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebugOpGenericAdaptor::RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebugOpGenericAdaptor; + RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebugOpAdaptor(RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebugOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebugOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebugOpAdaptor; + template + using GenericAdaptor = RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebugOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebug"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getAccumulators(); + ::mlir::TypedValue<::mlir::TensorType> getGradientAccumulators(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type accumulators, ::mlir::Type gradient_accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type accumulators, ::mlir::Type gradient_accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RetrieveTPUEmbeddingProximalAdagradParametersGradAccumDebugOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RetrieveTPUEmbeddingProximalAdagradParametersOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RetrieveTPUEmbeddingProximalAdagradParametersOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RetrieveTPUEmbeddingProximalAdagradParametersOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RetrieveTPUEmbeddingProximalAdagradParametersOpGenericAdaptorBase(RetrieveTPUEmbeddingProximalAdagradParametersOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class RetrieveTPUEmbeddingProximalAdagradParametersOpGenericAdaptor : public detail::RetrieveTPUEmbeddingProximalAdagradParametersOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RetrieveTPUEmbeddingProximalAdagradParametersOpGenericAdaptorBase; +public: + RetrieveTPUEmbeddingProximalAdagradParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RetrieveTPUEmbeddingProximalAdagradParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RetrieveTPUEmbeddingProximalAdagradParametersOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RetrieveTPUEmbeddingProximalAdagradParametersOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RetrieveTPUEmbeddingProximalAdagradParametersOpAdaptor : public RetrieveTPUEmbeddingProximalAdagradParametersOpGenericAdaptor<::mlir::ValueRange> { +public: + using RetrieveTPUEmbeddingProximalAdagradParametersOpGenericAdaptor::RetrieveTPUEmbeddingProximalAdagradParametersOpGenericAdaptor; + RetrieveTPUEmbeddingProximalAdagradParametersOpAdaptor(RetrieveTPUEmbeddingProximalAdagradParametersOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RetrieveTPUEmbeddingProximalAdagradParametersOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RetrieveTPUEmbeddingProximalAdagradParametersOpAdaptor; + template + using GenericAdaptor = RetrieveTPUEmbeddingProximalAdagradParametersOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RetrieveTPUEmbeddingProximalAdagradParameters"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getAccumulators(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RetrieveTPUEmbeddingProximalAdagradParametersOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RetrieveTPUEmbeddingProximalYogiParametersGradAccumDebugOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RetrieveTPUEmbeddingProximalYogiParametersGradAccumDebugOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RetrieveTPUEmbeddingProximalYogiParametersGradAccumDebugOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RetrieveTPUEmbeddingProximalYogiParametersGradAccumDebugOpGenericAdaptorBase(RetrieveTPUEmbeddingProximalYogiParametersGradAccumDebugOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class RetrieveTPUEmbeddingProximalYogiParametersGradAccumDebugOpGenericAdaptor : public detail::RetrieveTPUEmbeddingProximalYogiParametersGradAccumDebugOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RetrieveTPUEmbeddingProximalYogiParametersGradAccumDebugOpGenericAdaptorBase; +public: + RetrieveTPUEmbeddingProximalYogiParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RetrieveTPUEmbeddingProximalYogiParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RetrieveTPUEmbeddingProximalYogiParametersGradAccumDebugOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RetrieveTPUEmbeddingProximalYogiParametersGradAccumDebugOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RetrieveTPUEmbeddingProximalYogiParametersGradAccumDebugOpAdaptor : public RetrieveTPUEmbeddingProximalYogiParametersGradAccumDebugOpGenericAdaptor<::mlir::ValueRange> { +public: + using RetrieveTPUEmbeddingProximalYogiParametersGradAccumDebugOpGenericAdaptor::RetrieveTPUEmbeddingProximalYogiParametersGradAccumDebugOpGenericAdaptor; + RetrieveTPUEmbeddingProximalYogiParametersGradAccumDebugOpAdaptor(RetrieveTPUEmbeddingProximalYogiParametersGradAccumDebugOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RetrieveTPUEmbeddingProximalYogiParametersGradAccumDebugOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RetrieveTPUEmbeddingProximalYogiParametersGradAccumDebugOpAdaptor; + template + using GenericAdaptor = RetrieveTPUEmbeddingProximalYogiParametersGradAccumDebugOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RetrieveTPUEmbeddingProximalYogiParametersGradAccumDebug"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getV(); + ::mlir::TypedValue<::mlir::TensorType> getM(); + ::mlir::TypedValue<::mlir::TensorType> getGradientAccumulators(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type v, ::mlir::Type m, ::mlir::Type gradient_accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type v, ::mlir::Type m, ::mlir::Type gradient_accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RetrieveTPUEmbeddingProximalYogiParametersGradAccumDebugOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RetrieveTPUEmbeddingProximalYogiParametersOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RetrieveTPUEmbeddingProximalYogiParametersOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RetrieveTPUEmbeddingProximalYogiParametersOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RetrieveTPUEmbeddingProximalYogiParametersOpGenericAdaptorBase(RetrieveTPUEmbeddingProximalYogiParametersOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class RetrieveTPUEmbeddingProximalYogiParametersOpGenericAdaptor : public detail::RetrieveTPUEmbeddingProximalYogiParametersOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RetrieveTPUEmbeddingProximalYogiParametersOpGenericAdaptorBase; +public: + RetrieveTPUEmbeddingProximalYogiParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RetrieveTPUEmbeddingProximalYogiParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RetrieveTPUEmbeddingProximalYogiParametersOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RetrieveTPUEmbeddingProximalYogiParametersOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RetrieveTPUEmbeddingProximalYogiParametersOpAdaptor : public RetrieveTPUEmbeddingProximalYogiParametersOpGenericAdaptor<::mlir::ValueRange> { +public: + using RetrieveTPUEmbeddingProximalYogiParametersOpGenericAdaptor::RetrieveTPUEmbeddingProximalYogiParametersOpGenericAdaptor; + RetrieveTPUEmbeddingProximalYogiParametersOpAdaptor(RetrieveTPUEmbeddingProximalYogiParametersOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RetrieveTPUEmbeddingProximalYogiParametersOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RetrieveTPUEmbeddingProximalYogiParametersOpAdaptor; + template + using GenericAdaptor = RetrieveTPUEmbeddingProximalYogiParametersOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RetrieveTPUEmbeddingProximalYogiParameters"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getV(); + ::mlir::TypedValue<::mlir::TensorType> getM(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type v, ::mlir::Type m, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type v, ::mlir::Type m, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RetrieveTPUEmbeddingProximalYogiParametersOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RetrieveTPUEmbeddingRMSPropParametersGradAccumDebugOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RetrieveTPUEmbeddingRMSPropParametersGradAccumDebugOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RetrieveTPUEmbeddingRMSPropParametersGradAccumDebugOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RetrieveTPUEmbeddingRMSPropParametersGradAccumDebugOpGenericAdaptorBase(RetrieveTPUEmbeddingRMSPropParametersGradAccumDebugOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class RetrieveTPUEmbeddingRMSPropParametersGradAccumDebugOpGenericAdaptor : public detail::RetrieveTPUEmbeddingRMSPropParametersGradAccumDebugOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RetrieveTPUEmbeddingRMSPropParametersGradAccumDebugOpGenericAdaptorBase; +public: + RetrieveTPUEmbeddingRMSPropParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RetrieveTPUEmbeddingRMSPropParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RetrieveTPUEmbeddingRMSPropParametersGradAccumDebugOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RetrieveTPUEmbeddingRMSPropParametersGradAccumDebugOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RetrieveTPUEmbeddingRMSPropParametersGradAccumDebugOpAdaptor : public RetrieveTPUEmbeddingRMSPropParametersGradAccumDebugOpGenericAdaptor<::mlir::ValueRange> { +public: + using RetrieveTPUEmbeddingRMSPropParametersGradAccumDebugOpGenericAdaptor::RetrieveTPUEmbeddingRMSPropParametersGradAccumDebugOpGenericAdaptor; + RetrieveTPUEmbeddingRMSPropParametersGradAccumDebugOpAdaptor(RetrieveTPUEmbeddingRMSPropParametersGradAccumDebugOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RetrieveTPUEmbeddingRMSPropParametersGradAccumDebugOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RetrieveTPUEmbeddingRMSPropParametersGradAccumDebugOpAdaptor; + template + using GenericAdaptor = RetrieveTPUEmbeddingRMSPropParametersGradAccumDebugOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RetrieveTPUEmbeddingRMSPropParametersGradAccumDebug"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getMs(); + ::mlir::TypedValue<::mlir::TensorType> getMom(); + ::mlir::TypedValue<::mlir::TensorType> getGradientAccumulators(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type ms, ::mlir::Type mom, ::mlir::Type gradient_accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type ms, ::mlir::Type mom, ::mlir::Type gradient_accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RetrieveTPUEmbeddingRMSPropParametersGradAccumDebugOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RetrieveTPUEmbeddingRMSPropParametersOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RetrieveTPUEmbeddingRMSPropParametersOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RetrieveTPUEmbeddingRMSPropParametersOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RetrieveTPUEmbeddingRMSPropParametersOpGenericAdaptorBase(RetrieveTPUEmbeddingRMSPropParametersOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class RetrieveTPUEmbeddingRMSPropParametersOpGenericAdaptor : public detail::RetrieveTPUEmbeddingRMSPropParametersOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RetrieveTPUEmbeddingRMSPropParametersOpGenericAdaptorBase; +public: + RetrieveTPUEmbeddingRMSPropParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RetrieveTPUEmbeddingRMSPropParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RetrieveTPUEmbeddingRMSPropParametersOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RetrieveTPUEmbeddingRMSPropParametersOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RetrieveTPUEmbeddingRMSPropParametersOpAdaptor : public RetrieveTPUEmbeddingRMSPropParametersOpGenericAdaptor<::mlir::ValueRange> { +public: + using RetrieveTPUEmbeddingRMSPropParametersOpGenericAdaptor::RetrieveTPUEmbeddingRMSPropParametersOpGenericAdaptor; + RetrieveTPUEmbeddingRMSPropParametersOpAdaptor(RetrieveTPUEmbeddingRMSPropParametersOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RetrieveTPUEmbeddingRMSPropParametersOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RetrieveTPUEmbeddingRMSPropParametersOpAdaptor; + template + using GenericAdaptor = RetrieveTPUEmbeddingRMSPropParametersOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RetrieveTPUEmbeddingRMSPropParameters"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getMs(); + ::mlir::TypedValue<::mlir::TensorType> getMom(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type ms, ::mlir::Type mom, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type ms, ::mlir::Type mom, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RetrieveTPUEmbeddingRMSPropParametersOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RetrieveTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RetrieveTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RetrieveTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RetrieveTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpGenericAdaptorBase(RetrieveTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class RetrieveTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpGenericAdaptor : public detail::RetrieveTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RetrieveTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpGenericAdaptorBase; +public: + RetrieveTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RetrieveTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RetrieveTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RetrieveTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RetrieveTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpAdaptor : public RetrieveTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpGenericAdaptor<::mlir::ValueRange> { +public: + using RetrieveTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpGenericAdaptor::RetrieveTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpGenericAdaptor; + RetrieveTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpAdaptor(RetrieveTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RetrieveTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RetrieveTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpAdaptor; + template + using GenericAdaptor = RetrieveTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RetrieveTPUEmbeddingStochasticGradientDescentParametersGradAccumDebug"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::TypedValue<::mlir::TensorType> getGradientAccumulators(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type gradient_accumulators, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, ::mlir::Type gradient_accumulators, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RetrieveTPUEmbeddingStochasticGradientDescentParametersGradAccumDebugOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RetrieveTPUEmbeddingStochasticGradientDescentParametersOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RetrieveTPUEmbeddingStochasticGradientDescentParametersOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RetrieveTPUEmbeddingStochasticGradientDescentParametersOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RetrieveTPUEmbeddingStochasticGradientDescentParametersOpGenericAdaptorBase(RetrieveTPUEmbeddingStochasticGradientDescentParametersOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class RetrieveTPUEmbeddingStochasticGradientDescentParametersOpGenericAdaptor : public detail::RetrieveTPUEmbeddingStochasticGradientDescentParametersOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RetrieveTPUEmbeddingStochasticGradientDescentParametersOpGenericAdaptorBase; +public: + RetrieveTPUEmbeddingStochasticGradientDescentParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RetrieveTPUEmbeddingStochasticGradientDescentParametersOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RetrieveTPUEmbeddingStochasticGradientDescentParametersOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RetrieveTPUEmbeddingStochasticGradientDescentParametersOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RetrieveTPUEmbeddingStochasticGradientDescentParametersOpAdaptor : public RetrieveTPUEmbeddingStochasticGradientDescentParametersOpGenericAdaptor<::mlir::ValueRange> { +public: + using RetrieveTPUEmbeddingStochasticGradientDescentParametersOpGenericAdaptor::RetrieveTPUEmbeddingStochasticGradientDescentParametersOpGenericAdaptor; + RetrieveTPUEmbeddingStochasticGradientDescentParametersOpAdaptor(RetrieveTPUEmbeddingStochasticGradientDescentParametersOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RetrieveTPUEmbeddingStochasticGradientDescentParametersOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RetrieveTPUEmbeddingStochasticGradientDescentParametersOpAdaptor; + template + using GenericAdaptor = RetrieveTPUEmbeddingStochasticGradientDescentParametersOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_shards"), ::llvm::StringRef("shard_id"), ::llvm::StringRef("table_id"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumShardsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumShardsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RetrieveTPUEmbeddingStochasticGradientDescentParameters"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getParameters(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::IntegerAttr getNumShardsAttr(); + uint64_t getNumShards(); + ::mlir::IntegerAttr getShardIdAttr(); + uint64_t getShardId(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::std::optional<::llvm::StringRef> attrValue); + void setNumShardsAttr(::mlir::IntegerAttr attr); + void setNumShards(uint64_t attrValue); + void setShardIdAttr(::mlir::IntegerAttr attr); + void setShardId(uint64_t attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeTableIdAttr(); + ::mlir::Attribute removeTableNameAttr(); + ::mlir::Attribute removeConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::IntegerAttr table_id, /*optional*/::mlir::StringAttr table_name, ::mlir::IntegerAttr num_shards, ::mlir::IntegerAttr shard_id, /*optional*/::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type parameters, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/uint64_t table_id, /*optional*/::llvm::StringRef table_name, uint64_t num_shards, uint64_t shard_id, /*optional*/::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RetrieveTPUEmbeddingStochasticGradientDescentParametersOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ReverseOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReverseOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ReverseOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ReverseOpGenericAdaptorBase(ReverseOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ReverseOpGenericAdaptor : public detail::ReverseOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReverseOpGenericAdaptorBase; +public: + ReverseOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReverseOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReverseOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ReverseOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTensor() { + return (*getODSOperands(0).begin()); + } + + ValueT getDims() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ReverseOpAdaptor : public ReverseOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReverseOpGenericAdaptor::ReverseOpGenericAdaptor; + ReverseOpAdaptor(ReverseOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReverseOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ReverseOpAdaptor; + template + using GenericAdaptor = ReverseOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Reverse"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::TypedValue<::mlir::TensorType> getDims(); + ::mlir::OpOperand &getTensorMutable(); + ::mlir::OpOperand &getDimsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value tensor, ::mlir::Value dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tensor, ::mlir::Value dims); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ReverseOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ReverseSequenceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReverseSequenceOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ReverseSequenceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ReverseSequenceOpGenericAdaptorBase(ReverseSequenceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getSeqDimAttr(); + uint64_t getSeqDim(); + ::mlir::IntegerAttr getBatchDimAttr(); + uint64_t getBatchDim(); +}; +} // namespace detail +template +class ReverseSequenceOpGenericAdaptor : public detail::ReverseSequenceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReverseSequenceOpGenericAdaptorBase; +public: + ReverseSequenceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReverseSequenceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReverseSequenceOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ReverseSequenceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getSeqLengths() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ReverseSequenceOpAdaptor : public ReverseSequenceOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReverseSequenceOpGenericAdaptor::ReverseSequenceOpGenericAdaptor; + ReverseSequenceOpAdaptor(ReverseSequenceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReverseSequenceOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ReverseSequenceOpAdaptor; + template + using GenericAdaptor = ReverseSequenceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tlen"), ::llvm::StringRef("batch_dim"), ::llvm::StringRef("seq_dim")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTlenAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTlenAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getBatchDimAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getBatchDimAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSeqDimAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSeqDimAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ReverseSequence"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getSeqLengths(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getSeqLengthsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getSeqDimAttr(); + uint64_t getSeqDim(); + ::mlir::IntegerAttr getBatchDimAttr(); + uint64_t getBatchDim(); + ::mlir::Type getT(); + ::mlir::Type getTlen(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setSeqDimAttr(::mlir::IntegerAttr attr); + void setSeqDim(uint64_t attrValue); + void setBatchDimAttr(::mlir::IntegerAttr attr); + void setBatchDim(::std::optional attrValue); + ::mlir::Attribute removeBatchDimAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value seq_lengths, ::mlir::IntegerAttr seq_dim, /*optional*/::mlir::IntegerAttr batch_dim); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value seq_lengths, ::mlir::IntegerAttr seq_dim, /*optional*/::mlir::IntegerAttr batch_dim); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value seq_lengths, uint64_t seq_dim, /*optional*/uint64_t batch_dim = 0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value seq_lengths, uint64_t seq_dim, /*optional*/uint64_t batch_dim = 0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ReverseSequenceOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ReverseV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReverseV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ReverseV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ReverseV2OpGenericAdaptorBase(ReverseV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ReverseV2OpGenericAdaptor : public detail::ReverseV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReverseV2OpGenericAdaptorBase; +public: + ReverseV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReverseV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReverseV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ReverseV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTensor() { + return (*getODSOperands(0).begin()); + } + + ValueT getAxis() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ReverseV2OpAdaptor : public ReverseV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using ReverseV2OpGenericAdaptor::ReverseV2OpGenericAdaptor; + ReverseV2OpAdaptor(ReverseV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReverseV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ReverseV2OpAdaptor; + template + using GenericAdaptor = ReverseV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tidx")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTidxAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTidxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ReverseV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::TypedValue<::mlir::TensorType> getAxis(); + ::mlir::OpOperand &getTensorMutable(); + ::mlir::OpOperand &getAxisMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTidx(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value tensor, ::mlir::Value axis); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tensor, ::mlir::Value axis); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ReverseV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RightShiftOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RightShiftOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RightShiftOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RightShiftOpGenericAdaptorBase(RightShiftOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RightShiftOpGenericAdaptor : public detail::RightShiftOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RightShiftOpGenericAdaptorBase; +public: + RightShiftOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RightShiftOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RightShiftOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RightShiftOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RightShiftOpAdaptor : public RightShiftOpGenericAdaptor<::mlir::ValueRange> { +public: + using RightShiftOpGenericAdaptor::RightShiftOpGenericAdaptor; + RightShiftOpAdaptor(RightShiftOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RightShiftOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RightShiftOpAdaptor; + template + using GenericAdaptor = RightShiftOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RightShift"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RightShiftOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RintOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RintOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RintOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RintOpGenericAdaptorBase(RintOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RintOpGenericAdaptor : public detail::RintOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RintOpGenericAdaptorBase; +public: + RintOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RintOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RintOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RintOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RintOpAdaptor : public RintOpGenericAdaptor<::mlir::ValueRange> { +public: + using RintOpGenericAdaptor::RintOpGenericAdaptor; + RintOpAdaptor(RintOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RintOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::IsIdempotent, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RintOpAdaptor; + template + using GenericAdaptor = RintOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Rint"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RintOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RiscAddOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RiscAddOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RiscAddOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RiscAddOpGenericAdaptorBase(RiscAddOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RiscAddOpGenericAdaptor : public detail::RiscAddOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RiscAddOpGenericAdaptorBase; +public: + RiscAddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RiscAddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RiscAddOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RiscAddOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RiscAddOpAdaptor : public RiscAddOpGenericAdaptor<::mlir::ValueRange> { +public: + using RiscAddOpGenericAdaptor::RiscAddOpGenericAdaptor; + RiscAddOpAdaptor(RiscAddOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RiscAddOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsCommutative, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RiscAddOpAdaptor; + template + using GenericAdaptor = RiscAddOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RiscAdd"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RiscAddOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RiscDotOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RiscDotOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RiscDotOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RiscDotOpGenericAdaptorBase(RiscDotOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getTransposeAAttr(); + bool getTransposeA(); + ::mlir::BoolAttr getTransposeBAttr(); + bool getTransposeB(); +}; +} // namespace detail +template +class RiscDotOpGenericAdaptor : public detail::RiscDotOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RiscDotOpGenericAdaptorBase; +public: + RiscDotOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RiscDotOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RiscDotOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RiscDotOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + ValueT getB() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RiscDotOpAdaptor : public RiscDotOpGenericAdaptor<::mlir::ValueRange> { +public: + using RiscDotOpGenericAdaptor::RiscDotOpGenericAdaptor; + RiscDotOpAdaptor(RiscDotOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RiscDotOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RiscDotOpAdaptor; + template + using GenericAdaptor = RiscDotOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("transpose_a"), ::llvm::StringRef("transpose_b")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTransposeAAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTransposeAAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTransposeBAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTransposeBAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RiscDot"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getA(); + ::mlir::TypedValue<::mlir::TensorType> getB(); + ::mlir::OpOperand &getAMutable(); + ::mlir::OpOperand &getBMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getProduct(); + ::mlir::BoolAttr getTransposeAAttr(); + bool getTransposeA(); + ::mlir::BoolAttr getTransposeBAttr(); + bool getTransposeB(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setTransposeAAttr(::mlir::BoolAttr attr); + void setTransposeA(::std::optional attrValue); + void setTransposeBAttr(::mlir::BoolAttr attr); + void setTransposeB(::std::optional attrValue); + ::mlir::Attribute removeTransposeAAttr(); + ::mlir::Attribute removeTransposeBAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type product, ::mlir::Value a, ::mlir::Value b, /*optional*/::mlir::BoolAttr transpose_a, /*optional*/::mlir::BoolAttr transpose_b); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, /*optional*/::mlir::BoolAttr transpose_a, /*optional*/::mlir::BoolAttr transpose_b); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type product, ::mlir::Value a, ::mlir::Value b, /*optional*/bool transpose_a = false, /*optional*/bool transpose_b = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, /*optional*/bool transpose_a = false, /*optional*/bool transpose_b = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RiscDotOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RngReadAndSkipOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RngReadAndSkipOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RngReadAndSkipOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RngReadAndSkipOpGenericAdaptorBase(RngReadAndSkipOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RngReadAndSkipOpGenericAdaptor : public detail::RngReadAndSkipOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RngReadAndSkipOpGenericAdaptorBase; +public: + RngReadAndSkipOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RngReadAndSkipOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RngReadAndSkipOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RngReadAndSkipOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getResource() { + return (*getODSOperands(0).begin()); + } + + ValueT getAlg() { + return (*getODSOperands(1).begin()); + } + + ValueT getDelta() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RngReadAndSkipOpAdaptor : public RngReadAndSkipOpGenericAdaptor<::mlir::ValueRange> { +public: + using RngReadAndSkipOpGenericAdaptor::RngReadAndSkipOpGenericAdaptor; + RngReadAndSkipOpAdaptor(RngReadAndSkipOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RngReadAndSkipOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = RngReadAndSkipOpAdaptor; + template + using GenericAdaptor = RngReadAndSkipOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RngReadAndSkip"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResource(); + ::mlir::TypedValue<::mlir::TensorType> getAlg(); + ::mlir::TypedValue<::mlir::TensorType> getDelta(); + ::mlir::OpOperand &getResourceMutable(); + ::mlir::OpOperand &getAlgMutable(); + ::mlir::OpOperand &getDeltaMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getValue(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type value, ::mlir::Value resource, ::mlir::Value alg, ::mlir::Value delta); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value resource, ::mlir::Value alg, ::mlir::Value delta); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RngReadAndSkipOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RollOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RollOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RollOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RollOpGenericAdaptorBase(RollOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RollOpGenericAdaptor : public detail::RollOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RollOpGenericAdaptorBase; +public: + RollOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RollOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RollOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RollOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getShift() { + return (*getODSOperands(1).begin()); + } + + ValueT getAxis() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RollOpAdaptor : public RollOpGenericAdaptor<::mlir::ValueRange> { +public: + using RollOpGenericAdaptor::RollOpGenericAdaptor; + RollOpAdaptor(RollOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RollOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RollOpAdaptor; + template + using GenericAdaptor = RollOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Taxis"), ::llvm::StringRef("Tshift")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTaxisAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTaxisAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTshiftAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTshiftAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Roll"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getShift(); + ::mlir::TypedValue<::mlir::TensorType> getAxis(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getShiftMutable(); + ::mlir::OpOperand &getAxisMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTaxis(); + ::mlir::Type getTshift(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value shift, ::mlir::Value axis); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value shift, ::mlir::Value axis); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RollOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RoundOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RoundOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RoundOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RoundOpGenericAdaptorBase(RoundOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RoundOpGenericAdaptor : public detail::RoundOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RoundOpGenericAdaptorBase; +public: + RoundOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RoundOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RoundOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RoundOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RoundOpAdaptor : public RoundOpGenericAdaptor<::mlir::ValueRange> { +public: + using RoundOpGenericAdaptor::RoundOpGenericAdaptor; + RoundOpAdaptor(RoundOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RoundOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::IsIdempotent, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RoundOpAdaptor; + template + using GenericAdaptor = RoundOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Round"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RoundOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RsqrtGradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RsqrtGradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RsqrtGradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RsqrtGradOpGenericAdaptorBase(RsqrtGradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RsqrtGradOpGenericAdaptor : public detail::RsqrtGradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RsqrtGradOpGenericAdaptorBase; +public: + RsqrtGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RsqrtGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RsqrtGradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RsqrtGradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getY() { + return (*getODSOperands(0).begin()); + } + + ValueT getDy() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RsqrtGradOpAdaptor : public RsqrtGradOpGenericAdaptor<::mlir::ValueRange> { +public: + using RsqrtGradOpGenericAdaptor::RsqrtGradOpGenericAdaptor; + RsqrtGradOpAdaptor(RsqrtGradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RsqrtGradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RsqrtGradOpAdaptor; + template + using GenericAdaptor = RsqrtGradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.RsqrtGrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::TypedValue<::mlir::TensorType> getDy(); + ::mlir::OpOperand &getYMutable(); + ::mlir::OpOperand &getDyMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value y, ::mlir::Value dy); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value y, ::mlir::Value dy); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value y, ::mlir::Value dy); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RsqrtGradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::RsqrtOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RsqrtOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RsqrtOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RsqrtOpGenericAdaptorBase(RsqrtOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RsqrtOpGenericAdaptor : public detail::RsqrtOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RsqrtOpGenericAdaptorBase; +public: + RsqrtOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RsqrtOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RsqrtOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RsqrtOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RsqrtOpAdaptor : public RsqrtOpGenericAdaptor<::mlir::ValueRange> { +public: + using RsqrtOpGenericAdaptor::RsqrtOpGenericAdaptor; + RsqrtOpAdaptor(RsqrtOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RsqrtOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RsqrtOpAdaptor; + template + using GenericAdaptor = RsqrtOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Rsqrt"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::RsqrtOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SaveOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SaveOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SaveOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SaveOpGenericAdaptorBase(SaveOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SaveOpGenericAdaptor : public detail::SaveOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SaveOpGenericAdaptorBase; +public: + SaveOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SaveOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SaveOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SaveOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getFilename() { + return (*getODSOperands(0).begin()); + } + + ValueT getTensorNames() { + return (*getODSOperands(1).begin()); + } + + RangeT getData() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SaveOpAdaptor : public SaveOpGenericAdaptor<::mlir::ValueRange> { +public: + using SaveOpGenericAdaptor::SaveOpGenericAdaptor; + SaveOpAdaptor(SaveOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SaveOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SaveOpAdaptor; + template + using GenericAdaptor = SaveOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Save"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getFilename(); + ::mlir::TypedValue<::mlir::TensorType> getTensorNames(); + ::mlir::Operation::operand_range getData(); + ::mlir::OpOperand &getFilenameMutable(); + ::mlir::OpOperand &getTensorNamesMutable(); + ::mlir::MutableOperandRange getDataMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + mlir::OperandElementTypeRange getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value filename, ::mlir::Value tensor_names, ::mlir::ValueRange data); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value filename, ::mlir::Value tensor_names, ::mlir::ValueRange data); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SaveOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SaveSlicesOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SaveSlicesOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SaveSlicesOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SaveSlicesOpGenericAdaptorBase(SaveSlicesOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SaveSlicesOpGenericAdaptor : public detail::SaveSlicesOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SaveSlicesOpGenericAdaptorBase; +public: + SaveSlicesOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SaveSlicesOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SaveSlicesOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SaveSlicesOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getFilename() { + return (*getODSOperands(0).begin()); + } + + ValueT getTensorNames() { + return (*getODSOperands(1).begin()); + } + + ValueT getShapesAndSlices() { + return (*getODSOperands(2).begin()); + } + + RangeT getData() { + return getODSOperands(3); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SaveSlicesOpAdaptor : public SaveSlicesOpGenericAdaptor<::mlir::ValueRange> { +public: + using SaveSlicesOpGenericAdaptor::SaveSlicesOpGenericAdaptor; + SaveSlicesOpAdaptor(SaveSlicesOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SaveSlicesOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SaveSlicesOpAdaptor; + template + using GenericAdaptor = SaveSlicesOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SaveSlices"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getFilename(); + ::mlir::TypedValue<::mlir::TensorType> getTensorNames(); + ::mlir::TypedValue<::mlir::TensorType> getShapesAndSlices(); + ::mlir::Operation::operand_range getData(); + ::mlir::OpOperand &getFilenameMutable(); + ::mlir::OpOperand &getTensorNamesMutable(); + ::mlir::OpOperand &getShapesAndSlicesMutable(); + ::mlir::MutableOperandRange getDataMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + mlir::OperandElementTypeRange getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value filename, ::mlir::Value tensor_names, ::mlir::Value shapes_and_slices, ::mlir::ValueRange data); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value filename, ::mlir::Value tensor_names, ::mlir::Value shapes_and_slices, ::mlir::ValueRange data); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SaveSlicesOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SaveV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SaveV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SaveV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SaveV2OpGenericAdaptorBase(SaveV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SaveV2OpGenericAdaptor : public detail::SaveV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SaveV2OpGenericAdaptorBase; +public: + SaveV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SaveV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SaveV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SaveV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getPrefix() { + return (*getODSOperands(0).begin()); + } + + ValueT getTensorNames() { + return (*getODSOperands(1).begin()); + } + + ValueT getShapeAndSlices() { + return (*getODSOperands(2).begin()); + } + + RangeT getTensors() { + return getODSOperands(3); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SaveV2OpAdaptor : public SaveV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using SaveV2OpGenericAdaptor::SaveV2OpGenericAdaptor; + SaveV2OpAdaptor(SaveV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SaveV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SaveV2OpAdaptor; + template + using GenericAdaptor = SaveV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dtypes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDtypesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDtypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SaveV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getPrefix(); + ::mlir::TypedValue<::mlir::TensorType> getTensorNames(); + ::mlir::TypedValue<::mlir::TensorType> getShapeAndSlices(); + ::mlir::Operation::operand_range getTensors(); + ::mlir::OpOperand &getPrefixMutable(); + ::mlir::OpOperand &getTensorNamesMutable(); + ::mlir::OpOperand &getShapeAndSlicesMutable(); + ::mlir::MutableOperandRange getTensorsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + mlir::OperandElementTypeRange getDtypes(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value prefix, ::mlir::Value tensor_names, ::mlir::Value shape_and_slices, ::mlir::ValueRange tensors); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value prefix, ::mlir::Value tensor_names, ::mlir::Value shape_and_slices, ::mlir::ValueRange tensors); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SaveV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ScatterNdOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ScatterNdOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ScatterNdOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ScatterNdOpGenericAdaptorBase(ScatterNdOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ScatterNdOpGenericAdaptor : public detail::ScatterNdOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ScatterNdOpGenericAdaptorBase; +public: + ScatterNdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ScatterNdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ScatterNdOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ScatterNdOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIndices() { + return (*getODSOperands(0).begin()); + } + + ValueT getUpdates() { + return (*getODSOperands(1).begin()); + } + + ValueT getShape() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ScatterNdOpAdaptor : public ScatterNdOpGenericAdaptor<::mlir::ValueRange> { +public: + using ScatterNdOpGenericAdaptor::ScatterNdOpGenericAdaptor; + ScatterNdOpAdaptor(ScatterNdOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ScatterNdOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ScatterNdOpAdaptor; + template + using GenericAdaptor = ScatterNdOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ScatterNd"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getUpdates(); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getUpdatesMutable(); + ::mlir::OpOperand &getShapeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value indices, ::mlir::Value updates, ::mlir::Value shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value indices, ::mlir::Value updates, ::mlir::Value shape); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ScatterNdOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SegmentMaxOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SegmentMaxOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SegmentMaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SegmentMaxOpGenericAdaptorBase(SegmentMaxOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SegmentMaxOpGenericAdaptor : public detail::SegmentMaxOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SegmentMaxOpGenericAdaptorBase; +public: + SegmentMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SegmentMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SegmentMaxOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SegmentMaxOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getData() { + return (*getODSOperands(0).begin()); + } + + ValueT getSegmentIds() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SegmentMaxOpAdaptor : public SegmentMaxOpGenericAdaptor<::mlir::ValueRange> { +public: + using SegmentMaxOpGenericAdaptor::SegmentMaxOpGenericAdaptor; + SegmentMaxOpAdaptor(SegmentMaxOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SegmentMaxOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SegmentMaxOpAdaptor; + template + using GenericAdaptor = SegmentMaxOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SegmentMax"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getData(); + ::mlir::TypedValue<::mlir::TensorType> getSegmentIds(); + ::mlir::OpOperand &getDataMutable(); + ::mlir::OpOperand &getSegmentIdsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value data, ::mlir::Value segment_ids); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value data, ::mlir::Value segment_ids); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SegmentMaxOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SegmentMaxV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SegmentMaxV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SegmentMaxV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SegmentMaxV2OpGenericAdaptorBase(SegmentMaxV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SegmentMaxV2OpGenericAdaptor : public detail::SegmentMaxV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SegmentMaxV2OpGenericAdaptorBase; +public: + SegmentMaxV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SegmentMaxV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SegmentMaxV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SegmentMaxV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getData() { + return (*getODSOperands(0).begin()); + } + + ValueT getSegmentIds() { + return (*getODSOperands(1).begin()); + } + + ValueT getNumSegments() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SegmentMaxV2OpAdaptor : public SegmentMaxV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using SegmentMaxV2OpGenericAdaptor::SegmentMaxV2OpGenericAdaptor; + SegmentMaxV2OpAdaptor(SegmentMaxV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SegmentMaxV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SegmentMaxV2OpAdaptor; + template + using GenericAdaptor = SegmentMaxV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices"), ::llvm::StringRef("Tnumsegments")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTnumsegmentsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTnumsegmentsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SegmentMaxV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getData(); + ::mlir::TypedValue<::mlir::TensorType> getSegmentIds(); + ::mlir::TypedValue<::mlir::TensorType> getNumSegments(); + ::mlir::OpOperand &getDataMutable(); + ::mlir::OpOperand &getSegmentIdsMutable(); + ::mlir::OpOperand &getNumSegmentsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + ::mlir::Type getTnumsegments(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value data, ::mlir::Value segment_ids, ::mlir::Value num_segments); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value data, ::mlir::Value segment_ids, ::mlir::Value num_segments); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SegmentMaxV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SegmentMeanOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SegmentMeanOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SegmentMeanOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SegmentMeanOpGenericAdaptorBase(SegmentMeanOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SegmentMeanOpGenericAdaptor : public detail::SegmentMeanOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SegmentMeanOpGenericAdaptorBase; +public: + SegmentMeanOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SegmentMeanOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SegmentMeanOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SegmentMeanOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getData() { + return (*getODSOperands(0).begin()); + } + + ValueT getSegmentIds() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SegmentMeanOpAdaptor : public SegmentMeanOpGenericAdaptor<::mlir::ValueRange> { +public: + using SegmentMeanOpGenericAdaptor::SegmentMeanOpGenericAdaptor; + SegmentMeanOpAdaptor(SegmentMeanOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SegmentMeanOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SegmentMeanOpAdaptor; + template + using GenericAdaptor = SegmentMeanOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SegmentMean"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getData(); + ::mlir::TypedValue<::mlir::TensorType> getSegmentIds(); + ::mlir::OpOperand &getDataMutable(); + ::mlir::OpOperand &getSegmentIdsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value data, ::mlir::Value segment_ids); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value data, ::mlir::Value segment_ids); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SegmentMeanOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SegmentMinOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SegmentMinOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SegmentMinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SegmentMinOpGenericAdaptorBase(SegmentMinOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SegmentMinOpGenericAdaptor : public detail::SegmentMinOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SegmentMinOpGenericAdaptorBase; +public: + SegmentMinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SegmentMinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SegmentMinOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SegmentMinOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getData() { + return (*getODSOperands(0).begin()); + } + + ValueT getSegmentIds() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SegmentMinOpAdaptor : public SegmentMinOpGenericAdaptor<::mlir::ValueRange> { +public: + using SegmentMinOpGenericAdaptor::SegmentMinOpGenericAdaptor; + SegmentMinOpAdaptor(SegmentMinOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SegmentMinOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SegmentMinOpAdaptor; + template + using GenericAdaptor = SegmentMinOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SegmentMin"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getData(); + ::mlir::TypedValue<::mlir::TensorType> getSegmentIds(); + ::mlir::OpOperand &getDataMutable(); + ::mlir::OpOperand &getSegmentIdsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value data, ::mlir::Value segment_ids); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value data, ::mlir::Value segment_ids); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SegmentMinOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SegmentMinV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SegmentMinV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SegmentMinV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SegmentMinV2OpGenericAdaptorBase(SegmentMinV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SegmentMinV2OpGenericAdaptor : public detail::SegmentMinV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SegmentMinV2OpGenericAdaptorBase; +public: + SegmentMinV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SegmentMinV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SegmentMinV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SegmentMinV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getData() { + return (*getODSOperands(0).begin()); + } + + ValueT getSegmentIds() { + return (*getODSOperands(1).begin()); + } + + ValueT getNumSegments() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SegmentMinV2OpAdaptor : public SegmentMinV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using SegmentMinV2OpGenericAdaptor::SegmentMinV2OpGenericAdaptor; + SegmentMinV2OpAdaptor(SegmentMinV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SegmentMinV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SegmentMinV2OpAdaptor; + template + using GenericAdaptor = SegmentMinV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices"), ::llvm::StringRef("Tnumsegments")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTnumsegmentsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTnumsegmentsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SegmentMinV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getData(); + ::mlir::TypedValue<::mlir::TensorType> getSegmentIds(); + ::mlir::TypedValue<::mlir::TensorType> getNumSegments(); + ::mlir::OpOperand &getDataMutable(); + ::mlir::OpOperand &getSegmentIdsMutable(); + ::mlir::OpOperand &getNumSegmentsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + ::mlir::Type getTnumsegments(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value data, ::mlir::Value segment_ids, ::mlir::Value num_segments); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value data, ::mlir::Value segment_ids, ::mlir::Value num_segments); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SegmentMinV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SegmentProdOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SegmentProdOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SegmentProdOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SegmentProdOpGenericAdaptorBase(SegmentProdOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SegmentProdOpGenericAdaptor : public detail::SegmentProdOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SegmentProdOpGenericAdaptorBase; +public: + SegmentProdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SegmentProdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SegmentProdOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SegmentProdOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getData() { + return (*getODSOperands(0).begin()); + } + + ValueT getSegmentIds() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SegmentProdOpAdaptor : public SegmentProdOpGenericAdaptor<::mlir::ValueRange> { +public: + using SegmentProdOpGenericAdaptor::SegmentProdOpGenericAdaptor; + SegmentProdOpAdaptor(SegmentProdOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SegmentProdOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SegmentProdOpAdaptor; + template + using GenericAdaptor = SegmentProdOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SegmentProd"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getData(); + ::mlir::TypedValue<::mlir::TensorType> getSegmentIds(); + ::mlir::OpOperand &getDataMutable(); + ::mlir::OpOperand &getSegmentIdsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value data, ::mlir::Value segment_ids); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value data, ::mlir::Value segment_ids); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SegmentProdOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SegmentProdV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SegmentProdV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SegmentProdV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SegmentProdV2OpGenericAdaptorBase(SegmentProdV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SegmentProdV2OpGenericAdaptor : public detail::SegmentProdV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SegmentProdV2OpGenericAdaptorBase; +public: + SegmentProdV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SegmentProdV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SegmentProdV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SegmentProdV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getData() { + return (*getODSOperands(0).begin()); + } + + ValueT getSegmentIds() { + return (*getODSOperands(1).begin()); + } + + ValueT getNumSegments() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SegmentProdV2OpAdaptor : public SegmentProdV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using SegmentProdV2OpGenericAdaptor::SegmentProdV2OpGenericAdaptor; + SegmentProdV2OpAdaptor(SegmentProdV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SegmentProdV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SegmentProdV2OpAdaptor; + template + using GenericAdaptor = SegmentProdV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices"), ::llvm::StringRef("Tnumsegments")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTnumsegmentsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTnumsegmentsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SegmentProdV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getData(); + ::mlir::TypedValue<::mlir::TensorType> getSegmentIds(); + ::mlir::TypedValue<::mlir::TensorType> getNumSegments(); + ::mlir::OpOperand &getDataMutable(); + ::mlir::OpOperand &getSegmentIdsMutable(); + ::mlir::OpOperand &getNumSegmentsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + ::mlir::Type getTnumsegments(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value data, ::mlir::Value segment_ids, ::mlir::Value num_segments); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value data, ::mlir::Value segment_ids, ::mlir::Value num_segments); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SegmentProdV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SegmentSumOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SegmentSumOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SegmentSumOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SegmentSumOpGenericAdaptorBase(SegmentSumOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SegmentSumOpGenericAdaptor : public detail::SegmentSumOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SegmentSumOpGenericAdaptorBase; +public: + SegmentSumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SegmentSumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SegmentSumOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SegmentSumOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getData() { + return (*getODSOperands(0).begin()); + } + + ValueT getSegmentIds() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SegmentSumOpAdaptor : public SegmentSumOpGenericAdaptor<::mlir::ValueRange> { +public: + using SegmentSumOpGenericAdaptor::SegmentSumOpGenericAdaptor; + SegmentSumOpAdaptor(SegmentSumOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SegmentSumOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SegmentSumOpAdaptor; + template + using GenericAdaptor = SegmentSumOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SegmentSum"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getData(); + ::mlir::TypedValue<::mlir::TensorType> getSegmentIds(); + ::mlir::OpOperand &getDataMutable(); + ::mlir::OpOperand &getSegmentIdsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value data, ::mlir::Value segment_ids); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value data, ::mlir::Value segment_ids); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SegmentSumOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SegmentSumV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SegmentSumV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SegmentSumV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SegmentSumV2OpGenericAdaptorBase(SegmentSumV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SegmentSumV2OpGenericAdaptor : public detail::SegmentSumV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SegmentSumV2OpGenericAdaptorBase; +public: + SegmentSumV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SegmentSumV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SegmentSumV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SegmentSumV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getData() { + return (*getODSOperands(0).begin()); + } + + ValueT getSegmentIds() { + return (*getODSOperands(1).begin()); + } + + ValueT getNumSegments() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SegmentSumV2OpAdaptor : public SegmentSumV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using SegmentSumV2OpGenericAdaptor::SegmentSumV2OpGenericAdaptor; + SegmentSumV2OpAdaptor(SegmentSumV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SegmentSumV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SegmentSumV2OpAdaptor; + template + using GenericAdaptor = SegmentSumV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices"), ::llvm::StringRef("Tnumsegments")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTnumsegmentsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTnumsegmentsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SegmentSumV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getData(); + ::mlir::TypedValue<::mlir::TensorType> getSegmentIds(); + ::mlir::TypedValue<::mlir::TensorType> getNumSegments(); + ::mlir::OpOperand &getDataMutable(); + ::mlir::OpOperand &getSegmentIdsMutable(); + ::mlir::OpOperand &getNumSegmentsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + ::mlir::Type getTnumsegments(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value data, ::mlir::Value segment_ids, ::mlir::Value num_segments); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value data, ::mlir::Value segment_ids, ::mlir::Value num_segments); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SegmentSumV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SelectOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SelectOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SelectOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SelectOpGenericAdaptorBase(SelectOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SelectOpGenericAdaptor : public detail::SelectOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SelectOpGenericAdaptorBase; +public: + SelectOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SelectOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SelectOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SelectOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getCondition() { + return (*getODSOperands(0).begin()); + } + + ValueT getThenValue() { + return (*getODSOperands(1).begin()); + } + + ValueT getElseValue() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SelectOpAdaptor : public SelectOpGenericAdaptor<::mlir::ValueRange> { +public: + using SelectOpGenericAdaptor::SelectOpGenericAdaptor; + SelectOpAdaptor(SelectOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SelectOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SelectOpAdaptor; + template + using GenericAdaptor = SelectOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Select"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getCondition(); + ::mlir::TypedValue<::mlir::TensorType> getThenValue(); + ::mlir::TypedValue<::mlir::TensorType> getElseValue(); + ::mlir::OpOperand &getConditionMutable(); + ::mlir::OpOperand &getThenValueMutable(); + ::mlir::OpOperand &getElseValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value condition, ::mlir::Value then_value, ::mlir::Value else_value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value condition, ::mlir::Value then_value, ::mlir::Value else_value); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SelectOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SelectV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SelectV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SelectV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SelectV2OpGenericAdaptorBase(SelectV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SelectV2OpGenericAdaptor : public detail::SelectV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SelectV2OpGenericAdaptorBase; +public: + SelectV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SelectV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SelectV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SelectV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getCondition() { + return (*getODSOperands(0).begin()); + } + + ValueT getThenValue() { + return (*getODSOperands(1).begin()); + } + + ValueT getElseValue() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SelectV2OpAdaptor : public SelectV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using SelectV2OpGenericAdaptor::SelectV2OpGenericAdaptor; + SelectV2OpAdaptor(SelectV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SelectV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SelectV2OpAdaptor; + template + using GenericAdaptor = SelectV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SelectV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getCondition(); + ::mlir::TypedValue<::mlir::TensorType> getThenValue(); + ::mlir::TypedValue<::mlir::TensorType> getElseValue(); + ::mlir::OpOperand &getConditionMutable(); + ::mlir::OpOperand &getThenValueMutable(); + ::mlir::OpOperand &getElseValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value condition, Value e, Value t); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value condition, ::mlir::Value then_value, ::mlir::Value else_value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value condition, ::mlir::Value then_value, ::mlir::Value else_value); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SelectV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SelfAdjointEigV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SelfAdjointEigV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SelfAdjointEigV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SelfAdjointEigV2OpGenericAdaptorBase(SelfAdjointEigV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getComputeVAttr(); + bool getComputeV(); +}; +} // namespace detail +template +class SelfAdjointEigV2OpGenericAdaptor : public detail::SelfAdjointEigV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SelfAdjointEigV2OpGenericAdaptorBase; +public: + SelfAdjointEigV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SelfAdjointEigV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SelfAdjointEigV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SelfAdjointEigV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SelfAdjointEigV2OpAdaptor : public SelfAdjointEigV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using SelfAdjointEigV2OpGenericAdaptor::SelfAdjointEigV2OpGenericAdaptor; + SelfAdjointEigV2OpAdaptor(SelfAdjointEigV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SelfAdjointEigV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SelfAdjointEigV2OpAdaptor; + template + using GenericAdaptor = SelfAdjointEigV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("compute_v")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getComputeVAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getComputeVAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SelfAdjointEigV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getE(); + ::mlir::TypedValue<::mlir::TensorType> getV(); + ::mlir::BoolAttr getComputeVAttr(); + bool getComputeV(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setComputeVAttr(::mlir::BoolAttr attr); + void setComputeV(::std::optional attrValue); + ::mlir::Attribute removeComputeVAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type e, ::mlir::Type v, ::mlir::Value input, /*optional*/::mlir::BoolAttr compute_v); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, /*optional*/::mlir::BoolAttr compute_v); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type e, ::mlir::Type v, ::mlir::Value input, /*optional*/bool compute_v = true); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, /*optional*/bool compute_v = true); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SelfAdjointEigV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SeluGradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SeluGradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SeluGradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SeluGradOpGenericAdaptorBase(SeluGradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SeluGradOpGenericAdaptor : public detail::SeluGradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SeluGradOpGenericAdaptorBase; +public: + SeluGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SeluGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SeluGradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SeluGradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getGradients() { + return (*getODSOperands(0).begin()); + } + + ValueT getOutputs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SeluGradOpAdaptor : public SeluGradOpGenericAdaptor<::mlir::ValueRange> { +public: + using SeluGradOpGenericAdaptor::SeluGradOpGenericAdaptor; + SeluGradOpAdaptor(SeluGradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SeluGradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SeluGradOpAdaptor; + template + using GenericAdaptor = SeluGradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SeluGrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getGradients(); + ::mlir::TypedValue<::mlir::TensorType> getOutputs(); + ::mlir::OpOperand &getGradientsMutable(); + ::mlir::OpOperand &getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getBackprops(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type backprops, ::mlir::Value gradients, ::mlir::Value outputs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value gradients, ::mlir::Value outputs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value gradients, ::mlir::Value outputs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SeluGradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SeluOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SeluOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SeluOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SeluOpGenericAdaptorBase(SeluOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SeluOpGenericAdaptor : public detail::SeluOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SeluOpGenericAdaptorBase; +public: + SeluOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SeluOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SeluOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SeluOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getFeatures() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SeluOpAdaptor : public SeluOpGenericAdaptor<::mlir::ValueRange> { +public: + using SeluOpGenericAdaptor::SeluOpGenericAdaptor; + SeluOpAdaptor(SeluOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SeluOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SeluOpAdaptor; + template + using GenericAdaptor = SeluOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Selu"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getFeatures(); + ::mlir::OpOperand &getFeaturesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getActivations(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type activations, ::mlir::Value features); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value features); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value features); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SeluOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SendOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SendOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SendOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SendOpGenericAdaptorBase(SendOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getTensorNameAttr(); + ::llvm::StringRef getTensorName(); + ::mlir::StringAttr getSendDeviceAttr(); + ::llvm::StringRef getSendDevice(); + ::mlir::IntegerAttr getSendDeviceIncarnationAttr(); + uint64_t getSendDeviceIncarnation(); + ::mlir::StringAttr getRecvDeviceAttr(); + ::llvm::StringRef getRecvDevice(); + ::mlir::BoolAttr getClientTerminatedAttr(); + bool getClientTerminated(); +}; +} // namespace detail +template +class SendOpGenericAdaptor : public detail::SendOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SendOpGenericAdaptorBase; +public: + SendOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SendOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SendOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SendOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTensor() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SendOpAdaptor : public SendOpGenericAdaptor<::mlir::ValueRange> { +public: + using SendOpGenericAdaptor::SendOpGenericAdaptor; + SendOpAdaptor(SendOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SendOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = SendOpAdaptor; + template + using GenericAdaptor = SendOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("client_terminated"), ::llvm::StringRef("recv_device"), ::llvm::StringRef("send_device"), ::llvm::StringRef("send_device_incarnation"), ::llvm::StringRef("tensor_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getClientTerminatedAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getClientTerminatedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getRecvDeviceAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getRecvDeviceAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSendDeviceAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSendDeviceAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getSendDeviceIncarnationAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getSendDeviceIncarnationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getTensorNameAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getTensorNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Send"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::OpOperand &getTensorMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::StringAttr getTensorNameAttr(); + ::llvm::StringRef getTensorName(); + ::mlir::StringAttr getSendDeviceAttr(); + ::llvm::StringRef getSendDevice(); + ::mlir::IntegerAttr getSendDeviceIncarnationAttr(); + uint64_t getSendDeviceIncarnation(); + ::mlir::StringAttr getRecvDeviceAttr(); + ::llvm::StringRef getRecvDevice(); + ::mlir::BoolAttr getClientTerminatedAttr(); + bool getClientTerminated(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setTensorNameAttr(::mlir::StringAttr attr); + void setTensorName(::llvm::StringRef attrValue); + void setSendDeviceAttr(::mlir::StringAttr attr); + void setSendDevice(::llvm::StringRef attrValue); + void setSendDeviceIncarnationAttr(::mlir::IntegerAttr attr); + void setSendDeviceIncarnation(uint64_t attrValue); + void setRecvDeviceAttr(::mlir::StringAttr attr); + void setRecvDevice(::llvm::StringRef attrValue); + void setClientTerminatedAttr(::mlir::BoolAttr attr); + void setClientTerminated(::std::optional attrValue); + ::mlir::Attribute removeClientTerminatedAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value tensor, ::mlir::StringAttr tensor_name, ::mlir::StringAttr send_device, ::mlir::IntegerAttr send_device_incarnation, ::mlir::StringAttr recv_device, /*optional*/::mlir::BoolAttr client_terminated); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tensor, ::mlir::StringAttr tensor_name, ::mlir::StringAttr send_device, ::mlir::IntegerAttr send_device_incarnation, ::mlir::StringAttr recv_device, /*optional*/::mlir::BoolAttr client_terminated); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value tensor, ::llvm::StringRef tensor_name, ::llvm::StringRef send_device, uint64_t send_device_incarnation, ::llvm::StringRef recv_device, /*optional*/bool client_terminated = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tensor, ::llvm::StringRef tensor_name, ::llvm::StringRef send_device, uint64_t send_device_incarnation, ::llvm::StringRef recv_device, /*optional*/bool client_terminated = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SendOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SendTPUEmbeddingGradientsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SendTPUEmbeddingGradientsOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SendTPUEmbeddingGradientsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SendTPUEmbeddingGradientsOpGenericAdaptorBase(SendTPUEmbeddingGradientsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class SendTPUEmbeddingGradientsOpGenericAdaptor : public detail::SendTPUEmbeddingGradientsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SendTPUEmbeddingGradientsOpGenericAdaptorBase; +public: + SendTPUEmbeddingGradientsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SendTPUEmbeddingGradientsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SendTPUEmbeddingGradientsOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SendTPUEmbeddingGradientsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getLearningRates() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SendTPUEmbeddingGradientsOpAdaptor : public SendTPUEmbeddingGradientsOpGenericAdaptor<::mlir::ValueRange> { +public: + using SendTPUEmbeddingGradientsOpGenericAdaptor::SendTPUEmbeddingGradientsOpGenericAdaptor; + SendTPUEmbeddingGradientsOpAdaptor(SendTPUEmbeddingGradientsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SendTPUEmbeddingGradientsOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = SendTPUEmbeddingGradientsOpAdaptor; + template + using GenericAdaptor = SendTPUEmbeddingGradientsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("N"), ::llvm::StringRef("NN"), ::llvm::StringRef("config"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNNAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SendTPUEmbeddingGradients"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getLearningRates(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getLearningRatesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + size_t getN(); + size_t getNN(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange inputs, ::mlir::ValueRange learning_rates, ::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::mlir::ValueRange learning_rates, ::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange inputs, ::mlir::ValueRange learning_rates, ::llvm::StringRef config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::mlir::ValueRange learning_rates, ::llvm::StringRef config); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SendTPUEmbeddingGradientsOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SerializeIteratorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SerializeIteratorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SerializeIteratorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SerializeIteratorOpGenericAdaptorBase(SerializeIteratorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getExternalStatePolicyAttr(); + uint64_t getExternalStatePolicy(); +}; +} // namespace detail +template +class SerializeIteratorOpGenericAdaptor : public detail::SerializeIteratorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SerializeIteratorOpGenericAdaptorBase; +public: + SerializeIteratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SerializeIteratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SerializeIteratorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SerializeIteratorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getResourceHandle() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SerializeIteratorOpAdaptor : public SerializeIteratorOpGenericAdaptor<::mlir::ValueRange> { +public: + using SerializeIteratorOpGenericAdaptor::SerializeIteratorOpGenericAdaptor; + SerializeIteratorOpAdaptor(SerializeIteratorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SerializeIteratorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SerializeIteratorOpAdaptor; + template + using GenericAdaptor = SerializeIteratorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("external_state_policy")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getExternalStatePolicyAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getExternalStatePolicyAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SerializeIterator"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResourceHandle(); + ::mlir::OpOperand &getResourceHandleMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSerialized(); + ::mlir::IntegerAttr getExternalStatePolicyAttr(); + uint64_t getExternalStatePolicy(); + void setExternalStatePolicyAttr(::mlir::IntegerAttr attr); + void setExternalStatePolicy(::std::optional attrValue); + ::mlir::Attribute removeExternalStatePolicyAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type serialized, ::mlir::Value resource_handle, /*optional*/::mlir::IntegerAttr external_state_policy); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value resource_handle, /*optional*/::mlir::IntegerAttr external_state_policy); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type serialized, ::mlir::Value resource_handle, /*optional*/uint64_t external_state_policy = 0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value resource_handle, /*optional*/uint64_t external_state_policy = 0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SerializeIteratorOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SerializeSparseOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SerializeSparseOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SerializeSparseOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SerializeSparseOpGenericAdaptorBase(SerializeSparseOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SerializeSparseOpGenericAdaptor : public detail::SerializeSparseOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SerializeSparseOpGenericAdaptorBase; +public: + SerializeSparseOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SerializeSparseOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SerializeSparseOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SerializeSparseOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSparseIndices() { + return (*getODSOperands(0).begin()); + } + + ValueT getSparseValues() { + return (*getODSOperands(1).begin()); + } + + ValueT getSparseShape() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SerializeSparseOpAdaptor : public SerializeSparseOpGenericAdaptor<::mlir::ValueRange> { +public: + using SerializeSparseOpGenericAdaptor::SerializeSparseOpGenericAdaptor; + SerializeSparseOpAdaptor(SerializeSparseOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SerializeSparseOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SerializeSparseOpAdaptor; + template + using GenericAdaptor = SerializeSparseOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("out_type")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutTypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SerializeSparse"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSparseIndices(); + ::mlir::TypedValue<::mlir::TensorType> getSparseValues(); + ::mlir::TypedValue<::mlir::TensorType> getSparseShape(); + ::mlir::OpOperand &getSparseIndicesMutable(); + ::mlir::OpOperand &getSparseValuesMutable(); + ::mlir::OpOperand &getSparseShapeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSerializedSparse(); + ::mlir::Type getT(); + ::mlir::Type getOutType(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type serialized_sparse, ::mlir::Value sparse_indices, ::mlir::Value sparse_values, ::mlir::Value sparse_shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value sparse_indices, ::mlir::Value sparse_values, ::mlir::Value sparse_shape); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SerializeSparseOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SetStaticDimensionBoundsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SetStaticDimensionBoundsOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SetStaticDimensionBoundsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SetStaticDimensionBoundsOpGenericAdaptorBase(SetStaticDimensionBoundsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SetStaticDimensionBoundsOpGenericAdaptor : public detail::SetStaticDimensionBoundsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SetStaticDimensionBoundsOpGenericAdaptorBase; +public: + SetStaticDimensionBoundsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SetStaticDimensionBoundsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SetStaticDimensionBoundsOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SetStaticDimensionBoundsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getStaticShape() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SetStaticDimensionBoundsOpAdaptor : public SetStaticDimensionBoundsOpGenericAdaptor<::mlir::ValueRange> { +public: + using SetStaticDimensionBoundsOpGenericAdaptor::SetStaticDimensionBoundsOpGenericAdaptor; + SetStaticDimensionBoundsOpAdaptor(SetStaticDimensionBoundsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SetStaticDimensionBoundsOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = SetStaticDimensionBoundsOpAdaptor; + template + using GenericAdaptor = SetStaticDimensionBoundsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SetStaticDimensionBounds"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getStaticShape(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getStaticShapeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value static_shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value static_shape); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SetStaticDimensionBoundsOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ShapeNOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ShapeNOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ShapeNOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ShapeNOpGenericAdaptorBase(ShapeNOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ShapeNOpGenericAdaptor : public detail::ShapeNOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ShapeNOpGenericAdaptorBase; +public: + ShapeNOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ShapeNOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ShapeNOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ShapeNOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInput() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ShapeNOpAdaptor : public ShapeNOpGenericAdaptor<::mlir::ValueRange> { +public: + using ShapeNOpGenericAdaptor::ShapeNOpGenericAdaptor; + ShapeNOpAdaptor(ShapeNOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ShapeNOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = ShapeNOpAdaptor; + template + using GenericAdaptor = ShapeNOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("N"), ::llvm::StringRef("T"), ::llvm::StringRef("out_type")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOutTypeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOutTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ShapeN"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInput(); + ::mlir::MutableOperandRange getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutput(); + size_t getN(); + ::mlir::Type getT(); + ::mlir::Type getOutType(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ShapeNOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ShapeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ShapeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ShapeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ShapeOpGenericAdaptorBase(ShapeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ShapeOpGenericAdaptor : public detail::ShapeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ShapeOpGenericAdaptorBase; +public: + ShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ShapeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ShapeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ShapeOpAdaptor : public ShapeOpGenericAdaptor<::mlir::ValueRange> { +public: + using ShapeOpGenericAdaptor::ShapeOpGenericAdaptor; + ShapeOpAdaptor(ShapeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ShapeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ShapeOpAdaptor; + template + using GenericAdaptor = ShapeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("out_type")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutTypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Shape"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getOutType(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value input, BoolAttr use32Bit); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ShapeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ShardedFilenameOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ShardedFilenameOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ShardedFilenameOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ShardedFilenameOpGenericAdaptorBase(ShardedFilenameOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ShardedFilenameOpGenericAdaptor : public detail::ShardedFilenameOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ShardedFilenameOpGenericAdaptorBase; +public: + ShardedFilenameOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ShardedFilenameOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ShardedFilenameOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ShardedFilenameOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getBasename() { + return (*getODSOperands(0).begin()); + } + + ValueT getShard() { + return (*getODSOperands(1).begin()); + } + + ValueT getNumShards() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ShardedFilenameOpAdaptor : public ShardedFilenameOpGenericAdaptor<::mlir::ValueRange> { +public: + using ShardedFilenameOpGenericAdaptor::ShardedFilenameOpGenericAdaptor; + ShardedFilenameOpAdaptor(ShardedFilenameOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ShardedFilenameOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ShardedFilenameOpAdaptor; + template + using GenericAdaptor = ShardedFilenameOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ShardedFilename"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getBasename(); + ::mlir::TypedValue<::mlir::TensorType> getShard(); + ::mlir::TypedValue<::mlir::TensorType> getNumShards(); + ::mlir::OpOperand &getBasenameMutable(); + ::mlir::OpOperand &getShardMutable(); + ::mlir::OpOperand &getNumShardsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getFilename(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type filename, ::mlir::Value basename, ::mlir::Value shard, ::mlir::Value num_shards); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value basename, ::mlir::Value shard, ::mlir::Value num_shards); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ShardedFilenameOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ShuffleAndRepeatDatasetV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ShuffleAndRepeatDatasetV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ShuffleAndRepeatDatasetV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ShuffleAndRepeatDatasetV2OpGenericAdaptorBase(ShuffleAndRepeatDatasetV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getReshuffleEachIterationAttr(); + bool getReshuffleEachIteration(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); +}; +} // namespace detail +template +class ShuffleAndRepeatDatasetV2OpGenericAdaptor : public detail::ShuffleAndRepeatDatasetV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ShuffleAndRepeatDatasetV2OpGenericAdaptorBase; +public: + ShuffleAndRepeatDatasetV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ShuffleAndRepeatDatasetV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ShuffleAndRepeatDatasetV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ShuffleAndRepeatDatasetV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputDataset() { + return (*getODSOperands(0).begin()); + } + + ValueT getBufferSize() { + return (*getODSOperands(1).begin()); + } + + ValueT getSeed() { + return (*getODSOperands(2).begin()); + } + + ValueT getSeed2() { + return (*getODSOperands(3).begin()); + } + + ValueT getCount() { + return (*getODSOperands(4).begin()); + } + + ValueT getSeedGenerator() { + return (*getODSOperands(5).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ShuffleAndRepeatDatasetV2OpAdaptor : public ShuffleAndRepeatDatasetV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using ShuffleAndRepeatDatasetV2OpGenericAdaptor::ShuffleAndRepeatDatasetV2OpGenericAdaptor; + ShuffleAndRepeatDatasetV2OpAdaptor(ShuffleAndRepeatDatasetV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ShuffleAndRepeatDatasetV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<6>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ShuffleAndRepeatDatasetV2OpAdaptor; + template + using GenericAdaptor = ShuffleAndRepeatDatasetV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("metadata"), ::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types"), ::llvm::StringRef("reshuffle_each_iteration")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getMetadataAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getMetadataAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getReshuffleEachIterationAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getReshuffleEachIterationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ShuffleAndRepeatDatasetV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputDataset(); + ::mlir::TypedValue<::mlir::TensorType> getBufferSize(); + ::mlir::TypedValue<::mlir::TensorType> getSeed(); + ::mlir::TypedValue<::mlir::TensorType> getSeed2(); + ::mlir::TypedValue<::mlir::TensorType> getCount(); + ::mlir::TypedValue<::mlir::TensorType> getSeedGenerator(); + ::mlir::OpOperand &getInputDatasetMutable(); + ::mlir::OpOperand &getBufferSizeMutable(); + ::mlir::OpOperand &getSeedMutable(); + ::mlir::OpOperand &getSeed2Mutable(); + ::mlir::OpOperand &getCountMutable(); + ::mlir::OpOperand &getSeedGeneratorMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::BoolAttr getReshuffleEachIterationAttr(); + bool getReshuffleEachIteration(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); + void setReshuffleEachIterationAttr(::mlir::BoolAttr attr); + void setReshuffleEachIteration(::std::optional attrValue); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + void setMetadataAttr(::mlir::StringAttr attr); + void setMetadata(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeReshuffleEachIterationAttr(); + ::mlir::Attribute removeMetadataAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, ::mlir::Value buffer_size, ::mlir::Value seed, ::mlir::Value seed2, ::mlir::Value count, ::mlir::Value seed_generator, /*optional*/::mlir::BoolAttr reshuffle_each_iteration, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, ::mlir::Value buffer_size, ::mlir::Value seed, ::mlir::Value seed2, ::mlir::Value count, ::mlir::Value seed_generator, /*optional*/::mlir::BoolAttr reshuffle_each_iteration, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, ::mlir::Value buffer_size, ::mlir::Value seed, ::mlir::Value seed2, ::mlir::Value count, ::mlir::Value seed_generator, /*optional*/bool reshuffle_each_iteration, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::llvm::StringRef metadata = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, ::mlir::Value buffer_size, ::mlir::Value seed, ::mlir::Value seed2, ::mlir::Value count, ::mlir::Value seed_generator, /*optional*/bool reshuffle_each_iteration, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::llvm::StringRef metadata = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ShuffleAndRepeatDatasetV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ShuffleDatasetV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ShuffleDatasetV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ShuffleDatasetV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ShuffleDatasetV2OpGenericAdaptorBase(ShuffleDatasetV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); +}; +} // namespace detail +template +class ShuffleDatasetV2OpGenericAdaptor : public detail::ShuffleDatasetV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ShuffleDatasetV2OpGenericAdaptorBase; +public: + ShuffleDatasetV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ShuffleDatasetV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ShuffleDatasetV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ShuffleDatasetV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputDataset() { + return (*getODSOperands(0).begin()); + } + + ValueT getBufferSize() { + return (*getODSOperands(1).begin()); + } + + ValueT getSeedGenerator() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ShuffleDatasetV2OpAdaptor : public ShuffleDatasetV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using ShuffleDatasetV2OpGenericAdaptor::ShuffleDatasetV2OpGenericAdaptor; + ShuffleDatasetV2OpAdaptor(ShuffleDatasetV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ShuffleDatasetV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ShuffleDatasetV2OpAdaptor; + template + using GenericAdaptor = ShuffleDatasetV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("metadata"), ::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getMetadataAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getMetadataAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ShuffleDatasetV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputDataset(); + ::mlir::TypedValue<::mlir::TensorType> getBufferSize(); + ::mlir::TypedValue<::mlir::TensorType> getSeedGenerator(); + ::mlir::OpOperand &getInputDatasetMutable(); + ::mlir::OpOperand &getBufferSizeMutable(); + ::mlir::OpOperand &getSeedGeneratorMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + void setMetadataAttr(::mlir::StringAttr attr); + void setMetadata(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeMetadataAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, ::mlir::Value buffer_size, ::mlir::Value seed_generator, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, ::mlir::Value buffer_size, ::mlir::Value seed_generator, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, ::mlir::Value buffer_size, ::mlir::Value seed_generator, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::llvm::StringRef metadata = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, ::mlir::Value buffer_size, ::mlir::Value seed_generator, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::llvm::StringRef metadata = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ShuffleDatasetV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ShuffleDatasetV3Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ShuffleDatasetV3OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ShuffleDatasetV3OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ShuffleDatasetV3OpGenericAdaptorBase(ShuffleDatasetV3Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getReshuffleEachIterationAttr(); + bool getReshuffleEachIteration(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); +}; +} // namespace detail +template +class ShuffleDatasetV3OpGenericAdaptor : public detail::ShuffleDatasetV3OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ShuffleDatasetV3OpGenericAdaptorBase; +public: + ShuffleDatasetV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ShuffleDatasetV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ShuffleDatasetV3OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ShuffleDatasetV3OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputDataset() { + return (*getODSOperands(0).begin()); + } + + ValueT getBufferSize() { + return (*getODSOperands(1).begin()); + } + + ValueT getSeed() { + return (*getODSOperands(2).begin()); + } + + ValueT getSeed2() { + return (*getODSOperands(3).begin()); + } + + ValueT getSeedGenerator() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ShuffleDatasetV3OpAdaptor : public ShuffleDatasetV3OpGenericAdaptor<::mlir::ValueRange> { +public: + using ShuffleDatasetV3OpGenericAdaptor::ShuffleDatasetV3OpGenericAdaptor; + ShuffleDatasetV3OpAdaptor(ShuffleDatasetV3Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ShuffleDatasetV3Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<5>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ShuffleDatasetV3OpAdaptor; + template + using GenericAdaptor = ShuffleDatasetV3OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("metadata"), ::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types"), ::llvm::StringRef("reshuffle_each_iteration")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getMetadataAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getMetadataAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getReshuffleEachIterationAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getReshuffleEachIterationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ShuffleDatasetV3"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputDataset(); + ::mlir::TypedValue<::mlir::TensorType> getBufferSize(); + ::mlir::TypedValue<::mlir::TensorType> getSeed(); + ::mlir::TypedValue<::mlir::TensorType> getSeed2(); + ::mlir::TypedValue<::mlir::TensorType> getSeedGenerator(); + ::mlir::OpOperand &getInputDatasetMutable(); + ::mlir::OpOperand &getBufferSizeMutable(); + ::mlir::OpOperand &getSeedMutable(); + ::mlir::OpOperand &getSeed2Mutable(); + ::mlir::OpOperand &getSeedGeneratorMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::BoolAttr getReshuffleEachIterationAttr(); + bool getReshuffleEachIteration(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); + void setReshuffleEachIterationAttr(::mlir::BoolAttr attr); + void setReshuffleEachIteration(::std::optional attrValue); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + void setMetadataAttr(::mlir::StringAttr attr); + void setMetadata(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeReshuffleEachIterationAttr(); + ::mlir::Attribute removeMetadataAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, ::mlir::Value buffer_size, ::mlir::Value seed, ::mlir::Value seed2, ::mlir::Value seed_generator, /*optional*/::mlir::BoolAttr reshuffle_each_iteration, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, ::mlir::Value buffer_size, ::mlir::Value seed, ::mlir::Value seed2, ::mlir::Value seed_generator, /*optional*/::mlir::BoolAttr reshuffle_each_iteration, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, ::mlir::Value buffer_size, ::mlir::Value seed, ::mlir::Value seed2, ::mlir::Value seed_generator, /*optional*/bool reshuffle_each_iteration, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::llvm::StringRef metadata = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, ::mlir::Value buffer_size, ::mlir::Value seed, ::mlir::Value seed2, ::mlir::Value seed_generator, /*optional*/bool reshuffle_each_iteration, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::llvm::StringRef metadata = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ShuffleDatasetV3Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ShutdownDistributedTPUOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ShutdownDistributedTPUOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ShutdownDistributedTPUOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ShutdownDistributedTPUOpGenericAdaptorBase(ShutdownDistributedTPUOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ShutdownDistributedTPUOpGenericAdaptor : public detail::ShutdownDistributedTPUOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ShutdownDistributedTPUOpGenericAdaptorBase; +public: + ShutdownDistributedTPUOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ShutdownDistributedTPUOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ShutdownDistributedTPUOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ShutdownDistributedTPUOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ShutdownDistributedTPUOpAdaptor : public ShutdownDistributedTPUOpGenericAdaptor<::mlir::ValueRange> { +public: + using ShutdownDistributedTPUOpGenericAdaptor::ShutdownDistributedTPUOpGenericAdaptor; + ShutdownDistributedTPUOpAdaptor(ShutdownDistributedTPUOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ShutdownDistributedTPUOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = ShutdownDistributedTPUOpAdaptor; + template + using GenericAdaptor = ShutdownDistributedTPUOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ShutdownDistributedTPU"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ShutdownDistributedTPUOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ShutdownTPUSystemOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ShutdownTPUSystemOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ShutdownTPUSystemOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ShutdownTPUSystemOpGenericAdaptorBase(ShutdownTPUSystemOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ShutdownTPUSystemOpGenericAdaptor : public detail::ShutdownTPUSystemOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ShutdownTPUSystemOpGenericAdaptorBase; +public: + ShutdownTPUSystemOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ShutdownTPUSystemOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ShutdownTPUSystemOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ShutdownTPUSystemOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ShutdownTPUSystemOpAdaptor : public ShutdownTPUSystemOpGenericAdaptor<::mlir::ValueRange> { +public: + using ShutdownTPUSystemOpGenericAdaptor::ShutdownTPUSystemOpGenericAdaptor; + ShutdownTPUSystemOpAdaptor(ShutdownTPUSystemOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ShutdownTPUSystemOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = ShutdownTPUSystemOpAdaptor; + template + using GenericAdaptor = ShutdownTPUSystemOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ShutdownTPUSystem"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSuccess(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type success); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ShutdownTPUSystemOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SigmoidGradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SigmoidGradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SigmoidGradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SigmoidGradOpGenericAdaptorBase(SigmoidGradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SigmoidGradOpGenericAdaptor : public detail::SigmoidGradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SigmoidGradOpGenericAdaptorBase; +public: + SigmoidGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SigmoidGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SigmoidGradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SigmoidGradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getY() { + return (*getODSOperands(0).begin()); + } + + ValueT getDy() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SigmoidGradOpAdaptor : public SigmoidGradOpGenericAdaptor<::mlir::ValueRange> { +public: + using SigmoidGradOpGenericAdaptor::SigmoidGradOpGenericAdaptor; + SigmoidGradOpAdaptor(SigmoidGradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SigmoidGradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SigmoidGradOpAdaptor; + template + using GenericAdaptor = SigmoidGradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SigmoidGrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::TypedValue<::mlir::TensorType> getDy(); + ::mlir::OpOperand &getYMutable(); + ::mlir::OpOperand &getDyMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value y, ::mlir::Value dy); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value y, ::mlir::Value dy); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value y, ::mlir::Value dy); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SigmoidGradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SigmoidOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SigmoidOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SigmoidOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SigmoidOpGenericAdaptorBase(SigmoidOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SigmoidOpGenericAdaptor : public detail::SigmoidOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SigmoidOpGenericAdaptorBase; +public: + SigmoidOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SigmoidOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SigmoidOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SigmoidOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SigmoidOpAdaptor : public SigmoidOpGenericAdaptor<::mlir::ValueRange> { +public: + using SigmoidOpGenericAdaptor::SigmoidOpGenericAdaptor; + SigmoidOpAdaptor(SigmoidOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SigmoidOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SigmoidOpAdaptor; + template + using GenericAdaptor = SigmoidOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Sigmoid"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SigmoidOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SignOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SignOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SignOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SignOpGenericAdaptorBase(SignOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SignOpGenericAdaptor : public detail::SignOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SignOpGenericAdaptorBase; +public: + SignOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SignOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SignOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SignOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SignOpAdaptor : public SignOpGenericAdaptor<::mlir::ValueRange> { +public: + using SignOpGenericAdaptor::SignOpGenericAdaptor; + SignOpAdaptor(SignOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SignOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::IsIdempotent, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SignOpAdaptor; + template + using GenericAdaptor = SignOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Sign"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SignOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SinOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SinOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SinOpGenericAdaptorBase(SinOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SinOpGenericAdaptor : public detail::SinOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SinOpGenericAdaptorBase; +public: + SinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SinOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SinOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SinOpAdaptor : public SinOpGenericAdaptor<::mlir::ValueRange> { +public: + using SinOpGenericAdaptor::SinOpGenericAdaptor; + SinOpAdaptor(SinOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SinOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SinOpAdaptor; + template + using GenericAdaptor = SinOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Sin"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SinOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SinhOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SinhOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SinhOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SinhOpGenericAdaptorBase(SinhOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SinhOpGenericAdaptor : public detail::SinhOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SinhOpGenericAdaptorBase; +public: + SinhOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SinhOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SinhOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SinhOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SinhOpAdaptor : public SinhOpGenericAdaptor<::mlir::ValueRange> { +public: + using SinhOpGenericAdaptor::SinhOpGenericAdaptor; + SinhOpAdaptor(SinhOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SinhOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SinhOpAdaptor; + template + using GenericAdaptor = SinhOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Sinh"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SinhOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SizeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SizeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SizeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SizeOpGenericAdaptorBase(SizeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SizeOpGenericAdaptor : public detail::SizeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SizeOpGenericAdaptorBase; +public: + SizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SizeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SizeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SizeOpAdaptor : public SizeOpGenericAdaptor<::mlir::ValueRange> { +public: + using SizeOpGenericAdaptor::SizeOpGenericAdaptor; + SizeOpAdaptor(SizeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SizeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SizeOpAdaptor; + template + using GenericAdaptor = SizeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("out_type")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutTypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Size"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getOutType(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SizeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SliceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SliceOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SliceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SliceOpGenericAdaptorBase(SliceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SliceOpGenericAdaptor : public detail::SliceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SliceOpGenericAdaptorBase; +public: + SliceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SliceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SliceOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SliceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getBegin() { + return (*getODSOperands(1).begin()); + } + + ValueT getSize() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SliceOpAdaptor : public SliceOpGenericAdaptor<::mlir::ValueRange> { +public: + using SliceOpGenericAdaptor::SliceOpGenericAdaptor; + SliceOpAdaptor(SliceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SliceOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SliceOpAdaptor; + template + using GenericAdaptor = SliceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Index"), ::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getIndexAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getIndexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Slice"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getBegin(); + ::mlir::TypedValue<::mlir::TensorType> getSize(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getBeginMutable(); + ::mlir::OpOperand &getSizeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getIndex(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value begin, ::mlir::Value size); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value begin, ::mlir::Value size); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SliceOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SnapshotOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SnapshotOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SnapshotOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SnapshotOpGenericAdaptorBase(SnapshotOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SnapshotOpGenericAdaptor : public detail::SnapshotOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SnapshotOpGenericAdaptorBase; +public: + SnapshotOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SnapshotOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SnapshotOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SnapshotOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SnapshotOpAdaptor : public SnapshotOpGenericAdaptor<::mlir::ValueRange> { +public: + using SnapshotOpGenericAdaptor::SnapshotOpGenericAdaptor; + SnapshotOpAdaptor(SnapshotOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SnapshotOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SnapshotOpAdaptor; + template + using GenericAdaptor = SnapshotOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Snapshot"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SnapshotOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SoftmaxCrossEntropyWithLogitsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SoftmaxCrossEntropyWithLogitsOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SoftmaxCrossEntropyWithLogitsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SoftmaxCrossEntropyWithLogitsOpGenericAdaptorBase(SoftmaxCrossEntropyWithLogitsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SoftmaxCrossEntropyWithLogitsOpGenericAdaptor : public detail::SoftmaxCrossEntropyWithLogitsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SoftmaxCrossEntropyWithLogitsOpGenericAdaptorBase; +public: + SoftmaxCrossEntropyWithLogitsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SoftmaxCrossEntropyWithLogitsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SoftmaxCrossEntropyWithLogitsOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SoftmaxCrossEntropyWithLogitsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getFeatures() { + return (*getODSOperands(0).begin()); + } + + ValueT getLabels() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SoftmaxCrossEntropyWithLogitsOpAdaptor : public SoftmaxCrossEntropyWithLogitsOpGenericAdaptor<::mlir::ValueRange> { +public: + using SoftmaxCrossEntropyWithLogitsOpGenericAdaptor::SoftmaxCrossEntropyWithLogitsOpGenericAdaptor; + SoftmaxCrossEntropyWithLogitsOpAdaptor(SoftmaxCrossEntropyWithLogitsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SoftmaxCrossEntropyWithLogitsOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SoftmaxCrossEntropyWithLogitsOpAdaptor; + template + using GenericAdaptor = SoftmaxCrossEntropyWithLogitsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SoftmaxCrossEntropyWithLogits"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getFeatures(); + ::mlir::TypedValue<::mlir::TensorType> getLabels(); + ::mlir::OpOperand &getFeaturesMutable(); + ::mlir::OpOperand &getLabelsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLoss(); + ::mlir::TypedValue<::mlir::TensorType> getBackprop(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type loss, ::mlir::Type backprop, ::mlir::Value features, ::mlir::Value labels); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value features, ::mlir::Value labels); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SoftmaxCrossEntropyWithLogitsOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SoftmaxOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SoftmaxOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SoftmaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SoftmaxOpGenericAdaptorBase(SoftmaxOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SoftmaxOpGenericAdaptor : public detail::SoftmaxOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SoftmaxOpGenericAdaptorBase; +public: + SoftmaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SoftmaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SoftmaxOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SoftmaxOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLogits() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SoftmaxOpAdaptor : public SoftmaxOpGenericAdaptor<::mlir::ValueRange> { +public: + using SoftmaxOpGenericAdaptor::SoftmaxOpGenericAdaptor; + SoftmaxOpAdaptor(SoftmaxOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SoftmaxOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SoftmaxOpAdaptor; + template + using GenericAdaptor = SoftmaxOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Softmax"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLogits(); + ::mlir::OpOperand &getLogitsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSoftmax(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type softmax, ::mlir::Value logits); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value logits); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value logits); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SoftmaxOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SoftplusGradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SoftplusGradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SoftplusGradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SoftplusGradOpGenericAdaptorBase(SoftplusGradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SoftplusGradOpGenericAdaptor : public detail::SoftplusGradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SoftplusGradOpGenericAdaptorBase; +public: + SoftplusGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SoftplusGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SoftplusGradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SoftplusGradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getGradients() { + return (*getODSOperands(0).begin()); + } + + ValueT getFeatures() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SoftplusGradOpAdaptor : public SoftplusGradOpGenericAdaptor<::mlir::ValueRange> { +public: + using SoftplusGradOpGenericAdaptor::SoftplusGradOpGenericAdaptor; + SoftplusGradOpAdaptor(SoftplusGradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SoftplusGradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SoftplusGradOpAdaptor; + template + using GenericAdaptor = SoftplusGradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SoftplusGrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getGradients(); + ::mlir::TypedValue<::mlir::TensorType> getFeatures(); + ::mlir::OpOperand &getGradientsMutable(); + ::mlir::OpOperand &getFeaturesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getBackprops(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type backprops, ::mlir::Value gradients, ::mlir::Value features); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value gradients, ::mlir::Value features); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value gradients, ::mlir::Value features); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SoftplusGradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SoftplusOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SoftplusOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SoftplusOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SoftplusOpGenericAdaptorBase(SoftplusOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SoftplusOpGenericAdaptor : public detail::SoftplusOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SoftplusOpGenericAdaptorBase; +public: + SoftplusOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SoftplusOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SoftplusOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SoftplusOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getFeatures() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SoftplusOpAdaptor : public SoftplusOpGenericAdaptor<::mlir::ValueRange> { +public: + using SoftplusOpGenericAdaptor::SoftplusOpGenericAdaptor; + SoftplusOpAdaptor(SoftplusOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SoftplusOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SoftplusOpAdaptor; + template + using GenericAdaptor = SoftplusOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Softplus"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getFeatures(); + ::mlir::OpOperand &getFeaturesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getActivations(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type activations, ::mlir::Value features); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value features); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value features); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SoftplusOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SoftsignGradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SoftsignGradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SoftsignGradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SoftsignGradOpGenericAdaptorBase(SoftsignGradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SoftsignGradOpGenericAdaptor : public detail::SoftsignGradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SoftsignGradOpGenericAdaptorBase; +public: + SoftsignGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SoftsignGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SoftsignGradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SoftsignGradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getGradients() { + return (*getODSOperands(0).begin()); + } + + ValueT getFeatures() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SoftsignGradOpAdaptor : public SoftsignGradOpGenericAdaptor<::mlir::ValueRange> { +public: + using SoftsignGradOpGenericAdaptor::SoftsignGradOpGenericAdaptor; + SoftsignGradOpAdaptor(SoftsignGradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SoftsignGradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SoftsignGradOpAdaptor; + template + using GenericAdaptor = SoftsignGradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SoftsignGrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getGradients(); + ::mlir::TypedValue<::mlir::TensorType> getFeatures(); + ::mlir::OpOperand &getGradientsMutable(); + ::mlir::OpOperand &getFeaturesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getBackprops(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type backprops, ::mlir::Value gradients, ::mlir::Value features); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value gradients, ::mlir::Value features); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value gradients, ::mlir::Value features); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SoftsignGradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SoftsignOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SoftsignOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SoftsignOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SoftsignOpGenericAdaptorBase(SoftsignOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SoftsignOpGenericAdaptor : public detail::SoftsignOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SoftsignOpGenericAdaptorBase; +public: + SoftsignOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SoftsignOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SoftsignOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SoftsignOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getFeatures() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SoftsignOpAdaptor : public SoftsignOpGenericAdaptor<::mlir::ValueRange> { +public: + using SoftsignOpGenericAdaptor::SoftsignOpGenericAdaptor; + SoftsignOpAdaptor(SoftsignOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SoftsignOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SoftsignOpAdaptor; + template + using GenericAdaptor = SoftsignOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Softsign"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getFeatures(); + ::mlir::OpOperand &getFeaturesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getActivations(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type activations, ::mlir::Value features); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value features); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value features); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SoftsignOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SpaceToBatchNDOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SpaceToBatchNDOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SpaceToBatchNDOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SpaceToBatchNDOpGenericAdaptorBase(SpaceToBatchNDOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SpaceToBatchNDOpGenericAdaptor : public detail::SpaceToBatchNDOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SpaceToBatchNDOpGenericAdaptorBase; +public: + SpaceToBatchNDOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SpaceToBatchNDOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SpaceToBatchNDOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SpaceToBatchNDOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getBlockShape() { + return (*getODSOperands(1).begin()); + } + + ValueT getPaddings() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SpaceToBatchNDOpAdaptor : public SpaceToBatchNDOpGenericAdaptor<::mlir::ValueRange> { +public: + using SpaceToBatchNDOpGenericAdaptor::SpaceToBatchNDOpGenericAdaptor; + SpaceToBatchNDOpAdaptor(SpaceToBatchNDOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SpaceToBatchNDOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SpaceToBatchNDOpAdaptor; + template + using GenericAdaptor = SpaceToBatchNDOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tblock_shape"), ::llvm::StringRef("Tpaddings")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTblockShapeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTblockShapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTpaddingsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTpaddingsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SpaceToBatchND"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getBlockShape(); + ::mlir::TypedValue<::mlir::TensorType> getPaddings(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getBlockShapeMutable(); + ::mlir::OpOperand &getPaddingsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTblockShape(); + ::mlir::Type getTpaddings(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value block_shape, ::mlir::Value paddings); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value block_shape, ::mlir::Value paddings); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return ArraysAreCastCompatible(l, r); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SpaceToBatchNDOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SpaceToBatchOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SpaceToBatchOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SpaceToBatchOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SpaceToBatchOpGenericAdaptorBase(SpaceToBatchOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getBlockSizeAttr(); + uint64_t getBlockSize(); +}; +} // namespace detail +template +class SpaceToBatchOpGenericAdaptor : public detail::SpaceToBatchOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SpaceToBatchOpGenericAdaptorBase; +public: + SpaceToBatchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SpaceToBatchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SpaceToBatchOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SpaceToBatchOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getPaddings() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SpaceToBatchOpAdaptor : public SpaceToBatchOpGenericAdaptor<::mlir::ValueRange> { +public: + using SpaceToBatchOpGenericAdaptor::SpaceToBatchOpGenericAdaptor; + SpaceToBatchOpAdaptor(SpaceToBatchOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SpaceToBatchOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SpaceToBatchOpAdaptor; + template + using GenericAdaptor = SpaceToBatchOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tpaddings"), ::llvm::StringRef("block_size")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTpaddingsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTpaddingsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getBlockSizeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getBlockSizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SpaceToBatch"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getPaddings(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getPaddingsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getBlockSizeAttr(); + uint64_t getBlockSize(); + ::mlir::Type getT(); + ::mlir::Type getTpaddings(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setBlockSizeAttr(::mlir::IntegerAttr attr); + void setBlockSize(uint64_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value paddings, ::mlir::IntegerAttr block_size); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value paddings, ::mlir::IntegerAttr block_size); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value paddings, uint64_t block_size); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value paddings, uint64_t block_size); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SpaceToBatchOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SpaceToDepthOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SpaceToDepthOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SpaceToDepthOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SpaceToDepthOpGenericAdaptorBase(SpaceToDepthOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getBlockSizeAttr(); + uint64_t getBlockSize(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); +}; +} // namespace detail +template +class SpaceToDepthOpGenericAdaptor : public detail::SpaceToDepthOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SpaceToDepthOpGenericAdaptorBase; +public: + SpaceToDepthOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SpaceToDepthOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SpaceToDepthOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SpaceToDepthOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SpaceToDepthOpAdaptor : public SpaceToDepthOpGenericAdaptor<::mlir::ValueRange> { +public: + using SpaceToDepthOpGenericAdaptor::SpaceToDepthOpGenericAdaptor; + SpaceToDepthOpAdaptor(SpaceToDepthOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SpaceToDepthOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SpaceToDepthOpAdaptor; + template + using GenericAdaptor = SpaceToDepthOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("block_size"), ::llvm::StringRef("data_format")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getBlockSizeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getBlockSizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SpaceToDepth"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getBlockSizeAttr(); + uint64_t getBlockSize(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setBlockSizeAttr(::mlir::IntegerAttr attr); + void setBlockSize(uint64_t attrValue); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeDataFormatAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::IntegerAttr block_size, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::IntegerAttr block_size, /*optional*/::mlir::StringAttr data_format); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, uint64_t block_size, /*optional*/::llvm::StringRef data_format = "NHWC"); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, uint64_t block_size, /*optional*/::llvm::StringRef data_format = "NHWC"); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SpaceToDepthOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SparseAddOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SparseAddOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SparseAddOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SparseAddOpGenericAdaptorBase(SparseAddOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SparseAddOpGenericAdaptor : public detail::SparseAddOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SparseAddOpGenericAdaptorBase; +public: + SparseAddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SparseAddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SparseAddOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SparseAddOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getAIndices() { + return (*getODSOperands(0).begin()); + } + + ValueT getAValues() { + return (*getODSOperands(1).begin()); + } + + ValueT getAShape() { + return (*getODSOperands(2).begin()); + } + + ValueT getBIndices() { + return (*getODSOperands(3).begin()); + } + + ValueT getBValues() { + return (*getODSOperands(4).begin()); + } + + ValueT getBShape() { + return (*getODSOperands(5).begin()); + } + + ValueT getThresh() { + return (*getODSOperands(6).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SparseAddOpAdaptor : public SparseAddOpGenericAdaptor<::mlir::ValueRange> { +public: + using SparseAddOpGenericAdaptor::SparseAddOpGenericAdaptor; + SparseAddOpAdaptor(SparseAddOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SparseAddOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<7>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SparseAddOpAdaptor; + template + using GenericAdaptor = SparseAddOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Treal")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTrealAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTrealAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SparseAdd"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getAIndices(); + ::mlir::TypedValue<::mlir::TensorType> getAValues(); + ::mlir::TypedValue<::mlir::TensorType> getAShape(); + ::mlir::TypedValue<::mlir::TensorType> getBIndices(); + ::mlir::TypedValue<::mlir::TensorType> getBValues(); + ::mlir::TypedValue<::mlir::TensorType> getBShape(); + ::mlir::TypedValue<::mlir::TensorType> getThresh(); + ::mlir::OpOperand &getAIndicesMutable(); + ::mlir::OpOperand &getAValuesMutable(); + ::mlir::OpOperand &getAShapeMutable(); + ::mlir::OpOperand &getBIndicesMutable(); + ::mlir::OpOperand &getBValuesMutable(); + ::mlir::OpOperand &getBShapeMutable(); + ::mlir::OpOperand &getThreshMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSumIndices(); + ::mlir::TypedValue<::mlir::TensorType> getSumValues(); + ::mlir::TypedValue<::mlir::TensorType> getSumShape(); + ::mlir::Type getT(); + ::mlir::Type getTreal(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type sum_indices, ::mlir::Type sum_values, ::mlir::Type sum_shape, ::mlir::Value a_indices, ::mlir::Value a_values, ::mlir::Value a_shape, ::mlir::Value b_indices, ::mlir::Value b_values, ::mlir::Value b_shape, ::mlir::Value thresh); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a_indices, ::mlir::Value a_values, ::mlir::Value a_shape, ::mlir::Value b_indices, ::mlir::Value b_values, ::mlir::Value b_shape, ::mlir::Value thresh); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SparseAddOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SparseFillEmptyRowsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SparseFillEmptyRowsOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SparseFillEmptyRowsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SparseFillEmptyRowsOpGenericAdaptorBase(SparseFillEmptyRowsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SparseFillEmptyRowsOpGenericAdaptor : public detail::SparseFillEmptyRowsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SparseFillEmptyRowsOpGenericAdaptorBase; +public: + SparseFillEmptyRowsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SparseFillEmptyRowsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SparseFillEmptyRowsOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SparseFillEmptyRowsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIndices() { + return (*getODSOperands(0).begin()); + } + + ValueT getValues() { + return (*getODSOperands(1).begin()); + } + + ValueT getDenseShape() { + return (*getODSOperands(2).begin()); + } + + ValueT getDefaultValue() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SparseFillEmptyRowsOpAdaptor : public SparseFillEmptyRowsOpGenericAdaptor<::mlir::ValueRange> { +public: + using SparseFillEmptyRowsOpGenericAdaptor::SparseFillEmptyRowsOpGenericAdaptor; + SparseFillEmptyRowsOpAdaptor(SparseFillEmptyRowsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SparseFillEmptyRowsOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SparseFillEmptyRowsOpAdaptor; + template + using GenericAdaptor = SparseFillEmptyRowsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SparseFillEmptyRows"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getValues(); + ::mlir::TypedValue<::mlir::TensorType> getDenseShape(); + ::mlir::TypedValue<::mlir::TensorType> getDefaultValue(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getValuesMutable(); + ::mlir::OpOperand &getDenseShapeMutable(); + ::mlir::OpOperand &getDefaultValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutputIndices(); + ::mlir::TypedValue<::mlir::TensorType> getOutputValues(); + ::mlir::TypedValue<::mlir::TensorType> getEmptyRowIndicator(); + ::mlir::TypedValue<::mlir::TensorType> getReverseIndexMap(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output_indices, ::mlir::Type output_values, ::mlir::Type empty_row_indicator, ::mlir::Type reverse_index_map, ::mlir::Value indices, ::mlir::Value values, ::mlir::Value dense_shape, ::mlir::Value default_value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value indices, ::mlir::Value values, ::mlir::Value dense_shape, ::mlir::Value default_value); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SparseFillEmptyRowsOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SparseMatMulOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SparseMatMulOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SparseMatMulOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SparseMatMulOpGenericAdaptorBase(SparseMatMulOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getTransposeAAttr(); + bool getTransposeA(); + ::mlir::BoolAttr getTransposeBAttr(); + bool getTransposeB(); + ::mlir::BoolAttr getAIsSparseAttr(); + bool getAIsSparse(); + ::mlir::BoolAttr getBIsSparseAttr(); + bool getBIsSparse(); +}; +} // namespace detail +template +class SparseMatMulOpGenericAdaptor : public detail::SparseMatMulOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SparseMatMulOpGenericAdaptorBase; +public: + SparseMatMulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SparseMatMulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SparseMatMulOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SparseMatMulOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + ValueT getB() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SparseMatMulOpAdaptor : public SparseMatMulOpGenericAdaptor<::mlir::ValueRange> { +public: + using SparseMatMulOpGenericAdaptor::SparseMatMulOpGenericAdaptor; + SparseMatMulOpAdaptor(SparseMatMulOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SparseMatMulOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SparseMatMulOpAdaptor; + template + using GenericAdaptor = SparseMatMulOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Ta"), ::llvm::StringRef("Tb"), ::llvm::StringRef("a_is_sparse"), ::llvm::StringRef("b_is_sparse"), ::llvm::StringRef("transpose_a"), ::llvm::StringRef("transpose_b")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTaAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTaAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTbAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTbAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getAIsSparseAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getAIsSparseAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getBIsSparseAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getBIsSparseAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTransposeAAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTransposeAAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getTransposeBAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getTransposeBAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SparseMatMul"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getA(); + ::mlir::TypedValue<::mlir::TensorType> getB(); + ::mlir::OpOperand &getAMutable(); + ::mlir::OpOperand &getBMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getProduct(); + ::mlir::BoolAttr getTransposeAAttr(); + bool getTransposeA(); + ::mlir::BoolAttr getTransposeBAttr(); + bool getTransposeB(); + ::mlir::BoolAttr getAIsSparseAttr(); + bool getAIsSparse(); + ::mlir::BoolAttr getBIsSparseAttr(); + bool getBIsSparse(); + ::mlir::Type getTa(); + ::mlir::Type getTb(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setTransposeAAttr(::mlir::BoolAttr attr); + void setTransposeA(::std::optional attrValue); + void setTransposeBAttr(::mlir::BoolAttr attr); + void setTransposeB(::std::optional attrValue); + void setAIsSparseAttr(::mlir::BoolAttr attr); + void setAIsSparse(::std::optional attrValue); + void setBIsSparseAttr(::mlir::BoolAttr attr); + void setBIsSparse(::std::optional attrValue); + ::mlir::Attribute removeTransposeAAttr(); + ::mlir::Attribute removeTransposeBAttr(); + ::mlir::Attribute removeAIsSparseAttr(); + ::mlir::Attribute removeBIsSparseAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type product, ::mlir::Value a, ::mlir::Value b, /*optional*/::mlir::BoolAttr transpose_a, /*optional*/::mlir::BoolAttr transpose_b, /*optional*/::mlir::BoolAttr a_is_sparse, /*optional*/::mlir::BoolAttr b_is_sparse); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, /*optional*/::mlir::BoolAttr transpose_a, /*optional*/::mlir::BoolAttr transpose_b, /*optional*/::mlir::BoolAttr a_is_sparse, /*optional*/::mlir::BoolAttr b_is_sparse); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type product, ::mlir::Value a, ::mlir::Value b, /*optional*/bool transpose_a = false, /*optional*/bool transpose_b = false, /*optional*/bool a_is_sparse = false, /*optional*/bool b_is_sparse = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, /*optional*/bool transpose_a = false, /*optional*/bool transpose_b = false, /*optional*/bool a_is_sparse = false, /*optional*/bool b_is_sparse = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SparseMatMulOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SparseReduceSumOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SparseReduceSumOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SparseReduceSumOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SparseReduceSumOpGenericAdaptorBase(SparseReduceSumOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getKeepDimsAttr(); + bool getKeepDims(); +}; +} // namespace detail +template +class SparseReduceSumOpGenericAdaptor : public detail::SparseReduceSumOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SparseReduceSumOpGenericAdaptorBase; +public: + SparseReduceSumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SparseReduceSumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SparseReduceSumOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SparseReduceSumOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputIndices() { + return (*getODSOperands(0).begin()); + } + + ValueT getInputValues() { + return (*getODSOperands(1).begin()); + } + + ValueT getInputShape() { + return (*getODSOperands(2).begin()); + } + + ValueT getReductionAxes() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SparseReduceSumOpAdaptor : public SparseReduceSumOpGenericAdaptor<::mlir::ValueRange> { +public: + using SparseReduceSumOpGenericAdaptor::SparseReduceSumOpGenericAdaptor; + SparseReduceSumOpAdaptor(SparseReduceSumOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SparseReduceSumOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SparseReduceSumOpAdaptor; + template + using GenericAdaptor = SparseReduceSumOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("keep_dims")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getKeepDimsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getKeepDimsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SparseReduceSum"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputIndices(); + ::mlir::TypedValue<::mlir::TensorType> getInputValues(); + ::mlir::TypedValue<::mlir::TensorType> getInputShape(); + ::mlir::TypedValue<::mlir::TensorType> getReductionAxes(); + ::mlir::OpOperand &getInputIndicesMutable(); + ::mlir::OpOperand &getInputValuesMutable(); + ::mlir::OpOperand &getInputShapeMutable(); + ::mlir::OpOperand &getReductionAxesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getKeepDimsAttr(); + bool getKeepDims(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setKeepDimsAttr(::mlir::BoolAttr attr); + void setKeepDims(::std::optional attrValue); + ::mlir::Attribute removeKeepDimsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input_indices, ::mlir::Value input_values, ::mlir::Value input_shape, ::mlir::Value reduction_axes, /*optional*/::mlir::BoolAttr keep_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_indices, ::mlir::Value input_values, ::mlir::Value input_shape, ::mlir::Value reduction_axes, /*optional*/::mlir::BoolAttr keep_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input_indices, ::mlir::Value input_values, ::mlir::Value input_shape, ::mlir::Value reduction_axes, /*optional*/bool keep_dims = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_indices, ::mlir::Value input_values, ::mlir::Value input_shape, ::mlir::Value reduction_axes, /*optional*/bool keep_dims = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SparseReduceSumOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SparseReshapeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SparseReshapeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SparseReshapeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SparseReshapeOpGenericAdaptorBase(SparseReshapeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SparseReshapeOpGenericAdaptor : public detail::SparseReshapeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SparseReshapeOpGenericAdaptorBase; +public: + SparseReshapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SparseReshapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SparseReshapeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SparseReshapeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputIndices() { + return (*getODSOperands(0).begin()); + } + + ValueT getInputShape() { + return (*getODSOperands(1).begin()); + } + + ValueT getNewShape() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SparseReshapeOpAdaptor : public SparseReshapeOpGenericAdaptor<::mlir::ValueRange> { +public: + using SparseReshapeOpGenericAdaptor::SparseReshapeOpGenericAdaptor; + SparseReshapeOpAdaptor(SparseReshapeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SparseReshapeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SparseReshapeOpAdaptor; + template + using GenericAdaptor = SparseReshapeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SparseReshape"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputIndices(); + ::mlir::TypedValue<::mlir::TensorType> getInputShape(); + ::mlir::TypedValue<::mlir::TensorType> getNewShape(); + ::mlir::OpOperand &getInputIndicesMutable(); + ::mlir::OpOperand &getInputShapeMutable(); + ::mlir::OpOperand &getNewShapeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutputIndices(); + ::mlir::TypedValue<::mlir::TensorType> getOutputShape(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output_indices, ::mlir::Type output_shape, ::mlir::Value input_indices, ::mlir::Value input_shape, ::mlir::Value new_shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_indices, ::mlir::Value input_shape, ::mlir::Value new_shape); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SparseReshapeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SparseSegmentMeanGradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SparseSegmentMeanGradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SparseSegmentMeanGradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SparseSegmentMeanGradOpGenericAdaptorBase(SparseSegmentMeanGradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SparseSegmentMeanGradOpGenericAdaptor : public detail::SparseSegmentMeanGradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SparseSegmentMeanGradOpGenericAdaptorBase; +public: + SparseSegmentMeanGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SparseSegmentMeanGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SparseSegmentMeanGradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SparseSegmentMeanGradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getGrad() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getSegmentIds() { + return (*getODSOperands(2).begin()); + } + + ValueT getOutputDim0() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SparseSegmentMeanGradOpAdaptor : public SparseSegmentMeanGradOpGenericAdaptor<::mlir::ValueRange> { +public: + using SparseSegmentMeanGradOpGenericAdaptor::SparseSegmentMeanGradOpGenericAdaptor; + SparseSegmentMeanGradOpAdaptor(SparseSegmentMeanGradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SparseSegmentMeanGradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SparseSegmentMeanGradOpAdaptor; + template + using GenericAdaptor = SparseSegmentMeanGradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tidx"), ::llvm::StringRef("Tsegmentids")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTidxAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTidxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTsegmentidsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTsegmentidsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SparseSegmentMeanGrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getGrad(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getSegmentIds(); + ::mlir::TypedValue<::mlir::TensorType> getOutputDim0(); + ::mlir::OpOperand &getGradMutable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getSegmentIdsMutable(); + ::mlir::OpOperand &getOutputDim0Mutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTidx(); + ::mlir::Type getTsegmentids(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value grad, ::mlir::Value indices, ::mlir::Value segment_ids, ::mlir::Value output_dim0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value grad, ::mlir::Value indices, ::mlir::Value segment_ids, ::mlir::Value output_dim0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SparseSegmentMeanGradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SparseSegmentMeanOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SparseSegmentMeanOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SparseSegmentMeanOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SparseSegmentMeanOpGenericAdaptorBase(SparseSegmentMeanOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getSparseGradientAttr(); + bool getSparseGradient(); +}; +} // namespace detail +template +class SparseSegmentMeanOpGenericAdaptor : public detail::SparseSegmentMeanOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SparseSegmentMeanOpGenericAdaptorBase; +public: + SparseSegmentMeanOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SparseSegmentMeanOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SparseSegmentMeanOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SparseSegmentMeanOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getData() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getSegmentIds() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SparseSegmentMeanOpAdaptor : public SparseSegmentMeanOpGenericAdaptor<::mlir::ValueRange> { +public: + using SparseSegmentMeanOpGenericAdaptor::SparseSegmentMeanOpGenericAdaptor; + SparseSegmentMeanOpAdaptor(SparseSegmentMeanOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SparseSegmentMeanOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SparseSegmentMeanOpAdaptor; + template + using GenericAdaptor = SparseSegmentMeanOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tidx"), ::llvm::StringRef("Tsegmentids"), ::llvm::StringRef("sparse_gradient")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTidxAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTidxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTsegmentidsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTsegmentidsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSparseGradientAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSparseGradientAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SparseSegmentMean"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getData(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getSegmentIds(); + ::mlir::OpOperand &getDataMutable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getSegmentIdsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getSparseGradientAttr(); + bool getSparseGradient(); + ::mlir::Type getT(); + ::mlir::Type getTidx(); + ::mlir::Type getTsegmentids(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setSparseGradientAttr(::mlir::BoolAttr attr); + void setSparseGradient(::std::optional attrValue); + ::mlir::Attribute removeSparseGradientAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value data, ::mlir::Value indices, ::mlir::Value segment_ids, /*optional*/::mlir::BoolAttr sparse_gradient); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value data, ::mlir::Value indices, ::mlir::Value segment_ids, /*optional*/::mlir::BoolAttr sparse_gradient); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value data, ::mlir::Value indices, ::mlir::Value segment_ids, /*optional*/bool sparse_gradient = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value data, ::mlir::Value indices, ::mlir::Value segment_ids, /*optional*/bool sparse_gradient = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SparseSegmentMeanOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SparseSegmentMeanWithNumSegmentsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SparseSegmentMeanWithNumSegmentsOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SparseSegmentMeanWithNumSegmentsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SparseSegmentMeanWithNumSegmentsOpGenericAdaptorBase(SparseSegmentMeanWithNumSegmentsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getSparseGradientAttr(); + bool getSparseGradient(); +}; +} // namespace detail +template +class SparseSegmentMeanWithNumSegmentsOpGenericAdaptor : public detail::SparseSegmentMeanWithNumSegmentsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SparseSegmentMeanWithNumSegmentsOpGenericAdaptorBase; +public: + SparseSegmentMeanWithNumSegmentsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SparseSegmentMeanWithNumSegmentsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SparseSegmentMeanWithNumSegmentsOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SparseSegmentMeanWithNumSegmentsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getData() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getSegmentIds() { + return (*getODSOperands(2).begin()); + } + + ValueT getNumSegments() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SparseSegmentMeanWithNumSegmentsOpAdaptor : public SparseSegmentMeanWithNumSegmentsOpGenericAdaptor<::mlir::ValueRange> { +public: + using SparseSegmentMeanWithNumSegmentsOpGenericAdaptor::SparseSegmentMeanWithNumSegmentsOpGenericAdaptor; + SparseSegmentMeanWithNumSegmentsOpAdaptor(SparseSegmentMeanWithNumSegmentsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SparseSegmentMeanWithNumSegmentsOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SparseSegmentMeanWithNumSegmentsOpAdaptor; + template + using GenericAdaptor = SparseSegmentMeanWithNumSegmentsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tidx"), ::llvm::StringRef("Tnumsegments"), ::llvm::StringRef("Tsegmentids"), ::llvm::StringRef("sparse_gradient")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTidxAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTidxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTnumsegmentsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTnumsegmentsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTsegmentidsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTsegmentidsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getSparseGradientAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getSparseGradientAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SparseSegmentMeanWithNumSegments"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getData(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getSegmentIds(); + ::mlir::TypedValue<::mlir::TensorType> getNumSegments(); + ::mlir::OpOperand &getDataMutable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getSegmentIdsMutable(); + ::mlir::OpOperand &getNumSegmentsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getSparseGradientAttr(); + bool getSparseGradient(); + ::mlir::Type getT(); + ::mlir::Type getTidx(); + ::mlir::Type getTnumsegments(); + ::mlir::Type getTsegmentids(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setSparseGradientAttr(::mlir::BoolAttr attr); + void setSparseGradient(::std::optional attrValue); + ::mlir::Attribute removeSparseGradientAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value data, ::mlir::Value indices, ::mlir::Value segment_ids, ::mlir::Value num_segments, /*optional*/::mlir::BoolAttr sparse_gradient); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value data, ::mlir::Value indices, ::mlir::Value segment_ids, ::mlir::Value num_segments, /*optional*/::mlir::BoolAttr sparse_gradient); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value data, ::mlir::Value indices, ::mlir::Value segment_ids, ::mlir::Value num_segments, /*optional*/bool sparse_gradient = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value data, ::mlir::Value indices, ::mlir::Value segment_ids, ::mlir::Value num_segments, /*optional*/bool sparse_gradient = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SparseSegmentMeanWithNumSegmentsOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SparseSegmentSqrtNGradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SparseSegmentSqrtNGradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SparseSegmentSqrtNGradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SparseSegmentSqrtNGradOpGenericAdaptorBase(SparseSegmentSqrtNGradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SparseSegmentSqrtNGradOpGenericAdaptor : public detail::SparseSegmentSqrtNGradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SparseSegmentSqrtNGradOpGenericAdaptorBase; +public: + SparseSegmentSqrtNGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SparseSegmentSqrtNGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SparseSegmentSqrtNGradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SparseSegmentSqrtNGradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getGrad() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getSegmentIds() { + return (*getODSOperands(2).begin()); + } + + ValueT getOutputDim0() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SparseSegmentSqrtNGradOpAdaptor : public SparseSegmentSqrtNGradOpGenericAdaptor<::mlir::ValueRange> { +public: + using SparseSegmentSqrtNGradOpGenericAdaptor::SparseSegmentSqrtNGradOpGenericAdaptor; + SparseSegmentSqrtNGradOpAdaptor(SparseSegmentSqrtNGradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SparseSegmentSqrtNGradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SparseSegmentSqrtNGradOpAdaptor; + template + using GenericAdaptor = SparseSegmentSqrtNGradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tidx"), ::llvm::StringRef("Tsegmentids")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTidxAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTidxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTsegmentidsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTsegmentidsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SparseSegmentSqrtNGrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getGrad(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getSegmentIds(); + ::mlir::TypedValue<::mlir::TensorType> getOutputDim0(); + ::mlir::OpOperand &getGradMutable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getSegmentIdsMutable(); + ::mlir::OpOperand &getOutputDim0Mutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTidx(); + ::mlir::Type getTsegmentids(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value grad, ::mlir::Value indices, ::mlir::Value segment_ids, ::mlir::Value output_dim0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value grad, ::mlir::Value indices, ::mlir::Value segment_ids, ::mlir::Value output_dim0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SparseSegmentSqrtNGradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SparseSegmentSqrtNOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SparseSegmentSqrtNOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SparseSegmentSqrtNOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SparseSegmentSqrtNOpGenericAdaptorBase(SparseSegmentSqrtNOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getSparseGradientAttr(); + bool getSparseGradient(); +}; +} // namespace detail +template +class SparseSegmentSqrtNOpGenericAdaptor : public detail::SparseSegmentSqrtNOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SparseSegmentSqrtNOpGenericAdaptorBase; +public: + SparseSegmentSqrtNOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SparseSegmentSqrtNOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SparseSegmentSqrtNOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SparseSegmentSqrtNOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getData() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getSegmentIds() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SparseSegmentSqrtNOpAdaptor : public SparseSegmentSqrtNOpGenericAdaptor<::mlir::ValueRange> { +public: + using SparseSegmentSqrtNOpGenericAdaptor::SparseSegmentSqrtNOpGenericAdaptor; + SparseSegmentSqrtNOpAdaptor(SparseSegmentSqrtNOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SparseSegmentSqrtNOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SparseSegmentSqrtNOpAdaptor; + template + using GenericAdaptor = SparseSegmentSqrtNOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tidx"), ::llvm::StringRef("Tsegmentids"), ::llvm::StringRef("sparse_gradient")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTidxAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTidxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTsegmentidsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTsegmentidsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSparseGradientAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSparseGradientAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SparseSegmentSqrtN"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getData(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getSegmentIds(); + ::mlir::OpOperand &getDataMutable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getSegmentIdsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getSparseGradientAttr(); + bool getSparseGradient(); + ::mlir::Type getT(); + ::mlir::Type getTidx(); + ::mlir::Type getTsegmentids(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setSparseGradientAttr(::mlir::BoolAttr attr); + void setSparseGradient(::std::optional attrValue); + ::mlir::Attribute removeSparseGradientAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value data, ::mlir::Value indices, ::mlir::Value segment_ids, /*optional*/::mlir::BoolAttr sparse_gradient); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value data, ::mlir::Value indices, ::mlir::Value segment_ids, /*optional*/::mlir::BoolAttr sparse_gradient); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value data, ::mlir::Value indices, ::mlir::Value segment_ids, /*optional*/bool sparse_gradient = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value data, ::mlir::Value indices, ::mlir::Value segment_ids, /*optional*/bool sparse_gradient = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SparseSegmentSqrtNOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SparseSegmentSqrtNWithNumSegmentsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SparseSegmentSqrtNWithNumSegmentsOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SparseSegmentSqrtNWithNumSegmentsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SparseSegmentSqrtNWithNumSegmentsOpGenericAdaptorBase(SparseSegmentSqrtNWithNumSegmentsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getSparseGradientAttr(); + bool getSparseGradient(); +}; +} // namespace detail +template +class SparseSegmentSqrtNWithNumSegmentsOpGenericAdaptor : public detail::SparseSegmentSqrtNWithNumSegmentsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SparseSegmentSqrtNWithNumSegmentsOpGenericAdaptorBase; +public: + SparseSegmentSqrtNWithNumSegmentsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SparseSegmentSqrtNWithNumSegmentsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SparseSegmentSqrtNWithNumSegmentsOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SparseSegmentSqrtNWithNumSegmentsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getData() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getSegmentIds() { + return (*getODSOperands(2).begin()); + } + + ValueT getNumSegments() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SparseSegmentSqrtNWithNumSegmentsOpAdaptor : public SparseSegmentSqrtNWithNumSegmentsOpGenericAdaptor<::mlir::ValueRange> { +public: + using SparseSegmentSqrtNWithNumSegmentsOpGenericAdaptor::SparseSegmentSqrtNWithNumSegmentsOpGenericAdaptor; + SparseSegmentSqrtNWithNumSegmentsOpAdaptor(SparseSegmentSqrtNWithNumSegmentsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SparseSegmentSqrtNWithNumSegmentsOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SparseSegmentSqrtNWithNumSegmentsOpAdaptor; + template + using GenericAdaptor = SparseSegmentSqrtNWithNumSegmentsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tidx"), ::llvm::StringRef("Tnumsegments"), ::llvm::StringRef("Tsegmentids"), ::llvm::StringRef("sparse_gradient")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTidxAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTidxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTnumsegmentsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTnumsegmentsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTsegmentidsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTsegmentidsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getSparseGradientAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getSparseGradientAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SparseSegmentSqrtNWithNumSegments"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getData(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getSegmentIds(); + ::mlir::TypedValue<::mlir::TensorType> getNumSegments(); + ::mlir::OpOperand &getDataMutable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getSegmentIdsMutable(); + ::mlir::OpOperand &getNumSegmentsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getSparseGradientAttr(); + bool getSparseGradient(); + ::mlir::Type getT(); + ::mlir::Type getTidx(); + ::mlir::Type getTnumsegments(); + ::mlir::Type getTsegmentids(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setSparseGradientAttr(::mlir::BoolAttr attr); + void setSparseGradient(::std::optional attrValue); + ::mlir::Attribute removeSparseGradientAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value data, ::mlir::Value indices, ::mlir::Value segment_ids, ::mlir::Value num_segments, /*optional*/::mlir::BoolAttr sparse_gradient); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value data, ::mlir::Value indices, ::mlir::Value segment_ids, ::mlir::Value num_segments, /*optional*/::mlir::BoolAttr sparse_gradient); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value data, ::mlir::Value indices, ::mlir::Value segment_ids, ::mlir::Value num_segments, /*optional*/bool sparse_gradient = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value data, ::mlir::Value indices, ::mlir::Value segment_ids, ::mlir::Value num_segments, /*optional*/bool sparse_gradient = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SparseSegmentSqrtNWithNumSegmentsOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SparseSegmentSumOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SparseSegmentSumOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SparseSegmentSumOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SparseSegmentSumOpGenericAdaptorBase(SparseSegmentSumOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getSparseGradientAttr(); + bool getSparseGradient(); +}; +} // namespace detail +template +class SparseSegmentSumOpGenericAdaptor : public detail::SparseSegmentSumOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SparseSegmentSumOpGenericAdaptorBase; +public: + SparseSegmentSumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SparseSegmentSumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SparseSegmentSumOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SparseSegmentSumOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getData() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getSegmentIds() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SparseSegmentSumOpAdaptor : public SparseSegmentSumOpGenericAdaptor<::mlir::ValueRange> { +public: + using SparseSegmentSumOpGenericAdaptor::SparseSegmentSumOpGenericAdaptor; + SparseSegmentSumOpAdaptor(SparseSegmentSumOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SparseSegmentSumOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SparseSegmentSumOpAdaptor; + template + using GenericAdaptor = SparseSegmentSumOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tidx"), ::llvm::StringRef("Tsegmentids"), ::llvm::StringRef("sparse_gradient")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTidxAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTidxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTsegmentidsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTsegmentidsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSparseGradientAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSparseGradientAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SparseSegmentSum"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getData(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getSegmentIds(); + ::mlir::OpOperand &getDataMutable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getSegmentIdsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getSparseGradientAttr(); + bool getSparseGradient(); + ::mlir::Type getT(); + ::mlir::Type getTidx(); + ::mlir::Type getTsegmentids(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setSparseGradientAttr(::mlir::BoolAttr attr); + void setSparseGradient(::std::optional attrValue); + ::mlir::Attribute removeSparseGradientAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value data, ::mlir::Value indices, ::mlir::Value segment_ids, /*optional*/::mlir::BoolAttr sparse_gradient); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value data, ::mlir::Value indices, ::mlir::Value segment_ids, /*optional*/::mlir::BoolAttr sparse_gradient); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value data, ::mlir::Value indices, ::mlir::Value segment_ids, /*optional*/bool sparse_gradient = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value data, ::mlir::Value indices, ::mlir::Value segment_ids, /*optional*/bool sparse_gradient = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SparseSegmentSumOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SparseSoftmaxCrossEntropyWithLogitsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SparseSoftmaxCrossEntropyWithLogitsOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SparseSoftmaxCrossEntropyWithLogitsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SparseSoftmaxCrossEntropyWithLogitsOpGenericAdaptorBase(SparseSoftmaxCrossEntropyWithLogitsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SparseSoftmaxCrossEntropyWithLogitsOpGenericAdaptor : public detail::SparseSoftmaxCrossEntropyWithLogitsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SparseSoftmaxCrossEntropyWithLogitsOpGenericAdaptorBase; +public: + SparseSoftmaxCrossEntropyWithLogitsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SparseSoftmaxCrossEntropyWithLogitsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SparseSoftmaxCrossEntropyWithLogitsOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SparseSoftmaxCrossEntropyWithLogitsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getFeatures() { + return (*getODSOperands(0).begin()); + } + + ValueT getLabels() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SparseSoftmaxCrossEntropyWithLogitsOpAdaptor : public SparseSoftmaxCrossEntropyWithLogitsOpGenericAdaptor<::mlir::ValueRange> { +public: + using SparseSoftmaxCrossEntropyWithLogitsOpGenericAdaptor::SparseSoftmaxCrossEntropyWithLogitsOpGenericAdaptor; + SparseSoftmaxCrossEntropyWithLogitsOpAdaptor(SparseSoftmaxCrossEntropyWithLogitsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SparseSoftmaxCrossEntropyWithLogitsOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SparseSoftmaxCrossEntropyWithLogitsOpAdaptor; + template + using GenericAdaptor = SparseSoftmaxCrossEntropyWithLogitsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tlabels")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTlabelsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTlabelsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SparseSoftmaxCrossEntropyWithLogits"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getFeatures(); + ::mlir::TypedValue<::mlir::TensorType> getLabels(); + ::mlir::OpOperand &getFeaturesMutable(); + ::mlir::OpOperand &getLabelsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLoss(); + ::mlir::TypedValue<::mlir::TensorType> getBackprop(); + ::mlir::Type getT(); + ::mlir::Type getTlabels(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type loss, ::mlir::Type backprop, ::mlir::Value features, ::mlir::Value labels); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value features, ::mlir::Value labels); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SparseSoftmaxCrossEntropyWithLogitsOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SparseTensorDenseMatMulOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SparseTensorDenseMatMulOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SparseTensorDenseMatMulOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SparseTensorDenseMatMulOpGenericAdaptorBase(SparseTensorDenseMatMulOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getAdjointAAttr(); + bool getAdjointA(); + ::mlir::BoolAttr getAdjointBAttr(); + bool getAdjointB(); +}; +} // namespace detail +template +class SparseTensorDenseMatMulOpGenericAdaptor : public detail::SparseTensorDenseMatMulOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SparseTensorDenseMatMulOpGenericAdaptorBase; +public: + SparseTensorDenseMatMulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SparseTensorDenseMatMulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SparseTensorDenseMatMulOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SparseTensorDenseMatMulOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getAIndices() { + return (*getODSOperands(0).begin()); + } + + ValueT getAValues() { + return (*getODSOperands(1).begin()); + } + + ValueT getAShape() { + return (*getODSOperands(2).begin()); + } + + ValueT getB() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SparseTensorDenseMatMulOpAdaptor : public SparseTensorDenseMatMulOpGenericAdaptor<::mlir::ValueRange> { +public: + using SparseTensorDenseMatMulOpGenericAdaptor::SparseTensorDenseMatMulOpGenericAdaptor; + SparseTensorDenseMatMulOpAdaptor(SparseTensorDenseMatMulOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SparseTensorDenseMatMulOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SparseTensorDenseMatMulOpAdaptor; + template + using GenericAdaptor = SparseTensorDenseMatMulOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices"), ::llvm::StringRef("adjoint_a"), ::llvm::StringRef("adjoint_b")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getAdjointAAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getAdjointAAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getAdjointBAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getAdjointBAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SparseTensorDenseMatMul"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getAIndices(); + ::mlir::TypedValue<::mlir::TensorType> getAValues(); + ::mlir::TypedValue<::mlir::TensorType> getAShape(); + ::mlir::TypedValue<::mlir::TensorType> getB(); + ::mlir::OpOperand &getAIndicesMutable(); + ::mlir::OpOperand &getAValuesMutable(); + ::mlir::OpOperand &getAShapeMutable(); + ::mlir::OpOperand &getBMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getProduct(); + ::mlir::BoolAttr getAdjointAAttr(); + bool getAdjointA(); + ::mlir::BoolAttr getAdjointBAttr(); + bool getAdjointB(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setAdjointAAttr(::mlir::BoolAttr attr); + void setAdjointA(::std::optional attrValue); + void setAdjointBAttr(::mlir::BoolAttr attr); + void setAdjointB(::std::optional attrValue); + ::mlir::Attribute removeAdjointAAttr(); + ::mlir::Attribute removeAdjointBAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type product, ::mlir::Value a_indices, ::mlir::Value a_values, ::mlir::Value a_shape, ::mlir::Value b, /*optional*/::mlir::BoolAttr adjoint_a, /*optional*/::mlir::BoolAttr adjoint_b); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a_indices, ::mlir::Value a_values, ::mlir::Value a_shape, ::mlir::Value b, /*optional*/::mlir::BoolAttr adjoint_a, /*optional*/::mlir::BoolAttr adjoint_b); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type product, ::mlir::Value a_indices, ::mlir::Value a_values, ::mlir::Value a_shape, ::mlir::Value b, /*optional*/bool adjoint_a = false, /*optional*/bool adjoint_b = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a_indices, ::mlir::Value a_values, ::mlir::Value a_shape, ::mlir::Value b, /*optional*/bool adjoint_a = false, /*optional*/bool adjoint_b = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SparseTensorDenseMatMulOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SparseToDenseOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SparseToDenseOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SparseToDenseOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SparseToDenseOpGenericAdaptorBase(SparseToDenseOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getValidateIndicesAttr(); + bool getValidateIndices(); +}; +} // namespace detail +template +class SparseToDenseOpGenericAdaptor : public detail::SparseToDenseOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SparseToDenseOpGenericAdaptorBase; +public: + SparseToDenseOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SparseToDenseOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SparseToDenseOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SparseToDenseOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSparseIndices() { + return (*getODSOperands(0).begin()); + } + + ValueT getOutputShape() { + return (*getODSOperands(1).begin()); + } + + ValueT getSparseValues() { + return (*getODSOperands(2).begin()); + } + + ValueT getDefaultValue() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SparseToDenseOpAdaptor : public SparseToDenseOpGenericAdaptor<::mlir::ValueRange> { +public: + using SparseToDenseOpGenericAdaptor::SparseToDenseOpGenericAdaptor; + SparseToDenseOpAdaptor(SparseToDenseOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SparseToDenseOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SparseToDenseOpAdaptor; + template + using GenericAdaptor = SparseToDenseOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices"), ::llvm::StringRef("validate_indices")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getValidateIndicesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getValidateIndicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SparseToDense"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSparseIndices(); + ::mlir::TypedValue<::mlir::TensorType> getOutputShape(); + ::mlir::TypedValue<::mlir::TensorType> getSparseValues(); + ::mlir::TypedValue<::mlir::TensorType> getDefaultValue(); + ::mlir::OpOperand &getSparseIndicesMutable(); + ::mlir::OpOperand &getOutputShapeMutable(); + ::mlir::OpOperand &getSparseValuesMutable(); + ::mlir::OpOperand &getDefaultValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getDense(); + ::mlir::BoolAttr getValidateIndicesAttr(); + bool getValidateIndices(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setValidateIndicesAttr(::mlir::BoolAttr attr); + void setValidateIndices(::std::optional attrValue); + ::mlir::Attribute removeValidateIndicesAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type dense, ::mlir::Value sparse_indices, ::mlir::Value output_shape, ::mlir::Value sparse_values, ::mlir::Value default_value, /*optional*/::mlir::BoolAttr validate_indices); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value sparse_indices, ::mlir::Value output_shape, ::mlir::Value sparse_values, ::mlir::Value default_value, /*optional*/::mlir::BoolAttr validate_indices); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type dense, ::mlir::Value sparse_indices, ::mlir::Value output_shape, ::mlir::Value sparse_values, ::mlir::Value default_value, /*optional*/bool validate_indices = true); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value sparse_indices, ::mlir::Value output_shape, ::mlir::Value sparse_values, ::mlir::Value default_value, /*optional*/bool validate_indices = true); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SparseToDenseOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SplitOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SplitOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SplitOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SplitOpGenericAdaptorBase(SplitOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SplitOpGenericAdaptor : public detail::SplitOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SplitOpGenericAdaptorBase; +public: + SplitOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SplitOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SplitOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SplitOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSplitDim() { + return (*getODSOperands(0).begin()); + } + + ValueT getValue() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SplitOpAdaptor : public SplitOpGenericAdaptor<::mlir::ValueRange> { +public: + using SplitOpGenericAdaptor::SplitOpGenericAdaptor; + SplitOpAdaptor(SplitOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SplitOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SplitOpAdaptor; + template + using GenericAdaptor = SplitOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("num_split")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumSplitAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumSplitAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Split"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSplitDim(); + ::mlir::TypedValue<::mlir::TensorType> getValue(); + ::mlir::OpOperand &getSplitDimMutable(); + ::mlir::OpOperand &getValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutput(); + ::mlir::Type getT(); + size_t getNumSplit(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::Value split_dim, ::mlir::Value value); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SplitOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SplitVOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SplitVOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SplitVOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SplitVOpGenericAdaptorBase(SplitVOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SplitVOpGenericAdaptor : public detail::SplitVOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SplitVOpGenericAdaptorBase; +public: + SplitVOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SplitVOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SplitVOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SplitVOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getValue() { + return (*getODSOperands(0).begin()); + } + + ValueT getSizeSplits() { + return (*getODSOperands(1).begin()); + } + + ValueT getSplitDim() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SplitVOpAdaptor : public SplitVOpGenericAdaptor<::mlir::ValueRange> { +public: + using SplitVOpGenericAdaptor::SplitVOpGenericAdaptor; + SplitVOpAdaptor(SplitVOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SplitVOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SplitVOpAdaptor; + template + using GenericAdaptor = SplitVOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tlen"), ::llvm::StringRef("num_split")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTlenAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTlenAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getNumSplitAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getNumSplitAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SplitV"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getValue(); + ::mlir::TypedValue<::mlir::TensorType> getSizeSplits(); + ::mlir::TypedValue<::mlir::TensorType> getSplitDim(); + ::mlir::OpOperand &getValueMutable(); + ::mlir::OpOperand &getSizeSplitsMutable(); + ::mlir::OpOperand &getSplitDimMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTlen(); + size_t getNumSplit(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::Value value, ::mlir::Value size_splits, ::mlir::Value split_dim); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SplitVOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SqrtGradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SqrtGradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SqrtGradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SqrtGradOpGenericAdaptorBase(SqrtGradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SqrtGradOpGenericAdaptor : public detail::SqrtGradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SqrtGradOpGenericAdaptorBase; +public: + SqrtGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SqrtGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SqrtGradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SqrtGradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getY() { + return (*getODSOperands(0).begin()); + } + + ValueT getDy() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SqrtGradOpAdaptor : public SqrtGradOpGenericAdaptor<::mlir::ValueRange> { +public: + using SqrtGradOpGenericAdaptor::SqrtGradOpGenericAdaptor; + SqrtGradOpAdaptor(SqrtGradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SqrtGradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SqrtGradOpAdaptor; + template + using GenericAdaptor = SqrtGradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SqrtGrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::TypedValue<::mlir::TensorType> getDy(); + ::mlir::OpOperand &getYMutable(); + ::mlir::OpOperand &getDyMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value y, ::mlir::Value dy); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value y, ::mlir::Value dy); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value y, ::mlir::Value dy); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SqrtGradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SqrtOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SqrtOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SqrtOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SqrtOpGenericAdaptorBase(SqrtOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SqrtOpGenericAdaptor : public detail::SqrtOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SqrtOpGenericAdaptorBase; +public: + SqrtOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SqrtOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SqrtOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SqrtOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SqrtOpAdaptor : public SqrtOpGenericAdaptor<::mlir::ValueRange> { +public: + using SqrtOpGenericAdaptor::SqrtOpGenericAdaptor; + SqrtOpAdaptor(SqrtOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SqrtOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SqrtOpAdaptor; + template + using GenericAdaptor = SqrtOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Sqrt"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SqrtOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SquareOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SquareOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SquareOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SquareOpGenericAdaptorBase(SquareOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SquareOpGenericAdaptor : public detail::SquareOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SquareOpGenericAdaptorBase; +public: + SquareOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SquareOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SquareOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SquareOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SquareOpAdaptor : public SquareOpGenericAdaptor<::mlir::ValueRange> { +public: + using SquareOpGenericAdaptor::SquareOpGenericAdaptor; + SquareOpAdaptor(SquareOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SquareOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SquareOpAdaptor; + template + using GenericAdaptor = SquareOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Square"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SquareOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SquaredDifferenceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SquaredDifferenceOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SquaredDifferenceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SquaredDifferenceOpGenericAdaptorBase(SquaredDifferenceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SquaredDifferenceOpGenericAdaptor : public detail::SquaredDifferenceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SquaredDifferenceOpGenericAdaptorBase; +public: + SquaredDifferenceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SquaredDifferenceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SquaredDifferenceOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SquaredDifferenceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SquaredDifferenceOpAdaptor : public SquaredDifferenceOpGenericAdaptor<::mlir::ValueRange> { +public: + using SquaredDifferenceOpGenericAdaptor::SquaredDifferenceOpGenericAdaptor; + SquaredDifferenceOpAdaptor(SquaredDifferenceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SquaredDifferenceOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsCommutative, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SquaredDifferenceOpAdaptor; + template + using GenericAdaptor = SquaredDifferenceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SquaredDifference"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SquaredDifferenceOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SqueezeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SqueezeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SqueezeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SqueezeOpGenericAdaptorBase(SqueezeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getSqueezeDimsAttr(); + ::mlir::ArrayAttr getSqueezeDims(); +}; +} // namespace detail +template +class SqueezeOpGenericAdaptor : public detail::SqueezeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SqueezeOpGenericAdaptorBase; +public: + SqueezeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SqueezeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SqueezeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SqueezeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SqueezeOpAdaptor : public SqueezeOpGenericAdaptor<::mlir::ValueRange> { +public: + using SqueezeOpGenericAdaptor::SqueezeOpGenericAdaptor; + SqueezeOpAdaptor(SqueezeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SqueezeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SqueezeOpAdaptor; + template + using GenericAdaptor = SqueezeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("squeeze_dims")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getSqueezeDimsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getSqueezeDimsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Squeeze"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ArrayAttr getSqueezeDimsAttr(); + ::mlir::ArrayAttr getSqueezeDims(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setSqueezeDimsAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeSqueezeDimsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, /*optional*/::mlir::ArrayAttr squeeze_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, /*optional*/::mlir::ArrayAttr squeeze_dims); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SqueezeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StackCloseV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StackCloseV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StackCloseV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StackCloseV2OpGenericAdaptorBase(StackCloseV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class StackCloseV2OpGenericAdaptor : public detail::StackCloseV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StackCloseV2OpGenericAdaptorBase; +public: + StackCloseV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StackCloseV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StackCloseV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StackCloseV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getHandle() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StackCloseV2OpAdaptor : public StackCloseV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using StackCloseV2OpGenericAdaptor::StackCloseV2OpGenericAdaptor; + StackCloseV2OpAdaptor(StackCloseV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StackCloseV2Op : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = StackCloseV2OpAdaptor; + template + using GenericAdaptor = StackCloseV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StackCloseV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::OpOperand &getHandleMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value handle); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value handle); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StackCloseV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StackPopV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StackPopV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StackPopV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StackPopV2OpGenericAdaptorBase(StackPopV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class StackPopV2OpGenericAdaptor : public detail::StackPopV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StackPopV2OpGenericAdaptorBase; +public: + StackPopV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StackPopV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StackPopV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StackPopV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getHandle() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StackPopV2OpAdaptor : public StackPopV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using StackPopV2OpGenericAdaptor::StackPopV2OpGenericAdaptor; + StackPopV2OpAdaptor(StackPopV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StackPopV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StackPopV2OpAdaptor; + template + using GenericAdaptor = StackPopV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("elem_type")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getElemTypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getElemTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StackPopV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::OpOperand &getHandleMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getElem(); + ::mlir::Type getElemType(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type elem, ::mlir::Value handle); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value handle); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StackPopV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StackPushV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StackPushV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StackPushV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StackPushV2OpGenericAdaptorBase(StackPushV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getSwapMemoryAttr(); + bool getSwapMemory(); +}; +} // namespace detail +template +class StackPushV2OpGenericAdaptor : public detail::StackPushV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StackPushV2OpGenericAdaptorBase; +public: + StackPushV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StackPushV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StackPushV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StackPushV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getElem() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StackPushV2OpAdaptor : public StackPushV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using StackPushV2OpGenericAdaptor::StackPushV2OpGenericAdaptor; + StackPushV2OpAdaptor(StackPushV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StackPushV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StackPushV2OpAdaptor; + template + using GenericAdaptor = StackPushV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("swap_memory")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getSwapMemoryAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getSwapMemoryAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StackPushV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::TypedValue<::mlir::TensorType> getElem(); + ::mlir::OpOperand &getHandleMutable(); + ::mlir::OpOperand &getElemMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getSwapMemoryAttr(); + bool getSwapMemory(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setSwapMemoryAttr(::mlir::BoolAttr attr); + void setSwapMemory(::std::optional attrValue); + ::mlir::Attribute removeSwapMemoryAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value handle, ::mlir::Value elem, /*optional*/::mlir::BoolAttr swap_memory); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value handle, ::mlir::Value elem, /*optional*/::mlir::BoolAttr swap_memory); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value handle, ::mlir::Value elem, /*optional*/bool swap_memory = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value handle, ::mlir::Value elem, /*optional*/bool swap_memory = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StackPushV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StackV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StackV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StackV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StackV2OpGenericAdaptorBase(StackV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::TypeAttr getElemTypeAttr(); + ::mlir::Type getElemType(); + ::mlir::StringAttr getStackNameAttr(); + ::llvm::StringRef getStackName(); +}; +} // namespace detail +template +class StackV2OpGenericAdaptor : public detail::StackV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StackV2OpGenericAdaptorBase; +public: + StackV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StackV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StackV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StackV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getMaxSize() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StackV2OpAdaptor : public StackV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using StackV2OpGenericAdaptor::StackV2OpGenericAdaptor; + StackV2OpAdaptor(StackV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StackV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ResourceHandleAllocatorInterface::Trait, ::mlir::OpTrait::TF::UniqueResourceAllocation, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StackV2OpAdaptor; + template + using GenericAdaptor = StackV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("elem_type"), ::llvm::StringRef("stack_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getElemTypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getElemTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getStackNameAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getStackNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StackV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getMaxSize(); + ::mlir::OpOperand &getMaxSizeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::TypeAttr getElemTypeAttr(); + ::mlir::Type getElemType(); + ::mlir::StringAttr getStackNameAttr(); + ::llvm::StringRef getStackName(); + void setElemTypeAttr(::mlir::TypeAttr attr); + void setElemType(::mlir::Type attrValue); + void setStackNameAttr(::mlir::StringAttr attr); + void setStackName(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeStackNameAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value max_size, ::mlir::TypeAttr elem_type, /*optional*/::mlir::StringAttr stack_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value max_size, ::mlir::TypeAttr elem_type, /*optional*/::mlir::StringAttr stack_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value max_size, ::mlir::Type elem_type, /*optional*/::llvm::StringRef stack_name = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value max_size, ::mlir::Type elem_type, /*optional*/::llvm::StringRef stack_name = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StackV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StatefulPartitionedCallOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StatefulPartitionedCallOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StatefulPartitionedCallOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StatefulPartitionedCallOpGenericAdaptorBase(StatefulPartitionedCallOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::FlatSymbolRefAttr getFAttr(); + ::llvm::StringRef getF(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + ::mlir::StringAttr getConfigProtoAttr(); + ::llvm::StringRef getConfigProto(); + ::mlir::StringAttr getExecutorTypeAttr(); + ::llvm::StringRef getExecutorType(); +}; +} // namespace detail +template +class StatefulPartitionedCallOpGenericAdaptor : public detail::StatefulPartitionedCallOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StatefulPartitionedCallOpGenericAdaptorBase; +public: + StatefulPartitionedCallOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StatefulPartitionedCallOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StatefulPartitionedCallOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StatefulPartitionedCallOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StatefulPartitionedCallOpAdaptor : public StatefulPartitionedCallOpGenericAdaptor<::mlir::ValueRange> { +public: + using StatefulPartitionedCallOpGenericAdaptor::StatefulPartitionedCallOpGenericAdaptor; + StatefulPartitionedCallOpAdaptor(StatefulPartitionedCallOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StatefulPartitionedCallOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = StatefulPartitionedCallOpAdaptor; + template + using GenericAdaptor = StatefulPartitionedCallOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tin"), ::llvm::StringRef("Tout"), ::llvm::StringRef("config"), ::llvm::StringRef("config_proto"), ::llvm::StringRef("executor_type"), ::llvm::StringRef("f")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTinAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTinAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getToutAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getToutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getConfigProtoAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getConfigProtoAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getExecutorTypeAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getExecutorTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getFAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getFAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StatefulPartitionedCall"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutput(); + ::mlir::FlatSymbolRefAttr getFAttr(); + ::llvm::StringRef getF(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + ::mlir::StringAttr getConfigProtoAttr(); + ::llvm::StringRef getConfigProto(); + ::mlir::StringAttr getExecutorTypeAttr(); + ::llvm::StringRef getExecutorType(); + mlir::OperandElementTypeRange getTin(); + mlir::ResultElementTypeRange getTout(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setFAttr(::mlir::FlatSymbolRefAttr attr); + void setF(::llvm::StringRef attrValue); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::llvm::StringRef attrValue); + void setConfigProtoAttr(::mlir::StringAttr attr); + void setConfigProto(::llvm::StringRef attrValue); + void setExecutorTypeAttr(::mlir::StringAttr attr); + void setExecutorType(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::ValueRange args, ::mlir::FlatSymbolRefAttr f, ::mlir::StringAttr config, ::mlir::StringAttr config_proto, ::mlir::StringAttr executor_type); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::ValueRange args, ::llvm::StringRef f, ::llvm::StringRef config, ::llvm::StringRef config_proto, ::llvm::StringRef executor_type); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verifySymbolUses(::mlir::SymbolTableCollection &symbolTable); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Gets the argument operands to the called function. + operand_range getArgOperands() { return getArgs(); } + MutableOperandRange getArgOperandsMutable() { + return getArgsMutable(); + } + + // Returns the callee of this operation. + CallInterfaceCallable getCallableForCallee() { return getFAttr(); } + // Sets the callee from the callable + void setCalleeFromCallable(::mlir::CallInterfaceCallable callee); + + // Returns the resolved callee function of this operation. + // Prefer passing in SymbolTableCollection to reduce lookup costs by + // enabling reusing cached symbol table lookup. + func::FuncOp ResolveFunc(::mlir::SymbolTableCollection* table) { + if (table) + return table->lookupNearestSymbolFrom(*this, getFAttr()); + return SymbolTable::lookupNearestSymbolFrom(*this, getFAttr()); + } + // TODO(b/204997177): Deprecate and remove. + func::FuncOp func() { return ResolveFunc(nullptr); } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StatefulPartitionedCallOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StatefulStandardNormalV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StatefulStandardNormalV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StatefulStandardNormalV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StatefulStandardNormalV2OpGenericAdaptorBase(StatefulStandardNormalV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class StatefulStandardNormalV2OpGenericAdaptor : public detail::StatefulStandardNormalV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StatefulStandardNormalV2OpGenericAdaptorBase; +public: + StatefulStandardNormalV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StatefulStandardNormalV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StatefulStandardNormalV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StatefulStandardNormalV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getResource() { + return (*getODSOperands(0).begin()); + } + + ValueT getAlgorithm() { + return (*getODSOperands(1).begin()); + } + + ValueT getShape() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StatefulStandardNormalV2OpAdaptor : public StatefulStandardNormalV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using StatefulStandardNormalV2OpGenericAdaptor::StatefulStandardNormalV2OpGenericAdaptor; + StatefulStandardNormalV2OpAdaptor(StatefulStandardNormalV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StatefulStandardNormalV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StatefulStandardNormalV2OpAdaptor; + template + using GenericAdaptor = StatefulStandardNormalV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dtype"), ::llvm::StringRef("shape_dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getShapeDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getShapeDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StatefulStandardNormalV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResource(); + ::mlir::TypedValue<::mlir::TensorType> getAlgorithm(); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::OpOperand &getResourceMutable(); + ::mlir::OpOperand &getAlgorithmMutable(); + ::mlir::OpOperand &getShapeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getShapeDtype(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value resource, ::mlir::Value algorithm, ::mlir::Value shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value resource, ::mlir::Value algorithm, ::mlir::Value shape); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StatefulStandardNormalV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StatefulTruncatedNormalOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StatefulTruncatedNormalOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StatefulTruncatedNormalOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StatefulTruncatedNormalOpGenericAdaptorBase(StatefulTruncatedNormalOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class StatefulTruncatedNormalOpGenericAdaptor : public detail::StatefulTruncatedNormalOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StatefulTruncatedNormalOpGenericAdaptorBase; +public: + StatefulTruncatedNormalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StatefulTruncatedNormalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StatefulTruncatedNormalOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StatefulTruncatedNormalOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getResource() { + return (*getODSOperands(0).begin()); + } + + ValueT getAlgorithm() { + return (*getODSOperands(1).begin()); + } + + ValueT getShape() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StatefulTruncatedNormalOpAdaptor : public StatefulTruncatedNormalOpGenericAdaptor<::mlir::ValueRange> { +public: + using StatefulTruncatedNormalOpGenericAdaptor::StatefulTruncatedNormalOpGenericAdaptor; + StatefulTruncatedNormalOpAdaptor(StatefulTruncatedNormalOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StatefulTruncatedNormalOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StatefulTruncatedNormalOpAdaptor; + template + using GenericAdaptor = StatefulTruncatedNormalOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dtype"), ::llvm::StringRef("shape_dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getShapeDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getShapeDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StatefulTruncatedNormal"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResource(); + ::mlir::TypedValue<::mlir::TensorType> getAlgorithm(); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::OpOperand &getResourceMutable(); + ::mlir::OpOperand &getAlgorithmMutable(); + ::mlir::OpOperand &getShapeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getShapeDtype(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value resource, ::mlir::Value algorithm, ::mlir::Value shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value resource, ::mlir::Value algorithm, ::mlir::Value shape); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StatefulTruncatedNormalOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StatefulUniformFullIntOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StatefulUniformFullIntOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StatefulUniformFullIntOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StatefulUniformFullIntOpGenericAdaptorBase(StatefulUniformFullIntOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class StatefulUniformFullIntOpGenericAdaptor : public detail::StatefulUniformFullIntOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StatefulUniformFullIntOpGenericAdaptorBase; +public: + StatefulUniformFullIntOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StatefulUniformFullIntOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StatefulUniformFullIntOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StatefulUniformFullIntOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getResource() { + return (*getODSOperands(0).begin()); + } + + ValueT getAlgorithm() { + return (*getODSOperands(1).begin()); + } + + ValueT getShape() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StatefulUniformFullIntOpAdaptor : public StatefulUniformFullIntOpGenericAdaptor<::mlir::ValueRange> { +public: + using StatefulUniformFullIntOpGenericAdaptor::StatefulUniformFullIntOpGenericAdaptor; + StatefulUniformFullIntOpAdaptor(StatefulUniformFullIntOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StatefulUniformFullIntOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StatefulUniformFullIntOpAdaptor; + template + using GenericAdaptor = StatefulUniformFullIntOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dtype"), ::llvm::StringRef("shape_dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getShapeDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getShapeDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StatefulUniformFullInt"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResource(); + ::mlir::TypedValue<::mlir::TensorType> getAlgorithm(); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::OpOperand &getResourceMutable(); + ::mlir::OpOperand &getAlgorithmMutable(); + ::mlir::OpOperand &getShapeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getShapeDtype(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value resource, ::mlir::Value algorithm, ::mlir::Value shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value resource, ::mlir::Value algorithm, ::mlir::Value shape); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StatefulUniformFullIntOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StatefulUniformIntOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StatefulUniformIntOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StatefulUniformIntOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StatefulUniformIntOpGenericAdaptorBase(StatefulUniformIntOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class StatefulUniformIntOpGenericAdaptor : public detail::StatefulUniformIntOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StatefulUniformIntOpGenericAdaptorBase; +public: + StatefulUniformIntOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StatefulUniformIntOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StatefulUniformIntOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StatefulUniformIntOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getResource() { + return (*getODSOperands(0).begin()); + } + + ValueT getAlgorithm() { + return (*getODSOperands(1).begin()); + } + + ValueT getShape() { + return (*getODSOperands(2).begin()); + } + + ValueT getMinval() { + return (*getODSOperands(3).begin()); + } + + ValueT getMaxval() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StatefulUniformIntOpAdaptor : public StatefulUniformIntOpGenericAdaptor<::mlir::ValueRange> { +public: + using StatefulUniformIntOpGenericAdaptor::StatefulUniformIntOpGenericAdaptor; + StatefulUniformIntOpAdaptor(StatefulUniformIntOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StatefulUniformIntOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<5>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StatefulUniformIntOpAdaptor; + template + using GenericAdaptor = StatefulUniformIntOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dtype"), ::llvm::StringRef("shape_dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getShapeDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getShapeDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StatefulUniformInt"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResource(); + ::mlir::TypedValue<::mlir::TensorType> getAlgorithm(); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::TypedValue<::mlir::TensorType> getMinval(); + ::mlir::TypedValue<::mlir::TensorType> getMaxval(); + ::mlir::OpOperand &getResourceMutable(); + ::mlir::OpOperand &getAlgorithmMutable(); + ::mlir::OpOperand &getShapeMutable(); + ::mlir::OpOperand &getMinvalMutable(); + ::mlir::OpOperand &getMaxvalMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getShapeDtype(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value resource, ::mlir::Value algorithm, ::mlir::Value shape, ::mlir::Value minval, ::mlir::Value maxval); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value resource, ::mlir::Value algorithm, ::mlir::Value shape, ::mlir::Value minval, ::mlir::Value maxval); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StatefulUniformIntOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StatefulUniformOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StatefulUniformOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StatefulUniformOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StatefulUniformOpGenericAdaptorBase(StatefulUniformOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class StatefulUniformOpGenericAdaptor : public detail::StatefulUniformOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StatefulUniformOpGenericAdaptorBase; +public: + StatefulUniformOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StatefulUniformOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StatefulUniformOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StatefulUniformOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getResource() { + return (*getODSOperands(0).begin()); + } + + ValueT getAlgorithm() { + return (*getODSOperands(1).begin()); + } + + ValueT getShape() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StatefulUniformOpAdaptor : public StatefulUniformOpGenericAdaptor<::mlir::ValueRange> { +public: + using StatefulUniformOpGenericAdaptor::StatefulUniformOpGenericAdaptor; + StatefulUniformOpAdaptor(StatefulUniformOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StatefulUniformOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StatefulUniformOpAdaptor; + template + using GenericAdaptor = StatefulUniformOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dtype"), ::llvm::StringRef("shape_dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getShapeDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getShapeDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StatefulUniform"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResource(); + ::mlir::TypedValue<::mlir::TensorType> getAlgorithm(); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::OpOperand &getResourceMutable(); + ::mlir::OpOperand &getAlgorithmMutable(); + ::mlir::OpOperand &getShapeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getShapeDtype(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value resource, ::mlir::Value algorithm, ::mlir::Value shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value resource, ::mlir::Value algorithm, ::mlir::Value shape); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StatefulUniformOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StatelessMultinomialOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StatelessMultinomialOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StatelessMultinomialOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StatelessMultinomialOpGenericAdaptorBase(StatelessMultinomialOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class StatelessMultinomialOpGenericAdaptor : public detail::StatelessMultinomialOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StatelessMultinomialOpGenericAdaptorBase; +public: + StatelessMultinomialOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StatelessMultinomialOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StatelessMultinomialOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StatelessMultinomialOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLogits() { + return (*getODSOperands(0).begin()); + } + + ValueT getNumSamples() { + return (*getODSOperands(1).begin()); + } + + ValueT getSeed() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StatelessMultinomialOpAdaptor : public StatelessMultinomialOpGenericAdaptor<::mlir::ValueRange> { +public: + using StatelessMultinomialOpGenericAdaptor::StatelessMultinomialOpGenericAdaptor; + StatelessMultinomialOpAdaptor(StatelessMultinomialOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StatelessMultinomialOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StatelessMultinomialOpAdaptor; + template + using GenericAdaptor = StatelessMultinomialOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tseed"), ::llvm::StringRef("output_dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTseedAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTseedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOutputDtypeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOutputDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StatelessMultinomial"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLogits(); + ::mlir::TypedValue<::mlir::TensorType> getNumSamples(); + ::mlir::TypedValue<::mlir::TensorType> getSeed(); + ::mlir::OpOperand &getLogitsMutable(); + ::mlir::OpOperand &getNumSamplesMutable(); + ::mlir::OpOperand &getSeedMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTseed(); + ::mlir::Type getOutputDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value logits, ::mlir::Value num_samples, ::mlir::Value seed); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value logits, ::mlir::Value num_samples, ::mlir::Value seed); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StatelessMultinomialOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StatelessParameterizedTruncatedNormalOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StatelessParameterizedTruncatedNormalOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StatelessParameterizedTruncatedNormalOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StatelessParameterizedTruncatedNormalOpGenericAdaptorBase(StatelessParameterizedTruncatedNormalOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class StatelessParameterizedTruncatedNormalOpGenericAdaptor : public detail::StatelessParameterizedTruncatedNormalOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StatelessParameterizedTruncatedNormalOpGenericAdaptorBase; +public: + StatelessParameterizedTruncatedNormalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StatelessParameterizedTruncatedNormalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StatelessParameterizedTruncatedNormalOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StatelessParameterizedTruncatedNormalOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getShape() { + return (*getODSOperands(0).begin()); + } + + ValueT getSeed() { + return (*getODSOperands(1).begin()); + } + + ValueT getMeans() { + return (*getODSOperands(2).begin()); + } + + ValueT getStddevs() { + return (*getODSOperands(3).begin()); + } + + ValueT getMinvals() { + return (*getODSOperands(4).begin()); + } + + ValueT getMaxvals() { + return (*getODSOperands(5).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StatelessParameterizedTruncatedNormalOpAdaptor : public StatelessParameterizedTruncatedNormalOpGenericAdaptor<::mlir::ValueRange> { +public: + using StatelessParameterizedTruncatedNormalOpGenericAdaptor::StatelessParameterizedTruncatedNormalOpGenericAdaptor; + StatelessParameterizedTruncatedNormalOpAdaptor(StatelessParameterizedTruncatedNormalOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StatelessParameterizedTruncatedNormalOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<6>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StatelessParameterizedTruncatedNormalOpAdaptor; + template + using GenericAdaptor = StatelessParameterizedTruncatedNormalOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("S"), ::llvm::StringRef("Tseed"), ::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getSAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getSAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTseedAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTseedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StatelessParameterizedTruncatedNormal"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::TypedValue<::mlir::TensorType> getSeed(); + ::mlir::TypedValue<::mlir::TensorType> getMeans(); + ::mlir::TypedValue<::mlir::TensorType> getStddevs(); + ::mlir::TypedValue<::mlir::TensorType> getMinvals(); + ::mlir::TypedValue<::mlir::TensorType> getMaxvals(); + ::mlir::OpOperand &getShapeMutable(); + ::mlir::OpOperand &getSeedMutable(); + ::mlir::OpOperand &getMeansMutable(); + ::mlir::OpOperand &getStddevsMutable(); + ::mlir::OpOperand &getMinvalsMutable(); + ::mlir::OpOperand &getMaxvalsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getS(); + ::mlir::Type getTseed(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, ::mlir::Value seed, ::mlir::Value means, ::mlir::Value stddevs, ::mlir::Value minvals, ::mlir::Value maxvals); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, ::mlir::Value seed, ::mlir::Value means, ::mlir::Value stddevs, ::mlir::Value minvals, ::mlir::Value maxvals); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StatelessParameterizedTruncatedNormalOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StatelessRandomBinomialOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StatelessRandomBinomialOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StatelessRandomBinomialOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StatelessRandomBinomialOpGenericAdaptorBase(StatelessRandomBinomialOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class StatelessRandomBinomialOpGenericAdaptor : public detail::StatelessRandomBinomialOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StatelessRandomBinomialOpGenericAdaptorBase; +public: + StatelessRandomBinomialOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StatelessRandomBinomialOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StatelessRandomBinomialOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StatelessRandomBinomialOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getShape() { + return (*getODSOperands(0).begin()); + } + + ValueT getSeed() { + return (*getODSOperands(1).begin()); + } + + ValueT getCounts() { + return (*getODSOperands(2).begin()); + } + + ValueT getProbs() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StatelessRandomBinomialOpAdaptor : public StatelessRandomBinomialOpGenericAdaptor<::mlir::ValueRange> { +public: + using StatelessRandomBinomialOpGenericAdaptor::StatelessRandomBinomialOpGenericAdaptor; + StatelessRandomBinomialOpAdaptor(StatelessRandomBinomialOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StatelessRandomBinomialOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StatelessRandomBinomialOpAdaptor; + template + using GenericAdaptor = StatelessRandomBinomialOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("S"), ::llvm::StringRef("T"), ::llvm::StringRef("Tseed"), ::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getSAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getSAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTseedAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTseedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StatelessRandomBinomial"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::TypedValue<::mlir::TensorType> getSeed(); + ::mlir::TypedValue<::mlir::TensorType> getCounts(); + ::mlir::TypedValue<::mlir::TensorType> getProbs(); + ::mlir::OpOperand &getShapeMutable(); + ::mlir::OpOperand &getSeedMutable(); + ::mlir::OpOperand &getCountsMutable(); + ::mlir::OpOperand &getProbsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getS(); + ::mlir::Type getT(); + ::mlir::Type getTseed(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, ::mlir::Value seed, ::mlir::Value counts, ::mlir::Value probs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, ::mlir::Value seed, ::mlir::Value counts, ::mlir::Value probs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StatelessRandomBinomialOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StatelessRandomGammaV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StatelessRandomGammaV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StatelessRandomGammaV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StatelessRandomGammaV2OpGenericAdaptorBase(StatelessRandomGammaV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class StatelessRandomGammaV2OpGenericAdaptor : public detail::StatelessRandomGammaV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StatelessRandomGammaV2OpGenericAdaptorBase; +public: + StatelessRandomGammaV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StatelessRandomGammaV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StatelessRandomGammaV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StatelessRandomGammaV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getShape() { + return (*getODSOperands(0).begin()); + } + + ValueT getSeed() { + return (*getODSOperands(1).begin()); + } + + ValueT getAlpha() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StatelessRandomGammaV2OpAdaptor : public StatelessRandomGammaV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using StatelessRandomGammaV2OpGenericAdaptor::StatelessRandomGammaV2OpGenericAdaptor; + StatelessRandomGammaV2OpAdaptor(StatelessRandomGammaV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StatelessRandomGammaV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StatelessRandomGammaV2OpAdaptor; + template + using GenericAdaptor = StatelessRandomGammaV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tseed"), ::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTseedAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTseedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StatelessRandomGammaV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::TypedValue<::mlir::TensorType> getSeed(); + ::mlir::TypedValue<::mlir::TensorType> getAlpha(); + ::mlir::OpOperand &getShapeMutable(); + ::mlir::OpOperand &getSeedMutable(); + ::mlir::OpOperand &getAlphaMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTseed(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, ::mlir::Value seed, ::mlir::Value alpha); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, ::mlir::Value seed, ::mlir::Value alpha); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StatelessRandomGammaV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StatelessRandomGetAlgOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StatelessRandomGetAlgOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StatelessRandomGetAlgOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StatelessRandomGetAlgOpGenericAdaptorBase(StatelessRandomGetAlgOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class StatelessRandomGetAlgOpGenericAdaptor : public detail::StatelessRandomGetAlgOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StatelessRandomGetAlgOpGenericAdaptorBase; +public: + StatelessRandomGetAlgOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StatelessRandomGetAlgOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StatelessRandomGetAlgOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StatelessRandomGetAlgOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StatelessRandomGetAlgOpAdaptor : public StatelessRandomGetAlgOpGenericAdaptor<::mlir::ValueRange> { +public: + using StatelessRandomGetAlgOpGenericAdaptor::StatelessRandomGetAlgOpGenericAdaptor; + StatelessRandomGetAlgOpAdaptor(StatelessRandomGetAlgOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StatelessRandomGetAlgOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = StatelessRandomGetAlgOpAdaptor; + template + using GenericAdaptor = StatelessRandomGetAlgOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StatelessRandomGetAlg"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getAlg(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type alg); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StatelessRandomGetAlgOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StatelessRandomGetKeyCounterAlgOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StatelessRandomGetKeyCounterAlgOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StatelessRandomGetKeyCounterAlgOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StatelessRandomGetKeyCounterAlgOpGenericAdaptorBase(StatelessRandomGetKeyCounterAlgOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class StatelessRandomGetKeyCounterAlgOpGenericAdaptor : public detail::StatelessRandomGetKeyCounterAlgOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StatelessRandomGetKeyCounterAlgOpGenericAdaptorBase; +public: + StatelessRandomGetKeyCounterAlgOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StatelessRandomGetKeyCounterAlgOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StatelessRandomGetKeyCounterAlgOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StatelessRandomGetKeyCounterAlgOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSeed() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StatelessRandomGetKeyCounterAlgOpAdaptor : public StatelessRandomGetKeyCounterAlgOpGenericAdaptor<::mlir::ValueRange> { +public: + using StatelessRandomGetKeyCounterAlgOpGenericAdaptor::StatelessRandomGetKeyCounterAlgOpGenericAdaptor; + StatelessRandomGetKeyCounterAlgOpAdaptor(StatelessRandomGetKeyCounterAlgOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StatelessRandomGetKeyCounterAlgOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StatelessRandomGetKeyCounterAlgOpAdaptor; + template + using GenericAdaptor = StatelessRandomGetKeyCounterAlgOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tseed")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTseedAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTseedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StatelessRandomGetKeyCounterAlg"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSeed(); + ::mlir::OpOperand &getSeedMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getKey(); + ::mlir::TypedValue<::mlir::TensorType> getCounter(); + ::mlir::TypedValue<::mlir::TensorType> getAlg(); + ::mlir::Type getTseed(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type key, ::mlir::Type counter, ::mlir::Type alg, ::mlir::Value seed); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value seed); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StatelessRandomGetKeyCounterAlgOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StatelessRandomGetKeyCounterOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StatelessRandomGetKeyCounterOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StatelessRandomGetKeyCounterOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StatelessRandomGetKeyCounterOpGenericAdaptorBase(StatelessRandomGetKeyCounterOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class StatelessRandomGetKeyCounterOpGenericAdaptor : public detail::StatelessRandomGetKeyCounterOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StatelessRandomGetKeyCounterOpGenericAdaptorBase; +public: + StatelessRandomGetKeyCounterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StatelessRandomGetKeyCounterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StatelessRandomGetKeyCounterOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StatelessRandomGetKeyCounterOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSeed() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StatelessRandomGetKeyCounterOpAdaptor : public StatelessRandomGetKeyCounterOpGenericAdaptor<::mlir::ValueRange> { +public: + using StatelessRandomGetKeyCounterOpGenericAdaptor::StatelessRandomGetKeyCounterOpGenericAdaptor; + StatelessRandomGetKeyCounterOpAdaptor(StatelessRandomGetKeyCounterOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StatelessRandomGetKeyCounterOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StatelessRandomGetKeyCounterOpAdaptor; + template + using GenericAdaptor = StatelessRandomGetKeyCounterOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tseed")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTseedAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTseedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StatelessRandomGetKeyCounter"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSeed(); + ::mlir::OpOperand &getSeedMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getKey(); + ::mlir::TypedValue<::mlir::TensorType> getCounter(); + ::mlir::Type getTseed(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type key, ::mlir::Type counter, ::mlir::Value seed); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value seed); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StatelessRandomGetKeyCounterOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StatelessRandomNormalOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StatelessRandomNormalOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StatelessRandomNormalOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StatelessRandomNormalOpGenericAdaptorBase(StatelessRandomNormalOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class StatelessRandomNormalOpGenericAdaptor : public detail::StatelessRandomNormalOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StatelessRandomNormalOpGenericAdaptorBase; +public: + StatelessRandomNormalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StatelessRandomNormalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StatelessRandomNormalOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StatelessRandomNormalOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getShape() { + return (*getODSOperands(0).begin()); + } + + ValueT getSeed() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StatelessRandomNormalOpAdaptor : public StatelessRandomNormalOpGenericAdaptor<::mlir::ValueRange> { +public: + using StatelessRandomNormalOpGenericAdaptor::StatelessRandomNormalOpGenericAdaptor; + StatelessRandomNormalOpAdaptor(StatelessRandomNormalOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StatelessRandomNormalOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StatelessRandomNormalOpAdaptor; + template + using GenericAdaptor = StatelessRandomNormalOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tseed"), ::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTseedAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTseedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StatelessRandomNormal"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::TypedValue<::mlir::TensorType> getSeed(); + ::mlir::OpOperand &getShapeMutable(); + ::mlir::OpOperand &getSeedMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTseed(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, ::mlir::Value seed); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, ::mlir::Value seed); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StatelessRandomNormalOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StatelessRandomNormalV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StatelessRandomNormalV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StatelessRandomNormalV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StatelessRandomNormalV2OpGenericAdaptorBase(StatelessRandomNormalV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class StatelessRandomNormalV2OpGenericAdaptor : public detail::StatelessRandomNormalV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StatelessRandomNormalV2OpGenericAdaptorBase; +public: + StatelessRandomNormalV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StatelessRandomNormalV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StatelessRandomNormalV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StatelessRandomNormalV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getShape() { + return (*getODSOperands(0).begin()); + } + + ValueT getKey() { + return (*getODSOperands(1).begin()); + } + + ValueT getCounter() { + return (*getODSOperands(2).begin()); + } + + ValueT getAlg() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StatelessRandomNormalV2OpAdaptor : public StatelessRandomNormalV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using StatelessRandomNormalV2OpGenericAdaptor::StatelessRandomNormalV2OpGenericAdaptor; + StatelessRandomNormalV2OpAdaptor(StatelessRandomNormalV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StatelessRandomNormalV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StatelessRandomNormalV2OpAdaptor; + template + using GenericAdaptor = StatelessRandomNormalV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tshape"), ::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTshapeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTshapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StatelessRandomNormalV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::TypedValue<::mlir::TensorType> getKey(); + ::mlir::TypedValue<::mlir::TensorType> getCounter(); + ::mlir::TypedValue<::mlir::TensorType> getAlg(); + ::mlir::OpOperand &getShapeMutable(); + ::mlir::OpOperand &getKeyMutable(); + ::mlir::OpOperand &getCounterMutable(); + ::mlir::OpOperand &getAlgMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getTshape(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, ::mlir::Value key, ::mlir::Value counter, ::mlir::Value alg); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, ::mlir::Value key, ::mlir::Value counter, ::mlir::Value alg); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StatelessRandomNormalV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StatelessRandomPoissonOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StatelessRandomPoissonOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StatelessRandomPoissonOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StatelessRandomPoissonOpGenericAdaptorBase(StatelessRandomPoissonOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class StatelessRandomPoissonOpGenericAdaptor : public detail::StatelessRandomPoissonOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StatelessRandomPoissonOpGenericAdaptorBase; +public: + StatelessRandomPoissonOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StatelessRandomPoissonOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StatelessRandomPoissonOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StatelessRandomPoissonOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getShape() { + return (*getODSOperands(0).begin()); + } + + ValueT getSeed() { + return (*getODSOperands(1).begin()); + } + + ValueT getLam() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StatelessRandomPoissonOpAdaptor : public StatelessRandomPoissonOpGenericAdaptor<::mlir::ValueRange> { +public: + using StatelessRandomPoissonOpGenericAdaptor::StatelessRandomPoissonOpGenericAdaptor; + StatelessRandomPoissonOpAdaptor(StatelessRandomPoissonOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StatelessRandomPoissonOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StatelessRandomPoissonOpAdaptor; + template + using GenericAdaptor = StatelessRandomPoissonOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Rtype"), ::llvm::StringRef("T"), ::llvm::StringRef("Tseed"), ::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getRtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getRtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTseedAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTseedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StatelessRandomPoisson"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::TypedValue<::mlir::TensorType> getSeed(); + ::mlir::TypedValue<::mlir::TensorType> getLam(); + ::mlir::OpOperand &getShapeMutable(); + ::mlir::OpOperand &getSeedMutable(); + ::mlir::OpOperand &getLamMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getRtype(); + ::mlir::Type getT(); + ::mlir::Type getTseed(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, ::mlir::Value seed, ::mlir::Value lam); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, ::mlir::Value seed, ::mlir::Value lam); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StatelessRandomPoissonOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StatelessRandomUniformFullIntOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StatelessRandomUniformFullIntOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StatelessRandomUniformFullIntOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StatelessRandomUniformFullIntOpGenericAdaptorBase(StatelessRandomUniformFullIntOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class StatelessRandomUniformFullIntOpGenericAdaptor : public detail::StatelessRandomUniformFullIntOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StatelessRandomUniformFullIntOpGenericAdaptorBase; +public: + StatelessRandomUniformFullIntOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StatelessRandomUniformFullIntOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StatelessRandomUniformFullIntOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StatelessRandomUniformFullIntOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getShape() { + return (*getODSOperands(0).begin()); + } + + ValueT getSeed() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StatelessRandomUniformFullIntOpAdaptor : public StatelessRandomUniformFullIntOpGenericAdaptor<::mlir::ValueRange> { +public: + using StatelessRandomUniformFullIntOpGenericAdaptor::StatelessRandomUniformFullIntOpGenericAdaptor; + StatelessRandomUniformFullIntOpAdaptor(StatelessRandomUniformFullIntOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StatelessRandomUniformFullIntOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StatelessRandomUniformFullIntOpAdaptor; + template + using GenericAdaptor = StatelessRandomUniformFullIntOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tseed"), ::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTseedAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTseedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StatelessRandomUniformFullInt"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::TypedValue<::mlir::TensorType> getSeed(); + ::mlir::OpOperand &getShapeMutable(); + ::mlir::OpOperand &getSeedMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTseed(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, ::mlir::Value seed); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, ::mlir::Value seed); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StatelessRandomUniformFullIntOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StatelessRandomUniformFullIntV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StatelessRandomUniformFullIntV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StatelessRandomUniformFullIntV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StatelessRandomUniformFullIntV2OpGenericAdaptorBase(StatelessRandomUniformFullIntV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class StatelessRandomUniformFullIntV2OpGenericAdaptor : public detail::StatelessRandomUniformFullIntV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StatelessRandomUniformFullIntV2OpGenericAdaptorBase; +public: + StatelessRandomUniformFullIntV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StatelessRandomUniformFullIntV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StatelessRandomUniformFullIntV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StatelessRandomUniformFullIntV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getShape() { + return (*getODSOperands(0).begin()); + } + + ValueT getKey() { + return (*getODSOperands(1).begin()); + } + + ValueT getCounter() { + return (*getODSOperands(2).begin()); + } + + ValueT getAlg() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StatelessRandomUniformFullIntV2OpAdaptor : public StatelessRandomUniformFullIntV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using StatelessRandomUniformFullIntV2OpGenericAdaptor::StatelessRandomUniformFullIntV2OpGenericAdaptor; + StatelessRandomUniformFullIntV2OpAdaptor(StatelessRandomUniformFullIntV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StatelessRandomUniformFullIntV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StatelessRandomUniformFullIntV2OpAdaptor; + template + using GenericAdaptor = StatelessRandomUniformFullIntV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tshape"), ::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTshapeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTshapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StatelessRandomUniformFullIntV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::TypedValue<::mlir::TensorType> getKey(); + ::mlir::TypedValue<::mlir::TensorType> getCounter(); + ::mlir::TypedValue<::mlir::TensorType> getAlg(); + ::mlir::OpOperand &getShapeMutable(); + ::mlir::OpOperand &getKeyMutable(); + ::mlir::OpOperand &getCounterMutable(); + ::mlir::OpOperand &getAlgMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getTshape(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, ::mlir::Value key, ::mlir::Value counter, ::mlir::Value alg); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, ::mlir::Value key, ::mlir::Value counter, ::mlir::Value alg); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StatelessRandomUniformFullIntV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StatelessRandomUniformIntOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StatelessRandomUniformIntOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StatelessRandomUniformIntOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StatelessRandomUniformIntOpGenericAdaptorBase(StatelessRandomUniformIntOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class StatelessRandomUniformIntOpGenericAdaptor : public detail::StatelessRandomUniformIntOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StatelessRandomUniformIntOpGenericAdaptorBase; +public: + StatelessRandomUniformIntOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StatelessRandomUniformIntOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StatelessRandomUniformIntOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StatelessRandomUniformIntOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getShape() { + return (*getODSOperands(0).begin()); + } + + ValueT getSeed() { + return (*getODSOperands(1).begin()); + } + + ValueT getMinval() { + return (*getODSOperands(2).begin()); + } + + ValueT getMaxval() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StatelessRandomUniformIntOpAdaptor : public StatelessRandomUniformIntOpGenericAdaptor<::mlir::ValueRange> { +public: + using StatelessRandomUniformIntOpGenericAdaptor::StatelessRandomUniformIntOpGenericAdaptor; + StatelessRandomUniformIntOpAdaptor(StatelessRandomUniformIntOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StatelessRandomUniformIntOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StatelessRandomUniformIntOpAdaptor; + template + using GenericAdaptor = StatelessRandomUniformIntOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tseed"), ::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTseedAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTseedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StatelessRandomUniformInt"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::TypedValue<::mlir::TensorType> getSeed(); + ::mlir::TypedValue<::mlir::TensorType> getMinval(); + ::mlir::TypedValue<::mlir::TensorType> getMaxval(); + ::mlir::OpOperand &getShapeMutable(); + ::mlir::OpOperand &getSeedMutable(); + ::mlir::OpOperand &getMinvalMutable(); + ::mlir::OpOperand &getMaxvalMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTseed(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, ::mlir::Value seed, ::mlir::Value minval, ::mlir::Value maxval); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, ::mlir::Value seed, ::mlir::Value minval, ::mlir::Value maxval); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StatelessRandomUniformIntOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StatelessRandomUniformIntV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StatelessRandomUniformIntV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StatelessRandomUniformIntV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StatelessRandomUniformIntV2OpGenericAdaptorBase(StatelessRandomUniformIntV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class StatelessRandomUniformIntV2OpGenericAdaptor : public detail::StatelessRandomUniformIntV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StatelessRandomUniformIntV2OpGenericAdaptorBase; +public: + StatelessRandomUniformIntV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StatelessRandomUniformIntV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StatelessRandomUniformIntV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StatelessRandomUniformIntV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getShape() { + return (*getODSOperands(0).begin()); + } + + ValueT getKey() { + return (*getODSOperands(1).begin()); + } + + ValueT getCounter() { + return (*getODSOperands(2).begin()); + } + + ValueT getAlg() { + return (*getODSOperands(3).begin()); + } + + ValueT getMinval() { + return (*getODSOperands(4).begin()); + } + + ValueT getMaxval() { + return (*getODSOperands(5).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StatelessRandomUniformIntV2OpAdaptor : public StatelessRandomUniformIntV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using StatelessRandomUniformIntV2OpGenericAdaptor::StatelessRandomUniformIntV2OpGenericAdaptor; + StatelessRandomUniformIntV2OpAdaptor(StatelessRandomUniformIntV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StatelessRandomUniformIntV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<6>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StatelessRandomUniformIntV2OpAdaptor; + template + using GenericAdaptor = StatelessRandomUniformIntV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tshape"), ::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTshapeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTshapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StatelessRandomUniformIntV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::TypedValue<::mlir::TensorType> getKey(); + ::mlir::TypedValue<::mlir::TensorType> getCounter(); + ::mlir::TypedValue<::mlir::TensorType> getAlg(); + ::mlir::TypedValue<::mlir::TensorType> getMinval(); + ::mlir::TypedValue<::mlir::TensorType> getMaxval(); + ::mlir::OpOperand &getShapeMutable(); + ::mlir::OpOperand &getKeyMutable(); + ::mlir::OpOperand &getCounterMutable(); + ::mlir::OpOperand &getAlgMutable(); + ::mlir::OpOperand &getMinvalMutable(); + ::mlir::OpOperand &getMaxvalMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getTshape(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, ::mlir::Value key, ::mlir::Value counter, ::mlir::Value alg, ::mlir::Value minval, ::mlir::Value maxval); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, ::mlir::Value key, ::mlir::Value counter, ::mlir::Value alg, ::mlir::Value minval, ::mlir::Value maxval); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StatelessRandomUniformIntV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StatelessRandomUniformOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StatelessRandomUniformOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StatelessRandomUniformOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StatelessRandomUniformOpGenericAdaptorBase(StatelessRandomUniformOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class StatelessRandomUniformOpGenericAdaptor : public detail::StatelessRandomUniformOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StatelessRandomUniformOpGenericAdaptorBase; +public: + StatelessRandomUniformOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StatelessRandomUniformOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StatelessRandomUniformOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StatelessRandomUniformOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getShape() { + return (*getODSOperands(0).begin()); + } + + ValueT getSeed() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StatelessRandomUniformOpAdaptor : public StatelessRandomUniformOpGenericAdaptor<::mlir::ValueRange> { +public: + using StatelessRandomUniformOpGenericAdaptor::StatelessRandomUniformOpGenericAdaptor; + StatelessRandomUniformOpAdaptor(StatelessRandomUniformOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StatelessRandomUniformOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StatelessRandomUniformOpAdaptor; + template + using GenericAdaptor = StatelessRandomUniformOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tseed"), ::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTseedAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTseedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StatelessRandomUniform"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::TypedValue<::mlir::TensorType> getSeed(); + ::mlir::OpOperand &getShapeMutable(); + ::mlir::OpOperand &getSeedMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTseed(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, ::mlir::Value seed); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, ::mlir::Value seed); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StatelessRandomUniformOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StatelessRandomUniformV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StatelessRandomUniformV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StatelessRandomUniformV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StatelessRandomUniformV2OpGenericAdaptorBase(StatelessRandomUniformV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class StatelessRandomUniformV2OpGenericAdaptor : public detail::StatelessRandomUniformV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StatelessRandomUniformV2OpGenericAdaptorBase; +public: + StatelessRandomUniformV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StatelessRandomUniformV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StatelessRandomUniformV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StatelessRandomUniformV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getShape() { + return (*getODSOperands(0).begin()); + } + + ValueT getKey() { + return (*getODSOperands(1).begin()); + } + + ValueT getCounter() { + return (*getODSOperands(2).begin()); + } + + ValueT getAlg() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StatelessRandomUniformV2OpAdaptor : public StatelessRandomUniformV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using StatelessRandomUniformV2OpGenericAdaptor::StatelessRandomUniformV2OpGenericAdaptor; + StatelessRandomUniformV2OpAdaptor(StatelessRandomUniformV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StatelessRandomUniformV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StatelessRandomUniformV2OpAdaptor; + template + using GenericAdaptor = StatelessRandomUniformV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tshape"), ::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTshapeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTshapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StatelessRandomUniformV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::TypedValue<::mlir::TensorType> getKey(); + ::mlir::TypedValue<::mlir::TensorType> getCounter(); + ::mlir::TypedValue<::mlir::TensorType> getAlg(); + ::mlir::OpOperand &getShapeMutable(); + ::mlir::OpOperand &getKeyMutable(); + ::mlir::OpOperand &getCounterMutable(); + ::mlir::OpOperand &getAlgMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getTshape(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, ::mlir::Value key, ::mlir::Value counter, ::mlir::Value alg); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, ::mlir::Value key, ::mlir::Value counter, ::mlir::Value alg); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StatelessRandomUniformV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StatelessTruncatedNormalOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StatelessTruncatedNormalOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StatelessTruncatedNormalOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StatelessTruncatedNormalOpGenericAdaptorBase(StatelessTruncatedNormalOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class StatelessTruncatedNormalOpGenericAdaptor : public detail::StatelessTruncatedNormalOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StatelessTruncatedNormalOpGenericAdaptorBase; +public: + StatelessTruncatedNormalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StatelessTruncatedNormalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StatelessTruncatedNormalOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StatelessTruncatedNormalOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getShape() { + return (*getODSOperands(0).begin()); + } + + ValueT getSeed() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StatelessTruncatedNormalOpAdaptor : public StatelessTruncatedNormalOpGenericAdaptor<::mlir::ValueRange> { +public: + using StatelessTruncatedNormalOpGenericAdaptor::StatelessTruncatedNormalOpGenericAdaptor; + StatelessTruncatedNormalOpAdaptor(StatelessTruncatedNormalOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StatelessTruncatedNormalOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StatelessTruncatedNormalOpAdaptor; + template + using GenericAdaptor = StatelessTruncatedNormalOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tseed"), ::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTseedAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTseedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StatelessTruncatedNormal"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::TypedValue<::mlir::TensorType> getSeed(); + ::mlir::OpOperand &getShapeMutable(); + ::mlir::OpOperand &getSeedMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTseed(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, ::mlir::Value seed); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, ::mlir::Value seed); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StatelessTruncatedNormalOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StatelessTruncatedNormalV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StatelessTruncatedNormalV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StatelessTruncatedNormalV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StatelessTruncatedNormalV2OpGenericAdaptorBase(StatelessTruncatedNormalV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class StatelessTruncatedNormalV2OpGenericAdaptor : public detail::StatelessTruncatedNormalV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StatelessTruncatedNormalV2OpGenericAdaptorBase; +public: + StatelessTruncatedNormalV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StatelessTruncatedNormalV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StatelessTruncatedNormalV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StatelessTruncatedNormalV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getShape() { + return (*getODSOperands(0).begin()); + } + + ValueT getKey() { + return (*getODSOperands(1).begin()); + } + + ValueT getCounter() { + return (*getODSOperands(2).begin()); + } + + ValueT getAlg() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StatelessTruncatedNormalV2OpAdaptor : public StatelessTruncatedNormalV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using StatelessTruncatedNormalV2OpGenericAdaptor::StatelessTruncatedNormalV2OpGenericAdaptor; + StatelessTruncatedNormalV2OpAdaptor(StatelessTruncatedNormalV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StatelessTruncatedNormalV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StatelessTruncatedNormalV2OpAdaptor; + template + using GenericAdaptor = StatelessTruncatedNormalV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tshape"), ::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTshapeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTshapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StatelessTruncatedNormalV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::TypedValue<::mlir::TensorType> getKey(); + ::mlir::TypedValue<::mlir::TensorType> getCounter(); + ::mlir::TypedValue<::mlir::TensorType> getAlg(); + ::mlir::OpOperand &getShapeMutable(); + ::mlir::OpOperand &getKeyMutable(); + ::mlir::OpOperand &getCounterMutable(); + ::mlir::OpOperand &getAlgMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getTshape(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, ::mlir::Value key, ::mlir::Value counter, ::mlir::Value alg); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, ::mlir::Value key, ::mlir::Value counter, ::mlir::Value alg); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StatelessTruncatedNormalV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StaticRegexFullMatchOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StaticRegexFullMatchOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StaticRegexFullMatchOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StaticRegexFullMatchOpGenericAdaptorBase(StaticRegexFullMatchOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getPatternAttr(); + ::llvm::StringRef getPattern(); +}; +} // namespace detail +template +class StaticRegexFullMatchOpGenericAdaptor : public detail::StaticRegexFullMatchOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StaticRegexFullMatchOpGenericAdaptorBase; +public: + StaticRegexFullMatchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StaticRegexFullMatchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StaticRegexFullMatchOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StaticRegexFullMatchOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StaticRegexFullMatchOpAdaptor : public StaticRegexFullMatchOpGenericAdaptor<::mlir::ValueRange> { +public: + using StaticRegexFullMatchOpGenericAdaptor::StaticRegexFullMatchOpGenericAdaptor; + StaticRegexFullMatchOpAdaptor(StaticRegexFullMatchOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StaticRegexFullMatchOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape> { +public: + using Op::Op; + using Op::print; + using Adaptor = StaticRegexFullMatchOpAdaptor; + template + using GenericAdaptor = StaticRegexFullMatchOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("pattern")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getPatternAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getPatternAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StaticRegexFullMatch"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::StringAttr getPatternAttr(); + ::llvm::StringRef getPattern(); + void setPatternAttr(::mlir::StringAttr attr); + void setPattern(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::StringAttr pattern); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::StringAttr pattern); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::llvm::StringRef pattern); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::llvm::StringRef pattern); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StaticRegexFullMatchOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StopGradientOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StopGradientOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StopGradientOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StopGradientOpGenericAdaptorBase(StopGradientOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class StopGradientOpGenericAdaptor : public detail::StopGradientOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StopGradientOpGenericAdaptorBase; +public: + StopGradientOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StopGradientOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StopGradientOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StopGradientOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StopGradientOpAdaptor : public StopGradientOpGenericAdaptor<::mlir::ValueRange> { +public: + using StopGradientOpGenericAdaptor::StopGradientOpGenericAdaptor; + StopGradientOpAdaptor(StopGradientOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StopGradientOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StopGradientOpAdaptor; + template + using GenericAdaptor = StopGradientOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StopGradient"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StopGradientOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StoreMinibatchStatisticsInFdoOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StoreMinibatchStatisticsInFdoOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StoreMinibatchStatisticsInFdoOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StoreMinibatchStatisticsInFdoOpGenericAdaptorBase(StoreMinibatchStatisticsInFdoOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getSampleCountAttr(); + uint64_t getSampleCount(); + ::mlir::IntegerAttr getNumReplicaAttr(); + uint64_t getNumReplica(); + ::mlir::IntegerAttr getFeatureWidthAttr(); + uint64_t getFeatureWidth(); + ::mlir::IntegerAttr getNumScPerChipAttr(); + uint64_t getNumScPerChip(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::StringAttr getMiniBatchSplitsAttr(); + ::llvm::StringRef getMiniBatchSplits(); +}; +} // namespace detail +template +class StoreMinibatchStatisticsInFdoOpGenericAdaptor : public detail::StoreMinibatchStatisticsInFdoOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StoreMinibatchStatisticsInFdoOpGenericAdaptorBase; +public: + StoreMinibatchStatisticsInFdoOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StoreMinibatchStatisticsInFdoOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StoreMinibatchStatisticsInFdoOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StoreMinibatchStatisticsInFdoOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getProgramKey() { + return (*getODSOperands(0).begin()); + } + + ValueT getMaxIds() { + return (*getODSOperands(1).begin()); + } + + ValueT getMaxUniques() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StoreMinibatchStatisticsInFdoOpAdaptor : public StoreMinibatchStatisticsInFdoOpGenericAdaptor<::mlir::ValueRange> { +public: + using StoreMinibatchStatisticsInFdoOpGenericAdaptor::StoreMinibatchStatisticsInFdoOpGenericAdaptor; + StoreMinibatchStatisticsInFdoOpAdaptor(StoreMinibatchStatisticsInFdoOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StoreMinibatchStatisticsInFdoOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StoreMinibatchStatisticsInFdoOpAdaptor; + template + using GenericAdaptor = StoreMinibatchStatisticsInFdoOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("feature_width"), ::llvm::StringRef("mini_batch_splits"), ::llvm::StringRef("num_replica"), ::llvm::StringRef("num_sc_per_chip"), ::llvm::StringRef("sample_count"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFeatureWidthAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFeatureWidthAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getMiniBatchSplitsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getMiniBatchSplitsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getNumReplicaAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getNumReplicaAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getNumScPerChipAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getNumScPerChipAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getSampleCountAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getSampleCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StoreMinibatchStatisticsInFdo"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getProgramKey(); + ::mlir::TypedValue<::mlir::TensorType> getMaxIds(); + ::mlir::TypedValue<::mlir::TensorType> getMaxUniques(); + ::mlir::OpOperand &getProgramKeyMutable(); + ::mlir::OpOperand &getMaxIdsMutable(); + ::mlir::OpOperand &getMaxUniquesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getSampleCountAttr(); + uint64_t getSampleCount(); + ::mlir::IntegerAttr getNumReplicaAttr(); + uint64_t getNumReplica(); + ::mlir::IntegerAttr getFeatureWidthAttr(); + uint64_t getFeatureWidth(); + ::mlir::IntegerAttr getNumScPerChipAttr(); + uint64_t getNumScPerChip(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + ::mlir::StringAttr getMiniBatchSplitsAttr(); + ::llvm::StringRef getMiniBatchSplits(); + void setSampleCountAttr(::mlir::IntegerAttr attr); + void setSampleCount(uint64_t attrValue); + void setNumReplicaAttr(::mlir::IntegerAttr attr); + void setNumReplica(uint64_t attrValue); + void setFeatureWidthAttr(::mlir::IntegerAttr attr); + void setFeatureWidth(uint64_t attrValue); + void setNumScPerChipAttr(::mlir::IntegerAttr attr); + void setNumScPerChip(uint64_t attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::llvm::StringRef attrValue); + void setMiniBatchSplitsAttr(::mlir::StringAttr attr); + void setMiniBatchSplits(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value program_key, ::mlir::Value max_ids, ::mlir::Value max_uniques, ::mlir::IntegerAttr sample_count, ::mlir::IntegerAttr num_replica, ::mlir::IntegerAttr feature_width, ::mlir::IntegerAttr num_sc_per_chip, ::mlir::StringAttr table_name, ::mlir::StringAttr mini_batch_splits); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value program_key, ::mlir::Value max_ids, ::mlir::Value max_uniques, ::mlir::IntegerAttr sample_count, ::mlir::IntegerAttr num_replica, ::mlir::IntegerAttr feature_width, ::mlir::IntegerAttr num_sc_per_chip, ::mlir::StringAttr table_name, ::mlir::StringAttr mini_batch_splits); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value program_key, ::mlir::Value max_ids, ::mlir::Value max_uniques, uint64_t sample_count, uint64_t num_replica, uint64_t feature_width, uint64_t num_sc_per_chip, ::llvm::StringRef table_name, ::llvm::StringRef mini_batch_splits); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value program_key, ::mlir::Value max_ids, ::mlir::Value max_uniques, uint64_t sample_count, uint64_t num_replica, uint64_t feature_width, uint64_t num_sc_per_chip, ::llvm::StringRef table_name, ::llvm::StringRef mini_batch_splits); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StoreMinibatchStatisticsInFdoOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StridedSliceGradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StridedSliceGradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StridedSliceGradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StridedSliceGradOpGenericAdaptorBase(StridedSliceGradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getBeginMaskAttr(); + uint64_t getBeginMask(); + ::mlir::IntegerAttr getEndMaskAttr(); + uint64_t getEndMask(); + ::mlir::IntegerAttr getEllipsisMaskAttr(); + uint64_t getEllipsisMask(); + ::mlir::IntegerAttr getNewAxisMaskAttr(); + uint64_t getNewAxisMask(); + ::mlir::IntegerAttr getShrinkAxisMaskAttr(); + uint64_t getShrinkAxisMask(); +}; +} // namespace detail +template +class StridedSliceGradOpGenericAdaptor : public detail::StridedSliceGradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StridedSliceGradOpGenericAdaptorBase; +public: + StridedSliceGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StridedSliceGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StridedSliceGradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StridedSliceGradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getShape() { + return (*getODSOperands(0).begin()); + } + + ValueT getBegin() { + return (*getODSOperands(1).begin()); + } + + ValueT getEnd() { + return (*getODSOperands(2).begin()); + } + + ValueT getStrides() { + return (*getODSOperands(3).begin()); + } + + ValueT getDy() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StridedSliceGradOpAdaptor : public StridedSliceGradOpGenericAdaptor<::mlir::ValueRange> { +public: + using StridedSliceGradOpGenericAdaptor::StridedSliceGradOpGenericAdaptor; + StridedSliceGradOpAdaptor(StridedSliceGradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StridedSliceGradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<5>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StridedSliceGradOpAdaptor; + template + using GenericAdaptor = StridedSliceGradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Index"), ::llvm::StringRef("T"), ::llvm::StringRef("begin_mask"), ::llvm::StringRef("ellipsis_mask"), ::llvm::StringRef("end_mask"), ::llvm::StringRef("new_axis_mask"), ::llvm::StringRef("shrink_axis_mask")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getIndexAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getIndexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getBeginMaskAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getBeginMaskAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getEllipsisMaskAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getEllipsisMaskAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getEndMaskAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getEndMaskAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getNewAxisMaskAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getNewAxisMaskAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getShrinkAxisMaskAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getShrinkAxisMaskAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StridedSliceGrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::TypedValue<::mlir::TensorType> getBegin(); + ::mlir::TypedValue<::mlir::TensorType> getEnd(); + ::mlir::TypedValue<::mlir::TensorType> getStrides(); + ::mlir::TypedValue<::mlir::TensorType> getDy(); + ::mlir::OpOperand &getShapeMutable(); + ::mlir::OpOperand &getBeginMutable(); + ::mlir::OpOperand &getEndMutable(); + ::mlir::OpOperand &getStridesMutable(); + ::mlir::OpOperand &getDyMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getBeginMaskAttr(); + uint64_t getBeginMask(); + ::mlir::IntegerAttr getEndMaskAttr(); + uint64_t getEndMask(); + ::mlir::IntegerAttr getEllipsisMaskAttr(); + uint64_t getEllipsisMask(); + ::mlir::IntegerAttr getNewAxisMaskAttr(); + uint64_t getNewAxisMask(); + ::mlir::IntegerAttr getShrinkAxisMaskAttr(); + uint64_t getShrinkAxisMask(); + ::mlir::Type getIndex(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setBeginMaskAttr(::mlir::IntegerAttr attr); + void setBeginMask(::std::optional attrValue); + void setEndMaskAttr(::mlir::IntegerAttr attr); + void setEndMask(::std::optional attrValue); + void setEllipsisMaskAttr(::mlir::IntegerAttr attr); + void setEllipsisMask(::std::optional attrValue); + void setNewAxisMaskAttr(::mlir::IntegerAttr attr); + void setNewAxisMask(::std::optional attrValue); + void setShrinkAxisMaskAttr(::mlir::IntegerAttr attr); + void setShrinkAxisMask(::std::optional attrValue); + ::mlir::Attribute removeBeginMaskAttr(); + ::mlir::Attribute removeEndMaskAttr(); + ::mlir::Attribute removeEllipsisMaskAttr(); + ::mlir::Attribute removeNewAxisMaskAttr(); + ::mlir::Attribute removeShrinkAxisMaskAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, ::mlir::Value begin, ::mlir::Value end, ::mlir::Value strides, ::mlir::Value dy, /*optional*/::mlir::IntegerAttr begin_mask, /*optional*/::mlir::IntegerAttr end_mask, /*optional*/::mlir::IntegerAttr ellipsis_mask, /*optional*/::mlir::IntegerAttr new_axis_mask, /*optional*/::mlir::IntegerAttr shrink_axis_mask); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, ::mlir::Value begin, ::mlir::Value end, ::mlir::Value strides, ::mlir::Value dy, /*optional*/::mlir::IntegerAttr begin_mask, /*optional*/::mlir::IntegerAttr end_mask, /*optional*/::mlir::IntegerAttr ellipsis_mask, /*optional*/::mlir::IntegerAttr new_axis_mask, /*optional*/::mlir::IntegerAttr shrink_axis_mask); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, ::mlir::Value begin, ::mlir::Value end, ::mlir::Value strides, ::mlir::Value dy, /*optional*/uint64_t begin_mask = 0, /*optional*/uint64_t end_mask = 0, /*optional*/uint64_t ellipsis_mask = 0, /*optional*/uint64_t new_axis_mask = 0, /*optional*/uint64_t shrink_axis_mask = 0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, ::mlir::Value begin, ::mlir::Value end, ::mlir::Value strides, ::mlir::Value dy, /*optional*/uint64_t begin_mask = 0, /*optional*/uint64_t end_mask = 0, /*optional*/uint64_t ellipsis_mask = 0, /*optional*/uint64_t new_axis_mask = 0, /*optional*/uint64_t shrink_axis_mask = 0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 7 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // If sliced shape is able to be deduced, returns true, updates `shape` + // with the final shape after performing StridedSlice, and updates + // `begin_indices`, `end_indices`, and `strides` with their canonical + // values, respectively. + bool GetSlicedShapeAndBoundRanges( + ::llvm::SmallVectorImpl *input_shape, + ::llvm::SmallVectorImpl *slice_begin, + ::llvm::SmallVectorImpl *slice_end, + ::llvm::SmallVectorImpl *slice_stride); +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StridedSliceGradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StridedSliceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StridedSliceOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StridedSliceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StridedSliceOpGenericAdaptorBase(StridedSliceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getBeginMaskAttr(); + uint64_t getBeginMask(); + ::mlir::IntegerAttr getEndMaskAttr(); + uint64_t getEndMask(); + ::mlir::IntegerAttr getEllipsisMaskAttr(); + uint64_t getEllipsisMask(); + ::mlir::IntegerAttr getNewAxisMaskAttr(); + uint64_t getNewAxisMask(); + ::mlir::IntegerAttr getShrinkAxisMaskAttr(); + uint64_t getShrinkAxisMask(); +}; +} // namespace detail +template +class StridedSliceOpGenericAdaptor : public detail::StridedSliceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StridedSliceOpGenericAdaptorBase; +public: + StridedSliceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StridedSliceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StridedSliceOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StridedSliceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getBegin() { + return (*getODSOperands(1).begin()); + } + + ValueT getEnd() { + return (*getODSOperands(2).begin()); + } + + ValueT getStrides() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StridedSliceOpAdaptor : public StridedSliceOpGenericAdaptor<::mlir::ValueRange> { +public: + using StridedSliceOpGenericAdaptor::StridedSliceOpGenericAdaptor; + StridedSliceOpAdaptor(StridedSliceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StridedSliceOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StridedSliceOpAdaptor; + template + using GenericAdaptor = StridedSliceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Index"), ::llvm::StringRef("T"), ::llvm::StringRef("begin_mask"), ::llvm::StringRef("ellipsis_mask"), ::llvm::StringRef("end_mask"), ::llvm::StringRef("new_axis_mask"), ::llvm::StringRef("shrink_axis_mask")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getIndexAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getIndexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getBeginMaskAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getBeginMaskAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getEllipsisMaskAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getEllipsisMaskAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getEndMaskAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getEndMaskAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getNewAxisMaskAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getNewAxisMaskAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getShrinkAxisMaskAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getShrinkAxisMaskAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StridedSlice"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getBegin(); + ::mlir::TypedValue<::mlir::TensorType> getEnd(); + ::mlir::TypedValue<::mlir::TensorType> getStrides(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getBeginMutable(); + ::mlir::OpOperand &getEndMutable(); + ::mlir::OpOperand &getStridesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getBeginMaskAttr(); + uint64_t getBeginMask(); + ::mlir::IntegerAttr getEndMaskAttr(); + uint64_t getEndMask(); + ::mlir::IntegerAttr getEllipsisMaskAttr(); + uint64_t getEllipsisMask(); + ::mlir::IntegerAttr getNewAxisMaskAttr(); + uint64_t getNewAxisMask(); + ::mlir::IntegerAttr getShrinkAxisMaskAttr(); + uint64_t getShrinkAxisMask(); + ::mlir::Type getIndex(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setBeginMaskAttr(::mlir::IntegerAttr attr); + void setBeginMask(::std::optional attrValue); + void setEndMaskAttr(::mlir::IntegerAttr attr); + void setEndMask(::std::optional attrValue); + void setEllipsisMaskAttr(::mlir::IntegerAttr attr); + void setEllipsisMask(::std::optional attrValue); + void setNewAxisMaskAttr(::mlir::IntegerAttr attr); + void setNewAxisMask(::std::optional attrValue); + void setShrinkAxisMaskAttr(::mlir::IntegerAttr attr); + void setShrinkAxisMask(::std::optional attrValue); + ::mlir::Attribute removeBeginMaskAttr(); + ::mlir::Attribute removeEndMaskAttr(); + ::mlir::Attribute removeEllipsisMaskAttr(); + ::mlir::Attribute removeNewAxisMaskAttr(); + ::mlir::Attribute removeShrinkAxisMaskAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value begin, ::mlir::Value end, ::mlir::Value strides, /*optional*/::mlir::IntegerAttr begin_mask, /*optional*/::mlir::IntegerAttr end_mask, /*optional*/::mlir::IntegerAttr ellipsis_mask, /*optional*/::mlir::IntegerAttr new_axis_mask, /*optional*/::mlir::IntegerAttr shrink_axis_mask); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value begin, ::mlir::Value end, ::mlir::Value strides, /*optional*/::mlir::IntegerAttr begin_mask, /*optional*/::mlir::IntegerAttr end_mask, /*optional*/::mlir::IntegerAttr ellipsis_mask, /*optional*/::mlir::IntegerAttr new_axis_mask, /*optional*/::mlir::IntegerAttr shrink_axis_mask); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value begin, ::mlir::Value end, ::mlir::Value strides, /*optional*/uint64_t begin_mask = 0, /*optional*/uint64_t end_mask = 0, /*optional*/uint64_t ellipsis_mask = 0, /*optional*/uint64_t new_axis_mask = 0, /*optional*/uint64_t shrink_axis_mask = 0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value begin, ::mlir::Value end, ::mlir::Value strides, /*optional*/uint64_t begin_mask = 0, /*optional*/uint64_t end_mask = 0, /*optional*/uint64_t ellipsis_mask = 0, /*optional*/uint64_t new_axis_mask = 0, /*optional*/uint64_t shrink_axis_mask = 0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 7 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // If sliced shape is able to be deduced, returns true, updates + // `begin_indices`, `end_indices`, and `strides` with their canonical + // values, respectively. + bool GetSlicedBoundRanges( + ::llvm::SmallVectorImpl *slice_begin, + ::llvm::SmallVectorImpl *slice_end, + ::llvm::SmallVectorImpl *slice_stride); +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StridedSliceOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StringFormatOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StringFormatOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StringFormatOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StringFormatOpGenericAdaptorBase(StringFormatOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getStrtemplateAttr(); + ::llvm::StringRef getStrtemplate(); + ::mlir::StringAttr getPlaceholderAttr(); + ::llvm::StringRef getPlaceholder(); + ::mlir::IntegerAttr getSummarizeAttr(); + uint64_t getSummarize(); +}; +} // namespace detail +template +class StringFormatOpGenericAdaptor : public detail::StringFormatOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StringFormatOpGenericAdaptorBase; +public: + StringFormatOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StringFormatOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StringFormatOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StringFormatOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StringFormatOpAdaptor : public StringFormatOpGenericAdaptor<::mlir::ValueRange> { +public: + using StringFormatOpGenericAdaptor::StringFormatOpGenericAdaptor; + StringFormatOpAdaptor(StringFormatOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StringFormatOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StringFormatOpAdaptor; + template + using GenericAdaptor = StringFormatOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("placeholder"), ::llvm::StringRef("strtemplate"), ::llvm::StringRef("summarize")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getPlaceholderAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getPlaceholderAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getStrtemplateAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getStrtemplateAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSummarizeAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSummarizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StringFormat"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::MutableOperandRange getInputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::StringAttr getStrtemplateAttr(); + ::llvm::StringRef getStrtemplate(); + ::mlir::StringAttr getPlaceholderAttr(); + ::llvm::StringRef getPlaceholder(); + ::mlir::IntegerAttr getSummarizeAttr(); + uint64_t getSummarize(); + mlir::OperandElementTypeRange getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setStrtemplateAttr(::mlir::StringAttr attr); + void setStrtemplate(::llvm::StringRef attrValue); + void setPlaceholderAttr(::mlir::StringAttr attr); + void setPlaceholder(::llvm::StringRef attrValue); + void setSummarizeAttr(::mlir::IntegerAttr attr); + void setSummarize(::std::optional attrValue); + ::mlir::Attribute removeSummarizeAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::ValueRange inputs, ::mlir::StringAttr strtemplate, ::mlir::StringAttr placeholder, /*optional*/::mlir::IntegerAttr summarize); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::mlir::StringAttr strtemplate, ::mlir::StringAttr placeholder, /*optional*/::mlir::IntegerAttr summarize); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::ValueRange inputs, ::llvm::StringRef strtemplate = "%s", ::llvm::StringRef placeholder = "%s", /*optional*/uint64_t summarize = 3); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::llvm::StringRef strtemplate = "%s", ::llvm::StringRef placeholder = "%s", /*optional*/uint64_t summarize = 3); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultAttrs(const ::mlir::OperationName &opName, ::mlir::NamedAttrList &attributes); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StringFormatOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StringJoinOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StringJoinOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StringJoinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StringJoinOpGenericAdaptorBase(StringJoinOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getSeparatorAttr(); + ::llvm::StringRef getSeparator(); +}; +} // namespace detail +template +class StringJoinOpGenericAdaptor : public detail::StringJoinOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StringJoinOpGenericAdaptorBase; +public: + StringJoinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StringJoinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StringJoinOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StringJoinOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StringJoinOpAdaptor : public StringJoinOpGenericAdaptor<::mlir::ValueRange> { +public: + using StringJoinOpGenericAdaptor::StringJoinOpGenericAdaptor; + StringJoinOpAdaptor(StringJoinOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StringJoinOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StringJoinOpAdaptor; + template + using GenericAdaptor = StringJoinOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("N"), ::llvm::StringRef("separator")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getSeparatorAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getSeparatorAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StringJoin"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::MutableOperandRange getInputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::StringAttr getSeparatorAttr(); + ::llvm::StringRef getSeparator(); + size_t getN(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setSeparatorAttr(::mlir::StringAttr attr); + void setSeparator(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeSeparatorAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::ValueRange inputs, /*optional*/::mlir::StringAttr separator); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, /*optional*/::mlir::StringAttr separator); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::ValueRange inputs, /*optional*/::llvm::StringRef separator = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, /*optional*/::llvm::StringRef separator = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StringJoinOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StringStripOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StringStripOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StringStripOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StringStripOpGenericAdaptorBase(StringStripOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class StringStripOpGenericAdaptor : public detail::StringStripOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StringStripOpGenericAdaptorBase; +public: + StringStripOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StringStripOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StringStripOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StringStripOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StringStripOpAdaptor : public StringStripOpGenericAdaptor<::mlir::ValueRange> { +public: + using StringStripOpGenericAdaptor::StringStripOpGenericAdaptor; + StringStripOpAdaptor(StringStripOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StringStripOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef> { +public: + using Op::Op; + using Op::print; + using Adaptor = StringStripOpAdaptor; + template + using GenericAdaptor = StringStripOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StringStrip"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StringStripOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::StringToHashBucketFastOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StringToHashBucketFastOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StringToHashBucketFastOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StringToHashBucketFastOpGenericAdaptorBase(StringToHashBucketFastOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getNumBucketsAttr(); + uint64_t getNumBuckets(); +}; +} // namespace detail +template +class StringToHashBucketFastOpGenericAdaptor : public detail::StringToHashBucketFastOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StringToHashBucketFastOpGenericAdaptorBase; +public: + StringToHashBucketFastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StringToHashBucketFastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StringToHashBucketFastOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StringToHashBucketFastOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StringToHashBucketFastOpAdaptor : public StringToHashBucketFastOpGenericAdaptor<::mlir::ValueRange> { +public: + using StringToHashBucketFastOpGenericAdaptor::StringToHashBucketFastOpGenericAdaptor; + StringToHashBucketFastOpAdaptor(StringToHashBucketFastOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StringToHashBucketFastOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StringToHashBucketFastOpAdaptor; + template + using GenericAdaptor = StringToHashBucketFastOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("num_buckets")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNumBucketsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNumBucketsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.StringToHashBucketFast"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getNumBucketsAttr(); + uint64_t getNumBuckets(); + void setNumBucketsAttr(::mlir::IntegerAttr attr); + void setNumBuckets(uint64_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::IntegerAttr num_buckets); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::IntegerAttr num_buckets); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, uint64_t num_buckets); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, uint64_t num_buckets); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::StringToHashBucketFastOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SubOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SubOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SubOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SubOpGenericAdaptorBase(SubOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SubOpGenericAdaptor : public detail::SubOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SubOpGenericAdaptorBase; +public: + SubOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SubOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SubOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SubOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SubOpAdaptor : public SubOpGenericAdaptor<::mlir::ValueRange> { +public: + using SubOpGenericAdaptor::SubOpGenericAdaptor; + SubOpAdaptor(SubOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SubOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::OpTrait::TF::CwiseBinary, ::mlir::OpTrait::TF::SameOperandsAndResultElementTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SubOpAdaptor; + template + using GenericAdaptor = SubOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Sub"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SubOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SumOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SumOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SumOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SumOpGenericAdaptorBase(SumOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getKeepDimsAttr(); + bool getKeepDims(); +}; +} // namespace detail +template +class SumOpGenericAdaptor : public detail::SumOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SumOpGenericAdaptorBase; +public: + SumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SumOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SumOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getReductionIndices() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SumOpAdaptor : public SumOpGenericAdaptor<::mlir::ValueRange> { +public: + using SumOpGenericAdaptor::SumOpGenericAdaptor; + SumOpAdaptor(SumOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SumOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SumOpAdaptor; + template + using GenericAdaptor = SumOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tidx"), ::llvm::StringRef("keep_dims")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTidxAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTidxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getKeepDimsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getKeepDimsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Sum"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getReductionIndices(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getReductionIndicesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getKeepDimsAttr(); + bool getKeepDims(); + ::mlir::Type getT(); + ::mlir::Type getTidx(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setKeepDimsAttr(::mlir::BoolAttr attr); + void setKeepDims(::std::optional attrValue); + ::mlir::Attribute removeKeepDimsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value input, Value reduction_indices, BoolAttr keep_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value reduction_indices, /*optional*/::mlir::BoolAttr keep_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value reduction_indices, /*optional*/::mlir::BoolAttr keep_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value reduction_indices, /*optional*/bool keep_dims = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value reduction_indices, /*optional*/bool keep_dims = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SumOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SummaryWriterOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SummaryWriterOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SummaryWriterOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SummaryWriterOpGenericAdaptorBase(SummaryWriterOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getSharedNameAttr(); + ::llvm::StringRef getSharedName(); + ::mlir::StringAttr getContainerAttr(); + ::llvm::StringRef getContainer(); +}; +} // namespace detail +template +class SummaryWriterOpGenericAdaptor : public detail::SummaryWriterOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SummaryWriterOpGenericAdaptorBase; +public: + SummaryWriterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SummaryWriterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SummaryWriterOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SummaryWriterOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SummaryWriterOpAdaptor : public SummaryWriterOpGenericAdaptor<::mlir::ValueRange> { +public: + using SummaryWriterOpGenericAdaptor::SummaryWriterOpGenericAdaptor; + SummaryWriterOpAdaptor(SummaryWriterOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SummaryWriterOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ResourceHandleAllocatorInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SummaryWriterOpAdaptor; + template + using GenericAdaptor = SummaryWriterOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("container"), ::llvm::StringRef("shared_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getContainerAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getContainerAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getSharedNameAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getSharedNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SummaryWriter"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getWriter(); + ::mlir::StringAttr getSharedNameAttr(); + ::llvm::StringRef getSharedName(); + ::mlir::StringAttr getContainerAttr(); + ::llvm::StringRef getContainer(); + void setSharedNameAttr(::mlir::StringAttr attr); + void setSharedName(::llvm::StringRef attrValue); + void setContainerAttr(::mlir::StringAttr attr); + void setContainer(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type writer, ::mlir::StringAttr shared_name, ::mlir::StringAttr container); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr shared_name, ::mlir::StringAttr container); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type writer, ::llvm::StringRef shared_name, ::llvm::StringRef container); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef shared_name, ::llvm::StringRef container); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + llvm::SmallVector GetResourceHandleValueAndIdList(llvm::SmallDenseMap&resource_handle_id_map, int64_t&next_id); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SummaryWriterOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SvdOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SvdOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SvdOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SvdOpGenericAdaptorBase(SvdOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getComputeUvAttr(); + bool getComputeUv(); + ::mlir::BoolAttr getFullMatricesAttr(); + bool getFullMatrices(); +}; +} // namespace detail +template +class SvdOpGenericAdaptor : public detail::SvdOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SvdOpGenericAdaptorBase; +public: + SvdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SvdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SvdOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SvdOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SvdOpAdaptor : public SvdOpGenericAdaptor<::mlir::ValueRange> { +public: + using SvdOpGenericAdaptor::SvdOpGenericAdaptor; + SvdOpAdaptor(SvdOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SvdOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SvdOpAdaptor; + template + using GenericAdaptor = SvdOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("compute_uv"), ::llvm::StringRef("full_matrices")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getComputeUvAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getComputeUvAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getFullMatricesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getFullMatricesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Svd"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getS(); + ::mlir::TypedValue<::mlir::TensorType> getU(); + ::mlir::TypedValue<::mlir::TensorType> getV(); + ::mlir::BoolAttr getComputeUvAttr(); + bool getComputeUv(); + ::mlir::BoolAttr getFullMatricesAttr(); + bool getFullMatrices(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setComputeUvAttr(::mlir::BoolAttr attr); + void setComputeUv(::std::optional attrValue); + void setFullMatricesAttr(::mlir::BoolAttr attr); + void setFullMatrices(::std::optional attrValue); + ::mlir::Attribute removeComputeUvAttr(); + ::mlir::Attribute removeFullMatricesAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type s, ::mlir::Type u, ::mlir::Type v, ::mlir::Value input, /*optional*/::mlir::BoolAttr compute_uv, /*optional*/::mlir::BoolAttr full_matrices); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, /*optional*/::mlir::BoolAttr compute_uv, /*optional*/::mlir::BoolAttr full_matrices); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type s, ::mlir::Type u, ::mlir::Type v, ::mlir::Value input, /*optional*/bool compute_uv = true, /*optional*/bool full_matrices = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, /*optional*/bool compute_uv = true, /*optional*/bool full_matrices = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SvdOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::SymbolicGradientOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SymbolicGradientOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SymbolicGradientOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SymbolicGradientOpGenericAdaptorBase(SymbolicGradientOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::SymbolRefAttr getFAttr(); + ::mlir::SymbolRefAttr getF(); +}; +} // namespace detail +template +class SymbolicGradientOpGenericAdaptor : public detail::SymbolicGradientOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SymbolicGradientOpGenericAdaptorBase; +public: + SymbolicGradientOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SymbolicGradientOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SymbolicGradientOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SymbolicGradientOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInput() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SymbolicGradientOpAdaptor : public SymbolicGradientOpGenericAdaptor<::mlir::ValueRange> { +public: + using SymbolicGradientOpGenericAdaptor::SymbolicGradientOpGenericAdaptor; + SymbolicGradientOpAdaptor(SymbolicGradientOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SymbolicGradientOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = SymbolicGradientOpAdaptor; + template + using GenericAdaptor = SymbolicGradientOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tin"), ::llvm::StringRef("Tout"), ::llvm::StringRef("f")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTinAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTinAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getToutAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getToutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getFAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getFAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.SymbolicGradient"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInput(); + ::mlir::MutableOperandRange getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutput(); + ::mlir::SymbolRefAttr getFAttr(); + ::mlir::SymbolRefAttr getF(); + mlir::OperandElementTypeRange getTin(); + mlir::ResultElementTypeRange getTout(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setFAttr(::mlir::SymbolRefAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::ValueRange input, ::mlir::SymbolRefAttr f); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::SymbolicGradientOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TPUAnnotateTensorsWithDynamicShapeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TPUAnnotateTensorsWithDynamicShapeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TPUAnnotateTensorsWithDynamicShapeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TPUAnnotateTensorsWithDynamicShapeOpGenericAdaptorBase(TPUAnnotateTensorsWithDynamicShapeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TPUAnnotateTensorsWithDynamicShapeOpGenericAdaptor : public detail::TPUAnnotateTensorsWithDynamicShapeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TPUAnnotateTensorsWithDynamicShapeOpGenericAdaptorBase; +public: + TPUAnnotateTensorsWithDynamicShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TPUAnnotateTensorsWithDynamicShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TPUAnnotateTensorsWithDynamicShapeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TPUAnnotateTensorsWithDynamicShapeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getTensors() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TPUAnnotateTensorsWithDynamicShapeOpAdaptor : public TPUAnnotateTensorsWithDynamicShapeOpGenericAdaptor<::mlir::ValueRange> { +public: + using TPUAnnotateTensorsWithDynamicShapeOpGenericAdaptor::TPUAnnotateTensorsWithDynamicShapeOpGenericAdaptor; + TPUAnnotateTensorsWithDynamicShapeOpAdaptor(TPUAnnotateTensorsWithDynamicShapeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TPUAnnotateTensorsWithDynamicShapeOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = TPUAnnotateTensorsWithDynamicShapeOpAdaptor; + template + using GenericAdaptor = TPUAnnotateTensorsWithDynamicShapeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TPUAnnotateTensorsWithDynamicShape"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getTensors(); + ::mlir::MutableOperandRange getTensorsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getTpuTensors(); + mlir::OperandElementTypeRange getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TPUAnnotateTensorsWithDynamicShapeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TPUCompilationResultOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TPUCompilationResultOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TPUCompilationResultOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TPUCompilationResultOpGenericAdaptorBase(TPUCompilationResultOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TPUCompilationResultOpGenericAdaptor : public detail::TPUCompilationResultOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TPUCompilationResultOpGenericAdaptorBase; +public: + TPUCompilationResultOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TPUCompilationResultOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TPUCompilationResultOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TPUCompilationResultOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TPUCompilationResultOpAdaptor : public TPUCompilationResultOpGenericAdaptor<::mlir::ValueRange> { +public: + using TPUCompilationResultOpGenericAdaptor::TPUCompilationResultOpGenericAdaptor; + TPUCompilationResultOpAdaptor(TPUCompilationResultOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TPUCompilationResultOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TPUCompilationResultOpAdaptor; + template + using GenericAdaptor = TPUCompilationResultOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TPUCompilationResult"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TPUCompilationResultOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TPUCompileMlirAndExecuteOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TPUCompileMlirAndExecuteOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TPUCompileMlirAndExecuteOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TPUCompileMlirAndExecuteOpGenericAdaptorBase(TPUCompileMlirAndExecuteOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getOperandsWithStaticShapeAttr(); + ::std::optional< ::mlir::ArrayAttr > getOperandsWithStaticShape(); + ::mlir::StringAttr getMlirModuleAttr(); + ::llvm::StringRef getMlirModule(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); + ::mlir::StringAttr getProducerNameAttr(); + ::llvm::StringRef getProducerName(); +}; +} // namespace detail +template +class TPUCompileMlirAndExecuteOpGenericAdaptor : public detail::TPUCompileMlirAndExecuteOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TPUCompileMlirAndExecuteOpGenericAdaptorBase; +public: + TPUCompileMlirAndExecuteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TPUCompileMlirAndExecuteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TPUCompileMlirAndExecuteOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TPUCompileMlirAndExecuteOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getStaticShapes() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TPUCompileMlirAndExecuteOpAdaptor : public TPUCompileMlirAndExecuteOpGenericAdaptor<::mlir::ValueRange> { +public: + using TPUCompileMlirAndExecuteOpGenericAdaptor::TPUCompileMlirAndExecuteOpGenericAdaptor; + TPUCompileMlirAndExecuteOpAdaptor(TPUCompileMlirAndExecuteOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TPUCompileMlirAndExecuteOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TPUCompileMlirAndExecuteOpAdaptor; + template + using GenericAdaptor = TPUCompileMlirAndExecuteOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Targs"), ::llvm::StringRef("Tresults"), ::llvm::StringRef("metadata"), ::llvm::StringRef("mlir_module"), ::llvm::StringRef("operandSegmentSizes"), ::llvm::StringRef("operands_with_static_shape"), ::llvm::StringRef("producer_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTargsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTargsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTresultsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTresultsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getMetadataAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getMetadataAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getMlirModuleAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getMlirModuleAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getOperandsWithStaticShapeAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getOperandsWithStaticShapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getProducerNameAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getProducerNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TPUCompileMlirAndExecute"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::Operation::operand_range getStaticShapes(); + ::mlir::MutableOperandRange getArgsMutable(); + ::mlir::MutableOperandRange getStaticShapesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getRendezvousKeyBase(); + ::mlir::Operation::result_range getResults(); + ::mlir::ArrayAttr getOperandsWithStaticShapeAttr(); + ::std::optional< ::mlir::ArrayAttr > getOperandsWithStaticShape(); + ::mlir::StringAttr getMlirModuleAttr(); + ::llvm::StringRef getMlirModule(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); + ::mlir::StringAttr getProducerNameAttr(); + ::llvm::StringRef getProducerName(); + mlir::OperandElementTypeRange getTargs(); + mlir::ResultElementTypeRange getTresults(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setOperandsWithStaticShapeAttr(::mlir::ArrayAttr attr); + void setMlirModuleAttr(::mlir::StringAttr attr); + void setMlirModule(::llvm::StringRef attrValue); + void setMetadataAttr(::mlir::StringAttr attr); + void setMetadata(::llvm::StringRef attrValue); + void setProducerNameAttr(::mlir::StringAttr attr); + void setProducerName(::llvm::StringRef attrValue); + ::mlir::Attribute removeOperandsWithStaticShapeAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type rendezvous_key_base, ::mlir::TypeRange results, ::mlir::ValueRange args, ::mlir::ValueRange static_shapes, /*optional*/::mlir::ArrayAttr operands_with_static_shape, ::mlir::StringAttr mlir_module, ::mlir::StringAttr metadata, ::mlir::StringAttr producer_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange args, ::mlir::ValueRange static_shapes, /*optional*/::mlir::ArrayAttr operands_with_static_shape, ::mlir::StringAttr mlir_module, ::mlir::StringAttr metadata, ::mlir::StringAttr producer_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type rendezvous_key_base, ::mlir::TypeRange results, ::mlir::ValueRange args, ::mlir::ValueRange static_shapes, /*optional*/::mlir::ArrayAttr operands_with_static_shape, ::llvm::StringRef mlir_module, ::llvm::StringRef metadata, ::llvm::StringRef producer_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange args, ::mlir::ValueRange static_shapes, /*optional*/::mlir::ArrayAttr operands_with_static_shape, ::llvm::StringRef mlir_module, ::llvm::StringRef metadata, ::llvm::StringRef producer_name); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultAttrs(const ::mlir::OperationName &opName, ::mlir::NamedAttrList &attributes); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 7 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TPUCompileMlirAndExecuteOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TPUCompileSucceededAssertOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TPUCompileSucceededAssertOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TPUCompileSucceededAssertOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TPUCompileSucceededAssertOpGenericAdaptorBase(TPUCompileSucceededAssertOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TPUCompileSucceededAssertOpGenericAdaptor : public detail::TPUCompileSucceededAssertOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TPUCompileSucceededAssertOpGenericAdaptorBase; +public: + TPUCompileSucceededAssertOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TPUCompileSucceededAssertOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TPUCompileSucceededAssertOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TPUCompileSucceededAssertOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getCompilationStatus() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TPUCompileSucceededAssertOpAdaptor : public TPUCompileSucceededAssertOpGenericAdaptor<::mlir::ValueRange> { +public: + using TPUCompileSucceededAssertOpGenericAdaptor::TPUCompileSucceededAssertOpGenericAdaptor; + TPUCompileSucceededAssertOpAdaptor(TPUCompileSucceededAssertOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TPUCompileSucceededAssertOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = TPUCompileSucceededAssertOpAdaptor; + template + using GenericAdaptor = TPUCompileSucceededAssertOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TPUCompileSucceededAssert"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getCompilationStatus(); + ::mlir::OpOperand &getCompilationStatusMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value compilation_status); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value compilation_status); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TPUCompileSucceededAssertOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TPUCopyWithDynamicShapeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TPUCopyWithDynamicShapeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TPUCopyWithDynamicShapeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TPUCopyWithDynamicShapeOpGenericAdaptorBase(TPUCopyWithDynamicShapeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TPUCopyWithDynamicShapeOpGenericAdaptor : public detail::TPUCopyWithDynamicShapeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TPUCopyWithDynamicShapeOpGenericAdaptorBase; +public: + TPUCopyWithDynamicShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TPUCopyWithDynamicShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TPUCopyWithDynamicShapeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TPUCopyWithDynamicShapeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getTensors() { + return getODSOperands(0); + } + + RangeT getUnpaddedSizes() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TPUCopyWithDynamicShapeOpAdaptor : public TPUCopyWithDynamicShapeOpGenericAdaptor<::mlir::ValueRange> { +public: + using TPUCopyWithDynamicShapeOpGenericAdaptor::TPUCopyWithDynamicShapeOpGenericAdaptor; + TPUCopyWithDynamicShapeOpAdaptor(TPUCopyWithDynamicShapeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TPUCopyWithDynamicShapeOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = TPUCopyWithDynamicShapeOpAdaptor; + template + using GenericAdaptor = TPUCopyWithDynamicShapeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("N"), ::llvm::StringRef("T"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TPUCopyWithDynamicShape"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getTensors(); + ::mlir::Operation::operand_range getUnpaddedSizes(); + ::mlir::MutableOperandRange getTensorsMutable(); + ::mlir::MutableOperandRange getUnpaddedSizesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getTpuTensors(); + size_t getN(); + mlir::OperandElementTypeRange getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange tpu_tensors, ::mlir::ValueRange tensors, ::mlir::ValueRange unpadded_sizes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TPUCopyWithDynamicShapeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TPUCopyWithLayoutOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TPUCopyWithLayoutOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TPUCopyWithLayoutOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TPUCopyWithLayoutOpGenericAdaptorBase(TPUCopyWithLayoutOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TPUCopyWithLayoutOpGenericAdaptor : public detail::TPUCopyWithLayoutOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TPUCopyWithLayoutOpGenericAdaptorBase; +public: + TPUCopyWithLayoutOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TPUCopyWithLayoutOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TPUCopyWithLayoutOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TPUCopyWithLayoutOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getLayout() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TPUCopyWithLayoutOpAdaptor : public TPUCopyWithLayoutOpGenericAdaptor<::mlir::ValueRange> { +public: + using TPUCopyWithLayoutOpGenericAdaptor::TPUCopyWithLayoutOpGenericAdaptor; + TPUCopyWithLayoutOpAdaptor(TPUCopyWithLayoutOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TPUCopyWithLayoutOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TPUCopyWithLayoutOpAdaptor; + template + using GenericAdaptor = TPUCopyWithLayoutOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TPUCopyWithLayout"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getLayout(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getLayoutMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value layout); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value layout); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TPUCopyWithLayoutOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TPUEmbeddingActivationsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TPUEmbeddingActivationsOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TPUEmbeddingActivationsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TPUEmbeddingActivationsOpGenericAdaptorBase(TPUEmbeddingActivationsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::IntegerAttr getLookupIdAttr(); + uint64_t getLookupId(); +}; +} // namespace detail +template +class TPUEmbeddingActivationsOpGenericAdaptor : public detail::TPUEmbeddingActivationsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TPUEmbeddingActivationsOpGenericAdaptorBase; +public: + TPUEmbeddingActivationsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TPUEmbeddingActivationsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TPUEmbeddingActivationsOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TPUEmbeddingActivationsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getEmbeddingVariable() { + return (*getODSOperands(0).begin()); + } + + ValueT getSlicedActivations() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TPUEmbeddingActivationsOpAdaptor : public TPUEmbeddingActivationsOpGenericAdaptor<::mlir::ValueRange> { +public: + using TPUEmbeddingActivationsOpGenericAdaptor::TPUEmbeddingActivationsOpGenericAdaptor; + TPUEmbeddingActivationsOpAdaptor(TPUEmbeddingActivationsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TPUEmbeddingActivationsOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TPUEmbeddingActivationsOpAdaptor; + template + using GenericAdaptor = TPUEmbeddingActivationsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("lookup_id"), ::llvm::StringRef("table_id")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getLookupIdAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getLookupIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTableIdAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTableIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TPUEmbeddingActivations"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getEmbeddingVariable(); + ::mlir::TypedValue<::mlir::TensorType> getSlicedActivations(); + ::mlir::OpOperand &getEmbeddingVariableMutable(); + ::mlir::OpOperand &getSlicedActivationsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getTableIdAttr(); + uint64_t getTableId(); + ::mlir::IntegerAttr getLookupIdAttr(); + uint64_t getLookupId(); + void setTableIdAttr(::mlir::IntegerAttr attr); + void setTableId(uint64_t attrValue); + void setLookupIdAttr(::mlir::IntegerAttr attr); + void setLookupId(uint64_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value embedding_variable, ::mlir::Value sliced_activations, ::mlir::IntegerAttr table_id, ::mlir::IntegerAttr lookup_id); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value embedding_variable, ::mlir::Value sliced_activations, ::mlir::IntegerAttr table_id, ::mlir::IntegerAttr lookup_id); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value embedding_variable, ::mlir::Value sliced_activations, uint64_t table_id, uint64_t lookup_id); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value embedding_variable, ::mlir::Value sliced_activations, uint64_t table_id, uint64_t lookup_id); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TPUEmbeddingActivationsOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TPUExecuteAndUpdateVariablesOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TPUExecuteAndUpdateVariablesOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TPUExecuteAndUpdateVariablesOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TPUExecuteAndUpdateVariablesOpGenericAdaptorBase(TPUExecuteAndUpdateVariablesOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getDeviceVarReadsIndicesAttr(); + ::mlir::ArrayAttr getDeviceVarReadsIndices(); + ::mlir::ArrayAttr getDeviceVarUpdatesIndicesAttr(); + ::mlir::ArrayAttr getDeviceVarUpdatesIndices(); +}; +} // namespace detail +template +class TPUExecuteAndUpdateVariablesOpGenericAdaptor : public detail::TPUExecuteAndUpdateVariablesOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TPUExecuteAndUpdateVariablesOpGenericAdaptorBase; +public: + TPUExecuteAndUpdateVariablesOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TPUExecuteAndUpdateVariablesOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TPUExecuteAndUpdateVariablesOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TPUExecuteAndUpdateVariablesOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + ValueT getKey() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TPUExecuteAndUpdateVariablesOpAdaptor : public TPUExecuteAndUpdateVariablesOpGenericAdaptor<::mlir::ValueRange> { +public: + using TPUExecuteAndUpdateVariablesOpGenericAdaptor::TPUExecuteAndUpdateVariablesOpGenericAdaptor; + TPUExecuteAndUpdateVariablesOpAdaptor(TPUExecuteAndUpdateVariablesOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TPUExecuteAndUpdateVariablesOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TPUExecuteAndUpdateVariablesOpAdaptor; + template + using GenericAdaptor = TPUExecuteAndUpdateVariablesOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Targs"), ::llvm::StringRef("Tresults"), ::llvm::StringRef("device_var_reads_indices"), ::llvm::StringRef("device_var_updates_indices")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTargsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTargsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTresultsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTresultsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDeviceVarReadsIndicesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDeviceVarReadsIndicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getDeviceVarUpdatesIndicesAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getDeviceVarUpdatesIndicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TPUExecuteAndUpdateVariables"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::TypedValue<::mlir::TensorType> getKey(); + ::mlir::MutableOperandRange getArgsMutable(); + ::mlir::OpOperand &getKeyMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResults(); + ::mlir::ArrayAttr getDeviceVarReadsIndicesAttr(); + ::mlir::ArrayAttr getDeviceVarReadsIndices(); + ::mlir::ArrayAttr getDeviceVarUpdatesIndicesAttr(); + ::mlir::ArrayAttr getDeviceVarUpdatesIndices(); + mlir::OperandElementTypeRange getTargs(); + mlir::ResultElementTypeRange getTresults(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setDeviceVarReadsIndicesAttr(::mlir::ArrayAttr attr); + void setDeviceVarUpdatesIndicesAttr(::mlir::ArrayAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange results, ::mlir::ValueRange args, ::mlir::Value key, ::mlir::ArrayAttr device_var_reads_indices, ::mlir::ArrayAttr device_var_updates_indices); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TPUExecuteAndUpdateVariablesOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TPUExecuteOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TPUExecuteOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TPUExecuteOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TPUExecuteOpGenericAdaptorBase(TPUExecuteOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TPUExecuteOpGenericAdaptor : public detail::TPUExecuteOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TPUExecuteOpGenericAdaptorBase; +public: + TPUExecuteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TPUExecuteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TPUExecuteOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TPUExecuteOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + ValueT getKey() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TPUExecuteOpAdaptor : public TPUExecuteOpGenericAdaptor<::mlir::ValueRange> { +public: + using TPUExecuteOpGenericAdaptor::TPUExecuteOpGenericAdaptor; + TPUExecuteOpAdaptor(TPUExecuteOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TPUExecuteOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TPUExecuteOpAdaptor; + template + using GenericAdaptor = TPUExecuteOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Targs"), ::llvm::StringRef("Tresults")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTargsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTargsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTresultsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTresultsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TPUExecute"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::TypedValue<::mlir::TensorType> getKey(); + ::mlir::MutableOperandRange getArgsMutable(); + ::mlir::OpOperand &getKeyMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResults(); + mlir::OperandElementTypeRange getTargs(); + mlir::ResultElementTypeRange getTresults(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange results, ::mlir::ValueRange args, ::mlir::Value key); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TPUExecuteOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TPUGetLayoutOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TPUGetLayoutOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TPUGetLayoutOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TPUGetLayoutOpGenericAdaptorBase(TPUGetLayoutOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getIndexAttr(); + uint64_t getIndex(); + ::mlir::BoolAttr getIsOutputAttr(); + bool getIsOutput(); +}; +} // namespace detail +template +class TPUGetLayoutOpGenericAdaptor : public detail::TPUGetLayoutOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TPUGetLayoutOpGenericAdaptorBase; +public: + TPUGetLayoutOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TPUGetLayoutOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TPUGetLayoutOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TPUGetLayoutOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getCacheKey() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TPUGetLayoutOpAdaptor : public TPUGetLayoutOpGenericAdaptor<::mlir::ValueRange> { +public: + using TPUGetLayoutOpGenericAdaptor::TPUGetLayoutOpGenericAdaptor; + TPUGetLayoutOpAdaptor(TPUGetLayoutOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TPUGetLayoutOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TPUGetLayoutOpAdaptor; + template + using GenericAdaptor = TPUGetLayoutOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("index"), ::llvm::StringRef("is_output")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getIndexAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getIndexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getIsOutputAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getIsOutputAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TPUGetLayoutOp"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getCacheKey(); + ::mlir::OpOperand &getCacheKeyMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLayout(); + ::mlir::IntegerAttr getIndexAttr(); + uint64_t getIndex(); + ::mlir::BoolAttr getIsOutputAttr(); + bool getIsOutput(); + void setIndexAttr(::mlir::IntegerAttr attr); + void setIndex(uint64_t attrValue); + void setIsOutputAttr(::mlir::BoolAttr attr); + void setIsOutput(bool attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type layout, ::mlir::Value cache_key, ::mlir::IntegerAttr index, ::mlir::BoolAttr is_output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value cache_key, ::mlir::IntegerAttr index, ::mlir::BoolAttr is_output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type layout, ::mlir::Value cache_key, uint64_t index, bool is_output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value cache_key, uint64_t index, bool is_output); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TPUGetLayoutOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TPUOrdinalSelectorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TPUOrdinalSelectorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TPUOrdinalSelectorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TPUOrdinalSelectorOpGenericAdaptorBase(TPUOrdinalSelectorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TPUOrdinalSelectorOpGenericAdaptor : public detail::TPUOrdinalSelectorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TPUOrdinalSelectorOpGenericAdaptorBase; +public: + TPUOrdinalSelectorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TPUOrdinalSelectorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TPUOrdinalSelectorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TPUOrdinalSelectorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TPUOrdinalSelectorOpAdaptor : public TPUOrdinalSelectorOpGenericAdaptor<::mlir::ValueRange> { +public: + using TPUOrdinalSelectorOpGenericAdaptor::TPUOrdinalSelectorOpGenericAdaptor; + TPUOrdinalSelectorOpAdaptor(TPUOrdinalSelectorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TPUOrdinalSelectorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = TPUOrdinalSelectorOpAdaptor; + template + using GenericAdaptor = TPUOrdinalSelectorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TPUOrdinalSelector"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getDeviceOrdinals(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type device_ordinals); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TPUOrdinalSelectorOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TPUPartitionedCallOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TPUPartitionedCallOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TPUPartitionedCallOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TPUPartitionedCallOpGenericAdaptorBase(TPUPartitionedCallOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::SymbolRefAttr getFAttr(); + ::mlir::SymbolRefAttr getF(); + ::mlir::IntegerAttr getAutotunerThreshAttr(); + uint64_t getAutotunerThresh(); +}; +} // namespace detail +template +class TPUPartitionedCallOpGenericAdaptor : public detail::TPUPartitionedCallOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TPUPartitionedCallOpGenericAdaptorBase; +public: + TPUPartitionedCallOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TPUPartitionedCallOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TPUPartitionedCallOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TPUPartitionedCallOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + ValueT getDeviceOrdinal() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TPUPartitionedCallOpAdaptor : public TPUPartitionedCallOpGenericAdaptor<::mlir::ValueRange> { +public: + using TPUPartitionedCallOpGenericAdaptor::TPUPartitionedCallOpGenericAdaptor; + TPUPartitionedCallOpAdaptor(TPUPartitionedCallOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TPUPartitionedCallOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::CallOpInterface::Trait, ::mlir::SymbolUserOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TPUPartitionedCallOpAdaptor; + template + using GenericAdaptor = TPUPartitionedCallOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tin"), ::llvm::StringRef("Tout"), ::llvm::StringRef("autotuner_thresh"), ::llvm::StringRef("f")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTinAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTinAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getToutAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getToutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getAutotunerThreshAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getAutotunerThreshAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getFAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getFAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TPUPartitionedCall"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::TypedValue<::mlir::TensorType> getDeviceOrdinal(); + ::mlir::MutableOperandRange getArgsMutable(); + ::mlir::OpOperand &getDeviceOrdinalMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutput(); + ::mlir::SymbolRefAttr getFAttr(); + ::mlir::SymbolRefAttr getF(); + ::mlir::IntegerAttr getAutotunerThreshAttr(); + uint64_t getAutotunerThresh(); + mlir::OperandElementTypeRange getTin(); + mlir::ResultElementTypeRange getTout(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setFAttr(::mlir::SymbolRefAttr attr); + void setAutotunerThreshAttr(::mlir::IntegerAttr attr); + void setAutotunerThresh(::std::optional attrValue); + ::mlir::Attribute removeAutotunerThreshAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::ValueRange args, ::mlir::Value device_ordinal, ::mlir::SymbolRefAttr f, /*optional*/::mlir::IntegerAttr autotuner_thresh); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::ValueRange args, ::mlir::Value device_ordinal, ::mlir::SymbolRefAttr f, /*optional*/uint64_t autotuner_thresh = 0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verifySymbolUses(::mlir::SymbolTableCollection &symbolTable); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Gets the argument operands to the called function. + operand_range getArgOperands() { return getArgs(); } + MutableOperandRange getArgOperandsMutable() { + return getArgsMutable(); + } + + // Returns the callee of this operation. + CallInterfaceCallable getCallableForCallee() { return getFAttr(); } + // Sets the callee from the callable. + void setCalleeFromCallable(CallInterfaceCallable callee); + + // Returns the resolved callee function of this operation. + // Prefer passing in SymbolTableCollection to reduce lookup costs by + // enabling reusing cached symbol table lookup. + func::FuncOp ResolveFunc(::mlir::SymbolTableCollection* table) { + if (table) + return table->lookupNearestSymbolFrom(*this, getFAttr()); + return SymbolTable::lookupNearestSymbolFrom(*this, getFAttr()); + } + // TODO(b/204997177): Deprecate and remove. + func::FuncOp func() { return ResolveFunc(nullptr); } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TPUPartitionedCallOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TPUPartitionedInputOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TPUPartitionedInputOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TPUPartitionedInputOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TPUPartitionedInputOpGenericAdaptorBase(TPUPartitionedInputOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getPartitionDimAttr(); + uint64_t getPartitionDim(); + ::mlir::StringAttr get_XlaShardingAttr(); + ::std::optional< ::llvm::StringRef > get_XlaSharding(); +}; +} // namespace detail +template +class TPUPartitionedInputOpGenericAdaptor : public detail::TPUPartitionedInputOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TPUPartitionedInputOpGenericAdaptorBase; +public: + TPUPartitionedInputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TPUPartitionedInputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TPUPartitionedInputOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TPUPartitionedInputOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TPUPartitionedInputOpAdaptor : public TPUPartitionedInputOpGenericAdaptor<::mlir::ValueRange> { +public: + using TPUPartitionedInputOpGenericAdaptor::TPUPartitionedInputOpGenericAdaptor; + TPUPartitionedInputOpAdaptor(TPUPartitionedInputOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TPUPartitionedInputOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TPUPartitionedInputOpAdaptor; + template + using GenericAdaptor = TPUPartitionedInputOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("N"), ::llvm::StringRef("T"), ::llvm::StringRef("_XlaSharding"), ::llvm::StringRef("partition_dim")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr get_XlaShardingAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr get_XlaShardingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getPartitionDimAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getPartitionDimAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TPUPartitionedInput"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::MutableOperandRange getInputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getPartitionDimAttr(); + uint64_t getPartitionDim(); + ::mlir::StringAttr get_XlaShardingAttr(); + ::std::optional< ::llvm::StringRef > get_XlaSharding(); + ::mlir::Type getT(); + size_t getN(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setPartitionDimAttr(::mlir::IntegerAttr attr); + void setPartitionDim(::std::optional attrValue); + void set_XlaShardingAttr(::mlir::StringAttr attr); + void set_XlaSharding(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removePartitionDimAttr(); + ::mlir::Attribute remove_XlaShardingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::ValueRange inputs, /*optional*/::mlir::IntegerAttr partition_dim, /*optional*/::mlir::StringAttr _XlaSharding); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, /*optional*/::mlir::IntegerAttr partition_dim, /*optional*/::mlir::StringAttr _XlaSharding); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::ValueRange inputs, /*optional*/uint64_t partition_dim, /*optional*/::mlir::StringAttr _XlaSharding); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, /*optional*/uint64_t partition_dim, /*optional*/::mlir::StringAttr _XlaSharding); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TPUPartitionedInputOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TPUPartitionedInputV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TPUPartitionedInputV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TPUPartitionedInputV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TPUPartitionedInputV2OpGenericAdaptorBase(TPUPartitionedInputV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getPartitionDimsAttr(); + ::mlir::ArrayAttr getPartitionDims(); + ::mlir::BoolAttr getIsPackedAttr(); + bool getIsPacked(); + ::mlir::StringAttr get_XlaShardingAttr(); + ::std::optional< ::llvm::StringRef > get_XlaSharding(); +}; +} // namespace detail +template +class TPUPartitionedInputV2OpGenericAdaptor : public detail::TPUPartitionedInputV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TPUPartitionedInputV2OpGenericAdaptorBase; +public: + TPUPartitionedInputV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TPUPartitionedInputV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TPUPartitionedInputV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TPUPartitionedInputV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TPUPartitionedInputV2OpAdaptor : public TPUPartitionedInputV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using TPUPartitionedInputV2OpGenericAdaptor::TPUPartitionedInputV2OpGenericAdaptor; + TPUPartitionedInputV2OpAdaptor(TPUPartitionedInputV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TPUPartitionedInputV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TPUPartitionedInputV2OpAdaptor; + template + using GenericAdaptor = TPUPartitionedInputV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("N"), ::llvm::StringRef("T"), ::llvm::StringRef("_XlaSharding"), ::llvm::StringRef("is_packed"), ::llvm::StringRef("partition_dims")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr get_XlaShardingAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr get_XlaShardingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getIsPackedAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getIsPackedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getPartitionDimsAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getPartitionDimsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TPUPartitionedInputV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::MutableOperandRange getInputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ArrayAttr getPartitionDimsAttr(); + ::mlir::ArrayAttr getPartitionDims(); + ::mlir::BoolAttr getIsPackedAttr(); + bool getIsPacked(); + ::mlir::StringAttr get_XlaShardingAttr(); + ::std::optional< ::llvm::StringRef > get_XlaSharding(); + ::mlir::Type getT(); + size_t getN(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setPartitionDimsAttr(::mlir::ArrayAttr attr); + void setIsPackedAttr(::mlir::BoolAttr attr); + void setIsPacked(::std::optional attrValue); + void set_XlaShardingAttr(::mlir::StringAttr attr); + void set_XlaSharding(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeIsPackedAttr(); + ::mlir::Attribute remove_XlaShardingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::ValueRange inputs, ::mlir::ArrayAttr partition_dims, /*optional*/::mlir::BoolAttr is_packed, /*optional*/::mlir::StringAttr _XlaSharding); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::mlir::ArrayAttr partition_dims, /*optional*/::mlir::BoolAttr is_packed, /*optional*/::mlir::StringAttr _XlaSharding); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::ValueRange inputs, ::mlir::ArrayAttr partition_dims, /*optional*/bool is_packed, /*optional*/::mlir::StringAttr _XlaSharding); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::mlir::ArrayAttr partition_dims, /*optional*/bool is_packed, /*optional*/::mlir::StringAttr _XlaSharding); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TPUPartitionedInputV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TPUPartitionedOutputOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TPUPartitionedOutputOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TPUPartitionedOutputOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TPUPartitionedOutputOpGenericAdaptorBase(TPUPartitionedOutputOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getPartitionDimAttr(); + uint64_t getPartitionDim(); + ::mlir::StringAttr get_XlaShardingAttr(); + ::std::optional< ::llvm::StringRef > get_XlaSharding(); +}; +} // namespace detail +template +class TPUPartitionedOutputOpGenericAdaptor : public detail::TPUPartitionedOutputOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TPUPartitionedOutputOpGenericAdaptorBase; +public: + TPUPartitionedOutputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TPUPartitionedOutputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TPUPartitionedOutputOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TPUPartitionedOutputOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputs() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TPUPartitionedOutputOpAdaptor : public TPUPartitionedOutputOpGenericAdaptor<::mlir::ValueRange> { +public: + using TPUPartitionedOutputOpGenericAdaptor::TPUPartitionedOutputOpGenericAdaptor; + TPUPartitionedOutputOpAdaptor(TPUPartitionedOutputOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TPUPartitionedOutputOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = TPUPartitionedOutputOpAdaptor; + template + using GenericAdaptor = TPUPartitionedOutputOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("_XlaSharding"), ::llvm::StringRef("num_splits"), ::llvm::StringRef("partition_dim")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr get_XlaShardingAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr get_XlaShardingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getNumSplitsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getNumSplitsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getPartitionDimAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getPartitionDimAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TPUPartitionedOutput"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputs(); + ::mlir::OpOperand &getInputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutput(); + ::mlir::IntegerAttr getPartitionDimAttr(); + uint64_t getPartitionDim(); + ::mlir::StringAttr get_XlaShardingAttr(); + ::std::optional< ::llvm::StringRef > get_XlaSharding(); + ::mlir::Type getT(); + size_t getNumSplits(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setPartitionDimAttr(::mlir::IntegerAttr attr); + void setPartitionDim(::std::optional attrValue); + void set_XlaShardingAttr(::mlir::StringAttr attr); + void set_XlaSharding(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removePartitionDimAttr(); + ::mlir::Attribute remove_XlaShardingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::Value inputs, /*optional*/::mlir::IntegerAttr partition_dim, /*optional*/::mlir::StringAttr _XlaSharding); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::Value inputs, /*optional*/uint64_t partition_dim, /*optional*/::mlir::StringAttr _XlaSharding); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TPUPartitionedOutputOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TPUPartitionedOutputV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TPUPartitionedOutputV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TPUPartitionedOutputV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TPUPartitionedOutputV2OpGenericAdaptorBase(TPUPartitionedOutputV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getPartitionDimsAttr(); + ::mlir::ArrayAttr getPartitionDims(); + ::mlir::StringAttr get_XlaShardingAttr(); + ::std::optional< ::llvm::StringRef > get_XlaSharding(); +}; +} // namespace detail +template +class TPUPartitionedOutputV2OpGenericAdaptor : public detail::TPUPartitionedOutputV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TPUPartitionedOutputV2OpGenericAdaptorBase; +public: + TPUPartitionedOutputV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TPUPartitionedOutputV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TPUPartitionedOutputV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TPUPartitionedOutputV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputs() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TPUPartitionedOutputV2OpAdaptor : public TPUPartitionedOutputV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using TPUPartitionedOutputV2OpGenericAdaptor::TPUPartitionedOutputV2OpGenericAdaptor; + TPUPartitionedOutputV2OpAdaptor(TPUPartitionedOutputV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TPUPartitionedOutputV2Op : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = TPUPartitionedOutputV2OpAdaptor; + template + using GenericAdaptor = TPUPartitionedOutputV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("_XlaSharding"), ::llvm::StringRef("num_splits"), ::llvm::StringRef("partition_dims")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr get_XlaShardingAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr get_XlaShardingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getNumSplitsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getNumSplitsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getPartitionDimsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getPartitionDimsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TPUPartitionedOutputV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputs(); + ::mlir::OpOperand &getInputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutput(); + ::mlir::ArrayAttr getPartitionDimsAttr(); + ::mlir::ArrayAttr getPartitionDims(); + ::mlir::StringAttr get_XlaShardingAttr(); + ::std::optional< ::llvm::StringRef > get_XlaSharding(); + ::mlir::Type getT(); + size_t getNumSplits(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setPartitionDimsAttr(::mlir::ArrayAttr attr); + void set_XlaShardingAttr(::mlir::StringAttr attr); + void set_XlaSharding(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute remove_XlaShardingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::Value inputs, ::mlir::ArrayAttr partition_dims, /*optional*/::mlir::StringAttr _XlaSharding); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TPUPartitionedOutputV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TPUReplicateMetadataOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TPUReplicateMetadataOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TPUReplicateMetadataOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TPUReplicateMetadataOpGenericAdaptorBase(TPUReplicateMetadataOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getNumReplicasAttr(); + uint64_t getNumReplicas(); + ::mlir::IntegerAttr getNumCoresPerReplicaAttr(); + uint64_t getNumCoresPerReplica(); + ::mlir::StringAttr getTopologyAttr(); + ::llvm::StringRef getTopology(); + ::mlir::BoolAttr getUseTpuAttr(); + bool getUseTpu(); + ::mlir::ArrayAttr getDeviceAssignmentAttr(); + ::mlir::ArrayAttr getDeviceAssignment(); + ::mlir::ArrayAttr getComputationShapeAttr(); + ::mlir::ArrayAttr getComputationShape(); + ::mlir::ArrayAttr getHostComputeCoreAttr(); + ::mlir::ArrayAttr getHostComputeCore(); + ::mlir::ArrayAttr getPaddingMapAttr(); + ::mlir::ArrayAttr getPaddingMap(); + ::mlir::StringAttr getStepMarkerLocationAttr(); + ::llvm::StringRef getStepMarkerLocation(); + ::mlir::BoolAttr getAllowSoftPlacementAttr(); + bool getAllowSoftPlacement(); + ::mlir::BoolAttr getUseSpmdForXlaPartitioningAttr(); + bool getUseSpmdForXlaPartitioning(); + ::mlir::StringAttr getTpuCompileOptionsProtoAttr(); + ::llvm::StringRef getTpuCompileOptionsProto(); +}; +} // namespace detail +template +class TPUReplicateMetadataOpGenericAdaptor : public detail::TPUReplicateMetadataOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TPUReplicateMetadataOpGenericAdaptorBase; +public: + TPUReplicateMetadataOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TPUReplicateMetadataOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TPUReplicateMetadataOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TPUReplicateMetadataOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TPUReplicateMetadataOpAdaptor : public TPUReplicateMetadataOpGenericAdaptor<::mlir::ValueRange> { +public: + using TPUReplicateMetadataOpGenericAdaptor::TPUReplicateMetadataOpGenericAdaptor; + TPUReplicateMetadataOpAdaptor(TPUReplicateMetadataOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TPUReplicateMetadataOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = TPUReplicateMetadataOpAdaptor; + template + using GenericAdaptor = TPUReplicateMetadataOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("allow_soft_placement"), ::llvm::StringRef("computation_shape"), ::llvm::StringRef("device_assignment"), ::llvm::StringRef("host_compute_core"), ::llvm::StringRef("num_cores_per_replica"), ::llvm::StringRef("num_replicas"), ::llvm::StringRef("padding_map"), ::llvm::StringRef("step_marker_location"), ::llvm::StringRef("topology"), ::llvm::StringRef("tpu_compile_options_proto"), ::llvm::StringRef("use_spmd_for_xla_partitioning"), ::llvm::StringRef("use_tpu")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAllowSoftPlacementAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAllowSoftPlacementAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getComputationShapeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getComputationShapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDeviceAssignmentAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDeviceAssignmentAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getHostComputeCoreAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getHostComputeCoreAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getNumCoresPerReplicaAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getNumCoresPerReplicaAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getNumReplicasAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getNumReplicasAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getPaddingMapAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getPaddingMapAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getStepMarkerLocationAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getStepMarkerLocationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getTopologyAttrName() { + return getAttributeNameForIndex(8); + } + + static ::mlir::StringAttr getTopologyAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 8); + } + + ::mlir::StringAttr getTpuCompileOptionsProtoAttrName() { + return getAttributeNameForIndex(9); + } + + static ::mlir::StringAttr getTpuCompileOptionsProtoAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 9); + } + + ::mlir::StringAttr getUseSpmdForXlaPartitioningAttrName() { + return getAttributeNameForIndex(10); + } + + static ::mlir::StringAttr getUseSpmdForXlaPartitioningAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 10); + } + + ::mlir::StringAttr getUseTpuAttrName() { + return getAttributeNameForIndex(11); + } + + static ::mlir::StringAttr getUseTpuAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 11); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TPUReplicateMetadata"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getNumReplicasAttr(); + uint64_t getNumReplicas(); + ::mlir::IntegerAttr getNumCoresPerReplicaAttr(); + uint64_t getNumCoresPerReplica(); + ::mlir::StringAttr getTopologyAttr(); + ::llvm::StringRef getTopology(); + ::mlir::BoolAttr getUseTpuAttr(); + bool getUseTpu(); + ::mlir::ArrayAttr getDeviceAssignmentAttr(); + ::mlir::ArrayAttr getDeviceAssignment(); + ::mlir::ArrayAttr getComputationShapeAttr(); + ::mlir::ArrayAttr getComputationShape(); + ::mlir::ArrayAttr getHostComputeCoreAttr(); + ::mlir::ArrayAttr getHostComputeCore(); + ::mlir::ArrayAttr getPaddingMapAttr(); + ::mlir::ArrayAttr getPaddingMap(); + ::mlir::StringAttr getStepMarkerLocationAttr(); + ::llvm::StringRef getStepMarkerLocation(); + ::mlir::BoolAttr getAllowSoftPlacementAttr(); + bool getAllowSoftPlacement(); + ::mlir::BoolAttr getUseSpmdForXlaPartitioningAttr(); + bool getUseSpmdForXlaPartitioning(); + ::mlir::StringAttr getTpuCompileOptionsProtoAttr(); + ::llvm::StringRef getTpuCompileOptionsProto(); + void setNumReplicasAttr(::mlir::IntegerAttr attr); + void setNumReplicas(uint64_t attrValue); + void setNumCoresPerReplicaAttr(::mlir::IntegerAttr attr); + void setNumCoresPerReplica(::std::optional attrValue); + void setTopologyAttr(::mlir::StringAttr attr); + void setTopology(::std::optional<::llvm::StringRef> attrValue); + void setUseTpuAttr(::mlir::BoolAttr attr); + void setUseTpu(::std::optional attrValue); + void setDeviceAssignmentAttr(::mlir::ArrayAttr attr); + void setComputationShapeAttr(::mlir::ArrayAttr attr); + void setHostComputeCoreAttr(::mlir::ArrayAttr attr); + void setPaddingMapAttr(::mlir::ArrayAttr attr); + void setStepMarkerLocationAttr(::mlir::StringAttr attr); + void setStepMarkerLocation(::std::optional<::llvm::StringRef> attrValue); + void setAllowSoftPlacementAttr(::mlir::BoolAttr attr); + void setAllowSoftPlacement(::std::optional attrValue); + void setUseSpmdForXlaPartitioningAttr(::mlir::BoolAttr attr); + void setUseSpmdForXlaPartitioning(::std::optional attrValue); + void setTpuCompileOptionsProtoAttr(::mlir::StringAttr attr); + void setTpuCompileOptionsProto(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeNumCoresPerReplicaAttr(); + ::mlir::Attribute removeTopologyAttr(); + ::mlir::Attribute removeUseTpuAttr(); + ::mlir::Attribute removeDeviceAssignmentAttr(); + ::mlir::Attribute removeComputationShapeAttr(); + ::mlir::Attribute removeHostComputeCoreAttr(); + ::mlir::Attribute removePaddingMapAttr(); + ::mlir::Attribute removeStepMarkerLocationAttr(); + ::mlir::Attribute removeAllowSoftPlacementAttr(); + ::mlir::Attribute removeUseSpmdForXlaPartitioningAttr(); + ::mlir::Attribute removeTpuCompileOptionsProtoAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::IntegerAttr num_replicas, /*optional*/::mlir::IntegerAttr num_cores_per_replica, /*optional*/::mlir::StringAttr topology, /*optional*/::mlir::BoolAttr use_tpu, /*optional*/::mlir::ArrayAttr device_assignment, /*optional*/::mlir::ArrayAttr computation_shape, /*optional*/::mlir::ArrayAttr host_compute_core, /*optional*/::mlir::ArrayAttr padding_map, /*optional*/::mlir::StringAttr step_marker_location, /*optional*/::mlir::BoolAttr allow_soft_placement, /*optional*/::mlir::BoolAttr use_spmd_for_xla_partitioning, /*optional*/::mlir::StringAttr tpu_compile_options_proto); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr num_replicas, /*optional*/::mlir::IntegerAttr num_cores_per_replica, /*optional*/::mlir::StringAttr topology, /*optional*/::mlir::BoolAttr use_tpu, /*optional*/::mlir::ArrayAttr device_assignment, /*optional*/::mlir::ArrayAttr computation_shape, /*optional*/::mlir::ArrayAttr host_compute_core, /*optional*/::mlir::ArrayAttr padding_map, /*optional*/::mlir::StringAttr step_marker_location, /*optional*/::mlir::BoolAttr allow_soft_placement, /*optional*/::mlir::BoolAttr use_spmd_for_xla_partitioning, /*optional*/::mlir::StringAttr tpu_compile_options_proto); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, uint64_t num_replicas, /*optional*/uint64_t num_cores_per_replica, /*optional*/::llvm::StringRef topology, /*optional*/bool use_tpu, /*optional*/::mlir::ArrayAttr device_assignment, /*optional*/::mlir::ArrayAttr computation_shape, /*optional*/::mlir::ArrayAttr host_compute_core, /*optional*/::mlir::ArrayAttr padding_map, /*optional*/::llvm::StringRef step_marker_location = "STEP_MARK_AT_ENTRY", /*optional*/bool allow_soft_placement = false, /*optional*/bool use_spmd_for_xla_partitioning = false, /*optional*/::llvm::StringRef tpu_compile_options_proto = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, uint64_t num_replicas, /*optional*/uint64_t num_cores_per_replica, /*optional*/::llvm::StringRef topology, /*optional*/bool use_tpu, /*optional*/::mlir::ArrayAttr device_assignment, /*optional*/::mlir::ArrayAttr computation_shape, /*optional*/::mlir::ArrayAttr host_compute_core, /*optional*/::mlir::ArrayAttr padding_map, /*optional*/::llvm::StringRef step_marker_location = "STEP_MARK_AT_ENTRY", /*optional*/bool allow_soft_placement = false, /*optional*/bool use_spmd_for_xla_partitioning = false, /*optional*/::llvm::StringRef tpu_compile_options_proto = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 12 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TPUReplicateMetadataOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TPUReplicatedInputOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TPUReplicatedInputOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TPUReplicatedInputOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TPUReplicatedInputOpGenericAdaptorBase(TPUReplicatedInputOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getIsMirroredVariableAttr(); + bool getIsMirroredVariable(); + ::mlir::IntegerAttr getIndexAttr(); + uint64_t getIndex(); + ::mlir::BoolAttr getIsPackedAttr(); + bool getIsPacked(); +}; +} // namespace detail +template +class TPUReplicatedInputOpGenericAdaptor : public detail::TPUReplicatedInputOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TPUReplicatedInputOpGenericAdaptorBase; +public: + TPUReplicatedInputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TPUReplicatedInputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TPUReplicatedInputOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TPUReplicatedInputOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TPUReplicatedInputOpAdaptor : public TPUReplicatedInputOpGenericAdaptor<::mlir::ValueRange> { +public: + using TPUReplicatedInputOpGenericAdaptor::TPUReplicatedInputOpGenericAdaptor; + TPUReplicatedInputOpAdaptor(TPUReplicatedInputOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TPUReplicatedInputOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TPUReplicatedInputOpAdaptor; + template + using GenericAdaptor = TPUReplicatedInputOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("N"), ::llvm::StringRef("T"), ::llvm::StringRef("index"), ::llvm::StringRef("is_mirrored_variable"), ::llvm::StringRef("is_packed")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getIndexAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getIndexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getIsMirroredVariableAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getIsMirroredVariableAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getIsPackedAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getIsPackedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TPUReplicatedInput"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::MutableOperandRange getInputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getIsMirroredVariableAttr(); + bool getIsMirroredVariable(); + ::mlir::IntegerAttr getIndexAttr(); + uint64_t getIndex(); + ::mlir::BoolAttr getIsPackedAttr(); + bool getIsPacked(); + size_t getN(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setIsMirroredVariableAttr(::mlir::BoolAttr attr); + void setIsMirroredVariable(::std::optional attrValue); + void setIndexAttr(::mlir::IntegerAttr attr); + void setIndex(::std::optional attrValue); + void setIsPackedAttr(::mlir::BoolAttr attr); + void setIsPacked(::std::optional attrValue); + ::mlir::Attribute removeIsMirroredVariableAttr(); + ::mlir::Attribute removeIndexAttr(); + ::mlir::Attribute removeIsPackedAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::ValueRange inputs, /*optional*/::mlir::BoolAttr is_mirrored_variable, /*optional*/::mlir::IntegerAttr index, /*optional*/::mlir::BoolAttr is_packed); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, /*optional*/::mlir::BoolAttr is_mirrored_variable, /*optional*/::mlir::IntegerAttr index, /*optional*/::mlir::BoolAttr is_packed); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::ValueRange inputs, /*optional*/bool is_mirrored_variable = false, /*optional*/uint64_t index = -1, /*optional*/bool is_packed = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, /*optional*/bool is_mirrored_variable = false, /*optional*/uint64_t index = -1, /*optional*/bool is_packed = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TPUReplicatedInputOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TPUReplicatedOutputOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TPUReplicatedOutputOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TPUReplicatedOutputOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TPUReplicatedOutputOpGenericAdaptorBase(TPUReplicatedOutputOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TPUReplicatedOutputOpGenericAdaptor : public detail::TPUReplicatedOutputOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TPUReplicatedOutputOpGenericAdaptorBase; +public: + TPUReplicatedOutputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TPUReplicatedOutputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TPUReplicatedOutputOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TPUReplicatedOutputOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TPUReplicatedOutputOpAdaptor : public TPUReplicatedOutputOpGenericAdaptor<::mlir::ValueRange> { +public: + using TPUReplicatedOutputOpGenericAdaptor::TPUReplicatedOutputOpGenericAdaptor; + TPUReplicatedOutputOpAdaptor(TPUReplicatedOutputOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TPUReplicatedOutputOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = TPUReplicatedOutputOpAdaptor; + template + using GenericAdaptor = TPUReplicatedOutputOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("num_replicas")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumReplicasAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumReplicasAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TPUReplicatedOutput"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutputs(); + ::mlir::Type getT(); + size_t getNumReplicas(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outputs, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TPUReplicatedOutputOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TPUReshardVariablesOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TPUReshardVariablesOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TPUReshardVariablesOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TPUReshardVariablesOpGenericAdaptorBase(TPUReshardVariablesOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TPUReshardVariablesOpGenericAdaptor : public detail::TPUReshardVariablesOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TPUReshardVariablesOpGenericAdaptorBase; +public: + TPUReshardVariablesOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TPUReshardVariablesOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TPUReshardVariablesOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TPUReshardVariablesOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getVars() { + return getODSOperands(0); + } + + ValueT getNewFormatKey() { + return (*getODSOperands(1).begin()); + } + + ValueT getFormatStateVar() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TPUReshardVariablesOpAdaptor : public TPUReshardVariablesOpGenericAdaptor<::mlir::ValueRange> { +public: + using TPUReshardVariablesOpGenericAdaptor::TPUReshardVariablesOpGenericAdaptor; + TPUReshardVariablesOpAdaptor(TPUReshardVariablesOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TPUReshardVariablesOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TPUReshardVariablesOpAdaptor; + template + using GenericAdaptor = TPUReshardVariablesOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("N")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TPUReshardVariables"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getVars(); + ::mlir::TypedValue<::mlir::TensorType> getNewFormatKey(); + ::mlir::TypedValue<::mlir::TensorType> getFormatStateVar(); + ::mlir::MutableOperandRange getVarsMutable(); + ::mlir::OpOperand &getNewFormatKeyMutable(); + ::mlir::OpOperand &getFormatStateVarMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + size_t getN(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange vars, ::mlir::Value new_format_key, ::mlir::Value format_state_var); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange vars, ::mlir::Value new_format_key, ::mlir::Value format_state_var); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TPUReshardVariablesOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TPURoundRobinOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TPURoundRobinOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TPURoundRobinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TPURoundRobinOpGenericAdaptorBase(TPURoundRobinOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TPURoundRobinOpGenericAdaptor : public detail::TPURoundRobinOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TPURoundRobinOpGenericAdaptorBase; +public: + TPURoundRobinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TPURoundRobinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TPURoundRobinOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TPURoundRobinOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TPURoundRobinOpAdaptor : public TPURoundRobinOpGenericAdaptor<::mlir::ValueRange> { +public: + using TPURoundRobinOpGenericAdaptor::TPURoundRobinOpGenericAdaptor; + TPURoundRobinOpAdaptor(TPURoundRobinOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TPURoundRobinOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = TPURoundRobinOpAdaptor; + template + using GenericAdaptor = TPURoundRobinOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TPURoundRobin"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getDeviceOrdinal(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type device_ordinal); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TPURoundRobinOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TakeDatasetOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TakeDatasetOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TakeDatasetOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TakeDatasetOpGenericAdaptorBase(TakeDatasetOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); +}; +} // namespace detail +template +class TakeDatasetOpGenericAdaptor : public detail::TakeDatasetOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TakeDatasetOpGenericAdaptorBase; +public: + TakeDatasetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TakeDatasetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TakeDatasetOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TakeDatasetOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputDataset() { + return (*getODSOperands(0).begin()); + } + + ValueT getCount() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TakeDatasetOpAdaptor : public TakeDatasetOpGenericAdaptor<::mlir::ValueRange> { +public: + using TakeDatasetOpGenericAdaptor::TakeDatasetOpGenericAdaptor; + TakeDatasetOpAdaptor(TakeDatasetOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TakeDatasetOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TakeDatasetOpAdaptor; + template + using GenericAdaptor = TakeDatasetOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("metadata"), ::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getMetadataAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getMetadataAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TakeDataset"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputDataset(); + ::mlir::TypedValue<::mlir::TensorType> getCount(); + ::mlir::OpOperand &getInputDatasetMutable(); + ::mlir::OpOperand &getCountMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + void setMetadataAttr(::mlir::StringAttr attr); + void setMetadata(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeMetadataAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, ::mlir::Value count, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, ::mlir::Value count, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, ::mlir::Value count, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::llvm::StringRef metadata = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, ::mlir::Value count, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::llvm::StringRef metadata = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TakeDatasetOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TakeWhileDatasetOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TakeWhileDatasetOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TakeWhileDatasetOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TakeWhileDatasetOpGenericAdaptorBase(TakeWhileDatasetOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::SymbolRefAttr getPredicateAttr(); + ::mlir::SymbolRefAttr getPredicate(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); +}; +} // namespace detail +template +class TakeWhileDatasetOpGenericAdaptor : public detail::TakeWhileDatasetOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TakeWhileDatasetOpGenericAdaptorBase; +public: + TakeWhileDatasetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TakeWhileDatasetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TakeWhileDatasetOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TakeWhileDatasetOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputDataset() { + return (*getODSOperands(0).begin()); + } + + RangeT getOtherArguments() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TakeWhileDatasetOpAdaptor : public TakeWhileDatasetOpGenericAdaptor<::mlir::ValueRange> { +public: + using TakeWhileDatasetOpGenericAdaptor::TakeWhileDatasetOpGenericAdaptor; + TakeWhileDatasetOpAdaptor(TakeWhileDatasetOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TakeWhileDatasetOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TakeWhileDatasetOpAdaptor; + template + using GenericAdaptor = TakeWhileDatasetOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Targuments"), ::llvm::StringRef("metadata"), ::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types"), ::llvm::StringRef("predicate")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTargumentsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTargumentsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getMetadataAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getMetadataAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getPredicateAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getPredicateAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TakeWhileDataset"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputDataset(); + ::mlir::Operation::operand_range getOtherArguments(); + ::mlir::OpOperand &getInputDatasetMutable(); + ::mlir::MutableOperandRange getOtherArgumentsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::SymbolRefAttr getPredicateAttr(); + ::mlir::SymbolRefAttr getPredicate(); + ::mlir::ArrayAttr getOutputTypesAttr(); + ::mlir::ArrayAttr getOutputTypes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); + mlir::OperandElementTypeRange getTarguments(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setPredicateAttr(::mlir::SymbolRefAttr attr); + void setOutputTypesAttr(::mlir::ArrayAttr attr); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + void setMetadataAttr(::mlir::StringAttr attr); + void setMetadata(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeMetadataAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, ::mlir::ValueRange other_arguments, ::mlir::SymbolRefAttr predicate, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, ::mlir::ValueRange other_arguments, ::mlir::SymbolRefAttr predicate, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value input_dataset, ::mlir::ValueRange other_arguments, ::mlir::SymbolRefAttr predicate, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::llvm::StringRef metadata = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_dataset, ::mlir::ValueRange other_arguments, ::mlir::SymbolRefAttr predicate, ::mlir::ArrayAttr output_types, ::mlir::ArrayAttr output_shapes, /*optional*/::llvm::StringRef metadata = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TakeWhileDatasetOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TanOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TanOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TanOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TanOpGenericAdaptorBase(TanOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TanOpGenericAdaptor : public detail::TanOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TanOpGenericAdaptorBase; +public: + TanOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TanOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TanOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TanOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TanOpAdaptor : public TanOpGenericAdaptor<::mlir::ValueRange> { +public: + using TanOpGenericAdaptor::TanOpGenericAdaptor; + TanOpAdaptor(TanOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TanOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TanOpAdaptor; + template + using GenericAdaptor = TanOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Tan"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TanOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TanhGradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TanhGradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TanhGradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TanhGradOpGenericAdaptorBase(TanhGradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TanhGradOpGenericAdaptor : public detail::TanhGradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TanhGradOpGenericAdaptorBase; +public: + TanhGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TanhGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TanhGradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TanhGradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getY() { + return (*getODSOperands(0).begin()); + } + + ValueT getDy() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TanhGradOpAdaptor : public TanhGradOpGenericAdaptor<::mlir::ValueRange> { +public: + using TanhGradOpGenericAdaptor::TanhGradOpGenericAdaptor; + TanhGradOpAdaptor(TanhGradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TanhGradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TanhGradOpAdaptor; + template + using GenericAdaptor = TanhGradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TanhGrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::TypedValue<::mlir::TensorType> getDy(); + ::mlir::OpOperand &getYMutable(); + ::mlir::OpOperand &getDyMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value y, ::mlir::Value dy); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value y, ::mlir::Value dy); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value y, ::mlir::Value dy); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TanhGradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TanhOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TanhOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TanhOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TanhOpGenericAdaptorBase(TanhOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TanhOpGenericAdaptor : public detail::TanhOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TanhOpGenericAdaptorBase; +public: + TanhOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TanhOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TanhOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TanhOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TanhOpAdaptor : public TanhOpGenericAdaptor<::mlir::ValueRange> { +public: + using TanhOpGenericAdaptor::TanhOpGenericAdaptor; + TanhOpAdaptor(TanhOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TanhOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::LayoutAgnostic, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TanhOpAdaptor; + template + using GenericAdaptor = TanhOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Tanh"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TanhOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TensorArrayCloseV3Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorArrayCloseV3OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorArrayCloseV3OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorArrayCloseV3OpGenericAdaptorBase(TensorArrayCloseV3Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TensorArrayCloseV3OpGenericAdaptor : public detail::TensorArrayCloseV3OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorArrayCloseV3OpGenericAdaptorBase; +public: + TensorArrayCloseV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorArrayCloseV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorArrayCloseV3OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorArrayCloseV3OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getHandle() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorArrayCloseV3OpAdaptor : public TensorArrayCloseV3OpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorArrayCloseV3OpGenericAdaptor::TensorArrayCloseV3OpGenericAdaptor; + TensorArrayCloseV3OpAdaptor(TensorArrayCloseV3Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorArrayCloseV3Op : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorArrayCloseV3OpAdaptor; + template + using GenericAdaptor = TensorArrayCloseV3OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TensorArrayCloseV3"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::OpOperand &getHandleMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value handle); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value handle); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TensorArrayCloseV3Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TensorArrayConcatV3Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorArrayConcatV3OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorArrayConcatV3OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorArrayConcatV3OpGenericAdaptorBase(TensorArrayConcatV3Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Attribute getElementShapeExcept0Attr(); + std::optional> getElementShapeExcept0(); +}; +} // namespace detail +template +class TensorArrayConcatV3OpGenericAdaptor : public detail::TensorArrayConcatV3OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorArrayConcatV3OpGenericAdaptorBase; +public: + TensorArrayConcatV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorArrayConcatV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorArrayConcatV3OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorArrayConcatV3OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getFlowIn() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorArrayConcatV3OpAdaptor : public TensorArrayConcatV3OpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorArrayConcatV3OpGenericAdaptor::TensorArrayConcatV3OpGenericAdaptor; + TensorArrayConcatV3OpAdaptor(TensorArrayConcatV3Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorArrayConcatV3Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorArrayConcatV3OpAdaptor; + template + using GenericAdaptor = TensorArrayConcatV3OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dtype"), ::llvm::StringRef("element_shape_except0")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getElementShapeExcept0AttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getElementShapeExcept0AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TensorArrayConcatV3"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::TypedValue<::mlir::TensorType> getFlowIn(); + ::mlir::OpOperand &getHandleMutable(); + ::mlir::OpOperand &getFlowInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getValue(); + ::mlir::TypedValue<::mlir::TensorType> getLengths(); + ::mlir::Attribute getElementShapeExcept0Attr(); + std::optional> getElementShapeExcept0(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setElementShapeExcept0Attr(::mlir::Attribute attr); + void setElementShapeExcept0(::std::optional>> attrValue); + ::mlir::Attribute removeElementShapeExcept0Attr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type value, ::mlir::Type lengths, ::mlir::Value handle, ::mlir::Value flow_in, /*optional*/::mlir::Attribute element_shape_except0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value handle, ::mlir::Value flow_in, /*optional*/::mlir::Attribute element_shape_except0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type value, ::mlir::Type lengths, ::mlir::Value handle, ::mlir::Value flow_in, /*optional*/std::optional> element_shape_except0 = std::nullopt); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value handle, ::mlir::Value flow_in, /*optional*/std::optional> element_shape_except0 = std::nullopt); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TensorArrayConcatV3Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TensorArrayGatherV3Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorArrayGatherV3OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorArrayGatherV3OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorArrayGatherV3OpGenericAdaptorBase(TensorArrayGatherV3Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Attribute getElementShapeAttr(); + std::optional> getElementShape(); +}; +} // namespace detail +template +class TensorArrayGatherV3OpGenericAdaptor : public detail::TensorArrayGatherV3OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorArrayGatherV3OpGenericAdaptorBase; +public: + TensorArrayGatherV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorArrayGatherV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorArrayGatherV3OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorArrayGatherV3OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getFlowIn() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorArrayGatherV3OpAdaptor : public TensorArrayGatherV3OpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorArrayGatherV3OpGenericAdaptor::TensorArrayGatherV3OpGenericAdaptor; + TensorArrayGatherV3OpAdaptor(TensorArrayGatherV3Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorArrayGatherV3Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorArrayGatherV3OpAdaptor; + template + using GenericAdaptor = TensorArrayGatherV3OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dtype"), ::llvm::StringRef("element_shape")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getElementShapeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getElementShapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TensorArrayGatherV3"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getFlowIn(); + ::mlir::OpOperand &getHandleMutable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getFlowInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getValue(); + ::mlir::Attribute getElementShapeAttr(); + std::optional> getElementShape(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setElementShapeAttr(::mlir::Attribute attr); + void setElementShape(::std::optional>> attrValue); + ::mlir::Attribute removeElementShapeAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type value, ::mlir::Value handle, ::mlir::Value indices, ::mlir::Value flow_in, /*optional*/::mlir::Attribute element_shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value handle, ::mlir::Value indices, ::mlir::Value flow_in, /*optional*/::mlir::Attribute element_shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type value, ::mlir::Value handle, ::mlir::Value indices, ::mlir::Value flow_in, /*optional*/std::optional> element_shape = std::nullopt); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value handle, ::mlir::Value indices, ::mlir::Value flow_in, /*optional*/std::optional> element_shape = std::nullopt); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TensorArrayGatherV3Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TensorArrayGradV3Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorArrayGradV3OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorArrayGradV3OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorArrayGradV3OpGenericAdaptorBase(TensorArrayGradV3Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getSourceAttr(); + ::llvm::StringRef getSource(); +}; +} // namespace detail +template +class TensorArrayGradV3OpGenericAdaptor : public detail::TensorArrayGradV3OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorArrayGradV3OpGenericAdaptorBase; +public: + TensorArrayGradV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorArrayGradV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorArrayGradV3OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorArrayGradV3OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getFlowIn() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorArrayGradV3OpAdaptor : public TensorArrayGradV3OpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorArrayGradV3OpGenericAdaptor::TensorArrayGradV3OpGenericAdaptor; + TensorArrayGradV3OpAdaptor(TensorArrayGradV3Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorArrayGradV3Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpAsmOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorArrayGradV3OpAdaptor; + template + using GenericAdaptor = TensorArrayGradV3OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("source")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getSourceAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getSourceAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TensorArrayGradV3"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::TypedValue<::mlir::TensorType> getFlowIn(); + ::mlir::OpOperand &getHandleMutable(); + ::mlir::OpOperand &getFlowInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getGradHandle(); + ::mlir::TypedValue<::mlir::TensorType> getFlowOut(); + ::mlir::StringAttr getSourceAttr(); + ::llvm::StringRef getSource(); + void setSourceAttr(::mlir::StringAttr attr); + void setSource(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type grad_handle, ::mlir::Type flow_out, ::mlir::Value handle, ::mlir::Value flow_in, ::mlir::StringAttr source); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value handle, ::mlir::Value flow_in, ::mlir::StringAttr source); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type grad_handle, ::mlir::Type flow_out, ::mlir::Value handle, ::mlir::Value flow_in, ::llvm::StringRef source); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value handle, ::mlir::Value flow_in, ::llvm::StringRef source); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TensorArrayGradV3Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TensorArrayReadV3Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorArrayReadV3OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorArrayReadV3OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorArrayReadV3OpGenericAdaptorBase(TensorArrayReadV3Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TensorArrayReadV3OpGenericAdaptor : public detail::TensorArrayReadV3OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorArrayReadV3OpGenericAdaptorBase; +public: + TensorArrayReadV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorArrayReadV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorArrayReadV3OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorArrayReadV3OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndex() { + return (*getODSOperands(1).begin()); + } + + ValueT getFlowIn() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorArrayReadV3OpAdaptor : public TensorArrayReadV3OpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorArrayReadV3OpGenericAdaptor::TensorArrayReadV3OpGenericAdaptor; + TensorArrayReadV3OpAdaptor(TensorArrayReadV3Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorArrayReadV3Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorArrayReadV3OpAdaptor; + template + using GenericAdaptor = TensorArrayReadV3OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TensorArrayReadV3"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::TypedValue<::mlir::TensorType> getIndex(); + ::mlir::TypedValue<::mlir::TensorType> getFlowIn(); + ::mlir::OpOperand &getHandleMutable(); + ::mlir::OpOperand &getIndexMutable(); + ::mlir::OpOperand &getFlowInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getValue(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type value, ::mlir::Value handle, ::mlir::Value index, ::mlir::Value flow_in); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value handle, ::mlir::Value index, ::mlir::Value flow_in); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TensorArrayReadV3Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TensorArrayScatterV3Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorArrayScatterV3OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorArrayScatterV3OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorArrayScatterV3OpGenericAdaptorBase(TensorArrayScatterV3Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TensorArrayScatterV3OpGenericAdaptor : public detail::TensorArrayScatterV3OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorArrayScatterV3OpGenericAdaptorBase; +public: + TensorArrayScatterV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorArrayScatterV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorArrayScatterV3OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorArrayScatterV3OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getValue() { + return (*getODSOperands(2).begin()); + } + + ValueT getFlowIn() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorArrayScatterV3OpAdaptor : public TensorArrayScatterV3OpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorArrayScatterV3OpGenericAdaptor::TensorArrayScatterV3OpGenericAdaptor; + TensorArrayScatterV3OpAdaptor(TensorArrayScatterV3Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorArrayScatterV3Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorArrayScatterV3OpAdaptor; + template + using GenericAdaptor = TensorArrayScatterV3OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TensorArrayScatterV3"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getValue(); + ::mlir::TypedValue<::mlir::TensorType> getFlowIn(); + ::mlir::OpOperand &getHandleMutable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getValueMutable(); + ::mlir::OpOperand &getFlowInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getFlowOut(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type flow_out, ::mlir::Value handle, ::mlir::Value indices, ::mlir::Value value, ::mlir::Value flow_in); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value handle, ::mlir::Value indices, ::mlir::Value value, ::mlir::Value flow_in); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TensorArrayScatterV3Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TensorArraySizeV3Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorArraySizeV3OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorArraySizeV3OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorArraySizeV3OpGenericAdaptorBase(TensorArraySizeV3Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TensorArraySizeV3OpGenericAdaptor : public detail::TensorArraySizeV3OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorArraySizeV3OpGenericAdaptorBase; +public: + TensorArraySizeV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorArraySizeV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorArraySizeV3OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorArraySizeV3OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getFlowIn() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorArraySizeV3OpAdaptor : public TensorArraySizeV3OpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorArraySizeV3OpGenericAdaptor::TensorArraySizeV3OpGenericAdaptor; + TensorArraySizeV3OpAdaptor(TensorArraySizeV3Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorArraySizeV3Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorArraySizeV3OpAdaptor; + template + using GenericAdaptor = TensorArraySizeV3OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TensorArraySizeV3"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::TypedValue<::mlir::TensorType> getFlowIn(); + ::mlir::OpOperand &getHandleMutable(); + ::mlir::OpOperand &getFlowInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSize(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type size, ::mlir::Value handle, ::mlir::Value flow_in); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value handle, ::mlir::Value flow_in); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TensorArraySizeV3Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TensorArraySplitV3Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorArraySplitV3OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorArraySplitV3OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorArraySplitV3OpGenericAdaptorBase(TensorArraySplitV3Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TensorArraySplitV3OpGenericAdaptor : public detail::TensorArraySplitV3OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorArraySplitV3OpGenericAdaptorBase; +public: + TensorArraySplitV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorArraySplitV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorArraySplitV3OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorArraySplitV3OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getValue() { + return (*getODSOperands(1).begin()); + } + + ValueT getLengths() { + return (*getODSOperands(2).begin()); + } + + ValueT getFlowIn() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorArraySplitV3OpAdaptor : public TensorArraySplitV3OpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorArraySplitV3OpGenericAdaptor::TensorArraySplitV3OpGenericAdaptor; + TensorArraySplitV3OpAdaptor(TensorArraySplitV3Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorArraySplitV3Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorArraySplitV3OpAdaptor; + template + using GenericAdaptor = TensorArraySplitV3OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TensorArraySplitV3"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::TypedValue<::mlir::TensorType> getValue(); + ::mlir::TypedValue<::mlir::TensorType> getLengths(); + ::mlir::TypedValue<::mlir::TensorType> getFlowIn(); + ::mlir::OpOperand &getHandleMutable(); + ::mlir::OpOperand &getValueMutable(); + ::mlir::OpOperand &getLengthsMutable(); + ::mlir::OpOperand &getFlowInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getFlowOut(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type flow_out, ::mlir::Value handle, ::mlir::Value value, ::mlir::Value lengths, ::mlir::Value flow_in); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value handle, ::mlir::Value value, ::mlir::Value lengths, ::mlir::Value flow_in); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TensorArraySplitV3Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TensorArrayV3Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorArrayV3OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorArrayV3OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorArrayV3OpGenericAdaptorBase(TensorArrayV3Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::TypeAttr getDtypeAttr(); + ::mlir::Type getDtype(); + ::mlir::Attribute getElementShapeAttr(); + std::optional> getElementShape(); + ::mlir::BoolAttr getDynamicSizeAttr(); + bool getDynamicSize(); + ::mlir::BoolAttr getClearAfterReadAttr(); + bool getClearAfterRead(); + ::mlir::BoolAttr getIdenticalElementShapesAttr(); + bool getIdenticalElementShapes(); + ::mlir::StringAttr getTensorArrayNameAttr(); + ::llvm::StringRef getTensorArrayName(); +}; +} // namespace detail +template +class TensorArrayV3OpGenericAdaptor : public detail::TensorArrayV3OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorArrayV3OpGenericAdaptorBase; +public: + TensorArrayV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorArrayV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorArrayV3OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorArrayV3OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSize() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorArrayV3OpAdaptor : public TensorArrayV3OpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorArrayV3OpGenericAdaptor::TensorArrayV3OpGenericAdaptor; + TensorArrayV3OpAdaptor(TensorArrayV3Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorArrayV3Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::OpAsmOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorArrayV3OpAdaptor; + template + using GenericAdaptor = TensorArrayV3OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("clear_after_read"), ::llvm::StringRef("dtype"), ::llvm::StringRef("dynamic_size"), ::llvm::StringRef("element_shape"), ::llvm::StringRef("identical_element_shapes"), ::llvm::StringRef("tensor_array_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getClearAfterReadAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getClearAfterReadAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDynamicSizeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDynamicSizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getElementShapeAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getElementShapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getIdenticalElementShapesAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getIdenticalElementShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getTensorArrayNameAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getTensorArrayNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TensorArrayV3"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSize(); + ::mlir::OpOperand &getSizeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::TypedValue<::mlir::TensorType> getFlow(); + ::mlir::TypeAttr getDtypeAttr(); + ::mlir::Type getDtype(); + ::mlir::Attribute getElementShapeAttr(); + std::optional> getElementShape(); + ::mlir::BoolAttr getDynamicSizeAttr(); + bool getDynamicSize(); + ::mlir::BoolAttr getClearAfterReadAttr(); + bool getClearAfterRead(); + ::mlir::BoolAttr getIdenticalElementShapesAttr(); + bool getIdenticalElementShapes(); + ::mlir::StringAttr getTensorArrayNameAttr(); + ::llvm::StringRef getTensorArrayName(); + void setDtypeAttr(::mlir::TypeAttr attr); + void setDtype(::mlir::Type attrValue); + void setElementShapeAttr(::mlir::Attribute attr); + void setElementShape(::std::optional>> attrValue); + void setDynamicSizeAttr(::mlir::BoolAttr attr); + void setDynamicSize(::std::optional attrValue); + void setClearAfterReadAttr(::mlir::BoolAttr attr); + void setClearAfterRead(::std::optional attrValue); + void setIdenticalElementShapesAttr(::mlir::BoolAttr attr); + void setIdenticalElementShapes(::std::optional attrValue); + void setTensorArrayNameAttr(::mlir::StringAttr attr); + void setTensorArrayName(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeElementShapeAttr(); + ::mlir::Attribute removeDynamicSizeAttr(); + ::mlir::Attribute removeClearAfterReadAttr(); + ::mlir::Attribute removeIdenticalElementShapesAttr(); + ::mlir::Attribute removeTensorArrayNameAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Type flow, ::mlir::Value size, ::mlir::TypeAttr dtype, /*optional*/::mlir::Attribute element_shape, /*optional*/::mlir::BoolAttr dynamic_size, /*optional*/::mlir::BoolAttr clear_after_read, /*optional*/::mlir::BoolAttr identical_element_shapes, /*optional*/::mlir::StringAttr tensor_array_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value size, ::mlir::TypeAttr dtype, /*optional*/::mlir::Attribute element_shape, /*optional*/::mlir::BoolAttr dynamic_size, /*optional*/::mlir::BoolAttr clear_after_read, /*optional*/::mlir::BoolAttr identical_element_shapes, /*optional*/::mlir::StringAttr tensor_array_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Type flow, ::mlir::Value size, ::mlir::Type dtype, /*optional*/std::optional> element_shape = std::nullopt, /*optional*/bool dynamic_size = false, /*optional*/bool clear_after_read = true, /*optional*/bool identical_element_shapes = false, /*optional*/::llvm::StringRef tensor_array_name = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value size, ::mlir::Type dtype, /*optional*/std::optional> element_shape = std::nullopt, /*optional*/bool dynamic_size = false, /*optional*/bool clear_after_read = true, /*optional*/bool identical_element_shapes = false, /*optional*/::llvm::StringRef tensor_array_name = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TensorArrayV3Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TensorArrayWriteV3Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorArrayWriteV3OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorArrayWriteV3OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorArrayWriteV3OpGenericAdaptorBase(TensorArrayWriteV3Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TensorArrayWriteV3OpGenericAdaptor : public detail::TensorArrayWriteV3OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorArrayWriteV3OpGenericAdaptorBase; +public: + TensorArrayWriteV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorArrayWriteV3OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorArrayWriteV3OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorArrayWriteV3OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndex() { + return (*getODSOperands(1).begin()); + } + + ValueT getValue() { + return (*getODSOperands(2).begin()); + } + + ValueT getFlowIn() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorArrayWriteV3OpAdaptor : public TensorArrayWriteV3OpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorArrayWriteV3OpGenericAdaptor::TensorArrayWriteV3OpGenericAdaptor; + TensorArrayWriteV3OpAdaptor(TensorArrayWriteV3Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorArrayWriteV3Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorArrayWriteV3OpAdaptor; + template + using GenericAdaptor = TensorArrayWriteV3OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TensorArrayWriteV3"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::TypedValue<::mlir::TensorType> getIndex(); + ::mlir::TypedValue<::mlir::TensorType> getValue(); + ::mlir::TypedValue<::mlir::TensorType> getFlowIn(); + ::mlir::OpOperand &getHandleMutable(); + ::mlir::OpOperand &getIndexMutable(); + ::mlir::OpOperand &getValueMutable(); + ::mlir::OpOperand &getFlowInMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getFlowOut(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type flow_out, ::mlir::Value handle, ::mlir::Value index, ::mlir::Value value, ::mlir::Value flow_in); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value handle, ::mlir::Value index, ::mlir::Value value, ::mlir::Value flow_in); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TensorArrayWriteV3Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TensorListConcatV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorListConcatV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorListConcatV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorListConcatV2OpGenericAdaptorBase(TensorListConcatV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TensorListConcatV2OpGenericAdaptor : public detail::TensorListConcatV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorListConcatV2OpGenericAdaptorBase; +public: + TensorListConcatV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorListConcatV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorListConcatV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorListConcatV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getElementShape() { + return (*getODSOperands(1).begin()); + } + + ValueT getLeadingDims() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorListConcatV2OpAdaptor : public TensorListConcatV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorListConcatV2OpGenericAdaptor::TensorListConcatV2OpGenericAdaptor; + TensorListConcatV2OpAdaptor(TensorListConcatV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorListConcatV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorListConcatV2OpAdaptor; + template + using GenericAdaptor = TensorListConcatV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("element_dtype"), ::llvm::StringRef("shape_type")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getElementDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getElementDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getShapeTypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getShapeTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TensorListConcatV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputHandle(); + ::mlir::TypedValue<::mlir::TensorType> getElementShape(); + ::mlir::TypedValue<::mlir::TensorType> getLeadingDims(); + ::mlir::OpOperand &getInputHandleMutable(); + ::mlir::OpOperand &getElementShapeMutable(); + ::mlir::OpOperand &getLeadingDimsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::TypedValue<::mlir::TensorType> getLengths(); + ::mlir::Type getShapeType(); + ::mlir::Type getElementDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type tensor, ::mlir::Type lengths, ::mlir::Value input_handle, ::mlir::Value element_shape, ::mlir::Value leading_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_handle, ::mlir::Value element_shape, ::mlir::Value leading_dims); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TensorListConcatV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TensorListElementShapeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorListElementShapeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorListElementShapeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorListElementShapeOpGenericAdaptorBase(TensorListElementShapeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TensorListElementShapeOpGenericAdaptor : public detail::TensorListElementShapeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorListElementShapeOpGenericAdaptorBase; +public: + TensorListElementShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorListElementShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorListElementShapeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorListElementShapeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputHandle() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorListElementShapeOpAdaptor : public TensorListElementShapeOpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorListElementShapeOpGenericAdaptor::TensorListElementShapeOpGenericAdaptor; + TensorListElementShapeOpAdaptor(TensorListElementShapeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorListElementShapeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorListElementShapeOpAdaptor; + template + using GenericAdaptor = TensorListElementShapeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("shape_type")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getShapeTypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getShapeTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TensorListElementShape"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputHandle(); + ::mlir::OpOperand &getInputHandleMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getElementShape(); + ::mlir::Type getShapeType(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type element_shape, ::mlir::Value input_handle); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_handle); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TensorListElementShapeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TensorListFromTensorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorListFromTensorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorListFromTensorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorListFromTensorOpGenericAdaptorBase(TensorListFromTensorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TensorListFromTensorOpGenericAdaptor : public detail::TensorListFromTensorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorListFromTensorOpGenericAdaptorBase; +public: + TensorListFromTensorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorListFromTensorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorListFromTensorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorListFromTensorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTensor() { + return (*getODSOperands(0).begin()); + } + + ValueT getElementShape() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorListFromTensorOpAdaptor : public TensorListFromTensorOpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorListFromTensorOpGenericAdaptor::TensorListFromTensorOpGenericAdaptor; + TensorListFromTensorOpAdaptor(TensorListFromTensorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorListFromTensorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorListFromTensorOpAdaptor; + template + using GenericAdaptor = TensorListFromTensorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("element_dtype"), ::llvm::StringRef("shape_type")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getElementDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getElementDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getShapeTypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getShapeTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TensorListFromTensor"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::TypedValue<::mlir::TensorType> getElementShape(); + ::mlir::OpOperand &getTensorMutable(); + ::mlir::OpOperand &getElementShapeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutputHandle(); + ::mlir::Type getElementDtype(); + ::mlir::Type getShapeType(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output_handle, ::mlir::Value tensor, ::mlir::Value element_shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tensor, ::mlir::Value element_shape); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TensorListFromTensorOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TensorListGatherOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorListGatherOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorListGatherOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorListGatherOpGenericAdaptorBase(TensorListGatherOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TensorListGatherOpGenericAdaptor : public detail::TensorListGatherOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorListGatherOpGenericAdaptorBase; +public: + TensorListGatherOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorListGatherOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorListGatherOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorListGatherOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getElementShape() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorListGatherOpAdaptor : public TensorListGatherOpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorListGatherOpGenericAdaptor::TensorListGatherOpGenericAdaptor; + TensorListGatherOpAdaptor(TensorListGatherOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorListGatherOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorListGatherOpAdaptor; + template + using GenericAdaptor = TensorListGatherOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("element_dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getElementDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getElementDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TensorListGather"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputHandle(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getElementShape(); + ::mlir::OpOperand &getInputHandleMutable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getElementShapeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getValues(); + ::mlir::Type getElementDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type values, ::mlir::Value input_handle, ::mlir::Value indices, ::mlir::Value element_shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_handle, ::mlir::Value indices, ::mlir::Value element_shape); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TensorListGatherOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TensorListGetItemOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorListGetItemOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorListGetItemOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorListGetItemOpGenericAdaptorBase(TensorListGetItemOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TensorListGetItemOpGenericAdaptor : public detail::TensorListGetItemOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorListGetItemOpGenericAdaptorBase; +public: + TensorListGetItemOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorListGetItemOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorListGetItemOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorListGetItemOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndex() { + return (*getODSOperands(1).begin()); + } + + ValueT getElementShape() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorListGetItemOpAdaptor : public TensorListGetItemOpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorListGetItemOpGenericAdaptor::TensorListGetItemOpGenericAdaptor; + TensorListGetItemOpAdaptor(TensorListGetItemOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorListGetItemOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorListGetItemOpAdaptor; + template + using GenericAdaptor = TensorListGetItemOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("element_dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getElementDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getElementDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TensorListGetItem"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputHandle(); + ::mlir::TypedValue<::mlir::TensorType> getIndex(); + ::mlir::TypedValue<::mlir::TensorType> getElementShape(); + ::mlir::OpOperand &getInputHandleMutable(); + ::mlir::OpOperand &getIndexMutable(); + ::mlir::OpOperand &getElementShapeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getItem(); + ::mlir::Type getElementDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type item, ::mlir::Value input_handle, ::mlir::Value index, ::mlir::Value element_shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_handle, ::mlir::Value index, ::mlir::Value element_shape); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TensorListGetItemOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TensorListLengthOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorListLengthOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorListLengthOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorListLengthOpGenericAdaptorBase(TensorListLengthOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TensorListLengthOpGenericAdaptor : public detail::TensorListLengthOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorListLengthOpGenericAdaptorBase; +public: + TensorListLengthOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorListLengthOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorListLengthOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorListLengthOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputHandle() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorListLengthOpAdaptor : public TensorListLengthOpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorListLengthOpGenericAdaptor::TensorListLengthOpGenericAdaptor; + TensorListLengthOpAdaptor(TensorListLengthOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorListLengthOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorListLengthOpAdaptor; + template + using GenericAdaptor = TensorListLengthOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TensorListLength"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputHandle(); + ::mlir::OpOperand &getInputHandleMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLength(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type length, ::mlir::Value input_handle); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_handle); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TensorListLengthOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TensorListPopBackOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorListPopBackOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorListPopBackOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorListPopBackOpGenericAdaptorBase(TensorListPopBackOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TensorListPopBackOpGenericAdaptor : public detail::TensorListPopBackOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorListPopBackOpGenericAdaptorBase; +public: + TensorListPopBackOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorListPopBackOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorListPopBackOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorListPopBackOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getElementShape() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorListPopBackOpAdaptor : public TensorListPopBackOpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorListPopBackOpGenericAdaptor::TensorListPopBackOpGenericAdaptor; + TensorListPopBackOpAdaptor(TensorListPopBackOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorListPopBackOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorListPopBackOpAdaptor; + template + using GenericAdaptor = TensorListPopBackOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("element_dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getElementDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getElementDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TensorListPopBack"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputHandle(); + ::mlir::TypedValue<::mlir::TensorType> getElementShape(); + ::mlir::OpOperand &getInputHandleMutable(); + ::mlir::OpOperand &getElementShapeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutputHandle(); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::Type getElementDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output_handle, ::mlir::Type tensor, ::mlir::Value input_handle, ::mlir::Value element_shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_handle, ::mlir::Value element_shape); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TensorListPopBackOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TensorListPushBackOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorListPushBackOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorListPushBackOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorListPushBackOpGenericAdaptorBase(TensorListPushBackOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TensorListPushBackOpGenericAdaptor : public detail::TensorListPushBackOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorListPushBackOpGenericAdaptorBase; +public: + TensorListPushBackOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorListPushBackOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorListPushBackOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorListPushBackOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getTensor() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorListPushBackOpAdaptor : public TensorListPushBackOpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorListPushBackOpGenericAdaptor::TensorListPushBackOpGenericAdaptor; + TensorListPushBackOpAdaptor(TensorListPushBackOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorListPushBackOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorListPushBackOpAdaptor; + template + using GenericAdaptor = TensorListPushBackOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("element_dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getElementDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getElementDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TensorListPushBack"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputHandle(); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::OpOperand &getInputHandleMutable(); + ::mlir::OpOperand &getTensorMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutputHandle(); + ::mlir::Type getElementDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output_handle, ::mlir::Value input_handle, ::mlir::Value tensor); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_handle, ::mlir::Value tensor); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TensorListPushBackOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TensorListReserveOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorListReserveOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorListReserveOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorListReserveOpGenericAdaptorBase(TensorListReserveOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TensorListReserveOpGenericAdaptor : public detail::TensorListReserveOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorListReserveOpGenericAdaptorBase; +public: + TensorListReserveOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorListReserveOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorListReserveOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorListReserveOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getElementShape() { + return (*getODSOperands(0).begin()); + } + + ValueT getNumElements() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorListReserveOpAdaptor : public TensorListReserveOpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorListReserveOpGenericAdaptor::TensorListReserveOpGenericAdaptor; + TensorListReserveOpAdaptor(TensorListReserveOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorListReserveOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorListReserveOpAdaptor; + template + using GenericAdaptor = TensorListReserveOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("element_dtype"), ::llvm::StringRef("shape_type")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getElementDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getElementDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getShapeTypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getShapeTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TensorListReserve"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getElementShape(); + ::mlir::TypedValue<::mlir::TensorType> getNumElements(); + ::mlir::OpOperand &getElementShapeMutable(); + ::mlir::OpOperand &getNumElementsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::Type getShapeType(); + ::mlir::Type getElementDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::Value element_shape, ::mlir::Value num_elements); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value element_shape, ::mlir::Value num_elements); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Returns type of the TensorList element produced by this op. + TensorType element_type() { return handle_dtype().getSubtypes()[0]; } + + // Returns data type of the result handle. Returned type contains type of + // the TensorList element as a subtype. + VariantType handle_dtype() { + return getElementTypeOrSelf(getHandle().getType()).cast(); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TensorListReserveOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TensorListResizeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorListResizeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorListResizeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorListResizeOpGenericAdaptorBase(TensorListResizeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TensorListResizeOpGenericAdaptor : public detail::TensorListResizeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorListResizeOpGenericAdaptorBase; +public: + TensorListResizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorListResizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorListResizeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorListResizeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getSize() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorListResizeOpAdaptor : public TensorListResizeOpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorListResizeOpGenericAdaptor::TensorListResizeOpGenericAdaptor; + TensorListResizeOpAdaptor(TensorListResizeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorListResizeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorListResizeOpAdaptor; + template + using GenericAdaptor = TensorListResizeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TensorListResize"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputHandle(); + ::mlir::TypedValue<::mlir::TensorType> getSize(); + ::mlir::OpOperand &getInputHandleMutable(); + ::mlir::OpOperand &getSizeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutputHandle(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output_handle, ::mlir::Value input_handle, ::mlir::Value size); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_handle, ::mlir::Value size); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TensorListResizeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TensorListScatterIntoExistingListOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorListScatterIntoExistingListOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorListScatterIntoExistingListOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorListScatterIntoExistingListOpGenericAdaptorBase(TensorListScatterIntoExistingListOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TensorListScatterIntoExistingListOpGenericAdaptor : public detail::TensorListScatterIntoExistingListOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorListScatterIntoExistingListOpGenericAdaptorBase; +public: + TensorListScatterIntoExistingListOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorListScatterIntoExistingListOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorListScatterIntoExistingListOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorListScatterIntoExistingListOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getTensor() { + return (*getODSOperands(1).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorListScatterIntoExistingListOpAdaptor : public TensorListScatterIntoExistingListOpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorListScatterIntoExistingListOpGenericAdaptor::TensorListScatterIntoExistingListOpGenericAdaptor; + TensorListScatterIntoExistingListOpAdaptor(TensorListScatterIntoExistingListOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorListScatterIntoExistingListOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorListScatterIntoExistingListOpAdaptor; + template + using GenericAdaptor = TensorListScatterIntoExistingListOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("element_dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getElementDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getElementDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TensorListScatterIntoExistingList"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputHandle(); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::OpOperand &getInputHandleMutable(); + ::mlir::OpOperand &getTensorMutable(); + ::mlir::OpOperand &getIndicesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutputHandle(); + ::mlir::Type getElementDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output_handle, ::mlir::Value input_handle, ::mlir::Value tensor, ::mlir::Value indices); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_handle, ::mlir::Value tensor, ::mlir::Value indices); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TensorListScatterIntoExistingListOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TensorListSetItemOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorListSetItemOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorListSetItemOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorListSetItemOpGenericAdaptorBase(TensorListSetItemOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getResizeIfIndexOutOfBoundsAttr(); + bool getResizeIfIndexOutOfBounds(); +}; +} // namespace detail +template +class TensorListSetItemOpGenericAdaptor : public detail::TensorListSetItemOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorListSetItemOpGenericAdaptorBase; +public: + TensorListSetItemOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorListSetItemOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorListSetItemOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorListSetItemOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndex() { + return (*getODSOperands(1).begin()); + } + + ValueT getItem() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorListSetItemOpAdaptor : public TensorListSetItemOpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorListSetItemOpGenericAdaptor::TensorListSetItemOpGenericAdaptor; + TensorListSetItemOpAdaptor(TensorListSetItemOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorListSetItemOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorListSetItemOpAdaptor; + template + using GenericAdaptor = TensorListSetItemOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("element_dtype"), ::llvm::StringRef("resize_if_index_out_of_bounds")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getElementDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getElementDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getResizeIfIndexOutOfBoundsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getResizeIfIndexOutOfBoundsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TensorListSetItem"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputHandle(); + ::mlir::TypedValue<::mlir::TensorType> getIndex(); + ::mlir::TypedValue<::mlir::TensorType> getItem(); + ::mlir::OpOperand &getInputHandleMutable(); + ::mlir::OpOperand &getIndexMutable(); + ::mlir::OpOperand &getItemMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutputHandle(); + ::mlir::BoolAttr getResizeIfIndexOutOfBoundsAttr(); + bool getResizeIfIndexOutOfBounds(); + ::mlir::Type getElementDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setResizeIfIndexOutOfBoundsAttr(::mlir::BoolAttr attr); + void setResizeIfIndexOutOfBounds(::std::optional attrValue); + ::mlir::Attribute removeResizeIfIndexOutOfBoundsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output_handle, ::mlir::Value input_handle, ::mlir::Value index, ::mlir::Value item, /*optional*/::mlir::BoolAttr resize_if_index_out_of_bounds); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_handle, ::mlir::Value index, ::mlir::Value item, /*optional*/::mlir::BoolAttr resize_if_index_out_of_bounds); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output_handle, ::mlir::Value input_handle, ::mlir::Value index, ::mlir::Value item, /*optional*/bool resize_if_index_out_of_bounds = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_handle, ::mlir::Value index, ::mlir::Value item, /*optional*/bool resize_if_index_out_of_bounds = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TensorListSetItemOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TensorListStackOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorListStackOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorListStackOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorListStackOpGenericAdaptorBase(TensorListStackOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getNumElementsAttr(); + uint64_t getNumElements(); +}; +} // namespace detail +template +class TensorListStackOpGenericAdaptor : public detail::TensorListStackOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorListStackOpGenericAdaptorBase; +public: + TensorListStackOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorListStackOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorListStackOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorListStackOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInputHandle() { + return (*getODSOperands(0).begin()); + } + + ValueT getElementShape() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorListStackOpAdaptor : public TensorListStackOpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorListStackOpGenericAdaptor::TensorListStackOpGenericAdaptor; + TensorListStackOpAdaptor(TensorListStackOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorListStackOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorListStackOpAdaptor; + template + using GenericAdaptor = TensorListStackOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("element_dtype"), ::llvm::StringRef("num_elements")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getElementDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getElementDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumElementsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumElementsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TensorListStack"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInputHandle(); + ::mlir::TypedValue<::mlir::TensorType> getElementShape(); + ::mlir::OpOperand &getInputHandleMutable(); + ::mlir::OpOperand &getElementShapeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::IntegerAttr getNumElementsAttr(); + uint64_t getNumElements(); + ::mlir::Type getElementDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setNumElementsAttr(::mlir::IntegerAttr attr); + void setNumElements(::std::optional attrValue); + ::mlir::Attribute removeNumElementsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type tensor, ::mlir::Value input_handle, ::mlir::Value element_shape, /*optional*/::mlir::IntegerAttr num_elements); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_handle, ::mlir::Value element_shape, /*optional*/::mlir::IntegerAttr num_elements); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type tensor, ::mlir::Value input_handle, ::mlir::Value element_shape, /*optional*/uint64_t num_elements = -1); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input_handle, ::mlir::Value element_shape, /*optional*/uint64_t num_elements = -1); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TensorListStackOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TensorScatterAddOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorScatterAddOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorScatterAddOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorScatterAddOpGenericAdaptorBase(TensorScatterAddOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TensorScatterAddOpGenericAdaptor : public detail::TensorScatterAddOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorScatterAddOpGenericAdaptorBase; +public: + TensorScatterAddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorScatterAddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorScatterAddOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorScatterAddOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTensor() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getUpdates() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorScatterAddOpAdaptor : public TensorScatterAddOpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorScatterAddOpGenericAdaptor::TensorScatterAddOpGenericAdaptor; + TensorScatterAddOpAdaptor(TensorScatterAddOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorScatterAddOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorScatterAddOpAdaptor; + template + using GenericAdaptor = TensorScatterAddOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TensorScatterAdd"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getUpdates(); + ::mlir::OpOperand &getTensorMutable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getUpdatesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value tensor, Value indices, Value updates); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value tensor, ::mlir::Value indices, ::mlir::Value updates); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tensor, ::mlir::Value indices, ::mlir::Value updates); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TensorScatterAddOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TensorScatterMaxOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorScatterMaxOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorScatterMaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorScatterMaxOpGenericAdaptorBase(TensorScatterMaxOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TensorScatterMaxOpGenericAdaptor : public detail::TensorScatterMaxOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorScatterMaxOpGenericAdaptorBase; +public: + TensorScatterMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorScatterMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorScatterMaxOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorScatterMaxOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTensor() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getUpdates() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorScatterMaxOpAdaptor : public TensorScatterMaxOpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorScatterMaxOpGenericAdaptor::TensorScatterMaxOpGenericAdaptor; + TensorScatterMaxOpAdaptor(TensorScatterMaxOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorScatterMaxOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorScatterMaxOpAdaptor; + template + using GenericAdaptor = TensorScatterMaxOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TensorScatterMax"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getUpdates(); + ::mlir::OpOperand &getTensorMutable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getUpdatesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value tensor, ::mlir::Value indices, ::mlir::Value updates); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tensor, ::mlir::Value indices, ::mlir::Value updates); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TensorScatterMaxOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TensorScatterMinOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorScatterMinOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorScatterMinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorScatterMinOpGenericAdaptorBase(TensorScatterMinOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TensorScatterMinOpGenericAdaptor : public detail::TensorScatterMinOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorScatterMinOpGenericAdaptorBase; +public: + TensorScatterMinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorScatterMinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorScatterMinOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorScatterMinOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTensor() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getUpdates() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorScatterMinOpAdaptor : public TensorScatterMinOpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorScatterMinOpGenericAdaptor::TensorScatterMinOpGenericAdaptor; + TensorScatterMinOpAdaptor(TensorScatterMinOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorScatterMinOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorScatterMinOpAdaptor; + template + using GenericAdaptor = TensorScatterMinOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TensorScatterMin"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getUpdates(); + ::mlir::OpOperand &getTensorMutable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getUpdatesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value tensor, ::mlir::Value indices, ::mlir::Value updates); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tensor, ::mlir::Value indices, ::mlir::Value updates); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TensorScatterMinOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TensorScatterSubOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorScatterSubOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorScatterSubOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorScatterSubOpGenericAdaptorBase(TensorScatterSubOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TensorScatterSubOpGenericAdaptor : public detail::TensorScatterSubOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorScatterSubOpGenericAdaptorBase; +public: + TensorScatterSubOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorScatterSubOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorScatterSubOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorScatterSubOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTensor() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getUpdates() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorScatterSubOpAdaptor : public TensorScatterSubOpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorScatterSubOpGenericAdaptor::TensorScatterSubOpGenericAdaptor; + TensorScatterSubOpAdaptor(TensorScatterSubOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorScatterSubOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorScatterSubOpAdaptor; + template + using GenericAdaptor = TensorScatterSubOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TensorScatterSub"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getUpdates(); + ::mlir::OpOperand &getTensorMutable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getUpdatesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value tensor, ::mlir::Value indices, ::mlir::Value updates); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tensor, ::mlir::Value indices, ::mlir::Value updates); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TensorScatterSubOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TensorScatterUpdateOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorScatterUpdateOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorScatterUpdateOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorScatterUpdateOpGenericAdaptorBase(TensorScatterUpdateOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TensorScatterUpdateOpGenericAdaptor : public detail::TensorScatterUpdateOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorScatterUpdateOpGenericAdaptorBase; +public: + TensorScatterUpdateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorScatterUpdateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorScatterUpdateOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorScatterUpdateOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTensor() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getUpdates() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorScatterUpdateOpAdaptor : public TensorScatterUpdateOpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorScatterUpdateOpGenericAdaptor::TensorScatterUpdateOpGenericAdaptor; + TensorScatterUpdateOpAdaptor(TensorScatterUpdateOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorScatterUpdateOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorScatterUpdateOpAdaptor; + template + using GenericAdaptor = TensorScatterUpdateOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TensorScatterUpdate"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getUpdates(); + ::mlir::OpOperand &getTensorMutable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getUpdatesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value tensor, Value indices, Value updates); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value tensor, ::mlir::Value indices, ::mlir::Value updates); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tensor, ::mlir::Value indices, ::mlir::Value updates); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TensorScatterUpdateOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TensorSliceDatasetOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorSliceDatasetOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorSliceDatasetOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorSliceDatasetOpGenericAdaptorBase(TensorSliceDatasetOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::BoolAttr getIsFilesAttr(); + bool getIsFiles(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); + ::mlir::BoolAttr getReplicateOnSplitAttr(); + bool getReplicateOnSplit(); +}; +} // namespace detail +template +class TensorSliceDatasetOpGenericAdaptor : public detail::TensorSliceDatasetOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorSliceDatasetOpGenericAdaptorBase; +public: + TensorSliceDatasetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorSliceDatasetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorSliceDatasetOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorSliceDatasetOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getComponents() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorSliceDatasetOpAdaptor : public TensorSliceDatasetOpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorSliceDatasetOpGenericAdaptor::TensorSliceDatasetOpGenericAdaptor; + TensorSliceDatasetOpAdaptor(TensorSliceDatasetOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorSliceDatasetOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorSliceDatasetOpAdaptor; + template + using GenericAdaptor = TensorSliceDatasetOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Toutput_types"), ::llvm::StringRef("is_files"), ::llvm::StringRef("metadata"), ::llvm::StringRef("output_shapes"), ::llvm::StringRef("replicate_on_split")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getToutputTypesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getToutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getIsFilesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getIsFilesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getMetadataAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getMetadataAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getReplicateOnSplitAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getReplicateOnSplitAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TensorSliceDataset"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getComponents(); + ::mlir::MutableOperandRange getComponentsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getHandle(); + ::mlir::ArrayAttr getOutputShapesAttr(); + ::mlir::ArrayAttr getOutputShapes(); + ::mlir::BoolAttr getIsFilesAttr(); + bool getIsFiles(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); + ::mlir::BoolAttr getReplicateOnSplitAttr(); + bool getReplicateOnSplit(); + mlir::OperandElementTypeRange getToutputTypes(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setOutputShapesAttr(::mlir::ArrayAttr attr); + void setIsFilesAttr(::mlir::BoolAttr attr); + void setIsFiles(::std::optional attrValue); + void setMetadataAttr(::mlir::StringAttr attr); + void setMetadata(::std::optional<::llvm::StringRef> attrValue); + void setReplicateOnSplitAttr(::mlir::BoolAttr attr); + void setReplicateOnSplit(::std::optional attrValue); + ::mlir::Attribute removeIsFilesAttr(); + ::mlir::Attribute removeMetadataAttr(); + ::mlir::Attribute removeReplicateOnSplitAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::ValueRange components, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::BoolAttr is_files, /*optional*/::mlir::StringAttr metadata, /*optional*/::mlir::BoolAttr replicate_on_split); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange components, ::mlir::ArrayAttr output_shapes, /*optional*/::mlir::BoolAttr is_files, /*optional*/::mlir::StringAttr metadata, /*optional*/::mlir::BoolAttr replicate_on_split); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type handle, ::mlir::ValueRange components, ::mlir::ArrayAttr output_shapes, /*optional*/bool is_files = false, /*optional*/::llvm::StringRef metadata = "", /*optional*/bool replicate_on_split = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange components, ::mlir::ArrayAttr output_shapes, /*optional*/bool is_files = false, /*optional*/::llvm::StringRef metadata = "", /*optional*/bool replicate_on_split = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TensorSliceDatasetOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TensorStridedSliceUpdateOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TensorStridedSliceUpdateOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TensorStridedSliceUpdateOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TensorStridedSliceUpdateOpGenericAdaptorBase(TensorStridedSliceUpdateOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getBeginMaskAttr(); + uint64_t getBeginMask(); + ::mlir::IntegerAttr getEndMaskAttr(); + uint64_t getEndMask(); + ::mlir::IntegerAttr getEllipsisMaskAttr(); + uint64_t getEllipsisMask(); + ::mlir::IntegerAttr getNewAxisMaskAttr(); + uint64_t getNewAxisMask(); + ::mlir::IntegerAttr getShrinkAxisMaskAttr(); + uint64_t getShrinkAxisMask(); +}; +} // namespace detail +template +class TensorStridedSliceUpdateOpGenericAdaptor : public detail::TensorStridedSliceUpdateOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TensorStridedSliceUpdateOpGenericAdaptorBase; +public: + TensorStridedSliceUpdateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TensorStridedSliceUpdateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TensorStridedSliceUpdateOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TensorStridedSliceUpdateOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getBegin() { + return (*getODSOperands(1).begin()); + } + + ValueT getEnd() { + return (*getODSOperands(2).begin()); + } + + ValueT getStrides() { + return (*getODSOperands(3).begin()); + } + + ValueT getValue() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TensorStridedSliceUpdateOpAdaptor : public TensorStridedSliceUpdateOpGenericAdaptor<::mlir::ValueRange> { +public: + using TensorStridedSliceUpdateOpGenericAdaptor::TensorStridedSliceUpdateOpGenericAdaptor; + TensorStridedSliceUpdateOpAdaptor(TensorStridedSliceUpdateOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TensorStridedSliceUpdateOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<5>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TensorStridedSliceUpdateOpAdaptor; + template + using GenericAdaptor = TensorStridedSliceUpdateOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Index"), ::llvm::StringRef("T"), ::llvm::StringRef("begin_mask"), ::llvm::StringRef("ellipsis_mask"), ::llvm::StringRef("end_mask"), ::llvm::StringRef("new_axis_mask"), ::llvm::StringRef("shrink_axis_mask")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getIndexAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getIndexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getBeginMaskAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getBeginMaskAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getEllipsisMaskAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getEllipsisMaskAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getEndMaskAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getEndMaskAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getNewAxisMaskAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getNewAxisMaskAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getShrinkAxisMaskAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getShrinkAxisMaskAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TensorStridedSliceUpdate"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getBegin(); + ::mlir::TypedValue<::mlir::TensorType> getEnd(); + ::mlir::TypedValue<::mlir::TensorType> getStrides(); + ::mlir::TypedValue<::mlir::TensorType> getValue(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getBeginMutable(); + ::mlir::OpOperand &getEndMutable(); + ::mlir::OpOperand &getStridesMutable(); + ::mlir::OpOperand &getValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getBeginMaskAttr(); + uint64_t getBeginMask(); + ::mlir::IntegerAttr getEndMaskAttr(); + uint64_t getEndMask(); + ::mlir::IntegerAttr getEllipsisMaskAttr(); + uint64_t getEllipsisMask(); + ::mlir::IntegerAttr getNewAxisMaskAttr(); + uint64_t getNewAxisMask(); + ::mlir::IntegerAttr getShrinkAxisMaskAttr(); + uint64_t getShrinkAxisMask(); + ::mlir::Type getIndex(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setBeginMaskAttr(::mlir::IntegerAttr attr); + void setBeginMask(::std::optional attrValue); + void setEndMaskAttr(::mlir::IntegerAttr attr); + void setEndMask(::std::optional attrValue); + void setEllipsisMaskAttr(::mlir::IntegerAttr attr); + void setEllipsisMask(::std::optional attrValue); + void setNewAxisMaskAttr(::mlir::IntegerAttr attr); + void setNewAxisMask(::std::optional attrValue); + void setShrinkAxisMaskAttr(::mlir::IntegerAttr attr); + void setShrinkAxisMask(::std::optional attrValue); + ::mlir::Attribute removeBeginMaskAttr(); + ::mlir::Attribute removeEndMaskAttr(); + ::mlir::Attribute removeEllipsisMaskAttr(); + ::mlir::Attribute removeNewAxisMaskAttr(); + ::mlir::Attribute removeShrinkAxisMaskAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value begin, ::mlir::Value end, ::mlir::Value strides, ::mlir::Value value, /*optional*/::mlir::IntegerAttr begin_mask, /*optional*/::mlir::IntegerAttr end_mask, /*optional*/::mlir::IntegerAttr ellipsis_mask, /*optional*/::mlir::IntegerAttr new_axis_mask, /*optional*/::mlir::IntegerAttr shrink_axis_mask); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value begin, ::mlir::Value end, ::mlir::Value strides, ::mlir::Value value, /*optional*/::mlir::IntegerAttr begin_mask, /*optional*/::mlir::IntegerAttr end_mask, /*optional*/::mlir::IntegerAttr ellipsis_mask, /*optional*/::mlir::IntegerAttr new_axis_mask, /*optional*/::mlir::IntegerAttr shrink_axis_mask); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value begin, ::mlir::Value end, ::mlir::Value strides, ::mlir::Value value, /*optional*/uint64_t begin_mask = 0, /*optional*/uint64_t end_mask = 0, /*optional*/uint64_t ellipsis_mask = 0, /*optional*/uint64_t new_axis_mask = 0, /*optional*/uint64_t shrink_axis_mask = 0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value begin, ::mlir::Value end, ::mlir::Value strides, ::mlir::Value value, /*optional*/uint64_t begin_mask = 0, /*optional*/uint64_t end_mask = 0, /*optional*/uint64_t ellipsis_mask = 0, /*optional*/uint64_t new_axis_mask = 0, /*optional*/uint64_t shrink_axis_mask = 0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 7 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TensorStridedSliceUpdateOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TileOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TileOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TileOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TileOpGenericAdaptorBase(TileOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TileOpGenericAdaptor : public detail::TileOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TileOpGenericAdaptorBase; +public: + TileOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TileOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TileOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TileOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getMultiples() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TileOpAdaptor : public TileOpGenericAdaptor<::mlir::ValueRange> { +public: + using TileOpGenericAdaptor::TileOpGenericAdaptor; + TileOpAdaptor(TileOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TileOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TileOpAdaptor; + template + using GenericAdaptor = TileOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tmultiples")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTmultiplesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTmultiplesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Tile"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getMultiples(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getMultiplesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTmultiples(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value multiples); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value multiples); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TileOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TimestampOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TimestampOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TimestampOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TimestampOpGenericAdaptorBase(TimestampOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TimestampOpGenericAdaptor : public detail::TimestampOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TimestampOpGenericAdaptorBase; +public: + TimestampOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TimestampOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TimestampOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TimestampOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TimestampOpAdaptor : public TimestampOpGenericAdaptor<::mlir::ValueRange> { +public: + using TimestampOpGenericAdaptor::TimestampOpGenericAdaptor; + TimestampOpAdaptor(TimestampOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TimestampOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = TimestampOpAdaptor; + template + using GenericAdaptor = TimestampOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Timestamp"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTs(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type ts); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TimestampOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ToBoolOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ToBoolOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ToBoolOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ToBoolOpGenericAdaptorBase(ToBoolOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ToBoolOpGenericAdaptor : public detail::ToBoolOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ToBoolOpGenericAdaptorBase; +public: + ToBoolOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ToBoolOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ToBoolOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ToBoolOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ToBoolOpAdaptor : public ToBoolOpGenericAdaptor<::mlir::ValueRange> { +public: + using ToBoolOpGenericAdaptor::ToBoolOpGenericAdaptor; + ToBoolOpAdaptor(ToBoolOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ToBoolOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::InferTypeOpInterface::Trait, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ToBoolOpAdaptor; + template + using GenericAdaptor = ToBoolOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ToBool"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // InferTypeOpInterface: + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return ArraysAreCastCompatible(l, r); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ToBoolOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TopKUniqueOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TopKUniqueOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TopKUniqueOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TopKUniqueOpGenericAdaptorBase(TopKUniqueOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getKAttr(); + uint64_t getK(); +}; +} // namespace detail +template +class TopKUniqueOpGenericAdaptor : public detail::TopKUniqueOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TopKUniqueOpGenericAdaptorBase; +public: + TopKUniqueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TopKUniqueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TopKUniqueOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TopKUniqueOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TopKUniqueOpAdaptor : public TopKUniqueOpGenericAdaptor<::mlir::ValueRange> { +public: + using TopKUniqueOpGenericAdaptor::TopKUniqueOpGenericAdaptor; + TopKUniqueOpAdaptor(TopKUniqueOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TopKUniqueOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TopKUniqueOpAdaptor; + template + using GenericAdaptor = TopKUniqueOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("k")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getKAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getKAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TopKUnique"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTopk(); + ::mlir::TypedValue<::mlir::TensorType> getTopkIndices(); + ::mlir::IntegerAttr getKAttr(); + uint64_t getK(); + void setKAttr(::mlir::IntegerAttr attr); + void setK(uint64_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type topk, ::mlir::Type topk_indices, ::mlir::Value input, ::mlir::IntegerAttr k); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::IntegerAttr k); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type topk, ::mlir::Type topk_indices, ::mlir::Value input, uint64_t k); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, uint64_t k); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TopKUniqueOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TopKV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TopKV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TopKV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TopKV2OpGenericAdaptorBase(TopKV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getSortedAttr(); + bool getSorted(); +}; +} // namespace detail +template +class TopKV2OpGenericAdaptor : public detail::TopKV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TopKV2OpGenericAdaptorBase; +public: + TopKV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TopKV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TopKV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TopKV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getK() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TopKV2OpAdaptor : public TopKV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using TopKV2OpGenericAdaptor::TopKV2OpGenericAdaptor; + TopKV2OpAdaptor(TopKV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TopKV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TopKV2OpAdaptor; + template + using GenericAdaptor = TopKV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tk"), ::llvm::StringRef("index_type"), ::llvm::StringRef("sorted")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTkAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTkAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getIndexTypeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getIndexTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSortedAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSortedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TopKV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getK(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getKMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getValues(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::BoolAttr getSortedAttr(); + bool getSorted(); + ::mlir::Type getT(); + ::mlir::Type getTk(); + ::mlir::Type getIndexType(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setSortedAttr(::mlir::BoolAttr attr); + void setSorted(::std::optional attrValue); + ::mlir::Attribute removeSortedAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type values, ::mlir::Type indices, ::mlir::Value input, ::mlir::Value k, /*optional*/::mlir::BoolAttr sorted); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value k, /*optional*/::mlir::BoolAttr sorted); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type values, ::mlir::Type indices, ::mlir::Value input, ::mlir::Value k, /*optional*/bool sorted = true); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value k, /*optional*/bool sorted = true); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TopKV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TopKWithUniqueOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TopKWithUniqueOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TopKWithUniqueOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TopKWithUniqueOpGenericAdaptorBase(TopKWithUniqueOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getKAttr(); + uint64_t getK(); +}; +} // namespace detail +template +class TopKWithUniqueOpGenericAdaptor : public detail::TopKWithUniqueOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TopKWithUniqueOpGenericAdaptorBase; +public: + TopKWithUniqueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TopKWithUniqueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TopKWithUniqueOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TopKWithUniqueOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TopKWithUniqueOpAdaptor : public TopKWithUniqueOpGenericAdaptor<::mlir::ValueRange> { +public: + using TopKWithUniqueOpGenericAdaptor::TopKWithUniqueOpGenericAdaptor; + TopKWithUniqueOpAdaptor(TopKWithUniqueOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TopKWithUniqueOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TopKWithUniqueOpAdaptor; + template + using GenericAdaptor = TopKWithUniqueOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("k")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getKAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getKAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TopKWithUnique"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTopk(); + ::mlir::TypedValue<::mlir::TensorType> getTopkIndices(); + ::mlir::IntegerAttr getKAttr(); + uint64_t getK(); + void setKAttr(::mlir::IntegerAttr attr); + void setK(uint64_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type topk, ::mlir::Type topk_indices, ::mlir::Value input, ::mlir::IntegerAttr k); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::IntegerAttr k); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type topk, ::mlir::Type topk_indices, ::mlir::Value input, uint64_t k); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, uint64_t k); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TopKWithUniqueOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TransposeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TransposeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TransposeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TransposeOpGenericAdaptorBase(TransposeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TransposeOpGenericAdaptor : public detail::TransposeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TransposeOpGenericAdaptorBase; +public: + TransposeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TransposeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TransposeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TransposeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getPerm() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TransposeOpAdaptor : public TransposeOpGenericAdaptor<::mlir::ValueRange> { +public: + using TransposeOpGenericAdaptor::TransposeOpGenericAdaptor; + TransposeOpAdaptor(TransposeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TransposeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TransposeOpAdaptor; + template + using GenericAdaptor = TransposeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tperm")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTpermAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTpermAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Transpose"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getPerm(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getPermMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + ::mlir::Type getTperm(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value perm); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x, ::mlir::Value perm); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value perm); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TransposeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TridiagonalMatMulOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TridiagonalMatMulOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TridiagonalMatMulOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TridiagonalMatMulOpGenericAdaptorBase(TridiagonalMatMulOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TridiagonalMatMulOpGenericAdaptor : public detail::TridiagonalMatMulOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TridiagonalMatMulOpGenericAdaptorBase; +public: + TridiagonalMatMulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TridiagonalMatMulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TridiagonalMatMulOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TridiagonalMatMulOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSuperdiag() { + return (*getODSOperands(0).begin()); + } + + ValueT getMaindiag() { + return (*getODSOperands(1).begin()); + } + + ValueT getSubdiag() { + return (*getODSOperands(2).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TridiagonalMatMulOpAdaptor : public TridiagonalMatMulOpGenericAdaptor<::mlir::ValueRange> { +public: + using TridiagonalMatMulOpGenericAdaptor::TridiagonalMatMulOpGenericAdaptor; + TridiagonalMatMulOpAdaptor(TridiagonalMatMulOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TridiagonalMatMulOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TridiagonalMatMulOpAdaptor; + template + using GenericAdaptor = TridiagonalMatMulOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TridiagonalMatMul"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSuperdiag(); + ::mlir::TypedValue<::mlir::TensorType> getMaindiag(); + ::mlir::TypedValue<::mlir::TensorType> getSubdiag(); + ::mlir::TypedValue<::mlir::TensorType> getRhs(); + ::mlir::OpOperand &getSuperdiagMutable(); + ::mlir::OpOperand &getMaindiagMutable(); + ::mlir::OpOperand &getSubdiagMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value superdiag, ::mlir::Value maindiag, ::mlir::Value subdiag, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value superdiag, ::mlir::Value maindiag, ::mlir::Value subdiag, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TridiagonalMatMulOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TridiagonalSolveOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TridiagonalSolveOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TridiagonalSolveOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TridiagonalSolveOpGenericAdaptorBase(TridiagonalSolveOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getPartialPivotingAttr(); + bool getPartialPivoting(); + ::mlir::BoolAttr getPerturbSingularAttr(); + bool getPerturbSingular(); +}; +} // namespace detail +template +class TridiagonalSolveOpGenericAdaptor : public detail::TridiagonalSolveOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TridiagonalSolveOpGenericAdaptorBase; +public: + TridiagonalSolveOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TridiagonalSolveOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TridiagonalSolveOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TridiagonalSolveOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getDiagonals() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TridiagonalSolveOpAdaptor : public TridiagonalSolveOpGenericAdaptor<::mlir::ValueRange> { +public: + using TridiagonalSolveOpGenericAdaptor::TridiagonalSolveOpGenericAdaptor; + TridiagonalSolveOpAdaptor(TridiagonalSolveOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TridiagonalSolveOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TridiagonalSolveOpAdaptor; + template + using GenericAdaptor = TridiagonalSolveOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("partial_pivoting"), ::llvm::StringRef("perturb_singular")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getPartialPivotingAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getPartialPivotingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getPerturbSingularAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getPerturbSingularAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TridiagonalSolve"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getDiagonals(); + ::mlir::TypedValue<::mlir::TensorType> getRhs(); + ::mlir::OpOperand &getDiagonalsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::BoolAttr getPartialPivotingAttr(); + bool getPartialPivoting(); + ::mlir::BoolAttr getPerturbSingularAttr(); + bool getPerturbSingular(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setPartialPivotingAttr(::mlir::BoolAttr attr); + void setPartialPivoting(::std::optional attrValue); + void setPerturbSingularAttr(::mlir::BoolAttr attr); + void setPerturbSingular(::std::optional attrValue); + ::mlir::Attribute removePartialPivotingAttr(); + ::mlir::Attribute removePerturbSingularAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value diagonals, ::mlir::Value rhs, /*optional*/::mlir::BoolAttr partial_pivoting, /*optional*/::mlir::BoolAttr perturb_singular); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value diagonals, ::mlir::Value rhs, /*optional*/::mlir::BoolAttr partial_pivoting, /*optional*/::mlir::BoolAttr perturb_singular); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value diagonals, ::mlir::Value rhs, /*optional*/bool partial_pivoting = true, /*optional*/bool perturb_singular = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value diagonals, ::mlir::Value rhs, /*optional*/bool partial_pivoting = true, /*optional*/bool perturb_singular = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TridiagonalSolveOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TruncateDivOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TruncateDivOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TruncateDivOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TruncateDivOpGenericAdaptorBase(TruncateDivOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TruncateDivOpGenericAdaptor : public detail::TruncateDivOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TruncateDivOpGenericAdaptorBase; +public: + TruncateDivOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TruncateDivOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TruncateDivOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TruncateDivOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TruncateDivOpAdaptor : public TruncateDivOpGenericAdaptor<::mlir::ValueRange> { +public: + using TruncateDivOpGenericAdaptor::TruncateDivOpGenericAdaptor; + TruncateDivOpAdaptor(TruncateDivOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TruncateDivOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TruncateDivOpAdaptor; + template + using GenericAdaptor = TruncateDivOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TruncateDiv"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TruncateDivOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TruncateModOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TruncateModOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TruncateModOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TruncateModOpGenericAdaptorBase(TruncateModOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TruncateModOpGenericAdaptor : public detail::TruncateModOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TruncateModOpGenericAdaptorBase; +public: + TruncateModOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TruncateModOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TruncateModOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TruncateModOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TruncateModOpAdaptor : public TruncateModOpGenericAdaptor<::mlir::ValueRange> { +public: + using TruncateModOpGenericAdaptor::TruncateModOpGenericAdaptor; + TruncateModOpAdaptor(TruncateModOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TruncateModOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::OpTrait::TF::SameOperandsAndResultElementTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TruncateModOpAdaptor; + template + using GenericAdaptor = TruncateModOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TruncateMod"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TruncateModOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::TruncatedNormalOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TruncatedNormalOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TruncatedNormalOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TruncatedNormalOpGenericAdaptorBase(TruncatedNormalOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getSeedAttr(); + uint64_t getSeed(); + ::mlir::IntegerAttr getSeed2Attr(); + uint64_t getSeed2(); +}; +} // namespace detail +template +class TruncatedNormalOpGenericAdaptor : public detail::TruncatedNormalOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TruncatedNormalOpGenericAdaptorBase; +public: + TruncatedNormalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TruncatedNormalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TruncatedNormalOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TruncatedNormalOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getShape() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TruncatedNormalOpAdaptor : public TruncatedNormalOpGenericAdaptor<::mlir::ValueRange> { +public: + using TruncatedNormalOpGenericAdaptor::TruncatedNormalOpGenericAdaptor; + TruncatedNormalOpAdaptor(TruncatedNormalOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TruncatedNormalOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::TF::CannotDuplicate, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TruncatedNormalOpAdaptor; + template + using GenericAdaptor = TruncatedNormalOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("dtype"), ::llvm::StringRef("seed"), ::llvm::StringRef("seed2")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getSeedAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getSeedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSeed2AttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSeed2AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.TruncatedNormal"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::OpOperand &getShapeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getSeedAttr(); + uint64_t getSeed(); + ::mlir::IntegerAttr getSeed2Attr(); + uint64_t getSeed2(); + ::mlir::Type getT(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setSeedAttr(::mlir::IntegerAttr attr); + void setSeed(::std::optional attrValue); + void setSeed2Attr(::mlir::IntegerAttr attr); + void setSeed2(::std::optional attrValue); + ::mlir::Attribute removeSeedAttr(); + ::mlir::Attribute removeSeed2Attr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, /*optional*/::mlir::IntegerAttr seed, /*optional*/::mlir::IntegerAttr seed2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, /*optional*/::mlir::IntegerAttr seed, /*optional*/::mlir::IntegerAttr seed2); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value shape, /*optional*/uint64_t seed = 0, /*optional*/uint64_t seed2 = 0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, /*optional*/uint64_t seed = 0, /*optional*/uint64_t seed2 = 0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::TruncatedNormalOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::UncompressElementOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class UncompressElementOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + UncompressElementOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + UncompressElementOpGenericAdaptorBase(UncompressElementOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class UncompressElementOpGenericAdaptor : public detail::UncompressElementOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::UncompressElementOpGenericAdaptorBase; +public: + UncompressElementOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + UncompressElementOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : UncompressElementOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + UncompressElementOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getCompressed() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class UncompressElementOpAdaptor : public UncompressElementOpGenericAdaptor<::mlir::ValueRange> { +public: + using UncompressElementOpGenericAdaptor::UncompressElementOpGenericAdaptor; + UncompressElementOpAdaptor(UncompressElementOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class UncompressElementOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = UncompressElementOpAdaptor; + template + using GenericAdaptor = UncompressElementOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("output_shapes"), ::llvm::StringRef("output_types")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutputTypesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutputTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.UncompressElement"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getCompressed(); + ::mlir::OpOperand &getCompressedMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getComponents(); + mlir::TF::ResultShapeRange getOutputShapes(); + mlir::ResultElementTypeRange getOutputTypes(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange components, ::mlir::Value compressed); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::UncompressElementOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::UniformDequantizeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class UniformDequantizeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + UniformDequantizeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + UniformDequantizeOpGenericAdaptorBase(UniformDequantizeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getQuantizationAxisAttr(); + uint64_t getQuantizationAxis(); + ::mlir::IntegerAttr getQuantizationMinValAttr(); + uint64_t getQuantizationMinVal(); + ::mlir::IntegerAttr getQuantizationMaxValAttr(); + uint64_t getQuantizationMaxVal(); +}; +} // namespace detail +template +class UniformDequantizeOpGenericAdaptor : public detail::UniformDequantizeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::UniformDequantizeOpGenericAdaptorBase; +public: + UniformDequantizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + UniformDequantizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : UniformDequantizeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + UniformDequantizeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getScales() { + return (*getODSOperands(1).begin()); + } + + ValueT getZeroPoints() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class UniformDequantizeOpAdaptor : public UniformDequantizeOpGenericAdaptor<::mlir::ValueRange> { +public: + using UniformDequantizeOpGenericAdaptor::UniformDequantizeOpGenericAdaptor; + UniformDequantizeOpAdaptor(UniformDequantizeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class UniformDequantizeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = UniformDequantizeOpAdaptor; + template + using GenericAdaptor = UniformDequantizeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tin"), ::llvm::StringRef("Tout"), ::llvm::StringRef("quantization_axis"), ::llvm::StringRef("quantization_max_val"), ::llvm::StringRef("quantization_min_val")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTinAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTinAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getToutAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getToutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getQuantizationAxisAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getQuantizationAxisAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getQuantizationMaxValAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getQuantizationMaxValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getQuantizationMinValAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getQuantizationMinValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.UniformDequantize"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getScales(); + ::mlir::TypedValue<::mlir::TensorType> getZeroPoints(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getScalesMutable(); + ::mlir::OpOperand &getZeroPointsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getQuantizationAxisAttr(); + uint64_t getQuantizationAxis(); + ::mlir::IntegerAttr getQuantizationMinValAttr(); + uint64_t getQuantizationMinVal(); + ::mlir::IntegerAttr getQuantizationMaxValAttr(); + uint64_t getQuantizationMaxVal(); + ::mlir::Type getTin(); + ::mlir::Type getTout(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setQuantizationAxisAttr(::mlir::IntegerAttr attr); + void setQuantizationAxis(::std::optional attrValue); + void setQuantizationMinValAttr(::mlir::IntegerAttr attr); + void setQuantizationMinVal(uint64_t attrValue); + void setQuantizationMaxValAttr(::mlir::IntegerAttr attr); + void setQuantizationMaxVal(uint64_t attrValue); + ::mlir::Attribute removeQuantizationAxisAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value scales, ::mlir::Value zero_points, /*optional*/::mlir::IntegerAttr quantization_axis, ::mlir::IntegerAttr quantization_min_val, ::mlir::IntegerAttr quantization_max_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value scales, ::mlir::Value zero_points, /*optional*/::mlir::IntegerAttr quantization_axis, ::mlir::IntegerAttr quantization_min_val, ::mlir::IntegerAttr quantization_max_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value scales, ::mlir::Value zero_points, /*optional*/uint64_t quantization_axis, uint64_t quantization_min_val, uint64_t quantization_max_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value scales, ::mlir::Value zero_points, /*optional*/uint64_t quantization_axis, uint64_t quantization_min_val, uint64_t quantization_max_val); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::UniformDequantizeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::UniformQuantizeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class UniformQuantizeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + UniformQuantizeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + UniformQuantizeOpGenericAdaptorBase(UniformQuantizeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getQuantizationAxisAttr(); + uint64_t getQuantizationAxis(); + ::mlir::IntegerAttr getQuantizationMinValAttr(); + uint64_t getQuantizationMinVal(); + ::mlir::IntegerAttr getQuantizationMaxValAttr(); + uint64_t getQuantizationMaxVal(); +}; +} // namespace detail +template +class UniformQuantizeOpGenericAdaptor : public detail::UniformQuantizeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::UniformQuantizeOpGenericAdaptorBase; +public: + UniformQuantizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + UniformQuantizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : UniformQuantizeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + UniformQuantizeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getScales() { + return (*getODSOperands(1).begin()); + } + + ValueT getZeroPoints() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class UniformQuantizeOpAdaptor : public UniformQuantizeOpGenericAdaptor<::mlir::ValueRange> { +public: + using UniformQuantizeOpGenericAdaptor::UniformQuantizeOpGenericAdaptor; + UniformQuantizeOpAdaptor(UniformQuantizeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class UniformQuantizeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = UniformQuantizeOpAdaptor; + template + using GenericAdaptor = UniformQuantizeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tin"), ::llvm::StringRef("Tout"), ::llvm::StringRef("quantization_axis"), ::llvm::StringRef("quantization_max_val"), ::llvm::StringRef("quantization_min_val")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTinAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTinAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getToutAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getToutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getQuantizationAxisAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getQuantizationAxisAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getQuantizationMaxValAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getQuantizationMaxValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getQuantizationMinValAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getQuantizationMinValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.UniformQuantize"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getScales(); + ::mlir::TypedValue<::mlir::TensorType> getZeroPoints(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getScalesMutable(); + ::mlir::OpOperand &getZeroPointsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getQuantizationAxisAttr(); + uint64_t getQuantizationAxis(); + ::mlir::IntegerAttr getQuantizationMinValAttr(); + uint64_t getQuantizationMinVal(); + ::mlir::IntegerAttr getQuantizationMaxValAttr(); + uint64_t getQuantizationMaxVal(); + ::mlir::Type getTin(); + ::mlir::Type getTout(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setQuantizationAxisAttr(::mlir::IntegerAttr attr); + void setQuantizationAxis(::std::optional attrValue); + void setQuantizationMinValAttr(::mlir::IntegerAttr attr); + void setQuantizationMinVal(uint64_t attrValue); + void setQuantizationMaxValAttr(::mlir::IntegerAttr attr); + void setQuantizationMaxVal(uint64_t attrValue); + ::mlir::Attribute removeQuantizationAxisAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value scales, ::mlir::Value zero_points, /*optional*/::mlir::IntegerAttr quantization_axis, ::mlir::IntegerAttr quantization_min_val, ::mlir::IntegerAttr quantization_max_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value scales, ::mlir::Value zero_points, /*optional*/::mlir::IntegerAttr quantization_axis, ::mlir::IntegerAttr quantization_min_val, ::mlir::IntegerAttr quantization_max_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value scales, ::mlir::Value zero_points, /*optional*/uint64_t quantization_axis, uint64_t quantization_min_val, uint64_t quantization_max_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value scales, ::mlir::Value zero_points, /*optional*/uint64_t quantization_axis, uint64_t quantization_min_val, uint64_t quantization_max_val); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::UniformQuantizeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::UniformQuantizedAddOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class UniformQuantizedAddOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + UniformQuantizedAddOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + UniformQuantizedAddOpGenericAdaptorBase(UniformQuantizedAddOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getLhsQuantizationAxisAttr(); + uint64_t getLhsQuantizationAxis(); + ::mlir::IntegerAttr getLhsQuantizationMinValAttr(); + uint64_t getLhsQuantizationMinVal(); + ::mlir::IntegerAttr getLhsQuantizationMaxValAttr(); + uint64_t getLhsQuantizationMaxVal(); + ::mlir::IntegerAttr getRhsQuantizationAxisAttr(); + uint64_t getRhsQuantizationAxis(); + ::mlir::IntegerAttr getRhsQuantizationMinValAttr(); + uint64_t getRhsQuantizationMinVal(); + ::mlir::IntegerAttr getRhsQuantizationMaxValAttr(); + uint64_t getRhsQuantizationMaxVal(); + ::mlir::IntegerAttr getOutputQuantizationAxisAttr(); + uint64_t getOutputQuantizationAxis(); + ::mlir::IntegerAttr getOutputQuantizationMinValAttr(); + uint64_t getOutputQuantizationMinVal(); + ::mlir::IntegerAttr getOutputQuantizationMaxValAttr(); + uint64_t getOutputQuantizationMaxVal(); +}; +} // namespace detail +template +class UniformQuantizedAddOpGenericAdaptor : public detail::UniformQuantizedAddOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::UniformQuantizedAddOpGenericAdaptorBase; +public: + UniformQuantizedAddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + UniformQuantizedAddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : UniformQuantizedAddOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + UniformQuantizedAddOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + ValueT getLhsScales() { + return (*getODSOperands(2).begin()); + } + + ValueT getLhsZeroPoints() { + return (*getODSOperands(3).begin()); + } + + ValueT getRhsScales() { + return (*getODSOperands(4).begin()); + } + + ValueT getRhsZeroPoints() { + return (*getODSOperands(5).begin()); + } + + ValueT getOutputScales() { + return (*getODSOperands(6).begin()); + } + + ValueT getOutputZeroPoints() { + return (*getODSOperands(7).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class UniformQuantizedAddOpAdaptor : public UniformQuantizedAddOpGenericAdaptor<::mlir::ValueRange> { +public: + using UniformQuantizedAddOpGenericAdaptor::UniformQuantizedAddOpGenericAdaptor; + UniformQuantizedAddOpAdaptor(UniformQuantizedAddOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class UniformQuantizedAddOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<8>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = UniformQuantizedAddOpAdaptor; + template + using GenericAdaptor = UniformQuantizedAddOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("lhs_quantization_axis"), ::llvm::StringRef("lhs_quantization_max_val"), ::llvm::StringRef("lhs_quantization_min_val"), ::llvm::StringRef("output_quantization_axis"), ::llvm::StringRef("output_quantization_max_val"), ::llvm::StringRef("output_quantization_min_val"), ::llvm::StringRef("rhs_quantization_axis"), ::llvm::StringRef("rhs_quantization_max_val"), ::llvm::StringRef("rhs_quantization_min_val")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getLhsQuantizationAxisAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getLhsQuantizationAxisAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getLhsQuantizationMaxValAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getLhsQuantizationMaxValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getLhsQuantizationMinValAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getLhsQuantizationMinValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getOutputQuantizationAxisAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getOutputQuantizationAxisAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getOutputQuantizationMaxValAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getOutputQuantizationMaxValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getOutputQuantizationMinValAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getOutputQuantizationMinValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getRhsQuantizationAxisAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getRhsQuantizationAxisAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getRhsQuantizationMaxValAttrName() { + return getAttributeNameForIndex(8); + } + + static ::mlir::StringAttr getRhsQuantizationMaxValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 8); + } + + ::mlir::StringAttr getRhsQuantizationMinValAttrName() { + return getAttributeNameForIndex(9); + } + + static ::mlir::StringAttr getRhsQuantizationMinValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 9); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.UniformQuantizedAdd"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLhs(); + ::mlir::TypedValue<::mlir::TensorType> getRhs(); + ::mlir::TypedValue<::mlir::TensorType> getLhsScales(); + ::mlir::TypedValue<::mlir::TensorType> getLhsZeroPoints(); + ::mlir::TypedValue<::mlir::TensorType> getRhsScales(); + ::mlir::TypedValue<::mlir::TensorType> getRhsZeroPoints(); + ::mlir::TypedValue<::mlir::TensorType> getOutputScales(); + ::mlir::TypedValue<::mlir::TensorType> getOutputZeroPoints(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + ::mlir::OpOperand &getLhsScalesMutable(); + ::mlir::OpOperand &getLhsZeroPointsMutable(); + ::mlir::OpOperand &getRhsScalesMutable(); + ::mlir::OpOperand &getRhsZeroPointsMutable(); + ::mlir::OpOperand &getOutputScalesMutable(); + ::mlir::OpOperand &getOutputZeroPointsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getLhsQuantizationAxisAttr(); + uint64_t getLhsQuantizationAxis(); + ::mlir::IntegerAttr getLhsQuantizationMinValAttr(); + uint64_t getLhsQuantizationMinVal(); + ::mlir::IntegerAttr getLhsQuantizationMaxValAttr(); + uint64_t getLhsQuantizationMaxVal(); + ::mlir::IntegerAttr getRhsQuantizationAxisAttr(); + uint64_t getRhsQuantizationAxis(); + ::mlir::IntegerAttr getRhsQuantizationMinValAttr(); + uint64_t getRhsQuantizationMinVal(); + ::mlir::IntegerAttr getRhsQuantizationMaxValAttr(); + uint64_t getRhsQuantizationMaxVal(); + ::mlir::IntegerAttr getOutputQuantizationAxisAttr(); + uint64_t getOutputQuantizationAxis(); + ::mlir::IntegerAttr getOutputQuantizationMinValAttr(); + uint64_t getOutputQuantizationMinVal(); + ::mlir::IntegerAttr getOutputQuantizationMaxValAttr(); + uint64_t getOutputQuantizationMaxVal(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setLhsQuantizationAxisAttr(::mlir::IntegerAttr attr); + void setLhsQuantizationAxis(::std::optional attrValue); + void setLhsQuantizationMinValAttr(::mlir::IntegerAttr attr); + void setLhsQuantizationMinVal(uint64_t attrValue); + void setLhsQuantizationMaxValAttr(::mlir::IntegerAttr attr); + void setLhsQuantizationMaxVal(uint64_t attrValue); + void setRhsQuantizationAxisAttr(::mlir::IntegerAttr attr); + void setRhsQuantizationAxis(::std::optional attrValue); + void setRhsQuantizationMinValAttr(::mlir::IntegerAttr attr); + void setRhsQuantizationMinVal(uint64_t attrValue); + void setRhsQuantizationMaxValAttr(::mlir::IntegerAttr attr); + void setRhsQuantizationMaxVal(uint64_t attrValue); + void setOutputQuantizationAxisAttr(::mlir::IntegerAttr attr); + void setOutputQuantizationAxis(::std::optional attrValue); + void setOutputQuantizationMinValAttr(::mlir::IntegerAttr attr); + void setOutputQuantizationMinVal(uint64_t attrValue); + void setOutputQuantizationMaxValAttr(::mlir::IntegerAttr attr); + void setOutputQuantizationMaxVal(uint64_t attrValue); + ::mlir::Attribute removeLhsQuantizationAxisAttr(); + ::mlir::Attribute removeRhsQuantizationAxisAttr(); + ::mlir::Attribute removeOutputQuantizationAxisAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value lhs_scales, ::mlir::Value lhs_zero_points, ::mlir::Value rhs_scales, ::mlir::Value rhs_zero_points, ::mlir::Value output_scales, ::mlir::Value output_zero_points, /*optional*/::mlir::IntegerAttr lhs_quantization_axis, ::mlir::IntegerAttr lhs_quantization_min_val, ::mlir::IntegerAttr lhs_quantization_max_val, /*optional*/::mlir::IntegerAttr rhs_quantization_axis, ::mlir::IntegerAttr rhs_quantization_min_val, ::mlir::IntegerAttr rhs_quantization_max_val, /*optional*/::mlir::IntegerAttr output_quantization_axis, ::mlir::IntegerAttr output_quantization_min_val, ::mlir::IntegerAttr output_quantization_max_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value lhs_scales, ::mlir::Value lhs_zero_points, ::mlir::Value rhs_scales, ::mlir::Value rhs_zero_points, ::mlir::Value output_scales, ::mlir::Value output_zero_points, /*optional*/::mlir::IntegerAttr lhs_quantization_axis, ::mlir::IntegerAttr lhs_quantization_min_val, ::mlir::IntegerAttr lhs_quantization_max_val, /*optional*/::mlir::IntegerAttr rhs_quantization_axis, ::mlir::IntegerAttr rhs_quantization_min_val, ::mlir::IntegerAttr rhs_quantization_max_val, /*optional*/::mlir::IntegerAttr output_quantization_axis, ::mlir::IntegerAttr output_quantization_min_val, ::mlir::IntegerAttr output_quantization_max_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value lhs_scales, ::mlir::Value lhs_zero_points, ::mlir::Value rhs_scales, ::mlir::Value rhs_zero_points, ::mlir::Value output_scales, ::mlir::Value output_zero_points, /*optional*/uint64_t lhs_quantization_axis, uint64_t lhs_quantization_min_val, uint64_t lhs_quantization_max_val, /*optional*/uint64_t rhs_quantization_axis, uint64_t rhs_quantization_min_val, uint64_t rhs_quantization_max_val, /*optional*/uint64_t output_quantization_axis, uint64_t output_quantization_min_val, uint64_t output_quantization_max_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value lhs_scales, ::mlir::Value lhs_zero_points, ::mlir::Value rhs_scales, ::mlir::Value rhs_zero_points, ::mlir::Value output_scales, ::mlir::Value output_zero_points, /*optional*/uint64_t lhs_quantization_axis, uint64_t lhs_quantization_min_val, uint64_t lhs_quantization_max_val, /*optional*/uint64_t rhs_quantization_axis, uint64_t rhs_quantization_min_val, uint64_t rhs_quantization_max_val, /*optional*/uint64_t output_quantization_axis, uint64_t output_quantization_min_val, uint64_t output_quantization_max_val); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 10 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::UniformQuantizedAddOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::UniformQuantizedClipByValueOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class UniformQuantizedClipByValueOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + UniformQuantizedClipByValueOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + UniformQuantizedClipByValueOpGenericAdaptorBase(UniformQuantizedClipByValueOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getQuantizationAxisAttr(); + uint64_t getQuantizationAxis(); + ::mlir::IntegerAttr getQuantizationMinValAttr(); + uint64_t getQuantizationMinVal(); + ::mlir::IntegerAttr getQuantizationMaxValAttr(); + uint64_t getQuantizationMaxVal(); +}; +} // namespace detail +template +class UniformQuantizedClipByValueOpGenericAdaptor : public detail::UniformQuantizedClipByValueOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::UniformQuantizedClipByValueOpGenericAdaptorBase; +public: + UniformQuantizedClipByValueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + UniformQuantizedClipByValueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : UniformQuantizedClipByValueOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + UniformQuantizedClipByValueOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + ValueT getMin() { + return (*getODSOperands(1).begin()); + } + + ValueT getMax() { + return (*getODSOperands(2).begin()); + } + + ValueT getScales() { + return (*getODSOperands(3).begin()); + } + + ValueT getZeroPoints() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class UniformQuantizedClipByValueOpAdaptor : public UniformQuantizedClipByValueOpGenericAdaptor<::mlir::ValueRange> { +public: + using UniformQuantizedClipByValueOpGenericAdaptor::UniformQuantizedClipByValueOpGenericAdaptor; + UniformQuantizedClipByValueOpAdaptor(UniformQuantizedClipByValueOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class UniformQuantizedClipByValueOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<5>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = UniformQuantizedClipByValueOpAdaptor; + template + using GenericAdaptor = UniformQuantizedClipByValueOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("quantization_axis"), ::llvm::StringRef("quantization_max_val"), ::llvm::StringRef("quantization_min_val")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getQuantizationAxisAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getQuantizationAxisAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getQuantizationMaxValAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getQuantizationMaxValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getQuantizationMinValAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getQuantizationMinValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.UniformQuantizedClipByValue"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::TypedValue<::mlir::TensorType> getMin(); + ::mlir::TypedValue<::mlir::TensorType> getMax(); + ::mlir::TypedValue<::mlir::TensorType> getScales(); + ::mlir::TypedValue<::mlir::TensorType> getZeroPoints(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::OpOperand &getMinMutable(); + ::mlir::OpOperand &getMaxMutable(); + ::mlir::OpOperand &getScalesMutable(); + ::mlir::OpOperand &getZeroPointsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getQuantizationAxisAttr(); + uint64_t getQuantizationAxis(); + ::mlir::IntegerAttr getQuantizationMinValAttr(); + uint64_t getQuantizationMinVal(); + ::mlir::IntegerAttr getQuantizationMaxValAttr(); + uint64_t getQuantizationMaxVal(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setQuantizationAxisAttr(::mlir::IntegerAttr attr); + void setQuantizationAxis(::std::optional attrValue); + void setQuantizationMinValAttr(::mlir::IntegerAttr attr); + void setQuantizationMinVal(uint64_t attrValue); + void setQuantizationMaxValAttr(::mlir::IntegerAttr attr); + void setQuantizationMaxVal(uint64_t attrValue); + ::mlir::Attribute removeQuantizationAxisAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value operand, ::mlir::Value min, ::mlir::Value max, ::mlir::Value scales, ::mlir::Value zero_points, /*optional*/::mlir::IntegerAttr quantization_axis, ::mlir::IntegerAttr quantization_min_val, ::mlir::IntegerAttr quantization_max_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value min, ::mlir::Value max, ::mlir::Value scales, ::mlir::Value zero_points, /*optional*/::mlir::IntegerAttr quantization_axis, ::mlir::IntegerAttr quantization_min_val, ::mlir::IntegerAttr quantization_max_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value operand, ::mlir::Value min, ::mlir::Value max, ::mlir::Value scales, ::mlir::Value zero_points, /*optional*/uint64_t quantization_axis, uint64_t quantization_min_val, uint64_t quantization_max_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value min, ::mlir::Value max, ::mlir::Value scales, ::mlir::Value zero_points, /*optional*/uint64_t quantization_axis, uint64_t quantization_min_val, uint64_t quantization_max_val); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::UniformQuantizedClipByValueOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::UniformQuantizedConvolutionHybridOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class UniformQuantizedConvolutionHybridOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + UniformQuantizedConvolutionHybridOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + UniformQuantizedConvolutionHybridOpGenericAdaptorBase(UniformQuantizedConvolutionHybridOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getWindowStridesAttr(); + ::mlir::ArrayAttr getWindowStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getExplicitPaddingAttr(); + ::mlir::ArrayAttr getExplicitPadding(); + ::mlir::ArrayAttr getLhsDilationAttr(); + ::mlir::ArrayAttr getLhsDilation(); + ::mlir::ArrayAttr getRhsDilationAttr(); + ::mlir::ArrayAttr getRhsDilation(); + ::mlir::IntegerAttr getBatchGroupCountAttr(); + uint64_t getBatchGroupCount(); + ::mlir::IntegerAttr getFeatureGroupCountAttr(); + uint64_t getFeatureGroupCount(); + ::mlir::StringAttr getDimensionNumbersAttr(); + ::llvm::StringRef getDimensionNumbers(); + ::mlir::IntegerAttr getRhsQuantizationAxisAttr(); + uint64_t getRhsQuantizationAxis(); + ::mlir::IntegerAttr getRhsQuantizationMinValAttr(); + uint64_t getRhsQuantizationMinVal(); + ::mlir::IntegerAttr getRhsQuantizationMaxValAttr(); + uint64_t getRhsQuantizationMaxVal(); +}; +} // namespace detail +template +class UniformQuantizedConvolutionHybridOpGenericAdaptor : public detail::UniformQuantizedConvolutionHybridOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::UniformQuantizedConvolutionHybridOpGenericAdaptorBase; +public: + UniformQuantizedConvolutionHybridOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + UniformQuantizedConvolutionHybridOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : UniformQuantizedConvolutionHybridOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + UniformQuantizedConvolutionHybridOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + ValueT getRhsScales() { + return (*getODSOperands(2).begin()); + } + + ValueT getRhsZeroPoints() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class UniformQuantizedConvolutionHybridOpAdaptor : public UniformQuantizedConvolutionHybridOpGenericAdaptor<::mlir::ValueRange> { +public: + using UniformQuantizedConvolutionHybridOpGenericAdaptor::UniformQuantizedConvolutionHybridOpGenericAdaptor; + UniformQuantizedConvolutionHybridOpAdaptor(UniformQuantizedConvolutionHybridOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class UniformQuantizedConvolutionHybridOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = UniformQuantizedConvolutionHybridOpAdaptor; + template + using GenericAdaptor = UniformQuantizedConvolutionHybridOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tlhs"), ::llvm::StringRef("Tout"), ::llvm::StringRef("Trhs"), ::llvm::StringRef("batch_group_count"), ::llvm::StringRef("dimension_numbers"), ::llvm::StringRef("explicit_padding"), ::llvm::StringRef("feature_group_count"), ::llvm::StringRef("lhs_dilation"), ::llvm::StringRef("padding"), ::llvm::StringRef("rhs_dilation"), ::llvm::StringRef("rhs_quantization_axis"), ::llvm::StringRef("rhs_quantization_max_val"), ::llvm::StringRef("rhs_quantization_min_val"), ::llvm::StringRef("window_strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTlhsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTlhsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getToutAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getToutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTrhsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTrhsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getBatchGroupCountAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getBatchGroupCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getDimensionNumbersAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getDimensionNumbersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getExplicitPaddingAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getExplicitPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getFeatureGroupCountAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getFeatureGroupCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getLhsDilationAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getLhsDilationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(8); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 8); + } + + ::mlir::StringAttr getRhsDilationAttrName() { + return getAttributeNameForIndex(9); + } + + static ::mlir::StringAttr getRhsDilationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 9); + } + + ::mlir::StringAttr getRhsQuantizationAxisAttrName() { + return getAttributeNameForIndex(10); + } + + static ::mlir::StringAttr getRhsQuantizationAxisAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 10); + } + + ::mlir::StringAttr getRhsQuantizationMaxValAttrName() { + return getAttributeNameForIndex(11); + } + + static ::mlir::StringAttr getRhsQuantizationMaxValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 11); + } + + ::mlir::StringAttr getRhsQuantizationMinValAttrName() { + return getAttributeNameForIndex(12); + } + + static ::mlir::StringAttr getRhsQuantizationMinValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 12); + } + + ::mlir::StringAttr getWindowStridesAttrName() { + return getAttributeNameForIndex(13); + } + + static ::mlir::StringAttr getWindowStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 13); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.UniformQuantizedConvolutionHybrid"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLhs(); + ::mlir::TypedValue<::mlir::TensorType> getRhs(); + ::mlir::TypedValue<::mlir::TensorType> getRhsScales(); + ::mlir::TypedValue<::mlir::TensorType> getRhsZeroPoints(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + ::mlir::OpOperand &getRhsScalesMutable(); + ::mlir::OpOperand &getRhsZeroPointsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ArrayAttr getWindowStridesAttr(); + ::mlir::ArrayAttr getWindowStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getExplicitPaddingAttr(); + ::mlir::ArrayAttr getExplicitPadding(); + ::mlir::ArrayAttr getLhsDilationAttr(); + ::mlir::ArrayAttr getLhsDilation(); + ::mlir::ArrayAttr getRhsDilationAttr(); + ::mlir::ArrayAttr getRhsDilation(); + ::mlir::IntegerAttr getBatchGroupCountAttr(); + uint64_t getBatchGroupCount(); + ::mlir::IntegerAttr getFeatureGroupCountAttr(); + uint64_t getFeatureGroupCount(); + ::mlir::StringAttr getDimensionNumbersAttr(); + ::llvm::StringRef getDimensionNumbers(); + ::mlir::IntegerAttr getRhsQuantizationAxisAttr(); + uint64_t getRhsQuantizationAxis(); + ::mlir::IntegerAttr getRhsQuantizationMinValAttr(); + uint64_t getRhsQuantizationMinVal(); + ::mlir::IntegerAttr getRhsQuantizationMaxValAttr(); + uint64_t getRhsQuantizationMaxVal(); + ::mlir::Type getTlhs(); + ::mlir::Type getTrhs(); + ::mlir::Type getTout(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setWindowStridesAttr(::mlir::ArrayAttr attr); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + void setExplicitPaddingAttr(::mlir::ArrayAttr attr); + void setLhsDilationAttr(::mlir::ArrayAttr attr); + void setRhsDilationAttr(::mlir::ArrayAttr attr); + void setBatchGroupCountAttr(::mlir::IntegerAttr attr); + void setBatchGroupCount(::std::optional attrValue); + void setFeatureGroupCountAttr(::mlir::IntegerAttr attr); + void setFeatureGroupCount(::std::optional attrValue); + void setDimensionNumbersAttr(::mlir::StringAttr attr); + void setDimensionNumbers(::std::optional<::llvm::StringRef> attrValue); + void setRhsQuantizationAxisAttr(::mlir::IntegerAttr attr); + void setRhsQuantizationAxis(::std::optional attrValue); + void setRhsQuantizationMinValAttr(::mlir::IntegerAttr attr); + void setRhsQuantizationMinVal(uint64_t attrValue); + void setRhsQuantizationMaxValAttr(::mlir::IntegerAttr attr); + void setRhsQuantizationMaxVal(uint64_t attrValue); + ::mlir::Attribute removeWindowStridesAttr(); + ::mlir::Attribute removeExplicitPaddingAttr(); + ::mlir::Attribute removeLhsDilationAttr(); + ::mlir::Attribute removeRhsDilationAttr(); + ::mlir::Attribute removeBatchGroupCountAttr(); + ::mlir::Attribute removeFeatureGroupCountAttr(); + ::mlir::Attribute removeDimensionNumbersAttr(); + ::mlir::Attribute removeRhsQuantizationAxisAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value rhs_scales, ::mlir::Value rhs_zero_points, /*optional*/::mlir::ArrayAttr window_strides, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr explicit_padding, /*optional*/::mlir::ArrayAttr lhs_dilation, /*optional*/::mlir::ArrayAttr rhs_dilation, /*optional*/::mlir::IntegerAttr batch_group_count, /*optional*/::mlir::IntegerAttr feature_group_count, /*optional*/::mlir::StringAttr dimension_numbers, /*optional*/::mlir::IntegerAttr rhs_quantization_axis, ::mlir::IntegerAttr rhs_quantization_min_val, ::mlir::IntegerAttr rhs_quantization_max_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value rhs_scales, ::mlir::Value rhs_zero_points, /*optional*/::mlir::ArrayAttr window_strides, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr explicit_padding, /*optional*/::mlir::ArrayAttr lhs_dilation, /*optional*/::mlir::ArrayAttr rhs_dilation, /*optional*/::mlir::IntegerAttr batch_group_count, /*optional*/::mlir::IntegerAttr feature_group_count, /*optional*/::mlir::StringAttr dimension_numbers, /*optional*/::mlir::IntegerAttr rhs_quantization_axis, ::mlir::IntegerAttr rhs_quantization_min_val, ::mlir::IntegerAttr rhs_quantization_max_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value rhs_scales, ::mlir::Value rhs_zero_points, /*optional*/::mlir::ArrayAttr window_strides, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr explicit_padding, /*optional*/::mlir::ArrayAttr lhs_dilation, /*optional*/::mlir::ArrayAttr rhs_dilation, /*optional*/uint64_t batch_group_count, /*optional*/uint64_t feature_group_count, /*optional*/::llvm::StringRef dimension_numbers, /*optional*/uint64_t rhs_quantization_axis, uint64_t rhs_quantization_min_val, uint64_t rhs_quantization_max_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value rhs_scales, ::mlir::Value rhs_zero_points, /*optional*/::mlir::ArrayAttr window_strides, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr explicit_padding, /*optional*/::mlir::ArrayAttr lhs_dilation, /*optional*/::mlir::ArrayAttr rhs_dilation, /*optional*/uint64_t batch_group_count, /*optional*/uint64_t feature_group_count, /*optional*/::llvm::StringRef dimension_numbers, /*optional*/uint64_t rhs_quantization_axis, uint64_t rhs_quantization_min_val, uint64_t rhs_quantization_max_val); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 14 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::UniformQuantizedConvolutionHybridOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::UniformQuantizedConvolutionOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class UniformQuantizedConvolutionOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + UniformQuantizedConvolutionOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + UniformQuantizedConvolutionOpGenericAdaptorBase(UniformQuantizedConvolutionOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getWindowStridesAttr(); + ::mlir::ArrayAttr getWindowStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getExplicitPaddingAttr(); + ::mlir::ArrayAttr getExplicitPadding(); + ::mlir::ArrayAttr getLhsDilationAttr(); + ::mlir::ArrayAttr getLhsDilation(); + ::mlir::ArrayAttr getRhsDilationAttr(); + ::mlir::ArrayAttr getRhsDilation(); + ::mlir::IntegerAttr getBatchGroupCountAttr(); + uint64_t getBatchGroupCount(); + ::mlir::IntegerAttr getFeatureGroupCountAttr(); + uint64_t getFeatureGroupCount(); + ::mlir::StringAttr getDimensionNumbersAttr(); + ::llvm::StringRef getDimensionNumbers(); + ::mlir::IntegerAttr getLhsQuantizationAxisAttr(); + uint64_t getLhsQuantizationAxis(); + ::mlir::IntegerAttr getLhsQuantizationMinValAttr(); + uint64_t getLhsQuantizationMinVal(); + ::mlir::IntegerAttr getLhsQuantizationMaxValAttr(); + uint64_t getLhsQuantizationMaxVal(); + ::mlir::IntegerAttr getRhsQuantizationAxisAttr(); + uint64_t getRhsQuantizationAxis(); + ::mlir::IntegerAttr getRhsQuantizationMinValAttr(); + uint64_t getRhsQuantizationMinVal(); + ::mlir::IntegerAttr getRhsQuantizationMaxValAttr(); + uint64_t getRhsQuantizationMaxVal(); + ::mlir::IntegerAttr getOutputQuantizationAxisAttr(); + uint64_t getOutputQuantizationAxis(); + ::mlir::IntegerAttr getOutputQuantizationMinValAttr(); + uint64_t getOutputQuantizationMinVal(); + ::mlir::IntegerAttr getOutputQuantizationMaxValAttr(); + uint64_t getOutputQuantizationMaxVal(); +}; +} // namespace detail +template +class UniformQuantizedConvolutionOpGenericAdaptor : public detail::UniformQuantizedConvolutionOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::UniformQuantizedConvolutionOpGenericAdaptorBase; +public: + UniformQuantizedConvolutionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + UniformQuantizedConvolutionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : UniformQuantizedConvolutionOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + UniformQuantizedConvolutionOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + ValueT getLhsScales() { + return (*getODSOperands(2).begin()); + } + + ValueT getLhsZeroPoints() { + return (*getODSOperands(3).begin()); + } + + ValueT getRhsScales() { + return (*getODSOperands(4).begin()); + } + + ValueT getRhsZeroPoints() { + return (*getODSOperands(5).begin()); + } + + ValueT getOutputScales() { + return (*getODSOperands(6).begin()); + } + + ValueT getOutputZeroPoints() { + return (*getODSOperands(7).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class UniformQuantizedConvolutionOpAdaptor : public UniformQuantizedConvolutionOpGenericAdaptor<::mlir::ValueRange> { +public: + using UniformQuantizedConvolutionOpGenericAdaptor::UniformQuantizedConvolutionOpGenericAdaptor; + UniformQuantizedConvolutionOpAdaptor(UniformQuantizedConvolutionOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class UniformQuantizedConvolutionOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<8>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = UniformQuantizedConvolutionOpAdaptor; + template + using GenericAdaptor = UniformQuantizedConvolutionOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tin"), ::llvm::StringRef("Tout"), ::llvm::StringRef("batch_group_count"), ::llvm::StringRef("dimension_numbers"), ::llvm::StringRef("explicit_padding"), ::llvm::StringRef("feature_group_count"), ::llvm::StringRef("lhs_dilation"), ::llvm::StringRef("lhs_quantization_axis"), ::llvm::StringRef("lhs_quantization_max_val"), ::llvm::StringRef("lhs_quantization_min_val"), ::llvm::StringRef("output_quantization_axis"), ::llvm::StringRef("output_quantization_max_val"), ::llvm::StringRef("output_quantization_min_val"), ::llvm::StringRef("padding"), ::llvm::StringRef("rhs_dilation"), ::llvm::StringRef("rhs_quantization_axis"), ::llvm::StringRef("rhs_quantization_max_val"), ::llvm::StringRef("rhs_quantization_min_val"), ::llvm::StringRef("window_strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTinAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTinAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getToutAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getToutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getBatchGroupCountAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getBatchGroupCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getDimensionNumbersAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getDimensionNumbersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getExplicitPaddingAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getExplicitPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getFeatureGroupCountAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getFeatureGroupCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getLhsDilationAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getLhsDilationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getLhsQuantizationAxisAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getLhsQuantizationAxisAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getLhsQuantizationMaxValAttrName() { + return getAttributeNameForIndex(8); + } + + static ::mlir::StringAttr getLhsQuantizationMaxValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 8); + } + + ::mlir::StringAttr getLhsQuantizationMinValAttrName() { + return getAttributeNameForIndex(9); + } + + static ::mlir::StringAttr getLhsQuantizationMinValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 9); + } + + ::mlir::StringAttr getOutputQuantizationAxisAttrName() { + return getAttributeNameForIndex(10); + } + + static ::mlir::StringAttr getOutputQuantizationAxisAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 10); + } + + ::mlir::StringAttr getOutputQuantizationMaxValAttrName() { + return getAttributeNameForIndex(11); + } + + static ::mlir::StringAttr getOutputQuantizationMaxValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 11); + } + + ::mlir::StringAttr getOutputQuantizationMinValAttrName() { + return getAttributeNameForIndex(12); + } + + static ::mlir::StringAttr getOutputQuantizationMinValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 12); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(13); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 13); + } + + ::mlir::StringAttr getRhsDilationAttrName() { + return getAttributeNameForIndex(14); + } + + static ::mlir::StringAttr getRhsDilationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 14); + } + + ::mlir::StringAttr getRhsQuantizationAxisAttrName() { + return getAttributeNameForIndex(15); + } + + static ::mlir::StringAttr getRhsQuantizationAxisAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 15); + } + + ::mlir::StringAttr getRhsQuantizationMaxValAttrName() { + return getAttributeNameForIndex(16); + } + + static ::mlir::StringAttr getRhsQuantizationMaxValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 16); + } + + ::mlir::StringAttr getRhsQuantizationMinValAttrName() { + return getAttributeNameForIndex(17); + } + + static ::mlir::StringAttr getRhsQuantizationMinValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 17); + } + + ::mlir::StringAttr getWindowStridesAttrName() { + return getAttributeNameForIndex(18); + } + + static ::mlir::StringAttr getWindowStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 18); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.UniformQuantizedConvolution"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLhs(); + ::mlir::TypedValue<::mlir::TensorType> getRhs(); + ::mlir::TypedValue<::mlir::TensorType> getLhsScales(); + ::mlir::TypedValue<::mlir::TensorType> getLhsZeroPoints(); + ::mlir::TypedValue<::mlir::TensorType> getRhsScales(); + ::mlir::TypedValue<::mlir::TensorType> getRhsZeroPoints(); + ::mlir::TypedValue<::mlir::TensorType> getOutputScales(); + ::mlir::TypedValue<::mlir::TensorType> getOutputZeroPoints(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + ::mlir::OpOperand &getLhsScalesMutable(); + ::mlir::OpOperand &getLhsZeroPointsMutable(); + ::mlir::OpOperand &getRhsScalesMutable(); + ::mlir::OpOperand &getRhsZeroPointsMutable(); + ::mlir::OpOperand &getOutputScalesMutable(); + ::mlir::OpOperand &getOutputZeroPointsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ArrayAttr getWindowStridesAttr(); + ::mlir::ArrayAttr getWindowStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getExplicitPaddingAttr(); + ::mlir::ArrayAttr getExplicitPadding(); + ::mlir::ArrayAttr getLhsDilationAttr(); + ::mlir::ArrayAttr getLhsDilation(); + ::mlir::ArrayAttr getRhsDilationAttr(); + ::mlir::ArrayAttr getRhsDilation(); + ::mlir::IntegerAttr getBatchGroupCountAttr(); + uint64_t getBatchGroupCount(); + ::mlir::IntegerAttr getFeatureGroupCountAttr(); + uint64_t getFeatureGroupCount(); + ::mlir::StringAttr getDimensionNumbersAttr(); + ::llvm::StringRef getDimensionNumbers(); + ::mlir::IntegerAttr getLhsQuantizationAxisAttr(); + uint64_t getLhsQuantizationAxis(); + ::mlir::IntegerAttr getLhsQuantizationMinValAttr(); + uint64_t getLhsQuantizationMinVal(); + ::mlir::IntegerAttr getLhsQuantizationMaxValAttr(); + uint64_t getLhsQuantizationMaxVal(); + ::mlir::IntegerAttr getRhsQuantizationAxisAttr(); + uint64_t getRhsQuantizationAxis(); + ::mlir::IntegerAttr getRhsQuantizationMinValAttr(); + uint64_t getRhsQuantizationMinVal(); + ::mlir::IntegerAttr getRhsQuantizationMaxValAttr(); + uint64_t getRhsQuantizationMaxVal(); + ::mlir::IntegerAttr getOutputQuantizationAxisAttr(); + uint64_t getOutputQuantizationAxis(); + ::mlir::IntegerAttr getOutputQuantizationMinValAttr(); + uint64_t getOutputQuantizationMinVal(); + ::mlir::IntegerAttr getOutputQuantizationMaxValAttr(); + uint64_t getOutputQuantizationMaxVal(); + ::mlir::Type getTin(); + ::mlir::Type getTout(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setWindowStridesAttr(::mlir::ArrayAttr attr); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + void setExplicitPaddingAttr(::mlir::ArrayAttr attr); + void setLhsDilationAttr(::mlir::ArrayAttr attr); + void setRhsDilationAttr(::mlir::ArrayAttr attr); + void setBatchGroupCountAttr(::mlir::IntegerAttr attr); + void setBatchGroupCount(::std::optional attrValue); + void setFeatureGroupCountAttr(::mlir::IntegerAttr attr); + void setFeatureGroupCount(::std::optional attrValue); + void setDimensionNumbersAttr(::mlir::StringAttr attr); + void setDimensionNumbers(::std::optional<::llvm::StringRef> attrValue); + void setLhsQuantizationAxisAttr(::mlir::IntegerAttr attr); + void setLhsQuantizationAxis(::std::optional attrValue); + void setLhsQuantizationMinValAttr(::mlir::IntegerAttr attr); + void setLhsQuantizationMinVal(uint64_t attrValue); + void setLhsQuantizationMaxValAttr(::mlir::IntegerAttr attr); + void setLhsQuantizationMaxVal(uint64_t attrValue); + void setRhsQuantizationAxisAttr(::mlir::IntegerAttr attr); + void setRhsQuantizationAxis(::std::optional attrValue); + void setRhsQuantizationMinValAttr(::mlir::IntegerAttr attr); + void setRhsQuantizationMinVal(uint64_t attrValue); + void setRhsQuantizationMaxValAttr(::mlir::IntegerAttr attr); + void setRhsQuantizationMaxVal(uint64_t attrValue); + void setOutputQuantizationAxisAttr(::mlir::IntegerAttr attr); + void setOutputQuantizationAxis(::std::optional attrValue); + void setOutputQuantizationMinValAttr(::mlir::IntegerAttr attr); + void setOutputQuantizationMinVal(uint64_t attrValue); + void setOutputQuantizationMaxValAttr(::mlir::IntegerAttr attr); + void setOutputQuantizationMaxVal(uint64_t attrValue); + ::mlir::Attribute removeWindowStridesAttr(); + ::mlir::Attribute removeExplicitPaddingAttr(); + ::mlir::Attribute removeLhsDilationAttr(); + ::mlir::Attribute removeRhsDilationAttr(); + ::mlir::Attribute removeBatchGroupCountAttr(); + ::mlir::Attribute removeFeatureGroupCountAttr(); + ::mlir::Attribute removeDimensionNumbersAttr(); + ::mlir::Attribute removeLhsQuantizationAxisAttr(); + ::mlir::Attribute removeRhsQuantizationAxisAttr(); + ::mlir::Attribute removeOutputQuantizationAxisAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value lhs_scales, ::mlir::Value lhs_zero_points, ::mlir::Value rhs_scales, ::mlir::Value rhs_zero_points, ::mlir::Value output_scales, ::mlir::Value output_zero_points, /*optional*/::mlir::ArrayAttr window_strides, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr explicit_padding, /*optional*/::mlir::ArrayAttr lhs_dilation, /*optional*/::mlir::ArrayAttr rhs_dilation, /*optional*/::mlir::IntegerAttr batch_group_count, /*optional*/::mlir::IntegerAttr feature_group_count, /*optional*/::mlir::StringAttr dimension_numbers, /*optional*/::mlir::IntegerAttr lhs_quantization_axis, ::mlir::IntegerAttr lhs_quantization_min_val, ::mlir::IntegerAttr lhs_quantization_max_val, /*optional*/::mlir::IntegerAttr rhs_quantization_axis, ::mlir::IntegerAttr rhs_quantization_min_val, ::mlir::IntegerAttr rhs_quantization_max_val, /*optional*/::mlir::IntegerAttr output_quantization_axis, ::mlir::IntegerAttr output_quantization_min_val, ::mlir::IntegerAttr output_quantization_max_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value lhs_scales, ::mlir::Value lhs_zero_points, ::mlir::Value rhs_scales, ::mlir::Value rhs_zero_points, ::mlir::Value output_scales, ::mlir::Value output_zero_points, /*optional*/::mlir::ArrayAttr window_strides, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr explicit_padding, /*optional*/::mlir::ArrayAttr lhs_dilation, /*optional*/::mlir::ArrayAttr rhs_dilation, /*optional*/::mlir::IntegerAttr batch_group_count, /*optional*/::mlir::IntegerAttr feature_group_count, /*optional*/::mlir::StringAttr dimension_numbers, /*optional*/::mlir::IntegerAttr lhs_quantization_axis, ::mlir::IntegerAttr lhs_quantization_min_val, ::mlir::IntegerAttr lhs_quantization_max_val, /*optional*/::mlir::IntegerAttr rhs_quantization_axis, ::mlir::IntegerAttr rhs_quantization_min_val, ::mlir::IntegerAttr rhs_quantization_max_val, /*optional*/::mlir::IntegerAttr output_quantization_axis, ::mlir::IntegerAttr output_quantization_min_val, ::mlir::IntegerAttr output_quantization_max_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value lhs_scales, ::mlir::Value lhs_zero_points, ::mlir::Value rhs_scales, ::mlir::Value rhs_zero_points, ::mlir::Value output_scales, ::mlir::Value output_zero_points, /*optional*/::mlir::ArrayAttr window_strides, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr explicit_padding, /*optional*/::mlir::ArrayAttr lhs_dilation, /*optional*/::mlir::ArrayAttr rhs_dilation, /*optional*/uint64_t batch_group_count, /*optional*/uint64_t feature_group_count, /*optional*/::llvm::StringRef dimension_numbers, /*optional*/uint64_t lhs_quantization_axis, uint64_t lhs_quantization_min_val, uint64_t lhs_quantization_max_val, /*optional*/uint64_t rhs_quantization_axis, uint64_t rhs_quantization_min_val, uint64_t rhs_quantization_max_val, /*optional*/uint64_t output_quantization_axis, uint64_t output_quantization_min_val, uint64_t output_quantization_max_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value lhs_scales, ::mlir::Value lhs_zero_points, ::mlir::Value rhs_scales, ::mlir::Value rhs_zero_points, ::mlir::Value output_scales, ::mlir::Value output_zero_points, /*optional*/::mlir::ArrayAttr window_strides, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr explicit_padding, /*optional*/::mlir::ArrayAttr lhs_dilation, /*optional*/::mlir::ArrayAttr rhs_dilation, /*optional*/uint64_t batch_group_count, /*optional*/uint64_t feature_group_count, /*optional*/::llvm::StringRef dimension_numbers, /*optional*/uint64_t lhs_quantization_axis, uint64_t lhs_quantization_min_val, uint64_t lhs_quantization_max_val, /*optional*/uint64_t rhs_quantization_axis, uint64_t rhs_quantization_min_val, uint64_t rhs_quantization_max_val, /*optional*/uint64_t output_quantization_axis, uint64_t output_quantization_min_val, uint64_t output_quantization_max_val); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 19 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::UniformQuantizedConvolutionOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::UniformQuantizedDotHybridOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class UniformQuantizedDotHybridOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + UniformQuantizedDotHybridOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + UniformQuantizedDotHybridOpGenericAdaptorBase(UniformQuantizedDotHybridOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getRhsQuantizationAxisAttr(); + uint64_t getRhsQuantizationAxis(); + ::mlir::IntegerAttr getRhsQuantizationMinValAttr(); + uint64_t getRhsQuantizationMinVal(); + ::mlir::IntegerAttr getRhsQuantizationMaxValAttr(); + uint64_t getRhsQuantizationMaxVal(); +}; +} // namespace detail +template +class UniformQuantizedDotHybridOpGenericAdaptor : public detail::UniformQuantizedDotHybridOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::UniformQuantizedDotHybridOpGenericAdaptorBase; +public: + UniformQuantizedDotHybridOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + UniformQuantizedDotHybridOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : UniformQuantizedDotHybridOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + UniformQuantizedDotHybridOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + ValueT getRhsScales() { + return (*getODSOperands(2).begin()); + } + + ValueT getRhsZeroPoints() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class UniformQuantizedDotHybridOpAdaptor : public UniformQuantizedDotHybridOpGenericAdaptor<::mlir::ValueRange> { +public: + using UniformQuantizedDotHybridOpGenericAdaptor::UniformQuantizedDotHybridOpGenericAdaptor; + UniformQuantizedDotHybridOpAdaptor(UniformQuantizedDotHybridOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class UniformQuantizedDotHybridOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = UniformQuantizedDotHybridOpAdaptor; + template + using GenericAdaptor = UniformQuantizedDotHybridOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tlhs"), ::llvm::StringRef("Tout"), ::llvm::StringRef("Trhs"), ::llvm::StringRef("rhs_quantization_axis"), ::llvm::StringRef("rhs_quantization_max_val"), ::llvm::StringRef("rhs_quantization_min_val")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTlhsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTlhsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getToutAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getToutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTrhsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTrhsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getRhsQuantizationAxisAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getRhsQuantizationAxisAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getRhsQuantizationMaxValAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getRhsQuantizationMaxValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getRhsQuantizationMinValAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getRhsQuantizationMinValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.UniformQuantizedDotHybrid"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLhs(); + ::mlir::TypedValue<::mlir::TensorType> getRhs(); + ::mlir::TypedValue<::mlir::TensorType> getRhsScales(); + ::mlir::TypedValue<::mlir::TensorType> getRhsZeroPoints(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + ::mlir::OpOperand &getRhsScalesMutable(); + ::mlir::OpOperand &getRhsZeroPointsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getRhsQuantizationAxisAttr(); + uint64_t getRhsQuantizationAxis(); + ::mlir::IntegerAttr getRhsQuantizationMinValAttr(); + uint64_t getRhsQuantizationMinVal(); + ::mlir::IntegerAttr getRhsQuantizationMaxValAttr(); + uint64_t getRhsQuantizationMaxVal(); + ::mlir::Type getTlhs(); + ::mlir::Type getTrhs(); + ::mlir::Type getTout(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setRhsQuantizationAxisAttr(::mlir::IntegerAttr attr); + void setRhsQuantizationAxis(::std::optional attrValue); + void setRhsQuantizationMinValAttr(::mlir::IntegerAttr attr); + void setRhsQuantizationMinVal(uint64_t attrValue); + void setRhsQuantizationMaxValAttr(::mlir::IntegerAttr attr); + void setRhsQuantizationMaxVal(uint64_t attrValue); + ::mlir::Attribute removeRhsQuantizationAxisAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value rhs_scales, ::mlir::Value rhs_zero_points, /*optional*/::mlir::IntegerAttr rhs_quantization_axis, ::mlir::IntegerAttr rhs_quantization_min_val, ::mlir::IntegerAttr rhs_quantization_max_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value rhs_scales, ::mlir::Value rhs_zero_points, /*optional*/::mlir::IntegerAttr rhs_quantization_axis, ::mlir::IntegerAttr rhs_quantization_min_val, ::mlir::IntegerAttr rhs_quantization_max_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value rhs_scales, ::mlir::Value rhs_zero_points, /*optional*/uint64_t rhs_quantization_axis, uint64_t rhs_quantization_min_val, uint64_t rhs_quantization_max_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value rhs_scales, ::mlir::Value rhs_zero_points, /*optional*/uint64_t rhs_quantization_axis, uint64_t rhs_quantization_min_val, uint64_t rhs_quantization_max_val); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::UniformQuantizedDotHybridOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::UniformQuantizedDotOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class UniformQuantizedDotOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + UniformQuantizedDotOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + UniformQuantizedDotOpGenericAdaptorBase(UniformQuantizedDotOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getLhsQuantizationAxisAttr(); + uint64_t getLhsQuantizationAxis(); + ::mlir::IntegerAttr getLhsQuantizationMinValAttr(); + uint64_t getLhsQuantizationMinVal(); + ::mlir::IntegerAttr getLhsQuantizationMaxValAttr(); + uint64_t getLhsQuantizationMaxVal(); + ::mlir::IntegerAttr getRhsQuantizationAxisAttr(); + uint64_t getRhsQuantizationAxis(); + ::mlir::IntegerAttr getRhsQuantizationMinValAttr(); + uint64_t getRhsQuantizationMinVal(); + ::mlir::IntegerAttr getRhsQuantizationMaxValAttr(); + uint64_t getRhsQuantizationMaxVal(); + ::mlir::IntegerAttr getOutputQuantizationAxisAttr(); + uint64_t getOutputQuantizationAxis(); + ::mlir::IntegerAttr getOutputQuantizationMinValAttr(); + uint64_t getOutputQuantizationMinVal(); + ::mlir::IntegerAttr getOutputQuantizationMaxValAttr(); + uint64_t getOutputQuantizationMaxVal(); +}; +} // namespace detail +template +class UniformQuantizedDotOpGenericAdaptor : public detail::UniformQuantizedDotOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::UniformQuantizedDotOpGenericAdaptorBase; +public: + UniformQuantizedDotOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + UniformQuantizedDotOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : UniformQuantizedDotOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + UniformQuantizedDotOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + ValueT getLhsScales() { + return (*getODSOperands(2).begin()); + } + + ValueT getLhsZeroPoints() { + return (*getODSOperands(3).begin()); + } + + ValueT getRhsScales() { + return (*getODSOperands(4).begin()); + } + + ValueT getRhsZeroPoints() { + return (*getODSOperands(5).begin()); + } + + ValueT getOutputScales() { + return (*getODSOperands(6).begin()); + } + + ValueT getOutputZeroPoints() { + return (*getODSOperands(7).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class UniformQuantizedDotOpAdaptor : public UniformQuantizedDotOpGenericAdaptor<::mlir::ValueRange> { +public: + using UniformQuantizedDotOpGenericAdaptor::UniformQuantizedDotOpGenericAdaptor; + UniformQuantizedDotOpAdaptor(UniformQuantizedDotOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class UniformQuantizedDotOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<8>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = UniformQuantizedDotOpAdaptor; + template + using GenericAdaptor = UniformQuantizedDotOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tin"), ::llvm::StringRef("Tout"), ::llvm::StringRef("lhs_quantization_axis"), ::llvm::StringRef("lhs_quantization_max_val"), ::llvm::StringRef("lhs_quantization_min_val"), ::llvm::StringRef("output_quantization_axis"), ::llvm::StringRef("output_quantization_max_val"), ::llvm::StringRef("output_quantization_min_val"), ::llvm::StringRef("rhs_quantization_axis"), ::llvm::StringRef("rhs_quantization_max_val"), ::llvm::StringRef("rhs_quantization_min_val")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTinAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTinAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getToutAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getToutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getLhsQuantizationAxisAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getLhsQuantizationAxisAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getLhsQuantizationMaxValAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getLhsQuantizationMaxValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getLhsQuantizationMinValAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getLhsQuantizationMinValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getOutputQuantizationAxisAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getOutputQuantizationAxisAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getOutputQuantizationMaxValAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getOutputQuantizationMaxValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getOutputQuantizationMinValAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getOutputQuantizationMinValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getRhsQuantizationAxisAttrName() { + return getAttributeNameForIndex(8); + } + + static ::mlir::StringAttr getRhsQuantizationAxisAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 8); + } + + ::mlir::StringAttr getRhsQuantizationMaxValAttrName() { + return getAttributeNameForIndex(9); + } + + static ::mlir::StringAttr getRhsQuantizationMaxValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 9); + } + + ::mlir::StringAttr getRhsQuantizationMinValAttrName() { + return getAttributeNameForIndex(10); + } + + static ::mlir::StringAttr getRhsQuantizationMinValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 10); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.UniformQuantizedDot"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLhs(); + ::mlir::TypedValue<::mlir::TensorType> getRhs(); + ::mlir::TypedValue<::mlir::TensorType> getLhsScales(); + ::mlir::TypedValue<::mlir::TensorType> getLhsZeroPoints(); + ::mlir::TypedValue<::mlir::TensorType> getRhsScales(); + ::mlir::TypedValue<::mlir::TensorType> getRhsZeroPoints(); + ::mlir::TypedValue<::mlir::TensorType> getOutputScales(); + ::mlir::TypedValue<::mlir::TensorType> getOutputZeroPoints(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + ::mlir::OpOperand &getLhsScalesMutable(); + ::mlir::OpOperand &getLhsZeroPointsMutable(); + ::mlir::OpOperand &getRhsScalesMutable(); + ::mlir::OpOperand &getRhsZeroPointsMutable(); + ::mlir::OpOperand &getOutputScalesMutable(); + ::mlir::OpOperand &getOutputZeroPointsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getLhsQuantizationAxisAttr(); + uint64_t getLhsQuantizationAxis(); + ::mlir::IntegerAttr getLhsQuantizationMinValAttr(); + uint64_t getLhsQuantizationMinVal(); + ::mlir::IntegerAttr getLhsQuantizationMaxValAttr(); + uint64_t getLhsQuantizationMaxVal(); + ::mlir::IntegerAttr getRhsQuantizationAxisAttr(); + uint64_t getRhsQuantizationAxis(); + ::mlir::IntegerAttr getRhsQuantizationMinValAttr(); + uint64_t getRhsQuantizationMinVal(); + ::mlir::IntegerAttr getRhsQuantizationMaxValAttr(); + uint64_t getRhsQuantizationMaxVal(); + ::mlir::IntegerAttr getOutputQuantizationAxisAttr(); + uint64_t getOutputQuantizationAxis(); + ::mlir::IntegerAttr getOutputQuantizationMinValAttr(); + uint64_t getOutputQuantizationMinVal(); + ::mlir::IntegerAttr getOutputQuantizationMaxValAttr(); + uint64_t getOutputQuantizationMaxVal(); + ::mlir::Type getTin(); + ::mlir::Type getTout(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setLhsQuantizationAxisAttr(::mlir::IntegerAttr attr); + void setLhsQuantizationAxis(::std::optional attrValue); + void setLhsQuantizationMinValAttr(::mlir::IntegerAttr attr); + void setLhsQuantizationMinVal(uint64_t attrValue); + void setLhsQuantizationMaxValAttr(::mlir::IntegerAttr attr); + void setLhsQuantizationMaxVal(uint64_t attrValue); + void setRhsQuantizationAxisAttr(::mlir::IntegerAttr attr); + void setRhsQuantizationAxis(::std::optional attrValue); + void setRhsQuantizationMinValAttr(::mlir::IntegerAttr attr); + void setRhsQuantizationMinVal(uint64_t attrValue); + void setRhsQuantizationMaxValAttr(::mlir::IntegerAttr attr); + void setRhsQuantizationMaxVal(uint64_t attrValue); + void setOutputQuantizationAxisAttr(::mlir::IntegerAttr attr); + void setOutputQuantizationAxis(::std::optional attrValue); + void setOutputQuantizationMinValAttr(::mlir::IntegerAttr attr); + void setOutputQuantizationMinVal(uint64_t attrValue); + void setOutputQuantizationMaxValAttr(::mlir::IntegerAttr attr); + void setOutputQuantizationMaxVal(uint64_t attrValue); + ::mlir::Attribute removeLhsQuantizationAxisAttr(); + ::mlir::Attribute removeRhsQuantizationAxisAttr(); + ::mlir::Attribute removeOutputQuantizationAxisAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value lhs_scales, ::mlir::Value lhs_zero_points, ::mlir::Value rhs_scales, ::mlir::Value rhs_zero_points, ::mlir::Value output_scales, ::mlir::Value output_zero_points, /*optional*/::mlir::IntegerAttr lhs_quantization_axis, ::mlir::IntegerAttr lhs_quantization_min_val, ::mlir::IntegerAttr lhs_quantization_max_val, /*optional*/::mlir::IntegerAttr rhs_quantization_axis, ::mlir::IntegerAttr rhs_quantization_min_val, ::mlir::IntegerAttr rhs_quantization_max_val, /*optional*/::mlir::IntegerAttr output_quantization_axis, ::mlir::IntegerAttr output_quantization_min_val, ::mlir::IntegerAttr output_quantization_max_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value lhs_scales, ::mlir::Value lhs_zero_points, ::mlir::Value rhs_scales, ::mlir::Value rhs_zero_points, ::mlir::Value output_scales, ::mlir::Value output_zero_points, /*optional*/::mlir::IntegerAttr lhs_quantization_axis, ::mlir::IntegerAttr lhs_quantization_min_val, ::mlir::IntegerAttr lhs_quantization_max_val, /*optional*/::mlir::IntegerAttr rhs_quantization_axis, ::mlir::IntegerAttr rhs_quantization_min_val, ::mlir::IntegerAttr rhs_quantization_max_val, /*optional*/::mlir::IntegerAttr output_quantization_axis, ::mlir::IntegerAttr output_quantization_min_val, ::mlir::IntegerAttr output_quantization_max_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value lhs_scales, ::mlir::Value lhs_zero_points, ::mlir::Value rhs_scales, ::mlir::Value rhs_zero_points, ::mlir::Value output_scales, ::mlir::Value output_zero_points, /*optional*/uint64_t lhs_quantization_axis, uint64_t lhs_quantization_min_val, uint64_t lhs_quantization_max_val, /*optional*/uint64_t rhs_quantization_axis, uint64_t rhs_quantization_min_val, uint64_t rhs_quantization_max_val, /*optional*/uint64_t output_quantization_axis, uint64_t output_quantization_min_val, uint64_t output_quantization_max_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value lhs_scales, ::mlir::Value lhs_zero_points, ::mlir::Value rhs_scales, ::mlir::Value rhs_zero_points, ::mlir::Value output_scales, ::mlir::Value output_zero_points, /*optional*/uint64_t lhs_quantization_axis, uint64_t lhs_quantization_min_val, uint64_t lhs_quantization_max_val, /*optional*/uint64_t rhs_quantization_axis, uint64_t rhs_quantization_min_val, uint64_t rhs_quantization_max_val, /*optional*/uint64_t output_quantization_axis, uint64_t output_quantization_min_val, uint64_t output_quantization_max_val); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 11 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::UniformQuantizedDotOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::UniformRequantizeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class UniformRequantizeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + UniformRequantizeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + UniformRequantizeOpGenericAdaptorBase(UniformRequantizeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getInputQuantizationAxisAttr(); + uint64_t getInputQuantizationAxis(); + ::mlir::IntegerAttr getInputQuantizationMinValAttr(); + uint64_t getInputQuantizationMinVal(); + ::mlir::IntegerAttr getInputQuantizationMaxValAttr(); + uint64_t getInputQuantizationMaxVal(); + ::mlir::IntegerAttr getOutputQuantizationAxisAttr(); + uint64_t getOutputQuantizationAxis(); + ::mlir::IntegerAttr getOutputQuantizationMinValAttr(); + uint64_t getOutputQuantizationMinVal(); + ::mlir::IntegerAttr getOutputQuantizationMaxValAttr(); + uint64_t getOutputQuantizationMaxVal(); +}; +} // namespace detail +template +class UniformRequantizeOpGenericAdaptor : public detail::UniformRequantizeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::UniformRequantizeOpGenericAdaptorBase; +public: + UniformRequantizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + UniformRequantizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : UniformRequantizeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + UniformRequantizeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getInputScales() { + return (*getODSOperands(1).begin()); + } + + ValueT getInputZeroPoints() { + return (*getODSOperands(2).begin()); + } + + ValueT getOutputScales() { + return (*getODSOperands(3).begin()); + } + + ValueT getOutputZeroPoints() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class UniformRequantizeOpAdaptor : public UniformRequantizeOpGenericAdaptor<::mlir::ValueRange> { +public: + using UniformRequantizeOpGenericAdaptor::UniformRequantizeOpGenericAdaptor; + UniformRequantizeOpAdaptor(UniformRequantizeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class UniformRequantizeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<5>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = UniformRequantizeOpAdaptor; + template + using GenericAdaptor = UniformRequantizeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tin"), ::llvm::StringRef("Tout"), ::llvm::StringRef("input_quantization_axis"), ::llvm::StringRef("input_quantization_max_val"), ::llvm::StringRef("input_quantization_min_val"), ::llvm::StringRef("output_quantization_axis"), ::llvm::StringRef("output_quantization_max_val"), ::llvm::StringRef("output_quantization_min_val")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTinAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTinAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getToutAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getToutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getInputQuantizationAxisAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getInputQuantizationAxisAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getInputQuantizationMaxValAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getInputQuantizationMaxValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getInputQuantizationMinValAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getInputQuantizationMinValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getOutputQuantizationAxisAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getOutputQuantizationAxisAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getOutputQuantizationMaxValAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getOutputQuantizationMaxValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getOutputQuantizationMinValAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getOutputQuantizationMinValAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.UniformRequantize"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getInputScales(); + ::mlir::TypedValue<::mlir::TensorType> getInputZeroPoints(); + ::mlir::TypedValue<::mlir::TensorType> getOutputScales(); + ::mlir::TypedValue<::mlir::TensorType> getOutputZeroPoints(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getInputScalesMutable(); + ::mlir::OpOperand &getInputZeroPointsMutable(); + ::mlir::OpOperand &getOutputScalesMutable(); + ::mlir::OpOperand &getOutputZeroPointsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getInputQuantizationAxisAttr(); + uint64_t getInputQuantizationAxis(); + ::mlir::IntegerAttr getInputQuantizationMinValAttr(); + uint64_t getInputQuantizationMinVal(); + ::mlir::IntegerAttr getInputQuantizationMaxValAttr(); + uint64_t getInputQuantizationMaxVal(); + ::mlir::IntegerAttr getOutputQuantizationAxisAttr(); + uint64_t getOutputQuantizationAxis(); + ::mlir::IntegerAttr getOutputQuantizationMinValAttr(); + uint64_t getOutputQuantizationMinVal(); + ::mlir::IntegerAttr getOutputQuantizationMaxValAttr(); + uint64_t getOutputQuantizationMaxVal(); + ::mlir::Type getTin(); + ::mlir::Type getTout(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setInputQuantizationAxisAttr(::mlir::IntegerAttr attr); + void setInputQuantizationAxis(::std::optional attrValue); + void setInputQuantizationMinValAttr(::mlir::IntegerAttr attr); + void setInputQuantizationMinVal(uint64_t attrValue); + void setInputQuantizationMaxValAttr(::mlir::IntegerAttr attr); + void setInputQuantizationMaxVal(uint64_t attrValue); + void setOutputQuantizationAxisAttr(::mlir::IntegerAttr attr); + void setOutputQuantizationAxis(::std::optional attrValue); + void setOutputQuantizationMinValAttr(::mlir::IntegerAttr attr); + void setOutputQuantizationMinVal(uint64_t attrValue); + void setOutputQuantizationMaxValAttr(::mlir::IntegerAttr attr); + void setOutputQuantizationMaxVal(uint64_t attrValue); + ::mlir::Attribute removeInputQuantizationAxisAttr(); + ::mlir::Attribute removeOutputQuantizationAxisAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value input_scales, ::mlir::Value input_zero_points, ::mlir::Value output_scales, ::mlir::Value output_zero_points, /*optional*/::mlir::IntegerAttr input_quantization_axis, ::mlir::IntegerAttr input_quantization_min_val, ::mlir::IntegerAttr input_quantization_max_val, /*optional*/::mlir::IntegerAttr output_quantization_axis, ::mlir::IntegerAttr output_quantization_min_val, ::mlir::IntegerAttr output_quantization_max_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value input_scales, ::mlir::Value input_zero_points, ::mlir::Value output_scales, ::mlir::Value output_zero_points, /*optional*/::mlir::IntegerAttr input_quantization_axis, ::mlir::IntegerAttr input_quantization_min_val, ::mlir::IntegerAttr input_quantization_max_val, /*optional*/::mlir::IntegerAttr output_quantization_axis, ::mlir::IntegerAttr output_quantization_min_val, ::mlir::IntegerAttr output_quantization_max_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value input_scales, ::mlir::Value input_zero_points, ::mlir::Value output_scales, ::mlir::Value output_zero_points, /*optional*/uint64_t input_quantization_axis, uint64_t input_quantization_min_val, uint64_t input_quantization_max_val, /*optional*/uint64_t output_quantization_axis, uint64_t output_quantization_min_val, uint64_t output_quantization_max_val); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value input_scales, ::mlir::Value input_zero_points, ::mlir::Value output_scales, ::mlir::Value output_zero_points, /*optional*/uint64_t input_quantization_axis, uint64_t input_quantization_min_val, uint64_t input_quantization_max_val, /*optional*/uint64_t output_quantization_axis, uint64_t output_quantization_min_val, uint64_t output_quantization_max_val); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 8 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::UniformRequantizeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::UniqueOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class UniqueOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + UniqueOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + UniqueOpGenericAdaptorBase(UniqueOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class UniqueOpGenericAdaptor : public detail::UniqueOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::UniqueOpGenericAdaptorBase; +public: + UniqueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + UniqueOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : UniqueOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + UniqueOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class UniqueOpAdaptor : public UniqueOpGenericAdaptor<::mlir::ValueRange> { +public: + using UniqueOpGenericAdaptor::UniqueOpGenericAdaptor; + UniqueOpAdaptor(UniqueOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class UniqueOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = UniqueOpAdaptor; + template + using GenericAdaptor = UniqueOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("out_idx")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutIdxAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutIdxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Unique"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::TypedValue<::mlir::TensorType> getIdx(); + ::mlir::Type getT(); + ::mlir::Type getOutIdx(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Type idx, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::UniqueOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::UniqueV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class UniqueV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + UniqueV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + UniqueV2OpGenericAdaptorBase(UniqueV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class UniqueV2OpGenericAdaptor : public detail::UniqueV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::UniqueV2OpGenericAdaptorBase; +public: + UniqueV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + UniqueV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : UniqueV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + UniqueV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getAxis() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class UniqueV2OpAdaptor : public UniqueV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using UniqueV2OpGenericAdaptor::UniqueV2OpGenericAdaptor; + UniqueV2OpAdaptor(UniqueV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class UniqueV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = UniqueV2OpAdaptor; + template + using GenericAdaptor = UniqueV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Taxis"), ::llvm::StringRef("out_idx")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTaxisAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTaxisAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOutIdxAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOutIdxAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.UniqueV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getAxis(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getAxisMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::TypedValue<::mlir::TensorType> getIdx(); + ::mlir::Type getT(); + ::mlir::Type getTaxis(); + ::mlir::Type getOutIdx(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Type idx, ::mlir::Value x, ::mlir::Value axis); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value axis); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::UniqueV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::UnpackOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class UnpackOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + UnpackOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + UnpackOpGenericAdaptorBase(UnpackOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getAxisAttr(); + uint64_t getAxis(); +}; +} // namespace detail +template +class UnpackOpGenericAdaptor : public detail::UnpackOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::UnpackOpGenericAdaptorBase; +public: + UnpackOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + UnpackOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : UnpackOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + UnpackOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getValue() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class UnpackOpAdaptor : public UnpackOpGenericAdaptor<::mlir::ValueRange> { +public: + using UnpackOpGenericAdaptor::UnpackOpGenericAdaptor; + UnpackOpAdaptor(UnpackOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class UnpackOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = UnpackOpAdaptor; + template + using GenericAdaptor = UnpackOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("axis"), ::llvm::StringRef("num")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAxisAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAxisAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getNumAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getNumAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Unpack"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getValue(); + ::mlir::OpOperand &getValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutput(); + ::mlir::IntegerAttr getAxisAttr(); + uint64_t getAxis(); + ::mlir::Type getT(); + size_t getNum(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setAxisAttr(::mlir::IntegerAttr attr); + void setAxis(::std::optional attrValue); + ::mlir::Attribute removeAxisAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::Value value, /*optional*/::mlir::IntegerAttr axis); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::Value value, /*optional*/uint64_t axis = 0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::UnpackOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::UnsortedSegmentMaxOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class UnsortedSegmentMaxOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + UnsortedSegmentMaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + UnsortedSegmentMaxOpGenericAdaptorBase(UnsortedSegmentMaxOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class UnsortedSegmentMaxOpGenericAdaptor : public detail::UnsortedSegmentMaxOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::UnsortedSegmentMaxOpGenericAdaptorBase; +public: + UnsortedSegmentMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + UnsortedSegmentMaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : UnsortedSegmentMaxOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + UnsortedSegmentMaxOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getData() { + return (*getODSOperands(0).begin()); + } + + ValueT getSegmentIds() { + return (*getODSOperands(1).begin()); + } + + ValueT getNumSegments() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class UnsortedSegmentMaxOpAdaptor : public UnsortedSegmentMaxOpGenericAdaptor<::mlir::ValueRange> { +public: + using UnsortedSegmentMaxOpGenericAdaptor::UnsortedSegmentMaxOpGenericAdaptor; + UnsortedSegmentMaxOpAdaptor(UnsortedSegmentMaxOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class UnsortedSegmentMaxOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = UnsortedSegmentMaxOpAdaptor; + template + using GenericAdaptor = UnsortedSegmentMaxOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices"), ::llvm::StringRef("Tnumsegments")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTnumsegmentsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTnumsegmentsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.UnsortedSegmentMax"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getData(); + ::mlir::TypedValue<::mlir::TensorType> getSegmentIds(); + ::mlir::TypedValue<::mlir::TensorType> getNumSegments(); + ::mlir::OpOperand &getDataMutable(); + ::mlir::OpOperand &getSegmentIdsMutable(); + ::mlir::OpOperand &getNumSegmentsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + ::mlir::Type getTnumsegments(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value data, ::mlir::Value segment_ids, ::mlir::Value num_segments); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value data, ::mlir::Value segment_ids, ::mlir::Value num_segments); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::UnsortedSegmentMaxOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::UnsortedSegmentMinOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class UnsortedSegmentMinOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + UnsortedSegmentMinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + UnsortedSegmentMinOpGenericAdaptorBase(UnsortedSegmentMinOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class UnsortedSegmentMinOpGenericAdaptor : public detail::UnsortedSegmentMinOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::UnsortedSegmentMinOpGenericAdaptorBase; +public: + UnsortedSegmentMinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + UnsortedSegmentMinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : UnsortedSegmentMinOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + UnsortedSegmentMinOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getData() { + return (*getODSOperands(0).begin()); + } + + ValueT getSegmentIds() { + return (*getODSOperands(1).begin()); + } + + ValueT getNumSegments() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class UnsortedSegmentMinOpAdaptor : public UnsortedSegmentMinOpGenericAdaptor<::mlir::ValueRange> { +public: + using UnsortedSegmentMinOpGenericAdaptor::UnsortedSegmentMinOpGenericAdaptor; + UnsortedSegmentMinOpAdaptor(UnsortedSegmentMinOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class UnsortedSegmentMinOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = UnsortedSegmentMinOpAdaptor; + template + using GenericAdaptor = UnsortedSegmentMinOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices"), ::llvm::StringRef("Tnumsegments")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTnumsegmentsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTnumsegmentsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.UnsortedSegmentMin"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getData(); + ::mlir::TypedValue<::mlir::TensorType> getSegmentIds(); + ::mlir::TypedValue<::mlir::TensorType> getNumSegments(); + ::mlir::OpOperand &getDataMutable(); + ::mlir::OpOperand &getSegmentIdsMutable(); + ::mlir::OpOperand &getNumSegmentsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + ::mlir::Type getTnumsegments(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value data, ::mlir::Value segment_ids, ::mlir::Value num_segments); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value data, ::mlir::Value segment_ids, ::mlir::Value num_segments); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::UnsortedSegmentMinOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::UnsortedSegmentProdOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class UnsortedSegmentProdOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + UnsortedSegmentProdOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + UnsortedSegmentProdOpGenericAdaptorBase(UnsortedSegmentProdOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class UnsortedSegmentProdOpGenericAdaptor : public detail::UnsortedSegmentProdOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::UnsortedSegmentProdOpGenericAdaptorBase; +public: + UnsortedSegmentProdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + UnsortedSegmentProdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : UnsortedSegmentProdOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + UnsortedSegmentProdOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getData() { + return (*getODSOperands(0).begin()); + } + + ValueT getSegmentIds() { + return (*getODSOperands(1).begin()); + } + + ValueT getNumSegments() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class UnsortedSegmentProdOpAdaptor : public UnsortedSegmentProdOpGenericAdaptor<::mlir::ValueRange> { +public: + using UnsortedSegmentProdOpGenericAdaptor::UnsortedSegmentProdOpGenericAdaptor; + UnsortedSegmentProdOpAdaptor(UnsortedSegmentProdOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class UnsortedSegmentProdOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = UnsortedSegmentProdOpAdaptor; + template + using GenericAdaptor = UnsortedSegmentProdOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices"), ::llvm::StringRef("Tnumsegments")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTnumsegmentsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTnumsegmentsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.UnsortedSegmentProd"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getData(); + ::mlir::TypedValue<::mlir::TensorType> getSegmentIds(); + ::mlir::TypedValue<::mlir::TensorType> getNumSegments(); + ::mlir::OpOperand &getDataMutable(); + ::mlir::OpOperand &getSegmentIdsMutable(); + ::mlir::OpOperand &getNumSegmentsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + ::mlir::Type getTnumsegments(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value data, ::mlir::Value segment_ids, ::mlir::Value num_segments); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value data, ::mlir::Value segment_ids, ::mlir::Value num_segments); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::UnsortedSegmentProdOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::UnsortedSegmentSumOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class UnsortedSegmentSumOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + UnsortedSegmentSumOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + UnsortedSegmentSumOpGenericAdaptorBase(UnsortedSegmentSumOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class UnsortedSegmentSumOpGenericAdaptor : public detail::UnsortedSegmentSumOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::UnsortedSegmentSumOpGenericAdaptorBase; +public: + UnsortedSegmentSumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + UnsortedSegmentSumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : UnsortedSegmentSumOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + UnsortedSegmentSumOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getData() { + return (*getODSOperands(0).begin()); + } + + ValueT getSegmentIds() { + return (*getODSOperands(1).begin()); + } + + ValueT getNumSegments() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class UnsortedSegmentSumOpAdaptor : public UnsortedSegmentSumOpGenericAdaptor<::mlir::ValueRange> { +public: + using UnsortedSegmentSumOpGenericAdaptor::UnsortedSegmentSumOpGenericAdaptor; + UnsortedSegmentSumOpAdaptor(UnsortedSegmentSumOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class UnsortedSegmentSumOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = UnsortedSegmentSumOpAdaptor; + template + using GenericAdaptor = UnsortedSegmentSumOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices"), ::llvm::StringRef("Tnumsegments")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTnumsegmentsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTnumsegmentsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.UnsortedSegmentSum"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getData(); + ::mlir::TypedValue<::mlir::TensorType> getSegmentIds(); + ::mlir::TypedValue<::mlir::TensorType> getNumSegments(); + ::mlir::OpOperand &getDataMutable(); + ::mlir::OpOperand &getSegmentIdsMutable(); + ::mlir::OpOperand &getNumSegmentsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + ::mlir::Type getTnumsegments(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value data, ::mlir::Value segment_ids, ::mlir::Value num_segments); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value data, ::mlir::Value segment_ids, ::mlir::Value num_segments); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::UnsortedSegmentSumOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::UpperBoundOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class UpperBoundOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + UpperBoundOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + UpperBoundOpGenericAdaptorBase(UpperBoundOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class UpperBoundOpGenericAdaptor : public detail::UpperBoundOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::UpperBoundOpGenericAdaptorBase; +public: + UpperBoundOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + UpperBoundOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : UpperBoundOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + UpperBoundOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSortedInputs() { + return (*getODSOperands(0).begin()); + } + + ValueT getValues() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class UpperBoundOpAdaptor : public UpperBoundOpGenericAdaptor<::mlir::ValueRange> { +public: + using UpperBoundOpGenericAdaptor::UpperBoundOpGenericAdaptor; + UpperBoundOpAdaptor(UpperBoundOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class UpperBoundOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = UpperBoundOpAdaptor; + template + using GenericAdaptor = UpperBoundOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("out_type")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutTypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.UpperBound"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSortedInputs(); + ::mlir::TypedValue<::mlir::TensorType> getValues(); + ::mlir::OpOperand &getSortedInputsMutable(); + ::mlir::OpOperand &getValuesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getOutType(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value sorted_inputs, ::mlir::Value values); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value sorted_inputs, ::mlir::Value values); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::UpperBoundOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::VarHandleOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VarHandleOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VarHandleOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VarHandleOpGenericAdaptorBase(VarHandleOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getContainerAttr(); + ::llvm::StringRef getContainer(); + ::mlir::StringAttr getSharedNameAttr(); + ::llvm::StringRef getSharedName(); +}; +} // namespace detail +template +class VarHandleOpGenericAdaptor : public detail::VarHandleOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VarHandleOpGenericAdaptorBase; +public: + VarHandleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VarHandleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VarHandleOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VarHandleOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VarHandleOpAdaptor : public VarHandleOpGenericAdaptor<::mlir::ValueRange> { +public: + using VarHandleOpGenericAdaptor::VarHandleOpGenericAdaptor; + VarHandleOpAdaptor(VarHandleOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VarHandleOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ResourceHandleAllocatorInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = VarHandleOpAdaptor; + template + using GenericAdaptor = VarHandleOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("container"), ::llvm::StringRef("dtype"), ::llvm::StringRef("shape"), ::llvm::StringRef("shared_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getContainerAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getContainerAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShapeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSharedNameAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSharedNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.VarHandleOp"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResource(); + ::mlir::StringAttr getContainerAttr(); + ::llvm::StringRef getContainer(); + ::mlir::StringAttr getSharedNameAttr(); + ::llvm::StringRef getSharedName(); + ::mlir::Type getDtype(); + ShapedType getShape(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setContainerAttr(::mlir::StringAttr attr); + void setContainer(::llvm::StringRef attrValue); + void setSharedNameAttr(::mlir::StringAttr attr); + void setSharedName(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resource, ::mlir::StringAttr container, ::mlir::StringAttr shared_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr container, ::mlir::StringAttr shared_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resource, ::llvm::StringRef container = "", ::llvm::StringRef shared_name = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef container = "", ::llvm::StringRef shared_name = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultAttrs(const ::mlir::OperationName &opName, ::mlir::NamedAttrList &attributes); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + llvm::SmallVector GetResourceHandleValueAndIdList(llvm::SmallDenseMap&resource_handle_id_map, int64_t&next_id); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + TensorType resource_subtype() { return resource_type().getSubtypes()[0]; } + + ResourceType resource_type() { + return getElementTypeOrSelf(getResource()).cast(); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::VarHandleOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::VarIsInitializedOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VarIsInitializedOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VarIsInitializedOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VarIsInitializedOpGenericAdaptorBase(VarIsInitializedOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class VarIsInitializedOpGenericAdaptor : public detail::VarIsInitializedOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VarIsInitializedOpGenericAdaptorBase; +public: + VarIsInitializedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VarIsInitializedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VarIsInitializedOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VarIsInitializedOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getResource() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VarIsInitializedOpAdaptor : public VarIsInitializedOpGenericAdaptor<::mlir::ValueRange> { +public: + using VarIsInitializedOpGenericAdaptor::VarIsInitializedOpGenericAdaptor; + VarIsInitializedOpAdaptor(VarIsInitializedOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VarIsInitializedOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = VarIsInitializedOpAdaptor; + template + using GenericAdaptor = VarIsInitializedOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.VarIsInitializedOp"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResource(); + ::mlir::OpOperand &getResourceMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getIsInitialized(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type is_initialized, ::mlir::Value resource); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value resource); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::VarIsInitializedOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::VariableOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VariableOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VariableOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VariableOpGenericAdaptorBase(VariableOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Attribute getShapeAttr(); + std::optional> getShape(); + ::mlir::StringAttr getContainerAttr(); + ::llvm::StringRef getContainer(); + ::mlir::StringAttr getSharedNameAttr(); + ::llvm::StringRef getSharedName(); +}; +} // namespace detail +template +class VariableOpGenericAdaptor : public detail::VariableOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VariableOpGenericAdaptorBase; +public: + VariableOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VariableOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VariableOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VariableOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VariableOpAdaptor : public VariableOpGenericAdaptor<::mlir::ValueRange> { +public: + using VariableOpGenericAdaptor::VariableOpGenericAdaptor; + VariableOpAdaptor(VariableOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VariableOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = VariableOpAdaptor; + template + using GenericAdaptor = VariableOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("container"), ::llvm::StringRef("dtype"), ::llvm::StringRef("shape"), ::llvm::StringRef("shared_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getContainerAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getContainerAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShapeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSharedNameAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSharedNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Variable"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getRef(); + ::mlir::Attribute getShapeAttr(); + std::optional> getShape(); + ::mlir::StringAttr getContainerAttr(); + ::llvm::StringRef getContainer(); + ::mlir::StringAttr getSharedNameAttr(); + ::llvm::StringRef getSharedName(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setShapeAttr(::mlir::Attribute attr); + void setShape(std::optional> attrValue); + void setContainerAttr(::mlir::StringAttr attr); + void setContainer(::std::optional<::llvm::StringRef> attrValue); + void setSharedNameAttr(::mlir::StringAttr attr); + void setSharedName(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeContainerAttr(); + ::mlir::Attribute removeSharedNameAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type ref, ::mlir::Attribute shape, /*optional*/::mlir::StringAttr container, /*optional*/::mlir::StringAttr shared_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Attribute shape, /*optional*/::mlir::StringAttr container, /*optional*/::mlir::StringAttr shared_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type ref, std::optional> shape, /*optional*/::llvm::StringRef container = "", /*optional*/::llvm::StringRef shared_name = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, std::optional> shape, /*optional*/::llvm::StringRef container = "", /*optional*/::llvm::StringRef shared_name = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::VariableOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::VariableShapeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VariableShapeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VariableShapeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VariableShapeOpGenericAdaptorBase(VariableShapeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class VariableShapeOpGenericAdaptor : public detail::VariableShapeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VariableShapeOpGenericAdaptorBase; +public: + VariableShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VariableShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VariableShapeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VariableShapeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VariableShapeOpAdaptor : public VariableShapeOpGenericAdaptor<::mlir::ValueRange> { +public: + using VariableShapeOpGenericAdaptor::VariableShapeOpGenericAdaptor; + VariableShapeOpAdaptor(VariableShapeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VariableShapeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = VariableShapeOpAdaptor; + template + using GenericAdaptor = VariableShapeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("out_type")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOutTypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getOutTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.VariableShape"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getOutType(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::VariableShapeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::VariableV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class VariableV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + VariableV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + VariableV2OpGenericAdaptorBase(VariableV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Attribute getShapeAttr(); + std::optional> getShape(); + ::mlir::StringAttr getContainerAttr(); + ::llvm::StringRef getContainer(); + ::mlir::StringAttr getSharedNameAttr(); + ::llvm::StringRef getSharedName(); +}; +} // namespace detail +template +class VariableV2OpGenericAdaptor : public detail::VariableV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::VariableV2OpGenericAdaptorBase; +public: + VariableV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + VariableV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : VariableV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + VariableV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class VariableV2OpAdaptor : public VariableV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using VariableV2OpGenericAdaptor::VariableV2OpGenericAdaptor; + VariableV2OpAdaptor(VariableV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class VariableV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = VariableV2OpAdaptor; + template + using GenericAdaptor = VariableV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("container"), ::llvm::StringRef("dtype"), ::llvm::StringRef("shape"), ::llvm::StringRef("shared_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getContainerAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getContainerAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShapeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSharedNameAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSharedNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.VariableV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getRef(); + ::mlir::Attribute getShapeAttr(); + std::optional> getShape(); + ::mlir::StringAttr getContainerAttr(); + ::llvm::StringRef getContainer(); + ::mlir::StringAttr getSharedNameAttr(); + ::llvm::StringRef getSharedName(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setShapeAttr(::mlir::Attribute attr); + void setShape(std::optional> attrValue); + void setContainerAttr(::mlir::StringAttr attr); + void setContainer(::std::optional<::llvm::StringRef> attrValue); + void setSharedNameAttr(::mlir::StringAttr attr); + void setSharedName(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeContainerAttr(); + ::mlir::Attribute removeSharedNameAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type ref, ::mlir::Attribute shape, /*optional*/::mlir::StringAttr container, /*optional*/::mlir::StringAttr shared_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Attribute shape, /*optional*/::mlir::StringAttr container, /*optional*/::mlir::StringAttr shared_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type ref, std::optional> shape, /*optional*/::llvm::StringRef container = "", /*optional*/::llvm::StringRef shared_name = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, std::optional> shape, /*optional*/::llvm::StringRef container = "", /*optional*/::llvm::StringRef shared_name = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::VariableV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::WhereOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class WhereOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + WhereOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + WhereOpGenericAdaptorBase(WhereOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class WhereOpGenericAdaptor : public detail::WhereOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::WhereOpGenericAdaptorBase; +public: + WhereOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + WhereOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : WhereOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + WhereOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class WhereOpAdaptor : public WhereOpGenericAdaptor<::mlir::ValueRange> { +public: + using WhereOpGenericAdaptor::WhereOpGenericAdaptor; + WhereOpAdaptor(WhereOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class WhereOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = WhereOpAdaptor; + template + using GenericAdaptor = WhereOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Where"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getIndex(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type index, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::WhereOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::WhileOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class WhileOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + WhileOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + WhileOpGenericAdaptorBase(WhileOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::FlatSymbolRefAttr getCondAttr(); + ::llvm::StringRef getCond(); + ::mlir::FlatSymbolRefAttr getBodyAttr(); + ::llvm::StringRef getBody(); + ::mlir::IntegerAttr getParallelIterationsAttr(); + uint64_t getParallelIterations(); + ::mlir::BoolAttr getIsStatelessAttr(); + bool getIsStateless(); + ::mlir::UnitAttr getShapeInvariantAttr(); + bool getShapeInvariant(); +}; +} // namespace detail +template +class WhileOpGenericAdaptor : public detail::WhileOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::WhileOpGenericAdaptorBase; +public: + WhileOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + WhileOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : WhileOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + WhileOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInput() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class WhileOpAdaptor : public WhileOpGenericAdaptor<::mlir::ValueRange> { +public: + using WhileOpGenericAdaptor::WhileOpGenericAdaptor; + WhileOpAdaptor(WhileOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class WhileOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = WhileOpAdaptor; + template + using GenericAdaptor = WhileOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("body"), ::llvm::StringRef("cond"), ::llvm::StringRef("is_stateless"), ::llvm::StringRef("output_shapes"), ::llvm::StringRef("parallel_iterations"), ::llvm::StringRef("shape_invariant")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getBodyAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getBodyAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getCondAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getCondAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getIsStatelessAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getIsStatelessAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getOutputShapesAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getOutputShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getParallelIterationsAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getParallelIterationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getShapeInvariantAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getShapeInvariantAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.While"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInput(); + ::mlir::MutableOperandRange getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutput(); + ::mlir::FlatSymbolRefAttr getCondAttr(); + ::llvm::StringRef getCond(); + ::mlir::FlatSymbolRefAttr getBodyAttr(); + ::llvm::StringRef getBody(); + ::mlir::IntegerAttr getParallelIterationsAttr(); + uint64_t getParallelIterations(); + ::mlir::BoolAttr getIsStatelessAttr(); + bool getIsStateless(); + ::mlir::UnitAttr getShapeInvariantAttr(); + bool getShapeInvariant(); + mlir::OperandElementTypeRange getT(); + mlir::TF::ResultShapeRange getOutputShapes(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setCondAttr(::mlir::FlatSymbolRefAttr attr); + void setCond(::llvm::StringRef attrValue); + void setBodyAttr(::mlir::FlatSymbolRefAttr attr); + void setBody(::llvm::StringRef attrValue); + void setParallelIterationsAttr(::mlir::IntegerAttr attr); + void setParallelIterations(::std::optional attrValue); + void setIsStatelessAttr(::mlir::BoolAttr attr); + void setIsStateless(bool attrValue); + void setShapeInvariantAttr(::mlir::UnitAttr attr); + void setShapeInvariant(bool attrValue); + ::mlir::Attribute removeParallelIterationsAttr(); + ::mlir::Attribute removeShapeInvariantAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::ValueRange input, ::mlir::FlatSymbolRefAttr cond, ::mlir::FlatSymbolRefAttr body, /*optional*/::mlir::IntegerAttr parallel_iterations, ::mlir::BoolAttr is_stateless, /*optional*/::mlir::UnitAttr shape_invariant); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::ValueRange input, ::llvm::StringRef cond, ::llvm::StringRef body, /*optional*/uint64_t parallel_iterations, bool is_stateless, /*optional*/bool shape_invariant = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verifySymbolUses(::mlir::SymbolTableCollection &symbolTable); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 7 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Get the condition function. + // Prefer passing in SymbolTableCollection to reduce lookup costs by + // enabling reusing cached symbol table lookup. + func::FuncOp ResolveCondFunction(::mlir::SymbolTableCollection* table) { + if (table) + return table->lookupNearestSymbolFrom(*this, getCondAttr()); + return SymbolTable::lookupNearestSymbolFrom(*this, getCondAttr()); + } + // TODO(b/204997177): Deprecate and remove. + func::FuncOp cond_function() { return ResolveCondFunction(nullptr); } + + // Get the body function. + // Prefer passing in SymbolTableCollection to reduce lookup costs by + // enabling reusing cached symbol table lookup. + func::FuncOp ResolveBodyFunction(::mlir::SymbolTableCollection* table) { + if (table) + return table->lookupNearestSymbolFrom(*this, getBodyAttr()); + return SymbolTable::lookupNearestSymbolFrom(*this, getBodyAttr()); + } + // TODO(b/204997177): Deprecate and remove. + func::FuncOp body_function() { return ResolveBodyFunction(nullptr); } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::WhileOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::WhileRegionOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class WhileRegionOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + WhileRegionOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + WhileRegionOpGenericAdaptorBase(WhileRegionOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getParallelIterationsAttr(); + uint64_t getParallelIterations(); + ::mlir::BoolAttr getIsStatelessAttr(); + bool getIsStateless(); + ::mlir::UnitAttr getShapeInvariantAttr(); + bool getShapeInvariant(); + ::mlir::Region &getCond(); + ::mlir::Region &getBody(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class WhileRegionOpGenericAdaptor : public detail::WhileRegionOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::WhileRegionOpGenericAdaptorBase; +public: + WhileRegionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + WhileRegionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : WhileRegionOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + WhileRegionOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInput() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class WhileRegionOpAdaptor : public WhileRegionOpGenericAdaptor<::mlir::ValueRange> { +public: + using WhileRegionOpGenericAdaptor::WhileRegionOpGenericAdaptor; + WhileRegionOpAdaptor(WhileRegionOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class WhileRegionOp : public ::mlir::Op::Impl, ::mlir::OpTrait::VariadicResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::SingleBlock, ::mlir::OpTrait::SingleBlockImplicitTerminator::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::LoopLikeOpInterface::Trait, ::mlir::RegionBranchOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = WhileRegionOpAdaptor; + template + using GenericAdaptor = WhileRegionOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("is_stateless"), ::llvm::StringRef("parallel_iterations"), ::llvm::StringRef("shape_invariant")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getIsStatelessAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getIsStatelessAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getParallelIterationsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getParallelIterationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShapeInvariantAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShapeInvariantAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.WhileRegion"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInput(); + ::mlir::MutableOperandRange getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutput(); + ::mlir::Region &getCond(); + ::mlir::Region &getBody(); + ::mlir::IntegerAttr getParallelIterationsAttr(); + uint64_t getParallelIterations(); + ::mlir::BoolAttr getIsStatelessAttr(); + bool getIsStateless(); + ::mlir::UnitAttr getShapeInvariantAttr(); + bool getShapeInvariant(); + void setParallelIterationsAttr(::mlir::IntegerAttr attr); + void setParallelIterations(::std::optional attrValue); + void setIsStatelessAttr(::mlir::BoolAttr attr); + void setIsStateless(bool attrValue); + void setShapeInvariantAttr(::mlir::UnitAttr attr); + void setShapeInvariant(bool attrValue); + ::mlir::Attribute removeParallelIterationsAttr(); + ::mlir::Attribute removeShapeInvariantAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::ValueRange input, /*optional*/::mlir::IntegerAttr parallel_iterations, ::mlir::BoolAttr is_stateless, /*optional*/::mlir::UnitAttr shape_invariant); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::ValueRange input, /*optional*/uint64_t parallel_iterations, bool is_stateless, /*optional*/bool shape_invariant = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::llvm::SmallVector<::mlir::Region *> getLoopRegions(); + ::mlir::OperandRange getEntrySuccessorOperands(::mlir::RegionBranchPoint point); + void getSuccessorRegions(::mlir::RegionBranchPoint point, ::llvm::SmallVectorImpl<::mlir::RegionSuccessor> ®ions); + void getRegionInvocationBounds(::llvm::ArrayRef<::mlir::Attribute> operands, ::llvm::SmallVectorImpl<::mlir::InvocationBounds> &invocationBounds); + bool areTypesCompatible(::mlir::Type lhs, ::mlir::Type rhs); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::WhileRegionOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::WriteAudioSummaryOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class WriteAudioSummaryOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + WriteAudioSummaryOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + WriteAudioSummaryOpGenericAdaptorBase(WriteAudioSummaryOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getMaxOutputsAttr(); + uint64_t getMaxOutputs(); +}; +} // namespace detail +template +class WriteAudioSummaryOpGenericAdaptor : public detail::WriteAudioSummaryOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::WriteAudioSummaryOpGenericAdaptorBase; +public: + WriteAudioSummaryOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + WriteAudioSummaryOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : WriteAudioSummaryOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + WriteAudioSummaryOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getWriter() { + return (*getODSOperands(0).begin()); + } + + ValueT getStep() { + return (*getODSOperands(1).begin()); + } + + ValueT getTag() { + return (*getODSOperands(2).begin()); + } + + ValueT getTensor() { + return (*getODSOperands(3).begin()); + } + + ValueT getSampleRate() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class WriteAudioSummaryOpAdaptor : public WriteAudioSummaryOpGenericAdaptor<::mlir::ValueRange> { +public: + using WriteAudioSummaryOpGenericAdaptor::WriteAudioSummaryOpGenericAdaptor; + WriteAudioSummaryOpAdaptor(WriteAudioSummaryOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class WriteAudioSummaryOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = WriteAudioSummaryOpAdaptor; + template + using GenericAdaptor = WriteAudioSummaryOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("max_outputs")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getMaxOutputsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getMaxOutputsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.WriteAudioSummary"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getWriter(); + ::mlir::TypedValue<::mlir::TensorType> getStep(); + ::mlir::TypedValue<::mlir::TensorType> getTag(); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::TypedValue<::mlir::TensorType> getSampleRate(); + ::mlir::OpOperand &getWriterMutable(); + ::mlir::OpOperand &getStepMutable(); + ::mlir::OpOperand &getTagMutable(); + ::mlir::OpOperand &getTensorMutable(); + ::mlir::OpOperand &getSampleRateMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getMaxOutputsAttr(); + uint64_t getMaxOutputs(); + void setMaxOutputsAttr(::mlir::IntegerAttr attr); + void setMaxOutputs(::std::optional attrValue); + ::mlir::Attribute removeMaxOutputsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value writer, ::mlir::Value step, ::mlir::Value tag, ::mlir::Value tensor, ::mlir::Value sample_rate, /*optional*/::mlir::IntegerAttr max_outputs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value writer, ::mlir::Value step, ::mlir::Value tag, ::mlir::Value tensor, ::mlir::Value sample_rate, /*optional*/::mlir::IntegerAttr max_outputs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value writer, ::mlir::Value step, ::mlir::Value tag, ::mlir::Value tensor, ::mlir::Value sample_rate, /*optional*/uint64_t max_outputs = 3); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value writer, ::mlir::Value step, ::mlir::Value tag, ::mlir::Value tensor, ::mlir::Value sample_rate, /*optional*/uint64_t max_outputs = 3); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::WriteAudioSummaryOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::WriteGraphSummaryOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class WriteGraphSummaryOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + WriteGraphSummaryOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + WriteGraphSummaryOpGenericAdaptorBase(WriteGraphSummaryOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class WriteGraphSummaryOpGenericAdaptor : public detail::WriteGraphSummaryOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::WriteGraphSummaryOpGenericAdaptorBase; +public: + WriteGraphSummaryOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + WriteGraphSummaryOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : WriteGraphSummaryOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + WriteGraphSummaryOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getWriter() { + return (*getODSOperands(0).begin()); + } + + ValueT getStep() { + return (*getODSOperands(1).begin()); + } + + ValueT getTensor() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class WriteGraphSummaryOpAdaptor : public WriteGraphSummaryOpGenericAdaptor<::mlir::ValueRange> { +public: + using WriteGraphSummaryOpGenericAdaptor::WriteGraphSummaryOpGenericAdaptor; + WriteGraphSummaryOpAdaptor(WriteGraphSummaryOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class WriteGraphSummaryOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = WriteGraphSummaryOpAdaptor; + template + using GenericAdaptor = WriteGraphSummaryOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.WriteGraphSummary"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getWriter(); + ::mlir::TypedValue<::mlir::TensorType> getStep(); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::OpOperand &getWriterMutable(); + ::mlir::OpOperand &getStepMutable(); + ::mlir::OpOperand &getTensorMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value writer, ::mlir::Value step, ::mlir::Value tensor); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value writer, ::mlir::Value step, ::mlir::Value tensor); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::WriteGraphSummaryOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::WriteHistogramSummaryOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class WriteHistogramSummaryOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + WriteHistogramSummaryOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + WriteHistogramSummaryOpGenericAdaptorBase(WriteHistogramSummaryOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class WriteHistogramSummaryOpGenericAdaptor : public detail::WriteHistogramSummaryOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::WriteHistogramSummaryOpGenericAdaptorBase; +public: + WriteHistogramSummaryOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + WriteHistogramSummaryOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : WriteHistogramSummaryOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + WriteHistogramSummaryOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getWriter() { + return (*getODSOperands(0).begin()); + } + + ValueT getStep() { + return (*getODSOperands(1).begin()); + } + + ValueT getTag() { + return (*getODSOperands(2).begin()); + } + + ValueT getValues() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class WriteHistogramSummaryOpAdaptor : public WriteHistogramSummaryOpGenericAdaptor<::mlir::ValueRange> { +public: + using WriteHistogramSummaryOpGenericAdaptor::WriteHistogramSummaryOpGenericAdaptor; + WriteHistogramSummaryOpAdaptor(WriteHistogramSummaryOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class WriteHistogramSummaryOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = WriteHistogramSummaryOpAdaptor; + template + using GenericAdaptor = WriteHistogramSummaryOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.WriteHistogramSummary"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getWriter(); + ::mlir::TypedValue<::mlir::TensorType> getStep(); + ::mlir::TypedValue<::mlir::TensorType> getTag(); + ::mlir::TypedValue<::mlir::TensorType> getValues(); + ::mlir::OpOperand &getWriterMutable(); + ::mlir::OpOperand &getStepMutable(); + ::mlir::OpOperand &getTagMutable(); + ::mlir::OpOperand &getValuesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value writer, ::mlir::Value step, ::mlir::Value tag, ::mlir::Value values); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value writer, ::mlir::Value step, ::mlir::Value tag, ::mlir::Value values); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::WriteHistogramSummaryOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::WriteImageSummaryOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class WriteImageSummaryOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + WriteImageSummaryOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + WriteImageSummaryOpGenericAdaptorBase(WriteImageSummaryOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getMaxImagesAttr(); + uint64_t getMaxImages(); +}; +} // namespace detail +template +class WriteImageSummaryOpGenericAdaptor : public detail::WriteImageSummaryOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::WriteImageSummaryOpGenericAdaptorBase; +public: + WriteImageSummaryOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + WriteImageSummaryOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : WriteImageSummaryOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + WriteImageSummaryOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getWriter() { + return (*getODSOperands(0).begin()); + } + + ValueT getStep() { + return (*getODSOperands(1).begin()); + } + + ValueT getTag() { + return (*getODSOperands(2).begin()); + } + + ValueT getTensor() { + return (*getODSOperands(3).begin()); + } + + ValueT getBadColor() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class WriteImageSummaryOpAdaptor : public WriteImageSummaryOpGenericAdaptor<::mlir::ValueRange> { +public: + using WriteImageSummaryOpGenericAdaptor::WriteImageSummaryOpGenericAdaptor; + WriteImageSummaryOpAdaptor(WriteImageSummaryOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class WriteImageSummaryOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = WriteImageSummaryOpAdaptor; + template + using GenericAdaptor = WriteImageSummaryOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("max_images")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getMaxImagesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getMaxImagesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.WriteImageSummary"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getWriter(); + ::mlir::TypedValue<::mlir::TensorType> getStep(); + ::mlir::TypedValue<::mlir::TensorType> getTag(); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::TypedValue<::mlir::TensorType> getBadColor(); + ::mlir::OpOperand &getWriterMutable(); + ::mlir::OpOperand &getStepMutable(); + ::mlir::OpOperand &getTagMutable(); + ::mlir::OpOperand &getTensorMutable(); + ::mlir::OpOperand &getBadColorMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getMaxImagesAttr(); + uint64_t getMaxImages(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setMaxImagesAttr(::mlir::IntegerAttr attr); + void setMaxImages(::std::optional attrValue); + ::mlir::Attribute removeMaxImagesAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value writer, ::mlir::Value step, ::mlir::Value tag, ::mlir::Value tensor, ::mlir::Value bad_color, /*optional*/::mlir::IntegerAttr max_images); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value writer, ::mlir::Value step, ::mlir::Value tag, ::mlir::Value tensor, ::mlir::Value bad_color, /*optional*/::mlir::IntegerAttr max_images); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value writer, ::mlir::Value step, ::mlir::Value tag, ::mlir::Value tensor, ::mlir::Value bad_color, /*optional*/uint64_t max_images = 3); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value writer, ::mlir::Value step, ::mlir::Value tag, ::mlir::Value tensor, ::mlir::Value bad_color, /*optional*/uint64_t max_images = 3); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::WriteImageSummaryOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::WriteRawProtoSummaryOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class WriteRawProtoSummaryOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + WriteRawProtoSummaryOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + WriteRawProtoSummaryOpGenericAdaptorBase(WriteRawProtoSummaryOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class WriteRawProtoSummaryOpGenericAdaptor : public detail::WriteRawProtoSummaryOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::WriteRawProtoSummaryOpGenericAdaptorBase; +public: + WriteRawProtoSummaryOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + WriteRawProtoSummaryOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : WriteRawProtoSummaryOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + WriteRawProtoSummaryOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getWriter() { + return (*getODSOperands(0).begin()); + } + + ValueT getStep() { + return (*getODSOperands(1).begin()); + } + + ValueT getTensor() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class WriteRawProtoSummaryOpAdaptor : public WriteRawProtoSummaryOpGenericAdaptor<::mlir::ValueRange> { +public: + using WriteRawProtoSummaryOpGenericAdaptor::WriteRawProtoSummaryOpGenericAdaptor; + WriteRawProtoSummaryOpAdaptor(WriteRawProtoSummaryOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class WriteRawProtoSummaryOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = WriteRawProtoSummaryOpAdaptor; + template + using GenericAdaptor = WriteRawProtoSummaryOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.WriteRawProtoSummary"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getWriter(); + ::mlir::TypedValue<::mlir::TensorType> getStep(); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::OpOperand &getWriterMutable(); + ::mlir::OpOperand &getStepMutable(); + ::mlir::OpOperand &getTensorMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value writer, ::mlir::Value step, ::mlir::Value tensor); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value writer, ::mlir::Value step, ::mlir::Value tensor); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::WriteRawProtoSummaryOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::WriteScalarSummaryOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class WriteScalarSummaryOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + WriteScalarSummaryOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + WriteScalarSummaryOpGenericAdaptorBase(WriteScalarSummaryOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class WriteScalarSummaryOpGenericAdaptor : public detail::WriteScalarSummaryOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::WriteScalarSummaryOpGenericAdaptorBase; +public: + WriteScalarSummaryOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + WriteScalarSummaryOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : WriteScalarSummaryOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + WriteScalarSummaryOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getWriter() { + return (*getODSOperands(0).begin()); + } + + ValueT getStep() { + return (*getODSOperands(1).begin()); + } + + ValueT getTag() { + return (*getODSOperands(2).begin()); + } + + ValueT getValue() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class WriteScalarSummaryOpAdaptor : public WriteScalarSummaryOpGenericAdaptor<::mlir::ValueRange> { +public: + using WriteScalarSummaryOpGenericAdaptor::WriteScalarSummaryOpGenericAdaptor; + WriteScalarSummaryOpAdaptor(WriteScalarSummaryOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class WriteScalarSummaryOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = WriteScalarSummaryOpAdaptor; + template + using GenericAdaptor = WriteScalarSummaryOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.WriteScalarSummary"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getWriter(); + ::mlir::TypedValue<::mlir::TensorType> getStep(); + ::mlir::TypedValue<::mlir::TensorType> getTag(); + ::mlir::TypedValue<::mlir::TensorType> getValue(); + ::mlir::OpOperand &getWriterMutable(); + ::mlir::OpOperand &getStepMutable(); + ::mlir::OpOperand &getTagMutable(); + ::mlir::OpOperand &getValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value writer, ::mlir::Value step, ::mlir::Value tag, ::mlir::Value value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value writer, ::mlir::Value step, ::mlir::Value tag, ::mlir::Value value); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::WriteScalarSummaryOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::WriteSummaryOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class WriteSummaryOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + WriteSummaryOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + WriteSummaryOpGenericAdaptorBase(WriteSummaryOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class WriteSummaryOpGenericAdaptor : public detail::WriteSummaryOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::WriteSummaryOpGenericAdaptorBase; +public: + WriteSummaryOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + WriteSummaryOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : WriteSummaryOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + WriteSummaryOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getWriter() { + return (*getODSOperands(0).begin()); + } + + ValueT getStep() { + return (*getODSOperands(1).begin()); + } + + ValueT getTensor() { + return (*getODSOperands(2).begin()); + } + + ValueT getTag() { + return (*getODSOperands(3).begin()); + } + + ValueT getSummaryMetadata() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class WriteSummaryOpAdaptor : public WriteSummaryOpGenericAdaptor<::mlir::ValueRange> { +public: + using WriteSummaryOpGenericAdaptor::WriteSummaryOpGenericAdaptor; + WriteSummaryOpAdaptor(WriteSummaryOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class WriteSummaryOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DerivedAttributeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = WriteSummaryOpAdaptor; + template + using GenericAdaptor = WriteSummaryOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.WriteSummary"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getWriter(); + ::mlir::TypedValue<::mlir::TensorType> getStep(); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::TypedValue<::mlir::TensorType> getTag(); + ::mlir::TypedValue<::mlir::TensorType> getSummaryMetadata(); + ::mlir::OpOperand &getWriterMutable(); + ::mlir::OpOperand &getStepMutable(); + ::mlir::OpOperand &getTensorMutable(); + ::mlir::OpOperand &getTagMutable(); + ::mlir::OpOperand &getSummaryMetadataMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value writer, ::mlir::Value step, ::mlir::Value tensor, ::mlir::Value tag, ::mlir::Value summary_metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value writer, ::mlir::Value step, ::mlir::Value tensor, ::mlir::Value tag, ::mlir::Value summary_metadata); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::WriteSummaryOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::WriteTrainingPredictionsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class WriteTrainingPredictionsOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + WriteTrainingPredictionsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + WriteTrainingPredictionsOpGenericAdaptorBase(WriteTrainingPredictionsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getPredictionNamesAttr(); + ::mlir::ArrayAttr getPredictionNames(); + ::mlir::BoolAttr getTrainingAttr(); + bool getTraining(); + ::mlir::StringAttr getFilePathAttr(); + ::llvm::StringRef getFilePath(); +}; +} // namespace detail +template +class WriteTrainingPredictionsOpGenericAdaptor : public detail::WriteTrainingPredictionsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::WriteTrainingPredictionsOpGenericAdaptorBase; +public: + WriteTrainingPredictionsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + WriteTrainingPredictionsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : WriteTrainingPredictionsOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + WriteTrainingPredictionsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getKeys() { + return (*getODSOperands(0).begin()); + } + + RangeT getPredictionsList() { + return getODSOperands(1); + } + + ValueT getStep() { + return (*getODSOperands(2).begin()); + } + + ValueT getTimestampUsec() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class WriteTrainingPredictionsOpAdaptor : public WriteTrainingPredictionsOpGenericAdaptor<::mlir::ValueRange> { +public: + using WriteTrainingPredictionsOpGenericAdaptor::WriteTrainingPredictionsOpGenericAdaptor; + WriteTrainingPredictionsOpAdaptor(WriteTrainingPredictionsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class WriteTrainingPredictionsOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = WriteTrainingPredictionsOpAdaptor; + template + using GenericAdaptor = WriteTrainingPredictionsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("file_path"), ::llvm::StringRef("num_predictions"), ::llvm::StringRef("prediction_names"), ::llvm::StringRef("training")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFilePathAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFilePathAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumPredictionsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumPredictionsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getPredictionNamesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getPredictionNamesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTrainingAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTrainingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.WriteTrainingPredictions"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getKeys(); + ::mlir::Operation::operand_range getPredictionsList(); + ::mlir::TypedValue<::mlir::TensorType> getStep(); + ::mlir::TypedValue<::mlir::TensorType> getTimestampUsec(); + ::mlir::OpOperand &getKeysMutable(); + ::mlir::MutableOperandRange getPredictionsListMutable(); + ::mlir::OpOperand &getStepMutable(); + ::mlir::OpOperand &getTimestampUsecMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::ArrayAttr getPredictionNamesAttr(); + ::mlir::ArrayAttr getPredictionNames(); + ::mlir::BoolAttr getTrainingAttr(); + bool getTraining(); + ::mlir::StringAttr getFilePathAttr(); + ::llvm::StringRef getFilePath(); + size_t getNumPredictions(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setPredictionNamesAttr(::mlir::ArrayAttr attr); + void setTrainingAttr(::mlir::BoolAttr attr); + void setTraining(bool attrValue); + void setFilePathAttr(::mlir::StringAttr attr); + void setFilePath(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value keys, ::mlir::ValueRange predictions_list, ::mlir::Value step, ::mlir::Value timestamp_usec, ::mlir::ArrayAttr prediction_names, ::mlir::BoolAttr training, ::mlir::StringAttr file_path); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value keys, ::mlir::ValueRange predictions_list, ::mlir::Value step, ::mlir::Value timestamp_usec, ::mlir::ArrayAttr prediction_names, ::mlir::BoolAttr training, ::mlir::StringAttr file_path); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value keys, ::mlir::ValueRange predictions_list, ::mlir::Value step, ::mlir::Value timestamp_usec, ::mlir::ArrayAttr prediction_names, bool training, ::llvm::StringRef file_path); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value keys, ::mlir::ValueRange predictions_list, ::mlir::Value step, ::mlir::Value timestamp_usec, ::mlir::ArrayAttr prediction_names, bool training, ::llvm::StringRef file_path); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::WriteTrainingPredictionsOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XdivyOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XdivyOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XdivyOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XdivyOpGenericAdaptorBase(XdivyOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class XdivyOpGenericAdaptor : public detail::XdivyOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XdivyOpGenericAdaptorBase; +public: + XdivyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XdivyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XdivyOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XdivyOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XdivyOpAdaptor : public XdivyOpGenericAdaptor<::mlir::ValueRange> { +public: + using XdivyOpGenericAdaptor::XdivyOpGenericAdaptor; + XdivyOpAdaptor(XdivyOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XdivyOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::OpTrait::TF::SameOperandsAndResultElementTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XdivyOpAdaptor; + template + using GenericAdaptor = XdivyOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Xdivy"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XdivyOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaAllReduceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaAllReduceOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaAllReduceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaAllReduceOpGenericAdaptorBase(XlaAllReduceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getReduceOpAttr(); + ::llvm::StringRef getReduceOp(); + ::mlir::StringAttr getModeAttr(); + ::llvm::StringRef getMode(); +}; +} // namespace detail +template +class XlaAllReduceOpGenericAdaptor : public detail::XlaAllReduceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaAllReduceOpGenericAdaptorBase; +public: + XlaAllReduceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaAllReduceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaAllReduceOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaAllReduceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getGroupAssignment() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaAllReduceOpAdaptor : public XlaAllReduceOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaAllReduceOpGenericAdaptor::XlaAllReduceOpGenericAdaptor; + XlaAllReduceOpAdaptor(XlaAllReduceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaAllReduceOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaAllReduceOpAdaptor; + template + using GenericAdaptor = XlaAllReduceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("mode"), ::llvm::StringRef("reduce_op")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getModeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getModeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getReduceOpAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getReduceOpAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaAllReduce"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getGroupAssignment(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getGroupAssignmentMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::StringAttr getReduceOpAttr(); + ::llvm::StringRef getReduceOp(); + ::mlir::StringAttr getModeAttr(); + ::llvm::StringRef getMode(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setReduceOpAttr(::mlir::StringAttr attr); + void setReduceOp(::llvm::StringRef attrValue); + void setModeAttr(::mlir::StringAttr attr); + void setMode(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value group_assignment, ::mlir::StringAttr reduce_op, ::mlir::StringAttr mode); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value group_assignment, ::mlir::StringAttr reduce_op, ::mlir::StringAttr mode); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value group_assignment, ::llvm::StringRef reduce_op, ::llvm::StringRef mode); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value group_assignment, ::llvm::StringRef reduce_op, ::llvm::StringRef mode); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaAllReduceOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaBroadcastHelperOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaBroadcastHelperOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaBroadcastHelperOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaBroadcastHelperOpGenericAdaptorBase(XlaBroadcastHelperOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class XlaBroadcastHelperOpGenericAdaptor : public detail::XlaBroadcastHelperOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaBroadcastHelperOpGenericAdaptorBase; +public: + XlaBroadcastHelperOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaBroadcastHelperOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaBroadcastHelperOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaBroadcastHelperOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + ValueT getBroadcastDims() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaBroadcastHelperOpAdaptor : public XlaBroadcastHelperOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaBroadcastHelperOpGenericAdaptor::XlaBroadcastHelperOpGenericAdaptor; + XlaBroadcastHelperOpAdaptor(XlaBroadcastHelperOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaBroadcastHelperOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaBroadcastHelperOpAdaptor; + template + using GenericAdaptor = XlaBroadcastHelperOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaBroadcastHelper"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLhs(); + ::mlir::TypedValue<::mlir::TensorType> getRhs(); + ::mlir::TypedValue<::mlir::TensorType> getBroadcastDims(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + ::mlir::OpOperand &getBroadcastDimsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLhsOutput(); + ::mlir::TypedValue<::mlir::TensorType> getRhsOutput(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type lhs_output, ::mlir::Type rhs_output, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value broadcast_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value broadcast_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value broadcast_dims); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // InferTypeOpInterface: + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return ArraysAreCastCompatible(l, r); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaBroadcastHelperOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaCallModuleOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaCallModuleOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaCallModuleOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaCallModuleOpGenericAdaptorBase(XlaCallModuleOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getVersionAttr(); + uint64_t getVersion(); + ::mlir::StringAttr getModuleAttr(); + ::llvm::StringRef getModule(); + ::mlir::ArrayAttr getSoutAttr(); + ::mlir::ArrayAttr getSout(); + ::mlir::ArrayAttr getDimArgsSpecAttr(); + ::mlir::ArrayAttr getDimArgsSpec(); + ::mlir::ArrayAttr getPlatformsAttr(); + ::mlir::ArrayAttr getPlatforms(); + ::mlir::ArrayAttr getFunctionListAttr(); + ::mlir::ArrayAttr getFunctionList(); + ::mlir::BoolAttr getHasTokenInputOutputAttr(); + bool getHasTokenInputOutput(); + ::mlir::ArrayAttr getDisabledChecksAttr(); + ::mlir::ArrayAttr getDisabledChecks(); +}; +} // namespace detail +template +class XlaCallModuleOpGenericAdaptor : public detail::XlaCallModuleOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaCallModuleOpGenericAdaptorBase; +public: + XlaCallModuleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaCallModuleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaCallModuleOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaCallModuleOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaCallModuleOpAdaptor : public XlaCallModuleOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaCallModuleOpGenericAdaptor::XlaCallModuleOpGenericAdaptor; + XlaCallModuleOpAdaptor(XlaCallModuleOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaCallModuleOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaCallModuleOpAdaptor; + template + using GenericAdaptor = XlaCallModuleOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Sout"), ::llvm::StringRef("Tin"), ::llvm::StringRef("Tout"), ::llvm::StringRef("dim_args_spec"), ::llvm::StringRef("disabled_checks"), ::llvm::StringRef("function_list"), ::llvm::StringRef("has_token_input_output"), ::llvm::StringRef("module"), ::llvm::StringRef("platforms"), ::llvm::StringRef("version")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getSoutAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getSoutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTinAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTinAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getToutAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getToutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getDimArgsSpecAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getDimArgsSpecAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getDisabledChecksAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getDisabledChecksAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getFunctionListAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getFunctionListAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getHasTokenInputOutputAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getHasTokenInputOutputAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getModuleAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getModuleAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getPlatformsAttrName() { + return getAttributeNameForIndex(8); + } + + static ::mlir::StringAttr getPlatformsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 8); + } + + ::mlir::StringAttr getVersionAttrName() { + return getAttributeNameForIndex(9); + } + + static ::mlir::StringAttr getVersionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 9); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaCallModule"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutput(); + ::mlir::IntegerAttr getVersionAttr(); + uint64_t getVersion(); + ::mlir::StringAttr getModuleAttr(); + ::llvm::StringRef getModule(); + ::mlir::ArrayAttr getSoutAttr(); + ::mlir::ArrayAttr getSout(); + ::mlir::ArrayAttr getDimArgsSpecAttr(); + ::mlir::ArrayAttr getDimArgsSpec(); + ::mlir::ArrayAttr getPlatformsAttr(); + ::mlir::ArrayAttr getPlatforms(); + ::mlir::ArrayAttr getFunctionListAttr(); + ::mlir::ArrayAttr getFunctionList(); + ::mlir::BoolAttr getHasTokenInputOutputAttr(); + bool getHasTokenInputOutput(); + ::mlir::ArrayAttr getDisabledChecksAttr(); + ::mlir::ArrayAttr getDisabledChecks(); + mlir::OperandElementTypeRange getTin(); + mlir::ResultElementTypeRange getTout(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setVersionAttr(::mlir::IntegerAttr attr); + void setVersion(uint64_t attrValue); + void setModuleAttr(::mlir::StringAttr attr); + void setModule(::llvm::StringRef attrValue); + void setSoutAttr(::mlir::ArrayAttr attr); + void setDimArgsSpecAttr(::mlir::ArrayAttr attr); + void setPlatformsAttr(::mlir::ArrayAttr attr); + void setFunctionListAttr(::mlir::ArrayAttr attr); + void setHasTokenInputOutputAttr(::mlir::BoolAttr attr); + void setHasTokenInputOutput(::std::optional attrValue); + void setDisabledChecksAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeDimArgsSpecAttr(); + ::mlir::Attribute removePlatformsAttr(); + ::mlir::Attribute removeFunctionListAttr(); + ::mlir::Attribute removeHasTokenInputOutputAttr(); + ::mlir::Attribute removeDisabledChecksAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::ValueRange args, ::mlir::IntegerAttr version, ::mlir::StringAttr module, ::mlir::ArrayAttr Sout, /*optional*/::mlir::ArrayAttr dim_args_spec, /*optional*/::mlir::ArrayAttr platforms, /*optional*/::mlir::ArrayAttr function_list, /*optional*/::mlir::BoolAttr has_token_input_output, /*optional*/::mlir::ArrayAttr disabled_checks); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::ValueRange args, uint64_t version, ::llvm::StringRef module, ::mlir::ArrayAttr Sout, /*optional*/::mlir::ArrayAttr dim_args_spec, /*optional*/::mlir::ArrayAttr platforms, /*optional*/::mlir::ArrayAttr function_list, /*optional*/bool has_token_input_output, /*optional*/::mlir::ArrayAttr disabled_checks); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); + ::mlir::LogicalResult verifySymbolUses(::mlir::SymbolTableCollection &symbolTable); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 10 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaCallModuleOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaClusterOutputOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaClusterOutputOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaClusterOutputOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaClusterOutputOpGenericAdaptorBase(XlaClusterOutputOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class XlaClusterOutputOpGenericAdaptor : public detail::XlaClusterOutputOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaClusterOutputOpGenericAdaptorBase; +public: + XlaClusterOutputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaClusterOutputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaClusterOutputOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaClusterOutputOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaClusterOutputOpAdaptor : public XlaClusterOutputOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaClusterOutputOpGenericAdaptor::XlaClusterOutputOpGenericAdaptor; + XlaClusterOutputOpAdaptor(XlaClusterOutputOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaClusterOutputOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaClusterOutputOpAdaptor; + template + using GenericAdaptor = XlaClusterOutputOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaClusterOutput"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutputs(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type outputs, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaClusterOutputOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaConvOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaConvOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaConvOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaConvOpGenericAdaptorBase(XlaConvOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getDimensionNumbersAttr(); + ::llvm::StringRef getDimensionNumbers(); + ::mlir::StringAttr getPrecisionConfigAttr(); + ::llvm::StringRef getPrecisionConfig(); +}; +} // namespace detail +template +class XlaConvOpGenericAdaptor : public detail::XlaConvOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaConvOpGenericAdaptorBase; +public: + XlaConvOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaConvOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaConvOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaConvOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + ValueT getWindowStrides() { + return (*getODSOperands(2).begin()); + } + + ValueT getPadding() { + return (*getODSOperands(3).begin()); + } + + ValueT getLhsDilation() { + return (*getODSOperands(4).begin()); + } + + ValueT getRhsDilation() { + return (*getODSOperands(5).begin()); + } + + ValueT getFeatureGroupCount() { + return (*getODSOperands(6).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaConvOpAdaptor : public XlaConvOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaConvOpGenericAdaptor::XlaConvOpGenericAdaptor; + XlaConvOpAdaptor(XlaConvOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaConvOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<7>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaConvOpAdaptor; + template + using GenericAdaptor = XlaConvOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices"), ::llvm::StringRef("dimension_numbers"), ::llvm::StringRef("precision_config")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDimensionNumbersAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDimensionNumbersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getPrecisionConfigAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getPrecisionConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaConv"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLhs(); + ::mlir::TypedValue<::mlir::TensorType> getRhs(); + ::mlir::TypedValue<::mlir::TensorType> getWindowStrides(); + ::mlir::TypedValue<::mlir::TensorType> getPadding(); + ::mlir::TypedValue<::mlir::TensorType> getLhsDilation(); + ::mlir::TypedValue<::mlir::TensorType> getRhsDilation(); + ::mlir::TypedValue<::mlir::TensorType> getFeatureGroupCount(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + ::mlir::OpOperand &getWindowStridesMutable(); + ::mlir::OpOperand &getPaddingMutable(); + ::mlir::OpOperand &getLhsDilationMutable(); + ::mlir::OpOperand &getRhsDilationMutable(); + ::mlir::OpOperand &getFeatureGroupCountMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::StringAttr getDimensionNumbersAttr(); + ::llvm::StringRef getDimensionNumbers(); + ::mlir::StringAttr getPrecisionConfigAttr(); + ::llvm::StringRef getPrecisionConfig(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setDimensionNumbersAttr(::mlir::StringAttr attr); + void setDimensionNumbers(::llvm::StringRef attrValue); + void setPrecisionConfigAttr(::mlir::StringAttr attr); + void setPrecisionConfig(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value window_strides, ::mlir::Value padding, ::mlir::Value lhs_dilation, ::mlir::Value rhs_dilation, ::mlir::Value feature_group_count, ::mlir::StringAttr dimension_numbers, ::mlir::StringAttr precision_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value window_strides, ::mlir::Value padding, ::mlir::Value lhs_dilation, ::mlir::Value rhs_dilation, ::mlir::Value feature_group_count, ::mlir::StringAttr dimension_numbers, ::mlir::StringAttr precision_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value window_strides, ::mlir::Value padding, ::mlir::Value lhs_dilation, ::mlir::Value rhs_dilation, ::mlir::Value feature_group_count, ::llvm::StringRef dimension_numbers, ::llvm::StringRef precision_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value window_strides, ::mlir::Value padding, ::mlir::Value lhs_dilation, ::mlir::Value rhs_dilation, ::mlir::Value feature_group_count, ::llvm::StringRef dimension_numbers, ::llvm::StringRef precision_config); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaConvOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaConvV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaConvV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaConvV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaConvV2OpGenericAdaptorBase(XlaConvV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getDimensionNumbersAttr(); + ::llvm::StringRef getDimensionNumbers(); + ::mlir::StringAttr getPrecisionConfigAttr(); + ::llvm::StringRef getPrecisionConfig(); + ::mlir::IntegerAttr getBatchGroupCountAttr(); + uint64_t getBatchGroupCount(); +}; +} // namespace detail +template +class XlaConvV2OpGenericAdaptor : public detail::XlaConvV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaConvV2OpGenericAdaptorBase; +public: + XlaConvV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaConvV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaConvV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaConvV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + ValueT getWindowStrides() { + return (*getODSOperands(2).begin()); + } + + ValueT getPadding() { + return (*getODSOperands(3).begin()); + } + + ValueT getLhsDilation() { + return (*getODSOperands(4).begin()); + } + + ValueT getRhsDilation() { + return (*getODSOperands(5).begin()); + } + + ValueT getFeatureGroupCount() { + return (*getODSOperands(6).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaConvV2OpAdaptor : public XlaConvV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaConvV2OpGenericAdaptor::XlaConvV2OpGenericAdaptor; + XlaConvV2OpAdaptor(XlaConvV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaConvV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<7>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaConvV2OpAdaptor; + template + using GenericAdaptor = XlaConvV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("LhsT"), ::llvm::StringRef("RhsT"), ::llvm::StringRef("Tindices"), ::llvm::StringRef("batch_group_count"), ::llvm::StringRef("dimension_numbers"), ::llvm::StringRef("precision_config"), ::llvm::StringRef("preferred_element_type")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getLhsTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getLhsTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getRhsTAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getRhsTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getBatchGroupCountAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getBatchGroupCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getDimensionNumbersAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getDimensionNumbersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getPrecisionConfigAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getPrecisionConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getPreferredElementTypeAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getPreferredElementTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaConvV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLhs(); + ::mlir::TypedValue<::mlir::TensorType> getRhs(); + ::mlir::TypedValue<::mlir::TensorType> getWindowStrides(); + ::mlir::TypedValue<::mlir::TensorType> getPadding(); + ::mlir::TypedValue<::mlir::TensorType> getLhsDilation(); + ::mlir::TypedValue<::mlir::TensorType> getRhsDilation(); + ::mlir::TypedValue<::mlir::TensorType> getFeatureGroupCount(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + ::mlir::OpOperand &getWindowStridesMutable(); + ::mlir::OpOperand &getPaddingMutable(); + ::mlir::OpOperand &getLhsDilationMutable(); + ::mlir::OpOperand &getRhsDilationMutable(); + ::mlir::OpOperand &getFeatureGroupCountMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::StringAttr getDimensionNumbersAttr(); + ::llvm::StringRef getDimensionNumbers(); + ::mlir::StringAttr getPrecisionConfigAttr(); + ::llvm::StringRef getPrecisionConfig(); + ::mlir::IntegerAttr getBatchGroupCountAttr(); + uint64_t getBatchGroupCount(); + ::mlir::Type getLhsT(); + ::mlir::Type getRhsT(); + ::mlir::Type getTindices(); + ::mlir::Type getPreferredElementType(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setDimensionNumbersAttr(::mlir::StringAttr attr); + void setDimensionNumbers(::llvm::StringRef attrValue); + void setPrecisionConfigAttr(::mlir::StringAttr attr); + void setPrecisionConfig(::llvm::StringRef attrValue); + void setBatchGroupCountAttr(::mlir::IntegerAttr attr); + void setBatchGroupCount(::std::optional attrValue); + ::mlir::Attribute removeBatchGroupCountAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value window_strides, ::mlir::Value padding, ::mlir::Value lhs_dilation, ::mlir::Value rhs_dilation, ::mlir::Value feature_group_count, ::mlir::StringAttr dimension_numbers, ::mlir::StringAttr precision_config, /*optional*/::mlir::IntegerAttr batch_group_count); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value window_strides, ::mlir::Value padding, ::mlir::Value lhs_dilation, ::mlir::Value rhs_dilation, ::mlir::Value feature_group_count, ::mlir::StringAttr dimension_numbers, ::mlir::StringAttr precision_config, /*optional*/::mlir::IntegerAttr batch_group_count); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value window_strides, ::mlir::Value padding, ::mlir::Value lhs_dilation, ::mlir::Value rhs_dilation, ::mlir::Value feature_group_count, ::llvm::StringRef dimension_numbers, ::llvm::StringRef precision_config, /*optional*/uint64_t batch_group_count = 1); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value window_strides, ::mlir::Value padding, ::mlir::Value lhs_dilation, ::mlir::Value rhs_dilation, ::mlir::Value feature_group_count, ::llvm::StringRef dimension_numbers, ::llvm::StringRef precision_config, /*optional*/uint64_t batch_group_count = 1); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 7 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaConvV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaCustomCallV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaCustomCallV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaCustomCallV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaCustomCallV2OpGenericAdaptorBase(XlaCustomCallV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getCallTargetNameAttr(); + ::llvm::StringRef getCallTargetName(); + ::mlir::StringAttr getBackendConfigAttr(); + ::llvm::StringRef getBackendConfig(); + ::mlir::BoolAttr getHasSideEffectAttr(); + bool getHasSideEffect(); + ::mlir::ArrayAttr getResultShapesAttr(); + ::mlir::ArrayAttr getResultShapes(); +}; +} // namespace detail +template +class XlaCustomCallV2OpGenericAdaptor : public detail::XlaCustomCallV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaCustomCallV2OpGenericAdaptorBase; +public: + XlaCustomCallV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaCustomCallV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaCustomCallV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaCustomCallV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return getODSOperands(0); + } + +private: + RangeT odsOperands; +}; +class XlaCustomCallV2OpAdaptor : public XlaCustomCallV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaCustomCallV2OpGenericAdaptor::XlaCustomCallV2OpGenericAdaptor; + XlaCustomCallV2OpAdaptor(XlaCustomCallV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaCustomCallV2Op : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaCustomCallV2OpAdaptor; + template + using GenericAdaptor = XlaCustomCallV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("backend_config"), ::llvm::StringRef("call_target_name"), ::llvm::StringRef("has_side_effect"), ::llvm::StringRef("operand_dtypes"), ::llvm::StringRef("result_dtypes"), ::llvm::StringRef("result_shapes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBackendConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBackendConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getCallTargetNameAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getCallTargetNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getHasSideEffectAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getHasSideEffectAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getOperandDtypesAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getOperandDtypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getResultDtypesAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getResultDtypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getResultShapesAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getResultShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaCustomCallV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getOperands(); + ::mlir::MutableOperandRange getOperandsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResults(); + ::mlir::StringAttr getCallTargetNameAttr(); + ::llvm::StringRef getCallTargetName(); + ::mlir::StringAttr getBackendConfigAttr(); + ::llvm::StringRef getBackendConfig(); + ::mlir::BoolAttr getHasSideEffectAttr(); + bool getHasSideEffect(); + ::mlir::ArrayAttr getResultShapesAttr(); + ::mlir::ArrayAttr getResultShapes(); + mlir::OperandElementTypeRange getOperandDtypes(); + mlir::ResultElementTypeRange getResultDtypes(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setCallTargetNameAttr(::mlir::StringAttr attr); + void setCallTargetName(::llvm::StringRef attrValue); + void setBackendConfigAttr(::mlir::StringAttr attr); + void setBackendConfig(::llvm::StringRef attrValue); + void setHasSideEffectAttr(::mlir::BoolAttr attr); + void setHasSideEffect(bool attrValue); + void setResultShapesAttr(::mlir::ArrayAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange results, ::mlir::ValueRange operands, ::mlir::StringAttr call_target_name, ::mlir::StringAttr backend_config, ::mlir::BoolAttr has_side_effect, ::mlir::ArrayAttr result_shapes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange results, ::mlir::ValueRange operands, ::llvm::StringRef call_target_name, ::llvm::StringRef backend_config, bool has_side_effect, ::mlir::ArrayAttr result_shapes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaCustomCallV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaDotOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaDotOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaDotOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaDotOpGenericAdaptorBase(XlaDotOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getDimensionNumbersAttr(); + ::llvm::StringRef getDimensionNumbers(); + ::mlir::StringAttr getPrecisionConfigAttr(); + ::llvm::StringRef getPrecisionConfig(); +}; +} // namespace detail +template +class XlaDotOpGenericAdaptor : public detail::XlaDotOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaDotOpGenericAdaptorBase; +public: + XlaDotOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaDotOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaDotOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaDotOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaDotOpAdaptor : public XlaDotOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaDotOpGenericAdaptor::XlaDotOpGenericAdaptor; + XlaDotOpAdaptor(XlaDotOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaDotOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaDotOpAdaptor; + template + using GenericAdaptor = XlaDotOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("dimension_numbers"), ::llvm::StringRef("precision_config")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDimensionNumbersAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDimensionNumbersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getPrecisionConfigAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getPrecisionConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaDot"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLhs(); + ::mlir::TypedValue<::mlir::TensorType> getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::StringAttr getDimensionNumbersAttr(); + ::llvm::StringRef getDimensionNumbers(); + ::mlir::StringAttr getPrecisionConfigAttr(); + ::llvm::StringRef getPrecisionConfig(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setDimensionNumbersAttr(::mlir::StringAttr attr); + void setDimensionNumbers(::llvm::StringRef attrValue); + void setPrecisionConfigAttr(::mlir::StringAttr attr); + void setPrecisionConfig(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::StringAttr dimension_numbers, ::mlir::StringAttr precision_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::StringAttr dimension_numbers, ::mlir::StringAttr precision_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value lhs, ::mlir::Value rhs, ::llvm::StringRef dimension_numbers, ::llvm::StringRef precision_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::llvm::StringRef dimension_numbers, ::llvm::StringRef precision_config); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaDotOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaDotV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaDotV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaDotV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaDotV2OpGenericAdaptorBase(XlaDotV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getDimensionNumbersAttr(); + ::llvm::StringRef getDimensionNumbers(); + ::mlir::StringAttr getPrecisionConfigAttr(); + ::llvm::StringRef getPrecisionConfig(); +}; +} // namespace detail +template +class XlaDotV2OpGenericAdaptor : public detail::XlaDotV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaDotV2OpGenericAdaptorBase; +public: + XlaDotV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaDotV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaDotV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaDotV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaDotV2OpAdaptor : public XlaDotV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaDotV2OpGenericAdaptor::XlaDotV2OpGenericAdaptor; + XlaDotV2OpAdaptor(XlaDotV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaDotV2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaDotV2OpAdaptor; + template + using GenericAdaptor = XlaDotV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("LhsT"), ::llvm::StringRef("RhsT"), ::llvm::StringRef("dimension_numbers"), ::llvm::StringRef("precision_config"), ::llvm::StringRef("preferred_element_type")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getLhsTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getLhsTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getRhsTAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getRhsTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDimensionNumbersAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDimensionNumbersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getPrecisionConfigAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getPrecisionConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getPreferredElementTypeAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getPreferredElementTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaDotV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLhs(); + ::mlir::TypedValue<::mlir::TensorType> getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::StringAttr getDimensionNumbersAttr(); + ::llvm::StringRef getDimensionNumbers(); + ::mlir::StringAttr getPrecisionConfigAttr(); + ::llvm::StringRef getPrecisionConfig(); + ::mlir::Type getLhsT(); + ::mlir::Type getRhsT(); + ::mlir::Type getPreferredElementType(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setDimensionNumbersAttr(::mlir::StringAttr attr); + void setDimensionNumbers(::llvm::StringRef attrValue); + void setPrecisionConfigAttr(::mlir::StringAttr attr); + void setPrecisionConfig(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::StringAttr dimension_numbers, ::mlir::StringAttr precision_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::StringAttr dimension_numbers, ::mlir::StringAttr precision_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value lhs, ::mlir::Value rhs, ::llvm::StringRef dimension_numbers, ::llvm::StringRef precision_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::llvm::StringRef dimension_numbers, ::llvm::StringRef precision_config); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaDotV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaDynamicSliceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaDynamicSliceOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaDynamicSliceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaDynamicSliceOpGenericAdaptorBase(XlaDynamicSliceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class XlaDynamicSliceOpGenericAdaptor : public detail::XlaDynamicSliceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaDynamicSliceOpGenericAdaptorBase; +public: + XlaDynamicSliceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaDynamicSliceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaDynamicSliceOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaDynamicSliceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getStartIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getSizeIndices() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaDynamicSliceOpAdaptor : public XlaDynamicSliceOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaDynamicSliceOpGenericAdaptor::XlaDynamicSliceOpGenericAdaptor; + XlaDynamicSliceOpAdaptor(XlaDynamicSliceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaDynamicSliceOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaDynamicSliceOpAdaptor; + template + using GenericAdaptor = XlaDynamicSliceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaDynamicSlice"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getStartIndices(); + ::mlir::TypedValue<::mlir::TensorType> getSizeIndices(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getStartIndicesMutable(); + ::mlir::OpOperand &getSizeIndicesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value start_indices, ::mlir::Value size_indices); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value start_indices, ::mlir::Value size_indices); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaDynamicSliceOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaDynamicUpdateSliceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaDynamicUpdateSliceOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaDynamicUpdateSliceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaDynamicUpdateSliceOpGenericAdaptorBase(XlaDynamicUpdateSliceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class XlaDynamicUpdateSliceOpGenericAdaptor : public detail::XlaDynamicUpdateSliceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaDynamicUpdateSliceOpGenericAdaptorBase; +public: + XlaDynamicUpdateSliceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaDynamicUpdateSliceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaDynamicUpdateSliceOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaDynamicUpdateSliceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getUpdate() { + return (*getODSOperands(1).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaDynamicUpdateSliceOpAdaptor : public XlaDynamicUpdateSliceOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaDynamicUpdateSliceOpGenericAdaptor::XlaDynamicUpdateSliceOpGenericAdaptor; + XlaDynamicUpdateSliceOpAdaptor(XlaDynamicUpdateSliceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaDynamicUpdateSliceOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaDynamicUpdateSliceOpAdaptor; + template + using GenericAdaptor = XlaDynamicUpdateSliceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaDynamicUpdateSlice"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getUpdate(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getUpdateMutable(); + ::mlir::OpOperand &getIndicesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value update, ::mlir::Value indices); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value update, ::mlir::Value indices); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaDynamicUpdateSliceOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaEinsumOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaEinsumOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaEinsumOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaEinsumOpGenericAdaptorBase(XlaEinsumOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getEquationAttr(); + ::llvm::StringRef getEquation(); +}; +} // namespace detail +template +class XlaEinsumOpGenericAdaptor : public detail::XlaEinsumOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaEinsumOpGenericAdaptorBase; +public: + XlaEinsumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaEinsumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaEinsumOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaEinsumOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + ValueT getB() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaEinsumOpAdaptor : public XlaEinsumOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaEinsumOpGenericAdaptor::XlaEinsumOpGenericAdaptor; + XlaEinsumOpAdaptor(XlaEinsumOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaEinsumOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaEinsumOpAdaptor; + template + using GenericAdaptor = XlaEinsumOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("equation")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getEquationAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getEquationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaEinsum"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getA(); + ::mlir::TypedValue<::mlir::TensorType> getB(); + ::mlir::OpOperand &getAMutable(); + ::mlir::OpOperand &getBMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getProduct(); + ::mlir::StringAttr getEquationAttr(); + ::llvm::StringRef getEquation(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setEquationAttr(::mlir::StringAttr attr); + void setEquation(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type product, ::mlir::Value a, ::mlir::Value b, ::mlir::StringAttr equation); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::StringAttr equation); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type product, ::mlir::Value a, ::mlir::Value b, ::llvm::StringRef equation); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::llvm::StringRef equation); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaEinsumOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaGatherOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaGatherOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaGatherOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaGatherOpGenericAdaptorBase(XlaGatherOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getDimensionNumbersAttr(); + ::llvm::StringRef getDimensionNumbers(); + ::mlir::BoolAttr getIndicesAreSortedAttr(); + bool getIndicesAreSorted(); +}; +} // namespace detail +template +class XlaGatherOpGenericAdaptor : public detail::XlaGatherOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaGatherOpGenericAdaptorBase; +public: + XlaGatherOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaGatherOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaGatherOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaGatherOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + ValueT getStartIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getSliceSizes() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaGatherOpAdaptor : public XlaGatherOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaGatherOpGenericAdaptor::XlaGatherOpGenericAdaptor; + XlaGatherOpAdaptor(XlaGatherOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaGatherOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaGatherOpAdaptor; + template + using GenericAdaptor = XlaGatherOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices"), ::llvm::StringRef("dimension_numbers"), ::llvm::StringRef("indices_are_sorted")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDimensionNumbersAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDimensionNumbersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getIndicesAreSortedAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getIndicesAreSortedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaGather"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::TypedValue<::mlir::TensorType> getStartIndices(); + ::mlir::TypedValue<::mlir::TensorType> getSliceSizes(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::OpOperand &getStartIndicesMutable(); + ::mlir::OpOperand &getSliceSizesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::StringAttr getDimensionNumbersAttr(); + ::llvm::StringRef getDimensionNumbers(); + ::mlir::BoolAttr getIndicesAreSortedAttr(); + bool getIndicesAreSorted(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setDimensionNumbersAttr(::mlir::StringAttr attr); + void setDimensionNumbers(::llvm::StringRef attrValue); + void setIndicesAreSortedAttr(::mlir::BoolAttr attr); + void setIndicesAreSorted(bool attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value operand, ::mlir::Value start_indices, ::mlir::Value slice_sizes, ::mlir::StringAttr dimension_numbers, ::mlir::BoolAttr indices_are_sorted); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value start_indices, ::mlir::Value slice_sizes, ::mlir::StringAttr dimension_numbers, ::mlir::BoolAttr indices_are_sorted); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value operand, ::mlir::Value start_indices, ::mlir::Value slice_sizes, ::llvm::StringRef dimension_numbers, bool indices_are_sorted); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value start_indices, ::mlir::Value slice_sizes, ::llvm::StringRef dimension_numbers, bool indices_are_sorted); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaGatherOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaHostComputeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaHostComputeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaHostComputeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaHostComputeOpGenericAdaptorBase(XlaHostComputeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getAncestorsAttr(); + ::mlir::ArrayAttr getAncestors(); + ::mlir::ArrayAttr getShapesAttr(); + ::mlir::ArrayAttr getShapes(); + ::mlir::SymbolRefAttr getShapeInferenceGraphAttr(); + ::std::optional< ::mlir::SymbolRefAttr > getShapeInferenceGraph(); + ::mlir::StringAttr getKeyAttr(); + ::llvm::StringRef getKey(); + ::mlir::StringAttr getSendKeyAttr(); + ::llvm::StringRef getSendKey(); + ::mlir::StringAttr getRecvKeyAttr(); + ::llvm::StringRef getRecvKey(); + ::mlir::IntegerAttr getCostEstimateNsAttr(); + uint64_t getCostEstimateNs(); + ::mlir::IntegerAttr getTpuCoreAttr(); + uint64_t getTpuCore(); +}; +} // namespace detail +template +class XlaHostComputeOpGenericAdaptor : public detail::XlaHostComputeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaHostComputeOpGenericAdaptorBase; +public: + XlaHostComputeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaHostComputeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaHostComputeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaHostComputeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaHostComputeOpAdaptor : public XlaHostComputeOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaHostComputeOpGenericAdaptor::XlaHostComputeOpGenericAdaptor; + XlaHostComputeOpAdaptor(XlaHostComputeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaHostComputeOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaHostComputeOpAdaptor; + template + using GenericAdaptor = XlaHostComputeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tinputs"), ::llvm::StringRef("Toutputs"), ::llvm::StringRef("ancestors"), ::llvm::StringRef("cost_estimate_ns"), ::llvm::StringRef("key"), ::llvm::StringRef("recv_key"), ::llvm::StringRef("send_key"), ::llvm::StringRef("shape_inference_graph"), ::llvm::StringRef("shapes"), ::llvm::StringRef("tpu_core")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTinputsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTinputsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getToutputsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getToutputsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getAncestorsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getAncestorsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getCostEstimateNsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getCostEstimateNsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getKeyAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getKeyAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getRecvKeyAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getRecvKeyAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getSendKeyAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getSendKeyAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getShapeInferenceGraphAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getShapeInferenceGraphAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getShapesAttrName() { + return getAttributeNameForIndex(8); + } + + static ::mlir::StringAttr getShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 8); + } + + ::mlir::StringAttr getTpuCoreAttrName() { + return getAttributeNameForIndex(9); + } + + static ::mlir::StringAttr getTpuCoreAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 9); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaHostCompute"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::MutableOperandRange getInputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutputs(); + ::mlir::ArrayAttr getAncestorsAttr(); + ::mlir::ArrayAttr getAncestors(); + ::mlir::ArrayAttr getShapesAttr(); + ::mlir::ArrayAttr getShapes(); + ::mlir::SymbolRefAttr getShapeInferenceGraphAttr(); + ::std::optional< ::mlir::SymbolRefAttr > getShapeInferenceGraph(); + ::mlir::StringAttr getKeyAttr(); + ::llvm::StringRef getKey(); + ::mlir::StringAttr getSendKeyAttr(); + ::llvm::StringRef getSendKey(); + ::mlir::StringAttr getRecvKeyAttr(); + ::llvm::StringRef getRecvKey(); + ::mlir::IntegerAttr getCostEstimateNsAttr(); + uint64_t getCostEstimateNs(); + ::mlir::IntegerAttr getTpuCoreAttr(); + uint64_t getTpuCore(); + mlir::OperandElementTypeRange getTinputs(); + mlir::ResultElementTypeRange getToutputs(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setAncestorsAttr(::mlir::ArrayAttr attr); + void setShapesAttr(::mlir::ArrayAttr attr); + void setShapeInferenceGraphAttr(::mlir::SymbolRefAttr attr); + void setKeyAttr(::mlir::StringAttr attr); + void setKey(::llvm::StringRef attrValue); + void setSendKeyAttr(::mlir::StringAttr attr); + void setSendKey(::llvm::StringRef attrValue); + void setRecvKeyAttr(::mlir::StringAttr attr); + void setRecvKey(::llvm::StringRef attrValue); + void setCostEstimateNsAttr(::mlir::IntegerAttr attr); + void setCostEstimateNs(::std::optional attrValue); + void setTpuCoreAttr(::mlir::IntegerAttr attr); + void setTpuCore(::std::optional attrValue); + ::mlir::Attribute removeShapeInferenceGraphAttr(); + ::mlir::Attribute removeCostEstimateNsAttr(); + ::mlir::Attribute removeTpuCoreAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outputs, ::mlir::ValueRange inputs, ::mlir::ArrayAttr ancestors, ::mlir::ArrayAttr shapes, /*optional*/::mlir::SymbolRefAttr shape_inference_graph, ::mlir::StringAttr key, ::mlir::StringAttr send_key, ::mlir::StringAttr recv_key, /*optional*/::mlir::IntegerAttr cost_estimate_ns, /*optional*/::mlir::IntegerAttr tpu_core); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outputs, ::mlir::ValueRange inputs, ::mlir::ArrayAttr ancestors, ::mlir::ArrayAttr shapes, /*optional*/::mlir::SymbolRefAttr shape_inference_graph, ::llvm::StringRef key, ::llvm::StringRef send_key = "", ::llvm::StringRef recv_key = "", /*optional*/uint64_t cost_estimate_ns = 1000000, /*optional*/uint64_t tpu_core = 0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultAttrs(const ::mlir::OperationName &opName, ::mlir::NamedAttrList &attributes); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 10 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaHostComputeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaKeyValueSortOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaKeyValueSortOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaKeyValueSortOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaKeyValueSortOpGenericAdaptorBase(XlaKeyValueSortOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class XlaKeyValueSortOpGenericAdaptor : public detail::XlaKeyValueSortOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaKeyValueSortOpGenericAdaptorBase; +public: + XlaKeyValueSortOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaKeyValueSortOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaKeyValueSortOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaKeyValueSortOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getKeys() { + return (*getODSOperands(0).begin()); + } + + ValueT getValues() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaKeyValueSortOpAdaptor : public XlaKeyValueSortOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaKeyValueSortOpGenericAdaptor::XlaKeyValueSortOpGenericAdaptor; + XlaKeyValueSortOpAdaptor(XlaKeyValueSortOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaKeyValueSortOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaKeyValueSortOpAdaptor; + template + using GenericAdaptor = XlaKeyValueSortOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("K"), ::llvm::StringRef("V")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getKAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getKAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getVAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getVAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaKeyValueSort"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getKeys(); + ::mlir::TypedValue<::mlir::TensorType> getValues(); + ::mlir::OpOperand &getKeysMutable(); + ::mlir::OpOperand &getValuesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getSortedKeys(); + ::mlir::TypedValue<::mlir::TensorType> getSortedValues(); + ::mlir::Type getK(); + ::mlir::Type getV(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type sorted_keys, ::mlir::Type sorted_values, ::mlir::Value keys, ::mlir::Value values); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value keys, ::mlir::Value values); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaKeyValueSortOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaLaunchOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaLaunchOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaLaunchOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaLaunchOpGenericAdaptorBase(XlaLaunchOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::SymbolRefAttr getFunctionAttr(); + ::mlir::SymbolRefAttr getFunction(); +}; +} // namespace detail +template +class XlaLaunchOpGenericAdaptor : public detail::XlaLaunchOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaLaunchOpGenericAdaptorBase; +public: + XlaLaunchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaLaunchOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaLaunchOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaLaunchOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getConstants() { + return getODSOperands(0); + } + + RangeT getArgs() { + return getODSOperands(1); + } + + RangeT getResources() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaLaunchOpAdaptor : public XlaLaunchOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaLaunchOpGenericAdaptor::XlaLaunchOpGenericAdaptor; + XlaLaunchOpAdaptor(XlaLaunchOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaLaunchOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaLaunchOpAdaptor; + template + using GenericAdaptor = XlaLaunchOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Nresources"), ::llvm::StringRef("Targs"), ::llvm::StringRef("Tconstants"), ::llvm::StringRef("Tresults"), ::llvm::StringRef("function"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNresourcesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNresourcesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTargsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTargsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTconstantsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTconstantsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTresultsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTresultsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getFunctionAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getFunctionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaLaunch"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getConstants(); + ::mlir::Operation::operand_range getArgs(); + ::mlir::Operation::operand_range getResources(); + ::mlir::MutableOperandRange getConstantsMutable(); + ::mlir::MutableOperandRange getArgsMutable(); + ::mlir::MutableOperandRange getResourcesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResults(); + ::mlir::SymbolRefAttr getFunctionAttr(); + ::mlir::SymbolRefAttr getFunction(); + size_t getNresources(); + mlir::OperandElementTypeRange getTargs(); + mlir::OperandElementTypeRange getTconstants(); + mlir::ResultElementTypeRange getTresults(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setFunctionAttr(::mlir::SymbolRefAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange results, ::mlir::ValueRange constants, ::mlir::ValueRange args, ::mlir::ValueRange resources, ::mlir::SymbolRefAttr function); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); + std::optional GetResourceInstanceStr(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaLaunchOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaLaunchV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaLaunchV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaLaunchV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaLaunchV2OpGenericAdaptorBase(XlaLaunchV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getConstantsAttr(); + ::mlir::ArrayAttr getConstants(); + ::mlir::ArrayAttr getResourcesAttr(); + ::mlir::ArrayAttr getResources(); + ::mlir::SymbolRefAttr getFunctionAttr(); + ::mlir::SymbolRefAttr getFunction(); +}; +} // namespace detail +template +class XlaLaunchV2OpGenericAdaptor : public detail::XlaLaunchV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaLaunchV2OpGenericAdaptorBase; +public: + XlaLaunchV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaLaunchV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaLaunchV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaLaunchV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaLaunchV2OpAdaptor : public XlaLaunchV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaLaunchV2OpGenericAdaptor::XlaLaunchV2OpGenericAdaptor; + XlaLaunchV2OpAdaptor(XlaLaunchV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaLaunchV2Op : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaLaunchV2OpAdaptor; + template + using GenericAdaptor = XlaLaunchV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Targs"), ::llvm::StringRef("Tresults"), ::llvm::StringRef("constants"), ::llvm::StringRef("function"), ::llvm::StringRef("resources")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTargsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTargsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTresultsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTresultsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getConstantsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getConstantsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getFunctionAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getFunctionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getResourcesAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getResourcesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaLaunchV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResults(); + ::mlir::ArrayAttr getConstantsAttr(); + ::mlir::ArrayAttr getConstants(); + ::mlir::ArrayAttr getResourcesAttr(); + ::mlir::ArrayAttr getResources(); + ::mlir::SymbolRefAttr getFunctionAttr(); + ::mlir::SymbolRefAttr getFunction(); + mlir::OperandElementTypeRange getTargs(); + mlir::ResultElementTypeRange getTresults(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setConstantsAttr(::mlir::ArrayAttr attr); + void setResourcesAttr(::mlir::ArrayAttr attr); + void setFunctionAttr(::mlir::SymbolRefAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange results, ::mlir::ValueRange args, ::mlir::ArrayAttr constants, ::mlir::ArrayAttr resources, ::mlir::SymbolRefAttr function); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaLaunchV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaOptimizationBarrierOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaOptimizationBarrierOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaOptimizationBarrierOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaOptimizationBarrierOpGenericAdaptorBase(XlaOptimizationBarrierOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class XlaOptimizationBarrierOpGenericAdaptor : public detail::XlaOptimizationBarrierOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaOptimizationBarrierOpGenericAdaptorBase; +public: + XlaOptimizationBarrierOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaOptimizationBarrierOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaOptimizationBarrierOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaOptimizationBarrierOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInput() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaOptimizationBarrierOpAdaptor : public XlaOptimizationBarrierOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaOptimizationBarrierOpGenericAdaptor::XlaOptimizationBarrierOpGenericAdaptor; + XlaOptimizationBarrierOpAdaptor(XlaOptimizationBarrierOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaOptimizationBarrierOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaOptimizationBarrierOpAdaptor; + template + using GenericAdaptor = XlaOptimizationBarrierOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaOptimizationBarrier"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInput(); + ::mlir::MutableOperandRange getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutput(); + mlir::OperandElementTypeRange getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaOptimizationBarrierOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaPadOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaPadOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaPadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaPadOpGenericAdaptorBase(XlaPadOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class XlaPadOpGenericAdaptor : public detail::XlaPadOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaPadOpGenericAdaptorBase; +public: + XlaPadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaPadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaPadOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaPadOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getPaddingValue() { + return (*getODSOperands(1).begin()); + } + + ValueT getPaddingLow() { + return (*getODSOperands(2).begin()); + } + + ValueT getPaddingHigh() { + return (*getODSOperands(3).begin()); + } + + ValueT getPaddingInterior() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaPadOpAdaptor : public XlaPadOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaPadOpGenericAdaptor::XlaPadOpGenericAdaptor; + XlaPadOpAdaptor(XlaPadOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaPadOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<5>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaPadOpAdaptor; + template + using GenericAdaptor = XlaPadOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaPad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getPaddingValue(); + ::mlir::TypedValue<::mlir::TensorType> getPaddingLow(); + ::mlir::TypedValue<::mlir::TensorType> getPaddingHigh(); + ::mlir::TypedValue<::mlir::TensorType> getPaddingInterior(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getPaddingValueMutable(); + ::mlir::OpOperand &getPaddingLowMutable(); + ::mlir::OpOperand &getPaddingHighMutable(); + ::mlir::OpOperand &getPaddingInteriorMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value padding_value, ::mlir::Value padding_low, ::mlir::Value padding_high, ::mlir::Value padding_interior); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value padding_value, ::mlir::Value padding_low, ::mlir::Value padding_high, ::mlir::Value padding_interior); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaPadOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaRecvFromHostOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaRecvFromHostOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaRecvFromHostOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaRecvFromHostOpGenericAdaptorBase(XlaRecvFromHostOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Attribute getShapeAttr(); + std::optional> getShape(); + ::mlir::StringAttr getKeyAttr(); + ::llvm::StringRef getKey(); +}; +} // namespace detail +template +class XlaRecvFromHostOpGenericAdaptor : public detail::XlaRecvFromHostOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaRecvFromHostOpGenericAdaptorBase; +public: + XlaRecvFromHostOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaRecvFromHostOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaRecvFromHostOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaRecvFromHostOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaRecvFromHostOpAdaptor : public XlaRecvFromHostOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaRecvFromHostOpGenericAdaptor::XlaRecvFromHostOpGenericAdaptor; + XlaRecvFromHostOpAdaptor(XlaRecvFromHostOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaRecvFromHostOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaRecvFromHostOpAdaptor; + template + using GenericAdaptor = XlaRecvFromHostOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Toutput"), ::llvm::StringRef("key"), ::llvm::StringRef("shape")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getToutputAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getToutputAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getKeyAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getKeyAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShapeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaRecvFromHost"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Attribute getShapeAttr(); + std::optional> getShape(); + ::mlir::StringAttr getKeyAttr(); + ::llvm::StringRef getKey(); + ::mlir::Type getToutput(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setShapeAttr(::mlir::Attribute attr); + void setShape(std::optional> attrValue); + void setKeyAttr(::mlir::StringAttr attr); + void setKey(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Attribute shape, ::mlir::StringAttr key); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Attribute shape, ::mlir::StringAttr key); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, std::optional> shape, ::llvm::StringRef key); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, std::optional> shape, ::llvm::StringRef key); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaRecvFromHostOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaRecvOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaRecvOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaRecvOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaRecvOpGenericAdaptorBase(XlaRecvOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getTensorNameAttr(); + ::llvm::StringRef getTensorName(); + ::mlir::Attribute getShapeAttr(); + std::optional> getShape(); +}; +} // namespace detail +template +class XlaRecvOpGenericAdaptor : public detail::XlaRecvOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaRecvOpGenericAdaptorBase; +public: + XlaRecvOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaRecvOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaRecvOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaRecvOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaRecvOpAdaptor : public XlaRecvOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaRecvOpGenericAdaptor::XlaRecvOpGenericAdaptor; + XlaRecvOpAdaptor(XlaRecvOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaRecvOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaRecvOpAdaptor; + template + using GenericAdaptor = XlaRecvOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dtype"), ::llvm::StringRef("shape"), ::llvm::StringRef("tensor_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getShapeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getShapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTensorNameAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTensorNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaRecv"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::StringAttr getTensorNameAttr(); + ::llvm::StringRef getTensorName(); + ::mlir::Attribute getShapeAttr(); + std::optional> getShape(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setTensorNameAttr(::mlir::StringAttr attr); + void setTensorName(::llvm::StringRef attrValue); + void setShapeAttr(::mlir::Attribute attr); + void setShape(std::optional> attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type tensor, ::mlir::StringAttr tensor_name, ::mlir::Attribute shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr tensor_name, ::mlir::Attribute shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type tensor, ::llvm::StringRef tensor_name, std::optional> shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef tensor_name, std::optional> shape); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaRecvOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaRecvTPUEmbeddingActivationsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaRecvTPUEmbeddingActivationsOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaRecvTPUEmbeddingActivationsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaRecvTPUEmbeddingActivationsOpGenericAdaptorBase(XlaRecvTPUEmbeddingActivationsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class XlaRecvTPUEmbeddingActivationsOpGenericAdaptor : public detail::XlaRecvTPUEmbeddingActivationsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaRecvTPUEmbeddingActivationsOpGenericAdaptorBase; +public: + XlaRecvTPUEmbeddingActivationsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaRecvTPUEmbeddingActivationsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaRecvTPUEmbeddingActivationsOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaRecvTPUEmbeddingActivationsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getDeduplicationData() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaRecvTPUEmbeddingActivationsOpAdaptor : public XlaRecvTPUEmbeddingActivationsOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaRecvTPUEmbeddingActivationsOpGenericAdaptor::XlaRecvTPUEmbeddingActivationsOpGenericAdaptor; + XlaRecvTPUEmbeddingActivationsOpAdaptor(XlaRecvTPUEmbeddingActivationsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaRecvTPUEmbeddingActivationsOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaRecvTPUEmbeddingActivationsOpAdaptor; + template + using GenericAdaptor = XlaRecvTPUEmbeddingActivationsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("num_tables")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumTablesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumTablesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaRecvTPUEmbeddingActivations"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getDeduplicationData(); + ::mlir::OpOperand &getDeduplicationDataMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutputs(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + size_t getNumTables(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outputs, ::mlir::Value deduplication_data, ::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outputs, ::mlir::Value deduplication_data, ::llvm::StringRef config); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaRecvTPUEmbeddingActivationsOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaRecvTPUEmbeddingDeduplicationDataOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaRecvTPUEmbeddingDeduplicationDataOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaRecvTPUEmbeddingDeduplicationDataOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaRecvTPUEmbeddingDeduplicationDataOpGenericAdaptorBase(XlaRecvTPUEmbeddingDeduplicationDataOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class XlaRecvTPUEmbeddingDeduplicationDataOpGenericAdaptor : public detail::XlaRecvTPUEmbeddingDeduplicationDataOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaRecvTPUEmbeddingDeduplicationDataOpGenericAdaptorBase; +public: + XlaRecvTPUEmbeddingDeduplicationDataOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaRecvTPUEmbeddingDeduplicationDataOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaRecvTPUEmbeddingDeduplicationDataOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaRecvTPUEmbeddingDeduplicationDataOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaRecvTPUEmbeddingDeduplicationDataOpAdaptor : public XlaRecvTPUEmbeddingDeduplicationDataOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaRecvTPUEmbeddingDeduplicationDataOpGenericAdaptor::XlaRecvTPUEmbeddingDeduplicationDataOpGenericAdaptor; + XlaRecvTPUEmbeddingDeduplicationDataOpAdaptor(XlaRecvTPUEmbeddingDeduplicationDataOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaRecvTPUEmbeddingDeduplicationDataOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaRecvTPUEmbeddingDeduplicationDataOpAdaptor; + template + using GenericAdaptor = XlaRecvTPUEmbeddingDeduplicationDataOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaRecvTPUEmbeddingDeduplicationData"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::llvm::StringRef config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef config); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaRecvTPUEmbeddingDeduplicationDataOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaReduceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaReduceOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaReduceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaReduceOpGenericAdaptorBase(XlaReduceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getDimensionsToReduceAttr(); + ::mlir::ArrayAttr getDimensionsToReduce(); + ::mlir::SymbolRefAttr getReducerAttr(); + ::mlir::SymbolRefAttr getReducer(); +}; +} // namespace detail +template +class XlaReduceOpGenericAdaptor : public detail::XlaReduceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaReduceOpGenericAdaptorBase; +public: + XlaReduceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaReduceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaReduceOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaReduceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getInitValue() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaReduceOpAdaptor : public XlaReduceOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaReduceOpGenericAdaptor::XlaReduceOpGenericAdaptor; + XlaReduceOpAdaptor(XlaReduceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaReduceOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaReduceOpAdaptor; + template + using GenericAdaptor = XlaReduceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("dimensions_to_reduce"), ::llvm::StringRef("reducer")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDimensionsToReduceAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDimensionsToReduceAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getReducerAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getReducerAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaReduce"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getInitValue(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getInitValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::ArrayAttr getDimensionsToReduceAttr(); + ::mlir::ArrayAttr getDimensionsToReduce(); + ::mlir::SymbolRefAttr getReducerAttr(); + ::mlir::SymbolRefAttr getReducer(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setDimensionsToReduceAttr(::mlir::ArrayAttr attr); + void setReducerAttr(::mlir::SymbolRefAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value init_value, ::mlir::ArrayAttr dimensions_to_reduce, ::mlir::SymbolRefAttr reducer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value init_value, ::mlir::ArrayAttr dimensions_to_reduce, ::mlir::SymbolRefAttr reducer); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaReduceOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaReducePrecisionOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaReducePrecisionOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaReducePrecisionOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaReducePrecisionOpGenericAdaptorBase(XlaReducePrecisionOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getExponentBitsAttr(); + uint64_t getExponentBits(); + ::mlir::IntegerAttr getMantissaBitsAttr(); + uint64_t getMantissaBits(); +}; +} // namespace detail +template +class XlaReducePrecisionOpGenericAdaptor : public detail::XlaReducePrecisionOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaReducePrecisionOpGenericAdaptorBase; +public: + XlaReducePrecisionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaReducePrecisionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaReducePrecisionOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaReducePrecisionOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaReducePrecisionOpAdaptor : public XlaReducePrecisionOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaReducePrecisionOpGenericAdaptor::XlaReducePrecisionOpGenericAdaptor; + XlaReducePrecisionOpAdaptor(XlaReducePrecisionOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaReducePrecisionOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaReducePrecisionOpAdaptor; + template + using GenericAdaptor = XlaReducePrecisionOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("exponent_bits"), ::llvm::StringRef("mantissa_bits")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getExponentBitsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getExponentBitsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getMantissaBitsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getMantissaBitsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaReducePrecision"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getExponentBitsAttr(); + uint64_t getExponentBits(); + ::mlir::IntegerAttr getMantissaBitsAttr(); + uint64_t getMantissaBits(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setExponentBitsAttr(::mlir::IntegerAttr attr); + void setExponentBits(uint64_t attrValue); + void setMantissaBitsAttr(::mlir::IntegerAttr attr); + void setMantissaBits(uint64_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value operand, ::mlir::IntegerAttr exponent_bits, ::mlir::IntegerAttr mantissa_bits); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::IntegerAttr exponent_bits, ::mlir::IntegerAttr mantissa_bits); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value operand, uint64_t exponent_bits, uint64_t mantissa_bits); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, uint64_t exponent_bits, uint64_t mantissa_bits); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaReducePrecisionOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaReduceScatterOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaReduceScatterOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaReduceScatterOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaReduceScatterOpGenericAdaptorBase(XlaReduceScatterOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getReduceOpAttr(); + ::llvm::StringRef getReduceOp(); +}; +} // namespace detail +template +class XlaReduceScatterOpGenericAdaptor : public detail::XlaReduceScatterOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaReduceScatterOpGenericAdaptorBase; +public: + XlaReduceScatterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaReduceScatterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaReduceScatterOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaReduceScatterOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getGroupAssignment() { + return (*getODSOperands(1).begin()); + } + + ValueT getScatterDimension() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaReduceScatterOpAdaptor : public XlaReduceScatterOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaReduceScatterOpGenericAdaptor::XlaReduceScatterOpGenericAdaptor; + XlaReduceScatterOpAdaptor(XlaReduceScatterOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaReduceScatterOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaReduceScatterOpAdaptor; + template + using GenericAdaptor = XlaReduceScatterOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("reduce_op")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getReduceOpAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getReduceOpAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaReduceScatter"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getGroupAssignment(); + ::mlir::TypedValue<::mlir::TensorType> getScatterDimension(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getGroupAssignmentMutable(); + ::mlir::OpOperand &getScatterDimensionMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::StringAttr getReduceOpAttr(); + ::llvm::StringRef getReduceOp(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setReduceOpAttr(::mlir::StringAttr attr); + void setReduceOp(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value group_assignment, ::mlir::Value scatter_dimension, ::mlir::StringAttr reduce_op); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value group_assignment, ::mlir::Value scatter_dimension, ::mlir::StringAttr reduce_op); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value group_assignment, ::mlir::Value scatter_dimension, ::llvm::StringRef reduce_op); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value group_assignment, ::mlir::Value scatter_dimension, ::llvm::StringRef reduce_op); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaReduceScatterOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaReduceWindowOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaReduceWindowOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaReduceWindowOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaReduceWindowOpGenericAdaptorBase(XlaReduceWindowOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::SymbolRefAttr getComputationAttr(); + ::mlir::SymbolRefAttr getComputation(); +}; +} // namespace detail +template +class XlaReduceWindowOpGenericAdaptor : public detail::XlaReduceWindowOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaReduceWindowOpGenericAdaptorBase; +public: + XlaReduceWindowOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaReduceWindowOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaReduceWindowOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaReduceWindowOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getInitValue() { + return (*getODSOperands(1).begin()); + } + + ValueT getWindowDimensions() { + return (*getODSOperands(2).begin()); + } + + ValueT getWindowStrides() { + return (*getODSOperands(3).begin()); + } + + ValueT getBaseDilations() { + return (*getODSOperands(4).begin()); + } + + ValueT getWindowDilations() { + return (*getODSOperands(5).begin()); + } + + ValueT getPadding() { + return (*getODSOperands(6).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaReduceWindowOpAdaptor : public XlaReduceWindowOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaReduceWindowOpGenericAdaptor::XlaReduceWindowOpGenericAdaptor; + XlaReduceWindowOpAdaptor(XlaReduceWindowOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaReduceWindowOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<7>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaReduceWindowOpAdaptor; + template + using GenericAdaptor = XlaReduceWindowOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices"), ::llvm::StringRef("computation")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getComputationAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getComputationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaReduceWindow"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getInitValue(); + ::mlir::TypedValue<::mlir::TensorType> getWindowDimensions(); + ::mlir::TypedValue<::mlir::TensorType> getWindowStrides(); + ::mlir::TypedValue<::mlir::TensorType> getBaseDilations(); + ::mlir::TypedValue<::mlir::TensorType> getWindowDilations(); + ::mlir::TypedValue<::mlir::TensorType> getPadding(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getInitValueMutable(); + ::mlir::OpOperand &getWindowDimensionsMutable(); + ::mlir::OpOperand &getWindowStridesMutable(); + ::mlir::OpOperand &getBaseDilationsMutable(); + ::mlir::OpOperand &getWindowDilationsMutable(); + ::mlir::OpOperand &getPaddingMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::SymbolRefAttr getComputationAttr(); + ::mlir::SymbolRefAttr getComputation(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setComputationAttr(::mlir::SymbolRefAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value init_value, ::mlir::Value window_dimensions, ::mlir::Value window_strides, ::mlir::Value base_dilations, ::mlir::Value window_dilations, ::mlir::Value padding, ::mlir::SymbolRefAttr computation); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value init_value, ::mlir::Value window_dimensions, ::mlir::Value window_strides, ::mlir::Value base_dilations, ::mlir::Value window_dilations, ::mlir::Value padding, ::mlir::SymbolRefAttr computation); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaReduceWindowOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaRemoveDynamicDimensionSizeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaRemoveDynamicDimensionSizeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaRemoveDynamicDimensionSizeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaRemoveDynamicDimensionSizeOpGenericAdaptorBase(XlaRemoveDynamicDimensionSizeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class XlaRemoveDynamicDimensionSizeOpGenericAdaptor : public detail::XlaRemoveDynamicDimensionSizeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaRemoveDynamicDimensionSizeOpGenericAdaptorBase; +public: + XlaRemoveDynamicDimensionSizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaRemoveDynamicDimensionSizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaRemoveDynamicDimensionSizeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaRemoveDynamicDimensionSizeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getDimIndex() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaRemoveDynamicDimensionSizeOpAdaptor : public XlaRemoveDynamicDimensionSizeOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaRemoveDynamicDimensionSizeOpGenericAdaptor::XlaRemoveDynamicDimensionSizeOpGenericAdaptor; + XlaRemoveDynamicDimensionSizeOpAdaptor(XlaRemoveDynamicDimensionSizeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaRemoveDynamicDimensionSizeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaRemoveDynamicDimensionSizeOpAdaptor; + template + using GenericAdaptor = XlaRemoveDynamicDimensionSizeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaRemoveDynamicDimensionSize"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getDimIndex(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getDimIndexMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value dim_index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value dim_index); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaRemoveDynamicDimensionSizeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaReplicaIdOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaReplicaIdOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaReplicaIdOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaReplicaIdOpGenericAdaptorBase(XlaReplicaIdOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class XlaReplicaIdOpGenericAdaptor : public detail::XlaReplicaIdOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaReplicaIdOpGenericAdaptorBase; +public: + XlaReplicaIdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaReplicaIdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaReplicaIdOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaReplicaIdOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaReplicaIdOpAdaptor : public XlaReplicaIdOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaReplicaIdOpGenericAdaptor::XlaReplicaIdOpGenericAdaptor; + XlaReplicaIdOpAdaptor(XlaReplicaIdOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaReplicaIdOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaReplicaIdOpAdaptor; + template + using GenericAdaptor = XlaReplicaIdOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaReplicaId"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getId(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type id); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaReplicaIdOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaRngBitGeneratorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaRngBitGeneratorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaRngBitGeneratorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaRngBitGeneratorOpGenericAdaptorBase(XlaRngBitGeneratorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class XlaRngBitGeneratorOpGenericAdaptor : public detail::XlaRngBitGeneratorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaRngBitGeneratorOpGenericAdaptorBase; +public: + XlaRngBitGeneratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaRngBitGeneratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaRngBitGeneratorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaRngBitGeneratorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getAlgorithm() { + return (*getODSOperands(0).begin()); + } + + ValueT getInitialState() { + return (*getODSOperands(1).begin()); + } + + ValueT getShape() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaRngBitGeneratorOpAdaptor : public XlaRngBitGeneratorOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaRngBitGeneratorOpGenericAdaptor::XlaRngBitGeneratorOpGenericAdaptor; + XlaRngBitGeneratorOpAdaptor(XlaRngBitGeneratorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaRngBitGeneratorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaRngBitGeneratorOpAdaptor; + template + using GenericAdaptor = XlaRngBitGeneratorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tshape"), ::llvm::StringRef("dtype")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTshapeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTshapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDtypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDtypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaRngBitGenerator"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getAlgorithm(); + ::mlir::TypedValue<::mlir::TensorType> getInitialState(); + ::mlir::TypedValue<::mlir::TensorType> getShape(); + ::mlir::OpOperand &getAlgorithmMutable(); + ::mlir::OpOperand &getInitialStateMutable(); + ::mlir::OpOperand &getShapeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutputKey(); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getTshape(); + ::mlir::Type getDtype(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output_key, ::mlir::Type output, ::mlir::Value algorithm, ::mlir::Value initial_state, ::mlir::Value shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value algorithm, ::mlir::Value initial_state, ::mlir::Value shape); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaRngBitGeneratorOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaScatterOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaScatterOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaScatterOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaScatterOpGenericAdaptorBase(XlaScatterOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::SymbolRefAttr getUpdateComputationAttr(); + ::mlir::SymbolRefAttr getUpdateComputation(); + ::mlir::StringAttr getDimensionNumbersAttr(); + ::llvm::StringRef getDimensionNumbers(); + ::mlir::BoolAttr getIndicesAreSortedAttr(); + bool getIndicesAreSorted(); +}; +} // namespace detail +template +class XlaScatterOpGenericAdaptor : public detail::XlaScatterOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaScatterOpGenericAdaptorBase; +public: + XlaScatterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaScatterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaScatterOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaScatterOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + ValueT getScatterIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getUpdates() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaScatterOpAdaptor : public XlaScatterOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaScatterOpGenericAdaptor::XlaScatterOpGenericAdaptor; + XlaScatterOpAdaptor(XlaScatterOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaScatterOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaScatterOpAdaptor; + template + using GenericAdaptor = XlaScatterOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices"), ::llvm::StringRef("dimension_numbers"), ::llvm::StringRef("indices_are_sorted"), ::llvm::StringRef("update_computation")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDimensionNumbersAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDimensionNumbersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getIndicesAreSortedAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getIndicesAreSortedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getUpdateComputationAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getUpdateComputationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaScatter"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::TypedValue<::mlir::TensorType> getScatterIndices(); + ::mlir::TypedValue<::mlir::TensorType> getUpdates(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::OpOperand &getScatterIndicesMutable(); + ::mlir::OpOperand &getUpdatesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::SymbolRefAttr getUpdateComputationAttr(); + ::mlir::SymbolRefAttr getUpdateComputation(); + ::mlir::StringAttr getDimensionNumbersAttr(); + ::llvm::StringRef getDimensionNumbers(); + ::mlir::BoolAttr getIndicesAreSortedAttr(); + bool getIndicesAreSorted(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setUpdateComputationAttr(::mlir::SymbolRefAttr attr); + void setDimensionNumbersAttr(::mlir::StringAttr attr); + void setDimensionNumbers(::llvm::StringRef attrValue); + void setIndicesAreSortedAttr(::mlir::BoolAttr attr); + void setIndicesAreSorted(bool attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value operand, ::mlir::Value scatter_indices, ::mlir::Value updates, ::mlir::SymbolRefAttr update_computation, ::mlir::StringAttr dimension_numbers, ::mlir::BoolAttr indices_are_sorted); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value scatter_indices, ::mlir::Value updates, ::mlir::SymbolRefAttr update_computation, ::mlir::StringAttr dimension_numbers, ::mlir::BoolAttr indices_are_sorted); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value operand, ::mlir::Value scatter_indices, ::mlir::Value updates, ::mlir::SymbolRefAttr update_computation, ::llvm::StringRef dimension_numbers, bool indices_are_sorted); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value scatter_indices, ::mlir::Value updates, ::mlir::SymbolRefAttr update_computation, ::llvm::StringRef dimension_numbers, bool indices_are_sorted); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaScatterOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaSelectAndScatterOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaSelectAndScatterOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaSelectAndScatterOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaSelectAndScatterOpGenericAdaptorBase(XlaSelectAndScatterOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::SymbolRefAttr getSelectAttr(); + ::mlir::SymbolRefAttr getSelect(); + ::mlir::SymbolRefAttr getScatterAttr(); + ::mlir::SymbolRefAttr getScatter(); +}; +} // namespace detail +template +class XlaSelectAndScatterOpGenericAdaptor : public detail::XlaSelectAndScatterOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaSelectAndScatterOpGenericAdaptorBase; +public: + XlaSelectAndScatterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaSelectAndScatterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaSelectAndScatterOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaSelectAndScatterOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + ValueT getWindowDimensions() { + return (*getODSOperands(1).begin()); + } + + ValueT getWindowStrides() { + return (*getODSOperands(2).begin()); + } + + ValueT getPadding() { + return (*getODSOperands(3).begin()); + } + + ValueT getSource() { + return (*getODSOperands(4).begin()); + } + + ValueT getInitValue() { + return (*getODSOperands(5).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaSelectAndScatterOpAdaptor : public XlaSelectAndScatterOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaSelectAndScatterOpGenericAdaptor::XlaSelectAndScatterOpGenericAdaptor; + XlaSelectAndScatterOpAdaptor(XlaSelectAndScatterOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaSelectAndScatterOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<6>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaSelectAndScatterOpAdaptor; + template + using GenericAdaptor = XlaSelectAndScatterOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("Tindices"), ::llvm::StringRef("scatter"), ::llvm::StringRef("select")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTindicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTindicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getScatterAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getScatterAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSelectAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSelectAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaSelectAndScatter"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::TypedValue<::mlir::TensorType> getWindowDimensions(); + ::mlir::TypedValue<::mlir::TensorType> getWindowStrides(); + ::mlir::TypedValue<::mlir::TensorType> getPadding(); + ::mlir::TypedValue<::mlir::TensorType> getSource(); + ::mlir::TypedValue<::mlir::TensorType> getInitValue(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::OpOperand &getWindowDimensionsMutable(); + ::mlir::OpOperand &getWindowStridesMutable(); + ::mlir::OpOperand &getPaddingMutable(); + ::mlir::OpOperand &getSourceMutable(); + ::mlir::OpOperand &getInitValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::SymbolRefAttr getSelectAttr(); + ::mlir::SymbolRefAttr getSelect(); + ::mlir::SymbolRefAttr getScatterAttr(); + ::mlir::SymbolRefAttr getScatter(); + ::mlir::Type getT(); + ::mlir::Type getTindices(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setSelectAttr(::mlir::SymbolRefAttr attr); + void setScatterAttr(::mlir::SymbolRefAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value operand, ::mlir::Value window_dimensions, ::mlir::Value window_strides, ::mlir::Value padding, ::mlir::Value source, ::mlir::Value init_value, ::mlir::SymbolRefAttr select, ::mlir::SymbolRefAttr scatter); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value window_dimensions, ::mlir::Value window_strides, ::mlir::Value padding, ::mlir::Value source, ::mlir::Value init_value, ::mlir::SymbolRefAttr select, ::mlir::SymbolRefAttr scatter); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaSelectAndScatterOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaSelfAdjointEigOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaSelfAdjointEigOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaSelfAdjointEigOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaSelfAdjointEigOpGenericAdaptorBase(XlaSelfAdjointEigOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getLowerAttr(); + bool getLower(); + ::mlir::IntegerAttr getMaxIterAttr(); + uint64_t getMaxIter(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); +}; +} // namespace detail +template +class XlaSelfAdjointEigOpGenericAdaptor : public detail::XlaSelfAdjointEigOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaSelfAdjointEigOpGenericAdaptorBase; +public: + XlaSelfAdjointEigOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaSelfAdjointEigOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaSelfAdjointEigOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaSelfAdjointEigOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaSelfAdjointEigOpAdaptor : public XlaSelfAdjointEigOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaSelfAdjointEigOpGenericAdaptor::XlaSelfAdjointEigOpGenericAdaptor; + XlaSelfAdjointEigOpAdaptor(XlaSelfAdjointEigOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaSelfAdjointEigOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaSelfAdjointEigOpAdaptor; + template + using GenericAdaptor = XlaSelfAdjointEigOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("epsilon"), ::llvm::StringRef("lower"), ::llvm::StringRef("max_iter")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getEpsilonAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getEpsilonAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getLowerAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getLowerAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getMaxIterAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getMaxIterAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaSelfAdjointEig"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getA(); + ::mlir::OpOperand &getAMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getW(); + ::mlir::TypedValue<::mlir::TensorType> getV(); + ::mlir::BoolAttr getLowerAttr(); + bool getLower(); + ::mlir::IntegerAttr getMaxIterAttr(); + uint64_t getMaxIter(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setLowerAttr(::mlir::BoolAttr attr); + void setLower(bool attrValue); + void setMaxIterAttr(::mlir::IntegerAttr attr); + void setMaxIter(uint64_t attrValue); + void setEpsilonAttr(::mlir::FloatAttr attr); + void setEpsilon(::llvm::APFloat attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type w, ::mlir::Type v, ::mlir::Value a, ::mlir::BoolAttr lower, ::mlir::IntegerAttr max_iter, ::mlir::FloatAttr epsilon); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::BoolAttr lower, ::mlir::IntegerAttr max_iter, ::mlir::FloatAttr epsilon); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type w, ::mlir::Type v, ::mlir::Value a, bool lower, uint64_t max_iter, ::llvm::APFloat epsilon); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, bool lower, uint64_t max_iter, ::llvm::APFloat epsilon); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaSelfAdjointEigOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaSendOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaSendOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaSendOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaSendOpGenericAdaptorBase(XlaSendOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getTensorNameAttr(); + ::llvm::StringRef getTensorName(); +}; +} // namespace detail +template +class XlaSendOpGenericAdaptor : public detail::XlaSendOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaSendOpGenericAdaptorBase; +public: + XlaSendOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaSendOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaSendOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaSendOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTensor() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaSendOpAdaptor : public XlaSendOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaSendOpGenericAdaptor::XlaSendOpGenericAdaptor; + XlaSendOpAdaptor(XlaSendOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaSendOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaSendOpAdaptor; + template + using GenericAdaptor = XlaSendOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("tensor_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTensorNameAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTensorNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaSend"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::OpOperand &getTensorMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::StringAttr getTensorNameAttr(); + ::llvm::StringRef getTensorName(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setTensorNameAttr(::mlir::StringAttr attr); + void setTensorName(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value tensor, ::mlir::StringAttr tensor_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tensor, ::mlir::StringAttr tensor_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value tensor, ::llvm::StringRef tensor_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tensor, ::llvm::StringRef tensor_name); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaSendOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaSendTPUEmbeddingGradientsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaSendTPUEmbeddingGradientsOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaSendTPUEmbeddingGradientsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaSendTPUEmbeddingGradientsOpGenericAdaptorBase(XlaSendTPUEmbeddingGradientsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class XlaSendTPUEmbeddingGradientsOpGenericAdaptor : public detail::XlaSendTPUEmbeddingGradientsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaSendTPUEmbeddingGradientsOpGenericAdaptorBase; +public: + XlaSendTPUEmbeddingGradientsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaSendTPUEmbeddingGradientsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaSendTPUEmbeddingGradientsOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaSendTPUEmbeddingGradientsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getGradients() { + return getODSOperands(0); + } + + RangeT getLearningRates() { + return getODSOperands(1); + } + + ValueT getDeduplicationData() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaSendTPUEmbeddingGradientsOpAdaptor : public XlaSendTPUEmbeddingGradientsOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaSendTPUEmbeddingGradientsOpGenericAdaptor::XlaSendTPUEmbeddingGradientsOpGenericAdaptor; + XlaSendTPUEmbeddingGradientsOpAdaptor(XlaSendTPUEmbeddingGradientsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaSendTPUEmbeddingGradientsOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaSendTPUEmbeddingGradientsOpAdaptor; + template + using GenericAdaptor = XlaSendTPUEmbeddingGradientsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("NumLearningRateTags"), ::llvm::StringRef("NumTables"), ::llvm::StringRef("config"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNumLearningRateTagsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNumLearningRateTagsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNumTablesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNumTablesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaSendTPUEmbeddingGradients"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getGradients(); + ::mlir::Operation::operand_range getLearningRates(); + ::mlir::TypedValue<::mlir::TensorType> getDeduplicationData(); + ::mlir::MutableOperandRange getGradientsMutable(); + ::mlir::MutableOperandRange getLearningRatesMutable(); + ::mlir::OpOperand &getDeduplicationDataMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + size_t getNumLearningRateTags(); + size_t getNumTables(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange gradients, ::mlir::ValueRange learning_rates, ::mlir::Value deduplication_data, ::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange gradients, ::mlir::ValueRange learning_rates, ::mlir::Value deduplication_data, ::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange gradients, ::mlir::ValueRange learning_rates, ::mlir::Value deduplication_data, ::llvm::StringRef config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange gradients, ::mlir::ValueRange learning_rates, ::mlir::Value deduplication_data, ::llvm::StringRef config); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaSendTPUEmbeddingGradientsOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaSendToHostOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaSendToHostOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaSendToHostOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaSendToHostOpGenericAdaptorBase(XlaSendToHostOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getKeyAttr(); + ::llvm::StringRef getKey(); +}; +} // namespace detail +template +class XlaSendToHostOpGenericAdaptor : public detail::XlaSendToHostOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaSendToHostOpGenericAdaptorBase; +public: + XlaSendToHostOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaSendToHostOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaSendToHostOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaSendToHostOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaSendToHostOpAdaptor : public XlaSendToHostOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaSendToHostOpGenericAdaptor::XlaSendToHostOpGenericAdaptor; + XlaSendToHostOpAdaptor(XlaSendToHostOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaSendToHostOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaSendToHostOpAdaptor; + template + using GenericAdaptor = XlaSendToHostOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tinput"), ::llvm::StringRef("key")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTinputAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTinputAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getKeyAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getKeyAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaSendToHost"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::StringAttr getKeyAttr(); + ::llvm::StringRef getKey(); + ::mlir::Type getTinput(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setKeyAttr(::mlir::StringAttr attr); + void setKey(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::StringAttr key); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::StringAttr key); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::llvm::StringRef key); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::llvm::StringRef key); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaSendToHostOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaSetBoundOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaSetBoundOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaSetBoundOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaSetBoundOpGenericAdaptorBase(XlaSetBoundOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class XlaSetBoundOpGenericAdaptor : public detail::XlaSetBoundOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaSetBoundOpGenericAdaptorBase; +public: + XlaSetBoundOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaSetBoundOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaSetBoundOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaSetBoundOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getBound() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaSetBoundOpAdaptor : public XlaSetBoundOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaSetBoundOpGenericAdaptor::XlaSetBoundOpGenericAdaptor; + XlaSetBoundOpAdaptor(XlaSetBoundOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaSetBoundOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaSetBoundOpAdaptor; + template + using GenericAdaptor = XlaSetBoundOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaSetBound"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getBound(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getBoundMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value bound); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value bound); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaSetBoundOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaSetDynamicDimensionSizeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaSetDynamicDimensionSizeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaSetDynamicDimensionSizeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaSetDynamicDimensionSizeOpGenericAdaptorBase(XlaSetDynamicDimensionSizeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class XlaSetDynamicDimensionSizeOpGenericAdaptor : public detail::XlaSetDynamicDimensionSizeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaSetDynamicDimensionSizeOpGenericAdaptorBase; +public: + XlaSetDynamicDimensionSizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaSetDynamicDimensionSizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaSetDynamicDimensionSizeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaSetDynamicDimensionSizeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getDimIndex() { + return (*getODSOperands(1).begin()); + } + + ValueT getSize() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaSetDynamicDimensionSizeOpAdaptor : public XlaSetDynamicDimensionSizeOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaSetDynamicDimensionSizeOpGenericAdaptor::XlaSetDynamicDimensionSizeOpGenericAdaptor; + XlaSetDynamicDimensionSizeOpAdaptor(XlaSetDynamicDimensionSizeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaSetDynamicDimensionSizeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaSetDynamicDimensionSizeOpAdaptor; + template + using GenericAdaptor = XlaSetDynamicDimensionSizeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaSetDynamicDimensionSize"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getDimIndex(); + ::mlir::TypedValue<::mlir::TensorType> getSize(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getDimIndexMutable(); + ::mlir::OpOperand &getSizeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value dim_index, ::mlir::Value size); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value dim_index, ::mlir::Value size); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value dim_index, ::mlir::Value size); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // InferTypeOpInterface: + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return ArraysAreCastCompatible(l, r); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaSetDynamicDimensionSizeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaShardingOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaShardingOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaShardingOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaShardingOpGenericAdaptorBase(XlaShardingOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getShardingAttr(); + ::llvm::StringRef getSharding(); + ::mlir::StringAttr get_XlaShardingAttr(); + ::std::optional< ::llvm::StringRef > get_XlaSharding(); +}; +} // namespace detail +template +class XlaShardingOpGenericAdaptor : public detail::XlaShardingOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaShardingOpGenericAdaptorBase; +public: + XlaShardingOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaShardingOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaShardingOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaShardingOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaShardingOpAdaptor : public XlaShardingOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaShardingOpGenericAdaptor::XlaShardingOpGenericAdaptor; + XlaShardingOpAdaptor(XlaShardingOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaShardingOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaShardingOpAdaptor; + template + using GenericAdaptor = XlaShardingOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("_XlaSharding"), ::llvm::StringRef("sharding")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr get_XlaShardingAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr get_XlaShardingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getShardingAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getShardingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaSharding"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::StringAttr getShardingAttr(); + ::llvm::StringRef getSharding(); + ::mlir::StringAttr get_XlaShardingAttr(); + ::std::optional< ::llvm::StringRef > get_XlaSharding(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setShardingAttr(::mlir::StringAttr attr); + void setSharding(::llvm::StringRef attrValue); + void set_XlaShardingAttr(::mlir::StringAttr attr); + void set_XlaSharding(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute remove_XlaShardingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::StringAttr sharding, /*optional*/::mlir::StringAttr _XlaSharding); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::StringAttr sharding, /*optional*/::mlir::StringAttr _XlaSharding); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::llvm::StringRef sharding, /*optional*/::mlir::StringAttr _XlaSharding); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::llvm::StringRef sharding, /*optional*/::mlir::StringAttr _XlaSharding); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultAttrs(const ::mlir::OperationName &opName, ::mlir::NamedAttrList &attributes); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaShardingOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaSortOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaSortOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaSortOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaSortOpGenericAdaptorBase(XlaSortOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class XlaSortOpGenericAdaptor : public detail::XlaSortOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaSortOpGenericAdaptorBase; +public: + XlaSortOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaSortOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaSortOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaSortOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaSortOpAdaptor : public XlaSortOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaSortOpGenericAdaptor::XlaSortOpGenericAdaptor; + XlaSortOpAdaptor(XlaSortOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaSortOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaSortOpAdaptor; + template + using GenericAdaptor = XlaSortOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaSort"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaSortOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaSparseCoreAdagradMomentumOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaSparseCoreAdagradMomentumOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaSparseCoreAdagradMomentumOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaSparseCoreAdagradMomentumOpGenericAdaptorBase(XlaSparseCoreAdagradMomentumOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getFeatureWidthAttr(); + uint64_t getFeatureWidth(); + ::mlir::BoolAttr getUseNesterovAttr(); + bool getUseNesterov(); + ::mlir::FloatAttr getBeta_2Attr(); + ::llvm::APFloat getBeta_2(); + ::mlir::FloatAttr getExponentAttr(); + ::llvm::APFloat getExponent(); +}; +} // namespace detail +template +class XlaSparseCoreAdagradMomentumOpGenericAdaptor : public detail::XlaSparseCoreAdagradMomentumOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaSparseCoreAdagradMomentumOpGenericAdaptorBase; +public: + XlaSparseCoreAdagradMomentumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaSparseCoreAdagradMomentumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaSparseCoreAdagradMomentumOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaSparseCoreAdagradMomentumOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIndices() { + return (*getODSOperands(0).begin()); + } + + ValueT getGradient() { + return (*getODSOperands(1).begin()); + } + + ValueT getLearningRate() { + return (*getODSOperands(2).begin()); + } + + ValueT getBeta_1() { + return (*getODSOperands(3).begin()); + } + + ValueT getEpsilon() { + return (*getODSOperands(4).begin()); + } + + ValueT getAccumulator() { + return (*getODSOperands(5).begin()); + } + + ValueT getMomentum() { + return (*getODSOperands(6).begin()); + } + + ValueT getEmbeddingTable() { + return (*getODSOperands(7).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaSparseCoreAdagradMomentumOpAdaptor : public XlaSparseCoreAdagradMomentumOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaSparseCoreAdagradMomentumOpGenericAdaptor::XlaSparseCoreAdagradMomentumOpGenericAdaptor; + XlaSparseCoreAdagradMomentumOpAdaptor(XlaSparseCoreAdagradMomentumOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaSparseCoreAdagradMomentumOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<8>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaSparseCoreAdagradMomentumOpAdaptor; + template + using GenericAdaptor = XlaSparseCoreAdagradMomentumOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("beta_2"), ::llvm::StringRef("exponent"), ::llvm::StringRef("feature_width"), ::llvm::StringRef("use_nesterov")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBeta_2AttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBeta_2AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getExponentAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getExponentAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getFeatureWidthAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getFeatureWidthAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getUseNesterovAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getUseNesterovAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaSparseCoreAdagradMomentum"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getGradient(); + ::mlir::TypedValue<::mlir::TensorType> getLearningRate(); + ::mlir::TypedValue<::mlir::TensorType> getBeta_1(); + ::mlir::TypedValue<::mlir::TensorType> getEpsilon(); + ::mlir::TypedValue<::mlir::TensorType> getAccumulator(); + ::mlir::TypedValue<::mlir::TensorType> getMomentum(); + ::mlir::TypedValue<::mlir::TensorType> getEmbeddingTable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getGradientMutable(); + ::mlir::OpOperand &getLearningRateMutable(); + ::mlir::OpOperand &getBeta_1Mutable(); + ::mlir::OpOperand &getEpsilonMutable(); + ::mlir::OpOperand &getAccumulatorMutable(); + ::mlir::OpOperand &getMomentumMutable(); + ::mlir::OpOperand &getEmbeddingTableMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getUpdatedEmbeddingTable(); + ::mlir::TypedValue<::mlir::TensorType> getUpdatedAccumulator(); + ::mlir::TypedValue<::mlir::TensorType> getUpdatedMomentum(); + ::mlir::IntegerAttr getFeatureWidthAttr(); + uint64_t getFeatureWidth(); + ::mlir::BoolAttr getUseNesterovAttr(); + bool getUseNesterov(); + ::mlir::FloatAttr getBeta_2Attr(); + ::llvm::APFloat getBeta_2(); + ::mlir::FloatAttr getExponentAttr(); + ::llvm::APFloat getExponent(); + void setFeatureWidthAttr(::mlir::IntegerAttr attr); + void setFeatureWidth(uint64_t attrValue); + void setUseNesterovAttr(::mlir::BoolAttr attr); + void setUseNesterov(bool attrValue); + void setBeta_2Attr(::mlir::FloatAttr attr); + void setBeta_2(::llvm::APFloat attrValue); + void setExponentAttr(::mlir::FloatAttr attr); + void setExponent(::llvm::APFloat attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type updated_embedding_table, ::mlir::Type updated_accumulator, ::mlir::Type updated_momentum, ::mlir::Value indices, ::mlir::Value gradient, ::mlir::Value learning_rate, ::mlir::Value beta_1, ::mlir::Value epsilon, ::mlir::Value accumulator, ::mlir::Value momentum, ::mlir::Value embedding_table, ::mlir::IntegerAttr feature_width, ::mlir::BoolAttr use_nesterov, ::mlir::FloatAttr beta_2, ::mlir::FloatAttr exponent); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value indices, ::mlir::Value gradient, ::mlir::Value learning_rate, ::mlir::Value beta_1, ::mlir::Value epsilon, ::mlir::Value accumulator, ::mlir::Value momentum, ::mlir::Value embedding_table, ::mlir::IntegerAttr feature_width, ::mlir::BoolAttr use_nesterov, ::mlir::FloatAttr beta_2, ::mlir::FloatAttr exponent); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type updated_embedding_table, ::mlir::Type updated_accumulator, ::mlir::Type updated_momentum, ::mlir::Value indices, ::mlir::Value gradient, ::mlir::Value learning_rate, ::mlir::Value beta_1, ::mlir::Value epsilon, ::mlir::Value accumulator, ::mlir::Value momentum, ::mlir::Value embedding_table, uint64_t feature_width, bool use_nesterov, ::llvm::APFloat beta_2, ::llvm::APFloat exponent); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value indices, ::mlir::Value gradient, ::mlir::Value learning_rate, ::mlir::Value beta_1, ::mlir::Value epsilon, ::mlir::Value accumulator, ::mlir::Value momentum, ::mlir::Value embedding_table, uint64_t feature_width, bool use_nesterov, ::llvm::APFloat beta_2, ::llvm::APFloat exponent); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaSparseCoreAdagradMomentumOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaSparseCoreAdagradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaSparseCoreAdagradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaSparseCoreAdagradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaSparseCoreAdagradOpGenericAdaptorBase(XlaSparseCoreAdagradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getFeatureWidthAttr(); + uint64_t getFeatureWidth(); +}; +} // namespace detail +template +class XlaSparseCoreAdagradOpGenericAdaptor : public detail::XlaSparseCoreAdagradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaSparseCoreAdagradOpGenericAdaptorBase; +public: + XlaSparseCoreAdagradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaSparseCoreAdagradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaSparseCoreAdagradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaSparseCoreAdagradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIndices() { + return (*getODSOperands(0).begin()); + } + + ValueT getGradient() { + return (*getODSOperands(1).begin()); + } + + ValueT getLearningRate() { + return (*getODSOperands(2).begin()); + } + + ValueT getAccumulator() { + return (*getODSOperands(3).begin()); + } + + ValueT getEmbeddingTable() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaSparseCoreAdagradOpAdaptor : public XlaSparseCoreAdagradOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaSparseCoreAdagradOpGenericAdaptor::XlaSparseCoreAdagradOpGenericAdaptor; + XlaSparseCoreAdagradOpAdaptor(XlaSparseCoreAdagradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaSparseCoreAdagradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<5>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaSparseCoreAdagradOpAdaptor; + template + using GenericAdaptor = XlaSparseCoreAdagradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("feature_width")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFeatureWidthAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFeatureWidthAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaSparseCoreAdagrad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getGradient(); + ::mlir::TypedValue<::mlir::TensorType> getLearningRate(); + ::mlir::TypedValue<::mlir::TensorType> getAccumulator(); + ::mlir::TypedValue<::mlir::TensorType> getEmbeddingTable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getGradientMutable(); + ::mlir::OpOperand &getLearningRateMutable(); + ::mlir::OpOperand &getAccumulatorMutable(); + ::mlir::OpOperand &getEmbeddingTableMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getUpdatedEmbeddingTable(); + ::mlir::TypedValue<::mlir::TensorType> getUpdatedAccumulator(); + ::mlir::IntegerAttr getFeatureWidthAttr(); + uint64_t getFeatureWidth(); + void setFeatureWidthAttr(::mlir::IntegerAttr attr); + void setFeatureWidth(uint64_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type updated_embedding_table, ::mlir::Type updated_accumulator, ::mlir::Value indices, ::mlir::Value gradient, ::mlir::Value learning_rate, ::mlir::Value accumulator, ::mlir::Value embedding_table, ::mlir::IntegerAttr feature_width); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value indices, ::mlir::Value gradient, ::mlir::Value learning_rate, ::mlir::Value accumulator, ::mlir::Value embedding_table, ::mlir::IntegerAttr feature_width); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type updated_embedding_table, ::mlir::Type updated_accumulator, ::mlir::Value indices, ::mlir::Value gradient, ::mlir::Value learning_rate, ::mlir::Value accumulator, ::mlir::Value embedding_table, uint64_t feature_width); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value indices, ::mlir::Value gradient, ::mlir::Value learning_rate, ::mlir::Value accumulator, ::mlir::Value embedding_table, uint64_t feature_width); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaSparseCoreAdagradOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaSparseCoreAdamOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaSparseCoreAdamOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaSparseCoreAdamOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaSparseCoreAdamOpGenericAdaptorBase(XlaSparseCoreAdamOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getFeatureWidthAttr(); + uint64_t getFeatureWidth(); + ::mlir::BoolAttr getUseSumInsideSqrtAttr(); + bool getUseSumInsideSqrt(); +}; +} // namespace detail +template +class XlaSparseCoreAdamOpGenericAdaptor : public detail::XlaSparseCoreAdamOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaSparseCoreAdamOpGenericAdaptorBase; +public: + XlaSparseCoreAdamOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaSparseCoreAdamOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaSparseCoreAdamOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaSparseCoreAdamOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getEmbeddingTable() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getGradient() { + return (*getODSOperands(2).begin()); + } + + ValueT getLearningRate() { + return (*getODSOperands(3).begin()); + } + + ValueT getMomentum() { + return (*getODSOperands(4).begin()); + } + + ValueT getVelocity() { + return (*getODSOperands(5).begin()); + } + + ValueT getBeta_1() { + return (*getODSOperands(6).begin()); + } + + ValueT getBeta_2() { + return (*getODSOperands(7).begin()); + } + + ValueT getEpsilon() { + return (*getODSOperands(8).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaSparseCoreAdamOpAdaptor : public XlaSparseCoreAdamOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaSparseCoreAdamOpGenericAdaptor::XlaSparseCoreAdamOpGenericAdaptor; + XlaSparseCoreAdamOpAdaptor(XlaSparseCoreAdamOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaSparseCoreAdamOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<9>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaSparseCoreAdamOpAdaptor; + template + using GenericAdaptor = XlaSparseCoreAdamOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("feature_width"), ::llvm::StringRef("use_sum_inside_sqrt")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFeatureWidthAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFeatureWidthAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getUseSumInsideSqrtAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getUseSumInsideSqrtAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaSparseCoreAdam"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getEmbeddingTable(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getGradient(); + ::mlir::TypedValue<::mlir::TensorType> getLearningRate(); + ::mlir::TypedValue<::mlir::TensorType> getMomentum(); + ::mlir::TypedValue<::mlir::TensorType> getVelocity(); + ::mlir::TypedValue<::mlir::TensorType> getBeta_1(); + ::mlir::TypedValue<::mlir::TensorType> getBeta_2(); + ::mlir::TypedValue<::mlir::TensorType> getEpsilon(); + ::mlir::OpOperand &getEmbeddingTableMutable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getGradientMutable(); + ::mlir::OpOperand &getLearningRateMutable(); + ::mlir::OpOperand &getMomentumMutable(); + ::mlir::OpOperand &getVelocityMutable(); + ::mlir::OpOperand &getBeta_1Mutable(); + ::mlir::OpOperand &getBeta_2Mutable(); + ::mlir::OpOperand &getEpsilonMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getUpdatedEmbeddingTable(); + ::mlir::TypedValue<::mlir::TensorType> getUpdatedVelocity(); + ::mlir::TypedValue<::mlir::TensorType> getUpdatedMomentum(); + ::mlir::IntegerAttr getFeatureWidthAttr(); + uint64_t getFeatureWidth(); + ::mlir::BoolAttr getUseSumInsideSqrtAttr(); + bool getUseSumInsideSqrt(); + void setFeatureWidthAttr(::mlir::IntegerAttr attr); + void setFeatureWidth(uint64_t attrValue); + void setUseSumInsideSqrtAttr(::mlir::BoolAttr attr); + void setUseSumInsideSqrt(bool attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type updated_embedding_table, ::mlir::Type updated_velocity, ::mlir::Type updated_momentum, ::mlir::Value embedding_table, ::mlir::Value indices, ::mlir::Value gradient, ::mlir::Value learning_rate, ::mlir::Value momentum, ::mlir::Value velocity, ::mlir::Value beta_1, ::mlir::Value beta_2, ::mlir::Value epsilon, ::mlir::IntegerAttr feature_width, ::mlir::BoolAttr use_sum_inside_sqrt); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value embedding_table, ::mlir::Value indices, ::mlir::Value gradient, ::mlir::Value learning_rate, ::mlir::Value momentum, ::mlir::Value velocity, ::mlir::Value beta_1, ::mlir::Value beta_2, ::mlir::Value epsilon, ::mlir::IntegerAttr feature_width, ::mlir::BoolAttr use_sum_inside_sqrt); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type updated_embedding_table, ::mlir::Type updated_velocity, ::mlir::Type updated_momentum, ::mlir::Value embedding_table, ::mlir::Value indices, ::mlir::Value gradient, ::mlir::Value learning_rate, ::mlir::Value momentum, ::mlir::Value velocity, ::mlir::Value beta_1, ::mlir::Value beta_2, ::mlir::Value epsilon, uint64_t feature_width, bool use_sum_inside_sqrt); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value embedding_table, ::mlir::Value indices, ::mlir::Value gradient, ::mlir::Value learning_rate, ::mlir::Value momentum, ::mlir::Value velocity, ::mlir::Value beta_1, ::mlir::Value beta_2, ::mlir::Value epsilon, uint64_t feature_width, bool use_sum_inside_sqrt); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaSparseCoreAdamOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaSparseCoreFtrlOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaSparseCoreFtrlOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaSparseCoreFtrlOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaSparseCoreFtrlOpGenericAdaptorBase(XlaSparseCoreFtrlOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getFeatureWidthAttr(); + uint64_t getFeatureWidth(); + ::mlir::BoolAttr getMultiplyLinearByLearningRateAttr(); + bool getMultiplyLinearByLearningRate(); + ::mlir::FloatAttr getL1RegularizationStrengthAttr(); + ::llvm::APFloat getL1RegularizationStrength(); +}; +} // namespace detail +template +class XlaSparseCoreFtrlOpGenericAdaptor : public detail::XlaSparseCoreFtrlOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaSparseCoreFtrlOpGenericAdaptorBase; +public: + XlaSparseCoreFtrlOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaSparseCoreFtrlOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaSparseCoreFtrlOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaSparseCoreFtrlOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getEmbeddingTable() { + return (*getODSOperands(0).begin()); + } + + ValueT getAccumulator() { + return (*getODSOperands(1).begin()); + } + + ValueT getLinear() { + return (*getODSOperands(2).begin()); + } + + ValueT getLearningRate() { + return (*getODSOperands(3).begin()); + } + + ValueT getIndices() { + return (*getODSOperands(4).begin()); + } + + ValueT getGradient() { + return (*getODSOperands(5).begin()); + } + + ValueT getBeta() { + return (*getODSOperands(6).begin()); + } + + ValueT getLearningRatePower() { + return (*getODSOperands(7).begin()); + } + + ValueT getL2RegularizationStrength() { + return (*getODSOperands(8).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaSparseCoreFtrlOpAdaptor : public XlaSparseCoreFtrlOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaSparseCoreFtrlOpGenericAdaptor::XlaSparseCoreFtrlOpGenericAdaptor; + XlaSparseCoreFtrlOpAdaptor(XlaSparseCoreFtrlOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaSparseCoreFtrlOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<9>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaSparseCoreFtrlOpAdaptor; + template + using GenericAdaptor = XlaSparseCoreFtrlOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("feature_width"), ::llvm::StringRef("l1_regularization_strength"), ::llvm::StringRef("multiply_linear_by_learning_rate")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFeatureWidthAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFeatureWidthAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getL1RegularizationStrengthAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getL1RegularizationStrengthAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getMultiplyLinearByLearningRateAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getMultiplyLinearByLearningRateAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaSparseCoreFtrl"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getEmbeddingTable(); + ::mlir::TypedValue<::mlir::TensorType> getAccumulator(); + ::mlir::TypedValue<::mlir::TensorType> getLinear(); + ::mlir::TypedValue<::mlir::TensorType> getLearningRate(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getGradient(); + ::mlir::TypedValue<::mlir::TensorType> getBeta(); + ::mlir::TypedValue<::mlir::TensorType> getLearningRatePower(); + ::mlir::TypedValue<::mlir::TensorType> getL2RegularizationStrength(); + ::mlir::OpOperand &getEmbeddingTableMutable(); + ::mlir::OpOperand &getAccumulatorMutable(); + ::mlir::OpOperand &getLinearMutable(); + ::mlir::OpOperand &getLearningRateMutable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getGradientMutable(); + ::mlir::OpOperand &getBetaMutable(); + ::mlir::OpOperand &getLearningRatePowerMutable(); + ::mlir::OpOperand &getL2RegularizationStrengthMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getUpdatedEmbeddingTable(); + ::mlir::TypedValue<::mlir::TensorType> getUpdatedAccumulator(); + ::mlir::TypedValue<::mlir::TensorType> getUpdatedLinear(); + ::mlir::IntegerAttr getFeatureWidthAttr(); + uint64_t getFeatureWidth(); + ::mlir::BoolAttr getMultiplyLinearByLearningRateAttr(); + bool getMultiplyLinearByLearningRate(); + ::mlir::FloatAttr getL1RegularizationStrengthAttr(); + ::llvm::APFloat getL1RegularizationStrength(); + void setFeatureWidthAttr(::mlir::IntegerAttr attr); + void setFeatureWidth(uint64_t attrValue); + void setMultiplyLinearByLearningRateAttr(::mlir::BoolAttr attr); + void setMultiplyLinearByLearningRate(bool attrValue); + void setL1RegularizationStrengthAttr(::mlir::FloatAttr attr); + void setL1RegularizationStrength(::llvm::APFloat attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type updated_embedding_table, ::mlir::Type updated_accumulator, ::mlir::Type updated_linear, ::mlir::Value embedding_table, ::mlir::Value accumulator, ::mlir::Value linear, ::mlir::Value learning_rate, ::mlir::Value indices, ::mlir::Value gradient, ::mlir::Value beta, ::mlir::Value learning_rate_power, ::mlir::Value l2_regularization_strength, ::mlir::IntegerAttr feature_width, ::mlir::BoolAttr multiply_linear_by_learning_rate, ::mlir::FloatAttr l1_regularization_strength); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value embedding_table, ::mlir::Value accumulator, ::mlir::Value linear, ::mlir::Value learning_rate, ::mlir::Value indices, ::mlir::Value gradient, ::mlir::Value beta, ::mlir::Value learning_rate_power, ::mlir::Value l2_regularization_strength, ::mlir::IntegerAttr feature_width, ::mlir::BoolAttr multiply_linear_by_learning_rate, ::mlir::FloatAttr l1_regularization_strength); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type updated_embedding_table, ::mlir::Type updated_accumulator, ::mlir::Type updated_linear, ::mlir::Value embedding_table, ::mlir::Value accumulator, ::mlir::Value linear, ::mlir::Value learning_rate, ::mlir::Value indices, ::mlir::Value gradient, ::mlir::Value beta, ::mlir::Value learning_rate_power, ::mlir::Value l2_regularization_strength, uint64_t feature_width, bool multiply_linear_by_learning_rate, ::llvm::APFloat l1_regularization_strength); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value embedding_table, ::mlir::Value accumulator, ::mlir::Value linear, ::mlir::Value learning_rate, ::mlir::Value indices, ::mlir::Value gradient, ::mlir::Value beta, ::mlir::Value learning_rate_power, ::mlir::Value l2_regularization_strength, uint64_t feature_width, bool multiply_linear_by_learning_rate, ::llvm::APFloat l1_regularization_strength); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaSparseCoreFtrlOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaSparseCoreSgdOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaSparseCoreSgdOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaSparseCoreSgdOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaSparseCoreSgdOpGenericAdaptorBase(XlaSparseCoreSgdOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getFeatureWidthAttr(); + uint64_t getFeatureWidth(); +}; +} // namespace detail +template +class XlaSparseCoreSgdOpGenericAdaptor : public detail::XlaSparseCoreSgdOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaSparseCoreSgdOpGenericAdaptorBase; +public: + XlaSparseCoreSgdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaSparseCoreSgdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaSparseCoreSgdOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaSparseCoreSgdOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIndices() { + return (*getODSOperands(0).begin()); + } + + ValueT getGradient() { + return (*getODSOperands(1).begin()); + } + + ValueT getLearningRate() { + return (*getODSOperands(2).begin()); + } + + ValueT getEmbeddingTable() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaSparseCoreSgdOpAdaptor : public XlaSparseCoreSgdOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaSparseCoreSgdOpGenericAdaptor::XlaSparseCoreSgdOpGenericAdaptor; + XlaSparseCoreSgdOpAdaptor(XlaSparseCoreSgdOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaSparseCoreSgdOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaSparseCoreSgdOpAdaptor; + template + using GenericAdaptor = XlaSparseCoreSgdOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("feature_width")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFeatureWidthAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFeatureWidthAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaSparseCoreSgd"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::TypedValue<::mlir::TensorType> getGradient(); + ::mlir::TypedValue<::mlir::TensorType> getLearningRate(); + ::mlir::TypedValue<::mlir::TensorType> getEmbeddingTable(); + ::mlir::OpOperand &getIndicesMutable(); + ::mlir::OpOperand &getGradientMutable(); + ::mlir::OpOperand &getLearningRateMutable(); + ::mlir::OpOperand &getEmbeddingTableMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getUpdatedEmbeddingTable(); + ::mlir::IntegerAttr getFeatureWidthAttr(); + uint64_t getFeatureWidth(); + void setFeatureWidthAttr(::mlir::IntegerAttr attr); + void setFeatureWidth(uint64_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type updated_embedding_table, ::mlir::Value indices, ::mlir::Value gradient, ::mlir::Value learning_rate, ::mlir::Value embedding_table, ::mlir::IntegerAttr feature_width); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value indices, ::mlir::Value gradient, ::mlir::Value learning_rate, ::mlir::Value embedding_table, ::mlir::IntegerAttr feature_width); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type updated_embedding_table, ::mlir::Value indices, ::mlir::Value gradient, ::mlir::Value learning_rate, ::mlir::Value embedding_table, uint64_t feature_width); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value indices, ::mlir::Value gradient, ::mlir::Value learning_rate, ::mlir::Value embedding_table, uint64_t feature_width); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaSparseCoreSgdOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaSparseDenseMatmulGradWithSgdAndCsrInputOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaSparseDenseMatmulGradWithSgdAndCsrInputOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaSparseDenseMatmulGradWithSgdAndCsrInputOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaSparseDenseMatmulGradWithSgdAndCsrInputOpGenericAdaptorBase(XlaSparseDenseMatmulGradWithSgdAndCsrInputOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); +}; +} // namespace detail +template +class XlaSparseDenseMatmulGradWithSgdAndCsrInputOpGenericAdaptor : public detail::XlaSparseDenseMatmulGradWithSgdAndCsrInputOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaSparseDenseMatmulGradWithSgdAndCsrInputOpGenericAdaptorBase; +public: + XlaSparseDenseMatmulGradWithSgdAndCsrInputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaSparseDenseMatmulGradWithSgdAndCsrInputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaSparseDenseMatmulGradWithSgdAndCsrInputOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaSparseDenseMatmulGradWithSgdAndCsrInputOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getRowPointers() { + return (*getODSOperands(0).begin()); + } + + ValueT getSortedSampleIds() { + return (*getODSOperands(1).begin()); + } + + ValueT getSortedTokenIds() { + return (*getODSOperands(2).begin()); + } + + ValueT getSortedGains() { + return (*getODSOperands(3).begin()); + } + + ValueT getActivationGradients() { + return (*getODSOperands(4).begin()); + } + + ValueT getLearningRate() { + return (*getODSOperands(5).begin()); + } + + ValueT getEmbeddingTable() { + return (*getODSOperands(6).begin()); + } + + ValueT getNumMinibatchesPerPhysicalSparseCore() { + return (*getODSOperands(7).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaSparseDenseMatmulGradWithSgdAndCsrInputOpAdaptor : public XlaSparseDenseMatmulGradWithSgdAndCsrInputOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaSparseDenseMatmulGradWithSgdAndCsrInputOpGenericAdaptor::XlaSparseDenseMatmulGradWithSgdAndCsrInputOpGenericAdaptor; + XlaSparseDenseMatmulGradWithSgdAndCsrInputOpAdaptor(XlaSparseDenseMatmulGradWithSgdAndCsrInputOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaSparseDenseMatmulGradWithSgdAndCsrInputOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<8>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaSparseDenseMatmulGradWithSgdAndCsrInputOpAdaptor; + template + using GenericAdaptor = XlaSparseDenseMatmulGradWithSgdAndCsrInputOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaSparseDenseMatmulGradWithSgdAndCsrInput"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getRowPointers(); + ::mlir::TypedValue<::mlir::TensorType> getSortedSampleIds(); + ::mlir::TypedValue<::mlir::TensorType> getSortedTokenIds(); + ::mlir::TypedValue<::mlir::TensorType> getSortedGains(); + ::mlir::TypedValue<::mlir::TensorType> getActivationGradients(); + ::mlir::TypedValue<::mlir::TensorType> getLearningRate(); + ::mlir::TypedValue<::mlir::TensorType> getEmbeddingTable(); + ::mlir::TypedValue<::mlir::TensorType> getNumMinibatchesPerPhysicalSparseCore(); + ::mlir::OpOperand &getRowPointersMutable(); + ::mlir::OpOperand &getSortedSampleIdsMutable(); + ::mlir::OpOperand &getSortedTokenIdsMutable(); + ::mlir::OpOperand &getSortedGainsMutable(); + ::mlir::OpOperand &getActivationGradientsMutable(); + ::mlir::OpOperand &getLearningRateMutable(); + ::mlir::OpOperand &getEmbeddingTableMutable(); + ::mlir::OpOperand &getNumMinibatchesPerPhysicalSparseCoreMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getUpdatedEmbeddingTable(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type updated_embedding_table, ::mlir::Value row_pointers, ::mlir::Value sorted_sample_ids, ::mlir::Value sorted_token_ids, ::mlir::Value sorted_gains, ::mlir::Value activation_gradients, ::mlir::Value learning_rate, ::mlir::Value embedding_table, ::mlir::Value num_minibatches_per_physical_sparse_core, ::mlir::StringAttr table_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value row_pointers, ::mlir::Value sorted_sample_ids, ::mlir::Value sorted_token_ids, ::mlir::Value sorted_gains, ::mlir::Value activation_gradients, ::mlir::Value learning_rate, ::mlir::Value embedding_table, ::mlir::Value num_minibatches_per_physical_sparse_core, ::mlir::StringAttr table_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type updated_embedding_table, ::mlir::Value row_pointers, ::mlir::Value sorted_sample_ids, ::mlir::Value sorted_token_ids, ::mlir::Value sorted_gains, ::mlir::Value activation_gradients, ::mlir::Value learning_rate, ::mlir::Value embedding_table, ::mlir::Value num_minibatches_per_physical_sparse_core, ::llvm::StringRef table_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value row_pointers, ::mlir::Value sorted_sample_ids, ::mlir::Value sorted_token_ids, ::mlir::Value sorted_gains, ::mlir::Value activation_gradients, ::mlir::Value learning_rate, ::mlir::Value embedding_table, ::mlir::Value num_minibatches_per_physical_sparse_core, ::llvm::StringRef table_name); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaSparseDenseMatmulGradWithSgdAndCsrInputOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaSparseDenseMatmulWithCsrInputOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaSparseDenseMatmulWithCsrInputOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaSparseDenseMatmulWithCsrInputOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaSparseDenseMatmulWithCsrInputOpGenericAdaptorBase(XlaSparseDenseMatmulWithCsrInputOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getInputSizeAttr(); + uint64_t getInputSize(); + ::mlir::FloatAttr getQuantizationConfigLowAttr(); + ::std::optional< ::llvm::APFloat > getQuantizationConfigLow(); + ::mlir::FloatAttr getQuantizationConfigHighAttr(); + ::std::optional< ::llvm::APFloat > getQuantizationConfigHigh(); + ::mlir::IntegerAttr getQuantizationConfigNumBucketsAttr(); + ::std::optional getQuantizationConfigNumBuckets(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); +}; +} // namespace detail +template +class XlaSparseDenseMatmulWithCsrInputOpGenericAdaptor : public detail::XlaSparseDenseMatmulWithCsrInputOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaSparseDenseMatmulWithCsrInputOpGenericAdaptorBase; +public: + XlaSparseDenseMatmulWithCsrInputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaSparseDenseMatmulWithCsrInputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaSparseDenseMatmulWithCsrInputOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaSparseDenseMatmulWithCsrInputOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getRowPointers() { + return (*getODSOperands(0).begin()); + } + + ValueT getSortedSampleIds() { + return (*getODSOperands(1).begin()); + } + + ValueT getSortedTokenIds() { + return (*getODSOperands(2).begin()); + } + + ValueT getSortedGains() { + return (*getODSOperands(3).begin()); + } + + ValueT getEmbeddingTable() { + return (*getODSOperands(4).begin()); + } + + ValueT getNumMinibatchesPerPhysicalSparseCore() { + return (*getODSOperands(5).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaSparseDenseMatmulWithCsrInputOpAdaptor : public XlaSparseDenseMatmulWithCsrInputOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaSparseDenseMatmulWithCsrInputOpGenericAdaptor::XlaSparseDenseMatmulWithCsrInputOpGenericAdaptor; + XlaSparseDenseMatmulWithCsrInputOpAdaptor(XlaSparseDenseMatmulWithCsrInputOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaSparseDenseMatmulWithCsrInputOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<6>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaSparseDenseMatmulWithCsrInputOpAdaptor; + template + using GenericAdaptor = XlaSparseDenseMatmulWithCsrInputOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("input_size"), ::llvm::StringRef("quantization_config_high"), ::llvm::StringRef("quantization_config_low"), ::llvm::StringRef("quantization_config_num_buckets"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getInputSizeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getInputSizeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getQuantizationConfigHighAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getQuantizationConfigHighAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getQuantizationConfigLowAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getQuantizationConfigLowAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getQuantizationConfigNumBucketsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getQuantizationConfigNumBucketsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaSparseDenseMatmulWithCsrInput"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getRowPointers(); + ::mlir::TypedValue<::mlir::TensorType> getSortedSampleIds(); + ::mlir::TypedValue<::mlir::TensorType> getSortedTokenIds(); + ::mlir::TypedValue<::mlir::TensorType> getSortedGains(); + ::mlir::TypedValue<::mlir::TensorType> getEmbeddingTable(); + ::mlir::TypedValue<::mlir::TensorType> getNumMinibatchesPerPhysicalSparseCore(); + ::mlir::OpOperand &getRowPointersMutable(); + ::mlir::OpOperand &getSortedSampleIdsMutable(); + ::mlir::OpOperand &getSortedTokenIdsMutable(); + ::mlir::OpOperand &getSortedGainsMutable(); + ::mlir::OpOperand &getEmbeddingTableMutable(); + ::mlir::OpOperand &getNumMinibatchesPerPhysicalSparseCoreMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getActivations(); + ::mlir::IntegerAttr getInputSizeAttr(); + uint64_t getInputSize(); + ::mlir::FloatAttr getQuantizationConfigLowAttr(); + ::std::optional< ::llvm::APFloat > getQuantizationConfigLow(); + ::mlir::FloatAttr getQuantizationConfigHighAttr(); + ::std::optional< ::llvm::APFloat > getQuantizationConfigHigh(); + ::mlir::IntegerAttr getQuantizationConfigNumBucketsAttr(); + ::std::optional getQuantizationConfigNumBuckets(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + void setInputSizeAttr(::mlir::IntegerAttr attr); + void setInputSize(uint64_t attrValue); + void setQuantizationConfigLowAttr(::mlir::FloatAttr attr); + void setQuantizationConfigLow(::std::optional<::llvm::APFloat> attrValue); + void setQuantizationConfigHighAttr(::mlir::FloatAttr attr); + void setQuantizationConfigHigh(::std::optional<::llvm::APFloat> attrValue); + void setQuantizationConfigNumBucketsAttr(::mlir::IntegerAttr attr); + void setQuantizationConfigNumBuckets(::std::optional attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::llvm::StringRef attrValue); + ::mlir::Attribute removeQuantizationConfigLowAttr(); + ::mlir::Attribute removeQuantizationConfigHighAttr(); + ::mlir::Attribute removeQuantizationConfigNumBucketsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type activations, ::mlir::Value row_pointers, ::mlir::Value sorted_sample_ids, ::mlir::Value sorted_token_ids, ::mlir::Value sorted_gains, ::mlir::Value embedding_table, ::mlir::Value num_minibatches_per_physical_sparse_core, ::mlir::IntegerAttr input_size, /*optional*/::mlir::FloatAttr quantization_config_low, /*optional*/::mlir::FloatAttr quantization_config_high, /*optional*/::mlir::IntegerAttr quantization_config_num_buckets, ::mlir::StringAttr table_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value row_pointers, ::mlir::Value sorted_sample_ids, ::mlir::Value sorted_token_ids, ::mlir::Value sorted_gains, ::mlir::Value embedding_table, ::mlir::Value num_minibatches_per_physical_sparse_core, ::mlir::IntegerAttr input_size, /*optional*/::mlir::FloatAttr quantization_config_low, /*optional*/::mlir::FloatAttr quantization_config_high, /*optional*/::mlir::IntegerAttr quantization_config_num_buckets, ::mlir::StringAttr table_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type activations, ::mlir::Value row_pointers, ::mlir::Value sorted_sample_ids, ::mlir::Value sorted_token_ids, ::mlir::Value sorted_gains, ::mlir::Value embedding_table, ::mlir::Value num_minibatches_per_physical_sparse_core, uint64_t input_size, /*optional*/::mlir::FloatAttr quantization_config_low, /*optional*/::mlir::FloatAttr quantization_config_high, /*optional*/::mlir::IntegerAttr quantization_config_num_buckets, ::llvm::StringRef table_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value row_pointers, ::mlir::Value sorted_sample_ids, ::mlir::Value sorted_token_ids, ::mlir::Value sorted_gains, ::mlir::Value embedding_table, ::mlir::Value num_minibatches_per_physical_sparse_core, uint64_t input_size, /*optional*/::mlir::FloatAttr quantization_config_low, /*optional*/::mlir::FloatAttr quantization_config_high, /*optional*/::mlir::IntegerAttr quantization_config_num_buckets, ::llvm::StringRef table_name); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaSparseDenseMatmulWithCsrInputOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaSpmdFullToShardShapeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaSpmdFullToShardShapeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaSpmdFullToShardShapeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaSpmdFullToShardShapeOpGenericAdaptorBase(XlaSpmdFullToShardShapeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getManualShardingAttr(); + ::llvm::StringRef getManualSharding(); + ::mlir::IntegerAttr getDimAttr(); + uint64_t getDim(); + ::mlir::ArrayAttr getUnspecifiedDimsAttr(); + ::mlir::ArrayAttr getUnspecifiedDims(); +}; +} // namespace detail +template +class XlaSpmdFullToShardShapeOpGenericAdaptor : public detail::XlaSpmdFullToShardShapeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaSpmdFullToShardShapeOpGenericAdaptorBase; +public: + XlaSpmdFullToShardShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaSpmdFullToShardShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaSpmdFullToShardShapeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaSpmdFullToShardShapeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaSpmdFullToShardShapeOpAdaptor : public XlaSpmdFullToShardShapeOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaSpmdFullToShardShapeOpGenericAdaptor::XlaSpmdFullToShardShapeOpGenericAdaptor; + XlaSpmdFullToShardShapeOpAdaptor(XlaSpmdFullToShardShapeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaSpmdFullToShardShapeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaSpmdFullToShardShapeOpAdaptor; + template + using GenericAdaptor = XlaSpmdFullToShardShapeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("dim"), ::llvm::StringRef("manual_sharding"), ::llvm::StringRef("unspecified_dims")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDimAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDimAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getManualShardingAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getManualShardingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getUnspecifiedDimsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getUnspecifiedDimsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaSpmdFullToShardShape"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::StringAttr getManualShardingAttr(); + ::llvm::StringRef getManualSharding(); + ::mlir::IntegerAttr getDimAttr(); + uint64_t getDim(); + ::mlir::ArrayAttr getUnspecifiedDimsAttr(); + ::mlir::ArrayAttr getUnspecifiedDims(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setManualShardingAttr(::mlir::StringAttr attr); + void setManualSharding(::llvm::StringRef attrValue); + void setDimAttr(::mlir::IntegerAttr attr); + void setDim(::std::optional attrValue); + void setUnspecifiedDimsAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeDimAttr(); + ::mlir::Attribute removeUnspecifiedDimsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::StringAttr manual_sharding, /*optional*/::mlir::IntegerAttr dim, /*optional*/::mlir::ArrayAttr unspecified_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::StringAttr manual_sharding, /*optional*/::mlir::IntegerAttr dim, /*optional*/::mlir::ArrayAttr unspecified_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::llvm::StringRef manual_sharding, /*optional*/uint64_t dim, /*optional*/::mlir::ArrayAttr unspecified_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::llvm::StringRef manual_sharding, /*optional*/uint64_t dim, /*optional*/::mlir::ArrayAttr unspecified_dims); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaSpmdFullToShardShapeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaSpmdShardToFullShapeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaSpmdShardToFullShapeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaSpmdShardToFullShapeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaSpmdShardToFullShapeOpGenericAdaptorBase(XlaSpmdShardToFullShapeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getManualShardingAttr(); + ::llvm::StringRef getManualSharding(); + ::mlir::Attribute getFullShapeAttr(); + std::optional> getFullShape(); + ::mlir::IntegerAttr getDimAttr(); + uint64_t getDim(); + ::mlir::ArrayAttr getUnspecifiedDimsAttr(); + ::mlir::ArrayAttr getUnspecifiedDims(); +}; +} // namespace detail +template +class XlaSpmdShardToFullShapeOpGenericAdaptor : public detail::XlaSpmdShardToFullShapeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaSpmdShardToFullShapeOpGenericAdaptorBase; +public: + XlaSpmdShardToFullShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaSpmdShardToFullShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaSpmdShardToFullShapeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaSpmdShardToFullShapeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaSpmdShardToFullShapeOpAdaptor : public XlaSpmdShardToFullShapeOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaSpmdShardToFullShapeOpGenericAdaptor::XlaSpmdShardToFullShapeOpGenericAdaptor; + XlaSpmdShardToFullShapeOpAdaptor(XlaSpmdShardToFullShapeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaSpmdShardToFullShapeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaSpmdShardToFullShapeOpAdaptor; + template + using GenericAdaptor = XlaSpmdShardToFullShapeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("dim"), ::llvm::StringRef("full_shape"), ::llvm::StringRef("manual_sharding"), ::llvm::StringRef("unspecified_dims")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDimAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDimAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getFullShapeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getFullShapeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getManualShardingAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getManualShardingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getUnspecifiedDimsAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getUnspecifiedDimsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaSpmdShardToFullShape"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::StringAttr getManualShardingAttr(); + ::llvm::StringRef getManualSharding(); + ::mlir::Attribute getFullShapeAttr(); + std::optional> getFullShape(); + ::mlir::IntegerAttr getDimAttr(); + uint64_t getDim(); + ::mlir::ArrayAttr getUnspecifiedDimsAttr(); + ::mlir::ArrayAttr getUnspecifiedDims(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setManualShardingAttr(::mlir::StringAttr attr); + void setManualSharding(::llvm::StringRef attrValue); + void setFullShapeAttr(::mlir::Attribute attr); + void setFullShape(std::optional> attrValue); + void setDimAttr(::mlir::IntegerAttr attr); + void setDim(::std::optional attrValue); + void setUnspecifiedDimsAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeDimAttr(); + ::mlir::Attribute removeUnspecifiedDimsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::StringAttr manual_sharding, ::mlir::Attribute full_shape, /*optional*/::mlir::IntegerAttr dim, /*optional*/::mlir::ArrayAttr unspecified_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::StringAttr manual_sharding, ::mlir::Attribute full_shape, /*optional*/::mlir::IntegerAttr dim, /*optional*/::mlir::ArrayAttr unspecified_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::llvm::StringRef manual_sharding, std::optional> full_shape, /*optional*/uint64_t dim, /*optional*/::mlir::ArrayAttr unspecified_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::llvm::StringRef manual_sharding, std::optional> full_shape, /*optional*/uint64_t dim, /*optional*/::mlir::ArrayAttr unspecified_dims); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaSpmdShardToFullShapeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaSvdOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaSvdOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaSvdOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaSvdOpGenericAdaptorBase(XlaSvdOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getMaxIterAttr(); + uint64_t getMaxIter(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::StringAttr getPrecisionConfigAttr(); + ::llvm::StringRef getPrecisionConfig(); +}; +} // namespace detail +template +class XlaSvdOpGenericAdaptor : public detail::XlaSvdOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaSvdOpGenericAdaptorBase; +public: + XlaSvdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaSvdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaSvdOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaSvdOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaSvdOpAdaptor : public XlaSvdOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaSvdOpGenericAdaptor::XlaSvdOpGenericAdaptor; + XlaSvdOpAdaptor(XlaSvdOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaSvdOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaSvdOpAdaptor; + template + using GenericAdaptor = XlaSvdOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("epsilon"), ::llvm::StringRef("max_iter"), ::llvm::StringRef("precision_config")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getEpsilonAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getEpsilonAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getMaxIterAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getMaxIterAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getPrecisionConfigAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getPrecisionConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaSvd"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getA(); + ::mlir::OpOperand &getAMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getS(); + ::mlir::TypedValue<::mlir::TensorType> getU(); + ::mlir::TypedValue<::mlir::TensorType> getV(); + ::mlir::IntegerAttr getMaxIterAttr(); + uint64_t getMaxIter(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::StringAttr getPrecisionConfigAttr(); + ::llvm::StringRef getPrecisionConfig(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setMaxIterAttr(::mlir::IntegerAttr attr); + void setMaxIter(uint64_t attrValue); + void setEpsilonAttr(::mlir::FloatAttr attr); + void setEpsilon(::llvm::APFloat attrValue); + void setPrecisionConfigAttr(::mlir::StringAttr attr); + void setPrecisionConfig(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type s, ::mlir::Type u, ::mlir::Type v, ::mlir::Value a, ::mlir::IntegerAttr max_iter, ::mlir::FloatAttr epsilon, ::mlir::StringAttr precision_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::IntegerAttr max_iter, ::mlir::FloatAttr epsilon, ::mlir::StringAttr precision_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type s, ::mlir::Type u, ::mlir::Type v, ::mlir::Value a, uint64_t max_iter, ::llvm::APFloat epsilon, ::llvm::StringRef precision_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, uint64_t max_iter, ::llvm::APFloat epsilon, ::llvm::StringRef precision_config); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaSvdOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaVariadicReduceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaVariadicReduceOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaVariadicReduceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaVariadicReduceOpGenericAdaptorBase(XlaVariadicReduceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getDimensionsToReduceAttr(); + ::mlir::ArrayAttr getDimensionsToReduce(); + ::mlir::SymbolRefAttr getReducerAttr(); + ::mlir::SymbolRefAttr getReducer(); +}; +} // namespace detail +template +class XlaVariadicReduceOpGenericAdaptor : public detail::XlaVariadicReduceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaVariadicReduceOpGenericAdaptorBase; +public: + XlaVariadicReduceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaVariadicReduceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaVariadicReduceOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaVariadicReduceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInput() { + return getODSOperands(0); + } + + RangeT getInitValue() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaVariadicReduceOpAdaptor : public XlaVariadicReduceOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaVariadicReduceOpGenericAdaptor::XlaVariadicReduceOpGenericAdaptor; + XlaVariadicReduceOpAdaptor(XlaVariadicReduceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaVariadicReduceOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaVariadicReduceOpAdaptor; + template + using GenericAdaptor = XlaVariadicReduceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("N"), ::llvm::StringRef("T"), ::llvm::StringRef("dimensions_to_reduce"), ::llvm::StringRef("reducer")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDimensionsToReduceAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDimensionsToReduceAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getReducerAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getReducerAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaVariadicReduce"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInput(); + ::mlir::Operation::operand_range getInitValue(); + ::mlir::MutableOperandRange getInputMutable(); + ::mlir::MutableOperandRange getInitValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutput(); + ::mlir::ArrayAttr getDimensionsToReduceAttr(); + ::mlir::ArrayAttr getDimensionsToReduce(); + ::mlir::SymbolRefAttr getReducerAttr(); + ::mlir::SymbolRefAttr getReducer(); + size_t getN(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setDimensionsToReduceAttr(::mlir::ArrayAttr attr); + void setReducerAttr(::mlir::SymbolRefAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange output, ::mlir::ValueRange input, ::mlir::ValueRange init_value, ::mlir::ArrayAttr dimensions_to_reduce, ::mlir::SymbolRefAttr reducer); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaVariadicReduceOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaVariadicReduceV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaVariadicReduceV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaVariadicReduceV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaVariadicReduceV2OpGenericAdaptorBase(XlaVariadicReduceV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getDimensionsToReduceAttr(); + ::mlir::ArrayAttr getDimensionsToReduce(); + ::mlir::SymbolRefAttr getReducerAttr(); + ::mlir::SymbolRefAttr getReducer(); +}; +} // namespace detail +template +class XlaVariadicReduceV2OpGenericAdaptor : public detail::XlaVariadicReduceV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaVariadicReduceV2OpGenericAdaptorBase; +public: + XlaVariadicReduceV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaVariadicReduceV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaVariadicReduceV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaVariadicReduceV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getInitValues() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaVariadicReduceV2OpAdaptor : public XlaVariadicReduceV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaVariadicReduceV2OpGenericAdaptor::XlaVariadicReduceV2OpGenericAdaptor; + XlaVariadicReduceV2OpAdaptor(XlaVariadicReduceV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaVariadicReduceV2Op : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaVariadicReduceV2OpAdaptor; + template + using GenericAdaptor = XlaVariadicReduceV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("dimensions_to_reduce"), ::llvm::StringRef("operandSegmentSizes"), ::llvm::StringRef("reducer")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDimensionsToReduceAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDimensionsToReduceAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getReducerAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getReducerAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaVariadicReduceV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getInitValues(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getInitValuesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutputs(); + ::mlir::ArrayAttr getDimensionsToReduceAttr(); + ::mlir::ArrayAttr getDimensionsToReduce(); + ::mlir::SymbolRefAttr getReducerAttr(); + ::mlir::SymbolRefAttr getReducer(); + mlir::OperandElementTypeRange getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setDimensionsToReduceAttr(::mlir::ArrayAttr attr); + void setReducerAttr(::mlir::SymbolRefAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outputs, ::mlir::ValueRange inputs, ::mlir::ValueRange init_values, ::mlir::ArrayAttr dimensions_to_reduce, ::mlir::SymbolRefAttr reducer); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaVariadicReduceV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaVariadicSortOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaVariadicSortOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaVariadicSortOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaVariadicSortOpGenericAdaptorBase(XlaVariadicSortOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::SymbolRefAttr getComparatorAttr(); + ::mlir::SymbolRefAttr getComparator(); + ::mlir::BoolAttr getIsStableAttr(); + bool getIsStable(); +}; +} // namespace detail +template +class XlaVariadicSortOpGenericAdaptor : public detail::XlaVariadicSortOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaVariadicSortOpGenericAdaptorBase; +public: + XlaVariadicSortOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaVariadicSortOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaVariadicSortOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaVariadicSortOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + ValueT getDimension() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaVariadicSortOpAdaptor : public XlaVariadicSortOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaVariadicSortOpGenericAdaptor::XlaVariadicSortOpGenericAdaptor; + XlaVariadicSortOpAdaptor(XlaVariadicSortOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaVariadicSortOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaVariadicSortOpAdaptor; + template + using GenericAdaptor = XlaVariadicSortOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("comparator"), ::llvm::StringRef("is_stable")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getComparatorAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getComparatorAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getIsStableAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getIsStableAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaVariadicSort"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::TypedValue<::mlir::TensorType> getDimension(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::OpOperand &getDimensionMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutputs(); + ::mlir::SymbolRefAttr getComparatorAttr(); + ::mlir::SymbolRefAttr getComparator(); + ::mlir::BoolAttr getIsStableAttr(); + bool getIsStable(); + mlir::OperandElementTypeRange getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setComparatorAttr(::mlir::SymbolRefAttr attr); + void setIsStableAttr(::mlir::BoolAttr attr); + void setIsStable(bool attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outputs, ::mlir::ValueRange inputs, ::mlir::Value dimension, ::mlir::SymbolRefAttr comparator, ::mlir::BoolAttr is_stable); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outputs, ::mlir::ValueRange inputs, ::mlir::Value dimension, ::mlir::SymbolRefAttr comparator, bool is_stable); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaVariadicSortOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::Xlog1pyOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Xlog1pyOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + Xlog1pyOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + Xlog1pyOpGenericAdaptorBase(Xlog1pyOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class Xlog1pyOpGenericAdaptor : public detail::Xlog1pyOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Xlog1pyOpGenericAdaptorBase; +public: + Xlog1pyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Xlog1pyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Xlog1pyOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + Xlog1pyOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Xlog1pyOpAdaptor : public Xlog1pyOpGenericAdaptor<::mlir::ValueRange> { +public: + using Xlog1pyOpGenericAdaptor::Xlog1pyOpGenericAdaptor; + Xlog1pyOpAdaptor(Xlog1pyOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Xlog1pyOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::SameOperandsAndResultElementTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = Xlog1pyOpAdaptor; + template + using GenericAdaptor = Xlog1pyOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Xlog1py"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::Xlog1pyOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlogyOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlogyOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlogyOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlogyOpGenericAdaptorBase(XlogyOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class XlogyOpGenericAdaptor : public detail::XlogyOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlogyOpGenericAdaptorBase; +public: + XlogyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlogyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlogyOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlogyOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getY() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlogyOpAdaptor : public XlogyOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlogyOpGenericAdaptor::XlogyOpGenericAdaptor; + XlogyOpAdaptor(XlogyOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlogyOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::OpTrait::TF::SameOperandsAndResultElementTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlogyOpAdaptor; + template + using GenericAdaptor = XlogyOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Xlogy"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getYMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value y); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlogyOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::YieldOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class YieldOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + YieldOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + YieldOpGenericAdaptorBase(YieldOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class YieldOpGenericAdaptor : public detail::YieldOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::YieldOpGenericAdaptorBase; +public: + YieldOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + YieldOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : YieldOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + YieldOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class YieldOpAdaptor : public YieldOpGenericAdaptor<::mlir::ValueRange> { +public: + using YieldOpGenericAdaptor::YieldOpGenericAdaptor; + YieldOpAdaptor(YieldOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class YieldOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsTerminator, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ReturnLike, ::mlir::RegionBranchTerminatorOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = YieldOpAdaptor; + template + using GenericAdaptor = YieldOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Yield"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange odsArg_0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::MutableOperandRange getMutableSuccessorOperands(::mlir::RegionBranchPoint point); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::YieldOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ZerosLikeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ZerosLikeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ZerosLikeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ZerosLikeOpGenericAdaptorBase(ZerosLikeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ZerosLikeOpGenericAdaptor : public detail::ZerosLikeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ZerosLikeOpGenericAdaptorBase; +public: + ZerosLikeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ZerosLikeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ZerosLikeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ZerosLikeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ZerosLikeOpAdaptor : public ZerosLikeOpGenericAdaptor<::mlir::ValueRange> { +public: + using ZerosLikeOpGenericAdaptor::ZerosLikeOpGenericAdaptor; + ZerosLikeOpAdaptor(ZerosLikeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ZerosLikeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::IsIdempotent, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ZerosLikeOpAdaptor; + template + using GenericAdaptor = ZerosLikeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.ZerosLike"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ZerosLikeOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::ZetaOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ZetaOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ZetaOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ZetaOpGenericAdaptorBase(ZetaOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ZetaOpGenericAdaptor : public detail::ZetaOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ZetaOpGenericAdaptorBase; +public: + ZetaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ZetaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ZetaOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ZetaOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getQ() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ZetaOpAdaptor : public ZetaOpGenericAdaptor<::mlir::ValueRange> { +public: + using ZetaOpGenericAdaptor::ZetaOpGenericAdaptor; + ZetaOpAdaptor(ZetaOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ZetaOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::ResultsBroadcastableShape, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ZetaOpAdaptor; + template + using GenericAdaptor = ZetaOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.Zeta"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getQ(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getQMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getZ(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value x, Value y); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type z, ::mlir::Value x, ::mlir::Value q); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value q); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::ZetaOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaSparseDenseMatmulGradWithAdagradAndCsrInputOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaSparseDenseMatmulGradWithAdagradAndCsrInputOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaSparseDenseMatmulGradWithAdagradAndCsrInputOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaSparseDenseMatmulGradWithAdagradAndCsrInputOpGenericAdaptorBase(XlaSparseDenseMatmulGradWithAdagradAndCsrInputOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); +}; +} // namespace detail +template +class XlaSparseDenseMatmulGradWithAdagradAndCsrInputOpGenericAdaptor : public detail::XlaSparseDenseMatmulGradWithAdagradAndCsrInputOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaSparseDenseMatmulGradWithAdagradAndCsrInputOpGenericAdaptorBase; +public: + XlaSparseDenseMatmulGradWithAdagradAndCsrInputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaSparseDenseMatmulGradWithAdagradAndCsrInputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaSparseDenseMatmulGradWithAdagradAndCsrInputOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaSparseDenseMatmulGradWithAdagradAndCsrInputOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getRowPointers() { + return (*getODSOperands(0).begin()); + } + + ValueT getSortedSampleIds() { + return (*getODSOperands(1).begin()); + } + + ValueT getSortedTokenIds() { + return (*getODSOperands(2).begin()); + } + + ValueT getSortedGains() { + return (*getODSOperands(3).begin()); + } + + ValueT getActivationGradients() { + return (*getODSOperands(4).begin()); + } + + ValueT getLearningRate() { + return (*getODSOperands(5).begin()); + } + + ValueT getEmbeddingTable() { + return (*getODSOperands(6).begin()); + } + + ValueT getAccumulator() { + return (*getODSOperands(7).begin()); + } + + ValueT getNumMinibatchesPerPhysicalSparseCore() { + return (*getODSOperands(8).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaSparseDenseMatmulGradWithAdagradAndCsrInputOpAdaptor : public XlaSparseDenseMatmulGradWithAdagradAndCsrInputOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaSparseDenseMatmulGradWithAdagradAndCsrInputOpGenericAdaptor::XlaSparseDenseMatmulGradWithAdagradAndCsrInputOpGenericAdaptor; + XlaSparseDenseMatmulGradWithAdagradAndCsrInputOpAdaptor(XlaSparseDenseMatmulGradWithAdagradAndCsrInputOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaSparseDenseMatmulGradWithAdagradAndCsrInputOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<9>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaSparseDenseMatmulGradWithAdagradAndCsrInputOpAdaptor; + template + using GenericAdaptor = XlaSparseDenseMatmulGradWithAdagradAndCsrInputOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaSparseDenseMatmulGradWithAdagradAndCsrInput"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getRowPointers(); + ::mlir::TypedValue<::mlir::TensorType> getSortedSampleIds(); + ::mlir::TypedValue<::mlir::TensorType> getSortedTokenIds(); + ::mlir::TypedValue<::mlir::TensorType> getSortedGains(); + ::mlir::TypedValue<::mlir::TensorType> getActivationGradients(); + ::mlir::TypedValue<::mlir::TensorType> getLearningRate(); + ::mlir::TypedValue<::mlir::TensorType> getEmbeddingTable(); + ::mlir::TypedValue<::mlir::TensorType> getAccumulator(); + ::mlir::TypedValue<::mlir::TensorType> getNumMinibatchesPerPhysicalSparseCore(); + ::mlir::OpOperand &getRowPointersMutable(); + ::mlir::OpOperand &getSortedSampleIdsMutable(); + ::mlir::OpOperand &getSortedTokenIdsMutable(); + ::mlir::OpOperand &getSortedGainsMutable(); + ::mlir::OpOperand &getActivationGradientsMutable(); + ::mlir::OpOperand &getLearningRateMutable(); + ::mlir::OpOperand &getEmbeddingTableMutable(); + ::mlir::OpOperand &getAccumulatorMutable(); + ::mlir::OpOperand &getNumMinibatchesPerPhysicalSparseCoreMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getUpdatedEmbeddingTable(); + ::mlir::TypedValue<::mlir::TensorType> getUpdatedAccumulator(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type updated_embedding_table, ::mlir::Type updated_accumulator, ::mlir::Value row_pointers, ::mlir::Value sorted_sample_ids, ::mlir::Value sorted_token_ids, ::mlir::Value sorted_gains, ::mlir::Value activation_gradients, ::mlir::Value learning_rate, ::mlir::Value embedding_table, ::mlir::Value accumulator, ::mlir::Value num_minibatches_per_physical_sparse_core, ::mlir::StringAttr table_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value row_pointers, ::mlir::Value sorted_sample_ids, ::mlir::Value sorted_token_ids, ::mlir::Value sorted_gains, ::mlir::Value activation_gradients, ::mlir::Value learning_rate, ::mlir::Value embedding_table, ::mlir::Value accumulator, ::mlir::Value num_minibatches_per_physical_sparse_core, ::mlir::StringAttr table_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type updated_embedding_table, ::mlir::Type updated_accumulator, ::mlir::Value row_pointers, ::mlir::Value sorted_sample_ids, ::mlir::Value sorted_token_ids, ::mlir::Value sorted_gains, ::mlir::Value activation_gradients, ::mlir::Value learning_rate, ::mlir::Value embedding_table, ::mlir::Value accumulator, ::mlir::Value num_minibatches_per_physical_sparse_core, ::llvm::StringRef table_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value row_pointers, ::mlir::Value sorted_sample_ids, ::mlir::Value sorted_token_ids, ::mlir::Value sorted_gains, ::mlir::Value activation_gradients, ::mlir::Value learning_rate, ::mlir::Value embedding_table, ::mlir::Value accumulator, ::mlir::Value num_minibatches_per_physical_sparse_core, ::llvm::StringRef table_name); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaSparseDenseMatmulGradWithAdagradAndCsrInputOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaSparseDenseMatmulGradWithAdagradMomentumAndCsrInputOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaSparseDenseMatmulGradWithAdagradMomentumAndCsrInputOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaSparseDenseMatmulGradWithAdagradMomentumAndCsrInputOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaSparseDenseMatmulGradWithAdagradMomentumAndCsrInputOpGenericAdaptorBase(XlaSparseDenseMatmulGradWithAdagradMomentumAndCsrInputOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getUseNesterovAttr(); + bool getUseNesterov(); + ::mlir::FloatAttr getExponentAttr(); + ::llvm::APFloat getExponent(); + ::mlir::FloatAttr getBeta1Attr(); + ::llvm::APFloat getBeta1(); + ::mlir::FloatAttr getBeta2Attr(); + ::llvm::APFloat getBeta2(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); +}; +} // namespace detail +template +class XlaSparseDenseMatmulGradWithAdagradMomentumAndCsrInputOpGenericAdaptor : public detail::XlaSparseDenseMatmulGradWithAdagradMomentumAndCsrInputOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaSparseDenseMatmulGradWithAdagradMomentumAndCsrInputOpGenericAdaptorBase; +public: + XlaSparseDenseMatmulGradWithAdagradMomentumAndCsrInputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaSparseDenseMatmulGradWithAdagradMomentumAndCsrInputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaSparseDenseMatmulGradWithAdagradMomentumAndCsrInputOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaSparseDenseMatmulGradWithAdagradMomentumAndCsrInputOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getRowPointers() { + return (*getODSOperands(0).begin()); + } + + ValueT getSortedSampleIds() { + return (*getODSOperands(1).begin()); + } + + ValueT getSortedTokenIds() { + return (*getODSOperands(2).begin()); + } + + ValueT getSortedGains() { + return (*getODSOperands(3).begin()); + } + + ValueT getActivationGradients() { + return (*getODSOperands(4).begin()); + } + + ValueT getLearningRate() { + return (*getODSOperands(5).begin()); + } + + ValueT getEmbeddingTable() { + return (*getODSOperands(6).begin()); + } + + ValueT getAccumulator() { + return (*getODSOperands(7).begin()); + } + + ValueT getMomenta() { + return (*getODSOperands(8).begin()); + } + + ValueT getNumMinibatchesPerPhysicalSparseCore() { + return (*getODSOperands(9).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaSparseDenseMatmulGradWithAdagradMomentumAndCsrInputOpAdaptor : public XlaSparseDenseMatmulGradWithAdagradMomentumAndCsrInputOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaSparseDenseMatmulGradWithAdagradMomentumAndCsrInputOpGenericAdaptor::XlaSparseDenseMatmulGradWithAdagradMomentumAndCsrInputOpGenericAdaptor; + XlaSparseDenseMatmulGradWithAdagradMomentumAndCsrInputOpAdaptor(XlaSparseDenseMatmulGradWithAdagradMomentumAndCsrInputOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaSparseDenseMatmulGradWithAdagradMomentumAndCsrInputOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<10>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaSparseDenseMatmulGradWithAdagradMomentumAndCsrInputOpAdaptor; + template + using GenericAdaptor = XlaSparseDenseMatmulGradWithAdagradMomentumAndCsrInputOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("beta1"), ::llvm::StringRef("beta2"), ::llvm::StringRef("epsilon"), ::llvm::StringRef("exponent"), ::llvm::StringRef("table_name"), ::llvm::StringRef("use_nesterov")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBeta1AttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBeta1AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getBeta2AttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getBeta2AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getEpsilonAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getEpsilonAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getExponentAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getExponentAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getUseNesterovAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getUseNesterovAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaSparseDenseMatmulGradWithAdagradMomentumAndCsrInput"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getRowPointers(); + ::mlir::TypedValue<::mlir::TensorType> getSortedSampleIds(); + ::mlir::TypedValue<::mlir::TensorType> getSortedTokenIds(); + ::mlir::TypedValue<::mlir::TensorType> getSortedGains(); + ::mlir::TypedValue<::mlir::TensorType> getActivationGradients(); + ::mlir::TypedValue<::mlir::TensorType> getLearningRate(); + ::mlir::TypedValue<::mlir::TensorType> getEmbeddingTable(); + ::mlir::TypedValue<::mlir::TensorType> getAccumulator(); + ::mlir::TypedValue<::mlir::TensorType> getMomenta(); + ::mlir::TypedValue<::mlir::TensorType> getNumMinibatchesPerPhysicalSparseCore(); + ::mlir::OpOperand &getRowPointersMutable(); + ::mlir::OpOperand &getSortedSampleIdsMutable(); + ::mlir::OpOperand &getSortedTokenIdsMutable(); + ::mlir::OpOperand &getSortedGainsMutable(); + ::mlir::OpOperand &getActivationGradientsMutable(); + ::mlir::OpOperand &getLearningRateMutable(); + ::mlir::OpOperand &getEmbeddingTableMutable(); + ::mlir::OpOperand &getAccumulatorMutable(); + ::mlir::OpOperand &getMomentaMutable(); + ::mlir::OpOperand &getNumMinibatchesPerPhysicalSparseCoreMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getUpdatedEmbeddingTable(); + ::mlir::TypedValue<::mlir::TensorType> getUpdatedAccumulator(); + ::mlir::TypedValue<::mlir::TensorType> getUpdatedMomenta(); + ::mlir::BoolAttr getUseNesterovAttr(); + bool getUseNesterov(); + ::mlir::FloatAttr getExponentAttr(); + ::llvm::APFloat getExponent(); + ::mlir::FloatAttr getBeta1Attr(); + ::llvm::APFloat getBeta1(); + ::mlir::FloatAttr getBeta2Attr(); + ::llvm::APFloat getBeta2(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + void setUseNesterovAttr(::mlir::BoolAttr attr); + void setUseNesterov(bool attrValue); + void setExponentAttr(::mlir::FloatAttr attr); + void setExponent(::llvm::APFloat attrValue); + void setBeta1Attr(::mlir::FloatAttr attr); + void setBeta1(::llvm::APFloat attrValue); + void setBeta2Attr(::mlir::FloatAttr attr); + void setBeta2(::llvm::APFloat attrValue); + void setEpsilonAttr(::mlir::FloatAttr attr); + void setEpsilon(::llvm::APFloat attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type updated_embedding_table, ::mlir::Type updated_accumulator, ::mlir::Type updated_momenta, ::mlir::Value row_pointers, ::mlir::Value sorted_sample_ids, ::mlir::Value sorted_token_ids, ::mlir::Value sorted_gains, ::mlir::Value activation_gradients, ::mlir::Value learning_rate, ::mlir::Value embedding_table, ::mlir::Value accumulator, ::mlir::Value momenta, ::mlir::Value num_minibatches_per_physical_sparse_core, ::mlir::BoolAttr use_nesterov, ::mlir::FloatAttr exponent, ::mlir::FloatAttr beta1, ::mlir::FloatAttr beta2, ::mlir::FloatAttr epsilon, ::mlir::StringAttr table_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value row_pointers, ::mlir::Value sorted_sample_ids, ::mlir::Value sorted_token_ids, ::mlir::Value sorted_gains, ::mlir::Value activation_gradients, ::mlir::Value learning_rate, ::mlir::Value embedding_table, ::mlir::Value accumulator, ::mlir::Value momenta, ::mlir::Value num_minibatches_per_physical_sparse_core, ::mlir::BoolAttr use_nesterov, ::mlir::FloatAttr exponent, ::mlir::FloatAttr beta1, ::mlir::FloatAttr beta2, ::mlir::FloatAttr epsilon, ::mlir::StringAttr table_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type updated_embedding_table, ::mlir::Type updated_accumulator, ::mlir::Type updated_momenta, ::mlir::Value row_pointers, ::mlir::Value sorted_sample_ids, ::mlir::Value sorted_token_ids, ::mlir::Value sorted_gains, ::mlir::Value activation_gradients, ::mlir::Value learning_rate, ::mlir::Value embedding_table, ::mlir::Value accumulator, ::mlir::Value momenta, ::mlir::Value num_minibatches_per_physical_sparse_core, bool use_nesterov, ::llvm::APFloat exponent, ::llvm::APFloat beta1, ::llvm::APFloat beta2, ::llvm::APFloat epsilon, ::llvm::StringRef table_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value row_pointers, ::mlir::Value sorted_sample_ids, ::mlir::Value sorted_token_ids, ::mlir::Value sorted_gains, ::mlir::Value activation_gradients, ::mlir::Value learning_rate, ::mlir::Value embedding_table, ::mlir::Value accumulator, ::mlir::Value momenta, ::mlir::Value num_minibatches_per_physical_sparse_core, bool use_nesterov, ::llvm::APFloat exponent, ::llvm::APFloat beta1, ::llvm::APFloat beta2, ::llvm::APFloat epsilon, ::llvm::StringRef table_name); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaSparseDenseMatmulGradWithAdagradMomentumAndCsrInputOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaSparseDenseMatmulGradWithAdamAndCsrInputOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaSparseDenseMatmulGradWithAdamAndCsrInputOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaSparseDenseMatmulGradWithAdamAndCsrInputOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaSparseDenseMatmulGradWithAdamAndCsrInputOpGenericAdaptorBase(XlaSparseDenseMatmulGradWithAdamAndCsrInputOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getUseSumInsideSqrtAttr(); + bool getUseSumInsideSqrt(); + ::mlir::FloatAttr getBeta1Attr(); + ::llvm::APFloat getBeta1(); + ::mlir::FloatAttr getBeta2Attr(); + ::llvm::APFloat getBeta2(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); +}; +} // namespace detail +template +class XlaSparseDenseMatmulGradWithAdamAndCsrInputOpGenericAdaptor : public detail::XlaSparseDenseMatmulGradWithAdamAndCsrInputOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaSparseDenseMatmulGradWithAdamAndCsrInputOpGenericAdaptorBase; +public: + XlaSparseDenseMatmulGradWithAdamAndCsrInputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaSparseDenseMatmulGradWithAdamAndCsrInputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaSparseDenseMatmulGradWithAdamAndCsrInputOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaSparseDenseMatmulGradWithAdamAndCsrInputOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getRowPointers() { + return (*getODSOperands(0).begin()); + } + + ValueT getSortedSampleIds() { + return (*getODSOperands(1).begin()); + } + + ValueT getSortedTokenIds() { + return (*getODSOperands(2).begin()); + } + + ValueT getSortedGains() { + return (*getODSOperands(3).begin()); + } + + ValueT getActivationGradients() { + return (*getODSOperands(4).begin()); + } + + ValueT getLearningRate() { + return (*getODSOperands(5).begin()); + } + + ValueT getEmbeddingTable() { + return (*getODSOperands(6).begin()); + } + + ValueT getMomenta() { + return (*getODSOperands(7).begin()); + } + + ValueT getVelocity() { + return (*getODSOperands(8).begin()); + } + + ValueT getNumMinibatchesPerPhysicalSparseCore() { + return (*getODSOperands(9).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaSparseDenseMatmulGradWithAdamAndCsrInputOpAdaptor : public XlaSparseDenseMatmulGradWithAdamAndCsrInputOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaSparseDenseMatmulGradWithAdamAndCsrInputOpGenericAdaptor::XlaSparseDenseMatmulGradWithAdamAndCsrInputOpGenericAdaptor; + XlaSparseDenseMatmulGradWithAdamAndCsrInputOpAdaptor(XlaSparseDenseMatmulGradWithAdamAndCsrInputOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaSparseDenseMatmulGradWithAdamAndCsrInputOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<10>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaSparseDenseMatmulGradWithAdamAndCsrInputOpAdaptor; + template + using GenericAdaptor = XlaSparseDenseMatmulGradWithAdamAndCsrInputOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("beta1"), ::llvm::StringRef("beta2"), ::llvm::StringRef("epsilon"), ::llvm::StringRef("table_name"), ::llvm::StringRef("use_sum_inside_sqrt")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBeta1AttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBeta1AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getBeta2AttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getBeta2AttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getEpsilonAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getEpsilonAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getUseSumInsideSqrtAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getUseSumInsideSqrtAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaSparseDenseMatmulGradWithAdamAndCsrInput"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getRowPointers(); + ::mlir::TypedValue<::mlir::TensorType> getSortedSampleIds(); + ::mlir::TypedValue<::mlir::TensorType> getSortedTokenIds(); + ::mlir::TypedValue<::mlir::TensorType> getSortedGains(); + ::mlir::TypedValue<::mlir::TensorType> getActivationGradients(); + ::mlir::TypedValue<::mlir::TensorType> getLearningRate(); + ::mlir::TypedValue<::mlir::TensorType> getEmbeddingTable(); + ::mlir::TypedValue<::mlir::TensorType> getMomenta(); + ::mlir::TypedValue<::mlir::TensorType> getVelocity(); + ::mlir::TypedValue<::mlir::TensorType> getNumMinibatchesPerPhysicalSparseCore(); + ::mlir::OpOperand &getRowPointersMutable(); + ::mlir::OpOperand &getSortedSampleIdsMutable(); + ::mlir::OpOperand &getSortedTokenIdsMutable(); + ::mlir::OpOperand &getSortedGainsMutable(); + ::mlir::OpOperand &getActivationGradientsMutable(); + ::mlir::OpOperand &getLearningRateMutable(); + ::mlir::OpOperand &getEmbeddingTableMutable(); + ::mlir::OpOperand &getMomentaMutable(); + ::mlir::OpOperand &getVelocityMutable(); + ::mlir::OpOperand &getNumMinibatchesPerPhysicalSparseCoreMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getUpdatedEmbeddingTable(); + ::mlir::TypedValue<::mlir::TensorType> getUpdatedMomenta(); + ::mlir::TypedValue<::mlir::TensorType> getUpdatedVelocity(); + ::mlir::BoolAttr getUseSumInsideSqrtAttr(); + bool getUseSumInsideSqrt(); + ::mlir::FloatAttr getBeta1Attr(); + ::llvm::APFloat getBeta1(); + ::mlir::FloatAttr getBeta2Attr(); + ::llvm::APFloat getBeta2(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + void setUseSumInsideSqrtAttr(::mlir::BoolAttr attr); + void setUseSumInsideSqrt(bool attrValue); + void setBeta1Attr(::mlir::FloatAttr attr); + void setBeta1(::llvm::APFloat attrValue); + void setBeta2Attr(::mlir::FloatAttr attr); + void setBeta2(::llvm::APFloat attrValue); + void setEpsilonAttr(::mlir::FloatAttr attr); + void setEpsilon(::llvm::APFloat attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type updated_embedding_table, ::mlir::Type updated_momenta, ::mlir::Type updated_velocity, ::mlir::Value row_pointers, ::mlir::Value sorted_sample_ids, ::mlir::Value sorted_token_ids, ::mlir::Value sorted_gains, ::mlir::Value activation_gradients, ::mlir::Value learning_rate, ::mlir::Value embedding_table, ::mlir::Value momenta, ::mlir::Value velocity, ::mlir::Value num_minibatches_per_physical_sparse_core, ::mlir::BoolAttr use_sum_inside_sqrt, ::mlir::FloatAttr beta1, ::mlir::FloatAttr beta2, ::mlir::FloatAttr epsilon, ::mlir::StringAttr table_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value row_pointers, ::mlir::Value sorted_sample_ids, ::mlir::Value sorted_token_ids, ::mlir::Value sorted_gains, ::mlir::Value activation_gradients, ::mlir::Value learning_rate, ::mlir::Value embedding_table, ::mlir::Value momenta, ::mlir::Value velocity, ::mlir::Value num_minibatches_per_physical_sparse_core, ::mlir::BoolAttr use_sum_inside_sqrt, ::mlir::FloatAttr beta1, ::mlir::FloatAttr beta2, ::mlir::FloatAttr epsilon, ::mlir::StringAttr table_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type updated_embedding_table, ::mlir::Type updated_momenta, ::mlir::Type updated_velocity, ::mlir::Value row_pointers, ::mlir::Value sorted_sample_ids, ::mlir::Value sorted_token_ids, ::mlir::Value sorted_gains, ::mlir::Value activation_gradients, ::mlir::Value learning_rate, ::mlir::Value embedding_table, ::mlir::Value momenta, ::mlir::Value velocity, ::mlir::Value num_minibatches_per_physical_sparse_core, bool use_sum_inside_sqrt, ::llvm::APFloat beta1, ::llvm::APFloat beta2, ::llvm::APFloat epsilon, ::llvm::StringRef table_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value row_pointers, ::mlir::Value sorted_sample_ids, ::mlir::Value sorted_token_ids, ::mlir::Value sorted_gains, ::mlir::Value activation_gradients, ::mlir::Value learning_rate, ::mlir::Value embedding_table, ::mlir::Value momenta, ::mlir::Value velocity, ::mlir::Value num_minibatches_per_physical_sparse_core, bool use_sum_inside_sqrt, ::llvm::APFloat beta1, ::llvm::APFloat beta2, ::llvm::APFloat epsilon, ::llvm::StringRef table_name); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaSparseDenseMatmulGradWithAdamAndCsrInputOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::XlaSparseDenseMatmulGradWithFtrlAndCsrInputOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaSparseDenseMatmulGradWithFtrlAndCsrInputOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaSparseDenseMatmulGradWithFtrlAndCsrInputOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaSparseDenseMatmulGradWithFtrlAndCsrInputOpGenericAdaptorBase(XlaSparseDenseMatmulGradWithFtrlAndCsrInputOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getMultiplyLinearByLearningRateAttr(); + bool getMultiplyLinearByLearningRate(); + ::mlir::FloatAttr getBetaAttr(); + ::llvm::APFloat getBeta(); + ::mlir::FloatAttr getLearningRatePowerAttr(); + ::llvm::APFloat getLearningRatePower(); + ::mlir::FloatAttr getL1RegularizationStrengthAttr(); + ::llvm::APFloat getL1RegularizationStrength(); + ::mlir::FloatAttr getL2RegularizationStrengthAttr(); + ::llvm::APFloat getL2RegularizationStrength(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); +}; +} // namespace detail +template +class XlaSparseDenseMatmulGradWithFtrlAndCsrInputOpGenericAdaptor : public detail::XlaSparseDenseMatmulGradWithFtrlAndCsrInputOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaSparseDenseMatmulGradWithFtrlAndCsrInputOpGenericAdaptorBase; +public: + XlaSparseDenseMatmulGradWithFtrlAndCsrInputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaSparseDenseMatmulGradWithFtrlAndCsrInputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaSparseDenseMatmulGradWithFtrlAndCsrInputOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaSparseDenseMatmulGradWithFtrlAndCsrInputOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getRowPointers() { + return (*getODSOperands(0).begin()); + } + + ValueT getSortedSampleIds() { + return (*getODSOperands(1).begin()); + } + + ValueT getSortedTokenIds() { + return (*getODSOperands(2).begin()); + } + + ValueT getSortedGains() { + return (*getODSOperands(3).begin()); + } + + ValueT getActivationGradients() { + return (*getODSOperands(4).begin()); + } + + ValueT getLearningRate() { + return (*getODSOperands(5).begin()); + } + + ValueT getEmbeddingTable() { + return (*getODSOperands(6).begin()); + } + + ValueT getAccumulator() { + return (*getODSOperands(7).begin()); + } + + ValueT getLinear() { + return (*getODSOperands(8).begin()); + } + + ValueT getNumMinibatchesPerPhysicalSparseCore() { + return (*getODSOperands(9).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaSparseDenseMatmulGradWithFtrlAndCsrInputOpAdaptor : public XlaSparseDenseMatmulGradWithFtrlAndCsrInputOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaSparseDenseMatmulGradWithFtrlAndCsrInputOpGenericAdaptor::XlaSparseDenseMatmulGradWithFtrlAndCsrInputOpGenericAdaptor; + XlaSparseDenseMatmulGradWithFtrlAndCsrInputOpAdaptor(XlaSparseDenseMatmulGradWithFtrlAndCsrInputOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaSparseDenseMatmulGradWithFtrlAndCsrInputOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<10>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaSparseDenseMatmulGradWithFtrlAndCsrInputOpAdaptor; + template + using GenericAdaptor = XlaSparseDenseMatmulGradWithFtrlAndCsrInputOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("beta"), ::llvm::StringRef("l1_regularization_strength"), ::llvm::StringRef("l2_regularization_strength"), ::llvm::StringRef("learning_rate_power"), ::llvm::StringRef("multiply_linear_by_learning_rate"), ::llvm::StringRef("table_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBetaAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBetaAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getL1RegularizationStrengthAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getL1RegularizationStrengthAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getL2RegularizationStrengthAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getL2RegularizationStrengthAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getLearningRatePowerAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getLearningRatePowerAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getMultiplyLinearByLearningRateAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getMultiplyLinearByLearningRateAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getTableNameAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getTableNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.XlaSparseDenseMatmulGradWithFtrlAndCsrInput"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getRowPointers(); + ::mlir::TypedValue<::mlir::TensorType> getSortedSampleIds(); + ::mlir::TypedValue<::mlir::TensorType> getSortedTokenIds(); + ::mlir::TypedValue<::mlir::TensorType> getSortedGains(); + ::mlir::TypedValue<::mlir::TensorType> getActivationGradients(); + ::mlir::TypedValue<::mlir::TensorType> getLearningRate(); + ::mlir::TypedValue<::mlir::TensorType> getEmbeddingTable(); + ::mlir::TypedValue<::mlir::TensorType> getAccumulator(); + ::mlir::TypedValue<::mlir::TensorType> getLinear(); + ::mlir::TypedValue<::mlir::TensorType> getNumMinibatchesPerPhysicalSparseCore(); + ::mlir::OpOperand &getRowPointersMutable(); + ::mlir::OpOperand &getSortedSampleIdsMutable(); + ::mlir::OpOperand &getSortedTokenIdsMutable(); + ::mlir::OpOperand &getSortedGainsMutable(); + ::mlir::OpOperand &getActivationGradientsMutable(); + ::mlir::OpOperand &getLearningRateMutable(); + ::mlir::OpOperand &getEmbeddingTableMutable(); + ::mlir::OpOperand &getAccumulatorMutable(); + ::mlir::OpOperand &getLinearMutable(); + ::mlir::OpOperand &getNumMinibatchesPerPhysicalSparseCoreMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getUpdatedEmbeddingTable(); + ::mlir::TypedValue<::mlir::TensorType> getUpdatedAccumulator(); + ::mlir::TypedValue<::mlir::TensorType> getUpdatedLinear(); + ::mlir::BoolAttr getMultiplyLinearByLearningRateAttr(); + bool getMultiplyLinearByLearningRate(); + ::mlir::FloatAttr getBetaAttr(); + ::llvm::APFloat getBeta(); + ::mlir::FloatAttr getLearningRatePowerAttr(); + ::llvm::APFloat getLearningRatePower(); + ::mlir::FloatAttr getL1RegularizationStrengthAttr(); + ::llvm::APFloat getL1RegularizationStrength(); + ::mlir::FloatAttr getL2RegularizationStrengthAttr(); + ::llvm::APFloat getL2RegularizationStrength(); + ::mlir::StringAttr getTableNameAttr(); + ::llvm::StringRef getTableName(); + void setMultiplyLinearByLearningRateAttr(::mlir::BoolAttr attr); + void setMultiplyLinearByLearningRate(bool attrValue); + void setBetaAttr(::mlir::FloatAttr attr); + void setBeta(::llvm::APFloat attrValue); + void setLearningRatePowerAttr(::mlir::FloatAttr attr); + void setLearningRatePower(::llvm::APFloat attrValue); + void setL1RegularizationStrengthAttr(::mlir::FloatAttr attr); + void setL1RegularizationStrength(::llvm::APFloat attrValue); + void setL2RegularizationStrengthAttr(::mlir::FloatAttr attr); + void setL2RegularizationStrength(::llvm::APFloat attrValue); + void setTableNameAttr(::mlir::StringAttr attr); + void setTableName(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type updated_embedding_table, ::mlir::Type updated_accumulator, ::mlir::Type updated_linear, ::mlir::Value row_pointers, ::mlir::Value sorted_sample_ids, ::mlir::Value sorted_token_ids, ::mlir::Value sorted_gains, ::mlir::Value activation_gradients, ::mlir::Value learning_rate, ::mlir::Value embedding_table, ::mlir::Value accumulator, ::mlir::Value linear, ::mlir::Value num_minibatches_per_physical_sparse_core, ::mlir::BoolAttr multiply_linear_by_learning_rate, ::mlir::FloatAttr beta, ::mlir::FloatAttr learning_rate_power, ::mlir::FloatAttr l1_regularization_strength, ::mlir::FloatAttr l2_regularization_strength, ::mlir::StringAttr table_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value row_pointers, ::mlir::Value sorted_sample_ids, ::mlir::Value sorted_token_ids, ::mlir::Value sorted_gains, ::mlir::Value activation_gradients, ::mlir::Value learning_rate, ::mlir::Value embedding_table, ::mlir::Value accumulator, ::mlir::Value linear, ::mlir::Value num_minibatches_per_physical_sparse_core, ::mlir::BoolAttr multiply_linear_by_learning_rate, ::mlir::FloatAttr beta, ::mlir::FloatAttr learning_rate_power, ::mlir::FloatAttr l1_regularization_strength, ::mlir::FloatAttr l2_regularization_strength, ::mlir::StringAttr table_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type updated_embedding_table, ::mlir::Type updated_accumulator, ::mlir::Type updated_linear, ::mlir::Value row_pointers, ::mlir::Value sorted_sample_ids, ::mlir::Value sorted_token_ids, ::mlir::Value sorted_gains, ::mlir::Value activation_gradients, ::mlir::Value learning_rate, ::mlir::Value embedding_table, ::mlir::Value accumulator, ::mlir::Value linear, ::mlir::Value num_minibatches_per_physical_sparse_core, bool multiply_linear_by_learning_rate, ::llvm::APFloat beta, ::llvm::APFloat learning_rate_power, ::llvm::APFloat l1_regularization_strength, ::llvm::APFloat l2_regularization_strength, ::llvm::StringRef table_name); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value row_pointers, ::mlir::Value sorted_sample_ids, ::mlir::Value sorted_token_ids, ::mlir::Value sorted_gains, ::mlir::Value activation_gradients, ::mlir::Value learning_rate, ::mlir::Value embedding_table, ::mlir::Value accumulator, ::mlir::Value linear, ::mlir::Value num_minibatches_per_physical_sparse_core, bool multiply_linear_by_learning_rate, ::llvm::APFloat beta, ::llvm::APFloat learning_rate_power, ::llvm::APFloat l1_regularization_strength, ::llvm::APFloat l2_regularization_strength, ::llvm::StringRef table_name); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::XlaSparseDenseMatmulGradWithFtrlAndCsrInputOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_ops_tensor_helper.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_ops_tensor_helper.h new file mode 100644 index 0000000000000000000000000000000000000000..aaf795afd72917cd974fe2d7db71768bf0587fec --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_ops_tensor_helper.h @@ -0,0 +1,93 @@ +/* Copyright 2021 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_OPS_TENSOR_HELPER_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_OPS_TENSOR_HELPER_H_ + +#include "mlir/IR/BuiltinTypes.h" // from @llvm-project +#include "mlir/IR/Operation.h" // from @llvm-project +#include "mlir/IR/Value.h" // from @llvm-project + +namespace mlir { + +class Builder; + +namespace TF { + +// Returns the RankedTensorType for the given operand. TensorFlow constant ops +// may have non-static shape because the shape is not propagated during constant +// folding. If the defining op for the given operand is a constant op, this +// routine uses the constant op's attribute to get the actual shape. +RankedTensorType GetRankedTensorTypeForOperand(Value operand); + +// Returns true if the given `value` is of ranked float tensor type with the +// given `rank`. +inline bool IsOfRankedFloatTensorType(RankedTensorType type, int rank) { + return type && type.getRank() == rank && + type.getElementType().isa(); +} + +// Returns true if the given `value` has the specified rank or has unranked +// type. +inline bool IsOfRankOrUnranked(Value value, int64_t rank) { + RankedTensorType type = GetRankedTensorTypeForOperand(value); + return !type || type.getRank() == rank; +} + +// Returns true if the given `value` has at least the specified rank or has +// unranked type. +inline bool HasRankAtLeast(Value value, int64_t rank) { + RankedTensorType type = GetRankedTensorTypeForOperand(value); + return !type || type.getRank() >= rank; +} + +// Returns true if the given `value` has at most the specified rank or has +// unranked type. +inline bool HasRankAtMost(Value value, int64_t rank) { + RankedTensorType type = GetRankedTensorTypeForOperand(value); + return !type || type.getRank() <= rank; +} + +inline bool IsUnknownDimOrRank(int64_t dim_or_rank) { + return dim_or_rank == -1; +} + +// Returns dimension index for the given TensorFlow axis that supports negative +// indexing. +inline int64_t GetDimForAxis(int64_t axis, int64_t rank) { + return axis >= 0 ? axis : axis + rank; +} + +// Returns the tf.Equal/tf.NotEqual result type given `x` and `y` and inputs. If +// `incompatible_shape_error` is true, reports error if `x` and `y` has +// incompatible shapes. Otherwise, returns a tensor type with unknown rank. +Type DeduceEqualCmpOpType(Builder *builder, Location loc, Value x, Value y, + BoolAttr incompatible_shape_error); + +Type InferReductionOpType(Value input, Value reduction_indices, + BoolAttr keep_dims); + +// Verifies that the given types are cast compatible. If not, emits appropriate +// error for the given op. If mask_one_dim is set to true, then the types are +// allowed to have one mismatching dimension. Masking one of the dimensions is +// useful for ops like Concat that requires all ranked inputs to have the same +// rank and match dimension sizes for all but one of the dimensions. +LogicalResult VerifyTypesCompatibility(Operation::operand_type_range types, + bool mask_one_dim, Operation *op); + +} // namespace TF +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_OPS_TENSOR_HELPER_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_remaining_ops.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_remaining_ops.h new file mode 100644 index 0000000000000000000000000000000000000000..8e9f32cdca0c6c4ceaf5190dcf3d4d12c9f6ecb6 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_remaining_ops.h @@ -0,0 +1,45 @@ +/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_REMAINING_OPS_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_REMAINING_OPS_H_ + +#include "mlir/Dialect/Func/IR/FuncOps.h" // from @llvm-project +#include "mlir/Dialect/Traits.h" // from @llvm-project +#include "mlir/IR/Attributes.h" // from @llvm-project +#include "mlir/IR/Builders.h" // from @llvm-project +#include "mlir/IR/BuiltinOps.h" // from @llvm-project +#include "mlir/IR/BuiltinTypes.h" // from @llvm-project +#include "mlir/IR/Matchers.h" // from @llvm-project +#include "mlir/IR/OpImplementation.h" // from @llvm-project +#include "mlir/IR/TypeUtilities.h" // from @llvm-project +#include "mlir/Interfaces/CallInterfaces.h" // from @llvm-project +#include "mlir/Interfaces/DerivedAttributeOpInterface.h" // from @llvm-project +#include "mlir/Interfaces/InferTypeOpInterface.h" // from @llvm-project +#include "mlir/Interfaces/LoopLikeInterface.h" // from @llvm-project +#include "mlir/Interfaces/SideEffectInterfaces.h" // from @llvm-project +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_attributes.h" +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_op_interfaces.h" +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_structs.h" +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_traits.h" +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_types.h" +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_verifiers.h" + +#define GET_OP_FWD_DEFINES +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_all_ops.h.inc" +#define GET_OP_CLASSES +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_remaining_ops.h.inc" + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_REMAINING_OPS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_remaining_ops.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_remaining_ops.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..f478bd44b27fc8b62f38193144c8226d502b4585 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_remaining_ops.h.inc @@ -0,0 +1,3971 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: tf_ops.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#if defined(GET_OP_CLASSES) || defined(GET_OP_FWD_DEFINES) +#undef GET_OP_FWD_DEFINES +namespace mlir { +namespace TF { +class _ArrayToListOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class _EagerConstOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class _FusedBatchNormExOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class _FusedConv2DOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class _FusedMatMulOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class _HostRecvOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class _HostSendOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class _InternalTestMustExecuteTrait_; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class _InternalTestNonResourceValueSideEffects_; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class _ListToArrayOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class _RecvOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class _SendOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class _TPUCompileMlirOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class _TPUDeviceOrdinalPlaceholderOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class _UnaryOpsCompositionOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class _XlaCompileMlirPlaceholderProgramKeyOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class _XlaCompileOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class _XlaHostComputeMlirOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class _XlaRecvAtHostOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class _XlaRecvAtHostV2Op; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class _XlaRunOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class _XlaSendFromHostOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class _XlaSendFromHostV2Op; +} // namespace TF +} // namespace mlir +#endif + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::_ArrayToListOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class _ArrayToListOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + _ArrayToListOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + _ArrayToListOpGenericAdaptorBase(_ArrayToListOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class _ArrayToListOpGenericAdaptor : public detail::_ArrayToListOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::_ArrayToListOpGenericAdaptorBase; +public: + _ArrayToListOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + _ArrayToListOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : _ArrayToListOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + _ArrayToListOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInput() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class _ArrayToListOpAdaptor : public _ArrayToListOpGenericAdaptor<::mlir::ValueRange> { +public: + using _ArrayToListOpGenericAdaptor::_ArrayToListOpGenericAdaptor; + _ArrayToListOpAdaptor(_ArrayToListOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class _ArrayToListOp : public ::mlir::Op<_ArrayToListOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::VariadicResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = _ArrayToListOpAdaptor; + template + using GenericAdaptor = _ArrayToListOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("N"), ::llvm::StringRef("T"), ::llvm::StringRef("out_types")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOutTypesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOutTypesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf._ArrayToList"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInput(); + ::mlir::MutableOperandRange getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutput(); + size_t getN(); + ::mlir::Type getT(); + mlir::ResultElementTypeRange getOutTypes(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::_ArrayToListOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::_EagerConstOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class _EagerConstOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + _EagerConstOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + _EagerConstOpGenericAdaptorBase(_EagerConstOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class _EagerConstOpGenericAdaptor : public detail::_EagerConstOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::_EagerConstOpGenericAdaptorBase; +public: + _EagerConstOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + _EagerConstOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : _EagerConstOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + _EagerConstOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class _EagerConstOpAdaptor : public _EagerConstOpGenericAdaptor<::mlir::ValueRange> { +public: + using _EagerConstOpGenericAdaptor::_EagerConstOpGenericAdaptor; + _EagerConstOpAdaptor(_EagerConstOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class _EagerConstOp : public ::mlir::Op<_EagerConstOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = _EagerConstOpAdaptor; + template + using GenericAdaptor = _EagerConstOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf._EagerConst"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::_EagerConstOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::_FusedBatchNormExOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class _FusedBatchNormExOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + _FusedBatchNormExOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + _FusedBatchNormExOpGenericAdaptorBase(_FusedBatchNormExOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::FloatAttr getExponentialAvgFactorAttr(); + ::llvm::APFloat getExponentialAvgFactor(); + ::mlir::StringAttr getActivationModeAttr(); + ::llvm::StringRef getActivationMode(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::BoolAttr getIsTrainingAttr(); + bool getIsTraining(); +}; +} // namespace detail +template +class _FusedBatchNormExOpGenericAdaptor : public detail::_FusedBatchNormExOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::_FusedBatchNormExOpGenericAdaptorBase; +public: + _FusedBatchNormExOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + _FusedBatchNormExOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : _FusedBatchNormExOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + _FusedBatchNormExOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + ValueT getScale() { + return (*getODSOperands(1).begin()); + } + + ValueT getOffset() { + return (*getODSOperands(2).begin()); + } + + ValueT getMean() { + return (*getODSOperands(3).begin()); + } + + ValueT getVariance() { + return (*getODSOperands(4).begin()); + } + + RangeT getSideInput() { + return getODSOperands(5); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class _FusedBatchNormExOpAdaptor : public _FusedBatchNormExOpGenericAdaptor<::mlir::ValueRange> { +public: + using _FusedBatchNormExOpGenericAdaptor::_FusedBatchNormExOpGenericAdaptor; + _FusedBatchNormExOpAdaptor(_FusedBatchNormExOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class _FusedBatchNormExOp : public ::mlir::Op<_FusedBatchNormExOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::NResults<6>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<5>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = _FusedBatchNormExOpAdaptor; + template + using GenericAdaptor = _FusedBatchNormExOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("U"), ::llvm::StringRef("activation_mode"), ::llvm::StringRef("data_format"), ::llvm::StringRef("epsilon"), ::llvm::StringRef("exponential_avg_factor"), ::llvm::StringRef("is_training"), ::llvm::StringRef("num_side_inputs")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getUAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getUAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getActivationModeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getActivationModeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getEpsilonAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getEpsilonAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getExponentialAvgFactorAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getExponentialAvgFactorAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getIsTrainingAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getIsTrainingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getNumSideInputsAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getNumSideInputsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf._FusedBatchNormEx"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::TypedValue<::mlir::TensorType> getScale(); + ::mlir::TypedValue<::mlir::TensorType> getOffset(); + ::mlir::TypedValue<::mlir::TensorType> getMean(); + ::mlir::TypedValue<::mlir::TensorType> getVariance(); + ::mlir::Operation::operand_range getSideInput(); + ::mlir::OpOperand &getXMutable(); + ::mlir::OpOperand &getScaleMutable(); + ::mlir::OpOperand &getOffsetMutable(); + ::mlir::OpOperand &getMeanMutable(); + ::mlir::OpOperand &getVarianceMutable(); + ::mlir::MutableOperandRange getSideInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::TypedValue<::mlir::TensorType> getBatchMean(); + ::mlir::TypedValue<::mlir::TensorType> getBatchVariance(); + ::mlir::TypedValue<::mlir::TensorType> getReserveSpace_1(); + ::mlir::TypedValue<::mlir::TensorType> getReserveSpace_2(); + ::mlir::TypedValue<::mlir::TensorType> getReserveSpace_3(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::FloatAttr getExponentialAvgFactorAttr(); + ::llvm::APFloat getExponentialAvgFactor(); + ::mlir::StringAttr getActivationModeAttr(); + ::llvm::StringRef getActivationMode(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::BoolAttr getIsTrainingAttr(); + bool getIsTraining(); + size_t getNumSideInputs(); + ::mlir::Type getT(); + ::mlir::Type getU(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setEpsilonAttr(::mlir::FloatAttr attr); + void setEpsilon(::std::optional<::llvm::APFloat> attrValue); + void setExponentialAvgFactorAttr(::mlir::FloatAttr attr); + void setExponentialAvgFactor(::std::optional<::llvm::APFloat> attrValue); + void setActivationModeAttr(::mlir::StringAttr attr); + void setActivationMode(::std::optional<::llvm::StringRef> attrValue); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + void setIsTrainingAttr(::mlir::BoolAttr attr); + void setIsTraining(::std::optional attrValue); + ::mlir::Attribute removeEpsilonAttr(); + ::mlir::Attribute removeExponentialAvgFactorAttr(); + ::mlir::Attribute removeActivationModeAttr(); + ::mlir::Attribute removeDataFormatAttr(); + ::mlir::Attribute removeIsTrainingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Type batch_mean, ::mlir::Type batch_variance, ::mlir::Type reserve_space_1, ::mlir::Type reserve_space_2, ::mlir::Type reserve_space_3, ::mlir::Value x, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value mean, ::mlir::Value variance, ::mlir::ValueRange side_input, /*optional*/::mlir::FloatAttr epsilon, /*optional*/::mlir::FloatAttr exponential_avg_factor, /*optional*/::mlir::StringAttr activation_mode, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::BoolAttr is_training); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value mean, ::mlir::Value variance, ::mlir::ValueRange side_input, /*optional*/::mlir::FloatAttr epsilon, /*optional*/::mlir::FloatAttr exponential_avg_factor, /*optional*/::mlir::StringAttr activation_mode, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::BoolAttr is_training); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Type batch_mean, ::mlir::Type batch_variance, ::mlir::Type reserve_space_1, ::mlir::Type reserve_space_2, ::mlir::Type reserve_space_3, ::mlir::Value x, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value mean, ::mlir::Value variance, ::mlir::ValueRange side_input, /*optional*/::llvm::APFloat epsilon, /*optional*/::llvm::APFloat exponential_avg_factor, /*optional*/::llvm::StringRef activation_mode = "Identity", /*optional*/::llvm::StringRef data_format = "NHWC", /*optional*/bool is_training = true); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value mean, ::mlir::Value variance, ::mlir::ValueRange side_input, /*optional*/::llvm::APFloat epsilon, /*optional*/::llvm::APFloat exponential_avg_factor, /*optional*/::llvm::StringRef activation_mode = "Identity", /*optional*/::llvm::StringRef data_format = "NHWC", /*optional*/bool is_training = true); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 8 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::_FusedBatchNormExOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::_FusedConv2DOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class _FusedConv2DOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + _FusedConv2DOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + _FusedConv2DOpGenericAdaptorBase(_FusedConv2DOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getNumArgsAttr(); + uint64_t getNumArgs(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getExplicitPaddingsAttr(); + ::mlir::ArrayAttr getExplicitPaddings(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::StringAttr getFilterFormatAttr(); + ::llvm::StringRef getFilterFormat(); + ::mlir::ArrayAttr getDilationsAttr(); + ::mlir::ArrayAttr getDilations(); + ::mlir::BoolAttr getUseCudnnOnGpuAttr(); + bool getUseCudnnOnGpu(); + ::mlir::ArrayAttr getFusedOpsAttr(); + ::mlir::ArrayAttr getFusedOps(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::FloatAttr getLeakyreluAlphaAttr(); + ::llvm::APFloat getLeakyreluAlpha(); +}; +} // namespace detail +template +class _FusedConv2DOpGenericAdaptor : public detail::_FusedConv2DOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::_FusedConv2DOpGenericAdaptorBase; +public: + _FusedConv2DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + _FusedConv2DOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : _FusedConv2DOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + _FusedConv2DOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getFilter() { + return (*getODSOperands(1).begin()); + } + + RangeT getArgs() { + return getODSOperands(2); + } + + RangeT getHostArgs() { + return getODSOperands(3); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class _FusedConv2DOpAdaptor : public _FusedConv2DOpGenericAdaptor<::mlir::ValueRange> { +public: + using _FusedConv2DOpGenericAdaptor::_FusedConv2DOpGenericAdaptor; + _FusedConv2DOpAdaptor(_FusedConv2DOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class _FusedConv2DOp : public ::mlir::Op<_FusedConv2DOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<2>::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = _FusedConv2DOpAdaptor; + template + using GenericAdaptor = _FusedConv2DOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("TArgs"), ::llvm::StringRef("data_format"), ::llvm::StringRef("dilations"), ::llvm::StringRef("epsilon"), ::llvm::StringRef("explicit_paddings"), ::llvm::StringRef("filter_format"), ::llvm::StringRef("fused_ops"), ::llvm::StringRef("leakyrelu_alpha"), ::llvm::StringRef("num_args"), ::llvm::StringRef("num_host_args"), ::llvm::StringRef("operandSegmentSizes"), ::llvm::StringRef("padding"), ::llvm::StringRef("strides"), ::llvm::StringRef("use_cudnn_on_gpu")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTArgsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTArgsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDataFormatAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDataFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getDilationsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getEpsilonAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getEpsilonAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getExplicitPaddingsAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getExplicitPaddingsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getFilterFormatAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getFilterFormatAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getFusedOpsAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getFusedOpsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getLeakyreluAlphaAttrName() { + return getAttributeNameForIndex(8); + } + + static ::mlir::StringAttr getLeakyreluAlphaAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 8); + } + + ::mlir::StringAttr getNumArgsAttrName() { + return getAttributeNameForIndex(9); + } + + static ::mlir::StringAttr getNumArgsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 9); + } + + ::mlir::StringAttr getNumHostArgsAttrName() { + return getAttributeNameForIndex(10); + } + + static ::mlir::StringAttr getNumHostArgsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 10); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return getAttributeNameForIndex(11); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 11); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(12); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 12); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(13); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 13); + } + + ::mlir::StringAttr getUseCudnnOnGpuAttrName() { + return getAttributeNameForIndex(14); + } + + static ::mlir::StringAttr getUseCudnnOnGpuAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 14); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf._FusedConv2D"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInput(); + ::mlir::TypedValue<::mlir::TensorType> getFilter(); + ::mlir::Operation::operand_range getArgs(); + ::mlir::Operation::operand_range getHostArgs(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getFilterMutable(); + ::mlir::MutableOperandRange getArgsMutable(); + ::mlir::MutableOperandRange getHostArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getNumArgsAttr(); + uint64_t getNumArgs(); + ::mlir::ArrayAttr getStridesAttr(); + ::mlir::ArrayAttr getStrides(); + ::mlir::StringAttr getPaddingAttr(); + ::llvm::StringRef getPadding(); + ::mlir::ArrayAttr getExplicitPaddingsAttr(); + ::mlir::ArrayAttr getExplicitPaddings(); + ::mlir::StringAttr getDataFormatAttr(); + ::llvm::StringRef getDataFormat(); + ::mlir::StringAttr getFilterFormatAttr(); + ::llvm::StringRef getFilterFormat(); + ::mlir::ArrayAttr getDilationsAttr(); + ::mlir::ArrayAttr getDilations(); + ::mlir::BoolAttr getUseCudnnOnGpuAttr(); + bool getUseCudnnOnGpu(); + ::mlir::ArrayAttr getFusedOpsAttr(); + ::mlir::ArrayAttr getFusedOps(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::FloatAttr getLeakyreluAlphaAttr(); + ::llvm::APFloat getLeakyreluAlpha(); + size_t getNumHostArgs(); + ::mlir::Type getT(); + mlir::OperandElementTypeRange getTArgs(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setNumArgsAttr(::mlir::IntegerAttr attr); + void setNumArgs(uint64_t attrValue); + void setStridesAttr(::mlir::ArrayAttr attr); + void setPaddingAttr(::mlir::StringAttr attr); + void setPadding(::llvm::StringRef attrValue); + void setExplicitPaddingsAttr(::mlir::ArrayAttr attr); + void setDataFormatAttr(::mlir::StringAttr attr); + void setDataFormat(::std::optional<::llvm::StringRef> attrValue); + void setFilterFormatAttr(::mlir::StringAttr attr); + void setFilterFormat(::std::optional<::llvm::StringRef> attrValue); + void setDilationsAttr(::mlir::ArrayAttr attr); + void setUseCudnnOnGpuAttr(::mlir::BoolAttr attr); + void setUseCudnnOnGpu(::std::optional attrValue); + void setFusedOpsAttr(::mlir::ArrayAttr attr); + void setEpsilonAttr(::mlir::FloatAttr attr); + void setEpsilon(::std::optional<::llvm::APFloat> attrValue); + void setLeakyreluAlphaAttr(::mlir::FloatAttr attr); + void setLeakyreluAlpha(::std::optional<::llvm::APFloat> attrValue); + ::mlir::Attribute removeExplicitPaddingsAttr(); + ::mlir::Attribute removeDataFormatAttr(); + ::mlir::Attribute removeFilterFormatAttr(); + ::mlir::Attribute removeDilationsAttr(); + ::mlir::Attribute removeUseCudnnOnGpuAttr(); + ::mlir::Attribute removeFusedOpsAttr(); + ::mlir::Attribute removeEpsilonAttr(); + ::mlir::Attribute removeLeakyreluAlphaAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value filter, ::mlir::ValueRange args, ::mlir::ValueRange host_args, ::mlir::IntegerAttr num_args, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::StringAttr filter_format, /*optional*/::mlir::ArrayAttr dilations, /*optional*/::mlir::BoolAttr use_cudnn_on_gpu, /*optional*/::mlir::ArrayAttr fused_ops, /*optional*/::mlir::FloatAttr epsilon, /*optional*/::mlir::FloatAttr leakyrelu_alpha); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter, ::mlir::ValueRange args, ::mlir::ValueRange host_args, ::mlir::IntegerAttr num_args, ::mlir::ArrayAttr strides, ::mlir::StringAttr padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::mlir::StringAttr data_format, /*optional*/::mlir::StringAttr filter_format, /*optional*/::mlir::ArrayAttr dilations, /*optional*/::mlir::BoolAttr use_cudnn_on_gpu, /*optional*/::mlir::ArrayAttr fused_ops, /*optional*/::mlir::FloatAttr epsilon, /*optional*/::mlir::FloatAttr leakyrelu_alpha); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value filter, ::mlir::ValueRange args, ::mlir::ValueRange host_args, uint64_t num_args, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::llvm::StringRef data_format, /*optional*/::llvm::StringRef filter_format, /*optional*/::mlir::ArrayAttr dilations, /*optional*/bool use_cudnn_on_gpu, /*optional*/::mlir::ArrayAttr fused_ops, /*optional*/::llvm::APFloat epsilon, /*optional*/::llvm::APFloat leakyrelu_alpha); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter, ::mlir::ValueRange args, ::mlir::ValueRange host_args, uint64_t num_args, ::mlir::ArrayAttr strides, ::llvm::StringRef padding, /*optional*/::mlir::ArrayAttr explicit_paddings, /*optional*/::llvm::StringRef data_format, /*optional*/::llvm::StringRef filter_format, /*optional*/::mlir::ArrayAttr dilations, /*optional*/bool use_cudnn_on_gpu, /*optional*/::mlir::ArrayAttr fused_ops, /*optional*/::llvm::APFloat epsilon, /*optional*/::llvm::APFloat leakyrelu_alpha); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 15 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::_FusedConv2DOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::_FusedMatMulOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class _FusedMatMulOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + _FusedMatMulOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + _FusedMatMulOpGenericAdaptorBase(_FusedMatMulOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getTransposeAAttr(); + bool getTransposeA(); + ::mlir::BoolAttr getTransposeBAttr(); + bool getTransposeB(); + ::mlir::ArrayAttr getFusedOpsAttr(); + ::mlir::ArrayAttr getFusedOps(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::FloatAttr getLeakyreluAlphaAttr(); + ::llvm::APFloat getLeakyreluAlpha(); +}; +} // namespace detail +template +class _FusedMatMulOpGenericAdaptor : public detail::_FusedMatMulOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::_FusedMatMulOpGenericAdaptorBase; +public: + _FusedMatMulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + _FusedMatMulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : _FusedMatMulOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + _FusedMatMulOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + ValueT getB() { + return (*getODSOperands(1).begin()); + } + + RangeT getArgs() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class _FusedMatMulOpAdaptor : public _FusedMatMulOpGenericAdaptor<::mlir::ValueRange> { +public: + using _FusedMatMulOpGenericAdaptor::_FusedMatMulOpGenericAdaptor; + _FusedMatMulOpAdaptor(_FusedMatMulOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class _FusedMatMulOp : public ::mlir::Op<_FusedMatMulOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::SameOperandsAndResultElementTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = _FusedMatMulOpAdaptor; + template + using GenericAdaptor = _FusedMatMulOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("epsilon"), ::llvm::StringRef("fused_ops"), ::llvm::StringRef("leakyrelu_alpha"), ::llvm::StringRef("num_args"), ::llvm::StringRef("transpose_a"), ::llvm::StringRef("transpose_b")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getEpsilonAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getEpsilonAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getFusedOpsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getFusedOpsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getLeakyreluAlphaAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getLeakyreluAlphaAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getNumArgsAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getNumArgsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getTransposeAAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getTransposeAAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getTransposeBAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getTransposeBAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf._FusedMatMul"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getA(); + ::mlir::TypedValue<::mlir::TensorType> getB(); + ::mlir::Operation::operand_range getArgs(); + ::mlir::OpOperand &getAMutable(); + ::mlir::OpOperand &getBMutable(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getProduct(); + ::mlir::BoolAttr getTransposeAAttr(); + bool getTransposeA(); + ::mlir::BoolAttr getTransposeBAttr(); + bool getTransposeB(); + ::mlir::ArrayAttr getFusedOpsAttr(); + ::mlir::ArrayAttr getFusedOps(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::FloatAttr getLeakyreluAlphaAttr(); + ::llvm::APFloat getLeakyreluAlpha(); + size_t getNumArgs(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setTransposeAAttr(::mlir::BoolAttr attr); + void setTransposeA(::std::optional attrValue); + void setTransposeBAttr(::mlir::BoolAttr attr); + void setTransposeB(::std::optional attrValue); + void setFusedOpsAttr(::mlir::ArrayAttr attr); + void setEpsilonAttr(::mlir::FloatAttr attr); + void setEpsilon(::std::optional<::llvm::APFloat> attrValue); + void setLeakyreluAlphaAttr(::mlir::FloatAttr attr); + void setLeakyreluAlpha(::std::optional<::llvm::APFloat> attrValue); + ::mlir::Attribute removeTransposeAAttr(); + ::mlir::Attribute removeTransposeBAttr(); + ::mlir::Attribute removeFusedOpsAttr(); + ::mlir::Attribute removeEpsilonAttr(); + ::mlir::Attribute removeLeakyreluAlphaAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type product, ::mlir::Value a, ::mlir::Value b, ::mlir::ValueRange args, /*optional*/::mlir::BoolAttr transpose_a, /*optional*/::mlir::BoolAttr transpose_b, /*optional*/::mlir::ArrayAttr fused_ops, /*optional*/::mlir::FloatAttr epsilon, /*optional*/::mlir::FloatAttr leakyrelu_alpha); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::ValueRange args, /*optional*/::mlir::BoolAttr transpose_a, /*optional*/::mlir::BoolAttr transpose_b, /*optional*/::mlir::ArrayAttr fused_ops, /*optional*/::mlir::FloatAttr epsilon, /*optional*/::mlir::FloatAttr leakyrelu_alpha); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type product, ::mlir::Value a, ::mlir::Value b, ::mlir::ValueRange args, /*optional*/bool transpose_a, /*optional*/bool transpose_b, /*optional*/::mlir::ArrayAttr fused_ops, /*optional*/::llvm::APFloat epsilon, /*optional*/::llvm::APFloat leakyrelu_alpha); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::ValueRange args, /*optional*/bool transpose_a, /*optional*/bool transpose_b, /*optional*/::mlir::ArrayAttr fused_ops, /*optional*/::llvm::APFloat epsilon, /*optional*/::llvm::APFloat leakyrelu_alpha); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 7 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::_FusedMatMulOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::_HostRecvOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class _HostRecvOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + _HostRecvOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + _HostRecvOpGenericAdaptorBase(_HostRecvOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getTensorNameAttr(); + ::llvm::StringRef getTensorName(); + ::mlir::StringAttr getSendDeviceAttr(); + ::llvm::StringRef getSendDevice(); + ::mlir::IntegerAttr getSendDeviceIncarnationAttr(); + uint64_t getSendDeviceIncarnation(); + ::mlir::StringAttr getRecvDeviceAttr(); + ::llvm::StringRef getRecvDevice(); + ::mlir::BoolAttr getClientTerminatedAttr(); + bool getClientTerminated(); +}; +} // namespace detail +template +class _HostRecvOpGenericAdaptor : public detail::_HostRecvOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::_HostRecvOpGenericAdaptorBase; +public: + _HostRecvOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + _HostRecvOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : _HostRecvOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + _HostRecvOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class _HostRecvOpAdaptor : public _HostRecvOpGenericAdaptor<::mlir::ValueRange> { +public: + using _HostRecvOpGenericAdaptor::_HostRecvOpGenericAdaptor; + _HostRecvOpAdaptor(_HostRecvOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class _HostRecvOp : public ::mlir::Op<_HostRecvOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, GetResourceInstanceInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = _HostRecvOpAdaptor; + template + using GenericAdaptor = _HostRecvOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("client_terminated"), ::llvm::StringRef("recv_device"), ::llvm::StringRef("send_device"), ::llvm::StringRef("send_device_incarnation"), ::llvm::StringRef("tensor_name"), ::llvm::StringRef("tensor_type")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getClientTerminatedAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getClientTerminatedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getRecvDeviceAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getRecvDeviceAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getSendDeviceAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getSendDeviceAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSendDeviceIncarnationAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSendDeviceIncarnationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTensorNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTensorNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getTensorTypeAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getTensorTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf._HostRecv"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::StringAttr getTensorNameAttr(); + ::llvm::StringRef getTensorName(); + ::mlir::StringAttr getSendDeviceAttr(); + ::llvm::StringRef getSendDevice(); + ::mlir::IntegerAttr getSendDeviceIncarnationAttr(); + uint64_t getSendDeviceIncarnation(); + ::mlir::StringAttr getRecvDeviceAttr(); + ::llvm::StringRef getRecvDevice(); + ::mlir::BoolAttr getClientTerminatedAttr(); + bool getClientTerminated(); + ::mlir::Type getTensorType(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setTensorNameAttr(::mlir::StringAttr attr); + void setTensorName(::llvm::StringRef attrValue); + void setSendDeviceAttr(::mlir::StringAttr attr); + void setSendDevice(::llvm::StringRef attrValue); + void setSendDeviceIncarnationAttr(::mlir::IntegerAttr attr); + void setSendDeviceIncarnation(uint64_t attrValue); + void setRecvDeviceAttr(::mlir::StringAttr attr); + void setRecvDevice(::llvm::StringRef attrValue); + void setClientTerminatedAttr(::mlir::BoolAttr attr); + void setClientTerminated(::std::optional attrValue); + ::mlir::Attribute removeClientTerminatedAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type tensor, ::mlir::StringAttr tensor_name, ::mlir::StringAttr send_device, ::mlir::IntegerAttr send_device_incarnation, ::mlir::StringAttr recv_device, /*optional*/::mlir::BoolAttr client_terminated); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr tensor_name, ::mlir::StringAttr send_device, ::mlir::IntegerAttr send_device_incarnation, ::mlir::StringAttr recv_device, /*optional*/::mlir::BoolAttr client_terminated); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type tensor, ::llvm::StringRef tensor_name, ::llvm::StringRef send_device, uint64_t send_device_incarnation, ::llvm::StringRef recv_device, /*optional*/bool client_terminated = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef tensor_name, ::llvm::StringRef send_device, uint64_t send_device_incarnation, ::llvm::StringRef recv_device, /*optional*/bool client_terminated = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + std::optional GetResourceInstanceStr(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::_HostRecvOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::_HostSendOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class _HostSendOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + _HostSendOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + _HostSendOpGenericAdaptorBase(_HostSendOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getTensorNameAttr(); + ::llvm::StringRef getTensorName(); + ::mlir::StringAttr getSendDeviceAttr(); + ::llvm::StringRef getSendDevice(); + ::mlir::IntegerAttr getSendDeviceIncarnationAttr(); + uint64_t getSendDeviceIncarnation(); + ::mlir::StringAttr getRecvDeviceAttr(); + ::llvm::StringRef getRecvDevice(); + ::mlir::BoolAttr getClientTerminatedAttr(); + bool getClientTerminated(); +}; +} // namespace detail +template +class _HostSendOpGenericAdaptor : public detail::_HostSendOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::_HostSendOpGenericAdaptorBase; +public: + _HostSendOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + _HostSendOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : _HostSendOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + _HostSendOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTensor() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class _HostSendOpAdaptor : public _HostSendOpGenericAdaptor<::mlir::ValueRange> { +public: + using _HostSendOpGenericAdaptor::_HostSendOpGenericAdaptor; + _HostSendOpAdaptor(_HostSendOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class _HostSendOp : public ::mlir::Op<_HostSendOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::ZeroResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, GetResourceInstanceInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = _HostSendOpAdaptor; + template + using GenericAdaptor = _HostSendOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("client_terminated"), ::llvm::StringRef("recv_device"), ::llvm::StringRef("send_device"), ::llvm::StringRef("send_device_incarnation"), ::llvm::StringRef("tensor_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getClientTerminatedAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getClientTerminatedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getRecvDeviceAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getRecvDeviceAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSendDeviceAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSendDeviceAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getSendDeviceIncarnationAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getSendDeviceIncarnationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getTensorNameAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getTensorNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf._HostSend"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::OpOperand &getTensorMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::StringAttr getTensorNameAttr(); + ::llvm::StringRef getTensorName(); + ::mlir::StringAttr getSendDeviceAttr(); + ::llvm::StringRef getSendDevice(); + ::mlir::IntegerAttr getSendDeviceIncarnationAttr(); + uint64_t getSendDeviceIncarnation(); + ::mlir::StringAttr getRecvDeviceAttr(); + ::llvm::StringRef getRecvDevice(); + ::mlir::BoolAttr getClientTerminatedAttr(); + bool getClientTerminated(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setTensorNameAttr(::mlir::StringAttr attr); + void setTensorName(::llvm::StringRef attrValue); + void setSendDeviceAttr(::mlir::StringAttr attr); + void setSendDevice(::llvm::StringRef attrValue); + void setSendDeviceIncarnationAttr(::mlir::IntegerAttr attr); + void setSendDeviceIncarnation(uint64_t attrValue); + void setRecvDeviceAttr(::mlir::StringAttr attr); + void setRecvDevice(::llvm::StringRef attrValue); + void setClientTerminatedAttr(::mlir::BoolAttr attr); + void setClientTerminated(::std::optional attrValue); + ::mlir::Attribute removeClientTerminatedAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value tensor, ::mlir::StringAttr tensor_name, ::mlir::StringAttr send_device, ::mlir::IntegerAttr send_device_incarnation, ::mlir::StringAttr recv_device, /*optional*/::mlir::BoolAttr client_terminated); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tensor, ::mlir::StringAttr tensor_name, ::mlir::StringAttr send_device, ::mlir::IntegerAttr send_device_incarnation, ::mlir::StringAttr recv_device, /*optional*/::mlir::BoolAttr client_terminated); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value tensor, ::llvm::StringRef tensor_name, ::llvm::StringRef send_device, uint64_t send_device_incarnation, ::llvm::StringRef recv_device, /*optional*/bool client_terminated = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tensor, ::llvm::StringRef tensor_name, ::llvm::StringRef send_device, uint64_t send_device_incarnation, ::llvm::StringRef recv_device, /*optional*/bool client_terminated = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + std::optional GetResourceInstanceStr(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::_HostSendOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::_InternalTestMustExecuteTrait_ declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class _InternalTestMustExecuteTrait_GenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + _InternalTestMustExecuteTrait_GenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + _InternalTestMustExecuteTrait_GenericAdaptorBase(_InternalTestMustExecuteTrait_ op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class _InternalTestMustExecuteTrait_GenericAdaptor : public detail::_InternalTestMustExecuteTrait_GenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::_InternalTestMustExecuteTrait_GenericAdaptorBase; +public: + _InternalTestMustExecuteTrait_GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + _InternalTestMustExecuteTrait_GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : _InternalTestMustExecuteTrait_GenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + _InternalTestMustExecuteTrait_GenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class _InternalTestMustExecuteTrait_Adaptor : public _InternalTestMustExecuteTrait_GenericAdaptor<::mlir::ValueRange> { +public: + using _InternalTestMustExecuteTrait_GenericAdaptor::_InternalTestMustExecuteTrait_GenericAdaptor; + _InternalTestMustExecuteTrait_Adaptor(_InternalTestMustExecuteTrait_ op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class _InternalTestMustExecuteTrait_ : public ::mlir::Op<_InternalTestMustExecuteTrait_, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::ZeroResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = _InternalTestMustExecuteTrait_Adaptor; + template + using GenericAdaptor = _InternalTestMustExecuteTrait_GenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf._InternalTestMustExecuteTrait_"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::_InternalTestMustExecuteTrait_) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::_InternalTestNonResourceValueSideEffects_ declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class _InternalTestNonResourceValueSideEffects_GenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + _InternalTestNonResourceValueSideEffects_GenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + _InternalTestNonResourceValueSideEffects_GenericAdaptorBase(_InternalTestNonResourceValueSideEffects_ op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class _InternalTestNonResourceValueSideEffects_GenericAdaptor : public detail::_InternalTestNonResourceValueSideEffects_GenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::_InternalTestNonResourceValueSideEffects_GenericAdaptorBase; +public: + _InternalTestNonResourceValueSideEffects_GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + _InternalTestNonResourceValueSideEffects_GenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : _InternalTestNonResourceValueSideEffects_GenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + _InternalTestNonResourceValueSideEffects_GenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getKey() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class _InternalTestNonResourceValueSideEffects_Adaptor : public _InternalTestNonResourceValueSideEffects_GenericAdaptor<::mlir::ValueRange> { +public: + using _InternalTestNonResourceValueSideEffects_GenericAdaptor::_InternalTestNonResourceValueSideEffects_GenericAdaptor; + _InternalTestNonResourceValueSideEffects_Adaptor(_InternalTestNonResourceValueSideEffects_ op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class _InternalTestNonResourceValueSideEffects_ : public ::mlir::Op<_InternalTestNonResourceValueSideEffects_, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::ZeroResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = _InternalTestNonResourceValueSideEffects_Adaptor; + template + using GenericAdaptor = _InternalTestNonResourceValueSideEffects_GenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf._InternalTestNonResourceValueSideEffects_"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getKey(); + ::mlir::OpOperand &getKeyMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value key); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value key); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::_InternalTestNonResourceValueSideEffects_) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::_ListToArrayOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class _ListToArrayOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + _ListToArrayOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + _ListToArrayOpGenericAdaptorBase(_ListToArrayOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class _ListToArrayOpGenericAdaptor : public detail::_ListToArrayOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::_ListToArrayOpGenericAdaptorBase; +public: + _ListToArrayOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + _ListToArrayOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : _ListToArrayOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + _ListToArrayOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInput() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class _ListToArrayOpAdaptor : public _ListToArrayOpGenericAdaptor<::mlir::ValueRange> { +public: + using _ListToArrayOpGenericAdaptor::_ListToArrayOpGenericAdaptor; + _ListToArrayOpAdaptor(_ListToArrayOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class _ListToArrayOp : public ::mlir::Op<_ListToArrayOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::VariadicResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = _ListToArrayOpAdaptor; + template + using GenericAdaptor = _ListToArrayOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("N"), ::llvm::StringRef("T"), ::llvm::StringRef("Tin")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTinAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTinAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf._ListToArray"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInput(); + ::mlir::MutableOperandRange getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutput(); + mlir::OperandElementTypeRange getTin(); + size_t getN(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::_ListToArrayOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::_RecvOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class _RecvOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + _RecvOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + _RecvOpGenericAdaptorBase(_RecvOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getTensorNameAttr(); + ::llvm::StringRef getTensorName(); + ::mlir::StringAttr getSendDeviceAttr(); + ::llvm::StringRef getSendDevice(); + ::mlir::IntegerAttr getSendDeviceIncarnationAttr(); + uint64_t getSendDeviceIncarnation(); + ::mlir::StringAttr getRecvDeviceAttr(); + ::llvm::StringRef getRecvDevice(); + ::mlir::BoolAttr getClientTerminatedAttr(); + bool getClientTerminated(); +}; +} // namespace detail +template +class _RecvOpGenericAdaptor : public detail::_RecvOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::_RecvOpGenericAdaptorBase; +public: + _RecvOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + _RecvOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : _RecvOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + _RecvOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class _RecvOpAdaptor : public _RecvOpGenericAdaptor<::mlir::ValueRange> { +public: + using _RecvOpGenericAdaptor::_RecvOpGenericAdaptor; + _RecvOpAdaptor(_RecvOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class _RecvOp : public ::mlir::Op<_RecvOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, GetResourceInstanceInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = _RecvOpAdaptor; + template + using GenericAdaptor = _RecvOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("client_terminated"), ::llvm::StringRef("recv_device"), ::llvm::StringRef("send_device"), ::llvm::StringRef("send_device_incarnation"), ::llvm::StringRef("tensor_name"), ::llvm::StringRef("tensor_type")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getClientTerminatedAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getClientTerminatedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getRecvDeviceAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getRecvDeviceAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getSendDeviceAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getSendDeviceAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSendDeviceIncarnationAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSendDeviceIncarnationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getTensorNameAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getTensorNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getTensorTypeAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getTensorTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf._Recv"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::StringAttr getTensorNameAttr(); + ::llvm::StringRef getTensorName(); + ::mlir::StringAttr getSendDeviceAttr(); + ::llvm::StringRef getSendDevice(); + ::mlir::IntegerAttr getSendDeviceIncarnationAttr(); + uint64_t getSendDeviceIncarnation(); + ::mlir::StringAttr getRecvDeviceAttr(); + ::llvm::StringRef getRecvDevice(); + ::mlir::BoolAttr getClientTerminatedAttr(); + bool getClientTerminated(); + ::mlir::Type getTensorType(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setTensorNameAttr(::mlir::StringAttr attr); + void setTensorName(::llvm::StringRef attrValue); + void setSendDeviceAttr(::mlir::StringAttr attr); + void setSendDevice(::llvm::StringRef attrValue); + void setSendDeviceIncarnationAttr(::mlir::IntegerAttr attr); + void setSendDeviceIncarnation(uint64_t attrValue); + void setRecvDeviceAttr(::mlir::StringAttr attr); + void setRecvDevice(::llvm::StringRef attrValue); + void setClientTerminatedAttr(::mlir::BoolAttr attr); + void setClientTerminated(::std::optional attrValue); + ::mlir::Attribute removeClientTerminatedAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type tensor, ::mlir::StringAttr tensor_name, ::mlir::StringAttr send_device, ::mlir::IntegerAttr send_device_incarnation, ::mlir::StringAttr recv_device, /*optional*/::mlir::BoolAttr client_terminated); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr tensor_name, ::mlir::StringAttr send_device, ::mlir::IntegerAttr send_device_incarnation, ::mlir::StringAttr recv_device, /*optional*/::mlir::BoolAttr client_terminated); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type tensor, ::llvm::StringRef tensor_name, ::llvm::StringRef send_device, uint64_t send_device_incarnation, ::llvm::StringRef recv_device, /*optional*/bool client_terminated = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef tensor_name, ::llvm::StringRef send_device, uint64_t send_device_incarnation, ::llvm::StringRef recv_device, /*optional*/bool client_terminated = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + std::optional GetResourceInstanceStr(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::_RecvOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::_SendOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class _SendOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + _SendOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + _SendOpGenericAdaptorBase(_SendOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getTensorNameAttr(); + ::llvm::StringRef getTensorName(); + ::mlir::StringAttr getSendDeviceAttr(); + ::llvm::StringRef getSendDevice(); + ::mlir::IntegerAttr getSendDeviceIncarnationAttr(); + uint64_t getSendDeviceIncarnation(); + ::mlir::StringAttr getRecvDeviceAttr(); + ::llvm::StringRef getRecvDevice(); + ::mlir::BoolAttr getClientTerminatedAttr(); + bool getClientTerminated(); +}; +} // namespace detail +template +class _SendOpGenericAdaptor : public detail::_SendOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::_SendOpGenericAdaptorBase; +public: + _SendOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + _SendOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : _SendOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + _SendOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTensor() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class _SendOpAdaptor : public _SendOpGenericAdaptor<::mlir::ValueRange> { +public: + using _SendOpGenericAdaptor::_SendOpGenericAdaptor; + _SendOpAdaptor(_SendOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class _SendOp : public ::mlir::Op<_SendOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::ZeroResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, GetResourceInstanceInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = _SendOpAdaptor; + template + using GenericAdaptor = _SendOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("client_terminated"), ::llvm::StringRef("recv_device"), ::llvm::StringRef("send_device"), ::llvm::StringRef("send_device_incarnation"), ::llvm::StringRef("tensor_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getClientTerminatedAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getClientTerminatedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getRecvDeviceAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getRecvDeviceAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSendDeviceAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSendDeviceAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getSendDeviceIncarnationAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getSendDeviceIncarnationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getTensorNameAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getTensorNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf._Send"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getTensor(); + ::mlir::OpOperand &getTensorMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::StringAttr getTensorNameAttr(); + ::llvm::StringRef getTensorName(); + ::mlir::StringAttr getSendDeviceAttr(); + ::llvm::StringRef getSendDevice(); + ::mlir::IntegerAttr getSendDeviceIncarnationAttr(); + uint64_t getSendDeviceIncarnation(); + ::mlir::StringAttr getRecvDeviceAttr(); + ::llvm::StringRef getRecvDevice(); + ::mlir::BoolAttr getClientTerminatedAttr(); + bool getClientTerminated(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setTensorNameAttr(::mlir::StringAttr attr); + void setTensorName(::llvm::StringRef attrValue); + void setSendDeviceAttr(::mlir::StringAttr attr); + void setSendDevice(::llvm::StringRef attrValue); + void setSendDeviceIncarnationAttr(::mlir::IntegerAttr attr); + void setSendDeviceIncarnation(uint64_t attrValue); + void setRecvDeviceAttr(::mlir::StringAttr attr); + void setRecvDevice(::llvm::StringRef attrValue); + void setClientTerminatedAttr(::mlir::BoolAttr attr); + void setClientTerminated(::std::optional attrValue); + ::mlir::Attribute removeClientTerminatedAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value tensor, ::mlir::StringAttr tensor_name, ::mlir::StringAttr send_device, ::mlir::IntegerAttr send_device_incarnation, ::mlir::StringAttr recv_device, /*optional*/::mlir::BoolAttr client_terminated); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tensor, ::mlir::StringAttr tensor_name, ::mlir::StringAttr send_device, ::mlir::IntegerAttr send_device_incarnation, ::mlir::StringAttr recv_device, /*optional*/::mlir::BoolAttr client_terminated); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value tensor, ::llvm::StringRef tensor_name, ::llvm::StringRef send_device, uint64_t send_device_incarnation, ::llvm::StringRef recv_device, /*optional*/bool client_terminated = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tensor, ::llvm::StringRef tensor_name, ::llvm::StringRef send_device, uint64_t send_device_incarnation, ::llvm::StringRef recv_device, /*optional*/bool client_terminated = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + std::optional GetResourceInstanceStr(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::_SendOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::_TPUCompileMlirOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class _TPUCompileMlirOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + _TPUCompileMlirOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + _TPUCompileMlirOpGenericAdaptorBase(_TPUCompileMlirOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getMlirModuleAttr(); + ::llvm::StringRef getMlirModule(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); +}; +} // namespace detail +template +class _TPUCompileMlirOpGenericAdaptor : public detail::_TPUCompileMlirOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::_TPUCompileMlirOpGenericAdaptorBase; +public: + _TPUCompileMlirOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + _TPUCompileMlirOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : _TPUCompileMlirOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + _TPUCompileMlirOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getDynamicShapes() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class _TPUCompileMlirOpAdaptor : public _TPUCompileMlirOpGenericAdaptor<::mlir::ValueRange> { +public: + using _TPUCompileMlirOpGenericAdaptor::_TPUCompileMlirOpGenericAdaptor; + _TPUCompileMlirOpAdaptor(_TPUCompileMlirOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class _TPUCompileMlirOp : public ::mlir::Op<_TPUCompileMlirOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::AtLeastNResults<1>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = _TPUCompileMlirOpAdaptor; + template + using GenericAdaptor = _TPUCompileMlirOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("NumDynamicShapes"), ::llvm::StringRef("metadata"), ::llvm::StringRef("mlir_module"), ::llvm::StringRef("num_computations")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNumDynamicShapesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNumDynamicShapesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getMetadataAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getMetadataAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getMlirModuleAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getMlirModuleAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getNumComputationsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getNumComputationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf._TPUCompileMlir"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getDynamicShapes(); + ::mlir::MutableOperandRange getDynamicShapesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getCompilationStatus(); + ::mlir::Operation::result_range getProgram(); + ::mlir::StringAttr getMlirModuleAttr(); + ::llvm::StringRef getMlirModule(); + ::mlir::StringAttr getMetadataAttr(); + ::llvm::StringRef getMetadata(); + size_t getNumDynamicShapes(); + size_t getNumComputations(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setMlirModuleAttr(::mlir::StringAttr attr); + void setMlirModule(::std::optional<::llvm::StringRef> attrValue); + void setMetadataAttr(::mlir::StringAttr attr); + void setMetadata(::llvm::StringRef attrValue); + ::mlir::Attribute removeMlirModuleAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type compilation_status, ::mlir::TypeRange program, ::mlir::ValueRange dynamic_shapes, /*optional*/::mlir::StringAttr mlir_module, ::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange dynamic_shapes, /*optional*/::mlir::StringAttr mlir_module, ::mlir::StringAttr metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type compilation_status, ::mlir::TypeRange program, ::mlir::ValueRange dynamic_shapes, /*optional*/::llvm::StringRef mlir_module, ::llvm::StringRef metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange dynamic_shapes, /*optional*/::llvm::StringRef mlir_module, ::llvm::StringRef metadata); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::_TPUCompileMlirOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::_TPUDeviceOrdinalPlaceholderOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class _TPUDeviceOrdinalPlaceholderOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + _TPUDeviceOrdinalPlaceholderOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + _TPUDeviceOrdinalPlaceholderOpGenericAdaptorBase(_TPUDeviceOrdinalPlaceholderOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getLogicalCoreAttr(); + uint64_t getLogicalCore(); +}; +} // namespace detail +template +class _TPUDeviceOrdinalPlaceholderOpGenericAdaptor : public detail::_TPUDeviceOrdinalPlaceholderOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::_TPUDeviceOrdinalPlaceholderOpGenericAdaptorBase; +public: + _TPUDeviceOrdinalPlaceholderOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + _TPUDeviceOrdinalPlaceholderOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : _TPUDeviceOrdinalPlaceholderOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + _TPUDeviceOrdinalPlaceholderOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class _TPUDeviceOrdinalPlaceholderOpAdaptor : public _TPUDeviceOrdinalPlaceholderOpGenericAdaptor<::mlir::ValueRange> { +public: + using _TPUDeviceOrdinalPlaceholderOpGenericAdaptor::_TPUDeviceOrdinalPlaceholderOpGenericAdaptor; + _TPUDeviceOrdinalPlaceholderOpAdaptor(_TPUDeviceOrdinalPlaceholderOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class _TPUDeviceOrdinalPlaceholderOp : public ::mlir::Op<_TPUDeviceOrdinalPlaceholderOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = _TPUDeviceOrdinalPlaceholderOpAdaptor; + template + using GenericAdaptor = _TPUDeviceOrdinalPlaceholderOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("logical_core")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getLogicalCoreAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getLogicalCoreAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf._TPUDeviceOrdinalPlaceholder"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getDeviceOrdinal(); + ::mlir::IntegerAttr getLogicalCoreAttr(); + uint64_t getLogicalCore(); + void setLogicalCoreAttr(::mlir::IntegerAttr attr); + void setLogicalCore(uint64_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type device_ordinal, ::mlir::IntegerAttr logical_core); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr logical_core); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type device_ordinal, uint64_t logical_core); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, uint64_t logical_core); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::_TPUDeviceOrdinalPlaceholderOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::_UnaryOpsCompositionOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class _UnaryOpsCompositionOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + _UnaryOpsCompositionOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + _UnaryOpsCompositionOpGenericAdaptorBase(_UnaryOpsCompositionOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getOpNamesAttr(); + ::mlir::ArrayAttr getOpNames(); +}; +} // namespace detail +template +class _UnaryOpsCompositionOpGenericAdaptor : public detail::_UnaryOpsCompositionOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::_UnaryOpsCompositionOpGenericAdaptorBase; +public: + _UnaryOpsCompositionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + _UnaryOpsCompositionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : _UnaryOpsCompositionOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + _UnaryOpsCompositionOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class _UnaryOpsCompositionOpAdaptor : public _UnaryOpsCompositionOpGenericAdaptor<::mlir::ValueRange> { +public: + using _UnaryOpsCompositionOpGenericAdaptor::_UnaryOpsCompositionOpGenericAdaptor; + _UnaryOpsCompositionOpAdaptor(_UnaryOpsCompositionOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class _UnaryOpsCompositionOp : public ::mlir::Op<_UnaryOpsCompositionOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpTrait::TF::SameOperandsAndResultTypeResolveRef, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = _UnaryOpsCompositionOpAdaptor; + template + using GenericAdaptor = _UnaryOpsCompositionOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("op_names")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOpNamesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOpNamesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf._UnaryOpsComposition"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + ::mlir::ArrayAttr getOpNamesAttr(); + ::mlir::ArrayAttr getOpNames(); + ::mlir::Type getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setOpNamesAttr(::mlir::ArrayAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x, ::mlir::ArrayAttr op_names); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x, ::mlir::ArrayAttr op_names); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x, ::mlir::ArrayAttr op_names); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange inferred, TypeRange actual) { + return ArraysAreCastCompatible(inferred, actual); + } +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::_UnaryOpsCompositionOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::_XlaCompileMlirPlaceholderProgramKeyOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class _XlaCompileMlirPlaceholderProgramKeyOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + _XlaCompileMlirPlaceholderProgramKeyOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + _XlaCompileMlirPlaceholderProgramKeyOpGenericAdaptorBase(_XlaCompileMlirPlaceholderProgramKeyOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class _XlaCompileMlirPlaceholderProgramKeyOpGenericAdaptor : public detail::_XlaCompileMlirPlaceholderProgramKeyOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::_XlaCompileMlirPlaceholderProgramKeyOpGenericAdaptorBase; +public: + _XlaCompileMlirPlaceholderProgramKeyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + _XlaCompileMlirPlaceholderProgramKeyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : _XlaCompileMlirPlaceholderProgramKeyOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + _XlaCompileMlirPlaceholderProgramKeyOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class _XlaCompileMlirPlaceholderProgramKeyOpAdaptor : public _XlaCompileMlirPlaceholderProgramKeyOpGenericAdaptor<::mlir::ValueRange> { +public: + using _XlaCompileMlirPlaceholderProgramKeyOpGenericAdaptor::_XlaCompileMlirPlaceholderProgramKeyOpGenericAdaptor; + _XlaCompileMlirPlaceholderProgramKeyOpAdaptor(_XlaCompileMlirPlaceholderProgramKeyOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class _XlaCompileMlirPlaceholderProgramKeyOp : public ::mlir::Op<_XlaCompileMlirPlaceholderProgramKeyOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = _XlaCompileMlirPlaceholderProgramKeyOpAdaptor; + template + using GenericAdaptor = _XlaCompileMlirPlaceholderProgramKeyOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf._XlaCompileMlirPlaceholderProgramKey"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getProgram(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type program); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::_XlaCompileMlirPlaceholderProgramKeyOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::_XlaCompileOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class _XlaCompileOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + _XlaCompileOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + _XlaCompileOpGenericAdaptorBase(_XlaCompileOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getMustCompileAttr(); + bool getMustCompile(); + ::mlir::SymbolRefAttr getFunctionAttr(); + ::mlir::SymbolRefAttr getFunction(); +}; +} // namespace detail +template +class _XlaCompileOpGenericAdaptor : public detail::_XlaCompileOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::_XlaCompileOpGenericAdaptorBase; +public: + _XlaCompileOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + _XlaCompileOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : _XlaCompileOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + _XlaCompileOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getConstants() { + return getODSOperands(0); + } + + RangeT getArgs() { + return getODSOperands(1); + } + + RangeT getResources() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class _XlaCompileOpAdaptor : public _XlaCompileOpGenericAdaptor<::mlir::ValueRange> { +public: + using _XlaCompileOpGenericAdaptor::_XlaCompileOpGenericAdaptor; + _XlaCompileOpAdaptor(_XlaCompileOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class _XlaCompileOp : public ::mlir::Op<_XlaCompileOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::NResults<2>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::OpAsmOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = _XlaCompileOpAdaptor; + template + using GenericAdaptor = _XlaCompileOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Nresources"), ::llvm::StringRef("Targs"), ::llvm::StringRef("Tconstants"), ::llvm::StringRef("function"), ::llvm::StringRef("must_compile"), ::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getNresourcesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getNresourcesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTargsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTargsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTconstantsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTconstantsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getFunctionAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getFunctionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getMustCompileAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getMustCompileAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf._XlaCompile"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getConstants(); + ::mlir::Operation::operand_range getArgs(); + ::mlir::Operation::operand_range getResources(); + ::mlir::MutableOperandRange getConstantsMutable(); + ::mlir::MutableOperandRange getArgsMutable(); + ::mlir::MutableOperandRange getResourcesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getKey(); + ::mlir::TypedValue<::mlir::TensorType> getCompilationSuccessful(); + ::mlir::BoolAttr getMustCompileAttr(); + bool getMustCompile(); + ::mlir::SymbolRefAttr getFunctionAttr(); + ::mlir::SymbolRefAttr getFunction(); + size_t getNresources(); + mlir::OperandElementTypeRange getTargs(); + mlir::OperandElementTypeRange getTconstants(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setMustCompileAttr(::mlir::BoolAttr attr); + void setMustCompile(bool attrValue); + void setFunctionAttr(::mlir::SymbolRefAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type key, ::mlir::Type compilation_successful, ::mlir::ValueRange constants, ::mlir::ValueRange args, ::mlir::ValueRange resources, ::mlir::BoolAttr must_compile, ::mlir::SymbolRefAttr function); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange constants, ::mlir::ValueRange args, ::mlir::ValueRange resources, ::mlir::BoolAttr must_compile, ::mlir::SymbolRefAttr function); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type key, ::mlir::Type compilation_successful, ::mlir::ValueRange constants, ::mlir::ValueRange args, ::mlir::ValueRange resources, bool must_compile, ::mlir::SymbolRefAttr function); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange constants, ::mlir::ValueRange args, ::mlir::ValueRange resources, bool must_compile, ::mlir::SymbolRefAttr function); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::_XlaCompileOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::_XlaHostComputeMlirOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class _XlaHostComputeMlirOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + _XlaHostComputeMlirOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + _XlaHostComputeMlirOpGenericAdaptorBase(_XlaHostComputeMlirOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getSendKeyAttr(); + ::llvm::StringRef getSendKey(); + ::mlir::StringAttr getRecvKeyAttr(); + ::llvm::StringRef getRecvKey(); + ::mlir::StringAttr getHostMlirModuleAttr(); + ::llvm::StringRef getHostMlirModule(); + ::mlir::BoolAttr getManualShardingAttr(); + bool getManualSharding(); +}; +} // namespace detail +template +class _XlaHostComputeMlirOpGenericAdaptor : public detail::_XlaHostComputeMlirOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::_XlaHostComputeMlirOpGenericAdaptorBase; +public: + _XlaHostComputeMlirOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + _XlaHostComputeMlirOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : _XlaHostComputeMlirOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + _XlaHostComputeMlirOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class _XlaHostComputeMlirOpAdaptor : public _XlaHostComputeMlirOpGenericAdaptor<::mlir::ValueRange> { +public: + using _XlaHostComputeMlirOpGenericAdaptor::_XlaHostComputeMlirOpGenericAdaptor; + _XlaHostComputeMlirOpAdaptor(_XlaHostComputeMlirOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class _XlaHostComputeMlirOp : public ::mlir::Op<_XlaHostComputeMlirOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::VariadicResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = _XlaHostComputeMlirOpAdaptor; + template + using GenericAdaptor = _XlaHostComputeMlirOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tinputs"), ::llvm::StringRef("Toutputs"), ::llvm::StringRef("host_mlir_module"), ::llvm::StringRef("manual_sharding"), ::llvm::StringRef("recv_key"), ::llvm::StringRef("send_key")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTinputsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTinputsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getToutputsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getToutputsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getHostMlirModuleAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getHostMlirModuleAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getManualShardingAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getManualShardingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getRecvKeyAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getRecvKeyAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getSendKeyAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getSendKeyAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf._XlaHostComputeMlir"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::MutableOperandRange getInputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutputs(); + ::mlir::StringAttr getSendKeyAttr(); + ::llvm::StringRef getSendKey(); + ::mlir::StringAttr getRecvKeyAttr(); + ::llvm::StringRef getRecvKey(); + ::mlir::StringAttr getHostMlirModuleAttr(); + ::llvm::StringRef getHostMlirModule(); + ::mlir::BoolAttr getManualShardingAttr(); + bool getManualSharding(); + mlir::OperandElementTypeRange getTinputs(); + mlir::ResultElementTypeRange getToutputs(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setSendKeyAttr(::mlir::StringAttr attr); + void setSendKey(::llvm::StringRef attrValue); + void setRecvKeyAttr(::mlir::StringAttr attr); + void setRecvKey(::llvm::StringRef attrValue); + void setHostMlirModuleAttr(::mlir::StringAttr attr); + void setHostMlirModule(::std::optional<::llvm::StringRef> attrValue); + void setManualShardingAttr(::mlir::BoolAttr attr); + void setManualSharding(::std::optional attrValue); + ::mlir::Attribute removeHostMlirModuleAttr(); + ::mlir::Attribute removeManualShardingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outputs, ::mlir::ValueRange inputs, ::mlir::StringAttr send_key, ::mlir::StringAttr recv_key, /*optional*/::mlir::StringAttr host_mlir_module, /*optional*/::mlir::BoolAttr manual_sharding); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outputs, ::mlir::ValueRange inputs, ::llvm::StringRef send_key, ::llvm::StringRef recv_key, /*optional*/::llvm::StringRef host_mlir_module = "", /*optional*/bool manual_sharding = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + func::FuncOp GetHostFunc(mlir::OwningOpRef* mlir_module); +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::_XlaHostComputeMlirOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::_XlaRecvAtHostOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class _XlaRecvAtHostOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + _XlaRecvAtHostOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + _XlaRecvAtHostOpGenericAdaptorBase(_XlaRecvAtHostOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getKeyAttr(); + ::llvm::StringRef getKey(); + ::mlir::IntegerAttr getDeviceOrdinalAttr(); + uint64_t getDeviceOrdinal(); + ::mlir::StringAttr getDeviceTypeAttr(); + ::llvm::StringRef getDeviceType(); +}; +} // namespace detail +template +class _XlaRecvAtHostOpGenericAdaptor : public detail::_XlaRecvAtHostOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::_XlaRecvAtHostOpGenericAdaptorBase; +public: + _XlaRecvAtHostOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + _XlaRecvAtHostOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : _XlaRecvAtHostOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + _XlaRecvAtHostOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getDynamicKey() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class _XlaRecvAtHostOpAdaptor : public _XlaRecvAtHostOpGenericAdaptor<::mlir::ValueRange> { +public: + using _XlaRecvAtHostOpGenericAdaptor::_XlaRecvAtHostOpGenericAdaptor; + _XlaRecvAtHostOpAdaptor(_XlaRecvAtHostOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class _XlaRecvAtHostOp : public ::mlir::Op<_XlaRecvAtHostOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::VariadicResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, GetResourceInstanceInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = _XlaRecvAtHostOpAdaptor; + template + using GenericAdaptor = _XlaRecvAtHostOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Toutputs"), ::llvm::StringRef("device_ordinal"), ::llvm::StringRef("device_type"), ::llvm::StringRef("key")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getToutputsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getToutputsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDeviceOrdinalAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDeviceOrdinalAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDeviceTypeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDeviceTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getKeyAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getKeyAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf._XlaRecvAtHost"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getDynamicKey(); + ::mlir::OpOperand &getDynamicKeyMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutputs(); + ::mlir::StringAttr getKeyAttr(); + ::llvm::StringRef getKey(); + ::mlir::IntegerAttr getDeviceOrdinalAttr(); + uint64_t getDeviceOrdinal(); + ::mlir::StringAttr getDeviceTypeAttr(); + ::llvm::StringRef getDeviceType(); + mlir::ResultElementTypeRange getToutputs(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setKeyAttr(::mlir::StringAttr attr); + void setKey(::llvm::StringRef attrValue); + void setDeviceOrdinalAttr(::mlir::IntegerAttr attr); + void setDeviceOrdinal(uint64_t attrValue); + void setDeviceTypeAttr(::mlir::StringAttr attr); + void setDeviceType(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeDeviceTypeAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outputs, ::mlir::Value dynamic_key, ::mlir::StringAttr key, ::mlir::IntegerAttr device_ordinal, /*optional*/::mlir::StringAttr device_type); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outputs, ::mlir::Value dynamic_key, ::llvm::StringRef key, uint64_t device_ordinal, /*optional*/::llvm::StringRef device_type = "TPU"); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + std::optional GetResourceInstanceStr(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::_XlaRecvAtHostOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::_XlaRecvAtHostV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class _XlaRecvAtHostV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + _XlaRecvAtHostV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + _XlaRecvAtHostV2OpGenericAdaptorBase(_XlaRecvAtHostV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getKeyAttr(); + ::llvm::StringRef getKey(); + ::mlir::StringAttr getDeviceTypeAttr(); + ::llvm::StringRef getDeviceType(); +}; +} // namespace detail +template +class _XlaRecvAtHostV2OpGenericAdaptor : public detail::_XlaRecvAtHostV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::_XlaRecvAtHostV2OpGenericAdaptorBase; +public: + _XlaRecvAtHostV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + _XlaRecvAtHostV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : _XlaRecvAtHostV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + _XlaRecvAtHostV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getDynamicKey() { + return (*getODSOperands(0).begin()); + } + + ValueT getDeviceOrdinal() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class _XlaRecvAtHostV2OpAdaptor : public _XlaRecvAtHostV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using _XlaRecvAtHostV2OpGenericAdaptor::_XlaRecvAtHostV2OpGenericAdaptor; + _XlaRecvAtHostV2OpAdaptor(_XlaRecvAtHostV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class _XlaRecvAtHostV2Op : public ::mlir::Op<_XlaRecvAtHostV2Op, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::VariadicResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, GetResourceInstanceInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = _XlaRecvAtHostV2OpAdaptor; + template + using GenericAdaptor = _XlaRecvAtHostV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Toutputs"), ::llvm::StringRef("device_type"), ::llvm::StringRef("key")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getToutputsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getToutputsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDeviceTypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDeviceTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getKeyAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getKeyAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf._XlaRecvAtHostV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getDynamicKey(); + ::mlir::TypedValue<::mlir::TensorType> getDeviceOrdinal(); + ::mlir::OpOperand &getDynamicKeyMutable(); + ::mlir::OpOperand &getDeviceOrdinalMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOutputs(); + ::mlir::StringAttr getKeyAttr(); + ::llvm::StringRef getKey(); + ::mlir::StringAttr getDeviceTypeAttr(); + ::llvm::StringRef getDeviceType(); + mlir::ResultElementTypeRange getToutputs(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setKeyAttr(::mlir::StringAttr attr); + void setKey(::llvm::StringRef attrValue); + void setDeviceTypeAttr(::mlir::StringAttr attr); + void setDeviceType(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeDeviceTypeAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outputs, ::mlir::Value dynamic_key, ::mlir::Value device_ordinal, ::mlir::StringAttr key, /*optional*/::mlir::StringAttr device_type); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outputs, ::mlir::Value dynamic_key, ::mlir::Value device_ordinal, ::llvm::StringRef key, /*optional*/::llvm::StringRef device_type = "TPU"); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + std::optional GetResourceInstanceStr(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::_XlaRecvAtHostV2Op) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::_XlaRunOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class _XlaRunOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + _XlaRunOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + _XlaRunOpGenericAdaptorBase(_XlaRunOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class _XlaRunOpGenericAdaptor : public detail::_XlaRunOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::_XlaRunOpGenericAdaptorBase; +public: + _XlaRunOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + _XlaRunOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : _XlaRunOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + _XlaRunOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + ValueT getKey() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class _XlaRunOpAdaptor : public _XlaRunOpGenericAdaptor<::mlir::ValueRange> { +public: + using _XlaRunOpGenericAdaptor::_XlaRunOpGenericAdaptor; + _XlaRunOpAdaptor(_XlaRunOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class _XlaRunOp : public ::mlir::Op<_XlaRunOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::VariadicResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = _XlaRunOpAdaptor; + template + using GenericAdaptor = _XlaRunOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Targs"), ::llvm::StringRef("Tresults")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTargsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTargsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getTresultsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getTresultsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf._XlaRun"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::TypedValue<::mlir::TensorType> getKey(); + ::mlir::MutableOperandRange getArgsMutable(); + ::mlir::OpOperand &getKeyMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResults(); + mlir::OperandElementTypeRange getTargs(); + mlir::ResultElementTypeRange getTresults(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange results, ::mlir::ValueRange args, ::mlir::Value key); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::_XlaRunOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::_XlaSendFromHostOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class _XlaSendFromHostOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + _XlaSendFromHostOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + _XlaSendFromHostOpGenericAdaptorBase(_XlaSendFromHostOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getKeyAttr(); + ::llvm::StringRef getKey(); + ::mlir::IntegerAttr getDeviceOrdinalAttr(); + uint64_t getDeviceOrdinal(); + ::mlir::StringAttr getDeviceTypeAttr(); + ::llvm::StringRef getDeviceType(); +}; +} // namespace detail +template +class _XlaSendFromHostOpGenericAdaptor : public detail::_XlaSendFromHostOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::_XlaSendFromHostOpGenericAdaptorBase; +public: + _XlaSendFromHostOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + _XlaSendFromHostOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : _XlaSendFromHostOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + _XlaSendFromHostOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + ValueT getDynamicKey() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class _XlaSendFromHostOpAdaptor : public _XlaSendFromHostOpGenericAdaptor<::mlir::ValueRange> { +public: + using _XlaSendFromHostOpGenericAdaptor::_XlaSendFromHostOpGenericAdaptor; + _XlaSendFromHostOpAdaptor(_XlaSendFromHostOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class _XlaSendFromHostOp : public ::mlir::Op<_XlaSendFromHostOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::ZeroResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::OpInvariants, GetResourceInstanceInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = _XlaSendFromHostOpAdaptor; + template + using GenericAdaptor = _XlaSendFromHostOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tinputs"), ::llvm::StringRef("device_ordinal"), ::llvm::StringRef("device_type"), ::llvm::StringRef("key")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTinputsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTinputsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDeviceOrdinalAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDeviceOrdinalAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDeviceTypeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDeviceTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getKeyAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getKeyAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf._XlaSendFromHost"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::TypedValue<::mlir::TensorType> getDynamicKey(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::OpOperand &getDynamicKeyMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::StringAttr getKeyAttr(); + ::llvm::StringRef getKey(); + ::mlir::IntegerAttr getDeviceOrdinalAttr(); + uint64_t getDeviceOrdinal(); + ::mlir::StringAttr getDeviceTypeAttr(); + ::llvm::StringRef getDeviceType(); + mlir::OperandElementTypeRange getTinputs(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setKeyAttr(::mlir::StringAttr attr); + void setKey(::llvm::StringRef attrValue); + void setDeviceOrdinalAttr(::mlir::IntegerAttr attr); + void setDeviceOrdinal(uint64_t attrValue); + void setDeviceTypeAttr(::mlir::StringAttr attr); + void setDeviceType(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeDeviceTypeAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange inputs, ::mlir::Value dynamic_key, ::mlir::StringAttr key, ::mlir::IntegerAttr device_ordinal, /*optional*/::mlir::StringAttr device_type); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::mlir::Value dynamic_key, ::mlir::StringAttr key, ::mlir::IntegerAttr device_ordinal, /*optional*/::mlir::StringAttr device_type); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange inputs, ::mlir::Value dynamic_key, ::llvm::StringRef key, uint64_t device_ordinal, /*optional*/::llvm::StringRef device_type = "TPU"); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::mlir::Value dynamic_key, ::llvm::StringRef key, uint64_t device_ordinal, /*optional*/::llvm::StringRef device_type = "TPU"); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + std::optional GetResourceInstanceStr(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::_XlaSendFromHostOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::_XlaSendFromHostV2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class _XlaSendFromHostV2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + _XlaSendFromHostV2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + _XlaSendFromHostV2OpGenericAdaptorBase(_XlaSendFromHostV2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getKeyAttr(); + ::llvm::StringRef getKey(); + ::mlir::StringAttr getDeviceTypeAttr(); + ::llvm::StringRef getDeviceType(); +}; +} // namespace detail +template +class _XlaSendFromHostV2OpGenericAdaptor : public detail::_XlaSendFromHostV2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::_XlaSendFromHostV2OpGenericAdaptorBase; +public: + _XlaSendFromHostV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + _XlaSendFromHostV2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : _XlaSendFromHostV2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + _XlaSendFromHostV2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + ValueT getDynamicKey() { + return (*getODSOperands(1).begin()); + } + + ValueT getDeviceOrdinal() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class _XlaSendFromHostV2OpAdaptor : public _XlaSendFromHostV2OpGenericAdaptor<::mlir::ValueRange> { +public: + using _XlaSendFromHostV2OpGenericAdaptor::_XlaSendFromHostV2OpGenericAdaptor; + _XlaSendFromHostV2OpAdaptor(_XlaSendFromHostV2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class _XlaSendFromHostV2Op : public ::mlir::Op<_XlaSendFromHostV2Op, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::ZeroResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, GetResourceInstanceInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::DerivedAttributeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = _XlaSendFromHostV2OpAdaptor; + template + using GenericAdaptor = _XlaSendFromHostV2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("Tinputs"), ::llvm::StringRef("device_type"), ::llvm::StringRef("key")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTinputsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTinputsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDeviceTypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDeviceTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getKeyAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getKeyAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf._XlaSendFromHostV2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::TypedValue<::mlir::TensorType> getDynamicKey(); + ::mlir::TypedValue<::mlir::TensorType> getDeviceOrdinal(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::OpOperand &getDynamicKeyMutable(); + ::mlir::OpOperand &getDeviceOrdinalMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::StringAttr getKeyAttr(); + ::llvm::StringRef getKey(); + ::mlir::StringAttr getDeviceTypeAttr(); + ::llvm::StringRef getDeviceType(); + mlir::OperandElementTypeRange getTinputs(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setKeyAttr(::mlir::StringAttr attr); + void setKey(::llvm::StringRef attrValue); + void setDeviceTypeAttr(::mlir::StringAttr attr); + void setDeviceType(::std::optional<::llvm::StringRef> attrValue); + ::mlir::Attribute removeDeviceTypeAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange inputs, ::mlir::Value dynamic_key, ::mlir::Value device_ordinal, ::mlir::StringAttr key, /*optional*/::mlir::StringAttr device_type); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::mlir::Value dynamic_key, ::mlir::Value device_ordinal, ::mlir::StringAttr key, /*optional*/::mlir::StringAttr device_type); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange inputs, ::mlir::Value dynamic_key, ::mlir::Value device_ordinal, ::llvm::StringRef key, /*optional*/::llvm::StringRef device_type = "TPU"); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::mlir::Value dynamic_key, ::mlir::Value device_ordinal, ::llvm::StringRef key, /*optional*/::llvm::StringRef device_type = "TPU"); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + std::optional GetResourceInstanceStr(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::_XlaSendFromHostV2Op) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_saved_model.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_saved_model.h new file mode 100644 index 0000000000000000000000000000000000000000..53d335f4ff2d433e1df5a6552a273d92091e8cd4 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_saved_model.h @@ -0,0 +1,120 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_SAVED_MODEL_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_SAVED_MODEL_H_ + +#include "mlir/Dialect/Func/IR/FuncOps.h" // from @llvm-project +#include "mlir/IR/BuiltinOps.h" // from @llvm-project +#include "mlir/IR/Dialect.h" // from @llvm-project +#include "mlir/IR/OpDefinition.h" // from @llvm-project + +namespace mlir { +namespace tf_saved_model { + +// The name of the attribute indicating under what name an object is exported. +inline constexpr StringRef kTfSavedModelExportedNamesAttr = + "tf_saved_model.exported_names"; + +// The name of the attribute attached to input arguments or results of a +// function to represent the path which one would use to index into a structured +// value to reach a given tensor. +inline constexpr StringRef kTfSavedModelIndexPathAttr = + "tf_saved_model.index_path"; + +// Name of the attribute that inidicates the type of initializer. It should be +// on a function and the function should exist in the initializers attribute of +// the SessionInitializerOp. +inline constexpr StringRef kTfSavedModelInitializerTypeAttr = + "tf_saved_model.initializer_type"; + +// Indicates that the initializer corresponds to the restore op. +inline constexpr StringRef kTfSavedModelInitializerRestoreType = "restore_op"; + +// Indicates that the initializer corresponds to the init op. +inline constexpr StringRef kTfSavedModelInitializerInitType = "init_op"; + +class TensorFlowSavedModelDialect : public Dialect { + public: + explicit TensorFlowSavedModelDialect(MLIRContext *context); + LogicalResult verifyRegionArgAttribute(Operation *op, unsigned region_index, + unsigned arg_index, + NamedAttribute named_attr) override; + LogicalResult verifyRegionResultAttribute(Operation *op, + unsigned region_index, + unsigned result_index, + NamedAttribute named_attr) override; + LogicalResult verifyOperationAttribute(Operation *op, + NamedAttribute named_attr) override; + + static StringRef getDialectNamespace() { return "tf_saved_model"; } +}; + +} // namespace tf_saved_model +} // namespace mlir + +// Declares the operations for this dialect using the generated header. +#define GET_OP_CLASSES +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_saved_model.h.inc" + +namespace mlir { +namespace tf_saved_model { + +// Returns the list of exported names for `op`. +// An empty list means `op` is not exported. +SmallVector GetExportedNames(Operation *op); + +// Returns true if `op` is exported. +bool IsExported(Operation *op); + +// Returns true if `module` has tf_saved_model linkage semantics. +bool HasTfSavedModelSemantics(ModuleOp module_op); + +// Returns the tf_saved_model.global_tensor op that func's arg_index'th argument +// refers to as a bound input, or null. +Operation *LookupBoundInput(func::FuncOp func, int arg_index, + const SymbolTable &symbol_table); + +template +T LookupBoundInputOfType(func::FuncOp func, int arg_index, + const SymbolTable &symbol_table) { + return llvm::dyn_cast_or_null( + LookupBoundInput(func, arg_index, symbol_table)); +} + +// Gets the type that an exported function arg that is bound to symbol ops such +// as `global_tensor` and `asset` should have. +Type GetBoundInputArgTypeFor(mlir::Operation *op); + +// Returns the session initializer of this module if it exists. Returns null +// otherwise. +SessionInitializerOp GetSessionInitializerOp(ModuleOp module_op); + +// Returns the exported name for the session initializer function. +SmallVector GetSessionInitializerExportedName(ModuleOp module_op); + +// Returns initializer function ops. These functions' symbols are in the +// "initializers" attribute of the session initializer op. +SmallVector GetInitializerFunctions(ModuleOp module_op); + +// Returns the initializer function whose `tf_saved_model.initializer_type` +// attribute matches `initializer_type`. Returns a null op if it doesn't exist. +func::FuncOp GetInitializerFunction(ModuleOp module_op, + StringRef initializer_type); + +} // namespace tf_saved_model +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_SAVED_MODEL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_saved_model.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_saved_model.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..f25cf5571f1180f57afd17cd4b332952a952f0ef --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_saved_model.h.inc @@ -0,0 +1,450 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: tf_saved_model_ops.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#if defined(GET_OP_CLASSES) || defined(GET_OP_FWD_DEFINES) +#undef GET_OP_FWD_DEFINES +namespace mlir { +namespace tf_saved_model { +class AssetOp; +} // namespace tf_saved_model +} // namespace mlir +namespace mlir { +namespace tf_saved_model { +class GlobalTensorOp; +} // namespace tf_saved_model +} // namespace mlir +namespace mlir { +namespace tf_saved_model { +class SessionInitializerOp; +} // namespace tf_saved_model +} // namespace mlir +#endif + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace tf_saved_model { + +//===----------------------------------------------------------------------===// +// ::mlir::tf_saved_model::AssetOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AssetOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AssetOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AssetOpGenericAdaptorBase(AssetOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getSymNameAttr(); + ::llvm::StringRef getSymName(); + ::mlir::StringAttr getFilenameAttr(); + ::llvm::StringRef getFilename(); +}; +} // namespace detail +template +class AssetOpGenericAdaptor : public detail::AssetOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AssetOpGenericAdaptorBase; +public: + AssetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AssetOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AssetOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AssetOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AssetOpAdaptor : public AssetOpGenericAdaptor<::mlir::ValueRange> { +public: + using AssetOpGenericAdaptor::AssetOpGenericAdaptor; + AssetOpAdaptor(AssetOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AssetOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = AssetOpAdaptor; + template + using GenericAdaptor = AssetOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("filename"), ::llvm::StringRef("sym_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFilenameAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFilenameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getSymNameAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getSymNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf_saved_model.asset"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::StringAttr getSymNameAttr(); + ::llvm::StringRef getSymName(); + ::mlir::StringAttr getFilenameAttr(); + ::llvm::StringRef getFilename(); + void setSymNameAttr(::mlir::StringAttr attr); + void setSymName(::llvm::StringRef attrValue); + void setFilenameAttr(::mlir::StringAttr attr); + void setFilename(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, ::mlir::StringAttr filename); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, ::mlir::StringAttr filename); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name, ::llvm::StringRef filename); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, ::llvm::StringRef filename); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace tf_saved_model +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::tf_saved_model::AssetOp) + +namespace mlir { +namespace tf_saved_model { + +//===----------------------------------------------------------------------===// +// ::mlir::tf_saved_model::GlobalTensorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GlobalTensorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + GlobalTensorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + GlobalTensorOpGenericAdaptorBase(GlobalTensorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getSymNameAttr(); + ::llvm::StringRef getSymName(); + ::mlir::ElementsAttr getValueAttr(); + ::std::optional< ::mlir::ElementsAttr > getValue(); + ::mlir::TypeAttr getTypeAttr(); + ::mlir::Type getType(); + ::mlir::UnitAttr getIsMutableAttr(); + bool getIsMutable(); +}; +} // namespace detail +template +class GlobalTensorOpGenericAdaptor : public detail::GlobalTensorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GlobalTensorOpGenericAdaptorBase; +public: + GlobalTensorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GlobalTensorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GlobalTensorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + GlobalTensorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GlobalTensorOpAdaptor : public GlobalTensorOpGenericAdaptor<::mlir::ValueRange> { +public: + using GlobalTensorOpGenericAdaptor::GlobalTensorOpGenericAdaptor; + GlobalTensorOpAdaptor(GlobalTensorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GlobalTensorOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = GlobalTensorOpAdaptor; + template + using GenericAdaptor = GlobalTensorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("is_mutable"), ::llvm::StringRef("sym_name"), ::llvm::StringRef("type"), ::llvm::StringRef("value")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getIsMutableAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getIsMutableAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getSymNameAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getSymNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTypeAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getValueAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getValueAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf_saved_model.global_tensor"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::StringAttr getSymNameAttr(); + ::llvm::StringRef getSymName(); + ::mlir::ElementsAttr getValueAttr(); + ::std::optional< ::mlir::ElementsAttr > getValue(); + ::mlir::TypeAttr getTypeAttr(); + ::mlir::Type getType(); + ::mlir::UnitAttr getIsMutableAttr(); + bool getIsMutable(); + void setSymNameAttr(::mlir::StringAttr attr); + void setSymName(::llvm::StringRef attrValue); + void setValueAttr(::mlir::ElementsAttr attr); + void setTypeAttr(::mlir::TypeAttr attr); + void setType(::mlir::Type attrValue); + void setIsMutableAttr(::mlir::UnitAttr attr); + void setIsMutable(bool attrValue); + ::mlir::Attribute removeValueAttr(); + ::mlir::Attribute removeIsMutableAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::StringAttr sym_name, /*optional*/::mlir::ElementsAttr value, ::mlir::TypeAttr type, /*optional*/::mlir::UnitAttr is_mutable); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::StringAttr sym_name, /*optional*/::mlir::ElementsAttr value, ::mlir::TypeAttr type, /*optional*/::mlir::UnitAttr is_mutable); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::llvm::StringRef sym_name, /*optional*/::mlir::ElementsAttr value, ::mlir::Type type, /*optional*/bool is_mutable = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::llvm::StringRef sym_name, /*optional*/::mlir::ElementsAttr value, ::mlir::Type type, /*optional*/bool is_mutable = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace tf_saved_model +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::tf_saved_model::GlobalTensorOp) + +namespace mlir { +namespace tf_saved_model { + +//===----------------------------------------------------------------------===// +// ::mlir::tf_saved_model::SessionInitializerOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SessionInitializerOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SessionInitializerOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SessionInitializerOpGenericAdaptorBase(SessionInitializerOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getInitializersAttr(); + ::mlir::ArrayAttr getInitializers(); +}; +} // namespace detail +template +class SessionInitializerOpGenericAdaptor : public detail::SessionInitializerOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SessionInitializerOpGenericAdaptorBase; +public: + SessionInitializerOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SessionInitializerOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SessionInitializerOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SessionInitializerOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SessionInitializerOpAdaptor : public SessionInitializerOpGenericAdaptor<::mlir::ValueRange> { +public: + using SessionInitializerOpGenericAdaptor::SessionInitializerOpGenericAdaptor; + SessionInitializerOpAdaptor(SessionInitializerOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SessionInitializerOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = SessionInitializerOpAdaptor; + template + using GenericAdaptor = SessionInitializerOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("initializers")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getInitializersAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getInitializersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf_saved_model.session_initializer"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::ArrayAttr getInitializersAttr(); + ::mlir::ArrayAttr getInitializers(); + void setInitializersAttr(::mlir::ArrayAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ArrayAttr initializers); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ArrayAttr initializers); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace tf_saved_model +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::tf_saved_model::SessionInitializerOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_side_effects.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_side_effects.h new file mode 100644 index 0000000000000000000000000000000000000000..6384d0770a335817937e3dc4dd567709ad94c96c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_side_effects.h @@ -0,0 +1,136 @@ +/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +// This is the side effect definition file for TensorFlow. +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_SIDE_EFFECTS_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_SIDE_EFFECTS_H_ + +#include "mlir/Interfaces/SideEffectInterfaces.h" // from @llvm-project + +namespace mlir { +namespace TF { +namespace ResourceEffects { + +struct Variable : ::mlir::SideEffects::Resource::Base { + StringRef getName() final { return "Variable"; } +}; + +struct Stack : ::mlir::SideEffects::Resource::Base { + StringRef getName() final { return "Stack"; } +}; + +struct TensorArray : ::mlir::SideEffects::Resource::Base { + StringRef getName() final { return "TensorArray"; } +}; + +struct Summary : ::mlir::SideEffects::Resource::Base { + StringRef getName() final { return "Summary"; } +}; + +struct LookupTable : ::mlir::SideEffects::Resource::Base { + StringRef getName() final { return "LookupTable"; } +}; + +struct DatasetSeedGenerator + : ::mlir::SideEffects::Resource::Base { + StringRef getName() final { return "DatasetSeedGenerator"; } +}; + +struct DatasetMemoryCache + : ::mlir::SideEffects::Resource::Base { + StringRef getName() final { return "DatasetMemoryCache"; } +}; + +struct DatasetIterator : ::mlir::SideEffects::Resource::Base { + StringRef getName() final { return "DatasetIterator"; } +}; + +// Special resource type to track TPU Embedding specific ops, which must execute +// but do not have side effects with one another or with resource variable ops. +struct TPUEmbedding : ::mlir::SideEffects::Resource::Base { + StringRef getName() final { return "TPUEmbedding"; } +}; + +// Resource corresponding to GeneratorOp. +struct GeneratorOp : public ::mlir::SideEffects::Resource::Base { + StringRef getName() final { return "Generator"; } +}; + +struct Send : public ::mlir::SideEffects::Resource::Base { + StringRef getName() final { return "Send"; } +}; + +struct Recv : public ::mlir::SideEffects::Resource::Base { + StringRef getName() final { return "Recv"; } +}; + +struct XlaHostCompute + : public ::mlir::SideEffects::Resource::Base { + StringRef getName() final { return "XlaHostCompute"; } +}; + +struct RandomGenerator + : public ::mlir::SideEffects::Resource::Base { + StringRef getName() final { return "RandomGenerator"; } +}; + +struct TPUExecute : public ::mlir::SideEffects::Resource::Base { + StringRef getName() final { return "TPUExecute"; } +}; + +struct MustExecute : public ::mlir::SideEffects::Resource::Base { + StringRef getName() final { return "MustExecute"; } +}; + +struct CollectiveReduceOrdering + : public ::mlir::SideEffects::Resource::Base { + StringRef getName() final { return "CollectiveReduceOrdering"; } +}; + +struct NcclAllReduceOrdering + : public ::mlir::SideEffects::Resource::Base { + StringRef getName() final { return "NcclAllReduceOrdering"; } +}; + +struct GlobalIterId : public ::mlir::SideEffects::Resource::Base { + StringRef getName() final { return "GlobalIterId"; } +}; + +struct XlaLaunch : public ::mlir::SideEffects::Resource::Base { + StringRef getName() final { return "XlaLaunch"; } +}; + +struct WriteTrainingPredictions + : public ::mlir::SideEffects::Resource::Base { + StringRef getName() final { return "WriteTrainingPredictions"; } +}; + +struct _XlaRun : public ::mlir::SideEffects::Resource::Base<_XlaRun> { + StringRef getName() final { return "_XlaRun"; } +}; + +// Returns true iff resource type with given ID is only self-dependent, i.e., +// there are no dependencies to other resource types (including unknown resource +// type). +inline bool IsOnlySelfDependent(TypeID resource_type_id) { + return resource_type_id == ResourceEffects::Send::getResourceID() || + resource_type_id == ResourceEffects::Recv::getResourceID(); +} + +} // namespace ResourceEffects +} // namespace TF +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_SIDE_EFFECTS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_structs.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_structs.h new file mode 100644 index 0000000000000000000000000000000000000000..2c6fd05dcfa5334ff5b83ff724f119effc807571 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_structs.h @@ -0,0 +1,69 @@ +/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +// This file defines the types used in the standard MLIR TensorFlow dialect. + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_STRUCTS_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_STRUCTS_H_ + +#include + +#include "llvm/ADT/StringMap.h" +#include "mlir/IR/BuiltinTypes.h" // from @llvm-project +#include "mlir/IR/Diagnostics.h" // from @llvm-project +#include "mlir/IR/Location.h" // from @llvm-project +#include "mlir/IR/Operation.h" // from @llvm-project +#include "mlir/IR/Types.h" // from @llvm-project +#include "tensorflow/core/ir/types/dialect.h" +#include "tensorflow/core/util/device_name_utils.h" + +namespace mlir { +namespace TF { + +using GpuDeviceMetadata = tf_type::GpuDeviceMetadataAttr; + +// Tensorflow devices available at runtime with corresponding metadata if it is +// available. It's completely valid to have a device without any metadata +// attached to it. +class RuntimeDevices { + using DeviceNameUtils = ::tensorflow::DeviceNameUtils; + using ParsedName = ::tensorflow::DeviceNameUtils::ParsedName; + + public: + // Adds a device with and empty metadata. Device can be of any type. + void AddDevice(const ParsedName& device); + + // Adds a GPU device with GPU specific metadata. + void AddGpuDevice(const ParsedName& device, + const GpuDeviceMetadata& metadata); + + llvm::ArrayRef device_names() const { return device_names_; } + size_t NumDevices() const { return device_names_.size(); } + + // Returns GPU device metadata if it is available, otherwise returns None. + std::optional GetGpuDeviceMetadata( + const ParsedName& device) const; + + private: + llvm::SmallVector device_names_; + // TODO(ezhulenev): Add DenseMapInfo specialization to be able to + // use ParsedName as a key in a DenseMap. + llvm::StringMap gpu_metadata_; +}; + +} // namespace TF +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_STRUCTS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_traits.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_traits.h new file mode 100644 index 0000000000000000000000000000000000000000..62f6192c1f84f0ef9c8869d2d754670371abcc63 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_traits.h @@ -0,0 +1,328 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +// This file defines the op traits used in the MLIR TensorFlow dialect. + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_TRAITS_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_TRAITS_H_ + +#include + +#include "mlir/IR/BuiltinTypeInterfaces.h" // from @llvm-project +#include "mlir/IR/BuiltinTypes.h" // from @llvm-project +#include "mlir/IR/OpDefinition.h" // from @llvm-project +#include "mlir/IR/TypeUtilities.h" // from @llvm-project +#include "mlir/Interfaces/InferTypeOpInterface.h" // from @llvm-project +#include "mlir/Interfaces/SideEffectInterfaces.h" // from @llvm-project +#include "mlir/Support/LogicalResult.h" // from @llvm-project +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_op_interfaces.h" +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_types.h" + +namespace mlir { +namespace OpTrait { +namespace TF { + +// Verifies if 'ref_type' is a REF type corresponding to 'type'. +static inline LogicalResult VerifyRefTypeMatch(mlir::Type type, + mlir::Type maybe_ref_type) { + if (auto ref_type = + maybe_ref_type.dyn_cast()) + return success(ref_type.RemoveRef().getTypeID() == type.getTypeID()); + return failure(); +} + +// This class provides verification for ops that are known to have the same +// result types and all operands are either of the same type as result or a REF +// type corresponding to the result type. +// TODO(jpienaar): Update the name and the description. +template +class OperandsSameAsResultsTypeOrRef + : public TraitBase { + public: + static LogicalResult verifyTrait(Operation* op) { + LogicalResult shapeMatch = impl::verifySameOperandsAndResultShape(op); + if (failed(shapeMatch)) return shapeMatch; + Type type = op->getResult(0).getType(); + // Verify that the first result type is same as the rest of the results. + // We skip the comparison against itself. + for (auto result_type : llvm::drop_begin(op->getResultTypes(), 1)) { + if (!mlir::tf_type::HasCompatibleElementTypes(type, result_type)) + return op->emitOpError() + << "requires all return types to have compatible element types"; + } + for (auto operand_type : op->getOperandTypes()) { + if (!mlir::tf_type::HasCompatibleElementTypes( + operand_type, type, /*may_ignore_ref_type_lhs=*/true)) + return op->emitError() << "requires all operands and results to have " + "compatible element types"; + } + return success(); + } +}; + +namespace detail { +inline LogicalResult verifySameOperandsAndResultElementTypeResolveRef( + Operation* op) { + Type element_type; + if (op->getNumResults() > 0) { + element_type = mlir::tf_type::GetElementTypeOrSelfResolveRef( + op->getResult(0).getType()); + } else if (op->getNumOperands() > 0) { + element_type = mlir::tf_type::GetElementTypeOrSelfResolveRef( + op->getOperand(0).getType()); + } else { + // Nothing to check. + return success(); + } + // Verify that all result element types are compatible to `element_type`. + for (const auto& result_type : op->getResultTypes()) { + if (mlir::tf_type::GetElementTypeOrSelfResolveRef(result_type) != + element_type) { + return op->emitOpError( + "requires compatible element types for all operands and results"); + } + } + // Verify that all operand element types are compatible to `element_type`. + for (const auto& operand_type : op->getOperandTypes()) { + if (mlir::tf_type::GetElementTypeOrSelfResolveRef(operand_type) != + element_type) { + return op->emitOpError( + "requires compatible element types for all operands and results"); + } + } + return success(); +} + +inline ShapedType MergeType(ShapedType a, ShapedType b) { + if (!a.hasRank()) { + return b; + } + if (!b.hasRank()) { + return a; + } + int64_t rank = a.getRank(); + SmallVector dims; + dims.resize(rank); + for (int i = 0, e = rank; i != e; i++) { + int64_t dim0 = a.getDimSize(i); + int64_t dim1 = b.getDimSize(i); + dims[i] = (dim0 == ShapedType::kDynamic) ? dim1 : dim0; + } + return RankedTensorType::get(dims, a.getElementType()); +} +} // namespace detail + +// Verifies that op has the same operand and result element types (or type +// itself, if scalar) after resolving reference types (i.e., after converting +// reference types to their corresponding TensorFlow or standard types). +template +class SameOperandsAndResultElementTypeResolveRef + : public TraitBase { + public: + static LogicalResult verifyTrait(Operation* op) { + return detail::verifySameOperandsAndResultElementTypeResolveRef(op); + } +}; + +// Verifies that op has the same operand and result types after resolving +// reference types (i.e., after converting reference types to their +// corresponding TensorFlow or standard types). +template +class SameOperandsAndResultTypeResolveRef + : public TraitBase { + public: + static LogicalResult verifyTrait(Operation* op) { + if (failed(impl::verifySameOperandsAndResultShape(op))) return failure(); + return detail::verifySameOperandsAndResultElementTypeResolveRef(op); + } + + static LogicalResult inferReturnTypeComponentsFromOperands( + MLIRContext*, std::optional location, ValueShapeRange operands, + DictionaryAttr attributes, OpaqueProperties properties, + RegionRange regions, + SmallVectorImpl& inferredReturnShapes) { + if (operands.empty()) + return emitOptionalError( + location, + "Expected non-empty operands for [CompatibleOperandsAndResultType]"); + + auto result_ty = llvm::dyn_cast_or_null(operands[0].getType()); + if (!result_ty) { + return emitOptionalError(location, "Expected shape type for operand 0"); + } + for (auto [index, ty] : + llvm::drop_begin(llvm::enumerate(operands.getTypes()), 1)) { + auto shape_type = llvm::dyn_cast_or_null(ty); + if (!shape_type) { + return emitOptionalError(location, "Expected shape type for operand ", + index); + } + result_ty = detail::MergeType(shape_type, result_ty); + } + inferredReturnShapes.push_back(result_ty); + return success(); + } +}; + +// Layout agnostic operations do not depend on the operands data layout (data +// format), as and example all element wise operations are layout agnostic. +template +class LayoutAgnostic : public TraitBase {}; + +// Trait to indicate operations that cannot be duplicated as they might carry +// certain state around within their implementations. +template +class CannotDuplicate : public TraitBase { + public: + static LogicalResult verifyTrait(Operation* op) { + if (isMemoryEffectFree(op)) + return op->emitError( + "operations with no side effects cannot have CannotDuplicate trait"); + return success(); + } +}; + +// Trait to indicate an operation cannot be constant folded. +template +class NoConstantFold : public TraitBase {}; + +// Coefficient-wise binary operation with implicit broadcasting support, for +// example tf.Sub operation. +template +class CwiseBinary : public TraitBase {}; + +// Coefficient-wise unary operation, for example tf.Sqrt operation. +template +class CwiseUnary : public TraitBase {}; + +namespace detail { + +inline LogicalResult verifyIsIdempotent(Operation* op) { + // TODO(b/246518997): Add back check for no side effects on operation. + // Currently adding it would cause the shared library build + // to fail since there would be a dependency of IR on SideEffectInterfaces + // which is cyclical. + return success(); +} + +inline OpFoldResult foldIdempotent(Operation* op) { + if (op->getNumOperands() == 1) { + auto* argumentOp = op->getOperand(0).getDefiningOp(); + if (argumentOp && op->getName() == argumentOp->getName()) { + // Replace the outer operation output with the inner operation. + return op->getOperand(0); + } + } else if (op->getOperand(0) == op->getOperand(1)) { + return op->getOperand(0); + } + + return {}; +} + +inline LogicalResult verifyIsInvolution(Operation* op) { + // TODO(b/246518997): Add back check for no side effects on operation. + // Currently adding it would cause the shared library build + // to fail since there would be a dependency of IR on SideEffectInterfaces + // which is cyclical. + return success(); +} + +inline OpFoldResult foldInvolution(Operation* op) { + auto* argumentOp = op->getOperand(0).getDefiningOp(); + if (argumentOp && op->getName() == argumentOp->getName()) { + // Replace the outer involutions output with inner's input. + return argumentOp->getOperand(0); + } + + return {}; +} + +} // namespace detail + +// This class adds property that the operation is idempotent. +// This means a unary to unary operation "f" that satisfies f(f(x)) = f(x), +// or a binary operation "g" that satisfies g(x, x) = x. +template +class IsIdempotent : public TraitBase { + public: + static LogicalResult verifyTrait(Operation* op) { + static_assert(ConcreteType::template hasTrait(), + "expected operation to produce one result"); + static_assert(ConcreteType::template hasTrait() || + ConcreteType::template hasTrait::Impl>(), + "expected operation to take one or two operands"); + static_assert( + ConcreteType::template hasTrait(), + "expected operation to preserve type"); + // Idempotent requires the operation to be side effect free as well + // but currently this check is under a FIXME and is not actually done. + return detail::verifyIsIdempotent(op); + } + + static OpFoldResult foldTrait(Operation* op, ArrayRef operands) { + return detail::foldIdempotent(op); + } +}; + +/// This class adds property that the operation is an involution. +/// This means a unary to unary operation "f" that satisfies f(f(x)) = x +template +class IsInvolution : public TraitBase { + public: + static LogicalResult verifyTrait(Operation* op) { + static_assert(ConcreteType::template hasTrait(), + "expected operation to produce one result"); + static_assert(ConcreteType::template hasTrait(), + "expected operation to take one operand"); + static_assert( + ConcreteType::template hasTrait(), + "expected operation to preserve type"); + // TODO(b/246518997): Involution requires the operation to be side effect + // free as well but currently this check is under a FIXME and is not + // actually done. + return detail::verifyIsInvolution(op); + } + + static OpFoldResult foldTrait(Operation* op, ArrayRef operands) { + return detail::foldInvolution(op); + } +}; + +// Indicates that any returned resource is unique. +template +class UniqueResourceAllocation + : public TraitBase { + public: + // Implements method required for `ResourceHandleAllocatorInterface`. + llvm::SmallVector + GetResourceHandleValueAndIdList( + llvm::SmallDenseMap& + resource_handle_id_map, + int64_t& next_id) { + llvm::SmallVector resource_vec; + for (Value resource : + mlir::tf_type::filter_resources(this->getOperation()->getResults())) { + resource_vec.push_back({resource, next_id++}); + } + return resource_vec; + } +}; + +} // namespace TF +} // namespace OpTrait +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_TRAITS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_types.def b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_types.def new file mode 100644 index 0000000000000000000000000000000000000000..17daa6afdcaf4b689c77a72f0ab7ecd60563eb4d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_types.def @@ -0,0 +1,81 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +// This file contains descriptions of the various TensorFlow types. This is +// used as a central place for enumerating the different types. + +#ifdef HANDLE_TF_TYPE + +// class, enumerant, name +HANDLE_TF_TYPE(Qint8, QINT8, "qint8") +HANDLE_TF_TYPE(Qint16, QINT16, "qint16") +HANDLE_TF_TYPE(Qint32, QINT32, "qint32") +HANDLE_TF_TYPE(Quint8, QUINT8, "quint8") +HANDLE_TF_TYPE(Quint16, QUINT16, "quint16") +HANDLE_TF_TYPE(String, STRING, "string") + +#ifndef HANDLE_CUSTOM_TF_TYPE +#define HANDLE_CUSTOM_TF_TYPE(class, enumerant, name) \ + HANDLE_TF_TYPE(class, enumerant, name) +#endif +HANDLE_CUSTOM_TF_TYPE(Resource, RESOURCE, "resource") +HANDLE_CUSTOM_TF_TYPE(Variant, VARIANT, "variant") +#undef HANDLE_CUSTOM_TF_TYPE + +// All ref types are listed below this line and FloatRef is the first ref type. +// This helps in easily differentiating ref and non-ref types, and converting +// a type to/from ref types. + +#ifndef HANDLE_TF_REF_TYPE +#define HANDLE_TF_REF_TYPE(class, enumerant, name) \ + HANDLE_TF_TYPE(class, enumerant, name) +#endif +HANDLE_TF_REF_TYPE(FloatRef, FLOAT_REF, "f32ref") +HANDLE_TF_REF_TYPE(DoubleRef, DOUBLE_REF, "f64ref") +HANDLE_TF_REF_TYPE(Uint4Ref, UINT4_REF, "uint4ref") +HANDLE_TF_REF_TYPE(Int4Ref, INT4_REF, "int4ref") +HANDLE_TF_REF_TYPE(Uint8Ref, UINT8_REF, "uint8ref") +HANDLE_TF_REF_TYPE(Int8Ref, INT8_REF, "int8ref") +HANDLE_TF_REF_TYPE(Uint16Ref, UINT16_REF, "uint16ref") +HANDLE_TF_REF_TYPE(Int16Ref, INT16_REF, "int16ref") +HANDLE_TF_REF_TYPE(Uint32Ref, UINT32_REF, "uint32ref") +HANDLE_TF_REF_TYPE(Int32Ref, INT32_REF, "int32ref") +HANDLE_TF_REF_TYPE(Uint64Ref, UINT64_REF, "uint64ref") +HANDLE_TF_REF_TYPE(Int64Ref, INT64_REF, "int64ref") +HANDLE_TF_REF_TYPE(StringRef, STRING_REF, "stringref") +HANDLE_TF_REF_TYPE(BoolRef, BOOL_REF, "boolref") +HANDLE_TF_REF_TYPE(Quint8Ref, QUINT8_REF, "quint8ref") +HANDLE_TF_REF_TYPE(Qint8Ref, QINT8_REF, "qint8ref") +HANDLE_TF_REF_TYPE(Quint16Ref, QUINT16_REF, "quint16ref") +HANDLE_TF_REF_TYPE(Qint16Ref, QINT16_REF, "qint16ref") +HANDLE_TF_REF_TYPE(Qint32Ref, QINT32_REF, "qint32ref") +HANDLE_TF_REF_TYPE(Bfloat16Ref, BFLOAT16_REF, "bfloat16ref") +HANDLE_TF_REF_TYPE(Complex64Ref, COMPLEX64_REF, "complex64ref") +HANDLE_TF_REF_TYPE(Complex128Ref, COMPLEX128_REF, "complex128ref") +HANDLE_TF_REF_TYPE(HalfRef, HALF_REF, "halfref") +HANDLE_TF_REF_TYPE(ResourceRef, RESOURCE_REF, "resourceref") +HANDLE_TF_REF_TYPE(Float8E4M3FNRef, FLOAT8_E4M3FN_REF, "float8e4m3fnref") +HANDLE_TF_REF_TYPE(Float8E5M2Ref, FLOAT8_E5M2_REF, "float8e5m2ref") + +#ifndef HANDLE_LAST_TF_TYPE +#define HANDLE_LAST_TF_TYPE(class, enumerant, name) \ + HANDLE_TF_REF_TYPE(class, enumerant, name) +#endif +HANDLE_LAST_TF_TYPE(VariantRef, VARIANT_REF, "variantref") +#undef HANDLE_LAST_TF_TYPE + +#undef HANDLE_TF_REF_TYPE +#undef HANDLE_TF_TYPE +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_types.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_types.h new file mode 100644 index 0000000000000000000000000000000000000000..31233f56b01404a4aa9581bf3b7a7ced06fadfdd --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_types.h @@ -0,0 +1,55 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +// This file defines the types used in the standard MLIR TensorFlow dialect. + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_TYPES_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_TYPES_H_ + +#include "tensorflow/core/ir/types/dialect.h" + +namespace mlir { +namespace TF { + +// This all moved under tensorflow/core/ir/types and these using declaration are +// to help with the transition. + +using ::mlir::tf_type::AreCastCompatible; // NOLINT +using ::mlir::tf_type::ArraysAreCastCompatible; // NOLINT +using ::mlir::tf_type::BroadcastCompatible; // NOLINT +using ::mlir::tf_type::DropRefType; // NOLINT +using ::mlir::tf_type::filter_resources; // NOLINT +using ::mlir::tf_type::GetCastCompatibleType; // NOLINT +using ::mlir::tf_type::HasCompatibleElementTypes; // NOLINT +using ::mlir::tf_type::IsValidTFTensorType; // NOLINT +using ::mlir::tf_type::OperandShapeIterator; // NOLINT +using ::mlir::tf_type::ResourceType; // NOLINT +using ::mlir::tf_type::ResultShapeIterator; // NOLINT +using ::mlir::tf_type::ResultShapeRange; // NOLINT +using ::mlir::tf_type::StringType; // NOLINT +using ::mlir::tf_type::TensorFlowRefType; // NOLINT +using ::mlir::tf_type::TensorFlowType; // NOLINT +using ::mlir::tf_type::TensorFlowTypeWithSubtype; // NOLINT +using ::mlir::tf_type::VariantType; // NOLINT + +#define HANDLE_TF_TYPE(tftype, enumerant, name) \ + using tftype##Type = mlir::tf_type::tftype##Type; +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_types.def" + + +} // end namespace TF +} // end namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_TYPES_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_verifiers.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_verifiers.h new file mode 100644 index 0000000000000000000000000000000000000000..8fbf54c48d6fd0806d6fc610480fab48bfdddd17 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tf_verifiers.h @@ -0,0 +1,41 @@ +/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_VERIFIERS_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_VERIFIERS_H_ + +#include "mlir/IR/Operation.h" // from @llvm-project +#include "mlir/Support/LogicalResult.h" // from @llvm-project + +namespace mlir { +namespace TF { + +// Verifies correctness of ops implementing LayoutSensitiveInterface (see +// definition in tf_op_base.td): +// (1) Operation must have valid `data_format` attribute. +// (2) Layout dependent arguments and results indices must be in +// [0, getNumOperands/getNumResults) range. +LogicalResult VerifyLayoutSensitiveInterface(Operation* op); + +// Verifies correctness of ops implementing FoldOperandsTransposeInterface (see +// definition in tf_op_base.td): +// (1) Layout dependent arguments and results indices must be in +// [0, getNumOperands/getNumResults) range. +LogicalResult VerifyFoldOperandsTransposeInterface(Operation* op); + +} // namespace TF +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TF_VERIFIERS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tfrt_ops.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tfrt_ops.h new file mode 100644 index 0000000000000000000000000000000000000000..e4a41d41e0c90e176146bad9e7fdd4783d66190a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tfrt_ops.h @@ -0,0 +1,29 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TFRT_OPS_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TFRT_OPS_H_ + +#include "mlir/IR/BuiltinTypes.h" // from @llvm-project +#include "mlir/Interfaces/DerivedAttributeOpInterface.h" // from @llvm-project +#include "mlir/Interfaces/InferTypeOpInterface.h" // from @llvm-project +#include "mlir/Interfaces/SideEffectInterfaces.h" // from @llvm-project +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_op_interfaces.h" +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_traits.h" + +#define GET_OP_CLASSES +#include "tensorflow/compiler/mlir/tensorflow/ir/tfrt_ops.h.inc" + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TFRT_OPS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tfrt_ops.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tfrt_ops.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..e0136e2ae737dcac569787d9ff7a8be886647648 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tfrt_ops.h.inc @@ -0,0 +1,440 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: tfrt_ops.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#if defined(GET_OP_CLASSES) || defined(GET_OP_FWD_DEFINES) +#undef GET_OP_FWD_DEFINES +namespace mlir { +namespace TF { +class PwStreamResultsOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class _TfrtGetResourceOp; +} // namespace TF +} // namespace mlir +namespace mlir { +namespace TF { +class _TfrtSetResourceOp; +} // namespace TF +} // namespace mlir +#endif + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::PwStreamResultsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PwStreamResultsOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + PwStreamResultsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + PwStreamResultsOpGenericAdaptorBase(PwStreamResultsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getNamesAttr(); + ::mlir::ArrayAttr getNames(); +}; +} // namespace detail +template +class PwStreamResultsOpGenericAdaptor : public detail::PwStreamResultsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PwStreamResultsOpGenericAdaptorBase; +public: + PwStreamResultsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PwStreamResultsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PwStreamResultsOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + PwStreamResultsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PwStreamResultsOpAdaptor : public PwStreamResultsOpGenericAdaptor<::mlir::ValueRange> { +public: + using PwStreamResultsOpGenericAdaptor::PwStreamResultsOpGenericAdaptor; + PwStreamResultsOpAdaptor(PwStreamResultsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PwStreamResultsOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = PwStreamResultsOpAdaptor; + template + using GenericAdaptor = PwStreamResultsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("T"), ::llvm::StringRef("names")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getNamesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getNamesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf.PwStreamResults"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::ArrayAttr getNamesAttr(); + ::mlir::ArrayAttr getNames(); + mlir::OperandElementTypeRange getT(); + static bool isDerivedAttribute(::llvm::StringRef name); + ::mlir::DictionaryAttr materializeDerivedAttributes(); + void setNamesAttr(::mlir::ArrayAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange args, ::mlir::ArrayAttr names); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange args, ::mlir::ArrayAttr names); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::PwStreamResultsOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::_TfrtGetResourceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class _TfrtGetResourceOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + _TfrtGetResourceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + _TfrtGetResourceOpGenericAdaptorBase(_TfrtGetResourceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getIndicesAttr(); + ::mlir::ArrayAttr getIndices(); + ::mlir::ArrayAttr getSharedNameAttr(); + ::mlir::ArrayAttr getSharedName(); + ::mlir::ArrayAttr getContainerAttr(); + ::mlir::ArrayAttr getContainer(); +}; +} // namespace detail +template +class _TfrtGetResourceOpGenericAdaptor : public detail::_TfrtGetResourceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::_TfrtGetResourceOpGenericAdaptorBase; +public: + _TfrtGetResourceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + _TfrtGetResourceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : _TfrtGetResourceOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + _TfrtGetResourceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class _TfrtGetResourceOpAdaptor : public _TfrtGetResourceOpGenericAdaptor<::mlir::ValueRange> { +public: + using _TfrtGetResourceOpGenericAdaptor::_TfrtGetResourceOpGenericAdaptor; + _TfrtGetResourceOpAdaptor(_TfrtGetResourceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class _TfrtGetResourceOp : public ::mlir::Op<_TfrtGetResourceOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::VariadicResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::TF::NoConstantFold, ResourceHandleAllocatorInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = _TfrtGetResourceOpAdaptor; + template + using GenericAdaptor = _TfrtGetResourceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("container"), ::llvm::StringRef("indices"), ::llvm::StringRef("shared_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getContainerAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getContainerAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getIndicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getIndicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getSharedNameAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getSharedNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf._TfrtGetResource"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResults(); + ::mlir::ArrayAttr getIndicesAttr(); + ::mlir::ArrayAttr getIndices(); + ::mlir::ArrayAttr getSharedNameAttr(); + ::mlir::ArrayAttr getSharedName(); + ::mlir::ArrayAttr getContainerAttr(); + ::mlir::ArrayAttr getContainer(); + void setIndicesAttr(::mlir::ArrayAttr attr); + void setSharedNameAttr(::mlir::ArrayAttr attr); + void setContainerAttr(::mlir::ArrayAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange results, ::mlir::ArrayAttr indices, ::mlir::ArrayAttr shared_name, ::mlir::ArrayAttr container); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + llvm::SmallVector GetResourceHandleValueAndIdList(llvm::SmallDenseMap&resource_handle_id_map, int64_t&next_id); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::_TfrtGetResourceOp) + +namespace mlir { +namespace TF { + +//===----------------------------------------------------------------------===// +// ::mlir::TF::_TfrtSetResourceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class _TfrtSetResourceOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + _TfrtSetResourceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + _TfrtSetResourceOpGenericAdaptorBase(_TfrtSetResourceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getIndexAttr(); + uint64_t getIndex(); +}; +} // namespace detail +template +class _TfrtSetResourceOpGenericAdaptor : public detail::_TfrtSetResourceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::_TfrtSetResourceOpGenericAdaptorBase; +public: + _TfrtSetResourceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + _TfrtSetResourceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : _TfrtSetResourceOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + _TfrtSetResourceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getArg() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class _TfrtSetResourceOpAdaptor : public _TfrtSetResourceOpGenericAdaptor<::mlir::ValueRange> { +public: + using _TfrtSetResourceOpGenericAdaptor::_TfrtSetResourceOpGenericAdaptor; + _TfrtSetResourceOpAdaptor(_TfrtSetResourceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class _TfrtSetResourceOp : public ::mlir::Op<_TfrtSetResourceOp, ::mlir::OpTrait::ZeroRegions, ::mlir::OpTrait::ZeroResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = _TfrtSetResourceOpAdaptor; + template + using GenericAdaptor = _TfrtSetResourceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("index")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getIndexAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getIndexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf._TfrtSetResource"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getArg(); + ::mlir::OpOperand &getArgMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getIndexAttr(); + uint64_t getIndex(); + void setIndexAttr(::mlir::IntegerAttr attr); + void setIndex(uint64_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value arg, ::mlir::IntegerAttr index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg, ::mlir::IntegerAttr index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value arg, uint64_t index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg, uint64_t index); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TF +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TF::_TfrtSetResourceOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tpu_embedding_ops_registry.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tpu_embedding_ops_registry.h new file mode 100644 index 0000000000000000000000000000000000000000..c8160418e8f7d0316ca8a56a0e5432f4090cd3d8 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/ir/tpu_embedding_ops_registry.h @@ -0,0 +1,59 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TPU_EMBEDDING_OPS_REGISTRY_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TPU_EMBEDDING_OPS_REGISTRY_H_ + +#include "llvm/ADT/DenseSet.h" +#include "mlir/IR/Operation.h" // from @llvm-project +#include "mlir/Support/TypeID.h" // from @llvm-project + +namespace mlir { +namespace TF { + +// A global ops registry that is used to hold TPU embedding ops. +// +// Example: +// TPUEmbeddingOpsRegistry::Global().Add(); +// for (auto op_type_id : TPUEmbeddingOpsRegistry::Global().GetOpsTypeIds()) +// { +// ... +// } +class TPUEmbeddingOpsRegistry { + public: + // Add the op to the registry. + // + // Adding an op here will allow use old bridge legalization from the MLIR + // bridge with the use of fallback mechanism. Therefore, addition of any op + // here must have a python test with MLIR bridge enabled to verify that the + // fallback works correctly. + template + void Add() { + ops_type_ids_.insert(TypeID::get()); + } + + // Returns the type id of the ops in the TPUEmbeddingOpRegistry. + const llvm::SmallDenseSet& GetOpsTypeIds(); + + // Returns the global registry. + static TPUEmbeddingOpsRegistry& Global(); + + private: + llvm::SmallDenseSet ops_type_ids_{}; +}; +} // namespace TF +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_IR_TPU_EMBEDDING_OPS_REGISTRY_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/bridge.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/bridge.h new file mode 100644 index 0000000000000000000000000000000000000000..6912dcdf4a2529926b5f09181990bbb75513896a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/bridge.h @@ -0,0 +1,57 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSFORMS_BRIDGE_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSFORMS_BRIDGE_H_ + +#include + +#include "mlir/Dialect/Func/IR/FuncOps.h" // from @llvm-project +#include "mlir/IR/BuiltinOps.h" // from @llvm-project +#include "tensorflow/core/lib/core/status.h" + +namespace mlir { +namespace TFTPU { + +// Run all the passes involved in transforming the graph before execution so +// that it is suitable for targeting TPUs. When fallback_enabled is true, it +// means if the bridge fails the old bridge will run. This is used for logging +// and doesn't affect any logic. +tensorflow::Status TPUBridge(ModuleOp module, bool fallback_enabled = false, + llvm::StringRef module_name = llvm::StringRef()); + +} // namespace TFTPU + +namespace TF { + +inline constexpr char kStandardPipelineBefore[] = "standard_pipeline_before"; +inline constexpr char kStandardPipelineAfter[] = "standard_pipeline_after"; + +// Runs all passes involved in transforming or optimizing an MLIR graph without +// any target specialization. When enable_logging is true, enables +// tensorflow::BridgeLogger. When enable_inliner is true, enables the inliner +// pass. +tensorflow::Status RunBridgeWithStandardPipeline(ModuleOp module, + bool enable_logging, + bool enable_inliner); + +// Runs all passes for non TPU (GPU and CPU) graph. +tensorflow::Status RunTFXLABridge( + ModuleOp module, llvm::StringRef module_name = llvm::StringRef()); +} // namespace TF + +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSFORMS_BRIDGE_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/cluster_ops_by_policy.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/cluster_ops_by_policy.h new file mode 100644 index 0000000000000000000000000000000000000000..e3c0ee5cc232386968f1022d93c518a43845b223 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/cluster_ops_by_policy.h @@ -0,0 +1,294 @@ +/* Copyright 2021 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSFORMS_CLUSTER_OPS_BY_POLICY_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSFORMS_CLUSTER_OPS_BY_POLICY_H_ + +#include +#include + +#include "llvm/ADT/DenseMap.h" +#include "llvm/ADT/SmallVector.h" +#include "mlir/Dialect/Func/IR/FuncOps.h" // from @llvm-project +#include "mlir/IR/Attributes.h" // from @llvm-project +#include "mlir/IR/BuiltinOps.h" // from @llvm-project +#include "mlir/IR/Operation.h" // from @llvm-project +#include "mlir/IR/Region.h" // from @llvm-project +#include "mlir/IR/Value.h" // from @llvm-project +#include "mlir/Support/LLVM.h" // from @llvm-project +#include "mlir/Support/LogicalResult.h" // from @llvm-project +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_device.h" + +namespace mlir { +namespace TFDevice { + +// -------------------------------------------------------------------------- // +// ValueConstraint. +// -------------------------------------------------------------------------- // + +// In order to be clustered operation can require its operands to satisfy +// some constraints (e.g. reduction operation can require reduction dimension +// operand to be a constant value). +enum class ValueConstraint { + // Operand must have statically known rank. + kRank = 0, + // Operand must have statically known shape (all dimensions are known at + // compile time). + kShape = 1, + // Operand must have statically known value (operand must be defined by a + // constant operation). + kValue = 2, +}; + +// Returns the more restrictive constraint of `a` and `b`: +// +// Value >> Shape >> Rank +// +// If you know the value, you always know the shape and the rank. If you know +// the shape, you always know the rank. +ValueConstraint Merge(ValueConstraint a, ValueConstraint b); + +// Returns success if constraint can be resolved statically based on the value +// type, e.g. `shape` constraint can be resolved if the value is a tensor of +// statically known shape. +LogicalResult IsStaticallyResolved(Value value, ValueConstraint constraint); + +raw_ostream& operator<<(raw_ostream& os, const ValueConstraint& constraint); + +// -------------------------------------------------------------------------- // +// ValuesConstraintSet. +// -------------------------------------------------------------------------- // + +// A set of constraints for values, that either operation results or operands. +class ValuesConstraintSet { + using ConstraintsMap = llvm::SmallDenseMap; + using ConstIterator = typename ConstraintsMap::const_iterator; + + public: + ValuesConstraintSet() = default; + + // Inserts a new constraint for the `value`. If the `value` already has some + // constraint, it will merge it with a new one, and will return a new + // constraint value. Returned pair has a constraint value that was set for + // a value, and a boolean flag that is true if the constraint was updated. + std::pair Insert(Value value, + ValueConstraint constraint); + + // Inserts constraints for multiple values. + void Insert(ValueRange value, ValueConstraint constraint); + + // Walk all the constraints owned by this set. + void Walk(llvm::function_ref walk) const; + + // Returns the constraint of the value if it exists, or None otherwise. + std::optional GetConstraint(Value value) const; + bool HasConstraint(Value value) const; + + // Merges all constrains from the other constraints set into this one. + void MergeAll(const ValuesConstraintSet& other); + + // Remove constraints that can be statically resolved from the type of the + // constrained value (see `IsStaticallyResolved` defined above). + ValuesConstraintSet& Resolve(); + + // Reset all constraints. + ValuesConstraintSet& Reset(); + + // Return the number of constrained values in the set. + size_t Size() const; + + // Returns true if the constraint set is empty. + bool Empty() const; + + ConstIterator begin() const { return constraints_.begin(); } + ConstIterator end() const { return constraints_.end(); } + + private: + llvm::SmallDenseMap constraints_; +}; + +// -------------------------------------------------------------------------- // +// ClusteringPolicy. +// -------------------------------------------------------------------------- // + +// Clustering policy specifies if the operation can be clustered (in practice it +// usually means that operation can be added to a cluster that will be later +// compiled) given the set of constraints on its results, and might propagate or +// create new constraints on the operation operands. +// +// Clustering policy must make a local decision just for a single operation. It +// is the responsibility of a clustering pass to combine all these individual +// operations constraints to form a valid cluster. +// +// Example: compilation using XLA (MHLO) lowering +// +// %0 = "tf.Transpose"(%input, %perm) +// : (tensor, tensor<2xi32>) -> tensor +// +// XLAs `mhlo.transpose` operation requires permutation to be an attribute +// (compile time value), so it means that if we want to put `tf.Transpose` +// into a cluster that will be compiled with XLA, the `%perm` operand must +// be a known compiled time value, e.g. result of a `tf.Const` operation. +// +class ClusteringPolicy { + public: + virtual ~ClusteringPolicy() = default; + + // Returns success if an operation can be clustered given the constraints on + // the operation results. Updates operands constraits to satisfy all the + // results constraints. + virtual LogicalResult MatchAndUpdateConstraints( + Operation* operation, const ValuesConstraintSet& results, + ValuesConstraintSet& operands) const = 0; +}; + +// Clustering policy for a specific operation type. +template +class OpClusteringPolicy : public ClusteringPolicy { + public: + LogicalResult MatchAndUpdateConstraints( + Operation* operation, const ValuesConstraintSet& results, + ValuesConstraintSet& operands) const final { + if (auto op = dyn_cast(operation)) + return MatchAndUpdateConstraints(op, results, operands); + return failure(); + } + + virtual LogicalResult MatchAndUpdateConstraints( + OpTy op, const ValuesConstraintSet& results, + ValuesConstraintSet& operands) const = 0; +}; + +// -------------------------------------------------------------------------- // +// ClusteringPolicySet. +// -------------------------------------------------------------------------- // + +// A set of clustering policies for different operations. +class ClusteringPolicySet { + public: + using Policies = std::vector>; + + const Policies& policies() const { return policies_; } + + // Add an instance of each of the policy types 'Ts'. Return a reference to + // `this` for chaining insertions. + template + ClusteringPolicySet& Add() { + (void)std::initializer_list{0, (AddImpl(), 0)...}; + return *this; + } + + // ClusteringPolicySet is move only type. + ClusteringPolicySet() = default; + ClusteringPolicySet(const ClusteringPolicySet&) = delete; + ClusteringPolicySet(ClusteringPolicySet&&) = default; + ClusteringPolicySet& operator=(const ClusteringPolicySet&) = delete; + ClusteringPolicySet& operator=(ClusteringPolicySet&&) = default; + + private: + template + void AddImpl(Args&&... args) { + static_assert(std::is_base_of::value, + "T must implement ClusteringPolicy"); + policies_.emplace_back(std::make_unique(std::forward(args)...)); + } + + std::vector> policies_; +}; + +// -------------------------------------------------------------------------- // +// Discovering clusters of operations based on the policy. +// -------------------------------------------------------------------------- // + +// Cluster groups together operations in the single basic block based on the +// given clustering policy set. Clusters can be outlined into nested modules +// later device specific compilation (e.g. for TFRT JIT compiler). +struct Cluster { + llvm::SmallVector operations; + ValuesConstraintSet constraints; +}; + +// Returns clusters of operations in the given `block` based on the provided +// clustering policy. If `filter` is defined, it will be used to filter +// operations that can be considered for clustering based on the policy. +// +// TODO(ezhulenev): Additional filter function is a workaround for customizing +// clustering policies at runtime for experimentation. In the long term, +// clustering policy should be enough. +llvm::SmallVector FindClustersInTheBlock( + Block* block, const ClusteringPolicySet& policies, + std::function filter = {}); + +// Creates a `tf_device.cluster` operation from the clustered operations. +tf_device::ClusterOp CreateClusterOp(Cluster& cluster, StringAttr policy = {}); + +// -------------------------------------------------------------------------- // +// Helper functions for value constraints propagations and analysis. +// -------------------------------------------------------------------------- // + +// Propagates initial constraints on the values defined by the `constraints` set +// with operations in the `root` as a starting point, using user provided set of +// clustering policies. +// +// Filter predicate specifies if constraints should be propagated across the +// given operation. Operations in the root set will be also filtered using +// the `filter` predicate. +// +// Optionally resolve constraints that can be statically satisfied by the +// value type, and stop constraints propagation early. +// +// Optionally emits remarks attached to operation that failed to propagate +// results constraints to its operands (for testing purpose). +// +// Returns failure if constraints can't be propagated through some of the +// operations accepted by the filter (there is no clustering policy for an +// operation, or constraints can't be satisfied by the policy), and attaches +// error diagnostics to the operation that prevented constraints propagation. +mlir::LogicalResult PropagateValuesConstraints( + llvm::ArrayRef root, std::function filter, + const ClusteringPolicySet& policies, ValuesConstraintSet& constraints, + bool resolve = false, bool emit_remarks = false); + +// Propagates initial constraints on the values in the `region` to the other +// values in the same region, using user provided set of clustering policies. +mlir::LogicalResult PropagateValuesConstraints( + mlir::Region& region, const ClusteringPolicySet& policies, + ValuesConstraintSet& constraints, bool resolve = false, + bool emit_remarks = false); + +// Emits constraints remarks for all operations that use constrained values. +void EmitValueConstraintsRemarks(const ValuesConstraintSet& constraints); + +// Emits constraints remarks for function inputs that are in the constraints +// set (entry block arguments have constraints). +void EmitInputsConstraintsRemarks(func::FuncOp func, + const ValuesConstraintSet& constraints); + +// Infers constraints for the values in the function body from the function +// results attributes. +// +// Example: +// func @test(...) -> (tensor {tf.constraint = "shape"}) { +// ..... +// %v = "some_operation"() : () -> tensor +// return %v : tensor +// } +LogicalResult InferFunctionBodyValuesConstraints( + func::FuncOp func, ValuesConstraintSet& constraints); + +} // namespace TFDevice +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSFORMS_CLUSTER_OPS_BY_POLICY_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/collection_ops_util.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/collection_ops_util.h new file mode 100644 index 0000000000000000000000000000000000000000..e43a1ec458e5a35edc6c7b24e7d039ed2434d81b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/collection_ops_util.h @@ -0,0 +1,109 @@ +/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSFORMS_COLLECTION_OPS_UTIL_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSFORMS_COLLECTION_OPS_UTIL_H_ + +#include + +#include "llvm/ADT/ArrayRef.h" +#include "mlir/IR/Builders.h" // from @llvm-project +#include "mlir/IR/Location.h" // from @llvm-project +#include "mlir/IR/Value.h" // from @llvm-project +#include "mlir/Support/LLVM.h" // from @llvm-project +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_ops.h" +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_types.h" + +namespace mlir { +namespace TF { +namespace collection_ops_util { + +// This file includes utilities for decomposing collection ops (stack, tensor +// list, tensor array) in TF. We represent such a data structure as a buffer of +// shape [max_element_count, element_shape]. + +// Creates an i32 scalar tf.Const. +Value CreateScalarConst(int32_t value, OpBuilder builder, Location loc); + +// Creates an integer vector tf.Const. +Value GetR1Const(ArrayRef r1, OpBuilder builder, Location loc, + int bitwidth = 32); + +// Returns the type of the size tensor used to track a data structure's element +// count. It is a tensor<1xi32>, and we use R1 instead of a scalar because it is +// easier to concat it with other offsets. +TensorType GetSizeType(OpBuilder builder); + +// Reshapes a scalar value to match the size type tensor. +Value ReshapeScalarToSizeType(OpBuilder builder, Value scalar, Location loc); + +// Creates ops that represent the indices of the slice for an element in the +// buffer. Requires `index` to have tensor<1xi32> type. +Value GetIndicesForElement(Value index, Value buffer, OpBuilder builder, + Location loc); + +// Creates ops that slice the element out of a buffer at the given index. +// Requires `index` to have tensor<1xi32> type. +Value GetElement(Value index, Value buffer, OpBuilder builder, Location loc, + bool keep_slice_shape = false); + +// Creates ops that copy the buffer and update an element at the given index. +// Requires `index` to have tensor<1xi32> type. +Value SetElement(Value index, Value buffer, Value element, OpBuilder builder, + Location loc); + +// Creates the buffer for the data structure with given element shape, type and +// maximum size. +LogicalResult CreateInitBufferValue(ArrayRef element_shape, + int64_t max_size, Operation* op, + Type element_dtype, OpBuilder builder, + Value* buffer); + +// Same as above, but uses a Value as max_size and check if it is a constant. +LogicalResult CreateInitBufferValue(ArrayRef element_shape, + Value max_size, Operation* op, + Type element_dtype, OpBuilder builder, + Value* buffer); + +// Tries to infer the element type with full shape based its write accesses. +// `infer_from_user` should check if the provided op is an accessing op that +// could be used to infer the type. +std::optional GetElementTypeFromAccess( + Value collection, ModuleOp module, + llvm::function_ref(Operation*)> infer_from_op); + +// Creates a ReadVariableOp on a local variable. +Value ReadLocalVariable(Value local_var, OpBuilder builder, Location loc); + +// Creates an AssignVariableOp on a local variable. +TF::AssignVariableOp WriteLocalVariable(Value local_var, Value value, + OpBuilder builder, Location loc); + +// Adds two values, or creates a logical-or if they are boolean type. +Value AccumulateBuffers(Value a, Value b, OpBuilder builder, Location loc); + +// Gathers elements in buffer with the indices. +Value GatherElements(Value indices, Value buffer, OpBuilder builder, + Location loc); + +// Scatters elements into buffer, where each scattered element is accumulated +// with the old value in buffer. +Value ScatterAccumulateElements(Value indices, Value updates, Value buffer, + OpBuilder builder, Location loc); + +} // namespace collection_ops_util +} // namespace TF +} // namespace mlir +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSFORMS_COLLECTION_OPS_UTIL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/decompose_resource_ops.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/decompose_resource_ops.h new file mode 100644 index 0000000000000000000000000000000000000000..c8f0c84b4450abe668d2c71b12f2a5c28db1b9fa --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/decompose_resource_ops.h @@ -0,0 +1,37 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSFORMS_DECOMPOSE_RESOURCE_OPS_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSFORMS_DECOMPOSE_RESOURCE_OPS_H_ + +#include "mlir/IR/MLIRContext.h" // from @llvm-project +#include "mlir/IR/PatternMatch.h" // from @llvm-project + +namespace mlir { +namespace TF { + +// Populates rewrite patterns that decompose composite resource operations into +// primitive ones like ReadVariableOp, AssignVariableOp and other computations +// to facilitate transformations like resource op lifting. +// NOTE: These patterns do not support `use_locking=true` for a lot of resource +// operations. So decomposition may not be correct outside of backends like XLA, +// which automatically locks all resource variables. +void PopulateDecomposeResourceOpsPatterns(MLIRContext *context, + RewritePatternSet *patterns); + +} // namespace TF +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSFORMS_DECOMPOSE_RESOURCE_OPS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/einsum.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/einsum.h new file mode 100644 index 0000000000000000000000000000000000000000..65e0528096e4c89d8ae16e73eb08c633fb2da393 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/einsum.h @@ -0,0 +1,55 @@ +/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ +// This pass identifies patterns for certain Einsum Ops and replaces them +// with other equivalent TF Ops. + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSFORMS_EINSUM_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSFORMS_EINSUM_H_ + +#include +#include + +#include "llvm/ADT/ArrayRef.h" +#include "llvm/Support/Casting.h" +#include "mlir/IR/Attributes.h" // from @llvm-project +#include "mlir/IR/BuiltinTypes.h" // from @llvm-project +#include "mlir/IR/Location.h" // from @llvm-project +#include "mlir/IR/MLIRContext.h" // from @llvm-project +#include "mlir/IR/Matchers.h" // from @llvm-project +#include "mlir/IR/PatternMatch.h" // from @llvm-project +#include "mlir/IR/TypeUtilities.h" // from @llvm-project +#include "mlir/Pass/Pass.h" // from @llvm-project +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_ops.h" +#include "tensorflow/core/util/matmul_bcast.h" + +namespace mlir { +namespace TF { + +// TF.Einsum provides fully general tensor contractions. For a few select +// cases, we can convert this op to other TF Ops, which in later passes +// properly convert to TF Lite ops. +struct ConvertTFEinsumOp : public OpRewritePattern { + public: + explicit ConvertTFEinsumOp(MLIRContext* context) + : OpRewritePattern(context) {} + + LogicalResult matchAndRewrite(TF::EinsumOp op, + PatternRewriter& rewriter) const override; +}; + +} // namespace TF +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSFORMS_EINSUM_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/initialize_variables_in_session_init.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/initialize_variables_in_session_init.h new file mode 100644 index 0000000000000000000000000000000000000000..623e5f4e2d1a189746b7abddb50043067528bd67 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/initialize_variables_in_session_init.h @@ -0,0 +1,35 @@ +/* Copyright 2021 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSFORMS_INITIALIZE_VARIABLES_IN_SESSION_INIT_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSFORMS_INITIALIZE_VARIABLES_IN_SESSION_INIT_H_ + +#include "mlir/Dialect/Func/IR/FuncOps.h" // from @llvm-project +#include "mlir/IR/BuiltinOps.h" // from @llvm-project +#include "tensorflow/core/public/session.h" + +namespace mlir { +namespace tf_saved_model { + +// Initializes all variables in Session Init function for all variables in +// 'session'. +LogicalResult InitializeVariablesInSessionInitializer( + ModuleOp module, tensorflow::Session *session); + +} // namespace tf_saved_model + +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSFORMS_INITIALIZE_VARIABLES_IN_SESSION_INIT_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/lift_variables.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/lift_variables.h new file mode 100644 index 0000000000000000000000000000000000000000..e86e2f570d01d4a8b4c7db36170090d2ddf611a2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/lift_variables.h @@ -0,0 +1,34 @@ +/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSFORMS_LIFT_VARIABLES_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSFORMS_LIFT_VARIABLES_H_ + +#include "mlir/Dialect/Func/IR/FuncOps.h" // from @llvm-project +#include "mlir/IR/BuiltinOps.h" // from @llvm-project +#include "mlir/Support/LogicalResult.h" // from @llvm-project +#include "tensorflow/core/public/session.h" + +namespace mlir { +namespace tf_saved_model { + +// Creates GlobalTensorOp for each variable from function arguments and converts +// them to the corresponding saved model arguments. +LogicalResult LiftVariables(ModuleOp module, ::tensorflow::Session* session); + +} // namespace tf_saved_model +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSFORMS_LIFT_VARIABLES_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/lower_tf.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/lower_tf.h new file mode 100644 index 0000000000000000000000000000000000000000..b8e263022944a34597226c78a7b42fa9b85702e2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/lower_tf.h @@ -0,0 +1,52 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSFORMS_LOWER_TF_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSFORMS_LOWER_TF_H_ + +#include "mlir/IR/MLIRContext.h" // from @llvm-project +#include "mlir/IR/PatternMatch.h" // from @llvm-project + +namespace mlir { +namespace TF { + +// Populates TensorFlow lowering patterns to lower some of the TensorFlow +// operations that can be represented using other TensorFlow operations. +// TODO(laurenzo): For some reason, TFLite uses this pass and has exact +// requirements on what it can do. This is fragile and should be fixed (at a +// minimum, names should clearly convey scope). In the mean time, for a real +// compiler, use PopulateTFLoweringBeforeHLOPatterns. +void PopulateLoweringTFPatterns(MLIRContext *context, + RewritePatternSet *patterns); + +// Populates TensorFlow lowering patterns to lower some of the TensorFlow +// operations that can be represented by means of other TensorFlow operations. +// This pattern collection preserves those TensorFlow operations that will later +// be lowered to equivalent operations in CHLO or MHLO. This allows for +// HLO-specific lowerings. +void PopulateTFLoweringBeforeHLOPatterns(MLIRContext *context, + RewritePatternSet *patterns); + +// Populates TensorFlow lowering patterns to lower some of the TensorFlow +// operations that can be represented using other TensorFlow operations. +// Patterns are from ops with some inputs or outputs that are quantized types +// only to ops that allow non-quantized types on all inputs and outputs. +void PopulateLoweringQuantizedPatterns(MLIRContext *context, + RewritePatternSet *patterns); + +} // namespace TF +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSFORMS_LOWER_TF_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/mark_initialized_variables.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/mark_initialized_variables.h new file mode 100644 index 0000000000000000000000000000000000000000..4a18c096887b637553bf6fb33ea6e7b3823c5aa0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/mark_initialized_variables.h @@ -0,0 +1,41 @@ +/* Copyright 2021 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSFORMS_MARK_INITIALIZED_VARIABLES_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSFORMS_MARK_INITIALIZED_VARIABLES_H_ + +#include "mlir/Dialect/Func/IR/FuncOps.h" // from @llvm-project +#include "mlir/IR/BuiltinOps.h" // from @llvm-project +#include "tensorflow/core/public/session.h" + +namespace mlir { +namespace tf_saved_model { +// Marks all variables in 'function' whether they are initialized +// in 'session' or not by setting an attribute named 'is_initialized' +// on each variable op with value true/false based on variable is initialized +// in the session or not. +// If 'session' is NULL the function is no-op. +// Returns failure in case fetching variables from session failed, success +// otherwise. +LogicalResult MarkInitializedVariablesInFunction(func::FuncOp function, + tensorflow::Session* session); +// Apply `MarkInitializedVariablesInFunction` to every non-empty function in the +// module. +LogicalResult MarkInitializedVariablesInFunction(ModuleOp module, + tensorflow::Session* session); + +} // namespace tf_saved_model +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSFORMS_MARK_INITIALIZED_VARIABLES_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/passes.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/passes.h new file mode 100644 index 0000000000000000000000000000000000000000..034bc3de5c807531ef6fc6b235dc79eed1403aba --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/passes.h @@ -0,0 +1,772 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSFORMS_PASSES_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSFORMS_PASSES_H_ + +#include + +#include "mlir/Dialect/Func/IR/FuncOps.h" // from @llvm-project +#include "mlir/IR/BuiltinOps.h" // from @llvm-project +#include "mlir/IR/MLIRContext.h" // from @llvm-project +#include "mlir/IR/PatternMatch.h" // from @llvm-project +#include "mlir/Pass/Pass.h" // from @llvm-project +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_device.h" +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_executor.h" + +namespace mlir { + +// Creates a pass that breaks up an island with multiple ops into multiple +// islands, each with a single op. +std::unique_ptr> CreateBreakUpIslandsPass(); + +// Creates a pass that converts mlir functions consisting of mlir ops into a +// tf_executor dialect as a single island. +std::unique_ptr> +CreateFunctionalToExecutorDialectConversionPass(); + +// Creates a pass that lifts inner ops of tf_executor.island ops in +// tf_executor.graph into the same block as the tf_executor.graph. +std::unique_ptr> +CreateExecutorDialectToFunctionalConversionPass(); + +namespace TF { +// Creates a pass that canonicalizes legacy compilation and replication +// attributes. +std::unique_ptr> +CreateCanonicalizeCompileAndReplicateAttributesPass(); + +// Creates a pass that drops `shape_invariant` attribute from While/WhileRegion +// ops. +std::unique_ptr> +CreateDropWhileShapeInvariantPass(); + +// Creates a pass that drops `shape_invariant` attribute from While/WhileRegion +// ops within device cluster. +std::unique_ptr> +CreateDropWhileShapeInvariantInDeviceClusterPass(); + +// Creates a pass that moves writes to replicate invariant resource variables +// outside tf_device.replicate op. +std::unique_ptr> +CreateHoistReplicateInvariantResourceWritesPass(); + +// Transforms functional control flow operations in the TensorFlow dialect to +// MLIR Control Flow Graph (CFG) form. +std::unique_ptr> +CreateTFFunctionalControlFlowToCFG(); + +// Transforms functional control flow operations in the TensorFlow dialect to +// their region based counterparts. +std::unique_ptr> +CreateTFFunctionalControlFlowToRegions(); + +// Transforms region bases control flow operations in the TensorFlow dialect to +// their functional counterparts. +std::unique_ptr> +CreateTFRegionControlFlowToFunctional(); + +// Materialize the MlirPassthroughOp by replacing it with the MLIR module +// attached as an attribute. +std::unique_ptr> +CreateMaterializePassthroughOpPass(); + +// Replicates the TensorList init op by undoing some CSE needed for correct +// shape assignment in shape_inference. +std::unique_ptr> +CreateReplicateTensorListInitOpsPass(); + +// Performs Shape Inference on the TensorFlow dialect using the global registry. +std::unique_ptr> CreateTFShapeInferencePass(); + +// Performs TF.data optimizations. +std::unique_ptr> CreateTFDataOptimizationPass(); + +std::unique_ptr> CreateMoveTransposesPass(); +std::unique_ptr> CreateLayoutAssignmentPass(); + +// Guarantee that all FuncOp's have a single use. +std::unique_ptr> CreateGuaranteeAllFuncsOneUsePass(); + +// Optional pass which will unroll BatchMatMul and use only MatMul +std::unique_ptr> CreateUnrollBatchMatMulPassPass(); + +// Optional pass which will map TF BatchMatMul to TF Einsum +std::unique_ptr> CreateBatchMatMulToEinsumPass(); + +// Pass that transform Einsum to other TF Ops for the supported variants. +std::unique_ptr> CreateTransformEinsumPass(); + +// Optimizes Tensorflow graph. +std::unique_ptr> CreateTFOptimizePass(); +void RegisterTFOptimizePassPipeline(); + +// Creates pass to rewrite RecvTPUEmbeddingActivationsOp and +// SendTPUEmbeddingGradients ops to internal variants. +std::unique_ptr> CreateRewriteTPUEmbeddingOpsPass(); + +// Performs specific fusion for GPU targets. +std::unique_ptr> CreateGpuOpFusionPass(); + +// Creates a pass that decomposes to be compiled ReduceDataset ops into a while +// loop that iterates the dataset and calls the reduction function. +std::unique_ptr> CreateDecomposeReduceDatasetPass(); + +// Create a pass that convert ops that copy tensors between devices, e.g. +// tf.Identity. +std::unique_ptr> +CreateTensorDeviceCopyConversionPass(); + +// Returns a pass that folds tf.BroadcastTo nodes with subsequent nodes if they +// have built in broadcasting support. +std::unique_ptr> CreateBroadcastFoldPass(); + +void populateTfControlFlowToScfPatterns(MLIRContext* context, + RewritePatternSet* patterns); +// Create a pass to convert TensorFlow control flow to SCF. +std::unique_ptr> createConvertTfControlFlowToScfPass(); + +struct LayoutOptimizationPipelineOptions + : public PassPipelineOptions { + Option force_data_format{ + *this, "force-data-format", + llvm::cl::desc("Force data format for all layout sensitive ops")}; + Option skip_fold_transpose_in_ops{ + *this, "skip-fold-transpose-in-ops", + llvm::cl::desc("Skip folding transpose operands in Ops which can support " + "different layouts.")}; +}; + +// Layout optimization assigns optimal data layout for layout sensitive +// operations, and cancels all redundant transposes. +void CreateLayoutOptimizationPipeline( + OpPassManager& pm, // NOLINT - MLIR contract is pass by mutable reference. + const LayoutOptimizationPipelineOptions& options); + +struct StandardPipelineOptions + : public PassPipelineOptions { + Option enable_inliner{*this, "enable-inliner", + llvm::cl::desc("Enable inliner."), + llvm::cl::init(false)}; + Option form_clusters{*this, "form-clusters", + llvm::cl::desc("Enable Cluster Formation pass."), + llvm::cl::init(false)}; +}; + +// Propagates the pass manager with the passes involved in transforming or +// optimizing an MLIR graph without any target specialization. +// NOLINTNEXTLINE - MLIR contract is pass by mutable reference. +void CreateTFStandardPipeline(OpPassManager& pm, + const StandardPipelineOptions& options); + +// Propagates device attributes of resources from callers to callees. +std::unique_ptr> CreateResourceDeviceInferencePass(); + +// Creates a pass that promotes resource reads/writes in `functions` to inputs +// and outputs of `functions`, assuming that resource operations have already +// been decomposed and function calls have already been inlined. If `functions` +// is empty, the pass is applied to the main function by default. The pass also +// annotates the input arguments for resources with the indices of their +// aliasing output arguments. +std::unique_ptr> CreatePromoteResourcesToArgsPass( + llvm::ArrayRef functions = {}); + +// Creates a pass that promotes tf.VarHandleOp to resource arguments for all +// functions. +std::unique_ptr> CreatePromoteVarHandlesToArgsPass(); + +// Creates a pass that converts readonly reference variables to the +// corresponding resource variables. +std::unique_ptr> +CreateConvertReadonlyReferenceVariablesToResourceVariablesPass(); + +// Creates a simple device assignment pass on TF dialect for CoreRT use case. +std::unique_ptr> CreateSimpleTFDeviceAssignmentPass( + llvm::StringRef default_device = "cpu"); + +// Creates a pass to perform device assignment for TF dialect ops that do not +// have device assignment, by using the device attribute of the function. +std::unique_ptr> +CreateTFDeviceAssignmentByFuncAttrPass(); + +// Performs resource lifting on the function body to hoist resource variable +// accesses outside all control flow statements. +LogicalResult ResourceLiftingForFunctionalControlFlow(func::FuncOp function); + +// Converts stack ops into operations on local variables, which can later be +// removed by resource lifting. Requires known maximum sizes of stacks and +// known element shapes of push ops. +std::unique_ptr> CreateStackOpsDecompositionPass(); + +// Creates a pass to strip the "tf._noinline" attribute from the functions in +// the module. +std::unique_ptr> CreateStripNoinlineAttributePass(); + +// Converts tensor list operations into operations on buffers and sizes. Needs +// static shapes and known max element count. +std::unique_ptr> CreateTensorListOpsDecompositionPass(); + +// Converts tensor array ops into operations on local variables, which can later +// be removed by resource lifting. Requires known sizes and known element shapes +// (either defined in TensorArrayV3 or implied in the first write). +std::unique_ptr> +CreateTensorArrayOpsDecompositionPass(); + +// Create a pass that legalize TFG to TF dialect. +std::unique_ptr CreateLegalizeTFGToTFEPass(); + +// Matches sequence of ops to TensorFlow fused kernels. This pass should not be +// generally used beyond exporting to runtimes that supports these ops. In the +// future these fusions may be codegen'd automatically. +std::unique_ptr> CreateFusedKernelMatcherPass(); + +// Creates function pass to select device index/fold tf.DeviceIndex. +std::unique_ptr> CreateDeviceIndexSelectorPass(); + +// Creates function pass to replace InitializeTableFromTextFileV2Ops with +// LookupTableImportV2Op ops. +std::unique_ptr> CreateInitTextFileToImportPass( + std::string saved_model_dir = ""); + +// Creates function pass to cluster TensorFlow ops by host. The program +// generated by this pass will have one function per host where all operations +// in the same function are placed on the same host. Each result of the per-host +// function will have a "tf.device" attribute which specifies the device +// assignment of the result. +std::unique_ptr> CreateClusterTFOpsByHostPass(); + +// Creates a pass to insert tf_device.send and tf_device.receive ops to make +// sure any argument of any op is on the same host of the op itself. +std::unique_ptr> CreateCrossHostTransferPass(); + +// Creates a pass that adds the device attribute to every tf.Const op based on +// the device attribute of the operations that read its result. If the result of +// a tf.Const op is read by operations placed on multiple devices, then the pass +// will replicate the tf.Const op once for each device. +std::unique_ptr> CreateConstantOpDeviceAssignmentPass(); + +// Returns pass that verifies whether all functions in module are of single +// tf_executor.graph and each tf_executor.island in tf_executor.graph only has a +// single op. +std::unique_ptr> CreateVerifySuitableForExportPass(); + +// Returns pass that prepares TPU computation to be legal for export to +// TensorFlow. +std::unique_ptr> +CreatePrepareTpuComputationForTfExportPass(); + +// Rewrites ops that require quantized inputs or outputs to ops that allow +// non-quantized inputs and outputs. +std::unique_ptr> CreateLowerQuantizedPass(); + +// Reorders ops so ops of the same dialect are next to each other. +std::unique_ptr CreateOrderByDialectPass(); + +// Groups ops into functions that only contain one dialect. +std::unique_ptr CreateGroupByDialectPass(); + +// Removes unused parameters from functions & their callers. +std::unique_ptr> CreateRemoveUnusedArgumentsPass(); + +// Removes unused results from WhileRegion ops. +std::unique_ptr> +CreateRemoveUnusedWhileResultsPass(); + +// Hoists loop invariant ops to the outside of the loop. +std::unique_ptr> CreateHoistLoopInvariantPass(); + +// Creates VarHandleOps right next to the operations that use them. +std::unique_ptr> CreateLocalizeVarHandlesPass(); + +// Removes all TF attributes +std::unique_ptr> CreateStripTfAttributesPass(); + +// Converts AnonymousIteratorOps to (named) IteratorOps. +std::unique_ptr> CreateNameAnonymousIteratorsPass(); + +// Creates a pass that breaks up an island with multiple ops into multiple +// islands, each with a single op. This pass intentionally does not propagate +// control dependencies across newly created islands, a following pass will +// handle this. +// TODO(b/244596254) Implement followup pass for creating control deps. +std::unique_ptr> CreateSplitIntoIslandPerOpPass(); + +// Populates the supplied passmanager with the passes required to run the +// CPU/GPU bridge. +void CreateTFXLABridgePipeline(OpPassManager& pm); + +//===----------------------------------------------------------------------===// +// XlaCallModule +//===----------------------------------------------------------------------===// + +// Creates a pass that deserializes functions in the StableHLO modules from +// `tf.XlaCallModule` to the top-level module. +std::unique_ptr> +CreateXlaCallModuleDeserializationPass(); + +// Creates a pass that serializes StableHLO functions referenced by +// `tf.XlaCallModule` from the top-level module to `tf.XlaCallModule`'s +// `module` attribute. +std::unique_ptr> CreateXlaCallModuleSerializationPass(); + +} // namespace TF + +namespace tf_executor { + +// Creates a pass to chain control outputs of while loop body. +std::unique_ptr> +CreateTFExecutorConvertControlToDataOutputsPass(); + +std::unique_ptr> +CreateTFExecutorCheckControlDependenciesPass(); + +// Creates a pass to merge IslandOps from TFExecutor dialect. +std::unique_ptr> +CreateTFExecutorIslandCoarseningPass(); + +// Creates a pass to merge IslandOps for operation marked for execution on TPU. +// This is a V1 backward compatibility. +std::unique_ptr> +CreateTFExecutorTPUV1IslandCoarseningPass(); + +// Creates a pass to outlining TPU clusters from single IslandOp into a nested +// module suitable for being processed as-if it was a V2 module. +// This is a V1 backward compatibility. +std::unique_ptr> +CreateTFExecutorTPUV1IslandOutliningPass(); + +// Creates a pass to inline calls to the nested TPU module, this reverses the +// effect of the `TFExecutorTPUV1IslandOutlining` pass above. +// This is a V1 backward compatibility. +std::unique_ptr> +CreateTFExecutorTPUV1IslandInliningPass(); + +// Creates a pass to prune tf_executor.graph from dead nodes. +std::unique_ptr> CreateTFExecutorGraphPruningPass( + llvm::ArrayRef ops_to_preserve = {}); + +// Creates a pass to update control dependencies. +std::unique_ptr> +CreateTFExecutorUpdateControlDependenciesPass(); + +} // namespace tf_executor + +namespace TFDevice { +// Creates a pass that forms clusters from instructions that are assigned to +// same device. +std::unique_ptr> CreateClusterFormationPass(); + +// Sinks `tf.Const` operations in the ClusterOp region using them. This is +// performed in order to limit the number of values implicitly captured in this +// region before outlining. +std::unique_ptr> CreateClusterConstantSinkingPass( + llvm::function_ref filter = {}); + +// Creates a pass that outlines regions of tf_device.cluster operations. +std::unique_ptr> CreateClusterOutliningPass(); + +// Creates a pass that outlines regions of tf_device.launch operations. +std::unique_ptr> CreateLaunchOutliningPass(); + +// Creates a pass that converts tf_device::LaunchFuncOp into +// TF::PartitionedCallOp. +std::unique_ptr> CreateConvertLaunchFuncToTFCallPass(); + +// A pass that decomposes composite resource operations into primitive ones like +// ReadVariableOp, AssignVariableOp and other computations to facilitate +// transformations like resource op lifting. +std::unique_ptr> CreateDecomposeResourceOpsPass(); + +// A pass that decomposes composite resource operations in device cluster +// (tf_device.cluster op) into primitive ones like ReadVariableOp, +// AssignVariableOp and other computations to facilitate transformations like +// resource op lifting. +std::unique_ptr> +CreateDecomposeResourceOpsInClusterPass(); + +// Creates a pass that marks TPU cluster input-output pairs reading and writing +// to same resource variable as aliases. +std::unique_ptr> CreateMarkInputOutputAliasesPass(); + +// Creates a pass that lifts operations on external resource variables from +// device computation nested in `tf_device::LaunchOp` out so that resource +// variable load operations are all before device computation while resource +// variable store operations are all after device computation. After this pass, +// device computation no longer interacts with external resource variables. +std::unique_ptr> CreateResourceOpLiftingPass(); + +// Creates a pass that lifts operations from the main function. +std::unique_ptr> +CreateResourceOpLiftingForMainFunctionPass(); + +// Lifts resource operations from tf_device.launch_func ops nested in `op` +// outside. Returns a failure if there are remaining resource-type values that +// can not be lifted. +LogicalResult LiftResourceOps(Operation* op); + +// Creates a pass that hoists invariant operations in a `tf_device.replicate`. +std::unique_ptr> +CreateReplicateInvariantOpHoistingPass(); + +// Creates a pass that forms replica `tf_executor.island` from a single +// `tf_device.replicate` island. +std::unique_ptr> CreateReplicateToIslandPass( + bool legacy_graph_export = true); + +// Creates a pass that sets the device ordinal attribute of the required op +// using the replica id attribute. +std::unique_ptr> +CreateReplicaIDToDeviceOrdinalPass(); + +// Creates a pass that adds pipelining to a graph that contains device +// accelerated embeddings. The EmbeddingSequencingPass is a temporary fallback +// while developing full pipelining capabilities. +std::unique_ptr> CreateEmbeddingSequencingPass(); +std::unique_ptr> CreateEmbeddingPipeliningPass(); +std::unique_ptr> CreateEmbeddingProgramKeyPass(); + +// Creates a pass that creates `tf_executor.island` from a single +// `tf_device.parallel_execute` island. +std::unique_ptr> CreateParallelExecuteToIslandsPass( + bool legacy_graph_export = true); + +// Creates a pass that annotates whether a LaunchFuncOp's parameters have the +// same data across replicas. +std::unique_ptr> +CreateAnnotateParameterReplicationPass(); + +// Creates a pass that marks unsupported ops in device cluster for outside +// compilation. +std::unique_ptr> +CreateMarkOpsForOutsideCompilationPass(); + +// Creates a pass that extracts outside compilation (Host ops inside device +// cluster) at head/tail of Device cluster to run before/after XLA computation. +std::unique_ptr> +CreateExtractHeadTailOutsideCompilationPass(); + +// Creates a pass that extract outside compilation (Host ops inside cevice +// cluster) ops to a separate parallel_execute region to run on CPU. +std::unique_ptr> CreateExtractOutsideCompilationPass(); + +// Creates a pass that merges control flow with similar predicates. +std::unique_ptr> CreateMergeControlFlowPass(); + +// Creates a pass that wraps each TensorFlow dialect with `device` attribute +// in a `tf_device.launch` op with the same `device` attribute. +std::unique_ptr> +CreateDeviceAttributeToLaunchPass(); + +// Creates a pass that hoists a `tf_device.launch` body and assigns a `device` +// attribute to each TensorFlow dialect op in the body based on the `device` +// attribute on the `tf_device.launch`. +std::unique_ptr> CreateLaunchToDeviceAttributePass( + bool legacy_graph_export = true); + +// Creates a pass that extracts ops in tf_device.launch op with host device +// assignment and adds an `_xla_outside_compilation` attribute value. +std::unique_ptr> +CreateHostLaunchToOutsideCompiledPass(); + +// Creates a pass that wraps ops with the same `_xla_outside_compilation` +// attribute value in a tf_device.launch op with host device assignment. +std::unique_ptr> +CreateOutsideCompiledToHostLaunchPass(); + +// Creates a pass to ensure that the `_xla_outside_compilation` and +// tf_device.launch op no longer exist after Outside Compilation is complete. +std::unique_ptr> +CreateVerifyNoOutsideCompilationMarkersPass(); + +// Create a pass that encapsulates StatefulPartitionedCallOp within a cluster. +std::unique_ptr> CreateXlaClusterFormationPass(); + +// Create a pass that inlines the StatefulPartitionedCallOp op based in the +// parent region. +std::unique_ptr> CreateXlaInlineDeviceOpsPass(); + +// Creates a pass that rewrites partitioned calls with `_xla_compile_device +// type` with `tf.XlaLaunch` ops. +std::unique_ptr> CreateXlaRewritePass(); + +// Creates a pass that rewrites partitioned calls with `tf._XlaCompile` op and +// `tf.XlaRun` op. +std::unique_ptr> CreateXlaRewriteV2Pass(); + +// Create a pass that validates the input graph to the CPU/GPU bridge. +std::unique_ptr> CreateXlaValidateInputsPass(); +} // namespace TFDevice + +namespace TFTPU { +// Creates a pass that converts unified compilation and replication +// attributes back to legacy attributes. +std::unique_ptr> +CreateConvertToLegacyCompileAndReplicateAttributesPass(); + +// Creates a pass that converts all TPUPartitionedInput to TPUPartitionedInputV2 +std::unique_ptr> +CreateTPUPartitionedOpConversionPass(); + +// Creates a pass that forms clusters from operations of the same +// `_replication_info` attribute. +std::unique_ptr> CreateTPUClusterFormationPass( + bool strict_clusters = false); + +std::unique_ptr> CreateTPUValidateInputsPass(); + +// Creates a pass that cleans up `_replication_info` attribute on operations +// that are inside a cluster. +std::unique_ptr> +CreateTPUClusterCleanupAttributesPass(); + +// Creates a pass that removes Identity/IdentityN ops from a cluster. +std::unique_ptr> CreateTPUIdentityPruningPass(); + +// Creates a pass that allows TPU program inputs to have layouts determined at +// run time. +std::unique_ptr> CreateTPUDynamicLayoutPass(); + +// Creates a pass that adds `tf.ReadVariableOp` to a TPU cluster for resources +// the cluster only writes to. +std::unique_ptr> CreateTPUResourceReadForWritePass(); + +// Creates a pass that reorders partitiioned resource reads and replicated +// inputs. +std::unique_ptr> +CreateTPUReorderReplicateAndPartitionedInputsPass(); + +// Creates a pass that partitions unpartitioned resource read/write to +// partitioned resource variables. +std::unique_ptr> +CreateTPUResourceReadsWritesPartitioningPass(); + +// Creates a pass that looks for usage of the result of +// TPUCopyWithDynamicShapeOp and annotate these values to be dynamic shape. This +// ensures that the generated tpu program has the correct inputs annotation. +std::unique_ptr> +CreateTPUAnnotateDynamicShapeInputsPass(); + +// Creates a pass that rewrites `tf_device.launch_func` on TPUs into TPU runtime +// ops. +std::unique_ptr> CreateTPURewritePass( + llvm::StringRef module_name = llvm::StringRef()); + +// Creates a pass that identifies XLASharding ops in launch op for TPU +// computation. +std::unique_ptr> CreateTPUShardingIdentificationPass(); + +// Creates a pass that moves `tf.AssignVariableOp` into a +// `tf_device.parallel_execute` region if the `tf.AssignVariableOp` is the +// only consumer of a `tf_device.parallel_execute` result. +std::unique_ptr> +CreateTPUParallelExecuteSinkResourceWritePass(); + +// Creates a pass that merges device variable reads/updates into the surrounded +// TPUExecute node. This allows the execute node to perform in-place variable +// updates. +std::unique_ptr> +CreateTPUMergeVariablesWithExecutePass(); + +// Create a pass that extract TPUCopyWithDynamicShapeOp from the host launch op +// and wrap them in device launch op. This allows this op executed on TPU while +// still compiled on host. +std::unique_ptr> +CreateExtractTPUCopyWithDynamicShapeOpPass(); + +// Creates a pass that wraps ReadVariableOp/AssignVariable op that consumes a +// packed tensor to have same device placement as underlying TPU device. +std::unique_ptr> +CreateTPUColocateCompositeResourceOps(); + +// Creates a pass that adds ops which perform formatting on variables at +// run-time according to compilation result. +std::unique_ptr> +CreateTPUVariableRuntimeReformattingPass(); + +// Creates a pass that expands outside compilation cluster at the head/tail of +// TPU computation by adding outside compilation attribute to identity/cast ops +// that are only used for host computation. +std::unique_ptr> +CreateTPUHostComputationExpansionPass(); + +// Creates a pass that updates inputs to TPU embedding layer enqueue ops so that +// correct ops are invoked during training and evaluation. +std::unique_ptr> +CreateTPUUpdateEmbeddingEnqueueOpInputsPass(); + +// Creates a pass that propagates TPU devices to users. +std::unique_ptr> CreateTPUDevicePropagationPass(); + +// Create a pass that colocates each `Split` with its predecessor. +std::unique_ptr> CreateTPUColocateSplitsPass(); + +// Populates the supplied passmanager with the passes required to run the +// bridge. +void CreateTPUBridgePipeline(OpPassManager& pm, + llvm::StringRef module_name = llvm::StringRef()); + +// Creates a pass that replicates the tf._TPUCompileMlir op on each host that +// needs the compiled program. It helps avoid transferring the compiled binary +// between hosts. +std::unique_ptr> +CreateTPUCompileOpReplicationPass(); + +// Creates a pass that applies space to depth transform +// for the first or frontier convolutions consume host inputs on TPU. +std::unique_ptr> CreateTPUSpaceToDepthPass(); + +// Adjusts the device on TPUCopyWithDynamicShape ops. +std::unique_ptr> +CreateColocateTPUCopyWithDynamicShapePass(); + +} // namespace TFTPU + +// Define the registrations in a detail namespace, just so that we can overload +// the main entry point `registerTensorFlowPasses` to inject +// RegisterTFOptimizePassPipeline. +namespace detail { + +// Direction in which to move transposes in MoveTransposePass. +enum MoveTransposeDirection { kBegin, kEnd }; + +#define GEN_PASS_REGISTRATION +#define GEN_PASS_DECL_BATCHMATMULTOEINSUMPASS +#define GEN_PASS_DECL_BREAKUPISLANDSPASS +#define GEN_PASS_DECL_BROADCASTFOLDPASS +#define GEN_PASS_DECL_CANONICALIZECOMPILEANDREPLICATEATTRIBUTESPASS +#define GEN_PASS_DECL_CLUSTERCONSTANTSINKINGPASS +#define GEN_PASS_DECL_CLUSTERFORMATIONPASS +#define GEN_PASS_DECL_CLUSTEROUTLININGPASS +#define GEN_PASS_DECL_CLUSTERTFOPSBYHOSTPASS +#define GEN_PASS_DECL_CONSTANTOPDEVICEASSIGNMENTPASS +#define GEN_PASS_DECL_CONVERTLAUNCHFUNCTOTFCALLPASS +#define GEN_PASS_DECL_CONVERTREADONLYREFERENCEVARIABLESTORESOURCEVARIABLESPASS +#define GEN_PASS_DECL_CONVERTTFCONTROLFLOWTOSCFPASS +#define GEN_PASS_DECL_CONVERTTOLEGACYCOMPILEANDREPLICATEATTRIBUTESPASS +#define GEN_PASS_DECL_DECOMPOSEREDUCEDATASETPASS +#define GEN_PASS_DECL_DEVICEINDEXSELECTORPASS +#define GEN_PASS_DECL_DROPWHILESHAPEINVARIANTINDEVICECLUSTERPASS +#define GEN_PASS_DECL_DROPWHILESHAPEINVARIANTPASS +#define GEN_PASS_DECL_EXECUTORCHECKCONTROLDEPENDENCIESPASS +#define GEN_PASS_DECL_EXECUTORCONVERTCONTROLTODATAOUTPUTSPASS +#define GEN_PASS_DECL_EXECUTORDIALECTTOFUNCTIONALPASS +#define GEN_PASS_DECL_EXECUTORGRAPHPRUNINGPASS +#define GEN_PASS_DECL_EXECUTORISLANDCOARSENINGPASS +#define GEN_PASS_DECL_EXECUTORTPUV1ISLANDINLININGPASS +#define GEN_PASS_DECL_EXECUTORUPDATECONTROLDEPENDENCIESPASS +#define GEN_PASS_DECL_FUNCTIONALCONTROLFLOWTOCFGPASS +#define GEN_PASS_DECL_FUNCTIONALCONTROLFLOWTOREGIONSPASS +#define GEN_PASS_DECL_FUNCTIONALTOEXECUTORDIALECTCONVERSIONPASS +#define GEN_PASS_DECL_FUSEDKERNELMATCHERPASS +#define GEN_PASS_DECL_GROUPBYDIALECTPASS +#define GEN_PASS_DECL_GUARANTEEALLFUNCSONEUSEPASS +#define GEN_PASS_DECL_HOISTREPLICATEINVARIANTRESOURCEWRITESPASS +#define GEN_PASS_DECL_INITTEXTFILETOIMPORTPASS +#define GEN_PASS_DECL_LAUNCHOUTLININGPASS +#define GEN_PASS_DECL_LAYOUTASSIGNMENTPASS +#define GEN_PASS_DECL_LEGALIZEHLOTOTFPASS +#define GEN_PASS_DECL_LEGALIZETFGTOTFPASS +#define GEN_PASS_DECL_LOCALIZEVARHANDLESPASS +#define GEN_PASS_DECL_LOWERQUANTIZEDPASS +#define GEN_PASS_DECL_MARKINPUTOUTPUTALIASESPASS +#define GEN_PASS_DECL_MARKOPSFOROUTSIDECOMPILATIONPASS +#define GEN_PASS_DECL_MATERIALIZEPASSTHROUGHOP +#define GEN_PASS_DECL_MERGECONTROLFLOWPASS +#define GEN_PASS_DECL_MOVETRANSPOSESPASS +#define GEN_PASS_DECL_ORDERBYDIALECTPASS +#define GEN_PASS_DECL_PARALLELEXECUTETOISLANDSPASS +#define GEN_PASS_DECL_PREPARETPUCOMPUTATIONFORTFEXPORTPASS +#define GEN_PASS_DECL_PROMOTERESOURCESTOARGSPASS +#define GEN_PASS_DECL_PROMOTEVARHANDLESTOARGSPASS +#define GEN_PASS_DECL_REGIONCONTROLFLOWTOFUNCTIONALPASS +#define GEN_PASS_DECL_REMOVEUNUSEDARGUMENTSPASS +#define GEN_PASS_DECL_REMOVEUNUSEDWHILERESULTSPASS +#define GEN_PASS_DECL_REPLICAIDTODEVICEORDINALPASS +#define GEN_PASS_DECL_REPLICATEINVARIANTOPHOISTINGPASS +#define GEN_PASS_DECL_REPLICATETOISLANDPASS +#define GEN_PASS_DECL_RESOURCEDEVICEINFERENCEPASS +#define GEN_PASS_DECL_REWRITETPUEMBEDDINGOPSPASS +#define GEN_PASS_DECL_SIMPLETFDEVICEASSIGNMENTPASS +#define GEN_PASS_DECL_SPLITINTOISLANDPEROPPASS +#define GEN_PASS_DECL_STACKOPSDECOMPOSITIONPASS +#define GEN_PASS_DECL_STRIPNOINLINEATTRIBUTEPASS +#define GEN_PASS_DECL_TFDATAOPTIMIZATIONPASS +#define GEN_PASS_DECL_TFDEVICEASSIGNMENTBYFUNCATTRPASS +#define GEN_PASS_DECL_TPUBRIDGEEXECUTORISLANDOUTLININGPASS +#define GEN_PASS_DECL_TPUCLEANUPCLUSTERATTRIBUTESPASS +#define GEN_PASS_DECL_TPUCLUSTERFORMATIONPASS +#define GEN_PASS_DECL_TPUCOLOCATECOMPOSITERESOURCEOPSPASS +#define GEN_PASS_DECL_TPUDEVICEPROPAGATIONPASS +#define GEN_PASS_DECL_TPUDYNAMICLAYOUTPASS +#define GEN_PASS_DECL_TPUEXTRACTHEADTAILOUTSIDECOMPILATIONPASS +#define GEN_PASS_DECL_TPUEXTRACTOUTSIDECOMPILATIONPASS +#define GEN_PASS_DECL_TPUHOSTCOMPUTATIONEXPANSIONPASS +#define GEN_PASS_DECL_TPUIDENTITYPRUNINGPASS +#define GEN_PASS_DECL_TPUMERGEVARIABLESWITHEXECUTEPASS +#define GEN_PASS_DECL_EXTRACTTPUCOPYWITHDYNAMICSHAPEOPPASS +#define GEN_PASS_DECL_TPUPARALLELEXECUTESINKRESOURCEWRITEPASS +#define GEN_PASS_DECL_TPUREORDERREPLICATEANDPARTITIONEDINPUTSPASS +#define GEN_PASS_DECL_TPURESOURCEREADFORWRITEPASS +#define GEN_PASS_DECL_TPURESOURCEREADSWRITESPARTITIONINGPASS +#define GEN_PASS_DECL_TPUREWRITEPASS +#define GEN_PASS_DECL_TPUSHARDINGIDENTIFICATIONPASS +#define GEN_PASS_DECL_TPUSPACETODEPTHPASS +#define GEN_PASS_DECL_TPUUPDATEEMBEDDINGENQUEUEOPINPUTSPASS +#define GEN_PASS_DECL_TPUVALIDATEINPUTSPASS +#define GEN_PASS_DECL_TPUVARIABLERUNTIMEREFORMATTINGPASS +#define GEN_PASS_DECL_TENSORARRAYOPSDECOMPOSITIONPASS +#define GEN_PASS_DECL_TENSORDEVICECOPYCONVERSIONPASS +#define GEN_PASS_DECL_TENSORFLOWOPTIMIZEPASS +#define GEN_PASS_DECL_TENSORFLOWSHAPEINFERENCEPASS +#define GEN_PASS_DECL_TENSORLISTOPSDECOMPOSITIONPASS +#define GEN_PASS_DECL_TENSORFLOWGPUFUSION +#define GEN_PASS_DECL_TPUV1BRIDGEEXECUTORISLANDCOARSENINGPASS +#define GEN_PASS_DECL_TRANSFORMEINSUMPASS +#define GEN_PASS_DECL_UNROLLBATCHMATMULPASS +#define GEN_PASS_DECL_VERIFYSUITABLEFOREXPORTPASS +#define GEN_PASS_DECL_XLACALLMODULEDESERIALIZATIONPASS +#define GEN_PASS_DECL_XLACALLMODULESERIALIZATIONPASS +#define GEN_PASS_DECL_XLACALLMODULECUSTOMCALLTFFUNCTIONRENAMINGPASS +#include "tensorflow/compiler/mlir/tensorflow/transforms/tf_passes.h.inc" +} // namespace detail +using namespace detail; // NOLINT +inline void registerTensorFlowPasses() { + detail::registerTensorFlowPasses(); + TF::RegisterTFOptimizePassPipeline(); +} + +namespace TFDevice { +#define GEN_PASS_REGISTRATION +#define GEN_PASS_DECL_ANNOTATEPARAMETERREPLICATIONPASS +#define GEN_PASS_DECL_DECOMPOSERESOURCEOPSINCLUSTERPASS +#define GEN_PASS_DECL_DECOMPOSERESOURCEOPSPASS +#define GEN_PASS_DECL_DEVICEATTRIBUTETOLAUNCHPASS +#define GEN_PASS_DECL_HOSTLAUNCHTOOUTSIDECOMPILEDPASS +#define GEN_PASS_DECL_LAUNCHTODEVICEATTRIBUTEPASS +#define GEN_PASS_DECL_OUTSIDECOMPILEDTOHOSTLAUNCHPASS +#define GEN_PASS_DECL_RESOURCEOPLIFTINGFORMAINFUNCTIONPASS +#define GEN_PASS_DECL_RESOURCEOPLIFTINGPASS +#define GEN_PASS_DECL_VERIFYNOOUTSIDECOMPILATIONMARKERSPASS +#define GEN_PASS_DECL_XLACLUSTERFORMATIONPASS +#define GEN_PASS_DECL_XLAINLINEDEVICEOPSPASS +#define GEN_PASS_DECL_XLAREWRITEPASS +#define GEN_PASS_DECL_XLAREWRITEV2PASS +#define GEN_PASS_DECL_XLAVALIDATEINPUTSPASS +#include "tensorflow/compiler/mlir/tensorflow/transforms/tf_device_passes.h.inc" +} // namespace TFDevice + +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSFORMS_PASSES_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/resource_op_lifting_cleanup.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/resource_op_lifting_cleanup.h new file mode 100644 index 0000000000000000000000000000000000000000..f526acc1c29cf6deeaf247a9d4056b7c6c8d3d2d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/resource_op_lifting_cleanup.h @@ -0,0 +1,47 @@ +/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSFORMS_RESOURCE_OP_LIFTING_CLEANUP_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSFORMS_RESOURCE_OP_LIFTING_CLEANUP_H_ + +#include "mlir/Dialect/Func/IR/FuncOps.h" // from @llvm-project +#include "mlir/IR/BuiltinOps.h" // from @llvm-project +#include "mlir/IR/TypeUtilities.h" // from @llvm-project +#include "mlir/IR/Types.h" // from @llvm-project + +// Performs IR cleanup and canonicalization in preparation for Resource Op +// Lifting pass. It does several things: +// - Eliminate identity nodes to remove (most) of resource aliasing +// - Canonicalize functional control flow. For functional control flow we +// expect that any resource output of these ops matches the corresponding +// input, and then forward that input to the output. Fails if this is not the +// case. If successful, the following invariants will hold true: +// (a) For if/case, any resource type results will be deleted. +// (b) For while, any resource type results will be unused. +// - Canonicalize region based control flow. Again, any resource outputs are +// expected to be resolved to be one of the captured resource inputs. Fails +// if this is not the case. If successful, the following invariants will hold +// true: +// (a) For if/case, any resource type results will be deleted. +// (b) For while, any resource type results will be unused. +namespace mlir { +namespace TF { +LogicalResult CleanupAndCanonicalizeForResourceOpLifting(ModuleOp module); +LogicalResult CleanupAndCanonicalizeForResourceOpLifting(func::FuncOp func); + +} // namespace TF +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSFORMS_RESOURCE_OP_LIFTING_CLEANUP_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/rewrite_util.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/rewrite_util.h new file mode 100644 index 0000000000000000000000000000000000000000..c86c4383cc602fc5d8a0b87d80c6fc6cb1804f59 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/rewrite_util.h @@ -0,0 +1,83 @@ +/* Copyright 2021 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSFORMS_REWRITE_UTIL_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSFORMS_REWRITE_UTIL_H_ + +#include "mlir/IR/Matchers.h" // from @llvm-project +#include "mlir/IR/PatternMatch.h" // from @llvm-project + +namespace mlir { +namespace TF { + +// Returns int, float or complex DenseElementsAttr with scalar shape with the +// given element type and the integer value. +template +DenseElementsAttr GetScalarOfType(Type ty, T raw_value) { + RankedTensorType scalar_ty = RankedTensorType::get({}, ty); + if (auto float_ty = ty.dyn_cast()) { + FloatAttr attr = FloatAttr::get(float_ty, raw_value); + return DenseElementsAttr::get(scalar_ty, attr); + } else if (auto int_ty = ty.dyn_cast()) { + IntegerAttr attr = IntegerAttr::get(int_ty, raw_value); + return DenseElementsAttr::get(scalar_ty, attr); + } else if (auto complex_ty = ty.dyn_cast()) { + Type complex_element_ty = complex_ty.getElementType(); + if (complex_element_ty.isF32()) { + return DenseElementsAttr::get( + scalar_ty, static_cast>(raw_value)); + } else if (complex_element_ty.isF64()) { + return DenseElementsAttr::get( + scalar_ty, static_cast>(raw_value)); + } + } + llvm_unreachable("unsupported type"); +} + +// Returns true if `value` is compile-time constant and its splat value equals +// to `raw_value`. +template +bool IsConstantValueOf(Value value, T raw_value) { + auto element_type = value.getType().cast().getElementType(); + if (element_type.isa()) { + DenseFPElementsAttr float_attr; + if (matchPattern(value, m_Constant(&float_attr)) && float_attr.isSplat() && + float_attr.getSplatValue().isExactlyValue(raw_value)) + return true; + } else if (element_type.isa()) { + DenseIntElementsAttr int_attr; + if (matchPattern(value, m_Constant(&int_attr)) && int_attr.isSplat() && + int_attr.getSplatValue() == raw_value) + return true; + } + + return false; +} + +// Returns true if `op` is placed on GPU device, and false if it's on other +// devices or the device is not specified. +bool IsOnGpuDevice(mlir::Operation *op); + +// Wrappers for CopyDeviceAndUnderscoredAttributes +void CopyDeviceAndUnderscoredAttributesAdaptor(mlir::OpResult src, + mlir::OpResult dest); +void CopyDeviceAndUnderscoredAttributesAdaptor(mlir::Operation *src, + mlir::OpResult dest); +void CopyDeviceAndUnderscoredAttributesAdaptor(mlir::Operation *src, + mlir::Operation *dest); +} // namespace TF +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSFORMS_REWRITE_UTIL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/set_tpu_infeed_layout.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/set_tpu_infeed_layout.h new file mode 100644 index 0000000000000000000000000000000000000000..c2fd9a3989c9a1779555a37f0de1d0cf51afe4b2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/set_tpu_infeed_layout.h @@ -0,0 +1,34 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSFORMS_SET_TPU_INFEED_LAYOUT_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSFORMS_SET_TPU_INFEED_LAYOUT_H_ + +#include "mlir/Dialect/Func/IR/FuncOps.h" // from @llvm-project +#include "mlir/IR/BuiltinOps.h" // from @llvm-project +#include "mlir/IR/OwningOpRef.h" // from @llvm-project + +namespace mlir { + +// Set layouts attribute of tf.InfeedDequeueTuple ops. +bool SetTPUInfeedLayout(OwningOpRef& mlir_module); + +// Try to determine the right TPU infeed layout. +FailureOr GetTPUInfeedLayout(ArrayRef types, + OpBuilder& rewriter); + +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSFORMS_SET_TPU_INFEED_LAYOUT_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/shape_inference.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/shape_inference.h new file mode 100644 index 0000000000000000000000000000000000000000..e12c470d53f4cb180a9e1339a715060aa7938978 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/shape_inference.h @@ -0,0 +1,54 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSFORMS_SHAPE_INFERENCE_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSFORMS_SHAPE_INFERENCE_H_ + +#include + +#include "mlir/Dialect/Func/IR/FuncOps.h" // from @llvm-project +#include "mlir/IR/BuiltinOps.h" // from @llvm-project +#include "mlir/IR/Operation.h" // from @llvm-project +#include "mlir/IR/Region.h" // from @llvm-project +#include "mlir/Support/LogicalResult.h" // from @llvm-project + +namespace mlir { +namespace TF { + +// Returns whether type can be further refined. +bool CanBeRefined(Type type); + +// Refines all the shapes in a module. +// Returns a failure() on error, otherwise returns true to indicate that it +// reached convergence, false otherwise. +FailureOr InferModuleShape(ModuleOp module, int64_t max_iterations = 10); + +// Given a list of refined shapes matching the function arguments of func, runs +// shape inference over the function to propagate this updated information. +// If arg_shapes are empty, then argument shapes will be left unchanged. +// Note: This affects the entire module, and changes are not just scoped to the +// function being inferred. +// Returns a failure() on error, otherwise returns true to indicate that it +// reached convergence, false otherwise. +FailureOr InferShapeForFunction(func::FuncOp func, + ArrayRef> arg_shapes, + int64_t graph_version, + int64_t max_iterations = 10); + +} // namespace TF + +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSFORMS_SHAPE_INFERENCE_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/tf_data_optimization.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/tf_data_optimization.h new file mode 100644 index 0000000000000000000000000000000000000000..b8a176da35535fae33718c36aae9c6e53a3911b0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/tf_data_optimization.h @@ -0,0 +1,32 @@ +/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSFORMS_TF_DATA_OPTIMIZATION_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSFORMS_TF_DATA_OPTIMIZATION_H_ + +#include "mlir/IR/MLIRContext.h" // from @llvm-project +#include "mlir/IR/PatternMatch.h" // from @llvm-project + +namespace mlir { +namespace TF { + +// Populates patterns to perform optimizations specific to tf.data operations. +void PopulateTFDataOptimizationPatterns(MLIRContext *context, + RewritePatternSet *patterns); + +} // namespace TF +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSFORMS_TF_DATA_OPTIMIZATION_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/tf_device_passes.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/tf_device_passes.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..7d4afcbde131e25075f13018842001061f4955f7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/tf_device_passes.h.inc @@ -0,0 +1,1878 @@ +/* Autogenerated by mlir-tblgen; don't manually edit */ + +#ifdef GEN_PASS_DECL +// Generate declarations for all passes. +#define GEN_PASS_DECL_ANNOTATEPARAMETERREPLICATIONPASS +#define GEN_PASS_DECL_DECOMPOSERESOURCEOPSINCLUSTERPASS +#define GEN_PASS_DECL_DECOMPOSERESOURCEOPSPASS +#define GEN_PASS_DECL_DEVICEATTRIBUTETOLAUNCHPASS +#define GEN_PASS_DECL_HOSTLAUNCHTOOUTSIDECOMPILEDPASS +#define GEN_PASS_DECL_LAUNCHTODEVICEATTRIBUTEPASS +#define GEN_PASS_DECL_OUTSIDECOMPILEDTOHOSTLAUNCHPASS +#define GEN_PASS_DECL_RESOURCEOPLIFTINGFORMAINFUNCTIONPASS +#define GEN_PASS_DECL_RESOURCEOPLIFTINGPASS +#define GEN_PASS_DECL_VERIFYNOOUTSIDECOMPILATIONMARKERSPASS +#define GEN_PASS_DECL_XLACLUSTERFORMATIONPASS +#define GEN_PASS_DECL_XLAINLINEDEVICEOPSPASS +#define GEN_PASS_DECL_XLAREWRITEPASS +#define GEN_PASS_DECL_XLAREWRITEV2PASS +#define GEN_PASS_DECL_XLAVALIDATEINPUTSPASS +#undef GEN_PASS_DECL +#endif // GEN_PASS_DECL + +//===----------------------------------------------------------------------===// +// AnnotateParameterReplicationPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_ANNOTATEPARAMETERREPLICATIONPASS +#undef GEN_PASS_DECL_ANNOTATEPARAMETERREPLICATIONPASS +#endif // GEN_PASS_DECL_ANNOTATEPARAMETERREPLICATIONPASS +#ifdef GEN_PASS_DEF_ANNOTATEPARAMETERREPLICATIONPASS +namespace impl { + +template +class AnnotateParameterReplicationPassBase : public ::mlir::OperationPass { +public: + using Base = AnnotateParameterReplicationPassBase; + + AnnotateParameterReplicationPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + AnnotateParameterReplicationPassBase(const AnnotateParameterReplicationPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-annotate-parameter-replication"); + } + ::llvm::StringRef getArgument() const override { return "tf-annotate-parameter-replication"; } + + ::llvm::StringRef getDescription() const override { return "Annotate whether a ClusterFuncOp's parameters have the same data across replicas."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("AnnotateParameterReplicationPass"); + } + ::llvm::StringRef getName() const override { return "AnnotateParameterReplicationPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(AnnotateParameterReplicationPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_ANNOTATEPARAMETERREPLICATIONPASS +#endif // GEN_PASS_DEF_ANNOTATEPARAMETERREPLICATIONPASS + +//===----------------------------------------------------------------------===// +// DecomposeResourceOpsInClusterPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_DECOMPOSERESOURCEOPSINCLUSTERPASS +#undef GEN_PASS_DECL_DECOMPOSERESOURCEOPSINCLUSTERPASS +#endif // GEN_PASS_DECL_DECOMPOSERESOURCEOPSINCLUSTERPASS +#ifdef GEN_PASS_DEF_DECOMPOSERESOURCEOPSINCLUSTERPASS +namespace impl { + +template +class DecomposeResourceOpsInClusterPassBase : public ::mlir::OperationPass { +public: + using Base = DecomposeResourceOpsInClusterPassBase; + + DecomposeResourceOpsInClusterPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + DecomposeResourceOpsInClusterPassBase(const DecomposeResourceOpsInClusterPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-device-decompose-resource-ops-in-cluster"); + } + ::llvm::StringRef getArgument() const override { return "tf-device-decompose-resource-ops-in-cluster"; } + + ::llvm::StringRef getDescription() const override { return "Decompose composite resource variable operations into primitive Read/AssignVariableOp and raw computation within device cluster and reachable functions."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("DecomposeResourceOpsInClusterPass"); + } + ::llvm::StringRef getName() const override { return "DecomposeResourceOpsInClusterPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(DecomposeResourceOpsInClusterPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_DECOMPOSERESOURCEOPSINCLUSTERPASS +#endif // GEN_PASS_DEF_DECOMPOSERESOURCEOPSINCLUSTERPASS + +//===----------------------------------------------------------------------===// +// DecomposeResourceOpsPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_DECOMPOSERESOURCEOPSPASS +#undef GEN_PASS_DECL_DECOMPOSERESOURCEOPSPASS +#endif // GEN_PASS_DECL_DECOMPOSERESOURCEOPSPASS +#ifdef GEN_PASS_DEF_DECOMPOSERESOURCEOPSPASS +namespace impl { + +template +class DecomposeResourceOpsPassBase : public ::mlir::OperationPass { +public: + using Base = DecomposeResourceOpsPassBase; + + DecomposeResourceOpsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + DecomposeResourceOpsPassBase(const DecomposeResourceOpsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-device-decompose-resource-ops"); + } + ::llvm::StringRef getArgument() const override { return "tf-device-decompose-resource-ops"; } + + ::llvm::StringRef getDescription() const override { return "Decompose composite resource variable operations into primitive Read/AssignVariableOp and raw computation."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("DecomposeResourceOpsPass"); + } + ::llvm::StringRef getName() const override { return "DecomposeResourceOpsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(DecomposeResourceOpsPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_DECOMPOSERESOURCEOPSPASS +#endif // GEN_PASS_DEF_DECOMPOSERESOURCEOPSPASS + +//===----------------------------------------------------------------------===// +// DeviceAttributeToLaunchPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_DEVICEATTRIBUTETOLAUNCHPASS +#undef GEN_PASS_DECL_DEVICEATTRIBUTETOLAUNCHPASS +#endif // GEN_PASS_DECL_DEVICEATTRIBUTETOLAUNCHPASS +#ifdef GEN_PASS_DEF_DEVICEATTRIBUTETOLAUNCHPASS +namespace impl { + +template +class DeviceAttributeToLaunchPassBase : public ::mlir::OperationPass { +public: + using Base = DeviceAttributeToLaunchPassBase; + + DeviceAttributeToLaunchPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + DeviceAttributeToLaunchPassBase(const DeviceAttributeToLaunchPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-device-attribute-to-launch"); + } + ::llvm::StringRef getArgument() const override { return "tf-device-attribute-to-launch"; } + + ::llvm::StringRef getDescription() const override { return "Wraps each TF op which has a non-empty device attribute in a tf_device.launch."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("DeviceAttributeToLaunchPass"); + } + ::llvm::StringRef getName() const override { return "DeviceAttributeToLaunchPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(DeviceAttributeToLaunchPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_DEVICEATTRIBUTETOLAUNCHPASS +#endif // GEN_PASS_DEF_DEVICEATTRIBUTETOLAUNCHPASS + +//===----------------------------------------------------------------------===// +// HostLaunchToOutsideCompiledPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_HOSTLAUNCHTOOUTSIDECOMPILEDPASS +#undef GEN_PASS_DECL_HOSTLAUNCHTOOUTSIDECOMPILEDPASS +#endif // GEN_PASS_DECL_HOSTLAUNCHTOOUTSIDECOMPILEDPASS +#ifdef GEN_PASS_DEF_HOSTLAUNCHTOOUTSIDECOMPILEDPASS +namespace impl { + +template +class HostLaunchToOutsideCompiledPassBase : public ::mlir::OperationPass { +public: + using Base = HostLaunchToOutsideCompiledPassBase; + + HostLaunchToOutsideCompiledPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + HostLaunchToOutsideCompiledPassBase(const HostLaunchToOutsideCompiledPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-device-host-launch-to-outside-compiled"); + } + ::llvm::StringRef getArgument() const override { return "tf-device-host-launch-to-outside-compiled"; } + + ::llvm::StringRef getDescription() const override { return "Converts each op wrapped in launch op with host device assignnment to op with _xla_outside_compiled attribute."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("HostLaunchToOutsideCompiledPass"); + } + ::llvm::StringRef getName() const override { return "HostLaunchToOutsideCompiledPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(HostLaunchToOutsideCompiledPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_HOSTLAUNCHTOOUTSIDECOMPILEDPASS +#endif // GEN_PASS_DEF_HOSTLAUNCHTOOUTSIDECOMPILEDPASS + +//===----------------------------------------------------------------------===// +// LaunchToDeviceAttributePass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_LAUNCHTODEVICEATTRIBUTEPASS +struct LaunchToDeviceAttributePassOptions { + bool legacy_graph_export_ = true; +}; +#undef GEN_PASS_DECL_LAUNCHTODEVICEATTRIBUTEPASS +#endif // GEN_PASS_DECL_LAUNCHTODEVICEATTRIBUTEPASS +#ifdef GEN_PASS_DEF_LAUNCHTODEVICEATTRIBUTEPASS +namespace impl { + +template +class LaunchToDeviceAttributePassBase : public ::mlir::OperationPass { +public: + using Base = LaunchToDeviceAttributePassBase; + + LaunchToDeviceAttributePassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + LaunchToDeviceAttributePassBase(const LaunchToDeviceAttributePassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-launch-to-device-attribute"); + } + ::llvm::StringRef getArgument() const override { return "tf-launch-to-device-attribute"; } + + ::llvm::StringRef getDescription() const override { return "Hoists and annotates device launch inner ops with associated device attribute."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LaunchToDeviceAttributePass"); + } + ::llvm::StringRef getName() const override { return "LaunchToDeviceAttributePass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LaunchToDeviceAttributePassBase) + + LaunchToDeviceAttributePassBase(const LaunchToDeviceAttributePassOptions &options) : LaunchToDeviceAttributePassBase() { + legacy_graph_export_ = options.legacy_graph_export_; + } +protected: + ::mlir::Pass::Option legacy_graph_export_{*this, "legacy-graph-export", ::llvm::cl::desc("Determines whether or not this pass should execute logic that is reserved for the legacy graph export pipeline to maintain expected invariants. In the case of this pass, that means manually propagating controls to lifted parallel execute regions to the graph fetch to ensure the ops execute, as well as determining whether or not the islands created by this pass should be split after the replicated ops have been lifted."), ::llvm::cl::init(true)}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_LAUNCHTODEVICEATTRIBUTEPASS +#endif // GEN_PASS_DEF_LAUNCHTODEVICEATTRIBUTEPASS + +//===----------------------------------------------------------------------===// +// OutsideCompiledToHostLaunchPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_OUTSIDECOMPILEDTOHOSTLAUNCHPASS +#undef GEN_PASS_DECL_OUTSIDECOMPILEDTOHOSTLAUNCHPASS +#endif // GEN_PASS_DECL_OUTSIDECOMPILEDTOHOSTLAUNCHPASS +#ifdef GEN_PASS_DEF_OUTSIDECOMPILEDTOHOSTLAUNCHPASS +namespace impl { + +template +class OutsideCompiledToHostLaunchPassBase : public ::mlir::OperationPass { +public: + using Base = OutsideCompiledToHostLaunchPassBase; + + OutsideCompiledToHostLaunchPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + OutsideCompiledToHostLaunchPassBase(const OutsideCompiledToHostLaunchPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-outside-compiled-to-host-launch"); + } + ::llvm::StringRef getArgument() const override { return "tf-outside-compiled-to-host-launch"; } + + ::llvm::StringRef getDescription() const override { return "Wraps each op with the _xla_outside_compiled attribute in a separate tf_device.launch on replicated host device."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("OutsideCompiledToHostLaunchPass"); + } + ::llvm::StringRef getName() const override { return "OutsideCompiledToHostLaunchPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(OutsideCompiledToHostLaunchPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_OUTSIDECOMPILEDTOHOSTLAUNCHPASS +#endif // GEN_PASS_DEF_OUTSIDECOMPILEDTOHOSTLAUNCHPASS + +//===----------------------------------------------------------------------===// +// ResourceOpLiftingForMainFunctionPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_RESOURCEOPLIFTINGFORMAINFUNCTIONPASS +#undef GEN_PASS_DECL_RESOURCEOPLIFTINGFORMAINFUNCTIONPASS +#endif // GEN_PASS_DECL_RESOURCEOPLIFTINGFORMAINFUNCTIONPASS +#ifdef GEN_PASS_DEF_RESOURCEOPLIFTINGFORMAINFUNCTIONPASS +namespace impl { + +template +class ResourceOpLiftingForMainFunctionPassBase : public ::mlir::OperationPass { +public: + using Base = ResourceOpLiftingForMainFunctionPassBase; + + ResourceOpLiftingForMainFunctionPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ResourceOpLiftingForMainFunctionPassBase(const ResourceOpLiftingForMainFunctionPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-resource-op-lifting-for-main-function"); + } + ::llvm::StringRef getArgument() const override { return "tf-resource-op-lifting-for-main-function"; } + + ::llvm::StringRef getDescription() const override { return "Lifting resource operations out of control flow statements for the main function"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ResourceOpLiftingForMainFunctionPass"); + } + ::llvm::StringRef getName() const override { return "ResourceOpLiftingForMainFunctionPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ResourceOpLiftingForMainFunctionPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_RESOURCEOPLIFTINGFORMAINFUNCTIONPASS +#endif // GEN_PASS_DEF_RESOURCEOPLIFTINGFORMAINFUNCTIONPASS + +//===----------------------------------------------------------------------===// +// ResourceOpLiftingPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_RESOURCEOPLIFTINGPASS +#undef GEN_PASS_DECL_RESOURCEOPLIFTINGPASS +#endif // GEN_PASS_DECL_RESOURCEOPLIFTINGPASS +#ifdef GEN_PASS_DEF_RESOURCEOPLIFTINGPASS +namespace impl { + +template +class ResourceOpLiftingPassBase : public ::mlir::OperationPass { +public: + using Base = ResourceOpLiftingPassBase; + + ResourceOpLiftingPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ResourceOpLiftingPassBase(const ResourceOpLiftingPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-resource-op-lifting"); + } + ::llvm::StringRef getArgument() const override { return "tf-resource-op-lifting"; } + + ::llvm::StringRef getDescription() const override { return "Lifting resource operations out of device computation"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ResourceOpLiftingPass"); + } + ::llvm::StringRef getName() const override { return "ResourceOpLiftingPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ResourceOpLiftingPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_RESOURCEOPLIFTINGPASS +#endif // GEN_PASS_DEF_RESOURCEOPLIFTINGPASS + +//===----------------------------------------------------------------------===// +// VerifyNoOutsideCompilationMarkersPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_VERIFYNOOUTSIDECOMPILATIONMARKERSPASS +#undef GEN_PASS_DECL_VERIFYNOOUTSIDECOMPILATIONMARKERSPASS +#endif // GEN_PASS_DECL_VERIFYNOOUTSIDECOMPILATIONMARKERSPASS +#ifdef GEN_PASS_DEF_VERIFYNOOUTSIDECOMPILATIONMARKERSPASS +namespace impl { + +template +class VerifyNoOutsideCompilationMarkersPassBase : public ::mlir::OperationPass { +public: + using Base = VerifyNoOutsideCompilationMarkersPassBase; + + VerifyNoOutsideCompilationMarkersPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + VerifyNoOutsideCompilationMarkersPassBase(const VerifyNoOutsideCompilationMarkersPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("verify-no-outside-compilation-markers"); + } + ::llvm::StringRef getArgument() const override { return "verify-no-outside-compilation-markers"; } + + ::llvm::StringRef getDescription() const override { return "Verifies that after Outside Compilation passes complete, there are no more _xla_outside_compilation attributes and no tf_device.launch ops."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("VerifyNoOutsideCompilationMarkersPass"); + } + ::llvm::StringRef getName() const override { return "VerifyNoOutsideCompilationMarkersPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(VerifyNoOutsideCompilationMarkersPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_VERIFYNOOUTSIDECOMPILATIONMARKERSPASS +#endif // GEN_PASS_DEF_VERIFYNOOUTSIDECOMPILATIONMARKERSPASS + +//===----------------------------------------------------------------------===// +// XlaClusterFormationPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_XLACLUSTERFORMATIONPASS +#undef GEN_PASS_DECL_XLACLUSTERFORMATIONPASS +#endif // GEN_PASS_DECL_XLACLUSTERFORMATIONPASS +#ifdef GEN_PASS_DEF_XLACLUSTERFORMATIONPASS +namespace impl { + +template +class XlaClusterFormationPassBase : public ::mlir::OperationPass { +public: + using Base = XlaClusterFormationPassBase; + + XlaClusterFormationPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + XlaClusterFormationPassBase(const XlaClusterFormationPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-xla-cluster-formation"); + } + ::llvm::StringRef getArgument() const override { return "tf-xla-cluster-formation"; } + + ::llvm::StringRef getDescription() const override { return "Encapsulate partitioned calls within a Cluster op"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("XlaClusterFormationPass"); + } + ::llvm::StringRef getName() const override { return "XlaClusterFormationPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(XlaClusterFormationPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_XLACLUSTERFORMATIONPASS +#endif // GEN_PASS_DEF_XLACLUSTERFORMATIONPASS + +//===----------------------------------------------------------------------===// +// XlaInlineDeviceOpsPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_XLAINLINEDEVICEOPSPASS +#undef GEN_PASS_DECL_XLAINLINEDEVICEOPSPASS +#endif // GEN_PASS_DECL_XLAINLINEDEVICEOPSPASS +#ifdef GEN_PASS_DEF_XLAINLINEDEVICEOPSPASS +namespace impl { + +template +class XlaInlineDeviceOpsPassBase : public ::mlir::OperationPass { +public: + using Base = XlaInlineDeviceOpsPassBase; + + XlaInlineDeviceOpsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + XlaInlineDeviceOpsPassBase(const XlaInlineDeviceOpsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-xla-inline-device-ops"); + } + ::llvm::StringRef getArgument() const override { return "tf-xla-inline-device-ops"; } + + ::llvm::StringRef getDescription() const override { return "Inline all Cluster op based in the parent region"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("XlaInlineDeviceOpsPass"); + } + ::llvm::StringRef getName() const override { return "XlaInlineDeviceOpsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(XlaInlineDeviceOpsPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_XLAINLINEDEVICEOPSPASS +#endif // GEN_PASS_DEF_XLAINLINEDEVICEOPSPASS + +//===----------------------------------------------------------------------===// +// XlaRewritePass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_XLAREWRITEPASS +#undef GEN_PASS_DECL_XLAREWRITEPASS +#endif // GEN_PASS_DECL_XLAREWRITEPASS +#ifdef GEN_PASS_DEF_XLAREWRITEPASS +namespace impl { + +template +class XlaRewritePassBase : public ::mlir::OperationPass { +public: + using Base = XlaRewritePassBase; + + XlaRewritePassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + XlaRewritePassBase(const XlaRewritePassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-xla-rewrite"); + } + ::llvm::StringRef getArgument() const override { return "tf-xla-rewrite"; } + + ::llvm::StringRef getDescription() const override { return "Rewrites partition calls into Xla launch ops to make the attached function run on XLA."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("XlaRewritePass"); + } + ::llvm::StringRef getName() const override { return "XlaRewritePass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(XlaRewritePassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_XLAREWRITEPASS +#endif // GEN_PASS_DEF_XLAREWRITEPASS + +//===----------------------------------------------------------------------===// +// XlaRewriteV2Pass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_XLAREWRITEV2PASS +#undef GEN_PASS_DECL_XLAREWRITEV2PASS +#endif // GEN_PASS_DECL_XLAREWRITEV2PASS +#ifdef GEN_PASS_DEF_XLAREWRITEV2PASS +namespace impl { + +template +class XlaRewriteV2PassBase : public ::mlir::OperationPass { +public: + using Base = XlaRewriteV2PassBase; + + XlaRewriteV2PassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + XlaRewriteV2PassBase(const XlaRewriteV2PassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-xla-rewrite-v2"); + } + ::llvm::StringRef getArgument() const override { return "tf-xla-rewrite-v2"; } + + ::llvm::StringRef getDescription() const override { return "Rewrites `tf_device.cluster_func op` into `_XlaCompile` and `_XlaRun` ops to make the attached function run on XLA."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("XlaRewriteV2Pass"); + } + ::llvm::StringRef getName() const override { return "XlaRewriteV2Pass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(XlaRewriteV2PassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_XLAREWRITEV2PASS +#endif // GEN_PASS_DEF_XLAREWRITEV2PASS + +//===----------------------------------------------------------------------===// +// XlaValidateInputsPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_XLAVALIDATEINPUTSPASS +#undef GEN_PASS_DECL_XLAVALIDATEINPUTSPASS +#endif // GEN_PASS_DECL_XLAVALIDATEINPUTSPASS +#ifdef GEN_PASS_DEF_XLAVALIDATEINPUTSPASS +namespace impl { + +template +class XlaValidateInputsPassBase : public ::mlir::OperationPass { +public: + using Base = XlaValidateInputsPassBase; + + XlaValidateInputsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + XlaValidateInputsPassBase(const XlaValidateInputsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-xla-validate-inputs"); + } + ::llvm::StringRef getArgument() const override { return "tf-xla-validate-inputs"; } + + ::llvm::StringRef getDescription() const override { return "Validtes inputs to the TF CPU/GPU bridge"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("XlaValidateInputsPass"); + } + ::llvm::StringRef getName() const override { return "XlaValidateInputsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(XlaValidateInputsPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_XLAVALIDATEINPUTSPASS +#endif // GEN_PASS_DEF_XLAVALIDATEINPUTSPASS +#ifdef GEN_PASS_REGISTRATION + +//===----------------------------------------------------------------------===// +// AnnotateParameterReplicationPass Registration +//===----------------------------------------------------------------------===// + +inline void registerAnnotateParameterReplicationPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateAnnotateParameterReplicationPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerAnnotateParameterReplicationPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateAnnotateParameterReplicationPass(); + }); +} + +//===----------------------------------------------------------------------===// +// DecomposeResourceOpsInClusterPass Registration +//===----------------------------------------------------------------------===// + +inline void registerDecomposeResourceOpsInClusterPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateDecomposeResourceOpsInClusterPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerDecomposeResourceOpsInClusterPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateDecomposeResourceOpsInClusterPass(); + }); +} + +//===----------------------------------------------------------------------===// +// DecomposeResourceOpsPass Registration +//===----------------------------------------------------------------------===// + +inline void registerDecomposeResourceOpsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateDecomposeResourceOpsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerDecomposeResourceOpsPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateDecomposeResourceOpsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// DeviceAttributeToLaunchPass Registration +//===----------------------------------------------------------------------===// + +inline void registerDeviceAttributeToLaunchPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateDeviceAttributeToLaunchPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerDeviceAttributeToLaunchPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateDeviceAttributeToLaunchPass(); + }); +} + +//===----------------------------------------------------------------------===// +// HostLaunchToOutsideCompiledPass Registration +//===----------------------------------------------------------------------===// + +inline void registerHostLaunchToOutsideCompiledPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateHostLaunchToOutsideCompiledPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerHostLaunchToOutsideCompiledPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateHostLaunchToOutsideCompiledPass(); + }); +} + +//===----------------------------------------------------------------------===// +// LaunchToDeviceAttributePass Registration +//===----------------------------------------------------------------------===// + +inline void registerLaunchToDeviceAttributePass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateLaunchToDeviceAttributePass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerLaunchToDeviceAttributePassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateLaunchToDeviceAttributePass(); + }); +} + +//===----------------------------------------------------------------------===// +// OutsideCompiledToHostLaunchPass Registration +//===----------------------------------------------------------------------===// + +inline void registerOutsideCompiledToHostLaunchPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateOutsideCompiledToHostLaunchPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerOutsideCompiledToHostLaunchPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateOutsideCompiledToHostLaunchPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ResourceOpLiftingForMainFunctionPass Registration +//===----------------------------------------------------------------------===// + +inline void registerResourceOpLiftingForMainFunctionPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateResourceOpLiftingForMainFunctionPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerResourceOpLiftingForMainFunctionPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateResourceOpLiftingForMainFunctionPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ResourceOpLiftingPass Registration +//===----------------------------------------------------------------------===// + +inline void registerResourceOpLiftingPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateResourceOpLiftingPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerResourceOpLiftingPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateResourceOpLiftingPass(); + }); +} + +//===----------------------------------------------------------------------===// +// VerifyNoOutsideCompilationMarkersPass Registration +//===----------------------------------------------------------------------===// + +inline void registerVerifyNoOutsideCompilationMarkersPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateVerifyNoOutsideCompilationMarkersPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerVerifyNoOutsideCompilationMarkersPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateVerifyNoOutsideCompilationMarkersPass(); + }); +} + +//===----------------------------------------------------------------------===// +// XlaClusterFormationPass Registration +//===----------------------------------------------------------------------===// + +inline void registerXlaClusterFormationPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateXlaClusterFormationPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerXlaClusterFormationPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateXlaClusterFormationPass(); + }); +} + +//===----------------------------------------------------------------------===// +// XlaInlineDeviceOpsPass Registration +//===----------------------------------------------------------------------===// + +inline void registerXlaInlineDeviceOpsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateXlaInlineDeviceOpsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerXlaInlineDeviceOpsPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateXlaInlineDeviceOpsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// XlaRewritePass Registration +//===----------------------------------------------------------------------===// + +inline void registerXlaRewritePass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateXlaRewritePass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerXlaRewritePassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateXlaRewritePass(); + }); +} + +//===----------------------------------------------------------------------===// +// XlaRewriteV2Pass Registration +//===----------------------------------------------------------------------===// + +inline void registerXlaRewriteV2Pass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateXlaRewriteV2Pass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerXlaRewriteV2PassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateXlaRewriteV2Pass(); + }); +} + +//===----------------------------------------------------------------------===// +// XlaValidateInputsPass Registration +//===----------------------------------------------------------------------===// + +inline void registerXlaValidateInputsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateXlaValidateInputsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerXlaValidateInputsPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateXlaValidateInputsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// TensorFlowDevice Registration +//===----------------------------------------------------------------------===// + +inline void registerTensorFlowDevicePasses() { + registerAnnotateParameterReplicationPass(); + registerDecomposeResourceOpsInClusterPass(); + registerDecomposeResourceOpsPass(); + registerDeviceAttributeToLaunchPass(); + registerHostLaunchToOutsideCompiledPass(); + registerLaunchToDeviceAttributePass(); + registerOutsideCompiledToHostLaunchPass(); + registerResourceOpLiftingForMainFunctionPass(); + registerResourceOpLiftingPass(); + registerVerifyNoOutsideCompilationMarkersPass(); + registerXlaClusterFormationPass(); + registerXlaInlineDeviceOpsPass(); + registerXlaRewritePass(); + registerXlaRewriteV2Pass(); + registerXlaValidateInputsPass(); +} +#undef GEN_PASS_REGISTRATION +#endif // GEN_PASS_REGISTRATION +// Deprecated. Please use the new per-pass macros. +#ifdef GEN_PASS_CLASSES + +template +class AnnotateParameterReplicationPassBase : public ::mlir::OperationPass { +public: + using Base = AnnotateParameterReplicationPassBase; + + AnnotateParameterReplicationPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + AnnotateParameterReplicationPassBase(const AnnotateParameterReplicationPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-annotate-parameter-replication"); + } + ::llvm::StringRef getArgument() const override { return "tf-annotate-parameter-replication"; } + + ::llvm::StringRef getDescription() const override { return "Annotate whether a ClusterFuncOp's parameters have the same data across replicas."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("AnnotateParameterReplicationPass"); + } + ::llvm::StringRef getName() const override { return "AnnotateParameterReplicationPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(AnnotateParameterReplicationPassBase) + +protected: +}; + +template +class DecomposeResourceOpsInClusterPassBase : public ::mlir::OperationPass { +public: + using Base = DecomposeResourceOpsInClusterPassBase; + + DecomposeResourceOpsInClusterPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + DecomposeResourceOpsInClusterPassBase(const DecomposeResourceOpsInClusterPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-device-decompose-resource-ops-in-cluster"); + } + ::llvm::StringRef getArgument() const override { return "tf-device-decompose-resource-ops-in-cluster"; } + + ::llvm::StringRef getDescription() const override { return "Decompose composite resource variable operations into primitive Read/AssignVariableOp and raw computation within device cluster and reachable functions."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("DecomposeResourceOpsInClusterPass"); + } + ::llvm::StringRef getName() const override { return "DecomposeResourceOpsInClusterPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(DecomposeResourceOpsInClusterPassBase) + +protected: +}; + +template +class DecomposeResourceOpsPassBase : public ::mlir::OperationPass { +public: + using Base = DecomposeResourceOpsPassBase; + + DecomposeResourceOpsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + DecomposeResourceOpsPassBase(const DecomposeResourceOpsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-device-decompose-resource-ops"); + } + ::llvm::StringRef getArgument() const override { return "tf-device-decompose-resource-ops"; } + + ::llvm::StringRef getDescription() const override { return "Decompose composite resource variable operations into primitive Read/AssignVariableOp and raw computation."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("DecomposeResourceOpsPass"); + } + ::llvm::StringRef getName() const override { return "DecomposeResourceOpsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(DecomposeResourceOpsPassBase) + +protected: +}; + +template +class DeviceAttributeToLaunchPassBase : public ::mlir::OperationPass { +public: + using Base = DeviceAttributeToLaunchPassBase; + + DeviceAttributeToLaunchPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + DeviceAttributeToLaunchPassBase(const DeviceAttributeToLaunchPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-device-attribute-to-launch"); + } + ::llvm::StringRef getArgument() const override { return "tf-device-attribute-to-launch"; } + + ::llvm::StringRef getDescription() const override { return "Wraps each TF op which has a non-empty device attribute in a tf_device.launch."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("DeviceAttributeToLaunchPass"); + } + ::llvm::StringRef getName() const override { return "DeviceAttributeToLaunchPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(DeviceAttributeToLaunchPassBase) + +protected: +}; + +template +class HostLaunchToOutsideCompiledPassBase : public ::mlir::OperationPass { +public: + using Base = HostLaunchToOutsideCompiledPassBase; + + HostLaunchToOutsideCompiledPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + HostLaunchToOutsideCompiledPassBase(const HostLaunchToOutsideCompiledPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-device-host-launch-to-outside-compiled"); + } + ::llvm::StringRef getArgument() const override { return "tf-device-host-launch-to-outside-compiled"; } + + ::llvm::StringRef getDescription() const override { return "Converts each op wrapped in launch op with host device assignnment to op with _xla_outside_compiled attribute."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("HostLaunchToOutsideCompiledPass"); + } + ::llvm::StringRef getName() const override { return "HostLaunchToOutsideCompiledPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(HostLaunchToOutsideCompiledPassBase) + +protected: +}; + +template +class LaunchToDeviceAttributePassBase : public ::mlir::OperationPass { +public: + using Base = LaunchToDeviceAttributePassBase; + + LaunchToDeviceAttributePassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + LaunchToDeviceAttributePassBase(const LaunchToDeviceAttributePassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-launch-to-device-attribute"); + } + ::llvm::StringRef getArgument() const override { return "tf-launch-to-device-attribute"; } + + ::llvm::StringRef getDescription() const override { return "Hoists and annotates device launch inner ops with associated device attribute."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LaunchToDeviceAttributePass"); + } + ::llvm::StringRef getName() const override { return "LaunchToDeviceAttributePass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LaunchToDeviceAttributePassBase) + +protected: + ::mlir::Pass::Option legacy_graph_export_{*this, "legacy-graph-export", ::llvm::cl::desc("Determines whether or not this pass should execute logic that is reserved for the legacy graph export pipeline to maintain expected invariants. In the case of this pass, that means manually propagating controls to lifted parallel execute regions to the graph fetch to ensure the ops execute, as well as determining whether or not the islands created by this pass should be split after the replicated ops have been lifted."), ::llvm::cl::init(true)}; +}; + +template +class OutsideCompiledToHostLaunchPassBase : public ::mlir::OperationPass { +public: + using Base = OutsideCompiledToHostLaunchPassBase; + + OutsideCompiledToHostLaunchPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + OutsideCompiledToHostLaunchPassBase(const OutsideCompiledToHostLaunchPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-outside-compiled-to-host-launch"); + } + ::llvm::StringRef getArgument() const override { return "tf-outside-compiled-to-host-launch"; } + + ::llvm::StringRef getDescription() const override { return "Wraps each op with the _xla_outside_compiled attribute in a separate tf_device.launch on replicated host device."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("OutsideCompiledToHostLaunchPass"); + } + ::llvm::StringRef getName() const override { return "OutsideCompiledToHostLaunchPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(OutsideCompiledToHostLaunchPassBase) + +protected: +}; + +template +class ResourceOpLiftingForMainFunctionPassBase : public ::mlir::OperationPass { +public: + using Base = ResourceOpLiftingForMainFunctionPassBase; + + ResourceOpLiftingForMainFunctionPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ResourceOpLiftingForMainFunctionPassBase(const ResourceOpLiftingForMainFunctionPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-resource-op-lifting-for-main-function"); + } + ::llvm::StringRef getArgument() const override { return "tf-resource-op-lifting-for-main-function"; } + + ::llvm::StringRef getDescription() const override { return "Lifting resource operations out of control flow statements for the main function"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ResourceOpLiftingForMainFunctionPass"); + } + ::llvm::StringRef getName() const override { return "ResourceOpLiftingForMainFunctionPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ResourceOpLiftingForMainFunctionPassBase) + +protected: +}; + +template +class ResourceOpLiftingPassBase : public ::mlir::OperationPass { +public: + using Base = ResourceOpLiftingPassBase; + + ResourceOpLiftingPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ResourceOpLiftingPassBase(const ResourceOpLiftingPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-resource-op-lifting"); + } + ::llvm::StringRef getArgument() const override { return "tf-resource-op-lifting"; } + + ::llvm::StringRef getDescription() const override { return "Lifting resource operations out of device computation"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ResourceOpLiftingPass"); + } + ::llvm::StringRef getName() const override { return "ResourceOpLiftingPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ResourceOpLiftingPassBase) + +protected: +}; + +template +class VerifyNoOutsideCompilationMarkersPassBase : public ::mlir::OperationPass { +public: + using Base = VerifyNoOutsideCompilationMarkersPassBase; + + VerifyNoOutsideCompilationMarkersPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + VerifyNoOutsideCompilationMarkersPassBase(const VerifyNoOutsideCompilationMarkersPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("verify-no-outside-compilation-markers"); + } + ::llvm::StringRef getArgument() const override { return "verify-no-outside-compilation-markers"; } + + ::llvm::StringRef getDescription() const override { return "Verifies that after Outside Compilation passes complete, there are no more _xla_outside_compilation attributes and no tf_device.launch ops."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("VerifyNoOutsideCompilationMarkersPass"); + } + ::llvm::StringRef getName() const override { return "VerifyNoOutsideCompilationMarkersPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(VerifyNoOutsideCompilationMarkersPassBase) + +protected: +}; + +template +class XlaClusterFormationPassBase : public ::mlir::OperationPass { +public: + using Base = XlaClusterFormationPassBase; + + XlaClusterFormationPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + XlaClusterFormationPassBase(const XlaClusterFormationPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-xla-cluster-formation"); + } + ::llvm::StringRef getArgument() const override { return "tf-xla-cluster-formation"; } + + ::llvm::StringRef getDescription() const override { return "Encapsulate partitioned calls within a Cluster op"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("XlaClusterFormationPass"); + } + ::llvm::StringRef getName() const override { return "XlaClusterFormationPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(XlaClusterFormationPassBase) + +protected: +}; + +template +class XlaInlineDeviceOpsPassBase : public ::mlir::OperationPass { +public: + using Base = XlaInlineDeviceOpsPassBase; + + XlaInlineDeviceOpsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + XlaInlineDeviceOpsPassBase(const XlaInlineDeviceOpsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-xla-inline-device-ops"); + } + ::llvm::StringRef getArgument() const override { return "tf-xla-inline-device-ops"; } + + ::llvm::StringRef getDescription() const override { return "Inline all Cluster op based in the parent region"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("XlaInlineDeviceOpsPass"); + } + ::llvm::StringRef getName() const override { return "XlaInlineDeviceOpsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(XlaInlineDeviceOpsPassBase) + +protected: +}; + +template +class XlaRewritePassBase : public ::mlir::OperationPass { +public: + using Base = XlaRewritePassBase; + + XlaRewritePassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + XlaRewritePassBase(const XlaRewritePassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-xla-rewrite"); + } + ::llvm::StringRef getArgument() const override { return "tf-xla-rewrite"; } + + ::llvm::StringRef getDescription() const override { return "Rewrites partition calls into Xla launch ops to make the attached function run on XLA."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("XlaRewritePass"); + } + ::llvm::StringRef getName() const override { return "XlaRewritePass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(XlaRewritePassBase) + +protected: +}; + +template +class XlaRewriteV2PassBase : public ::mlir::OperationPass { +public: + using Base = XlaRewriteV2PassBase; + + XlaRewriteV2PassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + XlaRewriteV2PassBase(const XlaRewriteV2PassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-xla-rewrite-v2"); + } + ::llvm::StringRef getArgument() const override { return "tf-xla-rewrite-v2"; } + + ::llvm::StringRef getDescription() const override { return "Rewrites `tf_device.cluster_func op` into `_XlaCompile` and `_XlaRun` ops to make the attached function run on XLA."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("XlaRewriteV2Pass"); + } + ::llvm::StringRef getName() const override { return "XlaRewriteV2Pass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(XlaRewriteV2PassBase) + +protected: +}; + +template +class XlaValidateInputsPassBase : public ::mlir::OperationPass { +public: + using Base = XlaValidateInputsPassBase; + + XlaValidateInputsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + XlaValidateInputsPassBase(const XlaValidateInputsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-xla-validate-inputs"); + } + ::llvm::StringRef getArgument() const override { return "tf-xla-validate-inputs"; } + + ::llvm::StringRef getDescription() const override { return "Validtes inputs to the TF CPU/GPU bridge"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("XlaValidateInputsPass"); + } + ::llvm::StringRef getName() const override { return "XlaValidateInputsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(XlaValidateInputsPassBase) + +protected: +}; +#undef GEN_PASS_CLASSES +#endif // GEN_PASS_CLASSES diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/tf_passes.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/tf_passes.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..53d8fdf6fc9bf9c1b02c310f49148eac2e078743 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/tf_passes.h.inc @@ -0,0 +1,13116 @@ +/* Autogenerated by mlir-tblgen; don't manually edit */ + +#ifdef GEN_PASS_DECL +// Generate declarations for all passes. +#define GEN_PASS_DECL_BATCHMATMULTOEINSUMPASS +#define GEN_PASS_DECL_BREAKUPISLANDSPASS +#define GEN_PASS_DECL_BROADCASTFOLDPASS +#define GEN_PASS_DECL_CANONICALIZECOMPILEANDREPLICATEATTRIBUTESPASS +#define GEN_PASS_DECL_CLUSTERCONSTANTSINKINGPASS +#define GEN_PASS_DECL_CLUSTERFORMATIONPASS +#define GEN_PASS_DECL_CLUSTEROUTLININGPASS +#define GEN_PASS_DECL_CLUSTERTFOPSBYHOSTPASS +#define GEN_PASS_DECL_COLOCATETPUCOPYWITHDYNAMICSHAPEPASS +#define GEN_PASS_DECL_CONSTANTOPDEVICEASSIGNMENTPASS +#define GEN_PASS_DECL_CONVERTLAUNCHFUNCTOTFCALLPASS +#define GEN_PASS_DECL_CONVERTREADONLYREFERENCEVARIABLESTORESOURCEVARIABLESPASS +#define GEN_PASS_DECL_CONVERTTFCONTROLFLOWTOSCFPASS +#define GEN_PASS_DECL_CONVERTTOLEGACYCOMPILEANDREPLICATEATTRIBUTESPASS +#define GEN_PASS_DECL_DECOMPOSEREDUCEDATASETPASS +#define GEN_PASS_DECL_DEVICEINDEXSELECTORPASS +#define GEN_PASS_DECL_DROPWHILESHAPEINVARIANTINDEVICECLUSTERPASS +#define GEN_PASS_DECL_DROPWHILESHAPEINVARIANTPASS +#define GEN_PASS_DECL_EMBEDDINGPIPELININGPASS +#define GEN_PASS_DECL_EMBEDDINGPROGRAMKEYPASS +#define GEN_PASS_DECL_EMBEDDINGSEQUENCINGPASS +#define GEN_PASS_DECL_EXECUTORCHECKCONTROLDEPENDENCIESPASS +#define GEN_PASS_DECL_EXECUTORCONVERTCONTROLTODATAOUTPUTSPASS +#define GEN_PASS_DECL_EXECUTORDIALECTTOFUNCTIONALPASS +#define GEN_PASS_DECL_EXECUTORGRAPHPRUNINGPASS +#define GEN_PASS_DECL_EXECUTORISLANDCOARSENINGPASS +#define GEN_PASS_DECL_EXECUTORTPUV1ISLANDINLININGPASS +#define GEN_PASS_DECL_EXECUTORUPDATECONTROLDEPENDENCIESPASS +#define GEN_PASS_DECL_EXTRACTHEADTAILOUTSIDECOMPILATIONPASS +#define GEN_PASS_DECL_EXTRACTOUTSIDECOMPILATIONPASS +#define GEN_PASS_DECL_EXTRACTTPUCOPYWITHDYNAMICSHAPEOPPASS +#define GEN_PASS_DECL_FUNCTIONALCONTROLFLOWTOCFGPASS +#define GEN_PASS_DECL_FUNCTIONALCONTROLFLOWTOREGIONSPASS +#define GEN_PASS_DECL_FUNCTIONALTOEXECUTORDIALECTCONVERSIONPASS +#define GEN_PASS_DECL_FUSEDKERNELMATCHERPASS +#define GEN_PASS_DECL_GROUPBYDIALECTPASS +#define GEN_PASS_DECL_GUARANTEEALLFUNCSONEUSEPASS +#define GEN_PASS_DECL_HOISTLOOPINVARIANTPASS +#define GEN_PASS_DECL_HOISTREPLICATEINVARIANTRESOURCEWRITESPASS +#define GEN_PASS_DECL_INITTEXTFILETOIMPORTPASS +#define GEN_PASS_DECL_LAUNCHOUTLININGPASS +#define GEN_PASS_DECL_LAYOUTASSIGNMENTPASS +#define GEN_PASS_DECL_LEGALIZETFGTOTFPASS +#define GEN_PASS_DECL_LOCALIZEVARHANDLESPASS +#define GEN_PASS_DECL_LOWERQUANTIZEDPASS +#define GEN_PASS_DECL_MARKINPUTOUTPUTALIASESPASS +#define GEN_PASS_DECL_MARKOPSFOROUTSIDECOMPILATIONPASS +#define GEN_PASS_DECL_MATERIALIZEPASSTHROUGHOP +#define GEN_PASS_DECL_MERGECONTROLFLOWPASS +#define GEN_PASS_DECL_MOVETRANSPOSESPASS +#define GEN_PASS_DECL_NAMEANONYMOUSITERATORSPASS +#define GEN_PASS_DECL_ORDERBYDIALECTPASS +#define GEN_PASS_DECL_PARALLELEXECUTETOISLANDSPASS +#define GEN_PASS_DECL_PREPARETPUCOMPUTATIONFORTFEXPORTPASS +#define GEN_PASS_DECL_PROMOTERESOURCESTOARGSPASS +#define GEN_PASS_DECL_PROMOTEVARHANDLESTOARGSPASS +#define GEN_PASS_DECL_REGIONCONTROLFLOWTOFUNCTIONALPASS +#define GEN_PASS_DECL_REMOVEUNUSEDARGUMENTSPASS +#define GEN_PASS_DECL_REMOVEUNUSEDWHILERESULTSPASS +#define GEN_PASS_DECL_REPLICAIDTODEVICEORDINALPASS +#define GEN_PASS_DECL_REPLICATEINVARIANTOPHOISTINGPASS +#define GEN_PASS_DECL_REPLICATETENSORLISTINITOPSPASS +#define GEN_PASS_DECL_REPLICATETOISLANDPASS +#define GEN_PASS_DECL_RESOURCEDEVICEINFERENCEPASS +#define GEN_PASS_DECL_REWRITETPUEMBEDDINGOPSPASS +#define GEN_PASS_DECL_SIMPLETFDEVICEASSIGNMENTPASS +#define GEN_PASS_DECL_SPLITINTOISLANDPEROPPASS +#define GEN_PASS_DECL_STACKOPSDECOMPOSITIONPASS +#define GEN_PASS_DECL_STRIPNOINLINEATTRIBUTEPASS +#define GEN_PASS_DECL_STRIPTFATTRIBUTESPASS +#define GEN_PASS_DECL_TFDATAOPTIMIZATIONPASS +#define GEN_PASS_DECL_TFDEVICEASSIGNMENTBYFUNCATTRPASS +#define GEN_PASS_DECL_TPUANNOTATEDYNAMICSHAPEINPUTSPASS +#define GEN_PASS_DECL_TPUBRIDGEEXECUTORISLANDOUTLININGPASS +#define GEN_PASS_DECL_TPUCLEANUPCLUSTERATTRIBUTESPASS +#define GEN_PASS_DECL_TPUCLUSTERFORMATIONPASS +#define GEN_PASS_DECL_TPUCOLOCATECOMPOSITERESOURCEOPSPASS +#define GEN_PASS_DECL_TPUCOLOCATESPLITSPASS +#define GEN_PASS_DECL_TPUDEVICEPROPAGATIONPASS +#define GEN_PASS_DECL_TPUDYNAMICLAYOUTPASS +#define GEN_PASS_DECL_TPUHOSTCOMPUTATIONEXPANSIONPASS +#define GEN_PASS_DECL_TPUIDENTITYPRUNINGPASS +#define GEN_PASS_DECL_TPUMERGEVARIABLESWITHEXECUTEPASS +#define GEN_PASS_DECL_TPUPARALLELEXECUTESINKRESOURCEWRITEPASS +#define GEN_PASS_DECL_TPUPARTITIONEDOPCONVERSIONPASS +#define GEN_PASS_DECL_TPUREORDERREPLICATEANDPARTITIONEDINPUTSPASS +#define GEN_PASS_DECL_TPURESOURCEREADFORWRITEPASS +#define GEN_PASS_DECL_TPURESOURCEREADSWRITESPARTITIONINGPASS +#define GEN_PASS_DECL_TPUREWRITEPASS +#define GEN_PASS_DECL_TPUSHARDINGIDENTIFICATIONPASS +#define GEN_PASS_DECL_TPUSPACETODEPTHPASS +#define GEN_PASS_DECL_TPUUPDATEEMBEDDINGENQUEUEOPINPUTSPASS +#define GEN_PASS_DECL_TPUVALIDATEINPUTSPASS +#define GEN_PASS_DECL_TPUVARIABLERUNTIMEREFORMATTINGPASS +#define GEN_PASS_DECL_TENSORARRAYOPSDECOMPOSITIONPASS +#define GEN_PASS_DECL_TENSORDEVICECOPYCONVERSIONPASS +#define GEN_PASS_DECL_TENSORFLOWOPTIMIZEPASS +#define GEN_PASS_DECL_TENSORFLOWSHAPEINFERENCEPASS +#define GEN_PASS_DECL_TENSORLISTOPSDECOMPOSITIONPASS +#define GEN_PASS_DECL_TENSORFLOWGPUFUSION +#define GEN_PASS_DECL_TPUV1BRIDGEEXECUTORISLANDCOARSENINGPASS +#define GEN_PASS_DECL_TRANSFORMEINSUMPASS +#define GEN_PASS_DECL_UNROLLBATCHMATMULPASS +#define GEN_PASS_DECL_VERIFYSUITABLEFOREXPORTPASS +#define GEN_PASS_DECL_XLACALLMODULEDESERIALIZATIONPASS +#define GEN_PASS_DECL_XLACALLMODULESERIALIZATIONPASS +#undef GEN_PASS_DECL +#endif // GEN_PASS_DECL + +//===----------------------------------------------------------------------===// +// BatchMatMulToEinsumPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_BATCHMATMULTOEINSUMPASS +#undef GEN_PASS_DECL_BATCHMATMULTOEINSUMPASS +#endif // GEN_PASS_DECL_BATCHMATMULTOEINSUMPASS +#ifdef GEN_PASS_DEF_BATCHMATMULTOEINSUMPASS +namespace impl { + +template +class BatchMatMulToEinsumPassBase : public ::mlir::OperationPass { +public: + using Base = BatchMatMulToEinsumPassBase; + + BatchMatMulToEinsumPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + BatchMatMulToEinsumPassBase(const BatchMatMulToEinsumPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-batch-matmul-to-tf-einsum"); + } + ::llvm::StringRef getArgument() const override { return "tf-batch-matmul-to-tf-einsum"; } + + ::llvm::StringRef getDescription() const override { return "Replace TF BatchMatMul op by TF Einsum op."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("BatchMatMulToEinsumPass"); + } + ::llvm::StringRef getName() const override { return "BatchMatMulToEinsumPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(BatchMatMulToEinsumPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_BATCHMATMULTOEINSUMPASS +#endif // GEN_PASS_DEF_BATCHMATMULTOEINSUMPASS + +//===----------------------------------------------------------------------===// +// BreakUpIslandsPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_BREAKUPISLANDSPASS +#undef GEN_PASS_DECL_BREAKUPISLANDSPASS +#endif // GEN_PASS_DECL_BREAKUPISLANDSPASS +#ifdef GEN_PASS_DEF_BREAKUPISLANDSPASS +namespace impl { + +template +class BreakUpIslandsPassBase : public ::mlir::OperationPass { +public: + using Base = BreakUpIslandsPassBase; + + BreakUpIslandsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + BreakUpIslandsPassBase(const BreakUpIslandsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-executor-break-up-islands"); + } + ::llvm::StringRef getArgument() const override { return "tf-executor-break-up-islands"; } + + ::llvm::StringRef getDescription() const override { return "Transform from TF control dialect to TF executor dialect."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("BreakUpIslandsPass"); + } + ::llvm::StringRef getName() const override { return "BreakUpIslandsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(BreakUpIslandsPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_BREAKUPISLANDSPASS +#endif // GEN_PASS_DEF_BREAKUPISLANDSPASS + +//===----------------------------------------------------------------------===// +// BroadcastFoldPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_BROADCASTFOLDPASS +#undef GEN_PASS_DECL_BROADCASTFOLDPASS +#endif // GEN_PASS_DECL_BROADCASTFOLDPASS +#ifdef GEN_PASS_DEF_BROADCASTFOLDPASS +namespace impl { + +template +class BroadcastFoldPassBase : public ::mlir::OperationPass { +public: + using Base = BroadcastFoldPassBase; + + BroadcastFoldPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + BroadcastFoldPassBase(const BroadcastFoldPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-broadcast-fold"); + } + ::llvm::StringRef getArgument() const override { return "tf-broadcast-fold"; } + + ::llvm::StringRef getDescription() const override { return "Fold explicit broadcasts into the following operations if they support implicit broadcasting on their operand."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("BroadcastFoldPass"); + } + ::llvm::StringRef getName() const override { return "BroadcastFoldPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(BroadcastFoldPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_BROADCASTFOLDPASS +#endif // GEN_PASS_DEF_BROADCASTFOLDPASS + +//===----------------------------------------------------------------------===// +// CanonicalizeCompileAndReplicateAttributesPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CANONICALIZECOMPILEANDREPLICATEATTRIBUTESPASS +#undef GEN_PASS_DECL_CANONICALIZECOMPILEANDREPLICATEATTRIBUTESPASS +#endif // GEN_PASS_DECL_CANONICALIZECOMPILEANDREPLICATEATTRIBUTESPASS +#ifdef GEN_PASS_DEF_CANONICALIZECOMPILEANDREPLICATEATTRIBUTESPASS +namespace impl { + +template +class CanonicalizeCompileAndReplicateAttributesPassBase : public ::mlir::OperationPass { +public: + using Base = CanonicalizeCompileAndReplicateAttributesPassBase; + + CanonicalizeCompileAndReplicateAttributesPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + CanonicalizeCompileAndReplicateAttributesPassBase(const CanonicalizeCompileAndReplicateAttributesPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-canonicalize-compile-and-replicate-attributes"); + } + ::llvm::StringRef getArgument() const override { return "tf-canonicalize-compile-and-replicate-attributes"; } + + ::llvm::StringRef getDescription() const override { return "Canonicalize compilation and replication attributes."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("CanonicalizeCompileAndReplicateAttributesPass"); + } + ::llvm::StringRef getName() const override { return "CanonicalizeCompileAndReplicateAttributesPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(CanonicalizeCompileAndReplicateAttributesPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_CANONICALIZECOMPILEANDREPLICATEATTRIBUTESPASS +#endif // GEN_PASS_DEF_CANONICALIZECOMPILEANDREPLICATEATTRIBUTESPASS + +//===----------------------------------------------------------------------===// +// ClusterConstantSinkingPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CLUSTERCONSTANTSINKINGPASS +#undef GEN_PASS_DECL_CLUSTERCONSTANTSINKINGPASS +#endif // GEN_PASS_DECL_CLUSTERCONSTANTSINKINGPASS +#ifdef GEN_PASS_DEF_CLUSTERCONSTANTSINKINGPASS +namespace impl { + +template +class ClusterConstantSinkingPassBase : public ::mlir::OperationPass { +public: + using Base = ClusterConstantSinkingPassBase; + + ClusterConstantSinkingPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ClusterConstantSinkingPassBase(const ClusterConstantSinkingPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-device-constant-sinking"); + } + ::llvm::StringRef getArgument() const override { return "tf-device-constant-sinking"; } + + ::llvm::StringRef getDescription() const override { return "Sinks constants implicitly captured in a tf_device.cluster region."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ClusterConstantSinkingPass"); + } + ::llvm::StringRef getName() const override { return "ClusterConstantSinkingPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ClusterConstantSinkingPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_CLUSTERCONSTANTSINKINGPASS +#endif // GEN_PASS_DEF_CLUSTERCONSTANTSINKINGPASS + +//===----------------------------------------------------------------------===// +// ClusterFormationPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CLUSTERFORMATIONPASS +#undef GEN_PASS_DECL_CLUSTERFORMATIONPASS +#endif // GEN_PASS_DECL_CLUSTERFORMATIONPASS +#ifdef GEN_PASS_DEF_CLUSTERFORMATIONPASS +namespace impl { + +template +class ClusterFormationPassBase : public ::mlir::OperationPass { +public: + using Base = ClusterFormationPassBase; + + ClusterFormationPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ClusterFormationPassBase(const ClusterFormationPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-device-cluster-formation"); + } + ::llvm::StringRef getArgument() const override { return "tf-device-cluster-formation"; } + + ::llvm::StringRef getDescription() const override { return "Form clusters from instructions assigned to same device"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ClusterFormationPass"); + } + ::llvm::StringRef getName() const override { return "ClusterFormationPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ClusterFormationPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_CLUSTERFORMATIONPASS +#endif // GEN_PASS_DEF_CLUSTERFORMATIONPASS + +//===----------------------------------------------------------------------===// +// ClusterOutliningPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CLUSTEROUTLININGPASS +#undef GEN_PASS_DECL_CLUSTEROUTLININGPASS +#endif // GEN_PASS_DECL_CLUSTEROUTLININGPASS +#ifdef GEN_PASS_DEF_CLUSTEROUTLININGPASS +namespace impl { + +template +class ClusterOutliningPassBase : public ::mlir::OperationPass { +public: + using Base = ClusterOutliningPassBase; + + ClusterOutliningPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ClusterOutliningPassBase(const ClusterOutliningPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-device-cluster-outlining"); + } + ::llvm::StringRef getArgument() const override { return "tf-device-cluster-outlining"; } + + ::llvm::StringRef getDescription() const override { return "Outlines regions of tf_device.cluster operations"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ClusterOutliningPass"); + } + ::llvm::StringRef getName() const override { return "ClusterOutliningPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ClusterOutliningPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_CLUSTEROUTLININGPASS +#endif // GEN_PASS_DEF_CLUSTEROUTLININGPASS + +//===----------------------------------------------------------------------===// +// ClusterTFOpsByHostPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CLUSTERTFOPSBYHOSTPASS +#undef GEN_PASS_DECL_CLUSTERTFOPSBYHOSTPASS +#endif // GEN_PASS_DECL_CLUSTERTFOPSBYHOSTPASS +#ifdef GEN_PASS_DEF_CLUSTERTFOPSBYHOSTPASS +namespace impl { + +template +class ClusterTFOpsByHostPassBase : public ::mlir::OperationPass { +public: + using Base = ClusterTFOpsByHostPassBase; + + ClusterTFOpsByHostPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ClusterTFOpsByHostPassBase(const ClusterTFOpsByHostPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("cluster-tf-ops-by-host"); + } + ::llvm::StringRef getArgument() const override { return "cluster-tf-ops-by-host"; } + + ::llvm::StringRef getDescription() const override { return "Cluster the TensorFlow ops by host so that each function only contains ops placed on the same host"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ClusterTFOpsByHostPass"); + } + ::llvm::StringRef getName() const override { return "ClusterTFOpsByHostPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ClusterTFOpsByHostPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_CLUSTERTFOPSBYHOSTPASS +#endif // GEN_PASS_DEF_CLUSTERTFOPSBYHOSTPASS + +//===----------------------------------------------------------------------===// +// ColocateTPUCopyWithDynamicShapePass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_COLOCATETPUCOPYWITHDYNAMICSHAPEPASS +#undef GEN_PASS_DECL_COLOCATETPUCOPYWITHDYNAMICSHAPEPASS +#endif // GEN_PASS_DECL_COLOCATETPUCOPYWITHDYNAMICSHAPEPASS +#ifdef GEN_PASS_DEF_COLOCATETPUCOPYWITHDYNAMICSHAPEPASS +namespace impl { + +template +class ColocateTPUCopyWithDynamicShapePassBase : public ::mlir::OperationPass { +public: + using Base = ColocateTPUCopyWithDynamicShapePassBase; + + ColocateTPUCopyWithDynamicShapePassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ColocateTPUCopyWithDynamicShapePassBase(const ColocateTPUCopyWithDynamicShapePassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-colocate-tpu-copy-with-dynamic-shape"); + } + ::llvm::StringRef getArgument() const override { return "tf-colocate-tpu-copy-with-dynamic-shape"; } + + ::llvm::StringRef getDescription() const override { return "Adjusts the device annotation of TPUCopyWithDynamicShape ops"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ColocateTPUCopyWithDynamicShapePass"); + } + ::llvm::StringRef getName() const override { return "ColocateTPUCopyWithDynamicShapePass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ColocateTPUCopyWithDynamicShapePassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_COLOCATETPUCOPYWITHDYNAMICSHAPEPASS +#endif // GEN_PASS_DEF_COLOCATETPUCOPYWITHDYNAMICSHAPEPASS + +//===----------------------------------------------------------------------===// +// ConstantOpDeviceAssignmentPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONSTANTOPDEVICEASSIGNMENTPASS +#undef GEN_PASS_DECL_CONSTANTOPDEVICEASSIGNMENTPASS +#endif // GEN_PASS_DECL_CONSTANTOPDEVICEASSIGNMENTPASS +#ifdef GEN_PASS_DEF_CONSTANTOPDEVICEASSIGNMENTPASS +namespace impl { + +template +class ConstantOpDeviceAssignmentPassBase : public ::mlir::OperationPass { +public: + using Base = ConstantOpDeviceAssignmentPassBase; + + ConstantOpDeviceAssignmentPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConstantOpDeviceAssignmentPassBase(const ConstantOpDeviceAssignmentPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("constant-op-device-assignment"); + } + ::llvm::StringRef getArgument() const override { return "constant-op-device-assignment"; } + + ::llvm::StringRef getDescription() const override { return "Assign device for tf.Const ops"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConstantOpDeviceAssignmentPass"); + } + ::llvm::StringRef getName() const override { return "ConstantOpDeviceAssignmentPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConstantOpDeviceAssignmentPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_CONSTANTOPDEVICEASSIGNMENTPASS +#endif // GEN_PASS_DEF_CONSTANTOPDEVICEASSIGNMENTPASS + +//===----------------------------------------------------------------------===// +// ConvertLaunchFuncToTFCallPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTLAUNCHFUNCTOTFCALLPASS +#undef GEN_PASS_DECL_CONVERTLAUNCHFUNCTOTFCALLPASS +#endif // GEN_PASS_DECL_CONVERTLAUNCHFUNCTOTFCALLPASS +#ifdef GEN_PASS_DEF_CONVERTLAUNCHFUNCTOTFCALLPASS +namespace impl { + +template +class ConvertLaunchFuncToTFCallPassBase : public ::mlir::OperationPass { +public: + using Base = ConvertLaunchFuncToTFCallPassBase; + + ConvertLaunchFuncToTFCallPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertLaunchFuncToTFCallPassBase(const ConvertLaunchFuncToTFCallPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-device-convert-launch-func-to-tf-call"); + } + ::llvm::StringRef getArgument() const override { return "tf-device-convert-launch-func-to-tf-call"; } + + ::llvm::StringRef getDescription() const override { return "Rewrites tf_device::LaunchFuncOp to TF::PartitionedCallOp"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertLaunchFuncToTFCallPass"); + } + ::llvm::StringRef getName() const override { return "ConvertLaunchFuncToTFCallPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertLaunchFuncToTFCallPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_CONVERTLAUNCHFUNCTOTFCALLPASS +#endif // GEN_PASS_DEF_CONVERTLAUNCHFUNCTOTFCALLPASS + +//===----------------------------------------------------------------------===// +// ConvertReadonlyReferenceVariablesToResourceVariablesPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTREADONLYREFERENCEVARIABLESTORESOURCEVARIABLESPASS +#undef GEN_PASS_DECL_CONVERTREADONLYREFERENCEVARIABLESTORESOURCEVARIABLESPASS +#endif // GEN_PASS_DECL_CONVERTREADONLYREFERENCEVARIABLESTORESOURCEVARIABLESPASS +#ifdef GEN_PASS_DEF_CONVERTREADONLYREFERENCEVARIABLESTORESOURCEVARIABLESPASS +namespace impl { + +template +class ConvertReadonlyReferenceVariablesToResourceVariablesPassBase : public ::mlir::OperationPass { +public: + using Base = ConvertReadonlyReferenceVariablesToResourceVariablesPassBase; + + ConvertReadonlyReferenceVariablesToResourceVariablesPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertReadonlyReferenceVariablesToResourceVariablesPassBase(const ConvertReadonlyReferenceVariablesToResourceVariablesPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-readonly-references-to-resources"); + } + ::llvm::StringRef getArgument() const override { return "tf-readonly-references-to-resources"; } + + ::llvm::StringRef getDescription() const override { return "Convert readonly reference variables to resource variables."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertReadonlyReferenceVariablesToResourceVariablesPass"); + } + ::llvm::StringRef getName() const override { return "ConvertReadonlyReferenceVariablesToResourceVariablesPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertReadonlyReferenceVariablesToResourceVariablesPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_CONVERTREADONLYREFERENCEVARIABLESTORESOURCEVARIABLESPASS +#endif // GEN_PASS_DEF_CONVERTREADONLYREFERENCEVARIABLESTORESOURCEVARIABLESPASS + +//===----------------------------------------------------------------------===// +// ConvertTfControlFlowToScfPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTTFCONTROLFLOWTOSCFPASS +#undef GEN_PASS_DECL_CONVERTTFCONTROLFLOWTOSCFPASS +#endif // GEN_PASS_DECL_CONVERTTFCONTROLFLOWTOSCFPASS +#ifdef GEN_PASS_DEF_CONVERTTFCONTROLFLOWTOSCFPASS +namespace impl { + +template +class ConvertTfControlFlowToScfPassBase : public ::mlir::OperationPass { +public: + using Base = ConvertTfControlFlowToScfPassBase; + + ConvertTfControlFlowToScfPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertTfControlFlowToScfPassBase(const ConvertTfControlFlowToScfPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-tf-control-flow-to-scf"); + } + ::llvm::StringRef getArgument() const override { return "convert-tf-control-flow-to-scf"; } + + ::llvm::StringRef getDescription() const override { return "Convert TensorFlow control flow to SCF."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertTfControlFlowToScfPass"); + } + ::llvm::StringRef getName() const override { return "ConvertTfControlFlowToScfPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertTfControlFlowToScfPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_CONVERTTFCONTROLFLOWTOSCFPASS +#endif // GEN_PASS_DEF_CONVERTTFCONTROLFLOWTOSCFPASS + +//===----------------------------------------------------------------------===// +// ConvertToLegacyCompileAndReplicateAttributesPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTTOLEGACYCOMPILEANDREPLICATEATTRIBUTESPASS +#undef GEN_PASS_DECL_CONVERTTOLEGACYCOMPILEANDREPLICATEATTRIBUTESPASS +#endif // GEN_PASS_DECL_CONVERTTOLEGACYCOMPILEANDREPLICATEATTRIBUTESPASS +#ifdef GEN_PASS_DEF_CONVERTTOLEGACYCOMPILEANDREPLICATEATTRIBUTESPASS +namespace impl { + +template +class ConvertToLegacyCompileAndReplicateAttributesPassBase : public ::mlir::OperationPass { +public: + using Base = ConvertToLegacyCompileAndReplicateAttributesPassBase; + + ConvertToLegacyCompileAndReplicateAttributesPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertToLegacyCompileAndReplicateAttributesPassBase(const ConvertToLegacyCompileAndReplicateAttributesPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-convert-to-legacy-compile-and-replicate-attributes"); + } + ::llvm::StringRef getArgument() const override { return "tf-convert-to-legacy-compile-and-replicate-attributes"; } + + ::llvm::StringRef getDescription() const override { return "Convert unified compilation and replication attributes back to legacy attributes."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertToLegacyCompileAndReplicateAttributesPass"); + } + ::llvm::StringRef getName() const override { return "ConvertToLegacyCompileAndReplicateAttributesPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertToLegacyCompileAndReplicateAttributesPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_CONVERTTOLEGACYCOMPILEANDREPLICATEATTRIBUTESPASS +#endif // GEN_PASS_DEF_CONVERTTOLEGACYCOMPILEANDREPLICATEATTRIBUTESPASS + +//===----------------------------------------------------------------------===// +// DecomposeReduceDatasetPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_DECOMPOSEREDUCEDATASETPASS +#undef GEN_PASS_DECL_DECOMPOSEREDUCEDATASETPASS +#endif // GEN_PASS_DECL_DECOMPOSEREDUCEDATASETPASS +#ifdef GEN_PASS_DEF_DECOMPOSEREDUCEDATASETPASS +namespace impl { + +template +class DecomposeReduceDatasetPassBase : public ::mlir::OperationPass { +public: + using Base = DecomposeReduceDatasetPassBase; + + DecomposeReduceDatasetPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + DecomposeReduceDatasetPassBase(const DecomposeReduceDatasetPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-decompose-reduce-dataset"); + } + ::llvm::StringRef getArgument() const override { return "tf-decompose-reduce-dataset"; } + + ::llvm::StringRef getDescription() const override { return "Decomposes ReduceDataset op into dataset operations."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("DecomposeReduceDatasetPass"); + } + ::llvm::StringRef getName() const override { return "DecomposeReduceDatasetPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(DecomposeReduceDatasetPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_DECOMPOSEREDUCEDATASETPASS +#endif // GEN_PASS_DEF_DECOMPOSEREDUCEDATASETPASS + +//===----------------------------------------------------------------------===// +// DeviceIndexSelectorPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_DEVICEINDEXSELECTORPASS +#undef GEN_PASS_DECL_DEVICEINDEXSELECTORPASS +#endif // GEN_PASS_DECL_DEVICEINDEXSELECTORPASS +#ifdef GEN_PASS_DEF_DEVICEINDEXSELECTORPASS +namespace impl { + +template +class DeviceIndexSelectorPassBase : public ::mlir::OperationPass { +public: + using Base = DeviceIndexSelectorPassBase; + + DeviceIndexSelectorPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + DeviceIndexSelectorPassBase(const DeviceIndexSelectorPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-device-index-selector"); + } + ::llvm::StringRef getArgument() const override { return "tf-device-index-selector"; } + + ::llvm::StringRef getDescription() const override { return "Fold tf.DeviceIndex to constant."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("DeviceIndexSelectorPass"); + } + ::llvm::StringRef getName() const override { return "DeviceIndexSelectorPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(DeviceIndexSelectorPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_DEVICEINDEXSELECTORPASS +#endif // GEN_PASS_DEF_DEVICEINDEXSELECTORPASS + +//===----------------------------------------------------------------------===// +// DropWhileShapeInvariantInDeviceClusterPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_DROPWHILESHAPEINVARIANTINDEVICECLUSTERPASS +#undef GEN_PASS_DECL_DROPWHILESHAPEINVARIANTINDEVICECLUSTERPASS +#endif // GEN_PASS_DECL_DROPWHILESHAPEINVARIANTINDEVICECLUSTERPASS +#ifdef GEN_PASS_DEF_DROPWHILESHAPEINVARIANTINDEVICECLUSTERPASS +namespace impl { + +template +class DropWhileShapeInvariantInDeviceClusterPassBase : public ::mlir::OperationPass { +public: + using Base = DropWhileShapeInvariantInDeviceClusterPassBase; + + DropWhileShapeInvariantInDeviceClusterPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + DropWhileShapeInvariantInDeviceClusterPassBase(const DropWhileShapeInvariantInDeviceClusterPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-drop-while-shape-invariant-in-device-cluster"); + } + ::llvm::StringRef getArgument() const override { return "tf-drop-while-shape-invariant-in-device-cluster"; } + + ::llvm::StringRef getDescription() const override { return "Drop `shape_invariant` attribute from While/WhileRegion ops inside device cluster."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("DropWhileShapeInvariantInDeviceClusterPass"); + } + ::llvm::StringRef getName() const override { return "DropWhileShapeInvariantInDeviceClusterPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(DropWhileShapeInvariantInDeviceClusterPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_DROPWHILESHAPEINVARIANTINDEVICECLUSTERPASS +#endif // GEN_PASS_DEF_DROPWHILESHAPEINVARIANTINDEVICECLUSTERPASS + +//===----------------------------------------------------------------------===// +// DropWhileShapeInvariantPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_DROPWHILESHAPEINVARIANTPASS +#undef GEN_PASS_DECL_DROPWHILESHAPEINVARIANTPASS +#endif // GEN_PASS_DECL_DROPWHILESHAPEINVARIANTPASS +#ifdef GEN_PASS_DEF_DROPWHILESHAPEINVARIANTPASS +namespace impl { + +template +class DropWhileShapeInvariantPassBase : public ::mlir::OperationPass { +public: + using Base = DropWhileShapeInvariantPassBase; + + DropWhileShapeInvariantPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + DropWhileShapeInvariantPassBase(const DropWhileShapeInvariantPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-drop-while-shape-invariant"); + } + ::llvm::StringRef getArgument() const override { return "tf-drop-while-shape-invariant"; } + + ::llvm::StringRef getDescription() const override { return "Drop `shape_invariant` attribute from While/WhileRegion ops."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("DropWhileShapeInvariantPass"); + } + ::llvm::StringRef getName() const override { return "DropWhileShapeInvariantPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(DropWhileShapeInvariantPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_DROPWHILESHAPEINVARIANTPASS +#endif // GEN_PASS_DEF_DROPWHILESHAPEINVARIANTPASS + +//===----------------------------------------------------------------------===// +// EmbeddingPipeliningPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_EMBEDDINGPIPELININGPASS +#undef GEN_PASS_DECL_EMBEDDINGPIPELININGPASS +#endif // GEN_PASS_DECL_EMBEDDINGPIPELININGPASS +#ifdef GEN_PASS_DEF_EMBEDDINGPIPELININGPASS +namespace impl { + +template +class EmbeddingPipeliningPassBase : public ::mlir::OperationPass { +public: + using Base = EmbeddingPipeliningPassBase; + + EmbeddingPipeliningPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + EmbeddingPipeliningPassBase(const EmbeddingPipeliningPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-embedding-pipelining"); + } + ::llvm::StringRef getArgument() const override { return "tf-embedding-pipelining"; } + + ::llvm::StringRef getDescription() const override { return "Rewrite graph for embedding pipelining"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("EmbeddingPipeliningPass"); + } + ::llvm::StringRef getName() const override { return "EmbeddingPipeliningPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(EmbeddingPipeliningPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_EMBEDDINGPIPELININGPASS +#endif // GEN_PASS_DEF_EMBEDDINGPIPELININGPASS + +//===----------------------------------------------------------------------===// +// EmbeddingProgramKeyPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_EMBEDDINGPROGRAMKEYPASS +#undef GEN_PASS_DECL_EMBEDDINGPROGRAMKEYPASS +#endif // GEN_PASS_DECL_EMBEDDINGPROGRAMKEYPASS +#ifdef GEN_PASS_DEF_EMBEDDINGPROGRAMKEYPASS +namespace impl { + +template +class EmbeddingProgramKeyPassBase : public ::mlir::OperationPass { +public: + using Base = EmbeddingProgramKeyPassBase; + + EmbeddingProgramKeyPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + EmbeddingProgramKeyPassBase(const EmbeddingProgramKeyPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-embedding-program-key"); + } + ::llvm::StringRef getArgument() const override { return "tf-embedding-program-key"; } + + ::llvm::StringRef getDescription() const override { return "Sets the program key for embedding ops."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("EmbeddingProgramKeyPass"); + } + ::llvm::StringRef getName() const override { return "EmbeddingProgramKeyPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(EmbeddingProgramKeyPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_EMBEDDINGPROGRAMKEYPASS +#endif // GEN_PASS_DEF_EMBEDDINGPROGRAMKEYPASS + +//===----------------------------------------------------------------------===// +// EmbeddingSequencingPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_EMBEDDINGSEQUENCINGPASS +#undef GEN_PASS_DECL_EMBEDDINGSEQUENCINGPASS +#endif // GEN_PASS_DECL_EMBEDDINGSEQUENCINGPASS +#ifdef GEN_PASS_DEF_EMBEDDINGSEQUENCINGPASS +namespace impl { + +template +class EmbeddingSequencingPassBase : public ::mlir::OperationPass { +public: + using Base = EmbeddingSequencingPassBase; + + EmbeddingSequencingPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + EmbeddingSequencingPassBase(const EmbeddingSequencingPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-embedding-sequencing"); + } + ::llvm::StringRef getArgument() const override { return "tf-embedding-sequencing"; } + + ::llvm::StringRef getDescription() const override { return "Rewrite graph for sequential execution of embeddings"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("EmbeddingSequencingPass"); + } + ::llvm::StringRef getName() const override { return "EmbeddingSequencingPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(EmbeddingSequencingPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_EMBEDDINGSEQUENCINGPASS +#endif // GEN_PASS_DEF_EMBEDDINGSEQUENCINGPASS + +//===----------------------------------------------------------------------===// +// ExecutorCheckControlDependenciesPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_EXECUTORCHECKCONTROLDEPENDENCIESPASS +#undef GEN_PASS_DECL_EXECUTORCHECKCONTROLDEPENDENCIESPASS +#endif // GEN_PASS_DECL_EXECUTORCHECKCONTROLDEPENDENCIESPASS +#ifdef GEN_PASS_DEF_EXECUTORCHECKCONTROLDEPENDENCIESPASS +namespace impl { + +template +class ExecutorCheckControlDependenciesPassBase : public ::mlir::OperationPass { +public: + using Base = ExecutorCheckControlDependenciesPassBase; + + ExecutorCheckControlDependenciesPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ExecutorCheckControlDependenciesPassBase(const ExecutorCheckControlDependenciesPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-executor-check-control-dependencies"); + } + ::llvm::StringRef getArgument() const override { return "tf-executor-check-control-dependencies"; } + + ::llvm::StringRef getDescription() const override { return "Checks control dependencies"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ExecutorCheckControlDependenciesPass"); + } + ::llvm::StringRef getName() const override { return "ExecutorCheckControlDependenciesPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ExecutorCheckControlDependenciesPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_EXECUTORCHECKCONTROLDEPENDENCIESPASS +#endif // GEN_PASS_DEF_EXECUTORCHECKCONTROLDEPENDENCIESPASS + +//===----------------------------------------------------------------------===// +// ExecutorConvertControlToDataOutputsPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_EXECUTORCONVERTCONTROLTODATAOUTPUTSPASS +#undef GEN_PASS_DECL_EXECUTORCONVERTCONTROLTODATAOUTPUTSPASS +#endif // GEN_PASS_DECL_EXECUTORCONVERTCONTROLTODATAOUTPUTSPASS +#ifdef GEN_PASS_DEF_EXECUTORCONVERTCONTROLTODATAOUTPUTSPASS +namespace impl { + +template +class ExecutorConvertControlToDataOutputsPassBase : public ::mlir::OperationPass { +public: + using Base = ExecutorConvertControlToDataOutputsPassBase; + + ExecutorConvertControlToDataOutputsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ExecutorConvertControlToDataOutputsPassBase(const ExecutorConvertControlToDataOutputsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-executor-convert-control-to-data-outputs"); + } + ::llvm::StringRef getArgument() const override { return "tf-executor-convert-control-to-data-outputs"; } + + ::llvm::StringRef getDescription() const override { return "Chain control outputs of while loop body"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ExecutorConvertControlToDataOutputsPass"); + } + ::llvm::StringRef getName() const override { return "ExecutorConvertControlToDataOutputsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ExecutorConvertControlToDataOutputsPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_EXECUTORCONVERTCONTROLTODATAOUTPUTSPASS +#endif // GEN_PASS_DEF_EXECUTORCONVERTCONTROLTODATAOUTPUTSPASS + +//===----------------------------------------------------------------------===// +// ExecutorDialectToFunctionalPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_EXECUTORDIALECTTOFUNCTIONALPASS +#undef GEN_PASS_DECL_EXECUTORDIALECTTOFUNCTIONALPASS +#endif // GEN_PASS_DECL_EXECUTORDIALECTTOFUNCTIONALPASS +#ifdef GEN_PASS_DEF_EXECUTORDIALECTTOFUNCTIONALPASS +namespace impl { + +template +class ExecutorDialectToFunctionalPassBase : public ::mlir::OperationPass { +public: + using Base = ExecutorDialectToFunctionalPassBase; + + ExecutorDialectToFunctionalPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ExecutorDialectToFunctionalPassBase(const ExecutorDialectToFunctionalPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-executor-to-functional-conversion"); + } + ::llvm::StringRef getArgument() const override { return "tf-executor-to-functional-conversion"; } + + ::llvm::StringRef getDescription() const override { return "Lifts tf_executor.island inner ops from a tf_executor.graph"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ExecutorDialectToFunctionalPass"); + } + ::llvm::StringRef getName() const override { return "ExecutorDialectToFunctionalPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ExecutorDialectToFunctionalPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_EXECUTORDIALECTTOFUNCTIONALPASS +#endif // GEN_PASS_DEF_EXECUTORDIALECTTOFUNCTIONALPASS + +//===----------------------------------------------------------------------===// +// ExecutorGraphPruningPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_EXECUTORGRAPHPRUNINGPASS +struct ExecutorGraphPruningPassOptions { + ::llvm::ArrayRef ops_to_preserve_; +}; +#undef GEN_PASS_DECL_EXECUTORGRAPHPRUNINGPASS +#endif // GEN_PASS_DECL_EXECUTORGRAPHPRUNINGPASS +#ifdef GEN_PASS_DEF_EXECUTORGRAPHPRUNINGPASS +namespace impl { + +template +class ExecutorGraphPruningPassBase : public ::mlir::OperationPass { +public: + using Base = ExecutorGraphPruningPassBase; + + ExecutorGraphPruningPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ExecutorGraphPruningPassBase(const ExecutorGraphPruningPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-executor-graph-pruning"); + } + ::llvm::StringRef getArgument() const override { return "tf-executor-graph-pruning"; } + + ::llvm::StringRef getDescription() const override { return "Prunes unreachable ops in a tf_executor.graph"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ExecutorGraphPruningPass"); + } + ::llvm::StringRef getName() const override { return "ExecutorGraphPruningPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ExecutorGraphPruningPassBase) + + ExecutorGraphPruningPassBase(const ExecutorGraphPruningPassOptions &options) : ExecutorGraphPruningPassBase() { + ops_to_preserve_ = options.ops_to_preserve_; + } +protected: + ::mlir::Pass::ListOption ops_to_preserve_{*this, "ops-to-preserve", ::llvm::cl::desc("Comma separated list of ops that should not be pruned regardless of reachability")}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_EXECUTORGRAPHPRUNINGPASS +#endif // GEN_PASS_DEF_EXECUTORGRAPHPRUNINGPASS + +//===----------------------------------------------------------------------===// +// ExecutorIslandCoarseningPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_EXECUTORISLANDCOARSENINGPASS +#undef GEN_PASS_DECL_EXECUTORISLANDCOARSENINGPASS +#endif // GEN_PASS_DECL_EXECUTORISLANDCOARSENINGPASS +#ifdef GEN_PASS_DEF_EXECUTORISLANDCOARSENINGPASS +namespace impl { + +template +class ExecutorIslandCoarseningPassBase : public ::mlir::OperationPass { +public: + using Base = ExecutorIslandCoarseningPassBase; + + ExecutorIslandCoarseningPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ExecutorIslandCoarseningPassBase(const ExecutorIslandCoarseningPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-executor-island-coarsening"); + } + ::llvm::StringRef getArgument() const override { return "tf-executor-island-coarsening"; } + + ::llvm::StringRef getDescription() const override { return "Walks tf_executor::GraphOp and merges individual tf_executor::IslandOps."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ExecutorIslandCoarseningPass"); + } + ::llvm::StringRef getName() const override { return "ExecutorIslandCoarseningPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ExecutorIslandCoarseningPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_EXECUTORISLANDCOARSENINGPASS +#endif // GEN_PASS_DEF_EXECUTORISLANDCOARSENINGPASS + +//===----------------------------------------------------------------------===// +// ExecutorTPUV1IslandInliningPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_EXECUTORTPUV1ISLANDINLININGPASS +#undef GEN_PASS_DECL_EXECUTORTPUV1ISLANDINLININGPASS +#endif // GEN_PASS_DECL_EXECUTORTPUV1ISLANDINLININGPASS +#ifdef GEN_PASS_DEF_EXECUTORTPUV1ISLANDINLININGPASS +namespace impl { + +template +class ExecutorTPUV1IslandInliningPassBase : public ::mlir::OperationPass { +public: + using Base = ExecutorTPUV1IslandInliningPassBase; + + ExecutorTPUV1IslandInliningPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ExecutorTPUV1IslandInliningPassBase(const ExecutorTPUV1IslandInliningPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-executor-tpu-v1-island-inlining"); + } + ::llvm::StringRef getArgument() const override { return "tf-executor-tpu-v1-island-inlining"; } + + ::llvm::StringRef getDescription() const override { return "Inline calls to the nested TPU module."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ExecutorTPUV1IslandInliningPass"); + } + ::llvm::StringRef getName() const override { return "ExecutorTPUV1IslandInliningPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ExecutorTPUV1IslandInliningPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_EXECUTORTPUV1ISLANDINLININGPASS +#endif // GEN_PASS_DEF_EXECUTORTPUV1ISLANDINLININGPASS + +//===----------------------------------------------------------------------===// +// ExecutorUpdateControlDependenciesPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_EXECUTORUPDATECONTROLDEPENDENCIESPASS +#undef GEN_PASS_DECL_EXECUTORUPDATECONTROLDEPENDENCIESPASS +#endif // GEN_PASS_DECL_EXECUTORUPDATECONTROLDEPENDENCIESPASS +#ifdef GEN_PASS_DEF_EXECUTORUPDATECONTROLDEPENDENCIESPASS +namespace impl { + +template +class ExecutorUpdateControlDependenciesPassBase : public ::mlir::OperationPass { +public: + using Base = ExecutorUpdateControlDependenciesPassBase; + + ExecutorUpdateControlDependenciesPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ExecutorUpdateControlDependenciesPassBase(const ExecutorUpdateControlDependenciesPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-executor-update-control-dependencies"); + } + ::llvm::StringRef getArgument() const override { return "tf-executor-update-control-dependencies"; } + + ::llvm::StringRef getDescription() const override { return "Computes and applies all necessary control dependencies based on side effect analysis."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ExecutorUpdateControlDependenciesPass"); + } + ::llvm::StringRef getName() const override { return "ExecutorUpdateControlDependenciesPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ExecutorUpdateControlDependenciesPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_EXECUTORUPDATECONTROLDEPENDENCIESPASS +#endif // GEN_PASS_DEF_EXECUTORUPDATECONTROLDEPENDENCIESPASS + +//===----------------------------------------------------------------------===// +// ExtractHeadTailOutsideCompilationPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_EXTRACTHEADTAILOUTSIDECOMPILATIONPASS +#undef GEN_PASS_DECL_EXTRACTHEADTAILOUTSIDECOMPILATIONPASS +#endif // GEN_PASS_DECL_EXTRACTHEADTAILOUTSIDECOMPILATIONPASS +#ifdef GEN_PASS_DEF_EXTRACTHEADTAILOUTSIDECOMPILATIONPASS +namespace impl { + +template +class ExtractHeadTailOutsideCompilationPassBase : public ::mlir::OperationPass { +public: + using Base = ExtractHeadTailOutsideCompilationPassBase; + + ExtractHeadTailOutsideCompilationPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ExtractHeadTailOutsideCompilationPassBase(const ExtractHeadTailOutsideCompilationPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-extract-head-tail-outside-compilation"); + } + ::llvm::StringRef getArgument() const override { return "tf-extract-head-tail-outside-compilation"; } + + ::llvm::StringRef getDescription() const override { return "Extracts head or tail outside compilation to separate host launches before/after device cluster."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ExtractHeadTailOutsideCompilationPass"); + } + ::llvm::StringRef getName() const override { return "ExtractHeadTailOutsideCompilationPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ExtractHeadTailOutsideCompilationPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_EXTRACTHEADTAILOUTSIDECOMPILATIONPASS +#endif // GEN_PASS_DEF_EXTRACTHEADTAILOUTSIDECOMPILATIONPASS + +//===----------------------------------------------------------------------===// +// ExtractOutsideCompilationPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_EXTRACTOUTSIDECOMPILATIONPASS +#undef GEN_PASS_DECL_EXTRACTOUTSIDECOMPILATIONPASS +#endif // GEN_PASS_DECL_EXTRACTOUTSIDECOMPILATIONPASS +#ifdef GEN_PASS_DEF_EXTRACTOUTSIDECOMPILATIONPASS +namespace impl { + +template +class ExtractOutsideCompilationPassBase : public ::mlir::OperationPass { +public: + using Base = ExtractOutsideCompilationPassBase; + + ExtractOutsideCompilationPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ExtractOutsideCompilationPassBase(const ExtractOutsideCompilationPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-extract-outside-compilation"); + } + ::llvm::StringRef getArgument() const override { return "tf-extract-outside-compilation"; } + + ::llvm::StringRef getDescription() const override { return "Extracts device outside compilation computation to a separate tf_device.parallel_execute region."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ExtractOutsideCompilationPass"); + } + ::llvm::StringRef getName() const override { return "ExtractOutsideCompilationPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ExtractOutsideCompilationPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_EXTRACTOUTSIDECOMPILATIONPASS +#endif // GEN_PASS_DEF_EXTRACTOUTSIDECOMPILATIONPASS + +//===----------------------------------------------------------------------===// +// ExtractTPUCopyWithDynamicShapeOpPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_EXTRACTTPUCOPYWITHDYNAMICSHAPEOPPASS +#undef GEN_PASS_DECL_EXTRACTTPUCOPYWITHDYNAMICSHAPEOPPASS +#endif // GEN_PASS_DECL_EXTRACTTPUCOPYWITHDYNAMICSHAPEOPPASS +#ifdef GEN_PASS_DEF_EXTRACTTPUCOPYWITHDYNAMICSHAPEOPPASS +namespace impl { + +template +class ExtractTPUCopyWithDynamicShapeOpPassBase : public ::mlir::OperationPass { +public: + using Base = ExtractTPUCopyWithDynamicShapeOpPassBase; + + ExtractTPUCopyWithDynamicShapeOpPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ExtractTPUCopyWithDynamicShapeOpPassBase(const ExtractTPUCopyWithDynamicShapeOpPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-extract-tpu-copy-with-dynamic-shape-op"); + } + ::llvm::StringRef getArgument() const override { return "tf-extract-tpu-copy-with-dynamic-shape-op"; } + + ::llvm::StringRef getDescription() const override { return "Extract the TPUCopyWithDynamicShapeOp out of the host launch and place it on device launch"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ExtractTPUCopyWithDynamicShapeOpPass"); + } + ::llvm::StringRef getName() const override { return "ExtractTPUCopyWithDynamicShapeOpPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ExtractTPUCopyWithDynamicShapeOpPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_EXTRACTTPUCOPYWITHDYNAMICSHAPEOPPASS +#endif // GEN_PASS_DEF_EXTRACTTPUCOPYWITHDYNAMICSHAPEOPPASS + +//===----------------------------------------------------------------------===// +// FunctionalControlFlowToCFGPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_FUNCTIONALCONTROLFLOWTOCFGPASS +#undef GEN_PASS_DECL_FUNCTIONALCONTROLFLOWTOCFGPASS +#endif // GEN_PASS_DECL_FUNCTIONALCONTROLFLOWTOCFGPASS +#ifdef GEN_PASS_DEF_FUNCTIONALCONTROLFLOWTOCFGPASS +namespace impl { + +template +class FunctionalControlFlowToCFGPassBase : public ::mlir::OperationPass { +public: + using Base = FunctionalControlFlowToCFGPassBase; + + FunctionalControlFlowToCFGPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + FunctionalControlFlowToCFGPassBase(const FunctionalControlFlowToCFGPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-functional-control-flow-to-cfg"); + } + ::llvm::StringRef getArgument() const override { return "tf-functional-control-flow-to-cfg"; } + + ::llvm::StringRef getDescription() const override { return "Transform functional control flow Ops to MLIR Control Form Graph (CFG) form"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("FunctionalControlFlowToCFGPass"); + } + ::llvm::StringRef getName() const override { return "FunctionalControlFlowToCFGPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(FunctionalControlFlowToCFGPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_FUNCTIONALCONTROLFLOWTOCFGPASS +#endif // GEN_PASS_DEF_FUNCTIONALCONTROLFLOWTOCFGPASS + +//===----------------------------------------------------------------------===// +// FunctionalControlFlowToRegionsPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_FUNCTIONALCONTROLFLOWTOREGIONSPASS +struct FunctionalControlFlowToRegionsPassOptions { + bool allow_passthrough_args_ = false; +}; +#undef GEN_PASS_DECL_FUNCTIONALCONTROLFLOWTOREGIONSPASS +#endif // GEN_PASS_DECL_FUNCTIONALCONTROLFLOWTOREGIONSPASS +#ifdef GEN_PASS_DEF_FUNCTIONALCONTROLFLOWTOREGIONSPASS +namespace impl { + +template +class FunctionalControlFlowToRegionsPassBase : public ::mlir::OperationPass { +public: + using Base = FunctionalControlFlowToRegionsPassBase; + + FunctionalControlFlowToRegionsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + FunctionalControlFlowToRegionsPassBase(const FunctionalControlFlowToRegionsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-functional-control-flow-to-regions"); + } + ::llvm::StringRef getArgument() const override { return "tf-functional-control-flow-to-regions"; } + + ::llvm::StringRef getDescription() const override { return "Transforms functional control flow operations to their region-based counterparts"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("FunctionalControlFlowToRegionsPass"); + } + ::llvm::StringRef getName() const override { return "FunctionalControlFlowToRegionsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(FunctionalControlFlowToRegionsPassBase) + + FunctionalControlFlowToRegionsPassBase(const FunctionalControlFlowToRegionsPassOptions &options) : FunctionalControlFlowToRegionsPassBase() { + allow_passthrough_args_ = options.allow_passthrough_args_; + } +protected: + ::mlir::Pass::Option allow_passthrough_args_{*this, "allow-passthrough-args", ::llvm::cl::desc("Allows to switch on passthrough args for control flow logic. This allows the pass to create blocks that better match MLIR interfaces, but might break assumptions in existing passes."), ::llvm::cl::init(false)}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_FUNCTIONALCONTROLFLOWTOREGIONSPASS +#endif // GEN_PASS_DEF_FUNCTIONALCONTROLFLOWTOREGIONSPASS + +//===----------------------------------------------------------------------===// +// FunctionalToExecutorDialectConversionPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_FUNCTIONALTOEXECUTORDIALECTCONVERSIONPASS +#undef GEN_PASS_DECL_FUNCTIONALTOEXECUTORDIALECTCONVERSIONPASS +#endif // GEN_PASS_DECL_FUNCTIONALTOEXECUTORDIALECTCONVERSIONPASS +#ifdef GEN_PASS_DEF_FUNCTIONALTOEXECUTORDIALECTCONVERSIONPASS +namespace impl { + +template +class FunctionalToExecutorDialectConversionPassBase : public ::mlir::OperationPass { +public: + using Base = FunctionalToExecutorDialectConversionPassBase; + + FunctionalToExecutorDialectConversionPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + FunctionalToExecutorDialectConversionPassBase(const FunctionalToExecutorDialectConversionPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-functional-to-executor-conversion"); + } + ::llvm::StringRef getArgument() const override { return "tf-functional-to-executor-conversion"; } + + ::llvm::StringRef getDescription() const override { return "Transform from func op to TF executor dialect."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("FunctionalToExecutorDialectConversionPass"); + } + ::llvm::StringRef getName() const override { return "FunctionalToExecutorDialectConversionPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(FunctionalToExecutorDialectConversionPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_FUNCTIONALTOEXECUTORDIALECTCONVERSIONPASS +#endif // GEN_PASS_DEF_FUNCTIONALTOEXECUTORDIALECTCONVERSIONPASS + +//===----------------------------------------------------------------------===// +// FusedKernelMatcherPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_FUSEDKERNELMATCHERPASS +#undef GEN_PASS_DECL_FUSEDKERNELMATCHERPASS +#endif // GEN_PASS_DECL_FUSEDKERNELMATCHERPASS +#ifdef GEN_PASS_DEF_FUSEDKERNELMATCHERPASS +namespace impl { + +template +class FusedKernelMatcherPassBase : public ::mlir::OperationPass { +public: + using Base = FusedKernelMatcherPassBase; + + FusedKernelMatcherPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + FusedKernelMatcherPassBase(const FusedKernelMatcherPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-fused-kernel-matcher"); + } + ::llvm::StringRef getArgument() const override { return "tf-fused-kernel-matcher"; } + + ::llvm::StringRef getDescription() const override { return "Matches computations corresponding to optimized fused kernels"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("FusedKernelMatcherPass"); + } + ::llvm::StringRef getName() const override { return "FusedKernelMatcherPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(FusedKernelMatcherPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_FUSEDKERNELMATCHERPASS +#endif // GEN_PASS_DEF_FUSEDKERNELMATCHERPASS + +//===----------------------------------------------------------------------===// +// GroupByDialectPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_GROUPBYDIALECTPASS +#undef GEN_PASS_DECL_GROUPBYDIALECTPASS +#endif // GEN_PASS_DECL_GROUPBYDIALECTPASS +#ifdef GEN_PASS_DEF_GROUPBYDIALECTPASS +namespace impl { + +template +class GroupByDialectPassBase : public ::mlir::OperationPass { +public: + using Base = GroupByDialectPassBase; + + GroupByDialectPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + GroupByDialectPassBase(const GroupByDialectPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-group-by-dialect"); + } + ::llvm::StringRef getArgument() const override { return "tf-group-by-dialect"; } + + ::llvm::StringRef getDescription() const override { return "Groups ops into functions that only contain one dialect."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("GroupByDialectPass"); + } + ::llvm::StringRef getName() const override { return "GroupByDialectPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(GroupByDialectPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_GROUPBYDIALECTPASS +#endif // GEN_PASS_DEF_GROUPBYDIALECTPASS + +//===----------------------------------------------------------------------===// +// GuaranteeAllFuncsOneUsePass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_GUARANTEEALLFUNCSONEUSEPASS +#undef GEN_PASS_DECL_GUARANTEEALLFUNCSONEUSEPASS +#endif // GEN_PASS_DECL_GUARANTEEALLFUNCSONEUSEPASS +#ifdef GEN_PASS_DEF_GUARANTEEALLFUNCSONEUSEPASS +namespace impl { + +template +class GuaranteeAllFuncsOneUsePassBase : public ::mlir::OperationPass { +public: + using Base = GuaranteeAllFuncsOneUsePassBase; + + GuaranteeAllFuncsOneUsePassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + GuaranteeAllFuncsOneUsePassBase(const GuaranteeAllFuncsOneUsePassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-guarantee-all-funcs-one-use"); + } + ::llvm::StringRef getArgument() const override { return "tf-guarantee-all-funcs-one-use"; } + + ::llvm::StringRef getDescription() const override { return "Guarantee all FuncOp's have only a single use."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("GuaranteeAllFuncsOneUsePass"); + } + ::llvm::StringRef getName() const override { return "GuaranteeAllFuncsOneUsePass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(GuaranteeAllFuncsOneUsePassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_GUARANTEEALLFUNCSONEUSEPASS +#endif // GEN_PASS_DEF_GUARANTEEALLFUNCSONEUSEPASS + +//===----------------------------------------------------------------------===// +// HoistLoopInvariantPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_HOISTLOOPINVARIANTPASS +#undef GEN_PASS_DECL_HOISTLOOPINVARIANTPASS +#endif // GEN_PASS_DECL_HOISTLOOPINVARIANTPASS +#ifdef GEN_PASS_DEF_HOISTLOOPINVARIANTPASS +namespace impl { + +template +class HoistLoopInvariantPassBase : public ::mlir::OperationPass { +public: + using Base = HoistLoopInvariantPassBase; + + HoistLoopInvariantPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + HoistLoopInvariantPassBase(const HoistLoopInvariantPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-hoist-loop-invariant"); + } + ::llvm::StringRef getArgument() const override { return "tf-hoist-loop-invariant"; } + + ::llvm::StringRef getDescription() const override { return "Hoists loop invariant ops to the outside of the loop"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("HoistLoopInvariantPass"); + } + ::llvm::StringRef getName() const override { return "HoistLoopInvariantPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(HoistLoopInvariantPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_HOISTLOOPINVARIANTPASS +#endif // GEN_PASS_DEF_HOISTLOOPINVARIANTPASS + +//===----------------------------------------------------------------------===// +// HoistReplicateInvariantResourceWritesPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_HOISTREPLICATEINVARIANTRESOURCEWRITESPASS +#undef GEN_PASS_DECL_HOISTREPLICATEINVARIANTRESOURCEWRITESPASS +#endif // GEN_PASS_DECL_HOISTREPLICATEINVARIANTRESOURCEWRITESPASS +#ifdef GEN_PASS_DEF_HOISTREPLICATEINVARIANTRESOURCEWRITESPASS +namespace impl { + +template +class HoistReplicateInvariantResourceWritesPassBase : public ::mlir::OperationPass { +public: + using Base = HoistReplicateInvariantResourceWritesPassBase; + + HoistReplicateInvariantResourceWritesPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + HoistReplicateInvariantResourceWritesPassBase(const HoistReplicateInvariantResourceWritesPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-hoist-replicate-invariant-resource-writes"); + } + ::llvm::StringRef getArgument() const override { return "tf-hoist-replicate-invariant-resource-writes"; } + + ::llvm::StringRef getDescription() const override { return "Hoists writes to replicate invariant resource variables."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("HoistReplicateInvariantResourceWritesPass"); + } + ::llvm::StringRef getName() const override { return "HoistReplicateInvariantResourceWritesPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(HoistReplicateInvariantResourceWritesPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_HOISTREPLICATEINVARIANTRESOURCEWRITESPASS +#endif // GEN_PASS_DEF_HOISTREPLICATEINVARIANTRESOURCEWRITESPASS + +//===----------------------------------------------------------------------===// +// InitTextFileToImportPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_INITTEXTFILETOIMPORTPASS +struct InitTextFileToImportPassOptions { + std::string saved_model_dir_; +}; +#undef GEN_PASS_DECL_INITTEXTFILETOIMPORTPASS +#endif // GEN_PASS_DECL_INITTEXTFILETOIMPORTPASS +#ifdef GEN_PASS_DEF_INITTEXTFILETOIMPORTPASS +namespace impl { + +template +class InitTextFileToImportPassBase : public ::mlir::OperationPass { +public: + using Base = InitTextFileToImportPassBase; + + InitTextFileToImportPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + InitTextFileToImportPassBase(const InitTextFileToImportPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-init-text-file-to-import"); + } + ::llvm::StringRef getArgument() const override { return "tf-init-text-file-to-import"; } + + ::llvm::StringRef getDescription() const override { return "convert InitializeTableFromTextFileV2 ops to LookupTableImportV2Op to remove the dependency on asset files"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("InitTextFileToImportPass"); + } + ::llvm::StringRef getName() const override { return "InitTextFileToImportPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(InitTextFileToImportPassBase) + + InitTextFileToImportPassBase(const InitTextFileToImportPassOptions &options) : InitTextFileToImportPassBase() { + saved_model_dir_ = options.saved_model_dir_; + } +protected: + ::mlir::Pass::Option saved_model_dir_{*this, "tf-saved-model-dir", ::llvm::cl::desc("Directory containing the model exported as a TensorFlow SavedModel. If your model is not based on the TensorFlow SavedModel, use an empty value.")}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_INITTEXTFILETOIMPORTPASS +#endif // GEN_PASS_DEF_INITTEXTFILETOIMPORTPASS + +//===----------------------------------------------------------------------===// +// LaunchOutliningPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_LAUNCHOUTLININGPASS +struct LaunchOutliningPassOptions { + bool globally_unique_func_names_ = true; +}; +#undef GEN_PASS_DECL_LAUNCHOUTLININGPASS +#endif // GEN_PASS_DECL_LAUNCHOUTLININGPASS +#ifdef GEN_PASS_DEF_LAUNCHOUTLININGPASS +namespace impl { + +template +class LaunchOutliningPassBase : public ::mlir::OperationPass { +public: + using Base = LaunchOutliningPassBase; + + LaunchOutliningPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + LaunchOutliningPassBase(const LaunchOutliningPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-device-launch-outlining"); + } + ::llvm::StringRef getArgument() const override { return "tf-device-launch-outlining"; } + + ::llvm::StringRef getDescription() const override { return "Outlines regions of tf_device.launch operations"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LaunchOutliningPass"); + } + ::llvm::StringRef getName() const override { return "LaunchOutliningPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LaunchOutliningPassBase) + + LaunchOutliningPassBase(const LaunchOutliningPassOptions &options) : LaunchOutliningPassBase() { + globally_unique_func_names_ = options.globally_unique_func_names_; + } +protected: + ::mlir::Pass::Option globally_unique_func_names_{*this, "globally-unique-func-names", ::llvm::cl::desc("If true, the pass adds extra identifiers to make function names globally unique within a process, not just within a module."), ::llvm::cl::init(true)}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_LAUNCHOUTLININGPASS +#endif // GEN_PASS_DEF_LAUNCHOUTLININGPASS + +//===----------------------------------------------------------------------===// +// LayoutAssignmentPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_LAYOUTASSIGNMENTPASS +struct LayoutAssignmentPassOptions { + std::string force_data_format_; +}; +#undef GEN_PASS_DECL_LAYOUTASSIGNMENTPASS +#endif // GEN_PASS_DECL_LAYOUTASSIGNMENTPASS +#ifdef GEN_PASS_DEF_LAYOUTASSIGNMENTPASS +namespace impl { + +template +class LayoutAssignmentPassBase : public ::mlir::OperationPass { +public: + using Base = LayoutAssignmentPassBase; + + LayoutAssignmentPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + LayoutAssignmentPassBase(const LayoutAssignmentPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-layout-assignment"); + } + ::llvm::StringRef getArgument() const override { return "tf-layout-assignment"; } + + ::llvm::StringRef getDescription() const override { return "Layout assignment pass."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LayoutAssignmentPass"); + } + ::llvm::StringRef getName() const override { return "LayoutAssignmentPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LayoutAssignmentPassBase) + + LayoutAssignmentPassBase(const LayoutAssignmentPassOptions &options) : LayoutAssignmentPassBase() { + force_data_format_ = options.force_data_format_; + } +protected: + ::mlir::Pass::Option force_data_format_{*this, "force-data-format", ::llvm::cl::desc("Force data format for all layout sensitive ops.")}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_LAYOUTASSIGNMENTPASS +#endif // GEN_PASS_DEF_LAYOUTASSIGNMENTPASS + +//===----------------------------------------------------------------------===// +// LegalizeTFGToTFPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_LEGALIZETFGTOTFPASS +#undef GEN_PASS_DECL_LEGALIZETFGTOTFPASS +#endif // GEN_PASS_DECL_LEGALIZETFGTOTFPASS +#ifdef GEN_PASS_DEF_LEGALIZETFGTOTFPASS +namespace impl { + +template +class LegalizeTFGToTFPassBase : public ::mlir::OperationPass { +public: + using Base = LegalizeTFGToTFPassBase; + + LegalizeTFGToTFPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + LegalizeTFGToTFPassBase(const LegalizeTFGToTFPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tfe-legalize-tfg"); + } + ::llvm::StringRef getArgument() const override { return "tfe-legalize-tfg"; } + + ::llvm::StringRef getDescription() const override { return "Legalize from TFG to the TFE dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LegalizeTFGToTFPass"); + } + ::llvm::StringRef getName() const override { return "LegalizeTFGToTFPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LegalizeTFGToTFPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_LEGALIZETFGTOTFPASS +#endif // GEN_PASS_DEF_LEGALIZETFGTOTFPASS + +//===----------------------------------------------------------------------===// +// LocalizeVarHandlesPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_LOCALIZEVARHANDLESPASS +#undef GEN_PASS_DECL_LOCALIZEVARHANDLESPASS +#endif // GEN_PASS_DECL_LOCALIZEVARHANDLESPASS +#ifdef GEN_PASS_DEF_LOCALIZEVARHANDLESPASS +namespace impl { + +template +class LocalizeVarHandlesPassBase : public ::mlir::OperationPass { +public: + using Base = LocalizeVarHandlesPassBase; + + LocalizeVarHandlesPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + LocalizeVarHandlesPassBase(const LocalizeVarHandlesPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-localize-var-handles"); + } + ::llvm::StringRef getArgument() const override { return "tf-localize-var-handles"; } + + ::llvm::StringRef getDescription() const override { return "Creates VarHandleOps next to the operations that use them."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LocalizeVarHandlesPass"); + } + ::llvm::StringRef getName() const override { return "LocalizeVarHandlesPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LocalizeVarHandlesPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_LOCALIZEVARHANDLESPASS +#endif // GEN_PASS_DEF_LOCALIZEVARHANDLESPASS + +//===----------------------------------------------------------------------===// +// LowerQuantizedPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_LOWERQUANTIZEDPASS +#undef GEN_PASS_DECL_LOWERQUANTIZEDPASS +#endif // GEN_PASS_DECL_LOWERQUANTIZEDPASS +#ifdef GEN_PASS_DEF_LOWERQUANTIZEDPASS +namespace impl { + +template +class LowerQuantizedPassBase : public ::mlir::OperationPass { +public: + using Base = LowerQuantizedPassBase; + + LowerQuantizedPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + LowerQuantizedPassBase(const LowerQuantizedPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-lower-quantized"); + } + ::llvm::StringRef getArgument() const override { return "tf-lower-quantized"; } + + ::llvm::StringRef getDescription() const override { return "Lowers ops that require quantized input or output."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LowerQuantizedPass"); + } + ::llvm::StringRef getName() const override { return "LowerQuantizedPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LowerQuantizedPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_LOWERQUANTIZEDPASS +#endif // GEN_PASS_DEF_LOWERQUANTIZEDPASS + +//===----------------------------------------------------------------------===// +// MarkInputOutputAliasesPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_MARKINPUTOUTPUTALIASESPASS +#undef GEN_PASS_DECL_MARKINPUTOUTPUTALIASESPASS +#endif // GEN_PASS_DECL_MARKINPUTOUTPUTALIASESPASS +#ifdef GEN_PASS_DEF_MARKINPUTOUTPUTALIASESPASS +namespace impl { + +template +class MarkInputOutputAliasesPassBase : public ::mlir::OperationPass { +public: + using Base = MarkInputOutputAliasesPassBase; + + MarkInputOutputAliasesPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + MarkInputOutputAliasesPassBase(const MarkInputOutputAliasesPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-device-mark-input-output-aliases"); + } + ::llvm::StringRef getArgument() const override { return "tf-device-mark-input-output-aliases"; } + + ::llvm::StringRef getDescription() const override { return "Marks device cluster inputs-output pairs that read/write to the same variable as aliases"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("MarkInputOutputAliasesPass"); + } + ::llvm::StringRef getName() const override { return "MarkInputOutputAliasesPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(MarkInputOutputAliasesPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_MARKINPUTOUTPUTALIASESPASS +#endif // GEN_PASS_DEF_MARKINPUTOUTPUTALIASESPASS + +//===----------------------------------------------------------------------===// +// MarkOpsForOutsideCompilationPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_MARKOPSFOROUTSIDECOMPILATIONPASS +#undef GEN_PASS_DECL_MARKOPSFOROUTSIDECOMPILATIONPASS +#endif // GEN_PASS_DECL_MARKOPSFOROUTSIDECOMPILATIONPASS +#ifdef GEN_PASS_DEF_MARKOPSFOROUTSIDECOMPILATIONPASS +namespace impl { + +template +class MarkOpsForOutsideCompilationPassBase : public ::mlir::OperationPass { +public: + using Base = MarkOpsForOutsideCompilationPassBase; + + MarkOpsForOutsideCompilationPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + MarkOpsForOutsideCompilationPassBase(const MarkOpsForOutsideCompilationPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-mark-ops-for-outside-compilation"); + } + ::llvm::StringRef getArgument() const override { return "tf-mark-ops-for-outside-compilation"; } + + ::llvm::StringRef getDescription() const override { return "Marks ops in device cluster for outside compilation if they are unsupported on device."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("MarkOpsForOutsideCompilationPass"); + } + ::llvm::StringRef getName() const override { return "MarkOpsForOutsideCompilationPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(MarkOpsForOutsideCompilationPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_MARKOPSFOROUTSIDECOMPILATIONPASS +#endif // GEN_PASS_DEF_MARKOPSFOROUTSIDECOMPILATIONPASS + +//===----------------------------------------------------------------------===// +// MaterializePassthroughOp +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_MATERIALIZEPASSTHROUGHOP +#undef GEN_PASS_DECL_MATERIALIZEPASSTHROUGHOP +#endif // GEN_PASS_DECL_MATERIALIZEPASSTHROUGHOP +#ifdef GEN_PASS_DEF_MATERIALIZEPASSTHROUGHOP +namespace impl { + +template +class MaterializePassthroughOpBase : public ::mlir::OperationPass { +public: + using Base = MaterializePassthroughOpBase; + + MaterializePassthroughOpBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + MaterializePassthroughOpBase(const MaterializePassthroughOpBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-materialize-passthrough-op"); + } + ::llvm::StringRef getArgument() const override { return "tf-materialize-passthrough-op"; } + + ::llvm::StringRef getDescription() const override { return "Materialize the MlirPassthroughOp by replacing it with the MLIR module attached as an attribute"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("MaterializePassthroughOp"); + } + ::llvm::StringRef getName() const override { return "MaterializePassthroughOp"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(MaterializePassthroughOpBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_MATERIALIZEPASSTHROUGHOP +#endif // GEN_PASS_DEF_MATERIALIZEPASSTHROUGHOP + +//===----------------------------------------------------------------------===// +// MergeControlFlowPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_MERGECONTROLFLOWPASS +#undef GEN_PASS_DECL_MERGECONTROLFLOWPASS +#endif // GEN_PASS_DECL_MERGECONTROLFLOWPASS +#ifdef GEN_PASS_DEF_MERGECONTROLFLOWPASS +namespace impl { + +template +class MergeControlFlowPassBase : public ::mlir::OperationPass { +public: + using Base = MergeControlFlowPassBase; + + MergeControlFlowPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + MergeControlFlowPassBase(const MergeControlFlowPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-merge-control-flow"); + } + ::llvm::StringRef getArgument() const override { return "tf-merge-control-flow"; } + + ::llvm::StringRef getDescription() const override { return "Merges IfRegion ops together with a common predicate."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("MergeControlFlowPass"); + } + ::llvm::StringRef getName() const override { return "MergeControlFlowPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(MergeControlFlowPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_MERGECONTROLFLOWPASS +#endif // GEN_PASS_DEF_MERGECONTROLFLOWPASS + +//===----------------------------------------------------------------------===// +// MoveTransposesPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_MOVETRANSPOSESPASS +struct MoveTransposesPassOptions { + bool fold_transpose_in_ops_ = true; + enum MoveTransposeDirection direction_ = MoveTransposeDirection::kBegin; +}; +#undef GEN_PASS_DECL_MOVETRANSPOSESPASS +#endif // GEN_PASS_DECL_MOVETRANSPOSESPASS +#ifdef GEN_PASS_DEF_MOVETRANSPOSESPASS +namespace impl { + +template +class MoveTransposesPassBase : public ::mlir::OperationPass { +public: + using Base = MoveTransposesPassBase; + + MoveTransposesPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + MoveTransposesPassBase(const MoveTransposesPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-move-transposes"); + } + ::llvm::StringRef getArgument() const override { return "tf-move-transposes"; } + + ::llvm::StringRef getDescription() const override { return "Move transposes pass."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("MoveTransposesPass"); + } + ::llvm::StringRef getName() const override { return "MoveTransposesPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(MoveTransposesPassBase) + + MoveTransposesPassBase(const MoveTransposesPassOptions &options) : MoveTransposesPassBase() { + fold_transpose_in_ops_ = options.fold_transpose_in_ops_; + direction_ = options.direction_; + } +protected: + ::mlir::Pass::Option fold_transpose_in_ops_{*this, "fold-transpose-in-ops", ::llvm::cl::desc("Whether to fold transposes in ops which can support folding."), ::llvm::cl::init(true)}; + ::mlir::Pass::Option direction_{*this, "direction", ::llvm::cl::desc("Move transposes to the beginning or the end of the block where they are defined."), ::llvm::cl::init(MoveTransposeDirection::kBegin), llvm::cl::values(clEnumValN(MoveTransposeDirection::kBegin, "begin", "beginning of the block"),clEnumValN(MoveTransposeDirection::kEnd, "end", "end of the block"))}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_MOVETRANSPOSESPASS +#endif // GEN_PASS_DEF_MOVETRANSPOSESPASS + +//===----------------------------------------------------------------------===// +// NameAnonymousIteratorsPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_NAMEANONYMOUSITERATORSPASS +#undef GEN_PASS_DECL_NAMEANONYMOUSITERATORSPASS +#endif // GEN_PASS_DECL_NAMEANONYMOUSITERATORSPASS +#ifdef GEN_PASS_DEF_NAMEANONYMOUSITERATORSPASS +namespace impl { + +template +class NameAnonymousIteratorsPassBase : public ::mlir::OperationPass { +public: + using Base = NameAnonymousIteratorsPassBase; + + NameAnonymousIteratorsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + NameAnonymousIteratorsPassBase(const NameAnonymousIteratorsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-name-anonymous-iterators"); + } + ::llvm::StringRef getArgument() const override { return "tf-name-anonymous-iterators"; } + + ::llvm::StringRef getDescription() const override { return "Converts anonymous iterators to named iterators"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("NameAnonymousIteratorsPass"); + } + ::llvm::StringRef getName() const override { return "NameAnonymousIteratorsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(NameAnonymousIteratorsPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_NAMEANONYMOUSITERATORSPASS +#endif // GEN_PASS_DEF_NAMEANONYMOUSITERATORSPASS + +//===----------------------------------------------------------------------===// +// OrderByDialectPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_ORDERBYDIALECTPASS +#undef GEN_PASS_DECL_ORDERBYDIALECTPASS +#endif // GEN_PASS_DECL_ORDERBYDIALECTPASS +#ifdef GEN_PASS_DEF_ORDERBYDIALECTPASS +namespace impl { + +template +class OrderByDialectPassBase : public ::mlir::OperationPass { +public: + using Base = OrderByDialectPassBase; + + OrderByDialectPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + OrderByDialectPassBase(const OrderByDialectPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-order-by-dialect"); + } + ::llvm::StringRef getArgument() const override { return "tf-order-by-dialect"; } + + ::llvm::StringRef getDescription() const override { return "Reorders ops so ops of the same dialect are next to each other."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("OrderByDialectPass"); + } + ::llvm::StringRef getName() const override { return "OrderByDialectPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(OrderByDialectPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_ORDERBYDIALECTPASS +#endif // GEN_PASS_DEF_ORDERBYDIALECTPASS + +//===----------------------------------------------------------------------===// +// ParallelExecuteToIslandsPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_PARALLELEXECUTETOISLANDSPASS +struct ParallelExecuteToIslandsPassOptions { + bool legacy_graph_export_ = true; +}; +#undef GEN_PASS_DECL_PARALLELEXECUTETOISLANDSPASS +#endif // GEN_PASS_DECL_PARALLELEXECUTETOISLANDSPASS +#ifdef GEN_PASS_DEF_PARALLELEXECUTETOISLANDSPASS +namespace impl { + +template +class ParallelExecuteToIslandsPassBase : public ::mlir::OperationPass { +public: + using Base = ParallelExecuteToIslandsPassBase; + + ParallelExecuteToIslandsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ParallelExecuteToIslandsPassBase(const ParallelExecuteToIslandsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-parallel-execute-to-islands"); + } + ::llvm::StringRef getArgument() const override { return "tf-parallel-execute-to-islands"; } + + ::llvm::StringRef getDescription() const override { return "Lowers device parallel_execute to executor islands"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ParallelExecuteToIslandsPass"); + } + ::llvm::StringRef getName() const override { return "ParallelExecuteToIslandsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ParallelExecuteToIslandsPassBase) + + ParallelExecuteToIslandsPassBase(const ParallelExecuteToIslandsPassOptions &options) : ParallelExecuteToIslandsPassBase() { + legacy_graph_export_ = options.legacy_graph_export_; + } +protected: + ::mlir::Pass::Option legacy_graph_export_{*this, "legacy-graph-export", ::llvm::cl::desc("Determines whether or not this pass should execute logic that is reserved for the legacy graph export pipeline to maintain expected invariants. In the case of this pass, that means manually propagating controls to lifted parallel execute regions to the graph fetch to ensure the ops execute."), ::llvm::cl::init(true)}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_PARALLELEXECUTETOISLANDSPASS +#endif // GEN_PASS_DEF_PARALLELEXECUTETOISLANDSPASS + +//===----------------------------------------------------------------------===// +// PrepareTpuComputationForTfExportPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_PREPARETPUCOMPUTATIONFORTFEXPORTPASS +#undef GEN_PASS_DECL_PREPARETPUCOMPUTATIONFORTFEXPORTPASS +#endif // GEN_PASS_DECL_PREPARETPUCOMPUTATIONFORTFEXPORTPASS +#ifdef GEN_PASS_DEF_PREPARETPUCOMPUTATIONFORTFEXPORTPASS +namespace impl { + +template +class PrepareTpuComputationForTfExportPassBase : public ::mlir::OperationPass { +public: + using Base = PrepareTpuComputationForTfExportPassBase; + + PrepareTpuComputationForTfExportPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + PrepareTpuComputationForTfExportPassBase(const PrepareTpuComputationForTfExportPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("prepare-tpu-computation-for-tf-export"); + } + ::llvm::StringRef getArgument() const override { return "prepare-tpu-computation-for-tf-export"; } + + ::llvm::StringRef getDescription() const override { return "Prepare TPU computation to be legal for export to TensorFlow"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("PrepareTpuComputationForTfExportPass"); + } + ::llvm::StringRef getName() const override { return "PrepareTpuComputationForTfExportPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(PrepareTpuComputationForTfExportPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_PREPARETPUCOMPUTATIONFORTFEXPORTPASS +#endif // GEN_PASS_DEF_PREPARETPUCOMPUTATIONFORTFEXPORTPASS + +//===----------------------------------------------------------------------===// +// PromoteResourcesToArgsPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_PROMOTERESOURCESTOARGSPASS +struct PromoteResourcesToArgsPassOptions { + ::llvm::ArrayRef functions_; +}; +#undef GEN_PASS_DECL_PROMOTERESOURCESTOARGSPASS +#endif // GEN_PASS_DECL_PROMOTERESOURCESTOARGSPASS +#ifdef GEN_PASS_DEF_PROMOTERESOURCESTOARGSPASS +namespace impl { + +template +class PromoteResourcesToArgsPassBase : public ::mlir::OperationPass { +public: + using Base = PromoteResourcesToArgsPassBase; + + PromoteResourcesToArgsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + PromoteResourcesToArgsPassBase(const PromoteResourcesToArgsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-promote-resources-to-args"); + } + ::llvm::StringRef getArgument() const override { return "tf-promote-resources-to-args"; } + + ::llvm::StringRef getDescription() const override { return "Promote resources reads/writes to function inputs/outputs."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("PromoteResourcesToArgsPass"); + } + ::llvm::StringRef getName() const override { return "PromoteResourcesToArgsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(PromoteResourcesToArgsPassBase) + + PromoteResourcesToArgsPassBase(const PromoteResourcesToArgsPassOptions &options) : PromoteResourcesToArgsPassBase() { + functions_ = options.functions_; + } +protected: + ::mlir::Pass::ListOption functions_{*this, "functions", ::llvm::cl::desc("Comma separated list of functions whose resources read/writes should be promoted to function inputs/outputs.")}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_PROMOTERESOURCESTOARGSPASS +#endif // GEN_PASS_DEF_PROMOTERESOURCESTOARGSPASS + +//===----------------------------------------------------------------------===// +// PromoteVarHandlesToArgsPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_PROMOTEVARHANDLESTOARGSPASS +#undef GEN_PASS_DECL_PROMOTEVARHANDLESTOARGSPASS +#endif // GEN_PASS_DECL_PROMOTEVARHANDLESTOARGSPASS +#ifdef GEN_PASS_DEF_PROMOTEVARHANDLESTOARGSPASS +namespace impl { + +template +class PromoteVarHandlesToArgsPassBase : public ::mlir::OperationPass { +public: + using Base = PromoteVarHandlesToArgsPassBase; + + PromoteVarHandlesToArgsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + PromoteVarHandlesToArgsPassBase(const PromoteVarHandlesToArgsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-promote-var-handles-to-args"); + } + ::llvm::StringRef getArgument() const override { return "tf-promote-var-handles-to-args"; } + + ::llvm::StringRef getDescription() const override { return "Promote tf.VarHandleOps to function arguments."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("PromoteVarHandlesToArgsPass"); + } + ::llvm::StringRef getName() const override { return "PromoteVarHandlesToArgsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(PromoteVarHandlesToArgsPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_PROMOTEVARHANDLESTOARGSPASS +#endif // GEN_PASS_DEF_PROMOTEVARHANDLESTOARGSPASS + +//===----------------------------------------------------------------------===// +// RegionControlFlowToFunctionalPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_REGIONCONTROLFLOWTOFUNCTIONALPASS +#undef GEN_PASS_DECL_REGIONCONTROLFLOWTOFUNCTIONALPASS +#endif // GEN_PASS_DECL_REGIONCONTROLFLOWTOFUNCTIONALPASS +#ifdef GEN_PASS_DEF_REGIONCONTROLFLOWTOFUNCTIONALPASS +namespace impl { + +template +class RegionControlFlowToFunctionalPassBase : public ::mlir::OperationPass { +public: + using Base = RegionControlFlowToFunctionalPassBase; + + RegionControlFlowToFunctionalPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + RegionControlFlowToFunctionalPassBase(const RegionControlFlowToFunctionalPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-region-control-flow-to-functional"); + } + ::llvm::StringRef getArgument() const override { return "tf-region-control-flow-to-functional"; } + + ::llvm::StringRef getDescription() const override { return "Transforms region-based control flow operations to their functional counterparts"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("RegionControlFlowToFunctionalPass"); + } + ::llvm::StringRef getName() const override { return "RegionControlFlowToFunctionalPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(RegionControlFlowToFunctionalPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_REGIONCONTROLFLOWTOFUNCTIONALPASS +#endif // GEN_PASS_DEF_REGIONCONTROLFLOWTOFUNCTIONALPASS + +//===----------------------------------------------------------------------===// +// RemoveUnusedArgumentsPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_REMOVEUNUSEDARGUMENTSPASS +#undef GEN_PASS_DECL_REMOVEUNUSEDARGUMENTSPASS +#endif // GEN_PASS_DECL_REMOVEUNUSEDARGUMENTSPASS +#ifdef GEN_PASS_DEF_REMOVEUNUSEDARGUMENTSPASS +namespace impl { + +template +class RemoveUnusedArgumentsPassBase : public ::mlir::OperationPass { +public: + using Base = RemoveUnusedArgumentsPassBase; + + RemoveUnusedArgumentsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + RemoveUnusedArgumentsPassBase(const RemoveUnusedArgumentsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-remove-unused-arguments"); + } + ::llvm::StringRef getArgument() const override { return "tf-remove-unused-arguments"; } + + ::llvm::StringRef getDescription() const override { return "Removes unused args from private functions & their callers."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("RemoveUnusedArgumentsPass"); + } + ::llvm::StringRef getName() const override { return "RemoveUnusedArgumentsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(RemoveUnusedArgumentsPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_REMOVEUNUSEDARGUMENTSPASS +#endif // GEN_PASS_DEF_REMOVEUNUSEDARGUMENTSPASS + +//===----------------------------------------------------------------------===// +// RemoveUnusedWhileResultsPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_REMOVEUNUSEDWHILERESULTSPASS +#undef GEN_PASS_DECL_REMOVEUNUSEDWHILERESULTSPASS +#endif // GEN_PASS_DECL_REMOVEUNUSEDWHILERESULTSPASS +#ifdef GEN_PASS_DEF_REMOVEUNUSEDWHILERESULTSPASS +namespace impl { + +template +class RemoveUnusedWhileResultsPassBase : public ::mlir::OperationPass { +public: + using Base = RemoveUnusedWhileResultsPassBase; + + RemoveUnusedWhileResultsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + RemoveUnusedWhileResultsPassBase(const RemoveUnusedWhileResultsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-remove-unused-while-results"); + } + ::llvm::StringRef getArgument() const override { return "tf-remove-unused-while-results"; } + + ::llvm::StringRef getDescription() const override { return "Removes unused results from tf.WhileRegion ops"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("RemoveUnusedWhileResultsPass"); + } + ::llvm::StringRef getName() const override { return "RemoveUnusedWhileResultsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(RemoveUnusedWhileResultsPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_REMOVEUNUSEDWHILERESULTSPASS +#endif // GEN_PASS_DEF_REMOVEUNUSEDWHILERESULTSPASS + +//===----------------------------------------------------------------------===// +// ReplicaIDToDeviceOrdinalPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_REPLICAIDTODEVICEORDINALPASS +#undef GEN_PASS_DECL_REPLICAIDTODEVICEORDINALPASS +#endif // GEN_PASS_DECL_REPLICAIDTODEVICEORDINALPASS +#ifdef GEN_PASS_DEF_REPLICAIDTODEVICEORDINALPASS +namespace impl { + +template +class ReplicaIDToDeviceOrdinalPassBase : public ::mlir::OperationPass { +public: + using Base = ReplicaIDToDeviceOrdinalPassBase; + + ReplicaIDToDeviceOrdinalPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ReplicaIDToDeviceOrdinalPassBase(const ReplicaIDToDeviceOrdinalPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-replica-id-to-device-ordinal"); + } + ::llvm::StringRef getArgument() const override { return "tf-replica-id-to-device-ordinal"; } + + ::llvm::StringRef getDescription() const override { return "Set device ordinal with replica id"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ReplicaIDToDeviceOrdinalPass"); + } + ::llvm::StringRef getName() const override { return "ReplicaIDToDeviceOrdinalPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ReplicaIDToDeviceOrdinalPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_REPLICAIDTODEVICEORDINALPASS +#endif // GEN_PASS_DEF_REPLICAIDTODEVICEORDINALPASS + +//===----------------------------------------------------------------------===// +// ReplicateInvariantOpHoistingPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_REPLICATEINVARIANTOPHOISTINGPASS +#undef GEN_PASS_DECL_REPLICATEINVARIANTOPHOISTINGPASS +#endif // GEN_PASS_DECL_REPLICATEINVARIANTOPHOISTINGPASS +#ifdef GEN_PASS_DEF_REPLICATEINVARIANTOPHOISTINGPASS +namespace impl { + +template +class ReplicateInvariantOpHoistingPassBase : public ::mlir::OperationPass { +public: + using Base = ReplicateInvariantOpHoistingPassBase; + + ReplicateInvariantOpHoistingPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ReplicateInvariantOpHoistingPassBase(const ReplicateInvariantOpHoistingPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-replicate-invariant-op-hoisting"); + } + ::llvm::StringRef getArgument() const override { return "tf-replicate-invariant-op-hoisting"; } + + ::llvm::StringRef getDescription() const override { return "Hoists replicate invariant operations out of replicate"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ReplicateInvariantOpHoistingPass"); + } + ::llvm::StringRef getName() const override { return "ReplicateInvariantOpHoistingPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ReplicateInvariantOpHoistingPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_REPLICATEINVARIANTOPHOISTINGPASS +#endif // GEN_PASS_DEF_REPLICATEINVARIANTOPHOISTINGPASS + +//===----------------------------------------------------------------------===// +// ReplicateTensorListInitOpsPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_REPLICATETENSORLISTINITOPSPASS +#undef GEN_PASS_DECL_REPLICATETENSORLISTINITOPSPASS +#endif // GEN_PASS_DECL_REPLICATETENSORLISTINITOPSPASS +#ifdef GEN_PASS_DEF_REPLICATETENSORLISTINITOPSPASS +namespace impl { + +template +class ReplicateTensorListInitOpsPassBase : public ::mlir::OperationPass { +public: + using Base = ReplicateTensorListInitOpsPassBase; + + ReplicateTensorListInitOpsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ReplicateTensorListInitOpsPassBase(const ReplicateTensorListInitOpsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-replicate-tensor-list-init-ops"); + } + ::llvm::StringRef getArgument() const override { return "tf-replicate-tensor-list-init-ops"; } + + ::llvm::StringRef getDescription() const override { return "Replicate TensorList init ops for correct shape assignments in shape inference"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ReplicateTensorListInitOpsPass"); + } + ::llvm::StringRef getName() const override { return "ReplicateTensorListInitOpsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ReplicateTensorListInitOpsPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_REPLICATETENSORLISTINITOPSPASS +#endif // GEN_PASS_DEF_REPLICATETENSORLISTINITOPSPASS + +//===----------------------------------------------------------------------===// +// ReplicateToIslandPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_REPLICATETOISLANDPASS +struct ReplicateToIslandPassOptions { + bool legacy_graph_export_ = true; +}; +#undef GEN_PASS_DECL_REPLICATETOISLANDPASS +#endif // GEN_PASS_DECL_REPLICATETOISLANDPASS +#ifdef GEN_PASS_DEF_REPLICATETOISLANDPASS +namespace impl { + +template +class ReplicateToIslandPassBase : public ::mlir::OperationPass { +public: + using Base = ReplicateToIslandPassBase; + + ReplicateToIslandPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ReplicateToIslandPassBase(const ReplicateToIslandPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-replicate-to-island"); + } + ::llvm::StringRef getArgument() const override { return "tf-replicate-to-island"; } + + ::llvm::StringRef getDescription() const override { return "Lowers device replicate to executor islands"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ReplicateToIslandPass"); + } + ::llvm::StringRef getName() const override { return "ReplicateToIslandPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ReplicateToIslandPassBase) + + ReplicateToIslandPassBase(const ReplicateToIslandPassOptions &options) : ReplicateToIslandPassBase() { + legacy_graph_export_ = options.legacy_graph_export_; + } +protected: + ::mlir::Pass::Option legacy_graph_export_{*this, "legacy-graph-export", ::llvm::cl::desc("Determines whether or not this pass should execute logic that is reserved for the legacy graph export pipeline to maintain expected invariants. In the case of this pass, that means manually propagating controls to lifted parallel execute regions to the graph fetch to ensure the ops execute, as well as determining whether or not the islands created by this pass should be split after the replicated ops have been lifted."), ::llvm::cl::init(true)}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_REPLICATETOISLANDPASS +#endif // GEN_PASS_DEF_REPLICATETOISLANDPASS + +//===----------------------------------------------------------------------===// +// ResourceDeviceInferencePass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_RESOURCEDEVICEINFERENCEPASS +#undef GEN_PASS_DECL_RESOURCEDEVICEINFERENCEPASS +#endif // GEN_PASS_DECL_RESOURCEDEVICEINFERENCEPASS +#ifdef GEN_PASS_DEF_RESOURCEDEVICEINFERENCEPASS +namespace impl { + +template +class ResourceDeviceInferencePassBase : public ::mlir::OperationPass { +public: + using Base = ResourceDeviceInferencePassBase; + + ResourceDeviceInferencePassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ResourceDeviceInferencePassBase(const ResourceDeviceInferencePassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-resource-device-inference"); + } + ::llvm::StringRef getArgument() const override { return "tf-resource-device-inference"; } + + ::llvm::StringRef getDescription() const override { return "Propagates the device attribute on resources from callers to callees."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ResourceDeviceInferencePass"); + } + ::llvm::StringRef getName() const override { return "ResourceDeviceInferencePass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ResourceDeviceInferencePassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_RESOURCEDEVICEINFERENCEPASS +#endif // GEN_PASS_DEF_RESOURCEDEVICEINFERENCEPASS + +//===----------------------------------------------------------------------===// +// RewriteTPUEmbeddingOpsPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_REWRITETPUEMBEDDINGOPSPASS +#undef GEN_PASS_DECL_REWRITETPUEMBEDDINGOPSPASS +#endif // GEN_PASS_DECL_REWRITETPUEMBEDDINGOPSPASS +#ifdef GEN_PASS_DEF_REWRITETPUEMBEDDINGOPSPASS +namespace impl { + +template +class RewriteTPUEmbeddingOpsPassBase : public ::mlir::OperationPass { +public: + using Base = RewriteTPUEmbeddingOpsPassBase; + + RewriteTPUEmbeddingOpsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + RewriteTPUEmbeddingOpsPassBase(const RewriteTPUEmbeddingOpsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-rewrite-tpu-embedding-ops"); + } + ::llvm::StringRef getArgument() const override { return "tf-rewrite-tpu-embedding-ops"; } + + ::llvm::StringRef getDescription() const override { return "Rewrites TPU embedding send/recv ops by adding TPU embedding deduplication data"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("RewriteTPUEmbeddingOpsPass"); + } + ::llvm::StringRef getName() const override { return "RewriteTPUEmbeddingOpsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(RewriteTPUEmbeddingOpsPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_REWRITETPUEMBEDDINGOPSPASS +#endif // GEN_PASS_DEF_REWRITETPUEMBEDDINGOPSPASS + +//===----------------------------------------------------------------------===// +// SimpleTFDeviceAssignmentPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_SIMPLETFDEVICEASSIGNMENTPASS +struct SimpleTFDeviceAssignmentPassOptions { + std::string default_device_ = "cpu"; +}; +#undef GEN_PASS_DECL_SIMPLETFDEVICEASSIGNMENTPASS +#endif // GEN_PASS_DECL_SIMPLETFDEVICEASSIGNMENTPASS +#ifdef GEN_PASS_DEF_SIMPLETFDEVICEASSIGNMENTPASS +namespace impl { + +template +class SimpleTFDeviceAssignmentPassBase : public ::mlir::OperationPass { +public: + using Base = SimpleTFDeviceAssignmentPassBase; + + SimpleTFDeviceAssignmentPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + SimpleTFDeviceAssignmentPassBase(const SimpleTFDeviceAssignmentPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-simple-device-assignment"); + } + ::llvm::StringRef getArgument() const override { return "tf-simple-device-assignment"; } + + ::llvm::StringRef getDescription() const override { return "Simple device assignment in TF dialect."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("SimpleTFDeviceAssignmentPass"); + } + ::llvm::StringRef getName() const override { return "SimpleTFDeviceAssignmentPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(SimpleTFDeviceAssignmentPassBase) + + SimpleTFDeviceAssignmentPassBase(const SimpleTFDeviceAssignmentPassOptions &options) : SimpleTFDeviceAssignmentPassBase() { + default_device_ = options.default_device_; + } +protected: + ::mlir::Pass::Option default_device_{*this, "default-device", ::llvm::cl::desc("The default device to assign."), ::llvm::cl::init("cpu")}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_SIMPLETFDEVICEASSIGNMENTPASS +#endif // GEN_PASS_DEF_SIMPLETFDEVICEASSIGNMENTPASS + +//===----------------------------------------------------------------------===// +// SplitIntoIslandPerOpPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_SPLITINTOISLANDPEROPPASS +#undef GEN_PASS_DECL_SPLITINTOISLANDPEROPPASS +#endif // GEN_PASS_DECL_SPLITINTOISLANDPEROPPASS +#ifdef GEN_PASS_DEF_SPLITINTOISLANDPEROPPASS +namespace impl { + +template +class SplitIntoIslandPerOpPassBase : public ::mlir::OperationPass { +public: + using Base = SplitIntoIslandPerOpPassBase; + + SplitIntoIslandPerOpPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + SplitIntoIslandPerOpPassBase(const SplitIntoIslandPerOpPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-executor-split-into-island-per-op"); + } + ::llvm::StringRef getArgument() const override { return "tf-executor-split-into-island-per-op"; } + + ::llvm::StringRef getDescription() const override { return "Transform from TF control dialect to TF executor dialect."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("SplitIntoIslandPerOpPass"); + } + ::llvm::StringRef getName() const override { return "SplitIntoIslandPerOpPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(SplitIntoIslandPerOpPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_SPLITINTOISLANDPEROPPASS +#endif // GEN_PASS_DEF_SPLITINTOISLANDPEROPPASS + +//===----------------------------------------------------------------------===// +// StackOpsDecompositionPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_STACKOPSDECOMPOSITIONPASS +#undef GEN_PASS_DECL_STACKOPSDECOMPOSITIONPASS +#endif // GEN_PASS_DECL_STACKOPSDECOMPOSITIONPASS +#ifdef GEN_PASS_DEF_STACKOPSDECOMPOSITIONPASS +namespace impl { + +template +class StackOpsDecompositionPassBase : public ::mlir::OperationPass { +public: + using Base = StackOpsDecompositionPassBase; + + StackOpsDecompositionPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + StackOpsDecompositionPassBase(const StackOpsDecompositionPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-stack-ops-decomposition"); + } + ::llvm::StringRef getArgument() const override { return "tf-stack-ops-decomposition"; } + + ::llvm::StringRef getDescription() const override { return "Decompose stack operations into local variable operations. Needs static shapes."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("StackOpsDecompositionPass"); + } + ::llvm::StringRef getName() const override { return "StackOpsDecompositionPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(StackOpsDecompositionPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_STACKOPSDECOMPOSITIONPASS +#endif // GEN_PASS_DEF_STACKOPSDECOMPOSITIONPASS + +//===----------------------------------------------------------------------===// +// StripNoinlineAttributePass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_STRIPNOINLINEATTRIBUTEPASS +#undef GEN_PASS_DECL_STRIPNOINLINEATTRIBUTEPASS +#endif // GEN_PASS_DECL_STRIPNOINLINEATTRIBUTEPASS +#ifdef GEN_PASS_DEF_STRIPNOINLINEATTRIBUTEPASS +namespace impl { + +template +class StripNoinlineAttributePassBase : public ::mlir::OperationPass { +public: + using Base = StripNoinlineAttributePassBase; + + StripNoinlineAttributePassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + StripNoinlineAttributePassBase(const StripNoinlineAttributePassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-strip-noinline-attribute"); + } + ::llvm::StringRef getArgument() const override { return "tf-strip-noinline-attribute"; } + + ::llvm::StringRef getDescription() const override { return "Strip the tf._noinline attribute from top-level functions."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("StripNoinlineAttributePass"); + } + ::llvm::StringRef getName() const override { return "StripNoinlineAttributePass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(StripNoinlineAttributePassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_STRIPNOINLINEATTRIBUTEPASS +#endif // GEN_PASS_DEF_STRIPNOINLINEATTRIBUTEPASS + +//===----------------------------------------------------------------------===// +// StripTfAttributesPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_STRIPTFATTRIBUTESPASS +#undef GEN_PASS_DECL_STRIPTFATTRIBUTESPASS +#endif // GEN_PASS_DECL_STRIPTFATTRIBUTESPASS +#ifdef GEN_PASS_DEF_STRIPTFATTRIBUTESPASS +namespace impl { + +template +class StripTfAttributesPassBase : public ::mlir::OperationPass { +public: + using Base = StripTfAttributesPassBase; + + StripTfAttributesPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + StripTfAttributesPassBase(const StripTfAttributesPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-strip-tf-attributes"); + } + ::llvm::StringRef getArgument() const override { return "tf-strip-tf-attributes"; } + + ::llvm::StringRef getDescription() const override { return "Removes TF specific attributes"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("StripTfAttributesPass"); + } + ::llvm::StringRef getName() const override { return "StripTfAttributesPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(StripTfAttributesPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_STRIPTFATTRIBUTESPASS +#endif // GEN_PASS_DEF_STRIPTFATTRIBUTESPASS + +//===----------------------------------------------------------------------===// +// TFDataOptimizationPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_TFDATAOPTIMIZATIONPASS +#undef GEN_PASS_DECL_TFDATAOPTIMIZATIONPASS +#endif // GEN_PASS_DECL_TFDATAOPTIMIZATIONPASS +#ifdef GEN_PASS_DEF_TFDATAOPTIMIZATIONPASS +namespace impl { + +template +class TFDataOptimizationPassBase : public ::mlir::OperationPass { +public: + using Base = TFDataOptimizationPassBase; + + TFDataOptimizationPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TFDataOptimizationPassBase(const TFDataOptimizationPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-data-optimization"); + } + ::llvm::StringRef getArgument() const override { return "tf-data-optimization"; } + + ::llvm::StringRef getDescription() const override { return "Performs tf.data optimizations"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TFDataOptimizationPass"); + } + ::llvm::StringRef getName() const override { return "TFDataOptimizationPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TFDataOptimizationPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_TFDATAOPTIMIZATIONPASS +#endif // GEN_PASS_DEF_TFDATAOPTIMIZATIONPASS + +//===----------------------------------------------------------------------===// +// TFDeviceAssignmentByFuncAttrPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_TFDEVICEASSIGNMENTBYFUNCATTRPASS +#undef GEN_PASS_DECL_TFDEVICEASSIGNMENTBYFUNCATTRPASS +#endif // GEN_PASS_DECL_TFDEVICEASSIGNMENTBYFUNCATTRPASS +#ifdef GEN_PASS_DEF_TFDEVICEASSIGNMENTBYFUNCATTRPASS +namespace impl { + +template +class TFDeviceAssignmentByFuncAttrPassBase : public ::mlir::OperationPass { +public: + using Base = TFDeviceAssignmentByFuncAttrPassBase; + + TFDeviceAssignmentByFuncAttrPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TFDeviceAssignmentByFuncAttrPassBase(const TFDeviceAssignmentByFuncAttrPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-device-assignment-by-func-attr"); + } + ::llvm::StringRef getArgument() const override { return "tf-device-assignment-by-func-attr"; } + + ::llvm::StringRef getDescription() const override { return "Device assignment in TF dialect using the device specified in the function attribute."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TFDeviceAssignmentByFuncAttrPass"); + } + ::llvm::StringRef getName() const override { return "TFDeviceAssignmentByFuncAttrPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TFDeviceAssignmentByFuncAttrPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_TFDEVICEASSIGNMENTBYFUNCATTRPASS +#endif // GEN_PASS_DEF_TFDEVICEASSIGNMENTBYFUNCATTRPASS + +//===----------------------------------------------------------------------===// +// TPUAnnotateDynamicShapeInputsPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_TPUANNOTATEDYNAMICSHAPEINPUTSPASS +#undef GEN_PASS_DECL_TPUANNOTATEDYNAMICSHAPEINPUTSPASS +#endif // GEN_PASS_DECL_TPUANNOTATEDYNAMICSHAPEINPUTSPASS +#ifdef GEN_PASS_DEF_TPUANNOTATEDYNAMICSHAPEINPUTSPASS +namespace impl { + +template +class TPUAnnotateDynamicShapeInputsPassBase : public ::mlir::OperationPass { +public: + using Base = TPUAnnotateDynamicShapeInputsPassBase; + + TPUAnnotateDynamicShapeInputsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TPUAnnotateDynamicShapeInputsPassBase(const TPUAnnotateDynamicShapeInputsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-tpu-annotate-dynamic-shape-inputs"); + } + ::llvm::StringRef getArgument() const override { return "tf-tpu-annotate-dynamic-shape-inputs"; } + + ::llvm::StringRef getDescription() const override { return "Annotate the inputs returned by TPUCopyWithDynamicShapeOp with dynamic shape"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TPUAnnotateDynamicShapeInputsPass"); + } + ::llvm::StringRef getName() const override { return "TPUAnnotateDynamicShapeInputsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TPUAnnotateDynamicShapeInputsPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_TPUANNOTATEDYNAMICSHAPEINPUTSPASS +#endif // GEN_PASS_DEF_TPUANNOTATEDYNAMICSHAPEINPUTSPASS + +//===----------------------------------------------------------------------===// +// TPUBridgeExecutorIslandOutliningPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_TPUBRIDGEEXECUTORISLANDOUTLININGPASS +#undef GEN_PASS_DECL_TPUBRIDGEEXECUTORISLANDOUTLININGPASS +#endif // GEN_PASS_DECL_TPUBRIDGEEXECUTORISLANDOUTLININGPASS +#ifdef GEN_PASS_DEF_TPUBRIDGEEXECUTORISLANDOUTLININGPASS +namespace impl { + +template +class TPUBridgeExecutorIslandOutliningPassBase : public ::mlir::OperationPass { +public: + using Base = TPUBridgeExecutorIslandOutliningPassBase; + + TPUBridgeExecutorIslandOutliningPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TPUBridgeExecutorIslandOutliningPassBase(const TPUBridgeExecutorIslandOutliningPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-executor-tpu-v1-island-outlining"); + } + ::llvm::StringRef getArgument() const override { return "tf-executor-tpu-v1-island-outlining"; } + + ::llvm::StringRef getDescription() const override { return "Outline TPU clusters from island into a nested module, so it can be processed like a V2 module, intended for V1 compatibility mode"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TPUBridgeExecutorIslandOutliningPass"); + } + ::llvm::StringRef getName() const override { return "TPUBridgeExecutorIslandOutliningPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TPUBridgeExecutorIslandOutliningPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_TPUBRIDGEEXECUTORISLANDOUTLININGPASS +#endif // GEN_PASS_DEF_TPUBRIDGEEXECUTORISLANDOUTLININGPASS + +//===----------------------------------------------------------------------===// +// TPUCleanupClusterAttributesPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_TPUCLEANUPCLUSTERATTRIBUTESPASS +#undef GEN_PASS_DECL_TPUCLEANUPCLUSTERATTRIBUTESPASS +#endif // GEN_PASS_DECL_TPUCLEANUPCLUSTERATTRIBUTESPASS +#ifdef GEN_PASS_DEF_TPUCLEANUPCLUSTERATTRIBUTESPASS +namespace impl { + +template +class TPUCleanupClusterAttributesPassBase : public ::mlir::OperationPass { +public: + using Base = TPUCleanupClusterAttributesPassBase; + + TPUCleanupClusterAttributesPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TPUCleanupClusterAttributesPassBase(const TPUCleanupClusterAttributesPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-tpu-cleanup-cluster-attributes"); + } + ::llvm::StringRef getArgument() const override { return "tf-tpu-cleanup-cluster-attributes"; } + + ::llvm::StringRef getDescription() const override { return "Eliminate _replication_info and other attributes from ops in a cluster"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TPUCleanupClusterAttributesPass"); + } + ::llvm::StringRef getName() const override { return "TPUCleanupClusterAttributesPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TPUCleanupClusterAttributesPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_TPUCLEANUPCLUSTERATTRIBUTESPASS +#endif // GEN_PASS_DEF_TPUCLEANUPCLUSTERATTRIBUTESPASS + +//===----------------------------------------------------------------------===// +// TPUClusterFormationPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_TPUCLUSTERFORMATIONPASS +#undef GEN_PASS_DECL_TPUCLUSTERFORMATIONPASS +#endif // GEN_PASS_DECL_TPUCLUSTERFORMATIONPASS +#ifdef GEN_PASS_DEF_TPUCLUSTERFORMATIONPASS +namespace impl { + +template +class TPUClusterFormationPassBase : public ::mlir::OperationPass { +public: + using Base = TPUClusterFormationPassBase; + + TPUClusterFormationPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TPUClusterFormationPassBase(const TPUClusterFormationPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-tpu-cluster-formation"); + } + ::llvm::StringRef getArgument() const override { return "tf-tpu-cluster-formation"; } + + ::llvm::StringRef getDescription() const override { return "Forms clusters from operations assigned to the same TPU computation"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TPUClusterFormationPass"); + } + ::llvm::StringRef getName() const override { return "TPUClusterFormationPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TPUClusterFormationPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_TPUCLUSTERFORMATIONPASS +#endif // GEN_PASS_DEF_TPUCLUSTERFORMATIONPASS + +//===----------------------------------------------------------------------===// +// TPUColocateCompositeResourceOpsPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_TPUCOLOCATECOMPOSITERESOURCEOPSPASS +#undef GEN_PASS_DECL_TPUCOLOCATECOMPOSITERESOURCEOPSPASS +#endif // GEN_PASS_DECL_TPUCOLOCATECOMPOSITERESOURCEOPSPASS +#ifdef GEN_PASS_DEF_TPUCOLOCATECOMPOSITERESOURCEOPSPASS +namespace impl { + +template +class TPUColocateCompositeResourceOpsPassBase : public ::mlir::OperationPass { +public: + using Base = TPUColocateCompositeResourceOpsPassBase; + + TPUColocateCompositeResourceOpsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TPUColocateCompositeResourceOpsPassBase(const TPUColocateCompositeResourceOpsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-tpu-colocate-composite-resource-ops"); + } + ::llvm::StringRef getArgument() const override { return "tf-tpu-colocate-composite-resource-ops"; } + + ::llvm::StringRef getDescription() const override { return "Colocate resource with composite device assignment to TPU device."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TPUColocateCompositeResourceOpsPass"); + } + ::llvm::StringRef getName() const override { return "TPUColocateCompositeResourceOpsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TPUColocateCompositeResourceOpsPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_TPUCOLOCATECOMPOSITERESOURCEOPSPASS +#endif // GEN_PASS_DEF_TPUCOLOCATECOMPOSITERESOURCEOPSPASS + +//===----------------------------------------------------------------------===// +// TPUColocateSplitsPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_TPUCOLOCATESPLITSPASS +#undef GEN_PASS_DECL_TPUCOLOCATESPLITSPASS +#endif // GEN_PASS_DECL_TPUCOLOCATESPLITSPASS +#ifdef GEN_PASS_DEF_TPUCOLOCATESPLITSPASS +namespace impl { + +template +class TPUColocateSplitsPassBase : public ::mlir::OperationPass { +public: + using Base = TPUColocateSplitsPassBase; + + TPUColocateSplitsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TPUColocateSplitsPassBase(const TPUColocateSplitsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-tpu-colocate-splits"); + } + ::llvm::StringRef getArgument() const override { return "tf-tpu-colocate-splits"; } + + ::llvm::StringRef getDescription() const override { return "Colocates each Split op with its predecessor"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TPUColocateSplitsPass"); + } + ::llvm::StringRef getName() const override { return "TPUColocateSplitsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TPUColocateSplitsPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_TPUCOLOCATESPLITSPASS +#endif // GEN_PASS_DEF_TPUCOLOCATESPLITSPASS + +//===----------------------------------------------------------------------===// +// TPUDevicePropagationPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_TPUDEVICEPROPAGATIONPASS +#undef GEN_PASS_DECL_TPUDEVICEPROPAGATIONPASS +#endif // GEN_PASS_DECL_TPUDEVICEPROPAGATIONPASS +#ifdef GEN_PASS_DEF_TPUDEVICEPROPAGATIONPASS +namespace impl { + +template +class TPUDevicePropagationPassBase : public ::mlir::OperationPass { +public: + using Base = TPUDevicePropagationPassBase; + + TPUDevicePropagationPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TPUDevicePropagationPassBase(const TPUDevicePropagationPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-tpu-device-propagation"); + } + ::llvm::StringRef getArgument() const override { return "tf-tpu-device-propagation"; } + + ::llvm::StringRef getDescription() const override { return "Propagates TPU devices from ops to users"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TPUDevicePropagationPass"); + } + ::llvm::StringRef getName() const override { return "TPUDevicePropagationPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TPUDevicePropagationPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_TPUDEVICEPROPAGATIONPASS +#endif // GEN_PASS_DEF_TPUDEVICEPROPAGATIONPASS + +//===----------------------------------------------------------------------===// +// TPUDynamicLayoutPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_TPUDYNAMICLAYOUTPASS +#undef GEN_PASS_DECL_TPUDYNAMICLAYOUTPASS +#endif // GEN_PASS_DECL_TPUDYNAMICLAYOUTPASS +#ifdef GEN_PASS_DEF_TPUDYNAMICLAYOUTPASS +namespace impl { + +template +class TPUDynamicLayoutPassBase : public ::mlir::OperationPass { +public: + using Base = TPUDynamicLayoutPassBase; + + TPUDynamicLayoutPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TPUDynamicLayoutPassBase(const TPUDynamicLayoutPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-tpu-dynamic-layout-pass"); + } + ::llvm::StringRef getArgument() const override { return "tf-tpu-dynamic-layout-pass"; } + + ::llvm::StringRef getDescription() const override { return "Inserts TPU layout ops to determine layout at run time."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TPUDynamicLayoutPass"); + } + ::llvm::StringRef getName() const override { return "TPUDynamicLayoutPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TPUDynamicLayoutPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_TPUDYNAMICLAYOUTPASS +#endif // GEN_PASS_DEF_TPUDYNAMICLAYOUTPASS + +//===----------------------------------------------------------------------===// +// TPUHostComputationExpansionPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_TPUHOSTCOMPUTATIONEXPANSIONPASS +#undef GEN_PASS_DECL_TPUHOSTCOMPUTATIONEXPANSIONPASS +#endif // GEN_PASS_DECL_TPUHOSTCOMPUTATIONEXPANSIONPASS +#ifdef GEN_PASS_DEF_TPUHOSTCOMPUTATIONEXPANSIONPASS +namespace impl { + +template +class TPUHostComputationExpansionPassBase : public ::mlir::OperationPass { +public: + using Base = TPUHostComputationExpansionPassBase; + + TPUHostComputationExpansionPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TPUHostComputationExpansionPassBase(const TPUHostComputationExpansionPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-tpu-host-computation-expansion"); + } + ::llvm::StringRef getArgument() const override { return "tf-tpu-host-computation-expansion"; } + + ::llvm::StringRef getDescription() const override { return "Expands host computation before and after TPU computation."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TPUHostComputationExpansionPass"); + } + ::llvm::StringRef getName() const override { return "TPUHostComputationExpansionPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TPUHostComputationExpansionPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_TPUHOSTCOMPUTATIONEXPANSIONPASS +#endif // GEN_PASS_DEF_TPUHOSTCOMPUTATIONEXPANSIONPASS + +//===----------------------------------------------------------------------===// +// TPUIdentityPruningPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_TPUIDENTITYPRUNINGPASS +#undef GEN_PASS_DECL_TPUIDENTITYPRUNINGPASS +#endif // GEN_PASS_DECL_TPUIDENTITYPRUNINGPASS +#ifdef GEN_PASS_DEF_TPUIDENTITYPRUNINGPASS +namespace impl { + +template +class TPUIdentityPruningPassBase : public ::mlir::OperationPass { +public: + using Base = TPUIdentityPruningPassBase; + + TPUIdentityPruningPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TPUIdentityPruningPassBase(const TPUIdentityPruningPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-tpu-identity-pruning"); + } + ::llvm::StringRef getArgument() const override { return "tf-tpu-identity-pruning"; } + + ::llvm::StringRef getDescription() const override { return "Removes Identity/IdentityN ops from the TPU computation"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TPUIdentityPruningPass"); + } + ::llvm::StringRef getName() const override { return "TPUIdentityPruningPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TPUIdentityPruningPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_TPUIDENTITYPRUNINGPASS +#endif // GEN_PASS_DEF_TPUIDENTITYPRUNINGPASS + +//===----------------------------------------------------------------------===// +// TPUMergeVariablesWithExecutePass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_TPUMERGEVARIABLESWITHEXECUTEPASS +#undef GEN_PASS_DECL_TPUMERGEVARIABLESWITHEXECUTEPASS +#endif // GEN_PASS_DECL_TPUMERGEVARIABLESWITHEXECUTEPASS +#ifdef GEN_PASS_DEF_TPUMERGEVARIABLESWITHEXECUTEPASS +namespace impl { + +template +class TPUMergeVariablesWithExecutePassBase : public ::mlir::OperationPass { +public: + using Base = TPUMergeVariablesWithExecutePassBase; + + TPUMergeVariablesWithExecutePassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TPUMergeVariablesWithExecutePassBase(const TPUMergeVariablesWithExecutePassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-tpu-merge-variables-with-execute"); + } + ::llvm::StringRef getArgument() const override { return "tf-tpu-merge-variables-with-execute"; } + + ::llvm::StringRef getDescription() const override { return "Merges device variable reads and updates into TPU execute ops"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TPUMergeVariablesWithExecutePass"); + } + ::llvm::StringRef getName() const override { return "TPUMergeVariablesWithExecutePass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TPUMergeVariablesWithExecutePassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_TPUMERGEVARIABLESWITHEXECUTEPASS +#endif // GEN_PASS_DEF_TPUMERGEVARIABLESWITHEXECUTEPASS + +//===----------------------------------------------------------------------===// +// TPUParallelExecuteSinkResourceWritePass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_TPUPARALLELEXECUTESINKRESOURCEWRITEPASS +#undef GEN_PASS_DECL_TPUPARALLELEXECUTESINKRESOURCEWRITEPASS +#endif // GEN_PASS_DECL_TPUPARALLELEXECUTESINKRESOURCEWRITEPASS +#ifdef GEN_PASS_DEF_TPUPARALLELEXECUTESINKRESOURCEWRITEPASS +namespace impl { + +template +class TPUParallelExecuteSinkResourceWritePassBase : public ::mlir::OperationPass { +public: + using Base = TPUParallelExecuteSinkResourceWritePassBase; + + TPUParallelExecuteSinkResourceWritePassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TPUParallelExecuteSinkResourceWritePassBase(const TPUParallelExecuteSinkResourceWritePassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-tpu-parallel-execute-sink-resource-write"); + } + ::llvm::StringRef getArgument() const override { return "tf-tpu-parallel-execute-sink-resource-write"; } + + ::llvm::StringRef getDescription() const override { return "Moves tf.AssignVariableOp consumers of tf_device.parallel_execute into tf_device.parallel_execute regions"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TPUParallelExecuteSinkResourceWritePass"); + } + ::llvm::StringRef getName() const override { return "TPUParallelExecuteSinkResourceWritePass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TPUParallelExecuteSinkResourceWritePassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_TPUPARALLELEXECUTESINKRESOURCEWRITEPASS +#endif // GEN_PASS_DEF_TPUPARALLELEXECUTESINKRESOURCEWRITEPASS + +//===----------------------------------------------------------------------===// +// TPUPartitionedOpConversionPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_TPUPARTITIONEDOPCONVERSIONPASS +#undef GEN_PASS_DECL_TPUPARTITIONEDOPCONVERSIONPASS +#endif // GEN_PASS_DECL_TPUPARTITIONEDOPCONVERSIONPASS +#ifdef GEN_PASS_DEF_TPUPARTITIONEDOPCONVERSIONPASS +namespace impl { + +template +class TPUPartitionedOpConversionPassBase : public ::mlir::OperationPass { +public: + using Base = TPUPartitionedOpConversionPassBase; + + TPUPartitionedOpConversionPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TPUPartitionedOpConversionPassBase(const TPUPartitionedOpConversionPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-tpu-partitioned-op-conversion"); + } + ::llvm::StringRef getArgument() const override { return "tf-tpu-partitioned-op-conversion"; } + + ::llvm::StringRef getDescription() const override { return "Rewrite all TPU Partitioned ops into their V2 counterparts."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TPUPartitionedOpConversionPass"); + } + ::llvm::StringRef getName() const override { return "TPUPartitionedOpConversionPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TPUPartitionedOpConversionPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_TPUPARTITIONEDOPCONVERSIONPASS +#endif // GEN_PASS_DEF_TPUPARTITIONEDOPCONVERSIONPASS + +//===----------------------------------------------------------------------===// +// TPUReorderReplicateAndPartitionedInputsPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_TPUREORDERREPLICATEANDPARTITIONEDINPUTSPASS +#undef GEN_PASS_DECL_TPUREORDERREPLICATEANDPARTITIONEDINPUTSPASS +#endif // GEN_PASS_DECL_TPUREORDERREPLICATEANDPARTITIONEDINPUTSPASS +#ifdef GEN_PASS_DEF_TPUREORDERREPLICATEANDPARTITIONEDINPUTSPASS +namespace impl { + +template +class TPUReorderReplicateAndPartitionedInputsPassBase : public ::mlir::OperationPass { +public: + using Base = TPUReorderReplicateAndPartitionedInputsPassBase; + + TPUReorderReplicateAndPartitionedInputsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TPUReorderReplicateAndPartitionedInputsPassBase(const TPUReorderReplicateAndPartitionedInputsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-tpu-reorder-replicate-partitioned-inputs"); + } + ::llvm::StringRef getArgument() const override { return "tf-tpu-reorder-replicate-partitioned-inputs"; } + + ::llvm::StringRef getDescription() const override { return "Reorder replicated and partitioned input ops."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TPUReorderReplicateAndPartitionedInputsPass"); + } + ::llvm::StringRef getName() const override { return "TPUReorderReplicateAndPartitionedInputsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TPUReorderReplicateAndPartitionedInputsPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_TPUREORDERREPLICATEANDPARTITIONEDINPUTSPASS +#endif // GEN_PASS_DEF_TPUREORDERREPLICATEANDPARTITIONEDINPUTSPASS + +//===----------------------------------------------------------------------===// +// TPUResourceReadForWritePass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_TPURESOURCEREADFORWRITEPASS +#undef GEN_PASS_DECL_TPURESOURCEREADFORWRITEPASS +#endif // GEN_PASS_DECL_TPURESOURCEREADFORWRITEPASS +#ifdef GEN_PASS_DEF_TPURESOURCEREADFORWRITEPASS +namespace impl { + +template +class TPUResourceReadForWritePassBase : public ::mlir::OperationPass { +public: + using Base = TPUResourceReadForWritePassBase; + + TPUResourceReadForWritePassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TPUResourceReadForWritePassBase(const TPUResourceReadForWritePassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-tpu-resource-read-for-write"); + } + ::llvm::StringRef getArgument() const override { return "tf-tpu-resource-read-for-write"; } + + ::llvm::StringRef getDescription() const override { return "Inserts tf.ReadVariableOp inputs to a TPU cluster for resource writes with no reads"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TPUResourceReadForWritePass"); + } + ::llvm::StringRef getName() const override { return "TPUResourceReadForWritePass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TPUResourceReadForWritePassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_TPURESOURCEREADFORWRITEPASS +#endif // GEN_PASS_DEF_TPURESOURCEREADFORWRITEPASS + +//===----------------------------------------------------------------------===// +// TPUResourceReadsWritesPartitioningPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_TPURESOURCEREADSWRITESPARTITIONINGPASS +#undef GEN_PASS_DECL_TPURESOURCEREADSWRITESPARTITIONINGPASS +#endif // GEN_PASS_DECL_TPURESOURCEREADSWRITESPARTITIONINGPASS +#ifdef GEN_PASS_DEF_TPURESOURCEREADSWRITESPARTITIONINGPASS +namespace impl { + +template +class TPUResourceReadsWritesPartitioningPassBase : public ::mlir::OperationPass { +public: + using Base = TPUResourceReadsWritesPartitioningPassBase; + + TPUResourceReadsWritesPartitioningPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TPUResourceReadsWritesPartitioningPassBase(const TPUResourceReadsWritesPartitioningPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-tpu-resource-partition"); + } + ::llvm::StringRef getArgument() const override { return "tf-tpu-resource-partition"; } + + ::llvm::StringRef getDescription() const override { return "Partitions unpartitioned resource read/write to partitioned resource variables."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TPUResourceReadsWritesPartitioningPass"); + } + ::llvm::StringRef getName() const override { return "TPUResourceReadsWritesPartitioningPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TPUResourceReadsWritesPartitioningPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_TPURESOURCEREADSWRITESPARTITIONINGPASS +#endif // GEN_PASS_DEF_TPURESOURCEREADSWRITESPARTITIONINGPASS + +//===----------------------------------------------------------------------===// +// TPURewritePass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_TPUREWRITEPASS +struct TPURewritePassOptions { + bool tpu_compile_metadata_debug_ = false; +}; +#undef GEN_PASS_DECL_TPUREWRITEPASS +#endif // GEN_PASS_DECL_TPUREWRITEPASS +#ifdef GEN_PASS_DEF_TPUREWRITEPASS +namespace impl { + +template +class TPURewritePassBase : public ::mlir::OperationPass { +public: + using Base = TPURewritePassBase; + + TPURewritePassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TPURewritePassBase(const TPURewritePassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-tpu-rewrite"); + } + ::llvm::StringRef getArgument() const override { return "tf-tpu-rewrite"; } + + ::llvm::StringRef getDescription() const override { return "Rewrites a `tf_device.cluster_func` on TPUs into TPU runtime operations."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TPURewritePass"); + } + ::llvm::StringRef getName() const override { return "TPURewritePass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TPURewritePassBase) + + TPURewritePassBase(const TPURewritePassOptions &options) : TPURewritePassBase() { + tpu_compile_metadata_debug_ = options.tpu_compile_metadata_debug_; + } +protected: + ::mlir::Pass::Option tpu_compile_metadata_debug_{*this, "tpu-compile-metadata-debug", ::llvm::cl::desc("Whether to serialize TPUCompileMetadataProto metadata in 'tf._TPUCompileMlir' op as a proto debug string"), ::llvm::cl::init(false)}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_TPUREWRITEPASS +#endif // GEN_PASS_DEF_TPUREWRITEPASS + +//===----------------------------------------------------------------------===// +// TPUShardingIdentificationPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_TPUSHARDINGIDENTIFICATIONPASS +#undef GEN_PASS_DECL_TPUSHARDINGIDENTIFICATIONPASS +#endif // GEN_PASS_DECL_TPUSHARDINGIDENTIFICATIONPASS +#ifdef GEN_PASS_DEF_TPUSHARDINGIDENTIFICATIONPASS +namespace impl { + +template +class TPUShardingIdentificationPassBase : public ::mlir::OperationPass { +public: + using Base = TPUShardingIdentificationPassBase; + + TPUShardingIdentificationPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TPUShardingIdentificationPassBase(const TPUShardingIdentificationPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-tpu-sharding-identification"); + } + ::llvm::StringRef getArgument() const override { return "tf-tpu-sharding-identification"; } + + ::llvm::StringRef getDescription() const override { return "Identifies and handles inputs/outputs of TPU computation that is sharded across logical cores."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TPUShardingIdentificationPass"); + } + ::llvm::StringRef getName() const override { return "TPUShardingIdentificationPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TPUShardingIdentificationPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_TPUSHARDINGIDENTIFICATIONPASS +#endif // GEN_PASS_DEF_TPUSHARDINGIDENTIFICATIONPASS + +//===----------------------------------------------------------------------===// +// TPUSpaceToDepthPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_TPUSPACETODEPTHPASS +#undef GEN_PASS_DECL_TPUSPACETODEPTHPASS +#endif // GEN_PASS_DECL_TPUSPACETODEPTHPASS +#ifdef GEN_PASS_DEF_TPUSPACETODEPTHPASS +namespace impl { + +template +class TPUSpaceToDepthPassBase : public ::mlir::OperationPass { +public: + using Base = TPUSpaceToDepthPassBase; + + TPUSpaceToDepthPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TPUSpaceToDepthPassBase(const TPUSpaceToDepthPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-tpu-space-to-depth-pass"); + } + ::llvm::StringRef getArgument() const override { return "tf-tpu-space-to-depth-pass"; } + + ::llvm::StringRef getDescription() const override { return "Applies automatic space to depth transform for the first or frontier convolutions consume host inputs on TPU."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TPUSpaceToDepthPass"); + } + ::llvm::StringRef getName() const override { return "TPUSpaceToDepthPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TPUSpaceToDepthPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_TPUSPACETODEPTHPASS +#endif // GEN_PASS_DEF_TPUSPACETODEPTHPASS + +//===----------------------------------------------------------------------===// +// TPUUpdateEmbeddingEnqueueOpInputsPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_TPUUPDATEEMBEDDINGENQUEUEOPINPUTSPASS +#undef GEN_PASS_DECL_TPUUPDATEEMBEDDINGENQUEUEOPINPUTSPASS +#endif // GEN_PASS_DECL_TPUUPDATEEMBEDDINGENQUEUEOPINPUTSPASS +#ifdef GEN_PASS_DEF_TPUUPDATEEMBEDDINGENQUEUEOPINPUTSPASS +namespace impl { + +template +class TPUUpdateEmbeddingEnqueueOpInputsPassBase : public ::mlir::OperationPass { +public: + using Base = TPUUpdateEmbeddingEnqueueOpInputsPassBase; + + TPUUpdateEmbeddingEnqueueOpInputsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TPUUpdateEmbeddingEnqueueOpInputsPassBase(const TPUUpdateEmbeddingEnqueueOpInputsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-tpu-update-embedding-enqueue-op-inputs"); + } + ::llvm::StringRef getArgument() const override { return "tf-tpu-update-embedding-enqueue-op-inputs"; } + + ::llvm::StringRef getDescription() const override { return "Updates inputs to TPU embedding enqueue ops depending on whether graph is in training mode or in evaluation mode."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TPUUpdateEmbeddingEnqueueOpInputsPass"); + } + ::llvm::StringRef getName() const override { return "TPUUpdateEmbeddingEnqueueOpInputsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TPUUpdateEmbeddingEnqueueOpInputsPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_TPUUPDATEEMBEDDINGENQUEUEOPINPUTSPASS +#endif // GEN_PASS_DEF_TPUUPDATEEMBEDDINGENQUEUEOPINPUTSPASS + +//===----------------------------------------------------------------------===// +// TPUValidateInputsPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_TPUVALIDATEINPUTSPASS +#undef GEN_PASS_DECL_TPUVALIDATEINPUTSPASS +#endif // GEN_PASS_DECL_TPUVALIDATEINPUTSPASS +#ifdef GEN_PASS_DEF_TPUVALIDATEINPUTSPASS +namespace impl { + +template +class TPUValidateInputsPassBase : public ::mlir::OperationPass { +public: + using Base = TPUValidateInputsPassBase; + + TPUValidateInputsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TPUValidateInputsPassBase(const TPUValidateInputsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-tpu-validate-inputs"); + } + ::llvm::StringRef getArgument() const override { return "tf-tpu-validate-inputs"; } + + ::llvm::StringRef getDescription() const override { return "Validates inputs to the TPU TF/XLA bridge"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TPUValidateInputsPass"); + } + ::llvm::StringRef getName() const override { return "TPUValidateInputsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TPUValidateInputsPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_TPUVALIDATEINPUTSPASS +#endif // GEN_PASS_DEF_TPUVALIDATEINPUTSPASS + +//===----------------------------------------------------------------------===// +// TPUVariableRuntimeReformattingPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_TPUVARIABLERUNTIMEREFORMATTINGPASS +#undef GEN_PASS_DECL_TPUVARIABLERUNTIMEREFORMATTINGPASS +#endif // GEN_PASS_DECL_TPUVARIABLERUNTIMEREFORMATTINGPASS +#ifdef GEN_PASS_DEF_TPUVARIABLERUNTIMEREFORMATTINGPASS +namespace impl { + +template +class TPUVariableRuntimeReformattingPassBase : public ::mlir::OperationPass { +public: + using Base = TPUVariableRuntimeReformattingPassBase; + + TPUVariableRuntimeReformattingPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TPUVariableRuntimeReformattingPassBase(const TPUVariableRuntimeReformattingPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-tpu-variable-runtime-reformatting"); + } + ::llvm::StringRef getArgument() const override { return "tf-tpu-variable-runtime-reformatting"; } + + ::llvm::StringRef getDescription() const override { return "Adds device variable formatting op to allow compilation-guided variable formatting."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TPUVariableRuntimeReformattingPass"); + } + ::llvm::StringRef getName() const override { return "TPUVariableRuntimeReformattingPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TPUVariableRuntimeReformattingPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_TPUVARIABLERUNTIMEREFORMATTINGPASS +#endif // GEN_PASS_DEF_TPUVARIABLERUNTIMEREFORMATTINGPASS + +//===----------------------------------------------------------------------===// +// TensorArrayOpsDecompositionPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_TENSORARRAYOPSDECOMPOSITIONPASS +#undef GEN_PASS_DECL_TENSORARRAYOPSDECOMPOSITIONPASS +#endif // GEN_PASS_DECL_TENSORARRAYOPSDECOMPOSITIONPASS +#ifdef GEN_PASS_DEF_TENSORARRAYOPSDECOMPOSITIONPASS +namespace impl { + +template +class TensorArrayOpsDecompositionPassBase : public ::mlir::OperationPass { +public: + using Base = TensorArrayOpsDecompositionPassBase; + + TensorArrayOpsDecompositionPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TensorArrayOpsDecompositionPassBase(const TensorArrayOpsDecompositionPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-tensor-array-ops-decomposition"); + } + ::llvm::StringRef getArgument() const override { return "tf-tensor-array-ops-decomposition"; } + + ::llvm::StringRef getDescription() const override { return "Decompose tensor array operations into local variable operations."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TensorArrayOpsDecompositionPass"); + } + ::llvm::StringRef getName() const override { return "TensorArrayOpsDecompositionPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TensorArrayOpsDecompositionPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_TENSORARRAYOPSDECOMPOSITIONPASS +#endif // GEN_PASS_DEF_TENSORARRAYOPSDECOMPOSITIONPASS + +//===----------------------------------------------------------------------===// +// TensorDeviceCopyConversionPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_TENSORDEVICECOPYCONVERSIONPASS +#undef GEN_PASS_DECL_TENSORDEVICECOPYCONVERSIONPASS +#endif // GEN_PASS_DECL_TENSORDEVICECOPYCONVERSIONPASS +#ifdef GEN_PASS_DEF_TENSORDEVICECOPYCONVERSIONPASS +namespace impl { + +template +class TensorDeviceCopyConversionPassBase : public ::mlir::OperationPass { +public: + using Base = TensorDeviceCopyConversionPassBase; + + TensorDeviceCopyConversionPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TensorDeviceCopyConversionPassBase(const TensorDeviceCopyConversionPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-tensor-device-copy"); + } + ::llvm::StringRef getArgument() const override { return "tf-tensor-device-copy"; } + + ::llvm::StringRef getDescription() const override { return "Fold the tf.Identity op and the tf.IdentityN op if the op has the same device as its operand"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TensorDeviceCopyConversionPass"); + } + ::llvm::StringRef getName() const override { return "TensorDeviceCopyConversionPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TensorDeviceCopyConversionPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_TENSORDEVICECOPYCONVERSIONPASS +#endif // GEN_PASS_DEF_TENSORDEVICECOPYCONVERSIONPASS + +//===----------------------------------------------------------------------===// +// TensorFlowOptimizePass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_TENSORFLOWOPTIMIZEPASS +#undef GEN_PASS_DECL_TENSORFLOWOPTIMIZEPASS +#endif // GEN_PASS_DECL_TENSORFLOWOPTIMIZEPASS +#ifdef GEN_PASS_DEF_TENSORFLOWOPTIMIZEPASS +namespace impl { + +template +class TensorFlowOptimizePassBase : public ::mlir::OperationPass { +public: + using Base = TensorFlowOptimizePassBase; + + TensorFlowOptimizePassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TensorFlowOptimizePassBase(const TensorFlowOptimizePassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-optimize"); + } + ::llvm::StringRef getArgument() const override { return "tf-optimize"; } + + ::llvm::StringRef getDescription() const override { return "Optimize TensorFlow module"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TensorFlowOptimizePass"); + } + ::llvm::StringRef getName() const override { return "TensorFlowOptimizePass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TensorFlowOptimizePassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_TENSORFLOWOPTIMIZEPASS +#endif // GEN_PASS_DEF_TENSORFLOWOPTIMIZEPASS + +//===----------------------------------------------------------------------===// +// TensorFlowShapeInferencePass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_TENSORFLOWSHAPEINFERENCEPASS +struct TensorFlowShapeInferencePassOptions { + int64_t max_iterations_ = 10; +}; +#undef GEN_PASS_DECL_TENSORFLOWSHAPEINFERENCEPASS +#endif // GEN_PASS_DECL_TENSORFLOWSHAPEINFERENCEPASS +#ifdef GEN_PASS_DEF_TENSORFLOWSHAPEINFERENCEPASS +namespace impl { + +template +class TensorFlowShapeInferencePassBase : public ::mlir::OperationPass { +public: + using Base = TensorFlowShapeInferencePassBase; + + TensorFlowShapeInferencePassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TensorFlowShapeInferencePassBase(const TensorFlowShapeInferencePassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-shape-inference"); + } + ::llvm::StringRef getArgument() const override { return "tf-shape-inference"; } + + ::llvm::StringRef getDescription() const override { return "Shape inference on TF dialect and ops implementing InferTypeOpInterface"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TensorFlowShapeInferencePass"); + } + ::llvm::StringRef getName() const override { return "TensorFlowShapeInferencePass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TensorFlowShapeInferencePassBase) + + TensorFlowShapeInferencePassBase(const TensorFlowShapeInferencePassOptions &options) : TensorFlowShapeInferencePassBase() { + max_iterations_ = options.max_iterations_; + } +protected: + ::mlir::Pass::Option max_iterations_{*this, "max-iterations", ::llvm::cl::desc("Maximum shape inference iterations"), ::llvm::cl::init(10)}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_TENSORFLOWSHAPEINFERENCEPASS +#endif // GEN_PASS_DEF_TENSORFLOWSHAPEINFERENCEPASS + +//===----------------------------------------------------------------------===// +// TensorListOpsDecompositionPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_TENSORLISTOPSDECOMPOSITIONPASS +#undef GEN_PASS_DECL_TENSORLISTOPSDECOMPOSITIONPASS +#endif // GEN_PASS_DECL_TENSORLISTOPSDECOMPOSITIONPASS +#ifdef GEN_PASS_DEF_TENSORLISTOPSDECOMPOSITIONPASS +namespace impl { + +template +class TensorListOpsDecompositionPassBase : public ::mlir::OperationPass { +public: + using Base = TensorListOpsDecompositionPassBase; + + TensorListOpsDecompositionPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TensorListOpsDecompositionPassBase(const TensorListOpsDecompositionPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-tensor-list-ops-decomposition"); + } + ::llvm::StringRef getArgument() const override { return "tf-tensor-list-ops-decomposition"; } + + ::llvm::StringRef getDescription() const override { return "Decomposes TensorList operations into generic operations on tensors."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TensorListOpsDecompositionPass"); + } + ::llvm::StringRef getName() const override { return "TensorListOpsDecompositionPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TensorListOpsDecompositionPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_TENSORLISTOPSDECOMPOSITIONPASS +#endif // GEN_PASS_DEF_TENSORLISTOPSDECOMPOSITIONPASS + +//===----------------------------------------------------------------------===// +// TensorflowGPUFusion +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_TENSORFLOWGPUFUSION +#undef GEN_PASS_DECL_TENSORFLOWGPUFUSION +#endif // GEN_PASS_DECL_TENSORFLOWGPUFUSION +#ifdef GEN_PASS_DEF_TENSORFLOWGPUFUSION +namespace impl { + +template +class TensorflowGPUFusionBase : public ::mlir::OperationPass { +public: + using Base = TensorflowGPUFusionBase; + + TensorflowGPUFusionBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TensorflowGPUFusionBase(const TensorflowGPUFusionBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-gpu-op-fusion"); + } + ::llvm::StringRef getArgument() const override { return "tf-gpu-op-fusion"; } + + ::llvm::StringRef getDescription() const override { return "Fusion optimization for GPU targets"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TensorflowGPUFusion"); + } + ::llvm::StringRef getName() const override { return "TensorflowGPUFusion"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TensorflowGPUFusionBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_TENSORFLOWGPUFUSION +#endif // GEN_PASS_DEF_TENSORFLOWGPUFUSION + +//===----------------------------------------------------------------------===// +// TpuV1BridgeExecutorIslandCoarseningPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_TPUV1BRIDGEEXECUTORISLANDCOARSENINGPASS +#undef GEN_PASS_DECL_TPUV1BRIDGEEXECUTORISLANDCOARSENINGPASS +#endif // GEN_PASS_DECL_TPUV1BRIDGEEXECUTORISLANDCOARSENINGPASS +#ifdef GEN_PASS_DEF_TPUV1BRIDGEEXECUTORISLANDCOARSENINGPASS +namespace impl { + +template +class TpuV1BridgeExecutorIslandCoarseningPassBase : public ::mlir::OperationPass { +public: + using Base = TpuV1BridgeExecutorIslandCoarseningPassBase; + + TpuV1BridgeExecutorIslandCoarseningPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TpuV1BridgeExecutorIslandCoarseningPassBase(const TpuV1BridgeExecutorIslandCoarseningPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-executor-tpu-v1-island-coarsening"); + } + ::llvm::StringRef getArgument() const override { return "tf-executor-tpu-v1-island-coarsening"; } + + ::llvm::StringRef getDescription() const override { return "Merges TPU clusters IslandOps, intended for V1 compatibility mode"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TpuV1BridgeExecutorIslandCoarseningPass"); + } + ::llvm::StringRef getName() const override { return "TpuV1BridgeExecutorIslandCoarseningPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TpuV1BridgeExecutorIslandCoarseningPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_TPUV1BRIDGEEXECUTORISLANDCOARSENINGPASS +#endif // GEN_PASS_DEF_TPUV1BRIDGEEXECUTORISLANDCOARSENINGPASS + +//===----------------------------------------------------------------------===// +// TransformEinsumPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_TRANSFORMEINSUMPASS +#undef GEN_PASS_DECL_TRANSFORMEINSUMPASS +#endif // GEN_PASS_DECL_TRANSFORMEINSUMPASS +#ifdef GEN_PASS_DEF_TRANSFORMEINSUMPASS +namespace impl { + +template +class TransformEinsumPassBase : public ::mlir::OperationPass { +public: + using Base = TransformEinsumPassBase; + + TransformEinsumPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TransformEinsumPassBase(const TransformEinsumPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-einsum"); + } + ::llvm::StringRef getArgument() const override { return "tf-einsum"; } + + ::llvm::StringRef getDescription() const override { return "Transform Einsum to other TF Ops for the supported variants"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TransformEinsumPass"); + } + ::llvm::StringRef getName() const override { return "TransformEinsumPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TransformEinsumPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_TRANSFORMEINSUMPASS +#endif // GEN_PASS_DEF_TRANSFORMEINSUMPASS + +//===----------------------------------------------------------------------===// +// UnrollBatchMatMulPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_UNROLLBATCHMATMULPASS +#undef GEN_PASS_DECL_UNROLLBATCHMATMULPASS +#endif // GEN_PASS_DECL_UNROLLBATCHMATMULPASS +#ifdef GEN_PASS_DEF_UNROLLBATCHMATMULPASS +namespace impl { + +template +class UnrollBatchMatMulPassBase : public ::mlir::OperationPass { +public: + using Base = UnrollBatchMatMulPassBase; + + UnrollBatchMatMulPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + UnrollBatchMatMulPassBase(const UnrollBatchMatMulPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-unroll-batch-matmul"); + } + ::llvm::StringRef getArgument() const override { return "tf-unroll-batch-matmul"; } + + ::llvm::StringRef getDescription() const override { return "Unroll TF BatchMatMul op into Reshape, Slice, MatMul, Pack ops."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("UnrollBatchMatMulPass"); + } + ::llvm::StringRef getName() const override { return "UnrollBatchMatMulPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(UnrollBatchMatMulPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_UNROLLBATCHMATMULPASS +#endif // GEN_PASS_DEF_UNROLLBATCHMATMULPASS + +//===----------------------------------------------------------------------===// +// VerifySuitableForExportPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_VERIFYSUITABLEFOREXPORTPASS +#undef GEN_PASS_DECL_VERIFYSUITABLEFOREXPORTPASS +#endif // GEN_PASS_DECL_VERIFYSUITABLEFOREXPORTPASS +#ifdef GEN_PASS_DEF_VERIFYSUITABLEFOREXPORTPASS +namespace impl { + +template +class VerifySuitableForExportPassBase : public ::mlir::OperationPass { +public: + using Base = VerifySuitableForExportPassBase; + + VerifySuitableForExportPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + VerifySuitableForExportPassBase(const VerifySuitableForExportPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-verify-for-export"); + } + ::llvm::StringRef getArgument() const override { return "tf-verify-for-export"; } + + ::llvm::StringRef getDescription() const override { return "Verify module is suitable for export back to TF Graph"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("VerifySuitableForExportPass"); + } + ::llvm::StringRef getName() const override { return "VerifySuitableForExportPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(VerifySuitableForExportPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_VERIFYSUITABLEFOREXPORTPASS +#endif // GEN_PASS_DEF_VERIFYSUITABLEFOREXPORTPASS + +//===----------------------------------------------------------------------===// +// XlaCallModuleDeserializationPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_XLACALLMODULEDESERIALIZATIONPASS +#undef GEN_PASS_DECL_XLACALLMODULEDESERIALIZATIONPASS +#endif // GEN_PASS_DECL_XLACALLMODULEDESERIALIZATIONPASS +#ifdef GEN_PASS_DEF_XLACALLMODULEDESERIALIZATIONPASS +namespace impl { + +template +class XlaCallModuleDeserializationPassBase : public ::mlir::OperationPass { +public: + using Base = XlaCallModuleDeserializationPassBase; + + XlaCallModuleDeserializationPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + XlaCallModuleDeserializationPassBase(const XlaCallModuleDeserializationPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-xla-call-module-deserialization"); + } + ::llvm::StringRef getArgument() const override { return "tf-xla-call-module-deserialization"; } + + ::llvm::StringRef getDescription() const override { return "Deserializes StableHLO functions embedded in `tf.XlaCallModule` to top level module"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("XlaCallModuleDeserializationPass"); + } + ::llvm::StringRef getName() const override { return "XlaCallModuleDeserializationPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(XlaCallModuleDeserializationPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_XLACALLMODULEDESERIALIZATIONPASS +#endif // GEN_PASS_DEF_XLACALLMODULEDESERIALIZATIONPASS + +//===----------------------------------------------------------------------===// +// XlaCallModuleSerializationPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_XLACALLMODULESERIALIZATIONPASS +#undef GEN_PASS_DECL_XLACALLMODULESERIALIZATIONPASS +#endif // GEN_PASS_DECL_XLACALLMODULESERIALIZATIONPASS +#ifdef GEN_PASS_DEF_XLACALLMODULESERIALIZATIONPASS +namespace impl { + +template +class XlaCallModuleSerializationPassBase : public ::mlir::OperationPass { +public: + using Base = XlaCallModuleSerializationPassBase; + + XlaCallModuleSerializationPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + XlaCallModuleSerializationPassBase(const XlaCallModuleSerializationPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-xla-call-module-serialization"); + } + ::llvm::StringRef getArgument() const override { return "tf-xla-call-module-serialization"; } + + ::llvm::StringRef getDescription() const override { return "Serializes StableHLO functions from top-level module into `tf.XlaCallModule`'s `module` attribute"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("XlaCallModuleSerializationPass"); + } + ::llvm::StringRef getName() const override { return "XlaCallModuleSerializationPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(XlaCallModuleSerializationPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_XLACALLMODULESERIALIZATIONPASS +#endif // GEN_PASS_DEF_XLACALLMODULESERIALIZATIONPASS +#ifdef GEN_PASS_REGISTRATION + +//===----------------------------------------------------------------------===// +// BatchMatMulToEinsumPass Registration +//===----------------------------------------------------------------------===// + +inline void registerBatchMatMulToEinsumPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateBatchMatMulToEinsumPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerBatchMatMulToEinsumPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateBatchMatMulToEinsumPass(); + }); +} + +//===----------------------------------------------------------------------===// +// BreakUpIslandsPass Registration +//===----------------------------------------------------------------------===// + +inline void registerBreakUpIslandsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return CreateBreakUpIslandsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerBreakUpIslandsPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return CreateBreakUpIslandsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// BroadcastFoldPass Registration +//===----------------------------------------------------------------------===// + +inline void registerBroadcastFoldPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateBroadcastFoldPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerBroadcastFoldPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateBroadcastFoldPass(); + }); +} + +//===----------------------------------------------------------------------===// +// CanonicalizeCompileAndReplicateAttributesPass Registration +//===----------------------------------------------------------------------===// + +inline void registerCanonicalizeCompileAndReplicateAttributesPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateCanonicalizeCompileAndReplicateAttributesPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerCanonicalizeCompileAndReplicateAttributesPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateCanonicalizeCompileAndReplicateAttributesPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ClusterConstantSinkingPass Registration +//===----------------------------------------------------------------------===// + +inline void registerClusterConstantSinkingPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateClusterConstantSinkingPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerClusterConstantSinkingPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateClusterConstantSinkingPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ClusterFormationPass Registration +//===----------------------------------------------------------------------===// + +inline void registerClusterFormationPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateClusterFormationPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerClusterFormationPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateClusterFormationPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ClusterOutliningPass Registration +//===----------------------------------------------------------------------===// + +inline void registerClusterOutliningPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateClusterOutliningPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerClusterOutliningPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateClusterOutliningPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ClusterTFOpsByHostPass Registration +//===----------------------------------------------------------------------===// + +inline void registerClusterTFOpsByHostPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateClusterTFOpsByHostPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerClusterTFOpsByHostPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateClusterTFOpsByHostPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ColocateTPUCopyWithDynamicShapePass Registration +//===----------------------------------------------------------------------===// + +inline void registerColocateTPUCopyWithDynamicShapePass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFTPU::CreateColocateTPUCopyWithDynamicShapePass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerColocateTPUCopyWithDynamicShapePassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFTPU::CreateColocateTPUCopyWithDynamicShapePass(); + }); +} + +//===----------------------------------------------------------------------===// +// ConstantOpDeviceAssignmentPass Registration +//===----------------------------------------------------------------------===// + +inline void registerConstantOpDeviceAssignmentPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateConstantOpDeviceAssignmentPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConstantOpDeviceAssignmentPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateConstantOpDeviceAssignmentPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertLaunchFuncToTFCallPass Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertLaunchFuncToTFCallPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateConvertLaunchFuncToTFCallPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertLaunchFuncToTFCallPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateConvertLaunchFuncToTFCallPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertReadonlyReferenceVariablesToResourceVariablesPass Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertReadonlyReferenceVariablesToResourceVariablesPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateConvertReadonlyReferenceVariablesToResourceVariablesPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertReadonlyReferenceVariablesToResourceVariablesPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateConvertReadonlyReferenceVariablesToResourceVariablesPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertTfControlFlowToScfPass Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertTfControlFlowToScfPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::createConvertTfControlFlowToScfPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertTfControlFlowToScfPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::createConvertTfControlFlowToScfPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertToLegacyCompileAndReplicateAttributesPass Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertToLegacyCompileAndReplicateAttributesPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFTPU::CreateConvertToLegacyCompileAndReplicateAttributesPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertToLegacyCompileAndReplicateAttributesPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFTPU::CreateConvertToLegacyCompileAndReplicateAttributesPass(); + }); +} + +//===----------------------------------------------------------------------===// +// DecomposeReduceDatasetPass Registration +//===----------------------------------------------------------------------===// + +inline void registerDecomposeReduceDatasetPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateDecomposeReduceDatasetPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerDecomposeReduceDatasetPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateDecomposeReduceDatasetPass(); + }); +} + +//===----------------------------------------------------------------------===// +// DeviceIndexSelectorPass Registration +//===----------------------------------------------------------------------===// + +inline void registerDeviceIndexSelectorPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateDeviceIndexSelectorPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerDeviceIndexSelectorPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateDeviceIndexSelectorPass(); + }); +} + +//===----------------------------------------------------------------------===// +// DropWhileShapeInvariantInDeviceClusterPass Registration +//===----------------------------------------------------------------------===// + +inline void registerDropWhileShapeInvariantInDeviceClusterPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateDropWhileShapeInvariantInDeviceClusterPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerDropWhileShapeInvariantInDeviceClusterPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateDropWhileShapeInvariantInDeviceClusterPass(); + }); +} + +//===----------------------------------------------------------------------===// +// DropWhileShapeInvariantPass Registration +//===----------------------------------------------------------------------===// + +inline void registerDropWhileShapeInvariantPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateDropWhileShapeInvariantPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerDropWhileShapeInvariantPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateDropWhileShapeInvariantPass(); + }); +} + +//===----------------------------------------------------------------------===// +// EmbeddingPipeliningPass Registration +//===----------------------------------------------------------------------===// + +inline void registerEmbeddingPipeliningPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateEmbeddingPipeliningPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerEmbeddingPipeliningPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateEmbeddingPipeliningPass(); + }); +} + +//===----------------------------------------------------------------------===// +// EmbeddingProgramKeyPass Registration +//===----------------------------------------------------------------------===// + +inline void registerEmbeddingProgramKeyPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateEmbeddingProgramKeyPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerEmbeddingProgramKeyPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateEmbeddingProgramKeyPass(); + }); +} + +//===----------------------------------------------------------------------===// +// EmbeddingSequencingPass Registration +//===----------------------------------------------------------------------===// + +inline void registerEmbeddingSequencingPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateEmbeddingSequencingPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerEmbeddingSequencingPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateEmbeddingSequencingPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ExecutorCheckControlDependenciesPass Registration +//===----------------------------------------------------------------------===// + +inline void registerExecutorCheckControlDependenciesPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return tf_executor::CreateTFExecutorCheckControlDependenciesPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerExecutorCheckControlDependenciesPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return tf_executor::CreateTFExecutorCheckControlDependenciesPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ExecutorConvertControlToDataOutputsPass Registration +//===----------------------------------------------------------------------===// + +inline void registerExecutorConvertControlToDataOutputsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return tf_executor::CreateTFExecutorConvertControlToDataOutputsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerExecutorConvertControlToDataOutputsPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return tf_executor::CreateTFExecutorConvertControlToDataOutputsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ExecutorDialectToFunctionalPass Registration +//===----------------------------------------------------------------------===// + +inline void registerExecutorDialectToFunctionalPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return CreateExecutorDialectToFunctionalConversionPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerExecutorDialectToFunctionalPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return CreateExecutorDialectToFunctionalConversionPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ExecutorGraphPruningPass Registration +//===----------------------------------------------------------------------===// + +inline void registerExecutorGraphPruningPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return tf_executor::CreateTFExecutorGraphPruningPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerExecutorGraphPruningPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return tf_executor::CreateTFExecutorGraphPruningPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ExecutorIslandCoarseningPass Registration +//===----------------------------------------------------------------------===// + +inline void registerExecutorIslandCoarseningPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return tf_executor::CreateTFExecutorIslandCoarseningPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerExecutorIslandCoarseningPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return tf_executor::CreateTFExecutorIslandCoarseningPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ExecutorTPUV1IslandInliningPass Registration +//===----------------------------------------------------------------------===// + +inline void registerExecutorTPUV1IslandInliningPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return tf_executor::CreateTFExecutorTPUV1IslandInliningPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerExecutorTPUV1IslandInliningPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return tf_executor::CreateTFExecutorTPUV1IslandInliningPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ExecutorUpdateControlDependenciesPass Registration +//===----------------------------------------------------------------------===// + +inline void registerExecutorUpdateControlDependenciesPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return tf_executor::CreateTFExecutorUpdateControlDependenciesPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerExecutorUpdateControlDependenciesPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return tf_executor::CreateTFExecutorUpdateControlDependenciesPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ExtractHeadTailOutsideCompilationPass Registration +//===----------------------------------------------------------------------===// + +inline void registerExtractHeadTailOutsideCompilationPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateExtractHeadTailOutsideCompilationPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerExtractHeadTailOutsideCompilationPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateExtractHeadTailOutsideCompilationPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ExtractOutsideCompilationPass Registration +//===----------------------------------------------------------------------===// + +inline void registerExtractOutsideCompilationPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateExtractOutsideCompilationPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerExtractOutsideCompilationPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateExtractOutsideCompilationPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ExtractTPUCopyWithDynamicShapeOpPass Registration +//===----------------------------------------------------------------------===// + +inline void registerExtractTPUCopyWithDynamicShapeOpPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFTPU::CreateExtractTPUCopyWithDynamicShapeOpPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerExtractTPUCopyWithDynamicShapeOpPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFTPU::CreateExtractTPUCopyWithDynamicShapeOpPass(); + }); +} + +//===----------------------------------------------------------------------===// +// FunctionalControlFlowToCFGPass Registration +//===----------------------------------------------------------------------===// + +inline void registerFunctionalControlFlowToCFGPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateTFFunctionalControlFlowToCFG(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerFunctionalControlFlowToCFGPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateTFFunctionalControlFlowToCFG(); + }); +} + +//===----------------------------------------------------------------------===// +// FunctionalControlFlowToRegionsPass Registration +//===----------------------------------------------------------------------===// + +inline void registerFunctionalControlFlowToRegionsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateTFFunctionalControlFlowToRegions(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerFunctionalControlFlowToRegionsPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateTFFunctionalControlFlowToRegions(); + }); +} + +//===----------------------------------------------------------------------===// +// FunctionalToExecutorDialectConversionPass Registration +//===----------------------------------------------------------------------===// + +inline void registerFunctionalToExecutorDialectConversionPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return CreateFunctionalToExecutorDialectConversionPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerFunctionalToExecutorDialectConversionPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return CreateFunctionalToExecutorDialectConversionPass(); + }); +} + +//===----------------------------------------------------------------------===// +// FusedKernelMatcherPass Registration +//===----------------------------------------------------------------------===// + +inline void registerFusedKernelMatcherPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateFusedKernelMatcherPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerFusedKernelMatcherPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateFusedKernelMatcherPass(); + }); +} + +//===----------------------------------------------------------------------===// +// GroupByDialectPass Registration +//===----------------------------------------------------------------------===// + +inline void registerGroupByDialectPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateGroupByDialectPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerGroupByDialectPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateGroupByDialectPass(); + }); +} + +//===----------------------------------------------------------------------===// +// GuaranteeAllFuncsOneUsePass Registration +//===----------------------------------------------------------------------===// + +inline void registerGuaranteeAllFuncsOneUsePass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateGuaranteeAllFuncsOneUsePass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerGuaranteeAllFuncsOneUsePassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateGuaranteeAllFuncsOneUsePass(); + }); +} + +//===----------------------------------------------------------------------===// +// HoistLoopInvariantPass Registration +//===----------------------------------------------------------------------===// + +inline void registerHoistLoopInvariantPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateHoistLoopInvariantPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerHoistLoopInvariantPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateHoistLoopInvariantPass(); + }); +} + +//===----------------------------------------------------------------------===// +// HoistReplicateInvariantResourceWritesPass Registration +//===----------------------------------------------------------------------===// + +inline void registerHoistReplicateInvariantResourceWritesPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateHoistReplicateInvariantResourceWritesPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerHoistReplicateInvariantResourceWritesPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateHoistReplicateInvariantResourceWritesPass(); + }); +} + +//===----------------------------------------------------------------------===// +// InitTextFileToImportPass Registration +//===----------------------------------------------------------------------===// + +inline void registerInitTextFileToImportPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateInitTextFileToImportPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerInitTextFileToImportPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateInitTextFileToImportPass(); + }); +} + +//===----------------------------------------------------------------------===// +// LaunchOutliningPass Registration +//===----------------------------------------------------------------------===// + +inline void registerLaunchOutliningPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateLaunchOutliningPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerLaunchOutliningPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateLaunchOutliningPass(); + }); +} + +//===----------------------------------------------------------------------===// +// LayoutAssignmentPass Registration +//===----------------------------------------------------------------------===// + +inline void registerLayoutAssignmentPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateLayoutAssignmentPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerLayoutAssignmentPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateLayoutAssignmentPass(); + }); +} + +//===----------------------------------------------------------------------===// +// LegalizeTFGToTFPass Registration +//===----------------------------------------------------------------------===// + +inline void registerLegalizeTFGToTFPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateLegalizeTFGToTFEPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerLegalizeTFGToTFPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateLegalizeTFGToTFEPass(); + }); +} + +//===----------------------------------------------------------------------===// +// LocalizeVarHandlesPass Registration +//===----------------------------------------------------------------------===// + +inline void registerLocalizeVarHandlesPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateLocalizeVarHandlesPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerLocalizeVarHandlesPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateLocalizeVarHandlesPass(); + }); +} + +//===----------------------------------------------------------------------===// +// LowerQuantizedPass Registration +//===----------------------------------------------------------------------===// + +inline void registerLowerQuantizedPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateLowerQuantizedPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerLowerQuantizedPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateLowerQuantizedPass(); + }); +} + +//===----------------------------------------------------------------------===// +// MarkInputOutputAliasesPass Registration +//===----------------------------------------------------------------------===// + +inline void registerMarkInputOutputAliasesPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateMarkInputOutputAliasesPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerMarkInputOutputAliasesPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateMarkInputOutputAliasesPass(); + }); +} + +//===----------------------------------------------------------------------===// +// MarkOpsForOutsideCompilationPass Registration +//===----------------------------------------------------------------------===// + +inline void registerMarkOpsForOutsideCompilationPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateMarkOpsForOutsideCompilationPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerMarkOpsForOutsideCompilationPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateMarkOpsForOutsideCompilationPass(); + }); +} + +//===----------------------------------------------------------------------===// +// MaterializePassthroughOp Registration +//===----------------------------------------------------------------------===// + +inline void registerMaterializePassthroughOp() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateMaterializePassthroughOpPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerMaterializePassthroughOpPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateMaterializePassthroughOpPass(); + }); +} + +//===----------------------------------------------------------------------===// +// MergeControlFlowPass Registration +//===----------------------------------------------------------------------===// + +inline void registerMergeControlFlowPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateMergeControlFlowPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerMergeControlFlowPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateMergeControlFlowPass(); + }); +} + +//===----------------------------------------------------------------------===// +// MoveTransposesPass Registration +//===----------------------------------------------------------------------===// + +inline void registerMoveTransposesPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateMoveTransposesPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerMoveTransposesPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateMoveTransposesPass(); + }); +} + +//===----------------------------------------------------------------------===// +// NameAnonymousIteratorsPass Registration +//===----------------------------------------------------------------------===// + +inline void registerNameAnonymousIteratorsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateNameAnonymousIteratorsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerNameAnonymousIteratorsPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateNameAnonymousIteratorsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// OrderByDialectPass Registration +//===----------------------------------------------------------------------===// + +inline void registerOrderByDialectPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateOrderByDialectPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerOrderByDialectPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateOrderByDialectPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ParallelExecuteToIslandsPass Registration +//===----------------------------------------------------------------------===// + +inline void registerParallelExecuteToIslandsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateParallelExecuteToIslandsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerParallelExecuteToIslandsPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateParallelExecuteToIslandsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// PrepareTpuComputationForTfExportPass Registration +//===----------------------------------------------------------------------===// + +inline void registerPrepareTpuComputationForTfExportPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreatePrepareTpuComputationForTfExportPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerPrepareTpuComputationForTfExportPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreatePrepareTpuComputationForTfExportPass(); + }); +} + +//===----------------------------------------------------------------------===// +// PromoteResourcesToArgsPass Registration +//===----------------------------------------------------------------------===// + +inline void registerPromoteResourcesToArgsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreatePromoteResourcesToArgsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerPromoteResourcesToArgsPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreatePromoteResourcesToArgsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// PromoteVarHandlesToArgsPass Registration +//===----------------------------------------------------------------------===// + +inline void registerPromoteVarHandlesToArgsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreatePromoteVarHandlesToArgsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerPromoteVarHandlesToArgsPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreatePromoteVarHandlesToArgsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// RegionControlFlowToFunctionalPass Registration +//===----------------------------------------------------------------------===// + +inline void registerRegionControlFlowToFunctionalPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateTFRegionControlFlowToFunctional(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerRegionControlFlowToFunctionalPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateTFRegionControlFlowToFunctional(); + }); +} + +//===----------------------------------------------------------------------===// +// RemoveUnusedArgumentsPass Registration +//===----------------------------------------------------------------------===// + +inline void registerRemoveUnusedArgumentsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateRemoveUnusedArgumentsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerRemoveUnusedArgumentsPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateRemoveUnusedArgumentsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// RemoveUnusedWhileResultsPass Registration +//===----------------------------------------------------------------------===// + +inline void registerRemoveUnusedWhileResultsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateRemoveUnusedWhileResultsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerRemoveUnusedWhileResultsPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateRemoveUnusedWhileResultsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ReplicaIDToDeviceOrdinalPass Registration +//===----------------------------------------------------------------------===// + +inline void registerReplicaIDToDeviceOrdinalPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateReplicaIDToDeviceOrdinalPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerReplicaIDToDeviceOrdinalPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateReplicaIDToDeviceOrdinalPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ReplicateInvariantOpHoistingPass Registration +//===----------------------------------------------------------------------===// + +inline void registerReplicateInvariantOpHoistingPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateReplicateInvariantOpHoistingPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerReplicateInvariantOpHoistingPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateReplicateInvariantOpHoistingPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ReplicateTensorListInitOpsPass Registration +//===----------------------------------------------------------------------===// + +inline void registerReplicateTensorListInitOpsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateReplicateTensorListInitOpsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerReplicateTensorListInitOpsPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateReplicateTensorListInitOpsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ReplicateToIslandPass Registration +//===----------------------------------------------------------------------===// + +inline void registerReplicateToIslandPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateReplicateToIslandPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerReplicateToIslandPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFDevice::CreateReplicateToIslandPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ResourceDeviceInferencePass Registration +//===----------------------------------------------------------------------===// + +inline void registerResourceDeviceInferencePass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateResourceDeviceInferencePass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerResourceDeviceInferencePassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateResourceDeviceInferencePass(); + }); +} + +//===----------------------------------------------------------------------===// +// RewriteTPUEmbeddingOpsPass Registration +//===----------------------------------------------------------------------===// + +inline void registerRewriteTPUEmbeddingOpsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateRewriteTPUEmbeddingOpsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerRewriteTPUEmbeddingOpsPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateRewriteTPUEmbeddingOpsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// SimpleTFDeviceAssignmentPass Registration +//===----------------------------------------------------------------------===// + +inline void registerSimpleTFDeviceAssignmentPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateSimpleTFDeviceAssignmentPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerSimpleTFDeviceAssignmentPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateSimpleTFDeviceAssignmentPass(); + }); +} + +//===----------------------------------------------------------------------===// +// SplitIntoIslandPerOpPass Registration +//===----------------------------------------------------------------------===// + +inline void registerSplitIntoIslandPerOpPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::TF::CreateSplitIntoIslandPerOpPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerSplitIntoIslandPerOpPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::TF::CreateSplitIntoIslandPerOpPass(); + }); +} + +//===----------------------------------------------------------------------===// +// StackOpsDecompositionPass Registration +//===----------------------------------------------------------------------===// + +inline void registerStackOpsDecompositionPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateStackOpsDecompositionPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerStackOpsDecompositionPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateStackOpsDecompositionPass(); + }); +} + +//===----------------------------------------------------------------------===// +// StripNoinlineAttributePass Registration +//===----------------------------------------------------------------------===// + +inline void registerStripNoinlineAttributePass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateStripNoinlineAttributePass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerStripNoinlineAttributePassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateStripNoinlineAttributePass(); + }); +} + +//===----------------------------------------------------------------------===// +// StripTfAttributesPass Registration +//===----------------------------------------------------------------------===// + +inline void registerStripTfAttributesPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateStripTfAttributesPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerStripTfAttributesPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateStripTfAttributesPass(); + }); +} + +//===----------------------------------------------------------------------===// +// TFDataOptimizationPass Registration +//===----------------------------------------------------------------------===// + +inline void registerTFDataOptimizationPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateTFDataOptimizationPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerTFDataOptimizationPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateTFDataOptimizationPass(); + }); +} + +//===----------------------------------------------------------------------===// +// TFDeviceAssignmentByFuncAttrPass Registration +//===----------------------------------------------------------------------===// + +inline void registerTFDeviceAssignmentByFuncAttrPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateTFDeviceAssignmentByFuncAttrPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerTFDeviceAssignmentByFuncAttrPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateTFDeviceAssignmentByFuncAttrPass(); + }); +} + +//===----------------------------------------------------------------------===// +// TPUAnnotateDynamicShapeInputsPass Registration +//===----------------------------------------------------------------------===// + +inline void registerTPUAnnotateDynamicShapeInputsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFTPU::CreateTPUAnnotateDynamicShapeInputsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerTPUAnnotateDynamicShapeInputsPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFTPU::CreateTPUAnnotateDynamicShapeInputsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// TPUBridgeExecutorIslandOutliningPass Registration +//===----------------------------------------------------------------------===// + +inline void registerTPUBridgeExecutorIslandOutliningPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return tf_executor::CreateTFExecutorTPUV1IslandOutliningPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerTPUBridgeExecutorIslandOutliningPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return tf_executor::CreateTFExecutorTPUV1IslandOutliningPass(); + }); +} + +//===----------------------------------------------------------------------===// +// TPUCleanupClusterAttributesPass Registration +//===----------------------------------------------------------------------===// + +inline void registerTPUCleanupClusterAttributesPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFTPU::CreateTPUClusterCleanupAttributesPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerTPUCleanupClusterAttributesPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFTPU::CreateTPUClusterCleanupAttributesPass(); + }); +} + +//===----------------------------------------------------------------------===// +// TPUClusterFormationPass Registration +//===----------------------------------------------------------------------===// + +inline void registerTPUClusterFormationPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFTPU::CreateTPUClusterFormationPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerTPUClusterFormationPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFTPU::CreateTPUClusterFormationPass(); + }); +} + +//===----------------------------------------------------------------------===// +// TPUColocateCompositeResourceOpsPass Registration +//===----------------------------------------------------------------------===// + +inline void registerTPUColocateCompositeResourceOpsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFTPU::CreateTPUColocateCompositeResourceOps(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerTPUColocateCompositeResourceOpsPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFTPU::CreateTPUColocateCompositeResourceOps(); + }); +} + +//===----------------------------------------------------------------------===// +// TPUColocateSplitsPass Registration +//===----------------------------------------------------------------------===// + +inline void registerTPUColocateSplitsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFTPU::CreateTPUColocateSplitsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerTPUColocateSplitsPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFTPU::CreateTPUColocateSplitsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// TPUDevicePropagationPass Registration +//===----------------------------------------------------------------------===// + +inline void registerTPUDevicePropagationPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFTPU::CreateTPUDevicePropagationPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerTPUDevicePropagationPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFTPU::CreateTPUDevicePropagationPass(); + }); +} + +//===----------------------------------------------------------------------===// +// TPUDynamicLayoutPass Registration +//===----------------------------------------------------------------------===// + +inline void registerTPUDynamicLayoutPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFTPU::CreateTPUDynamicLayoutPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerTPUDynamicLayoutPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFTPU::CreateTPUDynamicLayoutPass(); + }); +} + +//===----------------------------------------------------------------------===// +// TPUHostComputationExpansionPass Registration +//===----------------------------------------------------------------------===// + +inline void registerTPUHostComputationExpansionPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFTPU::CreateTPUHostComputationExpansionPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerTPUHostComputationExpansionPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFTPU::CreateTPUHostComputationExpansionPass(); + }); +} + +//===----------------------------------------------------------------------===// +// TPUIdentityPruningPass Registration +//===----------------------------------------------------------------------===// + +inline void registerTPUIdentityPruningPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFTPU::CreateTPUIdentityPruningPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerTPUIdentityPruningPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFTPU::CreateTPUIdentityPruningPass(); + }); +} + +//===----------------------------------------------------------------------===// +// TPUMergeVariablesWithExecutePass Registration +//===----------------------------------------------------------------------===// + +inline void registerTPUMergeVariablesWithExecutePass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFTPU::CreateTPUMergeVariablesWithExecutePass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerTPUMergeVariablesWithExecutePassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFTPU::CreateTPUMergeVariablesWithExecutePass(); + }); +} + +//===----------------------------------------------------------------------===// +// TPUParallelExecuteSinkResourceWritePass Registration +//===----------------------------------------------------------------------===// + +inline void registerTPUParallelExecuteSinkResourceWritePass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFTPU::CreateTPUParallelExecuteSinkResourceWritePass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerTPUParallelExecuteSinkResourceWritePassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFTPU::CreateTPUParallelExecuteSinkResourceWritePass(); + }); +} + +//===----------------------------------------------------------------------===// +// TPUPartitionedOpConversionPass Registration +//===----------------------------------------------------------------------===// + +inline void registerTPUPartitionedOpConversionPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFTPU::CreateTPUPartitionedOpConversionPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerTPUPartitionedOpConversionPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFTPU::CreateTPUPartitionedOpConversionPass(); + }); +} + +//===----------------------------------------------------------------------===// +// TPUReorderReplicateAndPartitionedInputsPass Registration +//===----------------------------------------------------------------------===// + +inline void registerTPUReorderReplicateAndPartitionedInputsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFTPU::CreateTPUReorderReplicateAndPartitionedInputsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerTPUReorderReplicateAndPartitionedInputsPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFTPU::CreateTPUReorderReplicateAndPartitionedInputsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// TPUResourceReadForWritePass Registration +//===----------------------------------------------------------------------===// + +inline void registerTPUResourceReadForWritePass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFTPU::CreateTPUResourceReadForWritePass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerTPUResourceReadForWritePassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFTPU::CreateTPUResourceReadForWritePass(); + }); +} + +//===----------------------------------------------------------------------===// +// TPUResourceReadsWritesPartitioningPass Registration +//===----------------------------------------------------------------------===// + +inline void registerTPUResourceReadsWritesPartitioningPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFTPU::CreateTPUResourceReadsWritesPartitioningPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerTPUResourceReadsWritesPartitioningPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFTPU::CreateTPUResourceReadsWritesPartitioningPass(); + }); +} + +//===----------------------------------------------------------------------===// +// TPURewritePass Registration +//===----------------------------------------------------------------------===// + +inline void registerTPURewritePass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFTPU::CreateTPURewritePass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerTPURewritePassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFTPU::CreateTPURewritePass(); + }); +} + +//===----------------------------------------------------------------------===// +// TPUShardingIdentificationPass Registration +//===----------------------------------------------------------------------===// + +inline void registerTPUShardingIdentificationPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFTPU::CreateTPUShardingIdentificationPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerTPUShardingIdentificationPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFTPU::CreateTPUShardingIdentificationPass(); + }); +} + +//===----------------------------------------------------------------------===// +// TPUSpaceToDepthPass Registration +//===----------------------------------------------------------------------===// + +inline void registerTPUSpaceToDepthPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFTPU::CreateTPUSpaceToDepthPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerTPUSpaceToDepthPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFTPU::CreateTPUSpaceToDepthPass(); + }); +} + +//===----------------------------------------------------------------------===// +// TPUUpdateEmbeddingEnqueueOpInputsPass Registration +//===----------------------------------------------------------------------===// + +inline void registerTPUUpdateEmbeddingEnqueueOpInputsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFTPU::CreateTPUUpdateEmbeddingEnqueueOpInputsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerTPUUpdateEmbeddingEnqueueOpInputsPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFTPU::CreateTPUUpdateEmbeddingEnqueueOpInputsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// TPUValidateInputsPass Registration +//===----------------------------------------------------------------------===// + +inline void registerTPUValidateInputsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFTPU::CreateTPUValidateInputsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerTPUValidateInputsPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFTPU::CreateTPUValidateInputsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// TPUVariableRuntimeReformattingPass Registration +//===----------------------------------------------------------------------===// + +inline void registerTPUVariableRuntimeReformattingPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFTPU::CreateTPUVariableRuntimeReformattingPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerTPUVariableRuntimeReformattingPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TFTPU::CreateTPUVariableRuntimeReformattingPass(); + }); +} + +//===----------------------------------------------------------------------===// +// TensorArrayOpsDecompositionPass Registration +//===----------------------------------------------------------------------===// + +inline void registerTensorArrayOpsDecompositionPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateTensorArrayOpsDecompositionPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerTensorArrayOpsDecompositionPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateTensorArrayOpsDecompositionPass(); + }); +} + +//===----------------------------------------------------------------------===// +// TensorDeviceCopyConversionPass Registration +//===----------------------------------------------------------------------===// + +inline void registerTensorDeviceCopyConversionPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateTensorDeviceCopyConversionPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerTensorDeviceCopyConversionPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateTensorDeviceCopyConversionPass(); + }); +} + +//===----------------------------------------------------------------------===// +// TensorFlowOptimizePass Registration +//===----------------------------------------------------------------------===// + +inline void registerTensorFlowOptimizePass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateTFOptimizePass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerTensorFlowOptimizePassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateTFOptimizePass(); + }); +} + +//===----------------------------------------------------------------------===// +// TensorFlowShapeInferencePass Registration +//===----------------------------------------------------------------------===// + +inline void registerTensorFlowShapeInferencePass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateTFShapeInferencePass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerTensorFlowShapeInferencePassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateTFShapeInferencePass(); + }); +} + +//===----------------------------------------------------------------------===// +// TensorListOpsDecompositionPass Registration +//===----------------------------------------------------------------------===// + +inline void registerTensorListOpsDecompositionPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateTensorListOpsDecompositionPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerTensorListOpsDecompositionPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateTensorListOpsDecompositionPass(); + }); +} + +//===----------------------------------------------------------------------===// +// TensorflowGPUFusion Registration +//===----------------------------------------------------------------------===// + +inline void registerTensorflowGPUFusion() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateGpuOpFusionPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerTensorflowGPUFusionPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateGpuOpFusionPass(); + }); +} + +//===----------------------------------------------------------------------===// +// TpuV1BridgeExecutorIslandCoarseningPass Registration +//===----------------------------------------------------------------------===// + +inline void registerTpuV1BridgeExecutorIslandCoarseningPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return tf_executor::CreateTFExecutorTPUV1IslandCoarseningPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerTpuV1BridgeExecutorIslandCoarseningPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return tf_executor::CreateTFExecutorTPUV1IslandCoarseningPass(); + }); +} + +//===----------------------------------------------------------------------===// +// TransformEinsumPass Registration +//===----------------------------------------------------------------------===// + +inline void registerTransformEinsumPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateTransformEinsumPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerTransformEinsumPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateTransformEinsumPass(); + }); +} + +//===----------------------------------------------------------------------===// +// UnrollBatchMatMulPass Registration +//===----------------------------------------------------------------------===// + +inline void registerUnrollBatchMatMulPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateUnrollBatchMatMulPassPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerUnrollBatchMatMulPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateUnrollBatchMatMulPassPass(); + }); +} + +//===----------------------------------------------------------------------===// +// VerifySuitableForExportPass Registration +//===----------------------------------------------------------------------===// + +inline void registerVerifySuitableForExportPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateVerifySuitableForExportPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerVerifySuitableForExportPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateVerifySuitableForExportPass(); + }); +} + +//===----------------------------------------------------------------------===// +// XlaCallModuleDeserializationPass Registration +//===----------------------------------------------------------------------===// + +inline void registerXlaCallModuleDeserializationPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateXlaCallModuleDeserializationPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerXlaCallModuleDeserializationPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateXlaCallModuleDeserializationPass(); + }); +} + +//===----------------------------------------------------------------------===// +// XlaCallModuleSerializationPass Registration +//===----------------------------------------------------------------------===// + +inline void registerXlaCallModuleSerializationPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateXlaCallModuleSerializationPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerXlaCallModuleSerializationPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return TF::CreateXlaCallModuleSerializationPass(); + }); +} + +//===----------------------------------------------------------------------===// +// TensorFlow Registration +//===----------------------------------------------------------------------===// + +inline void registerTensorFlowPasses() { + registerBatchMatMulToEinsumPass(); + registerBreakUpIslandsPass(); + registerBroadcastFoldPass(); + registerCanonicalizeCompileAndReplicateAttributesPass(); + registerClusterConstantSinkingPass(); + registerClusterFormationPass(); + registerClusterOutliningPass(); + registerClusterTFOpsByHostPass(); + registerColocateTPUCopyWithDynamicShapePass(); + registerConstantOpDeviceAssignmentPass(); + registerConvertLaunchFuncToTFCallPass(); + registerConvertReadonlyReferenceVariablesToResourceVariablesPass(); + registerConvertTfControlFlowToScfPass(); + registerConvertToLegacyCompileAndReplicateAttributesPass(); + registerDecomposeReduceDatasetPass(); + registerDeviceIndexSelectorPass(); + registerDropWhileShapeInvariantInDeviceClusterPass(); + registerDropWhileShapeInvariantPass(); + registerEmbeddingPipeliningPass(); + registerEmbeddingProgramKeyPass(); + registerEmbeddingSequencingPass(); + registerExecutorCheckControlDependenciesPass(); + registerExecutorConvertControlToDataOutputsPass(); + registerExecutorDialectToFunctionalPass(); + registerExecutorGraphPruningPass(); + registerExecutorIslandCoarseningPass(); + registerExecutorTPUV1IslandInliningPass(); + registerExecutorUpdateControlDependenciesPass(); + registerExtractHeadTailOutsideCompilationPass(); + registerExtractOutsideCompilationPass(); + registerExtractTPUCopyWithDynamicShapeOpPass(); + registerFunctionalControlFlowToCFGPass(); + registerFunctionalControlFlowToRegionsPass(); + registerFunctionalToExecutorDialectConversionPass(); + registerFusedKernelMatcherPass(); + registerGroupByDialectPass(); + registerGuaranteeAllFuncsOneUsePass(); + registerHoistLoopInvariantPass(); + registerHoistReplicateInvariantResourceWritesPass(); + registerInitTextFileToImportPass(); + registerLaunchOutliningPass(); + registerLayoutAssignmentPass(); + registerLegalizeTFGToTFPass(); + registerLocalizeVarHandlesPass(); + registerLowerQuantizedPass(); + registerMarkInputOutputAliasesPass(); + registerMarkOpsForOutsideCompilationPass(); + registerMaterializePassthroughOp(); + registerMergeControlFlowPass(); + registerMoveTransposesPass(); + registerNameAnonymousIteratorsPass(); + registerOrderByDialectPass(); + registerParallelExecuteToIslandsPass(); + registerPrepareTpuComputationForTfExportPass(); + registerPromoteResourcesToArgsPass(); + registerPromoteVarHandlesToArgsPass(); + registerRegionControlFlowToFunctionalPass(); + registerRemoveUnusedArgumentsPass(); + registerRemoveUnusedWhileResultsPass(); + registerReplicaIDToDeviceOrdinalPass(); + registerReplicateInvariantOpHoistingPass(); + registerReplicateTensorListInitOpsPass(); + registerReplicateToIslandPass(); + registerResourceDeviceInferencePass(); + registerRewriteTPUEmbeddingOpsPass(); + registerSimpleTFDeviceAssignmentPass(); + registerSplitIntoIslandPerOpPass(); + registerStackOpsDecompositionPass(); + registerStripNoinlineAttributePass(); + registerStripTfAttributesPass(); + registerTFDataOptimizationPass(); + registerTFDeviceAssignmentByFuncAttrPass(); + registerTPUAnnotateDynamicShapeInputsPass(); + registerTPUBridgeExecutorIslandOutliningPass(); + registerTPUCleanupClusterAttributesPass(); + registerTPUClusterFormationPass(); + registerTPUColocateCompositeResourceOpsPass(); + registerTPUColocateSplitsPass(); + registerTPUDevicePropagationPass(); + registerTPUDynamicLayoutPass(); + registerTPUHostComputationExpansionPass(); + registerTPUIdentityPruningPass(); + registerTPUMergeVariablesWithExecutePass(); + registerTPUParallelExecuteSinkResourceWritePass(); + registerTPUPartitionedOpConversionPass(); + registerTPUReorderReplicateAndPartitionedInputsPass(); + registerTPUResourceReadForWritePass(); + registerTPUResourceReadsWritesPartitioningPass(); + registerTPURewritePass(); + registerTPUShardingIdentificationPass(); + registerTPUSpaceToDepthPass(); + registerTPUUpdateEmbeddingEnqueueOpInputsPass(); + registerTPUValidateInputsPass(); + registerTPUVariableRuntimeReformattingPass(); + registerTensorArrayOpsDecompositionPass(); + registerTensorDeviceCopyConversionPass(); + registerTensorFlowOptimizePass(); + registerTensorFlowShapeInferencePass(); + registerTensorListOpsDecompositionPass(); + registerTensorflowGPUFusion(); + registerTpuV1BridgeExecutorIslandCoarseningPass(); + registerTransformEinsumPass(); + registerUnrollBatchMatMulPass(); + registerVerifySuitableForExportPass(); + registerXlaCallModuleDeserializationPass(); + registerXlaCallModuleSerializationPass(); +} +#undef GEN_PASS_REGISTRATION +#endif // GEN_PASS_REGISTRATION +// Deprecated. Please use the new per-pass macros. +#ifdef GEN_PASS_CLASSES + +template +class BatchMatMulToEinsumPassBase : public ::mlir::OperationPass { +public: + using Base = BatchMatMulToEinsumPassBase; + + BatchMatMulToEinsumPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + BatchMatMulToEinsumPassBase(const BatchMatMulToEinsumPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-batch-matmul-to-tf-einsum"); + } + ::llvm::StringRef getArgument() const override { return "tf-batch-matmul-to-tf-einsum"; } + + ::llvm::StringRef getDescription() const override { return "Replace TF BatchMatMul op by TF Einsum op."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("BatchMatMulToEinsumPass"); + } + ::llvm::StringRef getName() const override { return "BatchMatMulToEinsumPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(BatchMatMulToEinsumPassBase) + +protected: +}; + +template +class BreakUpIslandsPassBase : public ::mlir::OperationPass { +public: + using Base = BreakUpIslandsPassBase; + + BreakUpIslandsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + BreakUpIslandsPassBase(const BreakUpIslandsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-executor-break-up-islands"); + } + ::llvm::StringRef getArgument() const override { return "tf-executor-break-up-islands"; } + + ::llvm::StringRef getDescription() const override { return "Transform from TF control dialect to TF executor dialect."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("BreakUpIslandsPass"); + } + ::llvm::StringRef getName() const override { return "BreakUpIslandsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(BreakUpIslandsPassBase) + +protected: +}; + +template +class BroadcastFoldPassBase : public ::mlir::OperationPass { +public: + using Base = BroadcastFoldPassBase; + + BroadcastFoldPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + BroadcastFoldPassBase(const BroadcastFoldPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-broadcast-fold"); + } + ::llvm::StringRef getArgument() const override { return "tf-broadcast-fold"; } + + ::llvm::StringRef getDescription() const override { return "Fold explicit broadcasts into the following operations if they support implicit broadcasting on their operand."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("BroadcastFoldPass"); + } + ::llvm::StringRef getName() const override { return "BroadcastFoldPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(BroadcastFoldPassBase) + +protected: +}; + +template +class CanonicalizeCompileAndReplicateAttributesPassBase : public ::mlir::OperationPass { +public: + using Base = CanonicalizeCompileAndReplicateAttributesPassBase; + + CanonicalizeCompileAndReplicateAttributesPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + CanonicalizeCompileAndReplicateAttributesPassBase(const CanonicalizeCompileAndReplicateAttributesPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-canonicalize-compile-and-replicate-attributes"); + } + ::llvm::StringRef getArgument() const override { return "tf-canonicalize-compile-and-replicate-attributes"; } + + ::llvm::StringRef getDescription() const override { return "Canonicalize compilation and replication attributes."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("CanonicalizeCompileAndReplicateAttributesPass"); + } + ::llvm::StringRef getName() const override { return "CanonicalizeCompileAndReplicateAttributesPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(CanonicalizeCompileAndReplicateAttributesPassBase) + +protected: +}; + +template +class ClusterConstantSinkingPassBase : public ::mlir::OperationPass { +public: + using Base = ClusterConstantSinkingPassBase; + + ClusterConstantSinkingPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ClusterConstantSinkingPassBase(const ClusterConstantSinkingPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-device-constant-sinking"); + } + ::llvm::StringRef getArgument() const override { return "tf-device-constant-sinking"; } + + ::llvm::StringRef getDescription() const override { return "Sinks constants implicitly captured in a tf_device.cluster region."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ClusterConstantSinkingPass"); + } + ::llvm::StringRef getName() const override { return "ClusterConstantSinkingPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ClusterConstantSinkingPassBase) + +protected: +}; + +template +class ClusterFormationPassBase : public ::mlir::OperationPass { +public: + using Base = ClusterFormationPassBase; + + ClusterFormationPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ClusterFormationPassBase(const ClusterFormationPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-device-cluster-formation"); + } + ::llvm::StringRef getArgument() const override { return "tf-device-cluster-formation"; } + + ::llvm::StringRef getDescription() const override { return "Form clusters from instructions assigned to same device"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ClusterFormationPass"); + } + ::llvm::StringRef getName() const override { return "ClusterFormationPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ClusterFormationPassBase) + +protected: +}; + +template +class ClusterOutliningPassBase : public ::mlir::OperationPass { +public: + using Base = ClusterOutliningPassBase; + + ClusterOutliningPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ClusterOutliningPassBase(const ClusterOutliningPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-device-cluster-outlining"); + } + ::llvm::StringRef getArgument() const override { return "tf-device-cluster-outlining"; } + + ::llvm::StringRef getDescription() const override { return "Outlines regions of tf_device.cluster operations"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ClusterOutliningPass"); + } + ::llvm::StringRef getName() const override { return "ClusterOutliningPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ClusterOutliningPassBase) + +protected: +}; + +template +class ClusterTFOpsByHostPassBase : public ::mlir::OperationPass { +public: + using Base = ClusterTFOpsByHostPassBase; + + ClusterTFOpsByHostPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ClusterTFOpsByHostPassBase(const ClusterTFOpsByHostPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("cluster-tf-ops-by-host"); + } + ::llvm::StringRef getArgument() const override { return "cluster-tf-ops-by-host"; } + + ::llvm::StringRef getDescription() const override { return "Cluster the TensorFlow ops by host so that each function only contains ops placed on the same host"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ClusterTFOpsByHostPass"); + } + ::llvm::StringRef getName() const override { return "ClusterTFOpsByHostPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ClusterTFOpsByHostPassBase) + +protected: +}; + +template +class ColocateTPUCopyWithDynamicShapePassBase : public ::mlir::OperationPass { +public: + using Base = ColocateTPUCopyWithDynamicShapePassBase; + + ColocateTPUCopyWithDynamicShapePassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ColocateTPUCopyWithDynamicShapePassBase(const ColocateTPUCopyWithDynamicShapePassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-colocate-tpu-copy-with-dynamic-shape"); + } + ::llvm::StringRef getArgument() const override { return "tf-colocate-tpu-copy-with-dynamic-shape"; } + + ::llvm::StringRef getDescription() const override { return "Adjusts the device annotation of TPUCopyWithDynamicShape ops"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ColocateTPUCopyWithDynamicShapePass"); + } + ::llvm::StringRef getName() const override { return "ColocateTPUCopyWithDynamicShapePass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ColocateTPUCopyWithDynamicShapePassBase) + +protected: +}; + +template +class ConstantOpDeviceAssignmentPassBase : public ::mlir::OperationPass { +public: + using Base = ConstantOpDeviceAssignmentPassBase; + + ConstantOpDeviceAssignmentPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConstantOpDeviceAssignmentPassBase(const ConstantOpDeviceAssignmentPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("constant-op-device-assignment"); + } + ::llvm::StringRef getArgument() const override { return "constant-op-device-assignment"; } + + ::llvm::StringRef getDescription() const override { return "Assign device for tf.Const ops"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConstantOpDeviceAssignmentPass"); + } + ::llvm::StringRef getName() const override { return "ConstantOpDeviceAssignmentPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConstantOpDeviceAssignmentPassBase) + +protected: +}; + +template +class ConvertLaunchFuncToTFCallPassBase : public ::mlir::OperationPass { +public: + using Base = ConvertLaunchFuncToTFCallPassBase; + + ConvertLaunchFuncToTFCallPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertLaunchFuncToTFCallPassBase(const ConvertLaunchFuncToTFCallPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-device-convert-launch-func-to-tf-call"); + } + ::llvm::StringRef getArgument() const override { return "tf-device-convert-launch-func-to-tf-call"; } + + ::llvm::StringRef getDescription() const override { return "Rewrites tf_device::LaunchFuncOp to TF::PartitionedCallOp"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertLaunchFuncToTFCallPass"); + } + ::llvm::StringRef getName() const override { return "ConvertLaunchFuncToTFCallPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertLaunchFuncToTFCallPassBase) + +protected: +}; + +template +class ConvertReadonlyReferenceVariablesToResourceVariablesPassBase : public ::mlir::OperationPass { +public: + using Base = ConvertReadonlyReferenceVariablesToResourceVariablesPassBase; + + ConvertReadonlyReferenceVariablesToResourceVariablesPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertReadonlyReferenceVariablesToResourceVariablesPassBase(const ConvertReadonlyReferenceVariablesToResourceVariablesPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-readonly-references-to-resources"); + } + ::llvm::StringRef getArgument() const override { return "tf-readonly-references-to-resources"; } + + ::llvm::StringRef getDescription() const override { return "Convert readonly reference variables to resource variables."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertReadonlyReferenceVariablesToResourceVariablesPass"); + } + ::llvm::StringRef getName() const override { return "ConvertReadonlyReferenceVariablesToResourceVariablesPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertReadonlyReferenceVariablesToResourceVariablesPassBase) + +protected: +}; + +template +class ConvertTfControlFlowToScfPassBase : public ::mlir::OperationPass { +public: + using Base = ConvertTfControlFlowToScfPassBase; + + ConvertTfControlFlowToScfPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertTfControlFlowToScfPassBase(const ConvertTfControlFlowToScfPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("convert-tf-control-flow-to-scf"); + } + ::llvm::StringRef getArgument() const override { return "convert-tf-control-flow-to-scf"; } + + ::llvm::StringRef getDescription() const override { return "Convert TensorFlow control flow to SCF."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertTfControlFlowToScfPass"); + } + ::llvm::StringRef getName() const override { return "ConvertTfControlFlowToScfPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertTfControlFlowToScfPassBase) + +protected: +}; + +template +class ConvertToLegacyCompileAndReplicateAttributesPassBase : public ::mlir::OperationPass { +public: + using Base = ConvertToLegacyCompileAndReplicateAttributesPassBase; + + ConvertToLegacyCompileAndReplicateAttributesPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertToLegacyCompileAndReplicateAttributesPassBase(const ConvertToLegacyCompileAndReplicateAttributesPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-convert-to-legacy-compile-and-replicate-attributes"); + } + ::llvm::StringRef getArgument() const override { return "tf-convert-to-legacy-compile-and-replicate-attributes"; } + + ::llvm::StringRef getDescription() const override { return "Convert unified compilation and replication attributes back to legacy attributes."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertToLegacyCompileAndReplicateAttributesPass"); + } + ::llvm::StringRef getName() const override { return "ConvertToLegacyCompileAndReplicateAttributesPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertToLegacyCompileAndReplicateAttributesPassBase) + +protected: +}; + +template +class DecomposeReduceDatasetPassBase : public ::mlir::OperationPass { +public: + using Base = DecomposeReduceDatasetPassBase; + + DecomposeReduceDatasetPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + DecomposeReduceDatasetPassBase(const DecomposeReduceDatasetPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-decompose-reduce-dataset"); + } + ::llvm::StringRef getArgument() const override { return "tf-decompose-reduce-dataset"; } + + ::llvm::StringRef getDescription() const override { return "Decomposes ReduceDataset op into dataset operations."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("DecomposeReduceDatasetPass"); + } + ::llvm::StringRef getName() const override { return "DecomposeReduceDatasetPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(DecomposeReduceDatasetPassBase) + +protected: +}; + +template +class DeviceIndexSelectorPassBase : public ::mlir::OperationPass { +public: + using Base = DeviceIndexSelectorPassBase; + + DeviceIndexSelectorPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + DeviceIndexSelectorPassBase(const DeviceIndexSelectorPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-device-index-selector"); + } + ::llvm::StringRef getArgument() const override { return "tf-device-index-selector"; } + + ::llvm::StringRef getDescription() const override { return "Fold tf.DeviceIndex to constant."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("DeviceIndexSelectorPass"); + } + ::llvm::StringRef getName() const override { return "DeviceIndexSelectorPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(DeviceIndexSelectorPassBase) + +protected: +}; + +template +class DropWhileShapeInvariantInDeviceClusterPassBase : public ::mlir::OperationPass { +public: + using Base = DropWhileShapeInvariantInDeviceClusterPassBase; + + DropWhileShapeInvariantInDeviceClusterPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + DropWhileShapeInvariantInDeviceClusterPassBase(const DropWhileShapeInvariantInDeviceClusterPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-drop-while-shape-invariant-in-device-cluster"); + } + ::llvm::StringRef getArgument() const override { return "tf-drop-while-shape-invariant-in-device-cluster"; } + + ::llvm::StringRef getDescription() const override { return "Drop `shape_invariant` attribute from While/WhileRegion ops inside device cluster."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("DropWhileShapeInvariantInDeviceClusterPass"); + } + ::llvm::StringRef getName() const override { return "DropWhileShapeInvariantInDeviceClusterPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(DropWhileShapeInvariantInDeviceClusterPassBase) + +protected: +}; + +template +class DropWhileShapeInvariantPassBase : public ::mlir::OperationPass { +public: + using Base = DropWhileShapeInvariantPassBase; + + DropWhileShapeInvariantPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + DropWhileShapeInvariantPassBase(const DropWhileShapeInvariantPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-drop-while-shape-invariant"); + } + ::llvm::StringRef getArgument() const override { return "tf-drop-while-shape-invariant"; } + + ::llvm::StringRef getDescription() const override { return "Drop `shape_invariant` attribute from While/WhileRegion ops."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("DropWhileShapeInvariantPass"); + } + ::llvm::StringRef getName() const override { return "DropWhileShapeInvariantPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(DropWhileShapeInvariantPassBase) + +protected: +}; + +template +class EmbeddingPipeliningPassBase : public ::mlir::OperationPass { +public: + using Base = EmbeddingPipeliningPassBase; + + EmbeddingPipeliningPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + EmbeddingPipeliningPassBase(const EmbeddingPipeliningPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-embedding-pipelining"); + } + ::llvm::StringRef getArgument() const override { return "tf-embedding-pipelining"; } + + ::llvm::StringRef getDescription() const override { return "Rewrite graph for embedding pipelining"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("EmbeddingPipeliningPass"); + } + ::llvm::StringRef getName() const override { return "EmbeddingPipeliningPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(EmbeddingPipeliningPassBase) + +protected: +}; + +template +class EmbeddingProgramKeyPassBase : public ::mlir::OperationPass { +public: + using Base = EmbeddingProgramKeyPassBase; + + EmbeddingProgramKeyPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + EmbeddingProgramKeyPassBase(const EmbeddingProgramKeyPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-embedding-program-key"); + } + ::llvm::StringRef getArgument() const override { return "tf-embedding-program-key"; } + + ::llvm::StringRef getDescription() const override { return "Sets the program key for embedding ops."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("EmbeddingProgramKeyPass"); + } + ::llvm::StringRef getName() const override { return "EmbeddingProgramKeyPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(EmbeddingProgramKeyPassBase) + +protected: +}; + +template +class EmbeddingSequencingPassBase : public ::mlir::OperationPass { +public: + using Base = EmbeddingSequencingPassBase; + + EmbeddingSequencingPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + EmbeddingSequencingPassBase(const EmbeddingSequencingPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-embedding-sequencing"); + } + ::llvm::StringRef getArgument() const override { return "tf-embedding-sequencing"; } + + ::llvm::StringRef getDescription() const override { return "Rewrite graph for sequential execution of embeddings"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("EmbeddingSequencingPass"); + } + ::llvm::StringRef getName() const override { return "EmbeddingSequencingPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(EmbeddingSequencingPassBase) + +protected: +}; + +template +class ExecutorCheckControlDependenciesPassBase : public ::mlir::OperationPass { +public: + using Base = ExecutorCheckControlDependenciesPassBase; + + ExecutorCheckControlDependenciesPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ExecutorCheckControlDependenciesPassBase(const ExecutorCheckControlDependenciesPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-executor-check-control-dependencies"); + } + ::llvm::StringRef getArgument() const override { return "tf-executor-check-control-dependencies"; } + + ::llvm::StringRef getDescription() const override { return "Checks control dependencies"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ExecutorCheckControlDependenciesPass"); + } + ::llvm::StringRef getName() const override { return "ExecutorCheckControlDependenciesPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ExecutorCheckControlDependenciesPassBase) + +protected: +}; + +template +class ExecutorConvertControlToDataOutputsPassBase : public ::mlir::OperationPass { +public: + using Base = ExecutorConvertControlToDataOutputsPassBase; + + ExecutorConvertControlToDataOutputsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ExecutorConvertControlToDataOutputsPassBase(const ExecutorConvertControlToDataOutputsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-executor-convert-control-to-data-outputs"); + } + ::llvm::StringRef getArgument() const override { return "tf-executor-convert-control-to-data-outputs"; } + + ::llvm::StringRef getDescription() const override { return "Chain control outputs of while loop body"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ExecutorConvertControlToDataOutputsPass"); + } + ::llvm::StringRef getName() const override { return "ExecutorConvertControlToDataOutputsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ExecutorConvertControlToDataOutputsPassBase) + +protected: +}; + +template +class ExecutorDialectToFunctionalPassBase : public ::mlir::OperationPass { +public: + using Base = ExecutorDialectToFunctionalPassBase; + + ExecutorDialectToFunctionalPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ExecutorDialectToFunctionalPassBase(const ExecutorDialectToFunctionalPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-executor-to-functional-conversion"); + } + ::llvm::StringRef getArgument() const override { return "tf-executor-to-functional-conversion"; } + + ::llvm::StringRef getDescription() const override { return "Lifts tf_executor.island inner ops from a tf_executor.graph"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ExecutorDialectToFunctionalPass"); + } + ::llvm::StringRef getName() const override { return "ExecutorDialectToFunctionalPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ExecutorDialectToFunctionalPassBase) + +protected: +}; + +template +class ExecutorGraphPruningPassBase : public ::mlir::OperationPass { +public: + using Base = ExecutorGraphPruningPassBase; + + ExecutorGraphPruningPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ExecutorGraphPruningPassBase(const ExecutorGraphPruningPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-executor-graph-pruning"); + } + ::llvm::StringRef getArgument() const override { return "tf-executor-graph-pruning"; } + + ::llvm::StringRef getDescription() const override { return "Prunes unreachable ops in a tf_executor.graph"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ExecutorGraphPruningPass"); + } + ::llvm::StringRef getName() const override { return "ExecutorGraphPruningPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ExecutorGraphPruningPassBase) + +protected: + ::mlir::Pass::ListOption ops_to_preserve_{*this, "ops-to-preserve", ::llvm::cl::desc("Comma separated list of ops that should not be pruned regardless of reachability")}; +}; + +template +class ExecutorIslandCoarseningPassBase : public ::mlir::OperationPass { +public: + using Base = ExecutorIslandCoarseningPassBase; + + ExecutorIslandCoarseningPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ExecutorIslandCoarseningPassBase(const ExecutorIslandCoarseningPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-executor-island-coarsening"); + } + ::llvm::StringRef getArgument() const override { return "tf-executor-island-coarsening"; } + + ::llvm::StringRef getDescription() const override { return "Walks tf_executor::GraphOp and merges individual tf_executor::IslandOps."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ExecutorIslandCoarseningPass"); + } + ::llvm::StringRef getName() const override { return "ExecutorIslandCoarseningPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ExecutorIslandCoarseningPassBase) + +protected: +}; + +template +class ExecutorTPUV1IslandInliningPassBase : public ::mlir::OperationPass { +public: + using Base = ExecutorTPUV1IslandInliningPassBase; + + ExecutorTPUV1IslandInliningPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ExecutorTPUV1IslandInliningPassBase(const ExecutorTPUV1IslandInliningPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-executor-tpu-v1-island-inlining"); + } + ::llvm::StringRef getArgument() const override { return "tf-executor-tpu-v1-island-inlining"; } + + ::llvm::StringRef getDescription() const override { return "Inline calls to the nested TPU module."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ExecutorTPUV1IslandInliningPass"); + } + ::llvm::StringRef getName() const override { return "ExecutorTPUV1IslandInliningPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ExecutorTPUV1IslandInliningPassBase) + +protected: +}; + +template +class ExecutorUpdateControlDependenciesPassBase : public ::mlir::OperationPass { +public: + using Base = ExecutorUpdateControlDependenciesPassBase; + + ExecutorUpdateControlDependenciesPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ExecutorUpdateControlDependenciesPassBase(const ExecutorUpdateControlDependenciesPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-executor-update-control-dependencies"); + } + ::llvm::StringRef getArgument() const override { return "tf-executor-update-control-dependencies"; } + + ::llvm::StringRef getDescription() const override { return "Computes and applies all necessary control dependencies based on side effect analysis."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ExecutorUpdateControlDependenciesPass"); + } + ::llvm::StringRef getName() const override { return "ExecutorUpdateControlDependenciesPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ExecutorUpdateControlDependenciesPassBase) + +protected: +}; + +template +class ExtractHeadTailOutsideCompilationPassBase : public ::mlir::OperationPass { +public: + using Base = ExtractHeadTailOutsideCompilationPassBase; + + ExtractHeadTailOutsideCompilationPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ExtractHeadTailOutsideCompilationPassBase(const ExtractHeadTailOutsideCompilationPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-extract-head-tail-outside-compilation"); + } + ::llvm::StringRef getArgument() const override { return "tf-extract-head-tail-outside-compilation"; } + + ::llvm::StringRef getDescription() const override { return "Extracts head or tail outside compilation to separate host launches before/after device cluster."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ExtractHeadTailOutsideCompilationPass"); + } + ::llvm::StringRef getName() const override { return "ExtractHeadTailOutsideCompilationPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ExtractHeadTailOutsideCompilationPassBase) + +protected: +}; + +template +class ExtractOutsideCompilationPassBase : public ::mlir::OperationPass { +public: + using Base = ExtractOutsideCompilationPassBase; + + ExtractOutsideCompilationPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ExtractOutsideCompilationPassBase(const ExtractOutsideCompilationPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-extract-outside-compilation"); + } + ::llvm::StringRef getArgument() const override { return "tf-extract-outside-compilation"; } + + ::llvm::StringRef getDescription() const override { return "Extracts device outside compilation computation to a separate tf_device.parallel_execute region."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ExtractOutsideCompilationPass"); + } + ::llvm::StringRef getName() const override { return "ExtractOutsideCompilationPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ExtractOutsideCompilationPassBase) + +protected: +}; + +template +class ExtractTPUCopyWithDynamicShapeOpPassBase : public ::mlir::OperationPass { +public: + using Base = ExtractTPUCopyWithDynamicShapeOpPassBase; + + ExtractTPUCopyWithDynamicShapeOpPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ExtractTPUCopyWithDynamicShapeOpPassBase(const ExtractTPUCopyWithDynamicShapeOpPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-extract-tpu-copy-with-dynamic-shape-op"); + } + ::llvm::StringRef getArgument() const override { return "tf-extract-tpu-copy-with-dynamic-shape-op"; } + + ::llvm::StringRef getDescription() const override { return "Extract the TPUCopyWithDynamicShapeOp out of the host launch and place it on device launch"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ExtractTPUCopyWithDynamicShapeOpPass"); + } + ::llvm::StringRef getName() const override { return "ExtractTPUCopyWithDynamicShapeOpPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ExtractTPUCopyWithDynamicShapeOpPassBase) + +protected: +}; + +template +class FunctionalControlFlowToCFGPassBase : public ::mlir::OperationPass { +public: + using Base = FunctionalControlFlowToCFGPassBase; + + FunctionalControlFlowToCFGPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + FunctionalControlFlowToCFGPassBase(const FunctionalControlFlowToCFGPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-functional-control-flow-to-cfg"); + } + ::llvm::StringRef getArgument() const override { return "tf-functional-control-flow-to-cfg"; } + + ::llvm::StringRef getDescription() const override { return "Transform functional control flow Ops to MLIR Control Form Graph (CFG) form"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("FunctionalControlFlowToCFGPass"); + } + ::llvm::StringRef getName() const override { return "FunctionalControlFlowToCFGPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(FunctionalControlFlowToCFGPassBase) + +protected: +}; + +template +class FunctionalControlFlowToRegionsPassBase : public ::mlir::OperationPass { +public: + using Base = FunctionalControlFlowToRegionsPassBase; + + FunctionalControlFlowToRegionsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + FunctionalControlFlowToRegionsPassBase(const FunctionalControlFlowToRegionsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-functional-control-flow-to-regions"); + } + ::llvm::StringRef getArgument() const override { return "tf-functional-control-flow-to-regions"; } + + ::llvm::StringRef getDescription() const override { return "Transforms functional control flow operations to their region-based counterparts"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("FunctionalControlFlowToRegionsPass"); + } + ::llvm::StringRef getName() const override { return "FunctionalControlFlowToRegionsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(FunctionalControlFlowToRegionsPassBase) + +protected: + ::mlir::Pass::Option allow_passthrough_args_{*this, "allow-passthrough-args", ::llvm::cl::desc("Allows to switch on passthrough args for control flow logic. This allows the pass to create blocks that better match MLIR interfaces, but might break assumptions in existing passes."), ::llvm::cl::init(false)}; +}; + +template +class FunctionalToExecutorDialectConversionPassBase : public ::mlir::OperationPass { +public: + using Base = FunctionalToExecutorDialectConversionPassBase; + + FunctionalToExecutorDialectConversionPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + FunctionalToExecutorDialectConversionPassBase(const FunctionalToExecutorDialectConversionPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-functional-to-executor-conversion"); + } + ::llvm::StringRef getArgument() const override { return "tf-functional-to-executor-conversion"; } + + ::llvm::StringRef getDescription() const override { return "Transform from func op to TF executor dialect."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("FunctionalToExecutorDialectConversionPass"); + } + ::llvm::StringRef getName() const override { return "FunctionalToExecutorDialectConversionPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(FunctionalToExecutorDialectConversionPassBase) + +protected: +}; + +template +class FusedKernelMatcherPassBase : public ::mlir::OperationPass { +public: + using Base = FusedKernelMatcherPassBase; + + FusedKernelMatcherPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + FusedKernelMatcherPassBase(const FusedKernelMatcherPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-fused-kernel-matcher"); + } + ::llvm::StringRef getArgument() const override { return "tf-fused-kernel-matcher"; } + + ::llvm::StringRef getDescription() const override { return "Matches computations corresponding to optimized fused kernels"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("FusedKernelMatcherPass"); + } + ::llvm::StringRef getName() const override { return "FusedKernelMatcherPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(FusedKernelMatcherPassBase) + +protected: +}; + +template +class GroupByDialectPassBase : public ::mlir::OperationPass { +public: + using Base = GroupByDialectPassBase; + + GroupByDialectPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + GroupByDialectPassBase(const GroupByDialectPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-group-by-dialect"); + } + ::llvm::StringRef getArgument() const override { return "tf-group-by-dialect"; } + + ::llvm::StringRef getDescription() const override { return "Groups ops into functions that only contain one dialect."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("GroupByDialectPass"); + } + ::llvm::StringRef getName() const override { return "GroupByDialectPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(GroupByDialectPassBase) + +protected: +}; + +template +class GuaranteeAllFuncsOneUsePassBase : public ::mlir::OperationPass { +public: + using Base = GuaranteeAllFuncsOneUsePassBase; + + GuaranteeAllFuncsOneUsePassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + GuaranteeAllFuncsOneUsePassBase(const GuaranteeAllFuncsOneUsePassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-guarantee-all-funcs-one-use"); + } + ::llvm::StringRef getArgument() const override { return "tf-guarantee-all-funcs-one-use"; } + + ::llvm::StringRef getDescription() const override { return "Guarantee all FuncOp's have only a single use."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("GuaranteeAllFuncsOneUsePass"); + } + ::llvm::StringRef getName() const override { return "GuaranteeAllFuncsOneUsePass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(GuaranteeAllFuncsOneUsePassBase) + +protected: +}; + +template +class HoistLoopInvariantPassBase : public ::mlir::OperationPass { +public: + using Base = HoistLoopInvariantPassBase; + + HoistLoopInvariantPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + HoistLoopInvariantPassBase(const HoistLoopInvariantPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-hoist-loop-invariant"); + } + ::llvm::StringRef getArgument() const override { return "tf-hoist-loop-invariant"; } + + ::llvm::StringRef getDescription() const override { return "Hoists loop invariant ops to the outside of the loop"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("HoistLoopInvariantPass"); + } + ::llvm::StringRef getName() const override { return "HoistLoopInvariantPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(HoistLoopInvariantPassBase) + +protected: +}; + +template +class HoistReplicateInvariantResourceWritesPassBase : public ::mlir::OperationPass { +public: + using Base = HoistReplicateInvariantResourceWritesPassBase; + + HoistReplicateInvariantResourceWritesPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + HoistReplicateInvariantResourceWritesPassBase(const HoistReplicateInvariantResourceWritesPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-hoist-replicate-invariant-resource-writes"); + } + ::llvm::StringRef getArgument() const override { return "tf-hoist-replicate-invariant-resource-writes"; } + + ::llvm::StringRef getDescription() const override { return "Hoists writes to replicate invariant resource variables."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("HoistReplicateInvariantResourceWritesPass"); + } + ::llvm::StringRef getName() const override { return "HoistReplicateInvariantResourceWritesPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(HoistReplicateInvariantResourceWritesPassBase) + +protected: +}; + +template +class InitTextFileToImportPassBase : public ::mlir::OperationPass { +public: + using Base = InitTextFileToImportPassBase; + + InitTextFileToImportPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + InitTextFileToImportPassBase(const InitTextFileToImportPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-init-text-file-to-import"); + } + ::llvm::StringRef getArgument() const override { return "tf-init-text-file-to-import"; } + + ::llvm::StringRef getDescription() const override { return "convert InitializeTableFromTextFileV2 ops to LookupTableImportV2Op to remove the dependency on asset files"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("InitTextFileToImportPass"); + } + ::llvm::StringRef getName() const override { return "InitTextFileToImportPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(InitTextFileToImportPassBase) + +protected: + ::mlir::Pass::Option saved_model_dir_{*this, "tf-saved-model-dir", ::llvm::cl::desc("Directory containing the model exported as a TensorFlow SavedModel. If your model is not based on the TensorFlow SavedModel, use an empty value.")}; +}; + +template +class LaunchOutliningPassBase : public ::mlir::OperationPass { +public: + using Base = LaunchOutliningPassBase; + + LaunchOutliningPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + LaunchOutliningPassBase(const LaunchOutliningPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-device-launch-outlining"); + } + ::llvm::StringRef getArgument() const override { return "tf-device-launch-outlining"; } + + ::llvm::StringRef getDescription() const override { return "Outlines regions of tf_device.launch operations"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LaunchOutliningPass"); + } + ::llvm::StringRef getName() const override { return "LaunchOutliningPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LaunchOutliningPassBase) + +protected: + ::mlir::Pass::Option globally_unique_func_names_{*this, "globally-unique-func-names", ::llvm::cl::desc("If true, the pass adds extra identifiers to make function names globally unique within a process, not just within a module."), ::llvm::cl::init(true)}; +}; + +template +class LayoutAssignmentPassBase : public ::mlir::OperationPass { +public: + using Base = LayoutAssignmentPassBase; + + LayoutAssignmentPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + LayoutAssignmentPassBase(const LayoutAssignmentPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-layout-assignment"); + } + ::llvm::StringRef getArgument() const override { return "tf-layout-assignment"; } + + ::llvm::StringRef getDescription() const override { return "Layout assignment pass."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LayoutAssignmentPass"); + } + ::llvm::StringRef getName() const override { return "LayoutAssignmentPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LayoutAssignmentPassBase) + +protected: + ::mlir::Pass::Option force_data_format_{*this, "force-data-format", ::llvm::cl::desc("Force data format for all layout sensitive ops.")}; +}; + +template +class LegalizeTFGToTFPassBase : public ::mlir::OperationPass { +public: + using Base = LegalizeTFGToTFPassBase; + + LegalizeTFGToTFPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + LegalizeTFGToTFPassBase(const LegalizeTFGToTFPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tfe-legalize-tfg"); + } + ::llvm::StringRef getArgument() const override { return "tfe-legalize-tfg"; } + + ::llvm::StringRef getDescription() const override { return "Legalize from TFG to the TFE dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LegalizeTFGToTFPass"); + } + ::llvm::StringRef getName() const override { return "LegalizeTFGToTFPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LegalizeTFGToTFPassBase) + +protected: +}; + +template +class LocalizeVarHandlesPassBase : public ::mlir::OperationPass { +public: + using Base = LocalizeVarHandlesPassBase; + + LocalizeVarHandlesPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + LocalizeVarHandlesPassBase(const LocalizeVarHandlesPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-localize-var-handles"); + } + ::llvm::StringRef getArgument() const override { return "tf-localize-var-handles"; } + + ::llvm::StringRef getDescription() const override { return "Creates VarHandleOps next to the operations that use them."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LocalizeVarHandlesPass"); + } + ::llvm::StringRef getName() const override { return "LocalizeVarHandlesPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LocalizeVarHandlesPassBase) + +protected: +}; + +template +class LowerQuantizedPassBase : public ::mlir::OperationPass { +public: + using Base = LowerQuantizedPassBase; + + LowerQuantizedPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + LowerQuantizedPassBase(const LowerQuantizedPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-lower-quantized"); + } + ::llvm::StringRef getArgument() const override { return "tf-lower-quantized"; } + + ::llvm::StringRef getDescription() const override { return "Lowers ops that require quantized input or output."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LowerQuantizedPass"); + } + ::llvm::StringRef getName() const override { return "LowerQuantizedPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LowerQuantizedPassBase) + +protected: +}; + +template +class MarkInputOutputAliasesPassBase : public ::mlir::OperationPass { +public: + using Base = MarkInputOutputAliasesPassBase; + + MarkInputOutputAliasesPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + MarkInputOutputAliasesPassBase(const MarkInputOutputAliasesPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-device-mark-input-output-aliases"); + } + ::llvm::StringRef getArgument() const override { return "tf-device-mark-input-output-aliases"; } + + ::llvm::StringRef getDescription() const override { return "Marks device cluster inputs-output pairs that read/write to the same variable as aliases"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("MarkInputOutputAliasesPass"); + } + ::llvm::StringRef getName() const override { return "MarkInputOutputAliasesPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(MarkInputOutputAliasesPassBase) + +protected: +}; + +template +class MarkOpsForOutsideCompilationPassBase : public ::mlir::OperationPass { +public: + using Base = MarkOpsForOutsideCompilationPassBase; + + MarkOpsForOutsideCompilationPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + MarkOpsForOutsideCompilationPassBase(const MarkOpsForOutsideCompilationPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-mark-ops-for-outside-compilation"); + } + ::llvm::StringRef getArgument() const override { return "tf-mark-ops-for-outside-compilation"; } + + ::llvm::StringRef getDescription() const override { return "Marks ops in device cluster for outside compilation if they are unsupported on device."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("MarkOpsForOutsideCompilationPass"); + } + ::llvm::StringRef getName() const override { return "MarkOpsForOutsideCompilationPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(MarkOpsForOutsideCompilationPassBase) + +protected: +}; + +template +class MaterializePassthroughOpBase : public ::mlir::OperationPass { +public: + using Base = MaterializePassthroughOpBase; + + MaterializePassthroughOpBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + MaterializePassthroughOpBase(const MaterializePassthroughOpBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-materialize-passthrough-op"); + } + ::llvm::StringRef getArgument() const override { return "tf-materialize-passthrough-op"; } + + ::llvm::StringRef getDescription() const override { return "Materialize the MlirPassthroughOp by replacing it with the MLIR module attached as an attribute"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("MaterializePassthroughOp"); + } + ::llvm::StringRef getName() const override { return "MaterializePassthroughOp"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(MaterializePassthroughOpBase) + +protected: +}; + +template +class MergeControlFlowPassBase : public ::mlir::OperationPass { +public: + using Base = MergeControlFlowPassBase; + + MergeControlFlowPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + MergeControlFlowPassBase(const MergeControlFlowPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-merge-control-flow"); + } + ::llvm::StringRef getArgument() const override { return "tf-merge-control-flow"; } + + ::llvm::StringRef getDescription() const override { return "Merges IfRegion ops together with a common predicate."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("MergeControlFlowPass"); + } + ::llvm::StringRef getName() const override { return "MergeControlFlowPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(MergeControlFlowPassBase) + +protected: +}; + +template +class MoveTransposesPassBase : public ::mlir::OperationPass { +public: + using Base = MoveTransposesPassBase; + + MoveTransposesPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + MoveTransposesPassBase(const MoveTransposesPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-move-transposes"); + } + ::llvm::StringRef getArgument() const override { return "tf-move-transposes"; } + + ::llvm::StringRef getDescription() const override { return "Move transposes pass."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("MoveTransposesPass"); + } + ::llvm::StringRef getName() const override { return "MoveTransposesPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(MoveTransposesPassBase) + +protected: + ::mlir::Pass::Option fold_transpose_in_ops_{*this, "fold-transpose-in-ops", ::llvm::cl::desc("Whether to fold transposes in ops which can support folding."), ::llvm::cl::init(true)}; + ::mlir::Pass::Option direction_{*this, "direction", ::llvm::cl::desc("Move transposes to the beginning or the end of the block where they are defined."), ::llvm::cl::init(MoveTransposeDirection::kBegin), llvm::cl::values(clEnumValN(MoveTransposeDirection::kBegin, "begin", "beginning of the block"),clEnumValN(MoveTransposeDirection::kEnd, "end", "end of the block"))}; +}; + +template +class NameAnonymousIteratorsPassBase : public ::mlir::OperationPass { +public: + using Base = NameAnonymousIteratorsPassBase; + + NameAnonymousIteratorsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + NameAnonymousIteratorsPassBase(const NameAnonymousIteratorsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-name-anonymous-iterators"); + } + ::llvm::StringRef getArgument() const override { return "tf-name-anonymous-iterators"; } + + ::llvm::StringRef getDescription() const override { return "Converts anonymous iterators to named iterators"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("NameAnonymousIteratorsPass"); + } + ::llvm::StringRef getName() const override { return "NameAnonymousIteratorsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(NameAnonymousIteratorsPassBase) + +protected: +}; + +template +class OrderByDialectPassBase : public ::mlir::OperationPass { +public: + using Base = OrderByDialectPassBase; + + OrderByDialectPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + OrderByDialectPassBase(const OrderByDialectPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-order-by-dialect"); + } + ::llvm::StringRef getArgument() const override { return "tf-order-by-dialect"; } + + ::llvm::StringRef getDescription() const override { return "Reorders ops so ops of the same dialect are next to each other."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("OrderByDialectPass"); + } + ::llvm::StringRef getName() const override { return "OrderByDialectPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(OrderByDialectPassBase) + +protected: +}; + +template +class ParallelExecuteToIslandsPassBase : public ::mlir::OperationPass { +public: + using Base = ParallelExecuteToIslandsPassBase; + + ParallelExecuteToIslandsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ParallelExecuteToIslandsPassBase(const ParallelExecuteToIslandsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-parallel-execute-to-islands"); + } + ::llvm::StringRef getArgument() const override { return "tf-parallel-execute-to-islands"; } + + ::llvm::StringRef getDescription() const override { return "Lowers device parallel_execute to executor islands"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ParallelExecuteToIslandsPass"); + } + ::llvm::StringRef getName() const override { return "ParallelExecuteToIslandsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ParallelExecuteToIslandsPassBase) + +protected: + ::mlir::Pass::Option legacy_graph_export_{*this, "legacy-graph-export", ::llvm::cl::desc("Determines whether or not this pass should execute logic that is reserved for the legacy graph export pipeline to maintain expected invariants. In the case of this pass, that means manually propagating controls to lifted parallel execute regions to the graph fetch to ensure the ops execute."), ::llvm::cl::init(true)}; +}; + +template +class PrepareTpuComputationForTfExportPassBase : public ::mlir::OperationPass { +public: + using Base = PrepareTpuComputationForTfExportPassBase; + + PrepareTpuComputationForTfExportPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + PrepareTpuComputationForTfExportPassBase(const PrepareTpuComputationForTfExportPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("prepare-tpu-computation-for-tf-export"); + } + ::llvm::StringRef getArgument() const override { return "prepare-tpu-computation-for-tf-export"; } + + ::llvm::StringRef getDescription() const override { return "Prepare TPU computation to be legal for export to TensorFlow"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("PrepareTpuComputationForTfExportPass"); + } + ::llvm::StringRef getName() const override { return "PrepareTpuComputationForTfExportPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(PrepareTpuComputationForTfExportPassBase) + +protected: +}; + +template +class PromoteResourcesToArgsPassBase : public ::mlir::OperationPass { +public: + using Base = PromoteResourcesToArgsPassBase; + + PromoteResourcesToArgsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + PromoteResourcesToArgsPassBase(const PromoteResourcesToArgsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-promote-resources-to-args"); + } + ::llvm::StringRef getArgument() const override { return "tf-promote-resources-to-args"; } + + ::llvm::StringRef getDescription() const override { return "Promote resources reads/writes to function inputs/outputs."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("PromoteResourcesToArgsPass"); + } + ::llvm::StringRef getName() const override { return "PromoteResourcesToArgsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(PromoteResourcesToArgsPassBase) + +protected: + ::mlir::Pass::ListOption functions_{*this, "functions", ::llvm::cl::desc("Comma separated list of functions whose resources read/writes should be promoted to function inputs/outputs.")}; +}; + +template +class PromoteVarHandlesToArgsPassBase : public ::mlir::OperationPass { +public: + using Base = PromoteVarHandlesToArgsPassBase; + + PromoteVarHandlesToArgsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + PromoteVarHandlesToArgsPassBase(const PromoteVarHandlesToArgsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-promote-var-handles-to-args"); + } + ::llvm::StringRef getArgument() const override { return "tf-promote-var-handles-to-args"; } + + ::llvm::StringRef getDescription() const override { return "Promote tf.VarHandleOps to function arguments."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("PromoteVarHandlesToArgsPass"); + } + ::llvm::StringRef getName() const override { return "PromoteVarHandlesToArgsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(PromoteVarHandlesToArgsPassBase) + +protected: +}; + +template +class RegionControlFlowToFunctionalPassBase : public ::mlir::OperationPass { +public: + using Base = RegionControlFlowToFunctionalPassBase; + + RegionControlFlowToFunctionalPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + RegionControlFlowToFunctionalPassBase(const RegionControlFlowToFunctionalPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-region-control-flow-to-functional"); + } + ::llvm::StringRef getArgument() const override { return "tf-region-control-flow-to-functional"; } + + ::llvm::StringRef getDescription() const override { return "Transforms region-based control flow operations to their functional counterparts"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("RegionControlFlowToFunctionalPass"); + } + ::llvm::StringRef getName() const override { return "RegionControlFlowToFunctionalPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(RegionControlFlowToFunctionalPassBase) + +protected: +}; + +template +class RemoveUnusedArgumentsPassBase : public ::mlir::OperationPass { +public: + using Base = RemoveUnusedArgumentsPassBase; + + RemoveUnusedArgumentsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + RemoveUnusedArgumentsPassBase(const RemoveUnusedArgumentsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-remove-unused-arguments"); + } + ::llvm::StringRef getArgument() const override { return "tf-remove-unused-arguments"; } + + ::llvm::StringRef getDescription() const override { return "Removes unused args from private functions & their callers."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("RemoveUnusedArgumentsPass"); + } + ::llvm::StringRef getName() const override { return "RemoveUnusedArgumentsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(RemoveUnusedArgumentsPassBase) + +protected: +}; + +template +class RemoveUnusedWhileResultsPassBase : public ::mlir::OperationPass { +public: + using Base = RemoveUnusedWhileResultsPassBase; + + RemoveUnusedWhileResultsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + RemoveUnusedWhileResultsPassBase(const RemoveUnusedWhileResultsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-remove-unused-while-results"); + } + ::llvm::StringRef getArgument() const override { return "tf-remove-unused-while-results"; } + + ::llvm::StringRef getDescription() const override { return "Removes unused results from tf.WhileRegion ops"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("RemoveUnusedWhileResultsPass"); + } + ::llvm::StringRef getName() const override { return "RemoveUnusedWhileResultsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(RemoveUnusedWhileResultsPassBase) + +protected: +}; + +template +class ReplicaIDToDeviceOrdinalPassBase : public ::mlir::OperationPass { +public: + using Base = ReplicaIDToDeviceOrdinalPassBase; + + ReplicaIDToDeviceOrdinalPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ReplicaIDToDeviceOrdinalPassBase(const ReplicaIDToDeviceOrdinalPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-replica-id-to-device-ordinal"); + } + ::llvm::StringRef getArgument() const override { return "tf-replica-id-to-device-ordinal"; } + + ::llvm::StringRef getDescription() const override { return "Set device ordinal with replica id"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ReplicaIDToDeviceOrdinalPass"); + } + ::llvm::StringRef getName() const override { return "ReplicaIDToDeviceOrdinalPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ReplicaIDToDeviceOrdinalPassBase) + +protected: +}; + +template +class ReplicateInvariantOpHoistingPassBase : public ::mlir::OperationPass { +public: + using Base = ReplicateInvariantOpHoistingPassBase; + + ReplicateInvariantOpHoistingPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ReplicateInvariantOpHoistingPassBase(const ReplicateInvariantOpHoistingPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-replicate-invariant-op-hoisting"); + } + ::llvm::StringRef getArgument() const override { return "tf-replicate-invariant-op-hoisting"; } + + ::llvm::StringRef getDescription() const override { return "Hoists replicate invariant operations out of replicate"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ReplicateInvariantOpHoistingPass"); + } + ::llvm::StringRef getName() const override { return "ReplicateInvariantOpHoistingPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ReplicateInvariantOpHoistingPassBase) + +protected: +}; + +template +class ReplicateTensorListInitOpsPassBase : public ::mlir::OperationPass { +public: + using Base = ReplicateTensorListInitOpsPassBase; + + ReplicateTensorListInitOpsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ReplicateTensorListInitOpsPassBase(const ReplicateTensorListInitOpsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-replicate-tensor-list-init-ops"); + } + ::llvm::StringRef getArgument() const override { return "tf-replicate-tensor-list-init-ops"; } + + ::llvm::StringRef getDescription() const override { return "Replicate TensorList init ops for correct shape assignments in shape inference"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ReplicateTensorListInitOpsPass"); + } + ::llvm::StringRef getName() const override { return "ReplicateTensorListInitOpsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ReplicateTensorListInitOpsPassBase) + +protected: +}; + +template +class ReplicateToIslandPassBase : public ::mlir::OperationPass { +public: + using Base = ReplicateToIslandPassBase; + + ReplicateToIslandPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ReplicateToIslandPassBase(const ReplicateToIslandPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-replicate-to-island"); + } + ::llvm::StringRef getArgument() const override { return "tf-replicate-to-island"; } + + ::llvm::StringRef getDescription() const override { return "Lowers device replicate to executor islands"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ReplicateToIslandPass"); + } + ::llvm::StringRef getName() const override { return "ReplicateToIslandPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ReplicateToIslandPassBase) + +protected: + ::mlir::Pass::Option legacy_graph_export_{*this, "legacy-graph-export", ::llvm::cl::desc("Determines whether or not this pass should execute logic that is reserved for the legacy graph export pipeline to maintain expected invariants. In the case of this pass, that means manually propagating controls to lifted parallel execute regions to the graph fetch to ensure the ops execute, as well as determining whether or not the islands created by this pass should be split after the replicated ops have been lifted."), ::llvm::cl::init(true)}; +}; + +template +class ResourceDeviceInferencePassBase : public ::mlir::OperationPass { +public: + using Base = ResourceDeviceInferencePassBase; + + ResourceDeviceInferencePassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ResourceDeviceInferencePassBase(const ResourceDeviceInferencePassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-resource-device-inference"); + } + ::llvm::StringRef getArgument() const override { return "tf-resource-device-inference"; } + + ::llvm::StringRef getDescription() const override { return "Propagates the device attribute on resources from callers to callees."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ResourceDeviceInferencePass"); + } + ::llvm::StringRef getName() const override { return "ResourceDeviceInferencePass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ResourceDeviceInferencePassBase) + +protected: +}; + +template +class RewriteTPUEmbeddingOpsPassBase : public ::mlir::OperationPass { +public: + using Base = RewriteTPUEmbeddingOpsPassBase; + + RewriteTPUEmbeddingOpsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + RewriteTPUEmbeddingOpsPassBase(const RewriteTPUEmbeddingOpsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-rewrite-tpu-embedding-ops"); + } + ::llvm::StringRef getArgument() const override { return "tf-rewrite-tpu-embedding-ops"; } + + ::llvm::StringRef getDescription() const override { return "Rewrites TPU embedding send/recv ops by adding TPU embedding deduplication data"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("RewriteTPUEmbeddingOpsPass"); + } + ::llvm::StringRef getName() const override { return "RewriteTPUEmbeddingOpsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(RewriteTPUEmbeddingOpsPassBase) + +protected: +}; + +template +class SimpleTFDeviceAssignmentPassBase : public ::mlir::OperationPass { +public: + using Base = SimpleTFDeviceAssignmentPassBase; + + SimpleTFDeviceAssignmentPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + SimpleTFDeviceAssignmentPassBase(const SimpleTFDeviceAssignmentPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-simple-device-assignment"); + } + ::llvm::StringRef getArgument() const override { return "tf-simple-device-assignment"; } + + ::llvm::StringRef getDescription() const override { return "Simple device assignment in TF dialect."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("SimpleTFDeviceAssignmentPass"); + } + ::llvm::StringRef getName() const override { return "SimpleTFDeviceAssignmentPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(SimpleTFDeviceAssignmentPassBase) + +protected: + ::mlir::Pass::Option default_device_{*this, "default-device", ::llvm::cl::desc("The default device to assign."), ::llvm::cl::init("cpu")}; +}; + +template +class SplitIntoIslandPerOpPassBase : public ::mlir::OperationPass { +public: + using Base = SplitIntoIslandPerOpPassBase; + + SplitIntoIslandPerOpPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + SplitIntoIslandPerOpPassBase(const SplitIntoIslandPerOpPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-executor-split-into-island-per-op"); + } + ::llvm::StringRef getArgument() const override { return "tf-executor-split-into-island-per-op"; } + + ::llvm::StringRef getDescription() const override { return "Transform from TF control dialect to TF executor dialect."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("SplitIntoIslandPerOpPass"); + } + ::llvm::StringRef getName() const override { return "SplitIntoIslandPerOpPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(SplitIntoIslandPerOpPassBase) + +protected: +}; + +template +class StackOpsDecompositionPassBase : public ::mlir::OperationPass { +public: + using Base = StackOpsDecompositionPassBase; + + StackOpsDecompositionPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + StackOpsDecompositionPassBase(const StackOpsDecompositionPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-stack-ops-decomposition"); + } + ::llvm::StringRef getArgument() const override { return "tf-stack-ops-decomposition"; } + + ::llvm::StringRef getDescription() const override { return "Decompose stack operations into local variable operations. Needs static shapes."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("StackOpsDecompositionPass"); + } + ::llvm::StringRef getName() const override { return "StackOpsDecompositionPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(StackOpsDecompositionPassBase) + +protected: +}; + +template +class StripNoinlineAttributePassBase : public ::mlir::OperationPass { +public: + using Base = StripNoinlineAttributePassBase; + + StripNoinlineAttributePassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + StripNoinlineAttributePassBase(const StripNoinlineAttributePassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-strip-noinline-attribute"); + } + ::llvm::StringRef getArgument() const override { return "tf-strip-noinline-attribute"; } + + ::llvm::StringRef getDescription() const override { return "Strip the tf._noinline attribute from top-level functions."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("StripNoinlineAttributePass"); + } + ::llvm::StringRef getName() const override { return "StripNoinlineAttributePass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(StripNoinlineAttributePassBase) + +protected: +}; + +template +class StripTfAttributesPassBase : public ::mlir::OperationPass { +public: + using Base = StripTfAttributesPassBase; + + StripTfAttributesPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + StripTfAttributesPassBase(const StripTfAttributesPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-strip-tf-attributes"); + } + ::llvm::StringRef getArgument() const override { return "tf-strip-tf-attributes"; } + + ::llvm::StringRef getDescription() const override { return "Removes TF specific attributes"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("StripTfAttributesPass"); + } + ::llvm::StringRef getName() const override { return "StripTfAttributesPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(StripTfAttributesPassBase) + +protected: +}; + +template +class TFDataOptimizationPassBase : public ::mlir::OperationPass { +public: + using Base = TFDataOptimizationPassBase; + + TFDataOptimizationPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TFDataOptimizationPassBase(const TFDataOptimizationPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-data-optimization"); + } + ::llvm::StringRef getArgument() const override { return "tf-data-optimization"; } + + ::llvm::StringRef getDescription() const override { return "Performs tf.data optimizations"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TFDataOptimizationPass"); + } + ::llvm::StringRef getName() const override { return "TFDataOptimizationPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TFDataOptimizationPassBase) + +protected: +}; + +template +class TFDeviceAssignmentByFuncAttrPassBase : public ::mlir::OperationPass { +public: + using Base = TFDeviceAssignmentByFuncAttrPassBase; + + TFDeviceAssignmentByFuncAttrPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TFDeviceAssignmentByFuncAttrPassBase(const TFDeviceAssignmentByFuncAttrPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-device-assignment-by-func-attr"); + } + ::llvm::StringRef getArgument() const override { return "tf-device-assignment-by-func-attr"; } + + ::llvm::StringRef getDescription() const override { return "Device assignment in TF dialect using the device specified in the function attribute."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TFDeviceAssignmentByFuncAttrPass"); + } + ::llvm::StringRef getName() const override { return "TFDeviceAssignmentByFuncAttrPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TFDeviceAssignmentByFuncAttrPassBase) + +protected: +}; + +template +class TPUAnnotateDynamicShapeInputsPassBase : public ::mlir::OperationPass { +public: + using Base = TPUAnnotateDynamicShapeInputsPassBase; + + TPUAnnotateDynamicShapeInputsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TPUAnnotateDynamicShapeInputsPassBase(const TPUAnnotateDynamicShapeInputsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-tpu-annotate-dynamic-shape-inputs"); + } + ::llvm::StringRef getArgument() const override { return "tf-tpu-annotate-dynamic-shape-inputs"; } + + ::llvm::StringRef getDescription() const override { return "Annotate the inputs returned by TPUCopyWithDynamicShapeOp with dynamic shape"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TPUAnnotateDynamicShapeInputsPass"); + } + ::llvm::StringRef getName() const override { return "TPUAnnotateDynamicShapeInputsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TPUAnnotateDynamicShapeInputsPassBase) + +protected: +}; + +template +class TPUBridgeExecutorIslandOutliningPassBase : public ::mlir::OperationPass { +public: + using Base = TPUBridgeExecutorIslandOutliningPassBase; + + TPUBridgeExecutorIslandOutliningPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TPUBridgeExecutorIslandOutliningPassBase(const TPUBridgeExecutorIslandOutliningPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-executor-tpu-v1-island-outlining"); + } + ::llvm::StringRef getArgument() const override { return "tf-executor-tpu-v1-island-outlining"; } + + ::llvm::StringRef getDescription() const override { return "Outline TPU clusters from island into a nested module, so it can be processed like a V2 module, intended for V1 compatibility mode"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TPUBridgeExecutorIslandOutliningPass"); + } + ::llvm::StringRef getName() const override { return "TPUBridgeExecutorIslandOutliningPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TPUBridgeExecutorIslandOutliningPassBase) + +protected: +}; + +template +class TPUCleanupClusterAttributesPassBase : public ::mlir::OperationPass { +public: + using Base = TPUCleanupClusterAttributesPassBase; + + TPUCleanupClusterAttributesPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TPUCleanupClusterAttributesPassBase(const TPUCleanupClusterAttributesPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-tpu-cleanup-cluster-attributes"); + } + ::llvm::StringRef getArgument() const override { return "tf-tpu-cleanup-cluster-attributes"; } + + ::llvm::StringRef getDescription() const override { return "Eliminate _replication_info and other attributes from ops in a cluster"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TPUCleanupClusterAttributesPass"); + } + ::llvm::StringRef getName() const override { return "TPUCleanupClusterAttributesPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TPUCleanupClusterAttributesPassBase) + +protected: +}; + +template +class TPUClusterFormationPassBase : public ::mlir::OperationPass { +public: + using Base = TPUClusterFormationPassBase; + + TPUClusterFormationPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TPUClusterFormationPassBase(const TPUClusterFormationPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-tpu-cluster-formation"); + } + ::llvm::StringRef getArgument() const override { return "tf-tpu-cluster-formation"; } + + ::llvm::StringRef getDescription() const override { return "Forms clusters from operations assigned to the same TPU computation"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TPUClusterFormationPass"); + } + ::llvm::StringRef getName() const override { return "TPUClusterFormationPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TPUClusterFormationPassBase) + +protected: +}; + +template +class TPUColocateCompositeResourceOpsPassBase : public ::mlir::OperationPass { +public: + using Base = TPUColocateCompositeResourceOpsPassBase; + + TPUColocateCompositeResourceOpsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TPUColocateCompositeResourceOpsPassBase(const TPUColocateCompositeResourceOpsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-tpu-colocate-composite-resource-ops"); + } + ::llvm::StringRef getArgument() const override { return "tf-tpu-colocate-composite-resource-ops"; } + + ::llvm::StringRef getDescription() const override { return "Colocate resource with composite device assignment to TPU device."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TPUColocateCompositeResourceOpsPass"); + } + ::llvm::StringRef getName() const override { return "TPUColocateCompositeResourceOpsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TPUColocateCompositeResourceOpsPassBase) + +protected: +}; + +template +class TPUColocateSplitsPassBase : public ::mlir::OperationPass { +public: + using Base = TPUColocateSplitsPassBase; + + TPUColocateSplitsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TPUColocateSplitsPassBase(const TPUColocateSplitsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-tpu-colocate-splits"); + } + ::llvm::StringRef getArgument() const override { return "tf-tpu-colocate-splits"; } + + ::llvm::StringRef getDescription() const override { return "Colocates each Split op with its predecessor"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TPUColocateSplitsPass"); + } + ::llvm::StringRef getName() const override { return "TPUColocateSplitsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TPUColocateSplitsPassBase) + +protected: +}; + +template +class TPUDevicePropagationPassBase : public ::mlir::OperationPass { +public: + using Base = TPUDevicePropagationPassBase; + + TPUDevicePropagationPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TPUDevicePropagationPassBase(const TPUDevicePropagationPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-tpu-device-propagation"); + } + ::llvm::StringRef getArgument() const override { return "tf-tpu-device-propagation"; } + + ::llvm::StringRef getDescription() const override { return "Propagates TPU devices from ops to users"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TPUDevicePropagationPass"); + } + ::llvm::StringRef getName() const override { return "TPUDevicePropagationPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TPUDevicePropagationPassBase) + +protected: +}; + +template +class TPUDynamicLayoutPassBase : public ::mlir::OperationPass { +public: + using Base = TPUDynamicLayoutPassBase; + + TPUDynamicLayoutPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TPUDynamicLayoutPassBase(const TPUDynamicLayoutPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-tpu-dynamic-layout-pass"); + } + ::llvm::StringRef getArgument() const override { return "tf-tpu-dynamic-layout-pass"; } + + ::llvm::StringRef getDescription() const override { return "Inserts TPU layout ops to determine layout at run time."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TPUDynamicLayoutPass"); + } + ::llvm::StringRef getName() const override { return "TPUDynamicLayoutPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TPUDynamicLayoutPassBase) + +protected: +}; + +template +class TPUHostComputationExpansionPassBase : public ::mlir::OperationPass { +public: + using Base = TPUHostComputationExpansionPassBase; + + TPUHostComputationExpansionPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TPUHostComputationExpansionPassBase(const TPUHostComputationExpansionPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-tpu-host-computation-expansion"); + } + ::llvm::StringRef getArgument() const override { return "tf-tpu-host-computation-expansion"; } + + ::llvm::StringRef getDescription() const override { return "Expands host computation before and after TPU computation."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TPUHostComputationExpansionPass"); + } + ::llvm::StringRef getName() const override { return "TPUHostComputationExpansionPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TPUHostComputationExpansionPassBase) + +protected: +}; + +template +class TPUIdentityPruningPassBase : public ::mlir::OperationPass { +public: + using Base = TPUIdentityPruningPassBase; + + TPUIdentityPruningPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TPUIdentityPruningPassBase(const TPUIdentityPruningPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-tpu-identity-pruning"); + } + ::llvm::StringRef getArgument() const override { return "tf-tpu-identity-pruning"; } + + ::llvm::StringRef getDescription() const override { return "Removes Identity/IdentityN ops from the TPU computation"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TPUIdentityPruningPass"); + } + ::llvm::StringRef getName() const override { return "TPUIdentityPruningPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TPUIdentityPruningPassBase) + +protected: +}; + +template +class TPUMergeVariablesWithExecutePassBase : public ::mlir::OperationPass { +public: + using Base = TPUMergeVariablesWithExecutePassBase; + + TPUMergeVariablesWithExecutePassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TPUMergeVariablesWithExecutePassBase(const TPUMergeVariablesWithExecutePassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-tpu-merge-variables-with-execute"); + } + ::llvm::StringRef getArgument() const override { return "tf-tpu-merge-variables-with-execute"; } + + ::llvm::StringRef getDescription() const override { return "Merges device variable reads and updates into TPU execute ops"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TPUMergeVariablesWithExecutePass"); + } + ::llvm::StringRef getName() const override { return "TPUMergeVariablesWithExecutePass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TPUMergeVariablesWithExecutePassBase) + +protected: +}; + +template +class TPUParallelExecuteSinkResourceWritePassBase : public ::mlir::OperationPass { +public: + using Base = TPUParallelExecuteSinkResourceWritePassBase; + + TPUParallelExecuteSinkResourceWritePassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TPUParallelExecuteSinkResourceWritePassBase(const TPUParallelExecuteSinkResourceWritePassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-tpu-parallel-execute-sink-resource-write"); + } + ::llvm::StringRef getArgument() const override { return "tf-tpu-parallel-execute-sink-resource-write"; } + + ::llvm::StringRef getDescription() const override { return "Moves tf.AssignVariableOp consumers of tf_device.parallel_execute into tf_device.parallel_execute regions"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TPUParallelExecuteSinkResourceWritePass"); + } + ::llvm::StringRef getName() const override { return "TPUParallelExecuteSinkResourceWritePass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TPUParallelExecuteSinkResourceWritePassBase) + +protected: +}; + +template +class TPUPartitionedOpConversionPassBase : public ::mlir::OperationPass { +public: + using Base = TPUPartitionedOpConversionPassBase; + + TPUPartitionedOpConversionPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TPUPartitionedOpConversionPassBase(const TPUPartitionedOpConversionPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-tpu-partitioned-op-conversion"); + } + ::llvm::StringRef getArgument() const override { return "tf-tpu-partitioned-op-conversion"; } + + ::llvm::StringRef getDescription() const override { return "Rewrite all TPU Partitioned ops into their V2 counterparts."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TPUPartitionedOpConversionPass"); + } + ::llvm::StringRef getName() const override { return "TPUPartitionedOpConversionPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TPUPartitionedOpConversionPassBase) + +protected: +}; + +template +class TPUReorderReplicateAndPartitionedInputsPassBase : public ::mlir::OperationPass { +public: + using Base = TPUReorderReplicateAndPartitionedInputsPassBase; + + TPUReorderReplicateAndPartitionedInputsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TPUReorderReplicateAndPartitionedInputsPassBase(const TPUReorderReplicateAndPartitionedInputsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-tpu-reorder-replicate-partitioned-inputs"); + } + ::llvm::StringRef getArgument() const override { return "tf-tpu-reorder-replicate-partitioned-inputs"; } + + ::llvm::StringRef getDescription() const override { return "Reorder replicated and partitioned input ops."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TPUReorderReplicateAndPartitionedInputsPass"); + } + ::llvm::StringRef getName() const override { return "TPUReorderReplicateAndPartitionedInputsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TPUReorderReplicateAndPartitionedInputsPassBase) + +protected: +}; + +template +class TPUResourceReadForWritePassBase : public ::mlir::OperationPass { +public: + using Base = TPUResourceReadForWritePassBase; + + TPUResourceReadForWritePassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TPUResourceReadForWritePassBase(const TPUResourceReadForWritePassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-tpu-resource-read-for-write"); + } + ::llvm::StringRef getArgument() const override { return "tf-tpu-resource-read-for-write"; } + + ::llvm::StringRef getDescription() const override { return "Inserts tf.ReadVariableOp inputs to a TPU cluster for resource writes with no reads"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TPUResourceReadForWritePass"); + } + ::llvm::StringRef getName() const override { return "TPUResourceReadForWritePass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TPUResourceReadForWritePassBase) + +protected: +}; + +template +class TPUResourceReadsWritesPartitioningPassBase : public ::mlir::OperationPass { +public: + using Base = TPUResourceReadsWritesPartitioningPassBase; + + TPUResourceReadsWritesPartitioningPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TPUResourceReadsWritesPartitioningPassBase(const TPUResourceReadsWritesPartitioningPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-tpu-resource-partition"); + } + ::llvm::StringRef getArgument() const override { return "tf-tpu-resource-partition"; } + + ::llvm::StringRef getDescription() const override { return "Partitions unpartitioned resource read/write to partitioned resource variables."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TPUResourceReadsWritesPartitioningPass"); + } + ::llvm::StringRef getName() const override { return "TPUResourceReadsWritesPartitioningPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TPUResourceReadsWritesPartitioningPassBase) + +protected: +}; + +template +class TPURewritePassBase : public ::mlir::OperationPass { +public: + using Base = TPURewritePassBase; + + TPURewritePassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TPURewritePassBase(const TPURewritePassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-tpu-rewrite"); + } + ::llvm::StringRef getArgument() const override { return "tf-tpu-rewrite"; } + + ::llvm::StringRef getDescription() const override { return "Rewrites a `tf_device.cluster_func` on TPUs into TPU runtime operations."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TPURewritePass"); + } + ::llvm::StringRef getName() const override { return "TPURewritePass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TPURewritePassBase) + +protected: + ::mlir::Pass::Option tpu_compile_metadata_debug_{*this, "tpu-compile-metadata-debug", ::llvm::cl::desc("Whether to serialize TPUCompileMetadataProto metadata in 'tf._TPUCompileMlir' op as a proto debug string"), ::llvm::cl::init(false)}; +}; + +template +class TPUShardingIdentificationPassBase : public ::mlir::OperationPass { +public: + using Base = TPUShardingIdentificationPassBase; + + TPUShardingIdentificationPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TPUShardingIdentificationPassBase(const TPUShardingIdentificationPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-tpu-sharding-identification"); + } + ::llvm::StringRef getArgument() const override { return "tf-tpu-sharding-identification"; } + + ::llvm::StringRef getDescription() const override { return "Identifies and handles inputs/outputs of TPU computation that is sharded across logical cores."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TPUShardingIdentificationPass"); + } + ::llvm::StringRef getName() const override { return "TPUShardingIdentificationPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TPUShardingIdentificationPassBase) + +protected: +}; + +template +class TPUSpaceToDepthPassBase : public ::mlir::OperationPass { +public: + using Base = TPUSpaceToDepthPassBase; + + TPUSpaceToDepthPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TPUSpaceToDepthPassBase(const TPUSpaceToDepthPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-tpu-space-to-depth-pass"); + } + ::llvm::StringRef getArgument() const override { return "tf-tpu-space-to-depth-pass"; } + + ::llvm::StringRef getDescription() const override { return "Applies automatic space to depth transform for the first or frontier convolutions consume host inputs on TPU."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TPUSpaceToDepthPass"); + } + ::llvm::StringRef getName() const override { return "TPUSpaceToDepthPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TPUSpaceToDepthPassBase) + +protected: +}; + +template +class TPUUpdateEmbeddingEnqueueOpInputsPassBase : public ::mlir::OperationPass { +public: + using Base = TPUUpdateEmbeddingEnqueueOpInputsPassBase; + + TPUUpdateEmbeddingEnqueueOpInputsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TPUUpdateEmbeddingEnqueueOpInputsPassBase(const TPUUpdateEmbeddingEnqueueOpInputsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-tpu-update-embedding-enqueue-op-inputs"); + } + ::llvm::StringRef getArgument() const override { return "tf-tpu-update-embedding-enqueue-op-inputs"; } + + ::llvm::StringRef getDescription() const override { return "Updates inputs to TPU embedding enqueue ops depending on whether graph is in training mode or in evaluation mode."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TPUUpdateEmbeddingEnqueueOpInputsPass"); + } + ::llvm::StringRef getName() const override { return "TPUUpdateEmbeddingEnqueueOpInputsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TPUUpdateEmbeddingEnqueueOpInputsPassBase) + +protected: +}; + +template +class TPUValidateInputsPassBase : public ::mlir::OperationPass { +public: + using Base = TPUValidateInputsPassBase; + + TPUValidateInputsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TPUValidateInputsPassBase(const TPUValidateInputsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-tpu-validate-inputs"); + } + ::llvm::StringRef getArgument() const override { return "tf-tpu-validate-inputs"; } + + ::llvm::StringRef getDescription() const override { return "Validates inputs to the TPU TF/XLA bridge"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TPUValidateInputsPass"); + } + ::llvm::StringRef getName() const override { return "TPUValidateInputsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TPUValidateInputsPassBase) + +protected: +}; + +template +class TPUVariableRuntimeReformattingPassBase : public ::mlir::OperationPass { +public: + using Base = TPUVariableRuntimeReformattingPassBase; + + TPUVariableRuntimeReformattingPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TPUVariableRuntimeReformattingPassBase(const TPUVariableRuntimeReformattingPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-tpu-variable-runtime-reformatting"); + } + ::llvm::StringRef getArgument() const override { return "tf-tpu-variable-runtime-reformatting"; } + + ::llvm::StringRef getDescription() const override { return "Adds device variable formatting op to allow compilation-guided variable formatting."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TPUVariableRuntimeReformattingPass"); + } + ::llvm::StringRef getName() const override { return "TPUVariableRuntimeReformattingPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TPUVariableRuntimeReformattingPassBase) + +protected: +}; + +template +class TensorArrayOpsDecompositionPassBase : public ::mlir::OperationPass { +public: + using Base = TensorArrayOpsDecompositionPassBase; + + TensorArrayOpsDecompositionPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TensorArrayOpsDecompositionPassBase(const TensorArrayOpsDecompositionPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-tensor-array-ops-decomposition"); + } + ::llvm::StringRef getArgument() const override { return "tf-tensor-array-ops-decomposition"; } + + ::llvm::StringRef getDescription() const override { return "Decompose tensor array operations into local variable operations."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TensorArrayOpsDecompositionPass"); + } + ::llvm::StringRef getName() const override { return "TensorArrayOpsDecompositionPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TensorArrayOpsDecompositionPassBase) + +protected: +}; + +template +class TensorDeviceCopyConversionPassBase : public ::mlir::OperationPass { +public: + using Base = TensorDeviceCopyConversionPassBase; + + TensorDeviceCopyConversionPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TensorDeviceCopyConversionPassBase(const TensorDeviceCopyConversionPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-tensor-device-copy"); + } + ::llvm::StringRef getArgument() const override { return "tf-tensor-device-copy"; } + + ::llvm::StringRef getDescription() const override { return "Fold the tf.Identity op and the tf.IdentityN op if the op has the same device as its operand"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TensorDeviceCopyConversionPass"); + } + ::llvm::StringRef getName() const override { return "TensorDeviceCopyConversionPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TensorDeviceCopyConversionPassBase) + +protected: +}; + +template +class TensorFlowOptimizePassBase : public ::mlir::OperationPass { +public: + using Base = TensorFlowOptimizePassBase; + + TensorFlowOptimizePassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TensorFlowOptimizePassBase(const TensorFlowOptimizePassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-optimize"); + } + ::llvm::StringRef getArgument() const override { return "tf-optimize"; } + + ::llvm::StringRef getDescription() const override { return "Optimize TensorFlow module"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TensorFlowOptimizePass"); + } + ::llvm::StringRef getName() const override { return "TensorFlowOptimizePass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TensorFlowOptimizePassBase) + +protected: +}; + +template +class TensorFlowShapeInferencePassBase : public ::mlir::OperationPass { +public: + using Base = TensorFlowShapeInferencePassBase; + + TensorFlowShapeInferencePassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TensorFlowShapeInferencePassBase(const TensorFlowShapeInferencePassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-shape-inference"); + } + ::llvm::StringRef getArgument() const override { return "tf-shape-inference"; } + + ::llvm::StringRef getDescription() const override { return "Shape inference on TF dialect and ops implementing InferTypeOpInterface"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TensorFlowShapeInferencePass"); + } + ::llvm::StringRef getName() const override { return "TensorFlowShapeInferencePass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TensorFlowShapeInferencePassBase) + +protected: + ::mlir::Pass::Option max_iterations_{*this, "max-iterations", ::llvm::cl::desc("Maximum shape inference iterations"), ::llvm::cl::init(10)}; +}; + +template +class TensorListOpsDecompositionPassBase : public ::mlir::OperationPass { +public: + using Base = TensorListOpsDecompositionPassBase; + + TensorListOpsDecompositionPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TensorListOpsDecompositionPassBase(const TensorListOpsDecompositionPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-tensor-list-ops-decomposition"); + } + ::llvm::StringRef getArgument() const override { return "tf-tensor-list-ops-decomposition"; } + + ::llvm::StringRef getDescription() const override { return "Decomposes TensorList operations into generic operations on tensors."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TensorListOpsDecompositionPass"); + } + ::llvm::StringRef getName() const override { return "TensorListOpsDecompositionPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TensorListOpsDecompositionPassBase) + +protected: +}; + +template +class TensorflowGPUFusionBase : public ::mlir::OperationPass { +public: + using Base = TensorflowGPUFusionBase; + + TensorflowGPUFusionBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TensorflowGPUFusionBase(const TensorflowGPUFusionBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-gpu-op-fusion"); + } + ::llvm::StringRef getArgument() const override { return "tf-gpu-op-fusion"; } + + ::llvm::StringRef getDescription() const override { return "Fusion optimization for GPU targets"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TensorflowGPUFusion"); + } + ::llvm::StringRef getName() const override { return "TensorflowGPUFusion"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TensorflowGPUFusionBase) + +protected: +}; + +template +class TpuV1BridgeExecutorIslandCoarseningPassBase : public ::mlir::OperationPass { +public: + using Base = TpuV1BridgeExecutorIslandCoarseningPassBase; + + TpuV1BridgeExecutorIslandCoarseningPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TpuV1BridgeExecutorIslandCoarseningPassBase(const TpuV1BridgeExecutorIslandCoarseningPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-executor-tpu-v1-island-coarsening"); + } + ::llvm::StringRef getArgument() const override { return "tf-executor-tpu-v1-island-coarsening"; } + + ::llvm::StringRef getDescription() const override { return "Merges TPU clusters IslandOps, intended for V1 compatibility mode"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TpuV1BridgeExecutorIslandCoarseningPass"); + } + ::llvm::StringRef getName() const override { return "TpuV1BridgeExecutorIslandCoarseningPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TpuV1BridgeExecutorIslandCoarseningPassBase) + +protected: +}; + +template +class TransformEinsumPassBase : public ::mlir::OperationPass { +public: + using Base = TransformEinsumPassBase; + + TransformEinsumPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TransformEinsumPassBase(const TransformEinsumPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-einsum"); + } + ::llvm::StringRef getArgument() const override { return "tf-einsum"; } + + ::llvm::StringRef getDescription() const override { return "Transform Einsum to other TF Ops for the supported variants"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TransformEinsumPass"); + } + ::llvm::StringRef getName() const override { return "TransformEinsumPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TransformEinsumPassBase) + +protected: +}; + +template +class UnrollBatchMatMulPassBase : public ::mlir::OperationPass { +public: + using Base = UnrollBatchMatMulPassBase; + + UnrollBatchMatMulPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + UnrollBatchMatMulPassBase(const UnrollBatchMatMulPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-unroll-batch-matmul"); + } + ::llvm::StringRef getArgument() const override { return "tf-unroll-batch-matmul"; } + + ::llvm::StringRef getDescription() const override { return "Unroll TF BatchMatMul op into Reshape, Slice, MatMul, Pack ops."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("UnrollBatchMatMulPass"); + } + ::llvm::StringRef getName() const override { return "UnrollBatchMatMulPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(UnrollBatchMatMulPassBase) + +protected: +}; + +template +class VerifySuitableForExportPassBase : public ::mlir::OperationPass { +public: + using Base = VerifySuitableForExportPassBase; + + VerifySuitableForExportPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + VerifySuitableForExportPassBase(const VerifySuitableForExportPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-verify-for-export"); + } + ::llvm::StringRef getArgument() const override { return "tf-verify-for-export"; } + + ::llvm::StringRef getDescription() const override { return "Verify module is suitable for export back to TF Graph"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("VerifySuitableForExportPass"); + } + ::llvm::StringRef getName() const override { return "VerifySuitableForExportPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(VerifySuitableForExportPassBase) + +protected: +}; + +template +class XlaCallModuleDeserializationPassBase : public ::mlir::OperationPass { +public: + using Base = XlaCallModuleDeserializationPassBase; + + XlaCallModuleDeserializationPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + XlaCallModuleDeserializationPassBase(const XlaCallModuleDeserializationPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-xla-call-module-deserialization"); + } + ::llvm::StringRef getArgument() const override { return "tf-xla-call-module-deserialization"; } + + ::llvm::StringRef getDescription() const override { return "Deserializes StableHLO functions embedded in `tf.XlaCallModule` to top level module"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("XlaCallModuleDeserializationPass"); + } + ::llvm::StringRef getName() const override { return "XlaCallModuleDeserializationPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(XlaCallModuleDeserializationPassBase) + +protected: +}; + +template +class XlaCallModuleSerializationPassBase : public ::mlir::OperationPass { +public: + using Base = XlaCallModuleSerializationPassBase; + + XlaCallModuleSerializationPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + XlaCallModuleSerializationPassBase(const XlaCallModuleSerializationPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-xla-call-module-serialization"); + } + ::llvm::StringRef getArgument() const override { return "tf-xla-call-module-serialization"; } + + ::llvm::StringRef getDescription() const override { return "Serializes StableHLO functions from top-level module into `tf.XlaCallModule`'s `module` attribute"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("XlaCallModuleSerializationPass"); + } + ::llvm::StringRef getName() const override { return "XlaCallModuleSerializationPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(XlaCallModuleSerializationPassBase) + +protected: +}; +#undef GEN_PASS_CLASSES +#endif // GEN_PASS_CLASSES diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/tf_saved_model_asset_sinking_pass.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/tf_saved_model_asset_sinking_pass.h new file mode 100644 index 0000000000000000000000000000000000000000..a14e98e483fc343096e94f049025027cf300c612 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/tf_saved_model_asset_sinking_pass.h @@ -0,0 +1,35 @@ +/* Copyright 2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSFORMS_TF_SAVED_MODEL_ASSET_SINKING_PASS_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSFORMS_TF_SAVED_MODEL_ASSET_SINKING_PASS_H_ + +#include + +#include "llvm/ADT/StringRef.h" +#include "mlir/IR/BuiltinOps.h" // from @llvm-project +#include "mlir/Pass/Pass.h" // from @llvm-project + +namespace mlir { +namespace tf_saved_model { + +// Creates a pass that sinks SavedModel asset filenames to constants. +std::unique_ptr> CreateAssetSinkingPass( + llvm::StringRef saved_model_dir); + +} // namespace tf_saved_model +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSFORMS_TF_SAVED_MODEL_ASSET_SINKING_PASS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/tf_saved_model_passes.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/tf_saved_model_passes.h new file mode 100644 index 0000000000000000000000000000000000000000..801eaaeb0ae1f820106f4ac511488750183b908c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/tf_saved_model_passes.h @@ -0,0 +1,88 @@ +/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSFORMS_TF_SAVED_MODEL_PASSES_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSFORMS_TF_SAVED_MODEL_PASSES_H_ + +#include + +#include "mlir/Dialect/Func/IR/FuncOps.h" // from @llvm-project +#include "mlir/IR/BuiltinOps.h" // from @llvm-project +#include "mlir/Pass/Pass.h" // from @llvm-project +#include "tensorflow/compiler/mlir/tensorflow/transforms/tf_saved_model_asset_sinking_pass.h" +#include "tensorflow/core/public/session.h" + +namespace mlir { +namespace tf_saved_model { + +// Creates a pass that optimizes tf_saved_model.global_tensor ops. +std::unique_ptr> CreateOptimizeGlobalTensorsPass(); + +// Creates a pass that freezes tf_saved_model.global_tensor ops. +std::unique_ptr> CreateFreezeGlobalTensorsPass( + bool allow_mutable_tensors = false); + +// Creates a pass that freezes tf_saved_model.asset ops. +std::unique_ptr> CreateFreezeAssetsPass( + std::string saved_model_dir = ""); + +// Creates as pass that removes variables in the session initializer. +// This job is required with lifting variable passes. Originally, the session +// initializer function does assigning variables. However, the read-only +// variable assignments will be done via lifting variables pass by converting +// the read-only variables to constant ops, instead. This pass removes the +// redundant operations. This pass should be located in front of the pass for +// lifting read-only variables. +std::unique_ptr> +CreateRemoveVariablesInSessionInitializerPass(); + +// Creates a pass that removes duplicate 'tf_saved_model.bound_input' bindings. +std::unique_ptr> CreateDedupBoundInputBindingPass(); + +// Create a pass that removes function arguments that map to global tensors. +std::unique_ptr CreateLowerGlobalsToMlProgramPass(); + +// Create a pass that lowers variable read/write ops to ml_program ops. +std::unique_ptr> +CreateLowerVariableOpsToMlProgramPass(); + +// Strips saved_model attributes from a module and its functions. +std::unique_ptr> CreateStripSavedModuleMetadataPass(); + +// Convert the session initializer to a function. +std::unique_ptr> +CreateConvertSessionInitializerToFunctionPass(); + +// Creates forwarding functions for 'exported_names'. +std::unique_ptr> +CreateAddFunctionsForExportedNamesPass(); + +#define GEN_PASS_REGISTRATION +#define GEN_PASS_DECL_DEDUPBOUNDINPUTBINDINGPASS +#define GEN_PASS_DECL_FREEZEASSETSPASS +#define GEN_PASS_DECL_FREEZEGLOBALTENSORSPASS +#define GEN_PASS_DECL_LOWERGLOBALSTOMLPROGRAMPASS +#define GEN_PASS_DECL_LOWERVARIABLEOPSTOMLPROGRAMPASS +#define GEN_PASS_DECL_OPTIMIZEGLOBALTENSORSPASS +#define GEN_PASS_DECL_REMOVEVARIABLESINSESSIONINITIALIZERPASS +#define GEN_PASS_DECL_STRIPSAVEDMODULEMETADATAPASS +#define GEN_PASS_DECL_ADDFUNCTIONSFOREXPORTEDNAMESPASS +#include "tensorflow/compiler/mlir/tensorflow/transforms/tf_savedmodel_passes.h.inc" + +} // namespace tf_saved_model + +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSFORMS_TF_SAVED_MODEL_PASSES_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/tf_savedmodel_passes.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/tf_savedmodel_passes.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..9775c3a65eb9527b108acc16608104be7a28adf0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/tf_savedmodel_passes.h.inc @@ -0,0 +1,1378 @@ +/* Autogenerated by mlir-tblgen; don't manually edit */ + +#ifdef GEN_PASS_DECL +// Generate declarations for all passes. +#define GEN_PASS_DECL_ADDFUNCTIONSFOREXPORTEDNAMESPASS +#define GEN_PASS_DECL_ASSETSINKINGPASS +#define GEN_PASS_DECL_CONVERTSESSIONINITIALIZERTOFUNCTIONPASS +#define GEN_PASS_DECL_DEDUPBOUNDINPUTBINDINGPASS +#define GEN_PASS_DECL_FREEZEASSETSPASS +#define GEN_PASS_DECL_FREEZEGLOBALTENSORSPASS +#define GEN_PASS_DECL_LOWERGLOBALSTOMLPROGRAMPASS +#define GEN_PASS_DECL_LOWERVARIABLEOPSTOMLPROGRAMPASS +#define GEN_PASS_DECL_OPTIMIZEGLOBALTENSORSPASS +#define GEN_PASS_DECL_REMOVEVARIABLESINSESSIONINITIALIZERPASS +#define GEN_PASS_DECL_STRIPSAVEDMODULEMETADATAPASS +#undef GEN_PASS_DECL +#endif // GEN_PASS_DECL + +//===----------------------------------------------------------------------===// +// AddFunctionsForExportedNamesPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_ADDFUNCTIONSFOREXPORTEDNAMESPASS +#undef GEN_PASS_DECL_ADDFUNCTIONSFOREXPORTEDNAMESPASS +#endif // GEN_PASS_DECL_ADDFUNCTIONSFOREXPORTEDNAMESPASS +#ifdef GEN_PASS_DEF_ADDFUNCTIONSFOREXPORTEDNAMESPASS +namespace impl { + +template +class AddFunctionsForExportedNamesPassBase : public ::mlir::OperationPass { +public: + using Base = AddFunctionsForExportedNamesPassBase; + + AddFunctionsForExportedNamesPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + AddFunctionsForExportedNamesPassBase(const AddFunctionsForExportedNamesPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-saved-model-add-functions-for-exported-names"); + } + ::llvm::StringRef getArgument() const override { return "tf-saved-model-add-functions-for-exported-names"; } + + ::llvm::StringRef getDescription() const override { return "Create a trampoline function for each exported name."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("AddFunctionsForExportedNamesPass"); + } + ::llvm::StringRef getName() const override { return "AddFunctionsForExportedNamesPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(AddFunctionsForExportedNamesPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_ADDFUNCTIONSFOREXPORTEDNAMESPASS +#endif // GEN_PASS_DEF_ADDFUNCTIONSFOREXPORTEDNAMESPASS + +//===----------------------------------------------------------------------===// +// AssetSinkingPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_ASSETSINKINGPASS +struct AssetSinkingPassOptions { + std::string saved_model_dir_; +}; +#undef GEN_PASS_DECL_ASSETSINKINGPASS +#endif // GEN_PASS_DECL_ASSETSINKINGPASS +#ifdef GEN_PASS_DEF_ASSETSINKINGPASS +namespace impl { + +template +class AssetSinkingPassBase : public ::mlir::OperationPass { +public: + using Base = AssetSinkingPassBase; + + AssetSinkingPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + AssetSinkingPassBase(const AssetSinkingPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-saved-model-asset-sinking"); + } + ::llvm::StringRef getArgument() const override { return "tf-saved-model-asset-sinking"; } + + ::llvm::StringRef getDescription() const override { return "Sinks SavedModel asset filenames to constants"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("AssetSinkingPass"); + } + ::llvm::StringRef getName() const override { return "AssetSinkingPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(AssetSinkingPassBase) + + AssetSinkingPassBase(const AssetSinkingPassOptions &options) : AssetSinkingPassBase() { + saved_model_dir_ = options.saved_model_dir_; + } +protected: + ::mlir::Pass::Option saved_model_dir_{*this, "saved-model-dir", ::llvm::cl::desc("SavedModel directory, which is prepended to asset file names.")}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_ASSETSINKINGPASS +#endif // GEN_PASS_DEF_ASSETSINKINGPASS + +//===----------------------------------------------------------------------===// +// ConvertSessionInitializerToFunctionPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTSESSIONINITIALIZERTOFUNCTIONPASS +#undef GEN_PASS_DECL_CONVERTSESSIONINITIALIZERTOFUNCTIONPASS +#endif // GEN_PASS_DECL_CONVERTSESSIONINITIALIZERTOFUNCTIONPASS +#ifdef GEN_PASS_DEF_CONVERTSESSIONINITIALIZERTOFUNCTIONPASS +namespace impl { + +template +class ConvertSessionInitializerToFunctionPassBase : public ::mlir::OperationPass { +public: + using Base = ConvertSessionInitializerToFunctionPassBase; + + ConvertSessionInitializerToFunctionPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertSessionInitializerToFunctionPassBase(const ConvertSessionInitializerToFunctionPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-saved-model-convert-session-initializer-to-function"); + } + ::llvm::StringRef getArgument() const override { return "tf-saved-model-convert-session-initializer-to-function"; } + + ::llvm::StringRef getDescription() const override { return "Converts the session initializer to a function."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertSessionInitializerToFunctionPass"); + } + ::llvm::StringRef getName() const override { return "ConvertSessionInitializerToFunctionPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertSessionInitializerToFunctionPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_CONVERTSESSIONINITIALIZERTOFUNCTIONPASS +#endif // GEN_PASS_DEF_CONVERTSESSIONINITIALIZERTOFUNCTIONPASS + +//===----------------------------------------------------------------------===// +// DedupBoundInputBindingPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_DEDUPBOUNDINPUTBINDINGPASS +#undef GEN_PASS_DECL_DEDUPBOUNDINPUTBINDINGPASS +#endif // GEN_PASS_DECL_DEDUPBOUNDINPUTBINDINGPASS +#ifdef GEN_PASS_DEF_DEDUPBOUNDINPUTBINDINGPASS +namespace impl { + +template +class DedupBoundInputBindingPassBase : public ::mlir::OperationPass { +public: + using Base = DedupBoundInputBindingPassBase; + + DedupBoundInputBindingPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + DedupBoundInputBindingPassBase(const DedupBoundInputBindingPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-saved-model-dedup-bound-input-binding-pass"); + } + ::llvm::StringRef getArgument() const override { return "tf-saved-model-dedup-bound-input-binding-pass"; } + + ::llvm::StringRef getDescription() const override { return "Remove duplicate 'tf_saved_model.bound_input' bindings."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("DedupBoundInputBindingPass"); + } + ::llvm::StringRef getName() const override { return "DedupBoundInputBindingPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(DedupBoundInputBindingPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_DEDUPBOUNDINPUTBINDINGPASS +#endif // GEN_PASS_DEF_DEDUPBOUNDINPUTBINDINGPASS + +//===----------------------------------------------------------------------===// +// FreezeAssetsPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_FREEZEASSETSPASS +#undef GEN_PASS_DECL_FREEZEASSETSPASS +#endif // GEN_PASS_DECL_FREEZEASSETSPASS +#ifdef GEN_PASS_DEF_FREEZEASSETSPASS +namespace impl { + +template +class FreezeAssetsPassBase : public ::mlir::OperationPass { +public: + using Base = FreezeAssetsPassBase; + + FreezeAssetsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + FreezeAssetsPassBase(const FreezeAssetsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-saved-model-freeze-assets"); + } + ::llvm::StringRef getArgument() const override { return "tf-saved-model-freeze-assets"; } + + ::llvm::StringRef getDescription() const override { return "Freeze tf_saved_model.asset's in func bodies."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("FreezeAssetsPass"); + } + ::llvm::StringRef getName() const override { return "FreezeAssetsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(FreezeAssetsPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_FREEZEASSETSPASS +#endif // GEN_PASS_DEF_FREEZEASSETSPASS + +//===----------------------------------------------------------------------===// +// FreezeGlobalTensorsPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_FREEZEGLOBALTENSORSPASS +struct FreezeGlobalTensorsPassOptions { + bool allow_mutable_tensors = false; +}; +#undef GEN_PASS_DECL_FREEZEGLOBALTENSORSPASS +#endif // GEN_PASS_DECL_FREEZEGLOBALTENSORSPASS +#ifdef GEN_PASS_DEF_FREEZEGLOBALTENSORSPASS +namespace impl { + +template +class FreezeGlobalTensorsPassBase : public ::mlir::OperationPass { +public: + using Base = FreezeGlobalTensorsPassBase; + + FreezeGlobalTensorsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + FreezeGlobalTensorsPassBase(const FreezeGlobalTensorsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-saved-model-freeze-global-tensors"); + } + ::llvm::StringRef getArgument() const override { return "tf-saved-model-freeze-global-tensors"; } + + ::llvm::StringRef getDescription() const override { return "Freeze tf_saved_model.global_tensor's in func bodies."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("FreezeGlobalTensorsPass"); + } + ::llvm::StringRef getName() const override { return "FreezeGlobalTensorsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(FreezeGlobalTensorsPassBase) + + FreezeGlobalTensorsPassBase(const FreezeGlobalTensorsPassOptions &options) : FreezeGlobalTensorsPassBase() { + allow_mutable_tensors = options.allow_mutable_tensors; + } +protected: + ::mlir::Pass::Option allow_mutable_tensors{*this, "allow-mutable-tensors", ::llvm::cl::desc("Allows mutable tensors to be in the graph."), ::llvm::cl::init(false)}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_FREEZEGLOBALTENSORSPASS +#endif // GEN_PASS_DEF_FREEZEGLOBALTENSORSPASS + +//===----------------------------------------------------------------------===// +// LowerGlobalsToMlProgramPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_LOWERGLOBALSTOMLPROGRAMPASS +#undef GEN_PASS_DECL_LOWERGLOBALSTOMLPROGRAMPASS +#endif // GEN_PASS_DECL_LOWERGLOBALSTOMLPROGRAMPASS +#ifdef GEN_PASS_DEF_LOWERGLOBALSTOMLPROGRAMPASS +namespace impl { + +template +class LowerGlobalsToMlProgramPassBase : public ::mlir::OperationPass { +public: + using Base = LowerGlobalsToMlProgramPassBase; + + LowerGlobalsToMlProgramPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + LowerGlobalsToMlProgramPassBase(const LowerGlobalsToMlProgramPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-saved-model-lower-globals-to-mlprogram"); + } + ::llvm::StringRef getArgument() const override { return "tf-saved-model-lower-globals-to-mlprogram"; } + + ::llvm::StringRef getDescription() const override { return "Remove (and remap) function arguments that map to global tensors."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LowerGlobalsToMlProgramPass"); + } + ::llvm::StringRef getName() const override { return "LowerGlobalsToMlProgramPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LowerGlobalsToMlProgramPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_LOWERGLOBALSTOMLPROGRAMPASS +#endif // GEN_PASS_DEF_LOWERGLOBALSTOMLPROGRAMPASS + +//===----------------------------------------------------------------------===// +// LowerVariableOpsToMlProgramPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_LOWERVARIABLEOPSTOMLPROGRAMPASS +#undef GEN_PASS_DECL_LOWERVARIABLEOPSTOMLPROGRAMPASS +#endif // GEN_PASS_DECL_LOWERVARIABLEOPSTOMLPROGRAMPASS +#ifdef GEN_PASS_DEF_LOWERVARIABLEOPSTOMLPROGRAMPASS +namespace impl { + +template +class LowerVariableOpsToMlProgramPassBase : public ::mlir::OperationPass { +public: + using Base = LowerVariableOpsToMlProgramPassBase; + + LowerVariableOpsToMlProgramPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + LowerVariableOpsToMlProgramPassBase(const LowerVariableOpsToMlProgramPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-saved-model-lower-variable-ops-to-mlprogram"); + } + ::llvm::StringRef getArgument() const override { return "tf-saved-model-lower-variable-ops-to-mlprogram"; } + + ::llvm::StringRef getDescription() const override { return "Lower tf.ReadVariable and tf.AssignVariable"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LowerVariableOpsToMlProgramPass"); + } + ::llvm::StringRef getName() const override { return "LowerVariableOpsToMlProgramPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LowerVariableOpsToMlProgramPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_LOWERVARIABLEOPSTOMLPROGRAMPASS +#endif // GEN_PASS_DEF_LOWERVARIABLEOPSTOMLPROGRAMPASS + +//===----------------------------------------------------------------------===// +// OptimizeGlobalTensorsPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_OPTIMIZEGLOBALTENSORSPASS +#undef GEN_PASS_DECL_OPTIMIZEGLOBALTENSORSPASS +#endif // GEN_PASS_DECL_OPTIMIZEGLOBALTENSORSPASS +#ifdef GEN_PASS_DEF_OPTIMIZEGLOBALTENSORSPASS +namespace impl { + +template +class OptimizeGlobalTensorsPassBase : public ::mlir::OperationPass { +public: + using Base = OptimizeGlobalTensorsPassBase; + + OptimizeGlobalTensorsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + OptimizeGlobalTensorsPassBase(const OptimizeGlobalTensorsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-saved-model-optimize-global-tensors"); + } + ::llvm::StringRef getArgument() const override { return "tf-saved-model-optimize-global-tensors"; } + + ::llvm::StringRef getDescription() const override { return "Optimize tf_saved_model.global_tensor's."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("OptimizeGlobalTensorsPass"); + } + ::llvm::StringRef getName() const override { return "OptimizeGlobalTensorsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(OptimizeGlobalTensorsPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_OPTIMIZEGLOBALTENSORSPASS +#endif // GEN_PASS_DEF_OPTIMIZEGLOBALTENSORSPASS + +//===----------------------------------------------------------------------===// +// RemoveVariablesInSessionInitializerPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_REMOVEVARIABLESINSESSIONINITIALIZERPASS +#undef GEN_PASS_DECL_REMOVEVARIABLESINSESSIONINITIALIZERPASS +#endif // GEN_PASS_DECL_REMOVEVARIABLESINSESSIONINITIALIZERPASS +#ifdef GEN_PASS_DEF_REMOVEVARIABLESINSESSIONINITIALIZERPASS +namespace impl { + +template +class RemoveVariablesInSessionInitializerPassBase : public ::mlir::OperationPass { +public: + using Base = RemoveVariablesInSessionInitializerPassBase; + + RemoveVariablesInSessionInitializerPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + RemoveVariablesInSessionInitializerPassBase(const RemoveVariablesInSessionInitializerPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-saved-model-remove-vars-in-session-initializer"); + } + ::llvm::StringRef getArgument() const override { return "tf-saved-model-remove-vars-in-session-initializer"; } + + ::llvm::StringRef getDescription() const override { return "Remove variables in tf saved model's session initializer."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("RemoveVariablesInSessionInitializerPass"); + } + ::llvm::StringRef getName() const override { return "RemoveVariablesInSessionInitializerPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(RemoveVariablesInSessionInitializerPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_REMOVEVARIABLESINSESSIONINITIALIZERPASS +#endif // GEN_PASS_DEF_REMOVEVARIABLESINSESSIONINITIALIZERPASS + +//===----------------------------------------------------------------------===// +// StripSavedModuleMetadataPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_STRIPSAVEDMODULEMETADATAPASS +#undef GEN_PASS_DECL_STRIPSAVEDMODULEMETADATAPASS +#endif // GEN_PASS_DECL_STRIPSAVEDMODULEMETADATAPASS +#ifdef GEN_PASS_DEF_STRIPSAVEDMODULEMETADATAPASS +namespace impl { + +template +class StripSavedModuleMetadataPassBase : public ::mlir::OperationPass { +public: + using Base = StripSavedModuleMetadataPassBase; + + StripSavedModuleMetadataPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + StripSavedModuleMetadataPassBase(const StripSavedModuleMetadataPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-strip-saved-module-metadata"); + } + ::llvm::StringRef getArgument() const override { return "tf-strip-saved-module-metadata"; } + + ::llvm::StringRef getDescription() const override { return "Removes saved_model attributes."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("StripSavedModuleMetadataPass"); + } + ::llvm::StringRef getName() const override { return "StripSavedModuleMetadataPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(StripSavedModuleMetadataPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_STRIPSAVEDMODULEMETADATAPASS +#endif // GEN_PASS_DEF_STRIPSAVEDMODULEMETADATAPASS +#ifdef GEN_PASS_REGISTRATION + +//===----------------------------------------------------------------------===// +// AddFunctionsForExportedNamesPass Registration +//===----------------------------------------------------------------------===// + +inline void registerAddFunctionsForExportedNamesPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::tf_saved_model::CreateAddFunctionsForExportedNamesPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerAddFunctionsForExportedNamesPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::tf_saved_model::CreateAddFunctionsForExportedNamesPass(); + }); +} + +//===----------------------------------------------------------------------===// +// AssetSinkingPass Registration +//===----------------------------------------------------------------------===// + +inline void registerAssetSinkingPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::tf_saved_model::CreateAssetSinkingPass(""); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerAssetSinkingPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::tf_saved_model::CreateAssetSinkingPass(""); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertSessionInitializerToFunctionPass Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertSessionInitializerToFunctionPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::tf_saved_model::CreateConvertSessionInitializerToFunctionPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertSessionInitializerToFunctionPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::tf_saved_model::CreateConvertSessionInitializerToFunctionPass(); + }); +} + +//===----------------------------------------------------------------------===// +// DedupBoundInputBindingPass Registration +//===----------------------------------------------------------------------===// + +inline void registerDedupBoundInputBindingPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::tf_saved_model::CreateDedupBoundInputBindingPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerDedupBoundInputBindingPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::tf_saved_model::CreateDedupBoundInputBindingPass(); + }); +} + +//===----------------------------------------------------------------------===// +// FreezeAssetsPass Registration +//===----------------------------------------------------------------------===// + +inline void registerFreezeAssetsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::tf_saved_model::CreateFreezeAssetsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerFreezeAssetsPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::tf_saved_model::CreateFreezeAssetsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// FreezeGlobalTensorsPass Registration +//===----------------------------------------------------------------------===// + +inline void registerFreezeGlobalTensorsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::tf_saved_model::CreateFreezeGlobalTensorsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerFreezeGlobalTensorsPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::tf_saved_model::CreateFreezeGlobalTensorsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// LowerGlobalsToMlProgramPass Registration +//===----------------------------------------------------------------------===// + +inline void registerLowerGlobalsToMlProgramPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::tf_saved_model::CreateLowerGlobalsToMlProgramPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerLowerGlobalsToMlProgramPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::tf_saved_model::CreateLowerGlobalsToMlProgramPass(); + }); +} + +//===----------------------------------------------------------------------===// +// LowerVariableOpsToMlProgramPass Registration +//===----------------------------------------------------------------------===// + +inline void registerLowerVariableOpsToMlProgramPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::tf_saved_model::CreateLowerVariableOpsToMlProgramPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerLowerVariableOpsToMlProgramPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::tf_saved_model::CreateLowerVariableOpsToMlProgramPass(); + }); +} + +//===----------------------------------------------------------------------===// +// OptimizeGlobalTensorsPass Registration +//===----------------------------------------------------------------------===// + +inline void registerOptimizeGlobalTensorsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::tf_saved_model::CreateOptimizeGlobalTensorsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerOptimizeGlobalTensorsPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::tf_saved_model::CreateOptimizeGlobalTensorsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// RemoveVariablesInSessionInitializerPass Registration +//===----------------------------------------------------------------------===// + +inline void registerRemoveVariablesInSessionInitializerPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::tf_saved_model::CreateRemoveVariablesInSessionInitializerPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerRemoveVariablesInSessionInitializerPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::tf_saved_model::CreateRemoveVariablesInSessionInitializerPass(); + }); +} + +//===----------------------------------------------------------------------===// +// StripSavedModuleMetadataPass Registration +//===----------------------------------------------------------------------===// + +inline void registerStripSavedModuleMetadataPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::tf_saved_model::CreateStripSavedModuleMetadataPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerStripSavedModuleMetadataPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::tf_saved_model::CreateStripSavedModuleMetadataPass(); + }); +} + +//===----------------------------------------------------------------------===// +// TensorFlowSavedModel Registration +//===----------------------------------------------------------------------===// + +inline void registerTensorFlowSavedModelPasses() { + registerAddFunctionsForExportedNamesPass(); + registerAssetSinkingPass(); + registerConvertSessionInitializerToFunctionPass(); + registerDedupBoundInputBindingPass(); + registerFreezeAssetsPass(); + registerFreezeGlobalTensorsPass(); + registerLowerGlobalsToMlProgramPass(); + registerLowerVariableOpsToMlProgramPass(); + registerOptimizeGlobalTensorsPass(); + registerRemoveVariablesInSessionInitializerPass(); + registerStripSavedModuleMetadataPass(); +} +#undef GEN_PASS_REGISTRATION +#endif // GEN_PASS_REGISTRATION +// Deprecated. Please use the new per-pass macros. +#ifdef GEN_PASS_CLASSES + +template +class AddFunctionsForExportedNamesPassBase : public ::mlir::OperationPass { +public: + using Base = AddFunctionsForExportedNamesPassBase; + + AddFunctionsForExportedNamesPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + AddFunctionsForExportedNamesPassBase(const AddFunctionsForExportedNamesPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-saved-model-add-functions-for-exported-names"); + } + ::llvm::StringRef getArgument() const override { return "tf-saved-model-add-functions-for-exported-names"; } + + ::llvm::StringRef getDescription() const override { return "Create a trampoline function for each exported name."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("AddFunctionsForExportedNamesPass"); + } + ::llvm::StringRef getName() const override { return "AddFunctionsForExportedNamesPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(AddFunctionsForExportedNamesPassBase) + +protected: +}; + +template +class AssetSinkingPassBase : public ::mlir::OperationPass { +public: + using Base = AssetSinkingPassBase; + + AssetSinkingPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + AssetSinkingPassBase(const AssetSinkingPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-saved-model-asset-sinking"); + } + ::llvm::StringRef getArgument() const override { return "tf-saved-model-asset-sinking"; } + + ::llvm::StringRef getDescription() const override { return "Sinks SavedModel asset filenames to constants"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("AssetSinkingPass"); + } + ::llvm::StringRef getName() const override { return "AssetSinkingPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(AssetSinkingPassBase) + +protected: + ::mlir::Pass::Option saved_model_dir_{*this, "saved-model-dir", ::llvm::cl::desc("SavedModel directory, which is prepended to asset file names.")}; +}; + +template +class ConvertSessionInitializerToFunctionPassBase : public ::mlir::OperationPass { +public: + using Base = ConvertSessionInitializerToFunctionPassBase; + + ConvertSessionInitializerToFunctionPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertSessionInitializerToFunctionPassBase(const ConvertSessionInitializerToFunctionPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-saved-model-convert-session-initializer-to-function"); + } + ::llvm::StringRef getArgument() const override { return "tf-saved-model-convert-session-initializer-to-function"; } + + ::llvm::StringRef getDescription() const override { return "Converts the session initializer to a function."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertSessionInitializerToFunctionPass"); + } + ::llvm::StringRef getName() const override { return "ConvertSessionInitializerToFunctionPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertSessionInitializerToFunctionPassBase) + +protected: +}; + +template +class DedupBoundInputBindingPassBase : public ::mlir::OperationPass { +public: + using Base = DedupBoundInputBindingPassBase; + + DedupBoundInputBindingPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + DedupBoundInputBindingPassBase(const DedupBoundInputBindingPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-saved-model-dedup-bound-input-binding-pass"); + } + ::llvm::StringRef getArgument() const override { return "tf-saved-model-dedup-bound-input-binding-pass"; } + + ::llvm::StringRef getDescription() const override { return "Remove duplicate 'tf_saved_model.bound_input' bindings."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("DedupBoundInputBindingPass"); + } + ::llvm::StringRef getName() const override { return "DedupBoundInputBindingPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(DedupBoundInputBindingPassBase) + +protected: +}; + +template +class FreezeAssetsPassBase : public ::mlir::OperationPass { +public: + using Base = FreezeAssetsPassBase; + + FreezeAssetsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + FreezeAssetsPassBase(const FreezeAssetsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-saved-model-freeze-assets"); + } + ::llvm::StringRef getArgument() const override { return "tf-saved-model-freeze-assets"; } + + ::llvm::StringRef getDescription() const override { return "Freeze tf_saved_model.asset's in func bodies."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("FreezeAssetsPass"); + } + ::llvm::StringRef getName() const override { return "FreezeAssetsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(FreezeAssetsPassBase) + +protected: +}; + +template +class FreezeGlobalTensorsPassBase : public ::mlir::OperationPass { +public: + using Base = FreezeGlobalTensorsPassBase; + + FreezeGlobalTensorsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + FreezeGlobalTensorsPassBase(const FreezeGlobalTensorsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-saved-model-freeze-global-tensors"); + } + ::llvm::StringRef getArgument() const override { return "tf-saved-model-freeze-global-tensors"; } + + ::llvm::StringRef getDescription() const override { return "Freeze tf_saved_model.global_tensor's in func bodies."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("FreezeGlobalTensorsPass"); + } + ::llvm::StringRef getName() const override { return "FreezeGlobalTensorsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(FreezeGlobalTensorsPassBase) + +protected: + ::mlir::Pass::Option allow_mutable_tensors{*this, "allow-mutable-tensors", ::llvm::cl::desc("Allows mutable tensors to be in the graph."), ::llvm::cl::init(false)}; +}; + +template +class LowerGlobalsToMlProgramPassBase : public ::mlir::OperationPass { +public: + using Base = LowerGlobalsToMlProgramPassBase; + + LowerGlobalsToMlProgramPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + LowerGlobalsToMlProgramPassBase(const LowerGlobalsToMlProgramPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-saved-model-lower-globals-to-mlprogram"); + } + ::llvm::StringRef getArgument() const override { return "tf-saved-model-lower-globals-to-mlprogram"; } + + ::llvm::StringRef getDescription() const override { return "Remove (and remap) function arguments that map to global tensors."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LowerGlobalsToMlProgramPass"); + } + ::llvm::StringRef getName() const override { return "LowerGlobalsToMlProgramPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LowerGlobalsToMlProgramPassBase) + +protected: +}; + +template +class LowerVariableOpsToMlProgramPassBase : public ::mlir::OperationPass { +public: + using Base = LowerVariableOpsToMlProgramPassBase; + + LowerVariableOpsToMlProgramPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + LowerVariableOpsToMlProgramPassBase(const LowerVariableOpsToMlProgramPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-saved-model-lower-variable-ops-to-mlprogram"); + } + ::llvm::StringRef getArgument() const override { return "tf-saved-model-lower-variable-ops-to-mlprogram"; } + + ::llvm::StringRef getDescription() const override { return "Lower tf.ReadVariable and tf.AssignVariable"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LowerVariableOpsToMlProgramPass"); + } + ::llvm::StringRef getName() const override { return "LowerVariableOpsToMlProgramPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LowerVariableOpsToMlProgramPassBase) + +protected: +}; + +template +class OptimizeGlobalTensorsPassBase : public ::mlir::OperationPass { +public: + using Base = OptimizeGlobalTensorsPassBase; + + OptimizeGlobalTensorsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + OptimizeGlobalTensorsPassBase(const OptimizeGlobalTensorsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-saved-model-optimize-global-tensors"); + } + ::llvm::StringRef getArgument() const override { return "tf-saved-model-optimize-global-tensors"; } + + ::llvm::StringRef getDescription() const override { return "Optimize tf_saved_model.global_tensor's."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("OptimizeGlobalTensorsPass"); + } + ::llvm::StringRef getName() const override { return "OptimizeGlobalTensorsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(OptimizeGlobalTensorsPassBase) + +protected: +}; + +template +class RemoveVariablesInSessionInitializerPassBase : public ::mlir::OperationPass { +public: + using Base = RemoveVariablesInSessionInitializerPassBase; + + RemoveVariablesInSessionInitializerPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + RemoveVariablesInSessionInitializerPassBase(const RemoveVariablesInSessionInitializerPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-saved-model-remove-vars-in-session-initializer"); + } + ::llvm::StringRef getArgument() const override { return "tf-saved-model-remove-vars-in-session-initializer"; } + + ::llvm::StringRef getDescription() const override { return "Remove variables in tf saved model's session initializer."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("RemoveVariablesInSessionInitializerPass"); + } + ::llvm::StringRef getName() const override { return "RemoveVariablesInSessionInitializerPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(RemoveVariablesInSessionInitializerPassBase) + +protected: +}; + +template +class StripSavedModuleMetadataPassBase : public ::mlir::OperationPass { +public: + using Base = StripSavedModuleMetadataPassBase; + + StripSavedModuleMetadataPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + StripSavedModuleMetadataPassBase(const StripSavedModuleMetadataPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-strip-saved-module-metadata"); + } + ::llvm::StringRef getArgument() const override { return "tf-strip-saved-module-metadata"; } + + ::llvm::StringRef getDescription() const override { return "Removes saved_model attributes."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("StripSavedModuleMetadataPass"); + } + ::llvm::StringRef getName() const override { return "StripSavedModuleMetadataPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(StripSavedModuleMetadataPassBase) + +protected: +}; +#undef GEN_PASS_CLASSES +#endif // GEN_PASS_CLASSES diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/unroll_batch_matmul.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/unroll_batch_matmul.h new file mode 100644 index 0000000000000000000000000000000000000000..39ceab7cc1de73916a48a1cb6b37128c1fa85d43 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/transforms/unroll_batch_matmul.h @@ -0,0 +1,39 @@ +/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSFORMS_UNROLL_BATCH_MATMUL_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSFORMS_UNROLL_BATCH_MATMUL_H_ + +#include "llvm/ADT/ArrayRef.h" +#include "mlir/IR/Location.h" // from @llvm-project +#include "mlir/IR/OperationSupport.h" // from @llvm-project +#include "mlir/IR/PatternMatch.h" // from @llvm-project +#include "mlir/IR/TypeUtilities.h" // from @llvm-project +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_ops.h" +#include "tensorflow/core/util/matmul_bcast.h" + +namespace mlir { +namespace TF { + +// Populate patterns to unroll tf.BatchMatMulV2 op into a sequence of TF ops. +// Since TFLite does not support BatchMatMul operation, it unrolls a BatchMatMul +// op into tf.Reshape, tf.Slice, tf.MatMul, tf.Pack, and tf.Reshape ops. +void PopulateUnrollTfBatchMatMul(MLIRContext* context, + RewritePatternSet& patterns); + +} // namespace TF +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSFORMS_UNROLL_BATCH_MATMUL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/translate/export_graphdef.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/translate/export_graphdef.h new file mode 100644 index 0000000000000000000000000000000000000000..562226e1c764bcfb9cfd92be80249de6b2200339 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/translate/export_graphdef.h @@ -0,0 +1,60 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSLATE_EXPORT_GRAPHDEF_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSLATE_EXPORT_GRAPHDEF_H_ + +#include "absl/container/flat_hash_set.h" +#include "llvm/ADT/StringRef.h" +#include "mlir/Dialect/Func/IR/FuncOps.h" // from @llvm-project +#include "mlir/IR/BuiltinOps.h" // from @llvm-project +#include "mlir/IR/MLIRContext.h" // from @llvm-project +#include "mlir/IR/Operation.h" // from @llvm-project +#include "tensorflow/compiler/mlir/tensorflow/translate/mlir_roundtrip_flags.h" +#include "tensorflow/core/framework/function.h" +#include "tensorflow/core/framework/graph.pb.h" +#include "tensorflow/core/framework/node_def.pb.h" +#include "tensorflow/core/graph/graph.h" + +namespace tensorflow { +// Given an MLIR module, returns a GraphDef. +tsl::StatusOr> ConvertMlirToGraphdef( + mlir::ModuleOp module, const GraphExportConfig& configs); + +// Converts an MLIR module to TensorFlow graph and FunctionLibraryDefinition. +// The "main" function of the module is stored in the graph and the rest of +// functions are stored in the library. Control ret nodes are stored separately +// in `control_ret_nodes`. +Status ConvertMlirToGraph(mlir::ModuleOp module, + const GraphExportConfig& configs, + std::unique_ptr* graph, + FunctionLibraryDefinition* flib_def, + absl::flat_hash_set* control_ret_nodes); + +// Converts an MLIR module to TensorFlow graph and FunctionLibraryDefinition. +// The "main" function of the module is stored in the graph and the rest of +// functions are stored in the library. +Status ConvertMlirToGraph(mlir::ModuleOp module, + const GraphExportConfig& configs, + std::unique_ptr* graph, + FunctionLibraryDefinition* flib_def); + +// Converts an MLIR function and adds it to a FunctionLibraryDefinition. +Status ConvertMlirFunctionToFunctionLibraryDef(mlir::func::FuncOp func, + const GraphExportConfig& configs, + FunctionDef* function_def); +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSLATE_EXPORT_GRAPHDEF_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/translate/export_tf_dialect_op.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/translate/export_tf_dialect_op.h new file mode 100644 index 0000000000000000000000000000000000000000..ae87dad305a7e078f89862843ee5377b23a7e514 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/translate/export_tf_dialect_op.h @@ -0,0 +1,51 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSLATE_EXPORT_TF_DIALECT_OP_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSLATE_EXPORT_TF_DIALECT_OP_H_ + +#include "llvm/ADT/StringRef.h" +#include "mlir/IR/Operation.h" // from @llvm-project +#include "tensorflow/compiler/mlir/tensorflow/utils/export_utils.h" +#include "tensorflow/core/framework/attr_value.pb.h" +#include "tensorflow/core/framework/node_def.pb.h" +#include "tensorflow/core/framework/node_def_util.h" +#include "tensorflow/core/framework/op_def_builder.h" +#include "tensorflow/core/platform/status.h" + +namespace tensorflow { + +// Extracts the attributes of a MLIR operation and populates the converted +// attributes in a proto map. +Status GetAttrValuesFromOperation( + mlir::Operation* inst, llvm::StringRef name, + const tensorflow::OpRegistrationData* op_reg_data, + bool ignore_unregistered_attrs, AttrValueMap* attributes); + +// Converts a MLIR operation to TensorFlow NodeDef with given node name. This +// name should be unique to the graph it is being inserted to. If the +// `ignore_unregistered_attrs` argument is set to true, the attributes which are +// not in the op registry will be ignored. If the `ignore_unregistered_attrs` +// argument is not set to true, _output_shapes attribute is added to nodes with +// ShapedType for the leading values with ShapedType in the results of the +// nodes. Set it to true if the returned NodeDef will be executed by the linked +// TF Eager runtime. +StatusOr> ConvertTFDialectOpToNodeDef( + mlir::Operation* inst, llvm::StringRef name, + bool ignore_unregistered_attrs); + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSLATE_EXPORT_TF_DIALECT_OP_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/translate/import_model.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/translate/import_model.h new file mode 100644 index 0000000000000000000000000000000000000000..182a53078ba215e5da199737ae2352f41ab9b49f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/translate/import_model.h @@ -0,0 +1,148 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSLATE_IMPORT_MODEL_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSLATE_IMPORT_MODEL_H_ + +#include + +#include "absl/strings/string_view.h" +#include "mlir/Dialect/Func/IR/FuncOps.h" // from @llvm-project +#include "mlir/IR/BuiltinOps.h" // from @llvm-project +#include "mlir/IR/MLIRContext.h" // from @llvm-project +#include "mlir/IR/OperationSupport.h" // from @llvm-project +#include "mlir/Support/LLVM.h" // from @llvm-project +#include "tensorflow/cc/saved_model/bundle_v2.h" +#include "tensorflow/cc/saved_model/loader.h" +#include "tensorflow/compiler/mlir/tensorflow/translate/mlir_import_options.h" +#include "tensorflow/compiler/mlir/tensorflow/translate/mlir_roundtrip_flags.h" +#include "tensorflow/core/framework/function.h" +#include "tensorflow/core/framework/graph.pb.h" +#include "tensorflow/core/framework/graph_debug_info.pb.h" +#include "tensorflow/core/graph/graph.h" + +namespace tensorflow { + +inline constexpr absl::string_view kImportModelDefaultGraphFuncName = "main"; + +// Given a GraphDef, returns a MLIR module containing the graph, expressed with +// tf_executor dialect. +tsl::StatusOr> ConvertGraphdefToMlir( + const GraphDef& graphdef, const GraphDebugInfo& debug_info, + const GraphImportConfig& specs, mlir::MLIRContext* context, + bool add_default_attributes = true); + +// Given a Graph, returns a MLIR module containing the graph, expressed with +// tf_executor dialect. +tsl::StatusOr> ConvertGraphToMlir( + const Graph& graph, const GraphDebugInfo& debug_info, + const FunctionLibraryDefinition& flib_def, const GraphImportConfig& specs, + mlir::MLIRContext* context); + +// [Experimental] +// Given a Function, returns a MLIR module containing the graph, expressed with +// tf_executor dialect. +tsl::StatusOr> ConvertFunctionToMlir( + const FunctionBody* fbody, const FunctionLibraryDefinition& flib_def, + mlir::MLIRContext* context); + +// Given a SavedModel, returns a MLIR module containing the functions, expressed +// with tf_executor dialect. +tsl::StatusOr> ConvertSavedModelToMlir( + SavedModelV2Bundle* saved_model, mlir::MLIRContext* context, + absl::Span exported_names, MLIRImportOptions options = {}); + +// Given a V1 SavedModel, returns a MLIR module containing the functions, +// expressed with tf_executor dialect. +tsl::StatusOr> ConvertSavedModelV1ToMlir( + const SavedModelBundle& saved_model, absl::Span exported_names, + mlir::MLIRContext* context, MLIRImportOptions options = {}); + +// Given a V1 SavedModel, returns a MLIR module containing the functions, +// expressed with tf_executor dialect. It does not require a session to be +// created and it does not perform any graph transformation. If `exported_names` +// is std::nullopt, all signatures will be imported. Otherwise, only names +// in `exported_names` are imported. +// +// Note that the word `Lite` means it is a lighter version compared to +// ConvertSavedModelV1ToMlir(), and is not related to TFLite. +// +// TODO(b/179683149): Rename this class to avoid confusion with TFLite. +tsl::StatusOr> ConvertSavedModelV1ToMlirLite( + const MetaGraphDef& meta_graph_def, const GraphDebugInfo& debug_info, + std::optional> exported_names, + mlir::MLIRContext* context, MLIRImportOptions options); + +// SavedModelMLIRImportInput is an adapter class for users to inject custom +// graph transformation logic on Tensorflow graphs before importing to MLIR. It +// serves as the source that provides the subgraphs requested by the savedmodel +// MLIR importer, and at the same time it allows the implementation of this +// class to transform the graph before feeding it to the importer. +class SavedModelMLIRImportInput { + public: + SavedModelMLIRImportInput(const MetaGraphDef* meta_graph_def, + const GraphDebugInfo& debug_info) + : meta_graph_def_(meta_graph_def), debug_info_(debug_info) { + DCHECK(meta_graph_def); + } + + virtual ~SavedModelMLIRImportInput(); + + // The original MetaGraphDef of the savedmodel. + const MetaGraphDef& meta_graph_def() const { return *meta_graph_def_; } + + const GraphDebugInfo& debug_info() const { return debug_info_; } + + // GetSubGraph() is expected to return a tensorflow::Graph that contains the + // node set specified in `specs`. The implementation is free to transform the + // graph in the original savedmodel as needed, as long as it produces the same + // results and effects. If the transformation requires some configs in `spec` + // (e.g., control_outputs) to be changed, they should be updated accordingly + // and remain valid for the graph. + // `name` is a unique identifier for this subgraph, so the implementation can + // use it for eg. debugging or caching compilation results. + virtual tsl::StatusOr GetSubGraph(absl::string_view name, + GraphImportConfig& specs) = 0; + + private: + const MetaGraphDef* meta_graph_def_ = nullptr; + GraphDebugInfo debug_info_; +}; + +// Given the SavedModelMLIRImportInput for a saved model, returns a MLIR module +// containing the functions, expressed with tf_executor dialect. It does not +// require a session to be created. If `exported_names` is std::nullopt, all +// signatures will be imported. Otherwise, only names in `exported_names` are +// imported. + +// +// Note that the word `Lite` means it is a lighter version compared to +// ConvertSavedModelV1ToMlir(), and is not related to TFLite. +// +// TODO(b/179683149): Rename this class to avoid confusion with TFLite. +tsl::StatusOr> ConvertSavedModelV1ToMlirLite( + SavedModelMLIRImportInput& input, + std::optional> exported_names, + mlir::MLIRContext* context, + bool unconditionally_use_set_output_shapes = false); + +// Serialize a MLIR module to a string. +std::string MlirModuleToString(mlir::ModuleOp module, + mlir::OpPrintingFlags flags); +std::string MlirModuleToString(mlir::ModuleOp m, bool show_debug_info = false); + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSLATE_IMPORT_MODEL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/translate/mlir_import_options.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/translate/mlir_import_options.h new file mode 100644 index 0000000000000000000000000000000000000000..44262d0bd08d86e5c72df287245bfb6e42f32b7e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/translate/mlir_import_options.h @@ -0,0 +1,56 @@ +/* Copyright 2021 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSLATE_MLIR_IMPORT_OPTIONS_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSLATE_MLIR_IMPORT_OPTIONS_H_ + +namespace tensorflow { + +// TODO(jpienaar): This file and class are confusingly named. This seems to be +// a SavedModel only import options file that exposes a subset of the +// GraphImportConfig options, but the naming would make one think it is more +// general. +struct MLIRImportOptions { + // If true, functionalize the input graph before importing it into MLIR. + bool upgrade_legacy = false; + + // Whether to unconditionally use the shape set via _output_shapes on import. + bool unconditionally_use_set_output_shapes = false; + + // Apply default attributes from the op definition to the loaded op. + bool add_default_attributes = true; + + // If set, promote tf.VarHandleOp to resource arguments for all functions. + bool lift_variables = true; + + // Keeps the variables in initializers before lifting variables (when + // `lift_variables == true`) or newly adding variable initialization patterns + // in the initializer functions. One might want to set this to `true` because + // the `RemoveVariablesInSessionInitializerPass` pass, which runs otherwise, + // may unexpectedly also remove the initialization patterns for non-variable + // resources (like hash tables) if they involve variables. Such a case is + // illustrated in the test file + // "../tests/tf_saved_model_remove_vars_in_session_initializer.mlir". + // This defaults to `false` to avoid breaking existing uses. + bool include_variables_in_initializers = false; + + // Load the model without restoring associated variables from disk. Enables + // loading raw programs without checkpoints. + bool allow_uninitialized_variables = false; +}; + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSLATE_MLIR_IMPORT_OPTIONS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/translate/mlir_roundtrip_flags.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/translate/mlir_roundtrip_flags.h new file mode 100644 index 0000000000000000000000000000000000000000..00fd5b7de6aa4dd5c3958653bca67e366fd2850b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/translate/mlir_roundtrip_flags.h @@ -0,0 +1,159 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSLATE_MLIR_ROUNDTRIP_FLAGS_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSLATE_MLIR_ROUNDTRIP_FLAGS_H_ + +#include +#include + +#include "absl/container/flat_hash_set.h" +#include "llvm/ADT/MapVector.h" +#include "llvm/ADT/StringMap.h" +#include "tensorflow/core/framework/tensor_shape.pb.h" +#include "tensorflow/core/framework/types.h" +#include "tensorflow/core/framework/types.pb.h" +#include "tensorflow/core/lib/core/status.h" + +namespace tensorflow { + +struct ArrayInfoBase { + // The node type when the input node is imported. Typically needs to be + // specified when passing arbitrary nodes (some node attributes are removed). + DataType imported_dtype; + + // Node "shape" attribute value. + TensorShapeProto shape; +}; + +struct ArrayInfo : public ArrayInfoBase { + using SubTypeInfo = ArrayInfoBase; + // DT_RESOURCE and DT_VARIANT have subtypes + std::vector subtypes; +}; + +struct GraphImportConfig { + // Returns string representation of config. + std::string str() const; + + using InputArrays = + llvm::MapVector>; + // The name assigned to the function which is the import result of the given + // graph. If empty, a default one will be used. + std::string graph_func_name; + // Maps input node names to node data types and shapes. + InputArrays inputs; + // name:index strings for the data outputs. + std::vector outputs; + // name strings for the control outputs. + std::vector control_outputs; + // Setting prune_unused_nodes to true, would prune unreachable nodes if + // output_arrays is specified. + bool prune_unused_nodes = false; + // If true, inputs of type LegacyFedInput are replaced with Placeholder ops. + // LegacyFedInput ops have two outputs unlike Placeholder which has only one + // output, so if both outputs of the LegacyFedInput ops are used then returns + // an error. + bool convert_legacy_fed_inputs = false; + // If true, the main graph will be treated as a function. + bool graph_as_function = false; + // If true, upgrade legacy features of the graph (for instance, functionalize + // control-flow). + bool upgrade_legacy = false; + // If true, functionalization is restricted to nodes that will be + // XLA-compiled. This is only needed if + // - `upgrade_legacy` is true + // - upgrading legacy features of the graph (which includes functionalization) + // runs before compilation cluster extraction (as for MLIR-based TPU bridge) + // - session runtime is used (session runtime has issues with function names + // rewritten by functionalization). + // Otherwise, this parameter should be set to false. + bool restrict_functionalization_to_compiled_nodes = false; + // If true, enables shape inference on input. + // TODO(jpienaar): This will be removed shortly. + bool enable_shape_inference = true; + // _output_shapes is an unregistered attribute which is used during + // GraphConstructor::ConvertGraph to override shapes. It is unfortunately + // not always set correctly (which is undesirable and should be addressed) + // so make it opt-in to consider it unconditionally also when importing the + // graph. + bool unconditionally_use_set_output_shapes = false; + // If set, use the value as the device type and mark the function graph for + // XLA compilation. + string xla_compile_device_type; + // If true, enables moving ops to different devices or moving unsupported ops + // out of a compilation cluster. + bool enable_soft_placement = false; + // If true, a function attribute, `tf._original_func_name`, will be set in + // functions which contains the corresponding original TF function name. + bool set_original_tf_func_name = false; +}; + +struct GraphExportConfig { + // Whether to export shape attribute for the NodeDefs in the GraphDef. + bool export_shapes = true; + // Whether to export library field in the GraphDef. + bool export_library = true; + // Whether to export debug original node name in the GraphDef. + bool export_debug_info = true; + // Whether to export the entry function to function library instead of the + // graph. + bool export_entry_func_to_flib = false; + // Whether to export functions using the name set in the attribute + // `tf._original_func_name` if it exists. + bool export_original_tf_func_name = false; +}; + +// Parses the command line flag strings to the specification of nodes in +// the Graph. +Status ParseOutputArrayInfo(absl::string_view array_names, + std::vector* outputs); + +Status ParseOutputArrayInfo(const std::vector& output_names, + std::vector* outputs); + +// Parses the command line flag strings to the specification of nodes in +// the Graph. `data_types` input string can be empty since the flag is optional. +Status ParseInputArrayInfo(absl::string_view array_names, + absl::string_view data_types, + absl::string_view shapes, + GraphImportConfig::InputArrays* inputs); + +Status ParseInputArrayInfo( + const std::vector& node_names, + const std::vector& node_dtypes, + const std::vector>>& node_shapes, + GraphImportConfig::InputArrays* inputs); + +// Parses shapes from the given string into shapes_vector which is a structured +// format. +// NOTE: If shapes_str is empty, shapes_vector will also be empty. +Status ParseNodeShapes( + absl::string_view shapes_str, + std::vector>>& shapes_vector); + +// Parses names from the given string into the names_vector. +// NOTE: If names_str is empty, names_vector will also be empty. +Status ParseNodeNames(absl::string_view names_str, + std::vector& names_vector); + +// Parses data types from the given string into the data_type_vector. +// NOTE: If data_types_str is empty, data_type_vector will also be empty. +Status ParseNodeDataTypes(absl::string_view data_types_str, + std::vector& data_type_vector); + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSLATE_MLIR_ROUNDTRIP_FLAGS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/translate/split_into_island_per_op_pass.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/translate/split_into_island_per_op_pass.h new file mode 100644 index 0000000000000000000000000000000000000000..45924dea9f15de0258b0ba7ff257245801e0b5be --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/translate/split_into_island_per_op_pass.h @@ -0,0 +1,31 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSLATE_SPLIT_INTO_ISLAND_PER_OP_PASS_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSLATE_SPLIT_INTO_ISLAND_PER_OP_PASS_H_ + +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_executor.h" + +namespace mlir { +namespace TF { + +// Converts a single island into multiple islands (one for each op). +void SplitIsland(mlir::tf_executor::IslandOp island_op, + mlir::tf_executor::ControlType control_type); + +} // namespace TF +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSLATE_SPLIT_INTO_ISLAND_PER_OP_PASS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/translate/upgrade_graph.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/translate/upgrade_graph.h new file mode 100644 index 0000000000000000000000000000000000000000..fb2c22ce3858768964a65d74ea3b8d396d2a864e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/translate/upgrade_graph.h @@ -0,0 +1,40 @@ +/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSLATE_UPGRADE_GRAPH_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSLATE_UPGRADE_GRAPH_H_ + +#include "tensorflow/core/framework/function.h" +#include "tensorflow/core/graph/graph.h" + +namespace tensorflow { + +class GraphDef; +class MetaGraphDef; + +// Generate the shared_name for resource handle ops in the graph and functions +// if their shared_names are empty. Resource handle ops with empty shared_name +// may have undesired semantics. +Status GenerateResourceSharedNameIfEmpty( + GraphDef& gdef, const OpRegistryInterface* default_registry); + +// Upgrade the `graph` and `flib_def` by applying control flow +// functionalization. +Status UpgradeLegacyGraph(Graph* graph, FunctionLibraryDefinition* flib_def, + bool restrict_functionalization_to_compiled_nodes); + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_TRANSLATE_UPGRADE_GRAPH_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/attribute_utils.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/attribute_utils.h new file mode 100644 index 0000000000000000000000000000000000000000..c9633620a4621608e5ec02fd94592fc6eb79ed01 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/attribute_utils.h @@ -0,0 +1,179 @@ +/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_ATTRIBUTE_UTILS_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_ATTRIBUTE_UTILS_H_ + +#include +#include + +#include "llvm/ADT/SmallVector.h" +#include "mlir/IR/Attributes.h" // from @llvm-project +#include "mlir/IR/Operation.h" // from @llvm-project +#include "tensorflow/compiler/tf2xla/tf2xla_defs.h" + +namespace mlir { +namespace TF { + +// TODO(b/229028654) Use definitions from tf2xla_defs.h directly. We currently +// don't do this to avoid explicit casts (implicit conversion from +// `absl::string_view` to `llvm::StringRef` is not supported until C++17). + +// Marks a node for XLA compilation. The attribute value indicates the +// compilation device type. +inline constexpr llvm::StringRef kCompileDeviceTypeAttr = + "_xla_compile_device_type"; +// The attribute value speicifes the preferred outlined function name in +// ClusterOutliningPass. +inline constexpr llvm::StringRef kClusterOutlinedFunctionNameAttr = + "_cluster_outlined_function_name"; +// Marks a node for replication. The attribute value indicates the replication +// metadata op. +inline constexpr llvm::StringRef kReplicationInfoAttr = "_replication_info"; +// Marks a node for XLA-TPU compilation. The attribute value indicates the +// associated compilation cluster and replication metadata op. +inline constexpr llvm::StringRef kTpuReplicateAttr = "_tpu_replicate"; +// Device types. +inline constexpr llvm::StringRef kTpuDevice = "TPU"; +// _xla_outside_compilation +inline constexpr llvm::StringRef kXlaOutsideCompilationAttr = + "_xla_outside_compilation"; +// device attr +inline constexpr llvm::StringRef kDeviceAttr = "device"; +// Function attribute to signal that a function should be skipped from TPU +// island outlining. The attribute is set in +// `TpuV1BridgeExecutorIslandCoarsening` and removed in the subsequent +// `TPUBridgeExecutorIslandOutlining` pass. +inline constexpr llvm::StringRef kSkipIslandOutlining = + "_skip_island_outlining"; +// Function attribute to signal which argument contains bounded dynamic +// dimension. +inline constexpr llvm::StringRef kDynamicArgIndexAttr = "_dynamic_arg_index"; + +// This string attribute encodes parallel execution groups and their associated +// branches. It has the following format: +// `_parallel_execution_ids= group1:branch1,group2:branch2,...` +// For example, if we have IR as follows: +// +// tf_executor.island wraps "tf.OpA" +// tf_executor.island { +// "tf_device.replicate" {n = 2} { +// "tf.OpB" +// "tf_device.parallel_execute"() ({ +// "tf.OpC" +// }, { +// "tf.OpD" +// }) +// } +// +// The above IR will be flattened after `ReplicateToIslandPass` and +// `ParallelExecuteToIslandsPass` as follows: +// +// tf_executor.island wraps "tf.OpA" +// tf_executor.island {_parallel_execution_ids=r0:0} wraps "tf.OpB" +// tf_executor.island {_parallel_execution_ids=r0:0,p0:0} wraps "tf.OpC" +// tf_executor.island {_parallel_execution_ids=r0:0,p0:1} wraps "tf.OpD" +// tf_executor.island {_parallel_execution_ids=r0:1} wraps "tf.OpB" +// tf_executor.island {_parallel_execution_ids=r0:1,p0:0} wraps "tf.OpC" +// tf_executor.island {_parallel_execution_ids=r0:1,p0:1} wraps "tf.OpD" +// +// "tf.OpA" will not have `_parallel_execution_ids` attr, +// means it does not belong to any parallel execution groups. +// First instance of "tf.OpB" after flattening will have +// `_parallel_execution_ids = "r0:0"`, +// which represents the first branch of replicate group 0. +// Second instance of "tf.OpB" after flattening will have +// `_parallel_execution_ids = "r0:1"` +// which represents the second branch of replicate group 0. +// First instance of "tf.OpC" after flattening will have +// `_parallel_execution_ids = "r0:0,p0:0"` +// which represents the first branch of replicate group 0 and +// the first branch of parallel group 0. +// Second instance of "tf.OpC" after flattening will have +// `_parallel_execution_ids = "r0:1,p0:0"` +// which represents the second branch of replicate group 0 and +// the first branch of parallel group 0. +// First instance of "tf.OpD" after flattening will have +// `_parallel_execution_ids = "r0:0,p0:1"` +// which represents the first branch of replicate group 0 and +// the second branch of parallel group 0. +// Second instance of "tf.OpD" after flattening will have +// `_parallel_execution_ids = "r0:1,p0:1"` +// which represents the second branch of replicate group 0 and +// the second branch of parallel group 0. +inline constexpr llvm::StringRef kParallelExecAnnotation = + "_parallel_execution_ids"; + +// Copies attributes that satisfy the given predicate from `from` to `to`. +template +void CopyAttributes(Operation *from, Operation *to, Predicate P) { + for (const NamedAttribute &attr : from->getAttrs()) + if (P(attr)) to->setAttr(attr.getName(), attr.getValue()); +} + +// Copies attributes whose name begins with an _ from `from` to `to`. +inline void CopyUnderscoredAttributes(Operation *from, Operation *to) { + CopyAttributes(from, to, [](const NamedAttribute &attr) { + return attr.getName().strref().front() == '_'; + }); +} + +// Copies attributes that are either `device` or whose name begins with an _ +// from `from` to `to`. +// TODO(b/158769932): This should be a general feature instead post some policy +// discussion. +inline void CopyDeviceAndUnderscoredAttributes(Operation *from, Operation *to) { + auto device = mlir::StringAttr::get(from->getContext(), "device"); + CopyAttributes(from, to, [&device](const NamedAttribute &attr) { + return attr.getName().strref().front() == '_' || attr.getName() == device; + }); +} + +// Forward declare these passthrough ops. +// TODO(jpienaar): Remove these and use trait instead. +class IdentityOp; +class IdentityNOp; + +// Returns if a value corresponds to a constant, returns the matched constant +// as an attribute. +template +bool GetValueAsConstant(Value val, AttrT &attr) { + while (auto result = val.dyn_cast()) { + Operation *op = result.getOwner(); + if (!isa(op) && !isa(op)) break; + val = op->getOperand(result.getResultNumber()); + } + return matchPattern(val, m_Constant(&attr)); +} + +// Checks if both compilation and replication attributes are present in the +// operation, and if their values are valid. +LogicalResult HasValidCompilationAndReplicationAttributes(Operation &op); + +// Checks if the device attribute is valid. +LogicalResult IsValidDeviceTypeOrEmpty(StringAttr attr); + +using ParallelExecutionIdPairs = + llvm::SmallVector, 8>; +// Parses the parallel execution attribute for `op` and fills `id_pairs` with +// the corresponding (group ID,branch ID) pairs. +// Returns `failure` if the attribute is malformed. +LogicalResult ParseParallelExecutionIds(Operation *op, + ParallelExecutionIdPairs &id_pairs); + +} // namespace TF +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_ATTRIBUTE_UTILS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/bridge_logger.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/bridge_logger.h new file mode 100644 index 0000000000000000000000000000000000000000..2f65a87bef4d84907b5fef3cdead333fcffae53e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/bridge_logger.h @@ -0,0 +1,98 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_BRIDGE_LOGGER_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_BRIDGE_LOGGER_H_ + +#include +#include + +#include "mlir/IR/Operation.h" // from @llvm-project +#include "mlir/IR/OperationSupport.h" // from @llvm-project +#include "mlir/Pass/Pass.h" // from @llvm-project +#include "mlir/Pass/PassManager.h" // from @llvm-project +#include "mlir/Support/Timing.h" // from @llvm-project + +namespace tensorflow { + +// Logger for logging MLIR modules before and after passes in MLIR TPU bridge. +// +// The IR logging can be restricted to a particular set of pass invocations via +// filters that are specified with the `MLIR_BRIDGE_LOG_PASS_FILTER` and +// `MLIR_BRIDGE_LOG_STRING_FILTER` environment variables. +// `MLIR_BRIDGE_LOG_PASS_FILTER` takes a semicolon-separated list of pass class +// names, `MLIR_BRIDGE_LOG_STRING_FILTER` takes a semicolon-separated list of +// strings, and IR is only dumped for a pass invocation if the pass name exactly +// matches any of the provided pass names and if the serialized operation on +// which the pass is invoked contains any of the specified strings as a +// substring. An empty list is interpreted as no restriction. The string filter +// can be handy e.g. if one is only interested in a certain function or when +// checking where a certain attribute gets lost. Note that we use a semicolon +// instead of comma as the separator to allow strings that contain commas (which +// frequently appear in MLIR). The strings can contain any characters (including +// spaces) except semicolons. +// +// Example: Setting the environment variables +// `MLIR_BRIDGE_LOG_PASS_FILTER="LegalizeTF;Canonicalizer"` and +// `MLIR_BRIDGE_LOG_STRING_FILTER="my_string"` will dump IR only for invocations +// of `LegalizeTF` and `Canonicalizer` where the string `my_string` is contained +// in the serialized operation on which the pass is invoked. For verbose log +// level >= 1, `bridge_logger.cc` prints details about pass invocations for +// which the IR dumping was skipped because of a filter. +class BridgeLoggerConfig : public mlir::PassManager::IRPrinterConfig { + public: + explicit BridgeLoggerConfig( + bool print_module_scope = false, bool print_after_only_on_change = true, + mlir::OpPrintingFlags op_printing_flags = mlir::OpPrintingFlags()); + + // A hook that may be overridden by a derived config that checks if the IR + // of 'operation' should be dumped *before* the pass 'pass' has been + // executed. If the IR should be dumped, 'print_callback' should be invoked + // with the stream to dump into. + void printBeforeIfEnabled(mlir::Pass* pass, mlir::Operation* op, + PrintCallbackFn print_callback) override; + + // A hook that may be overridden by a derived config that checks if the IR + // of 'operation' should be dumped *after* the pass 'pass' has been + // executed. If the IR should be dumped, 'print_callback' should be invoked + // with the stream to dump into. + void printAfterIfEnabled(mlir::Pass* pass, mlir::Operation* op, + PrintCallbackFn print_callback) override; + + // Returns `true` iff we should log IR for given `pass` and `op`. + // Note: Visibility of this function is public for use in unit testing. + bool ShouldPrint(mlir::Pass* pass, mlir::Operation* op); + + private: + // Get `filter` encoded by environment variable `env_var`. + static std::vector GetFilter(const std::string& env_var); + // Returns `true` iff any of the strings in `filter` matches `str`, either + // exactly or as a substring, depending on `exact_match`. + static bool MatchesFilter(const std::string& str, + const std::vector& filter, + bool exact_match); + + // Only log pass invocations whose pass name exactly matches any string in + // `pass_filter_` (or when `pass_filter_` is empty). + const std::vector pass_filter_; + // Only log pass invocations where the serialized operation on which the pass + // is invoked contains any of the specified strings as a substring (or when + // `string_filter_` is empty). + const std::vector string_filter_; +}; + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_BRIDGE_LOGGER_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/call_graph_util.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/call_graph_util.h new file mode 100644 index 0000000000000000000000000000000000000000..ce76653eb9b399f3f4c3e74cfbb9fe3a79fe026c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/call_graph_util.h @@ -0,0 +1,115 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_CALL_GRAPH_UTIL_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_CALL_GRAPH_UTIL_H_ + +#include +#include + +#include "mlir/Dialect/Func/IR/FuncOps.h" // from @llvm-project +#include "mlir/IR/BuiltinOps.h" // from @llvm-project +#include "mlir/Support/LogicalResult.h" // from @llvm-project + +namespace mlir { + +// Check if a function is an entry in an MLIR module. +bool IsEntryFunction(func::FuncOp func); + +// Get all the entry functions in an MLIR module. +llvm::SmallVector GetEntryFunctions(ModuleOp module); + +// Get all the functions referenced in a symber user op and save them in +// `callees`. +LogicalResult GetCallees(SymbolUserOpInterface op, SymbolTable &symtab, + llvm::SmallVector &callees); + +// Find the first op with any of the specified types on each path rooted at the +// `root` node in a tree. Additional checks can be applied via `predicate`. The +// results are stored in `ops`. +template +LogicalResult GetFirstOpsOfType( + func::FuncOp root, SymbolTable &symtab, + const std::function &predicate, + llvm::SmallVector &ops) { + std::stack worklist; + worklist.push(root); + while (!worklist.empty()) { + func::FuncOp u = worklist.top(); + worklist.pop(); + auto result = u.walk([&](SymbolUserOpInterface op) { + if (llvm::isa(op) && (!predicate || predicate(op))) { + ops.push_back(op); + return WalkResult::advance(); + } + llvm::SmallVector callees; + if (GetCallees(op, symtab, callees).failed()) { + return WalkResult::interrupt(); + } + for (auto callee : callees) { + worklist.push(callee); + } + return WalkResult::advance(); + }); + if (result.wasInterrupted()) return failure(); + } + return success(); +} + +// Find the nodes with any of the specified types on the tree rooted at `root` +// node. Additional checks can be applied via `predicate`. The search skips +// the current path if a node with the specified types fails the check, and +// continues on the next path. The passing ops are stored in `hits`, while the +// first failing on on each path is stored in `first_misses`. +template +LogicalResult GetOpsOfTypeUntilMiss( + func::FuncOp root, SymbolTable &symtab, + const std::function &predicate, + llvm::SmallVector &hits, + llvm::SmallVector &first_misses) { + std::stack worklist; + worklist.push(root); + while (!worklist.empty()) { + func::FuncOp u = worklist.top(); + worklist.pop(); + auto result = u.walk([&](SymbolUserOpInterface op) { + if (llvm::isa(op)) { + if (!predicate || predicate(op)) { + hits.push_back(op); + } else { + first_misses.push_back(op); + return WalkResult::advance(); + } + } + llvm::SmallVector callees; + if (GetCallees(op, symtab, callees).failed()) { + return WalkResult::interrupt(); + } + for (auto callee : callees) { + worklist.push(callee); + } + return WalkResult::advance(); + }); + if (result.wasInterrupted()) return failure(); + } + return success(); +} + +// Check if a function has one region and one block only. +bool HasSingleBlock(func::FuncOp func); + +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_CALL_GRAPH_UTIL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/cluster_util.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/cluster_util.h new file mode 100644 index 0000000000000000000000000000000000000000..c521298e97e91d5c29ba113fa5f92268640fb614 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/cluster_util.h @@ -0,0 +1,67 @@ +/* Copyright 2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_CLUSTER_UTIL_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_CLUSTER_UTIL_H_ + +#include +#include + +#include "llvm/ADT/StringRef.h" +#include "mlir/IR/Block.h" // from @llvm-project +#include "mlir/Support/LLVM.h" // from @llvm-project +#include "tensorflow/compiler/mlir/tensorflow/analysis/side_effect_analysis.h" + +namespace mlir::TF { + +// Cluster structure captures all the operations that are assigned to same +// device and can form a legal strict cluster. +// Ops must follow same ordering in their parent block. We rely on this +// assumption to perform analysis. +struct Cluster { + llvm::SetVector ops; + std::string target; +}; + +// Builds the op clusters in the `block`. Ops are filtered by the function +// `get_target` that takes an op and returns the target name. `is_ignored_op` is +// a hook to ignore certain ops that are not included in any clusters. +llvm::StringMap> BuildAllClusters( + Block& block, const TF::SideEffectAnalysis::Info& side_effect_analysis, + std::function get_target, + std::function is_ignored_op); + +// Reorder all users of the given op's results to after the op. +// +// Since launch ops are inserted after the last op in the region, the region is +// guaranteed to dominate all live-in values. On the other hand, it is still +// possible that live-out values don't dominate the region. For example: +// +// ``` +// %0 = "tf.OpA"() +// %1 = "tf.OpB"(%0) +// %2 = "tf.OpC"(%0) +// ``` +// +// Assuming `tf.OpA` and `tf.OpC` are clustered together, the region will be +// inserted right after `tf.OpC`. The live-out `%0`, however, is used by +// `tf.OpB`, which won't dominate the region. This function reorders all users +// of the cluster op to be placed after the cluster op itself so that SSA +// dominance is preserved after cluster op creation. +void ReorderOpResultUses(mlir::Operation* cluster); + +} // namespace mlir::TF + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_CLUSTER_UTIL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/convert_attr.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/convert_attr.h new file mode 100644 index 0000000000000000000000000000000000000000..18f732081de8eea9f48cbc7a5c8b94dd97593dbb --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/convert_attr.h @@ -0,0 +1,39 @@ +/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_CONVERT_ATTR_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_CONVERT_ATTR_H_ + +#include "mlir/IR/Attributes.h" // from @llvm-project +#include "mlir/IR/Builders.h" // from @llvm-project +#include "tensorflow/core/framework/attr_value.pb.h" +#include "tsl/platform/statusor.h" + +namespace tensorflow { + +using tsl::StatusOr; + +// Converts non func AttrValue proto into an MLIR attribute. Func attribute is +// exclused in this function because the function might be renamed when the +// function definition is imported. +StatusOr ConvertNonFuncAttributeValue(const AttrValue& value, + mlir::Builder* builder); + +// Converts all kinds of AttrValue proto into an MLIR attribute. +StatusOr ConvertAttributeValue(const AttrValue& value, + mlir::Builder* builder); + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_CONVERT_ATTR_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/convert_tensor.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/convert_tensor.h new file mode 100644 index 0000000000000000000000000000000000000000..227e4bf465f70b1e89c98832c292d4772609756b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/convert_tensor.h @@ -0,0 +1,68 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_CONVERT_TENSOR_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_CONVERT_TENSOR_H_ + +#include "llvm/ADT/ArrayRef.h" +#include "llvm/ADT/SmallVector.h" +#include "mlir/IR/Attributes.h" // from @llvm-project +#include "mlir/IR/Builders.h" // from @llvm-project +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_attributes.h" +#include "tensorflow/core/framework/tensor.h" +#include "tensorflow/core/framework/tensor.pb.h" +#include "tensorflow/core/framework/tensor_shape.pb.h" +#include "tensorflow/core/protobuf/struct.pb.h" + +namespace tensorflow { + +using tsl::StatusOr; + +// Converts an TensorFlow tensor proto into an MLIR elements attribute. +StatusOr ConvertTensorProto(const TensorProto& input_tensor, + mlir::Builder* builder); + +// Converts an TensorFlow tensor into an MLIR elements attribute. +StatusOr ConvertTensor(const Tensor& input_tensor, + mlir::Builder* builder); + +// Converts a shape from MLIR to a TensorFlow tensor shape proto. +void ConvertToTensorShapeProto(llvm::ArrayRef shape, + TensorShapeProto* output_shape); + +// Converts an MLIR type to a TensorFlow tensor shape. +PartialTensorShape ConvertTypeToTensorShape(const mlir::Type& type); + +// Converts an MLIR shaped type to a TensorFlow shape attribute. +mlir::TF::ShapeAttr ConvertTypeToTensorShapeAttr(const mlir::Type& type); + +// Converts an MLIR shaped type to a Tensorflow tensor spec proto. +absl::StatusOr ConvertTypeToTensorSpecProto( + const mlir::Type& type); + +// Converts a TensorFlow shape attribute to an MLIR shape attribute. +StatusOr ConvertTensorShapeProto(const TensorShapeProto& shape, + mlir::MLIRContext* context); + +// Converts an MLIR elements attribute to a TensorFlow tensor proto. +Status ConvertToTensorProto(mlir::ElementsAttr attr, + TensorProto* output_tensor); + +// Converts an MLIR elements attribute to a TensorFlow tensor. +Status ConvertToTensor(mlir::ElementsAttr attr, Tensor* output_tensor); + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_CONVERT_TENSOR_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/convert_type.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/convert_type.h new file mode 100644 index 0000000000000000000000000000000000000000..35a3d1fb156f2bfe7f452b12390e221bedca9faf --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/convert_type.h @@ -0,0 +1,54 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_CONVERT_TYPE_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_CONVERT_TYPE_H_ + +#include "mlir/IR/Builders.h" // from @llvm-project +#include "mlir/IR/Types.h" // from @llvm-project +#include "tensorflow/core/framework/tensor_shape.h" +#include "tensorflow/core/framework/tensor_shape.pb.h" +#include "tensorflow/core/framework/types.pb.h" + +namespace tensorflow { + +using tsl::StatusOr; + +// Converts the TensorFlow DataType 'dtype' into an MLIR (scalar) type. +Status ConvertDataType(DataType dtype, mlir::Builder builder, mlir::Type* type); + +// Converts a scalar MLIR type to a TensorFlow Datatype. +Status ConvertScalarTypeToDataType(mlir::Type type, DataType* dtype); + +// Converts an MLIR type to TensorFlow DataType. If 'type' is a scalar type, it +// is converted directly. If it is a shaped type, the element type is converted. +Status ConvertToDataType(mlir::Type type, DataType* dtype); + +// Converts an TensorFlow shape to the one used in MLIR. +void ConvertToMlirShape(const TensorShape& input_shape, + llvm::SmallVectorImpl* shape); + +// Converts an TensorFlow shape proto to the one used in MLIR. +Status ConvertToMlirShape(const TensorShapeProto& input_shape, + llvm::SmallVectorImpl* shape); + +// Given a tensor shape and dtype, get the corresponding MLIR tensor type. +StatusOr ConvertToMlirTensorType(const TensorShapeProto& shape, + DataType dtype, + mlir::Builder* builder); + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_CONVERT_TYPE_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/data_dumper_logger_config.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/data_dumper_logger_config.h new file mode 100644 index 0000000000000000000000000000000000000000..e45479bfb090dee8596cd25b08e75b24f3cd86ed --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/data_dumper_logger_config.h @@ -0,0 +1,57 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_DATA_DUMPER_LOGGER_CONFIG_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_DATA_DUMPER_LOGGER_CONFIG_H_ + +#include +#include + +#include "tensorflow/compiler/mlir/tensorflow/utils/bridge_logger.h" + +namespace tensorflow { + +class DataDumperLoggerConfig : public ::tensorflow::BridgeLoggerConfig { + public: + explicit DataDumperLoggerConfig( + std::function + get_filename, + const std::string &pass_prefix = "", bool print_module_scope = false, + bool print_after_only_on_change = true, + mlir::OpPrintingFlags op_printing_flags = mlir::OpPrintingFlags()); + + void printBeforeIfEnabled(mlir::Pass *pass, mlir::Operation *op, + PrintCallbackFn print_callback) override; + + void printAfterIfEnabled(mlir::Pass *pass, mlir::Operation *op, + PrintCallbackFn print_callback) override; + + private: + static void DumpMlir(const std::string &filename, + BridgeLoggerConfig::PrintCallbackFn print_callback); + + // The function to dump the target MLIR string to file. + // The parameter that will be sent to the dump_func_ is: + // The pass name (std::string) + std::function + get_filename_; + + // The pass prefix. + std::string pass_prefix_; +}; + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_DATA_DUMPER_LOGGER_CONFIG_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/device_util.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/device_util.h new file mode 100644 index 0000000000000000000000000000000000000000..14e48bf771062ad162bb725ef8f3bbdb886d64db --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/device_util.h @@ -0,0 +1,53 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_DEVICE_UTIL_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_DEVICE_UTIL_H_ + +#include "llvm/ADT/SmallVector.h" +#include "mlir/IR/Location.h" // from @llvm-project +#include "mlir/IR/Operation.h" // from @llvm-project +#include "mlir/Support/LogicalResult.h" // from @llvm-project +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_structs.h" +#include "tensorflow/core/common_runtime/device_set.h" +#include "tensorflow/core/util/device_name_utils.h" + +namespace tensorflow { + +// Collects all devices known to the system by name and adds them as a +// `tf.devices` dictionary attribute with a full device name as a key, and +// device metadata as a value. +// +// Device names added in full parsed device form: +// /job:/replica:/task:/device:: +// +// Supported device metadata types: +// (1) GpuDeviceMetadata: GPU device compute capability. +void AddDevicesToOp(mlir::Operation* op, const DeviceSet* device_set); + +// Collects devices information from an op `tf.devices` attributes. Returns +// failure if can't parse device metadata from the attribute. +mlir::LogicalResult GetDevicesFromOp(mlir::Operation* op, + mlir::TF::RuntimeDevices* devices); + +// Parses a device string and returns its ordinal (id). This will return an +// error if the device string is invalid or has no id. +mlir::LogicalResult GetDeviceOrdinalFromDeviceString(mlir::Location loc, + llvm::StringRef device, + int64_t* device_ordinal); + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_DEVICE_UTIL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/dump_graph.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/dump_graph.h new file mode 100644 index 0000000000000000000000000000000000000000..2c400925a88cb414674738fb753add2ea8b7cee5 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/dump_graph.h @@ -0,0 +1,75 @@ +/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_DUMP_GRAPH_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_DUMP_GRAPH_H_ + +#include +#include + +#include "mlir/IR/OperationSupport.h" // from @llvm-project +#include "tensorflow/core/framework/function.h" +#include "tensorflow/core/graph/graph.h" +#include "tensorflow/core/platform/status.h" + +namespace tensorflow { + +struct MlirDumpConfig; + +// Dumps 'graph_def' to a file, as textual IR. Returns the file name chosen. +// +// Note: This is for debugging use and is not optimized for performance. +Status DumpTextualIRToFile(const MlirDumpConfig& config, const Graph& graph, + const FunctionLibraryDefinition* flib_def, + WritableFile* file); + +// Config of the textual dump. +struct MlirDumpConfig { + enum class Dialect { + // Tensorflow Graph Dialect + kTFG, + }; + + // The limit of element size that gets printed. + MlirDumpConfig& elide_large_attributes(int large_element_limit = 16) { + this->op_printing_flags.elideLargeElementsAttrs(large_element_limit); + return *this; + } + + // Enable printing of debug information. If 'pretty_form' is set to true, + // debug information is printed in a more readable 'pretty' form but this + // pretty form is not parsable (so only for human readability). + MlirDumpConfig& emit_location_information(bool pretty_form = false) { + this->op_printing_flags.enableDebugInfo(/*enable=*/true, pretty_form); + return *this; + } + + MlirDumpConfig& emit_dialect(Dialect dialect) { + this->dialect = dialect; + return *this; + } + + // Op printing flags. + mlir::OpPrintingFlags op_printing_flags = std::nullopt; + + // The target MLIR dialect. + Dialect dialect = Dialect::kTFG; +}; + +// Change DumpGraphToFile to dump MLIR textual IR instead of protobuf. +void UseMlirForGraphDump(const MlirDumpConfig& = {}); + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_DUMP_GRAPH_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/dump_mlir_util.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/dump_mlir_util.h new file mode 100644 index 0000000000000000000000000000000000000000..a7760872d7931560af399aa559bb3282e984f515 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/dump_mlir_util.h @@ -0,0 +1,105 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_DUMP_MLIR_UTIL_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_DUMP_MLIR_UTIL_H_ + +#include +#include + +#include "absl/strings/string_view.h" +#include "llvm/ADT/StringRef.h" +#include "mlir/IR/Operation.h" // from @llvm-project +#include "mlir/Pass/PassManager.h" // from @llvm-project +#include "tensorflow/core/platform/status.h" + +namespace tensorflow { + +inline constexpr absl::string_view kCrashReproducerStdErr = "-"; +inline constexpr absl::string_view kCrashReproducerCrashAnalysis = + "crash_analysis"; + +// Creates a file to use for dumping and returns success if a file could be +// created. The opened file is placed in 'os' and the path of the file used is +// placed in 'filepath'. +// +// If the TF_DUMP_GRAPH_PREFIX environment variable is kCrashReproducerStdErr, +// then the LOG(INFO) macro is used instead. +// +// This will create a file name via prefixing `name` with the value of the +// TF_DUMP_GRAPH_PREFIX environment variable if `dirname` is empty and +// suffixing `name` with ".mlir". +Status CreateFileForDumping(llvm::StringRef name, + std::unique_ptr* os, + std::string* filepath, + llvm::StringRef dirname = ""); + +// Dumps MLIR operation to a file and returns the file name used. +// +// If the TF_DUMP_GRAPH_PREFIX environment variable is kCrashReproducerStdErr, +// then the MLIR operation will be logged (using the LOG(INFO) macro) instead. +// +// This will create a file name via prefixing `name` with the value of the +// TF_DUMP_GRAPH_PREFIX environment variable if `dirname` is empty and +// suffixing `name` with ".mlir". +// If `pass_manager` is provided, prints a header with the pass pipeline. +std::string DumpMlirOpToFile(llvm::StringRef name, mlir::Operation* op, + llvm::StringRef dirname = "", + const mlir::PassManager* pass_manager = nullptr); + +// Reads the directory to dump the MLIR module from environment variables. +// Default is reading from TF_DUMP_GRAPH_PREFIX, and if the string is 'sponge' +// read from TEST_UNDECLARED_OUTPUTS_DIR. Returns nullptr if the directory +// cannot be determined and generates a warning message. +std::string GetDumpDirFromEnvVar(); + +// Dumps a raw string to a file and returns the file name used. +// +// This will create a file name via prefixing `name` with the value of the +// TF_DUMP_GRAPH_PREFIX environment variable if `dirname` is empty and +// suffixing `name` with ".mlir". +std::string DumpRawStringToFile(llvm::StringRef name, llvm::StringRef content, + llvm::StringRef dirname = ""); + +// Enable the crash reproducer on the provided PassManager to the provided +// directory path. +// If the provided path is empty, it is retrieved from the +// environment variable `MLIR_CRASH_REPRODUCER_DIRECTORY`. +// If the provided path is the string "sponge", the file will be included +// in the sponge "Output Files" by looking up the environment to infer +// the directory path. +// If the provided path is the string kCrashReproducerStdErr, the data is +// dumped into the stderr. +// If the provided path is the string kCrashReproducerCrashAnalysis, the data +// is dumped to the crash analysis system. Note, environment var +// `MLIR_CRASH_REPRODUCER_DIRECTORY` can be used to override +// kCrashReproducerCrashAnalysis settings. +void SetCrashReproducer(mlir::PassManager& pm, llvm::StringRef dir_path = ""); + +// This applies both the PassManagerCLOptions provided by MLIR along with any +// tensorflow specific options. +// +// Note that this function should be in a more appropriate file, but it is +// unclear what a proper file would be as no other functions would currently be +// in the file also. +void applyTensorflowAndCLOptions(mlir::PassManager& pm, + llvm::StringRef dir_path = ""); + +// Prints the pass pipeline of `pass_manager` to `os`. +void PrintPassPipeline(const mlir::PassManager& pass_manager, + mlir::Operation* op, llvm::raw_ostream& os); +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_DUMP_MLIR_UTIL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/dynamic_shape_utils.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/dynamic_shape_utils.h new file mode 100644 index 0000000000000000000000000000000000000000..a06d9664eadabd89591ddb45c716287ce97a4757 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/dynamic_shape_utils.h @@ -0,0 +1,34 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_DYNAMIC_SHAPE_UTILS_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_DYNAMIC_SHAPE_UTILS_H_ + +#include "mlir/IR/BuiltinTypes.h" // from @llvm-project + +namespace tensorflow { + +llvm::SmallVector ConvertTFShapeToMlir(llvm::ArrayRef shapes); + +llvm::SmallVector ConvertMlirShapeToTF(llvm::ArrayRef shape); + +static constexpr int64_t kTFDynamicSize = -1; +mlir::RankedTensorType GetTypeFromTFTensorShape(llvm::ArrayRef shape, + mlir::Type elementType, + mlir::Attribute encoding = {}); + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_DYNAMIC_SHAPE_UTILS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/error_util.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/error_util.h new file mode 100644 index 0000000000000000000000000000000000000000..bd958c8c87fca542779c19c3ddf0584f23f3f737 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/error_util.h @@ -0,0 +1,63 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_ERROR_UTIL_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_ERROR_UTIL_H_ + +#include "mlir/IR/MLIRContext.h" // from @llvm-project +#include "xla/mlir/utils/error_util.h" +#include "tensorflow/core/platform/status.h" + +// Error utilities for MLIR when interacting with code using Status returns. +namespace mlir { + +// TensorFlow's Status is used for error reporting back to callers. +using ::tensorflow::Status; + +// TF customized diagnostic handler that collects all the diagnostics reported +// and can produce a Status to return to callers. This is for the case where +// MLIR functions are called from a function that will return a Status: MLIR +// code still uses the default error reporting, and the final return function +// can return the Status constructed from the diagnostics collected. +// todo: [b/253331656]. Note ConsumeStatus() and Combine() are wrappers +// of what is inherited from the BaseScopedDiagnosticHandler to +// support cases where tensorflow::Status is still being used (base class uses +// absl::Status) +class StatusScopedDiagnosticHandler : public BaseScopedDiagnosticHandler { + public: + // Constructs a diagnostic handler in a context. If propagate is true, then + // diagnostics reported are also propagated back to the original diagnostic + // handler. If filter_stack is true, a reduced stack will be produced. + + explicit StatusScopedDiagnosticHandler(MLIRContext* context, + bool propagate = false, + bool filter_stack = false); + + ~StatusScopedDiagnosticHandler() = default; + // Returns Status corresponding to the diagnostics reported. This consumes + // the diagnostics reported and returns a Status of type Unknown. It is + // required to consume the error status, if there is one, before destroying + // the object. + Status ConsumeStatus(); + + // Returns the combination of the passed in status and consumed diagnostics. + // This consumes the diagnostics reported and either appends the diagnostics + // to the error message of 'status' (if 'status' is already an error state), + // or returns an Unknown status (if diagnostics reported), otherwise OK. + Status Combine(Status status); +}; +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_ERROR_UTIL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/export_utils.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/export_utils.h new file mode 100644 index 0000000000000000000000000000000000000000..86ff64b5ed4d0bdad4b77625654a941b4cef04f9 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/export_utils.h @@ -0,0 +1,96 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_EXPORT_UTILS_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_EXPORT_UTILS_H_ + +#include +#include +#include + +#include "absl/container/flat_hash_set.h" +#include "llvm/ADT/ArrayRef.h" +#include "llvm/ADT/StringRef.h" +#include "mlir/IR/Attributes.h" // from @llvm-project +#include "mlir/IR/Location.h" // from @llvm-project +#include "mlir/IR/Operation.h" // from @llvm-project +#include "mlir/IR/Types.h" // from @llvm-project +#include "tensorflow/core/framework/attr_value.pb.h" +#include "tensorflow/core/framework/function.h" +#include "tensorflow/core/framework/node_def.pb.h" +#include "tensorflow/core/framework/node_def_util.h" +#include "tensorflow/core/lib/core/status.h" + +namespace mlir { +class ShapedType; +} // namespace mlir + +namespace tensorflow { + +using tsl::StatusOr; + +// Add custom op prefix for TensorFlow dialects. +Status AddTensorFlowOpPrefix(std::string); + +// Maps an MLIR op name in the TensorFlow dialect or the TensorFlow control +// dialect back into a TensorFlow valid op name. +StatusOr GetTensorFlowOpName(llvm::StringRef); + +// Converts an MLIR operation to TensorFlow NodeDef with given node name. This +// name should be unique to the graph it is being inserted into. +StatusOr> GetOperationNodeDef( + mlir::Operation* inst, llvm::StringRef name); + +// Converts MLIR attributes with values to their tensorflow equivalent. +// "name" and "device" attributes are ignored by default. Use attrs_to_ignore to +// specify any other attributes that should be ignored. +Status ConvertAttributes( + llvm::ArrayRef attrs, + const absl::flat_hash_set& attrs_to_ignore, + bool remove_ref_type, AttrValueMap* values); + +// Fill in the contents of TensorShapeProto for the given shape. +// ShapeContainerT is any type with the following methods: +// bool hasRank() +// ArrayRef getShape() +// This includes mlir::TF::ShapeAttr and mlir::ShapedType. +template +void SetTensorShapeProto(ShapeContainerT shape, TensorShapeProto* proto) { + if (shape.hasRank()) { + for (int64_t dim : shape.getShape()) { + proto->add_dim()->set_size(mlir::ShapedType::isDynamic(dim) ? -1 : dim); + } + } else { + proto->set_unknown_rank(true); + } +} + +// Sets shape attribute with the given name. If the attribute already exists +// with a different value, returns an error. +Status SetShapeAttribute(absl::string_view name, mlir::ShapedType shape, + AttrValueMap* values); + +// Returns true if the given instruction is an mlir::TF::LegacyCallOp or the +// result of such an operation transformed by the +// ExecutorToControlDialectConversion pass. +// +// TODO(b/145706023): When the ExecutorToControlDialectConversion pass runs +// before the exporter, it mutates an mlir::TF::LegacyCallOp instruction to +// an instruction with a different operation name. As such, this routine checks +// both forms of a LegacyCall instruction. We only need to check for +// mlir::TF::LegacyCallOp when the ticket is resolved. +bool IsLegacyCallInstruction(mlir::Operation* inst); +} // namespace tensorflow +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_EXPORTER_UTILS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/location_utils.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/location_utils.h new file mode 100644 index 0000000000000000000000000000000000000000..c65cbb3ead5ad768d71c561a7e39bef9b6afc1ea --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/location_utils.h @@ -0,0 +1,27 @@ +/* Copyright 2021 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_LOCATION_UTILS_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_LOCATION_UTILS_H_ + +#include "mlir/IR/Location.h" // from @llvm-project + +namespace tensorflow { + +mlir::Location GetLocationWithoutOpType(mlir::Location loc); + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_IMPORT_UTILS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/mangling_util.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/mangling_util.h new file mode 100644 index 0000000000000000000000000000000000000000..d694009a25928b29eebe69cbe8416685b45a3a67 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/mangling_util.h @@ -0,0 +1,61 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_MANGLING_UTIL_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_MANGLING_UTIL_H_ + +#include "absl/strings/string_view.h" +#include "tensorflow/core/framework/tensor.pb.h" +#include "tensorflow/core/framework/tensor_shape.pb.h" +#include "tensorflow/core/framework/types.h" +#include "tensorflow/core/lib/core/status.h" + +namespace tensorflow { +namespace mangling_util { +// The type of a mangled string. +enum class MangledKind { kUnknown, kDataType, kTensorShape, kTensor }; + +// Mangles an attribute name, marking the attribute as a TensorFlow attribute. +string MangleAttributeName(absl::string_view str); + +// Returns true if 'str' was mangled with MangleAttributeName. +bool IsMangledAttributeName(absl::string_view str); + +// Demangles an attribute name that was manged with MangleAttributeName. +// REQUIRES: IsMangledAttributeName returns true. +absl::string_view DemangleAttributeName(absl::string_view str); + +// Returns the type of a mangled string, or kUnknown. +MangledKind GetMangledKind(absl::string_view str); + +// Return a TensorShapeProto mangled as a string. +string MangleShape(const TensorShapeProto& shape); +// Demangle a string mangled with MangleShape. +Status DemangleShape(absl::string_view str, TensorShapeProto* proto); + +// Return a TensorProto mangled as a string. +string MangleTensor(const TensorProto& tensor); +// Demangle a string mangled with MangleTensor. +Status DemangleTensor(absl::string_view str, TensorProto* proto); + +// Return a DataType mangled as a string. +string MangleDataType(const DataType& dtype); +// Demangle a string mangled with MangleDataType. +Status DemangleDataType(absl::string_view str, DataType* proto); + +} // namespace mangling_util +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_MANGLING_UTIL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/parallel_execute_util.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/parallel_execute_util.h new file mode 100644 index 0000000000000000000000000000000000000000..1b0e020151acdc52f9be8d3af036767a94799074 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/parallel_execute_util.h @@ -0,0 +1,41 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_PARALLEL_EXECUTE_UTIL_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_PARALLEL_EXECUTE_UTIL_H_ + +#include "mlir/Support/LogicalResult.h" // from @llvm-project +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_device.h" + +namespace mlir { +namespace TF { + +// TODO(b/243076653): Once the ParallelExecute is added do not remove it. This +// means BuildSingletonParallelExecuteOp will be used in one location, and +// RemoveSingletonParallelExecuteOp can be removed. + +// Wrap `cluster_func` in a `ParallelExecute` with only one child. This +// can be used to canonicalize IR, so there is always one `ParallelExecute`. +tf_device::ParallelExecuteOp BuildParallelExecuteOp( + tf_device::ClusterFuncOp cluster_func, OpBuilder* builder); + +// Unwrap `parallel_execute`'s contents if it only has one child. +LogicalResult RemoveSingletonParallelExecuteOp( + tf_device::ParallelExecuteOp parallel_execute, OpBuilder* builder); + +} // namespace TF +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_PARALLEL_EXECUTE_UTIL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/parse_text_proto.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/parse_text_proto.h new file mode 100644 index 0000000000000000000000000000000000000000..c1f1e3b111d368ca66699262e85df0bfccfb9909 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/parse_text_proto.h @@ -0,0 +1,44 @@ +/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_PARSE_TEXT_PROTO_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_PARSE_TEXT_PROTO_H_ + +#include "absl/strings/string_view.h" +#include "tensorflow/core/lib/core/errors.h" +#include "tensorflow/core/lib/core/status.h" +#include "tensorflow/core/platform/protobuf.h" + +namespace tensorflow { + +// Sets output to the given input with `prefix` stripped, or returns an error if +// the prefix doesn't exist. +Status ConsumePrefix(absl::string_view str, absl::string_view prefix, + absl::string_view* output); + +// Strips `prefix_to_strip` from `text_proto`, parses, and returns the parsed +// proto. +Status ParseTextProto(absl::string_view text_proto, + absl::string_view prefix_to_strip, + protobuf::Message* parsed_proto); +inline Status ParseTextProto(absl::string_view /* text_proto */, + absl::string_view /* prefix_to_strip */, + protobuf::MessageLite* /* parsed_proto */) { + return errors::Unavailable("Cannot parse text protos on mobile."); +} + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_PARSE_TEXT_PROTO_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/serialize_mlir_module_utils.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/serialize_mlir_module_utils.h new file mode 100644 index 0000000000000000000000000000000000000000..9f43603e3888f9c3cd059f8e9e0a2d0cc4a22bc6 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/serialize_mlir_module_utils.h @@ -0,0 +1,40 @@ +/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_SERIALIZE_MLIR_MODULE_UTILS_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_SERIALIZE_MLIR_MODULE_UTILS_H_ + +#include + +#include "llvm/ADT/StringRef.h" +#include "mlir/Dialect/Func/IR/FuncOps.h" // from @llvm-project +#include "mlir/IR/BuiltinOps.h" // from @llvm-project +#include "mlir/IR/MLIRContext.h" // from @llvm-project +#include "tensorflow/core/platform/status.h" + +namespace tensorflow { + +// Prints a MLIR module `module_op` and returns it as a string. +std::string SerializeMlirModule(mlir::ModuleOp module_op); + +// Parses a MLIR module from `mlir_module_string` into `mlir_module` with +// context `mlir_context`. +Status DeserializeMlirModule(llvm::StringRef serialized_mlir_module, + mlir::MLIRContext* mlir_context, + mlir::OwningOpRef* mlir_module); + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_SERIALIZE_MLIR_MODULE_UTILS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/session_utils.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/session_utils.h new file mode 100644 index 0000000000000000000000000000000000000000..be2d3786cb7d508b96abb22f0a974719182fd4ff --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/session_utils.h @@ -0,0 +1,50 @@ +/* Copyright 2021 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_SESSION_UTILS_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_SESSION_UTILS_H_ + +#include +#include + +#include "absl/status/statusor.h" +#include "llvm/ADT/ArrayRef.h" +#include "mlir/Dialect/Func/IR/FuncOps.h" // from @llvm-project +#include "mlir/IR/BuiltinOps.h" // from @llvm-project +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_ops.h" +#include "tensorflow/core/public/session.h" + +namespace mlir { +namespace tf_saved_model { + +// Returns the variable for the provided 'var_handle_op'. +std::string GetVariableName(TF::VarHandleOp var_handle_op); + +// Returns pointer to the variable from 'session' that 'var_handle_op' +// refers to which is in 'device_name' device. If failed to fetch the value null +// will be returned. +// Note, caller is responsible for Unref the variable. +tensorflow::Var* GetVariableFromSession(mlir::TF::VarHandleOp var_handle_op, + llvm::StringRef device_name, + const tensorflow::DeviceMgr* mgr); + +// Returns resource tensors from session for all variables in 'module'. +absl::StatusOr> GetResourcesFromSession( + llvm::ArrayRef var_handle_ops, + tensorflow::Session* session); + +} // namespace tf_saved_model +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_SESSION_UTILS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/shape_inference_utils.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/shape_inference_utils.h new file mode 100644 index 0000000000000000000000000000000000000000..040429ccf7305781c9fd6e525142697132ab3b1a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/shape_inference_utils.h @@ -0,0 +1,46 @@ +/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_SHAPE_INFERENCE_UTILS_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_SHAPE_INFERENCE_UTILS_H_ + +#include + +#include "tensorflow/core/ir/utils/shape_inference_utils.h" + +namespace mlir { + +class Operation; + +namespace TF { + +// Runs TensorFlow shape inference associated to the op type registered in the +// TensorFlow op registry based on the Graph version, operands, and attributes. +// Invoking this shape function will create conversions of parameters to the +// TensorFlow Graph equivalent data structures and back to MLIR equivalent data +// structures. This does not use a natively implemented shape inference in MLIR, +// and instead is temporary until shape functions are reimplemented/migrated to +// being in MLIR instead of the TensorFlow op registry. +LogicalResult InferReturnTypeComponentsForTFOp( + std::optional location, Operation* op, int64_t graph_version, + tfg::OperandAsConstantFn operand_as_constant_fn, + tfg::OpResultAsShapeFn op_result_as_shape_fn, + tfg::ResultElementTypeFn result_element_type_fn, + SmallVectorImpl& inferred_return_shapes); + +} // namespace TF +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_SHAPE_INFERENCE_UTILS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/stablehlo_custom_call.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/stablehlo_custom_call.h new file mode 100644 index 0000000000000000000000000000000000000000..7bb38112f77ee1b006ecc732c80c537c0a529407 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/stablehlo_custom_call.h @@ -0,0 +1,38 @@ +/* Copyright 2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_STABLEHLO_CUSTOM_CALL_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_STABLEHLO_CUSTOM_CALL_H_ + +#include "stablehlo/dialect/StablehloOps.h" // from @stablehlo + +namespace mlir { +namespace TF { + +// Returns whether the custom call op represents a TF function call. +bool IsTfFuncCustomCall(stablehlo::CustomCallOp op); + +// Returns the `called_func` symbol ref attribute in the `tf.backend_config` +// dictionary attribute. +// +// If the op does not represent a TF function call, returns nullptr. +// Otherwise, if the op does not have `caller_name`, returns failure. +FailureOr GetTfFuncCustomCallFuncName( + stablehlo::CustomCallOp op); + +} // namespace TF +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_STABLEHLO_CUSTOM_CALL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/string_util.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/string_util.h new file mode 100644 index 0000000000000000000000000000000000000000..56410385c20a49ffc64c51582a1a55fdeccef4a4 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/string_util.h @@ -0,0 +1,60 @@ +/* Copyright 2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_STRING_UTIL_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_STRING_UTIL_H_ + +#include +#include + +#include "llvm/ADT/StringRef.h" +#include "mlir/IR/Attributes.h" // from @llvm-project +#include "mlir/IR/Operation.h" // from @llvm-project + +// Utility functions for dumping operations/attributes as strings and ostream +// bindings. + +namespace tensorflow { +std::string OpAsString(mlir::Operation& op); +std::string AttrAsString(mlir::Attribute& attr); + +// b/281863212 enable automatic without Op/AttrAsString. +// We add logging via a wrapper struct in order to respect ODS and avoid +// multiple symbol definitions if MLIR or someone else decides to add ostream +// definitions for the MLIR symbols. +struct LoggableOperation { + mlir::Operation& v; + // NOLINTNEXTLINE(google-explicit-constructor) + LoggableOperation(mlir::Operation& v) : v(v) {} +}; +std::ostream& operator<<(std::ostream& o, const LoggableOperation& op); + +struct LoggableAttribute { + mlir::Attribute& v; + // NOLINTNEXTLINE(google-explicit-constructor) + LoggableAttribute(mlir::Attribute& v) : v(v) {} +}; +std::ostream& operator<<(std::ostream& o, const LoggableAttribute& attr); + +struct LoggableStringRef { + const llvm::StringRef& v; + // NOLINTNEXTLINE(google-explicit-constructor) + LoggableStringRef(const llvm::StringRef& v) : v(v) {} +}; +std::ostream& operator<<(std::ostream& o, const LoggableStringRef& ref); + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_STRING_UTIL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/topological_sort.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/topological_sort.h new file mode 100644 index 0000000000000000000000000000000000000000..a62fe17add2462095c7c94f1fbeb8cb9c2c0899f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/topological_sort.h @@ -0,0 +1,70 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_TOPOLOGICAL_SORT_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_TOPOLOGICAL_SORT_H_ + +#include +#include + +#include "absl/types/span.h" +#include "mlir/IR/BuiltinOps.h" // from @llvm-project + +namespace mlir { +namespace TF { + +// A function that determines which op to emit next in the case of ties. +// The predecessor (which can be null) is the last op we emitted, +// and op is the candidate we're considering. A larger returned integer +// means the op has a higher chance of being emitted first. +typedef int (*PriorityFunction)(Operation *predecessor, Operation *op); + +// A function that returns extra dependencies for each op. These might +// e.g. be known side-effects (or control dependencies) between ops. +// If "incoming" is true, then the list of (extra) predecessors of the +// op should be returned. If "incoming" is false, the list of successors. +// The algorithm assumes that these are consistent which each other. So +// if (and only if) op1 is in extra_dependencies(op2, true), then op2 +// must also be in extra_dependencies(op1, false). +// This function is called multiple times during the topological sort, +// so the implementation should preferably be constant-time. +typedef llvm::function_ref const &( + Operation *, bool incoming)> + ExtraDependenciesFunction; + +// Convenience function if there are no extra dependencies to declare. +// (Unlike nullptr, this also works inside the ternary operator) +extern ExtraDependenciesFunction no_extra_dependencies; + +// Sort a block topologically, so that for all ops, all operands are +// available at the time of execution. This is similar to MLIR's topological +// sort (lib/Transforms/TopologicalSort.cpp) but also takes a priority +// function to determine the next op to emit in the case of ambiguity. This +// makes it possible to group operations by certain attributes. For example, +// the order_by_dialect pass uses this function to group by dialect. +// Only the operations nested directly under the block will be reordered. +// Nested blocks will be left alone. +// Also takes a list of control dependencies (vector of operation pairs, +// from->to) that will be honored when ordering the ops together with the +// data dependencies given through (the ops/results of) the operations +// themselves. +std::vector SortBlockTopologically( + Block &block, PriorityFunction priorityFunction, + ExtraDependenciesFunction extraDependencies = no_extra_dependencies); + +} // namespace TF +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_TOPOLOGICAL_SORT_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/tpu_cluster_util.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/tpu_cluster_util.h new file mode 100644 index 0000000000000000000000000000000000000000..46ead1b827b93da13530cce135bab2f8414d7a2c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/tpu_cluster_util.h @@ -0,0 +1,51 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_TPU_CLUSTER_UTIL_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_TPU_CLUSTER_UTIL_H_ + +#include +#include +#include + +#include "mlir/Support/LogicalResult.h" // from @llvm-project +#include "tensorflow/compiler/mlir/tensorflow/utils/tpu_rewrite_device_util.h" + +namespace mlir { +namespace TFTPU { + +// For each TPU cluster in `module`, walk over all ops inside the cluster +// and reachable in the call graph from the cluster. +// For each op walked, `callback` is applied to the op, the root cluster, and +// the root cluster's host device. `callback` returning WasInterrupted +// indicates failure. +// The host device is null when the tpu_cluster HasModelParallelism: The +// HasModelParallelism case is currently unsupported in combination with +// outside compilation. +mlir::LogicalResult WalkReachableFromTpuCluster( + ModuleOp module, std::function)> + callback); + +// Like above, except TPU clusters are not required to have a host device, and +// no host device is passed to `callback`. +mlir::LogicalResult WalkReachableFromTpuCluster( + ModuleOp module, + std::function callback); + +} // namespace TFTPU +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_TPU_CLUSTER_UTIL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/tpu_rewrite_device_util.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/tpu_rewrite_device_util.h new file mode 100644 index 0000000000000000000000000000000000000000..9ed5d7614aaf4c997617632b7c4b89b9e9059fe0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/tpu_rewrite_device_util.h @@ -0,0 +1,301 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_TPU_REWRITE_DEVICE_UTIL_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_TPU_REWRITE_DEVICE_UTIL_H_ + +#include +#include +#include + +#include "absl/strings/string_view.h" +#include "llvm/ADT/ArrayRef.h" +#include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/StringRef.h" +#include "mlir/IR/Attributes.h" // from @llvm-project +#include "mlir/IR/Operation.h" // from @llvm-project +#include "mlir/Support/LogicalResult.h" // from @llvm-project +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_device.h" +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_structs.h" +#include "xla/xla_data.pb.h" +#include "tensorflow/core/lib/core/status.h" +#include "tensorflow/core/platform/statusor.h" +#include "tensorflow/core/util/device_name_utils.h" + +namespace tensorflow { +using tsl::StatusOr; + +inline constexpr absl::string_view kNumCoresPerReplicaAttr = + "num_cores_per_replica"; +inline constexpr absl::string_view kTopologyAttr = "topology"; +inline constexpr absl::string_view kDeviceAssignmentAttr = "device_assignment"; + +// A TPU device for execution alongside its associated host CPU device. +struct TPUDeviceAndHost { + TPUDeviceAndHost() = default; + TPUDeviceAndHost(llvm::StringRef device, llvm::StringRef host) + : device(device), host(host) {} + + std::string device; + std::string host; +}; + +// TPU devices to be used for execution (e.g. devices for TPUExecute ops) and +// their associated host CPU devices (for outside compilation). They are ordered +// by `num_replicas` followed by `num_cores_per_replica`. +using TPUDevicesAndHosts = + llvm::SmallVector, 8>; + +// TPU compilation device, execution and associated host devices, and optionally +// execution device IDs. Execution device IDs are populated if `topology` and +// `device_assignment` are provided. +struct TPUDeviceAssignment { + TPUDeviceAssignment(llvm::StringRef compilation_device, + TPUDevicesAndHosts&& tpu_devices) + : compilation_device(compilation_device), + tpu_devices(std::move(tpu_devices)) {} + + TPUDeviceAssignment(llvm::StringRef compilation_device, + TPUDevicesAndHosts&& tpu_devices, + xla::DeviceAssignmentProto&& xla_device_assignment) + : compilation_device(compilation_device), + tpu_devices(std::move(tpu_devices)), + xla_device_assignment(std::move(xla_device_assignment)) {} + + std::string compilation_device; + TPUDevicesAndHosts tpu_devices; + std::optional xla_device_assignment; +}; + +// Extracts device coordinates from a device assignment attribute on an op. +StatusOr> GetDeviceCoordinates( + mlir::ArrayAttr device_assignment_attr); + +// Finds the TPU compilation device and execution devices from `devices` for a +// TPU computation subgraph. Compilation device is determined from looking up +// all TPU_SYSTEM:0 devices and choosing the CPU device associated to the first +// TPU_SYSTEM device sorted lexicographically by replica and task. Execution +// devices are determined by looking up all TPU devices associated with each +// TPU_SYSTEM:0 device found, alongside associated `topology_attr` and +// `device_assignment_attr`. If `topology_attr` not an empty string (parsable to +// TopologyProto), `device_assignment_attr` must not be empty also. When +// `topology_attr` and `device_assignment_attr` are not empty, a general device +// assignment based on those two attributes are used. Otherwise when +// `topology_attr` and `device_assignment_attr` are empty, a full mesh device +// assignment is used instead. A failure will be returned if it is not possible +// (e.g. invalid devices or invalid parameters). +// +// +// For example, for `devices`: +// { +// /job:localhost/replica:0/task:0/device:CPU:0, +// /job:worker/replica:0/task:0/device:CPU:0, +// /job:worker/replica:0/task:0/device:TPU_SYSTEM:0, +// /job:worker/replica:0/task:0/device:TPU:0, +// /job:worker/replica:0/task:0/device:TPU:1, +// /job:worker/replica:0/task:0/device:TPU:2, +// /job:worker/replica:0/task:0/device:TPU:3, +// /job:worker/replica:0/task:1/device:CPU:0, +// /job:worker/replica:0/task:1/device:TPU_SYSTEM:0, +// /job:worker/replica:0/task:1/device:TPU:0, +// /job:worker/replica:0/task:1/device:TPU:1, +// /job:worker/replica:0/task:1/device:TPU:2, +// /job:worker/replica:0/task:1/device:TPU:3 +// } +// +// +// With the following parameters (full mesh device assignment): +// `num_replicas` = 8 +// `num_cores_per_replica` = 1 +// `topology_attr` = "" +// `device_assignment_attr` = {} +// +// The `compilation_device` will be: +// /job:worker/replica:0/task:0/device:CPU:0 +// +// `execution_devices` will be: +// { +// { +// /job:worker/replica:0/task:0/device:TPU:0 +// }, +// { +// /job:worker/replica:0/task:0/device:TPU:1 +// }, +// { +// /job:worker/replica:0/task:0/device:TPU:2 +// }, +// { +// /job:worker/replica:0/task:0/device:TPU:3 +// }, +// { +// /job:worker/replica:0/task:1/device:TPU:0 +// }, +// { +// /job:worker/replica:0/task:1/device:TPU:1 +// }, +// { +// /job:worker/replica:0/task:1/device:TPU:2 +// }, +// { +// /job:worker/replica:0/task:1/device:TPU:3 +// } +// } +// +// and `xla_device_assignment` will not be set. +// +// +// With the following parameters (general device assignment): +// `num_replicas` = 4 +// `num_cores_per_replica` = 2 +// `topology_attr` (in proto debug string format) = +// { +// mesh_shape: 2 +// mesh_shape: 2 +// mesh_shape: 2 +// num_tasks: 2 +// num_tpu_devices_per_task: 4 +// device_coordinates: 0 +// device_coordinates: 0 +// device_coordinates: 0 +// device_coordinates: 0 +// device_coordinates: 1 +// device_coordinates: 0 +// device_coordinates: 1 +// device_coordinates: 1 +// device_coordinates: 0 +// device_coordinates: 1 +// device_coordinates: 0 +// device_coordinates: 0 +// device_coordinates: 1 +// device_coordinates: 0 +// device_coordinates: 1 +// device_coordinates: 1 +// device_coordinates: 1 +// device_coordinates: 1 +// device_coordinates: 0 +// device_coordinates: 1 +// device_coordinates: 1 +// device_coordinates: 0 +// device_coordinates: 0 +// device_coordinates: 1 +// } +// `device_assignment` = +// {0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1} +// +// The `compilation_device` will be: +// /job:worker/replica:0/task:0/device:CPU:0 +// +// `execution_devices` will be: +// { +// { +// "/job:worker/replica:0/task:0/device:TPU:0", +// "/job:worker/replica:0/task:1/device:TPU:3" +// }, +// { +// "/job:worker/replica:0/task:0/device:TPU:1", +// "/job:worker/replica:0/task:1/device:TPU:2" +// }, +// { +// "/job:worker/replica:0/task:0/device:TPU:3", +// "/job:worker/replica:0/task:1/device:TPU:0" +// }, +// { +// "/job:worker/replica:0/task:0/device:TPU:2", +// "/job:worker/replica:0/task:1/device:TPU:1" +// } +// } +// +// and `xla_device_assignment` will be: +// { +// replica_count: 4 +// computation_count: 2 +// computation_devices { +// replica_device_ids: 0 +// replica_device_ids: 4 +// replica_device_ids: 2 +// replica_device_ids: 6 +// } +// computation_devices { +// replica_device_ids: 1 +// replica_device_ids: 5 +// replica_device_ids: 3 +// replica_device_ids: 7 +// } +// } +StatusOr GetTPUCompilationAndExecutionDevices( + llvm::ArrayRef devices, int num_replicas, + int num_cores_per_replica, llvm::StringRef topology_attr, + llvm::ArrayRef device_assignment_attr); + +// Virtual device name of the passed logical core. The logical core is the index +// of a core within a replica. +std::string GetDeviceAliasForLogicalCore(int core_index); + +// Virtual device name of the host that is associated with the passed logical +// core. The logical core is the index of a core within a replica. +std::string GetDeviceAliasForHostOfLogicalCore(int core_index); + +// Returns true if cluster contains model parallelism based on +// `num_cores_per_replica_attribute`. Otherwise returns false. +bool HasModelParallelism(mlir::tf_device::ClusterOp cluster); + +// Returns true if the devices list contain any TPU devices +bool HasTPUDevice(const mlir::TF::RuntimeDevices& devices); + +// Returns the host device used for outside compilation in generic pipeline. +mlir::LogicalResult GetHostDeviceOutsideCompilationInGenericPipeline( + mlir::TF::RuntimeDevices devices, std::string* host_device); + +// Parses XLA compilation and execution devices from a tf_device.cluster and +// returns the host device for the head and tail computations. For TPU device, +// if the computation is replicated, GetDeviceAliasForHostOfLogicalCore(0) is +// returned instead. +mlir::LogicalResult GetHostDeviceOutsideComputation( + mlir::TF::RuntimeDevices devices, mlir::tf_device::ClusterOp cluster, + std::string* host_device); + +// Checks if a device string is a TPU device. +bool IsTPUDevice(llvm::StringRef device); + +// Checks if a device string is a TPU replicated core device. +bool IsTPUReplicatedCore(llvm::StringRef device); + +// Checks if `type` is allowed for XLA. String and resources are not XLA types. +// There are other TF types that are not XLA types which will be removed by +// successive passes in TF/XLA bridge phase 2. +bool TypeValidForXLA(const mlir::Type& type); + +// Returns the map from core to the host that is associated with the +// core. If `cluster` is not replicated then the core is a physical core index +// and the host is a physical host name. If `cluster` is replicated then the +// core with index `i` is a logical core (`TPU_REPLICATED_CORE_i`), and the host +// is the associated virtual device name (`TPU_REPLICATED_HOST_i`). +mlir::LogicalResult GetDeviceToHostMap( + mlir::tf_device::ClusterOp cluster, + llvm::SmallVector& core_to_host); + +// Returns the first TPU device, for use in the non-replicated case. The list of +// TPU devices is retrived from `op`'s module ancestor. +mlir::LogicalResult GetNonReplicatedTPU0(mlir::Operation* op, + std::string* tpu0_device); + +// Returns the CPU of the first TPU device, for use in the non-replicated case. +// The list of devices is retrived from `op`'s module ancestor. +mlir::LogicalResult GetNonReplicatedCPU0(mlir::Operation* op, + std::string* cpu0_device); + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_TPU_REWRITE_DEVICE_UTIL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/translate_utils.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/translate_utils.h new file mode 100644 index 0000000000000000000000000000000000000000..feccb1754d57813d45c3e662a8a941e9203e95f2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/translate_utils.h @@ -0,0 +1,44 @@ +/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_TRANSLATE_UTILS_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_TRANSLATE_UTILS_H_ + +#include "mlir/Dialect/Func/IR/FuncOps.h" // from @llvm-project +#include "mlir/IR/Builders.h" // from @llvm-project +#include "mlir/IR/BuiltinOps.h" // from @llvm-project +#include "mlir/Support/LogicalResult.h" // from @llvm-project +#include "tensorflow/core/framework/versions.pb.h" +#include "tensorflow/core/platform/statusor.h" + +namespace tensorflow { + +// Populates the tf.versions attribute on a module, given a corresponding +// graph VersionDef proto. +void PopulateTfVersions(mlir::ModuleOp module, const VersionDef& versions); + +// Extracts TensorFlow GraphDef version information from the given module. +// Returns failure if version attribute is missing or any of the sub attributes +// are invalid. +mlir::LogicalResult ExtractTfVersions(mlir::ModuleOp module, + VersionDef* versions); + +// Returns TensorFlow GraphDef producer version for the given module. Returns an +// error if the version information is missing for the module or is not valid. +::tsl::StatusOr GetTfGraphProducerVersion(mlir::ModuleOp module); + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_TRANSLATE_UTILS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/verification_utils.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/verification_utils.h new file mode 100644 index 0000000000000000000000000000000000000000..0fdcfb4799636f70bcea3ea9cdf7c4cf6448ed50 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/verification_utils.h @@ -0,0 +1,30 @@ +/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_VERIFICATION_UTILS_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_VERIFICATION_UTILS_H_ + +#include "mlir/IR/Types.h" // from @llvm-project + +namespace mlir { +namespace TF { + +// Returns success when the given shape argument of the Reshape op is valid. +LogicalResult VerifyShapeOfReshapeOp(ArrayRef shape); + +} // namespace TF +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_VERIFICATION_UTILS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/verify_suitable_for_graph_export.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/verify_suitable_for_graph_export.h new file mode 100644 index 0000000000000000000000000000000000000000..31a6e25ac947cf0232b3735be94e414950867cec --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/verify_suitable_for_graph_export.h @@ -0,0 +1,31 @@ +/* Copyright 2021 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_VERIFY_SUITABLE_FOR_GRAPH_EXPORT_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_VERIFY_SUITABLE_FOR_GRAPH_EXPORT_H_ + +#include "mlir/Dialect/Func/IR/FuncOps.h" // from @llvm-project +#include "mlir/IR/BuiltinOps.h" // from @llvm-project +#include "mlir/Support/LogicalResult.h" // from @llvm-project + +namespace tensorflow { + +// Returns whether all functions in module are of single tf_executor.graph and +// each tf_executor.island in tf_executor.graph only has a single op. +mlir::LogicalResult VerifyExportSuitable(mlir::ModuleOp module); + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_VERIFY_SUITABLE_FOR_GRAPH_EXPORT_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/visitor.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/visitor.h new file mode 100644 index 0000000000000000000000000000000000000000..6a7ada0bdb882458163e19ed9f5a6c1fe383e2b2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/visitor.h @@ -0,0 +1,50 @@ +/* Copyright 2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_VISITOR_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_VISITOR_H_ + +#include "llvm/ADT/StringRef.h" +#include "mlir/Dialect/Func/IR/FuncOps.h" // from @llvm-project +#include "mlir/IR/BuiltinOps.h" // from @llvm-project +#include "mlir/IR/OwningOpRef.h" // from @llvm-project +#include "mlir/IR/SymbolTable.h" // from @llvm-project +#include "mlir/IR/Visitors.h" // from @llvm-project +#include "mlir/Support/LogicalResult.h" // from @llvm-project + +namespace mlir { +namespace TF { + +// Walks the function by following function call chains and calling the callback +// for each reachable function (including `func`). Each function is visited only +// once even if it's called from multiple places and/or recursively. +// +// The current implementation follows direct calls to `mlir::func::FuncOp` only +// and returns a `mlir::WalkResult::interrupt()` when it encounters a call whose +// callee cannot be resolved to `mlir::func::FuncOp`. +mlir::WalkResult WalkReachableFunctions( + mlir::func::FuncOp func, + llvm::function_ref callback, + mlir::SymbolTableCollection* symbol_table = nullptr); + +// Creates a new MLIR module that contains only the given functions and all +// reachable functions from them. +mlir::FailureOr> CreatePrunedModule( + mlir::ModuleOp module, llvm::ArrayRef function_names); + +} // namespace TF +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_VISITOR_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/xla_call_module_attrs.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/xla_call_module_attrs.h new file mode 100644 index 0000000000000000000000000000000000000000..5f8275b21d9e153ff7304af17c89db1bc43b25fd --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/xla_call_module_attrs.h @@ -0,0 +1,44 @@ +/* Copyright 2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_XLA_CALL_MODULE_ATTRS_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_XLA_CALL_MODULE_ATTRS_H_ + +#include "llvm/ADT/StringRef.h" + +namespace mlir { +namespace TF { + +// The main function's name in the serialized stablehlo module embedded in +// XlaCallModule's `module` attribute. +constexpr llvm::StringRef kStablehloMainFunctionName = "main"; + +// After deserializing the stablehlo functions from XlaCallModule, +// this XlaCallModule attribute refers to the deserialized stablehlo main +// function. +constexpr llvm::StringRef kStablehloEntryFunctionAttrName = "_entry_function"; + +// Every stablehlo function deserialized from XlaCallModule has this attribute. +constexpr llvm::StringRef kFromXlaCallModuleAttrName = "_from_xla_call_module"; + +// Name of `tf.XlaCallModule`'s dictionary attribute for keeping the +// deserialized stablehlo module's attributes. +constexpr llvm::StringRef kStablehloModuleAttrsAttrName = + "_stablehlo_module_attrs"; + +} // namespace TF +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_XLA_CALL_MODULE_ATTRS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/xla_rewrite_util.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/xla_rewrite_util.h new file mode 100644 index 0000000000000000000000000000000000000000..d1c8cabf11565378b049d568ed861f63aeec3ce7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/xla_rewrite_util.h @@ -0,0 +1,62 @@ +/* Copyright 2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_XLA_REWRITE_UTIL_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_XLA_REWRITE_UTIL_H_ + +#include +#include +#include + +#include "absl/strings/string_view.h" +#include "llvm/ADT/ArrayRef.h" +#include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/StringRef.h" +#include "mlir/IR/Attributes.h" // from @llvm-project +#include "mlir/Support/LogicalResult.h" // from @llvm-project +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_device.h" +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_ops.h" +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_structs.h" +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_types.h" +#include "xla/xla_data.pb.h" +#include "tensorflow/core/lib/core/status.h" +#include "tensorflow/core/platform/statusor.h" +#include "tensorflow/core/util/device_name_utils.h" + +namespace tensorflow { +// Erase rewritten ClusterFuncOp(s). If TPUPartitionedInputV2Op / +// TPUPartitionedOutputV2Op are present, they must be removed along with the +// ClusterFuncOp(s). +mlir::LogicalResult EraseClusterFuncs( + llvm::MutableArrayRef to_be_erased); + +// Move child processes of the ParallelExecute that do not change. These are all +// children except for the child with the ClusterFunc. +// Returns the index of the child with the ClusterFunc. +int MovePreservedParallelExecuteChildren( + int num_cores_per_replica, + llvm::SmallVector& concatenated_output_types, + mlir::OpBuilder* builder, mlir::tf_device::ClusterFuncOp cluster_func, + mlir::tf_device::ParallelExecuteOp old_parallel_execute, + mlir::tf_device::ParallelExecuteOp* new_parallel_execute); + +// Wraps single op in `tf_device.launch` for explicit device assignment. +mlir::tf_device::LaunchOp WrapOpInLaunch(mlir::OpBuilder* builder, + mlir::Location loc, + mlir::Operation* op, + llvm::StringRef device); + +} // namespace tensorflow +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_XLA_REWRITE_UTIL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/xla_sharding_util.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/xla_sharding_util.h new file mode 100644 index 0000000000000000000000000000000000000000..6295be3776416e3483fe97e5f847a6f4483cd885 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tensorflow/utils/xla_sharding_util.h @@ -0,0 +1,127 @@ +/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_XLA_SHARDING_UTIL_H_ +#define TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_XLA_SHARDING_UTIL_H_ + +#include + +#include "llvm/ADT/ArrayRef.h" +#include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/StringRef.h" +#include "mlir/IR/Attributes.h" // from @llvm-project +#include "mlir/IR/Builders.h" // from @llvm-project +#include "mlir/IR/Operation.h" // from @llvm-project +#include "mlir/IR/Types.h" // from @llvm-project +#include "mlir/IR/Value.h" // from @llvm-project +#include "mlir/Support/LogicalResult.h" // from @llvm-project +#include "tensorflow/compiler/mlir/tensorflow/ir/tf_device.h" +#include "xla/xla_data.pb.h" +#include "tensorflow/core/protobuf/tpu/compile_metadata.pb.h" + +namespace tensorflow { + +inline constexpr llvm::StringRef kInputShardingAttr = + "input_sharding_configuration"; +inline constexpr llvm::StringRef kOutputShardingAttr = + "output_sharding_configuration"; + +// Parses the sharding string. This sharding string can be binary (serialized) +// or human readable. +mlir::LogicalResult DecodeShardingAttribute(const std::string& shard_str, + xla::OpSharding& sharding, + bool report_error = true); + +// Encodes the sharding in human readable form. +mlir::LogicalResult DecodeShardingAttribute(mlir::Attribute shard_attr, + xla::OpSharding& sharding, + bool report_error = true); + +// Parses the sharding attr. This sharding attr can be binary (serialized) +// or human readable. +void EncodeSharding(mlir::Operation* op, llvm::StringRef shard_str); + +// Parses "input_sharding_configuration" attribute and returns a list where i-th +// element is a list of mlir::Value's which represent inputs for the TPU +// computation corresponding to i-th logical device. If the attribute does not +// exist, the all inputs are placed on logical core 0. +mlir::LogicalResult ExtractInputsForLogicalDevices( + int num_cores_per_replica, mlir::tf_device::ClusterFuncOp cluster_func, + mlir::OpBuilder* builder, + llvm::SmallVectorImpl>* input_list); + +// Extracts a list of OpSharding that represent output sharding configuration of +// `tf_device.cluster`. +mlir::LogicalResult ParseAndValidateOutputSharding( + int num_cores_per_replica, mlir::tf_device::ClusterFuncOp cluster_func, + mlir::SmallVector* output_sharding_list); + +// Retrieves output types for TPUExecute op representing execution for provided +// logical device id. TPUExecute op for different logical device may have +// different outputs depending on the output sharding configuration. +mlir::LogicalResult GetOutputTypesForLogicalDeviceComputation( + int core_id, llvm::ArrayRef output_sharding_config, + mlir::tf_device::ClusterFuncOp cluster_func, + llvm::SmallVectorImpl* output_types, + llvm::SmallVectorImpl* cluster_to_core_index); + +// Remaps outputs of `new_parallel_execute` op that represent concurrent +// execution of the `tf_device.cluster_func` at index `cluster_idx` of +// `old_parallel_execute` with its users. +// `num_results_pre_cluster` represent the # of outputs of +// `new_parallel_execute` which are from ops before `tf_device.cluster_func` op +mlir::LogicalResult RemapOutputsFromLogicalDevices( + const mlir::Location& location, + llvm::ArrayRef output_sharding_config, + llvm::SmallVector, 4> cluster_to_core_index, + int num_results_pre_cluster, + mlir::tf_device::ParallelExecuteOp old_parallel_execute, int cluster_idx, + mlir::tf_device::ParallelExecuteOp new_parallel_execute, + mlir::OpBuilder* builder); + +// Determines each logical core argument to metadata argument index mapping, +// based on sharding. The return value is indexed first by logical core then by +// argument index. +llvm::SmallVector, 4> GetMetadataArgumentMapping( + const tpu::TPUCompileMetadataProto& metadata); + +// Gets the proper tensor dimension from XLA OpSharding. +// "replicate_on_last_tile_dim" and "last_tile_dims" should be deducted from the +// real Tensor dimensions when tiled. +// For example: +// f32[8,512](sharding={devices=[1,1,2]0,1 last_tile_dims={REPLICATED}) +// also means a replicated tensor over all devices. +// +// See xla_data.proto for detailed explanations on the fields. +int GetDimsFromXLAShardingTiled(const xla::OpSharding& xla_sharding); + +// A sharding with OTHER type may be REPLICATED if: +// 'replicate_on_last_tile_dim' is true OR +// 'last_tile_dims' is not empty +// AND +// other than replicated last tile dims, all other dims are not sharded. +bool IsOtherReplicatedSharding(const xla::OpSharding& xla_sharding); + +// Returns whether the sharding is split sharding. i.e. A sharding with OTHER +// type but not replicated. +bool IsSplitSharding(const xla::OpSharding& sharding); + +// Returns whether the sharding is replicated. It includes sharding with +// REPLICATED type and replicated OTHER type. +bool IsReplicatedSharding(const xla::OpSharding& sharding); + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_MLIR_TENSORFLOW_UTILS_XLA_SHARDING_UTIL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tf2xla/api/v1/cluster_tf.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tf2xla/api/v1/cluster_tf.h new file mode 100644 index 0000000000000000000000000000000000000000..02a68e741bab10fd5fd2e3f6c92617e4ff2447bf --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tf2xla/api/v1/cluster_tf.h @@ -0,0 +1,43 @@ +/* Copyright 2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TF2XLA_API_V1_CLUSTER_TF_H_ +#define TENSORFLOW_COMPILER_MLIR_TF2XLA_API_V1_CLUSTER_TF_H_ + +#include "mlir/IR/BuiltinOps.h" // from @llvm-project +#include "tensorflow/core/lib/core/status.h" + +namespace tensorflow { +namespace tf2xla { +namespace v1 { + +// Run all the passes involved in transforming the graph before execution so +// that it is suitable for targeting devices when called via the TF1 Session +// API. +// These transformations take as input a Tensorflow Graph as an MLIR Module +// and transforms the module in place to cluster the given ops for compilation +// that is compatible with the given device_type. The MLIR should be in the TF +// Executor Dialect for graph nodes and edges. Individual Op inside a node +// should be the Tensorflow Dialect. The output MLIR is in the TF Executor +// Dialect. The input MLIR should not have infeed and outfeed ops, which are +// unsupported via this API. +// Returns OkStatus if passed, otherwise an error. +tensorflow::Status RunSessionTf2xlaClusteringBridge(mlir::ModuleOp module); + +} // namespace v1 +} // namespace tf2xla +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_MLIR_TF2XLA_API_V1_CLUSTER_TF_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tf2xla/api/v1/compile_mlir_util.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tf2xla/api/v1/compile_mlir_util.h new file mode 100644 index 0000000000000000000000000000000000000000..12e2212ba8144501019a5e87fd3e2fc28f6d2954 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tf2xla/api/v1/compile_mlir_util.h @@ -0,0 +1,219 @@ +/* Copyright 2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TF2XLA_API_V1_COMPILE_MLIR_UTIL_H_ +#define TENSORFLOW_COMPILER_MLIR_TF2XLA_API_V1_COMPILE_MLIR_UTIL_H_ + +#include + +#include "llvm/ADT/ArrayRef.h" +#include "llvm/ADT/StringRef.h" +#include "mlir/Dialect/Func/IR/FuncOps.h" // from @llvm-project +#include "mlir/IR/BuiltinOps.h" // from @llvm-project +#include "mlir/Pass/Pass.h" // from @llvm-project +#include "mlir/Pass/PassManager.h" // from @llvm-project +#include "tensorflow/compiler/tf2xla/layout_util.h" +#include "tensorflow/compiler/tf2xla/xla_argument.h" +#include "tensorflow/compiler/tf2xla/xla_helpers.h" +#include "xla/client/xla_computation.h" +#include "tensorflow/core/common_runtime/device.h" +#include "tensorflow/core/framework/graph_debug_info.pb.h" +#include "tensorflow/core/framework/tensor_shape.h" + +namespace tensorflow { + +// Lowers MLIR module to XLA HLO inside an XlaComputation. The input module +// should only contain operations in tf dialect. If the input module contains +// operation in the tf_executor dialect, for example, returns an error. +// Exception to this are tf_executor dialect ops that are optimized away through +// canonicalization. +// +// Operations in tf dialect are lowered to XLA HLO through the following steps: +// . Legalizes control flow operations. +// . Decomposes compound resource operations so that the only remaining +// operations on resource variables are resource reads/writes.. +// . Replaces resource reads/writes with function inputs/outputs and +// eliminates the use of resource variables. +// . Legalizes the operations to XLA HLO operations. +// . Canonicalizes the XLA HLO operations. +// +// device_type: XLA JIT device to use for compilation such as "XLA_CPU_JIT", +// "XLA_GPU_JIT" or "XLA_TPU_JIT". +// use_tuple_args: when this is true, always create a tuple argument for the +// entry computation. +// enable_op_fallback: when this is true, prefer tf2xla fallback kernels over +// MLIR +// native kernels for legalization to HLO. +// return_tuple: when this is true, always create a tuple result for the +// entry computation. +// shape_determination_fns: Contains layout preference fn and shape +// representation fn. The two functions are used to determine argument and +// result shapes. +// custom_legalization_passes: passes to run before the default TF legalization +// passes for backend-specific ops. +// +// TODO(hinsu): Migrate options to a separate struct. +Status ConvertMLIRToXlaComputation( + mlir::ModuleOp module_op, llvm::StringRef device_type, + xla::XlaComputation* xla_computation, bool use_tuple_args, + bool enable_op_fallback, bool return_tuple, + const XlaShapeLayoutHelpers::ShapeDeterminationFns shape_determination_fns = + {}, + llvm::MutableArrayRef> + custom_legalization_passes = {}, + llvm::StringRef module_name = llvm::StringRef()); + +// Creates a MLIR pipeline that lowers MLIR module to MHLO dialect. The input +// module should only contain operations in tf dialect. For example, if the +// input module contains operation in the tf_executor dialect, the pass raises +// an error unless the tf_executor dialect ops are optimized away by +// canonicalization. +// +// The pipeline is used in ConvertMLIRToXlaComputation. And it generally has the +// following pass structure: +// - TensorFlow passes +// - Legalization passes +// - MHLO passes +// +// device_type: XLA JIT device to use for compilation such as "XLA_CPU_JIT", +// "XLA_GPU_JIT" or "XLA_TPU_JIT". +// enable_op_fallback: when this is true, prefer tf2xla fallback kernels over +// MLIR +// native kernels for legalization to HLO. +// custom_legalization_passes: passes to run before the default TF legalization +// passes for backend-specific ops. +// lower_to_xla_hlo: Temporary parameter to be removed in imminent update. If +// true, includes legalization and MHLO lowering passes. +// allow_partial_conversion: when this is true, allow operations that can't be +// legalized. +void CreateConvertMlirToXlaHloPipeline( + mlir::OpPassManager& pm, llvm::StringRef device_type, + bool enable_op_fallback, + llvm::MutableArrayRef> + custom_legalization_passes, + bool lower_to_xla_hlo = true, bool allow_partial_conversion = false); + +// Helper struct representing argument tensor or resource handle shapes. +struct TensorOrResourceShape { + TensorShape shape; + bool is_resource = false; +}; + +// Refine MLIR types based on new shape information. +Status RefineShapes(llvm::ArrayRef arg_shapes, + mlir::ModuleOp module); + +// Lower TF to MHLO and insert HLO into the XlaBuilder. xla_params are HLO-level +// inputs to module_op that have already been added to the XlaBuilder. returns +// are the returned XlaOps. +Status BuildHloFromTf(mlir::ModuleOp module_op, xla::XlaBuilder& builder, + llvm::ArrayRef xla_params, + std::vector& returns, + llvm::ArrayRef arg_shapes, + llvm::StringRef device_type, + llvm::MutableArrayRef> + custom_legalization_passes); + +// Apply shape, description, and resource information to inputs and outputs +// in the XlaCompilationResult. This should be called after +// compilation_result->computation was set. +Status PopulateResultIOInfo( + mlir::ModuleOp module_op, llvm::ArrayRef arg_shapes, + bool use_tuple_args, bool use_resource_updates_for_aliases, + const XlaShapeLayoutHelpers::ShapeDeterminationFns shape_determination_fns, + XlaCompilationResult* compilation_result); + +// Runs MLIR Bridge on a MLIR module. +// +// If lower_to_xla_hlo is true then compiles down into XLA HLO, generates all +// accompanying metadata and stores them in CompilationResult. +// +// If enable_op_fallback is set to false, graph is legalized only if the graph +// analysis for the graph is successful. Otherwise, an error is returned. +StatusOr CompileMlirToXlaHlo( + mlir::ModuleOp module_op, llvm::ArrayRef arg_shapes, + llvm::StringRef device_type, bool use_tuple_args, bool enable_op_fallback, + bool use_return_tuple, bool use_resource_updates_for_aliases, + XlaShapeLayoutHelpers::ShapeDeterminationFns shape_determination_fns, + XlaCompilationResult* compilation_result, + llvm::MutableArrayRef> + custom_legalization_passes, + llvm::StringRef module_name = llvm::StringRef(), + bool lower_to_xla_hlo = true); + +// Runs MLIR Bridge on a serialized MLIR module. +// +// If lower_to_xla_hlo is true then compiles down into XLA HLO, generates all +// accompanying metadata and stores them in CompilationResult. +StatusOr CompileSerializedMlirToXlaHlo( + llvm::StringRef mlir_module_string, llvm::ArrayRef arg_shapes, + llvm::StringRef device_type, bool use_tuple_args, bool enable_op_fallback, + const XlaShapeLayoutHelpers::ShapeDeterminationFns shape_determination_fns, + XlaCompilationResult* compilation_result, + llvm::MutableArrayRef> + custom_legalization_passes = {}, + llvm::StringRef module_name = llvm::StringRef(), + bool lower_to_xla_hlo = true); + +// Compiles a TensorFlow Graph (already converted to MLIR, imported with +// tf_executor dialect still present) into XLA HLO, generates all accompanying +// metadata and stores them in CompilationResult. This will rewrite arguments +// and run the TensorFlow standard pipeline prior to invoking +// `CompileMlirToXlaHlo`. +Status CompileGraphToXlaHlo( + mlir::ModuleOp module_op, llvm::ArrayRef args, + llvm::StringRef device_type, bool use_tuple_args, bool enable_op_fallback, + bool use_return_tuple, + const XlaShapeLayoutHelpers::ShapeDeterminationFns shape_determination_fns, + XlaCompilationResult* compilation_result, + llvm::MutableArrayRef> + custom_legalization_passes); + +// Compiles a TensorFlow Graph into XLA HLO, generates all accompanying metadata +// and stores them in CompilationResult. +Status CompileGraphToXlaHlo( + const Graph& graph, llvm::ArrayRef args, + llvm::ArrayRef control_rets, llvm::StringRef device_type, + bool use_tuple_args, bool enable_op_fallback, + const FunctionLibraryDefinition& flib_def, const GraphDebugInfo& debug_info, + const XlaShapeLayoutHelpers::ShapeDeterminationFns shape_determination_fns, + XlaCompilationResult* compilation_result, + llvm::MutableArrayRef> + custom_legalization_passes = {}); + +// Compiles a Graph from TF to HLO and adds the resulting HLO to the +// XlaBuilder. This function adds HLO to a larger HLO computation, so +// HLO-level inputs are supplied, and HLO-level outputs are produced. +// xla_params is the HLO-level inputs and returns is the HLO-level outputs. +Status BuildHloFromGraph( + const Graph& graph, xla::XlaBuilder& builder, + mlir::MLIRContext& mlir_context, llvm::ArrayRef xla_params, + std::vector& returns, llvm::ArrayRef args, + llvm::ArrayRef control_rets, llvm::StringRef device_type, + const FunctionLibraryDefinition& flib_def, const GraphDebugInfo& debug_info, + llvm::MutableArrayRef> + custom_legalization_passes = {}); + +static inline Status CompileToHloGraphAnalysisFailedError() { + return errors::Internal("disabled after graph analysis"); +} + +// Register a convenient pipeline for invoking TF/XLA lowering from the command +// line. +void RegisterConvertMlirToXlaHloPipelineWithDefaults(); + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_MLIR_TF2XLA_API_V1_COMPILE_MLIR_UTIL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tf2xla/api/v1/tf_dialect_to_executor.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tf2xla/api/v1/tf_dialect_to_executor.h new file mode 100644 index 0000000000000000000000000000000000000000..2c1386f69f1415372c41a3463015e2d0d0ae755e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tf2xla/api/v1/tf_dialect_to_executor.h @@ -0,0 +1,52 @@ +/* Copyright 2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TF2XLA_API_V1_TF_DIALECT_TO_EXECUTOR_H_ +#define TENSORFLOW_COMPILER_MLIR_TF2XLA_API_V1_TF_DIALECT_TO_EXECUTOR_H_ + +#include "llvm/ADT/StringRef.h" +#include "mlir/IR/BuiltinOps.h" // from @llvm-project +#include "tensorflow/core/platform/status.h" + +namespace tensorflow { +namespace tf2xla { +namespace v1 { + +// Given the input Module op that's in the Tensorflow Dialect, convert the MLIR +// module in place to the Tensorflow Executor Dialect. Returns an OK Status if +// success, otherwise failure with an error message. +// The Tensorflow Executor Dialect is required to export an MLIR module to a +// Tensorflow GraphDef. This API will add control dependencies and verify that +// the conversion was successful. This version adds extra control dependencies +// for replication and parallel execution ops, which may slow performance. +// Prefer to use the v2 of this API. +// +// This also converts the Tensorflow Dialect MLIR into the Tensorflow Executor +// dialect that is suitable to be exported to GraphDef. Graph -> MLIR -> Graph +// is not perfectly round trippable, so this API will attempt to make the module +// exportable and verify some properties of the Tensorflow Executor MLIR that +// are required by Graph Export. It will return an error if it cannot. +// +// Input: A MLIR Module in the Tensorflow Dialect with no +// `tf_device.cluster_func` ops. +// Output: A MLIR module in the Tensorflow Executor Dialect. +tensorflow::Status ExportFromTensorflowDialectToExecutor( + mlir::ModuleOp module, llvm::StringRef module_name = llvm::StringRef()); + +} // namespace v1 +} // namespace tf2xla +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_MLIR_TF2XLA_API_V1_TF_DIALECT_TO_EXECUTOR_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tf2xla/api/v2/tf_dialect_to_executor.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tf2xla/api/v2/tf_dialect_to_executor.h new file mode 100644 index 0000000000000000000000000000000000000000..c410d2227f17d90a2534357199e8656fb3a8c3c6 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tf2xla/api/v2/tf_dialect_to_executor.h @@ -0,0 +1,50 @@ +/* Copyright 2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TF2XLA_API_V2_TF_DIALECT_TO_EXECUTOR_H_ +#define TENSORFLOW_COMPILER_MLIR_TF2XLA_API_V2_TF_DIALECT_TO_EXECUTOR_H_ + +#include "llvm/ADT/StringRef.h" +#include "mlir/IR/BuiltinOps.h" // from @llvm-project +#include "tensorflow/core/platform/status.h" + +namespace tensorflow { +namespace tf2xla { +namespace v2 { + +// Given the input Module op that's in the Tensorflow Dialect, convert the MLIR +// module in place to the Tensorflow Executor Dialect. Returns an OK Status if +// success, otherwise failure with an error message. +// The Tensorflow Executor Dialect is required to export an MLIR module to a +// Tensorflow GraphDef. This API will add control dependencies and verify that +// the conversion was successful. +// +// This also converts the Tensorflow Dialect MLIR into the Tensorflow Executor +// dialect that is suitable to be exported to GraphDef. Graph -> MLIR -> Graph +// is not perfectly round trippable, so this API will attempt to make the module +// exportable and verify some properties of the Tensorflow Executor MLIR that +// are required by Graph Export. It will return an error if it cannot. +// +// Input: A MLIR Module in the Tensorflow Dialect with no +// `tf_device.cluster_func` ops. +// Output: A MLIR module in the Tensorflow Executor Dialect. +tensorflow::Status ExportFromTensorflowDialectToExecutor( + mlir::ModuleOp module, llvm::StringRef module_name = llvm::StringRef()); + +} // namespace v2 +} // namespace tf2xla +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_MLIR_TF2XLA_API_V2_TF_DIALECT_TO_EXECUTOR_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tf2xla/internal/clustering_bridge_passes.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tf2xla/internal/clustering_bridge_passes.h new file mode 100644 index 0000000000000000000000000000000000000000..bd3a04960deed9f2fae194895990b57c4bedf6ec --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tf2xla/internal/clustering_bridge_passes.h @@ -0,0 +1,34 @@ +/* Copyright 2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TF2XLA_INTERNAL_CLUSTERING_BRIDGE_PASSES_H_ +#define TENSORFLOW_COMPILER_MLIR_TF2XLA_INTERNAL_CLUSTERING_BRIDGE_PASSES_H_ + +#include "llvm/ADT/StringRef.h" +#include "mlir/Pass/PassManager.h" // from @llvm-project + +namespace tensorflow { +namespace tf2xla { +namespace internal { + +// Given the pass manager, add Bridge passes to cluster the input. +void AddBridgeClusteringPipelinePasses( + mlir::OpPassManager& pm, llvm::StringRef module_name = llvm::StringRef()); + +}; // namespace internal +}; // namespace tf2xla +}; // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_MLIR_TF2XLA_INTERNAL_CLUSTERING_BRIDGE_PASSES_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tf2xla/internal/inference/inference_passes.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tf2xla/internal/inference/inference_passes.h new file mode 100644 index 0000000000000000000000000000000000000000..7d4bf6609eaabaf015b965326d86ac0ef081f45b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tf2xla/internal/inference/inference_passes.h @@ -0,0 +1,39 @@ +/* Copyright 2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TF2XLA_INTERNAL_INFERENCE_INFERENCE_PASSES_H_ +#define TENSORFLOW_COMPILER_MLIR_TF2XLA_INTERNAL_INFERENCE_INFERENCE_PASSES_H_ + +#include + +#include "mlir/Dialect/Func/IR/FuncOps.h" // from @llvm-project +#include "mlir/IR/BuiltinOps.h" // from @llvm-project +#include "mlir/Pass/Pass.h" // from @llvm-project + +namespace mlir { +namespace tf2xla { +namespace internal { + +std::unique_ptr> CreateInferenceMetricsPass(); + +#define GEN_PASS_REGISTRATION +#define GEN_PASS_DECL_INFERENCEMETRICSPASS +#include "tensorflow/compiler/mlir/tf2xla/internal/inference/inference_passes.h.inc" + +} // namespace internal +} // namespace tf2xla +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TF2XLA_INTERNAL_INFERENCE_INFERENCE_PASSES_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tf2xla/internal/inference/inference_passes.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tf2xla/internal/inference/inference_passes.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..75b6a900877f732df07f3cf28c846684d9dca110 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tf2xla/internal/inference/inference_passes.h.inc @@ -0,0 +1,142 @@ +/* Autogenerated by mlir-tblgen; don't manually edit */ + +#ifdef GEN_PASS_DECL +// Generate declarations for all passes. +#define GEN_PASS_DECL_INFERENCEMETRICSPASS +#undef GEN_PASS_DECL +#endif // GEN_PASS_DECL + +//===----------------------------------------------------------------------===// +// InferenceMetricsPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_INFERENCEMETRICSPASS +#undef GEN_PASS_DECL_INFERENCEMETRICSPASS +#endif // GEN_PASS_DECL_INFERENCEMETRICSPASS +#ifdef GEN_PASS_DEF_INFERENCEMETRICSPASS +namespace impl { + +template +class InferenceMetricsPassBase : public ::mlir::OperationPass { +public: + using Base = InferenceMetricsPassBase; + + InferenceMetricsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + InferenceMetricsPassBase(const InferenceMetricsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf2xla-inference-metrics-pass"); + } + ::llvm::StringRef getArgument() const override { return "tf2xla-inference-metrics-pass"; } + + ::llvm::StringRef getDescription() const override { return "A pass to go over a Module and collect various metrics"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("InferenceMetricsPass"); + } + ::llvm::StringRef getName() const override { return "InferenceMetricsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(InferenceMetricsPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_INFERENCEMETRICSPASS +#endif // GEN_PASS_DEF_INFERENCEMETRICSPASS +#ifdef GEN_PASS_REGISTRATION + +//===----------------------------------------------------------------------===// +// InferenceMetricsPass Registration +//===----------------------------------------------------------------------===// + +inline void registerInferenceMetricsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return internal::CreateInferenceMetricsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerInferenceMetricsPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return internal::CreateInferenceMetricsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// TF2XLA Registration +//===----------------------------------------------------------------------===// + +inline void registerTF2XLAPasses() { + registerInferenceMetricsPass(); +} +#undef GEN_PASS_REGISTRATION +#endif // GEN_PASS_REGISTRATION +// Deprecated. Please use the new per-pass macros. +#ifdef GEN_PASS_CLASSES + +template +class InferenceMetricsPassBase : public ::mlir::OperationPass { +public: + using Base = InferenceMetricsPassBase; + + InferenceMetricsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + InferenceMetricsPassBase(const InferenceMetricsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf2xla-inference-metrics-pass"); + } + ::llvm::StringRef getArgument() const override { return "tf2xla-inference-metrics-pass"; } + + ::llvm::StringRef getDescription() const override { return "A pass to go over a Module and collect various metrics"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("InferenceMetricsPass"); + } + ::llvm::StringRef getName() const override { return "InferenceMetricsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(InferenceMetricsPassBase) + +protected: +}; +#undef GEN_PASS_CLASSES +#endif // GEN_PASS_CLASSES diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tf2xla/internal/logging_hooks.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tf2xla/internal/logging_hooks.h new file mode 100644 index 0000000000000000000000000000000000000000..61c5028a1b8a919697a398a2f199726ba184c488 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tf2xla/internal/logging_hooks.h @@ -0,0 +1,38 @@ +/* Copyright 2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TF2XLA_INTERNAL_LOGGING_HOOKS_H_ +#define TENSORFLOW_COMPILER_MLIR_TF2XLA_INTERNAL_LOGGING_HOOKS_H_ + +#include + +#include "llvm/ADT/StringRef.h" +#include "mlir/Pass/PassManager.h" // from @llvm-project + +namespace tensorflow { +namespace tf2xla { +namespace internal { + +// Setup the input pass manager to enable IR dumping after each pass. +// Note a side effect of this method is that multi threading will be disabled. +void EnablePassIRPrinting(mlir::PassManager& pm, + const std::string& dump_group_name, + llvm::StringRef module_name = llvm::StringRef()); + +}; // namespace internal +}; // namespace tf2xla +}; // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_MLIR_TF2XLA_INTERNAL_LOGGING_HOOKS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tf2xla/internal/mlir_pass_instrumentation.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tf2xla/internal/mlir_pass_instrumentation.h new file mode 100644 index 0000000000000000000000000000000000000000..f4375dfc562f67ffaad6b725f50a8b2cf86c724e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tf2xla/internal/mlir_pass_instrumentation.h @@ -0,0 +1,36 @@ +/* Copyright 2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TF2XLA_INTERNAL_MLIR_PASS_INSTRUMENTATION_H_ +#define TENSORFLOW_COMPILER_MLIR_TF2XLA_INTERNAL_MLIR_PASS_INSTRUMENTATION_H_ + +#include +#include +#include +#include + +#include "mlir/Pass/PassInstrumentation.h" // from @llvm-project + +namespace mlir { + +void RegisterPassInstrumentor( + const std::string& name, + std::function()> creator); +std::vector()>> +GetPassInstrumentors(); + +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TF2XLA_INTERNAL_MLIR_PASS_INSTRUMENTATION_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tf2xla/mlir_bridge_rollout_policy.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tf2xla/mlir_bridge_rollout_policy.h new file mode 100644 index 0000000000000000000000000000000000000000..5c7f47a219e10eb31fe26225c3c10048415ef32e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tf2xla/mlir_bridge_rollout_policy.h @@ -0,0 +1,78 @@ +/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TF2XLA_MLIR_BRIDGE_ROLLOUT_POLICY_H_ +#define TENSORFLOW_COMPILER_MLIR_TF2XLA_MLIR_BRIDGE_ROLLOUT_POLICY_H_ + +#include + +#include "mlir/IR/BuiltinOps.h" +#include "tensorflow/core/graph/graph.h" +#include "tensorflow/core/protobuf/config.pb.h" + +namespace tensorflow { + +enum class MlirBridgeRolloutPolicy { + // The MLIR bridge is explicitly disabled by the user and must not be run. + kDisabledByUser = 0, + // The MLIR bridge is explicitly enabled by the user and must be run. If the + // MLIR bridge errors, the fallback path should NOT be used. + kEnabledByUser, + // The bridge was not explicitly enabled or disabled by the user. Based on the + // features in the model, the MLIR bridge should not be run. + kDisabledAfterGraphAnalysis, + // The bridge was not explicitly enabled or disabled by the user. Based on the + // features in the model, the MLIR bridge should be run. If the MLIR Bridge + // errors, the fallback path should be used whenever possible. + kEnabledAfterGraphAnalysis, +}; + +// Analyzes the user requested policy as well as the contents of the graph and +// returns true when the MLIR Bridge should be run. +// +// If the user explicitly requests the bridge be enabled or disabled, this +// function will respect the request. If the user does not explicitly request +// enabled or disabled, it will decide whether or not to run the bridge. +// +// The config_proto param is a required input for all TF1 graphs but it is +// redundant for TF2 graphs. +// If getting rollout policy involves graph analysis, `record_stats` is used +// to decide whether to emit metrics on unsupported features of the graph. +MlirBridgeRolloutPolicy GetMlirBridgeRolloutPolicy( + const tensorflow::Graph& graph, + const FunctionLibraryDefinition* function_library, + std::optional config_proto, bool run_tpu_bridge, + bool uses_uninitialized_resource_args, bool is_v1_compat, + bool record_stats); + +static inline MlirBridgeRolloutPolicy GetMlirBridge2ndPhaseRolloutPolicy( + mlir::ModuleOp module) { + return MlirBridgeRolloutPolicy::kDisabledAfterGraphAnalysis; +} + +// Explicit Interface for when we want to log features vs test the validity of +// the graph for MLIR bridge processing. Note that right now the logging +// which is done in the logic used by GraphHasFeaturesUnsupportedByMlirBridge +// has diverged and logs supported features as well. Parameters are the same +// as for GetMlirBridgeRolloutPolicy with the exception of +// record_stats, which isn't needed because this interface will always record. +void LogGraphFeatures(const Graph& graph, + const FunctionLibraryDefinition* function_library, + std::optional config_proto, + bool uses_uninitialized_resource_args, bool is_v1_compat); + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_MLIR_TF2XLA_MLIR_BRIDGE_ROLLOUT_POLICY_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tf2xla/transforms/legalization_op_config.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tf2xla/transforms/legalization_op_config.h new file mode 100644 index 0000000000000000000000000000000000000000..cacd0e6ed63aadde7909d59b673700c726a4b96f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tf2xla/transforms/legalization_op_config.h @@ -0,0 +1,47 @@ +/* Copyright 2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TF2XLA_TRANSFORMS_LEGALIZATION_OP_CONFIG_H_ +#define TENSORFLOW_COMPILER_MLIR_TF2XLA_TRANSFORMS_LEGALIZATION_OP_CONFIG_H_ + +#include "mlir/IR/Operation.h" // from @llvm-project +#include "mlir/Support/TypeID.h" // from @llvm-project + +namespace mlir { +namespace mhlo { + +// Given the Operation, return True if the op is legalized with MLIR. +// Returns false if it is legalized with an old TF2XLA Kernel. +bool IsOpLegalizedWithMlir(Operation& op); + +// Given the type ID, check if it's legalized with MLIR. +bool IsTypeLegalizedWithMlir(const TypeID& type_id); + +// Returns True if this op has a Tf2XLA fallback. Currently, this is not the +// inverse of the !IsOpLegalizedWithMlir, but it should be. +bool HasTf2XlaFallback(const TypeID& type_id); + +// Whether this type is allowed to have a TF2XLA fallback. +bool IsOpAllowedTf2xlaFallback(const TypeID& type_id); + +// Whether this type is Preferred to use a TF2XLA fallback kernel when using +// the MLIR bridge. If this is true, then the TF2XLA fallback kernel will be +// used over the MLIR lowering. +bool IsOpAllowedTf2xlaPreferred(const TypeID& type_id); + +} // namespace mhlo +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TF2XLA_TRANSFORMS_LEGALIZATION_OP_CONFIG_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tf2xla/transforms/passes.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tf2xla/transforms/passes.h new file mode 100644 index 0000000000000000000000000000000000000000..e4215725741a6dacf38a878117705e00a41eb6a4 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tf2xla/transforms/passes.h @@ -0,0 +1,137 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TF2XLA_TRANSFORMS_PASSES_H_ +#define TENSORFLOW_COMPILER_MLIR_TF2XLA_TRANSFORMS_PASSES_H_ + +#include +#include + +#include "llvm/ADT/StringRef.h" +#include "mlir/IR/MLIRContext.h" // from @llvm-project +#include "mlir/IR/PatternMatch.h" // from @llvm-project +#include "mlir/Pass/Pass.h" // from @llvm-project +#include "mlir/Pass/PassRegistry.h" // from @llvm-project +#include "mlir/Support/LogicalResult.h" // from @llvm-project +#include "mlir/Transforms/DialectConversion.h" // from @llvm-project + +namespace mlir { + +namespace func { +class FuncOp; +} +class ModuleOp; +class Operation; +template +class OperationPass; +class Pass; + +namespace mhlo { + +/// Lowers from TF dialect to HLO dialect. When allow_partial_conversion is +/// false, emits an error if there is any operation that can't be legalized. +/// When `tf2xla_fallback_device_type` is not `None`, also uses legalization +/// patterns from TF2XLA fallback for provided device type (see +/// legalize_tf_with_tf2xla.cc for details). By default, TF2XLA fallback is not +/// used. +/// Note: This is a module pass because when legalizing with TF2XLA fallback, +/// functions are imported into the module. Importing functions into a +/// module is not thread safe. +std::unique_ptr> createLegalizeTFPass( + bool legalize_chlo = true, + std::optional tf2xla_fallback_device_type = std::nullopt, + bool prefer_tf2xla = false); + +/// Converter to be used along with the fallback Tf2Xla patterns below. +class Tf2XlaTypeConverter : public TypeConverter { + public: + Tf2XlaTypeConverter(); +}; + +/// Adds the TF to XLA via TF2XLA rewrite patterns to the pattern list. +/// `prefer_tf2xla` means an op will be included iff it is not in +/// `MlirLegalizedUnderPreferTf2XlaSet`. `!prefer_tf2xla` mean an op will be +/// included if there is no native MLIR legalization for the op. +void PopulateLegalizeTfWithTf2XlaPatterns(llvm::StringRef device_type, + RewritePatternSet& patterns, + MLIRContext* ctx, + Tf2XlaTypeConverter& converter, + bool prefer_tf2xla = false); + +/// Adds the TF to TF lowerings and TF to XLA rewrite patterns to the pattern +/// list. +void PopulateLegalizeTfPatterns(MLIRContext* context, + RewritePatternSet* patterns); + +// Populates TF to MHLO legalization for some of the quantization ops. +// +// TODO(hinsu): Remove this once we combine quantized and non quantized op +// legalization in the ODML conversion pipeline. +void PopulateLegalizeTfQuantizationPatterns(MLIRContext* context, + RewritePatternSet* patterns); + +/// Converts the provided Operation as well as all nested operations into HLO +/// dialect using the conversion patterns registered by the HLO dialect. When +/// allow_partial_conversion is false, emits an error if there is any operation +/// that can't be legalized. +/// When `tf2xla_fallback_device_type` is not `None`, also uses legalization +/// patterns from TF2XLA fallback for provided device type (see +/// legalize_tf_with_tf2xla.cc for details). By default, TF2XLA fallback is not +/// used. +LogicalResult legalizeTF( + Operation* op, bool allow_partial_conversion = false, + bool legalize_chlo = true, + std::optional tf2xla_fallback_device_type = std::nullopt, + bool prefer_tf2xla = false); + +// Legalizes TF/XLA communication ops (TF dialect) to HLO dialect communication +// ops. +std::unique_ptr> CreateLegalizeTFCommunicationPass(); + +// Legalizes TF/XLA collective ops (TF dialect) to HLO dialect collective +// ops. +std::unique_ptr> CreateLegalizeTFCollectivePass(); + +// Verifies that the TF/XLA ops have all been lowered to MHLO. +std::unique_ptr> CreateVerifyTFXLALegalizationPass( + bool legalize_chlo = true); + +// Transforms TFXLA Device specific ops into device independent ops. +std::unique_ptr> +CreateTFXLADeviceSpecificTransformsPass( + std::optional tf2xla_fallback_device_type = std::nullopt); + +// Adjusts XLA layout for Infeed ops. +std::unique_ptr> +CreateInfeedsOpsXlaAdjustLayoutPass(); + +#define GEN_PASS_REGISTRATION +#define GEN_PASS_DECL_INFEEDSOPSXLAADJUSTLAYOUT +#define GEN_PASS_DECL_LEGALIZETF +#define GEN_PASS_DECL_LEGALIZETFCOLLECTIVE +#define GEN_PASS_DECL_LEGALIZETFMODULEPASS +#define GEN_PASS_DECL_LEGALIZETFTYPESPASS +#define GEN_PASS_DECL_TFXLADEVICESPECIFICTRANSFORMS +#define GEN_PASS_DECL_VERIFYTFXLALEGALIZATION +#include "tensorflow/compiler/mlir/tf2xla/transforms/xla_legalize_tf_passes.h.inc" + +#define GEN_PASS_REGISTRATION +#define GEN_PASS_DECL_LEGALIZETFCOMMUNICATIONPASS +#define GEN_PASS_DECL_LEGALIZETFWITHTF2XLA +#include "tensorflow/compiler/mlir/tf2xla/transforms/tf_xla_passes.h.inc" +} // namespace mhlo +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TF2XLA_TRANSFORMS_PASSES_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tf2xla/transforms/tf2xla_rewriter.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tf2xla/transforms/tf2xla_rewriter.h new file mode 100644 index 0000000000000000000000000000000000000000..71cafc5579ff16e3ec56a027f79a9f282c56bf8b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tf2xla/transforms/tf2xla_rewriter.h @@ -0,0 +1,126 @@ +/* Copyright 2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TF2XLA_TRANSFORMS_TF2XLA_REWRITER_H_ +#define TENSORFLOW_COMPILER_MLIR_TF2XLA_TRANSFORMS_TF2XLA_REWRITER_H_ + +#include +#include +#include + +#include "mlir/Dialect/Func/IR/FuncOps.h" // from @llvm-project +#include "mlir/IR/Operation.h" // from @llvm-project +#include "mlir/IR/PatternMatch.h" // from @llvm-project +#include "mlir/IR/Types.h" // from @llvm-project +#include "mlir/IR/Value.h" // from @llvm-project +#include "mlir/Support/LogicalResult.h" // from @llvm-project +#include "tensorflow/compiler/mlir/op_or_arg_name_mapper.h" +#include "tensorflow/compiler/tf2xla/xla_context.h" +#include "tensorflow/compiler/tf2xla/xla_expression.h" +#include "xla/client/xla_builder.h" +#include "xla/client/xla_computation.h" +#include "xla/mlir_hlo/mhlo/IR/hlo_ops.h" +#include "tensorflow/core/common_runtime/device_mgr.h" +#include "tensorflow/core/framework/op_kernel.h" + +namespace mlir { +namespace mhlo { + +class Tf2XlaRewriterTestPeer; + +class Tf2XlaRewriter { + public: + static mlir::LogicalResult RewriteOp(mlir::Operation* op, + mlir::PatternRewriter& rewriter, + const std::string& device_type); + + private: + friend class Tf2XlaRewriterTestPeer; + + Tf2XlaRewriter(mlir::Operation* op, mlir::PatternRewriter& rewriter, + const std::string& device_type); + + ~Tf2XlaRewriter(); + + // Compiles the given Operation with XlaBuilder and imports the generated HLO + // via the HLO -> MHLO importer. + tsl::StatusOr CompileWithHloImporter( + tensorflow::OpKernelContext& op_context); + + // Import the given XlaComputation into the parent module. Returns the given + // generated function. + tsl::StatusOr ImportXlaComputation( + xla::XlaComputation& computation); + + // Prepares OpKernelContext params common to all the ops. + // Emits an error on failure. + mlir::LogicalResult PrepareParams(); + + // Given the required_consts, it will fill the 3 output vectors with + // their respective data. + // Expressions: Output XLA expressions as required by the compiled kernel. + // Tensors: Vector of tensors that back the TensorValue inputs + // Inputs: Vector of inputs that are backed by tensors. + mlir::LogicalResult PrepareKernelInputs( + const llvm::SmallDenseSet& required_consts, + std::vector& expressions, + std::vector& tensors, + std::vector& inputs); + + mlir::LogicalResult VerifyOpResults(tensorflow::OpKernelContext& op_context); + mlir::LogicalResult GetKernelOutputs(tensorflow::OpKernelContext& op_context, + mhlo::TupleOp tuple_results, + llvm::SmallVector& outputs); + + // Given a translated function with a single return value, unpack the tuple + // results. + mlir::LogicalResult UnpackTupleResults(mhlo::TupleOp tuple_result, + llvm::SmallVector& outputs); + + // Tries to legalize the specified TensorFlow op, if supported. + // + // Emits an error and returns failure if an error is encountered during + // conversion. Note that success return value doesn't mean successful + // legalization. + mlir::LogicalResult LegalizeOp(); + + // Converts the given operand to expression of kind kConstant or kXlaOp. + // Emits a remark and returns expression of kind kInvalid on failure. + tensorflow::XlaExpression GetExprForOperand(mlir::Value operand, + mlir::Operation* op, + int64_t operand_index); + + mlir::Operation* op_; + std::string device_type_; + + mlir::PatternRewriter& rewriter_; + tensorflow::OpOrArgLocNameMapper name_mapper_; + + tensorflow::XlaContext* context_; // Ref-counted. + + std::unique_ptr device_mgr_; + tensorflow::Device* device_; // Owned by device_mgr_; + std::unique_ptr step_container_; + std::unique_ptr flib_def_; + std::unique_ptr pflr_; + tensorflow::OpKernelContext::Params params_; + + xla::XlaBuilder xla_builder_; +}; + +} // namespace mhlo +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TF2XLA_TRANSFORMS_TF2XLA_REWRITER_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tf2xla/transforms/tf_xla_passes.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tf2xla/transforms/tf_xla_passes.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..45dd8807175fe519161094de007530d607d6c098 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tf2xla/transforms/tf_xla_passes.h.inc @@ -0,0 +1,150 @@ +/* Autogenerated by mlir-tblgen; don't manually edit */ + +#ifdef GEN_PASS_DECL +// Generate declarations for all passes. +#define GEN_PASS_DECL_LEGALIZETFCOMMUNICATIONPASS +#undef GEN_PASS_DECL +#endif // GEN_PASS_DECL + +//===----------------------------------------------------------------------===// +// LegalizeTFCommunicationPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_LEGALIZETFCOMMUNICATIONPASS +#undef GEN_PASS_DECL_LEGALIZETFCOMMUNICATIONPASS +#endif // GEN_PASS_DECL_LEGALIZETFCOMMUNICATIONPASS +#ifdef GEN_PASS_DEF_LEGALIZETFCOMMUNICATIONPASS +namespace impl { + +template +class LegalizeTFCommunicationPassBase : public ::mlir::OperationPass { +public: + using Base = LegalizeTFCommunicationPassBase; + + LegalizeTFCommunicationPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + LegalizeTFCommunicationPassBase(const LegalizeTFCommunicationPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-legalize-tf-communication"); + } + ::llvm::StringRef getArgument() const override { return "xla-legalize-tf-communication"; } + + ::llvm::StringRef getDescription() const override { return "Legalize TF/XLA communication ops (TensorFlow dialect) to the HLO dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LegalizeTFCommunicationPass"); + } + ::llvm::StringRef getName() const override { return "LegalizeTFCommunicationPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LegalizeTFCommunicationPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_LEGALIZETFCOMMUNICATIONPASS +#endif // GEN_PASS_DEF_LEGALIZETFCOMMUNICATIONPASS +#ifdef GEN_PASS_REGISTRATION + +//===----------------------------------------------------------------------===// +// LegalizeTFCommunicationPass Registration +//===----------------------------------------------------------------------===// + +inline void registerLegalizeTFCommunicationPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::mhlo::CreateLegalizeTFCommunicationPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerLegalizeTFCommunicationPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::mhlo::CreateLegalizeTFCommunicationPass(); + }); +} + +//===----------------------------------------------------------------------===// +// TfXla Registration +//===----------------------------------------------------------------------===// + +inline void registerTfXlaPasses() { + registerLegalizeTFCommunicationPass(); +} +#undef GEN_PASS_REGISTRATION +#endif // GEN_PASS_REGISTRATION +// Deprecated. Please use the new per-pass macros. +#ifdef GEN_PASS_CLASSES + +template +class LegalizeTFCommunicationPassBase : public ::mlir::OperationPass { +public: + using Base = LegalizeTFCommunicationPassBase; + + LegalizeTFCommunicationPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + LegalizeTFCommunicationPassBase(const LegalizeTFCommunicationPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-legalize-tf-communication"); + } + ::llvm::StringRef getArgument() const override { return "xla-legalize-tf-communication"; } + + ::llvm::StringRef getDescription() const override { return "Legalize TF/XLA communication ops (TensorFlow dialect) to the HLO dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LegalizeTFCommunicationPass"); + } + ::llvm::StringRef getName() const override { return "LegalizeTFCommunicationPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LegalizeTFCommunicationPassBase) + +protected: +}; +#undef GEN_PASS_CLASSES +#endif // GEN_PASS_CLASSES diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tf2xla/transforms/utils.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tf2xla/transforms/utils.h new file mode 100644 index 0000000000000000000000000000000000000000..a4e6d323e47ab292026a4f199c2f8fb49392346e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tf2xla/transforms/utils.h @@ -0,0 +1,60 @@ +/* Copyright 2021 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TF2XLA_TRANSFORMS_UTILS_H_ +#define TENSORFLOW_COMPILER_MLIR_TF2XLA_TRANSFORMS_UTILS_H_ + +#include "llvm/ADT/ArrayRef.h" +#include "mlir/IR/Builders.h" // from @llvm-project +#include "mlir/IR/BuiltinAttributes.h" // from @llvm-project +#include "mlir/IR/BuiltinTypes.h" // from @llvm-project +#include "mlir/IR/Location.h" // from @llvm-project +#include "mlir/IR/Types.h" // from @llvm-project +#include "xla/mlir_hlo/mhlo/IR/hlo_ops.h" + +namespace mlir { +namespace mhlo { + +// Builds body for reduce op by using the template binary op as the +// reducer op. +template +void BuildReduceBody(Type element_type, Region* body, OpBuilder* builder) { + OpBuilder::InsertionGuard guard(*builder); + Block* block = builder->createBlock(body); + + // Block arguments are scalars of the given element type. + Type type = RankedTensorType::get(/*shape=*/{}, element_type); + Location loc = body->getLoc(); + block->addArguments({type, type}, SmallVector(2, loc)); + + auto reducer = + builder->create(loc, block->getArgument(0), block->getArgument(1)); + builder->create(loc, reducer.getResult()); +} + +ConstantOp GetScalarConstOfType(Type ty, Location loc, int64_t raw_value, + OpBuilder* builder); + +ConstantOp GetScalarNegZeroOfType(Type ty, Location loc, OpBuilder* builder); + +// Converts an ArrayAttr to a 1D 64-bit dense elements attribute. +DenseIntElementsAttr GetI64ElementsAttr(ArrayAttr attr); +DenseIntElementsAttr GetI64ElementsAttr(llvm::ArrayRef values, + Builder* builder); + +} // namespace mhlo +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TF2XLA_TRANSFORMS_UTILS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tf2xla/transforms/xla_legalize_targets.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tf2xla/transforms/xla_legalize_targets.h new file mode 100644 index 0000000000000000000000000000000000000000..1711e0391af9ba105b6277186a51e6959e4b2d09 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tf2xla/transforms/xla_legalize_targets.h @@ -0,0 +1,34 @@ +/* Copyright 2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TF2XLA_TRANSFORMS_XLA_LEGALIZE_TARGETS_H_ +#define TENSORFLOW_COMPILER_MLIR_TF2XLA_TRANSFORMS_XLA_LEGALIZE_TARGETS_H_ + +#include "mlir/IR/MLIRContext.h" // from @llvm-project +#include "mlir/Transforms/DialectConversion.h" // from @llvm-project + +namespace mlir { +namespace mhlo { + +// Returns a ConversionTarget that includes default legalized MLIR dialects +// for conversion to XLA. +// If legalize_chlo is true, the resulting conversion target cannot have CHLO. +mlir::ConversionTarget GetDefaultLegalConversionTargets( + MLIRContext& mlir_context, bool legalize_chlo); + +} // namespace mhlo +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TF2XLA_TRANSFORMS_XLA_LEGALIZE_TARGETS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tf2xla/transforms/xla_legalize_tf_passes.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tf2xla/transforms/xla_legalize_tf_passes.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..bbc3f08b4159d78067729ebf81e65cd5bc33afb8 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tf2xla/transforms/xla_legalize_tf_passes.h.inc @@ -0,0 +1,702 @@ +/* Autogenerated by mlir-tblgen; don't manually edit */ + +#ifdef GEN_PASS_DECL +// Generate declarations for all passes. +#define GEN_PASS_DECL_INFEEDOPSXLAADJUSTLAYOUT +#define GEN_PASS_DECL_LEGALIZETF +#define GEN_PASS_DECL_LEGALIZETFCOLLECTIVE +#define GEN_PASS_DECL_TFXLADEVICESPECIFICTRANSFORMS +#define GEN_PASS_DECL_VERIFYTFXLALEGALIZATION +#undef GEN_PASS_DECL +#endif // GEN_PASS_DECL + +//===----------------------------------------------------------------------===// +// InfeedOpsXlaAdjustLayout +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_INFEEDOPSXLAADJUSTLAYOUT +#undef GEN_PASS_DECL_INFEEDOPSXLAADJUSTLAYOUT +#endif // GEN_PASS_DECL_INFEEDOPSXLAADJUSTLAYOUT +#ifdef GEN_PASS_DEF_INFEEDOPSXLAADJUSTLAYOUT +namespace impl { + +template +class InfeedOpsXlaAdjustLayoutBase : public ::mlir::OperationPass { +public: + using Base = InfeedOpsXlaAdjustLayoutBase; + + InfeedOpsXlaAdjustLayoutBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + InfeedOpsXlaAdjustLayoutBase(const InfeedOpsXlaAdjustLayoutBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("infeed-ops-xla-adjust-layout"); + } + ::llvm::StringRef getArgument() const override { return "infeed-ops-xla-adjust-layout"; } + + ::llvm::StringRef getDescription() const override { return "Adjusts Infeed ops layout for XLA."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("InfeedOpsXlaAdjustLayout"); + } + ::llvm::StringRef getName() const override { return "InfeedOpsXlaAdjustLayout"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(InfeedOpsXlaAdjustLayoutBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_INFEEDOPSXLAADJUSTLAYOUT +#endif // GEN_PASS_DEF_INFEEDOPSXLAADJUSTLAYOUT + +//===----------------------------------------------------------------------===// +// LegalizeTF +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_LEGALIZETF +struct LegalizeTFOptions { + bool legalize_chlo_ = true; + bool use_tf2xla_fallback_ = false; + std::string device_type_ = "INVALID_DEVICE_TYPE"; + bool prefer_tf2xla_ = false; +}; +#undef GEN_PASS_DECL_LEGALIZETF +#endif // GEN_PASS_DECL_LEGALIZETF +#ifdef GEN_PASS_DEF_LEGALIZETF +namespace impl { + +template +class LegalizeTFBase : public ::mlir::OperationPass { +public: + using Base = LegalizeTFBase; + + LegalizeTFBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + LegalizeTFBase(const LegalizeTFBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-legalize-tf"); + } + ::llvm::StringRef getArgument() const override { return "xla-legalize-tf"; } + + ::llvm::StringRef getDescription() const override { return "Legalize from TF dialect's or HLO dialect's control flow."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LegalizeTF"); + } + ::llvm::StringRef getName() const override { return "LegalizeTF"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LegalizeTFBase) + + LegalizeTFBase(const LegalizeTFOptions &options) : LegalizeTFBase() { + legalize_chlo_ = options.legalize_chlo_; + use_tf2xla_fallback_ = options.use_tf2xla_fallback_; + device_type_ = options.device_type_; + prefer_tf2xla_ = options.prefer_tf2xla_; + } +protected: + ::mlir::Pass::Option legalize_chlo_{*this, "legalize-chlo", ::llvm::cl::desc("Legalizes intermediate chlo ops to hlo"), ::llvm::cl::init(true)}; + ::mlir::Pass::Option use_tf2xla_fallback_{*this, "use-tf2xla-fallback", ::llvm::cl::desc("Use TF2XLA fallback for legalization"), ::llvm::cl::init(false)}; + ::mlir::Pass::Option device_type_{*this, "device-type", ::llvm::cl::desc("The device type used by TF2XLA fallback. Must be specified if use-tf2xla-fallback is true, otherwise not used"), ::llvm::cl::init("INVALID_DEVICE_TYPE")}; + ::mlir::Pass::Option prefer_tf2xla_{*this, "prefer-tf2xla", ::llvm::cl::desc("Prioritize tf2xla fallback legalization over MLIR legalization patterns"), ::llvm::cl::init(false)}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_LEGALIZETF +#endif // GEN_PASS_DEF_LEGALIZETF + +//===----------------------------------------------------------------------===// +// LegalizeTFCollective +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_LEGALIZETFCOLLECTIVE +#undef GEN_PASS_DECL_LEGALIZETFCOLLECTIVE +#endif // GEN_PASS_DECL_LEGALIZETFCOLLECTIVE +#ifdef GEN_PASS_DEF_LEGALIZETFCOLLECTIVE +namespace impl { + +template +class LegalizeTFCollectiveBase : public ::mlir::OperationPass { +public: + using Base = LegalizeTFCollectiveBase; + + LegalizeTFCollectiveBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + LegalizeTFCollectiveBase(const LegalizeTFCollectiveBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-legalize-tf-collective"); + } + ::llvm::StringRef getArgument() const override { return "xla-legalize-tf-collective"; } + + ::llvm::StringRef getDescription() const override { return "Legalize TF/XLA collective ops (TensorFlow dialect) to the HLO dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LegalizeTFCollective"); + } + ::llvm::StringRef getName() const override { return "LegalizeTFCollective"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LegalizeTFCollectiveBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_LEGALIZETFCOLLECTIVE +#endif // GEN_PASS_DEF_LEGALIZETFCOLLECTIVE + +//===----------------------------------------------------------------------===// +// TFXLADeviceSpecificTransforms +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_TFXLADEVICESPECIFICTRANSFORMS +struct TFXLADeviceSpecificTransformsOptions { + std::string device_type_ = "INVALID_DEVICE_TYPE"; +}; +#undef GEN_PASS_DECL_TFXLADEVICESPECIFICTRANSFORMS +#endif // GEN_PASS_DECL_TFXLADEVICESPECIFICTRANSFORMS +#ifdef GEN_PASS_DEF_TFXLADEVICESPECIFICTRANSFORMS +namespace impl { + +template +class TFXLADeviceSpecificTransformsBase : public ::mlir::OperationPass { +public: + using Base = TFXLADeviceSpecificTransformsBase; + + TFXLADeviceSpecificTransformsBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TFXLADeviceSpecificTransformsBase(const TFXLADeviceSpecificTransformsBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tfxla-device-specific-transforms"); + } + ::llvm::StringRef getArgument() const override { return "tfxla-device-specific-transforms"; } + + ::llvm::StringRef getDescription() const override { return "Transforms ops that require device context into device independent TF Ops."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TFXLADeviceSpecificTransforms"); + } + ::llvm::StringRef getName() const override { return "TFXLADeviceSpecificTransforms"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TFXLADeviceSpecificTransformsBase) + + TFXLADeviceSpecificTransformsBase(const TFXLADeviceSpecificTransformsOptions &options) : TFXLADeviceSpecificTransformsBase() { + device_type_ = options.device_type_; + } +protected: + ::mlir::Pass::Option device_type_{*this, "device-type", ::llvm::cl::desc("The device type being targeted."), ::llvm::cl::init("INVALID_DEVICE_TYPE")}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_TFXLADEVICESPECIFICTRANSFORMS +#endif // GEN_PASS_DEF_TFXLADEVICESPECIFICTRANSFORMS + +//===----------------------------------------------------------------------===// +// VerifyTFXLALegalization +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_VERIFYTFXLALEGALIZATION +struct VerifyTFXLALegalizationOptions { + bool legalize_chlo_ = true; +}; +#undef GEN_PASS_DECL_VERIFYTFXLALEGALIZATION +#endif // GEN_PASS_DECL_VERIFYTFXLALEGALIZATION +#ifdef GEN_PASS_DEF_VERIFYTFXLALEGALIZATION +namespace impl { + +template +class VerifyTFXLALegalizationBase : public ::mlir::OperationPass { +public: + using Base = VerifyTFXLALegalizationBase; + + VerifyTFXLALegalizationBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + VerifyTFXLALegalizationBase(const VerifyTFXLALegalizationBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tfxla-verify-legalization"); + } + ::llvm::StringRef getArgument() const override { return "tfxla-verify-legalization"; } + + ::llvm::StringRef getDescription() const override { return "Verifies that all TF ops have been legalized to XLA."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("VerifyTFXLALegalization"); + } + ::llvm::StringRef getName() const override { return "VerifyTFXLALegalization"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(VerifyTFXLALegalizationBase) + + VerifyTFXLALegalizationBase(const VerifyTFXLALegalizationOptions &options) : VerifyTFXLALegalizationBase() { + legalize_chlo_ = options.legalize_chlo_; + } +protected: + ::mlir::Pass::Option legalize_chlo_{*this, "legalize-chlo", ::llvm::cl::desc("Legalizes intermediate chlo ops to hlo"), ::llvm::cl::init(true)}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_VERIFYTFXLALEGALIZATION +#endif // GEN_PASS_DEF_VERIFYTFXLALEGALIZATION +#ifdef GEN_PASS_REGISTRATION + +//===----------------------------------------------------------------------===// +// InfeedOpsXlaAdjustLayout Registration +//===----------------------------------------------------------------------===// + +inline void registerInfeedOpsXlaAdjustLayout() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::mhlo::CreateInfeedsOpsXlaAdjustLayoutPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerInfeedOpsXlaAdjustLayoutPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::mhlo::CreateInfeedsOpsXlaAdjustLayoutPass(); + }); +} + +//===----------------------------------------------------------------------===// +// LegalizeTF Registration +//===----------------------------------------------------------------------===// + +inline void registerLegalizeTF() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::mhlo::createLegalizeTFPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerLegalizeTFPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::mhlo::createLegalizeTFPass(); + }); +} + +//===----------------------------------------------------------------------===// +// LegalizeTFCollective Registration +//===----------------------------------------------------------------------===// + +inline void registerLegalizeTFCollective() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::mhlo::CreateLegalizeTFCollectivePass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerLegalizeTFCollectivePass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::mhlo::CreateLegalizeTFCollectivePass(); + }); +} + +//===----------------------------------------------------------------------===// +// TFXLADeviceSpecificTransforms Registration +//===----------------------------------------------------------------------===// + +inline void registerTFXLADeviceSpecificTransforms() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::mhlo::CreateTFXLADeviceSpecificTransformsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerTFXLADeviceSpecificTransformsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::mhlo::CreateTFXLADeviceSpecificTransformsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// VerifyTFXLALegalization Registration +//===----------------------------------------------------------------------===// + +inline void registerVerifyTFXLALegalization() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::mhlo::CreateVerifyTFXLALegalizationPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerVerifyTFXLALegalizationPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return mlir::mhlo::CreateVerifyTFXLALegalizationPass(); + }); +} + +//===----------------------------------------------------------------------===// +// LegalizeTf Registration +//===----------------------------------------------------------------------===// + +inline void registerLegalizeTfPasses() { + registerInfeedOpsXlaAdjustLayout(); + registerLegalizeTF(); + registerLegalizeTFCollective(); + registerTFXLADeviceSpecificTransforms(); + registerVerifyTFXLALegalization(); +} +#undef GEN_PASS_REGISTRATION +#endif // GEN_PASS_REGISTRATION +// Deprecated. Please use the new per-pass macros. +#ifdef GEN_PASS_CLASSES + +template +class InfeedOpsXlaAdjustLayoutBase : public ::mlir::OperationPass { +public: + using Base = InfeedOpsXlaAdjustLayoutBase; + + InfeedOpsXlaAdjustLayoutBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + InfeedOpsXlaAdjustLayoutBase(const InfeedOpsXlaAdjustLayoutBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("infeed-ops-xla-adjust-layout"); + } + ::llvm::StringRef getArgument() const override { return "infeed-ops-xla-adjust-layout"; } + + ::llvm::StringRef getDescription() const override { return "Adjusts Infeed ops layout for XLA."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("InfeedOpsXlaAdjustLayout"); + } + ::llvm::StringRef getName() const override { return "InfeedOpsXlaAdjustLayout"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(InfeedOpsXlaAdjustLayoutBase) + +protected: +}; + +template +class LegalizeTFBase : public ::mlir::OperationPass { +public: + using Base = LegalizeTFBase; + + LegalizeTFBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + LegalizeTFBase(const LegalizeTFBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-legalize-tf"); + } + ::llvm::StringRef getArgument() const override { return "xla-legalize-tf"; } + + ::llvm::StringRef getDescription() const override { return "Legalize from TF dialect's or HLO dialect's control flow."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LegalizeTF"); + } + ::llvm::StringRef getName() const override { return "LegalizeTF"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LegalizeTFBase) + +protected: + ::mlir::Pass::Option legalize_chlo_{*this, "legalize-chlo", ::llvm::cl::desc("Legalizes intermediate chlo ops to hlo"), ::llvm::cl::init(true)}; + ::mlir::Pass::Option use_tf2xla_fallback_{*this, "use-tf2xla-fallback", ::llvm::cl::desc("Use TF2XLA fallback for legalization"), ::llvm::cl::init(false)}; + ::mlir::Pass::Option device_type_{*this, "device-type", ::llvm::cl::desc("The device type used by TF2XLA fallback. Must be specified if use-tf2xla-fallback is true, otherwise not used"), ::llvm::cl::init("INVALID_DEVICE_TYPE")}; + ::mlir::Pass::Option prefer_tf2xla_{*this, "prefer-tf2xla", ::llvm::cl::desc("Prioritize tf2xla fallback legalization over MLIR legalization patterns"), ::llvm::cl::init(false)}; +}; + +template +class LegalizeTFCollectiveBase : public ::mlir::OperationPass { +public: + using Base = LegalizeTFCollectiveBase; + + LegalizeTFCollectiveBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + LegalizeTFCollectiveBase(const LegalizeTFCollectiveBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-legalize-tf-collective"); + } + ::llvm::StringRef getArgument() const override { return "xla-legalize-tf-collective"; } + + ::llvm::StringRef getDescription() const override { return "Legalize TF/XLA collective ops (TensorFlow dialect) to the HLO dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LegalizeTFCollective"); + } + ::llvm::StringRef getName() const override { return "LegalizeTFCollective"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LegalizeTFCollectiveBase) + +protected: +}; + +template +class TFXLADeviceSpecificTransformsBase : public ::mlir::OperationPass { +public: + using Base = TFXLADeviceSpecificTransformsBase; + + TFXLADeviceSpecificTransformsBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TFXLADeviceSpecificTransformsBase(const TFXLADeviceSpecificTransformsBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tfxla-device-specific-transforms"); + } + ::llvm::StringRef getArgument() const override { return "tfxla-device-specific-transforms"; } + + ::llvm::StringRef getDescription() const override { return "Transforms ops that require device context into device independent TF Ops."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TFXLADeviceSpecificTransforms"); + } + ::llvm::StringRef getName() const override { return "TFXLADeviceSpecificTransforms"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TFXLADeviceSpecificTransformsBase) + +protected: + ::mlir::Pass::Option device_type_{*this, "device-type", ::llvm::cl::desc("The device type being targeted."), ::llvm::cl::init("INVALID_DEVICE_TYPE")}; +}; + +template +class VerifyTFXLALegalizationBase : public ::mlir::OperationPass { +public: + using Base = VerifyTFXLALegalizationBase; + + VerifyTFXLALegalizationBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + VerifyTFXLALegalizationBase(const VerifyTFXLALegalizationBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tfxla-verify-legalization"); + } + ::llvm::StringRef getArgument() const override { return "tfxla-verify-legalization"; } + + ::llvm::StringRef getDescription() const override { return "Verifies that all TF ops have been legalized to XLA."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("VerifyTFXLALegalization"); + } + ::llvm::StringRef getName() const override { return "VerifyTFXLALegalization"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(VerifyTFXLALegalizationBase) + +protected: + ::mlir::Pass::Option legalize_chlo_{*this, "legalize-chlo", ::llvm::cl::desc("Legalizes intermediate chlo ops to hlo"), ::llvm::cl::init(true)}; +}; +#undef GEN_PASS_CLASSES +#endif // GEN_PASS_CLASSES diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tfr/integration/graph_decompose_pass.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tfr/integration/graph_decompose_pass.h new file mode 100644 index 0000000000000000000000000000000000000000..65f9f28bf1a33f1f928f9c6ccad96921125e109c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tfr/integration/graph_decompose_pass.h @@ -0,0 +1,53 @@ +/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ +#ifndef TENSORFLOW_COMPILER_MLIR_TFR_INTEGRATION_GRAPH_DECOMPOSE_PASS_H_ +#define TENSORFLOW_COMPILER_MLIR_TFR_INTEGRATION_GRAPH_DECOMPOSE_PASS_H_ + +#include + +#include "mlir/IR/MLIRContext.h" // from @llvm-project +#include "tensorflow/compiler/mlir/mlir_graph_optimization_pass.h" +#include "tensorflow/compiler/mlir/tfr/integration/tfr_decompose_ctx.h" +#include "tsl/platform/statusor.h" + +namespace tensorflow { +namespace tfr { + +// An optimization pass that decompose the composite ops in a module according +// to the decomposition library. Currently the decomposition library is loaded +// each time the pass runs. A special environment variable is set to locate the +// decomposition library. +class GraphDecomposePass : public MlirOptimizationPass { + public: + llvm::StringRef name() const override { return "tfr"; } + + // Whether to run this pass. If this is enabled, the GraphDef will be imported + // to MLIR even no tf composition file is found. + ::tensorflow::MlirOptimizationPassState GetPassState( + const DeviceSet* device_set, const ConfigProto& config_proto, + const Graph& graph, + const FunctionLibraryDefinition& function_library) const override; + + // This should be used as a thin mapper around mlir::ModulePass::runOnModule + // API integrated with the Tensorflow runtime. + Status Run(const std::string& function_name, const ConfigProto& config_proto, + mlir::ModuleOp module, const Graph& graph, + const FunctionLibraryDefinition& function_library) override; +}; + +} // namespace tfr +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_MLIR_TFR_INTEGRATION_GRAPH_DECOMPOSE_PASS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tfr/integration/node_expansion_pass.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tfr/integration/node_expansion_pass.h new file mode 100644 index 0000000000000000000000000000000000000000..58ea34ee1e1bc262cfa387185f217386276fb50f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tfr/integration/node_expansion_pass.h @@ -0,0 +1,49 @@ +/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ +#ifndef TENSORFLOW_COMPILER_MLIR_TFR_INTEGRATION_NODE_EXPANSION_PASS_H_ +#define TENSORFLOW_COMPILER_MLIR_TFR_INTEGRATION_NODE_EXPANSION_PASS_H_ + +#include "tensorflow/compiler/mlir/tfr/integration/tfr_decompose_ctx.h" +#include "tensorflow/core/common_runtime/eager/eager_op_rewrite_registry.h" +#include "tsl/platform/statusor.h" + +namespace tensorflow { +namespace tfr { + +// An optimization pass that decompose the composite ops in a module according +// to the decomposition library. Currently the decomposition library is loaded +// each time the pass runs. A special environment variable is set to locate the +// decomposition library. +class CompositeOpExpansion : public EagerOpRewrite { + public: + CompositeOpExpansion(string name, string file, string line) + : EagerOpRewrite(name, file, line) {} + + Status Run(EagerOperation* orig_op, + std::unique_ptr* out_op) override; + + private: + // Whether to run this pass. If this is enabled, the NodeDef will be imported + // to MLIR even no tf composition file is found. + bool IsEnabled() { + const char* tfr_lib_env_val = getenv(string(kTFRLibEnv).c_str()); + return tfr_lib_env_val != nullptr; + } +}; + +} // namespace tfr +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_MLIR_TFR_INTEGRATION_NODE_EXPANSION_PASS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tfr/integration/tfr_decompose_ctx.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tfr/integration/tfr_decompose_ctx.h new file mode 100644 index 0000000000000000000000000000000000000000..130f4c86932792c174f22fb10777f8af7fa66bda --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tfr/integration/tfr_decompose_ctx.h @@ -0,0 +1,82 @@ +/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ +#ifndef TENSORFLOW_COMPILER_MLIR_TFR_INTEGRATION_TFR_DECOMPOSE_CTX_H_ +#define TENSORFLOW_COMPILER_MLIR_TFR_INTEGRATION_TFR_DECOMPOSE_CTX_H_ + +#include "mlir/Dialect/Func/IR/FuncOps.h" // from @llvm-project +#include "mlir/IR/BuiltinOps.h" // from @llvm-project +#include "mlir/IR/MLIRContext.h" // from @llvm-project +#include "mlir/Pass/PassManager.h" // from @llvm-project +#include "tensorflow/compiler/mlir/tensorflow/translate/mlir_roundtrip_flags.h" +#include "tensorflow/core/framework/function.pb.h" +#include "tsl/platform/statusor.h" + +namespace tensorflow { +namespace tfr { + +extern const char* const kTFRLibEnv; + +using tsl::StatusOr; + +// An wrapper for all the objects used to decompose a module (graph mode) and +// node_def (eager mode). Note that this class owns the decomposition library. +class TFRDecomposeContext { + public: + // The entry function to get a decompose context. All the required passes have + // been initialized. + static StatusOr> Get( + mlir::MLIRContext* mlir_ctx); + + // Constructor of the decompose context. To share the decompose library, the + // whole decompose TFR function library is loaded. + explicit TFRDecomposeContext(mlir::ModuleOp tfr_module); + + // Constructs the decompose context from the tfr text module and the mlir + // context. The tfr text module is added to the mlir context. + static std::unique_ptr GetFromText( + StringPiece tfr_raw_text, mlir::MLIRContext* mlir_ctx); + + // Decomposes the op in the NodeDef to a set of primitive ops according to the + // decompose library in the context. Wrap the decomposed result in a + // FunctionDef. + StatusOr ExpandNode(const NodeDef& node_def, + StringPiece func_name); + + // Runs the decompose passes on the user_module. + Status DecomposeGraph(mlir::ModuleOp user_module); + + // Erases the tfr_module created. + void Destroy(); + + private: + mlir::ModuleOp tfr_module_; + mlir::PassManager pm_; + + GraphExportConfig export_confs_; +}; + +// Decomposes the NodeDef to a set of primitive ops according to the decompose +// library loaded. Wrap the decomposed result in a FunctionDef. +StatusOr ExpandNode(const NodeDef& node_def, + StringPiece func_name); + +// Decomposes the ops in the ModuleOp to a set of primitive ops according to +// decompose library in the context. +Status DecomposeGraph(mlir::ModuleOp user_module); + +} // namespace tfr +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_MLIR_TFR_INTEGRATION_TFR_DECOMPOSE_CTX_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tfr/ir/tfr_ops.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tfr/ir/tfr_ops.h new file mode 100644 index 0000000000000000000000000000000000000000..0db4ab6d96a4ff1447094a0d6f2f578c259e8818 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tfr/ir/tfr_ops.h @@ -0,0 +1,63 @@ +/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TFR_IR_TFR_OPS_H_ +#define TENSORFLOW_COMPILER_MLIR_TFR_IR_TFR_OPS_H_ + +#include "llvm/ADT/StringSet.h" +#include "mlir/Dialect/Func/IR/FuncOps.h" // from @llvm-project +#include "mlir/Dialect/Shape/IR/Shape.h" // from @llvm-project +#include "mlir/IR/BuiltinOps.h" // from @llvm-project +#include "mlir/IR/BuiltinTypes.h" // from @llvm-project +#include "mlir/IR/Dialect.h" // from @llvm-project +#include "mlir/IR/DialectImplementation.h" // from @llvm-project +#include "mlir/IR/MLIRContext.h" // from @llvm-project +#include "mlir/IR/Types.h" // from @llvm-project +#include "mlir/Interfaces/CallInterfaces.h" // from @llvm-project +#include "mlir/Interfaces/ControlFlowInterfaces.h" // from @llvm-project +#include "mlir/Interfaces/FunctionInterfaces.h" // from @llvm-project +#include "mlir/Interfaces/InferTypeOpInterface.h" // from @llvm-project +#include "mlir/Interfaces/SideEffectInterfaces.h" // from @llvm-project + +namespace mlir { +namespace TFR { + +constexpr char kAttrArgumentNameAttr[] = "tfr.name"; +constexpr char kAttrArgumentDefaultAttr[] = "tfr.default"; +constexpr char kAttrArgumentTypeAttr[] = "tfr.type"; + +class TFRDialect : public Dialect { + public: + explicit TFRDialect(MLIRContext *context); + + static StringRef getDialectNamespace() { return "tfr"; } + + Operation *materializeConstant(OpBuilder &builder, Attribute value, Type type, + Location loc) override; + + // Parse a type registered to this dialect. + Type parseType(DialectAsmParser &parser) const override; + + // Prints a type registered to this dialect. + void printType(Type ty, DialectAsmPrinter &os) const override; +}; + +} // namespace TFR +} // namespace mlir + +#define GET_OP_CLASSES +#include "tensorflow/compiler/mlir/tfr/ir/tfr_ops.h.inc" + +#endif // TENSORFLOW_COMPILER_MLIR_TFR_IR_TFR_OPS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tfr/ir/tfr_ops.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tfr/ir/tfr_ops.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..32bf2bb5f259c83b3b6b64c51fccfcd6ea49856d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tfr/ir/tfr_ops.h.inc @@ -0,0 +1,2039 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: tfr_ops.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#if defined(GET_OP_CLASSES) || defined(GET_OP_FWD_DEFINES) +#undef GET_OP_FWD_DEFINES +namespace mlir { +namespace TFR { +class BuildListOp; +} // namespace TFR +} // namespace mlir +namespace mlir { +namespace TFR { +class CallOp; +} // namespace TFR +} // namespace mlir +namespace mlir { +namespace TFR { +class CastOp; +} // namespace TFR +} // namespace mlir +namespace mlir { +namespace TFR { +class ConstOp; +} // namespace TFR +} // namespace mlir +namespace mlir { +namespace TFR { +class ConstantTensorOp; +} // namespace TFR +} // namespace mlir +namespace mlir { +namespace TFR { +class EqualOp; +} // namespace TFR +} // namespace mlir +namespace mlir { +namespace TFR { +class GetElementOp; +} // namespace TFR +} // namespace mlir +namespace mlir { +namespace TFR { +class GetElementTypeOp; +} // namespace TFR +} // namespace mlir +namespace mlir { +namespace TFR { +class GetLengthOp; +} // namespace TFR +} // namespace mlir +namespace mlir { +namespace TFR { +class GetShapeOp; +} // namespace TFR +} // namespace mlir +namespace mlir { +namespace TFR { +class TFRFuncOp; +} // namespace TFR +} // namespace mlir +namespace mlir { +namespace TFR { +class TFRQuantActRangeOp; +} // namespace TFR +} // namespace mlir +namespace mlir { +namespace TFR { +class TFRQuantQParamsOp; +} // namespace TFR +} // namespace mlir +namespace mlir { +namespace TFR { +class TFRQuantRawDataOp; +} // namespace TFR +} // namespace mlir +namespace mlir { +namespace TFR { +class TFRQuantRescaleOp; +} // namespace TFR +} // namespace mlir +namespace mlir { +namespace TFR { +class TFRQuantScaleFactorOp; +} // namespace TFR +} // namespace mlir +namespace mlir { +namespace TFR { +class TFRReturnOp; +} // namespace TFR +} // namespace mlir +#endif + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace TFR { + +//===----------------------------------------------------------------------===// +// ::mlir::TFR::BuildListOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BuildListOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BuildListOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BuildListOpGenericAdaptorBase(BuildListOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class BuildListOpGenericAdaptor : public detail::BuildListOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BuildListOpGenericAdaptorBase; +public: + BuildListOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BuildListOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BuildListOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BuildListOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getTensors() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BuildListOpAdaptor : public BuildListOpGenericAdaptor<::mlir::ValueRange> { +public: + using BuildListOpGenericAdaptor::BuildListOpGenericAdaptor; + BuildListOpAdaptor(BuildListOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BuildListOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BuildListOpAdaptor; + template + using GenericAdaptor = BuildListOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tfr.build_list"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getTensors(); + ::mlir::MutableOperandRange getTensorsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getOut(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, ::mlir::ValueRange tensors); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TFR +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TFR::BuildListOp) + +namespace mlir { +namespace TFR { + +//===----------------------------------------------------------------------===// +// ::mlir::TFR::CallOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CallOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CallOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CallOpGenericAdaptorBase(CallOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::FlatSymbolRefAttr getCalleeAttr(); + ::llvm::StringRef getCallee(); +}; +} // namespace detail +template +class CallOpGenericAdaptor : public detail::CallOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CallOpGenericAdaptorBase; +public: + CallOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CallOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CallOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CallOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CallOpAdaptor : public CallOpGenericAdaptor<::mlir::ValueRange> { +public: + using CallOpGenericAdaptor::CallOpGenericAdaptor; + CallOpAdaptor(CallOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CallOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = CallOpAdaptor; + template + using GenericAdaptor = CallOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("callee")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getCalleeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getCalleeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tfr.call"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::MutableOperandRange getArgsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getOuts(); + ::mlir::FlatSymbolRefAttr getCalleeAttr(); + ::llvm::StringRef getCallee(); + void setCalleeAttr(::mlir::FlatSymbolRefAttr attr); + void setCallee(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outs, ::mlir::FlatSymbolRefAttr callee, ::mlir::ValueRange args); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange outs, ::llvm::StringRef callee, ::mlir::ValueRange args); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Get the argument operands to the called function. + operand_range getArgOperands() { return getArgs(); } + MutableOperandRange getArgOperandsMutable() { + return getArgsMutable(); + } + + // Return the callee of this operation. + CallInterfaceCallable getCallableForCallee() { return getCalleeAttr(); } + // Sets the callee from the callable + void setCalleeFromCallable(CallInterfaceCallable callee); +}; +} // namespace TFR +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TFR::CallOp) + +namespace mlir { +namespace TFR { + +//===----------------------------------------------------------------------===// +// ::mlir::TFR::CastOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CastOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CastOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CastOpGenericAdaptorBase(CastOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CastOpGenericAdaptor : public detail::CastOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CastOpGenericAdaptorBase; +public: + CastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CastOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CastOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getArg() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CastOpAdaptor : public CastOpGenericAdaptor<::mlir::ValueRange> { +public: + using CastOpGenericAdaptor::CastOpGenericAdaptor; + CastOpAdaptor(CastOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CastOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CastOpAdaptor; + template + using GenericAdaptor = CastOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tfr.cast"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getArg(); + ::mlir::OpOperand &getArgMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getOut(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, ::mlir::Value arg); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + // Return element type of the input tensor type. Only available when the + // input is a MLIR built-in tensor type. + Attribute getInputElementType() { + if (auto ty = getArg().getType().dyn_cast()) { + return TypeAttr::get(ty.getElementType()); + } + return {}; + } +}; +} // namespace TFR +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TFR::CastOp) + +namespace mlir { +namespace TFR { + +//===----------------------------------------------------------------------===// +// ::mlir::TFR::ConstOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConstOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ConstOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ConstOpGenericAdaptorBase(ConstOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + Attribute getValueAttr(); + Attribute getValue(); +}; +} // namespace detail +template +class ConstOpGenericAdaptor : public detail::ConstOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConstOpGenericAdaptorBase; +public: + ConstOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConstOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConstOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ConstOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConstOpAdaptor : public ConstOpGenericAdaptor<::mlir::ValueRange> { +public: + using ConstOpGenericAdaptor::ConstOpGenericAdaptor; + ConstOpAdaptor(ConstOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConstOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::ConstantLike, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ConstOpAdaptor; + template + using GenericAdaptor = ConstOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("value")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getValueAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getValueAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tfr.constant"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getOut(); + Attribute getValueAttr(); + Attribute getValue(); + void setValueAttr(Attribute attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Attribute value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, Attribute value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, Attribute value); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace TFR +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TFR::ConstOp) + +namespace mlir { +namespace TFR { + +//===----------------------------------------------------------------------===// +// ::mlir::TFR::ConstantTensorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConstantTensorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ConstantTensorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ConstantTensorOpGenericAdaptorBase(ConstantTensorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ConstantTensorOpGenericAdaptor : public detail::ConstantTensorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConstantTensorOpGenericAdaptorBase; +public: + ConstantTensorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConstantTensorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConstantTensorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ConstantTensorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getArg() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConstantTensorOpAdaptor : public ConstantTensorOpGenericAdaptor<::mlir::ValueRange> { +public: + using ConstantTensorOpGenericAdaptor::ConstantTensorOpGenericAdaptor; + ConstantTensorOpAdaptor(ConstantTensorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConstantTensorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ConstantTensorOpAdaptor; + template + using GenericAdaptor = ConstantTensorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tfr.constant_tensor"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getArg(); + ::mlir::OpOperand &getArgMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getOut(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, ::mlir::Value arg); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TFR +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TFR::ConstantTensorOp) + +namespace mlir { +namespace TFR { + +//===----------------------------------------------------------------------===// +// ::mlir::TFR::EqualOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class EqualOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + EqualOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + EqualOpGenericAdaptorBase(EqualOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class EqualOpGenericAdaptor : public detail::EqualOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::EqualOpGenericAdaptorBase; +public: + EqualOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + EqualOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : EqualOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + EqualOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class EqualOpAdaptor : public EqualOpGenericAdaptor<::mlir::ValueRange> { +public: + using EqualOpGenericAdaptor::EqualOpGenericAdaptor; + EqualOpAdaptor(EqualOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class EqualOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameTypeOperands> { +public: + using Op::Op; + using Op::print; + using Adaptor = EqualOpAdaptor; + template + using GenericAdaptor = EqualOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tfr.equal"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getLhs(); + ::mlir::Value getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TFR +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TFR::EqualOp) + +namespace mlir { +namespace TFR { + +//===----------------------------------------------------------------------===// +// ::mlir::TFR::GetElementOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GetElementOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + GetElementOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + GetElementOpGenericAdaptorBase(GetElementOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class GetElementOpGenericAdaptor : public detail::GetElementOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GetElementOpGenericAdaptorBase; +public: + GetElementOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GetElementOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GetElementOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + GetElementOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTensorList() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndex() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GetElementOpAdaptor : public GetElementOpGenericAdaptor<::mlir::ValueRange> { +public: + using GetElementOpGenericAdaptor::GetElementOpGenericAdaptor; + GetElementOpAdaptor(GetElementOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GetElementOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = GetElementOpAdaptor; + template + using GenericAdaptor = GetElementOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tfr.get_element"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getTensorList(); + ::mlir::TypedValue<::mlir::IndexType> getIndex(); + ::mlir::OpOperand &getTensorListMutable(); + ::mlir::OpOperand &getIndexMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getOut(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, ::mlir::Value tensor_list, ::mlir::Value index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value tensor_list, ::mlir::Value index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tensor_list, ::mlir::Value index); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TFR +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TFR::GetElementOp) + +namespace mlir { +namespace TFR { + +//===----------------------------------------------------------------------===// +// ::mlir::TFR::GetElementTypeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GetElementTypeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + GetElementTypeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + GetElementTypeOpGenericAdaptorBase(GetElementTypeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class GetElementTypeOpGenericAdaptor : public detail::GetElementTypeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GetElementTypeOpGenericAdaptorBase; +public: + GetElementTypeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GetElementTypeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GetElementTypeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + GetElementTypeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getArg() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GetElementTypeOpAdaptor : public GetElementTypeOpGenericAdaptor<::mlir::ValueRange> { +public: + using GetElementTypeOpGenericAdaptor::GetElementTypeOpGenericAdaptor; + GetElementTypeOpAdaptor(GetElementTypeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GetElementTypeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = GetElementTypeOpAdaptor; + template + using GenericAdaptor = GetElementTypeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tfr.get_element_type"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getArg(); + ::mlir::OpOperand &getArgMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getOut(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, ::mlir::Value arg); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value arg); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TFR +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TFR::GetElementTypeOp) + +namespace mlir { +namespace TFR { + +//===----------------------------------------------------------------------===// +// ::mlir::TFR::GetLengthOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GetLengthOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + GetLengthOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + GetLengthOpGenericAdaptorBase(GetLengthOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class GetLengthOpGenericAdaptor : public detail::GetLengthOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GetLengthOpGenericAdaptorBase; +public: + GetLengthOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GetLengthOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GetLengthOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + GetLengthOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getTensorList() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GetLengthOpAdaptor : public GetLengthOpGenericAdaptor<::mlir::ValueRange> { +public: + using GetLengthOpGenericAdaptor::GetLengthOpGenericAdaptor; + GetLengthOpAdaptor(GetLengthOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GetLengthOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = GetLengthOpAdaptor; + template + using GenericAdaptor = GetLengthOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tfr.get_length"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getTensorList(); + ::mlir::OpOperand &getTensorListMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getOut(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, ::mlir::Value tensor_list); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value tensor_list); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value tensor_list); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TFR +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TFR::GetLengthOp) + +namespace mlir { +namespace TFR { + +//===----------------------------------------------------------------------===// +// ::mlir::TFR::GetShapeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GetShapeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + GetShapeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + GetShapeOpGenericAdaptorBase(GetShapeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class GetShapeOpGenericAdaptor : public detail::GetShapeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GetShapeOpGenericAdaptorBase; +public: + GetShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GetShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GetShapeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + GetShapeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getArg() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GetShapeOpAdaptor : public GetShapeOpGenericAdaptor<::mlir::ValueRange> { +public: + using GetShapeOpGenericAdaptor::GetShapeOpGenericAdaptor; + GetShapeOpAdaptor(GetShapeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GetShapeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = GetShapeOpAdaptor; + template + using GenericAdaptor = GetShapeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tfr.get_shape"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getArg(); + ::mlir::OpOperand &getArgMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::shape::ShapeType> getOut(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type out, ::mlir::Value arg); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value arg); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TFR +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TFR::GetShapeOp) + +namespace mlir { +namespace TFR { + +//===----------------------------------------------------------------------===// +// ::mlir::TFR::TFRFuncOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TFRFuncOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TFRFuncOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TFRFuncOpGenericAdaptorBase(TFRFuncOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::TypeAttr getFunctionTypeAttr(); + ::mlir::FunctionType getFunctionType(); + ::mlir::StringAttr getSymNameAttr(); + ::llvm::StringRef getSymName(); + ::mlir::ArrayAttr getArgAttrsAttr(); + ::std::optional< ::mlir::ArrayAttr > getArgAttrs(); + ::mlir::ArrayAttr getResAttrsAttr(); + ::std::optional< ::mlir::ArrayAttr > getResAttrs(); + ::mlir::RegionRange getBody(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class TFRFuncOpGenericAdaptor : public detail::TFRFuncOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TFRFuncOpGenericAdaptorBase; +public: + TFRFuncOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TFRFuncOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TFRFuncOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TFRFuncOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TFRFuncOpAdaptor : public TFRFuncOpGenericAdaptor<::mlir::ValueRange> { +public: + using TFRFuncOpGenericAdaptor::TFRFuncOpGenericAdaptor; + TFRFuncOpAdaptor(TFRFuncOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TFRFuncOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::SymbolOpInterface::Trait, ::mlir::CallableOpInterface::Trait, ::mlir::FunctionOpInterface::Trait, ::mlir::OpTrait::IsIsolatedFromAbove> { +public: + using Op::Op; + using Op::print; + using Adaptor = TFRFuncOpAdaptor; + template + using GenericAdaptor = TFRFuncOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("arg_attrs"), ::llvm::StringRef("function_type"), ::llvm::StringRef("res_attrs"), ::llvm::StringRef("sym_name")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getArgAttrsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getArgAttrsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getFunctionTypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getFunctionTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getResAttrsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getResAttrsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSymNameAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSymNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tfr.func"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::MutableArrayRef<::mlir::Region> getBody(); + ::mlir::TypeAttr getFunctionTypeAttr(); + ::mlir::FunctionType getFunctionType(); + ::mlir::StringAttr getSymNameAttr(); + ::llvm::StringRef getSymName(); + ::mlir::ArrayAttr getArgAttrsAttr(); + ::std::optional< ::mlir::ArrayAttr > getArgAttrs(); + ::mlir::ArrayAttr getResAttrsAttr(); + ::std::optional< ::mlir::ArrayAttr > getResAttrs(); + void setFunctionTypeAttr(::mlir::TypeAttr attr); + void setFunctionType(::mlir::FunctionType attrValue); + void setSymNameAttr(::mlir::StringAttr attr); + void setSymName(::llvm::StringRef attrValue); + void setArgAttrsAttr(::mlir::ArrayAttr attr); + void setResAttrsAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeArgAttrsAttr(); + ::mlir::Attribute removeResAttrsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, StringRef name, FunctionType type, ArrayRef attrs = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + LogicalResult verifyType() { return success(); } + + mlir::Region *getCallableRegion(); + + /// Returns the argument types of this function. + ArrayRef getArgumentTypes() { return getFunctionType().getInputs(); } + + /// Returns the result types of this function. + ArrayRef getResultTypes() { return getFunctionType().getResults(); } + + // Get the names of all defined attributes, including both derived and + // non-derived ones. + llvm::StringSet<> getDefinedAttributeNames() { + llvm::StringSet<> all_attrs; + for (auto& attr : (*this)->getAttrs()) { + all_attrs.insert(attr.getName().strref()); + } + for (const auto& operand : llvm::enumerate(getArgumentTypes())) { + if (auto attr_name = getArgAttrOfType( + operand.index(), kAttrArgumentNameAttr)) { + all_attrs.insert(attr_name.getValue()); + } + } + return all_attrs; + } +}; +} // namespace TFR +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TFR::TFRFuncOp) + +namespace mlir { +namespace TFR { + +//===----------------------------------------------------------------------===// +// ::mlir::TFR::TFRQuantActRangeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TFRQuantActRangeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TFRQuantActRangeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TFRQuantActRangeOpGenericAdaptorBase(TFRQuantActRangeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TFRQuantActRangeOpGenericAdaptor : public detail::TFRQuantActRangeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TFRQuantActRangeOpGenericAdaptorBase; +public: + TFRQuantActRangeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TFRQuantActRangeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TFRQuantActRangeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TFRQuantActRangeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getAct() { + return (*getODSOperands(0).begin()); + } + + ValueT getScale() { + return (*getODSOperands(1).begin()); + } + + ValueT getZp() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TFRQuantActRangeOpAdaptor : public TFRQuantActRangeOpGenericAdaptor<::mlir::ValueRange> { +public: + using TFRQuantActRangeOpGenericAdaptor::TFRQuantActRangeOpGenericAdaptor; + TFRQuantActRangeOpAdaptor(TFRQuantActRangeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TFRQuantActRangeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TFRQuantActRangeOpAdaptor; + template + using GenericAdaptor = TFRQuantActRangeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tfr.quant_act_range"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getAct(); + ::mlir::TypedValue<::mlir::FloatType> getScale(); + ::mlir::TypedValue<::mlir::IntegerType> getZp(); + ::mlir::OpOperand &getActMutable(); + ::mlir::OpOperand &getScaleMutable(); + ::mlir::OpOperand &getZpMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getMin(); + ::mlir::Value getMax(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type min, ::mlir::Type max, ::mlir::Value act, ::mlir::Value scale, ::mlir::Value zp); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value act, ::mlir::Value scale, ::mlir::Value zp); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value act, ::mlir::Value scale, ::mlir::Value zp); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TFR +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TFR::TFRQuantActRangeOp) + +namespace mlir { +namespace TFR { + +//===----------------------------------------------------------------------===// +// ::mlir::TFR::TFRQuantQParamsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TFRQuantQParamsOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TFRQuantQParamsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TFRQuantQParamsOpGenericAdaptorBase(TFRQuantQParamsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TFRQuantQParamsOpGenericAdaptor : public detail::TFRQuantQParamsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TFRQuantQParamsOpGenericAdaptorBase; +public: + TFRQuantQParamsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TFRQuantQParamsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TFRQuantQParamsOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TFRQuantQParamsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TFRQuantQParamsOpAdaptor : public TFRQuantQParamsOpGenericAdaptor<::mlir::ValueRange> { +public: + using TFRQuantQParamsOpGenericAdaptor::TFRQuantQParamsOpGenericAdaptor; + TFRQuantQParamsOpAdaptor(TFRQuantQParamsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TFRQuantQParamsOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TFRQuantQParamsOpAdaptor; + template + using GenericAdaptor = TFRQuantQParamsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tfr.quant_qparam"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getScale(); + ::mlir::Value getZp(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type scale, ::mlir::Type zp, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TFR +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TFR::TFRQuantQParamsOp) + +namespace mlir { +namespace TFR { + +//===----------------------------------------------------------------------===// +// ::mlir::TFR::TFRQuantRawDataOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TFRQuantRawDataOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TFRQuantRawDataOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TFRQuantRawDataOpGenericAdaptorBase(TFRQuantRawDataOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TFRQuantRawDataOpGenericAdaptor : public detail::TFRQuantRawDataOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TFRQuantRawDataOpGenericAdaptorBase; +public: + TFRQuantRawDataOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TFRQuantRawDataOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TFRQuantRawDataOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TFRQuantRawDataOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TFRQuantRawDataOpAdaptor : public TFRQuantRawDataOpGenericAdaptor<::mlir::ValueRange> { +public: + using TFRQuantRawDataOpGenericAdaptor::TFRQuantRawDataOpGenericAdaptor; + TFRQuantRawDataOpAdaptor(TFRQuantRawDataOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TFRQuantRawDataOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultType, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TFRQuantRawDataOpAdaptor; + template + using GenericAdaptor = TFRQuantRawDataOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tfr.quant_raw_data"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getInput(); + ::mlir::OpOperand &getInputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getOutput(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TFR +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TFR::TFRQuantRawDataOp) + +namespace mlir { +namespace TFR { + +//===----------------------------------------------------------------------===// +// ::mlir::TFR::TFRQuantRescaleOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TFRQuantRescaleOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TFRQuantRescaleOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TFRQuantRescaleOpGenericAdaptorBase(TFRQuantRescaleOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TFRQuantRescaleOpGenericAdaptor : public detail::TFRQuantRescaleOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TFRQuantRescaleOpGenericAdaptorBase; +public: + TFRQuantRescaleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TFRQuantRescaleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TFRQuantRescaleOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TFRQuantRescaleOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getScale() { + return (*getODSOperands(1).begin()); + } + + ValueT getZp() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TFRQuantRescaleOpAdaptor : public TFRQuantRescaleOpGenericAdaptor<::mlir::ValueRange> { +public: + using TFRQuantRescaleOpGenericAdaptor::TFRQuantRescaleOpGenericAdaptor; + TFRQuantRescaleOpAdaptor(TFRQuantRescaleOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TFRQuantRescaleOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TFRQuantRescaleOpAdaptor; + template + using GenericAdaptor = TFRQuantRescaleOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tfr.quant_rescale"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getInput(); + ::mlir::Value getScale(); + ::mlir::TypedValue<::mlir::IntegerType> getZp(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getScaleMutable(); + ::mlir::OpOperand &getZpMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getOutput(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value input, ::mlir::Value scale, ::mlir::Value zp); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value scale, ::mlir::Value zp); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value scale, ::mlir::Value zp); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TFR +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TFR::TFRQuantRescaleOp) + +namespace mlir { +namespace TFR { + +//===----------------------------------------------------------------------===// +// ::mlir::TFR::TFRQuantScaleFactorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TFRQuantScaleFactorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TFRQuantScaleFactorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TFRQuantScaleFactorOpGenericAdaptorBase(TFRQuantScaleFactorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TFRQuantScaleFactorOpGenericAdaptor : public detail::TFRQuantScaleFactorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TFRQuantScaleFactorOpGenericAdaptorBase; +public: + TFRQuantScaleFactorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TFRQuantScaleFactorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TFRQuantScaleFactorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TFRQuantScaleFactorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOutScale() { + return (*getODSOperands(0).begin()); + } + + ValueT getInScales() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TFRQuantScaleFactorOpAdaptor : public TFRQuantScaleFactorOpGenericAdaptor<::mlir::ValueRange> { +public: + using TFRQuantScaleFactorOpGenericAdaptor::TFRQuantScaleFactorOpGenericAdaptor; + TFRQuantScaleFactorOpAdaptor(TFRQuantScaleFactorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TFRQuantScaleFactorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TFRQuantScaleFactorOpAdaptor; + template + using GenericAdaptor = TFRQuantScaleFactorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tfr.quant_scale_factor"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::FloatType> getOutScale(); + ::mlir::Value getInScales(); + ::mlir::OpOperand &getOutScaleMutable(); + ::mlir::OpOperand &getInScalesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getScaleFactor(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type scale_factor, ::mlir::Value out_scale, ::mlir::Value in_scales); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value out_scale, ::mlir::Value in_scales); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value out_scale, ::mlir::Value in_scales); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TFR +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TFR::TFRQuantScaleFactorOp) + +namespace mlir { +namespace TFR { + +//===----------------------------------------------------------------------===// +// ::mlir::TFR::TFRReturnOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TFRReturnOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TFRReturnOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TFRReturnOpGenericAdaptorBase(TFRReturnOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TFRReturnOpGenericAdaptor : public detail::TFRReturnOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TFRReturnOpGenericAdaptorBase; +public: + TFRReturnOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TFRReturnOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TFRReturnOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TFRReturnOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArguments() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TFRReturnOpAdaptor : public TFRReturnOpGenericAdaptor<::mlir::ValueRange> { +public: + using TFRReturnOpGenericAdaptor::TFRReturnOpGenericAdaptor; + TFRReturnOpAdaptor(TFRReturnOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TFRReturnOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::RegionBranchTerminatorOpInterface::Trait, ::mlir::OpTrait::ReturnLike, ::mlir::OpTrait::IsTerminator> { +public: + using Op::Op; + using Op::print; + using Adaptor = TFRReturnOpAdaptor; + template + using GenericAdaptor = TFRReturnOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tfr.return"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArguments(); + ::mlir::MutableOperandRange getArgumentsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange arguments); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::MutableOperandRange getMutableSuccessorOperands(::mlir::RegionBranchPoint point); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace TFR +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::TFR::TFRReturnOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tfr/ir/tfr_types.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tfr/ir/tfr_types.h new file mode 100644 index 0000000000000000000000000000000000000000..c862f0f1b5f983722aae71c5575c498898d53116 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tfr/ir/tfr_types.h @@ -0,0 +1,123 @@ +/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TFR_IR_TFR_TYPES_H_ +#define TENSORFLOW_COMPILER_MLIR_TFR_IR_TFR_TYPES_H_ + +#include +#include + +#include "mlir/IR/Attributes.h" // from @llvm-project +#include "mlir/IR/BuiltinTypes.h" // from @llvm-project +#include "mlir/IR/Diagnostics.h" // from @llvm-project +#include "mlir/IR/Location.h" // from @llvm-project +#include "mlir/IR/MLIRContext.h" // from @llvm-project +#include "mlir/IR/Operation.h" // from @llvm-project +#include "mlir/IR/TypeSupport.h" // from @llvm-project +#include "mlir/IR/Types.h" // from @llvm-project + +namespace mlir { +namespace TFR { + +class TFRType : public Type { + public: + using Type::Type; + + static bool classof(Type type); +}; + +namespace detail { + +struct TFRTypeStorage final + : public TypeStorage, + public llvm::TrailingObjects { + using KeyTy = ArrayRef; + + explicit TFRTypeStorage(unsigned num_attrs) : num_attrs(num_attrs) {} + + static TFRTypeStorage* construct(TypeStorageAllocator& allocator, KeyTy key) { + // Allocate a new storage instance. + auto byteSize = TFRTypeStorage::totalSizeToAlloc(key.size()); + auto rawMem = allocator.allocate(byteSize, alignof(TFRTypeStorage)); + auto result = ::new (rawMem) TFRTypeStorage(key.size()); + + // Copy in the string attributes into the trailing storage. + std::uninitialized_copy(key.begin(), key.end(), + result->getTrailingObjects()); + return result; + } + + bool operator==(const KeyTy& attrs) const { return attrs == GetAttrs(); } + + KeyTy GetAttrs() const { + return {getTrailingObjects(), num_attrs}; + } + + unsigned num_attrs; +}; + +template +class TFRTypeImpl : public Type::TypeBase { + public: + using Base = Type::TypeBase; + using TFRBase = TFRTypeImpl; + using Base::Base; + + static Derived get(ArrayRef attrs, MLIRContext* context) { + return Base::get(context, attrs); + } + + static Derived getChecked(ArrayRef attrs, Location loc) { + return Base::getChecked(loc, loc.getContext(), attrs); + } + static Derived getChecked(function_ref emitError, + MLIRContext* context, ArrayRef attrs) { + return Base::getChecked(emitError, context, attrs); + } + + static Derived get(MLIRContext* context) { return get({}, context); } + + // TODO(fengliuai): fix the implementation + static LogicalResult verify(function_ref emitError, + ArrayRef attrs) { + return success(); + } + + ArrayRef getAttrKeys() { return Base::getImpl()->GetAttrs(); } +}; +} // namespace detail + +class TFRTensorType : public detail::TFRTypeImpl { + public: + using TFRBase::TFRBase; + static std::string getTypeName() { return "TFRTensorType"; } +}; + +class TFRTensorListType : public detail::TFRTypeImpl { + public: + using TFRBase::TFRBase; + static std::string getTypeName() { return "TFRTensorListType"; } +}; + +class TFRAttrType : public Type::TypeBase { + public: + using Base::Base; + static std::string getTypeName() { return "TFRAttrType"; } +}; + +} // namespace TFR +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TFR_IR_TFR_TYPES_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tfr/passes/passes.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tfr/passes/passes.h new file mode 100644 index 0000000000000000000000000000000000000000..00bf11870ca2f2c6aaa7d4dc9394e422819a5a2d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tfr/passes/passes.h @@ -0,0 +1,52 @@ +/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TFR_PASSES_PASSES_H_ +#define TENSORFLOW_COMPILER_MLIR_TFR_PASSES_PASSES_H_ + +#include +#include + +#include "mlir/Dialect/Func/IR/FuncOps.h" // from @llvm-project +#include "mlir/IR/BuiltinOps.h" // from @llvm-project +#include "mlir/Pass/Pass.h" // from @llvm-project +#include "mlir/Support/LogicalResult.h" // from @llvm-project + +namespace mlir { +namespace TFR { + +// Scans the func op and adds all the canonicalization patterns of the ops +// except the tf ops, inside the function. +void populateCanonicalizationPatterns(func::FuncOp func, + RewritePatternSet &patterns); + +// Decompose ops. +std::unique_ptr> CreateDecomposeTFOpsPass( + std::optional tfr_module = std::nullopt); + +// Rewrites quantized operands and results with their storage types. +// This pass should be run at module level after decomposition, if there are +// quantized operands or results. +std::unique_ptr> CreateRewriteQuantizedIOPass(); + +// Raise to TF ops. +std::unique_ptr> CreateRaiseToTFOpsPass( + std::optional tfr_module = std::nullopt, + bool materialize_derived_attrs = false); + +} // namespace TFR +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TFR_PASSES_PASSES_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tfr/utils/utils.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tfr/utils/utils.h new file mode 100644 index 0000000000000000000000000000000000000000..911015ae0be518ea9ed9c6085d650405eb392005 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tfr/utils/utils.h @@ -0,0 +1,66 @@ +/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TFR_UTILS_UTILS_H_ +#define TENSORFLOW_COMPILER_MLIR_TFR_UTILS_UTILS_H_ + +#include + +#include "mlir/IR/Block.h" // from @llvm-project +#include "mlir/IR/Operation.h" // from @llvm-project +#include "mlir/IR/OperationSupport.h" // from @llvm-project +#include "mlir/Support/LLVM.h" // from @llvm-project +#include "mlir/Support/LogicalResult.h" // from @llvm-project +#include "tensorflow/compiler/mlir/tfr/ir/tfr_ops.h" + +namespace mlir { +namespace TFR { + +// This is a hardcoded rule for mapping a TF op name to the corresponding +// TFR function name. Examples: +// tf.Pack => tf__pack +// tf.ConcatV2 => tf__concat_v2 +// TODO(fengliuai): move to an util file. +std::string GetComposeFuncName(StringRef tf_op_name); + +// This is a hardcoded rule for mapping a TFR function op name to the +// corresponding TF opname. Examples: +// tf__pack -> tf.Pack +// tf__concat_v2 => tf.ConcatV2 +std::string GetTFOpName(StringRef compose_func_name); + +// Validate the attributes of 'src' is either contained in the registered +// attribute sets or in the allowed list. +LogicalResult ValidateAttrs(Operation* src, const StringSet<>& registered); + +// Copies all the allowed attributes in 'src' to 'dst'. The copy failed if the +// 'dst' has the attribute. Return a failure if there are any attributes are not +// allowed and also unregistered. +LogicalResult CopyAllowedUnregisteredAttrs(Operation* src, CallOp dst, + const StringSet<>& registered); + +// Copies all the allowed attributes in 'src' to 'dst'. FlatSymbolRefAttr is +// excluded. +LogicalResult CopyNonSymbolRefAttrs(CallOp src, Operation* dst); + +// Propagates all the attributes in 'src' to the operations between 'begin' and +// 'end'. Operation 'end' is excluded. +void PropagateAttrsToOperations(CallOp src, Block::iterator begin, + Block::iterator end); + +} // namespace TFR +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TFR_UTILS_UTILS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tools/kernel_gen/compile_cache_item.pb.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tools/kernel_gen/compile_cache_item.pb.h new file mode 100644 index 0000000000000000000000000000000000000000..595821b41a5d3e6fd184da105a282bd2975469d5 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tools/kernel_gen/compile_cache_item.pb.h @@ -0,0 +1,352 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tensorflow/compiler/mlir/tools/kernel_gen/compile_cache_item.proto + +#ifndef GOOGLE_PROTOBUF_INCLUDED_tensorflow_2fcompiler_2fmlir_2ftools_2fkernel_5fgen_2fcompile_5fcache_5fitem_2eproto +#define GOOGLE_PROTOBUF_INCLUDED_tensorflow_2fcompiler_2fmlir_2ftools_2fkernel_5fgen_2fcompile_5fcache_5fitem_2eproto + +#include +#include + +#include +#if PROTOBUF_VERSION < 3021000 +#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 3021009 < 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 // IWYU pragma: export +#include // IWYU pragma: export +#include +// @@protoc_insertion_point(includes) +#include +#define PROTOBUF_INTERNAL_EXPORT_tensorflow_2fcompiler_2fmlir_2ftools_2fkernel_5fgen_2fcompile_5fcache_5fitem_2eproto +PROTOBUF_NAMESPACE_OPEN +namespace internal { +class AnyMetadata; +} // namespace internal +PROTOBUF_NAMESPACE_CLOSE + +// Internal implementation detail -- do not use these members. +struct TableStruct_tensorflow_2fcompiler_2fmlir_2ftools_2fkernel_5fgen_2fcompile_5fcache_5fitem_2eproto { + static const uint32_t offsets[]; +}; +extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_tensorflow_2fcompiler_2fmlir_2ftools_2fkernel_5fgen_2fcompile_5fcache_5fitem_2eproto; +namespace mlir { +namespace kernel_gen { +class CompilationCacheItem; +struct CompilationCacheItemDefaultTypeInternal; +extern CompilationCacheItemDefaultTypeInternal _CompilationCacheItem_default_instance_; +} // namespace kernel_gen +} // namespace mlir +PROTOBUF_NAMESPACE_OPEN +template<> ::mlir::kernel_gen::CompilationCacheItem* Arena::CreateMaybeMessage<::mlir::kernel_gen::CompilationCacheItem>(Arena*); +PROTOBUF_NAMESPACE_CLOSE +namespace mlir { +namespace kernel_gen { + +// =================================================================== + +class CompilationCacheItem final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:mlir.kernel_gen.CompilationCacheItem) */ { + public: + inline CompilationCacheItem() : CompilationCacheItem(nullptr) {} + ~CompilationCacheItem() override; + explicit PROTOBUF_CONSTEXPR CompilationCacheItem(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + CompilationCacheItem(const CompilationCacheItem& from); + CompilationCacheItem(CompilationCacheItem&& from) noexcept + : CompilationCacheItem() { + *this = ::std::move(from); + } + + inline CompilationCacheItem& operator=(const CompilationCacheItem& from) { + CopyFrom(from); + return *this; + } + inline CompilationCacheItem& operator=(CompilationCacheItem&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const CompilationCacheItem& default_instance() { + return *internal_default_instance(); + } + static inline const CompilationCacheItem* internal_default_instance() { + return reinterpret_cast( + &_CompilationCacheItem_default_instance_); + } + static constexpr int kIndexInFileMessages = + 0; + + friend void swap(CompilationCacheItem& a, CompilationCacheItem& b) { + a.Swap(&b); + } + inline void Swap(CompilationCacheItem* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(CompilationCacheItem* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + CompilationCacheItem* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const CompilationCacheItem& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom( const CompilationCacheItem& from) { + CompilationCacheItem::MergeImpl(*this, from); + } + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); + public: + 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(CompilationCacheItem* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "mlir.kernel_gen.CompilationCacheItem"; + } + protected: + explicit CompilationCacheItem(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kOriginalModuleFieldNumber = 1, + kResultModuleFieldNumber = 2, + }; + // string original_module = 1; + void clear_original_module(); + const std::string& original_module() const; + template + void set_original_module(ArgT0&& arg0, ArgT... args); + std::string* mutable_original_module(); + PROTOBUF_NODISCARD std::string* release_original_module(); + void set_allocated_original_module(std::string* original_module); + private: + const std::string& _internal_original_module() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_original_module(const std::string& value); + std::string* _internal_mutable_original_module(); + public: + + // string result_module = 2; + void clear_result_module(); + const std::string& result_module() const; + template + void set_result_module(ArgT0&& arg0, ArgT... args); + std::string* mutable_result_module(); + PROTOBUF_NODISCARD std::string* release_result_module(); + void set_allocated_result_module(std::string* result_module); + private: + const std::string& _internal_result_module() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_result_module(const std::string& value); + std::string* _internal_mutable_result_module(); + public: + + // @@protoc_insertion_point(class_scope:mlir.kernel_gen.CompilationCacheItem) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr original_module_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr result_module_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_tensorflow_2fcompiler_2fmlir_2ftools_2fkernel_5fgen_2fcompile_5fcache_5fitem_2eproto; +}; +// =================================================================== + + +// =================================================================== + +#ifdef __GNUC__ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wstrict-aliasing" +#endif // __GNUC__ +// CompilationCacheItem + +// string original_module = 1; +inline void CompilationCacheItem::clear_original_module() { + _impl_.original_module_.ClearToEmpty(); +} +inline const std::string& CompilationCacheItem::original_module() const { + // @@protoc_insertion_point(field_get:mlir.kernel_gen.CompilationCacheItem.original_module) + return _internal_original_module(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void CompilationCacheItem::set_original_module(ArgT0&& arg0, ArgT... args) { + + _impl_.original_module_.Set(static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:mlir.kernel_gen.CompilationCacheItem.original_module) +} +inline std::string* CompilationCacheItem::mutable_original_module() { + std::string* _s = _internal_mutable_original_module(); + // @@protoc_insertion_point(field_mutable:mlir.kernel_gen.CompilationCacheItem.original_module) + return _s; +} +inline const std::string& CompilationCacheItem::_internal_original_module() const { + return _impl_.original_module_.Get(); +} +inline void CompilationCacheItem::_internal_set_original_module(const std::string& value) { + + _impl_.original_module_.Set(value, GetArenaForAllocation()); +} +inline std::string* CompilationCacheItem::_internal_mutable_original_module() { + + return _impl_.original_module_.Mutable(GetArenaForAllocation()); +} +inline std::string* CompilationCacheItem::release_original_module() { + // @@protoc_insertion_point(field_release:mlir.kernel_gen.CompilationCacheItem.original_module) + return _impl_.original_module_.Release(); +} +inline void CompilationCacheItem::set_allocated_original_module(std::string* original_module) { + if (original_module != nullptr) { + + } else { + + } + _impl_.original_module_.SetAllocated(original_module, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.original_module_.IsDefault()) { + _impl_.original_module_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:mlir.kernel_gen.CompilationCacheItem.original_module) +} + +// string result_module = 2; +inline void CompilationCacheItem::clear_result_module() { + _impl_.result_module_.ClearToEmpty(); +} +inline const std::string& CompilationCacheItem::result_module() const { + // @@protoc_insertion_point(field_get:mlir.kernel_gen.CompilationCacheItem.result_module) + return _internal_result_module(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void CompilationCacheItem::set_result_module(ArgT0&& arg0, ArgT... args) { + + _impl_.result_module_.Set(static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:mlir.kernel_gen.CompilationCacheItem.result_module) +} +inline std::string* CompilationCacheItem::mutable_result_module() { + std::string* _s = _internal_mutable_result_module(); + // @@protoc_insertion_point(field_mutable:mlir.kernel_gen.CompilationCacheItem.result_module) + return _s; +} +inline const std::string& CompilationCacheItem::_internal_result_module() const { + return _impl_.result_module_.Get(); +} +inline void CompilationCacheItem::_internal_set_result_module(const std::string& value) { + + _impl_.result_module_.Set(value, GetArenaForAllocation()); +} +inline std::string* CompilationCacheItem::_internal_mutable_result_module() { + + return _impl_.result_module_.Mutable(GetArenaForAllocation()); +} +inline std::string* CompilationCacheItem::release_result_module() { + // @@protoc_insertion_point(field_release:mlir.kernel_gen.CompilationCacheItem.result_module) + return _impl_.result_module_.Release(); +} +inline void CompilationCacheItem::set_allocated_result_module(std::string* result_module) { + if (result_module != nullptr) { + + } else { + + } + _impl_.result_module_.SetAllocated(result_module, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.result_module_.IsDefault()) { + _impl_.result_module_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:mlir.kernel_gen.CompilationCacheItem.result_module) +} + +#ifdef __GNUC__ + #pragma GCC diagnostic pop +#endif // __GNUC__ + +// @@protoc_insertion_point(namespace_scope) + +} // namespace kernel_gen +} // namespace mlir + +// @@protoc_insertion_point(global_scope) + +#include +#endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_tensorflow_2fcompiler_2fmlir_2ftools_2fkernel_5fgen_2fcompile_5fcache_5fitem_2eproto diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tools/kernel_gen/ir/tf_framework_dialect.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tools/kernel_gen/ir/tf_framework_dialect.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..6202ce34ef5ef2721b67c7178edd956935500373 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tools/kernel_gen/ir/tf_framework_dialect.h.inc @@ -0,0 +1,38 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: tf_framework_ops.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace kernel_gen { +namespace tf_framework { + +class TFFrameworkDialect : public ::mlir::Dialect { + explicit TFFrameworkDialect(::mlir::MLIRContext *context); + + void initialize(); + friend class ::mlir::MLIRContext; +public: + ~TFFrameworkDialect() override; + static constexpr ::llvm::StringLiteral getDialectNamespace() { + return ::llvm::StringLiteral("tf_framework"); + } + + /// Parse a type registered to this dialect. + ::mlir::Type parseType(::mlir::DialectAsmParser &parser) const override; + + /// Print a type registered to this dialect. + void printType(::mlir::Type type, + ::mlir::DialectAsmPrinter &os) const override; + + static constexpr StringRef kTFEntryAttrName = "tf_entry"; + static constexpr size_t kAllocationAlignment = 16; + }; +} // namespace tf_framework +} // namespace kernel_gen +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::kernel_gen::tf_framework::TFFrameworkDialect) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tools/kernel_gen/ir/tf_framework_ops.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tools/kernel_gen/ir/tf_framework_ops.h new file mode 100644 index 0000000000000000000000000000000000000000..c1a6daff83008dc8021af30682f0679ed0a208fb --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tools/kernel_gen/ir/tf_framework_ops.h @@ -0,0 +1,63 @@ +/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +// This file defines the operations used in the TFFramework dialect. +// +#ifndef TENSORFLOW_COMPILER_MLIR_TOOLS_KERNEL_GEN_IR_TF_FRAMEWORK_OPS_H_ +#define TENSORFLOW_COMPILER_MLIR_TOOLS_KERNEL_GEN_IR_TF_FRAMEWORK_OPS_H_ + +#include "absl/status/status.h" +#include "mlir/Bytecode/BytecodeOpInterface.h" // from @llvm-project +#include "mlir/Dialect/Bufferization/IR/AllocationOpInterface.h" // from @llvm-project +#include "mlir/IR/Attributes.h" // from @llvm-project +#include "mlir/IR/BuiltinTypes.h" // from @llvm-project +#include "mlir/IR/Dialect.h" // from @llvm-project +#include "mlir/IR/MLIRContext.h" // from @llvm-project +#include "mlir/IR/OpDefinition.h" // from @llvm-project +#include "mlir/IR/OpImplementation.h" // from @llvm-project +#include "mlir/Interfaces/ControlFlowInterfaces.h" // from @llvm-project +#include "mlir/Interfaces/SideEffectInterfaces.h" // from @llvm-project +#include "tensorflow/compiler/mlir/tools/kernel_gen/ir/tf_status.h.inc" +#include "tensorflow/core/protobuf/error_codes.pb.h" + +namespace mlir { +namespace kernel_gen { +namespace tf_framework { + +/// OpKernelContextType corresponds to C++ class OpKernelContext defined in +/// tensorflow/core/framework/op_kernel.h +class OpKernelContextType + : public Type::TypeBase { + public: + using Base::Base; +}; + +class JITCallableType + : public Type::TypeBase { + public: + using Base::Base; +}; + +absl::StatusCode ConvertAttrToEnumValue(ErrorCode error_code); + +} // namespace tf_framework +} // namespace kernel_gen +} // namespace mlir + +#define GET_OP_CLASSES +#include "tensorflow/compiler/mlir/tools/kernel_gen/ir/tf_framework_dialect.h.inc" +#include "tensorflow/compiler/mlir/tools/kernel_gen/ir/tf_framework_ops.h.inc" + +#endif // TENSORFLOW_COMPILER_MLIR_TOOLS_KERNEL_GEN_IR_TF_FRAMEWORK_OPS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tools/kernel_gen/ir/tf_framework_ops.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tools/kernel_gen/ir/tf_framework_ops.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..b418b4334d3309ec8fc30537e573bd5c3bf4118c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tools/kernel_gen/ir/tf_framework_ops.h.inc @@ -0,0 +1,1777 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: tf_framework_ops.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#if defined(GET_OP_CLASSES) || defined(GET_OP_FWD_DEFINES) +#undef GET_OP_FWD_DEFINES +namespace mlir { +namespace kernel_gen { +namespace tf_framework { +class IsValidMemRefOp; +} // namespace tf_framework +} // namespace kernel_gen +} // namespace mlir +namespace mlir { +namespace kernel_gen { +namespace tf_framework { +class JITCompileFromStrOp; +} // namespace tf_framework +} // namespace kernel_gen +} // namespace mlir +namespace mlir { +namespace kernel_gen { +namespace tf_framework { +class JITCompileOp; +} // namespace tf_framework +} // namespace kernel_gen +} // namespace mlir +namespace mlir { +namespace kernel_gen { +namespace tf_framework { +class JITCompileYieldOp; +} // namespace tf_framework +} // namespace kernel_gen +} // namespace mlir +namespace mlir { +namespace kernel_gen { +namespace tf_framework { +class JITExecuteOp; +} // namespace tf_framework +} // namespace kernel_gen +} // namespace mlir +namespace mlir { +namespace kernel_gen { +namespace tf_framework { +class NullContextOp; +} // namespace tf_framework +} // namespace kernel_gen +} // namespace mlir +namespace mlir { +namespace kernel_gen { +namespace tf_framework { +class NullMemRefOp; +} // namespace tf_framework +} // namespace kernel_gen +} // namespace mlir +namespace mlir { +namespace kernel_gen { +namespace tf_framework { +class ReportErrorOp; +} // namespace tf_framework +} // namespace kernel_gen +} // namespace mlir +namespace mlir { +namespace kernel_gen { +namespace tf_framework { +class TFAllocOp; +} // namespace tf_framework +} // namespace kernel_gen +} // namespace mlir +namespace mlir { +namespace kernel_gen { +namespace tf_framework { +class TFAssertOp; +} // namespace tf_framework +} // namespace kernel_gen +} // namespace mlir +namespace mlir { +namespace kernel_gen { +namespace tf_framework { +class TFDeallocOp; +} // namespace tf_framework +} // namespace kernel_gen +} // namespace mlir +#endif + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace kernel_gen { +namespace tf_framework { + +//===----------------------------------------------------------------------===// +// ::mlir::kernel_gen::tf_framework::IsValidMemRefOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IsValidMemRefOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IsValidMemRefOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IsValidMemRefOpGenericAdaptorBase(IsValidMemRefOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class IsValidMemRefOpGenericAdaptor : public detail::IsValidMemRefOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IsValidMemRefOpGenericAdaptorBase; +public: + IsValidMemRefOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IsValidMemRefOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IsValidMemRefOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IsValidMemRefOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getArg() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IsValidMemRefOpAdaptor : public IsValidMemRefOpGenericAdaptor<::mlir::ValueRange> { +public: + using IsValidMemRefOpGenericAdaptor::IsValidMemRefOpGenericAdaptor; + IsValidMemRefOpAdaptor(IsValidMemRefOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IsValidMemRefOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = IsValidMemRefOpAdaptor; + template + using GenericAdaptor = IsValidMemRefOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf_framework.is_valid_memref"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getArg(); + ::mlir::OpOperand &getArgMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::IntegerType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value arg); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value arg); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace tf_framework +} // namespace kernel_gen +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::kernel_gen::tf_framework::IsValidMemRefOp) + +namespace mlir { +namespace kernel_gen { +namespace tf_framework { + +//===----------------------------------------------------------------------===// +// ::mlir::kernel_gen::tf_framework::JITCompileFromStrOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class JITCompileFromStrOpGenericAdaptorBase { +public: + struct Properties { + using codeTy = ::mlir::StringAttr; + codeTy code; + + auto getCode() { + auto &propStorage = this->code; + return ::llvm::cast<::mlir::StringAttr>(propStorage); + } + void setCode(const ::mlir::StringAttr &propValue) { + this->code = propValue; + } + using cpuCodegenTy = ::mlir::BoolAttr; + cpuCodegenTy cpuCodegen; + + auto getCpuCodegen() { + auto &propStorage = this->cpuCodegen; + return ::llvm::cast<::mlir::BoolAttr>(propStorage); + } + void setCpuCodegen(const ::mlir::BoolAttr &propValue) { + this->cpuCodegen = propValue; + } + using enableFtzTy = ::mlir::BoolAttr; + enableFtzTy enableFtz; + + auto getEnableFtz() { + auto &propStorage = this->enableFtz; + return ::llvm::cast<::mlir::BoolAttr>(propStorage); + } + void setEnableFtz(const ::mlir::BoolAttr &propValue) { + this->enableFtz = propValue; + } + using index64BitTy = ::mlir::BoolAttr; + index64BitTy index64Bit; + + auto getIndex64Bit() { + auto &propStorage = this->index64Bit; + return ::llvm::cast<::mlir::BoolAttr>(propStorage); + } + void setIndex64Bit(const ::mlir::BoolAttr &propValue) { + this->index64Bit = propValue; + } + using maxSupportedRankTy = ::mlir::IntegerAttr; + maxSupportedRankTy maxSupportedRank; + + auto getMaxSupportedRank() { + auto &propStorage = this->maxSupportedRank; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setMaxSupportedRank(const ::mlir::IntegerAttr &propValue) { + this->maxSupportedRank = propValue; + } + using tileSizesTy = ::mlir::ArrayAttr; + tileSizesTy tileSizes; + + auto getTileSizes() { + auto &propStorage = this->tileSizes; + return ::llvm::cast<::mlir::ArrayAttr>(propStorage); + } + void setTileSizes(const ::mlir::ArrayAttr &propValue) { + this->tileSizes = propValue; + } + using unrollFactorsTy = ::mlir::ArrayAttr; + unrollFactorsTy unrollFactors; + + auto getUnrollFactors() { + auto &propStorage = this->unrollFactors; + return ::llvm::cast<::mlir::ArrayAttr>(propStorage); + } + void setUnrollFactors(const ::mlir::ArrayAttr &propValue) { + this->unrollFactors = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.code == this->code && + rhs.cpuCodegen == this->cpuCodegen && + rhs.enableFtz == this->enableFtz && + rhs.index64Bit == this->index64Bit && + rhs.maxSupportedRank == this->maxSupportedRank && + rhs.tileSizes == this->tileSizes && + rhs.unrollFactors == this->unrollFactors && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + JITCompileFromStrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + JITCompileFromStrOpGenericAdaptorBase(JITCompileFromStrOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getCodeAttr(); + ::llvm::StringRef getCode(); + ::mlir::ArrayAttr getTileSizesAttr(); + ::mlir::ArrayAttr getTileSizes(); + ::mlir::ArrayAttr getUnrollFactorsAttr(); + ::mlir::ArrayAttr getUnrollFactors(); + ::mlir::IntegerAttr getMaxSupportedRankAttr(); + uint64_t getMaxSupportedRank(); + ::mlir::BoolAttr getEnableFtzAttr(); + bool getEnableFtz(); + ::mlir::BoolAttr getIndex64BitAttr(); + bool getIndex64Bit(); + ::mlir::BoolAttr getCpuCodegenAttr(); + bool getCpuCodegen(); +}; +} // namespace detail +template +class JITCompileFromStrOpGenericAdaptor : public detail::JITCompileFromStrOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::JITCompileFromStrOpGenericAdaptorBase; +public: + JITCompileFromStrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + JITCompileFromStrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : JITCompileFromStrOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + JITCompileFromStrOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getCtx() { + auto operands = getODSOperands(0); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class JITCompileFromStrOpAdaptor : public JITCompileFromStrOpGenericAdaptor<::mlir::ValueRange> { +public: + using JITCompileFromStrOpGenericAdaptor::JITCompileFromStrOpGenericAdaptor; + JITCompileFromStrOpAdaptor(JITCompileFromStrOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class JITCompileFromStrOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = JITCompileFromStrOpAdaptor; + template + using GenericAdaptor = JITCompileFromStrOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("code"), ::llvm::StringRef("cpuCodegen"), ::llvm::StringRef("enableFtz"), ::llvm::StringRef("index64Bit"), ::llvm::StringRef("maxSupportedRank"), ::llvm::StringRef("tileSizes"), ::llvm::StringRef("unrollFactors")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getCodeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getCodeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getCpuCodegenAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getCpuCodegenAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getEnableFtzAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getEnableFtzAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getIndex64BitAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getIndex64BitAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getMaxSupportedRankAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getMaxSupportedRankAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getTileSizesAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getTileSizesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getUnrollFactorsAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getUnrollFactorsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf_framework.jit_compile_from_str"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getCtx(); + ::mlir::MutableOperandRange getCtxMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::StringAttr getCodeAttr(); + ::llvm::StringRef getCode(); + ::mlir::ArrayAttr getTileSizesAttr(); + ::mlir::ArrayAttr getTileSizes(); + ::mlir::ArrayAttr getUnrollFactorsAttr(); + ::mlir::ArrayAttr getUnrollFactors(); + ::mlir::IntegerAttr getMaxSupportedRankAttr(); + uint64_t getMaxSupportedRank(); + ::mlir::BoolAttr getEnableFtzAttr(); + bool getEnableFtz(); + ::mlir::BoolAttr getIndex64BitAttr(); + bool getIndex64Bit(); + ::mlir::BoolAttr getCpuCodegenAttr(); + bool getCpuCodegen(); + void setCodeAttr(::mlir::StringAttr attr); + void setCode(::llvm::StringRef attrValue); + void setTileSizesAttr(::mlir::ArrayAttr attr); + void setUnrollFactorsAttr(::mlir::ArrayAttr attr); + void setMaxSupportedRankAttr(::mlir::IntegerAttr attr); + void setMaxSupportedRank(uint64_t attrValue); + void setEnableFtzAttr(::mlir::BoolAttr attr); + void setEnableFtz(bool attrValue); + void setIndex64BitAttr(::mlir::BoolAttr attr); + void setIndex64Bit(bool attrValue); + void setCpuCodegenAttr(::mlir::BoolAttr attr); + void setCpuCodegen(bool attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, /*optional*/::mlir::Value ctx, ::mlir::StringAttr code, ::mlir::ArrayAttr tileSizes, ::mlir::ArrayAttr unrollFactors, ::mlir::IntegerAttr maxSupportedRank, ::mlir::BoolAttr enableFtz, ::mlir::BoolAttr index64Bit, ::mlir::BoolAttr cpuCodegen); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value ctx, ::mlir::StringAttr code, ::mlir::ArrayAttr tileSizes, ::mlir::ArrayAttr unrollFactors, ::mlir::IntegerAttr maxSupportedRank, ::mlir::BoolAttr enableFtz, ::mlir::BoolAttr index64Bit, ::mlir::BoolAttr cpuCodegen); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, /*optional*/::mlir::Value ctx, ::llvm::StringRef code, ::mlir::ArrayAttr tileSizes, ::mlir::ArrayAttr unrollFactors, uint64_t maxSupportedRank, bool enableFtz, bool index64Bit, bool cpuCodegen); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value ctx, ::llvm::StringRef code, ::mlir::ArrayAttr tileSizes, ::mlir::ArrayAttr unrollFactors, uint64_t maxSupportedRank, bool enableFtz, bool index64Bit, bool cpuCodegen); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 7 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static constexpr StringRef kJITEntryFunctionName = "main"; +}; +} // namespace tf_framework +} // namespace kernel_gen +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::kernel_gen::tf_framework::JITCompileFromStrOp) + +namespace mlir { +namespace kernel_gen { +namespace tf_framework { + +//===----------------------------------------------------------------------===// +// ::mlir::kernel_gen::tf_framework::JITCompileOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class JITCompileOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + JITCompileOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + JITCompileOpGenericAdaptorBase(JITCompileOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Region &getBody(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class JITCompileOpGenericAdaptor : public detail::JITCompileOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::JITCompileOpGenericAdaptorBase; +public: + JITCompileOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + JITCompileOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : JITCompileOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + JITCompileOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getCtx() { + auto operands = getODSOperands(0); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class JITCompileOpAdaptor : public JITCompileOpGenericAdaptor<::mlir::ValueRange> { +public: + using JITCompileOpGenericAdaptor::JITCompileOpGenericAdaptor; + JITCompileOpAdaptor(JITCompileOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class JITCompileOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::SingleBlock, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = JITCompileOpAdaptor; + template + using GenericAdaptor = JITCompileOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf_framework.jit_compile"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getCtx(); + ::mlir::MutableOperandRange getCtxMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + ::mlir::Region &getBody(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, /*optional*/::mlir::Value ctx); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value ctx); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace tf_framework +} // namespace kernel_gen +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::kernel_gen::tf_framework::JITCompileOp) + +namespace mlir { +namespace kernel_gen { +namespace tf_framework { + +//===----------------------------------------------------------------------===// +// ::mlir::kernel_gen::tf_framework::JITCompileYieldOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class JITCompileYieldOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + JITCompileYieldOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + JITCompileYieldOpGenericAdaptorBase(JITCompileYieldOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class JITCompileYieldOpGenericAdaptor : public detail::JITCompileYieldOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::JITCompileYieldOpGenericAdaptorBase; +public: + JITCompileYieldOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + JITCompileYieldOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : JITCompileYieldOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + JITCompileYieldOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getResult() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class JITCompileYieldOpAdaptor : public JITCompileYieldOpGenericAdaptor<::mlir::ValueRange> { +public: + using JITCompileYieldOpGenericAdaptor::JITCompileYieldOpGenericAdaptor; + JITCompileYieldOpAdaptor(JITCompileYieldOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class JITCompileYieldOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::RegionBranchTerminatorOpInterface::Trait, ::mlir::OpTrait::ReturnLike, ::mlir::OpTrait::IsTerminator> { +public: + using Op::Op; + using Op::print; + using Adaptor = JITCompileYieldOpAdaptor; + template + using GenericAdaptor = JITCompileYieldOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf_framework.jit_compile_yield"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getResult(); + ::mlir::OpOperand &getResultMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value result); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value result); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::MutableOperandRange getMutableSuccessorOperands(::mlir::RegionBranchPoint point); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace tf_framework +} // namespace kernel_gen +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::kernel_gen::tf_framework::JITCompileYieldOp) + +namespace mlir { +namespace kernel_gen { +namespace tf_framework { + +//===----------------------------------------------------------------------===// +// ::mlir::kernel_gen::tf_framework::JITExecuteOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class JITExecuteOpGenericAdaptorBase { +public: + struct Properties { + using operandSegmentSizesTy = std::array; + operandSegmentSizesTy operandSegmentSizes; + ::llvm::ArrayRef getOperandSegmentSizes() { + auto &propStorage = this->operandSegmentSizes; + return propStorage; + } + void setOperandSegmentSizes(const ::llvm::ArrayRef &propValue) { + auto &propStorage = this->operandSegmentSizes; + ::llvm::copy(propValue, propStorage.begin()); + } + bool operator==(const Properties &rhs) const { + return + rhs.operandSegmentSizes == this->operandSegmentSizes && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + JITExecuteOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + JITExecuteOpGenericAdaptorBase(JITExecuteOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class JITExecuteOpGenericAdaptor : public detail::JITExecuteOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::JITExecuteOpGenericAdaptorBase; +public: + JITExecuteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + JITExecuteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : JITExecuteOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + JITExecuteOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getCtx() { + auto operands = getODSOperands(0); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + ValueT getCallable() { + return (*getODSOperands(1).begin()); + } + + RangeT getInputs() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class JITExecuteOpAdaptor : public JITExecuteOpGenericAdaptor<::mlir::ValueRange> { +public: + using JITExecuteOpGenericAdaptor::JITExecuteOpGenericAdaptor; + JITExecuteOpAdaptor(JITExecuteOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class JITExecuteOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::bufferization::AllocationOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = JITExecuteOpAdaptor; + template + using GenericAdaptor = JITExecuteOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return (*this)->getName().getAttributeNames().back(); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return name.getAttributeNames().back(); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf_framework.jit_execute"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getCtx(); + ::mlir::Value getCallable(); + ::mlir::Operation::operand_range getInputs(); + ::mlir::MutableOperandRange getCtxMutable(); + ::mlir::OpOperand &getCallableMutable(); + ::mlir::MutableOperandRange getInputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, /*optional*/::mlir::Value ctx, ::mlir::Value callable, ::mlir::ValueRange inputs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, /*optional*/::mlir::Value ctx, ::mlir::Value callable, ::mlir::ValueRange inputs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::std::optional<::mlir::Operation*> buildDealloc(::mlir::OpBuilder&builder, ::mlir::Value alloc); + static ::std::optional<::mlir::Value> buildClone(::mlir::OpBuilder&builder, ::mlir::Value alloc); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + return {}; + } + +public: +}; +} // namespace tf_framework +} // namespace kernel_gen +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::kernel_gen::tf_framework::JITExecuteOp) + +namespace mlir { +namespace kernel_gen { +namespace tf_framework { + +//===----------------------------------------------------------------------===// +// ::mlir::kernel_gen::tf_framework::NullContextOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class NullContextOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + NullContextOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + NullContextOpGenericAdaptorBase(NullContextOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class NullContextOpGenericAdaptor : public detail::NullContextOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::NullContextOpGenericAdaptorBase; +public: + NullContextOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + NullContextOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : NullContextOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + NullContextOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class NullContextOpAdaptor : public NullContextOpGenericAdaptor<::mlir::ValueRange> { +public: + using NullContextOpGenericAdaptor::NullContextOpGenericAdaptor; + NullContextOpAdaptor(NullContextOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class NullContextOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = NullContextOpAdaptor; + template + using GenericAdaptor = NullContextOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf_framework.null_context"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace tf_framework +} // namespace kernel_gen +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::kernel_gen::tf_framework::NullContextOp) + +namespace mlir { +namespace kernel_gen { +namespace tf_framework { + +//===----------------------------------------------------------------------===// +// ::mlir::kernel_gen::tf_framework::NullMemRefOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class NullMemRefOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + NullMemRefOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + NullMemRefOpGenericAdaptorBase(NullMemRefOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class NullMemRefOpGenericAdaptor : public detail::NullMemRefOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::NullMemRefOpGenericAdaptorBase; +public: + NullMemRefOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + NullMemRefOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : NullMemRefOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + NullMemRefOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class NullMemRefOpAdaptor : public NullMemRefOpGenericAdaptor<::mlir::ValueRange> { +public: + using NullMemRefOpGenericAdaptor::NullMemRefOpGenericAdaptor; + NullMemRefOpAdaptor(NullMemRefOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class NullMemRefOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = NullMemRefOpAdaptor; + template + using GenericAdaptor = NullMemRefOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf_framework.null_memref"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::BaseMemRefType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace tf_framework +} // namespace kernel_gen +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::kernel_gen::tf_framework::NullMemRefOp) + +namespace mlir { +namespace kernel_gen { +namespace tf_framework { + +//===----------------------------------------------------------------------===// +// ::mlir::kernel_gen::tf_framework::ReportErrorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReportErrorOpGenericAdaptorBase { +public: + struct Properties { + using error_codeTy = ::mlir::kernel_gen::tf_framework::ErrorCodeAttr; + error_codeTy error_code; + + auto getErrorCode() { + auto &propStorage = this->error_code; + return ::llvm::cast<::mlir::kernel_gen::tf_framework::ErrorCodeAttr>(propStorage); + } + void setErrorCode(const ::mlir::kernel_gen::tf_framework::ErrorCodeAttr &propValue) { + this->error_code = propValue; + } + using msgTy = ::mlir::StringAttr; + msgTy msg; + + auto getMsg() { + auto &propStorage = this->msg; + return ::llvm::cast<::mlir::StringAttr>(propStorage); + } + void setMsg(const ::mlir::StringAttr &propValue) { + this->msg = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.error_code == this->error_code && + rhs.msg == this->msg && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + ReportErrorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + ReportErrorOpGenericAdaptorBase(ReportErrorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::kernel_gen::tf_framework::ErrorCodeAttr getErrorCodeAttr(); + ::mlir::kernel_gen::tf_framework::ErrorCode getErrorCode(); + ::mlir::StringAttr getMsgAttr(); + ::llvm::StringRef getMsg(); +}; +} // namespace detail +template +class ReportErrorOpGenericAdaptor : public detail::ReportErrorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReportErrorOpGenericAdaptorBase; +public: + ReportErrorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReportErrorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReportErrorOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + ReportErrorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getCtx() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ReportErrorOpAdaptor : public ReportErrorOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReportErrorOpGenericAdaptor::ReportErrorOpGenericAdaptor; + ReportErrorOpAdaptor(ReportErrorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReportErrorOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = ReportErrorOpAdaptor; + template + using GenericAdaptor = ReportErrorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("error_code"), ::llvm::StringRef("msg")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getErrorCodeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getErrorCodeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getMsgAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getMsgAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf_framework.report_error"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getCtx(); + ::mlir::OpOperand &getCtxMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::kernel_gen::tf_framework::ErrorCodeAttr getErrorCodeAttr(); + ::mlir::kernel_gen::tf_framework::ErrorCode getErrorCode(); + ::mlir::StringAttr getMsgAttr(); + ::llvm::StringRef getMsg(); + void setErrorCodeAttr(::mlir::kernel_gen::tf_framework::ErrorCodeAttr attr); + void setErrorCode(::mlir::kernel_gen::tf_framework::ErrorCode attrValue); + void setMsgAttr(::mlir::StringAttr attr); + void setMsg(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value ctx, ::mlir::kernel_gen::tf_framework::ErrorCodeAttr error_code, ::mlir::StringAttr msg); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ctx, ::mlir::kernel_gen::tf_framework::ErrorCodeAttr error_code, ::mlir::StringAttr msg); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value ctx, ::mlir::kernel_gen::tf_framework::ErrorCode error_code, ::llvm::StringRef msg); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ctx, ::mlir::kernel_gen::tf_framework::ErrorCode error_code, ::llvm::StringRef msg); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace tf_framework +} // namespace kernel_gen +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::kernel_gen::tf_framework::ReportErrorOp) + +namespace mlir { +namespace kernel_gen { +namespace tf_framework { + +//===----------------------------------------------------------------------===// +// ::mlir::kernel_gen::tf_framework::TFAllocOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TFAllocOpGenericAdaptorBase { +public: + struct Properties { + using input_indicesTy = ::mlir::ArrayAttr; + input_indicesTy input_indices; + + auto getInputIndices() { + auto &propStorage = this->input_indices; + return ::llvm::dyn_cast_or_null<::mlir::ArrayAttr>(propStorage); + } + void setInputIndices(const ::mlir::ArrayAttr &propValue) { + this->input_indices = propValue; + } + using output_indexTy = ::mlir::IntegerAttr; + output_indexTy output_index; + + auto getOutputIndex() { + auto &propStorage = this->output_index; + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(propStorage); + } + void setOutputIndex(const ::mlir::IntegerAttr &propValue) { + this->output_index = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.input_indices == this->input_indices && + rhs.output_index == this->output_index && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + TFAllocOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + TFAllocOpGenericAdaptorBase(TFAllocOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getInputIndicesAttr(); + ::std::optional< ::mlir::ArrayAttr > getInputIndices(); + ::mlir::IntegerAttr getOutputIndexAttr(); + ::std::optional getOutputIndex(); +}; +} // namespace detail +template +class TFAllocOpGenericAdaptor : public detail::TFAllocOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TFAllocOpGenericAdaptorBase; +public: + TFAllocOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TFAllocOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TFAllocOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + TFAllocOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getCtx() { + return (*getODSOperands(0).begin()); + } + + RangeT getDynSizes() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TFAllocOpAdaptor : public TFAllocOpGenericAdaptor<::mlir::ValueRange> { +public: + using TFAllocOpGenericAdaptor::TFAllocOpGenericAdaptor; + TFAllocOpAdaptor(TFAllocOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TFAllocOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::bufferization::AllocationOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TFAllocOpAdaptor; + template + using GenericAdaptor = TFAllocOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("input_indices"), ::llvm::StringRef("output_index")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getInputIndicesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getInputIndicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutputIndexAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutputIndexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf_framework.alloc"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getCtx(); + ::mlir::Operation::operand_range getDynSizes(); + ::mlir::OpOperand &getCtxMutable(); + ::mlir::MutableOperandRange getDynSizesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getResult(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::ArrayAttr getInputIndicesAttr(); + ::std::optional< ::mlir::ArrayAttr > getInputIndices(); + ::mlir::IntegerAttr getOutputIndexAttr(); + ::std::optional getOutputIndex(); + void setInputIndicesAttr(::mlir::ArrayAttr attr); + void setOutputIndexAttr(::mlir::IntegerAttr attr); + void setOutputIndex(::std::optional attrValue); + ::mlir::Attribute removeInputIndicesAttr(); + ::mlir::Attribute removeOutputIndexAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, MemRefType memref_type, Value ctx); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, MemRefType memref_type, Value ctx, ValueRange dyn_sizes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value ctx, ::mlir::ValueRange dyn_sizes, /*optional*/::mlir::ArrayAttr input_indices, /*optional*/::mlir::IntegerAttr output_index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ctx, ::mlir::ValueRange dyn_sizes, /*optional*/::mlir::ArrayAttr input_indices, /*optional*/::mlir::IntegerAttr output_index); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::std::optional<::mlir::Operation*> buildDealloc(::mlir::OpBuilder&builder, ::mlir::Value alloc); + static ::std::optional<::mlir::Value> buildClone(::mlir::OpBuilder&builder, ::mlir::Value alloc); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + MemRefType getType() { return getResult().getType().cast(); } + static constexpr StringRef kReuseOutputAttrName = "reuse_output"; + static constexpr StringRef kReuseInputCandidatesAttrName = + "reuse_input_candidates"; +}; +} // namespace tf_framework +} // namespace kernel_gen +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::kernel_gen::tf_framework::TFAllocOp) + +namespace mlir { +namespace kernel_gen { +namespace tf_framework { + +//===----------------------------------------------------------------------===// +// ::mlir::kernel_gen::tf_framework::TFAssertOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TFAssertOpGenericAdaptorBase { +public: + struct Properties { + using error_codeTy = ::mlir::kernel_gen::tf_framework::ErrorCodeAttr; + error_codeTy error_code; + + auto getErrorCode() { + auto &propStorage = this->error_code; + return ::llvm::cast<::mlir::kernel_gen::tf_framework::ErrorCodeAttr>(propStorage); + } + void setErrorCode(const ::mlir::kernel_gen::tf_framework::ErrorCodeAttr &propValue) { + this->error_code = propValue; + } + using msgTy = ::mlir::StringAttr; + msgTy msg; + + auto getMsg() { + auto &propStorage = this->msg; + return ::llvm::cast<::mlir::StringAttr>(propStorage); + } + void setMsg(const ::mlir::StringAttr &propValue) { + this->msg = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.error_code == this->error_code && + rhs.msg == this->msg && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + TFAssertOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + TFAssertOpGenericAdaptorBase(TFAssertOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::kernel_gen::tf_framework::ErrorCodeAttr getErrorCodeAttr(); + ::mlir::kernel_gen::tf_framework::ErrorCode getErrorCode(); + ::mlir::StringAttr getMsgAttr(); + ::llvm::StringRef getMsg(); +}; +} // namespace detail +template +class TFAssertOpGenericAdaptor : public detail::TFAssertOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TFAssertOpGenericAdaptorBase; +public: + TFAssertOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TFAssertOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TFAssertOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + TFAssertOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getCtx() { + return (*getODSOperands(0).begin()); + } + + ValueT getArg() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TFAssertOpAdaptor : public TFAssertOpGenericAdaptor<::mlir::ValueRange> { +public: + using TFAssertOpGenericAdaptor::TFAssertOpGenericAdaptor; + TFAssertOpAdaptor(TFAssertOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TFAssertOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TFAssertOpAdaptor; + template + using GenericAdaptor = TFAssertOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("error_code"), ::llvm::StringRef("msg")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getErrorCodeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getErrorCodeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getMsgAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getMsgAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf_framework.assert"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getCtx(); + ::mlir::TypedValue<::mlir::IntegerType> getArg(); + ::mlir::OpOperand &getCtxMutable(); + ::mlir::OpOperand &getArgMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::kernel_gen::tf_framework::ErrorCodeAttr getErrorCodeAttr(); + ::mlir::kernel_gen::tf_framework::ErrorCode getErrorCode(); + ::mlir::StringAttr getMsgAttr(); + ::llvm::StringRef getMsg(); + void setErrorCodeAttr(::mlir::kernel_gen::tf_framework::ErrorCodeAttr attr); + void setErrorCode(::mlir::kernel_gen::tf_framework::ErrorCode attrValue); + void setMsgAttr(::mlir::StringAttr attr); + void setMsg(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value ctx, ::mlir::Value arg, ::mlir::kernel_gen::tf_framework::ErrorCodeAttr error_code, ::mlir::StringAttr msg); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ctx, ::mlir::Value arg, ::mlir::kernel_gen::tf_framework::ErrorCodeAttr error_code, ::mlir::StringAttr msg); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value ctx, ::mlir::Value arg, ::mlir::kernel_gen::tf_framework::ErrorCode error_code, ::llvm::StringRef msg); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ctx, ::mlir::Value arg, ::mlir::kernel_gen::tf_framework::ErrorCode error_code, ::llvm::StringRef msg); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace tf_framework +} // namespace kernel_gen +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::kernel_gen::tf_framework::TFAssertOp) + +namespace mlir { +namespace kernel_gen { +namespace tf_framework { + +//===----------------------------------------------------------------------===// +// ::mlir::kernel_gen::tf_framework::TFDeallocOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TFDeallocOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TFDeallocOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TFDeallocOpGenericAdaptorBase(TFDeallocOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TFDeallocOpGenericAdaptor : public detail::TFDeallocOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TFDeallocOpGenericAdaptorBase; +public: + TFDeallocOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TFDeallocOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TFDeallocOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TFDeallocOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getCtx() { + return (*getODSOperands(0).begin()); + } + + ValueT getMemref() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TFDeallocOpAdaptor : public TFDeallocOpGenericAdaptor<::mlir::ValueRange> { +public: + using TFDeallocOpGenericAdaptor::TFDeallocOpGenericAdaptor; + TFDeallocOpAdaptor(TFDeallocOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TFDeallocOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TFDeallocOpAdaptor; + template + using GenericAdaptor = TFDeallocOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("tf_framework.dealloc"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getCtx(); + ::mlir::TypedValue<::mlir::BaseMemRefType> getMemref(); + ::mlir::OpOperand &getCtxMutable(); + ::mlir::OpOperand &getMemrefMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value ctx, ::mlir::Value memref); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ctx, ::mlir::Value memref); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace tf_framework +} // namespace kernel_gen +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::kernel_gen::tf_framework::TFDeallocOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tools/kernel_gen/ir/tf_status.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tools/kernel_gen/ir/tf_status.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..e5d130d5653621b1a3519aaacaec501ca879fc6a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tools/kernel_gen/ir/tf_status.h.inc @@ -0,0 +1,116 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Enum Utility Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: tf_status.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace kernel_gen { +namespace tf_framework { +// error code +enum class ErrorCode : uint32_t { + OK = 0, + CANCELLED = 1, + UNKNOWN = 2, + INVALID_ARGUMENT = 3, + DEADLINE_EXCEEDED = 4, + NOT_FOUND = 5, + ALREADY_EXISTS = 6, + PERMISSION_DENIED = 7, + UNAUTHENTICATED = 16, + RESOURCE_EXHAUSTED = 8, + FAILED_PRECONDITION = 9, + ABORTED = 10, + OUT_OF_RANGE = 11, + UNIMPLEMENTED = 12, + INTERNAL = 13, + UNAVAILABLE = 14, + DATA_LOSS = 15, +}; + +::std::optional symbolizeErrorCode(uint32_t); +::llvm::StringRef stringifyErrorCode(ErrorCode); +::std::optional symbolizeErrorCode(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForErrorCode() { + return 16; +} + + +inline ::llvm::StringRef stringifyEnum(ErrorCode enumValue) { + return stringifyErrorCode(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeErrorCode(str); +} + +class ErrorCodeAttr : public ::mlir::IntegerAttr { +public: + using ValueType = ErrorCode; + using ::mlir::IntegerAttr::IntegerAttr; + static bool classof(::mlir::Attribute attr); + static ErrorCodeAttr get(::mlir::MLIRContext *context, ErrorCode val); + ErrorCode getValue() const; +}; +} // namespace tf_framework +} // namespace kernel_gen +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::kernel_gen::tf_framework::ErrorCode, ::mlir::kernel_gen::tf_framework::ErrorCode> { + template + static FailureOr<::mlir::kernel_gen::tf_framework::ErrorCode> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for error code"); + + // Symbolize the keyword. + if (::std::optional<::mlir::kernel_gen::tf_framework::ErrorCode> attr = ::mlir::kernel_gen::tf_framework::symbolizeEnum<::mlir::kernel_gen::tf_framework::ErrorCode>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid error code specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::kernel_gen::tf_framework::ErrorCode value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::kernel_gen::tf_framework::ErrorCode> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::kernel_gen::tf_framework::ErrorCode getEmptyKey() { + return static_cast<::mlir::kernel_gen::tf_framework::ErrorCode>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::kernel_gen::tf_framework::ErrorCode getTombstoneKey() { + return static_cast<::mlir::kernel_gen::tf_framework::ErrorCode>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::kernel_gen::tf_framework::ErrorCode &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::kernel_gen::tf_framework::ErrorCode &lhs, const ::mlir::kernel_gen::tf_framework::ErrorCode &rhs) { + return lhs == rhs; + } +}; +} + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tools/kernel_gen/kernel_creator.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tools/kernel_gen/kernel_creator.h new file mode 100644 index 0000000000000000000000000000000000000000..ac8666874224aaa72d07f715ed8a961a28224545 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tools/kernel_gen/kernel_creator.h @@ -0,0 +1,54 @@ +/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +//===- kernel_creator.h -----------------------------------------*- C++ -*-===// +// +// This file declares the function to compile a TF kernel function to gpu +// binary (hsaco for AMD, cubin for NVIDIA) or to a gpu binary with host side. +// +//===----------------------------------------------------------------------===// +#ifndef TENSORFLOW_COMPILER_MLIR_TOOLS_KERNEL_GEN_KERNEL_CREATOR_H_ +#define TENSORFLOW_COMPILER_MLIR_TOOLS_KERNEL_GEN_KERNEL_CREATOR_H_ + +#include + +#include "llvm/ADT/ArrayRef.h" +#include "llvm/ADT/StringRef.h" +#include "mlir/Dialect/Func/IR/FuncOps.h" // from @llvm-project +#include "mlir/IR/BuiltinOps.h" // from @llvm-project +#include "mlir/IR/MLIRContext.h" // from @llvm-project +#include "tensorflow/core/platform/statusor.h" + +namespace tensorflow { +namespace kernel_gen { + +// Parses tf_code to create a module. An MLIRContext is taken in case any +// unexpected dialects are needed. +StatusOr> SetupContextAndParseModule( + mlir::MLIRContext& context, llvm::StringRef tf_code); + +// Converts TF code to LLVM with or without GPU support. +StatusOr> GenerateKernelForHloCode( + mlir::MLIRContext& context, llvm::StringRef tf_code, + llvm::ArrayRef architectures, + llvm::ArrayRef tile_sizes, llvm::ArrayRef unroll_factors, + int64_t max_supported_rank, bool print_ptx, bool print_llvmir, + bool enable_ftz, bool index_64bit, bool jit_compile, + bool jit_i64_indexed_for_large_tensors, bool apply_cl_options); + +} // namespace kernel_gen +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_MLIR_TOOLS_KERNEL_GEN_KERNEL_CREATOR_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tools/kernel_gen/tf_framework_c_interface.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tools/kernel_gen/tf_framework_c_interface.h new file mode 100644 index 0000000000000000000000000000000000000000..3a7c879d2c64c922503c434156d9aef981681b95 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tools/kernel_gen/tf_framework_c_interface.h @@ -0,0 +1,50 @@ +/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TOOLS_KERNEL_GEN_TF_FRAMEWORK_C_INTERFACE_H_ +#define TENSORFLOW_COMPILER_MLIR_TOOLS_KERNEL_GEN_TF_FRAMEWORK_C_INTERFACE_H_ + +#include "mlir/ExecutionEngine/RunnerUtils.h" // from @llvm-project + +namespace mlir { +namespace kernel_gen { +namespace tf_framework { + +extern "C" MLIR_RUNNERUTILS_EXPORT void* _mlir_ciface_tf_alloc( + void* op_kernel_ctx, size_t num_elements, size_t element_size, + int32_t output_index, int32_t num_candidates, + int32_t* candidate_input_indices); + +extern "C" MLIR_RUNNERUTILS_EXPORT void _mlir_ciface_tf_dealloc( + void* op_kernel_ctx, void* ptr); + +extern "C" MLIR_RUNNERUTILS_EXPORT void _mlir_ciface_tf_report_error( + void* op_kernel_ctx, int32_t error_code, char* msg); + +extern "C" MLIR_RUNNERUTILS_EXPORT void* _mlir_ciface_tf_jit_compile( + void* op_kernel_ctx, char* code, int64_t num_tile_sizes, + int64_t* tile_sizes_ptr, int64_t num_unroll_factors, + int64_t* unroll_factors_ptr, int64_t max_supported_rank, bool enable_ftz, + bool index_64bit); + +extern "C" MLIR_RUNNERUTILS_EXPORT void _mlir_ciface_tf_jit_execute( + void* op_kernel_ctx, void* callable, void* result, int64_t num_args, + void* args_ptr); + +} // namespace tf_framework +} // namespace kernel_gen +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TOOLS_KERNEL_GEN_TF_FRAMEWORK_C_INTERFACE_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tools/kernel_gen/tf_gpu_runtime_wrappers.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tools/kernel_gen/tf_gpu_runtime_wrappers.h new file mode 100644 index 0000000000000000000000000000000000000000..79e2c0cc53055217ac734041d2fa45217b10c822 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tools/kernel_gen/tf_gpu_runtime_wrappers.h @@ -0,0 +1,95 @@ +/* Copyright 2021 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TOOLS_KERNEL_GEN_TF_GPU_RUNTIME_WRAPPERS_H_ +#define TENSORFLOW_COMPILER_MLIR_TOOLS_KERNEL_GEN_TF_GPU_RUNTIME_WRAPPERS_H_ + +#include "absl/container/flat_hash_map.h" +#include "mlir/ExecutionEngine/RunnerUtils.h" // from @llvm-project +#include "tensorflow/core/framework/resource_op_kernel.h" +#include "tensorflow/core/platform/mutex.h" +#include "tsl/platform/hash.h" + +#if GOOGLE_CUDA +#include "third_party/gpus/cuda/include/cuda.h" +#endif +#if TENSORFLOW_USE_ROCM +#include "rocm/include/hip/hip_runtime.h" +#endif + +namespace mlir { +namespace kernel_gen { +namespace tf_framework { + +class GPURuntimeCache : public tensorflow::ResourceBase { + public: +#if GOOGLE_CUDA + using GPUModule = CUmodule; + using GPUFunction = CUfunction; +#endif +#if TENSORFLOW_USE_ROCM + using GPUModule = hipModule_t; + using GPUFunction = hipFunction_t; +#endif + + ~GPURuntimeCache() override; + static constexpr const char* kDefaultResourceName = "mlir-gpu-runtime-cache"; + static tensorflow::Status Create(GPURuntimeCache** dst); + std::string DebugString() const override; + + // Assumes that no two modules are loaded from the same memory location over + // the lifetime of this cache. This allows to use the pointer as a key. All + // modules are unloaded on destruction of this cache. + GPUModule LookupOrLoadModule(void* data); + + GPUFunction LookupOrGetFunction(GPUModule module, const char* kernel_name); + + private: + struct FunctionKey { + GPUModule module; + const char* kernel_name; + + friend bool operator==(const FunctionKey& lhs, const FunctionKey& rhs) { + return lhs.module == rhs.module && lhs.kernel_name == rhs.kernel_name; + } + + struct Hash { + size_t operator()(const FunctionKey& key) const { + return tsl::Hash64Combine(tsl::hash()(key.module), + tsl::Hash64(key.kernel_name)); + } + }; + }; + + tensorflow::mutex mu_; + absl::flat_hash_map gpu_module_by_data_ptr_ + TF_GUARDED_BY(mu_); + absl::flat_hash_map + gpu_function_by_module_and_name_ TF_GUARDED_BY(mu_); +}; + +// Implements a C wrapper around the TensorFlow runtime and CUDA (or ROCm) +// library that allows launching a kernel on the current device and stream from +// a binary blob for the module and function name. +extern "C" MLIR_RUNNERUTILS_EXPORT void _mlir_ciface_tf_launch_kernel( + void* ctx, void* module_blob, char* kernel_name, intptr_t gridX, + intptr_t gridY, intptr_t gridZ, intptr_t blockX, intptr_t blockY, + intptr_t blockZ, void** params); + +} // namespace tf_framework +} // namespace kernel_gen +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TOOLS_KERNEL_GEN_TF_GPU_RUNTIME_WRAPPERS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tools/kernel_gen/tf_jit_cache.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tools/kernel_gen/tf_jit_cache.h new file mode 100644 index 0000000000000000000000000000000000000000..414e7954be271e2a5e5c64f7a4f4d7012e7ce0d1 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tools/kernel_gen/tf_jit_cache.h @@ -0,0 +1,52 @@ +/* Copyright 2021 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TOOLS_KERNEL_GEN_TF_JIT_CACHE_H_ +#define TENSORFLOW_COMPILER_MLIR_TOOLS_KERNEL_GEN_TF_JIT_CACHE_H_ + +#include +#include + +#include "absl/container/flat_hash_map.h" +#include "mlir/ExecutionEngine/ExecutionEngine.h" // from @llvm-project +#include "tensorflow/core/framework/resource_op_kernel.h" + +namespace mlir { +namespace kernel_gen { +namespace tf_framework { + +class JITCache : public tensorflow::ResourceBase { + public: + static constexpr const char* kDefaultResourceName = "mlir-jit-cache"; + static tensorflow::Status Create(JITCache** dst); + + std::string DebugString() const override; + ExecutionEngine* LookupOrCompile( + const std::string code, + std::function>()> + compile_callback); + size_t Size(); + + private: + tensorflow::mutex mu_; + absl::flat_hash_map> + execution_engine_by_key_ TF_GUARDED_BY(mu_); +}; + +} // namespace tf_framework +} // namespace kernel_gen +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TOOLS_KERNEL_GEN_TF_JIT_CACHE_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tools/kernel_gen/transforms/kernel_gen_passes.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tools/kernel_gen/transforms/kernel_gen_passes.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..46ab53c65106fbb268d56cce4d1280397965211a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tools/kernel_gen/transforms/kernel_gen_passes.h.inc @@ -0,0 +1,1686 @@ +/* Autogenerated by mlir-tblgen; don't manually edit */ + +#ifdef GEN_PASS_DECL +// Generate declarations for all passes. +#define GEN_PASS_DECL_BUFFERREUSEPASS +#define GEN_PASS_DECL_COPYCLEANUPPASS +#define GEN_PASS_DECL_EMBEDTFFRAMEWORKPASS +#define GEN_PASS_DECL_FUNCTOJITINVOCATIONPASS +#define GEN_PASS_DECL_FUSEINNERPARALLELLOOPSPASS +#define GEN_PASS_DECL_GPUKERNELTOBLOBPASS +#define GEN_PASS_DECL_KERNELGENFINALBUFFERIZEPASS +#define GEN_PASS_DECL_PARALLELLOOPSTOSEQUENTIAL +#define GEN_PASS_DECL_PROPAGATESHAPEKNOWLEDGETOKERNELS +#define GEN_PASS_DECL_PROPAGATETFABIKNOWLEDGETOKERNELS +#define GEN_PASS_DECL_REWRITETFFRAMEWORKASSERT +#define GEN_PASS_DECL_SHAPETODESCRIPTORSPASS +#define GEN_PASS_DECL_TFKERNELTOLLVMPASS +#undef GEN_PASS_DECL +#endif // GEN_PASS_DECL + +//===----------------------------------------------------------------------===// +// BufferReusePass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_BUFFERREUSEPASS +#undef GEN_PASS_DECL_BUFFERREUSEPASS +#endif // GEN_PASS_DECL_BUFFERREUSEPASS +#ifdef GEN_PASS_DEF_BUFFERREUSEPASS +namespace impl { + +template +class BufferReusePassBase : public ::mlir::OperationPass { +public: + using Base = BufferReusePassBase; + + BufferReusePassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + BufferReusePassBase(const BufferReusePassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("buffer-reuse"); + } + ::llvm::StringRef getArgument() const override { return "buffer-reuse"; } + + ::llvm::StringRef getDescription() const override { return "Pass to find and annotate candidates for buffer reuse."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("BufferReusePass"); + } + ::llvm::StringRef getName() const override { return "BufferReusePass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(BufferReusePassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_BUFFERREUSEPASS +#endif // GEN_PASS_DEF_BUFFERREUSEPASS + +//===----------------------------------------------------------------------===// +// CopyCleanupPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_COPYCLEANUPPASS +#undef GEN_PASS_DECL_COPYCLEANUPPASS +#endif // GEN_PASS_DECL_COPYCLEANUPPASS +#ifdef GEN_PASS_DEF_COPYCLEANUPPASS +namespace impl { + +template +class CopyCleanupPassBase : public ::mlir::OperationPass { +public: + using Base = CopyCleanupPassBase; + + CopyCleanupPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + CopyCleanupPassBase(const CopyCleanupPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("copy-cleanup"); + } + ::llvm::StringRef getArgument() const override { return "copy-cleanup"; } + + ::llvm::StringRef getDescription() const override { return "Pass to remove copies which are consumed by a GenericOp."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("CopyCleanupPass"); + } + ::llvm::StringRef getName() const override { return "CopyCleanupPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(CopyCleanupPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_COPYCLEANUPPASS +#endif // GEN_PASS_DEF_COPYCLEANUPPASS + +//===----------------------------------------------------------------------===// +// EmbedTFFrameworkPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_EMBEDTFFRAMEWORKPASS +#undef GEN_PASS_DECL_EMBEDTFFRAMEWORKPASS +#endif // GEN_PASS_DECL_EMBEDTFFRAMEWORKPASS +#ifdef GEN_PASS_DEF_EMBEDTFFRAMEWORKPASS +namespace impl { + +template +class EmbedTFFrameworkPassBase : public ::mlir::OperationPass { +public: + using Base = EmbedTFFrameworkPassBase; + + EmbedTFFrameworkPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + EmbedTFFrameworkPassBase(const EmbedTFFrameworkPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("embed-tf-framework"); + } + ::llvm::StringRef getArgument() const override { return "embed-tf-framework"; } + + ::llvm::StringRef getDescription() const override { return "Pass to embed TF Framework for allocation and assertions,"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("EmbedTFFrameworkPass"); + } + ::llvm::StringRef getName() const override { return "EmbedTFFrameworkPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(EmbedTFFrameworkPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_EMBEDTFFRAMEWORKPASS +#endif // GEN_PASS_DEF_EMBEDTFFRAMEWORKPASS + +//===----------------------------------------------------------------------===// +// FuncToJITInvocationPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_FUNCTOJITINVOCATIONPASS +struct FuncToJITInvocationPassOptions { + ::llvm::ArrayRef tile_sizes_; + ::llvm::ArrayRef unroll_factors_; + int64_t max_supported_rank_; + bool enable_ftz_; + bool index_64bit_; + bool cpu_codegen_; + bool jit_i64_indexed_for_large_tensors_ = false; +}; +#undef GEN_PASS_DECL_FUNCTOJITINVOCATIONPASS +#endif // GEN_PASS_DECL_FUNCTOJITINVOCATIONPASS +#ifdef GEN_PASS_DEF_FUNCTOJITINVOCATIONPASS +namespace impl { + +template +class FuncToJITInvocationPassBase : public ::mlir::OperationPass { +public: + using Base = FuncToJITInvocationPassBase; + + FuncToJITInvocationPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + FuncToJITInvocationPassBase(const FuncToJITInvocationPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("func-to-jit-invocation"); + } + ::llvm::StringRef getArgument() const override { return "func-to-jit-invocation"; } + + ::llvm::StringRef getDescription() const override { return "Pass to rewrite a function to JIT invocations"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("FuncToJITInvocationPass"); + } + ::llvm::StringRef getName() const override { return "FuncToJITInvocationPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(FuncToJITInvocationPassBase) + + FuncToJITInvocationPassBase(const FuncToJITInvocationPassOptions &options) : FuncToJITInvocationPassBase() { + tile_sizes_ = options.tile_sizes_; + unroll_factors_ = options.unroll_factors_; + max_supported_rank_ = options.max_supported_rank_; + enable_ftz_ = options.enable_ftz_; + index_64bit_ = options.index_64bit_; + cpu_codegen_ = options.cpu_codegen_; + jit_i64_indexed_for_large_tensors_ = options.jit_i64_indexed_for_large_tensors_; + } +protected: + ::mlir::Pass::ListOption tile_sizes_{*this, "tile-sizes", ::llvm::cl::desc("Tiling sizes"), llvm::cl::ZeroOrMore}; + ::mlir::Pass::ListOption unroll_factors_{*this, "unroll-factors", ::llvm::cl::desc("Unrolling in each tile dimension"), llvm::cl::ZeroOrMore}; + ::mlir::Pass::Option max_supported_rank_{*this, "max-supported-rank", ::llvm::cl::desc("Max rank that this kernel supports")}; + ::mlir::Pass::Option enable_ftz_{*this, "enable-ftz", ::llvm::cl::desc("Enable the denormal flush to zero mode when generating code")}; + ::mlir::Pass::Option index_64bit_{*this, "index_64bit", ::llvm::cl::desc("Enable the 64 bit indexing for GPU kernels")}; + ::mlir::Pass::Option cpu_codegen_{*this, "cpu-codegen", ::llvm::cl::desc("CPU codegen (false implies GPU)")}; + ::mlir::Pass::Option jit_i64_indexed_for_large_tensors_{*this, "jit_i64_indexed_for_large_tensors", ::llvm::cl::desc("Enable JIT compilation of i64-indexed kernels for large input tensors."), ::llvm::cl::init(false)}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_FUNCTOJITINVOCATIONPASS +#endif // GEN_PASS_DEF_FUNCTOJITINVOCATIONPASS + +//===----------------------------------------------------------------------===// +// FuseInnerParallelLoopsPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_FUSEINNERPARALLELLOOPSPASS +#undef GEN_PASS_DECL_FUSEINNERPARALLELLOOPSPASS +#endif // GEN_PASS_DECL_FUSEINNERPARALLELLOOPSPASS +#ifdef GEN_PASS_DEF_FUSEINNERPARALLELLOOPSPASS +namespace impl { + +template +class FuseInnerParallelLoopsPassBase : public ::mlir::OperationPass { +public: + using Base = FuseInnerParallelLoopsPassBase; + + FuseInnerParallelLoopsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + FuseInnerParallelLoopsPassBase(const FuseInnerParallelLoopsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("fuse-inner-parallel-loops"); + } + ::llvm::StringRef getArgument() const override { return "fuse-inner-parallel-loops"; } + + ::llvm::StringRef getDescription() const override { return "Limited pass to forward stores to loads."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("FuseInnerParallelLoopsPass"); + } + ::llvm::StringRef getName() const override { return "FuseInnerParallelLoopsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(FuseInnerParallelLoopsPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_FUSEINNERPARALLELLOOPSPASS +#endif // GEN_PASS_DEF_FUSEINNERPARALLELLOOPSPASS + +//===----------------------------------------------------------------------===// +// GpuKernelToBlobPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_GPUKERNELTOBLOBPASS +struct GpuKernelToBlobPassOptions { + std::string blob_annotation_ = "gpu.binary_blob"; + ::llvm::ArrayRef architectures_; + bool generate_fatbin_ = true; + bool print_ptx_ = false; + bool print_llvmir_ = false; +}; +#undef GEN_PASS_DECL_GPUKERNELTOBLOBPASS +#endif // GEN_PASS_DECL_GPUKERNELTOBLOBPASS +#ifdef GEN_PASS_DEF_GPUKERNELTOBLOBPASS +namespace impl { + +template +class GpuKernelToBlobPassBase : public ::mlir::OperationPass { +public: + using Base = GpuKernelToBlobPassBase; + + GpuKernelToBlobPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + GpuKernelToBlobPassBase(const GpuKernelToBlobPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("gpu-kernel-to-blob"); + } + ::llvm::StringRef getArgument() const override { return "gpu-kernel-to-blob"; } + + ::llvm::StringRef getDescription() const override { return "Pass to annotate GPU Module with its PTX"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("GpuKernelToBlobPass"); + } + ::llvm::StringRef getName() const override { return "GpuKernelToBlobPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(GpuKernelToBlobPassBase) + + GpuKernelToBlobPassBase(const GpuKernelToBlobPassOptions &options) : GpuKernelToBlobPassBase() { + blob_annotation_ = options.blob_annotation_; + architectures_ = options.architectures_; + generate_fatbin_ = options.generate_fatbin_; + print_ptx_ = options.print_ptx_; + print_llvmir_ = options.print_llvmir_; + } +protected: + ::mlir::Pass::Option blob_annotation_{*this, "blob-annotation", ::llvm::cl::desc("Blob attribute name"), ::llvm::cl::init("gpu.binary_blob")}; + ::mlir::Pass::ListOption architectures_{*this, "arch", ::llvm::cl::desc("GPU architectures")}; + ::mlir::Pass::Option generate_fatbin_{*this, "generate-fatbin", ::llvm::cl::desc("Bundle machine code for the different architectures in one fatbin."), ::llvm::cl::init(true)}; + ::mlir::Pass::Option print_ptx_{*this, "print-ptx", ::llvm::cl::desc("Print generated PTX code per target architecture."), ::llvm::cl::init(false)}; + ::mlir::Pass::Option print_llvmir_{*this, "print-llvmir", ::llvm::cl::desc("Print llvm ir when lowering code per target architecture."), ::llvm::cl::init(false)}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_GPUKERNELTOBLOBPASS +#endif // GEN_PASS_DEF_GPUKERNELTOBLOBPASS + +//===----------------------------------------------------------------------===// +// KernelgenFinalBufferizePass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_KERNELGENFINALBUFFERIZEPASS +#undef GEN_PASS_DECL_KERNELGENFINALBUFFERIZEPASS +#endif // GEN_PASS_DECL_KERNELGENFINALBUFFERIZEPASS +#ifdef GEN_PASS_DEF_KERNELGENFINALBUFFERIZEPASS +namespace impl { + +template +class KernelgenFinalBufferizePassBase : public ::mlir::OperationPass { +public: + using Base = KernelgenFinalBufferizePassBase; + + KernelgenFinalBufferizePassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + KernelgenFinalBufferizePassBase(const KernelgenFinalBufferizePassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("kernelgen-final-bufferize"); + } + ::llvm::StringRef getArgument() const override { return "kernelgen-final-bufferize"; } + + ::llvm::StringRef getDescription() const override { return "Pass to transform late operations on values to buffer based ones."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("KernelgenFinalBufferizePass"); + } + ::llvm::StringRef getName() const override { return "KernelgenFinalBufferizePass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(KernelgenFinalBufferizePassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_KERNELGENFINALBUFFERIZEPASS +#endif // GEN_PASS_DEF_KERNELGENFINALBUFFERIZEPASS + +//===----------------------------------------------------------------------===// +// ParallelLoopsToSequential +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_PARALLELLOOPSTOSEQUENTIAL +#undef GEN_PASS_DECL_PARALLELLOOPSTOSEQUENTIAL +#endif // GEN_PASS_DECL_PARALLELLOOPSTOSEQUENTIAL +#ifdef GEN_PASS_DEF_PARALLELLOOPSTOSEQUENTIAL +namespace impl { + +template +class ParallelLoopsToSequentialBase : public ::mlir::OperationPass { +public: + using Base = ParallelLoopsToSequentialBase; + + ParallelLoopsToSequentialBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ParallelLoopsToSequentialBase(const ParallelLoopsToSequentialBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("parallel-loops-to-sequential"); + } + ::llvm::StringRef getArgument() const override { return "parallel-loops-to-sequential"; } + + ::llvm::StringRef getDescription() const override { return "Pass to convert scf::ParallelOp to scf::ForOp"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ParallelLoopsToSequential"); + } + ::llvm::StringRef getName() const override { return "ParallelLoopsToSequential"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ParallelLoopsToSequentialBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_PARALLELLOOPSTOSEQUENTIAL +#endif // GEN_PASS_DEF_PARALLELLOOPSTOSEQUENTIAL + +//===----------------------------------------------------------------------===// +// PropagateShapeKnowledgeToKernels +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_PROPAGATESHAPEKNOWLEDGETOKERNELS +#undef GEN_PASS_DECL_PROPAGATESHAPEKNOWLEDGETOKERNELS +#endif // GEN_PASS_DECL_PROPAGATESHAPEKNOWLEDGETOKERNELS +#ifdef GEN_PASS_DEF_PROPAGATESHAPEKNOWLEDGETOKERNELS +namespace impl { + +template +class PropagateShapeKnowledgeToKernelsBase : public ::mlir::OperationPass { +public: + using Base = PropagateShapeKnowledgeToKernelsBase; + + PropagateShapeKnowledgeToKernelsBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + PropagateShapeKnowledgeToKernelsBase(const PropagateShapeKnowledgeToKernelsBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("propagate-shape-knowledge-to-kernels"); + } + ::llvm::StringRef getArgument() const override { return "propagate-shape-knowledge-to-kernels"; } + + ::llvm::StringRef getDescription() const override { return "Pass to propagate shape information into kernels"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("PropagateShapeKnowledgeToKernels"); + } + ::llvm::StringRef getName() const override { return "PropagateShapeKnowledgeToKernels"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(PropagateShapeKnowledgeToKernelsBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_PROPAGATESHAPEKNOWLEDGETOKERNELS +#endif // GEN_PASS_DEF_PROPAGATESHAPEKNOWLEDGETOKERNELS + +//===----------------------------------------------------------------------===// +// PropagateTfAbiKnowledgeToKernels +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_PROPAGATETFABIKNOWLEDGETOKERNELS +#undef GEN_PASS_DECL_PROPAGATETFABIKNOWLEDGETOKERNELS +#endif // GEN_PASS_DECL_PROPAGATETFABIKNOWLEDGETOKERNELS +#ifdef GEN_PASS_DEF_PROPAGATETFABIKNOWLEDGETOKERNELS +namespace impl { + +template +class PropagateTfAbiKnowledgeToKernelsBase : public ::mlir::OperationPass { +public: + using Base = PropagateTfAbiKnowledgeToKernelsBase; + + PropagateTfAbiKnowledgeToKernelsBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + PropagateTfAbiKnowledgeToKernelsBase(const PropagateTfAbiKnowledgeToKernelsBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("propagate-tf-abi-knowledge-to-kernels"); + } + ::llvm::StringRef getArgument() const override { return "propagate-tf-abi-knowledge-to-kernels"; } + + ::llvm::StringRef getDescription() const override { return "Pass to propagate tensorflow ABI knowledge to kernels"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("PropagateTfAbiKnowledgeToKernels"); + } + ::llvm::StringRef getName() const override { return "PropagateTfAbiKnowledgeToKernels"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(PropagateTfAbiKnowledgeToKernelsBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_PROPAGATETFABIKNOWLEDGETOKERNELS +#endif // GEN_PASS_DEF_PROPAGATETFABIKNOWLEDGETOKERNELS + +//===----------------------------------------------------------------------===// +// RewriteTFFrameworkAssert +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_REWRITETFFRAMEWORKASSERT +#undef GEN_PASS_DECL_REWRITETFFRAMEWORKASSERT +#endif // GEN_PASS_DECL_REWRITETFFRAMEWORKASSERT +#ifdef GEN_PASS_DEF_REWRITETFFRAMEWORKASSERT +namespace impl { + +template +class RewriteTFFrameworkAssertBase : public ::mlir::OperationPass { +public: + using Base = RewriteTFFrameworkAssertBase; + + RewriteTFFrameworkAssertBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + RewriteTFFrameworkAssertBase(const RewriteTFFrameworkAssertBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("rewrite-tf-framework-assert"); + } + ::llvm::StringRef getArgument() const override { return "rewrite-tf-framework-assert"; } + + ::llvm::StringRef getDescription() const override { return "Pass to rewrite TFAssertOps to CondBranchOp"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("RewriteTFFrameworkAssert"); + } + ::llvm::StringRef getName() const override { return "RewriteTFFrameworkAssert"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(RewriteTFFrameworkAssertBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_REWRITETFFRAMEWORKASSERT +#endif // GEN_PASS_DEF_REWRITETFFRAMEWORKASSERT + +//===----------------------------------------------------------------------===// +// ShapeToDescriptorsPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_SHAPETODESCRIPTORSPASS +#undef GEN_PASS_DECL_SHAPETODESCRIPTORSPASS +#endif // GEN_PASS_DECL_SHAPETODESCRIPTORSPASS +#ifdef GEN_PASS_DEF_SHAPETODESCRIPTORSPASS +namespace impl { + +template +class ShapeToDescriptorsPassBase : public ::mlir::OperationPass { +public: + using Base = ShapeToDescriptorsPassBase; + + ShapeToDescriptorsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ShapeToDescriptorsPassBase(const ShapeToDescriptorsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("shape-to-descriptors"); + } + ::llvm::StringRef getArgument() const override { return "shape-to-descriptors"; } + + ::llvm::StringRef getDescription() const override { return "Pass to transform shape computations to descriptors"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ShapeToDescriptorsPass"); + } + ::llvm::StringRef getName() const override { return "ShapeToDescriptorsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ShapeToDescriptorsPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_SHAPETODESCRIPTORSPASS +#endif // GEN_PASS_DEF_SHAPETODESCRIPTORSPASS + +//===----------------------------------------------------------------------===// +// TFKernelToLLVMPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_TFKERNELTOLLVMPASS +struct TFKernelToLLVMPassOptions { + std::string blob_annotation_ = "gpu.binary_blob"; +}; +#undef GEN_PASS_DECL_TFKERNELTOLLVMPASS +#endif // GEN_PASS_DECL_TFKERNELTOLLVMPASS +#ifdef GEN_PASS_DEF_TFKERNELTOLLVMPASS +namespace impl { + +template +class TFKernelToLLVMPassBase : public ::mlir::OperationPass { +public: + using Base = TFKernelToLLVMPassBase; + + TFKernelToLLVMPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TFKernelToLLVMPassBase(const TFKernelToLLVMPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-kernel-to-llvm"); + } + ::llvm::StringRef getArgument() const override { return "tf-kernel-to-llvm"; } + + ::llvm::StringRef getDescription() const override { return "Pass for applying LLVM legalization patterns."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TFKernelToLLVMPass"); + } + ::llvm::StringRef getName() const override { return "TFKernelToLLVMPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TFKernelToLLVMPassBase) + + TFKernelToLLVMPassBase(const TFKernelToLLVMPassOptions &options) : TFKernelToLLVMPassBase() { + blob_annotation_ = options.blob_annotation_; + } +protected: + ::mlir::Pass::Option blob_annotation_{*this, "blob-annotation", ::llvm::cl::desc("Blob attribute name"), ::llvm::cl::init("gpu.binary_blob")}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_TFKERNELTOLLVMPASS +#endif // GEN_PASS_DEF_TFKERNELTOLLVMPASS +#ifdef GEN_PASS_REGISTRATION + +//===----------------------------------------------------------------------===// +// BufferReusePass Registration +//===----------------------------------------------------------------------===// + +inline void registerBufferReusePass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return transforms::CreateBufferReusePass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerBufferReusePassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return transforms::CreateBufferReusePass(); + }); +} + +//===----------------------------------------------------------------------===// +// CopyCleanupPass Registration +//===----------------------------------------------------------------------===// + +inline void registerCopyCleanupPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return transforms::CreateCopyCleanupPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerCopyCleanupPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return transforms::CreateCopyCleanupPass(); + }); +} + +//===----------------------------------------------------------------------===// +// EmbedTFFrameworkPass Registration +//===----------------------------------------------------------------------===// + +inline void registerEmbedTFFrameworkPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return tf_framework::CreateEmbedTFFrameworkPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerEmbedTFFrameworkPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return tf_framework::CreateEmbedTFFrameworkPass(); + }); +} + +//===----------------------------------------------------------------------===// +// FuncToJITInvocationPass Registration +//===----------------------------------------------------------------------===// + +inline void registerFuncToJITInvocationPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return transforms::CreateFuncToJITInvocationPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerFuncToJITInvocationPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return transforms::CreateFuncToJITInvocationPass(); + }); +} + +//===----------------------------------------------------------------------===// +// FuseInnerParallelLoopsPass Registration +//===----------------------------------------------------------------------===// + +inline void registerFuseInnerParallelLoopsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return transforms::CreateFuseInnerParallelLoopsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerFuseInnerParallelLoopsPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return transforms::CreateFuseInnerParallelLoopsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// GpuKernelToBlobPass Registration +//===----------------------------------------------------------------------===// + +inline void registerGpuKernelToBlobPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return transforms::CreateGpuKernelToBlobPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerGpuKernelToBlobPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return transforms::CreateGpuKernelToBlobPass(); + }); +} + +//===----------------------------------------------------------------------===// +// KernelgenFinalBufferizePass Registration +//===----------------------------------------------------------------------===// + +inline void registerKernelgenFinalBufferizePass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return transforms::CreateKernelgenFinalBufferizePass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerKernelgenFinalBufferizePassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return transforms::CreateKernelgenFinalBufferizePass(); + }); +} + +//===----------------------------------------------------------------------===// +// ParallelLoopsToSequential Registration +//===----------------------------------------------------------------------===// + +inline void registerParallelLoopsToSequential() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return transforms::CreateParallelLoopsToSequential(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerParallelLoopsToSequentialPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return transforms::CreateParallelLoopsToSequential(); + }); +} + +//===----------------------------------------------------------------------===// +// PropagateShapeKnowledgeToKernels Registration +//===----------------------------------------------------------------------===// + +inline void registerPropagateShapeKnowledgeToKernels() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return transforms::CreatePropagateShapeKnowledgeToKernels(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerPropagateShapeKnowledgeToKernelsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return transforms::CreatePropagateShapeKnowledgeToKernels(); + }); +} + +//===----------------------------------------------------------------------===// +// PropagateTfAbiKnowledgeToKernels Registration +//===----------------------------------------------------------------------===// + +inline void registerPropagateTfAbiKnowledgeToKernels() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return transforms::CreatePropagateTfAbiKnowledgeToKernels(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerPropagateTfAbiKnowledgeToKernelsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return transforms::CreatePropagateTfAbiKnowledgeToKernels(); + }); +} + +//===----------------------------------------------------------------------===// +// RewriteTFFrameworkAssert Registration +//===----------------------------------------------------------------------===// + +inline void registerRewriteTFFrameworkAssert() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return tf_framework::CreateRewriteTFFrameworkAssert(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerRewriteTFFrameworkAssertPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return tf_framework::CreateRewriteTFFrameworkAssert(); + }); +} + +//===----------------------------------------------------------------------===// +// ShapeToDescriptorsPass Registration +//===----------------------------------------------------------------------===// + +inline void registerShapeToDescriptorsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return transforms::CreateShapeToDescriptorsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerShapeToDescriptorsPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return transforms::CreateShapeToDescriptorsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// TFKernelToLLVMPass Registration +//===----------------------------------------------------------------------===// + +inline void registerTFKernelToLLVMPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return transforms::CreateTFKernelToLLVMPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerTFKernelToLLVMPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return transforms::CreateTFKernelToLLVMPass(); + }); +} + +//===----------------------------------------------------------------------===// +// KernelGen Registration +//===----------------------------------------------------------------------===// + +inline void registerKernelGenPasses() { + registerBufferReusePass(); + registerCopyCleanupPass(); + registerEmbedTFFrameworkPass(); + registerFuncToJITInvocationPass(); + registerFuseInnerParallelLoopsPass(); + registerGpuKernelToBlobPass(); + registerKernelgenFinalBufferizePass(); + registerParallelLoopsToSequential(); + registerPropagateShapeKnowledgeToKernels(); + registerPropagateTfAbiKnowledgeToKernels(); + registerRewriteTFFrameworkAssert(); + registerShapeToDescriptorsPass(); + registerTFKernelToLLVMPass(); +} +#undef GEN_PASS_REGISTRATION +#endif // GEN_PASS_REGISTRATION +// Deprecated. Please use the new per-pass macros. +#ifdef GEN_PASS_CLASSES + +template +class BufferReusePassBase : public ::mlir::OperationPass { +public: + using Base = BufferReusePassBase; + + BufferReusePassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + BufferReusePassBase(const BufferReusePassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("buffer-reuse"); + } + ::llvm::StringRef getArgument() const override { return "buffer-reuse"; } + + ::llvm::StringRef getDescription() const override { return "Pass to find and annotate candidates for buffer reuse."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("BufferReusePass"); + } + ::llvm::StringRef getName() const override { return "BufferReusePass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(BufferReusePassBase) + +protected: +}; + +template +class CopyCleanupPassBase : public ::mlir::OperationPass { +public: + using Base = CopyCleanupPassBase; + + CopyCleanupPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + CopyCleanupPassBase(const CopyCleanupPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("copy-cleanup"); + } + ::llvm::StringRef getArgument() const override { return "copy-cleanup"; } + + ::llvm::StringRef getDescription() const override { return "Pass to remove copies which are consumed by a GenericOp."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("CopyCleanupPass"); + } + ::llvm::StringRef getName() const override { return "CopyCleanupPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(CopyCleanupPassBase) + +protected: +}; + +template +class EmbedTFFrameworkPassBase : public ::mlir::OperationPass { +public: + using Base = EmbedTFFrameworkPassBase; + + EmbedTFFrameworkPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + EmbedTFFrameworkPassBase(const EmbedTFFrameworkPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("embed-tf-framework"); + } + ::llvm::StringRef getArgument() const override { return "embed-tf-framework"; } + + ::llvm::StringRef getDescription() const override { return "Pass to embed TF Framework for allocation and assertions,"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("EmbedTFFrameworkPass"); + } + ::llvm::StringRef getName() const override { return "EmbedTFFrameworkPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(EmbedTFFrameworkPassBase) + +protected: +}; + +template +class FuncToJITInvocationPassBase : public ::mlir::OperationPass { +public: + using Base = FuncToJITInvocationPassBase; + + FuncToJITInvocationPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + FuncToJITInvocationPassBase(const FuncToJITInvocationPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("func-to-jit-invocation"); + } + ::llvm::StringRef getArgument() const override { return "func-to-jit-invocation"; } + + ::llvm::StringRef getDescription() const override { return "Pass to rewrite a function to JIT invocations"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("FuncToJITInvocationPass"); + } + ::llvm::StringRef getName() const override { return "FuncToJITInvocationPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(FuncToJITInvocationPassBase) + +protected: + ::mlir::Pass::ListOption tile_sizes_{*this, "tile-sizes", ::llvm::cl::desc("Tiling sizes"), llvm::cl::ZeroOrMore}; + ::mlir::Pass::ListOption unroll_factors_{*this, "unroll-factors", ::llvm::cl::desc("Unrolling in each tile dimension"), llvm::cl::ZeroOrMore}; + ::mlir::Pass::Option max_supported_rank_{*this, "max-supported-rank", ::llvm::cl::desc("Max rank that this kernel supports")}; + ::mlir::Pass::Option enable_ftz_{*this, "enable-ftz", ::llvm::cl::desc("Enable the denormal flush to zero mode when generating code")}; + ::mlir::Pass::Option index_64bit_{*this, "index_64bit", ::llvm::cl::desc("Enable the 64 bit indexing for GPU kernels")}; + ::mlir::Pass::Option cpu_codegen_{*this, "cpu-codegen", ::llvm::cl::desc("CPU codegen (false implies GPU)")}; + ::mlir::Pass::Option jit_i64_indexed_for_large_tensors_{*this, "jit_i64_indexed_for_large_tensors", ::llvm::cl::desc("Enable JIT compilation of i64-indexed kernels for large input tensors."), ::llvm::cl::init(false)}; +}; + +template +class FuseInnerParallelLoopsPassBase : public ::mlir::OperationPass { +public: + using Base = FuseInnerParallelLoopsPassBase; + + FuseInnerParallelLoopsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + FuseInnerParallelLoopsPassBase(const FuseInnerParallelLoopsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("fuse-inner-parallel-loops"); + } + ::llvm::StringRef getArgument() const override { return "fuse-inner-parallel-loops"; } + + ::llvm::StringRef getDescription() const override { return "Limited pass to forward stores to loads."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("FuseInnerParallelLoopsPass"); + } + ::llvm::StringRef getName() const override { return "FuseInnerParallelLoopsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(FuseInnerParallelLoopsPassBase) + +protected: +}; + +template +class GpuKernelToBlobPassBase : public ::mlir::OperationPass { +public: + using Base = GpuKernelToBlobPassBase; + + GpuKernelToBlobPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + GpuKernelToBlobPassBase(const GpuKernelToBlobPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("gpu-kernel-to-blob"); + } + ::llvm::StringRef getArgument() const override { return "gpu-kernel-to-blob"; } + + ::llvm::StringRef getDescription() const override { return "Pass to annotate GPU Module with its PTX"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("GpuKernelToBlobPass"); + } + ::llvm::StringRef getName() const override { return "GpuKernelToBlobPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(GpuKernelToBlobPassBase) + +protected: + ::mlir::Pass::Option blob_annotation_{*this, "blob-annotation", ::llvm::cl::desc("Blob attribute name"), ::llvm::cl::init("gpu.binary_blob")}; + ::mlir::Pass::ListOption architectures_{*this, "arch", ::llvm::cl::desc("GPU architectures")}; + ::mlir::Pass::Option generate_fatbin_{*this, "generate-fatbin", ::llvm::cl::desc("Bundle machine code for the different architectures in one fatbin."), ::llvm::cl::init(true)}; + ::mlir::Pass::Option print_ptx_{*this, "print-ptx", ::llvm::cl::desc("Print generated PTX code per target architecture."), ::llvm::cl::init(false)}; + ::mlir::Pass::Option print_llvmir_{*this, "print-llvmir", ::llvm::cl::desc("Print llvm ir when lowering code per target architecture."), ::llvm::cl::init(false)}; +}; + +template +class KernelgenFinalBufferizePassBase : public ::mlir::OperationPass { +public: + using Base = KernelgenFinalBufferizePassBase; + + KernelgenFinalBufferizePassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + KernelgenFinalBufferizePassBase(const KernelgenFinalBufferizePassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("kernelgen-final-bufferize"); + } + ::llvm::StringRef getArgument() const override { return "kernelgen-final-bufferize"; } + + ::llvm::StringRef getDescription() const override { return "Pass to transform late operations on values to buffer based ones."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("KernelgenFinalBufferizePass"); + } + ::llvm::StringRef getName() const override { return "KernelgenFinalBufferizePass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(KernelgenFinalBufferizePassBase) + +protected: +}; + +template +class ParallelLoopsToSequentialBase : public ::mlir::OperationPass { +public: + using Base = ParallelLoopsToSequentialBase; + + ParallelLoopsToSequentialBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ParallelLoopsToSequentialBase(const ParallelLoopsToSequentialBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("parallel-loops-to-sequential"); + } + ::llvm::StringRef getArgument() const override { return "parallel-loops-to-sequential"; } + + ::llvm::StringRef getDescription() const override { return "Pass to convert scf::ParallelOp to scf::ForOp"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ParallelLoopsToSequential"); + } + ::llvm::StringRef getName() const override { return "ParallelLoopsToSequential"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ParallelLoopsToSequentialBase) + +protected: +}; + +template +class PropagateShapeKnowledgeToKernelsBase : public ::mlir::OperationPass { +public: + using Base = PropagateShapeKnowledgeToKernelsBase; + + PropagateShapeKnowledgeToKernelsBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + PropagateShapeKnowledgeToKernelsBase(const PropagateShapeKnowledgeToKernelsBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("propagate-shape-knowledge-to-kernels"); + } + ::llvm::StringRef getArgument() const override { return "propagate-shape-knowledge-to-kernels"; } + + ::llvm::StringRef getDescription() const override { return "Pass to propagate shape information into kernels"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("PropagateShapeKnowledgeToKernels"); + } + ::llvm::StringRef getName() const override { return "PropagateShapeKnowledgeToKernels"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(PropagateShapeKnowledgeToKernelsBase) + +protected: +}; + +template +class PropagateTfAbiKnowledgeToKernelsBase : public ::mlir::OperationPass { +public: + using Base = PropagateTfAbiKnowledgeToKernelsBase; + + PropagateTfAbiKnowledgeToKernelsBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + PropagateTfAbiKnowledgeToKernelsBase(const PropagateTfAbiKnowledgeToKernelsBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("propagate-tf-abi-knowledge-to-kernels"); + } + ::llvm::StringRef getArgument() const override { return "propagate-tf-abi-knowledge-to-kernels"; } + + ::llvm::StringRef getDescription() const override { return "Pass to propagate tensorflow ABI knowledge to kernels"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("PropagateTfAbiKnowledgeToKernels"); + } + ::llvm::StringRef getName() const override { return "PropagateTfAbiKnowledgeToKernels"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(PropagateTfAbiKnowledgeToKernelsBase) + +protected: +}; + +template +class RewriteTFFrameworkAssertBase : public ::mlir::OperationPass { +public: + using Base = RewriteTFFrameworkAssertBase; + + RewriteTFFrameworkAssertBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + RewriteTFFrameworkAssertBase(const RewriteTFFrameworkAssertBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("rewrite-tf-framework-assert"); + } + ::llvm::StringRef getArgument() const override { return "rewrite-tf-framework-assert"; } + + ::llvm::StringRef getDescription() const override { return "Pass to rewrite TFAssertOps to CondBranchOp"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("RewriteTFFrameworkAssert"); + } + ::llvm::StringRef getName() const override { return "RewriteTFFrameworkAssert"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(RewriteTFFrameworkAssertBase) + +protected: +}; + +template +class ShapeToDescriptorsPassBase : public ::mlir::OperationPass { +public: + using Base = ShapeToDescriptorsPassBase; + + ShapeToDescriptorsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ShapeToDescriptorsPassBase(const ShapeToDescriptorsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("shape-to-descriptors"); + } + ::llvm::StringRef getArgument() const override { return "shape-to-descriptors"; } + + ::llvm::StringRef getDescription() const override { return "Pass to transform shape computations to descriptors"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ShapeToDescriptorsPass"); + } + ::llvm::StringRef getName() const override { return "ShapeToDescriptorsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ShapeToDescriptorsPassBase) + +protected: +}; + +template +class TFKernelToLLVMPassBase : public ::mlir::OperationPass { +public: + using Base = TFKernelToLLVMPassBase; + + TFKernelToLLVMPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TFKernelToLLVMPassBase(const TFKernelToLLVMPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("tf-kernel-to-llvm"); + } + ::llvm::StringRef getArgument() const override { return "tf-kernel-to-llvm"; } + + ::llvm::StringRef getDescription() const override { return "Pass for applying LLVM legalization patterns."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TFKernelToLLVMPass"); + } + ::llvm::StringRef getName() const override { return "TFKernelToLLVMPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TFKernelToLLVMPassBase) + +protected: + ::mlir::Pass::Option blob_annotation_{*this, "blob-annotation", ::llvm::cl::desc("Blob attribute name"), ::llvm::cl::init("gpu.binary_blob")}; +}; +#undef GEN_PASS_CLASSES +#endif // GEN_PASS_CLASSES diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tools/kernel_gen/transforms/passes.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tools/kernel_gen/transforms/passes.h new file mode 100644 index 0000000000000000000000000000000000000000..355030d6009f1878a445e0ab92a851781733c1ee --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tools/kernel_gen/transforms/passes.h @@ -0,0 +1,120 @@ +/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TOOLS_KERNEL_GEN_TRANSFORMS_PASSES_H_ +#define TENSORFLOW_COMPILER_MLIR_TOOLS_KERNEL_GEN_TRANSFORMS_PASSES_H_ + +#include +#include + +#include "mlir/Dialect/Func/IR/FuncOps.h" // from @llvm-project +#include "mlir/Dialect/GPU/IR/GPUDialect.h" // from @llvm-project +#include "mlir/Dialect/LLVMIR/LLVMDialect.h" // from @llvm-project +#include "mlir/IR/BuiltinOps.h" // from @llvm-project +#include "mlir/Pass/Pass.h" // from @llvm-project + +#define GEN_PASS_DECL_TFKERNELTOLLVMPASS +#define GEN_PASS_DECL_EMBEDTFFRAMEWORKPASS +#define GEN_PASS_DECL_REWRITETFFRAMEWORKASSERT +#define GEN_PASS_DECL_FUNCTOJITINVOCATIONPASS +#define GEN_PASS_DECL_BUFFERREUSEPASS +#define GEN_PASS_DECL_SHAPETODESCRIPTORSPASS +#define GEN_PASS_DECL_KERNELGENFINALBUFFERIZEPASS +#define GEN_PASS_DECL_GPUKERNELTOBLOBPASS +#define GEN_PASS_DECL_PARALLELLOOPSTOSEQUENTIAL +#define GEN_PASS_DECL_PROPAGATETFABIKNOWLEDGETOKERNELS +#define GEN_PASS_DECL_PROPAGATESHAPEKNOWLEDGETOKERNELS +#define GEN_PASS_DECL_FUSEINNERPARALLELLOOPSPASS +#define GEN_PASS_DECL_COPYCLEANUPPASS + +namespace mlir { +namespace kernel_gen { +namespace tf_framework { + +// Pass to replace some of the Standard ops with TF Framework ops. +// * adds tf_framework::OpKernelContextType argument to the function +// * std.alloc becomes tf_framework.alloc_raw +// * std.dealloc becomes tf_framework.dealloc_raw +// * std.assert becomes tf_framework.assert +std::unique_ptr> CreateEmbedTFFrameworkPass(); + +// Pass to convert tf_framework.assert operations to calls to +// tf_framework.report_error and create the required control flow to abort the +// function on failed execution. +std::unique_ptr> CreateRewriteTFFrameworkAssert(); + +} // namespace tf_framework + +namespace transforms { + +// Pass to find and annotate candidates for buffer reuse. +std::unique_ptr> CreateBufferReusePass(); + +// Pass to rewrite all functions to JIT invocations through the TF +// framework. +std::unique_ptr> CreateFuncToJITInvocationPass( + llvm::ArrayRef tile_sizes = {}, + llvm::ArrayRef unroll_factors = {}, int64_t max_supported_rank = 5, + bool enable_ftz = false, bool index_64bit = false, bool cpu_codegen = false, + bool jit_i64_indexed_for_large_tensors = false); + +// Pass for applying LLVM legalization patterns. +std::unique_ptr> CreateTFKernelToLLVMPass( + mlir::StringRef blob_annotation = {}); + +// Pass to tranform shape computations in shape dialect to standard and scf +// using memref descriptors. +std::unique_ptr> CreateShapeToDescriptorsPass(); + +// Pass to convert scf::ParallelOp to scf::ForOp. +std::unique_ptr> CreateParallelLoopsToSequential(); + +// Pass to annotate GPU Module with its PTX. +std::unique_ptr> CreateGpuKernelToBlobPass( + mlir::StringRef blob_annotation = {}, + ArrayRef architectures = {}, bool print_ptx = false, + bool print_llvmir = false, bool enable_ftz = false); + +// Pass to propagate tensorflow runtime ABI knowledge across kernel boundaries. +std::unique_ptr> +CreatePropagateTfAbiKnowledgeToKernels(); + +// Pass to propagate shape equalities across kernel boundaries. +std::unique_ptr> +CreatePropagateShapeKnowledgeToKernels(); + +/// Greedily maps loops to GPU hardware dimensions. +std::unique_ptr> CreateMapParallelLoopsPass(); + +/// We need to direct fusion to the inner loops. This cannot be done with +/// a passmanager alone ATM, as nested pass managers require operations to +/// be closed from above. +std::unique_ptr> +CreateFuseInnerParallelLoopsPass(); + +// Pass to remove copies which are consumed by a GenericOp. +std::unique_ptr> CreateCopyCleanupPass(); + +std::unique_ptr> CreateKernelgenFinalBufferizePass(); + +} // namespace transforms + +#define GEN_PASS_REGISTRATION +#include "tensorflow/compiler/mlir/tools/kernel_gen/transforms/kernel_gen_passes.h.inc" + +} // namespace kernel_gen +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TOOLS_KERNEL_GEN_TRANSFORMS_PASSES_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tools/kernel_gen/transforms/rewriters.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tools/kernel_gen/transforms/rewriters.h new file mode 100644 index 0000000000000000000000000000000000000000..e21339787430a85d66da80fc6e9cd61b2d8908f1 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tools/kernel_gen/transforms/rewriters.h @@ -0,0 +1,59 @@ +/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TOOLS_KERNEL_GEN_TRANSFORMS_REWRITERS_H_ +#define TENSORFLOW_COMPILER_MLIR_TOOLS_KERNEL_GEN_TRANSFORMS_REWRITERS_H_ + +#include "mlir/IR/MLIRContext.h" // from @llvm-project + +namespace mlir { +namespace bufferization { +class BufferizeTypeConverter; +} +class ConversionTarget; +class LLVMTypeConverter; +class MLIRContext; +class RewritePatternSet; +class TypeConverter; + +namespace kernel_gen { +namespace tf_framework { + +/// Collects a set of patterns to convert from the TF Framework dialect to LLVM. +void PopulateTFFrameworkToLLVMConversionPatterns(LLVMTypeConverter *converter, + RewritePatternSet *patterns); + +/// Collects a set of patterns to rewrite functions for use with TF framework +/// and also replace `alloc`, `dealloc` and `assert`. +void PopulateEmbedTFFrameworkPatterns(RewritePatternSet *patterns); +void PopulateEmbedTFFrameworkAssertPattern(RewritePatternSet *patterns); + +} // namespace tf_framework + +namespace transforms { + +/// Collects a set of patterns that bufferize operations from the standard and +/// other dialects. +void populateExtraBufferizeDialects(DialectRegistry ®istry); +void populateExtraBufferizePatterns( + ConversionTarget &target, MLIRContext *context, + bufferization::BufferizeTypeConverter *converter, + RewritePatternSet *patterns); + +} // namespace transforms +} // namespace kernel_gen +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TOOLS_KERNEL_GEN_TRANSFORMS_REWRITERS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tools/kernel_gen/transforms/utils.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tools/kernel_gen/transforms/utils.h new file mode 100644 index 0000000000000000000000000000000000000000..e0b67b738c9c55b82669f86a5784150ebe7a0367 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/tools/kernel_gen/transforms/utils.h @@ -0,0 +1,43 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_TOOLS_KERNEL_GEN_TRANSFORMS_UTILS_H_ +#define TENSORFLOW_COMPILER_MLIR_TOOLS_KERNEL_GEN_TRANSFORMS_UTILS_H_ + +#include + +#include "mlir/IR/BuiltinOps.h" // from @llvm-project +#include "mlir/IR/BuiltinTypes.h" // from @llvm-project + +namespace mlir { +namespace kernel_gen { +namespace transforms { + +// Attempts to find function symbol in the module, adds it if not found. +FlatSymbolRefAttr GetOrInsertLLVMFunction(StringRef func_name, Type func_type, + Operation* op, OpBuilder* b); + +// Attemts to find a global string constant in the module, adds it if not found. +Value CreateOrFindGlobalStringConstant(Location loc, StringRef global_name, + StringRef content, OpBuilder* builder); + +// Generates a global name with the format "base_hash(content)". +std::string GetGlobalName(StringRef base, StringRef content); + +} // namespace transforms +} // namespace kernel_gen +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_TOOLS_KERNEL_GEN_TRANSFORMS_UTILS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/utils/array_container_utils.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/utils/array_container_utils.h new file mode 100644 index 0000000000000000000000000000000000000000..80fa14e294c1c1384f7fd384a16229a1e59dcdda --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/utils/array_container_utils.h @@ -0,0 +1,46 @@ +/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_UTILS_ARRAY_CONTAINER_UTILS_H_ +#define TENSORFLOW_COMPILER_MLIR_UTILS_ARRAY_CONTAINER_UTILS_H_ + +#include "absl/types/span.h" +#include "llvm/ADT/ArrayRef.h" + +namespace mlir { + +template +inline llvm::ArrayRef SpanToArrayRef(absl::Span span) { + return llvm::ArrayRef(span.data(), span.size()); +} + +template +inline llvm::ArrayRef SpanToArrayRef(absl::Span span) { + return llvm::ArrayRef(span.data(), span.size()); +} + +template +inline llvm::MutableArrayRef SpanToMutableArrayRef(absl::Span span) { + return llvm::MutableArrayRef(span.data(), span.size()); +} + +template +inline absl::Span ArrayRefToSpan(llvm::ArrayRef ref) { + return absl::Span(ref.data(), ref.size()); +} + +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_UTILS_ARRAY_CONTAINER_UTILS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/utils/name_utils.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/utils/name_utils.h new file mode 100644 index 0000000000000000000000000000000000000000..356b4d258bbb8fffc15dc9b43883c199ec843247 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/utils/name_utils.h @@ -0,0 +1,34 @@ +/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_UTILS_NAME_UTILS_H_ +#define TENSORFLOW_COMPILER_MLIR_UTILS_NAME_UTILS_H_ + +#include + +#include "mlir/IR/Location.h" // from @llvm-project + +namespace mlir { + +// Converts characters in name that are considered illegal in TensorFlow Node +// name to '.'. +void LegalizeNodeName(std::string& name); + +// Returns the TensorFlow node name associated with a location. +std::string GetNameFromLoc(Location loc); + +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_UTILS_NAME_UTILS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/utils/string_container_utils.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/utils/string_container_utils.h new file mode 100644 index 0000000000000000000000000000000000000000..fb2fa06ca4dafc076e580a4b71dbe19cf1c71541 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/mlir/utils/string_container_utils.h @@ -0,0 +1,34 @@ +/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_MLIR_UTILS_STRING_CONTAINER_UTILS_H_ +#define TENSORFLOW_COMPILER_MLIR_UTILS_STRING_CONTAINER_UTILS_H_ + +#include "absl/strings/string_view.h" +#include "llvm/ADT/StringRef.h" + +namespace mlir { + +inline absl::string_view StringRefToView(llvm::StringRef ref) { + return absl::string_view(ref.data(), ref.size()); +} + +inline llvm::StringRef StringViewToRef(absl::string_view view) { + return llvm::StringRef(view.data(), view.size()); +} + +} // namespace mlir + +#endif // TENSORFLOW_COMPILER_MLIR_UTILS_STRING_CONTAINER_UTILS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/common/datavec.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/common/datavec.h new file mode 100644 index 0000000000000000000000000000000000000000..eff32f1f521af480046f6c73e99c3773646cc8ba --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/common/datavec.h @@ -0,0 +1,38 @@ +/* Copyright 2021 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_TF2TENSORRT_COMMON_DATAVEC_H_ +#define TENSORFLOW_COMPILER_TF2TENSORRT_COMMON_DATAVEC_H_ + +#include + +#include "tensorflow/core/framework/tensor.h" +#include "tensorflow/core/platform/types.h" + +namespace tensorflow { +namespace tensorrt { + +// Input/output data format for OpConverterTest::BuildAndRun(). +struct InputOutputData { + size_t TotalBytes() const { return tensor.TotalBytes(); } + string name; + Tensor tensor; +}; + +using DataVec = std::vector; + +} // namespace tensorrt +} // namespace tensorflow +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/common/utils.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/common/utils.h new file mode 100644 index 0000000000000000000000000000000000000000..0bc63ecd5c2c7f0f9e45efddbc5387d449bdec88 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/common/utils.h @@ -0,0 +1,175 @@ +/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_TF2TENSORRT_COMMON_UTILS_H_ +#define TENSORFLOW_COMPILER_TF2TENSORRT_COMMON_UTILS_H_ + +#include +#include + +#include "absl/strings/str_join.h" +#include "tensorflow/core/lib/core/status.h" + +namespace tensorflow { +namespace tensorrt { +// Returns the compile time TensorRT library version information +// {Maj, Min, Patch}. +std::tuple GetLinkedTensorRTVersion(); + +// Returns the runtime time TensorRT library version information +// {Maj, Min, Patch}. +std::tuple GetLoadedTensorRTVersion(); +} // namespace tensorrt +} // namespace tensorflow + +#if GOOGLE_CUDA && GOOGLE_TENSORRT + +#include "tensorflow/core/platform/errors.h" +#include "tensorflow/core/platform/logging.h" +#include "tensorflow/core/platform/status.h" +#include "third_party/tensorrt/NvInfer.h" + +#define ERROR_LOC __FILE__, ":", __LINE__ + +#define TFTRT_INTERNAL_ERROR_AT_NODE(node) \ + return errors::Internal("TFTRT::", __FUNCTION__, "\n", ERROR_LOC, \ + " failed to add TRT layer, at: ", node); + +#define TFTRT_RETURN_ERROR_IF_NULLPTR(ptr, node) \ + if (ptr == nullptr) { \ + TFTRT_INTERNAL_ERROR_AT_NODE(node); \ + } + +// Use this macro within functions that return a Status or StatusOR to check +// boolean conditions. If the condition fails, it returns an +// errors::Internal message with the file and line number. +#define TRT_ENSURE(x) \ + if (!(x)) { \ + return errors::Internal(ERROR_LOC, " TRT_ENSURE failure"); \ + } + +// Checks that a Status or StatusOr object does not carry an error message. +// If it does have an error, returns an errors::Internal instance +// containing the error message, along with the file and line number. For +// pointer-containing StatusOr, use the below TRT_ENSURE_PTR_OK macro. +#define TRT_ENSURE_OK(x) \ + if (!x.ok()) { \ + return errors::Internal(ERROR_LOC, " TRT_ENSURE_OK failure:\n ", \ + x.status().ToString()); \ + } + +// Checks that a StatusOrobject does not carry an error, and that the +// contained T* is non-null. If it does have an error status, returns an +// errors::Internal instance containing the error message, along with the file +// and line number. +#define TRT_ENSURE_PTR_OK(x) \ + TRT_ENSURE_OK(x); \ + if (*x == nullptr) { \ + return errors::Internal(ERROR_LOC, " pointer had null value"); \ + } + +namespace tensorflow { +namespace tensorrt { + +#define IS_TRT_VERSION_GE(major, minor, patch, build) \ + ((NV_TENSORRT_MAJOR > major) || \ + (NV_TENSORRT_MAJOR == major && NV_TENSORRT_MINOR > minor) || \ + (NV_TENSORRT_MAJOR == major && NV_TENSORRT_MINOR == minor && \ + NV_TENSORRT_PATCH > patch) || \ + (NV_TENSORRT_MAJOR == major && NV_TENSORRT_MINOR == minor && \ + NV_TENSORRT_PATCH == patch && NV_TENSORRT_BUILD >= build)) + +#define LOG_WARNING_WITH_PREFIX LOG(WARNING) << "TF-TRT Warning: " + +// Initializes the TensorRT plugin registry if this hasn't been done yet. +void MaybeInitializeTrtPlugins(nvinfer1::ILogger* trt_logger); + +class IONamePrefixes { + public: + static constexpr const char* const kInputPHName = "TensorRTInputPH_"; + static constexpr const char* const kOutputPHName = "TensorRTOutputPH_"; +}; + +// Gets the binding index of a tensor in an engine. +// +// The binding index is looked up using the tensor's name and the profile index. +// Profile index should be set to zero, if we do not have optimization profiles. +Status GetTrtBindingIndex(const char* tensor_name, int profile_index, + const nvinfer1::ICudaEngine* cuda_engine, + int* binding_index); + +// Gets the binding index of a tensor in an engine. +// +// Same as above, but uses the network input index to identify the tensor. +Status GetTrtBindingIndex(int network_input_idx, int profile_index, + const nvinfer1::ICudaEngine* cuda_engine, + int* binding_index); +} // namespace tensorrt +} // namespace tensorflow + +namespace nvinfer1 { +// Prints nvinfer1::Dims or any drived type to the given ostream. Per GTest +// printing requirements, this must be in the nvinfer1 namespace. +inline std::ostream& operator<<(std::ostream& os, const nvinfer1::Dims& v) { + os << "nvinfer1::Dims["; + os << absl::StrJoin(std::vector(v.d, v.d + v.nbDims), ","); + os << "]"; + return os; +} + +// Returns true if any two derived nvinfer1::Dims type structs are equivalent. +inline bool operator==(const nvinfer1::Dims& lhs, const nvinfer1::Dims& rhs) { + if (rhs.nbDims != lhs.nbDims) { + return false; + } + for (int i = 0; i < lhs.nbDims; i++) { + if (rhs.d[i] != lhs.d[i]) { + return false; + } + } + return true; +} + +// Returns false if any 2 subclasses of nvinfer1::Dims are equivalent. +inline bool operator!=(const nvinfer1::Dims& lhs, const nvinfer1::Dims& rhs) { + return !(rhs == lhs); +} + +// Prints nvinfer1::INetworkDefinition* information to the given ostream. +inline std::ostream& operator<<(std::ostream& os, + nvinfer1::INetworkDefinition* n) { + os << "nvinfer1::INetworkDefinition{\n"; + std::vector layer_idxs(n->getNbLayers()); + std::iota(layer_idxs.begin(), layer_idxs.end(), 0); + os << absl::StrJoin(layer_idxs, "\n ", + [n](std::string* out, const int layer_idx) { + out->append(n->getLayer(layer_idx)->getName()); + }); + os << "}"; + return os; +} + +// Prints the TensorFormat enum name to the stream. +std::ostream& operator<<(std::ostream& os, + const nvinfer1::TensorFormat& format); + +// Prints the DataType enum name to the stream. +std::ostream& operator<<(std::ostream& os, const nvinfer1::DataType& data_type); + +} // namespace nvinfer1 + +#endif // GOOGLE_CUDA && GOOGLE_TENSORRT + +#endif // TENSORFLOW_COMPILER_TF2TENSORRT_COMMON_UTILS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/convert/algorithm_selector.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/convert/algorithm_selector.h new file mode 100644 index 0000000000000000000000000000000000000000..9c311297542dd58a7f9a4ba6209fc7d63370c5a6 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/convert/algorithm_selector.h @@ -0,0 +1,121 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ +#ifndef TENSORFLOW_COMPILER_TF2TENSORRT_CONVERT_ALGORITHM_SELECTOR_H_ +#define TENSORFLOW_COMPILER_TF2TENSORRT_CONVERT_ALGORITHM_SELECTOR_H_ +#if GOOGLE_CUDA && GOOGLE_TENSORRT +#include +#include +#include + +#include "absl/types/optional.h" +#include "third_party/tensorrt/NvInfer.h" + +namespace tensorflow { +namespace tensorrt { +namespace convert { + +// Implements core algorithm selection logic in a testable manner. The policy +// implemented depends on the given TRT version. We have this class because TRT +// interfaces make it difficult to directly test an IAlgorithmSelector +// implementation. +class AlgorithmSelectorImpl { + public: + using TRTVersion = std::array; + using ImplementationID = int64_t; + using TacticID = int64_t; + + static constexpr TRTVersion CompileTimeTRTVersion() { + return TRTVersion{NV_TENSORRT_MAJOR, NV_TENSORRT_MINOR, NV_TENSORRT_PATCH, + NV_TENSORRT_BUILD}; + } + + explicit AlgorithmSelectorImpl( + const TRTVersion& version = CompileTimeTRTVersion()) + : version_(version) {} + + bool IsShuffleLayer(ImplementationID id) const; + + bool IsBannedTactic(TacticID id) const; + + // Returns true if the algorithm implementing the IShuffleLayer is acceptable. + bool AllowShuffleAlgorithm(TacticID tactic, nvinfer1::DataType input_dtype, + nvinfer1::TensorFormat input_format) const; + + bool IsTrtVersionGE(const TRTVersion& version) const; + + // Returns true if we know at compile time that the algorithm selector + // should be required. This is a conservative estimate. + bool IsAlgorithmSelectorRequired() const; + + static std::set GetBannedTRT72TuringTactics(); + + private: + TRTVersion version_; +}; + +// Impelements the TRT IAlgorithmSelector interface. The method +// "selectAlgorithms" selects allowable algorithms for each layer, and +// "reportAlgorithms" summarizes the algorithms selected by TensorRT. +class TftrtAlgorithmSelector : public nvinfer1::IAlgorithmSelector { + private: + using TacticID = AlgorithmSelectorImpl::TacticID; + + // An index we should choose for all algorithms. Used for debugging. + std::optional fixed_algorithm_idx_; + + AlgorithmSelectorImpl selector_; + + public: + TftrtAlgorithmSelector(); + + // If the environment variable TF_TRT_FIXED_ALGORITHM_ID is empty, this + // function returns nullopt. Otherwise, it returns the specified number. + static std::optional GetFixedAlgorithmID(); + + // Returns true if the algorithm associated with context is acceptable. + bool AlgorithmPolicy(const nvinfer1::IAlgorithmContext& context, + const nvinfer1::IAlgorithm& alg) const; + + // This function fills the array "selection" with the indices of selected + // algorithm candidates from "algoChoices", each of which is an implementation + // for the kernel described by the given IAlgorithmContext. It should return a + // number in [0, nbChoices] indicating the number of selected indices. If 0 is + // returned, TensorRT will use its default selection mechanism. + int32_t selectAlgorithms(const nvinfer1::IAlgorithmContext& algoContext, + const nvinfer1::IAlgorithm* const* algoChoices, + int32_t nbChoices, + int32_t* selection) noexcept override; + + // Called by TensorRT to report choices it made. + void reportAlgorithms(const nvinfer1::IAlgorithmContext* const* algoContexts, + const nvinfer1::IAlgorithm* const* algoChoices, + int32_t nbAlgorithms) noexcept override; + + bool IsRequired() const { + return selector_.IsAlgorithmSelectorRequired() || + fixed_algorithm_idx_ != std::nullopt; + } +}; + +// Returns an initialized AlgorithmSelector if an algorithm selector is required +// for the current TRT version. Otherwise, returns nullptr. +std::unique_ptr MaybeCreateAlgorithmSelector(); + +} // namespace convert +} // namespace tensorrt +} // namespace tensorflow + +#endif // GOOGLE_CUDA && GOOGLE_TENSORRT +#endif // TENSORFLOW_COMPILER_TF2TENSORRT_CONVERT_ALGORITHM_SELECTOR_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/convert/convert_graph.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/convert/convert_graph.h new file mode 100644 index 0000000000000000000000000000000000000000..0607fb85346b2c3e38d93ff2eb5cb4105f4edb27 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/convert/convert_graph.h @@ -0,0 +1,70 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ +#ifndef TENSORFLOW_COMPILER_TF2TENSORRT_CONVERT_CONVERT_GRAPH_H_ +#define TENSORFLOW_COMPILER_TF2TENSORRT_CONVERT_CONVERT_GRAPH_H_ + +#include + +#include "tensorflow/compiler/tf2tensorrt/convert/convert_nodes.h" +#include "tensorflow/compiler/tf2tensorrt/convert/trt_optimization_pass.h" +#include "tensorflow/compiler/tf2tensorrt/convert/utils.h" +#include "tensorflow/compiler/tf2tensorrt/utils/trt_shape_optimization_profiles.h" +#include "tensorflow/core/framework/graph.pb.h" +#include "tensorflow/core/framework/tensor_shape.h" +#include "tensorflow/core/grappler/clusters/cluster.h" +#include "tensorflow/core/grappler/grappler_item.h" +#include "tensorflow/core/lib/core/status.h" +#include "tensorflow/core/platform/types.h" + +#if GOOGLE_CUDA && GOOGLE_TENSORRT + +namespace tensorflow { +namespace tensorrt { +namespace convert { + +// These functions are internal implementation functions for the +// TRTOptimizationPass. + +// Performs segmentation and conversion on the given Grappler item. This method +// contains the core logic of the TRTOptimizationPass. +Status ConvertGraph(const TRTOptimizationPass::ConversionParams& params, + grappler::GrapplerItem& grappler_item, + const std::vector& input_output_names, + grappler::Cluster* cluster, GraphDef* output); + +// Helper method for the conversion, expose for testing. +std::pair GetDeviceAndAllocator( + const grappler::Cluster* cluster, const EngineInfo& engine); + +// Helper method that registers `segment_graph` as a function to the function +// library in `graph`. +Status RegisterGraphToFunctionLibrary(const GraphDef& segment_graph_def, + Graph* graph, const string& engine_name); + +// Creates and serializes an ICudaEngine. Used only in is_dynamic_op=false, +// a.k.a. static engine mode. +Status CreateStaticEngine(const TRTOptimizationPass::ConversionParams& params, + const EngineInfo& info, int max_batch_size, + const std::vector& input_shapes, + TrtShapeOptimizationProfile* profile, + string* segment_string, grappler::Cluster* cluster); + +} // namespace convert +} // namespace tensorrt +} // namespace tensorflow + +#endif // GOOGLE_CUDA && GOOGLE_TENSORRT + +#endif // TENSORFLOW_COMPILER_TF2TENSORRT_CONVERT_CONVERT_GRAPH_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/convert/convert_nodes.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/convert/convert_nodes.h new file mode 100644 index 0000000000000000000000000000000000000000..e9afd320be9a852741fb20a0922b04b432b704de --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/convert/convert_nodes.h @@ -0,0 +1,593 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_TF2TENSORRT_CONVERT_CONVERT_NODES_H_ +#define TENSORFLOW_COMPILER_TF2TENSORRT_CONVERT_CONVERT_NODES_H_ + +#include +#include +#include +#include +#include + +#include "absl/types/optional.h" +#include "tensorflow/compiler/tf2tensorrt/convert/op_converter.h" +#include "tensorflow/compiler/tf2tensorrt/convert/utils.h" +#include "tensorflow/compiler/tf2tensorrt/convert/weights.h" +#include "tensorflow/compiler/tf2tensorrt/utils/trt_allocator.h" +#include "tensorflow/compiler/tf2tensorrt/utils/trt_int8_calibrator.h" +#include "tensorflow/compiler/tf2tensorrt/utils/trt_logger.h" +#include "tensorflow/compiler/tf2tensorrt/utils/trt_shape_optimization_profiles.h" +#include "tensorflow/compiler/tf2tensorrt/utils/trt_tensor_proxy.h" +#include "tensorflow/core/framework/graph.pb.h" +#include "tensorflow/core/graph/graph.h" +#include "tensorflow/core/grappler/costs/graph_properties.h" +#include "tensorflow/core/lib/core/status.h" + +#if GOOGLE_CUDA && GOOGLE_TENSORRT +#include "third_party/tensorrt/NvInfer.h" + +namespace tensorflow { +namespace tensorrt { + +namespace convert { +using ::tsl::StatusOr; + +struct EngineConnection { + // Constructs a non-control edge. + EngineConnection(const string& outside, int out_id, int out_port, + const string& inside, int in_id, int in_port, + bool input_edge, int port) + : outside_node_name(outside), + outside_id(out_id), + outside_port(out_port), + inside_node_name(inside), + inside_id(in_id), + inside_port(in_port), + is_input_edge(input_edge), + port_number(port) {} + + // Constructs a control edge. + EngineConnection(const string& outside, int out_id, const string& inside, + int in_id, bool input_edge) + : outside_node_name(outside), + outside_id(out_id), + outside_port(Graph::kControlSlot), + inside_node_name(inside), + inside_id(in_id), + inside_port(Graph::kControlSlot), + is_input_edge(input_edge), + port_number(Graph::kControlSlot) {} + + bool is_control_edge() const { return port_number == Graph::kControlSlot; } + + const string outside_node_name; + const int outside_id; + const int outside_port; + PartialTensorShape outside_shape; // Only set for input edge. + + const string inside_node_name; + const int inside_id; + const int inside_port; + PartialTensorShape inside_shape; // Only set for output edge. + + DataType connection_type; + const bool is_input_edge; + + // The port number of the TRT node connected with this edge. + const int port_number; +}; + +struct EngineInfo { + EngineInfo() + : engine_type(EngineType::TRTStatic), + max_workspace_size_bytes(0), + max_batch_size(std::nullopt), + maximum_cached_engines(0), + precision_mode(TrtPrecisionMode::FP32), + use_calibration(true), + + allow_build_at_runtime(true), + use_explicit_precision(false) {} + + string engine_name; + string device; + GraphDef segment_graph_def; + + // Non-control input connections inside this vector are sorted in a way such + // that, the segment nodes connecting to them are topological sorted. + // In addition, for non-control connections, there must be no duplicates. + std::vector connections; + + enum class EngineType { TRTStatic = 0, TRTDynamic = 1 }; + EngineType engine_type; + int64 max_workspace_size_bytes; + std::optional max_batch_size; + int maximum_cached_engines; + TrtPrecisionMode precision_mode; + bool use_calibration; + bool allow_build_at_runtime; + bool use_explicit_precision; +}; + +// Constructs a graphdef from the segment in the given graph and stores it to +// the engine_info. Adds _Arg nodes for input edges (InputPH_*) and _Retval +// nodes for output edges (OutputPH_*). Maintains the topological order of the +// non-input/output nodes in the graphdef. This function needs to be called +// before TensorRT layers are created because it prepares the original graph +// for TensorRT conversion. +// +// - subgraph_node_names: the node names of the subgraph. +// - subgraph_node_ids: the node ids of the subgraph, must be sorted in +// topological order. +// - engine_info: a data structure that records the information about the +// engine containing the subgraph. +// +// TODO(aaroey): add tests to validate these properties. +Status ConvertSegmentToGraphDef( + const Graph* graph, const grappler::GraphProperties& graph_properties, + const std::vector& subgraph_nodes, EngineInfo* engine_info); + +// Converts given subgraph to a TRT engine saved in 'engine'. Returns ok iff +// 'builder' successfully build the engine. If the result is not ok, 'engine' +// will be set to nullptr +// Once returned, 'builder' is not needed any more and can be safely destroyed. +// +// - convert_successfully: indicates whether the conversion to TensorRT network +// is successful. This is different than successfully building the engine: +// building can still fail afterwards. +// Note: When 'cluster' is not null, it contains the graph to be converted. +// We may perform additional optimizations to the graph before converting +// the graph. +Status ConvertGraphDefToEngine( + const GraphDef& gdef, OpKernelContext* ctx, TrtPrecisionMode precision_mode, + int max_batch_size, size_t max_workspace_size_bytes, + const std::vector& input_shapes, + nvinfer1::ILogger* logger, nvinfer1::IGpuAllocator* allocator, + TRTInt8Calibrator* calibrator, + TrtUniquePtrType* engine, bool use_calibration, + const bool use_implicit_batch, bool* convert_successfully, + TrtShapeOptimizationProfile* profiles, absl::string_view engine_name, + bool use_explicit_precision, + tensorflow::grappler::Cluster* cluster = nullptr, + const string& device = ""); + +// Helper class for the segmenter to determine whether an output edge from the +// TRT segment is valid. +class OutputEdgeValidator { + public: + // Return true if the specified edge is eligible to be an output edge of the + // TRT segment. + bool operator()(const Edge* out_edge) const; +}; + +// Class to verify if specific TF node is supported by TRT. +class TrtNodeValidator { + public: + // 'graph_properties' is the GraphProperties of the graph whose nodes will be + // checked by IsTensorRTCandidate() later. It is used to get the shape and + // data type information of a tensor for validation purpose. + TrtNodeValidator(const grappler::GraphProperties& graph_properties, + TrtPrecisionMode precision_mode, bool use_calibration, + bool use_implicit_batch, bool use_explicit_precision); + + // Returns OK iff 'node' is a TF-TRT conversion candidate, which will be added + // to TRT subgraph and later converted into TRT engine. + Status IsTensorRTCandidate(const Node* node); + + static const std::set* quantize_ops; + + // Returns validator by op type. If no validator is registered for + // specific op, it means no validation is needed and ValidateNode() will + // return OK. + StatusOr GetValidator(const std::string& op); + + private: + // Convert a Const node to a TRT_TensorOrWeights. + Status ConvertConstToWeights(const NodeDef& const_node_def, + const std::vector& inputs, + TRT_TensorOrWeights* output); + + // Convert a VariableV2 node to a TRT_TensorOrWeights. + Status ConvertVariableToWeights( + const NodeDef& const_node_def, + const std::vector& inputs, + TRT_TensorOrWeights* output); + + // Convert the output tensor at 'output_port' of 'node_def' to a + // TRT_TensorOrWeights which will be later used as an input to other nodes and + // passed to ValidateNode() below. + Status ConvertToTensorOrWeights(const NodeDef& node_def, int output_port, + TRT_TensorOrWeights* tensor_or_weights); + + // Store the weights added during validation. Some validations (e.g. + // validation for Const node) may produce weights. + TrtWeightStore weight_store_; + + // GraphProperties of the graph whose nodes are to be validated by + // IsTensorRTCandidate(). + const grappler::GraphProperties& graph_properties_; + + // Quantization ops are only converted when using quantized precisions. + const TrtPrecisionMode precision_mode_; + + const bool use_calibration_; + + const bool use_implicit_batch_; + + const bool use_explicit_precision_; + + friend class ValidatorTest; + friend class OpConverterTest; +}; + +// Class to convert TF nodes to TRT network. +class Converter { + public: + // Used for Converter::RenameAndMarkOutputTensors() + struct EngineOutputInfo { + // The TRT tensor name which produces the output. + string source_tensor_name; + // The TensorFlow node name which is receiving the output from the TRT + // engine. This should always be the Identity node created in + // ConvertSegmentToGraphDef. + string dest_node_name; + // Output type. TensorRT requires this to be explicitly set for engine + // outputs. + nvinfer1::DataType trt_dtype; + }; + + static StatusOr> Create( + TrtPrecisionMode precision_mode, bool use_calibration, + nvinfer1::ILogger* trt_logger, const bool use_implicit_batch, + absl::string_view engine_name, bool use_explicit_precision = false, + OpKernelContext* ctx = nullptr); + + ////////////////////////////////////////////////////////////////////////////// + // Methods used by the TRT engine builder to build a TRT network from a TF + // function/subgraph. + + // Convert the node to TRT network. + Status ConvertNode(const NodeDef& node_def); + + // Add input tensor to the TRT network with given 'name', 'dtype', 'dims' and + // 'batch_size'. + Status AddInputTensor(const string& name, nvinfer1::DataType dtype, + const nvinfer1::Dims& dims, int batch_size); + + // Store the ResourceHandle as a TRT_TensorOrWeights object. This can be + // later used as input to other nodes. + Status AddInputResource(const string& name, const ResourceHandle& resource); + + // Mark the tensors with names specified by source_tensor_name as output of + // the TRT network, and set their names in the TRT network as dest_node_name. + Status RenameAndMarkOutputTensors( + const std::vector& output_tensors); + + // Build a TRT engine using the created network. + Status BuildCudaEngine(TrtUniquePtrType* engine, + int max_batch_size, size_t max_workspace_size_bytes, + nvinfer1::IGpuAllocator* allocator, + TRTInt8Calibrator* calibrator, + TrtShapeOptimizationProfile* profiles); + + ////////////////////////////////////////////////////////////////////////////// + // Methods used by op converters to convert individual TF node and add layers + // to the TRT network. + + // Op converters (e.g. ConvertReshape) need to access the TRT network in order + // to add TRT layers. + nvinfer1::INetworkDefinition* network() { return trt_network_.get(); } + + // What precision are we targeting? + TrtPrecisionMode precision_mode() const { return precision_mode_; } + + // Variable converters need the context to read variable values. + OpKernelContext* context() { return ctx_; } + + // Calibration will be or was previously performed on this network? + bool use_calibration() const { return use_calibration_; } + + // Whether implicit batch mode is enabled + bool use_implicit_batch() const { return use_implicit_batch_; } + + // This function should be called when we know the quantization range of a + // tensor from a quantize/dequantize node. + void ProvideQuantizationRange(ITensorProxyPtr* tensor, float min_range, + float max_range); + + // Should be called when full TRT network has been constructed and before + // building the engine. + void MaybeApplyQuantizationRanges(); + + // Below are helper methods for op converters to add different layers to the + // TRT network. + + // Transpose 'input_tensor' with given permutation 'order_with_batch_dim' to + // 'output_tensor'. The permutation 'order_with_batch_dim' contains the batch + // dimension which should always be 0. If this is for adding a transpose layer + // to support the conversion of 'node_def', callers need to provide a + // non-empty 'sub_op_name' appended to the name of 'node_def' to avoid layer + // name conflicts. + Status TransposeTensor(ITensorProxyPtr input_tensor, + const std::vector& order_with_batch_dim, + ITensorProxyPtr* output_tensor, + const NodeDef& node_def, + absl::string_view sub_op_name = ""); + + // Reshapes a dynamic shape tensor by removing or adding dimensions of size 1, + // and/or permuting the dimensions. The new shape is derived from the shape of + // the input tensor according to the slices and size_for_added_dims arguments. + // + // If there would be at most one unknown dimension, we could set the new shape + // using IShuffleLayer::setReshapeDimensions, which treats -1 as a special + // value (the same way as TF). In general, we can have more than one unknown + // dimensions, and we have to manipulate the shape tensors during runtime to + // define the new shape. This helper function defines the necessary shape + // inference layers and calls reshape using the calculated new shape. + // + // Example: + // + // Assume that we want to reshape a tensor from shape {A,B,C,D} to {C,D,A,B} + // (no transpose, just change the shape). In dynamic shape mode, the A,B,C,D + // values are not necessarily known at conversion time, they can be all -1. We + // can only define the new shape at runtime, when the actual shape is already + // known. To define the new shape: + // - We use an IShapeLayer to retrieve a shape tensor with the {A,B,C,D} + // values. + // - Create two slices {C,D} and {A,B} of the shape tensor. + // - Concatenate these slices {C,D,A,B}, + // - Set the {C,D,A,B} shape tensor as an input shape tensor for + // IShuffleLayer. + // + // This can be achieved by calling DynamicReshape(input, {{2,4},{0,2}}, + // params). + // + // Before each slice we can insert new dims if the corresponding + // size_for_added_dims element is not negative. The size_for_added_dims array + // can have more than slices.size() elements, in order to insert a dimension + // after the last slice. For example, to add two leading 1 dimensions, and + // three trailing 1 dimensions, call DynamicReshape(input, {{0,nbDims}}, + // {2, 3}). + // + // Parameters: + // input - input tensor + // slices - [start, end) pairs of slices + // params - conversion parameters + // output - reshaped tensor + // size_for_added_dims - size of dimension inserted right before slice[i]. We + // only insert a new dim if size_for_added_dims[i] >= 0. + Status DynamicReshape(ITensorProxyPtr input, + std::vector> slices, + const OpConverterParams* params, + ITensorProxyPtr* output, + std::vector size_for_added_dims = {}, + std::optional op_instance = std::nullopt); + + // Inserts a singleton dimension at axis for a dynamic shape tensor. + Status DynamicExpandDims(ITensorProxyPtr input, const nvinfer1::Dims& dims, + int axis, const OpConverterParams* params, + ITensorProxyPtr* output, + std::optional op_instance = std::nullopt); + + // Helper function to add a squeeze op to the network. + // + // The input_dims argument stores the TRT dimensions of the input tensor, + // where the dimensions to be squeezed are replaced by 0. + Status SqueezeTensor(ITensorProxyPtr input, std::vector* input_dims, + const OpConverterParams* params, ITensorProxyPtr* output, + std::optional op_instance = std::nullopt); + + // Creates an IConstantLayer using 'weights' whose dimensions are specified by + // 'dims', and returns the output ITensor. + ITensorProxyPtr CreateConstantLayer(const TRT_ShapedWeights& weights, + const nvinfer1::Dims& dims); + + // Gets the min and max value in a TRT_ShapedWeights + Status GetWeightRange(const TRT_ShapedWeights& weights, float* out_min, + float* out_max) const; + + // Constructs a name and passed it to the TensorRT layer to support xprof. + void SetLayerName(nvinfer1::ILayer* layer, const NodeDef& node_def, + absl::string_view sub_op_name = "", + std::optional sub_op_instance = std::nullopt, + std::optional origin_node_name = std::nullopt); + + void SetLayerName(nvinfer1::ILayer* layer, absl::string_view main_op_name, + absl::string_view sub_op_name, + std::optional sub_op_instance = std::nullopt); + + std::unordered_map& TensorsMap() { + return trt_tensors_; + } + + bool UseExplicitPrecision() const { return use_explicit_precision_; } + + private: + Converter(TrtPrecisionMode precision_mode, bool use_calibration, + nvinfer1::ILogger* trt_logger, const bool use_implicit_batch, + absl::string_view engine_name, bool use_explicit_precision, + OpKernelContext* ctx); + + Status Init(nvinfer1::ILogger* trt_logger); + + // Verify the provided batch_size is consistent with batch_size_ and update it + // if necessary. + Status MaybeUpdateBatchSize(int batch_size); + + // Add the provided tensor/weights to the map trt_tensors_. + Status AddTensorOrWeights(const string& name, TRT_TensorOrWeights input); + + // Get the tensor/weights from trt_tensors_ by 'name'. + Status GetTensorOrWeights(const string& name, TRT_TensorOrWeights* output); + + // Get the inputs of 'node_def' from trt_tensors_. + Status GetInputs(const NodeDef& node_def, + std::vector* inputs) const; + + // Tensors/weights added during construction of trt_network_. + std::unordered_map trt_tensors_; + + // The TRT builder used to create the network and build the engine. Not owned. + TrtUniquePtrType trt_builder_; + + // The TRT network being built. + TrtUniquePtrType trt_network_; + + // Store the weights added during construction of trt_network_. + TrtWeightStore weight_store_; + + // Store the context. + OpKernelContext* ctx_; + + // During conversion, this table is populated with quantization ranges per + // tensor. MaybeApplyQuantizationRanges() will use this table to set the TRT + // quantization ranges. Since TRT only supports symmetric ranges, we will + // store the range as a single float = max(abs(min_range), abs(max_range)). + // Range refers to the floating point values, e.g. min_range = 0.0f, max_range + // = 6.0f for Relu6. + std::unordered_map quantization_ranges_proxy_; + std::unordered_map quantization_ranges_; + + const TrtPrecisionMode precision_mode_; + + const bool use_calibration_; + + // If this is false, all dimensions including the batch dimension are + // set explicitely. + const bool use_implicit_batch_; + + // Batch size of inputs to trt_network_ added by AddInputTensor(). During + // network construction it will update this, use it to verify the batch + // size of all inputs are compatible, and make sure individual TF node is + // acceptable by TRT. + int batch_size_ = -1; + + // Assign a ID to each constant layer we create, so that we can assign a + // unique name to the layer. + int next_constant_layer_id_ = 0; + + // The name of the TRTEngineOp node. + absl::string_view engine_name_; + + // Indicates whether to use explicit precision in TensorRT (Q/DQ support). + bool use_explicit_precision_; + + friend class ConverterTest; + friend class OpConverterTest; +}; + +// Converts a TensorFlow tensor to TRT shaped weights. +Status TfTensorToTrtWeights(const Tensor& tensor, TrtWeightStore* weight_store, + TRT_ShapedWeights* weights); + +// Converts 'input' of 'node_def' into 'tensor' with shape specified by 'dims' +// (which doesn't contain the batch dimension). +// +// If validation_only is true, it doesn't do the conversion but only do some +// minimum validation for the eligibility of the conversion, and *tensor will +// be set to nullptr. +// If validation_only is false converter must not be nullptr. +Status PrepareTensorForShape( + Converter* converter, const TRT_TensorOrWeights& input, + const DimsAdapter& dims, const bool validation_only, + ITensorProxyPtr* tensor, const NodeDef& node_def, + std::optional op_instance = std::nullopt, + std::optional origin_node_name = std::nullopt); + +// Return OK if the broadcast scheme is supported and compute the shapes after +// broadcasting. check_feasibility can be set to false in cases where dimensions +// do not need to match exactly (as in the case of BatchMatMulV2). +Status GetTrtBroadcastShape(const TRT_TensorOrWeights& operand_l, + const TRT_TensorOrWeights& operand_r, + const bool check_feasibility, + const bool use_implicit_batch, + nvinfer1::Dims* operand_l_new_dims, + nvinfer1::Dims* operand_r_new_dims); + +template +using OperationMap = std::unordered_map; + +// Map from Tensorflow operation names to TensorRT unary operations. +using UnaryOperationMapType = OperationMap; +const UnaryOperationMapType* UnaryOperationMap(); + +// Map from Tensorflow boolean operation names to TensorRT unary operations. +const UnaryOperationMapType* UnaryBooleanOperationMap(); + +// Map of all supported ActivationTypes. +using ActivationTypeMapType = OperationMap; +const ActivationTypeMapType* ActivationTypeMap(); + +// Map from Tensorflow binary operation names to TensorRT binary operations +// types. +using BinaryOperationMapType = OperationMap; +const BinaryOperationMapType* BinaryOperationMap(); + +// Map from Tensorflow boolean binary operation names to TensorRT binary +// operations types. +const BinaryOperationMapType* BinaryBooleanOperationMap(); + +template +absl::InlinedVector GetOperationNames(const T& set) { + absl::InlinedVector result; + absl::c_transform(set, std::back_inserter(result), + [](const auto x) { return x.first; }); + return result; +} + +// Adds a matrix multiplication operation to the TensorRT graph. The "params" +// pointer is only used to access the TRT network builder. The inputs and +// parameters for the op are fully specified by input_[a|b] and transpose_[a|b]. +StatusOr ConvertMatMulImpl(const OpConverterParams* params, + TRT_TensorOrWeights input_a, + TRT_TensorOrWeights input_b, + bool transpose_a, bool transpose_b); + +Status ApplyBroadcast(std::unique_ptr& operand, + const DimsAdapter& broadcasted_dims, + const OpConverterParams* params, + std::optional op_instance); + +std::string convert_range_error_msg(float start, float limit, float delta); +std::string convert_range_expected_msg(const NodeDef& node_def); +std::string bool_weight_error_msg(const NodeDef& node_def); +std::string unexpected_type_error_msg(nvinfer1::DataType type_being_checked, + nvinfer1::DataType type_expected, + const NodeDef& node_def, int idx = 0); +std::string then_else_dtypes_error_msg(nvinfer1::DataType type_then, + nvinfer1::DataType type_else, + const NodeDef& node_def); +std::string input_shapes_error_msg(const nvinfer1::Dims& shape1, + const nvinfer1::Dims& shape2, + const NodeDef& node, + bool then_vs_else = false); +std::string batch_size_error(absl::string_view name, absl::string_view comment); + +inline bool find_name(const string& name, const std::vector names) { + return std::find(names.begin(), names.end(), name) != names.end(); +} + +Status check_type(nvinfer1::DataType type_being_checked, + nvinfer1::DataType type_expected, const NodeDef& node_def, + int idx = 0); + +} // namespace convert +} // namespace tensorrt +} // namespace tensorflow + +#endif // GOOGLE_CUDA && GOOGLE_TENSORRT + +#endif // TENSORFLOW_COMPILER_TF2TENSORRT_CONVERT_CONVERT_NODES_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/convert/logger_registry.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/convert/logger_registry.h new file mode 100644 index 0000000000000000000000000000000000000000..2a265cf7caaaa2c6c462070dfef8765308628b49 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/convert/logger_registry.h @@ -0,0 +1,58 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ +#ifndef TENSORFLOW_COMPILER_TF2TENSORRT_CONVERT_LOGGER_REGISTRY_H_ +#define TENSORFLOW_COMPILER_TF2TENSORRT_CONVERT_LOGGER_REGISTRY_H_ + +#include "tensorflow/core/lib/core/status.h" +#include "tensorflow/core/platform/macros.h" +#include "tensorflow/core/platform/types.h" + +#if GOOGLE_CUDA && GOOGLE_TENSORRT + +#include "third_party/tensorrt/NvInfer.h" + +namespace tensorflow { +namespace tensorrt { + +class LoggerRegistry { + public: + virtual Status Register(const string& name, nvinfer1::ILogger* logger) = 0; + virtual nvinfer1::ILogger* LookUp(const string& name) = 0; + virtual ~LoggerRegistry() {} +}; + +LoggerRegistry* GetLoggerRegistry(); + +class RegisterLogger { + public: + RegisterLogger(const string& name, nvinfer1::ILogger* logger) { + TF_CHECK_OK(GetLoggerRegistry()->Register(name, logger)); + } +}; + +#define REGISTER_TENSORRT_LOGGER(name, logger) \ + REGISTER_TENSORRT_LOGGER_UNIQ_HELPER(__COUNTER__, name, logger) +#define REGISTER_TENSORRT_LOGGER_UNIQ_HELPER(ctr, name, logger) \ + REGISTER_TENSORRT_LOGGER_UNIQ(ctr, name, logger) +#define REGISTER_TENSORRT_LOGGER_UNIQ(ctr, name, logger) \ + static ::tensorflow::tensorrt::RegisterLogger register_trt_logger##ctr \ + TF_ATTRIBUTE_UNUSED = \ + ::tensorflow::tensorrt::RegisterLogger(name, logger) + +} // namespace tensorrt +} // namespace tensorflow + +#endif // GOOGLE_CUDA && GOOGLE_TENSORRT +#endif // TENSORFLOW_COMPILER_TF2TENSORRT_CONVERT_LOGGER_REGISTRY_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/convert/op_converter.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/convert/op_converter.h new file mode 100644 index 0000000000000000000000000000000000000000..7ebaaeb1b61b00c6e109765139b43937919fb9a0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/convert/op_converter.h @@ -0,0 +1,224 @@ +/* Copyright 2021 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ +#ifndef TENSORFLOW_COMPILER_TF2TENSORRT_CONVERT_OP_CONVERTER_H_ +#define TENSORFLOW_COMPILER_TF2TENSORRT_CONVERT_OP_CONVERTER_H_ + +#if GOOGLE_CUDA && GOOGLE_TENSORRT + +#include +#include + +#include "absl/strings/str_format.h" +#include "tensorflow/compiler/tf2tensorrt/convert/trt_parameters.h" +#include "tensorflow/compiler/tf2tensorrt/convert/weights.h" + +namespace tensorflow { +namespace tensorrt { +namespace convert { + +class Converter; + +// Specifies the expected type taken by a TRT_TensorOrWeights input during op +// conversion. +// kResource is only used for resource variable ops. For an operation like +// Add(tensor, ReadVariableOp(...)), the second operand of Add is the result of +// the ReadVariableOp, which is a kWeight. +enum class TrtInputArg { kTensor = 1, kWeight = 2, kBoth = 3, kResource = 4 }; + +// Parameters for each op converter. +struct OpConverterParams { + // Constructor used for validation only. + OpConverterParams(const NodeDef& node_def, + const std::vector& inputs, + std::vector* outputs, + TrtWeightStore* weight_store, + TrtPrecisionMode precision_mode, bool use_calibration, + bool use_implicit_batch, bool use_explicit_precision); + + // Constructor used for conversion. + OpConverterParams(Converter* converter, const NodeDef& node_def, + const std::vector& inputs, + std::vector* outputs, + TrtWeightStore* weight_store); + + Converter* converter = nullptr; + const NodeDef& node_def; + const std::vector& inputs; + std::vector* outputs; + const bool validation_only; + TrtWeightStore* weight_store; + const TrtPrecisionMode precision_mode; + const bool use_calibration; + const bool use_implicit_batch; + const bool use_explicit_precision; +}; + +// Operation converter function specification. +using OpConverter = std::function; + +struct InputArgSpec { + absl::string_view name; + TrtInputArg allowed_roles; + + static constexpr InputArgSpec Create(absl::string_view n, TrtInputArg role) { + return InputArgSpec{n, role}; + } +}; + +template +std::string convert_not_supported_dtype_msg(const T& allowed_types, + DataType tf_type, + const NodeDef& node) { + string allowed_types_string = + absl::StrJoin(allowed_types, ", ", [](string* out, const DataType& type) { + absl::StrAppendFormat(out, "%s", DataTypeString(type)); + }); + + return absl::StrCat("Data type ", DataTypeString(tf_type), + " is not supported for ", node.op(), ", must be one of [", + allowed_types_string, "]"); +} + +std::string convert_not_supported_implicit(const std::string& pOpName, + const std::string& pNodeName, + const char* pOpType = NULL); + +// A Curiously recurring template pattern (CRTP) template class for operation +// converters. +template +class OpConverterBase { + public: + explicit OpConverterBase(const OpConverterParams* params, + const std::vector& data_types = + {DataType::DT_FLOAT, DataType::DT_HALF}) + : params_(params), + node_def_attrs_(params->node_def), + allowed_dtypes_(data_types) {} + + // Default NodeDef attribute name to inspect in order to determine node data + // type. The Impl class can override this by implementing the same function. + static constexpr const char* NodeDefDataTypeAttributeName() { return "T"; } + + // Validate data type of the given NodeDef against allowed types. + Status ValidateNodeDefDataType() { + // If the attribute name is empty, we should skip this check. + if (absl::string_view(Impl::NodeDefDataTypeAttributeName()).empty()) { + return OkStatus(); + } + + // Get the NodeDef data type. + auto dtype = GetAttrValue(Impl::NodeDefDataTypeAttributeName()); + if (!dtype.ok()) { + return errors::InvalidArgument("Attribute with name ", + Impl::NodeDefDataTypeAttributeName(), + " not found."); + } + + // Check allowed data types.; + if (std::find(allowed_dtypes_.begin(), allowed_dtypes_.end(), *dtype) == + allowed_dtypes_.end()) { + return errors::Unimplemented(convert_not_supported_dtype_msg( + allowed_dtypes_, *dtype, params_->node_def)); + } + return OkStatus(); + } + + static constexpr bool HasFixNumberOfInputs() { return true; } + + // Validates input argument roles and data types. + Status ValidateInputs() { + const NodeDef& node_def = params_->node_def; + const auto& inputs = params_->inputs; + if (Impl::HasFixNumberOfInputs()) { + TRT_ENSURE(inputs.size() == Impl::InputSpec().size()); + } else { + TRT_ENSURE(inputs.size() <= Impl::InputSpec().size()); + } + for (int i = 0; i < inputs.size(); i++) { + const InputArgSpec arg_spec = Impl::InputSpec()[i]; + if (arg_spec.allowed_roles == TrtInputArg::kWeight && + inputs.at(i).is_tensor()) { + return errors::Unimplemented("The input \"", arg_spec.name, "\" for ", + node_def.op(), " must be a constant, at ", + node_def.name()); + } + if (arg_spec.allowed_roles == TrtInputArg::kTensor && + inputs.at(i).is_weights()) { + return errors::Unimplemented("The input \"", arg_spec.name, "\" for ", + node_def.op(), " must be a tensor, at ", + node_def.name()); + } + } + return OkStatus(); + } + + Status operator()() { + // Validate data type and inputs. + TF_RETURN_IF_ERROR(this->ValidateNodeDefDataType()); + TF_RETURN_IF_ERROR(this->ValidateInputs()); + + // Perform op-level validation. + TF_RETURN_IF_ERROR(reinterpret_cast(this)->Validate()); + if (params_->validation_only) { + return OkStatus(); + } + + // Perform conversion. + return reinterpret_cast(this)->Convert(); + } + + protected: + Status NotSupportedInImplicitBatch(const char* pOpType = nullptr) { + if (params_->use_implicit_batch) { + const auto& op = params_->node_def.op(); + const auto& nodeName = params_->node_def.name(); + const auto& error = convert_not_supported_implicit(op, nodeName, pOpType); + return errors::Unimplemented(error); + } + return OkStatus(); + } + + void AddOutput(const TRT_TensorOrWeights& out) { + params_->outputs->push_back(out); + } + + template + StatusOr GetAttrValue(absl::string_view key) const { + T result; + TF_RETURN_IF_ERROR(GetNodeAttr(node_def_attrs_, key, &result)); + return result; + } + + const OpConverterParams* const params_; + const AttrSlice node_def_attrs_; + const std::vector allowed_dtypes_; +}; + +// Constructs and returns a converter function for a given operation converter +// class T. This requires T to be a derived class of StructuredOpConverter. +template +OpConverter MakeConverterFunction() { + return [](const OpConverterParams* params) -> Status { + T converter(params); + return converter(); + }; +} + +} // namespace convert +} // namespace tensorrt +} // namespace tensorflow + +#endif // GOOGLE_CUDA && GOOGLE_TENSORRT +#endif // TENSORFLOW_COMPILER_TF2TENSORRT_CONVERT_OP_CONVERTER_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/convert/op_converter_registry.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/convert/op_converter_registry.h new file mode 100644 index 0000000000000000000000000000000000000000..8780aa6891b553cd6c0d24ab1d2ab1b6c8cf6f7a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/convert/op_converter_registry.h @@ -0,0 +1,104 @@ +/* Copyright 2021 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ +#ifndef TENSORFLOW_COMPILER_TF2TENSORRT_CONVERT_OP_CONVERTER_REGISTRY_H_ +#define TENSORFLOW_COMPILER_TF2TENSORRT_CONVERT_OP_CONVERTER_REGISTRY_H_ + +#include +#if GOOGLE_CUDA && GOOGLE_TENSORRT + +#include +#include +#include + +#include "tensorflow/compiler/tf2tensorrt/convert/op_converter.h" +#include "tensorflow/core/lib/core/status.h" + +namespace tensorflow { +namespace tensorrt { +namespace convert { + +class OpConverterRegistry { + public: + OpConverterRegistry(); + ~OpConverterRegistry() = default; + + InitOnStartupMarker Register(const string& name, const int priority, + OpConverter converter); + + InitOnStartupMarker Register(const std::initializer_list& names, + const int priority, OpConverter converter) { + for (const auto& name : names) { + Register(name, priority, converter); + } + return {}; + } + + template ::value>::type* = nullptr> + InitOnStartupMarker Register(const T& names, const int priority, + OpConverter converter) { + for (const auto& name : names) { + Register(name, priority, converter); + } + return {}; + } + + // Clear all registered converters for the given Tensorflow operation name. + void Clear(const std::string& name); + + StatusOr LookUp(const string& name); + + std::vector ListRegisteredOps() const; + + private: + class Impl; + std::unique_ptr impl_; +}; + +OpConverterRegistry* GetOpConverterRegistry(); + +class RegisterOpConverter { + public: + RegisterOpConverter(const string& name, const int priority, + OpConverter converter) { + GetOpConverterRegistry()->Register(name, priority, converter); + } +}; + +constexpr int kDefaultConverterPriority = 1; + +} // namespace convert +} // namespace tensorrt + +#define REGISTER_TRT_OP_CONVERTER_IMPL(ctr, func, priority, ...) \ + static ::tensorflow::InitOnStartupMarker const \ + register_trt_op_converter##ctr TF_ATTRIBUTE_UNUSED = \ + TF_INIT_ON_STARTUP_IF(true) \ + << tensorrt::convert::GetOpConverterRegistry()->Register( \ + __VA_ARGS__, priority, func) + +#define REGISTER_TRT_OP_CONVERTER(func, priority, ...) \ + TF_NEW_ID_FOR_INIT(REGISTER_TRT_OP_CONVERTER_IMPL, func, priority, \ + __VA_ARGS__) + +#define REGISTER_DEFAULT_TRT_OP_CONVERTER(func, ...) \ + REGISTER_TRT_OP_CONVERTER( \ + func, tensorrt::convert::kDefaultConverterPriority, __VA_ARGS__) + +} // namespace tensorflow + +#endif // GOOGLE_CUDA && GOOGLE_TENSORRT +#endif // TENSORFLOW_COMPILER_TF2TENSORRT_CONVERT_OP_CONVERTER_REGISTRY_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/convert/ops/layer_utils.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/convert/ops/layer_utils.h new file mode 100644 index 0000000000000000000000000000000000000000..e3aadc279d9528c4002441593e192ead50a499ec --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/convert/ops/layer_utils.h @@ -0,0 +1,715 @@ +/* Copyright 2021 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ +#ifndef TENSORFLOW_COMPILER_TF2TENSORRT_CONVERT_OPS_LAYER_UTILS_H_ +#define TENSORFLOW_COMPILER_TF2TENSORRT_CONVERT_OPS_LAYER_UTILS_H_ +#if GOOGLE_CUDA && GOOGLE_TENSORRT + +#include + +#include "absl/strings/str_cat.h" +#include "tensorflow/compiler/tf2tensorrt/convert/convert_nodes.h" +#include "tensorflow/compiler/tf2tensorrt/convert/utils.h" +#include "tensorflow/core/framework/types.h" +#include "tensorflow/core/platform/statusor.h" +#include "third_party/tensorrt/NvInfer.h" +#include "third_party/tensorrt/NvInferRuntimeCommon.h" + +namespace tensorflow { +namespace tensorrt { + +namespace convert { + +// Facilitates the creation of TensorRT layers inside a network. The user +// provides a INetworkDefinition pointer during construction. They can then add +// operations to the network through the provided functions. Each function +// returns a struct which contains the symbolic result of the operation (ITensor +// pointer) as well as a pointer to the last TensorRT ILayer created. Some +// operations may create multiple layers in order to accomplish the desired +// result (e.g. Sign). +class TRTNetworkBuilder { + public: + static StatusOr Create( + nvinfer1::INetworkDefinition* network, TrtWeightStore* weight_store) { + TRT_ENSURE(network); + TRT_ENSURE(weight_store); + return TRTNetworkBuilder(network, weight_store); + } + + private: + TRTNetworkBuilder(nvinfer1::INetworkDefinition* network, + TrtWeightStore* weight_store) + : network_(network), weight_store_(weight_store) {} + + public: + // Adds an Add operation to the network. + StatusOr Add(nvinfer1::ITensor* lhs, + nvinfer1::ITensor* rhs) noexcept { + TRT_ENSURE(lhs); + TRT_ENSURE(rhs); + nvinfer1::IElementWiseLayer* layer = network_->addElementWise( + *lhs, *rhs, nvinfer1::ElementWiseOperation::kSUM); + TRT_ENSURE(layer); + return layer; + }; + + // Adds an elementwise min(lhs, rhs) operation to the network. The output has + // the same data type as the input. + StatusOr Min(nvinfer1::ITensor* lhs, + nvinfer1::ITensor* rhs) noexcept { + TRT_ENSURE(lhs); + TRT_ENSURE(rhs); + nvinfer1::IElementWiseLayer* layer = network_->addElementWise( + *lhs, *rhs, nvinfer1::ElementWiseOperation::kMIN); + TRT_ENSURE(layer); + return layer; + }; + + // Adds an elementwise max(lhs, rhs) operation to the network. The output has + // the same datatype as the input. + StatusOr Max(nvinfer1::ITensor* lhs, + nvinfer1::ITensor* rhs) noexcept { + TRT_ENSURE(lhs); + TRT_ENSURE(rhs); + nvinfer1::IElementWiseLayer* layer = network_->addElementWise( + *lhs, *rhs, nvinfer1::ElementWiseOperation::kMAX); + TRT_ENSURE(layer); + return layer; + }; + + // Adds an absolute value operation to the network. Note that this unary + // operation will do an implict float conversion. For int32 tensors, use + // "AbsInt". + StatusOr AbsFloat(nvinfer1::ITensor* input) noexcept { + TRT_ENSURE(input); + TRT_ENSURE(input->getType() != nvinfer1::DataType::kFLOAT && + input->getType() != nvinfer1::DataType::kHALF); + nvinfer1::IUnaryLayer* layer = + network_->addUnary(*input, nvinfer1::UnaryOperation::kABS); + TRT_ENSURE(layer); + return layer; + } + + // Performs Abs without implict float conversion. The input should be of type + // kInt32. For float datatypes, use "Abs". + StatusOr AbsInt( + nvinfer1::ITensor* input) noexcept { + TRT_ENSURE(input); + TRT_ENSURE(input->getType() == nvinfer1::DataType::kINT32); + StatusOr sign = this->SignInt(input); + return this->Mul(input, (*sign)->getOutput(0)); + } + + // Returns elementwise sign(x) for int32 input tensors where sign(x) is + // defined as 1 where x > 0, -1 where x < 0 and 0 where x == 0. + StatusOr SignInt( + nvinfer1::ITensor* input) noexcept { + TRT_ENSURE(input); + + // Create constants +1 and -1. + StatusOr one = + this->Constant(1, input->getDimensions().nbDims); + TRT_ENSURE_PTR_OK(one); + + StatusOr neg_one = + this->Constant(-1, input->getDimensions().nbDims); + TRT_ENSURE_PTR_OK(neg_one); + + // Turn all negaitve elements into -1, positive and zero elements + // unaffected. + StatusOr max = + this->Max(input, (*neg_one)->getOutput(0)); + TRT_ENSURE_PTR_OK(max); + + // Turn all positive elements into +1, negative and zero elements + // unaffected. + StatusOr min = + this->Min((*max)->getOutput(0), (*one)->getOutput(0)); + TRT_ENSURE_PTR_OK(min); + return min; + } + + // Adds a Sub operation to the network. + StatusOr Sub(nvinfer1::ITensor* lhs, + nvinfer1::ITensor* rhs) noexcept { + TRT_ENSURE(lhs); + TRT_ENSURE(rhs); + nvinfer1::IElementWiseLayer* layer = network_->addElementWise( + *lhs, *rhs, nvinfer1::ElementWiseOperation::kSUB); + TRT_ENSURE(layer); + return layer; + } + + // Adds an Greater operation to the network. + StatusOr Greater( + nvinfer1::ITensor* lhs, nvinfer1::ITensor* rhs) noexcept { + TRT_ENSURE(lhs); + TRT_ENSURE(rhs); + nvinfer1::IElementWiseLayer* layer = network_->addElementWise( + *lhs, *rhs, nvinfer1::ElementWiseOperation::kGREATER); + TRT_ENSURE(layer); + return layer; + } + + // Adds an Equal operation to the network. + StatusOr Equal( + nvinfer1::ITensor* lhs, nvinfer1::ITensor* rhs) noexcept { + TRT_ENSURE(lhs); + TRT_ENSURE(rhs); + nvinfer1::IElementWiseLayer* layer = network_->addElementWise( + *lhs, *rhs, nvinfer1::ElementWiseOperation::kEQUAL); + TRT_ENSURE(layer); + return layer; + } + + // Adds a FloorDiv operation to the network. + StatusOr FloorDiv( + nvinfer1::ITensor* lhs, nvinfer1::ITensor* rhs) noexcept { + TRT_ENSURE(lhs); + TRT_ENSURE(rhs); + nvinfer1::IElementWiseLayer* layer = network_->addElementWise( + *lhs, *rhs, nvinfer1::ElementWiseOperation::kFLOOR_DIV); + TRT_ENSURE(layer); + return layer; + } + + // Returns the equivalent of ceil_divide(abs(x)/abs(y))) operation. The inputs + // "lhs" and "rhs" should be int32 tensors. + StatusOr AbsCeilDivInt( + nvinfer1::ITensor* lhs, nvinfer1::ITensor* rhs) noexcept { + TRT_ENSURE(lhs); + TRT_ENSURE(rhs); + TRT_ENSURE(lhs->getType() == nvinfer1::DataType::kINT32); + TRT_ENSURE(rhs->getType() == nvinfer1::DataType::kINT32); + + StatusOr rhs_abs = this->AbsInt(rhs); + TRT_ENSURE_PTR_OK(rhs_abs); + StatusOr lhs_abs = this->AbsInt(lhs); + TRT_ENSURE_PTR_OK(lhs_abs); + StatusOr add1 = + this->Add((*lhs_abs)->getOutput(0), (*rhs_abs)->getOutput(0)); + TRT_ENSURE_PTR_OK(add1); + StatusOr one_const = + this->Constant(1, rhs->getDimensions().nbDims); + TRT_ENSURE_PTR_OK(one_const); + StatusOr numerator = + this->Sub((*add1)->getOutput(0), (*one_const)->getOutput(0)); + TRT_ENSURE_PTR_OK(numerator); + return FloorDiv((*numerator)->getOutput(0), (*rhs_abs)->getOutput(0)); + } + + // Adds an elementwise multiplication operation to the network. + StatusOr Mul(nvinfer1::ITensor* lhs, + nvinfer1::ITensor* rhs) noexcept { + TRT_ENSURE(lhs); + TRT_ENSURE(rhs); + nvinfer1::IElementWiseLayer* layer = network_->addElementWise( + *lhs, *rhs, nvinfer1::ElementWiseOperation::kPROD); + TRT_ENSURE(layer); + return layer; + } + + // Adds a sequence of elementwise multiplication operations to the network. + // The returned layer's output contains the cumulative elementwise product of + // all tensors in the input. + StatusOr CumulativeProd( + absl::Span inputs) noexcept { + TRT_ENSURE(!absl::c_any_of( + inputs, [](nvinfer1::ITensor* x) { return x == nullptr; })); + nvinfer1::ILayer* out = nullptr; + if (inputs.size() == 1) { + out = network_->addIdentity(*inputs[0]); + TRT_ENSURE(out != nullptr); + return out; + } + nvinfer1::ITensor* last = inputs[0]; + for (int i = 1; i < inputs.size(); i++) { + StatusOr mul = this->Mul(last, inputs[i]); + TRT_ENSURE_PTR_OK(mul); + out = *mul; + last = (*mul)->getOutput(0); + } + return out; + } + + // Adds a Constant layer whose output is a TensorRT shape tensor. The shape + // tensor's size and values correspond to dim's nbDims and d[], respectively. + StatusOr ConstantShape( + const DimsAdapter& shape_data) noexcept { + TRT_ENSURE(shape_data.NumDims() > 0); + nvinfer1::Dims shape_dims; + shape_dims.nbDims = 1; + shape_dims.d[0] = shape_data.NumDims(); + StatusOr const_weights = + weight_store_->GetTempWeights(nvinfer1::DataType::kINT32, shape_dims); + TRT_ENSURE_OK(const_weights); + absl::c_copy(shape_data, const_weights->GetPointer()); + StatusOr trt_dims = const_weights->Shape().AsTrtDims(); + TRT_ENSURE_OK(trt_dims); + nvinfer1::IConstantLayer* const_layer = + network_->addConstant(*trt_dims, const_weights->GetTrtWeights()); + TRT_ENSURE(const_layer); + nvinfer1::ITensor* output = const_layer->getOutput(0); + TRT_ENSURE(output); + TRT_ENSURE(output->getType() == nvinfer1::DataType::kINT32); + return const_layer; + } + + // Adds a Constant layer whose output is a TensorRT shape tensor. The shape + // tensor's size and values correspond to dim's nbDims and d[], respectively. + StatusOr Constant( + const std::vector& data) noexcept { + nvinfer1::Dims shape_dims; + shape_dims.nbDims = 1; + shape_dims.d[0] = data.size(); + StatusOr const_weights = + weight_store_->GetTempWeights(nvinfer1::DataType::kINT32, shape_dims); + TRT_ENSURE_OK(const_weights); + int32* values = const_weights->GetPointer(); + for (int i = 0; i < data.size(); i++) { + values[i] = static_cast(data[i]); + } + StatusOr trt_dims = const_weights->Shape().AsTrtDims(); + TRT_ENSURE_OK(trt_dims); + nvinfer1::IConstantLayer* const_layer = + network_->addConstant(*trt_dims, const_weights->GetTrtWeights()); + TRT_ENSURE(const_layer); + nvinfer1::ITensor* output = const_layer->getOutput(0); + TRT_ENSURE(output); + TRT_ENSURE(output->getType() == nvinfer1::DataType::kINT32); + TRT_ENSURE(const_layer); + return const_layer; + } + + // Adds a Constant layer that produces a tensor of shape "shape", + // type "data_type" and filled with value "scalar". + template + StatusOr Constant( + const T value, nvinfer1::Dims shape, + nvinfer1::DataType data_type) noexcept { + StatusOr const_weights = + weight_store_->GetTempWeights(data_type, shape); + TRT_ENSURE_OK(const_weights); + TRT_ENSURE(const_weights->SetValues(value).ok()); + nvinfer1::IConstantLayer* const_layer = + network_->addConstant(shape, const_weights->GetTrtWeights()); + TRT_ENSURE(const_layer); + return const_layer; + } + + // Adds a Constant layer that produces a tensor with a single value "scalar". + // The tensor has "nb_dims" dimensions and each dimension has only one + // element. The data type of the tensor is determined by the data type of + // "scalar". + template ::value>::type* = nullptr> + StatusOr Constant(const T scalar, + const int nb_dims) noexcept { + TRT_ENSURE(nb_dims <= nvinfer1::Dims::MAX_DIMS); + auto data_type = nvinfer1::DataType::kINT32; + if (std::is_floating_point::value) { + data_type = nvinfer1::DataType::kFLOAT; + } + nvinfer1::Dims zero_shape; + zero_shape.nbDims = nb_dims; + std::fill_n(zero_shape.d, nb_dims, 1); + return Constant(scalar, zero_shape, data_type); + } + + // Adds a Constant layer from a TRT_ShapedWeights object. + StatusOr WeightsToConstant( + const nvinfer1::Weights& weights, const DimsAdapter& dims) noexcept { + StatusOr vol = dims.Volume(); + TRT_ENSURE_OK(vol); + TRT_ENSURE(*vol == weights.count); + StatusOr trt_dims = dims.AsTrtDims(); + TRT_ENSURE_OK(trt_dims); + nvinfer1::IConstantLayer* const_layer = + network_->addConstant(*trt_dims, weights); + TRT_ENSURE(const_layer); + return const_layer; + } + + Status get_tensor4TensorOrWeights(const TRT_TensorOrWeights& input, + ITensorProxyPtr* pTensor) { + if (input.is_weights()) { + StatusOr const_layer = WeightsToConstant( + input.weights().GetTrtWeights(), input.GetTrtDims()); + if (!const_layer.status().ok()) return const_layer.status(); + *pTensor = (*const_layer)->getOutput(0); + } else { + *pTensor = input.tensor(); + } + return OkStatus(); + } + + // Creates a nvinfer1::Weights object containing a single scalar. + template ::value>::type* = nullptr> + StatusOr ScalarWeights(const T scalar, + const int nb_dims) noexcept { + TRT_ENSURE(nb_dims <= nvinfer1::Dims::MAX_DIMS); + auto data_type = nvinfer1::DataType::kINT32; + if (std::is_floating_point::value) { + data_type = nvinfer1::DataType::kFLOAT; + } + nvinfer1::Dims weights_shape; + weights_shape.nbDims = nb_dims; + std::fill_n(weights_shape.d, nb_dims, 1); + StatusOr const_weights = + weight_store_->GetTempWeights(data_type, weights_shape); + TRT_ENSURE_OK(const_weights); + const_weights->GetPointer()[0] = scalar; + return const_weights->GetTrtWeights(); + } + + // Adds a TensorRT Slice operation to the network. + StatusOr Slice( + nvinfer1::ITensor* input, const nvinfer1::Dims& begin, + const nvinfer1::Dims& size, const nvinfer1::Dims& stride) noexcept { + nvinfer1::ISliceLayer* layer = + network_->addSlice(*input, begin, size, stride); + TRT_ENSURE(layer); + return layer; + } + + // Adds a TensorRT Concatenate operation to the network. + StatusOr Concat( + absl::Span inputs, const int axis) { + for (nvinfer1::ITensor* input : inputs) { + TRT_ENSURE(input); + } + nvinfer1::IConcatenationLayer* layer = network_->addConcatenation( + inputs.data(), static_cast(inputs.size())); + TRT_ENSURE(layer); + layer->setAxis(axis); + return layer; + } + + // Adds a TensorRT Concatenate operation to the network. + StatusOr Concat( + const std::vector& inputs, const int axis) { + return this->Concat(absl::MakeSpan(inputs), axis); + } + + // Adds a TensorRT Shape operation, which determines the runtime shape of the + // input tensor, to the network. + StatusOr Shape(nvinfer1::ITensor* input) { + TRT_ENSURE(input); + nvinfer1::IShapeLayer* layer = network_->addShape(*input); + TRT_ENSURE(layer); + return layer; + } + + // Creates a Gather operation on the shape of the input tensor. The output of + // the gather operation is a 1D shape tensor where output[i] = (!sub_one ? + // input_shape[i] : input_shape[i] -1) if i is in "indices", otherwise zero. + StatusOr GetPartialShapeOf( + nvinfer1::ITensor* input, absl::InlinedVector indices, + bool sub_one = false) { + TRT_ENSURE(input); + TRT_ENSURE(indices.size() <= nvinfer1::Dims::MAX_DIMS); + + // Get the runtime shape of input; + StatusOr shape_layer = this->Shape(input); + TRT_ENSURE_PTR_OK(shape_layer); + nvinfer1::ITensor* runtime_shape = (*shape_layer)->getOutput(0); + + if (sub_one) { + StatusOr ones = this->Constant(1, 1); + TRT_ENSURE_PTR_OK(ones); + StatusOr sub = + this->Sub(runtime_shape, (*ones)->getOutput(0)); + TRT_ENSURE_PTR_OK(sub); + runtime_shape = (*sub)->getOutput(0); + } + + // Create a constant tensor containing the gather indices. + // For any dim not in "indices", we mark it size to gather a zero. + const int input_nb_dims = input->getDimensions().nbDims; + std::vector indices_all(input_nb_dims, input_nb_dims); + for (auto idx : indices) { + TRT_ENSURE(idx < input_nb_dims); + indices_all[idx] = idx; + } + + StatusOr indices_result = + this->Constant(indices_all); + TRT_ENSURE_PTR_OK(indices_result); + nvinfer1::ITensor* gather_indices = (*indices_result)->getOutput(0); + TRT_ENSURE(gather_indices->getDimensions().nbDims == 1); + TRT_ENSURE(gather_indices->getType() == nvinfer1::DataType::kINT32); + + // Append a zero to the shape tensor. + StatusOr zero_result = + this->Constant(std::vector{0}); + TRT_ENSURE_PTR_OK(zero_result); + std::array cat_inputs = { + runtime_shape, (*zero_result)->getOutput(0)}; + nvinfer1::IConcatenationLayer* cat_layer = + network_->addConcatenation(cat_inputs.data(), cat_inputs.size()); + TRT_ENSURE(cat_layer); + nvinfer1::ITensor* gather_input = cat_layer->getOutput(0); + TRT_ENSURE(gather_input); + + // Finally, gather the indices from the input. + nvinfer1::IGatherLayer* gather = + network_->addGather(*gather_input, *gather_indices, 0); + TRT_ENSURE(gather); + return gather; + } + + // Adds a scale layer that uniformly scales the input tensor by the specified + // amount. + StatusOr AddUniformScale(nvinfer1::ITensor* input, + float scale, + const std::string& name) { + TRT_ENSURE(input); + TRT_ENSURE(!name.empty()); + StatusOr weight = this->ScalarWeights(scale, 1); + TRT_ENSURE_OK(weight); + const nvinfer1::Weights empty_weights = + nvinfer1::Weights{nvinfer1::DataType::kFLOAT, nullptr, 0}; + nvinfer1::IScaleLayer* scale_layer = + network_->addScale(*input, nvinfer1::ScaleMode::kUNIFORM, empty_weights, + (*weight), empty_weights); + TRT_ENSURE(scale_layer != nullptr); + scale_layer->setName(name.c_str()); + TRT_ENSURE((*scale_layer).getPower().count == 0); + TRT_ENSURE((*scale_layer).getShift().count == 0); + TRT_ENSURE((*scale_layer).getScale().count == 1); + return scale_layer; + } + + StatusOr AddFill(const TRT_TensorOrWeights& value_input, + const TRT_TensorOrWeights& dims_input, + bool is_value_static, bool is_dims_static, + int nbDims, + const nvinfer1::Dims& trt_dims, + ITensorProxyPtr scalar_tensor = nullptr, + ITensorProxyPtr beta_tensor = nullptr, + const float delta = 0) { + // TensorRT IFillLayer requires a rank 0 scalar. + nvinfer1::Dims scalar_dims; + scalar_dims.nbDims = 0; + if (is_value_static) { + StatusOr const_layer = + WeightsToConstant(value_input.weights().GetTrtWeights(), scalar_dims); + if (!const_layer.status().ok()) return const_layer.status(); + scalar_tensor = (*const_layer)->getOutput(0); + } else { + if (scalar_tensor == nullptr) { + StatusOr shuffler_layer = + Reshape(value_input.tensor()->trt_tensor(), scalar_dims); + if (!shuffler_layer.status().ok()) return shuffler_layer.status(); + scalar_tensor = (*shuffler_layer)->getOutput(0); + } + } + + if (beta_tensor == nullptr) { + nvinfer1::Dims beta_shape{1, {nbDims}}; + StatusOr const_layer = + Constant(delta, beta_shape, value_input.TrtDType()); + TF_RETURN_IF_ERROR(const_layer.status()); + beta_tensor = (*const_layer)->getOutput(0); + } + + nvinfer1::IFillLayer* layer = + network_->addFill(trt_dims, nvinfer1::FillOperation::kLINSPACE); + TRT_ENSURE(layer); + if (!is_dims_static) { + layer->setInput(0, *dims_input.tensor()->trt_tensor()); + } + layer->setInput(1, *scalar_tensor->trt_tensor()); + layer->setInput(2, *beta_tensor->trt_tensor()); + return layer; + } + + // Adds a quantization layer that uniformly scales the input tensor + // by the given multiplicative "scaling_factor", then rounds + // (round-to-nearest-ties-to-even) to the nearest integer and clamps in the + // range of [-128, 127]. + StatusOr Quantize(nvinfer1::ITensor* input, + const float scaling_factor, + const std::string& name) { + TRT_ENSURE(input); + TRT_ENSURE(!name.empty()); + // Preprocessor usage here is unavoidable because TRT8 API is new. +#if IS_TRT_VERSION_GE(8, 0, 0, 0) + // The TensorRT IQuantizeLayer divides by the scale factor rather than + // multiplies. To be consistent, in this function we expect a multiplicative + // scale factor, so we take the reciprical. + StatusOr scaling_const = + this->Constant(1.0f / scaling_factor, 1); + TRT_ENSURE_PTR_OK(scaling_const); + (*scaling_const)->setDimensions(nvinfer1::Dims{0, {}}); + nvinfer1::IQuantizeLayer* quant_layer = + network_->addQuantize(*input, *(*scaling_const)->getOutput(0)); + TRT_ENSURE(quant_layer); + quant_layer->setAxis(1); + return quant_layer; +#else + StatusOr result = + this->AddUniformScale(input, scaling_factor, name); + TRT_ENSURE_PTR_OK(result); + (*result)->setOutputType(0, nvinfer1::DataType::kINT8); + (*result)->setPrecision(nvinfer1::DataType::kFLOAT); + return result; +#endif + } + + // Adds a dequantize layer that casts the input tensor to TensorRT float type + // and scales it uniformly by the given multiplicative "scaling_factor". + StatusOr Dequantize(nvinfer1::ITensor* input, + const float scaling_factor, + const std::string& name) { + TRT_ENSURE(input); + TRT_ENSURE(!name.empty()); +#if IS_TRT_VERSION_GE(8, 0, 0, 0) + StatusOr scaling_const = + this->Constant(scaling_factor, 1); + TRT_ENSURE_PTR_OK(scaling_const); + (*scaling_const)->setDimensions(nvinfer1::Dims{0, {}}); + nvinfer1::IDequantizeLayer* dequant_layer = + network_->addDequantize(*input, *(*scaling_const)->getOutput(0)); + dequant_layer->setAxis(1); + TRT_ENSURE(dequant_layer); + return dequant_layer; +#else + StatusOr result = + this->AddUniformScale(input, scaling_factor, name); + TRT_ENSURE_PTR_OK(result); + (*result)->setOutputType(0, nvinfer1::DataType::kFLOAT); + (*result)->setPrecision(nvinfer1::DataType::kINT8); + return result; +#endif + } + + // Adds TensorRT Q/DQ operations. This is for explicit precision mode. + StatusOr UniformQuantizeDequantizeExplicit( + nvinfer1::ITensor* input, float quantize_scale, float dequantize_scale, + const std::string& name) { + TRT_ENSURE(input); + if (!IS_TRT_VERSION_GE(8, 0, 0, 0)) { + TRT_ENSURE(network_->hasExplicitPrecision()); + } + TRT_ENSURE(IS_TRT_VERSION_GE(7, 1, 0, 0)); + + static int count = 0; + TRT_ENSURE(input->getType() == nvinfer1::DataType::kFLOAT); + std::string quant_name = absl::StrCat(input->getName(), "_quant_", count); + + StatusOr quant = + this->Quantize(input, quantize_scale, quant_name); + TRT_ENSURE_PTR_OK(quant); + + std::string dequant_name = + absl::StrCat(input->getName(), "_dequant_", count); + StatusOr dequant = this->Dequantize( + (*quant)->getOutput(0), dequantize_scale, dequant_name); + TRT_ENSURE_PTR_OK(dequant); + + count++; + return dequant; + } + + StatusOr Reshape(nvinfer1::ITensor* input, + const nvinfer1::Dims& new_shape) { + TRT_ENSURE(input); + nvinfer1::IShuffleLayer* layer = network_->addShuffle(*input); + TRT_ENSURE(layer); + layer->setReshapeDimensions(new_shape); + return layer; + } + + StatusOr FindProducerOf(const nvinfer1::ITensor* tensor) { + const char* name = tensor->getName(); + const int num_layers = network_->getNbLayers(); + for (int i = 0; i < num_layers; i++) { + nvinfer1::ILayer* layer = network_->getLayer(i); + const int num_outputs = layer->getNbOutputs(); + for (int j = 0; j < num_outputs; j++) { + nvinfer1::ITensor* t = layer->getOutput(j); + if (std::string(t->getName()) == name) { + return layer; + } + } + } + return errors::NotFound("could not find producing layer of ", name); + } + + StatusOr UniqueParentOf(const nvinfer1::ILayer* layer, + int input_idx = 0) { + return FindProducerOf(layer->getInput(input_idx)); + } + + nvinfer1::INetworkDefinition* Network() { return network_; } + + private: + nvinfer1::INetworkDefinition* network_; + TrtWeightStore* weight_store_; +}; + +class ShuffleBuilder { + private: + explicit ShuffleBuilder(TRTNetworkBuilder* builder, nvinfer1::ITensor* input) + : builder_(builder) { + layer_ = builder->Network()->addShuffle(*input); + } + + public: + static StatusOr Create(TRTNetworkBuilder* builder, + nvinfer1::ITensor* input) { + TRT_ENSURE(builder != nullptr); + TRT_ENSURE(input != nullptr); + return ShuffleBuilder(builder, input); + } + + ShuffleBuilder& SetReshape(const nvinfer1::Dims& dims) { + layer_->setReshapeDimensions(dims); + return *this; + } + + ShuffleBuilder& SetReshape(nvinfer1::ITensor* shape) { + layer_->setInput(1, *shape); + return *this; + } + + ShuffleBuilder& SetFirstTranspose(const nvinfer1::Permutation& perm) { + layer_->setFirstTranspose(perm); + return *this; + } + + ShuffleBuilder& SetSecondTranspose(const nvinfer1::Permutation& perm) { + layer_->setSecondTranspose(perm); + return *this; + } + + StatusOr Output() { + TRT_ENSURE(layer_ != nullptr); + TRT_ENSURE(layer_->getOutput(0) != nullptr); + return layer_->getOutput(0); + } + + private: + TRTNetworkBuilder* builder_; + nvinfer1::IShuffleLayer* layer_; +}; + +} // namespace convert +} // namespace tensorrt +} // namespace tensorflow + +#endif // GOOGLE_CUDA && GOOGLE_TENSORRT +#endif // TENSORFLOW_COMPILER_TF2TENSORRT_CONVERT_OPS_LAYER_UTILS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/convert/ops/quantization_ops.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/convert/ops/quantization_ops.h new file mode 100644 index 0000000000000000000000000000000000000000..280dc1e79f5155114d94f23ea658d0522a79981c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/convert/ops/quantization_ops.h @@ -0,0 +1,76 @@ +/* Copyright 2021 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ +#ifndef TENSORFLOW_COMPILER_TF2TENSORRT_CONVERT_OPS_QUANTIZATION_OPS_H_ +#define TENSORFLOW_COMPILER_TF2TENSORRT_CONVERT_OPS_QUANTIZATION_OPS_H_ +#if GOOGLE_CUDA && GOOGLE_TENSORRT + +#include "absl/strings/str_format.h" +#include "absl/strings/str_join.h" +#include "tensorflow/core/graph/graph.h" +#include "tensorflow/core/lib/core/status.h" + +namespace tensorflow { +namespace tensorrt { +namespace convert { + +constexpr std::array kQuantizationOpNames = { + "QuantizeAndDequantizeV2", + "QuantizeAndDequantizeV3", + "FakeQuantWithMinMaxVars", + "FakeQuantWithMinMaxArgs", +}; + +// Operations with supported conversion to Q/DQ ops in TensorRT explicit +// precision mode. +constexpr std::array kExplicitQuantizationOpNames = { + "QuantizeAndDequantizeV2", +}; + +// Contains two scaling factors for quantization and dequantization +// respectively. A shift factor is omitted as TensorRT only supports symmetric +// quantization. +template +struct QuantizationScales { + std::array quantize_scale; + std::array dequantize_scale; +}; + +// In TensorRT 7 and 8, only uniform tensor scaling is supported for +// activations. +using UniformQuantizationScales = QuantizationScales; + +// Per-channel scaling is supported for weights in TensorRT version >= 8.0. +template +using PerChannelQuantizationScales = QuantizationScales; + +template +std::ostream& operator<<(std::ostream& os, + const QuantizationScales& scales) { + os << absl::StrFormat("QuantizationScales[quantize={%s},dequantize={%s}]", + absl::StrJoin(scales.quantize_scale, ","), + absl::StrJoin(scales.dequantize_scale, ",")); + return os; +} + +// Returns true if the Tensorflow node is a quantize and dequantize operation. +bool IsQuantizeAndDequantizeOp(const Node*); + +} // namespace convert +} // namespace tensorrt +} // namespace tensorflow + +#endif // GOOGLE_CUDA && GOOGLE_TENSORRT + +#endif // TENSORFLOW_COMPILER_TF2TENSORRT_CONVERT_OPS_QUANTIZATION_OPS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/convert/ops/slice_ops.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/convert/ops/slice_ops.h new file mode 100644 index 0000000000000000000000000000000000000000..4dd281ae844f6830b936d12b6214cc2b4e8d060a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/convert/ops/slice_ops.h @@ -0,0 +1,70 @@ +/* Copyright 2021 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ +#ifndef TENSORFLOW_COMPILER_TF2TENSORRT_CONVERT_OPS_SLICE_OPS_H_ +#define TENSORFLOW_COMPILER_TF2TENSORRT_CONVERT_OPS_SLICE_OPS_H_ +#if GOOGLE_CUDA && GOOGLE_TENSORRT + +#include "tensorflow/compiler/tf2tensorrt/convert/convert_nodes.h" +#include "tensorflow/core/lib/core/status.h" +#include "tensorflow/core/util/strided_slice_op.h" + +namespace tensorflow { +namespace tensorrt { +namespace convert { +using SliceDims = absl::InlinedVector; + +// Creates a strided slice operation using the given information. This function +// expects that the begin, stride, and end vectors have already been validated. +// This function converts the [begin:stride:end] specification to the TensorRT +// [begin:stride:size] ISliceLayer specification. The following algorithm is +// used to perform this conversion: 1) The given (input_dims, +// [begin:stride:end]) specification is dividied into +// "static dimensions" and "dynamic dimensions". "Dynamic dimensions" +// includes all dimensions of the slice where input_dims[i] == -1. +// 2a) If there are no dynamic dimensions, then the "begin", "stride", and +// "size" variables are passed to the ISLiceLayer creation as build-time +// constants in the form of nvinfer1::Dims objects. +// 2b) If there are any dynamic dimensions, then the "begin", "stride", and +// "size" variables are treated as runtime dynamic shape Tensors in the +// TensorRT graph. In this case, we must calculate "size" at runtime for all +// dynamic dimensions, while static dimensions use the constant values. +// +// Note that when any dynamic indices are present (2b), the "strided_slice_spec" +// must be specified. This structure can be obtained through the +// "tensorflow::ValidateStridedSliceOp" function, or it can be constructed +// directly. When the ValidateStridedSliceOp helper function is used, it will +// also return the "begin", "stride", and "end" vectors. When all dimensions are +// static (2a), the "strided_slice_spec" variable is not required. +// +// If the "final_shape" variable is specified, then a reshape operation will be +// added to the graph to achieve this shape. The shape must be fully specified. +// +// "op_instance" is only required if the caller needs to pass this variable +// through to the Converter functions optionally accept it (SetLayerName, +// PrepareTensorForShape). +Status ConvertStridedSliceHelper( + const OpConverterParams* params, const TRT_TensorOrWeights& input, + const PartialTensorShape& input_dims, const SliceDims& begin, + const SliceDims& stride, const SliceDims& end, + std::optional final_shape = std::nullopt, + std::optional op_instance = std::nullopt, + std::optional strided_slice_spec = std::nullopt); + +} // namespace convert +} // namespace tensorrt +} // namespace tensorflow + +#endif // GOOGLE_CUDA && GOOGLE_TENSORRT +#endif // TENSORFLOW_COMPILER_TF2TENSORRT_CONVERT_OPS_SLICE_OPS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/convert/timing_cache.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/convert/timing_cache.h new file mode 100644 index 0000000000000000000000000000000000000000..4d43b1d0086235ce8dd41af7241d5c9d554252a6 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/convert/timing_cache.h @@ -0,0 +1,70 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ +#ifndef TENSORFLOW_COMPILER_TF2TENSORRT_CONVERT_TIMING_CACHE_H_ +#define TENSORFLOW_COMPILER_TF2TENSORRT_CONVERT_TIMING_CACHE_H_ +#if GOOGLE_CUDA && GOOGLE_TENSORRT +#include + +#include "tensorflow/compiler/tf2tensorrt/common/utils.h" +#include "tensorflow/core/framework/registration/registration.h" +#include "tensorflow/core/platform/mutex.h" +#include "tensorflow/core/platform/statusor.h" +#include "third_party/tensorrt/NvInfer.h" + +namespace tensorflow { +namespace tensorrt { +namespace convert { + +// A registry for holding serialized TensorRT autotuner timing caches. +// For TensorRT versions < 8.0, the timing cache is not serializable, so these +// operations become no-ops. +class TimingCacheRegistry { + public: + TimingCacheRegistry() = default; + ~TimingCacheRegistry() = default; + +#if IS_TRT_VERSION_GE(8, 0, 0, 0) + using TimingCache = nvinfer1::ITimingCache; + using TimingCachePtr = std::unique_ptr; +#else + struct TimingCache {}; + using TimingCachePtr = std::unique_ptr; +#endif + + // Insert or update a registry into the map using the given name. The cache + // will be serialized before being placed into the map. + void Upsert(const string& name, TimingCache* cache); + + // Find a timing cache using the given name. The provided BuilderConfig is + // used to deserialize the cache. If no timing cache is found, a new timing + // cache is returned. + StatusOr LookUp(const string& name, + nvinfer1::IBuilderConfig* builder_config); + + private: + using SerializedTimingCache = std::vector; + + mutex mu_; + std::unordered_map map_; +}; + +TimingCacheRegistry* GetTimingCacheRegistry(); + +} // namespace convert +} // namespace tensorrt +} // namespace tensorflow + +#endif // GOOGLE_CUDA && GOOGLE_TENSORRT +#endif // TENSORFLOW_COMPILER_TF2TENSORRT_CONVERT_TIMING_CACHE_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/convert/trt_optimization_pass.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/convert/trt_optimization_pass.h new file mode 100644 index 0000000000000000000000000000000000000000..abc3bdce4bb129ea6435d0644294106ab38296d9 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/convert/trt_optimization_pass.h @@ -0,0 +1,87 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_TF2TENSORRT_CONVERT_TRT_OPTIMIZATION_PASS_H_ +#define TENSORFLOW_COMPILER_TF2TENSORRT_CONVERT_TRT_OPTIMIZATION_PASS_H_ + +#include +#include + +#include "tensorflow/compiler/tf2tensorrt/convert/trt_parameters.h" +#include "tensorflow/compiler/tf2tensorrt/convert/utils.h" +#include "tensorflow/core/framework/graph.pb.h" +#include "tensorflow/core/grappler/costs/graph_properties.h" +#include "tensorflow/core/grappler/optimizers/custom_graph_optimizer.h" +#include "tensorflow/core/grappler/utils.h" +#include "tensorflow/core/platform/logging.h" + +#if GOOGLE_CUDA && GOOGLE_TENSORRT + +#if !IS_TRT_VERSION_GE(7, 0, 0, 0) +#error From version 2.6, we only support NVIDIA TensorRT version 7 or newer. +#error Please update your environment and relaunch the compilation. +#endif + +namespace tensorflow { +namespace tensorrt { +namespace convert { + +class TRTOptimizationPass : public grappler::CustomGraphOptimizer { + public: + struct ConversionParams { + string trt_logger_name = "DefaultLogger"; + size_t max_batch_size = -1; + size_t max_workspace_size_bytes = 1 << 30; + TrtPrecisionMode precision_mode = TrtPrecisionMode::FP32; + int minimum_segment_size = 3; + // Whether to create engine on conversion or execution time + bool is_dynamic_op = false; + // maximum number of cached engines + int max_cached_engines = 1; + bool use_calibration = true; + bool use_implicit_batch = true; + ProfileStrategy profile_strategy = ProfileStrategy::kRange; + bool allow_build_at_runtime = true; + bool use_explicit_precision = false; + }; + + TRTOptimizationPass(const string& name = "TRTOptimizationPass") + : name_(name) {} + + string name() const override { return name_; }; + + bool UsesFunctionLibrary() const override { return true; } + + Status Init( + const RewriterConfig_CustomGraphOptimizer* config = nullptr) override; + + Status Optimize(grappler::Cluster* cluster, + const grappler::GrapplerItem& item, + GraphDef* optimized_graph) override; + + private: + const string name_; + + ConversionParams params_; + + std::vector batches_; +}; + +} // namespace convert +} // namespace tensorrt +} // namespace tensorflow + +#endif // GOOGLE_CUDA && GOOGLE_TENSORRT +#endif // TENSORFLOW_COMPILER_TF2TENSORRT_CONVERT_TRT_OPTIMIZATION_PASS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/convert/trt_parameters.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/convert/trt_parameters.h new file mode 100644 index 0000000000000000000000000000000000000000..3f44bb5f1990e81a9e150d5ee9bcc66cbb8d4389 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/convert/trt_parameters.h @@ -0,0 +1,72 @@ +/* Copyright 2021 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_TF2TENSORRT_CONVERT_TRT_PARAMETERS_H_ +#define TENSORFLOW_COMPILER_TF2TENSORRT_CONVERT_TRT_PARAMETERS_H_ + +#if GOOGLE_CUDA && GOOGLE_TENSORRT + +#include "tensorflow/core/platform/status.h" + +namespace tensorflow { +namespace tensorrt { + +// The PrecisionMode controls the precision used in TRT converted parts of the +// model. Setting PrecisionMode other than FP32 enables TensorRT to select +// lower-precision implementations when searching for the fastest kernels. +// +// For regularized models whose input dynamic range is approximately one, this +// typically produces significant speedups with negligible change in accuracy. +// There is additional complexity when working with INT8, see Calibration. +// +// - FP32 +// - FP16 Enable FP16 layer selection, with FP32 fallback. +// - INT8 Enable Int8 layer selection, with FP32 and FP16 fallback. +// +// Note that TensorRT will still choose a higher-precision kernel if it results +// in overall lower runtime, or if no low-precision implementation exists. +enum class TrtPrecisionMode { FP32, FP16, INT8 }; + +Status TrtPrecisionModeToName(const TrtPrecisionMode mode, string* name); + +Status TrtPrecisionModeFromName(const string& name, TrtPrecisionMode* mode); + +string DebugString(const TrtPrecisionMode mode); + +// Optimization profile generation strategies. +// - `kRange`: create one profile that works for inputs with dimension values +// in the range of [min_dims, max_dims] where min_dims and max_dims are +// derived from the provided inputs. +// - `kOptimal`: create one profile for each input. The profile only works for +// inputs with the same dimensions as the input it is created for. The GPU +// engine will be run with optimal performance with such inputs. +// - `kRangeOptimal`: create the profiles for both `Range` and `Optimal`. +// - `kImplicitBatchModeCompatible`: create the profiles that will produce the +// same GPU engines as the implicit_batch_mode would produce. +enum class ProfileStrategy { + kRange, + kOptimal, + kRangeOptimal, + kImplicitBatchModeCompatible, +}; + +string ProfileStrategyToName(const ProfileStrategy strategy); +Status ProfileStrategyFromName(const string& name, ProfileStrategy* strategy); + +} // namespace tensorrt +} // namespace tensorflow + +#endif // GOOGLE_CUDA && GOOGLE_TENSORRT +#endif // TENSORFLOW_COMPILER_TF2TENSORRT_CONVERT_TRT_PARAMETERS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/convert/utils.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/convert/utils.h new file mode 100644 index 0000000000000000000000000000000000000000..9a03d2f9093bf0252b695d00988a4a8475d59ffd --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/convert/utils.h @@ -0,0 +1,399 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_TF2TENSORRT_CONVERT_UTILS_H_ +#define TENSORFLOW_COMPILER_TF2TENSORRT_CONVERT_UTILS_H_ + +#include +#include +#include +#include +#include + +#include "absl/algorithm/container.h" +#include "absl/types/optional.h" +#include "tensorflow/compiler/tf2tensorrt/common/utils.h" +#include "tensorflow/compiler/tf2tensorrt/utils/trt_tensor_proxy.h" +#include "tensorflow/core/framework/tensor.h" +#include "tensorflow/core/framework/tensor_shape.h" +#include "tensorflow/core/graph/graph.h" +#include "tensorflow/core/lib/core/status.h" +#include "tensorflow/core/lib/strings/str_util.h" +#include "tensorflow/core/lib/strings/strcat.h" +#include "tensorflow/core/util/env_var.h" + +#if GOOGLE_CUDA && GOOGLE_TENSORRT +#include "third_party/tensorrt/NvInfer.h" + +#define TFTRT_ERROR(func, ...) \ + do { \ + return func("TFTRT::", __FUNCTION__, ":", __LINE__, ": ", __VA_ARGS__); \ + } while (0) + +#define TFTRT_CHECK_SHAPE_TENSOR(tensor) \ + if (!IsTrtShapeTensorCompatible(tensor)) { \ + TFTRT_ERROR(errors::InvalidArgument, "Tensor of type ", \ + DebugString(tensor.dtype()), " having shape ", \ + tensor.shape().DebugString(), " is not TRT compatible"); \ + } + +namespace tensorflow { +namespace tensorrt { + +static constexpr char kCastOutputTypeAttrName[] = "DstT"; + +#if !IS_TRT_VERSION_GE(8, 2, 0, 0) +template +struct TrtDestroyer { + void operator()(T* t) { + if (t) t->destroy(); + } +}; +template +using TrtUniquePtrType = std::unique_ptr>; +#else +template +using TrtUniquePtrType = std::unique_ptr; +#endif + +// Define a hash function for vector because it is used as the key +// for the engine cache. +struct VectorTensorShapeHasher { + std::size_t operator()(const std::vector& key) const { + return std::hash()(TensorShapeUtils::ShapeListString(key)); + } +}; + +using absl::StrAppend; +using absl::StrCat; + +// This utility template converts an arithmetic type to a string. This function +// is necessary to allow the following function to behave recursively: +// `string DebugString(const std::vector&)`. +template ::value, CType>::type> +string DebugString(const CType& el) { + string el_str = std::to_string(el); + // Prettify std::to_string which can sometimes returns 1.50000 instead of 1.5. + // In short it removes trailing 0s in a string-formatted number. + el_str.erase(el_str.find_last_not_of('0') + 1, std::string::npos); + return el_str; +} +// This utility template converts nested vectors to a string for debug purposes. +template +string DebugString(const std::vector& vector) { + string tmp_s = ""; + for (const auto el : vector) { + StrAppend(&tmp_s, StrCat(DebugString(el), ", ")); + } + return StrCat("{", tmp_s.substr(0, tmp_s.length() - 2), "}"); +} +string DebugString(const nvinfer1::Dims& dims); +string DebugString(const nvinfer1::DataType trt_dtype); +string DebugString(const DataType tf_type); +string DebugString(const nvinfer1::Permutation& permutation, int len); +string DebugString(const ITensorProxyPtr& tensor); +string DebugString(const nvinfer1::ITensor& tensor); +string DebugString(const std::vector& dimvec); +string DebugString(const std::vector& shapes); +string DebugString(const std::vector& shapes); + +template +string DebugString(const absl::InlinedVector& data) { + return absl::StrCat("[", absl::StrJoin(data, ","), "]"); +} + +inline bool HasStaticShape(const nvinfer1::Dims& dims) { + if (dims.nbDims < 0) return false; + for (int d = 0; d < dims.nbDims; ++d) { + if (dims.d[d] < 0) return false; + } + return true; +} + +template +bool HasStaticShape(const T& dims) { + return !absl::c_any_of(dims, [](int i) { return i < 0; }); +} + +// Returns whether a shape is compatible with a TRT shape tensor. +template +inline bool IsTrtShapeTensorCompatible(const TensorShapeType& shape) { + return ( + shape.dims() == 0 || + (shape.dims() == 1 && shape.num_elements() <= nvinfer1::Dims::MAX_DIMS)); +} + +// Returns whether a TF tensor could be interpreted as a TRT shape tensor. +inline bool IsTrtShapeTensorCompatible(const Tensor& tensor) { + return tensor.dtype() == DT_INT32 && + IsTrtShapeTensorCompatible(tensor.shape()); +} + +// Adapts various representations of shape (TF Shape, TRT Dims, plain +// containers) and provides methods for properties (length, volume) and +// conversion between types. Note that unlike TF's TensorShape, the underlying +// storage will only contain active dimensions. In the case of scalar shapes, +// `NumDims` is allowed to return 0 or 1, but the `storage_` vector will contain +// 1 element in both cases. In the non-scalar case, `NumDims() == +// storage_.size()`. +class DimsAdapter { + public: + using StorageType = absl::InlinedVector; + + private: + template + using EnableIfNotTensorShapeType = + std::enable_if_t, T>::value>; + + template + using EnableIfInt = std::enable_if_t::value && + std::is_integral::value>; + + public: + //----- Constructors ------ + + // Constructs from an absl::Span. + template + explicit DimsAdapter(absl::Span shape) + : num_dims_(static_cast(shape.size())) { + absl::c_copy(shape, std::back_inserter(storage_)); + } + + // Constructs from an absl::Span. + template + explicit DimsAdapter(const std::vector& shape) + : num_dims_(static_cast(shape.size())) { + absl::c_copy(shape, std::back_inserter(storage_)); + } + + // Constructs from a TRT dims object. + DimsAdapter(const nvinfer1::Dims& dims) : num_dims_(dims.nbDims) { + absl::c_copy(absl::MakeSpan(dims.d, dims.d + std::max(dims.nbDims, 0)), + std::back_inserter(storage_)); + } + + // Constructs explicitly specifing num_dims and storage data. + DimsAdapter(int32_t num_dims, StorageType data) + : num_dims_(num_dims), storage_(std::forward(data)) {} + + // Constructs from a TensorShape or PartialTensorShape. + template + static StatusOr Create(const TensorShapeBase& shape, + bool ignore_first_dim = false) { + if (shape.dims() > nvinfer1::Dims::MAX_DIMS) + return errors::InvalidArgument("dims of TensorShape exceed MAX_DIMS"); + if (ignore_first_dim && shape.dims() <= 0) + return errors::InvalidArgument( + "removing first dim requires explicit batch dimension"); + if (shape.dims() == -1) { + return DimsAdapter(-1, StorageType{}); + } + if (shape.dims() == 0) { + return DimsAdapter(0, StorageType{1}); + } + auto offt = (ignore_first_dim ? 1 : 0); + return DimsAdapter( + absl::MakeSpan(shape.dim_sizes().begin() + offt, shape.dims() - offt)); + } + + // Constructs from a container. + template > + static StatusOr Create(const InputSequence& shape, + bool ignore_first_dim = false) { + if (ignore_first_dim && shape.size() <= 0) { + return errors::InvalidArgument( + "removing first dim requires explicit batch dimension"); + } + return DimsAdapter( + absl::MakeSpan(shape).subspan(ignore_first_dim ? 1 : 0, shape.size())); + } + + //----- Conversion Utilities ------ + + // Converts to an nvinfers::Dims and assign the result to the object passed + // in via the result pointer. + void TrtDims(nvinfer1::Dims* result) const { + result->nbDims = num_dims_; + absl::c_copy(storage_, static_cast(result->d)); + } + + // Converts to an nvinfer1::Dims and return by value. + nvinfer1::Dims AsTrtDims() const { + nvinfer1::Dims result; + TrtDims(&result); + return result; + } + + // Converts to a TensorShape and assigns the result to the object passed in + // via the shape pointer. + Status TensorShape(TensorShape* shape, + std::optional batch_size = std::nullopt) const { + TF_RETURN_IF_ERROR(TensorShapeUtils::MakeShape( + static_cast(storage_.data()), storage_.size(), shape)); + if (batch_size) shape->InsertDim(0, *batch_size); + return OkStatus(); + } + + // Converts to a PartialTensorShape and assigns the result to the object + // passed in via the shape pointer. + Status PartialTensorShape( + PartialTensorShape* shape, + std::optional batch_size = std::nullopt) const { + TF_RETURN_IF_ERROR(TensorShapeUtils::MakeShape( + static_cast(storage_.data()), storage_.size(), shape)); + if (batch_size) shape->InsertDim(0, *batch_size); + return OkStatus(); + } + + // Copies the dimension values to the vector passed in via the shape pointer. + template > + Status Vector(std::vector* shape) const { + shape->clear(); + absl::c_copy(storage_, std::back_inserter(*shape)); + return OkStatus(); + } + + //----- Property Accessors ------ + + // Returns true if the shape has no dynamic dimensions. + bool IsStatic() const { + return !absl::c_any_of(storage_, [](auto i) { return i < 0; }); + } + + // Returns product of all dimensions. + int64_t Volume() const { + return absl::c_accumulate(storage_, static_cast(1), + std::multiplies<>()); + } + + int32_t NumDims() const { return num_dims_; } + + // Returns true if the shape should be interpreted as a scalar. This follows + // TensorRT conversions: a scalar shape can have NumDims()==1 or NumDims()==0, + // but the underlying storage_ container has a single dimension of size 1. + bool IsScalar() const { + return (num_dims_ == 0 || num_dims_ == 1) && storage_.size() == 1 && + storage_[0] == 1; + } + + // Returns true if the dimension storage is empty. This indicates an empty + // shape in both the scalar and non-scalar case. + bool IsEmpty() const { return storage_.empty(); } + + string DebugString() const { + auto vol = absl::c_accumulate(storage_, static_cast(1), + std::multiplies<>()); + return absl::StrCat("DimsAdapter(num_dims=", num_dims_, ",shape=[", + absl::StrJoin(storage_, ","), "],", "vol=", vol, ")"); + } + + // Returns beginning iterator for the underlying storage. + StorageType::const_iterator begin() const { return storage_.begin(); } + + // Returns ending iterator for the underlying storage. + StorageType::const_iterator end() const { return storage_.end(); } + + // Returns the size of the dimension at `idx`. + StorageType::value_type dim(size_t idx) const { return storage_[idx]; } + + // Returns a references to the dimension at `idx`. + StorageType::value_type& dim(size_t idx) { return storage_[idx]; } + + //----- Non-Const Operators ------ + + DimsAdapter& Append(int32_t dim) { + StatusOr is_scalar = IsScalar(); + if (!is_scalar.ok()) return *this; + num_dims_ = *is_scalar ? 2 : num_dims_ + 1; + storage_.push_back(dim); + return *this; + } + + DimsAdapter& Prepend(std::optional dim) { + if (dim) { + num_dims_ = IsScalar() ? 2 : num_dims_ + 1; + storage_.insert(storage_.begin(), *dim); + } + return *this; + } + + Status RemoveBatchDimension() { + if (storage_.empty()) + return errors::InvalidArgument( + "attempted to remove batch dim from scalar"); + num_dims_ -= 1; + storage_.erase(storage_.begin()); + return OkStatus(); + } + + //----- Comparison Operators ------ + + bool operator==(const DimsAdapter& rhs) const { + if (rhs.num_dims_ != num_dims_) return false; + for (int i = 0; i < num_dims_; i++) { + if (rhs.storage_[i] != storage_[i]) return false; + } + return true; + } + + bool operator!=(const DimsAdapter& rhs) const { return !(*this == rhs); } + + private: + int32_t num_dims_{0}; + StorageType storage_{}; +}; + +Status GetNetworkInputShapes(const nvinfer1::INetworkDefinition* network, + std::vector* input_shapes); + +Status TfTypeToTrtType(DataType tf_type, nvinfer1::DataType* trt_type); +Status TrtTypeToTfType(nvinfer1::DataType trt_type, DataType* tf_type); + +// Returns true if an engine built for cached_shapes can also run actual_shapes. +bool AreShapesCompatible(const std::vector& actual_shapes, + const std::vector& cached_shapes); + +// Returns the number of inputs for the engine, which also correspends to the +// number of input tensors for the network. This can differ from the number of +// input bindings, because the number of total input bindings equals the number +// of profiles times the number of engine inputs. +int GetNumberOfEngineInputs(const nvinfer1::ICudaEngine* engine); + +// Returns the string representation for the assigned device or the requested +// device of the given node. +absl::string_view GetDeviceName(const Node* node); + +// Returns the ParsedName representation for the assigned device or the +// requested device string of the given node. If the device string is invalid, +// returns std::nullopt. +std::optional GetDeviceParsedName( + const Node* node); + +// If the given two device assignments as compatible, returns the merge of the +// two assignments. Otherwise, returns std::nullopt. +std::optional MergeIfCompatible( + const DeviceNameUtils::ParsedName& a, const DeviceNameUtils::ParsedName& b); +// Similar to the above, except that the second device assignment is represented +// by a string_view. +std::optional MergeIfCompatible( + const DeviceNameUtils::ParsedName& a, absl::string_view b); + +} // namespace tensorrt +} // namespace tensorflow + +#endif // GOOGLE_CUDA && GOOGLE_TENSORRT +#endif // TENSORFLOW_COMPILER_TF2TENSORRT_CONVERT_UTILS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/convert/weights.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/convert/weights.h new file mode 100644 index 0000000000000000000000000000000000000000..20b66e9852b736813bfcb4aafec33816499451a9 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/convert/weights.h @@ -0,0 +1,295 @@ +/* Copyright 2021 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ +#ifndef TENSORFLOW_COMPILER_TF2TENSORRT_CONVERT_WEIGHTS_H_ +#define TENSORFLOW_COMPILER_TF2TENSORRT_CONVERT_WEIGHTS_H_ + +#if GOOGLE_CUDA && GOOGLE_TENSORRT + +#include + +#include "tensorflow/compiler/tf2tensorrt/convert/utils.h" +#include "tensorflow/compiler/tf2tensorrt/utils/trt_tensor_proxy.h" +#include "tensorflow/core/framework/tensor.h" +#include "tensorflow/core/lib/core/status.h" +#include "tensorflow/core/platform/types.h" +#include "third_party/tensorrt/NvInfer.h" + +namespace tensorflow { +namespace tensorrt { +namespace convert { + +// Class to convert TF compile-time constants (e.g. Const nodes) to TRT weight. +class TRT_ShapedWeights { + public: + explicit TRT_ShapedWeights( + nvinfer1::DataType type = nvinfer1::DataType::kFLOAT); + + // Constructs a weights from another weights. + // + // NOTE: this does not copy the underlying buffer but only increase its + // reference count. + TRT_ShapedWeights(const TRT_ShapedWeights& rhs) = default; + + nvinfer1::Weights GetTrtWeights() const; + + const Tensor& GetTensor() const { return tensor_; } + + // Returns a pointer of type const T to the underlying buffer of the tensor. + template + const T* GetPointer() const { + int64 num_elem = + (tensor_.NumElements() * DataTypeSize(tensor_.dtype())) / sizeof(T); + return tensor_.bit_casted_shaped({num_elem}).data(); + } + + // Returns a pointer of type T to the underlying buffer of the tensor. + template + T* GetPointer() { + int64 num_elem = + (tensor_.NumElements() * DataTypeSize(tensor_.dtype())) / sizeof(T); + return tensor_.bit_casted_shaped({num_elem}).data(); + } + + // Fills all the weight values with value. + template + Status SetValues(T value) { + switch (type_) { + case nvinfer1::DataType::kFLOAT: { + float* ptr = tensor_.flat().data(); + std::fill(ptr, ptr + volume_, value); + break; + } + case nvinfer1::DataType::kHALF: { + Eigen::half* ptr = tensor_.flat().data(); + std::fill(ptr, ptr + volume_, Eigen::half(value)); + break; + } + case nvinfer1::DataType::kINT32: { + int32* ptr = tensor_.flat().data(); + std::fill(ptr, ptr + volume_, value); + break; + } + default: + return errors::InvalidArgument( + "Unsupported data type ", tensorflow::tensorrt::DebugString(type_)); + } + return OkStatus(); + } + + Status SetShape(DimsAdapter dims); + void SetShapeUnsafe(DimsAdapter dims) { shape_ = std::move(dims); } + + // Returns total number of elements. Returning 0 means either some dim is 0 + // or the number of dims is 0. Note that a TF scalar constant is marked as + // Dims{0, {1}}, and has a count() == 1. + int64_t count() const { return volume_; } + + size_t size_bytes() const; + + string DebugString() const; + + template + absl::Span GetSpan() const { + return absl::Span(tensor_.flat().data(), volume_); + } + + template + std::vector ToVector() const { + auto span = GetSpan(); + return std::vector(span.data(), span.data() + span.size()); + } + + nvinfer1::DataType TrtDType() const { return type_; } + + const DimsAdapter& Shape() const { return shape_; } + DimsAdapter& Shape() { return shape_; } + + private: + // The shape of the weights. Defaults to the empty shape. + DimsAdapter shape_; + + // This creation method is only used by TrtWeightStore, which creates the + // underlying buffer. + static StatusOr CreateWithTensor(nvinfer1::DataType type, + DimsAdapter dims, + Tensor tensor); + + nvinfer1::DataType type_; + + // All weights should be stored inside TrtWeightStore to make sure lifetime of + // all the underlying tensors are available until the engine is built. For + // this reason, tensor_ should never be reassigned to a different value that + // is not already present in the TrtWeightStore. + Tensor tensor_; + // Contains the volume of the weight's shape. + int64_t volume_; + + friend class TrtWeightStore; +}; + +// Container for TRT_ShapedWeights. We need this container because TRT does not +// manage the lifetime of the weights buffer, it only keeps a pointer to it and +// requires that the data referenced by the pointer be available until the +// building of engine is complete. For more information see +// https://docs.nvidia.com/deeplearning/sdk/tensorrt-api/c_api/classnvinfer1_1_1_weights.html +// +// TODO(laigd): consider adding garbage collection to the unused weights. +class TrtWeightStore { + public: + // Gets a TRT_ShapedWeights with 'type' and 'dims'. + StatusOr GetTempWeights(nvinfer1::DataType trt_type, + const DimsAdapter& dims); + + // Gets a TRT_ShapedWeights with the same data type and dimensions as + // 'weights'. + StatusOr GetTempWeights(const TRT_ShapedWeights& weights) { + return GetTempWeights(weights.TrtDType(), weights.Shape()); + } + + private: + // The backend storage of the TRT_ShapedWeights. + std::vector store_; +}; + +// Enumerates the possible types of arguments of a converter. This determines +// what object is contained in TRT_TensorOrWeights, and converters can require +// a specific type for each of their arguments. +enum class TRT_ArgumentType { + TENSOR = 0, + WEIGHTS = 1, + RESOURCE = 2, +}; + +struct OpConverterParams; + +// Represents a TRT-style input to a TF node, it can be either a +// ITensorProxyPtr (representing nvinfer1::ITensor* or SimpleITensor), +// or TRT_ShapedWeights which is compile-time constant. +// +// TODO(laigd): maybe rename it to TrtArgument, or mimic XlaCompiler::Argument. +class TRT_TensorOrWeights { + public: + TRT_TensorOrWeights() {} + TRT_TensorOrWeights(ITensorProxyPtr); + TRT_TensorOrWeights(ITensorProxyPtr tensor, int batch_size); + + // Constructs a wrapper for the given ITensor. + // This is used by Converter when building the TRT network, where the ITensor + // is owned by the TRT network being built. See comment for 'trt_tensor_' + // in trt_proxy_tensor.h. + explicit TRT_TensorOrWeights(nvinfer1::ITensor* tensor, int batch_size = -1); + + // Creates a SimpleITensor for trt_dtype and trt_dims and takes ownership of + // the object. Constructs a wrapper for the SimpleITensor. This is used by + // TrtNodeValidator to encapsulate the type and shape information for + // validation of graph nodes, and the created ITensor is fake and temporary, + // and should not be used to build any TRT network. See comment for + // 'simple_tensor_' in trt_proxy_tensor.h. + explicit TRT_TensorOrWeights(nvinfer1::DataType trt_dtype, + const nvinfer1::Dims& trt_dims, int batch_size); + + // Constructs a wrapper for the given weights. + explicit TRT_TensorOrWeights(const TRT_ShapedWeights& weights); + + // Constructs a wrapper for the given resource handle. + explicit TRT_TensorOrWeights(const ResourceHandle& resource); + + TRT_TensorOrWeights(const TRT_TensorOrWeights& rhs); + + void operator=(const TRT_TensorOrWeights& rhs); + + bool is_tensor() const { + return initialized_ && arg_type_ == TRT_ArgumentType::TENSOR; + } + bool is_weights() const { + return initialized_ && arg_type_ == TRT_ArgumentType::WEIGHTS; + } + bool is_resource() const { + return initialized_ && arg_type_ == TRT_ArgumentType::RESOURCE; + } + + ITensorProxyPtr tensor() const; + + ResourceHandle resource() const; + + ITensorProxyPtr as_tensor(const OpConverterParams* params); + + TRT_ShapedWeights& weights() { + DCHECK(is_weights()); + return weights_; + } + + const TRT_ShapedWeights& weights() const { + DCHECK(is_weights()); + return weights_; + } + + nvinfer1::Dims GetTrtDims() const; + + Status GetTfType(DataType* tf_type) const; + + int batch_size() const { return batch_size_; } + + string DebugString() const; + + nvinfer1::DataType TrtDType() const { + if (arg_type_ == TRT_ArgumentType::RESOURCE) { + VLOG(0) << "Calling TrtDType() with a RESOURCE argument is undefined " + "behavior."; + } + return arg_type_ == TRT_ArgumentType::TENSOR ? tensor_proxy_ptr_->getType() + : weights_.TrtDType(); + } + + private: + void set_batch_size(int batch_size) { batch_size_ = batch_size; } + + // First dimension of the TF tensor (NOT tensor_) that is represented by + // tensor_ is treated as the "batch dimension" by TRT, and tensor_'s + // dimensions (obtained via tensor_->getDimensions()) do not contain the batch + // dimension. For example, when a TF tensor with shape (A,B,C) is represented + // in TRT, tensor_->getDimensions() will be (B,C) and batch_size_ will be A. + // + // This requires that all tensors in the subgraph that is converted to a TRT + // engine have the same batch size are represented by the first dimension of + // their shape, and Converter will verify this during conversion. The drawback + // is that currently it cannot convert a graph that doesn't have the batch + // size represented in the shapes or the batch sizes are different. See + // b/118387490 for more details. + // + // If use_implicit_batch is false, batch_size_ is unused and + // tensor_->getDimensions() will contain the entire shape (A,B,C). + // + // tensor_proxy_ptr_ is used when arg_type_ == TENSOR. + ITensorProxyPtr tensor_proxy_ptr_ = nullptr; + int batch_size_ = -1; + + // For DT_RESOURCE arguments (there is no corresponding type in TRT). + // resource_ is used when arg_type_ == RESOURCE. + ResourceHandle resource_; + + // weights_ is used when arg_type_ == WEIGHTS. + TRT_ShapedWeights weights_; + bool initialized_ = false; + TRT_ArgumentType arg_type_ = TRT_ArgumentType::WEIGHTS; + + friend class Converter; +}; +} // namespace convert +} // namespace tensorrt +} // namespace tensorflow + +#endif // GOOGLE_CUDA && GOOGLE_TENSORRT +#endif // TENSORFLOW_COMPILER_TF2TENSORRT_CONVERT_WEIGHTS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/plugin/trt_plugin.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/plugin/trt_plugin.h new file mode 100644 index 0000000000000000000000000000000000000000..8976cc6e862012b8daf956258aa64dc7cfca0c4f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/plugin/trt_plugin.h @@ -0,0 +1,94 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_TF2TENSORRT_PLUGIN_TRT_PLUGIN_H_ +#define TENSORFLOW_COMPILER_TF2TENSORRT_PLUGIN_TRT_PLUGIN_H_ + +#include + +#include "tensorflow/core/platform/logging.h" + +#if GOOGLE_CUDA && GOOGLE_TENSORRT +#include "third_party/tensorrt/NvInfer.h" + +namespace tensorflow { +namespace tensorrt { + +extern const char* kTfTrtPluginVersion; +extern const char* kTfTrtPluginNamespace; + +// A wrapper class for TensorRT plugin. User application should inherit from +// this class to write custom kernels. +class TrtPlugin : public nvinfer1::IPluginV2Ext { + public: + TrtPlugin() { setPluginNamespace(kTfTrtPluginNamespace); } + + TrtPlugin(const void* serialized_data, size_t length) {} + + TrtPlugin(const TrtPlugin& rhs) : namespace_(rhs.namespace_) {} + + int initialize() noexcept override { return 0; } + + void terminate() noexcept override {} + + void destroy() noexcept override { delete this; } + + void setPluginNamespace(const char* plugin_namespace) noexcept override { + namespace_ = plugin_namespace; + } + + const char* getPluginNamespace() const noexcept override { + return namespace_.c_str(); + } + + protected: + template + void WriteToBuffer(const T& val, char** buffer) const { + *reinterpret_cast(*buffer) = val; + *buffer += sizeof(T); + } + + template + T ReadFromBuffer(const char** buffer) { + T val = *reinterpret_cast(*buffer); + *buffer += sizeof(T); + return val; + } + + private: + std::string namespace_; +}; + +template +class TrtPluginRegistrar { + public: + TrtPluginRegistrar() { + getPluginRegistry()->registerCreator(creator, kTfTrtPluginNamespace); + } + + private: + T creator; +}; + +#define REGISTER_TFTRT_PLUGIN(name) \ + static ::tensorflow::tensorrt::TrtPluginRegistrar \ + plugin_registrar_##name {} + +} // namespace tensorrt +} // namespace tensorflow + +#endif // GOOGLE_CUDA && GOOGLE_TENSORRT + +#endif // TENSORFLOW_COMPILER_TF2TENSORRT_PLUGIN_TRT_PLUGIN_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/segment/segment.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/segment/segment.h new file mode 100644 index 0000000000000000000000000000000000000000..06a3893d5736acff8c5e11aedd96eb4bbe67b319 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/segment/segment.h @@ -0,0 +1,94 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_TF2TENSORRT_SEGMENT_SEGMENT_H_ +#define TENSORFLOW_COMPILER_TF2TENSORRT_SEGMENT_SEGMENT_H_ + +#include +#include + +#include "absl/types/optional.h" +#include "tensorflow/compiler/tf2tensorrt/segment/union_find.h" +#include "tensorflow/core/framework/graph.pb.h" +#include "tensorflow/core/graph/graph.h" +#include "tensorflow/core/grappler/costs/graph_properties.h" +#include "tensorflow/core/lib/core/status.h" +#include "tensorflow/core/platform/types.h" + +#if GOOGLE_CUDA && GOOGLE_TENSORRT + +namespace tensorflow { +namespace tensorrt { +namespace segment { + +constexpr char kTftrtOpMaxBatchSizeAttr[] = "_tftrt_op_max_batch_size"; + +struct SegmentOptions { + // This struct holds per graph segmenting parameters. + // Segment must contain at least this many nodes. + int minimum_segment_size = 2; + bool use_implicit_batch = true; + // The maximum batch size used to build the engines in the graph, when + // use_implicit_batch is true. + std::optional maximum_batch_size = std::nullopt; + // When use_implicit_batch is false or when we are building dynamic engines, + // we allow dynamic non-batch dimensions. + bool allow_dynamic_non_batch_dim = false; + // The name of the device to put the segment on. + std::set exclude_node_list; +}; + +struct NodePtrCompare { + bool operator()(const Node* lhs, const Node* rhs) const { + return lhs->name() < rhs->name(); + } +}; + +struct Segment { + Segment() {} + Segment(const ClusterProperty& property, + const std::set& nodes) + : property(property), nodes(nodes) {} + ClusterProperty property; + std::set nodes; +}; + +// Vector of segments, each entry contains a set of node pointers. +using SegmentVector = std::vector; + +// Get the subgraphs of a graph that can be handled by TensorRT. +// +// @param tf_graph Graph of the network. +// @graph_properties is the static graph properties. +// @param candidate_fn A function that returns OK for a Node* if +// that node can be handled by TensorRT. +// @param segments Returns the TensorRT segments/subgraphs. Each entry +// in the vector describes a subgraph by giving a set of the names of +// all the NodeDefs in that subgraph. +// @return the status. +Status SegmentGraph(const Graph* tf_graph, + const grappler::GraphProperties* graph_properties, + const std::function& candidate_fn, + const std::function& input_candidate_fn, + const std::function& output_candidate_fn, + const SegmentOptions& options, SegmentVector* segments); + +} // namespace segment +} // namespace tensorrt +} // namespace tensorflow + +#endif // GOOGLE_CUDA && GOOGLE_TENSORRT + +#endif // TENSORFLOW_COMPILER_TF2TENSORRT_SEGMENT_SEGMENT_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/segment/union_find.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/segment/union_find.h new file mode 100644 index 0000000000000000000000000000000000000000..56a21392d9dea69cbb9be7d1ecd1c701eb9cde32 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/segment/union_find.h @@ -0,0 +1,218 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_TF2TENSORRT_SEGMENT_UNION_FIND_H_ +#define TENSORFLOW_COMPILER_TF2TENSORRT_SEGMENT_UNION_FIND_H_ + +#include "absl/types/optional.h" +#include "tensorflow/core/lib/core/errors.h" +#include "tensorflow/core/util/device_name_utils.h" + +#if GOOGLE_CUDA && GOOGLE_TENSORRT + +namespace tensorflow { +namespace tensorrt { +namespace segment { + +// ClusterBatchSize is a data structure to record the batch size we have seen +// for a cluster during segmentation. +// +// With the help of shape inference, all the dynamic batch sizes are converted +// to a negative integer number. +// If the number is -1, then nothing is known about the dynamic batch size. +// Ideally, we should not put nodes with -1 batch size into the same cluster, +// as they will likely have different batch sizes at runtime. However, we +// currently treat -1 as an equivalent class for simple implementation. We may +// need to revise this if it causes performance issues. +// If the number is strictly less than -1, then it represents a equivalent +// class. It is infered that all the nodes with the same equivalent class +// (strictly less than -1) shall have the same batch size at runtime. +// +// When constructing clusters for implicit batch mode, we support both +// dynamic batch sizes and static batch sizes. As all the nodes inside the same +// cluster shall have the same batch size at runtime, we restrict nodes inside a +// cluster to either have the same dynamic batch size equivalent class or the +// same static batch size value. +// +// Besides, all the nodes with an annotated max batch size inside the same +// cluster shall have the same annotated max batch size. (It is allowed if +// part or all the nodes inside the cluster doesn't have annotated max batch +// size). Static batch sizes are treated as max batch size annotations. The +// converter max batch size is used for an OP with a dynamic batch size and no +// annotated max batch size. +// +// cluster: a = a1[1,3] + a1[1,3] +// ClusterBatchSize: batch_size_ = 1 +// max_batch_size_ = 1 +// +// cluster: b = b1[-1,3] + b2[-1, 3] +// ClusterBatchSize: batch_size_ = -1 +// max_batch_size_ = null +// +// cluster: c = c1[-2,3] + c2[-2, 3](max_batch_size=100) +// ClusterBatchSize: batch_size_ = -2 +// max_batch_size_ = 100 +// +// When constructing cluster for explicit batch mode, all ClusterBatchSize is +// irrelevant. +// + +class ClusterBatchSize { + public: + ClusterBatchSize(); + + bool operator==(const ClusterBatchSize& other); + bool operator!=(const ClusterBatchSize& other) { return !(*this == other); } + + // Sets the batch size assuming that the object doesn't have a batch size yet: + // A non-negative input representing a static batch size value. + // A negative input representing a dynamic batch size equivalent class. + ClusterBatchSize& SetBatchSize(int batch_size); + bool HasBatchSize() const; + int GetBatchSize() const; + + // Sets the max batch size assuming that the object doesn't have a max batch + // size yet. + ClusterBatchSize& SetMaxBatchSize(int max_batch_size); + std::optional GetOptionalMaxBatchSize() const; + + // Merge `other` into the current ClusterBatchSize if the two are not + // conflicting. Two ClusterBatchSizes are conflicting iff they both have a + // value and their values are different. + bool MergeIfCompatible(const ClusterBatchSize& other); + + // Returns a string for the batch size and the annotated max batch size. + // For the batch size: + // If the object has a static batch size, return a string representing a + // non-negative integer. + // If the object has a dynamic batch size, return a string representing a + // negative integer as an equivalent class. + // If the object doesn't have a batch size yet, return "?". + // For the annotated max batch size: + // If the cluster has annotated max batch size in at least one of the nodes, + // return a string representing the annotated max batch size. Otherwise, + // return "?". + std::string ToString() const; + + private: + ClusterBatchSize& SetBatchSize(const std::optional& batch_size); + ClusterBatchSize& SetMaxBatchSize(const std::optional& batch_size); + + std::optional batch_size_; + std::optional max_batch_size_; +}; + +inline std::ostream& operator<<(std::ostream& os, + const ClusterBatchSize& batch_size) { + return os << batch_size.ToString(); +} + +// Represents the accumulated properties of a cluster during segmentation, +// including information about batch size and device assignment. Clusters shall +// have compatible properties in order to be merged together. +class ClusterProperty { + public: + ClusterProperty() {} + ClusterProperty(const ClusterBatchSize& batch_size, + const DeviceNameUtils::ParsedName& device_name); + + // Returns the batch size of the cluster and compresses the path from this + // object to the root object. + const ClusterBatchSize& BatchSize() const { return batch_size_; } + + // Returns the device name of the cluster and compresses the path from this + // object to the root object. + const DeviceNameUtils::ParsedName& DeviceName() const { return device_name_; } + + Status Merge(const ClusterProperty& other); + + private: + ClusterBatchSize batch_size_; + DeviceNameUtils::ParsedName device_name_; +}; + +// Represents a disjoint set of copyable value with type T and accumulated +// property of the values with type P. Most of the methods in this class are +// side-effecting as they also compress the path from the object to the parent +// of its containing set. +template +class UnionFind { + public: + UnionFind() : size_(1), parent_(nullptr) {} + UnionFind(const T& v, const P& p) + : size_(1), parent_(nullptr), value_(v), property_(p) {} + UnionFind(const T& v, P&& p) + : size_(1), parent_(nullptr), value_(v), property_(p) {} + + // Returns the number of elements in the set and compresses the path from + // this object to the root of the set. + int Size() { return FindRoot()->size_; } + + // Returns the accumulated property of all the elements in the set and + // compresses the path from this object to the root of the set. + const P& Property() { return FindRoot()->property_; } + + // Merges this set with 'other'. This updates the size_ and property_ of the + // set. The size_ and property_ of 'other' becomes inaccessible as only the + // size_ and property_ of the root of the set is accessible. + Status Merge(UnionFind* other); + + // Retrieves the value for the root of the set. + const T& ParentValue() { return FindRoot()->value_; } + + // Returns the value for the object. + const T& Value() const { return value_; } + + private: + // Returns the root object for the set and compresses the path from this + // object to the root object. + UnionFind* FindRoot(); + + int size_; + UnionFind* parent_; + T value_; + P property_; +}; + +template +Status UnionFind::Merge(UnionFind* other) { + UnionFind* a = FindRoot(); + UnionFind* b = other->FindRoot(); + if (a == b) return OkStatus(); + + P merged_property(a->property_); + TF_RETURN_IF_ERROR(merged_property.Merge(b->property_)); + b->parent_ = a; + a->size_ += b->size_; + a->property_ = std::move(merged_property); + return OkStatus(); +} + +template +UnionFind* UnionFind::FindRoot() { + if (!parent_) return this; + // Path compression: update intermediate nodes to point to the root of the + // equivalence class. + parent_ = parent_->FindRoot(); + return parent_; +} + +} // namespace segment +} // namespace tensorrt +} // namespace tensorflow + +#endif // GOOGLE_CUDA && GOOGLE_TENSORRT + +#endif // TENSORFLOW_COMPILER_TF2TENSORRT_SEGMENT_UNION_FIND_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/trt_convert_api.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/trt_convert_api.h new file mode 100644 index 0000000000000000000000000000000000000000..e9b3dcccd18b4edf6f476c49904bc9a5f4df251e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/trt_convert_api.h @@ -0,0 +1,129 @@ +/* Copyright 2021 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_TF2TENSORRT_TRT_CONVERT_API_H_ +#define TENSORFLOW_COMPILER_TF2TENSORRT_TRT_CONVERT_API_H_ + +#include +#include +#include + +#if GOOGLE_CUDA && GOOGLE_TENSORRT + +#include "tensorflow/compiler/tf2tensorrt/common/utils.h" +#include "tensorflow/compiler/tf2tensorrt/convert/trt_parameters.h" +#include "tensorflow/core/framework/tensor.h" +#include "tensorflow/core/platform/statusor.h" +#include "tensorflow/core/protobuf/meta_graph.pb.h" + +namespace tensorflow { + +struct SavedModelBundle; + +namespace tensorrt { + +struct TfTrtConversionParams { + // Corresponds 'workspaceSize' parameter of + // nvinfer1::IBuilderConfig::setMaxWorkspaceSize. +#if IS_TRT_VERSION_GE(8, 4, 0, 0) + // Must use `LLONG_MAX - 512` to avoid overflow during casting. + size_t max_workspace_size_bytes = LLONG_MAX - 512; +#else + size_t max_workspace_size_bytes = 1 << 30; // 1,073,741,824 +#endif + + // Minimum precision used by the TRT Engine. + TrtPrecisionMode precision_mode = TrtPrecisionMode::FP32; + + // The minimum number of nodes required for a subgraph to be replaced by + // TRTEngineOp. Note that many small TRT subgraphs could be detrimental for + // performance, increasing the minimum segment size can help avoid the + // problem. + int minimum_segment_size = 3; + + // Max number of cached TRT engines for dynamic TRT ops (by default we have + // dynamic TRT ops). + int max_cached_engines = 1; + + // Note that calibration is currently not implemented with the C++ converter. + // This argument is ignored if precision_mode is not INT8. If set to True, the + // implementation will use the user provided inputs to generate calibration + // data. If set to False, quantization nodes will be expected for every tensor + // in the graph (excluding those which will be fused). If a range is missing, + // an error will occur. Please note that accuracy may be negatively affected + // if there is a mismatch between which tensors TRT quantizes and which + // tensors were trained with fake quantization. + bool use_calibration = true; + + // Whether to enable dynamic shape mode for the TRT engines. It is + // recommended to use_dynamic_shape mode to handle dynamic input shape. + // Enabling dynamic shape mode can also improve the conversion rate of graphs + // with static input shape. + bool use_dynamic_shape = true; + + // In dynamic shape mode we create an engine that can handle various input + // shape ranges. We derive the shape optimization profiles for the TRT engines + // in the graph based on user provided input data and profile_strategy. + ProfileStrategy profile_strategy = ProfileStrategy::kRange; + + // Whether to allow bulding TRT engines at runtime. If no TensorRT engine can + // be found in cache that can handle the given inputs during runtime, then a + // new TensorRT engine is built at runtime if allow_build_at_runtime=True, + // otherwise native TF is used. We recommend to set this value false and build + // the engine in advance, to avoid runtime overhead. + bool allow_build_at_runtime = true; + + // Record the TRT engine as an attribute of the TRTEngineOp. This is only + // valid when max_cached_engines == 1. Note: the frozen graph together with + // the serialized engines have to be below 2GiB (protobuf size limit). If + // convert_to_static_engine = false, then the converted graph_def only + // contains placeholder TRTEngineOp nodes. + bool convert_to_static_engine = true; +}; + +/** + * Converts the graph with TF-TRT. + * + * Performs TF-TRT conversion and returns the converted GraphDef. If inputs is + * not empty and convert_to_static_engine is requested, we also build the + * engines and convert the engines to static engines. + * + * Arguments: + * - frozen_graph_def input graph, it is assumed to be frozen + * - input_names names of the input tensors + * - output_names names of the output tensors + * - inputs tensors that we will use as input while building the TRT engines + * - conv_params parameters for the TF-TRT conversion + * + * Returns the converted graph_def. + */ +StatusOr ConvertAndBuild( + const GraphDef& frozen_graph_def, const std::vector& input_names, + const std::vector& output_names, + const std::vector>& inputs, + const TfTrtConversionParams& conv_params); + +StatusOr ConvertAndBuild( + SavedModelBundle* bundle, + const std::string& signature_key = "serving_default", + const std::vector>& inputs = {}, + const TfTrtConversionParams& conversion_params = TfTrtConversionParams()); + +} // namespace tensorrt +} // namespace tensorflow + +#endif // GOOGLE_CUDA && GOOGLE_TENSORRT + +#endif // TENSORFLOW_COMPILER_TF2TENSORRT_TRT_CONVERT_API_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/utils/trt_allocator.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/utils/trt_allocator.h new file mode 100644 index 0000000000000000000000000000000000000000..2812aa0645799fc1ea16a085b049c246411132bd --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/utils/trt_allocator.h @@ -0,0 +1,73 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_TF2TENSORRT_UTILS_TRT_ALLOCATOR_H_ +#define TENSORFLOW_COMPILER_TF2TENSORRT_UTILS_TRT_ALLOCATOR_H_ + +#include + +#include "tensorflow/core/framework/allocator.h" +#include "tensorflow/core/platform/mutex.h" + +#if GOOGLE_CUDA && GOOGLE_TENSORRT +#include "third_party/tensorrt/NvInfer.h" +#endif // GOOGLE_CUDA && GOOGLE_TENSORRT + +namespace tensorflow { +namespace tensorrt { +// std::align is not supported, so this function mimic its behavior. +void* Align(uint64_t alignment, uint64_t size, void*& ptr, uint64_t& space); +} // namespace tensorrt +} // namespace tensorflow + +#if GOOGLE_CUDA && GOOGLE_TENSORRT + +namespace tensorflow { +namespace tensorrt { + +class TRTBaseAllocator : public nvinfer1::IGpuAllocator { + // Base allocator class so we can have a virtual destructor; + public: + // python wrapper seems to be not happy with an pure virtual destructor; + virtual ~TRTBaseAllocator() = default; +}; + +class TRTDeviceAllocator : public TRTBaseAllocator { + // Allocator implementation wrapping TF device allocators. + public: + TRTDeviceAllocator(Allocator* allocator); + + // TODO(aaroey): base class doesn't have a virtual destructor, work with + // Nvidia to fix it. + virtual ~TRTDeviceAllocator() { + VLOG(1) << "Destroying allocator attached to " << allocator_->Name(); + } + void* allocate(uint64_t size, uint64_t alignment, + uint32_t flags) noexcept override; + void free(void* memory) noexcept override; + + private: + mutex mu_; + Allocator* allocator_; + + // supporting alignment from allocation request requires a map to free; + std::unordered_map mem_map_ TF_GUARDED_BY(mu_); +}; + +} // namespace tensorrt +} // namespace tensorflow + +#endif // GOOGLE_CUDA && GOOGLE_TENSORRT +#endif // TENSORFLOW_COMPILER_TF2TENSORRT_UTILS_TRT_ALLOCATOR_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/utils/trt_engine_instance.pb.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/utils/trt_engine_instance.pb.h new file mode 100644 index 0000000000000000000000000000000000000000..5bc64dbf3e39708334c0a28ec9447327121ddb67 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/utils/trt_engine_instance.pb.h @@ -0,0 +1,344 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tensorflow/compiler/tf2tensorrt/utils/trt_engine_instance.proto + +#ifndef GOOGLE_PROTOBUF_INCLUDED_tensorflow_2fcompiler_2ftf2tensorrt_2futils_2ftrt_5fengine_5finstance_2eproto +#define GOOGLE_PROTOBUF_INCLUDED_tensorflow_2fcompiler_2ftf2tensorrt_2futils_2ftrt_5fengine_5finstance_2eproto + +#include +#include + +#include +#if PROTOBUF_VERSION < 3021000 +#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 3021009 < 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 // IWYU pragma: export +#include // IWYU pragma: export +#include +#include "tensorflow/core/framework/tensor_shape.pb.h" +// @@protoc_insertion_point(includes) +#include +#define PROTOBUF_INTERNAL_EXPORT_tensorflow_2fcompiler_2ftf2tensorrt_2futils_2ftrt_5fengine_5finstance_2eproto +PROTOBUF_NAMESPACE_OPEN +namespace internal { +class AnyMetadata; +} // namespace internal +PROTOBUF_NAMESPACE_CLOSE + +// Internal implementation detail -- do not use these members. +struct TableStruct_tensorflow_2fcompiler_2ftf2tensorrt_2futils_2ftrt_5fengine_5finstance_2eproto { + static const uint32_t offsets[]; +}; +extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_tensorflow_2fcompiler_2ftf2tensorrt_2futils_2ftrt_5fengine_5finstance_2eproto; +namespace tensorflow { +namespace tensorrt { +class TRTEngineInstance; +struct TRTEngineInstanceDefaultTypeInternal; +extern TRTEngineInstanceDefaultTypeInternal _TRTEngineInstance_default_instance_; +} // namespace tensorrt +} // namespace tensorflow +PROTOBUF_NAMESPACE_OPEN +template<> ::tensorflow::tensorrt::TRTEngineInstance* Arena::CreateMaybeMessage<::tensorflow::tensorrt::TRTEngineInstance>(Arena*); +PROTOBUF_NAMESPACE_CLOSE +namespace tensorflow { +namespace tensorrt { + +// =================================================================== + +class TRTEngineInstance final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:tensorflow.tensorrt.TRTEngineInstance) */ { + public: + inline TRTEngineInstance() : TRTEngineInstance(nullptr) {} + ~TRTEngineInstance() override; + explicit PROTOBUF_CONSTEXPR TRTEngineInstance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + TRTEngineInstance(const TRTEngineInstance& from); + TRTEngineInstance(TRTEngineInstance&& from) noexcept + : TRTEngineInstance() { + *this = ::std::move(from); + } + + inline TRTEngineInstance& operator=(const TRTEngineInstance& from) { + CopyFrom(from); + return *this; + } + inline TRTEngineInstance& operator=(TRTEngineInstance&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const TRTEngineInstance& default_instance() { + return *internal_default_instance(); + } + static inline const TRTEngineInstance* internal_default_instance() { + return reinterpret_cast( + &_TRTEngineInstance_default_instance_); + } + static constexpr int kIndexInFileMessages = + 0; + + friend void swap(TRTEngineInstance& a, TRTEngineInstance& b) { + a.Swap(&b); + } + inline void Swap(TRTEngineInstance* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(TRTEngineInstance* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + TRTEngineInstance* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const TRTEngineInstance& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom( const TRTEngineInstance& from) { + TRTEngineInstance::MergeImpl(*this, from); + } + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); + public: + 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(TRTEngineInstance* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "tensorflow.tensorrt.TRTEngineInstance"; + } + protected: + explicit TRTEngineInstance(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kInputShapesFieldNumber = 1, + kSerializedEngineFieldNumber = 2, + }; + // repeated .tensorflow.TensorShapeProto input_shapes = 1; + int input_shapes_size() const; + private: + int _internal_input_shapes_size() const; + public: + void clear_input_shapes(); + ::tensorflow::TensorShapeProto* mutable_input_shapes(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::tensorflow::TensorShapeProto >* + mutable_input_shapes(); + private: + const ::tensorflow::TensorShapeProto& _internal_input_shapes(int index) const; + ::tensorflow::TensorShapeProto* _internal_add_input_shapes(); + public: + const ::tensorflow::TensorShapeProto& input_shapes(int index) const; + ::tensorflow::TensorShapeProto* add_input_shapes(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::tensorflow::TensorShapeProto >& + input_shapes() const; + + // bytes serialized_engine = 2; + void clear_serialized_engine(); + const std::string& serialized_engine() const; + template + void set_serialized_engine(ArgT0&& arg0, ArgT... args); + std::string* mutable_serialized_engine(); + PROTOBUF_NODISCARD std::string* release_serialized_engine(); + void set_allocated_serialized_engine(std::string* serialized_engine); + private: + const std::string& _internal_serialized_engine() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_serialized_engine(const std::string& value); + std::string* _internal_mutable_serialized_engine(); + public: + + // @@protoc_insertion_point(class_scope:tensorflow.tensorrt.TRTEngineInstance) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::tensorflow::TensorShapeProto > input_shapes_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr serialized_engine_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_tensorflow_2fcompiler_2ftf2tensorrt_2futils_2ftrt_5fengine_5finstance_2eproto; +}; +// =================================================================== + + +// =================================================================== + +#ifdef __GNUC__ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wstrict-aliasing" +#endif // __GNUC__ +// TRTEngineInstance + +// repeated .tensorflow.TensorShapeProto input_shapes = 1; +inline int TRTEngineInstance::_internal_input_shapes_size() const { + return _impl_.input_shapes_.size(); +} +inline int TRTEngineInstance::input_shapes_size() const { + return _internal_input_shapes_size(); +} +inline ::tensorflow::TensorShapeProto* TRTEngineInstance::mutable_input_shapes(int index) { + // @@protoc_insertion_point(field_mutable:tensorflow.tensorrt.TRTEngineInstance.input_shapes) + return _impl_.input_shapes_.Mutable(index); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::tensorflow::TensorShapeProto >* +TRTEngineInstance::mutable_input_shapes() { + // @@protoc_insertion_point(field_mutable_list:tensorflow.tensorrt.TRTEngineInstance.input_shapes) + return &_impl_.input_shapes_; +} +inline const ::tensorflow::TensorShapeProto& TRTEngineInstance::_internal_input_shapes(int index) const { + return _impl_.input_shapes_.Get(index); +} +inline const ::tensorflow::TensorShapeProto& TRTEngineInstance::input_shapes(int index) const { + // @@protoc_insertion_point(field_get:tensorflow.tensorrt.TRTEngineInstance.input_shapes) + return _internal_input_shapes(index); +} +inline ::tensorflow::TensorShapeProto* TRTEngineInstance::_internal_add_input_shapes() { + return _impl_.input_shapes_.Add(); +} +inline ::tensorflow::TensorShapeProto* TRTEngineInstance::add_input_shapes() { + ::tensorflow::TensorShapeProto* _add = _internal_add_input_shapes(); + // @@protoc_insertion_point(field_add:tensorflow.tensorrt.TRTEngineInstance.input_shapes) + return _add; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::tensorflow::TensorShapeProto >& +TRTEngineInstance::input_shapes() const { + // @@protoc_insertion_point(field_list:tensorflow.tensorrt.TRTEngineInstance.input_shapes) + return _impl_.input_shapes_; +} + +// bytes serialized_engine = 2; +inline void TRTEngineInstance::clear_serialized_engine() { + _impl_.serialized_engine_.ClearToEmpty(); +} +inline const std::string& TRTEngineInstance::serialized_engine() const { + // @@protoc_insertion_point(field_get:tensorflow.tensorrt.TRTEngineInstance.serialized_engine) + return _internal_serialized_engine(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void TRTEngineInstance::set_serialized_engine(ArgT0&& arg0, ArgT... args) { + + _impl_.serialized_engine_.SetBytes(static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:tensorflow.tensorrt.TRTEngineInstance.serialized_engine) +} +inline std::string* TRTEngineInstance::mutable_serialized_engine() { + std::string* _s = _internal_mutable_serialized_engine(); + // @@protoc_insertion_point(field_mutable:tensorflow.tensorrt.TRTEngineInstance.serialized_engine) + return _s; +} +inline const std::string& TRTEngineInstance::_internal_serialized_engine() const { + return _impl_.serialized_engine_.Get(); +} +inline void TRTEngineInstance::_internal_set_serialized_engine(const std::string& value) { + + _impl_.serialized_engine_.Set(value, GetArenaForAllocation()); +} +inline std::string* TRTEngineInstance::_internal_mutable_serialized_engine() { + + return _impl_.serialized_engine_.Mutable(GetArenaForAllocation()); +} +inline std::string* TRTEngineInstance::release_serialized_engine() { + // @@protoc_insertion_point(field_release:tensorflow.tensorrt.TRTEngineInstance.serialized_engine) + return _impl_.serialized_engine_.Release(); +} +inline void TRTEngineInstance::set_allocated_serialized_engine(std::string* serialized_engine) { + if (serialized_engine != nullptr) { + + } else { + + } + _impl_.serialized_engine_.SetAllocated(serialized_engine, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.serialized_engine_.IsDefault()) { + _impl_.serialized_engine_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:tensorflow.tensorrt.TRTEngineInstance.serialized_engine) +} + +#ifdef __GNUC__ + #pragma GCC diagnostic pop +#endif // __GNUC__ + +// @@protoc_insertion_point(namespace_scope) + +} // namespace tensorrt +} // namespace tensorflow + +// @@protoc_insertion_point(global_scope) + +#include +#endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_tensorflow_2fcompiler_2ftf2tensorrt_2futils_2ftrt_5fengine_5finstance_2eproto diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/utils/trt_engine_utils.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/utils/trt_engine_utils.h new file mode 100644 index 0000000000000000000000000000000000000000..b0935afb5b2039ec02fc57f4a570c7c1d40bdf92 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/utils/trt_engine_utils.h @@ -0,0 +1,82 @@ +/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_TF2TENSORRT_UTILS_TRT_ENGINE_UTILS_H_ +#define TENSORFLOW_COMPILER_TF2TENSORRT_UTILS_TRT_ENGINE_UTILS_H_ + +#include +#include + +#include "tensorflow/compiler/tf2tensorrt/common/datavec.h" +#include "tensorflow/compiler/tf2tensorrt/common/utils.h" +#include "tensorflow/compiler/tf2tensorrt/utils/trt_shape_optimization_profiles.h" +#include "tensorflow/core/framework/op_kernel.h" +#include "tensorflow/core/framework/tensor.h" +#include "tensorflow/core/framework/tensor_shape.h" +#include "tensorflow/core/lib/core/status.h" + +#if GOOGLE_CUDA && GOOGLE_TENSORRT +#include "third_party/tensorrt/NvInfer.h" + +namespace tensorflow { +namespace tensorrt { +using ::tsl::StatusOr; + +// Creates a TensorRT execution context. +ExecutionContext CreateExecutionContext(nvinfer1::ICudaEngine* cuda_engine); + +// Sets input buffers for TRT from a list of input tensors. The input tensors +// are either defined by ctx or by input_vec. +Status SetTrtEngineInputs(nvinfer1::ICudaEngine* cuda_engine, + nvinfer1::IExecutionContext* execution_context, + const int trt_profile_idx, + std::vector& buffers, bool use_implicit_batch, + int num_batch, + const TrtShapeOptimizationProfile& profiles, + OpKernelContext* ctx = nullptr, + const DataVec* input_vec = nullptr); + +// Returns the shape of a binding from TensorRT. +// +// The binding is identified by its binding_index. The batch_size argument is +// ignored if use_implicit_batch==false. The shape is returned in the last +// argument. +Status GetTrtBindingShape(const nvinfer1::ICudaEngine* cuda_engine, + const nvinfer1::IExecutionContext* execution_context, + int binding_index, bool use_implicit_batch, + int batch_size, TensorShape& shape); + +// Defines output buffers for TRT. The buffers are allocated by ctx, if ctx is +// not null. Otherwise it is expected that the outputs DataVec is not null, and +// the Tensors in outputs are already allocated. +Status SetTrtEngineOutputs(nvinfer1::ICudaEngine* cuda_engine, + nvinfer1::IExecutionContext* execution_context, + int trt_profile_idx, std::vector& buffers, + bool use_implicit_batch, int batch_size = 0, + OpKernelContext* ctx = nullptr, + DataVec* outputs = nullptr); + +// Enqueues TensorRT inference job. The batch_size argument is only relevant in +// implicit batch mode. +Status TrtEnqueue(nvinfer1::IExecutionContext* execution_context, + std::vector& buffers, cudaStream_t stream, + bool use_implicit_batch, int batch_size = 1); + +} // namespace tensorrt +} // namespace tensorflow + +#endif // GOOGLE_CUDA && GOOGLE_TENSORRT + +#endif // TENSORFLOW_COMPILER_TF2TENSORRT_UTILS_TRT_ENGINE_UTILS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/utils/trt_execution_context.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/utils/trt_execution_context.h new file mode 100644 index 0000000000000000000000000000000000000000..05b5cefbf94391eb11ecf6611a0dffe73de76d13 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/utils/trt_execution_context.h @@ -0,0 +1,43 @@ +/* Copyright 2021 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_TF2TENSORRT_UTILS_TRT_EXECUTION_CONTEXT_H_ +#define TENSORFLOW_COMPILER_TF2TENSORRT_UTILS_TRT_EXECUTION_CONTEXT_H_ + +#if GOOGLE_CUDA && GOOGLE_TENSORRT +#include "third_party/tensorrt/NvInfer.h" + +namespace tensorflow { +namespace tensorrt { + +// A wrapper for the TensorRT execution context which will destroy the TensorRT +// execution context when the object goes out of scope. +class ExecutionContext : public TrtUniquePtrType { + public: + ExecutionContext(nvinfer1::IExecutionContext* context, bool has_memory) + : TrtUniquePtrType(context), + has_device_memory_(has_memory) {} + static ExecutionContext Create(nvinfer1::ICudaEngine* cuda_engine); + + bool HasDeviceMemory() { return has_device_memory_; } + + private: + bool has_device_memory_; +}; + +}; // namespace tensorrt +}; // namespace tensorflow +#endif +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/utils/trt_experimental_features.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/utils/trt_experimental_features.h new file mode 100644 index 0000000000000000000000000000000000000000..1a502c5f7e70cde16aabb50ba2e803ff2cea7bc7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/utils/trt_experimental_features.h @@ -0,0 +1,31 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_TF2TENSORRT_UTILS_TRT_EXPERIMENTAL_FEATURES_H_ +#define TENSORFLOW_COMPILER_TF2TENSORRT_UTILS_TRT_EXPERIMENTAL_FEATURES_H_ + +#if GOOGLE_CUDA && GOOGLE_TENSORRT + +namespace tensorflow { +namespace tensorrt { + +bool isExperimentalFeatureActivated(string feature_name); + +} // namespace tensorrt +} // namespace tensorflow + +#endif // GOOGLE_CUDA && GOOGLE_TENSORRT + +#endif // TENSORFLOW_COMPILER_TF2TENSORRT_UTILS_TRT_EXPERIMENTAL_FEATURES_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/utils/trt_int8_calibrator.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/utils/trt_int8_calibrator.h new file mode 100644 index 0000000000000000000000000000000000000000..2fa22662521bfacbed6ba228bb03d8ad116d890e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/utils/trt_int8_calibrator.h @@ -0,0 +1,102 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_TF2TENSORRT_UTILS_TRT_INT8_CALIBRATOR_H_ +#define TENSORFLOW_COMPILER_TF2TENSORRT_UTILS_TRT_INT8_CALIBRATOR_H_ + +#include +#include +#include +#include + +#include "tensorflow/core/platform/mutex.h" + +#if GOOGLE_CUDA && GOOGLE_TENSORRT + +#include "third_party/gpus/cuda/include/cuda_runtime_api.h" +#include "third_party/tensorrt/NvInfer.h" + +namespace tensorflow { +namespace tensorrt { +// This class provides a 1 element queue to match TFs push model to +// TRTs pull model for calibration. When TRT implements a means for +// a push calibration This class should be updated accordingly + +// IInt8EntropyCalibrator2 is preferred for TRT 5.1+. +struct TRTInt8Calibrator : public nvinfer1::IInt8EntropyCalibrator2 { + public: + // Construct a calibrator for future calibration. + TRTInt8Calibrator( + const std::unordered_map>& dev_buffers, + int batch_size, string engine_name); + + // Construct a finalized calibrator where we don't need to run calibration any + // more, as the calibration data is provided. + TRTInt8Calibrator(const string& calibration_data); + + ~TRTInt8Calibrator(); + + int getBatchSize() const noexcept override; + + bool getBatch(void* bindings[], const char* names[], + int num_bindings) noexcept override; + + // Feed calibration data to the calibrator, and return true if the data is + // accepted. Return false if the calibrator has been terminated. + bool setBatch(const std::unordered_map& data, + const cudaStream_t stream); + + // Wait until the last batch is consumed by the calibrator and set done. + void waitAndSetDone(); + + // Notify that calibration is done and future batches provided by setBatch() + // will be ignored. + void setDone(); + + // If not null, calibration is skipped. + const void* readCalibrationCache(std::size_t& length) noexcept override; + + void writeCalibrationCache(const void* ptr, + std::size_t length) noexcept override; + + const string& getCalibrationTableAsString() { return calibration_table_; } + + private: + const int batch_size_; + + // mutex for condition_variable + mutex cond_mtx_; + + // condition variable to implement producer-consumer queue for calibration + condition_variable cond_; + + // Is calibration finished? + bool done_; + + // Map to keep tensorrt input buffers and sizes keyed with buffer names + std::unordered_map> dev_buffers_; + + bool calib_running_; + bool batch_is_set_; + + string engine_name_; + string calibration_table_; +}; + +} // namespace tensorrt +} // namespace tensorflow + +#endif // GOOGLE_CUDA && GOOGLE_TENSORRT +#endif // TENSORFLOW_COMPILER_TF2TENSORRT_UTILS_TRT_INT8_CALIBRATOR_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/utils/trt_logger.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/utils/trt_logger.h new file mode 100644 index 0000000000000000000000000000000000000000..8002df53e5cf925cd3bf357c2ec119f11ebafb3c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/utils/trt_logger.h @@ -0,0 +1,50 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_TF2TENSORRT_UTILS_TRT_LOGGER_H_ +#define TENSORFLOW_COMPILER_TF2TENSORRT_UTILS_TRT_LOGGER_H_ + +#include "tensorflow/core/platform/types.h" + +#if GOOGLE_CUDA && GOOGLE_TENSORRT +#include "third_party/tensorrt/NvInfer.h" + +namespace tensorflow { +namespace tensorrt { + +// Logger for GIE info/warning/errors +class Logger : public nvinfer1::ILogger { + public: + Logger(string name = "DefaultLogger") : name_(name) {} + void log(nvinfer1::ILogger::Severity severity, + const char* msg) noexcept override; + void suppressLoggerMsgs(nvinfer1::ILogger::Severity severity); + void unsuppressLoggerMsgs(nvinfer1::ILogger::Severity severity); + void unsuppressAllLoggerMsgs() { suppressedMsg_ = 0; } + static Logger* GetLogger(); + + private: + bool isValidSeverity(nvinfer1::ILogger::Severity severity, + const char* msg = nullptr) noexcept; + const string name_; + unsigned int suppressedMsg_ = 0; +}; + +} // namespace tensorrt +} // namespace tensorflow + +#endif // GOOGLE_CUDA && GOOGLE_TENSORRT + +#endif // TENSORFLOW_COMPILER_TF2TENSORRT_UTILS_TRT_LOGGER_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/utils/trt_lru_cache.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/utils/trt_lru_cache.h new file mode 100644 index 0000000000000000000000000000000000000000..31c3b9c9a904cd0ded3e5a6b6f8f6652d2beb79e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/utils/trt_lru_cache.h @@ -0,0 +1,261 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_TF2TENSORRT_UTILS_TRT_LRU_CACHE_H_ +#define TENSORFLOW_COMPILER_TF2TENSORRT_UTILS_TRT_LRU_CACHE_H_ + +#include +#include +#include + +#include "tensorflow/compiler/tf2tensorrt/convert/utils.h" +#include "tensorflow/compiler/tf2tensorrt/utils/trt_allocator.h" +#include "tensorflow/compiler/tf2tensorrt/utils/trt_engine_utils.h" +#include "tensorflow/compiler/tf2tensorrt/utils/trt_int8_calibrator.h" +#include "tensorflow/compiler/tf2tensorrt/utils/trt_logger.h" +#include "tensorflow/compiler/tf2tensorrt/utils/trt_shape_optimization_profiles.h" +#include "tensorflow/core/framework/resource_mgr.h" +#include "tensorflow/core/lib/core/errors.h" + +#if GOOGLE_CUDA && GOOGLE_TENSORRT +#include "third_party/tensorrt/NvInfer.h" +#endif // GOOGLE_CUDA && GOOGLE_TENSORRT + +namespace tensorflow { +namespace tensorrt { + +template +class LRUCache { + public: + typedef Value value_type; + typedef Key key_type; + typedef HashFunction hasher; + typedef typename std::unordered_map map_type; + typedef typename map_type::iterator iterator; + typedef typename map_type::const_iterator const_iterator; + + LRUCache() : capacity_(0) {} + explicit LRUCache(size_t capacity) : capacity_(capacity) {} + + size_t capacity() const { return capacity_; } + + void reserve(size_t capacity) { + capacity_ = capacity; + DiscardOld(); + } + + size_t size() const { return objects_.size(); } + + size_t count(const key_type& key) const { return objects_.count(key); } + + value_type& at(const key_type& key) { return Touch(key); } + + const_iterator begin() const { return objects_.begin(); } + const_iterator end() const { return objects_.end(); } + + iterator begin() { return objects_.begin(); } + iterator end() { return objects_.end(); } + + template + std::pair emplace(Args&&... args) { + DiscardOld(1); + std::pair result = + objects_.emplace(std::forward(args)...); + key_type key = result.first->first; + if (result.second) { + keys_.push_front(key); + } else { + TouchNoCheck(key); // The key must exist in this case. + } + return result; + } + + private: + std::unordered_map objects_; + std::list keys_; + size_t capacity_; + value_type not_found_value_; + + value_type& Touch(const key_type& key) { + // Check that the key exists, and let it return std::out_of_range error if + // not. + value_type& value = objects_.at(key); + TouchNoCheck(key); + return value; + } + + void TouchNoCheck(const key_type& key) { + auto rank = std::find(keys_.begin(), keys_.end(), key); + if (rank != keys_.begin()) { + keys_.erase(rank); + keys_.push_front(key); + } + } + + // Creates n free positions in cache + void DiscardOld(size_t n = 0) { + DCHECK(capacity_ >= n) << "Insufficient capacity in cache (capacity = " + << capacity_ << ", requested " << n << ")"; + while (objects_.size() > (capacity_ - n)) { + key_type discard_key = keys_.back(); + keys_.pop_back(); + objects_.erase(discard_key); + } + } +}; + +#if GOOGLE_CUDA && GOOGLE_TENSORRT + +struct EngineContext { + EngineContext() {} // Creates an empty context. + EngineContext(TrtUniquePtrType&& cuda_engine, + ExecutionContext&& execution_context) + : cuda_engine_(std::move(cuda_engine)) { + execution_contexts.push_back(std::move(execution_context)); + device_memory_size_ = + cuda_engine_ ? cuda_engine_->getDeviceMemorySize() : 0; + } + EngineContext(TrtUniquePtrType&& cuda_engine, + std::vector&& execution_contexts) + : cuda_engine_(std::move(cuda_engine)), + execution_contexts(std::move(execution_contexts)) { + device_memory_size_ = + cuda_engine_ ? cuda_engine_->getDeviceMemorySize() : 0; + } + + mutex mu; + + nvinfer1::ICudaEngine* GetCudaEngine() { return cuda_engine_.get(); } + + Status GetExecutionContext(int idx, nvinfer1::IExecutionContext** exec_ctx, + bool* has_device_memory) + TF_EXCLUSIVE_LOCKS_REQUIRED(mu) { + if (idx >= execution_contexts.size()) { + return errors::Internal("Requested engine context with index ", idx, + ", but only ", execution_contexts.size(), + "contexts are present."); + } + *exec_ctx = execution_contexts[idx].get(); + *has_device_memory = execution_contexts[idx].HasDeviceMemory(); + return OkStatus(); + } + + int GetNumContexts() { + mutex_lock lock(mu); + return execution_contexts.size(); + } + + size_t GetDeviceMemorySize() { return device_memory_size_; } + + private: + // Note: declaration has to come before execution_contexts, to ensure proper + // order of destruction. + TrtUniquePtrType cuda_engine_; + + public: + // In explicit batch mode, we maintain a vector of contexts for each engine, + // where each context is created for a specific profile. This is because it is + // either not possible or non-trivial to change the profile of a context for + // the following reasons: + // - To switch profiles (from TRT 7), one must first ensure that all inference + // calls in that context are finished. This would require an additional + // synchronization before we call setOptimizationProfile. To avoid this + // extra sync call, we mantain separate execution context for each profile. + // IExecutionContext object is not thread safe: only one thread should use it + // for inference at a time therefore we need a mutex. More details at + // https://docs.nvidia.com/deeplearning/sdk/tensorrt-best-practices/index.html#thread-safety + // Additional discussion about execution context management and thread safety + // at https://github.com/tensorflow/tensorflow/issues/36959 + std::vector execution_contexts TF_GUARDED_BY(mu); + + private: + // Until TRT 8.4 ICudaEngine::getDeviceMemorySize() has a non-negligible + // latency. Since its value remains constant, we can cache it. + size_t device_memory_size_; +}; +// Contains the context required to build the calibration data. +class CalibrationContext { + public: + string TerminateCalibration(); + + // Lookup table for temporary staging areas of input tensors for calibration. + std::unordered_map> device_buffers_; + + // Temporary staging areas for calibration inputs. + std::vector device_tensors_; + + std::unique_ptr calibrator_; + TrtUniquePtrType builder_; + TrtUniquePtrType engine_; + // TODO(sami): Use threadpool threads! + std::unique_ptr thr_; + + private: + mutex mu_; + bool terminated_ TF_GUARDED_BY(mu_) = false; + std::string calibration_table_ TF_GUARDED_BY(mu_); +}; + +ABSL_CONST_INIT extern const absl::string_view kTfTrtContainerName; + +class TRTEngineCacheResource : public ResourceBase { + public: + // According to the TensorRT API, the logger is considered a singleton by the + // TensorRT library, and multiple instances of IRuntime and/or IBuilder must + // all use the same logger. So here we make it a singleton. + // + // TODO(laigd): use this logger in all places where conversion happens. + static Logger& GetLogger(); + + TRTEngineCacheResource(OpKernelContext* ctx, size_t capacity); + + ~TRTEngineCacheResource() override; + + string DebugString() const override; + + // Returns the EngineContext that is compatible with input_shapes. + // Returns nullptr if no compatible EngineContexts is found in cache. + EngineContext* GetEngineContext(const std::vector& input_shapes); + + // Returns the EngineContext that is compatible with profile_id. + // This function should be only called in explicit batch mode where + // cache size is expected to be at most one. + // Returns nullptr if no compatible EngineContexts is found in cache. + EngineContext* GetEngineContext(const int profile_id); + + // Keep device allocator for TRT. + std::unique_ptr allocator_; + + // Declare cache after allocator so that it is destroyed before allocator is. + LRUCache, std::unique_ptr, + VectorTensorShapeHasher> + cache_; + + // TODO(hinsu): Use different calibration context for the available shapes and + // attach it to each item of the cache. + std::unique_ptr calib_ctx_; + + // This object maintains all the optimization profiles during profile + // generation and engine build. During runtime the list of profiles is used to + // look up a matching profile for the input data. + TrtShapeOptimizationProfile profiles_; +}; + +#endif // GOOGLE_CUDA && GOOGLE_TENSORRT + +} // namespace tensorrt +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_TF2TENSORRT_UTILS_TRT_LRU_CACHE_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/utils/trt_shape_optimization_profiles.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/utils/trt_shape_optimization_profiles.h new file mode 100644 index 0000000000000000000000000000000000000000..e2d8fdb655b21513702a234f65556317049b75d7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/utils/trt_shape_optimization_profiles.h @@ -0,0 +1,351 @@ +/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_TF2TENSORRT_UTILS_TRT_SHAPE_OPTIMIZATION_PROFILES_H_ +#define TENSORFLOW_COMPILER_TF2TENSORRT_UTILS_TRT_SHAPE_OPTIMIZATION_PROFILES_H_ + +#include +#include +#include +#include + +#include "tensorflow/compiler/tf2tensorrt/common/datavec.h" +#include "tensorflow/compiler/tf2tensorrt/convert/trt_parameters.h" +#include "tensorflow/compiler/tf2tensorrt/convert/utils.h" +#include "tensorflow/compiler/tf2tensorrt/utils/trt_execution_context.h" +#include "tensorflow/compiler/tf2tensorrt/utils/trt_logger.h" +#include "tensorflow/core/framework/op_kernel.h" +#include "tensorflow/core/framework/tensor_shape.h" +#include "tensorflow/core/lib/core/errors.h" +#include "tensorflow/core/lib/core/status.h" +#include "tensorflow/core/lib/strings/str_util.h" +#include "tensorflow/core/lib/strings/strcat.h" + +#if GOOGLE_CUDA && GOOGLE_TENSORRT + +#include "third_party/tensorrt/NvInfer.h" + +namespace tensorflow { +namespace tensorrt { + +// Stores optimization profile parameters (min/opt/max of each input shape). +// +// A TensorRT optimization profile describes the possible min/max values of +// each dynamic input shape along with an optimum value. These values are used +// by the TensorRT builder to select the best kernel for the optimum value among +// those kernels that are valid for all input tensors in the [min, max] range. +struct OptimizationProfileConfig { + // Length of vector == 2*num_inputs to engine. min[0:num_inputs-1] are the min + // input dimensions for execution tensors. If engine has shape input tensors, + // then min[num_inputs + i] store the shape value for input i. For inputs that + // are not shape tensors min = opt = max = {0, {}}. + // + // When the OptimizationProfileConfig is created from the network definition + // (AddProfiles), then each elements of the min, opt, max vectors are defined. + // When the OptimizationProfileConfig object is restored during engine + // deserialization (RestoreProfiles), then some inputs can be pruned + // (see TrtShapeOptimizationProfile::is_pruned_input_). In that case min[i] + // is not defined for pruned inputs (same is true for opt and max). + std::vector min; + std::vector opt; + std::vector max; + + string DebugString() const { + using absl::StrCat; + return StrCat("[min: ", tensorflow::tensorrt::DebugString(min), + ", opt: : ", tensorflow::tensorrt::DebugString(opt), + ", max: ", tensorflow::tensorrt::DebugString(max), "]"); + } + + // Sets the min/opt/max dimensions for profile. + // + // The given min/opt/max dimensions should satisfy the condition + // min <= opt <= max. Additionally TRT requires that the min/opt/max values + // are compatible with the network input. Compatibility is defined the + // following way: let dim be the shape of an input binding and min/opt/max the + // corresponding profile dims. TRT requires that dim.d[k] must be -1 if + // (min.d[k] != dim.d[k] || opt.d[k] != dim.d[k] || max.d[k] != dim.d[k]). + // + // Parameters: + // network - TensorRT network, used to enumerate all the input tensors + // profile - on exit the profile information will be set for each input tensor + // input_mask - 1 for TRT inputs, 0 for TF inputs that are not TRT inputs + Status SetDimensions(const nvinfer1::INetworkDefinition* network, + nvinfer1::IOptimizationProfile* profile, + const std::vector& input_mask) const { + int n_inputs_trt = network->getNbInputs(); + int n_inputs_tf = opt.size() / 2; + /// TODO(lsugy): check that the sum of the mask equals n_inputs. + if (input_mask.size() != n_inputs_tf) { + return errors::Internal("Incorrect input mask size: ", input_mask.size()); + } + int n_mask_true = 0; + for (bool mask_val : input_mask) { + if (mask_val) { + n_mask_true++; + } + } + if (n_mask_true != n_inputs_trt) { + return errors::Internal( + "Number of true elements in input_mask (", n_mask_true, + ") doesn't match expected TRT inputs (", n_inputs_trt, ")"); + } + int j = 0; + for (int i = 0; i < n_inputs_tf; i++) { + if (input_mask[i]) { + const ITensorProxyPtr input = network->getInput(j); + const char* name = input->getName(); + if (input->isShapeTensor()) { + int idx = i + n_inputs_tf; + VLOG(2) << "Setting shape values for " << name << ", " + << ::tensorflow::tensorrt::DebugString(opt[idx]); + profile->setShapeValues(name, nvinfer1::OptProfileSelector::kMIN, + min[idx].d, min[idx].nbDims); + profile->setShapeValues(name, nvinfer1::OptProfileSelector::kOPT, + opt[idx].d, opt[idx].nbDims); + profile->setShapeValues(name, nvinfer1::OptProfileSelector::kMAX, + max[idx].d, max[idx].nbDims); + } + VLOG(2) << "Setting input dimensions for " << name << ", " + << ::tensorflow::tensorrt::DebugString(opt[i]); + profile->setDimensions(name, nvinfer1::OptProfileSelector::kMIN, + min[i]); + profile->setDimensions(name, nvinfer1::OptProfileSelector::kOPT, + opt[i]); + profile->setDimensions(name, nvinfer1::OptProfileSelector::kMAX, + max[i]); + + j++; + } + } + return OkStatus(); + } + + // Returns true if profile range completely includes the given shapes. + bool IncludesShapes(const std::vector& shapes, + bool has_shape_tensor, + const std::vector& shape_values, + const std::vector& is_pruned_input, + const std::vector& is_shape_tensor) const { + // min, max, and opt must have the same size which is already verified in + // SetDimensions. + if (min.size() != shapes.size() * 2 || + (has_shape_tensor && min.size() != shape_values.size() * 2)) { + VLOG(2) << "Profile size mismatch min size " << min.size() + << " vs input shapes size " << shapes.size() << " " + << shape_values.size(); + return false; + } + for (int i = 0; i < shapes.size(); i++) { + if (is_pruned_input[i]) { + continue; + } + auto current_shape = shapes[i]; + // min, max, and opt must have the same nbDims, which is already verified + // in SetDimensions. + if (min[i].nbDims != current_shape.dims()) { + return false; + } + // Check if range [min, max] includes current_shape. + for (int dim = 0; dim < current_shape.dims(); dim++) { + if ((min[i].d[dim] > current_shape.dim_size(dim)) || + (max[i].d[dim] < current_shape.dim_size(dim))) { + return false; + } + } + } + // Check shape values. + if (has_shape_tensor) { + int offset = shapes.size(); + for (int i = 0; i < shape_values.size(); i++) { + if (is_pruned_input[i] || !is_shape_tensor[i]) { + continue; + } + auto shape_val = shape_values[i]; + // min, max, and opt must have the same nbDims, which is already + // verified in SetDimensions. + if (min[i + offset].nbDims != shape_val.nbDims) { + return false; + } + // Check if range [min, max] includes shape_val. + for (int dim = 0; dim < shape_val.nbDims; dim++) { + if (min[i + offset].d[dim] > shape_val.d[dim] || + max[i + offset].d[dim] < shape_val.d[dim]) { + return false; + } + } + } + } + return true; + } +}; + +// Manages Optimization profiles during TRT Engine construction. +// +// An optimization profile describes a range of dimensions for each TRT network +// input, and the optimal dimensions that the auto-tuner should use for +// optimization. +// +// This class stores the list of input shapes that were seen during the +// build/profile_generation_mode phase, and using them it creates a set of +// OptimizationProfileConfigs. These configs will be added to IBuilderConfig +// before the engine is created. +class TrtShapeOptimizationProfile { + public: + TrtShapeOptimizationProfile() {} + + // Stores input shape information during profile_generation_mode. + void AddShape(const std::vector& shapes) { + input_shapes_.push_back(shapes); + input_shape_values_.push_back(actual_shape_values_); + VLOG(1) << "Collected shape(s) " << DebugString(shapes) << " for profiles."; + } + + // Stores the input mask. + void SetInputMask(const std::vector& input_mask) { + input_mask_ = input_mask; + } + + // Collects ShapeTensorCompatible tensor values. This is needed both during + // profile_generation_mode and during normal inference calls. + Status CollectShapeValues(OpKernelContext* ctx); + + // Collects ShapeTensorCompatible tensor values, used only for unit tests. + Status CollectShapeValues(const DataVec& input); + + void clear() { profiles_.clear(); } + + // Returns the profile number that should be used to execute the network with + // the given input shapes. Returns -1 if none of cached profiles are + // compatible with the given input shapes. + int GetProfileNumber(const std::vector& shapes); + + // Creates optimization profiles and add them to the builder config. + Status ConfigureBuilder(nvinfer1::IBuilder* builder, + nvinfer1::IBuilderConfig* config, + const nvinfer1::INetworkDefinition* network); + + // Creates execution contexts for each optimization profile. + Status CreateExecutionContexts(nvinfer1::ICudaEngine* engine, + std::vector* exec_contexts); + + Status SetInputShapeBinding(int input_index, int binding_index, + nvinfer1::ICudaEngine* cuda_engine, + nvinfer1::IExecutionContext* exec_context) const; + + // Creates optimization profiles profiles_ for the set of concrete input + // shapes collected in input_shapes_. The input_partial_shapes of the network + // is used to ensure that the created optimization profiles are compatible + // with the network. + void InitProfiles(const std::vector& input_partial_shapes, + ProfileStrategy strategy); + + void InitCalibProfile(const std::vector& shapes); + + // Returns number of created profiles. + int GetNumProfiles() const; + + bool HasShape() const { return !input_shapes_.empty(); } + bool NeedProfiles() const { return need_profiles_; } + + // Restores profiles from the engine (used after deserialization). + Status RestoreProfiles(const nvinfer1::ICudaEngine* engine, + int n_network_inputs); + + // Whether the network has any shape tensors. + bool HasShapeTensor() const { return has_shape_tensor_; } + + void SetShapeTensorMask(const nvinfer1::INetworkDefinition* network); + + // Whether the optimization profiles describe input that can be handled with + // a static engine (only 1 profile with min=max). + bool IsStaticCompatible() { + return strategy_ == ProfileStrategy::kOptimal && profiles_.size() == 1 +#if !IS_TRT_VERSION_GE(8, 0, 0, 0) + && !HasShapeTensor() +#endif + ; + // TODO(tfeher): remove !HasShapeTensor() condition once the + // FixShapeValueProfile workaround is turned off. + } + + private: + // Set of input shape vetors that we collect during profile_generation_mode. + std::vector> input_shapes_; + + // Input shape values that we collect during profile_generation_mode. If the + // tensor is not compatible with a TRT shape tensor then an empty shape is + // stored. + std::vector> input_shape_values_; + + // Shape values present in the current inference call. + std::vector actual_shape_values_; + + // The optimization profiles generated from input_shapes_. + std::vector profiles_; + + // The optimization profile for calibration. + OptimizationProfileConfig calib_profiles_; + + // A TRTEngineOp can have resource inputs. These are treated as constants: + // their value is read during conversion and stored as weights in the TRT + // engine. This means that resource inputs have no corresponding TRT engine + // input, and we do not need to provide profile information for these. The + // input mask helps to identify the TRT inputs, where we need to define + // optimization profiles. + std::vector input_mask_; + + // Whether the network has any shape tensors. Initially we assume that the + // network might have a shape value input. This will be updated when the + // network is created / engine is deserialized. + bool has_shape_tensor_ = true; + + // Whether the network/engine requires optimization profiles. + bool need_profiles_ = false; + + // Whether an input tensor is a shape tensor. + std::vector is_shape_tensor_; + + // Whether a network input was pruned (only in TRT 7). + std::vector is_pruned_input_; + + // Optimization profile generation strategy. + ProfileStrategy strategy_; + + // Adds optimization profiles to the builder config. + Status AddProfiles(nvinfer1::IBuilder* builder, + nvinfer1::IBuilderConfig* config, + const nvinfer1::INetworkDefinition* network); + + void SetShapeTensorMask(const nvinfer1::ICudaEngine* engine, int n_inputs); + void SetShapeTensorMask( + const std::vector& input_partial_shapes); + + Status SetPrunedMask(const nvinfer1::ICudaEngine* engine, + int n_network_inputs); + + void ImplicitBatchModeCompatibleStrategy( + const std::vector>& collected_shapes); + void OptimalStrategy( + const std::vector>& collected_shapes); + Status RangeStrategy( + const std::vector>& collected_shapes); +}; + +} // namespace tensorrt +} // namespace tensorflow + +#endif // GOOGLE_CUDA && GOOGLE_TENSORRT +#endif // TENSORFLOW_COMPILER_TF2TENSORRT_UTILS_TRT_SHAPE_OPTIMIZATION_PROFILES_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/utils/trt_tensor_proxy.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/utils/trt_tensor_proxy.h new file mode 100644 index 0000000000000000000000000000000000000000..5eea183fa9a364a63bdff533f5fa764ffd920006 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2tensorrt/utils/trt_tensor_proxy.h @@ -0,0 +1,458 @@ +/* Copyright 2021 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_TF2TENSORRT_UTILS_TRT_TENSOR_PROXY_H_ +#define TENSORFLOW_COMPILER_TF2TENSORRT_UTILS_TRT_TENSOR_PROXY_H_ + +#include +#include +#include +#include + +#include "tensorflow/compiler/tf2tensorrt/common/utils.h" +#include "tensorflow/core/platform/logging.h" + +#if GOOGLE_CUDA && GOOGLE_TENSORRT +#include "third_party/tensorrt/NvInfer.h" + +namespace tensorflow { + +namespace tensorrt { + +// SimpleITensor implements part of the ITensor interfaces to support the TF-TRT +// validator, as well as some TF-TRT tests. The former use case only utilizes +// the interfaces related to shape and type information. +class SimpleITensor { + public: + SimpleITensor(nvinfer1::DataType trt_dtype, const nvinfer1::Dims& trt_dims) + : trt_dtype_(trt_dtype), trt_dims_(trt_dims) {} + + SimpleITensor() : dynamic_range_min_(0.0f), dynamic_range_max_(0.0f) {} + SimpleITensor(const nvinfer1::Dims& dims) + : trt_dims_(dims), dynamic_range_min_(0.0f), dynamic_range_max_(0.0f) {} + + SimpleITensor(const std::vector& dims) { + trt_dims_.nbDims = dims.size(); + for (int i = 0; i < dims.size(); ++i) { + trt_dims_.d[i] = dims[i]; + } + dynamic_range_min_ = 0.0f; + dynamic_range_max_ = 0.0f; + } + + void setName(const char* name) {} + + const char* getName() const { return ""; } + + void setDimensions(nvinfer1::Dims dimensions) { trt_dims_ = dimensions; } + + nvinfer1::Dims getDimensions() const { return trt_dims_; } + + void setType(nvinfer1::DataType trt_dtype) { trt_dtype_ = trt_dtype; } + + nvinfer1::DataType getType() const { return trt_dtype_; } + + bool isNetworkInput() const { return false; } + + bool isNetworkOutput() const { return false; } + + void setBroadcastAcrossBatch(bool broadcastAcrossBatch) {} + + bool getBroadcastAcrossBatch() const { return false; } + + nvinfer1::TensorLocation getLocation() const { return location_; } + + void setLocation(nvinfer1::TensorLocation location) { location_ = location; } + bool setDynamicRange(float min, float max) { + dynamic_range_max_ = max; + dynamic_range_min_ = min; + return true; + } + + float getDynamicRange() const { + return (std::abs(dynamic_range_min_) + dynamic_range_max_) / 2.f; + } + bool dynamicRangeIsSet() const { return true; } + + void resetDynamicRange() { + dynamic_range_min_ = 0.f; + dynamic_range_max_ = 0.f; + } + float getDynamicRangeMin() const { return dynamic_range_min_; } + + float getDynamicRangeMax() const { return dynamic_range_max_; } + + void setAllowedFormats(nvinfer1::TensorFormats formats) {} + + nvinfer1::TensorFormats getAllowedFormats() const { return 1; } + + bool isShapeTensor() const { return false; } + bool isExecutionTensor() const { return true; } + + private: + nvinfer1::DataType trt_dtype_; + nvinfer1::Dims trt_dims_; + std::string name_; + nvinfer1::TensorLocation location_; + float dynamic_range_min_; + float dynamic_range_max_; +}; + +enum class TensorType : int { kTRT, kSIMPLE }; + +class ITensorProxy { + public: + //! ITensor not owned + ITensorProxy(nvinfer1::ITensor* trt_tensor) + : trt_tensor_(trt_tensor), ttype_(TensorType::kTRT) {} + + //! SimpleITensor owned + ITensorProxy(SimpleITensor* simple_itensor) + : simple_tensor_(simple_itensor), ttype_(TensorType::kSIMPLE) {} + + //! SimpleITensor owned + explicit ITensorProxy(nvinfer1::DataType trt_dtype, + const nvinfer1::Dims& trt_dims) + : simple_tensor_(std::unique_ptr( + new SimpleITensor(trt_dtype, trt_dims))), + ttype_(TensorType::kSIMPLE) {} + + //! Variants for testing purposes + ITensorProxy() + : simple_tensor_(std::unique_ptr(new SimpleITensor())), + ttype_(TensorType::kSIMPLE) {} + + explicit ITensorProxy(const nvinfer1::Dims& dims) + : simple_tensor_(std::unique_ptr(new SimpleITensor(dims))), + ttype_(TensorType::kSIMPLE) {} + + explicit ITensorProxy(const std::vector& dims) + : simple_tensor_(std::unique_ptr(new SimpleITensor(dims))), + ttype_(TensorType::kSIMPLE) {} + + bool is_trt_tensor() const { + CHECK(validate()); + return trt_tensor_ != nullptr; + } + + bool is_simple_tensor() const { + CHECK(validate()); + return simple_tensor_ != nullptr; + } + + TensorType ttype() const { return ttype_; } + + nvinfer1::ITensor* trt_tensor() const { + CHECK_NOTNULL(trt_tensor_); + CHECK(ttype_ == TensorType::kTRT); + return trt_tensor_; + } + + SimpleITensor* simple_tensor() const { + CHECK_NOTNULL(simple_tensor_); + CHECK(ttype_ == TensorType::kSIMPLE); + return simple_tensor_.get(); + } + + void setName(const char* name) { + switch (ttype_) { + case TensorType::kTRT: + return trt_tensor_->setName(name); + case TensorType::kSIMPLE: + return simple_tensor_->setName(name); + } + LOG(FATAL) << "Unsupported itensor_ type"; + } + + const char* getName() const { + switch (ttype_) { + case TensorType::kTRT: + return trt_tensor_->getName(); + case TensorType::kSIMPLE: + return simple_tensor_->getName(); + } + LOG(FATAL) << "Unsupported itensor_ type"; + } + + void setDimensions(nvinfer1::Dims dimensions) { + switch (ttype_) { + case TensorType::kTRT: + return trt_tensor_->setDimensions(dimensions); + case TensorType::kSIMPLE: + return simple_tensor_->setDimensions(dimensions); + } + LOG(FATAL) << "Unsupported itensor_ type"; + } + + nvinfer1::Dims getDimensions() const { + switch (ttype_) { + case TensorType::kTRT: + return trt_tensor_->getDimensions(); + case TensorType::kSIMPLE: + return simple_tensor_->getDimensions(); + } + LOG(FATAL) << "Unsupported itensor_ type"; + } + + void setType(nvinfer1::DataType type) { + switch (ttype_) { + case TensorType::kTRT: + return trt_tensor_->setType(type); + case TensorType::kSIMPLE: + return simple_tensor_->setType(type); + } + LOG(FATAL) << "Unsupported itensor_ type"; + } + + nvinfer1::DataType getType() const { + switch (ttype_) { + case TensorType::kTRT: + return trt_tensor_->getType(); + case TensorType::kSIMPLE: + return simple_tensor_->getType(); + } + LOG(FATAL) << "Unsupported itensor_ type"; + } + + bool isNetworkInput() const { + switch (ttype_) { + case TensorType::kTRT: + return trt_tensor_->isNetworkInput(); + case TensorType::kSIMPLE: + return simple_tensor_->isNetworkInput(); + } + LOG(FATAL) << "Unsupported itensor_ type"; + } + + bool isNetworkOutput() const { + switch (ttype_) { + case TensorType::kTRT: + return trt_tensor_->isNetworkOutput(); + case TensorType::kSIMPLE: + return simple_tensor_->isNetworkOutput(); + } + LOG(FATAL) << "Unsupported itensor_ type"; + } + + void setBroadcastAcrossBatch(bool broadcastAcrossBatch) { + switch (ttype_) { + case TensorType::kTRT: + return trt_tensor_->setBroadcastAcrossBatch(broadcastAcrossBatch); + case TensorType::kSIMPLE: + return simple_tensor_->setBroadcastAcrossBatch(broadcastAcrossBatch); + } + LOG(FATAL) << "Unsupported itensor_ type"; + } + + bool getBroadcastAcrossBatch() const { + switch (ttype_) { + case TensorType::kTRT: + return trt_tensor_->getBroadcastAcrossBatch(); + case TensorType::kSIMPLE: + return simple_tensor_->getBroadcastAcrossBatch(); + } + LOG(FATAL) << "Unsupported itensor_ type"; + } + + nvinfer1::TensorLocation getLocation() const { + switch (ttype_) { + case TensorType::kTRT: + return trt_tensor_->getLocation(); + case TensorType::kSIMPLE: + return simple_tensor_->getLocation(); + } + LOG(FATAL) << "Unsupported itensor_ type"; + } + + void setLocation(nvinfer1::TensorLocation location) { + switch (ttype_) { + case TensorType::kTRT: + return trt_tensor_->setLocation(location); + case TensorType::kSIMPLE: + return simple_tensor_->setLocation(location); + } + LOG(FATAL) << "Unsupported itensor_ type"; + } + + bool setDynamicRange(float min, float max) { + switch (ttype_) { + case TensorType::kTRT: + return trt_tensor_->setDynamicRange(min, max); + case TensorType::kSIMPLE: + return simple_tensor_->setDynamicRange(min, max); + } + LOG(FATAL) << "Unsupported itensor_ type"; + } + + bool dynamicRangeIsSet() const { + switch (ttype_) { + case TensorType::kTRT: + return trt_tensor_->dynamicRangeIsSet(); + case TensorType::kSIMPLE: + return simple_tensor_->dynamicRangeIsSet(); + } + LOG(FATAL) << "Unsupported itensor_ type"; + } + + void resetDynamicRange() { + switch (ttype_) { + case TensorType::kTRT: + return trt_tensor_->resetDynamicRange(); + case TensorType::kSIMPLE: + return simple_tensor_->resetDynamicRange(); + } + LOG(FATAL) << "Unsupported itensor_ type"; + } + float getDynamicRangeMin() const { + switch (ttype_) { + case TensorType::kTRT: + return trt_tensor_->getDynamicRangeMin(); + case TensorType::kSIMPLE: + return simple_tensor_->getDynamicRangeMin(); + } + LOG(FATAL) << "Unsupported itensor_ type"; + } + + float getDynamicRangeMax() const { + switch (ttype_) { + case TensorType::kTRT: + return trt_tensor_->getDynamicRangeMax(); + case TensorType::kSIMPLE: + return simple_tensor_->getDynamicRangeMax(); + } + LOG(FATAL) << "Unsupported itensor_ type"; + } +#if !IS_TRT_VERSION_GE(8, 0, 0, 0) + float getDynamicRange() const { + switch (ttype_) { + case TensorType::kTRT: + return trt_tensor_->getDynamicRange(); + case TensorType::kSIMPLE: + return simple_tensor_->getDynamicRange(); + } + LOG(FATAL) << "Unsupported itensor_ type"; + } +#endif + void setAllowedFormats(nvinfer1::TensorFormats formats) { + switch (ttype_) { + case TensorType::kTRT: + return trt_tensor_->setAllowedFormats(formats); + case TensorType::kSIMPLE: + return simple_tensor_->setAllowedFormats(formats); + } + LOG(FATAL) << "Unsupported itensor_ type"; + } + + nvinfer1::TensorFormats getAllowedFormats() const { + switch (ttype_) { + case TensorType::kTRT: + return trt_tensor_->getAllowedFormats(); + case TensorType::kSIMPLE: + return simple_tensor_->getAllowedFormats(); + } + LOG(FATAL) << "Unsupported itensor_ type"; + } + + bool isShapeTensor() const { + switch (ttype_) { + case TensorType::kTRT: + return trt_tensor_->isShapeTensor(); + case TensorType::kSIMPLE: + return simple_tensor_->isShapeTensor(); + } + LOG(FATAL) << "Unsupported itensor_ type"; + } + + bool isExecutionTensor() const { + switch (ttype_) { + case TensorType::kTRT: + return trt_tensor_->isExecutionTensor(); + case TensorType::kSIMPLE: + return simple_tensor_->isExecutionTensor(); + } + LOG(FATAL) << "Unsupported itensor_ type"; + } + + private: + bool validate() const { + return (trt_tensor_ && !simple_tensor_) || (!trt_tensor_ && simple_tensor_); + } + + // When ITensorProxy represents an ITensor, the ITensor can be either passed + // by the caller via the constructor that takes an ITensor* as parameter, or + // be created as a SimpleITensor. + // + // In the first case, the ITensor pointer is stored in 'tensor_' below, and + // the ITensor itself is not owned by this class. This method is used by + // Converter (e.g. AddInputTensor) and op converters during TRT network + // construction, where the TRT network owns the ITensor. + // + nvinfer1::ITensor* trt_tensor_ = nullptr; // Not owned. + // In the second case, the created SimpleITensor is stored in + // 'simple_itensor_' below and is owned by this class. SimpleITensor is a fake + // implementation of ITensor and is used for testing and by TrtNodeValidator + // to validate the graph nodes. + std::shared_ptr simple_tensor_ = nullptr; + + TensorType ttype_; +}; + +class ITensorProxyPtr { + public: + ITensorProxyPtr(std::nullptr_t) : p_(nullptr) {} + ITensorProxyPtr(ITensorProxy* p) : p_(p) {} + ITensorProxyPtr(nvinfer1::ITensor* p) : p_(new ITensorProxy(p)) {} + ITensorProxyPtr(SimpleITensor* p) : p_(new ITensorProxy(p)) {} + + ITensorProxyPtr() : p_(new ITensorProxy()) {} + ITensorProxyPtr(const nvinfer1::Dims& dims) : p_(new ITensorProxy(dims)) {} + ITensorProxyPtr(const std::vector& dims) : p_(new ITensorProxy(dims)) {} + + std::shared_ptr p_{nullptr}; + ITensorProxy* operator->() { return p_.get(); } + ITensorProxy* operator->() const { return p_.get(); } + ITensorProxy* operator*() { return p_.get(); } + ITensorProxy* operator*() const { return p_.get(); } +}; + +inline bool operator==(const ITensorProxyPtr& p1, const ITensorProxyPtr& p2) { + if (p1.p_ == nullptr) { + return p2.p_ == nullptr; + } + if (p2.p_ == nullptr) { + return p1.p_ == nullptr; + } + return (p1->ttype() == p2->ttype()) && + ((p1->ttype() == TensorType::kTRT && + p1->trt_tensor() == p2->trt_tensor()) || + (p1->ttype() == TensorType::kSIMPLE && + p1->simple_tensor() == p2->simple_tensor())); +} + +inline bool operator!=(const ITensorProxyPtr& p1, const ITensorProxyPtr& p2) { + return !(p1 == p2); +} + +struct ITensorProxyHash { + size_t operator()(const ITensorProxyPtr& tensor) const { + return reinterpret_cast(tensor.p_.get()); + } +}; + +} // namespace tensorrt +} // namespace tensorflow +#endif // GOOGLE_CUDA && GOOGLE_TENSORRT + +#endif // TENSORFLOW_COMPILER_TF2TENSORRT_UTILS_TRT_TENSOR_PROXY_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/cc/ops/xla_jit_ops.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/cc/ops/xla_jit_ops.h new file mode 100644 index 0000000000000000000000000000000000000000..81f75dce7f1e15845a400e89d83b21b16d12c974 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/cc/ops/xla_jit_ops.h @@ -0,0 +1,158 @@ +// This file is MACHINE GENERATED! Do not edit. + +#ifndef TENSORFLOW_COMPILER_TF_XLA_CC_OPS_XLA_JIT_OPS_H_ +#define TENSORFLOW_COMPILER_TF_XLA_CC_OPS_XLA_JIT_OPS_H_ + +// This file is MACHINE GENERATED! Do not edit. + +#include "tensorflow/cc/framework/ops.h" +#include "tensorflow/cc/framework/scope.h" +#include "tensorflow/core/framework/tensor.h" +#include "tensorflow/core/framework/tensor_shape.h" +#include "tensorflow/core/framework/types.h" +#include "tensorflow/core/lib/gtl/array_slice.h" + +namespace tensorflow { +namespace ops { + +/// @defgroup xla_jit_ops Xla Jit Ops +/// @{ + +/// Operator that connects the output of an XLA computation to other consumer graph nodes. +/// +/// Args: +/// * scope: A Scope object +/// +/// Returns: +/// * `Output`: The outputs tensor. +class XlaClusterOutput { + public: + XlaClusterOutput(const ::tensorflow::Scope& scope, ::tensorflow::Input input); + operator ::tensorflow::Output() const { return outputs; } + operator ::tensorflow::Input() const { return outputs; } + ::tensorflow::Node* node() const { return outputs.node(); } + + Operation operation; + ::tensorflow::Output outputs; +}; + +/// XLA Launch Op. For use by the XLA JIT only. +/// +/// Args: +/// * scope: A Scope object +/// +/// Returns: +/// * `OutputList`: The results tensor. +class XlaLaunch { + public: + XlaLaunch(const ::tensorflow::Scope& scope, ::tensorflow::InputList constants, + ::tensorflow::InputList args, ::tensorflow::InputList resources, + const DataTypeSlice& Tresults, const NameAttrList& function); + ::tensorflow::Output operator[](size_t index) const { return results[index]; } + + + Operation operation; + ::tensorflow::OutputList results; +}; + +/// XLA Launch Op. For use by the XLA JIT only. +/// +/// Args: +/// * scope: A Scope object +/// +/// Returns: +/// * `OutputList`: The results tensor. +class XlaLaunchV2 { + public: + XlaLaunchV2(const ::tensorflow::Scope& scope, ::tensorflow::InputList args, + const DataTypeSlice& Tresults, const gtl::ArraySlice& + constants, const gtl::ArraySlice& resources, const + NameAttrList& function); + ::tensorflow::Output operator[](size_t index) const { return results[index]; } + + + Operation operation; + ::tensorflow::OutputList results; +}; + +/// XLA Compile Op. For use by the XLA JIT only. +/// +/// Compiles a TensorFlow function into an XLA LocalExecutable and returns a key +/// that _XlaRun can use to look up the LocalExecutable and execute it. +/// +/// Args: +/// * scope: A Scope object +/// +/// Returns: +/// * `Output` key: A key that can be used to look up the local executable compiled by the +/// node and associated metadata. +/// * `Output` compilation_successful: If the `must_compile` attr is false the _XlaCompile op +/// can decide not to compile the clusters based on some profitability +/// heuristics. In that case `compilation_successful` is false if _XlaCompile +/// chose not to compile the cluster. If the `must_compile` attr is true then +/// _XlaCompile always attempts to compile the cluster and +/// `compilation_successful` is always true. +class _XlaCompile { + public: + _XlaCompile(const ::tensorflow::Scope& scope, ::tensorflow::InputList + constants, ::tensorflow::InputList args, ::tensorflow::InputList + resources, bool must_compile, const NameAttrList& function); + + Operation operation; + ::tensorflow::Output key; + ::tensorflow::Output compilation_successful; +}; + +/// XLA Merge Op. For use by the XLA JIT only. +/// +/// Merges the outputs from the PartitionedCall node and the _XlaRun node. +/// Unlike the TensorFlow Merge op, which requires inputs of some types to be +/// placed on the host, the _XlaMerge op can merge inputs of all types when +/// placed on the device. This prevents the need for copy operations, in +/// particular when an XLA cluster has int32 outputs. The _XlaMerge up does not +/// have a value_index output that identifies the chosen input. +/// +/// Args: +/// * scope: A Scope object +/// +/// Returns: +/// * `Output`: The output tensor. +class _XlaMerge { + public: + _XlaMerge(const ::tensorflow::Scope& scope, ::tensorflow::Input + partitioned_call, ::tensorflow::Input xla_run); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + Operation operation; + ::tensorflow::Output output; +}; + +/// XLA Run Op. For use by the XLA JIT only. +/// +/// Executes a TensorFlow function previously compiled into a LocalExecutable by an +/// _XlaCompile op. +/// +/// Args: +/// * scope: A Scope object +/// +/// Returns: +/// * `OutputList`: The results tensor. +class _XlaRun { + public: + _XlaRun(const ::tensorflow::Scope& scope, ::tensorflow::InputList args, + ::tensorflow::Input key, const DataTypeSlice& Tresults); + ::tensorflow::Output operator[](size_t index) const { return results[index]; } + + + Operation operation; + ::tensorflow::OutputList results; +}; + +/// @} + +} // namespace ops +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_TF_XLA_CC_OPS_XLA_JIT_OPS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/cc/ops/xla_ops.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/cc/ops/xla_ops.h new file mode 100644 index 0000000000000000000000000000000000000000..3b64a3f7ccc9556ddbc6105cbb1d41539e9c4af7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/cc/ops/xla_ops.h @@ -0,0 +1,1459 @@ +// This file is MACHINE GENERATED! Do not edit. + +#ifndef TENSORFLOW_COMPILER_TF_XLA_CC_OPS_XLA_OPS_H_ +#define TENSORFLOW_COMPILER_TF_XLA_CC_OPS_XLA_OPS_H_ + +// This file is MACHINE GENERATED! Do not edit. + +#include "tensorflow/cc/framework/ops.h" +#include "tensorflow/cc/framework/scope.h" +#include "tensorflow/core/framework/tensor.h" +#include "tensorflow/core/framework/tensor_shape.h" +#include "tensorflow/core/framework/types.h" +#include "tensorflow/core/lib/gtl/array_slice.h" + +namespace tensorflow { +namespace ops { + +/// @defgroup xla_ops Xla Ops +/// @{ + +/// Wraps the XLA AllReduce operator +/// +/// documented at https://www.tensorflow.org/xla/operation_semantics#allreduce. +/// +/// Args: +/// * scope: A Scope object +/// * input: Array or a non-empty tuple of arrays to reduce across replicas. +/// * group_assignment: Groups between which the reductions are performed. +/// * reduce_op: Reduction computation. +/// * mode: group mode. +/// CrossReplica: group_assignment contains replica_id. Each group contains the +/// replicas for the current partition. +/// CrossReplicaAndPartition: group_assignment contains replica_id. Each group +/// contains the replicas for all partitions. +/// +/// Returns: +/// * `Output`: The output tensor. +class XlaAllReduce { + public: + XlaAllReduce(const ::tensorflow::Scope& scope, ::tensorflow::Input input, + ::tensorflow::Input group_assignment, StringPiece reduce_op, + StringPiece mode); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + Operation operation; + ::tensorflow::Output output; +}; + +/// Helper operator for performing XLA-style broadcasts +/// +/// Broadcasts `lhs` and `rhs` to the same rank, by adding size 1 dimensions to +/// whichever of `lhs` and `rhs` has the lower rank, using XLA's broadcasting rules +/// for binary operators. +/// +/// Args: +/// * scope: A Scope object +/// * lhs: the LHS input tensor +/// * rhs: the RHS input tensor +/// * broadcast_dims: an XLA-style broadcast dimension specification +/// +/// Returns: +/// * `Output` lhs_output: the broadcasted LHS tensor +/// * `Output` rhs_output: the broadcasted RHS tensor +class XlaBroadcastHelper { + public: + XlaBroadcastHelper(const ::tensorflow::Scope& scope, ::tensorflow::Input lhs, + ::tensorflow::Input rhs, ::tensorflow::Input broadcast_dims); + + Operation operation; + ::tensorflow::Output lhs_output; + ::tensorflow::Output rhs_output; +}; + +/// Invokes a StableHLO module. +/// +/// This op is used with JAX native serialization in a TensorFlow context with +/// stability guarantees. +/// +/// Args: +/// * scope: A Scope object +/// * args: A list of `Tensor` with possibly different types to be passed as arguments +/// to the `module`. These are the actual arguments and do not include the +/// platform argument (see `platforms`) nor the dimension arguments (see +/// `dim_args_spec`). +/// * version: Tracks changes the semantics of the op, to support backwards +/// compatibility. Minimum supported version is 2. From +/// version 2, the op carries a StableHLO text or bytecode `module`. From +/// version 3, the op also supports the `platforms` attribute. From version 4, +/// the op carries a StableHLO module with compatibility guarantees. From version +/// 5, XLACallModule can include `stablehlo.custom_call` op to execute tf +/// functions. From version 6 the op supports the `disabled_checks` attribute. +/// See more versioning details at https://github.com/search?q=repo%3Atensorflow%2Ftensorflow+path%3Axla_call_module+%22int+VERSION_MAXIMUM_SUPPORTED%22&type=code. +/// * module_: A serialized computation, a text or bytecode representation of +/// an mlir.Module. The return type must be a tuple if and only if the `Sout` is +/// a list with 0 or more than 1 elements. The length of `Tout` and +/// `Sout` must match. This op always returns a tuple of results, even if the +/// module returns a single result. +/// * Sout: List of output tensor shapes. +/// * Tout: List of output tensor data types. +/// +/// Optional attributes (see `Attrs`): +/// * dim_args_spec: in presence of dynamic shapes, this is the specification for the +/// dimension arguments. In absence of dynamic shapes this list is empty. The +/// `module` takes one 0-dimensional integer tensor dimension argument for each +/// element of `dim_spec_args`. The dimension arguments come after the platform +/// index argument and before the actual arguments. Each specification is a +/// string of the form "." that specifies that the value of +/// the corresponding dimension argument must be "args[arg_idx].shape[axis_idx]", +/// where "args" are the actual array arguments. +/// This attribute is not used anymore in modules serialized with version 5 +/// after March 28th, 2023 and JAX OSS versions higher than 0.4.6. +/// TODO(b/283439649): remove support for dim_args_spec. +/// * platforms: the list of platforms supported by `module`. The list can contain +/// the strings "CPU", "CUDA", "ROCM", or "TPU". It is an error to compile +/// this op for a platform that does not appear in the list. This check can be +/// disabled using `disabled_checks`. If the list contains more than +/// one platform, then the `module` takes one additional 0-dimensional +/// integer-tensor parameter in the first position, encoding the index in +/// `platforms` of the current compilation platform. This parameter has value 0 +/// if the plaform is not among `platforms` and the check has been disabled. +/// The list can be empty in old versions (earlier than 6) to denote that no +/// platform checking must be performed at loading time. +/// * function_list: This list contains the TensorFlow FunctionDefs that are used by +/// the XLACallModule. If the XLACallModule contains `stablehlo.custom_call` +/// operations, they can call TensorFlow graph functions outside of the +/// XLACallModule. This `function_list` attribute registers the dependency of the +/// XLACallModule on those functions. This attribute was added in version 5. +/// * has_token_input_output: If true, the embedded StableHLO module's main function +/// must take a `!stablehlo.token` as its first argument and returns a token as +/// its first result. This can be used in conjunction with the TF2XLA's side +/// effect mechanism in order to model side effects. +/// * disabled_checks: A list of strings describing the safety checks that were +/// disabled at serialization time. This attribute was added in version 6. +/// For more details see +/// https://github.com/search?q=repo%3Agoogle%2Fjax+path%3Ajax_export+%22class+DisabledSafetyCheck%22&type=code. +/// This list, supplemented with a comma-separate list of directives specified +/// using the flag --tf_xla_call_module_disabled_checks, +/// is used at module loading time to skip the corresponding checks. +/// +/// Returns: +/// * `OutputList`: The output tensor. +class XlaCallModule { + public: + /// Optional attribute setters for XlaCallModule + struct Attrs { + /// in presence of dynamic shapes, this is the specification for the + /// dimension arguments. In absence of dynamic shapes this list is empty. The + /// `module` takes one 0-dimensional integer tensor dimension argument for each + /// element of `dim_spec_args`. The dimension arguments come after the platform + /// index argument and before the actual arguments. Each specification is a + /// string of the form "." that specifies that the value of + /// the corresponding dimension argument must be "args[arg_idx].shape[axis_idx]", + /// where "args" are the actual array arguments. + /// This attribute is not used anymore in modules serialized with version 5 + /// after March 28th, 2023 and JAX OSS versions higher than 0.4.6. + /// TODO(b/283439649): remove support for dim_args_spec. + /// + /// Defaults to [] + TF_MUST_USE_RESULT Attrs DimArgsSpec(const gtl::ArraySlice<::tensorflow::tstring>& x) { + Attrs ret = *this; + ret.dim_args_spec_ = x; + return ret; + } + + /// the list of platforms supported by `module`. The list can contain + /// the strings "CPU", "CUDA", "ROCM", or "TPU". It is an error to compile + /// this op for a platform that does not appear in the list. This check can be + /// disabled using `disabled_checks`. If the list contains more than + /// one platform, then the `module` takes one additional 0-dimensional + /// integer-tensor parameter in the first position, encoding the index in + /// `platforms` of the current compilation platform. This parameter has value 0 + /// if the plaform is not among `platforms` and the check has been disabled. + /// The list can be empty in old versions (earlier than 6) to denote that no + /// platform checking must be performed at loading time. + /// + /// Defaults to [] + TF_MUST_USE_RESULT Attrs Platforms(const gtl::ArraySlice<::tensorflow::tstring>& x) { + Attrs ret = *this; + ret.platforms_ = x; + return ret; + } + + /// This list contains the TensorFlow FunctionDefs that are used by + /// the XLACallModule. If the XLACallModule contains `stablehlo.custom_call` + /// operations, they can call TensorFlow graph functions outside of the + /// XLACallModule. This `function_list` attribute registers the dependency of the + /// XLACallModule on those functions. This attribute was added in version 5. + /// + /// Defaults to [] + TF_MUST_USE_RESULT Attrs FunctionList(const gtl::ArraySlice& x) { + Attrs ret = *this; + ret.function_list_ = x; + return ret; + } + + /// If true, the embedded StableHLO module's main function + /// must take a `!stablehlo.token` as its first argument and returns a token as + /// its first result. This can be used in conjunction with the TF2XLA's side + /// effect mechanism in order to model side effects. + /// + /// Defaults to false + TF_MUST_USE_RESULT Attrs HasTokenInputOutput(bool x) { + Attrs ret = *this; + ret.has_token_input_output_ = x; + return ret; + } + + /// A list of strings describing the safety checks that were + /// disabled at serialization time. This attribute was added in version 6. + /// For more details see + /// https://github.com/search?q=repo%3Agoogle%2Fjax+path%3Ajax_export+%22class+DisabledSafetyCheck%22&type=code. + /// This list, supplemented with a comma-separate list of directives specified + /// using the flag --tf_xla_call_module_disabled_checks, + /// is used at module loading time to skip the corresponding checks. + /// + /// Defaults to [] + TF_MUST_USE_RESULT Attrs DisabledChecks(const gtl::ArraySlice<::tensorflow::tstring>& x) { + Attrs ret = *this; + ret.disabled_checks_ = x; + return ret; + } + + gtl::ArraySlice<::tensorflow::tstring> dim_args_spec_ = {}; + gtl::ArraySlice<::tensorflow::tstring> platforms_ = {}; + gtl::ArraySlice function_list_ = {}; + bool has_token_input_output_ = false; + gtl::ArraySlice<::tensorflow::tstring> disabled_checks_ = {}; + }; + XlaCallModule(const ::tensorflow::Scope& scope, ::tensorflow::InputList args, + int64 version, StringPiece module_, const + gtl::ArraySlice& Sout, const DataTypeSlice& + Tout); + XlaCallModule(const ::tensorflow::Scope& scope, ::tensorflow::InputList args, + int64 version, StringPiece module_, const + gtl::ArraySlice& Sout, const DataTypeSlice& + Tout, const XlaCallModule::Attrs& attrs); + ::tensorflow::Output operator[](size_t index) const { return output[index]; } + + + static Attrs DimArgsSpec(const gtl::ArraySlice<::tensorflow::tstring>& x) { + return Attrs().DimArgsSpec(x); + } + static Attrs Platforms(const gtl::ArraySlice<::tensorflow::tstring>& x) { + return Attrs().Platforms(x); + } + static Attrs FunctionList(const gtl::ArraySlice& x) { + return Attrs().FunctionList(x); + } + static Attrs HasTokenInputOutput(bool x) { + return Attrs().HasTokenInputOutput(x); + } + static Attrs DisabledChecks(const gtl::ArraySlice<::tensorflow::tstring>& x) { + return Attrs().DisabledChecks(x); + } + + Operation operation; + ::tensorflow::OutputList output; +}; + +/// Wraps the XLA ConvGeneralDilated operator, documented at +/// +/// https://www.tensorflow.org/performance/xla/operation_semantics#conv_convolution +/// . +/// +/// Args: +/// * scope: A Scope object +/// * lhs: the input tensor +/// * rhs: the kernel tensor +/// * window_strides: the inter-window strides +/// * padding: the padding to apply at the start and end of each input dimensions +/// * lhs_dilation: dilation to apply between input elements +/// * rhs_dilation: dilation to apply between kernel elements +/// * feature_group_count: number of feature groups for grouped convolution. +/// * dimension_numbers: a serialized xla::ConvolutionDimensionNumbers proto. +/// * precision_config: a serialized xla::PrecisionConfig proto. +/// +/// Returns: +/// * `Output`: The output tensor. +class XlaConv { + public: + XlaConv(const ::tensorflow::Scope& scope, ::tensorflow::Input lhs, + ::tensorflow::Input rhs, ::tensorflow::Input window_strides, + ::tensorflow::Input padding, ::tensorflow::Input lhs_dilation, + ::tensorflow::Input rhs_dilation, ::tensorflow::Input + feature_group_count, StringPiece dimension_numbers, StringPiece + precision_config); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + Operation operation; + ::tensorflow::Output output; +}; + +/// Wraps the XLA ConvGeneralDilated operator, documented at +/// +/// https://www.tensorflow.org/performance/xla/operation_semantics#conv_convolution +/// . +/// +/// Args: +/// * scope: A Scope object +/// * lhs: input tensor +/// * rhs: kernel tensor +/// * window_strides: inter-window strides +/// * padding: padding to apply at the start and end of each input dimensions +/// * lhs_dilation: dilation to apply between input elements +/// * rhs_dilation: dilation to apply between kernel elements +/// * feature_group_count: number of feature groups for grouped convolution. +/// * dimension_numbers: serialized xla::ConvolutionDimensionNumbers proto. +/// * precision_config: serialized xla::PrecisionConfig proto. +/// * preferred_element_type: type of the tensor. +/// +/// Optional attributes (see `Attrs`): +/// * batch_group_count: number of batch groups or grouped filters. +/// +/// Returns: +/// * `Output`: The output tensor. +class XlaConvV2 { + public: + /// Optional attribute setters for XlaConvV2 + struct Attrs { + /// number of batch groups or grouped filters. + /// + /// Defaults to 1 + TF_MUST_USE_RESULT Attrs BatchGroupCount(int64 x) { + Attrs ret = *this; + ret.batch_group_count_ = x; + return ret; + } + + int64 batch_group_count_ = 1; + }; + XlaConvV2(const ::tensorflow::Scope& scope, ::tensorflow::Input lhs, + ::tensorflow::Input rhs, ::tensorflow::Input window_strides, + ::tensorflow::Input padding, ::tensorflow::Input lhs_dilation, + ::tensorflow::Input rhs_dilation, ::tensorflow::Input + feature_group_count, StringPiece dimension_numbers, StringPiece + precision_config, DataType preferred_element_type); + XlaConvV2(const ::tensorflow::Scope& scope, ::tensorflow::Input lhs, + ::tensorflow::Input rhs, ::tensorflow::Input window_strides, + ::tensorflow::Input padding, ::tensorflow::Input lhs_dilation, + ::tensorflow::Input rhs_dilation, ::tensorflow::Input + feature_group_count, StringPiece dimension_numbers, StringPiece + precision_config, DataType preferred_element_type, const + XlaConvV2::Attrs& attrs); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + static Attrs BatchGroupCount(int64 x) { + return Attrs().BatchGroupCount(x); + } + + Operation operation; + ::tensorflow::Output output; +}; + +/// Wraps the XLA CustomCall operator +/// +/// documented at https://www.tensorflow.org/xla/operation_semantics#customcall. +/// +/// Args: +/// * scope: A Scope object +/// * args: A list of `Tensor` with possibly different types. +/// * target_name: Name of the function. A call instruction will be emitted which +/// targets this symbol name. +/// * backend_config: String, used to encode serialized metadata to the backend. +/// * dtype: Output tensor data type. +/// * shape: Output tensor shape. +/// +/// Returns: +/// * `Output`: The output tensor. +class XlaCustomCall { + public: + XlaCustomCall(const ::tensorflow::Scope& scope, ::tensorflow::InputList args, + StringPiece target_name, StringPiece backend_config, DataType + dtype, PartialTensorShape shape); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + Operation operation; + ::tensorflow::Output output; +}; + +/// Emits an HLO `CustomCall` operation with multiple outputs. +/// +/// As opposed to `XlaCustomCall`, this operation supports multiple outputs. +/// +/// See `CustomCall` specification at +/// https://tensorflow.org/xla/operation_semantics#customcall, +/// and `mhlo.custom_call` specification at +/// https://tensorflow.org/mlir/hlo_ops#mhlocustom_call_mlirmhlocustomcallop. +/// +/// Args: +/// * scope: A Scope object +/// * operands: A sequence of tensors with possibly different types. +/// * call_target_name: Name of the user function. The function signature must conform +/// to version 3 of the API, see `API_VERSION_STATUS_RETURNING_UNIFIED`. All +/// operands and results assumed to be in the default layout. +/// * backend_config: A string that encodes a metadata for the backend. +/// * has_side_effect: Indicates whether the custom call has side effects. +/// * result_dtypes: Types of all results. +/// * result_shapes: Shapes of all results. +/// +/// Returns: +/// * `OutputList`: The results tensor. +class XlaCustomCallV2 { + public: + XlaCustomCallV2(const ::tensorflow::Scope& scope, ::tensorflow::InputList + operands, StringPiece call_target_name, StringPiece + backend_config, bool has_side_effect, const DataTypeSlice& + result_dtypes, const gtl::ArraySlice& + result_shapes); + ::tensorflow::Output operator[](size_t index) const { return results[index]; } + + + Operation operation; + ::tensorflow::OutputList results; +}; + +/// Takes the packed uint32 input and unpacks the input to uint8 to do +/// +/// Dequantization on device. +/// +/// Args: +/// * scope: A Scope object +/// * input: Input tensors whose types is uint32, shape is [d0, ..., dn]. +/// * min_range: The minimum scalar value possibly produced for the input. +/// * max_range: The maximum scalar value possibly produced for the input. +/// * mode: String to determine the dequantize mode in {"MIN_COMBINED", "MIN_FIRST", "SCALED"}. +/// * transpose_output: Boolean to determine if output is transposed. transpose_output +/// is faster when input is large and rank of input is higher than 1. +/// +/// Returns: +/// * `Output`: Output tensors whose types is bfloat16. If transpose_output is true, +/// output shape is [dn * 4, dn-1, ..., d1, d0]. If transpose_output +/// is false, output shape is [d0,..., dn * 4]. +class XlaDequantize { + public: + XlaDequantize(const ::tensorflow::Scope& scope, ::tensorflow::Input input, + float min_range, float max_range, StringPiece mode, bool + transpose_output); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + Operation operation; + ::tensorflow::Output output; +}; + +/// Wraps the XLA DotGeneral operator, documented at +/// +/// https://www.tensorflow.org/performance/xla/operation_semantics#dotgeneral +/// . +/// +/// Args: +/// * scope: A Scope object +/// * lhs: the LHS tensor +/// * rhs: the RHS tensor +/// * dimension_numbers: a serialized xla::DotDimensionNumbers proto. +/// * precision_config: a serialized xla::PrecisionConfig proto. +/// +/// Returns: +/// * `Output`: The output tensor. +class XlaDot { + public: + XlaDot(const ::tensorflow::Scope& scope, ::tensorflow::Input lhs, + ::tensorflow::Input rhs, StringPiece dimension_numbers, StringPiece + precision_config); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + Operation operation; + ::tensorflow::Output output; +}; + +/// Wraps the XLA DotGeneral operator, documented at +/// +/// https://www.tensorflow.org/performance/xla/operation_semantics#dotgeneral +/// . +/// +/// Args: +/// * scope: A Scope object +/// * lhs: the LHS tensor +/// * rhs: the RHS tensor +/// * dimension_numbers: a serialized xla::DotDimensionNumbers proto. +/// * precision_config: a serialized xla::PrecisionConfig proto. +/// * preferred_element_type: The type of the tensor. +/// +/// Returns: +/// * `Output`: The output tensor. +class XlaDotV2 { + public: + XlaDotV2(const ::tensorflow::Scope& scope, ::tensorflow::Input lhs, + ::tensorflow::Input rhs, StringPiece dimension_numbers, StringPiece + precision_config, DataType preferred_element_type); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + Operation operation; + ::tensorflow::Output output; +}; + +/// Wraps the XLA DynamicSlice operator, documented at +/// +/// https://www.tensorflow.org/performance/xla/operation_semantics#dynamicslice +/// . +/// +/// DynamicSlice extracts a sub-array from the input array at dynamic +/// start_indices. The size of the slice in each dimension is passed in +/// size_indices, which specify the end point of exclusive slice intervals in each +/// dimension -- [start, start + size). The shape of start_indices must have rank 1, +/// with dimension size equal to the rank of operand. +/// +/// Args: +/// * scope: A Scope object +/// * input: A `Tensor` of type T. +/// * start_indices: List of N integers containing the slice size for each +/// dimension. Each value must be strictly greater than zero, and start + size +/// must be less than or equal to the size of the dimension to avoid +/// implementation defined behavior. +/// +/// Returns: +/// * `Output`: The output tensor. +class XlaDynamicSlice { + public: + XlaDynamicSlice(const ::tensorflow::Scope& scope, ::tensorflow::Input input, + ::tensorflow::Input start_indices, ::tensorflow::Input + size_indices); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + Operation operation; + ::tensorflow::Output output; +}; + +/// Wraps the XLA DynamicUpdateSlice operator, documented at +/// +/// https://www.tensorflow.org/performance/xla/operation_semantics#dynamicupdateslice +/// . +/// +/// XlaDynamicUpdateSlice generates a result which is the value of the `input` +/// operand, with a slice update overwritten at `indices`. The shape of `update` +/// determines the shape of the sub-array of the result which is updated. The shape +/// of indices must be rank == 1, with dimension size equal to the rank of `input`. +/// +/// Handling of out-of-bounds slice indices is implementation-defined. +/// +/// Args: +/// * scope: A Scope object +/// * input: A `Tensor` of type T. +/// * update: A `Tensor` of type T. Same rank as `input`. +/// * indices: A vector of indices into `input`. Must have length equal to the rank of +/// `input`. +/// +/// Returns: +/// * `Output`: A `Tensor` of type T. +class XlaDynamicUpdateSlice { + public: + XlaDynamicUpdateSlice(const ::tensorflow::Scope& scope, ::tensorflow::Input + input, ::tensorflow::Input update, ::tensorflow::Input + indices); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + Operation operation; + ::tensorflow::Output output; +}; + +/// An op which supports basic einsum op with 2 inputs and 1 output. +/// +/// This op has better TPU performance since it doesn't have explicitly reshape and +/// transpose operations as tf.einsum does. +/// +/// Args: +/// * scope: A Scope object +/// +/// Returns: +/// * `Output`: The product tensor. +class XlaEinsum { + public: + XlaEinsum(const ::tensorflow::Scope& scope, ::tensorflow::Input a, + ::tensorflow::Input b, StringPiece equation); + operator ::tensorflow::Output() const { return product; } + operator ::tensorflow::Input() const { return product; } + ::tensorflow::Node* node() const { return product.node(); } + + Operation operation; + ::tensorflow::Output product; +}; + +/// Wraps the XLA Gather operator documented at +/// +/// https://www.tensorflow.org/xla/operation_semantics#gather +/// +/// Args: +/// * scope: A Scope object +/// * operand: The array we're gathering from. +/// * start_indices: Array containing the starting indices of the slices we gather. +/// * slice_sizes: slice_sizes[i] is the bounds for the slice on dimension i. +/// * dimension_numbers: A serialized xla::GatherDimensionNumbers proto. +/// * indices_are_sorted: Boolean indicating if the indices are sorted. +/// +/// Returns: +/// * `Output`: The output tensor. +class XlaGather { + public: + XlaGather(const ::tensorflow::Scope& scope, ::tensorflow::Input operand, + ::tensorflow::Input start_indices, ::tensorflow::Input slice_sizes, + StringPiece dimension_numbers, bool indices_are_sorted); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + Operation operation; + ::tensorflow::Output output; +}; + +/// output = cond ? then_branch(inputs) : else_branch(inputs). +/// +/// Args: +/// * scope: A Scope object +/// * cond: A boolean scalar. +/// * inputs: A list of input tensors. +/// * then_branch: A function takes 'inputs' and returns a list of tensors, +/// whose types are the same as what else_branch returns. +/// * else_branch: A function takes 'inputs' and returns a list of tensors. +/// whose types are the same as what then_branch returns. +/// +/// Returns: +/// * `OutputList`: A list of tensors returned by either then_branch(inputs) or +/// else_branch(inputs). The input shapes of the then_branch and +/// else_branch must match. +class XlaIf { + public: + XlaIf(const ::tensorflow::Scope& scope, ::tensorflow::Input cond, + ::tensorflow::InputList inputs, const NameAttrList& then_branch, const + NameAttrList& else_branch, const DataTypeSlice& Tout); + ::tensorflow::Output operator[](size_t index) const { return output[index]; } + + + Operation operation; + ::tensorflow::OutputList output; +}; + +/// Wraps the XLA Sort operator, documented at +/// +/// https://www.tensorflow.org/performance/xla/operation_semantics#sort +/// . +/// +/// Sorts a tensor. Currently only sorts in ascending order are supported. +/// +/// Args: +/// * scope: A Scope object +/// * keys: A `Tensor` of type K. +/// * values: A `Tensor` of type V. +/// +/// Returns: +/// * `Output` sorted_keys: A `Tensor` of type K. +/// * `Output` sorted_values: A `Tensor` of type V. +class XlaKeyValueSort { + public: + XlaKeyValueSort(const ::tensorflow::Scope& scope, ::tensorflow::Input keys, + ::tensorflow::Input values); + + Operation operation; + ::tensorflow::Output sorted_keys; + ::tensorflow::Output sorted_values; +}; + +/// Wraps the XLA OptimizationBarrier operator. +/// +/// Documented at https://www.tensorflow.org/xla/operation_semantics#optimizationbarrier. +/// +/// Args: +/// * scope: A Scope object +/// * input: A Tuple of Arrays of any type. +/// +/// Returns: +/// * `OutputList`: The output tensor. +class XlaOptimizationBarrier { + public: + XlaOptimizationBarrier(const ::tensorflow::Scope& scope, + ::tensorflow::InputList input); + ::tensorflow::Output operator[](size_t index) const { return output[index]; } + + + Operation operation; + ::tensorflow::OutputList output; +}; + +/// Wraps the XLA Pad operator, documented at +/// +/// https://www.tensorflow.org/performance/xla/operation_semantics#pad +/// . +/// +/// Args: +/// * scope: A Scope object +/// * input: A `Tensor` of type T. +/// * padding_value: A scalar `Tensor` of type T. +/// * padding_low: the padding to apply at the start of each input dimensions. Must +/// be a compile-time constant 1D tensor of length equal to rank of input. +/// * padding_high: the padding to apply at the end of each input dimension. Must +/// be a compile-time constant 1D tensor of length equal to rank of input. +/// * padding_interior: the padding to apply between each input element. Must +/// be a compile-time constant 1D tensor of length equal to rank of input, +/// containing only non-negative values. +/// +/// Returns: +/// * `Output`: A `Tensor` of type T. +class XlaPad { + public: + XlaPad(const ::tensorflow::Scope& scope, ::tensorflow::Input input, + ::tensorflow::Input padding_value, ::tensorflow::Input padding_low, + ::tensorflow::Input padding_high, ::tensorflow::Input padding_interior); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + Operation operation; + ::tensorflow::Output output; +}; + +/// Receives the named tensor from another XLA computation. Wraps the XLA Recv +/// +/// operator documented at +/// https://www.tensorflow.org/performance/xla/operation_semantics#recv . +/// +/// Args: +/// * scope: A Scope object +/// * dtype: The type of the tensor. +/// * tensor_name: A string key that identifies the channel. +/// * shape: The shape of the tensor. +/// +/// Returns: +/// * `Output`: The tensor to receive. +class XlaRecv { + public: + XlaRecv(const ::tensorflow::Scope& scope, DataType dtype, StringPiece + tensor_name, PartialTensorShape shape); + operator ::tensorflow::Output() const { return tensor; } + operator ::tensorflow::Input() const { return tensor; } + ::tensorflow::Node* node() const { return tensor.node(); } + + Operation operation; + ::tensorflow::Output tensor; +}; + +/// Wraps the XLA Reduce operator, documented at +/// +/// https://www.tensorflow.org/performance/xla/operation_semantics#reduce . +/// +/// Args: +/// * scope: A Scope object +/// * input: the input tensor +/// * init_value: a scalar representing the initial value for the reduction +/// * dimensions_to_reduce: dimension numbers over which to reduce +/// * reducer: a reducer function to apply +/// +/// Returns: +/// * `Output`: The output tensor. +class XlaReduce { + public: + XlaReduce(const ::tensorflow::Scope& scope, ::tensorflow::Input input, + ::tensorflow::Input init_value, const gtl::ArraySlice& + dimensions_to_reduce, const NameAttrList& reducer); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + Operation operation; + ::tensorflow::Output output; +}; + +/// Wraps the XLA ReducePrecision operator +/// +/// documented at https://www.tensorflow.org/xla/operation_semantics#reduceprecision. +/// +/// Args: +/// * scope: A Scope object +/// * operand: array of floating-point type. +/// * exponent_bits: number of exponent bits in lower-precision format +/// * mantissa_bits: number of mantissa bits in lower-precision format +/// +/// Returns: +/// * `Output`: The output tensor. +class XlaReducePrecision { + public: + XlaReducePrecision(const ::tensorflow::Scope& scope, ::tensorflow::Input + operand, int64 exponent_bits, int64 mantissa_bits); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + Operation operation; + ::tensorflow::Output output; +}; + +/// Wraps the XLA ReduceScatter operator +/// +/// documented at https://www.tensorflow.org/xla/operation_semantics#reducescatter. +/// +/// Args: +/// * scope: A Scope object +/// * input: Array or a non-empty tuple of arrays to reduce across replicas. +/// * group_assignment: Groups between which the reductions are performed. +/// * scatter_dimension: Dimension to scatter. +/// * reduce_op: Reduction computation. +/// +/// Returns: +/// * `Output`: The output tensor. +class XlaReduceScatter { + public: + XlaReduceScatter(const ::tensorflow::Scope& scope, ::tensorflow::Input input, + ::tensorflow::Input group_assignment, ::tensorflow::Input + scatter_dimension, StringPiece reduce_op); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + Operation operation; + ::tensorflow::Output output; +}; + +/// Wraps the XLA ReduceWindow operator, documented at +/// +/// https://www.tensorflow.org/performance/xla/operation_semantics#reducewindow . +/// +/// Args: +/// * scope: A Scope object +/// * input: the input tensor +/// * init_value: a scalar representing the initial value for the reduction +/// * window_dimensions: the shape of the window +/// * window_strides: the inter-window strides +/// * padding: the padding to apply at the start and end of each input dimensions +/// * computation: a reducer function to apply +/// +/// Returns: +/// * `Output`: The output tensor. +class XlaReduceWindow { + public: + XlaReduceWindow(const ::tensorflow::Scope& scope, ::tensorflow::Input input, + ::tensorflow::Input init_value, ::tensorflow::Input + window_dimensions, ::tensorflow::Input window_strides, + ::tensorflow::Input base_dilations, ::tensorflow::Input + window_dilations, ::tensorflow::Input padding, const + NameAttrList& computation); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + Operation operation; + ::tensorflow::Output output; +}; + +/// Inverse of XlaSetDynamicDimensionSize. +/// +/// Make an xla bounded dynamic dimension into a static dimension. The bound of the +/// size of dimension `dim_index` becomes the static dimension size. +/// +/// Args: +/// * scope: A Scope object +/// +/// Returns: +/// * `Output`: The output tensor. +class XlaRemoveDynamicDimensionSize { + public: + XlaRemoveDynamicDimensionSize(const ::tensorflow::Scope& scope, + ::tensorflow::Input input, ::tensorflow::Input + dim_index); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + Operation operation; + ::tensorflow::Output output; +}; + +/// Replica ID. +/// +/// Args: +/// * scope: A Scope object +/// +/// Returns: +/// * `Output`: The id tensor. +class XlaReplicaId { + public: + XlaReplicaId(const ::tensorflow::Scope& scope); + operator ::tensorflow::Output() const { return id; } + operator ::tensorflow::Input() const { return id; } + ::tensorflow::Node* node() const { return id.node(); } + + Operation operation; + ::tensorflow::Output id; +}; + +/// Stateless PRNG bit generator. +/// +/// Wraps the XLA RngBitGenerator operator, documented at +/// https://www.tensorflow.org/performance/xla/operation_semantics#rngbitgenerator. +/// +/// Args: +/// * scope: A Scope object +/// * algorithm: The PRNG algorithm to use, one of +/// tf.random.Algorithm.{PHILOX, THREEFRY, AUTO_SELECT}. +/// * initial_state: Initial state for the PRNG algorithm. For THREEFRY, it should be +/// a u64[2] and for PHILOX a u64[3]. +/// * shape: The output shape of the generated data. +/// +/// Optional attributes (see `Attrs`): +/// * dtype: The type of the tensor. +/// +/// Returns: +/// * `Output` output_key +/// * `Output` output +class XlaRngBitGenerator { + public: + /// Optional attribute setters for XlaRngBitGenerator + struct Attrs { + /// The type of the tensor. + /// + /// Defaults to DT_UINT64 + TF_MUST_USE_RESULT Attrs Dtype(DataType x) { + Attrs ret = *this; + ret.dtype_ = x; + return ret; + } + + DataType dtype_ = DT_UINT64; + }; + XlaRngBitGenerator(const ::tensorflow::Scope& scope, ::tensorflow::Input + algorithm, ::tensorflow::Input initial_state, + ::tensorflow::Input shape); + XlaRngBitGenerator(const ::tensorflow::Scope& scope, ::tensorflow::Input + algorithm, ::tensorflow::Input initial_state, + ::tensorflow::Input shape, const XlaRngBitGenerator::Attrs& + attrs); + + static Attrs Dtype(DataType x) { + return Attrs().Dtype(x); + } + + Operation operation; + ::tensorflow::Output output_key; + ::tensorflow::Output output; +}; + +/// Wraps the XLA Scatter operator documented at +/// +/// https://www.tensorflow.org/xla/operation_semantics#scatter. +/// +/// Args: +/// * scope: A Scope object +/// * operand: Array to be scattered into. +/// * scatter_indices: Array containing the starting indices of the slices that must +/// be scattered to. +/// * updates: Array containing the values that must be used for scattering. +/// * update_computation: Computation to be used for combining the existing values in +/// the input array and the updates during scatter. +/// * dimension_numbers: A serialized xla::ScatterDimensionNumbers proto. +/// * indices_are_sorted: Boolean indicating if the indices are sorted. +/// +/// Returns: +/// * `Output`: The output tensor. +class XlaScatter { + public: + XlaScatter(const ::tensorflow::Scope& scope, ::tensorflow::Input operand, + ::tensorflow::Input scatter_indices, ::tensorflow::Input updates, + const NameAttrList& update_computation, StringPiece + dimension_numbers, bool indices_are_sorted); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + Operation operation; + ::tensorflow::Output output; +}; + +/// Wraps the XLA SelectAndScatter operator, documented at +/// +/// https://www.tensorflow.org/performance/xla/operation_semantics#selectandscatter +/// . +/// +/// Args: +/// * scope: A Scope object +/// * operand: the input tensor +/// * window_dimensions: the shape of the window +/// * window_strides: the inter-window strides +/// * padding: the padding to apply at the start and end of each input dimensions +/// * source: a tensor of values to scatter +/// * init_value: a scalar representing the initial value for the output tensor +/// * select: a selection function to apply +/// * scatter: a scatter function to apply +/// +/// Returns: +/// * `Output`: The output tensor. +class XlaSelectAndScatter { + public: + XlaSelectAndScatter(const ::tensorflow::Scope& scope, ::tensorflow::Input + operand, ::tensorflow::Input window_dimensions, + ::tensorflow::Input window_strides, ::tensorflow::Input + padding, ::tensorflow::Input source, ::tensorflow::Input + init_value, const NameAttrList& select, const NameAttrList& + scatter); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + Operation operation; + ::tensorflow::Output output; +}; + +/// Computes the eigen decomposition of a batch of self-adjoint matrices +/// +/// (Note: Only real inputs are supported). +/// +/// Computes the eigenvalues and eigenvectors of the innermost N-by-N matrices in +/// tensor such that tensor[...,:,:] * v[..., :,i] = e[..., i] * v[...,:,i], for +/// i=0...N-1. +/// +/// Args: +/// * scope: A Scope object +/// * a: the input tensor. +/// * lower: a boolean specifies whether the calculation is done with the lower +/// triangular part or the upper triangular part. +/// * max_iter: maximum number of sweep update, i.e., the whole lower triangular +/// part or upper triangular part based on parameter lower. Heuristically, it has +/// been argued that approximately logN sweeps are needed in practice (Ref: Golub & +/// van Loan "Matrix Computation"). +/// * epsilon: the tolerance ratio. +/// +/// Returns: +/// * `Output` w: The eigenvalues in ascending order, each repeated according to its +/// multiplicity. +/// * `Output` v: The column v[..., :, i] is the normalized eigenvector corresponding to the +/// eigenvalue w[..., i]. +class XlaSelfAdjointEig { + public: + XlaSelfAdjointEig(const ::tensorflow::Scope& scope, ::tensorflow::Input a, bool + lower, int64 max_iter, float epsilon); + + Operation operation; + ::tensorflow::Output w; + ::tensorflow::Output v; +}; + +/// Sends the named tensor to another XLA computation. Wraps the XLA Send operator +/// +/// documented at +/// https://www.tensorflow.org/performance/xla/operation_semantics#send . +/// +/// Args: +/// * scope: A Scope object +/// * tensor: The tensor to send. +/// * tensor_name: A string key that identifies the channel. +/// +/// Returns: +/// * the created `Operation` +class XlaSend { + public: + XlaSend(const ::tensorflow::Scope& scope, ::tensorflow::Input tensor, + StringPiece tensor_name); + operator ::tensorflow::Operation() const { return operation; } + + Operation operation; +}; + +/// Set a bound for the given input value as a hint to Xla compiler, +/// +/// returns the same value. +/// +/// Args: +/// * scope: A Scope object +/// +/// Returns: +/// * `Output`: The output tensor. +class XlaSetBound { + public: + XlaSetBound(const ::tensorflow::Scope& scope, ::tensorflow::Input input, + ::tensorflow::Input bound); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + Operation operation; + ::tensorflow::Output output; +}; + +/// Make a static dimension into a xla bounded dynamic dimension. +/// +/// The current static dimension size will become the bound and the second +/// operand becomes the dynamic size of the dimension. +/// +/// Args: +/// * scope: A Scope object +/// +/// Returns: +/// * `Output`: The output tensor. +class XlaSetDynamicDimensionSize { + public: + XlaSetDynamicDimensionSize(const ::tensorflow::Scope& scope, + ::tensorflow::Input input, ::tensorflow::Input + dim_index, ::tensorflow::Input size); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + Operation operation; + ::tensorflow::Output output; +}; + +/// An op which shards the input based on the given sharding attribute. It can +/// +/// selectively annotate a subset of tensor dimensions by skipping unspecified_dims, +/// and the sharding annotation should be replicated in those dims. +/// +/// Args: +/// * scope: A Scope object +/// +/// Returns: +/// * `Output`: The output tensor. +class XlaSharding { + public: + /// Optional attribute setters for XlaSharding + struct Attrs { + /// Defaults to "" + TF_MUST_USE_RESULT Attrs Sharding(StringPiece x) { + Attrs ret = *this; + ret.sharding_ = x; + return ret; + } + + /// Defaults to [] + TF_MUST_USE_RESULT Attrs UnspecifiedDims(const gtl::ArraySlice& x) { + Attrs ret = *this; + ret.unspecified_dims_ = x; + return ret; + } + + StringPiece sharding_ = ""; + gtl::ArraySlice unspecified_dims_ = {}; + }; + XlaSharding(const ::tensorflow::Scope& scope, ::tensorflow::Input input); + XlaSharding(const ::tensorflow::Scope& scope, ::tensorflow::Input input, const + XlaSharding::Attrs& attrs); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + static Attrs Sharding(StringPiece x) { + return Attrs().Sharding(x); + } + static Attrs UnspecifiedDims(const gtl::ArraySlice& x) { + return Attrs().UnspecifiedDims(x); + } + + Operation operation; + ::tensorflow::Output output; +}; + +/// Wraps the XLA Sort operator, documented at +/// +/// https://www.tensorflow.org/performance/xla/operation_semantics#sort +/// . +/// +/// Sorts a tensor. Currently only sorts in ascending order are supported. +/// +/// Args: +/// * scope: A Scope object +/// * input: A `Tensor` of type T. +/// +/// Returns: +/// * `Output`: A `Tensor` of type T. +class XlaSort { + public: + XlaSort(const ::tensorflow::Scope& scope, ::tensorflow::Input input); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + Operation operation; + ::tensorflow::Output output; +}; + +/// An op used by XLA SPMD partitioner to switch from automatic partitioning to +/// +/// manual partitioning. It annotates the input (full-shape, to be automatically +/// partitioned) with the same sharding used by manual partitioning, and outputs a +/// shard-shaped tensor to be consumed by later manually-partitioned ops. If the +/// shape is not evenly partitionable, the padding region will be masked with 0s. +/// The conversion can happen partially in subgroups, by specifying the dim +/// attribute, where only that dim will be converted. +/// +/// Args: +/// * scope: A Scope object +/// +/// Returns: +/// * `Output`: The output tensor. +class XlaSpmdFullToShardShape { + public: + /// Optional attribute setters for XlaSpmdFullToShardShape + struct Attrs { + /// Defaults to -1 + TF_MUST_USE_RESULT Attrs Dim(int64 x) { + Attrs ret = *this; + ret.dim_ = x; + return ret; + } + + /// Defaults to [] + TF_MUST_USE_RESULT Attrs UnspecifiedDims(const gtl::ArraySlice& x) { + Attrs ret = *this; + ret.unspecified_dims_ = x; + return ret; + } + + int64 dim_ = -1; + gtl::ArraySlice unspecified_dims_ = {}; + }; + XlaSpmdFullToShardShape(const ::tensorflow::Scope& scope, ::tensorflow::Input + input, StringPiece manual_sharding); + XlaSpmdFullToShardShape(const ::tensorflow::Scope& scope, ::tensorflow::Input + input, StringPiece manual_sharding, const + XlaSpmdFullToShardShape::Attrs& attrs); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + static Attrs Dim(int64 x) { + return Attrs().Dim(x); + } + static Attrs UnspecifiedDims(const gtl::ArraySlice& x) { + return Attrs().UnspecifiedDims(x); + } + + Operation operation; + ::tensorflow::Output output; +}; + +/// An op used by XLA SPMD partitioner to switch from manual partitioning to +/// +/// automatic partitioning. It converts the shard-shaped, manually partitioned input +/// into full-shaped tensor to be partitioned automatically with the same sharding +/// used by manual partitioning. The conversion can happen partially in subgroups, +/// by specifying the dim attribute, where only that dim will be converted. +/// +/// Args: +/// * scope: A Scope object +/// +/// Returns: +/// * `Output`: The output tensor. +class XlaSpmdShardToFullShape { + public: + /// Optional attribute setters for XlaSpmdShardToFullShape + struct Attrs { + /// Defaults to -1 + TF_MUST_USE_RESULT Attrs Dim(int64 x) { + Attrs ret = *this; + ret.dim_ = x; + return ret; + } + + /// Defaults to [] + TF_MUST_USE_RESULT Attrs UnspecifiedDims(const gtl::ArraySlice& x) { + Attrs ret = *this; + ret.unspecified_dims_ = x; + return ret; + } + + int64 dim_ = -1; + gtl::ArraySlice unspecified_dims_ = {}; + }; + XlaSpmdShardToFullShape(const ::tensorflow::Scope& scope, ::tensorflow::Input + input, StringPiece manual_sharding, PartialTensorShape + full_shape); + XlaSpmdShardToFullShape(const ::tensorflow::Scope& scope, ::tensorflow::Input + input, StringPiece manual_sharding, PartialTensorShape + full_shape, const XlaSpmdShardToFullShape::Attrs& + attrs); + operator ::tensorflow::Output() const { return output; } + operator ::tensorflow::Input() const { return output; } + ::tensorflow::Node* node() const { return output.node(); } + + static Attrs Dim(int64 x) { + return Attrs().Dim(x); + } + static Attrs UnspecifiedDims(const gtl::ArraySlice& x) { + return Attrs().UnspecifiedDims(x); + } + + Operation operation; + ::tensorflow::Output output; +}; + +/// Computes the eigen decomposition of a batch of self-adjoint matrices +/// +/// (Note: Only real inputs are supported). +/// +/// Computes the eigenvalues and eigenvectors of the innermost M-by-N matrices in +/// tensor such that tensor[...,:,:] = u[..., :, :] * Diag(s[..., :]) * Transpose(v[...,:,:]). +/// +/// Args: +/// * scope: A Scope object +/// * a: the input tensor. +/// * max_iter: maximum number of sweep update, i.e., the whole lower triangular +/// part or upper triangular part based on parameter lower. Heuristically, it has +/// been argued that approximately log(min (M, N)) sweeps are needed in practice +/// (Ref: Golub & van Loan "Matrix Computation"). +/// * epsilon: the tolerance ratio. +/// * precision_config: a serialized xla::PrecisionConfig proto. +/// +/// Returns: +/// * `Output` s: Singular values. The values are sorted in reverse order of magnitude, so +/// s[..., 0] is the largest value, s[..., 1] is the second largest, etc. +/// * `Output` u: Left singular vectors. +/// * `Output` v: Right singular vectors. +class XlaSvd { + public: + XlaSvd(const ::tensorflow::Scope& scope, ::tensorflow::Input a, int64 max_iter, + float epsilon, StringPiece precision_config); + + Operation operation; + ::tensorflow::Output s; + ::tensorflow::Output u; + ::tensorflow::Output v; +}; + +/// Wraps the variadic XLA Reduce operator. +/// +/// Semantics are documented at +/// https://www.tensorflow.org/performance/xla/operation_semantics#variadic_reduce. +/// +/// This version is limited to operands of the same dtype. +/// XlaVariadicReduceV2 is a version that supports heterogeneous operands. +/// +/// Args: +/// * scope: A Scope object +/// * input: the input tensor(s) +/// * init_value: scalar initial value(s) for the reduction +/// * dimensions_to_reduce: dimension numbers over which to reduce +/// * reducer: a reducer function to apply +/// +/// Returns: +/// * `OutputList`: The output tensor. +class XlaVariadicReduce { + public: + XlaVariadicReduce(const ::tensorflow::Scope& scope, ::tensorflow::InputList + input, ::tensorflow::InputList init_value, const + gtl::ArraySlice& dimensions_to_reduce, const + NameAttrList& reducer); + ::tensorflow::Output operator[](size_t index) const { return output[index]; } + + + Operation operation; + ::tensorflow::OutputList output; +}; + +/// Wraps the variadic XLA Reduce operator. +/// +/// Semantics are documented at +/// https://www.tensorflow.org/performance/xla/operation_semantics#variadic_reduce. +/// +/// This is an expanded version of XlaVariadicReduce, with support for +/// operands of different dtypes, and improved shape inference. +/// +/// Args: +/// * scope: A Scope object +/// * inputs: the input tensor(s) +/// * init_values: scalar initial value(s) for the reduction +/// * dimensions_to_reduce: dimension numbers over which to reduce +/// * reducer: a reducer function to apply +/// +/// Returns: +/// * `OutputList`: The outputs tensor. +class XlaVariadicReduceV2 { + public: + XlaVariadicReduceV2(const ::tensorflow::Scope& scope, ::tensorflow::InputList + inputs, ::tensorflow::InputList init_values, const + gtl::ArraySlice& dimensions_to_reduce, const + NameAttrList& reducer); + ::tensorflow::Output operator[](size_t index) const { return outputs[index]; } + + + Operation operation; + ::tensorflow::OutputList outputs; +}; + +/// Wraps the XLA Sort operator, documented at +/// +/// https://www.tensorflow.org/performance/xla/operation_semantics#sort +/// . +/// +/// Sorts one or more tensors, with support for custom comparator, dimension, and +/// is_stable attributes. +/// +/// Args: +/// * scope: A Scope object +/// * inputs: A list of `Tensor` of identical shape but possibly different types. +/// * dimension: The dimension along which to sort. Must be a compile-time constant. +/// * comparator: A comparator function to apply to 2*N scalars and returning a +/// boolean. N is the number of sort inputs. If you want to sort in ascending +/// order then the comparator should perform a less-than comparison. +/// * is_stable: Whether to use stable sort. +/// +/// Returns: +/// * `OutputList`: A list of `Tensor` of same shape and types as the `input`. +class XlaVariadicSort { + public: + XlaVariadicSort(const ::tensorflow::Scope& scope, ::tensorflow::InputList + inputs, ::tensorflow::Input dimension, const NameAttrList& + comparator, bool is_stable); + ::tensorflow::Output operator[](size_t index) const { return outputs[index]; } + + + Operation operation; + ::tensorflow::OutputList outputs; +}; + +/// output = input; While (Cond(output)) { output = Body(output) } +/// +/// Args: +/// * scope: A Scope object +/// * input: A list of input tensors whose types are T. +/// * cond: A function takes 'input' and returns a tensor. If the tensor is +/// a scalar of non-boolean, the scalar is converted to a boolean +/// according to the following rule: if the scalar is a numerical +/// value, non-zero means True and zero means False; if the scalar is +/// a string, non-empty means True and empty means False. If the +/// tensor is not a scalar, non-emptiness means True and False +/// otherwise. +/// * body: A function that takes a list of tensors and returns another +/// list of tensors. Both lists have the same types as specified by T. +/// +/// Returns: +/// * `OutputList`: A list of output tensors whose types are T. +class XlaWhile { + public: + XlaWhile(const ::tensorflow::Scope& scope, ::tensorflow::InputList input, const + NameAttrList& cond, const NameAttrList& body); + ::tensorflow::Output operator[](size_t index) const { return output[index]; } + + + Operation operation; + ::tensorflow::OutputList output; +}; + +/// @} + +} // namespace ops +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_TF_XLA_CC_OPS_XLA_OPS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/const_analysis.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/const_analysis.h new file mode 100644 index 0000000000000000000000000000000000000000..ba5fa45fd9a6c199abe0fa7e70b54b9a947150f8 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/const_analysis.h @@ -0,0 +1,51 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_TF2XLA_CONST_ANALYSIS_H_ +#define TENSORFLOW_COMPILER_TF2XLA_CONST_ANALYSIS_H_ + +#include + +#include "tensorflow/core/graph/graph.h" +#include "tensorflow/core/lib/core/status.h" + +namespace tensorflow { + +// Backwards dataflow analysis that finds nodes in a graph that must be +// compile-time constants for us to be able to lower the graph to XLA. +// +// The indices of the arguments to `graph` that must be constant are returned in +// `compile_time_const_arg_indices`, if `compile_time_const_arg_indices` is not +// null. +// +// The ids of the nodes in `graph` that must be constant are returned in +// `compile_time_const_nodes`, if `compile_time_const_nodes` is not null. +// +// If `edge_filter` is non-null, only propagate const-ness along edges for which +// `edge_filter` returns true. +Status BackwardsConstAnalysis( + const Graph& g, std::vector* compile_time_const_arg_indices, + std::vector* compile_time_const_nodes, + FunctionLibraryRuntime* flib_runtime, + std::function edge_filter_input = nullptr); + +// Given an op kernel and function library runtime, return all the indices of +// inputs that need to be compile time constant. +Status GetCompileTimeConstInputs(const OpKernel* op_kernel, + std::vector* const_input_idxs, + FunctionLibraryRuntime* flib_runtime); +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_TF2XLA_CONST_ANALYSIS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/frontend_attributes_util.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/frontend_attributes_util.h new file mode 100644 index 0000000000000000000000000000000000000000..6113a9dd172615e774720c074f28d879d0213c92 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/frontend_attributes_util.h @@ -0,0 +1,36 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ +#ifndef TENSORFLOW_COMPILER_TF2XLA_FRONTEND_ATTRIBUTES_UTIL_H_ +#define TENSORFLOW_COMPILER_TF2XLA_FRONTEND_ATTRIBUTES_UTIL_H_ + +#include + +#include "absl/types/optional.h" +#include "xla/xla_data.pb.h" +#include "tensorflow/core/framework/node_def_util.h" +#include "tensorflow/core/platform/statusor.h" + +namespace tensorflow { + +// Return the FrontendAttributes stored in the AttrSlice if there are some. +// +// Return an InvalidArgument error if some attributes are present but +// cannot be parsed. +StatusOr> +GetFrontendAttributesFromAttrSlice(const AttrSlice& attrs); + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_TF2XLA_FRONTEND_ATTRIBUTES_UTIL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/functionalize_cond.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/functionalize_cond.h new file mode 100644 index 0000000000000000000000000000000000000000..1841a495bac60170d472f3d5d7b5c6a679c858e6 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/functionalize_cond.h @@ -0,0 +1,290 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_TF2XLA_FUNCTIONALIZE_COND_H_ +#define TENSORFLOW_COMPILER_TF2XLA_FUNCTIONALIZE_COND_H_ + +#include + +#include "tensorflow/compiler/tf2xla/functionalize_control_flow_util.h" +#include "xla/status_macros.h" +#include "tensorflow/core/framework/function.h" +#include "tensorflow/core/graph/graph.h" + +namespace tensorflow { + +// Functionalize all the switch-merge nodes of a loop-free graph into If +// nodes. That is, attempt to transform every remaining switch and merge nodes +// in the graph into If nodes. +// +// If `node_filter` is defined, then only conditions for whose nodes +// `node_filter` returns true are functionalized. +// +// Preconditions: +// a) Same as for `FunctionalizeControlFlow` (see comment there). +// b) While loops must have been functionalized before according to +// `node_filter` (e.g., by calling `FunctionalizeWhileLoop` with the same +// filter before calling this function). +Status FunctionalizeCond(Graph* graph, FunctionLibraryDefinition* library, + const NodeFilter& node_filter = {}); + +// Internal functions/classes exposed for testing purposes. +namespace functionalize_cond { + +// All nodes are assumed to be either in no branch, then branch, else branch, +// or both branches (such as merge nodes). +// The code below relies on Else and Then being 0 and 1 (corresponding to the +// switch outputs). Both and Neither are arbitrary. +enum class BranchType { + kElseBranch = 0, + kThenBranch = 1, + kBoth = 2, + kNeither = 3, +}; + +// When we keep track of which switch/merge node's feed into a node, we record +// 1) predicate for non-dead switch node, +// 2) the switch node itself for dead switch node, +// 3) the merge node itself for merge node. +// Case 1) is an optimization. With this optimization, if there are nodes from +// different switch nodes but those switch nodes have the same predicate, the +// nodes will still have same AncestorState, and they will be clustered into a +// single "If". +struct AncestorNode { + enum class AncestorNodeType { + kPred = 0, + kSwitch = 1, + kMerge = 2, + }; + + OutputTensor output_tensor; + AncestorNodeType type; + + // Compare two AncestorNodes by (node id, index, type). + bool operator<(const AncestorNode& other) const; + bool operator==(const AncestorNode& other) const; + + struct Hash { + size_t operator()(const AncestorNode&) const; + }; +}; + +// StateMap is responsible for mapping from each graph Node to +// * a CondState, where each CondState is a map from predicate to branch (i,e., +// what predicates have to hold or not hold). +// * a AncestorState, where each AncestorState is a set of switch/merge nodes +// that are an ancestor of the node in the graph; +// For efficiency, this class interns the CondState (AncestorState), so that +// CondState (AncestorState) equality comparisons are simply pointer +// comparisons. +class StateMap { + public: + explicit StateMap(Graph* graph); + + // Compare two OutputTensors by (node id, index). + struct OutputTensorLess { + bool operator()(const OutputTensor& lhs, const OutputTensor& rhs) const; + }; + + // A node in the graph is executed when multiple conditions hold. Keep track + // of the predicates that must hold for a node to execute. + using CondState = std::map; + + // Every unique ID is mapped to a CondState. + using CondId = const CondState*; + + // Keep track of which switch/merge node's feed into a node's values. + using AncestorState = std::set; + + // Every unique ID is mapped to a AncestorState. + using AncestorId = const AncestorState*; + + // Returns the CondId for a given node. + CondId LookupCondId(const Node* node) const; + + // Returns the unique CondId for CondState. + CondId GetCondId(const CondState& state); + + // Resets the CondId for a given node. + void ResetCondId(const Node* node, CondId id); + + // Returns the AncestorId for a given node. + AncestorId LookupAncestorId(const Node* node) const; + + // Returns the unique AncestorId for CondState. + AncestorId GetAncestorId(const AncestorState& state); + + // Resets the AncestorId for a given node. + void ResetAncestorId(const Node* node, AncestorId id); + + // Marks `node` as dead. + void MarkDead(const Node* node); + + // Determine branch execution of CondState. + BranchType FindBranchOf(CondId id, OutputTensor predicate) const; + + // Returns textual representation of node's CondState. + string CondStateToString(const Node* node) const; + string CondStateToString(CondId id) const; + + // Returns textual representation of node's AncestorState. + string AncestorStateToString(const Node* node) const; + + // Returns whether the cond state is the dead state. + bool IsDead(CondId id) const; + + // Returns whether the cond state is the empty state. + bool IsEmpty(CondId id) const; + + private: + // Hash for CondState and AncestorState. + struct Hash { + size_t operator()(const CondState& map) const; + size_t operator()(const AncestorState& map) const; + }; + + // Set to keep track of unique CondStates. + // Pointers to the entries in the unordered set are used as identifiers: + // unordered_set guarantees that the pointers remain the same. + std::unordered_set condstate_set_; + + // Mapping from Node id to CondId. + std::vector node_to_condid_map_; + + // Track the CondId for newly inserted nodes. We use a vector to quickly map + // from Node id in the original graph to the CondId, but there will be nodes + // added to the original graph (such as If nodes) whose CondState needs to be + // tracked too. + std::unordered_map added_node_condid_mapping_; + + // AncestorId variants of the CondId members. + std::unordered_set ancestorstate_set_; + std::vector node_to_ancestorid_map_; + std::unordered_map added_node_ancestorid_mapping_; + + // Identifier of the dead flow state. The empty flow state is represented with + // a nullptr. + CondId dead_id_; +}; + +// FunctionalizeCond groups all the state used by functionalizing conditionals +// of the given graph together. +class FunctionalizeCond { + public: + // See comment for function `FunctionalizeCond`. + static Status Functionalize(Graph* graph, FunctionLibraryDefinition* library, + const NodeFilter& node_filter); + + // Build identity node with the same name as the merge that will be replaced + // in case the output is fetched/colocated. + Status AddIdentityNode(const Node* replacee, Node* if_node, int port); + + // Add a If node to the graph defined by def that will, amongst other, replace + // replacee in the graph. + StatusOr AddIfNode(const NodeDef& def, const Node* replacee, + const OutputTensor& predicate); + + // Propagates the state of a newly inserted node. + Status PropagateUpdatedState(const Node* replacee); + + // Dump graph with the CondState annotated. + void DumpGraphWithCondState(const string& name); + + // Adds `switch_id` to the list of Switch node ids. + void AddSwitchId(int switch_id); + + private: + FunctionalizeCond(Graph* graph, FunctionLibraryDefinition* library, + const NodeFilter& node_filter); + + // Performs the actual cond functionalization. Iterate over groups of merge + // nodes (linked by common predicates & ancestor IDs), from innermost to + // outermost, and extract into If nodes. + Status FunctionalizeInternal(); + + // Returns the forward flow state propagated along edge `e`. + // This may modify state_map_. + StateMap::CondId StateAlongEdge(const Edge* e); + + // Determines the CondState and AncestorState of all the nodes in the given + // vector where the input is expected in reverse topological order. + // This populates the state_map_. + Status DetermineStates(std::vector rev_topo_order); + + // Determine the CondState for a given node using the incoming edges + // to the node. Note: it is expected that this node's CondState is only + // determined once its input's CondState is. + Status DetermineCondState(Node* dst) { + if (IsMerge(dst)) return DetermineCondStateMerge(dst); + return DetermineCondStateNonMerge(dst); + } + + // Helper functions for DetermineCondState. + Status DetermineCondStateNonMerge(Node* dst); + Status DetermineCondStateMerge(Node* dst); + + // Determines the dst node's CondState by joining the src and dst's CondState + // where either the dst node is a merge or not. + // These may modify state_map_. + StatusOr JoinCondStatesMerge(Node* merge, + StateMap::CondId src, + StateMap::CondId dst); + StatusOr JoinCondStatesNonMerge(StateMap::CondId src, + StateMap::CondId dst); + + // Determines which switch/merge nodes are ancestors of this node. + Status DetermineAncestorState(Node* dst); + + // Checks if a merge node is redundant and if so removes it from the graph. + Status RemoveRedundantMerge(Node* node); + + // Checks if a switch node is redundant and if so removes it from the graph. + Status RemoveRedundantSwitch(Node* node); + + // Sorts merge nodes (in reverse topological order) in order of increasing + // nesting depth. + void SortMergeNodes(std::vector* merge_order); + + // Deletes all nodes in/consumers reachable from switch/merge nodes that were + // extracted. + void DeleteReachableAndDeadNodes(const std::vector& merge_order); + + // Member used to unique the CondState to a unique CondId (AncestorState to a + // unique AncestorId) and keep track of CondState/CondId + // (AncestorState/AncestorId) per Node. + StateMap state_map_; + + // Mapping from merge nodes to predicate. + std::unordered_map merge_to_predicate_; + + // Mapping from merge nodes to corresponding If node outputs. + std::unordered_map merge_to_replacement_; + + FunctionLibraryDefinition* library_; + Graph* graph_; + + friend class FunctionalizeCondTest; + + std::vector switch_ids_; + + // Controls which nodes are skipped for functionalization. + NodeFilter node_filter_ = {}; +}; + +} // namespace functionalize_cond + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_TF2XLA_FUNCTIONALIZE_COND_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/functionalize_control_flow.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/functionalize_control_flow.h new file mode 100644 index 0000000000000000000000000000000000000000..ff5ae841e3044ca4061a0c799db59efbe5664c9a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/functionalize_control_flow.h @@ -0,0 +1,71 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_TF2XLA_FUNCTIONALIZE_CONTROL_FLOW_H_ +#define TENSORFLOW_COMPILER_TF2XLA_FUNCTIONALIZE_CONTROL_FLOW_H_ + +#include "tensorflow/compiler/tf2xla/functionalize_control_flow_util.h" +#include "xla/status_macros.h" +#include "tensorflow/core/common_runtime/optimization_registry.h" +#include "tensorflow/core/framework/function.h" +#include "tensorflow/core/graph/graph.h" + +namespace tensorflow { + +// Transformation that converts tf.while_loop() loops into functional While +// operators and tf.cond() conditionals into function If operators, suitable for +// XLA compilation. +// +// If `node_filter` is defined, then only loops and conditions for whose +// nodes `node_filter` returns true are functionalized. + +// If `include_functions` is true, then loops and conditions inside of functions +// that are associated with nodes in `graph` (e.g., a function called from a +// node in `graph`) are also functionalized, otherwise they are not. +// This also handles transitive cases, e.g., a function body will be +// functionalized when it is called in another function that is called by some +// node in `graph` (and so on). The node filter also applies here. +// +// Precondition: +// For any node in a loop or condition for which `node_filter` returns true, +// all nodes inside of the same loop or condition must also return true +// (including nodes in other nested loops and conditions inside of that loop or +// condition). +// This means that a "not to be functionalized" loop or condition is not allowed +// inside a "to be functionalized" loop or condition. +// +// The user of this function is responsible for using a node filter that +// satisfies the above conditions. +Status FunctionalizeControlFlow(Graph* graph, + FunctionLibraryDefinition* library, + const NodeFilter& node_filter = {}, + bool include_functions = false); + +Status FunctionalizeControlFlowForGraphDef(GraphDef* graph_def, + FunctionLibraryDefinition* library, + const NodeFilter& node_filter = {}, + bool include_functions = false); + +// Rewrites the graph by turning V1 control flow structure +// (Switch/Merge/etc.) into V2 control flow structure (If/While), only modifies +// functions that will be executed by XLA. +class FunctionalizeControlFlowForXlaPass : public GraphOptimizationPass { + public: + Status Run(const GraphOptimizationPassOptions& options) override; +}; + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_TF2XLA_FUNCTIONALIZE_CONTROL_FLOW_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/functionalize_control_flow_util.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/functionalize_control_flow_util.h new file mode 100644 index 0000000000000000000000000000000000000000..888839455db8b2a88dec21edc6b65c6f104da24e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/functionalize_control_flow_util.h @@ -0,0 +1,111 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_TF2XLA_FUNCTIONALIZE_CONTROL_FLOW_UTIL_H_ +#define TENSORFLOW_COMPILER_TF2XLA_FUNCTIONALIZE_CONTROL_FLOW_UTIL_H_ + +#include "absl/strings/str_join.h" +#include "xla/status_macros.h" +#include "tensorflow/core/graph/control_flow.h" +#include "tensorflow/core/graph/graph.h" + +// Utility functions shared between functionalize cond and while +// or used by other graph optimization passes. + +namespace tensorflow { + +using NodeFilter = std::function; + +// Information about a loop argument. +struct WhileLoopArg { + // Every loop argument has an Enter node. + Node* enter; + + // Is the loop argument a loop-invariant value? Taken from the `is_constant` + // attribute on the Enter node. + bool is_loop_invariant; + + // If 'is_loop_invariant' is true, the following are all nullptr. Non-constant + // arguments must have all of the following nodes: + Node* merge = nullptr; + Node* switch_node = nullptr; + Node* next_iteration = nullptr; + Node* exit = nullptr; +}; + +// Information about a loop frame. +struct WhileLoopFrame { + string name; + + // Pointer to the parent frame. The root frame has a pointer to itself. + WhileLoopFrame* parent = nullptr; + int num_children = 0; + + // Arguments to this loop. + std::vector args; + + // The loop condition of the loop. There should be exactly one loop condition + // in every loop. + Node* loop_cond = nullptr; + + // Set of nodes that belong to the loop frame. + std::unordered_set nodes; + + // After `ExtractWhileLoopFrames` this is true if for all control flow nodes + // of this frame `node_filter` returns true, i.e., the frame should be + // functionalized, and false otherwise. + bool should_be_functionalized = true; +}; + +// Extracts v1 while loops within a graph and creates a map of +// . +// If `node_filter` is defined, then we keep track of frames that should be +// functionalized according to the filter (see comment for +// `FunctionalizeControlFlow` for more details about node filters). +Status ExtractWhileLoopFrames( + const std::vector& cf_info, const Graph* graph, + std::unordered_map* frames, + const NodeFilter& node_filter = {}); + +// Check that the graph has no cycle containing the given node. +Status CheckNodeNotInCycle(const Node* node, const int num_nodes); + +// Comparison function used for sorting nodes consistently. +// a) resource variables are last, and +// b) sort lexicographically by name (for deterministic output). +struct NodeCmpByNameResourcesLast { + bool operator()(const Node* lhs, const Node* rhs) const; +}; + +// Returns the Node* created from the NodeDef in the Graph. +StatusOr AddNodeDefToGraph(const NodeDef& node_def, Graph* graph); + +// Build a retval node of given type and index. +StatusOr BuildRetvalNode(Graph* graph, DataType type, int index); + +// Returns a textual representation of the names of the nodes in the input. +template +string NodesToString(const T& nodes) { + return absl::StrCat("{", + absl::StrJoin(nodes, ",", + [](string* output, const Node* node) { + absl::StrAppend(output, node->name()); + }), + "}"); +} + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_TF2XLA_FUNCTIONALIZE_CONTROL_FLOW_UTIL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/functionalize_while.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/functionalize_while.h new file mode 100644 index 0000000000000000000000000000000000000000..ddd6b655cd52c221885e31adca5f87751345f6ee --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/functionalize_while.h @@ -0,0 +1,39 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_TF2XLA_FUNCTIONALIZE_WHILE_H_ +#define TENSORFLOW_COMPILER_TF2XLA_FUNCTIONALIZE_WHILE_H_ + +#include "tensorflow/compiler/tf2xla/functionalize_control_flow_util.h" +#include "tensorflow/core/framework/function.h" +#include "tensorflow/core/graph/graph.h" + +namespace tensorflow { + +// Transformation that converts tf.while_loop() loops into functional While +// operators, suitable for XLA compilation. If lookup_library is provided, use +// it to make the library for control flow self-contained. +// +// If `node_filter` is defined, then only loops for whose nodes `node_filter` +// returns true are functionalized. +// +// Preconditions: +// Same as for `FunctionalizeControlFlow` (see comment there). +Status FunctionalizeWhileLoop(Graph* graph, FunctionLibraryDefinition* library, + const NodeFilter& node_filter = {}); + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_TF2XLA_FUNCTIONALIZE_WHILE_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/graph_compiler.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/graph_compiler.h new file mode 100644 index 0000000000000000000000000000000000000000..da4dcda1010c28d0d96f35f620cb0bbf93ebf42a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/graph_compiler.h @@ -0,0 +1,92 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_TF2XLA_GRAPH_COMPILER_H_ +#define TENSORFLOW_COMPILER_TF2XLA_GRAPH_COMPILER_H_ + +#include "tensorflow/compiler/tf2xla/xla_compilation_device.h" +#include "tensorflow/compiler/tf2xla/xla_context.h" +#include "xla/client/local_client.h" +#include "tensorflow/core/common_runtime/device.h" +#include "tensorflow/core/common_runtime/device_mgr.h" +#include "tensorflow/core/common_runtime/function.h" +#include "tensorflow/core/framework/function.h" +#include "tensorflow/core/framework/op_kernel.h" +#include "tensorflow/core/lib/core/status.h" +#include "tensorflow/core/platform/env.h" +#include "tensorflow/core/platform/mutex.h" +#include "tensorflow/core/platform/notification.h" +#include "tensorflow/core/platform/thread_annotations.h" +#include "tensorflow/core/public/version.h" + +namespace tensorflow { + +// GraphCompiler compiles the graph in topological order in the current +// thread. It also resolves the nondeterminism in the graph by enforcing a +// total order on all inputs to a node. This abstraction helps us create the +// same XLA computation given two structurally equivalent TensorFlow graphs. +// If a function call is visited during the graph traversal, it is then +// compiled through the xla_context into a computation and a `Call` operation +// is inserted to call into that computation. +// +// Note: GraphCompiler was created to remove our dependency to TF Executor in +// the history. There are still some todos so that we can completely decouple +// from Executor. +// +// TODO(yunxing): Remove usage of XlaCompilationDevice. +// +// TODO(yunxing): Remove the hack that wraps XlaExpression within a tensor now +// that we don't use TF Executor to pass around a tensor. +// +// TODO(yunxing): Make XlaOpkernel not a subclass of OpKernel so that it can +// handle a XlaExpression directly instead of a Tensor. This may require our own +// op registration infrastructure instead of FunctionLibraryRuntime. +class GraphCompiler { + public: + GraphCompiler(XlaCompilationDevice* device, Graph* graph, + FunctionLibraryRuntime* flib, + ScopedStepContainer* step_container) + : device_(device), + graph_(graph), + flib_(flib), + step_container_(step_container) {} + + // Compiles the graph. The results are written in xla_context stored in the + // resource_manager of the 'XlaCompilationDevice' that's passed into the + // constructor. + Status Compile(); + + private: + // Partially sets params. This partially set params can be reused + // across multiple nodes visit. + void PartiallySetupParams(OpKernelContext::Params* params); + + // Compiles a functional node and writes result to OpkernelContext. A + // functional node represents a defined computation and should be compiled + // using `compiler_`. + Status CompileFunctionalNode(Node* n, OpKernelContext* op_context); + + XlaCompilationDevice* device_; + Graph* graph_; + FunctionLibraryRuntime* flib_; + ScopedStepContainer* step_container_; + // A buffer to hold tensor inputs to a node, this is reused across the graph + // traversal. + absl::InlinedVector tensor_inputs_; +}; + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_TF2XLA_GRAPH_COMPILER_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/host_compute_metadata.pb.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/host_compute_metadata.pb.h new file mode 100644 index 0000000000000000000000000000000000000000..5c4ff97152ea91d00719f1a007f1e7011e01272f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/host_compute_metadata.pb.h @@ -0,0 +1,898 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tensorflow/compiler/tf2xla/host_compute_metadata.proto + +#ifndef GOOGLE_PROTOBUF_INCLUDED_tensorflow_2fcompiler_2ftf2xla_2fhost_5fcompute_5fmetadata_2eproto +#define GOOGLE_PROTOBUF_INCLUDED_tensorflow_2fcompiler_2ftf2xla_2fhost_5fcompute_5fmetadata_2eproto + +#include +#include + +#include +#if PROTOBUF_VERSION < 3021000 +#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 3021009 < 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 // IWYU pragma: export +#include // IWYU pragma: export +#include +#include "tensorflow/core/framework/tensor_shape.pb.h" +#include "tensorflow/core/framework/types.pb.h" +// @@protoc_insertion_point(includes) +#include +#define PROTOBUF_INTERNAL_EXPORT_tensorflow_2fcompiler_2ftf2xla_2fhost_5fcompute_5fmetadata_2eproto +PROTOBUF_NAMESPACE_OPEN +namespace internal { +class AnyMetadata; +} // namespace internal +PROTOBUF_NAMESPACE_CLOSE + +// Internal implementation detail -- do not use these members. +struct TableStruct_tensorflow_2fcompiler_2ftf2xla_2fhost_5fcompute_5fmetadata_2eproto { + static const uint32_t offsets[]; +}; +extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_tensorflow_2fcompiler_2ftf2xla_2fhost_5fcompute_5fmetadata_2eproto; +namespace tensorflow { +namespace tf2xla { +class HostComputeMetadata; +struct HostComputeMetadataDefaultTypeInternal; +extern HostComputeMetadataDefaultTypeInternal _HostComputeMetadata_default_instance_; +class HostTransferMetadata; +struct HostTransferMetadataDefaultTypeInternal; +extern HostTransferMetadataDefaultTypeInternal _HostTransferMetadata_default_instance_; +class TensorMetadata; +struct TensorMetadataDefaultTypeInternal; +extern TensorMetadataDefaultTypeInternal _TensorMetadata_default_instance_; +} // namespace tf2xla +} // namespace tensorflow +PROTOBUF_NAMESPACE_OPEN +template<> ::tensorflow::tf2xla::HostComputeMetadata* Arena::CreateMaybeMessage<::tensorflow::tf2xla::HostComputeMetadata>(Arena*); +template<> ::tensorflow::tf2xla::HostTransferMetadata* Arena::CreateMaybeMessage<::tensorflow::tf2xla::HostTransferMetadata>(Arena*); +template<> ::tensorflow::tf2xla::TensorMetadata* Arena::CreateMaybeMessage<::tensorflow::tf2xla::TensorMetadata>(Arena*); +PROTOBUF_NAMESPACE_CLOSE +namespace tensorflow { +namespace tf2xla { + +// =================================================================== + +class TensorMetadata final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:tensorflow.tf2xla.TensorMetadata) */ { + public: + inline TensorMetadata() : TensorMetadata(nullptr) {} + ~TensorMetadata() override; + explicit PROTOBUF_CONSTEXPR TensorMetadata(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + TensorMetadata(const TensorMetadata& from); + TensorMetadata(TensorMetadata&& from) noexcept + : TensorMetadata() { + *this = ::std::move(from); + } + + inline TensorMetadata& operator=(const TensorMetadata& from) { + CopyFrom(from); + return *this; + } + inline TensorMetadata& operator=(TensorMetadata&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const TensorMetadata& default_instance() { + return *internal_default_instance(); + } + static inline const TensorMetadata* internal_default_instance() { + return reinterpret_cast( + &_TensorMetadata_default_instance_); + } + static constexpr int kIndexInFileMessages = + 0; + + friend void swap(TensorMetadata& a, TensorMetadata& b) { + a.Swap(&b); + } + inline void Swap(TensorMetadata* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(TensorMetadata* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + TensorMetadata* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const TensorMetadata& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom( const TensorMetadata& from) { + TensorMetadata::MergeImpl(*this, from); + } + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); + public: + 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(TensorMetadata* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "tensorflow.tf2xla.TensorMetadata"; + } + protected: + explicit TensorMetadata(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kShapeFieldNumber = 2, + kTypeFieldNumber = 1, + }; + // .tensorflow.TensorShapeProto shape = 2; + bool has_shape() const; + private: + bool _internal_has_shape() const; + public: + void clear_shape(); + const ::tensorflow::TensorShapeProto& shape() const; + PROTOBUF_NODISCARD ::tensorflow::TensorShapeProto* release_shape(); + ::tensorflow::TensorShapeProto* mutable_shape(); + void set_allocated_shape(::tensorflow::TensorShapeProto* shape); + private: + const ::tensorflow::TensorShapeProto& _internal_shape() const; + ::tensorflow::TensorShapeProto* _internal_mutable_shape(); + public: + void unsafe_arena_set_allocated_shape( + ::tensorflow::TensorShapeProto* shape); + ::tensorflow::TensorShapeProto* unsafe_arena_release_shape(); + + // .tensorflow.DataType type = 1; + void clear_type(); + ::tensorflow::DataType type() const; + void set_type(::tensorflow::DataType value); + private: + ::tensorflow::DataType _internal_type() const; + void _internal_set_type(::tensorflow::DataType value); + public: + + // @@protoc_insertion_point(class_scope:tensorflow.tf2xla.TensorMetadata) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + ::tensorflow::TensorShapeProto* shape_; + int type_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_tensorflow_2fcompiler_2ftf2xla_2fhost_5fcompute_5fmetadata_2eproto; +}; +// ------------------------------------------------------------------- + +class HostTransferMetadata final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:tensorflow.tf2xla.HostTransferMetadata) */ { + public: + inline HostTransferMetadata() : HostTransferMetadata(nullptr) {} + ~HostTransferMetadata() override; + explicit PROTOBUF_CONSTEXPR HostTransferMetadata(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + HostTransferMetadata(const HostTransferMetadata& from); + HostTransferMetadata(HostTransferMetadata&& from) noexcept + : HostTransferMetadata() { + *this = ::std::move(from); + } + + inline HostTransferMetadata& operator=(const HostTransferMetadata& from) { + CopyFrom(from); + return *this; + } + inline HostTransferMetadata& operator=(HostTransferMetadata&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const HostTransferMetadata& default_instance() { + return *internal_default_instance(); + } + static inline const HostTransferMetadata* internal_default_instance() { + return reinterpret_cast( + &_HostTransferMetadata_default_instance_); + } + static constexpr int kIndexInFileMessages = + 1; + + friend void swap(HostTransferMetadata& a, HostTransferMetadata& b) { + a.Swap(&b); + } + inline void Swap(HostTransferMetadata* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(HostTransferMetadata* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + HostTransferMetadata* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const HostTransferMetadata& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom( const HostTransferMetadata& from) { + HostTransferMetadata::MergeImpl(*this, from); + } + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); + public: + 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(HostTransferMetadata* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "tensorflow.tf2xla.HostTransferMetadata"; + } + protected: + explicit HostTransferMetadata(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kMetadataFieldNumber = 2, + kKeyFieldNumber = 1, + }; + // repeated .tensorflow.tf2xla.TensorMetadata metadata = 2; + int metadata_size() const; + private: + int _internal_metadata_size() const; + public: + void clear_metadata(); + ::tensorflow::tf2xla::TensorMetadata* mutable_metadata(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::tensorflow::tf2xla::TensorMetadata >* + mutable_metadata(); + private: + const ::tensorflow::tf2xla::TensorMetadata& _internal_metadata(int index) const; + ::tensorflow::tf2xla::TensorMetadata* _internal_add_metadata(); + public: + const ::tensorflow::tf2xla::TensorMetadata& metadata(int index) const; + ::tensorflow::tf2xla::TensorMetadata* add_metadata(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::tensorflow::tf2xla::TensorMetadata >& + metadata() const; + + // string key = 1; + void clear_key(); + const std::string& key() const; + template + void set_key(ArgT0&& arg0, ArgT... args); + std::string* mutable_key(); + PROTOBUF_NODISCARD std::string* release_key(); + void set_allocated_key(std::string* key); + private: + const std::string& _internal_key() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_key(const std::string& value); + std::string* _internal_mutable_key(); + public: + + // @@protoc_insertion_point(class_scope:tensorflow.tf2xla.HostTransferMetadata) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::tensorflow::tf2xla::TensorMetadata > metadata_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr key_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_tensorflow_2fcompiler_2ftf2xla_2fhost_5fcompute_5fmetadata_2eproto; +}; +// ------------------------------------------------------------------- + +class HostComputeMetadata final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:tensorflow.tf2xla.HostComputeMetadata) */ { + public: + inline HostComputeMetadata() : HostComputeMetadata(nullptr) {} + ~HostComputeMetadata() override; + explicit PROTOBUF_CONSTEXPR HostComputeMetadata(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + HostComputeMetadata(const HostComputeMetadata& from); + HostComputeMetadata(HostComputeMetadata&& from) noexcept + : HostComputeMetadata() { + *this = ::std::move(from); + } + + inline HostComputeMetadata& operator=(const HostComputeMetadata& from) { + CopyFrom(from); + return *this; + } + inline HostComputeMetadata& operator=(HostComputeMetadata&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const HostComputeMetadata& default_instance() { + return *internal_default_instance(); + } + static inline const HostComputeMetadata* internal_default_instance() { + return reinterpret_cast( + &_HostComputeMetadata_default_instance_); + } + static constexpr int kIndexInFileMessages = + 2; + + friend void swap(HostComputeMetadata& a, HostComputeMetadata& b) { + a.Swap(&b); + } + inline void Swap(HostComputeMetadata* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(HostComputeMetadata* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + HostComputeMetadata* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const HostComputeMetadata& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom( const HostComputeMetadata& from) { + HostComputeMetadata::MergeImpl(*this, from); + } + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); + public: + 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(HostComputeMetadata* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "tensorflow.tf2xla.HostComputeMetadata"; + } + protected: + explicit HostComputeMetadata(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kDeviceToHostFieldNumber = 1, + kHostToDeviceFieldNumber = 2, + }; + // repeated .tensorflow.tf2xla.HostTransferMetadata device_to_host = 1; + int device_to_host_size() const; + private: + int _internal_device_to_host_size() const; + public: + void clear_device_to_host(); + ::tensorflow::tf2xla::HostTransferMetadata* mutable_device_to_host(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::tensorflow::tf2xla::HostTransferMetadata >* + mutable_device_to_host(); + private: + const ::tensorflow::tf2xla::HostTransferMetadata& _internal_device_to_host(int index) const; + ::tensorflow::tf2xla::HostTransferMetadata* _internal_add_device_to_host(); + public: + const ::tensorflow::tf2xla::HostTransferMetadata& device_to_host(int index) const; + ::tensorflow::tf2xla::HostTransferMetadata* add_device_to_host(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::tensorflow::tf2xla::HostTransferMetadata >& + device_to_host() const; + + // repeated .tensorflow.tf2xla.HostTransferMetadata host_to_device = 2; + int host_to_device_size() const; + private: + int _internal_host_to_device_size() const; + public: + void clear_host_to_device(); + ::tensorflow::tf2xla::HostTransferMetadata* mutable_host_to_device(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::tensorflow::tf2xla::HostTransferMetadata >* + mutable_host_to_device(); + private: + const ::tensorflow::tf2xla::HostTransferMetadata& _internal_host_to_device(int index) const; + ::tensorflow::tf2xla::HostTransferMetadata* _internal_add_host_to_device(); + public: + const ::tensorflow::tf2xla::HostTransferMetadata& host_to_device(int index) const; + ::tensorflow::tf2xla::HostTransferMetadata* add_host_to_device(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::tensorflow::tf2xla::HostTransferMetadata >& + host_to_device() const; + + // @@protoc_insertion_point(class_scope:tensorflow.tf2xla.HostComputeMetadata) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::tensorflow::tf2xla::HostTransferMetadata > device_to_host_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::tensorflow::tf2xla::HostTransferMetadata > host_to_device_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_tensorflow_2fcompiler_2ftf2xla_2fhost_5fcompute_5fmetadata_2eproto; +}; +// =================================================================== + + +// =================================================================== + +#ifdef __GNUC__ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wstrict-aliasing" +#endif // __GNUC__ +// TensorMetadata + +// .tensorflow.DataType type = 1; +inline void TensorMetadata::clear_type() { + _impl_.type_ = 0; +} +inline ::tensorflow::DataType TensorMetadata::_internal_type() const { + return static_cast< ::tensorflow::DataType >(_impl_.type_); +} +inline ::tensorflow::DataType TensorMetadata::type() const { + // @@protoc_insertion_point(field_get:tensorflow.tf2xla.TensorMetadata.type) + return _internal_type(); +} +inline void TensorMetadata::_internal_set_type(::tensorflow::DataType value) { + + _impl_.type_ = value; +} +inline void TensorMetadata::set_type(::tensorflow::DataType value) { + _internal_set_type(value); + // @@protoc_insertion_point(field_set:tensorflow.tf2xla.TensorMetadata.type) +} + +// .tensorflow.TensorShapeProto shape = 2; +inline bool TensorMetadata::_internal_has_shape() const { + return this != internal_default_instance() && _impl_.shape_ != nullptr; +} +inline bool TensorMetadata::has_shape() const { + return _internal_has_shape(); +} +inline const ::tensorflow::TensorShapeProto& TensorMetadata::_internal_shape() const { + const ::tensorflow::TensorShapeProto* p = _impl_.shape_; + return p != nullptr ? *p : reinterpret_cast( + ::tensorflow::_TensorShapeProto_default_instance_); +} +inline const ::tensorflow::TensorShapeProto& TensorMetadata::shape() const { + // @@protoc_insertion_point(field_get:tensorflow.tf2xla.TensorMetadata.shape) + return _internal_shape(); +} +inline void TensorMetadata::unsafe_arena_set_allocated_shape( + ::tensorflow::TensorShapeProto* shape) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.shape_); + } + _impl_.shape_ = shape; + if (shape) { + + } else { + + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.tf2xla.TensorMetadata.shape) +} +inline ::tensorflow::TensorShapeProto* TensorMetadata::release_shape() { + + ::tensorflow::TensorShapeProto* temp = _impl_.shape_; + _impl_.shape_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::tensorflow::TensorShapeProto* TensorMetadata::unsafe_arena_release_shape() { + // @@protoc_insertion_point(field_release:tensorflow.tf2xla.TensorMetadata.shape) + + ::tensorflow::TensorShapeProto* temp = _impl_.shape_; + _impl_.shape_ = nullptr; + return temp; +} +inline ::tensorflow::TensorShapeProto* TensorMetadata::_internal_mutable_shape() { + + if (_impl_.shape_ == nullptr) { + auto* p = CreateMaybeMessage<::tensorflow::TensorShapeProto>(GetArenaForAllocation()); + _impl_.shape_ = p; + } + return _impl_.shape_; +} +inline ::tensorflow::TensorShapeProto* TensorMetadata::mutable_shape() { + ::tensorflow::TensorShapeProto* _msg = _internal_mutable_shape(); + // @@protoc_insertion_point(field_mutable:tensorflow.tf2xla.TensorMetadata.shape) + return _msg; +} +inline void TensorMetadata::set_allocated_shape(::tensorflow::TensorShapeProto* shape) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete reinterpret_cast< ::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.shape_); + } + if (shape) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena( + reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(shape)); + if (message_arena != submessage_arena) { + shape = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, shape, submessage_arena); + } + + } else { + + } + _impl_.shape_ = shape; + // @@protoc_insertion_point(field_set_allocated:tensorflow.tf2xla.TensorMetadata.shape) +} + +// ------------------------------------------------------------------- + +// HostTransferMetadata + +// string key = 1; +inline void HostTransferMetadata::clear_key() { + _impl_.key_.ClearToEmpty(); +} +inline const std::string& HostTransferMetadata::key() const { + // @@protoc_insertion_point(field_get:tensorflow.tf2xla.HostTransferMetadata.key) + return _internal_key(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void HostTransferMetadata::set_key(ArgT0&& arg0, ArgT... args) { + + _impl_.key_.Set(static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:tensorflow.tf2xla.HostTransferMetadata.key) +} +inline std::string* HostTransferMetadata::mutable_key() { + std::string* _s = _internal_mutable_key(); + // @@protoc_insertion_point(field_mutable:tensorflow.tf2xla.HostTransferMetadata.key) + return _s; +} +inline const std::string& HostTransferMetadata::_internal_key() const { + return _impl_.key_.Get(); +} +inline void HostTransferMetadata::_internal_set_key(const std::string& value) { + + _impl_.key_.Set(value, GetArenaForAllocation()); +} +inline std::string* HostTransferMetadata::_internal_mutable_key() { + + return _impl_.key_.Mutable(GetArenaForAllocation()); +} +inline std::string* HostTransferMetadata::release_key() { + // @@protoc_insertion_point(field_release:tensorflow.tf2xla.HostTransferMetadata.key) + return _impl_.key_.Release(); +} +inline void HostTransferMetadata::set_allocated_key(std::string* key) { + if (key != nullptr) { + + } else { + + } + _impl_.key_.SetAllocated(key, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.key_.IsDefault()) { + _impl_.key_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:tensorflow.tf2xla.HostTransferMetadata.key) +} + +// repeated .tensorflow.tf2xla.TensorMetadata metadata = 2; +inline int HostTransferMetadata::_internal_metadata_size() const { + return _impl_.metadata_.size(); +} +inline int HostTransferMetadata::metadata_size() const { + return _internal_metadata_size(); +} +inline void HostTransferMetadata::clear_metadata() { + _impl_.metadata_.Clear(); +} +inline ::tensorflow::tf2xla::TensorMetadata* HostTransferMetadata::mutable_metadata(int index) { + // @@protoc_insertion_point(field_mutable:tensorflow.tf2xla.HostTransferMetadata.metadata) + return _impl_.metadata_.Mutable(index); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::tensorflow::tf2xla::TensorMetadata >* +HostTransferMetadata::mutable_metadata() { + // @@protoc_insertion_point(field_mutable_list:tensorflow.tf2xla.HostTransferMetadata.metadata) + return &_impl_.metadata_; +} +inline const ::tensorflow::tf2xla::TensorMetadata& HostTransferMetadata::_internal_metadata(int index) const { + return _impl_.metadata_.Get(index); +} +inline const ::tensorflow::tf2xla::TensorMetadata& HostTransferMetadata::metadata(int index) const { + // @@protoc_insertion_point(field_get:tensorflow.tf2xla.HostTransferMetadata.metadata) + return _internal_metadata(index); +} +inline ::tensorflow::tf2xla::TensorMetadata* HostTransferMetadata::_internal_add_metadata() { + return _impl_.metadata_.Add(); +} +inline ::tensorflow::tf2xla::TensorMetadata* HostTransferMetadata::add_metadata() { + ::tensorflow::tf2xla::TensorMetadata* _add = _internal_add_metadata(); + // @@protoc_insertion_point(field_add:tensorflow.tf2xla.HostTransferMetadata.metadata) + return _add; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::tensorflow::tf2xla::TensorMetadata >& +HostTransferMetadata::metadata() const { + // @@protoc_insertion_point(field_list:tensorflow.tf2xla.HostTransferMetadata.metadata) + return _impl_.metadata_; +} + +// ------------------------------------------------------------------- + +// HostComputeMetadata + +// repeated .tensorflow.tf2xla.HostTransferMetadata device_to_host = 1; +inline int HostComputeMetadata::_internal_device_to_host_size() const { + return _impl_.device_to_host_.size(); +} +inline int HostComputeMetadata::device_to_host_size() const { + return _internal_device_to_host_size(); +} +inline void HostComputeMetadata::clear_device_to_host() { + _impl_.device_to_host_.Clear(); +} +inline ::tensorflow::tf2xla::HostTransferMetadata* HostComputeMetadata::mutable_device_to_host(int index) { + // @@protoc_insertion_point(field_mutable:tensorflow.tf2xla.HostComputeMetadata.device_to_host) + return _impl_.device_to_host_.Mutable(index); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::tensorflow::tf2xla::HostTransferMetadata >* +HostComputeMetadata::mutable_device_to_host() { + // @@protoc_insertion_point(field_mutable_list:tensorflow.tf2xla.HostComputeMetadata.device_to_host) + return &_impl_.device_to_host_; +} +inline const ::tensorflow::tf2xla::HostTransferMetadata& HostComputeMetadata::_internal_device_to_host(int index) const { + return _impl_.device_to_host_.Get(index); +} +inline const ::tensorflow::tf2xla::HostTransferMetadata& HostComputeMetadata::device_to_host(int index) const { + // @@protoc_insertion_point(field_get:tensorflow.tf2xla.HostComputeMetadata.device_to_host) + return _internal_device_to_host(index); +} +inline ::tensorflow::tf2xla::HostTransferMetadata* HostComputeMetadata::_internal_add_device_to_host() { + return _impl_.device_to_host_.Add(); +} +inline ::tensorflow::tf2xla::HostTransferMetadata* HostComputeMetadata::add_device_to_host() { + ::tensorflow::tf2xla::HostTransferMetadata* _add = _internal_add_device_to_host(); + // @@protoc_insertion_point(field_add:tensorflow.tf2xla.HostComputeMetadata.device_to_host) + return _add; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::tensorflow::tf2xla::HostTransferMetadata >& +HostComputeMetadata::device_to_host() const { + // @@protoc_insertion_point(field_list:tensorflow.tf2xla.HostComputeMetadata.device_to_host) + return _impl_.device_to_host_; +} + +// repeated .tensorflow.tf2xla.HostTransferMetadata host_to_device = 2; +inline int HostComputeMetadata::_internal_host_to_device_size() const { + return _impl_.host_to_device_.size(); +} +inline int HostComputeMetadata::host_to_device_size() const { + return _internal_host_to_device_size(); +} +inline void HostComputeMetadata::clear_host_to_device() { + _impl_.host_to_device_.Clear(); +} +inline ::tensorflow::tf2xla::HostTransferMetadata* HostComputeMetadata::mutable_host_to_device(int index) { + // @@protoc_insertion_point(field_mutable:tensorflow.tf2xla.HostComputeMetadata.host_to_device) + return _impl_.host_to_device_.Mutable(index); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::tensorflow::tf2xla::HostTransferMetadata >* +HostComputeMetadata::mutable_host_to_device() { + // @@protoc_insertion_point(field_mutable_list:tensorflow.tf2xla.HostComputeMetadata.host_to_device) + return &_impl_.host_to_device_; +} +inline const ::tensorflow::tf2xla::HostTransferMetadata& HostComputeMetadata::_internal_host_to_device(int index) const { + return _impl_.host_to_device_.Get(index); +} +inline const ::tensorflow::tf2xla::HostTransferMetadata& HostComputeMetadata::host_to_device(int index) const { + // @@protoc_insertion_point(field_get:tensorflow.tf2xla.HostComputeMetadata.host_to_device) + return _internal_host_to_device(index); +} +inline ::tensorflow::tf2xla::HostTransferMetadata* HostComputeMetadata::_internal_add_host_to_device() { + return _impl_.host_to_device_.Add(); +} +inline ::tensorflow::tf2xla::HostTransferMetadata* HostComputeMetadata::add_host_to_device() { + ::tensorflow::tf2xla::HostTransferMetadata* _add = _internal_add_host_to_device(); + // @@protoc_insertion_point(field_add:tensorflow.tf2xla.HostComputeMetadata.host_to_device) + return _add; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::tensorflow::tf2xla::HostTransferMetadata >& +HostComputeMetadata::host_to_device() const { + // @@protoc_insertion_point(field_list:tensorflow.tf2xla.HostComputeMetadata.host_to_device) + return _impl_.host_to_device_; +} + +#ifdef __GNUC__ + #pragma GCC diagnostic pop +#endif // __GNUC__ +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + + +// @@protoc_insertion_point(namespace_scope) + +} // namespace tf2xla +} // namespace tensorflow + +// @@protoc_insertion_point(global_scope) + +#include +#endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_tensorflow_2fcompiler_2ftf2xla_2fhost_5fcompute_5fmetadata_2eproto diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/kernels/callback.pb.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/kernels/callback.pb.h new file mode 100644 index 0000000000000000000000000000000000000000..2dd09172cb8c350fd8dc689c45b1edf179945256 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/kernels/callback.pb.h @@ -0,0 +1,1445 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tensorflow/compiler/tf2xla/kernels/callback.proto + +#ifndef GOOGLE_PROTOBUF_INCLUDED_tensorflow_2fcompiler_2ftf2xla_2fkernels_2fcallback_2eproto +#define GOOGLE_PROTOBUF_INCLUDED_tensorflow_2fcompiler_2ftf2xla_2fkernels_2fcallback_2eproto + +#include +#include + +#include +#if PROTOBUF_VERSION < 3021000 +#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 3021009 < 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 // IWYU pragma: export +#include // IWYU pragma: export +#include +#include "tensorflow/core/framework/node_def.pb.h" +#include "tensorflow/core/framework/tensor.pb.h" +#include "tensorflow/core/framework/tensor_shape.pb.h" +#include "tensorflow/core/framework/types.pb.h" +// @@protoc_insertion_point(includes) +#include +#define PROTOBUF_INTERNAL_EXPORT_tensorflow_2fcompiler_2ftf2xla_2fkernels_2fcallback_2eproto +PROTOBUF_NAMESPACE_OPEN +namespace internal { +class AnyMetadata; +} // namespace internal +PROTOBUF_NAMESPACE_CLOSE + +// Internal implementation detail -- do not use these members. +struct TableStruct_tensorflow_2fcompiler_2ftf2xla_2fkernels_2fcallback_2eproto { + static const uint32_t offsets[]; +}; +extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_tensorflow_2fcompiler_2ftf2xla_2fkernels_2fcallback_2eproto; +namespace tensorflow { +class TfCallbackData; +struct TfCallbackDataDefaultTypeInternal; +extern TfCallbackDataDefaultTypeInternal _TfCallbackData_default_instance_; +class TfCallbackData_BufferDescription; +struct TfCallbackData_BufferDescriptionDefaultTypeInternal; +extern TfCallbackData_BufferDescriptionDefaultTypeInternal _TfCallbackData_BufferDescription_default_instance_; +class TfCallbackData_InputBufferDescription; +struct TfCallbackData_InputBufferDescriptionDefaultTypeInternal; +extern TfCallbackData_InputBufferDescriptionDefaultTypeInternal _TfCallbackData_InputBufferDescription_default_instance_; +class TfCallbackData_OutputBufferDescription; +struct TfCallbackData_OutputBufferDescriptionDefaultTypeInternal; +extern TfCallbackData_OutputBufferDescriptionDefaultTypeInternal _TfCallbackData_OutputBufferDescription_default_instance_; +} // namespace tensorflow +PROTOBUF_NAMESPACE_OPEN +template<> ::tensorflow::TfCallbackData* Arena::CreateMaybeMessage<::tensorflow::TfCallbackData>(Arena*); +template<> ::tensorflow::TfCallbackData_BufferDescription* Arena::CreateMaybeMessage<::tensorflow::TfCallbackData_BufferDescription>(Arena*); +template<> ::tensorflow::TfCallbackData_InputBufferDescription* Arena::CreateMaybeMessage<::tensorflow::TfCallbackData_InputBufferDescription>(Arena*); +template<> ::tensorflow::TfCallbackData_OutputBufferDescription* Arena::CreateMaybeMessage<::tensorflow::TfCallbackData_OutputBufferDescription>(Arena*); +PROTOBUF_NAMESPACE_CLOSE +namespace tensorflow { + +// =================================================================== + +class TfCallbackData_BufferDescription final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:tensorflow.TfCallbackData.BufferDescription) */ { + public: + inline TfCallbackData_BufferDescription() : TfCallbackData_BufferDescription(nullptr) {} + ~TfCallbackData_BufferDescription() override; + explicit PROTOBUF_CONSTEXPR TfCallbackData_BufferDescription(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + TfCallbackData_BufferDescription(const TfCallbackData_BufferDescription& from); + TfCallbackData_BufferDescription(TfCallbackData_BufferDescription&& from) noexcept + : TfCallbackData_BufferDescription() { + *this = ::std::move(from); + } + + inline TfCallbackData_BufferDescription& operator=(const TfCallbackData_BufferDescription& from) { + CopyFrom(from); + return *this; + } + inline TfCallbackData_BufferDescription& operator=(TfCallbackData_BufferDescription&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const TfCallbackData_BufferDescription& default_instance() { + return *internal_default_instance(); + } + static inline const TfCallbackData_BufferDescription* internal_default_instance() { + return reinterpret_cast( + &_TfCallbackData_BufferDescription_default_instance_); + } + static constexpr int kIndexInFileMessages = + 0; + + friend void swap(TfCallbackData_BufferDescription& a, TfCallbackData_BufferDescription& b) { + a.Swap(&b); + } + inline void Swap(TfCallbackData_BufferDescription* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(TfCallbackData_BufferDescription* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + TfCallbackData_BufferDescription* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const TfCallbackData_BufferDescription& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom( const TfCallbackData_BufferDescription& from) { + TfCallbackData_BufferDescription::MergeImpl(*this, from); + } + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); + public: + 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(TfCallbackData_BufferDescription* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "tensorflow.TfCallbackData.BufferDescription"; + } + protected: + explicit TfCallbackData_BufferDescription(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kShapeFieldNumber = 1, + kTypeFieldNumber = 2, + }; + // optional .tensorflow.TensorShapeProto shape = 1; + bool has_shape() const; + private: + bool _internal_has_shape() const; + public: + void clear_shape(); + const ::tensorflow::TensorShapeProto& shape() const; + PROTOBUF_NODISCARD ::tensorflow::TensorShapeProto* release_shape(); + ::tensorflow::TensorShapeProto* mutable_shape(); + void set_allocated_shape(::tensorflow::TensorShapeProto* shape); + private: + const ::tensorflow::TensorShapeProto& _internal_shape() const; + ::tensorflow::TensorShapeProto* _internal_mutable_shape(); + public: + void unsafe_arena_set_allocated_shape( + ::tensorflow::TensorShapeProto* shape); + ::tensorflow::TensorShapeProto* unsafe_arena_release_shape(); + + // optional .tensorflow.DataType type = 2; + bool has_type() const; + private: + bool _internal_has_type() const; + public: + void clear_type(); + ::tensorflow::DataType type() const; + void set_type(::tensorflow::DataType value); + private: + ::tensorflow::DataType _internal_type() const; + void _internal_set_type(::tensorflow::DataType value); + public: + + // @@protoc_insertion_point(class_scope:tensorflow.TfCallbackData.BufferDescription) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::tensorflow::TensorShapeProto* shape_; + int type_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_tensorflow_2fcompiler_2ftf2xla_2fkernels_2fcallback_2eproto; +}; +// ------------------------------------------------------------------- + +class TfCallbackData_InputBufferDescription final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:tensorflow.TfCallbackData.InputBufferDescription) */ { + public: + inline TfCallbackData_InputBufferDescription() : TfCallbackData_InputBufferDescription(nullptr) {} + ~TfCallbackData_InputBufferDescription() override; + explicit PROTOBUF_CONSTEXPR TfCallbackData_InputBufferDescription(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + TfCallbackData_InputBufferDescription(const TfCallbackData_InputBufferDescription& from); + TfCallbackData_InputBufferDescription(TfCallbackData_InputBufferDescription&& from) noexcept + : TfCallbackData_InputBufferDescription() { + *this = ::std::move(from); + } + + inline TfCallbackData_InputBufferDescription& operator=(const TfCallbackData_InputBufferDescription& from) { + CopyFrom(from); + return *this; + } + inline TfCallbackData_InputBufferDescription& operator=(TfCallbackData_InputBufferDescription&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const TfCallbackData_InputBufferDescription& default_instance() { + return *internal_default_instance(); + } + static inline const TfCallbackData_InputBufferDescription* internal_default_instance() { + return reinterpret_cast( + &_TfCallbackData_InputBufferDescription_default_instance_); + } + static constexpr int kIndexInFileMessages = + 1; + + friend void swap(TfCallbackData_InputBufferDescription& a, TfCallbackData_InputBufferDescription& b) { + a.Swap(&b); + } + inline void Swap(TfCallbackData_InputBufferDescription* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(TfCallbackData_InputBufferDescription* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + TfCallbackData_InputBufferDescription* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const TfCallbackData_InputBufferDescription& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom( const TfCallbackData_InputBufferDescription& from) { + TfCallbackData_InputBufferDescription::MergeImpl(*this, from); + } + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); + public: + 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(TfCallbackData_InputBufferDescription* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "tensorflow.TfCallbackData.InputBufferDescription"; + } + protected: + explicit TfCallbackData_InputBufferDescription(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kBufferDescriptionFieldNumber = 1, + kValueFieldNumber = 2, + }; + // optional .tensorflow.TfCallbackData.BufferDescription buffer_description = 1; + bool has_buffer_description() const; + private: + bool _internal_has_buffer_description() const; + public: + void clear_buffer_description(); + const ::tensorflow::TfCallbackData_BufferDescription& buffer_description() const; + PROTOBUF_NODISCARD ::tensorflow::TfCallbackData_BufferDescription* release_buffer_description(); + ::tensorflow::TfCallbackData_BufferDescription* mutable_buffer_description(); + void set_allocated_buffer_description(::tensorflow::TfCallbackData_BufferDescription* buffer_description); + private: + const ::tensorflow::TfCallbackData_BufferDescription& _internal_buffer_description() const; + ::tensorflow::TfCallbackData_BufferDescription* _internal_mutable_buffer_description(); + public: + void unsafe_arena_set_allocated_buffer_description( + ::tensorflow::TfCallbackData_BufferDescription* buffer_description); + ::tensorflow::TfCallbackData_BufferDescription* unsafe_arena_release_buffer_description(); + + // optional .tensorflow.TensorProto value = 2; + bool has_value() const; + private: + bool _internal_has_value() const; + public: + void clear_value(); + const ::tensorflow::TensorProto& value() const; + PROTOBUF_NODISCARD ::tensorflow::TensorProto* release_value(); + ::tensorflow::TensorProto* mutable_value(); + void set_allocated_value(::tensorflow::TensorProto* value); + private: + const ::tensorflow::TensorProto& _internal_value() const; + ::tensorflow::TensorProto* _internal_mutable_value(); + public: + void unsafe_arena_set_allocated_value( + ::tensorflow::TensorProto* value); + ::tensorflow::TensorProto* unsafe_arena_release_value(); + + // @@protoc_insertion_point(class_scope:tensorflow.TfCallbackData.InputBufferDescription) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::tensorflow::TfCallbackData_BufferDescription* buffer_description_; + ::tensorflow::TensorProto* value_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_tensorflow_2fcompiler_2ftf2xla_2fkernels_2fcallback_2eproto; +}; +// ------------------------------------------------------------------- + +class TfCallbackData_OutputBufferDescription final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:tensorflow.TfCallbackData.OutputBufferDescription) */ { + public: + inline TfCallbackData_OutputBufferDescription() : TfCallbackData_OutputBufferDescription(nullptr) {} + ~TfCallbackData_OutputBufferDescription() override; + explicit PROTOBUF_CONSTEXPR TfCallbackData_OutputBufferDescription(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + TfCallbackData_OutputBufferDescription(const TfCallbackData_OutputBufferDescription& from); + TfCallbackData_OutputBufferDescription(TfCallbackData_OutputBufferDescription&& from) noexcept + : TfCallbackData_OutputBufferDescription() { + *this = ::std::move(from); + } + + inline TfCallbackData_OutputBufferDescription& operator=(const TfCallbackData_OutputBufferDescription& from) { + CopyFrom(from); + return *this; + } + inline TfCallbackData_OutputBufferDescription& operator=(TfCallbackData_OutputBufferDescription&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const TfCallbackData_OutputBufferDescription& default_instance() { + return *internal_default_instance(); + } + static inline const TfCallbackData_OutputBufferDescription* internal_default_instance() { + return reinterpret_cast( + &_TfCallbackData_OutputBufferDescription_default_instance_); + } + static constexpr int kIndexInFileMessages = + 2; + + friend void swap(TfCallbackData_OutputBufferDescription& a, TfCallbackData_OutputBufferDescription& b) { + a.Swap(&b); + } + inline void Swap(TfCallbackData_OutputBufferDescription* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(TfCallbackData_OutputBufferDescription* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + TfCallbackData_OutputBufferDescription* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const TfCallbackData_OutputBufferDescription& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom( const TfCallbackData_OutputBufferDescription& from) { + TfCallbackData_OutputBufferDescription::MergeImpl(*this, from); + } + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); + public: + 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(TfCallbackData_OutputBufferDescription* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "tensorflow.TfCallbackData.OutputBufferDescription"; + } + protected: + explicit TfCallbackData_OutputBufferDescription(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kBufferDescriptionFieldNumber = 1, + kIsDynamicallyPaddedFieldNumber = 2, + }; + // optional .tensorflow.TfCallbackData.BufferDescription buffer_description = 1; + bool has_buffer_description() const; + private: + bool _internal_has_buffer_description() const; + public: + void clear_buffer_description(); + const ::tensorflow::TfCallbackData_BufferDescription& buffer_description() const; + PROTOBUF_NODISCARD ::tensorflow::TfCallbackData_BufferDescription* release_buffer_description(); + ::tensorflow::TfCallbackData_BufferDescription* mutable_buffer_description(); + void set_allocated_buffer_description(::tensorflow::TfCallbackData_BufferDescription* buffer_description); + private: + const ::tensorflow::TfCallbackData_BufferDescription& _internal_buffer_description() const; + ::tensorflow::TfCallbackData_BufferDescription* _internal_mutable_buffer_description(); + public: + void unsafe_arena_set_allocated_buffer_description( + ::tensorflow::TfCallbackData_BufferDescription* buffer_description); + ::tensorflow::TfCallbackData_BufferDescription* unsafe_arena_release_buffer_description(); + + // optional bool is_dynamically_padded = 2; + bool has_is_dynamically_padded() const; + private: + bool _internal_has_is_dynamically_padded() const; + public: + void clear_is_dynamically_padded(); + bool is_dynamically_padded() const; + void set_is_dynamically_padded(bool value); + private: + bool _internal_is_dynamically_padded() const; + void _internal_set_is_dynamically_padded(bool value); + public: + + // @@protoc_insertion_point(class_scope:tensorflow.TfCallbackData.OutputBufferDescription) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::tensorflow::TfCallbackData_BufferDescription* buffer_description_; + bool is_dynamically_padded_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_tensorflow_2fcompiler_2ftf2xla_2fkernels_2fcallback_2eproto; +}; +// ------------------------------------------------------------------- + +class TfCallbackData final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:tensorflow.TfCallbackData) */ { + public: + inline TfCallbackData() : TfCallbackData(nullptr) {} + ~TfCallbackData() override; + explicit PROTOBUF_CONSTEXPR TfCallbackData(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + TfCallbackData(const TfCallbackData& from); + TfCallbackData(TfCallbackData&& from) noexcept + : TfCallbackData() { + *this = ::std::move(from); + } + + inline TfCallbackData& operator=(const TfCallbackData& from) { + CopyFrom(from); + return *this; + } + inline TfCallbackData& operator=(TfCallbackData&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + inline const ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance); + } + inline ::PROTOBUF_NAMESPACE_ID::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(); + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const TfCallbackData& default_instance() { + return *internal_default_instance(); + } + static inline const TfCallbackData* internal_default_instance() { + return reinterpret_cast( + &_TfCallbackData_default_instance_); + } + static constexpr int kIndexInFileMessages = + 3; + + friend void swap(TfCallbackData& a, TfCallbackData& b) { + a.Swap(&b); + } + inline void Swap(TfCallbackData* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(TfCallbackData* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + TfCallbackData* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const TfCallbackData& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom( const TfCallbackData& from) { + TfCallbackData::MergeImpl(*this, from); + } + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); + public: + 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(TfCallbackData* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "tensorflow.TfCallbackData"; + } + protected: + explicit TfCallbackData(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + typedef TfCallbackData_BufferDescription BufferDescription; + typedef TfCallbackData_InputBufferDescription InputBufferDescription; + typedef TfCallbackData_OutputBufferDescription OutputBufferDescription; + + // accessors ------------------------------------------------------- + + enum : int { + kInputsFieldNumber = 2, + kOutputsFieldNumber = 3, + kOpFieldNumber = 1, + }; + // repeated .tensorflow.TfCallbackData.InputBufferDescription inputs = 2; + int inputs_size() const; + private: + int _internal_inputs_size() const; + public: + void clear_inputs(); + ::tensorflow::TfCallbackData_InputBufferDescription* mutable_inputs(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::tensorflow::TfCallbackData_InputBufferDescription >* + mutable_inputs(); + private: + const ::tensorflow::TfCallbackData_InputBufferDescription& _internal_inputs(int index) const; + ::tensorflow::TfCallbackData_InputBufferDescription* _internal_add_inputs(); + public: + const ::tensorflow::TfCallbackData_InputBufferDescription& inputs(int index) const; + ::tensorflow::TfCallbackData_InputBufferDescription* add_inputs(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::tensorflow::TfCallbackData_InputBufferDescription >& + inputs() const; + + // repeated .tensorflow.TfCallbackData.OutputBufferDescription outputs = 3; + int outputs_size() const; + private: + int _internal_outputs_size() const; + public: + void clear_outputs(); + ::tensorflow::TfCallbackData_OutputBufferDescription* mutable_outputs(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::tensorflow::TfCallbackData_OutputBufferDescription >* + mutable_outputs(); + private: + const ::tensorflow::TfCallbackData_OutputBufferDescription& _internal_outputs(int index) const; + ::tensorflow::TfCallbackData_OutputBufferDescription* _internal_add_outputs(); + public: + const ::tensorflow::TfCallbackData_OutputBufferDescription& outputs(int index) const; + ::tensorflow::TfCallbackData_OutputBufferDescription* add_outputs(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::tensorflow::TfCallbackData_OutputBufferDescription >& + outputs() const; + + // optional .tensorflow.NodeDef op = 1; + bool has_op() const; + private: + bool _internal_has_op() const; + public: + void clear_op(); + const ::tensorflow::NodeDef& op() const; + PROTOBUF_NODISCARD ::tensorflow::NodeDef* release_op(); + ::tensorflow::NodeDef* mutable_op(); + void set_allocated_op(::tensorflow::NodeDef* op); + private: + const ::tensorflow::NodeDef& _internal_op() const; + ::tensorflow::NodeDef* _internal_mutable_op(); + public: + void unsafe_arena_set_allocated_op( + ::tensorflow::NodeDef* op); + ::tensorflow::NodeDef* unsafe_arena_release_op(); + + // @@protoc_insertion_point(class_scope:tensorflow.TfCallbackData) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::tensorflow::TfCallbackData_InputBufferDescription > inputs_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::tensorflow::TfCallbackData_OutputBufferDescription > outputs_; + ::tensorflow::NodeDef* op_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_tensorflow_2fcompiler_2ftf2xla_2fkernels_2fcallback_2eproto; +}; +// =================================================================== + + +// =================================================================== + +#ifdef __GNUC__ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wstrict-aliasing" +#endif // __GNUC__ +// TfCallbackData_BufferDescription + +// optional .tensorflow.TensorShapeProto shape = 1; +inline bool TfCallbackData_BufferDescription::_internal_has_shape() const { + bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; + PROTOBUF_ASSUME(!value || _impl_.shape_ != nullptr); + return value; +} +inline bool TfCallbackData_BufferDescription::has_shape() const { + return _internal_has_shape(); +} +inline const ::tensorflow::TensorShapeProto& TfCallbackData_BufferDescription::_internal_shape() const { + const ::tensorflow::TensorShapeProto* p = _impl_.shape_; + return p != nullptr ? *p : reinterpret_cast( + ::tensorflow::_TensorShapeProto_default_instance_); +} +inline const ::tensorflow::TensorShapeProto& TfCallbackData_BufferDescription::shape() const { + // @@protoc_insertion_point(field_get:tensorflow.TfCallbackData.BufferDescription.shape) + return _internal_shape(); +} +inline void TfCallbackData_BufferDescription::unsafe_arena_set_allocated_shape( + ::tensorflow::TensorShapeProto* shape) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.shape_); + } + _impl_.shape_ = shape; + if (shape) { + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.TfCallbackData.BufferDescription.shape) +} +inline ::tensorflow::TensorShapeProto* TfCallbackData_BufferDescription::release_shape() { + _impl_._has_bits_[0] &= ~0x00000001u; + ::tensorflow::TensorShapeProto* temp = _impl_.shape_; + _impl_.shape_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::tensorflow::TensorShapeProto* TfCallbackData_BufferDescription::unsafe_arena_release_shape() { + // @@protoc_insertion_point(field_release:tensorflow.TfCallbackData.BufferDescription.shape) + _impl_._has_bits_[0] &= ~0x00000001u; + ::tensorflow::TensorShapeProto* temp = _impl_.shape_; + _impl_.shape_ = nullptr; + return temp; +} +inline ::tensorflow::TensorShapeProto* TfCallbackData_BufferDescription::_internal_mutable_shape() { + _impl_._has_bits_[0] |= 0x00000001u; + if (_impl_.shape_ == nullptr) { + auto* p = CreateMaybeMessage<::tensorflow::TensorShapeProto>(GetArenaForAllocation()); + _impl_.shape_ = p; + } + return _impl_.shape_; +} +inline ::tensorflow::TensorShapeProto* TfCallbackData_BufferDescription::mutable_shape() { + ::tensorflow::TensorShapeProto* _msg = _internal_mutable_shape(); + // @@protoc_insertion_point(field_mutable:tensorflow.TfCallbackData.BufferDescription.shape) + return _msg; +} +inline void TfCallbackData_BufferDescription::set_allocated_shape(::tensorflow::TensorShapeProto* shape) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete reinterpret_cast< ::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.shape_); + } + if (shape) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena( + reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(shape)); + if (message_arena != submessage_arena) { + shape = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, shape, submessage_arena); + } + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } + _impl_.shape_ = shape; + // @@protoc_insertion_point(field_set_allocated:tensorflow.TfCallbackData.BufferDescription.shape) +} + +// optional .tensorflow.DataType type = 2; +inline bool TfCallbackData_BufferDescription::_internal_has_type() const { + bool value = (_impl_._has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool TfCallbackData_BufferDescription::has_type() const { + return _internal_has_type(); +} +inline void TfCallbackData_BufferDescription::clear_type() { + _impl_.type_ = 0; + _impl_._has_bits_[0] &= ~0x00000002u; +} +inline ::tensorflow::DataType TfCallbackData_BufferDescription::_internal_type() const { + return static_cast< ::tensorflow::DataType >(_impl_.type_); +} +inline ::tensorflow::DataType TfCallbackData_BufferDescription::type() const { + // @@protoc_insertion_point(field_get:tensorflow.TfCallbackData.BufferDescription.type) + return _internal_type(); +} +inline void TfCallbackData_BufferDescription::_internal_set_type(::tensorflow::DataType value) { + assert(::tensorflow::DataType_IsValid(value)); + _impl_._has_bits_[0] |= 0x00000002u; + _impl_.type_ = value; +} +inline void TfCallbackData_BufferDescription::set_type(::tensorflow::DataType value) { + _internal_set_type(value); + // @@protoc_insertion_point(field_set:tensorflow.TfCallbackData.BufferDescription.type) +} + +// ------------------------------------------------------------------- + +// TfCallbackData_InputBufferDescription + +// optional .tensorflow.TfCallbackData.BufferDescription buffer_description = 1; +inline bool TfCallbackData_InputBufferDescription::_internal_has_buffer_description() const { + bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; + PROTOBUF_ASSUME(!value || _impl_.buffer_description_ != nullptr); + return value; +} +inline bool TfCallbackData_InputBufferDescription::has_buffer_description() const { + return _internal_has_buffer_description(); +} +inline void TfCallbackData_InputBufferDescription::clear_buffer_description() { + if (_impl_.buffer_description_ != nullptr) _impl_.buffer_description_->Clear(); + _impl_._has_bits_[0] &= ~0x00000001u; +} +inline const ::tensorflow::TfCallbackData_BufferDescription& TfCallbackData_InputBufferDescription::_internal_buffer_description() const { + const ::tensorflow::TfCallbackData_BufferDescription* p = _impl_.buffer_description_; + return p != nullptr ? *p : reinterpret_cast( + ::tensorflow::_TfCallbackData_BufferDescription_default_instance_); +} +inline const ::tensorflow::TfCallbackData_BufferDescription& TfCallbackData_InputBufferDescription::buffer_description() const { + // @@protoc_insertion_point(field_get:tensorflow.TfCallbackData.InputBufferDescription.buffer_description) + return _internal_buffer_description(); +} +inline void TfCallbackData_InputBufferDescription::unsafe_arena_set_allocated_buffer_description( + ::tensorflow::TfCallbackData_BufferDescription* buffer_description) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.buffer_description_); + } + _impl_.buffer_description_ = buffer_description; + if (buffer_description) { + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.TfCallbackData.InputBufferDescription.buffer_description) +} +inline ::tensorflow::TfCallbackData_BufferDescription* TfCallbackData_InputBufferDescription::release_buffer_description() { + _impl_._has_bits_[0] &= ~0x00000001u; + ::tensorflow::TfCallbackData_BufferDescription* temp = _impl_.buffer_description_; + _impl_.buffer_description_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::tensorflow::TfCallbackData_BufferDescription* TfCallbackData_InputBufferDescription::unsafe_arena_release_buffer_description() { + // @@protoc_insertion_point(field_release:tensorflow.TfCallbackData.InputBufferDescription.buffer_description) + _impl_._has_bits_[0] &= ~0x00000001u; + ::tensorflow::TfCallbackData_BufferDescription* temp = _impl_.buffer_description_; + _impl_.buffer_description_ = nullptr; + return temp; +} +inline ::tensorflow::TfCallbackData_BufferDescription* TfCallbackData_InputBufferDescription::_internal_mutable_buffer_description() { + _impl_._has_bits_[0] |= 0x00000001u; + if (_impl_.buffer_description_ == nullptr) { + auto* p = CreateMaybeMessage<::tensorflow::TfCallbackData_BufferDescription>(GetArenaForAllocation()); + _impl_.buffer_description_ = p; + } + return _impl_.buffer_description_; +} +inline ::tensorflow::TfCallbackData_BufferDescription* TfCallbackData_InputBufferDescription::mutable_buffer_description() { + ::tensorflow::TfCallbackData_BufferDescription* _msg = _internal_mutable_buffer_description(); + // @@protoc_insertion_point(field_mutable:tensorflow.TfCallbackData.InputBufferDescription.buffer_description) + return _msg; +} +inline void TfCallbackData_InputBufferDescription::set_allocated_buffer_description(::tensorflow::TfCallbackData_BufferDescription* buffer_description) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete _impl_.buffer_description_; + } + if (buffer_description) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(buffer_description); + if (message_arena != submessage_arena) { + buffer_description = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, buffer_description, submessage_arena); + } + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } + _impl_.buffer_description_ = buffer_description; + // @@protoc_insertion_point(field_set_allocated:tensorflow.TfCallbackData.InputBufferDescription.buffer_description) +} + +// optional .tensorflow.TensorProto value = 2; +inline bool TfCallbackData_InputBufferDescription::_internal_has_value() const { + bool value = (_impl_._has_bits_[0] & 0x00000002u) != 0; + PROTOBUF_ASSUME(!value || _impl_.value_ != nullptr); + return value; +} +inline bool TfCallbackData_InputBufferDescription::has_value() const { + return _internal_has_value(); +} +inline const ::tensorflow::TensorProto& TfCallbackData_InputBufferDescription::_internal_value() const { + const ::tensorflow::TensorProto* p = _impl_.value_; + return p != nullptr ? *p : reinterpret_cast( + ::tensorflow::_TensorProto_default_instance_); +} +inline const ::tensorflow::TensorProto& TfCallbackData_InputBufferDescription::value() const { + // @@protoc_insertion_point(field_get:tensorflow.TfCallbackData.InputBufferDescription.value) + return _internal_value(); +} +inline void TfCallbackData_InputBufferDescription::unsafe_arena_set_allocated_value( + ::tensorflow::TensorProto* value) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.value_); + } + _impl_.value_ = value; + if (value) { + _impl_._has_bits_[0] |= 0x00000002u; + } else { + _impl_._has_bits_[0] &= ~0x00000002u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.TfCallbackData.InputBufferDescription.value) +} +inline ::tensorflow::TensorProto* TfCallbackData_InputBufferDescription::release_value() { + _impl_._has_bits_[0] &= ~0x00000002u; + ::tensorflow::TensorProto* temp = _impl_.value_; + _impl_.value_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::tensorflow::TensorProto* TfCallbackData_InputBufferDescription::unsafe_arena_release_value() { + // @@protoc_insertion_point(field_release:tensorflow.TfCallbackData.InputBufferDescription.value) + _impl_._has_bits_[0] &= ~0x00000002u; + ::tensorflow::TensorProto* temp = _impl_.value_; + _impl_.value_ = nullptr; + return temp; +} +inline ::tensorflow::TensorProto* TfCallbackData_InputBufferDescription::_internal_mutable_value() { + _impl_._has_bits_[0] |= 0x00000002u; + if (_impl_.value_ == nullptr) { + auto* p = CreateMaybeMessage<::tensorflow::TensorProto>(GetArenaForAllocation()); + _impl_.value_ = p; + } + return _impl_.value_; +} +inline ::tensorflow::TensorProto* TfCallbackData_InputBufferDescription::mutable_value() { + ::tensorflow::TensorProto* _msg = _internal_mutable_value(); + // @@protoc_insertion_point(field_mutable:tensorflow.TfCallbackData.InputBufferDescription.value) + return _msg; +} +inline void TfCallbackData_InputBufferDescription::set_allocated_value(::tensorflow::TensorProto* value) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete reinterpret_cast< ::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.value_); + } + if (value) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena( + reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(value)); + if (message_arena != submessage_arena) { + value = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, value, submessage_arena); + } + _impl_._has_bits_[0] |= 0x00000002u; + } else { + _impl_._has_bits_[0] &= ~0x00000002u; + } + _impl_.value_ = value; + // @@protoc_insertion_point(field_set_allocated:tensorflow.TfCallbackData.InputBufferDescription.value) +} + +// ------------------------------------------------------------------- + +// TfCallbackData_OutputBufferDescription + +// optional .tensorflow.TfCallbackData.BufferDescription buffer_description = 1; +inline bool TfCallbackData_OutputBufferDescription::_internal_has_buffer_description() const { + bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; + PROTOBUF_ASSUME(!value || _impl_.buffer_description_ != nullptr); + return value; +} +inline bool TfCallbackData_OutputBufferDescription::has_buffer_description() const { + return _internal_has_buffer_description(); +} +inline void TfCallbackData_OutputBufferDescription::clear_buffer_description() { + if (_impl_.buffer_description_ != nullptr) _impl_.buffer_description_->Clear(); + _impl_._has_bits_[0] &= ~0x00000001u; +} +inline const ::tensorflow::TfCallbackData_BufferDescription& TfCallbackData_OutputBufferDescription::_internal_buffer_description() const { + const ::tensorflow::TfCallbackData_BufferDescription* p = _impl_.buffer_description_; + return p != nullptr ? *p : reinterpret_cast( + ::tensorflow::_TfCallbackData_BufferDescription_default_instance_); +} +inline const ::tensorflow::TfCallbackData_BufferDescription& TfCallbackData_OutputBufferDescription::buffer_description() const { + // @@protoc_insertion_point(field_get:tensorflow.TfCallbackData.OutputBufferDescription.buffer_description) + return _internal_buffer_description(); +} +inline void TfCallbackData_OutputBufferDescription::unsafe_arena_set_allocated_buffer_description( + ::tensorflow::TfCallbackData_BufferDescription* buffer_description) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.buffer_description_); + } + _impl_.buffer_description_ = buffer_description; + if (buffer_description) { + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.TfCallbackData.OutputBufferDescription.buffer_description) +} +inline ::tensorflow::TfCallbackData_BufferDescription* TfCallbackData_OutputBufferDescription::release_buffer_description() { + _impl_._has_bits_[0] &= ~0x00000001u; + ::tensorflow::TfCallbackData_BufferDescription* temp = _impl_.buffer_description_; + _impl_.buffer_description_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::tensorflow::TfCallbackData_BufferDescription* TfCallbackData_OutputBufferDescription::unsafe_arena_release_buffer_description() { + // @@protoc_insertion_point(field_release:tensorflow.TfCallbackData.OutputBufferDescription.buffer_description) + _impl_._has_bits_[0] &= ~0x00000001u; + ::tensorflow::TfCallbackData_BufferDescription* temp = _impl_.buffer_description_; + _impl_.buffer_description_ = nullptr; + return temp; +} +inline ::tensorflow::TfCallbackData_BufferDescription* TfCallbackData_OutputBufferDescription::_internal_mutable_buffer_description() { + _impl_._has_bits_[0] |= 0x00000001u; + if (_impl_.buffer_description_ == nullptr) { + auto* p = CreateMaybeMessage<::tensorflow::TfCallbackData_BufferDescription>(GetArenaForAllocation()); + _impl_.buffer_description_ = p; + } + return _impl_.buffer_description_; +} +inline ::tensorflow::TfCallbackData_BufferDescription* TfCallbackData_OutputBufferDescription::mutable_buffer_description() { + ::tensorflow::TfCallbackData_BufferDescription* _msg = _internal_mutable_buffer_description(); + // @@protoc_insertion_point(field_mutable:tensorflow.TfCallbackData.OutputBufferDescription.buffer_description) + return _msg; +} +inline void TfCallbackData_OutputBufferDescription::set_allocated_buffer_description(::tensorflow::TfCallbackData_BufferDescription* buffer_description) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete _impl_.buffer_description_; + } + if (buffer_description) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(buffer_description); + if (message_arena != submessage_arena) { + buffer_description = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, buffer_description, submessage_arena); + } + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } + _impl_.buffer_description_ = buffer_description; + // @@protoc_insertion_point(field_set_allocated:tensorflow.TfCallbackData.OutputBufferDescription.buffer_description) +} + +// optional bool is_dynamically_padded = 2; +inline bool TfCallbackData_OutputBufferDescription::_internal_has_is_dynamically_padded() const { + bool value = (_impl_._has_bits_[0] & 0x00000002u) != 0; + return value; +} +inline bool TfCallbackData_OutputBufferDescription::has_is_dynamically_padded() const { + return _internal_has_is_dynamically_padded(); +} +inline void TfCallbackData_OutputBufferDescription::clear_is_dynamically_padded() { + _impl_.is_dynamically_padded_ = false; + _impl_._has_bits_[0] &= ~0x00000002u; +} +inline bool TfCallbackData_OutputBufferDescription::_internal_is_dynamically_padded() const { + return _impl_.is_dynamically_padded_; +} +inline bool TfCallbackData_OutputBufferDescription::is_dynamically_padded() const { + // @@protoc_insertion_point(field_get:tensorflow.TfCallbackData.OutputBufferDescription.is_dynamically_padded) + return _internal_is_dynamically_padded(); +} +inline void TfCallbackData_OutputBufferDescription::_internal_set_is_dynamically_padded(bool value) { + _impl_._has_bits_[0] |= 0x00000002u; + _impl_.is_dynamically_padded_ = value; +} +inline void TfCallbackData_OutputBufferDescription::set_is_dynamically_padded(bool value) { + _internal_set_is_dynamically_padded(value); + // @@protoc_insertion_point(field_set:tensorflow.TfCallbackData.OutputBufferDescription.is_dynamically_padded) +} + +// ------------------------------------------------------------------- + +// TfCallbackData + +// optional .tensorflow.NodeDef op = 1; +inline bool TfCallbackData::_internal_has_op() const { + bool value = (_impl_._has_bits_[0] & 0x00000001u) != 0; + PROTOBUF_ASSUME(!value || _impl_.op_ != nullptr); + return value; +} +inline bool TfCallbackData::has_op() const { + return _internal_has_op(); +} +inline const ::tensorflow::NodeDef& TfCallbackData::_internal_op() const { + const ::tensorflow::NodeDef* p = _impl_.op_; + return p != nullptr ? *p : reinterpret_cast( + ::tensorflow::_NodeDef_default_instance_); +} +inline const ::tensorflow::NodeDef& TfCallbackData::op() const { + // @@protoc_insertion_point(field_get:tensorflow.TfCallbackData.op) + return _internal_op(); +} +inline void TfCallbackData::unsafe_arena_set_allocated_op( + ::tensorflow::NodeDef* op) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.op_); + } + _impl_.op_ = op; + if (op) { + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.TfCallbackData.op) +} +inline ::tensorflow::NodeDef* TfCallbackData::release_op() { + _impl_._has_bits_[0] &= ~0x00000001u; + ::tensorflow::NodeDef* temp = _impl_.op_; + _impl_.op_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::tensorflow::NodeDef* TfCallbackData::unsafe_arena_release_op() { + // @@protoc_insertion_point(field_release:tensorflow.TfCallbackData.op) + _impl_._has_bits_[0] &= ~0x00000001u; + ::tensorflow::NodeDef* temp = _impl_.op_; + _impl_.op_ = nullptr; + return temp; +} +inline ::tensorflow::NodeDef* TfCallbackData::_internal_mutable_op() { + _impl_._has_bits_[0] |= 0x00000001u; + if (_impl_.op_ == nullptr) { + auto* p = CreateMaybeMessage<::tensorflow::NodeDef>(GetArenaForAllocation()); + _impl_.op_ = p; + } + return _impl_.op_; +} +inline ::tensorflow::NodeDef* TfCallbackData::mutable_op() { + ::tensorflow::NodeDef* _msg = _internal_mutable_op(); + // @@protoc_insertion_point(field_mutable:tensorflow.TfCallbackData.op) + return _msg; +} +inline void TfCallbackData::set_allocated_op(::tensorflow::NodeDef* op) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete reinterpret_cast< ::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.op_); + } + if (op) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena( + reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(op)); + if (message_arena != submessage_arena) { + op = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, op, submessage_arena); + } + _impl_._has_bits_[0] |= 0x00000001u; + } else { + _impl_._has_bits_[0] &= ~0x00000001u; + } + _impl_.op_ = op; + // @@protoc_insertion_point(field_set_allocated:tensorflow.TfCallbackData.op) +} + +// repeated .tensorflow.TfCallbackData.InputBufferDescription inputs = 2; +inline int TfCallbackData::_internal_inputs_size() const { + return _impl_.inputs_.size(); +} +inline int TfCallbackData::inputs_size() const { + return _internal_inputs_size(); +} +inline void TfCallbackData::clear_inputs() { + _impl_.inputs_.Clear(); +} +inline ::tensorflow::TfCallbackData_InputBufferDescription* TfCallbackData::mutable_inputs(int index) { + // @@protoc_insertion_point(field_mutable:tensorflow.TfCallbackData.inputs) + return _impl_.inputs_.Mutable(index); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::tensorflow::TfCallbackData_InputBufferDescription >* +TfCallbackData::mutable_inputs() { + // @@protoc_insertion_point(field_mutable_list:tensorflow.TfCallbackData.inputs) + return &_impl_.inputs_; +} +inline const ::tensorflow::TfCallbackData_InputBufferDescription& TfCallbackData::_internal_inputs(int index) const { + return _impl_.inputs_.Get(index); +} +inline const ::tensorflow::TfCallbackData_InputBufferDescription& TfCallbackData::inputs(int index) const { + // @@protoc_insertion_point(field_get:tensorflow.TfCallbackData.inputs) + return _internal_inputs(index); +} +inline ::tensorflow::TfCallbackData_InputBufferDescription* TfCallbackData::_internal_add_inputs() { + return _impl_.inputs_.Add(); +} +inline ::tensorflow::TfCallbackData_InputBufferDescription* TfCallbackData::add_inputs() { + ::tensorflow::TfCallbackData_InputBufferDescription* _add = _internal_add_inputs(); + // @@protoc_insertion_point(field_add:tensorflow.TfCallbackData.inputs) + return _add; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::tensorflow::TfCallbackData_InputBufferDescription >& +TfCallbackData::inputs() const { + // @@protoc_insertion_point(field_list:tensorflow.TfCallbackData.inputs) + return _impl_.inputs_; +} + +// repeated .tensorflow.TfCallbackData.OutputBufferDescription outputs = 3; +inline int TfCallbackData::_internal_outputs_size() const { + return _impl_.outputs_.size(); +} +inline int TfCallbackData::outputs_size() const { + return _internal_outputs_size(); +} +inline void TfCallbackData::clear_outputs() { + _impl_.outputs_.Clear(); +} +inline ::tensorflow::TfCallbackData_OutputBufferDescription* TfCallbackData::mutable_outputs(int index) { + // @@protoc_insertion_point(field_mutable:tensorflow.TfCallbackData.outputs) + return _impl_.outputs_.Mutable(index); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::tensorflow::TfCallbackData_OutputBufferDescription >* +TfCallbackData::mutable_outputs() { + // @@protoc_insertion_point(field_mutable_list:tensorflow.TfCallbackData.outputs) + return &_impl_.outputs_; +} +inline const ::tensorflow::TfCallbackData_OutputBufferDescription& TfCallbackData::_internal_outputs(int index) const { + return _impl_.outputs_.Get(index); +} +inline const ::tensorflow::TfCallbackData_OutputBufferDescription& TfCallbackData::outputs(int index) const { + // @@protoc_insertion_point(field_get:tensorflow.TfCallbackData.outputs) + return _internal_outputs(index); +} +inline ::tensorflow::TfCallbackData_OutputBufferDescription* TfCallbackData::_internal_add_outputs() { + return _impl_.outputs_.Add(); +} +inline ::tensorflow::TfCallbackData_OutputBufferDescription* TfCallbackData::add_outputs() { + ::tensorflow::TfCallbackData_OutputBufferDescription* _add = _internal_add_outputs(); + // @@protoc_insertion_point(field_add:tensorflow.TfCallbackData.outputs) + return _add; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::tensorflow::TfCallbackData_OutputBufferDescription >& +TfCallbackData::outputs() const { + // @@protoc_insertion_point(field_list:tensorflow.TfCallbackData.outputs) + return _impl_.outputs_; +} + +#ifdef __GNUC__ + #pragma GCC diagnostic pop +#endif // __GNUC__ +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + + +// @@protoc_insertion_point(namespace_scope) + +} // namespace tensorflow + +// @@protoc_insertion_point(global_scope) + +#include +#endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_tensorflow_2fcompiler_2ftf2xla_2fkernels_2fcallback_2eproto diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/kernels/case_op.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/kernels/case_op.h new file mode 100644 index 0000000000000000000000000000000000000000..a4c01bea65a04d060fc5ab46eb374506cbb5c211 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/kernels/case_op.h @@ -0,0 +1,78 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_TF2XLA_KERNELS_CASE_OP_H_ +#define TENSORFLOW_COMPILER_TF2XLA_KERNELS_CASE_OP_H_ + +#include +#include +#include + +#include "tensorflow/compiler/tf2xla/xla_op_kernel.h" +#include "tensorflow/core/framework/attr_value.pb.h" +#include "tensorflow/core/framework/types.h" + +namespace tensorflow { + +// This TensorFlow op provides a functional switch/case primitive. +// +// The outputs of the branches must agree on the number, types, and +// shapes of the Tensors carried around the two bodies. +// +// Computations in branch bodies may read from and write to resource variables. +// Resource variables may be passed as arguments to the branch function's +// bodies. The XlaCompiler converts resource variable arguments +// into parameters to the XLA computation and moves them to the end of the +// parameter list, and by using the `return_updated_values_for_all_variables` +// we ensure that all variables that appear in the input also appear at the +// end of the branch bodies output. This ensures the branch bodies output +// signatures match. +// +// It is the user's responsibility to ensure that each non-variable _Arg matches +// the corresponding _Retval. +class XlaCaseOp : public XlaOpKernel { + public: + explicit XlaCaseOp(OpKernelConstruction* ctx); + + void Compile(XlaOpKernelContext* ctx) override; + + private: + XlaCaseOp(const XlaCaseOp&) = delete; + void operator=(const XlaCaseOp&) = delete; + + // If the branch_index input is a constant: prunes out all but the branch + // corrresponding to that constant branch index, and returns that branch and + // the literal 0 (as the first and second component of the pair). + // + // If the branch_index input is not a constant: returns unpruned_branches_ and + // the branch_index input. + std::pair, xla::XlaOp> GetPrunedBranchesAndIndex( + XlaOpKernelContext* ctx); + + std::vector unpruned_branches_; + DataTypeVector input_types_; + DataTypeVector output_types_; + bool has_token_input_output_; + std::vector token_input_nodes_; + string original_node_name_; + // Whether to propagate compile time consts into the cond branches. + // This is not supported by default now since it may cause HBM memory + // overheads. + bool propagate_compile_time_consts_ = false; +}; + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_TF2XLA_KERNELS_CASE_OP_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/kernels/conv_op_helpers.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/kernels/conv_op_helpers.h new file mode 100644 index 0000000000000000000000000000000000000000..e6e90bd48307b79c8906da919764ded5cc94c9c2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/kernels/conv_op_helpers.h @@ -0,0 +1,91 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_TF2XLA_KERNELS_CONV_OP_HELPERS_H_ +#define TENSORFLOW_COMPILER_TF2XLA_KERNELS_CONV_OP_HELPERS_H_ + +#include + +#include "xla/client/xla_builder.h" +#include "tensorflow/core/framework/op_kernel.h" +#include "tensorflow/core/framework/types.h" +#include "tensorflow/core/platform/statusor.h" +#include "tensorflow/core/util/padding.h" +#include "tensorflow/core/util/tensor_format.h" + +// This header exposes utilities for translating TensorFlow convolution ops into +// XLA ops. +// +// conv_ops.cc contains lowerings for many of these TF convolution ops (e.g. +// Conv2D, Conv3DBackpropFilterV2), but you might want to use the utilities in +// this header to implement a new and exciting convolution op, for example a +// fused TensorFlow op that contains a convolution and other things. + +namespace tensorflow { + +// We don't support integers for convolutions for GPU, so we list the supported +// types for non-gpu and gpu here. +std::vector GetXlaConvTypesForNonGpu(); +std::vector GetXlaConvTypesForGpu(); + +// ConvOpAttrs contains all of the metadata necessary to specify a TF or XLA +// convolution. +struct ConvOpAttrs { + // Constructs a ConvOpAttrs, reading most of the attributes from `ctx`. + static StatusOr Create(int num_spatial_dims, bool depthwise, + OpKernelConstruction* ctx); + + bool depthwise; + int num_spatial_dims; + std::vector dilations; + std::vector strides; + Padding padding; + std::vector explicit_paddings; + TensorFormat data_format; +}; + +// Helper for the general Conv Op. +struct ConvNDOpAttrs { + // Constructs a ConvOpAttrs, reading most of the attributes from `ctx`. + static StatusOr Create(OpKernelConstruction* ctx); + + int groups; + int batch_dims; + std::vector dilations; + std::vector strides; + Padding padding; + std::vector explicit_paddings; + TensorFormat data_format; +}; + +// Creates a new XLA forward or backward convolution with the given inputs and +// attributes. +StatusOr MakeXlaForwardConvOp(StringPiece type_string, + xla::XlaOp conv_input, + xla::XlaOp filter, + const ConvOpAttrs& attrs); +StatusOr MakeXlaBackpropInputConvOp( + StringPiece type_string, const xla::Shape& input_shape, xla::XlaOp filter, + xla::XlaOp out_backprop, const ConvOpAttrs& attrs, + xla::XlaOp* input_sizes = nullptr); +StatusOr MakeXlaBackpropFilterConvOp(StringPiece type_string, + xla::XlaOp activations, + const xla::Shape& filter_shape, + xla::XlaOp gradients, + const ConvOpAttrs& attrs); + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_TF2XLA_KERNELS_CONV_OP_HELPERS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/kernels/cwise_ops.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/kernels/cwise_ops.h new file mode 100644 index 0000000000000000000000000000000000000000..c09818549b7bd34986f60cf5621759efb1aaf60a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/kernels/cwise_ops.h @@ -0,0 +1,78 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +// XLA-specific base classes for Unary and Binary Ops. + +#ifndef TENSORFLOW_COMPILER_TF2XLA_KERNELS_CWISE_OPS_H_ +#define TENSORFLOW_COMPILER_TF2XLA_KERNELS_CWISE_OPS_H_ + +#include +#include + +#include "tensorflow/compiler/tf2xla/xla_op_kernel.h" +#include "xla/client/client_library.h" +#include "xla/client/xla_builder.h" +#include "tensorflow/core/framework/op_kernel.h" +#include "tensorflow/core/util/bcast.h" + +namespace tensorflow { + +// Coefficient-wise binary operations. Each binary Op expects two +// inputs that can be broadcast to the same shape. The base class +// contains pure virtual methods to override: description is a textual +// description of the operation; and Computation adds the +// implementation of the operation to a xla::XlaBuilder. For most +// arithmetic Ops XLA handles the broadcasting automatically given the input +// tensors. +class XlaBinaryOp : public XlaOpKernel { + public: + explicit XlaBinaryOp(OpKernelConstruction* ctx) : XlaOpKernel(ctx) { + const DataType lhs = BaseType(input_type(0)); + const DataType rhs = BaseType(input_type(1)); + OP_REQUIRES(ctx, lhs == rhs, + errors::InvalidArgument("Input types of binary op must match")); + } + ~XlaBinaryOp() override = default; + + // Implement the (tensor,tensor)->tensor lambda that should be + // applied to the inputs. The desired computation should be added to + // 'tc->builder()' and '(lhs,rhs)' are the function's inputs and + // (lhs_shape,rhs_shape) are their respective + // shapes. 'broadcast_helper' contains metadata about the shapes of + // the inputs and the dimensions that need to be broadcast, which + // may be useful for Ops that can't use standard XLA automatic + // broadcasting. 'extend_dimension' is non-empty if lhs and rhs have + // different ranks, and indicates which dimensions of the + // higher-rank input should be matched when broadcasting the + // lower-rank input. See comment below and the documentation on broadcasting + // in the XLA documentation. + virtual xla::XlaOp Computation( + XlaOpKernelContext* ctx, const xla::XlaOp& lhs, + const absl::Span& lhs_shape, const xla::XlaOp& rhs, + const absl::Span& rhs_shape, const BCast& broadcast_helper, + const std::vector& extend_dimensions) = 0; + + void Compile(XlaOpKernelContext* ctx) override; + + // Helper function that performs the broadcasting described by + // 'broadcast_helper', yielding arguments 'lhs' and 'rhs' that have the same + // shape. + static std::pair Broadcast( + xla::XlaOp lhs, xla::XlaOp rhs, const BCast& broadcast_helper); +}; + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_TF2XLA_KERNELS_CWISE_OPS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/kernels/elu_op.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/kernels/elu_op.h new file mode 100644 index 0000000000000000000000000000000000000000..d5ab2e9ee90220737e4482055188f4d827ee75b2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/kernels/elu_op.h @@ -0,0 +1,26 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ +#ifndef TENSORFLOW_COMPILER_TF2XLA_KERNELS_ELU_OP_H_ +#define TENSORFLOW_COMPILER_TF2XLA_KERNELS_ELU_OP_H_ + +#include "xla/client/lib/constants.h" +#include "xla/client/xla_builder.h" + +namespace xla { +XlaOp Elu(XlaOp x); +XlaOp Selu(XlaOp x); +} // namespace xla + +#endif // TENSORFLOW_COMPILER_TF2XLA_KERNELS_ELU_OP_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/kernels/gather_op_helpers.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/kernels/gather_op_helpers.h new file mode 100644 index 0000000000000000000000000000000000000000..fa160886eb5140ad5f2ab108fd4a050c5833ac8c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/kernels/gather_op_helpers.h @@ -0,0 +1,51 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +// Helper methods for XLA Gather Ops. + +#ifndef TENSORFLOW_COMPILER_TF2XLA_KERNELS_GATHER_OP_HELPERS_H_ +#define TENSORFLOW_COMPILER_TF2XLA_KERNELS_GATHER_OP_HELPERS_H_ + +#include "tensorflow/compiler/tf2xla/xla_op_kernel.h" +#include "xla/client/client_library.h" +#include "xla/client/xla_builder.h" +#include "tensorflow/core/framework/op_kernel.h" +#include "tensorflow/core/util/bcast.h" + +namespace tensorflow { + +// Adds to builder an XLA computation that performs a gather on input (of +// shape input_shape) keyed on indices (of shape indices_shape). +// +// index_type must be must be DT_INT32 or DT_INT64. +// If `indices_are_nd` is true, the last dimension of `indices` are treated as +// a multidimensional index values. Otherwise, `indices` is treated as a tensor +// of scalar indices. +Status XlaGather(const xla::XlaOp& input, const TensorShape& input_shape, + const xla::XlaOp& indices, const TensorShape& indices_shape, + int64_t axis, bool indices_are_nd, DataType dtype, + DataType index_type, xla::XlaBuilder* builder, + xla::XlaOp* gather_output); + +// The implementation of Gather and ResourceGather through XLA. Uses `input` as +// the input instead of context->input(0) in order to allow ResourceGather to +// handle obtaining the data from the ResourceVariable. +Status XlaGatherWithBatchDimsOpImpl(XlaOpKernelContext* context, + xla::XlaOp input, + const TensorShape& input_shape, + int batch_dims, xla::XlaOp* gather_output); +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_TF2XLA_KERNELS_GATHER_OP_HELPERS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/kernels/if_op.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/kernels/if_op.h new file mode 100644 index 0000000000000000000000000000000000000000..ac596a29b28ca9e200f307233b6f3f09ae03661c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/kernels/if_op.h @@ -0,0 +1,66 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_TF2XLA_KERNELS_IF_OP_H_ +#define TENSORFLOW_COMPILER_TF2XLA_KERNELS_IF_OP_H_ + +#include + +#include "tensorflow/compiler/tf2xla/xla_op_kernel.h" +#include "tensorflow/core/framework/attr_value.pb.h" + +namespace tensorflow { + +// This TensorFlow op provides a functional conditional primitive. +// +// The outputs of the then/else branches must agree on the number, types, and +// shapes of the Tensors carried around the two bodies. +// +// Computations in then/else bodies may read from and write to resource +// variables. +// Resource variables may be passed as arguments to the then/else function's +// bodies. The XlaCompiler converts resource variable arguments +// into parameters to the XLA computation and moves them to the end of the +// parameter list, and by using the `return_updated_values_for_all_variables` +// we ensure that all variables that appear in the input also appear at the +// end of the then/else bodies output. This ensures the then/else bodies output +// signatures match. +// +// It is the user's responsibility to ensure that each non-variable _Arg matches +// the corresponding _Retval. +class XlaIfOp : public XlaOpKernel { + public: + explicit XlaIfOp(OpKernelConstruction* ctx); + + void Compile(XlaOpKernelContext* ctx) override; + + private: + XlaIfOp(const XlaIfOp&) = delete; + void operator=(const XlaIfOp&) = delete; + + NameAttrList then_branch_; + NameAttrList else_branch_; + DataType cond_type_; + DataTypeVector input_types_; + DataTypeVector output_types_; + std::vector output_shapes_; + bool has_token_input_output_; + std::vector token_input_nodes_; + string original_node_name_; +}; + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_TF2XLA_KERNELS_IF_OP_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/kernels/if_while_utils.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/kernels/if_while_utils.h new file mode 100644 index 0000000000000000000000000000000000000000..15f30975076569d753bde6996a0466b13cb7bfda --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/kernels/if_while_utils.h @@ -0,0 +1,49 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_TF2XLA_KERNELS_IF_WHILE_UTILS_H_ +#define TENSORFLOW_COMPILER_TF2XLA_KERNELS_IF_WHILE_UTILS_H_ + +#include +#include + +#include "tensorflow/compiler/tf2xla/xla_op_kernel.h" +#include "tensorflow/core/lib/core/status.h" + +namespace tensorflow { + +extern const char kPropagateCompileTimeConsts[]; + +// Convert arguments in `args` to constants provided they are compile-time +// constants and they satisfy the condition in `should_resolve_constant`. The +// argument `xla_expression_offset` determines what offset is needed to get the +// input expression from context given the argument index in `args`. +// +// Returns a list of indices which were converted to constants. +absl::InlinedVector ConvertCompileTimeConstArgumentsToConst( + XlaOpKernelContext* ctx, std::vector* args, + int xla_expression_offset, + std::function should_resolve_constant); + +// Find and populate `must_be_const_nodes` and `body` of the function +// corresponding to the kernel with context `ctx` with name `func_name`. +Status FindMustBeConstNodes(XlaOpKernelContext* ctx, + const NameAttrList& func_name, + std::vector* must_be_const_nodes, + const FunctionBody** body); + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_TF2XLA_KERNELS_IF_WHILE_UTILS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/kernels/image_resize_ops.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/kernels/image_resize_ops.h new file mode 100644 index 0000000000000000000000000000000000000000..6818be33994cf0ccc7690f8c45d8b5cf434d12d5 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/kernels/image_resize_ops.h @@ -0,0 +1,71 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ +#ifndef TENSORFLOW_COMPILER_TF2XLA_KERNELS_IMAGE_RESIZE_OPS_H_ +#define TENSORFLOW_COMPILER_TF2XLA_KERNELS_IMAGE_RESIZE_OPS_H_ + +#include "tensorflow/compiler/tf2xla/xla_op_kernel.h" +#include "xla/primitive_util.h" + +#if GOOGLE_CUDA || TENSORFLOW_USE_ROCM +#include "tensorflow/compiler/tf2xla/kernels/light_outside_compilation.h" +#endif + +namespace tensorflow { + +class ResizeNearestNeighborOp : public XlaOpKernel { + public: + explicit ResizeNearestNeighborOp(OpKernelConstruction* ctx); + void Compile(XlaOpKernelContext* ctx) override; + + protected: + bool align_corners_ = true; + bool half_pixel_centers_ = true; + bool is_kernel_bilinear_ = false; +}; + +class ResizeBilinearOp : public XlaOpKernel { + public: + explicit ResizeBilinearOp(OpKernelConstruction* ctx); + + void Compile(XlaOpKernelContext* ctx) override; + + protected: + bool align_corners_ = true; + bool half_pixel_centers_ = true; + bool is_kernel_bilinear_ = true; +}; + +class ResizeBilinearGradOp : public XlaOpKernel { + public: + explicit ResizeBilinearGradOp(OpKernelConstruction* ctx); + + void Compile(XlaOpKernelContext* ctx) override; + + protected: + bool align_corners_; + bool half_pixel_centers_ = true; + xla::PrimitiveType output_type_; + + private: +#if GOOGLE_CUDA || TENSORFLOW_USE_ROCM + // Fallback light outside compilation kernel for the option combination we do + // not support. + std::optional fallback_tf_kernel_; +#endif +}; + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_TF2XLA_KERNELS_IMAGE_RESIZE_OPS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/kernels/index_ops.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/kernels/index_ops.h new file mode 100644 index 0000000000000000000000000000000000000000..ef2b9e6b6ebda921764de768fda0d20c20a765e2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/kernels/index_ops.h @@ -0,0 +1,42 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +// Declarations of the ArgMax/ArgMin ops using a pure XLA implementation. + +#ifndef TENSORFLOW_COMPILER_TF2XLA_KERNELS_INDEX_OPS_H_ +#define TENSORFLOW_COMPILER_TF2XLA_KERNELS_INDEX_OPS_H_ + +#include "tensorflow/compiler/tf2xla/xla_op_kernel.h" +#include "tensorflow/core/framework/op_kernel.h" + +namespace tensorflow { + +class XlaArgMinMaxOp : public XlaOpKernel { + public: + explicit XlaArgMinMaxOp(OpKernelConstruction* ctx, bool is_min); + void Compile(XlaOpKernelContext* ctx) override; + + private: + const bool is_min_; // Are we computing ArgMin (true) or ArgMax (false)? +}; + +class XlaArgMaxOp : public XlaArgMinMaxOp { + public: + explicit XlaArgMaxOp(OpKernelConstruction* ctx); +}; + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_TF2XLA_KERNELS_INDEX_OPS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/kernels/light_outside_compilation.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/kernels/light_outside_compilation.h new file mode 100644 index 0000000000000000000000000000000000000000..658b7838026e9549a47f90b2a9224bdcac60b8ae --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/kernels/light_outside_compilation.h @@ -0,0 +1,68 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_TF2XLA_KERNELS_LIGHT_OUTSIDE_COMPILATION_H_ +#define TENSORFLOW_COMPILER_TF2XLA_KERNELS_LIGHT_OUTSIDE_COMPILATION_H_ + +#include + +#include "tensorflow/compiler/tf2xla/kernels/callback.pb.h" +#include "tensorflow/compiler/tf2xla/xla_op_kernel.h" +#include "tensorflow/core/platform/status.h" + +namespace tensorflow { + +// Using std::map as the maps are presumed to be tiny, and we want a +// deterministic iteration order. +// +// Dimension -> bound. +using DimensionBoundsMap = std::map; + +// Output -> dimension -> bound. +using OutputDimensionBoundsMap = std::map; + +// Generic kernel for registering TF2XLA kernels which call back into the TF +// runtime to run a given kernel defined by the wrapped node. +// +// Cf. example usages in light_outside_compilation_kernels_for_test.cc. +// +// Currently does not support dynamic shape or resource variables. Currently +// works only on GPU. +class LightOutsideCompilationOp : public XlaOpKernel { + public: + explicit LightOutsideCompilationOp(OpKernelConstruction* context); + void Compile(XlaOpKernelContext* ctx) override; + + // Override to provide statically known bounds on output in case of dynamic + // shapes. + virtual StatusOr DynamicOutputDimensions( + const NodeDef& ndef, XlaOpKernelContext* ctx) const { + return OutputDimensionBoundsMap{}; + } + + private: + Status CompileToCustomCallCallingTfKernel(int graph_def_version, + const NodeDef& node_def, + XlaOpKernelContext* ctx); + static Status CallTfKernel(void* stream_handle, void** buffers, + const char* opaque, int opaque_len); + + NodeDef def_; + int graph_def_version_; +}; + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_TF2XLA_KERNELS_LIGHT_OUTSIDE_COMPILATION_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/kernels/random_ops_util.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/kernels/random_ops_util.h new file mode 100644 index 0000000000000000000000000000000000000000..0ea1ed75ca7748cb1677852ae3dd33a1cba659b3 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/kernels/random_ops_util.h @@ -0,0 +1,90 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_TF2XLA_KERNELS_RANDOM_OPS_UTIL_H_ +#define TENSORFLOW_COMPILER_TF2XLA_KERNELS_RANDOM_OPS_UTIL_H_ + +#include + +#include "tensorflow/compiler/tf2xla/xla_op_kernel.h" +#include "xla/client/lib/prng.h" +#include "xla/client/xla_builder.h" +#include "xla/xla_data.pb.h" + +namespace tensorflow { + +inline constexpr int kRandomKeyInputIdx = 1; +inline constexpr int kRandomCounterInputIdx = 2; +inline constexpr int kRandomAlgInputIdx = 3; + +// Returns a tensor containing 'shape' random values uniformly distributed in +// the range [minval, maxval). The raw random bits are generated by the given +// `bit_generator` and converted to the requested data type and range. This +// routine requires 2 32-bit integer seeds and currently only supports 'shape's +// of type F32, S32 and S64. +xla::XlaOp StatelessRngUniform(absl::string_view device_type_string, + xla::XlaOp seeds, const xla::Shape& shape, + xla::XlaOp minval, xla::XlaOp maxval); + +// Converts to bfloat16 if `dtype` equals DT_BFLOAT16, no-op otherwise. +// It masks the last 16 bit. With normal rounding, values near "maxval" would be +// converted to "maxval" which is out of range ["minval", "maxval"). In +// addition, the distribution near the limit is not uniform. +xla::XlaOp MaybeConvertF32ToBF16(xla::XlaOp input, DataType dtype); + +// Combines two signed 32-bit seeds into a single unsigned 64 bit seed. +xla::XlaOp GetU64FromS32Seeds(xla::XlaOp seed0, xla::XlaOp seed1); + +StatusOr GetAlgId(XlaOpKernelContext* ctx, int alg_input_idx); + +xla::RngOutput BitGenerator(xla::RandomAlgorithm const& alg, xla::XlaOp key, + xla::XlaOp counter, const xla::Shape& shape); + +// Gets user specified RNG algorithm. +StatusOr AlgorithmFromInput( + XlaOpKernelContext* ctx, int alg_input_idx, + absl::string_view device_type_string); + +xla::XlaOp MaybeSliceCounter(xla::RandomAlgorithm const& alg, + TensorShape const& counter_shape, + xla::XlaOp counter); + +DataType MaybeConvertBF16ToF32(DataType const& dtype); + +// Builds uniform randoms from a stateless RNG with given data type and device +// type, in the given low and high range, where low and high are expressed in +// XLA functions. +StatusOr BuildUniformRandoms( + XlaOpKernelContext* ctx, DataType dtype, string device_type_string, + TensorShape shape, + std::function lo, + std::function hi); + +// Overloads BuildUniformRandoms where low and high range are expressed in XLA +// ops. +StatusOr BuildUniformRandoms(XlaOpKernelContext* ctx, + DataType dtype, + string device_type_string, + xla::Shape xla_shape, xla::XlaOp lo, + xla::XlaOp hi); +} // namespace tensorflow + +namespace xla { + +int GetCounterSize(RandomAlgorithm const& alg); + +} // namespace xla + +#endif // TENSORFLOW_COMPILER_TF2XLA_KERNELS_RANDOM_OPS_UTIL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/kernels/reduction_ops.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/kernels/reduction_ops.h new file mode 100644 index 0000000000000000000000000000000000000000..cee41d33f715414714db49fd4c4a3524a0410c9f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/kernels/reduction_ops.h @@ -0,0 +1,75 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +// XLA-specific base classes for Reduction Ops. + +#ifndef TENSORFLOW_COMPILER_TF2XLA_KERNELS_REDUCTION_OPS_H_ +#define TENSORFLOW_COMPILER_TF2XLA_KERNELS_REDUCTION_OPS_H_ + +#include + +#include "tensorflow/compiler/tf2xla/xla_op_kernel.h" +#include "xla/client/xla_builder.h" +#include "tensorflow/core/framework/op_kernel.h" + +namespace tensorflow { + +// Reduction operations. The base class contains pure virtual methods +// to override: description is a textual description of the mapped +// function; InitialValue constructs the base case for the reduction; +// BuildReducer adds the implementation of the reduction lambda to a +// xla::XlaBuilder and BuildFinalizer adds the +// implementation of the finalizer lambda (if there is one) to a +// xla::XlaBuilder. +class XlaReductionOp : public XlaOpKernel { + public: + XlaReductionOp(OpKernelConstruction* ctx, DataType reduction_type); + ~XlaReductionOp() override = default; + + // Return the base case for the reduction. + virtual xla::XlaOp InitialValue(xla::XlaBuilder* builder) = 0; + + // Implement the (scalar,scalar)->scalar lambda that should be + // applied to each pair of elements to be reduced. The desired + // computation should be added to 'builder' and + // '(scalar_lhs,scalar_rhs)' are the function's inputs. + virtual void BuildReducer(xla::XlaBuilder* builder, + const xla::XlaOp& scalar_lhs, + const xla::XlaOp& scalar_rhs) = 0; + + // Applies a transformation to the output of the reduction. The desired + // computation should be added to 'builder'. Argument 'input' is the original + // input of the reduction; 'reduce_output' is the output of the reduction. + // Returns the transformed reduction output. Defaults to returning + // 'reduce_output' converted to the input type. + virtual xla::XlaOp BuildFinalizer( + xla::XlaBuilder* builder, const xla::XlaOp& input, + const xla::XlaOp& reduce_output, + const std::vector& dimensions_to_reduce); + + void Compile(XlaOpKernelContext* ctx) override; + + private: + // True if the number of dimensions should be maintained. + bool keep_dims_; + + protected: + DataType reduction_type_; + xla::PrimitiveType xla_reduction_type_; +}; + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_TF2XLA_KERNELS_REDUCTION_OPS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/kernels/relu_op.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/kernels/relu_op.h new file mode 100644 index 0000000000000000000000000000000000000000..a968194211b29acb91bb89c20244187e0fc3f95c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/kernels/relu_op.h @@ -0,0 +1,26 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ +#ifndef TENSORFLOW_COMPILER_TF2XLA_KERNELS_RELU_OP_H_ +#define TENSORFLOW_COMPILER_TF2XLA_KERNELS_RELU_OP_H_ + +#include "xla/client/lib/constants.h" +#include "xla/client/xla_builder.h" + +namespace xla { +XlaOp Relu(XlaOp x); +XlaOp Relu6(XlaOp x); +} // namespace xla + +#endif // TENSORFLOW_COMPILER_TF2XLA_KERNELS_RELU_OP_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/kernels/rng_converter_utils.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/kernels/rng_converter_utils.h new file mode 100644 index 0000000000000000000000000000000000000000..e12ec30e313cd6157730ee973f7bf21a17f7e9cc --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/kernels/rng_converter_utils.h @@ -0,0 +1,33 @@ +/* Copyright 2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_TF2XLA_KERNELS_RNG_CONVERTER_UTILS_H_ +#define TENSORFLOW_COMPILER_TF2XLA_KERNELS_RNG_CONVERTER_UTILS_H_ + +#include "xla/xla_data.pb.h" +#include "tensorflow/core/framework/rng_alg.h" + +namespace tensorflow { + +// Given the XLA::RandomAlgorithm, return the Tensorflow equivalent. +Algorithm ToTensorflowAlgorithm(xla::RandomAlgorithm alg); + +// Given the device type, return the default XLA::RandomAlgorithm +xla::RandomAlgorithm DefaultRngAlgForDeviceType( + absl::string_view device_type_string); + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_TF2XLA_KERNELS_RNG_CONVERTER_UTILS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/kernels/shape_util.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/kernels/shape_util.h new file mode 100644 index 0000000000000000000000000000000000000000..ca57be3d47b95d71b07746e50256070e0a4f4c09 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/kernels/shape_util.h @@ -0,0 +1,34 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_TF2XLA_KERNELS_SHAPE_UTIL_H_ +#define TENSORFLOW_COMPILER_TF2XLA_KERNELS_SHAPE_UTIL_H_ + +#include + +#include "tensorflow/core/framework/tensor.h" + +namespace tensorflow { + +// Converts a TensorShape to a constant Tensor. +// +// The input TensorShape input_shape is used to populate the elements of +// shape_constant, which is modified in place. +Status TensorShapeToConstant(const TensorShape& input_shape, + Tensor* shape_constant); + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_TF2XLA_KERNELS_SHAPE_UTIL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/kernels/tensor_list_utils.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/kernels/tensor_list_utils.h new file mode 100644 index 0000000000000000000000000000000000000000..04a92a505ba79e0154eaec3d2239f41ab3f6e2ce --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/kernels/tensor_list_utils.h @@ -0,0 +1,129 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_TF2XLA_KERNELS_TENSOR_LIST_UTILS_H_ +#define TENSORFLOW_COMPILER_TF2XLA_KERNELS_TENSOR_LIST_UTILS_H_ + +#include + +#include "tensorflow/compiler/tf2xla/xla_op_kernel.h" +#include "xla/client/xla_builder.h" +#include "tensorflow/core/framework/tensor_shape.h" + +namespace tensorflow { + +// Whether the input expression at `index` corresponds to a TensorList. +bool IsTensorListInput(XlaOpKernelContext* ctx, int index); + +// Whether the TensorList is initialized (has known data type and shape). +Status IsTensorListInitialized(xla::XlaOp list, bool* is_initialized); + +// Whether the TensorList is a nested TensorList. +// Input must be an initialized TensorList. +// Non-nested and nested TensorLists are both supported. +Status IsNestedTensorList(xla::XlaOp list, bool* is_nested_list); + +// Builds a non-nested TensorList from `buffer` and `push_index`. +Status BuildNonNestedTensorList(xla::XlaOp buffer, xla::XlaOp push_index, + xla::XlaOp* output_list); + +// Returns buffer shape for the TensorList. +// Input must be an initialized TensorList. +// Non-nested and nested TensorLists are both supported. +Status GetTensorListBufferShape(xla::XlaOp list, xla::Shape* buffer_shape); + +// Returns buffer for the TensorList. +// Input must be an initialized TensorList. +// Non-nested and nested TensorLists are both supported. +Status GetTensorListBuffer(xla::XlaOp list, xla::XlaOp* buffer); + +// Returns push index for the TensorList. +// Input must be an initialized TensorList. +// Non-nested and nested TensorLists are both supported. +Status GetTensorListPushIndex(xla::XlaOp list, xla::XlaOp* push_index); + +// Returns a new TensorList with given push_index. +// Input must be an initialized TensorList. +// Non-nested and nested TensorLists are both supported. +Status SetTensorListPushIndex(xla::XlaOp list, xla::XlaOp push_index, + xla::XlaOp* result); + +// Returns an uninitialized TensorList. +xla::XlaOp BuildUninitializedTensorList(xla::XlaBuilder* b, + int64_t leading_dimension, + bool leading_size_is_dynamic, + xla::XlaOp leading_dim_size); + +// Returns leading dimension for the TensorList as well as a dynamic op +// representing the dynamic size. Input can be initialized or uninitialized +// TensorList. Non-nested and nested TensorLists are both supported. +Status GetLeadingDimForTensorList(xla::XlaOp list, int64_t* leading_dim, + bool* leading_dim_is_dynamic, + xla::XlaOp* leading_dim_dynamic_size); + +// Returns TensorList shape for the element shape. +// Element shape must be a normal tensor shape. +Status GetTensorListShapeFromElementShape(const xla::Shape& element_shape, + int64_t leading_dim, + bool leading_dim_is_dynamic, + xla::Shape* tensor_list_shape); + +// Returns a TensorList filled by zeros with the given shape. +Status CreateZerosTensorListWithShape( + xla::XlaBuilder* b, const xla::Shape& list_shape, + const std::vector>& dynamic_dims, xla::XlaOp* list); + +// If the TensorList is initialized, check that its shape matches element shape; +// If the TensorList is uninitialized, initialize it with the element shape. +// Input can be initialized or uninitialized TensorList. +// "element" can be normal tensor or TensorList. +Status GetInitializedTensorListForElement(xla::XlaOp list, xla::XlaOp element, + bool element_is_tensor_list, + xla::XlaOp* initialized_list); + +// Executes TensorListPushBack with given TensorList and element. +// Input must be an initialized TensorList. +// Non-nested and nested TensorLists are both supported. +Status ExecuteTensorListPushBack(xla::XlaOp list, xla::XlaOp element, + bool element_is_tensor_list, + xla::XlaOp* result); + +// Executes TensorListPopBack with given TensorList. +// Input must be an initialized TensorList. +// Non-nested and nested TensorLists are both supported. +Status ExecuteTensorListPopBack(xla::XlaOp list, xla::XlaOp* list_result, + xla::XlaOp* element_result, + bool* element_is_tensor_list); + +// Executes TensorListSetItem with given TensorList, index and element. +// Input must be an initialized TensorList. +// Only non-nested TensorList is supported. +Status ExecuteTensorListSetItem(xla::XlaOp list, xla::XlaOp index, + xla::XlaOp element, xla::XlaOp* result); + +// Executes TensorListGetItem with given TensorList and index. +// Input must be an initialized TensorList. +// Only non-nested TensorList is supported. +Status ExecuteTensorListGetItem(xla::XlaOp list, xla::XlaOp index, + xla::XlaOp* result); + +// Executes TensorListPushBack with given tensor and push index. +// "tensor" must be a normal tensor. +Status ExecuteTensorListFromTensor(int push_index, xla::XlaOp tensor, + xla::XlaOp* result); + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_TF2XLA_KERNELS_TENSOR_LIST_UTILS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/kernels/while_op.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/kernels/while_op.h new file mode 100644 index 0000000000000000000000000000000000000000..3015e1862d041afe6f6a2cd00d8e34302b2cc1ef --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/kernels/while_op.h @@ -0,0 +1,75 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_TF2XLA_KERNELS_WHILE_OP_H_ +#define TENSORFLOW_COMPILER_TF2XLA_KERNELS_WHILE_OP_H_ + +#include + +#include "tensorflow/compiler/tf2xla/xla_op_kernel.h" +#include "tensorflow/core/framework/attr_value.pb.h" + +namespace tensorflow { + +// This TensorFlow op provides a functional iteration primitive. +// +// The inputs and outputs of the loop body must agree on the number, types, and +// shapes of the Tensors carried around the loop body. +// +// Computations in while loops may read from and write to resource variables. +// Resource variables may be passed as arguments to a function's body and +// condition functions. The XlaCompiler converts resource variable arguments +// into parameters to the XLA computation and moves them to the end of the +// parameter list, and by using the `return_updated_values_for_all_variables` +// we ensure that all variables that appear in the input also appear at the +// end of the body's output. This ensures the loop body's input and output +// signatures match. +// +// It is the user's responsibility to ensure that each non-variable _Arg matches +// the corresponding _Retval. +// +// For example, suppose we have a loop body with arguments: +// DT_INT32, DT_RESOURCE (pointing to a DT_BOOL var), DT_FLOAT +// and return values +// DT_INT32, DT_FLOAT +// It is an error for the body to return DT_RESOURCE values. +// +// The body will be lowered into an XLA computation that takes and returns a +// tuple with XLA type (I32, F32, PRED). Note the resource variable appears at +// the end of both the loop body's input and output argument lists. +class XlaWhileOp : public XlaOpKernel { + public: + explicit XlaWhileOp(OpKernelConstruction* ctx); + + void Compile(XlaOpKernelContext* ctx) override; + + private: + NameAttrList cond_name_attr_; + NameAttrList body_name_attr_; + bool has_token_input_output_; + std::vector token_input_nodes_; + string original_node_name_; + // Whether to propagate compile time consts into the loop body. + // This is not supported by default now since it may cause HBM memory + // overheads. + bool propagate_compile_time_consts_ = false; + + XlaWhileOp(const XlaWhileOp&) = delete; + void operator=(const XlaWhileOp&) = delete; +}; + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_TF2XLA_KERNELS_WHILE_OP_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/kernels/xla_call_module_loader.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/kernels/xla_call_module_loader.h new file mode 100644 index 0000000000000000000000000000000000000000..5c918b63c0aad3bd719b58d7fbf378837686f89f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/kernels/xla_call_module_loader.h @@ -0,0 +1,111 @@ +/* Copyright 2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_TF2XLA_KERNELS_XLA_CALL_MODULE_LOADER_H_ +#define TENSORFLOW_COMPILER_TF2XLA_KERNELS_XLA_CALL_MODULE_LOADER_H_ + +#include +#include +#include +#include + +#include "mlir/Dialect/Func/IR/FuncOps.h" // from @llvm-project +#include "mlir/IR/BuiltinOps.h" // from @llvm-project +#include "mlir/IR/MLIRContext.h" // from @llvm-project +#include "mlir/IR/OwningOpRef.h" // from @llvm-project +#include "mlir/IR/TypeRange.h" // from @llvm-project +#include "xla/client/xla_computation.h" +#include "tsl/platform/statusor.h" + +namespace tensorflow { + +class XlaCallModuleLoader { + public: + static tsl::StatusOr> Create( + mlir::MLIRContext* context, int version, std::string module_str, + std::vector dim_args_spec, + std::vector disabled_checks, + std::vector platforms, std::string loading_platform, + int num_invocation_args, bool main_has_token_input_output); + + int nr_outputs() { return main_.getNumResults(); } + mlir::TypeRange output_types() { return main_.getResultTypes(); } + + // Refines the dynamic module arguments based on the static argument shapes. + // This assumes that the module has a "main" function without dimension args, + // but possibly with dynamic shapes. We read the static shapes of the inputs, + // then set them as the types of the function parameters, and run StableHLO + // shape refinement to specialize all dynamic shapes in the StableHLO program + // to static shapes. + // + // This method accepts a list of `llvm::ArrayRef` instead of `mlir::Type`. + // This is to prevent callers from accidentally passing `mlir::Type` owned by + // a context that's different from the one passed to `Create`, which could + // cause lifetime issues. + tsl::Status RefineDynamicShapes(llvm::ArrayRef input_shapes); + + // Validates that the module only contains ops from valid dialects. + tsl::Status ValidateDialect(); + + // Validates that the module represents a statically-shaped StableHLO program, + // otherwise all sorts of weirdness might happen in the HLO exporter which is + // much easier to detect here. + absl::Status ValidateStaticShapes(); + + // Lowers the StableHLO module to MHLO in place. + absl::Status LowerModuleToMhlo(); + + // Lowers the MHLO module to XlaComputation and returns it. + // + // REQUIRES: `LowerModuleToMhlo()` is called beforehand. + tsl::StatusOr ToXlaComputation(); + + // Returns the deserialized stablehlo module. + mlir::ModuleOp module() & { return *module_; } + mlir::OwningOpRef module() && { return std::move(module_); } + + private: + XlaCallModuleLoader() = default; + + // Initializes the loader with the given serialized module string. + tsl::Status LoadAndPreprocessModule(mlir::MLIRContext* context, int version, + std::string module_str, + std::vector dim_args_spec, + std::vector disabled_checks, + std::vector platforms, + std::string loading_platform, + int num_invocation_args, + bool main_has_token_input_output); + + // Adds a wrapper for the "main" function to compute the platform index and + // the dimension arguments. + tsl::Status AddMainWrapper(); + + mlir::MLIRContext* context_; + int version_; + mlir::OwningOpRef module_; + // Index in platforms of the current platform, or -1 if module does not take + // a platform index arg. + int platform_index_; + std::vector dim_args_spec_; + // The disabled checks at loading time, including those from the + // disabled_checks attribute and the TF_XLA_FLAGS environment variable. + std::vector loading_disabled_checks_; + mlir::func::FuncOp main_; +}; + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_TF2XLA_KERNELS_XLA_CALL_MODULE_LOADER_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/layout_util.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/layout_util.h new file mode 100644 index 0000000000000000000000000000000000000000..4a4a652c1e83ae9e1c92fbdb2f7b6865d1326c44 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/layout_util.h @@ -0,0 +1,77 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +// Utilities for working with XLA layout and shapes. + +#ifndef TENSORFLOW_COMPILER_TF2XLA_LAYOUT_UTIL_H_ +#define TENSORFLOW_COMPILER_TF2XLA_LAYOUT_UTIL_H_ + +#include + +#include "tensorflow/compiler/tf2xla/xla_argument.h" +#include "tensorflow/compiler/tf2xla/xla_helpers.h" +#include "xla/shape.h" +#include "xla/xla_data.pb.h" +#include "tensorflow/core/framework/tensor_shape.h" +#include "tensorflow/core/framework/types.pb.h" +#include "tensorflow/core/platform/statusor.h" + +namespace tensorflow { + +class XlaShapeLayoutHelpers { + public: + // The following defines the layout preference of an xla tensor. + // The return value of LayoutPreferenceFn can be used in + // XlaHelper::ShapeRepresentationFn. + typedef std::function)> + LayoutPreferenceFn; + + // A bundle of LayoutPreferenceFn and ShapeRepresentationFn. + struct ShapeDeterminationFns { + // Use no preference function, and identity shape representation function, + // as default value. + ShapeDeterminationFns(); + + ShapeDeterminationFns( + LayoutPreferenceFn layout_preference_fn, + XlaHelpers::ShapeRepresentationFn shape_representation_fn) + : layout_preference_fn(layout_preference_fn), + shape_representation_fn(shape_representation_fn) {} + + LayoutPreferenceFn layout_preference_fn; + XlaHelpers::ShapeRepresentationFn shape_representation_fn; + }; +}; + +// Return a LayoutPreferenceFn that always uses kNoPreference layout. +XlaShapeLayoutHelpers::LayoutPreferenceFn UseNoPreferenceLayoutFn(); + +// Rewrites the layout of xla_shape if there is tiled sharding. +Status RewriteLayoutWithShardedShape( + const std::optional& sharding, bool use_fast_memory, + XlaShapeLayoutHelpers::ShapeDeterminationFns shape_determination_fns, + xla::Shape* xla_shape); + +// Adds reshapes to fix the layout of an output, if a shape_representation_fn or +// sharding is present. +StatusOr ReshapeWithCorrectRepresentationAndSharding( + xla::XlaBuilder* builder, xla::XlaOp original, xla::Shape original_shape, + XlaShapeLayoutHelpers::ShapeDeterminationFns shape_determination_fns, + std::optional sharding, bool fast_mem); + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_TF2XLA_SHAPE_UTIL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/lib/broadcast.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/lib/broadcast.h new file mode 100644 index 0000000000000000000000000000000000000000..dfd1c0199d2451504047965bc86c3f8f02236b06 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/lib/broadcast.h @@ -0,0 +1,34 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_TF2XLA_LIB_BROADCAST_H_ +#define TENSORFLOW_COMPILER_TF2XLA_LIB_BROADCAST_H_ + +#include "absl/types/span.h" +#include "xla/client/xla_builder.h" +#include "tensorflow/core/platform/statusor.h" + +namespace tensorflow { + +// Forwards to xla::BroadcastTo. +// TODO(cheshire): Call the underlying function directly. +StatusOr BroadcastTo(xla::XlaOp input, + absl::Span output_dims); + +// Forwards to xla::BroadcastOpsToSame. +Status BroadcastOpsToSame(xla::XlaOp* lhs, xla::XlaOp* rhs); +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_TF2XLA_LIB_BROADCAST_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/lib/data_format.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/lib/data_format.h new file mode 100644 index 0000000000000000000000000000000000000000..45496f3e2c24f02ae67df0f3d7173dfb0e2e53f1 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/lib/data_format.h @@ -0,0 +1,37 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_TF2XLA_LIB_DATA_FORMAT_H_ +#define TENSORFLOW_COMPILER_TF2XLA_LIB_DATA_FORMAT_H_ + +#include "xla/client/xla_builder.h" +#include "tensorflow/core/platform/statusor.h" +#include "tensorflow/core/util/tensor_format.h" + +namespace tensorflow { + +// Reformat from NCHW_VECT_C to NCHW. +// +// Prerequisites: the last dimension of the input must be of size 4. +StatusOr NCHW_VECT_CToNCHW(xla::XlaOp input); + +// Reformat from NCHW to NCHW_VECT_C. +// +// Prerequisites: the vectorized dimension `C` must be a multiple of 4. +StatusOr NCHWToNCHW_VECT_C(xla::XlaOp input); + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_TF2XLA_LIB_DATA_FORMAT_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/lib/random.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/lib/random.h new file mode 100644 index 0000000000000000000000000000000000000000..d586af85f1860216b42557c3fc572a3bf3d49d99 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/lib/random.h @@ -0,0 +1,42 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_TF2XLA_LIB_RANDOM_H_ +#define TENSORFLOW_COMPILER_TF2XLA_LIB_RANDOM_H_ + +#include "xla/client/xla_builder.h" +#include "tensorflow/core/framework/types.pb.h" +#include "tensorflow/core/platform/statusor.h" + +namespace tensorflow { + +// Builds an array of values sampled from a truncated normal distribution: +// +// uniform: an array of random numbers in uniform distribution (0, 1). +// mu: the mean of the normal distribution. +// sigma: the standard deviation of the normal distribution. +// a: the lower bound of the generated values. +// b: the upper bound of the generated values. +xla::XlaOp ParameterizedTruncatedNormal(xla::XlaOp uniform, xla::XlaOp mu, + xla::XlaOp sigma, xla::XlaOp a, + xla::XlaOp b); + +// A specialized version of ParameterizedTruncatedNormal, with mu=0, sigma=1, +// a=-2 and b=2. +xla::XlaOp TruncatedNormal(xla::XlaOp uniform); + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_TF2XLA_LIB_RANDOM_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/lib/scatter.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/lib/scatter.h new file mode 100644 index 0000000000000000000000000000000000000000..87a4fd5488671f11e8b8e1bcb6609ff1b530df42 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/lib/scatter.h @@ -0,0 +1,56 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_TF2XLA_LIB_SCATTER_H_ +#define TENSORFLOW_COMPILER_TF2XLA_LIB_SCATTER_H_ + +#include + +#include "xla/client/xla_builder.h" +#include "xla/client/xla_computation.h" +#include "tensorflow/core/platform/statusor.h" + +namespace tensorflow { + +// Builds an XLA computation that performs a scatter operation on `buffer`, +// returning an updated buffer. +// For each i0, i1, ..., sets +// buffer[indices[i0, i1, ...], ...] := updates[i0, i1, ...] +// +// If `indices_are_vectors` is false, then each index in indices is a scalar, +// and the shape of `indices` must be a prefix of the shape of updates. +// Otherwise, `indices_are_vectors`, then indices are multidimensional and the +// minor dimension of `indices` represents a vector of indices. +// +// If `updates` is a scalar, then it will be broadcasted into the expected shape +// of updates. +// +// If any part of the update region is out-of-bounds, the corresponding update +// is discarded. +// +// If a `combiner` is provided, updates are combined with the existing values in +// the buffer using the combiner function. Otherwise, the updates replace the +// existing values. The order of updates is implementation-defined. +StatusOr XlaScatter( + const xla::XlaOp& buffer, const xla::XlaOp& updates, + const xla::XlaOp& indices, bool indices_are_vectors, + bool indices_are_sorted, + const std::function& + combiner, + xla::XlaBuilder* builder); + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_TF2XLA_LIB_SCATTER_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/lib/util.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/lib/util.h new file mode 100644 index 0000000000000000000000000000000000000000..938bbe2f5255af357d899d6fba07be9430c1d0c4 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/lib/util.h @@ -0,0 +1,43 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_TF2XLA_LIB_UTIL_H_ +#define TENSORFLOW_COMPILER_TF2XLA_LIB_UTIL_H_ + +#include "absl/types/span.h" +#include "xla/client/xla_builder.h" +#include "xla/client/xla_computation.h" +#include "tensorflow/core/platform/statusor.h" + +namespace tensorflow { + +// Returns a floating point scalar constant of 'type' with 'value'. +// If 'type' is complex, returns a real value with zero imaginary component. +xla::XlaOp FloatLiteral(xla::XlaBuilder* builder, xla::PrimitiveType type, + double value); + +// Makes a 1D tensor [0, ..., x, y] from two tensors x and y with zeros +// prepended until the array is length n_dims. +xla::XlaOp PrependZerosInMajorDims(xla::XlaOp x, + absl::Span starts); + +// Returns a integer scalar constant of 'type' with 'value'. +// If 'type' is complex, returns a real value with zero imaginary component. +xla::XlaOp IntegerLiteral(xla::XlaBuilder* builder, xla::PrimitiveType type, + int64_t value); + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_TF2XLA_LIB_UTIL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/literal_util.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/literal_util.h new file mode 100644 index 0000000000000000000000000000000000000000..8f55dfabbe9822c2f290510b70ce1b7b41c5d9d8 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/literal_util.h @@ -0,0 +1,78 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +// Utilities for working with XLA Literals. + +#ifndef TENSORFLOW_COMPILER_TF2XLA_LITERAL_UTIL_H_ +#define TENSORFLOW_COMPILER_TF2XLA_LITERAL_UTIL_H_ + +#include "absl/types/span.h" +#include "xla/literal.h" +#include "xla/xla_data.pb.h" +#include "tensorflow/core/framework/tensor.h" +#include "tensorflow/core/lib/core/status.h" + +namespace tensorflow { + +// Returns a BorrowingLiteral that utilizes the same underlying buffer owned by +// 'host_tensor'. +Status HostTensorToBorrowingLiteral(const Tensor& host_tensor, + xla::BorrowingLiteral* literal); +// Similar as above, except the literal shape is explicitly provided and used +// instead of obtaining it from the 'host_tensor'. The provided literal shape +// 'xla_shape' must be compatible with the shape of 'host_tensor'. +Status HostTensorToBorrowingLiteral(const xla::Shape& xla_shape, + const Tensor& host_tensor, + xla::BorrowingLiteral* literal); + +// Returns a Literal with the contents of 'host_tensor', backed by its own +// storage (i.e., not reusing 'host_tensor's buffers.) +StatusOr HostTensorToLiteral(const Tensor& host_tensor); + +// Returns a MutableBorrowingLiteral that utilizes the same underlying buffer +// owned by 'host_tensor', but is mutable via the xla::Literal methods. +Status HostTensorToMutableBorrowingLiteral( + Tensor* host_tensor, xla::MutableBorrowingLiteral* literal); +// Similar as above, except the literal shape is explicitly provided and used +// instead of obtaining it from the 'host_tensor'. The provided literal shape +// 'xla_shape' must be compatible with the shape of 'host_tensor'. +Status HostTensorToMutableBorrowingLiteral( + const xla::Shape& xla_shape, Tensor* host_tensor, + xla::MutableBorrowingLiteral* literal); + +// Returns a BorrowingLiteral tuple that utilizes the same underlying buffers +// owned by 'host_tensors'. +Status HostTensorsToBorrowingLiteralTuple(absl::Span host_tensors, + xla::BorrowingLiteral* literal); + +// Copies 'literal' to freshly allocated 'host_tensor', which is allocated of +// type . +// Fails if the literal's primitive type != +// DataTypeToPrimitiveType(target_type). Note that is not +// derivable from the type of , because multiple tensorflow types map +// to the same XLA type (e.g. INT32 and QINT32 both map to INT32 in +// XLA). +Status LiteralToHostTensor(const xla::LiteralSlice& literal, + DataType target_type, Tensor* host_tensor); + +// Copies the contents of 'literal' to a previously allocated tensor +// 'host_tensor'. The tensor and the literal must have the same number of +// elements and the same type. +Status CopyLiteralToHostTensor(const xla::LiteralSlice& literal, + Tensor* host_tensor); + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_TF2XLA_LITERAL_UTIL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/mlir_bridge_pass.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/mlir_bridge_pass.h new file mode 100644 index 0000000000000000000000000000000000000000..ff32bc5f9ad40c8bd6cb218390b77f18cd5424eb --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/mlir_bridge_pass.h @@ -0,0 +1,67 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_TF2XLA_MLIR_BRIDGE_PASS_H_ +#define TENSORFLOW_COMPILER_TF2XLA_MLIR_BRIDGE_PASS_H_ + +#include + +#include "tensorflow/compiler/mlir/tf2xla/mlir_bridge_rollout_policy.h" +#include "llvm/ADT/StringRef.h" +#include "tensorflow/compiler/jit/flags.h" +#include "tensorflow/compiler/mlir/mlir_graph_optimization_pass.h" + +namespace tensorflow { + +// This pass uses MLIR to implement all the conversion steps to target XLA from +// a TensorFlow Function Graph. It is meant to expose a very limited set of +// functionalities during the bring-up of MLIR-based bridge. +class MlirBridgePass : public MlirOptimizationPass { + public: + llvm::StringRef name() const override { return "bridge"; } + + MlirOptimizationPassState GetPassState( + const DeviceSet* device_set, const ConfigProto& config_proto, + const Graph& graph, + const FunctionLibraryDefinition& function_library) const override; + + // This should be used as a thin mapper around mlir::ModulePass::runOnModule + // API integrated with the Tensorflow runtime. + Status Run(const std::string& function_name, const ConfigProto& config_proto, + mlir::ModuleOp module, const Graph& graph, + const FunctionLibraryDefinition& function_library) override; +}; + +// This pass uses MLIR to implement all the conversion steps to target XLA from +// a TensorFlow V1 Graph. It is meant to expose a very limited set of +// functionalities during the bring-up of MLIR-based bridge. +class MlirBridgeV1CompatPass : public MlirV1CompatOptimizationPass { + public: + llvm::StringRef name() const override { return "bridge"; } + + MlirOptimizationPassState GetPassState( + const DeviceSet* device_set, const ConfigProto& config_proto, + const Graph& graph, + const FunctionLibraryDefinition& function_library) const override; + + // This should be used as a thin mapper around mlir::ModulePass::runOnModule + // API integrated with the Tensorflow runtime. + Status Run(const GraphOptimizationPassOptions& options, + mlir::ModuleOp module) override; +}; + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_TF2XLA_MLIR_BRIDGE_PASS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/mlir_xla_op_kernel.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/mlir_xla_op_kernel.h new file mode 100644 index 0000000000000000000000000000000000000000..ec62bd98a219092de0caf33072d7b5aec317f8a5 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/mlir_xla_op_kernel.h @@ -0,0 +1,38 @@ +/* Copyright 2021 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_TF2XLA_MLIR_XLA_OP_KERNEL_H_ +#define TENSORFLOW_COMPILER_TF2XLA_MLIR_XLA_OP_KERNEL_H_ + +#include "tensorflow/compiler/tf2xla/xla_op_kernel.h" + +namespace tensorflow { + +// An XlaOpKernel that's implemented by lowering using MLIR TensorFlow to HLO +// legalization. +class MlirXlaOpKernel : public XlaOpKernel { + public: + explicit MlirXlaOpKernel(OpKernelConstruction* ctx); + + private: + Status ContextToXlaArgs(XlaOpKernelContext* ctx, + std::vector& xla_args); + void Compile(XlaOpKernelContext* ctx) override; + Status ConstructXlaOp(XlaOpKernelContext* ctx); +}; + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_TF2XLA_MLIR_XLA_OP_KERNEL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/rearrange_function_argument.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/rearrange_function_argument.h new file mode 100644 index 0000000000000000000000000000000000000000..fae625308b00b3bd4ccac37c27888f2bef2e4e71 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/rearrange_function_argument.h @@ -0,0 +1,42 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_TF2XLA_REARRANGE_FUNCTION_ARGUMENT_H_ +#define TENSORFLOW_COMPILER_TF2XLA_REARRANGE_FUNCTION_ARGUMENT_H_ + +#include "tensorflow/core/framework/function.h" +#include "tensorflow/core/graph/graph.h" + +namespace tensorflow { + +// For the given graph `g`: +// 1. Rewrite If/While node functions to rearrange arguments and return values, +// so that all resource arguments/return values are placed in the end (as +// required by XlaCompiler), +// 2. Inline StatefulPartitionedCall nodes so we do not need to rearrange +// arguments and return values. +// `get_function_body_fn` is used to instantiate FunctionDef. +// `fld` is used to store rewritten functions. +// `global_fld` is used to potentially supply stack traces for functions when +// they are not found in `fld`. +Status RearrangeFunctionArguments( + std::function + get_function_body_fn, + Graph* g, FunctionLibraryDefinition* fld, + const FunctionLibraryDefinition* global_fld = nullptr); + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_TF2XLA_REARRANGE_FUNCTION_ARGUMENT_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/resource_operation_table.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/resource_operation_table.h new file mode 100644 index 0000000000000000000000000000000000000000..61c7a56ff0d4adb75e93ced3155b37102763c652 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/resource_operation_table.h @@ -0,0 +1,71 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_TF2XLA_RESOURCE_OPERATION_TABLE_H_ +#define TENSORFLOW_COMPILER_TF2XLA_RESOURCE_OPERATION_TABLE_H_ + +#include +#include + +#include "absl/strings/string_view.h" +#include "tensorflow/core/platform/logging.h" + +// Exposes information about the resource operations supported by tf2xla in a +// structured form. + +namespace tensorflow { +enum class XlaResourceOpKind { + kRead, // Only reads from resources. + kWrite, // Only writes to resources. + kReadWrite // Reads from and writes to resources. +}; + +enum class XlaResourceKind { + kVariable, // Operates on resource variables. + kStack, // Operates on stacks. + kTensorArray // Operates on tensor arrays. +}; + +class XlaResourceOpInfo { + public: + explicit XlaResourceOpInfo(XlaResourceOpKind op_kind, + XlaResourceKind resource_kind) + : op_kind_(op_kind), resource_kind_(resource_kind) {} + + XlaResourceOpKind kind() const { return op_kind_; } + XlaResourceKind resource_kind() const { return resource_kind_; } + + static absl::string_view XlaResourceOpKindToString(XlaResourceOpKind op_kind); + + private: + XlaResourceOpKind op_kind_; + XlaResourceKind resource_kind_; +}; + +// Returns a XlaResourceOpInfo describing `op` if it is a resource operation +// supported by tf2xla, otherwise returns null (i.e. if this returns null then +// `op` is either not a resource operation or is unsupported by XLA). +const XlaResourceOpInfo* GetResourceOpInfoForOp(absl::string_view op); + +namespace resource_op_table_internal { +// NB! Implementation detail exposed for unit testing, do not use. +// +// Returns the set of resource operations known by this module. +std::vector GetKnownResourceOps(); +} // namespace resource_op_table_internal + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_TF2XLA_RESOURCE_OPERATION_TABLE_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/shape_util.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/shape_util.h new file mode 100644 index 0000000000000000000000000000000000000000..4a22afc3b9c82a9d2397f4bcff592feebe13d3d1 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/shape_util.h @@ -0,0 +1,87 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +// Utilities for working with XLA shapes. + +#ifndef TENSORFLOW_COMPILER_TF2XLA_SHAPE_UTIL_H_ +#define TENSORFLOW_COMPILER_TF2XLA_SHAPE_UTIL_H_ + +#include + +#include "xla/shape.h" +#include "xla/xla_data.pb.h" +#include "tensorflow/core/framework/tensor_shape.h" +#include "tensorflow/core/framework/types.pb.h" +#include "tensorflow/core/platform/statusor.h" + +namespace tensorflow { + +// Convert an XLA Shape into the equivalent TensorFlow shape. May fail since +// not all XLA shapes can be represented as TensorShapes. +Status XLAShapeToTensorShape(const xla::Shape& shape, + TensorShape* tensor_shape); + +// Convert a TensorShape into the equivalent XLA Shape proto. Unlike Tensorflow, +// XLA shapes include the type. Not all `dtype` values can be represented by +// XLA, so this conversion may fail. +Status TensorShapeToXLAShape(DataType dtype, const TensorShape& tensor_shape, + xla::Shape* shape); + +StatusOr TensorShapeToXLAShape(DataType dtype, + const TensorShape& tensor_shape); + +// Converts a TensorShape into the equivalent XLA Shape proto, taking an +// xla::PrimitiveType to specify the element type. This never fails. +xla::Shape TensorShapeToXLAShape(xla::PrimitiveType type, + const TensorShape& tensor_shape); + +// Convert a PartialTensorShape into the equivalent XLA Shape proto. An shape +// with unknown rank is represented by an r1 with empty dimension. +Status TensorShapeToXLAShape(DataType dtype, + const PartialTensorShape& tensor_shape, + xla::Shape* shape); + +// Convert a PartialTensorShape into the equivalent XLA Shape proto. An shape +// with unknown rank is represented by an r1 with empty dimension. +xla::Shape TensorShapeToXLAShape(xla::PrimitiveType type, + const PartialTensorShape& tensor_shape); + +Status TensorShapeToBoundedXLAShape(DataType dtype, + const PartialTensorShape& tensor_shape, + const TensorShape& bound, + xla::Shape* shape); + +// Given an XLA shape with layouts, builds a layout vector in the form able to +// be fed to ops like InfeedEnqueue/InfeedEnqueueTuple/XRTAllocateV2/.... +// THe returned vector is a linearized sequence of the minor-to-major values of +// the layouts held within the input shape. +// In case the input shape is a tuple, the minor-to-major values will be in the +// order of the tuple elements within the tuple shape. +// If a shape (or a subshape of a tuple shape) has missing layout, a rank long +// sequence of -1 values will be emitted. +StatusOr> GetShapeLayoutVector(const xla::Shape& shape); + +// Given the input shape and a linearized sequence of the minor-to-major values +// of the layouts, create the output shape by rewriting the input shape layouts. +// If a layout is missing (has -1 values) for a matching tuple subshape, the +// layout_func will be called, if not nullptr. +Status GetShapeWithLayout( + const xla::Shape& input_shape, absl::Span minor_to_major, + const std::function& layout_func, + xla::Shape* output_shape); + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_TF2XLA_SHAPE_UTIL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/sharding_util.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/sharding_util.h new file mode 100644 index 0000000000000000000000000000000000000000..0f5c42129bc16c2bca442219d20ff1dac50c010f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/sharding_util.h @@ -0,0 +1,58 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ +#ifndef TENSORFLOW_COMPILER_TF2XLA_SHARDING_UTIL_H_ +#define TENSORFLOW_COMPILER_TF2XLA_SHARDING_UTIL_H_ + +#include + +#include "xla/client/sharding_builder.h" +#include "xla/status_macros.h" +#include "tensorflow/core/graph/graph.h" +#include "tensorflow/core/lib/core/status.h" + +namespace tensorflow { + +// Parses the op sharding from the 'replicated core' device_name . +// Returns an error: +// - if the device name is invalid. +// - the core is parsed and is out of the range [0, num_cores_per_replica). +// +// Otherwise, returns either: +// - explicit_sharding if explicit_sharding.has_value() +// - a non-value if there is no assigned core or +// - a sharding set as per xla::sharding_builder::AssignDevice. +StatusOr> ParseShardingFromDevice( + const string& device_name, int num_cores_per_replica, + std::optional explicit_sharding = std::nullopt, + std::optional metadata = std::nullopt); + +StatusOr> ParseShardingFromDevice( + const Node& node, int num_cores_per_replica, bool add_metadata); + +StatusOr> ParseShardingFromDevice( + const NodeDef& node_def, int num_cores_per_replica, bool add_metadata); + +StatusOr> ParseShardingFromEdgeSource( + const Edge& edge, int num_cores_per_replica, bool add_metadata); + +void SetShardingDeviceAssignmentFromNode(const Node& src, Node* dst); + +// Get sharding inforamtion from node. +StatusOr> GetShardingFromNodeDef( + const NodeDef& node_def, bool add_metadata); + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_TF2XLA_SHARDING_UTIL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/side_effect_util.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/side_effect_util.h new file mode 100644 index 0000000000000000000000000000000000000000..f91fe75c8a4cf3b966207045b1dc545071a4986b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/side_effect_util.h @@ -0,0 +1,69 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_TF2XLA_SIDE_EFFECT_UTIL_H_ +#define TENSORFLOW_COMPILER_TF2XLA_SIDE_EFFECT_UTIL_H_ + +#include + +#include "tensorflow/core/graph/graph.h" + +namespace tensorflow { + +// Side-effecting nodes will have this attribute set. Its value is the list of +// node names which this node has side-effect dependencies on. +// +// Nodes like HostCompute, SendToHost, RecvFromHost always have this attribute, +// because they always have side-effect. +// If and While nodes may or may not have this attribute, depending on whether +// their bodies have side-effecting nodes. +extern const char kXlaTokenInputNodesAttrName[]; + +// This node name is used in kXlaTokenInputNodesAttrName attr to signal that a +// node has side-effect dependency on current graph's token input. +extern const char kXlaTokenArgNodeName[]; + +// This node have XlaRecvAtHost/XlaSendFromHost in its associated functions. +extern const char kXlaHasHostTransferAttrName[]; + +// This attribute is the replica id for an outside compilation node node. +extern const char kXlaReplicaIdAttrName[]; + +// This node is a Placeholder node added for tail outside compilation. +extern const char kXlaIsPlaceholderForTailOcAttrName[]; + +// This attribute is the original node name for this node. +extern const char kXlaOriginalOutsideCompilationNodeName[]; + +// Sets device ordinal attribute for nodes with attribute +// `kXlaHasHostTransferAttrName`. +Status SetDeviceOrdinalAttributeForNode(Node* node, int device_ordinal); + +// Calculates side-effect dependencies for the graph's token output. +// Returns a set of node names representing these dependencies. +std::set CalculateTokenInputsForOutputToken(const Graph& g); + +// Returns whether a graph contains side-effecting nodes. +bool HasSideEffectingNodes(const Graph& g); + +// Parse the mapping from outside_compilation_subgraph name to core number, +// which is specified in an attr as a list of strings +// :. +Status ParseHostComputeCoreList(absl::Span list_from_attr, + std::map* host_compute_core); + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_TF2XLA_SIDE_EFFECT_UTIL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/tf2xla.pb.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/tf2xla.pb.h new file mode 100644 index 0000000000000000000000000000000000000000..0525591304f0271405a1c57584398859b4a15168 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/tf2xla.pb.h @@ -0,0 +1,2010 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: tensorflow/compiler/tf2xla/tf2xla.proto + +#ifndef GOOGLE_PROTOBUF_INCLUDED_tensorflow_2fcompiler_2ftf2xla_2ftf2xla_2eproto +#define GOOGLE_PROTOBUF_INCLUDED_tensorflow_2fcompiler_2ftf2xla_2ftf2xla_2eproto + +#include +#include + +#include +#if PROTOBUF_VERSION < 3021000 +#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 3021009 < 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 // IWYU pragma: export +#include // IWYU pragma: export +#include +#include "tensorflow/core/framework/tensor_shape.pb.h" +#include "tensorflow/core/framework/types.pb.h" +// @@protoc_insertion_point(includes) +#include +#define PROTOBUF_INTERNAL_EXPORT_tensorflow_2fcompiler_2ftf2xla_2ftf2xla_2eproto +PROTOBUF_NAMESPACE_OPEN +namespace internal { +class AnyMetadata; +} // namespace internal +PROTOBUF_NAMESPACE_CLOSE + +// Internal implementation detail -- do not use these members. +struct TableStruct_tensorflow_2fcompiler_2ftf2xla_2ftf2xla_2eproto { + static const uint32_t offsets[]; +}; +extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_tensorflow_2fcompiler_2ftf2xla_2ftf2xla_2eproto; +namespace tensorflow { +namespace tf2xla { +class Config; +struct ConfigDefaultTypeInternal; +extern ConfigDefaultTypeInternal _Config_default_instance_; +class Feed; +struct FeedDefaultTypeInternal; +extern FeedDefaultTypeInternal _Feed_default_instance_; +class Fetch; +struct FetchDefaultTypeInternal; +extern FetchDefaultTypeInternal _Fetch_default_instance_; +class TensorId; +struct TensorIdDefaultTypeInternal; +extern TensorIdDefaultTypeInternal _TensorId_default_instance_; +class Variable; +struct VariableDefaultTypeInternal; +extern VariableDefaultTypeInternal _Variable_default_instance_; +} // namespace tf2xla +} // namespace tensorflow +PROTOBUF_NAMESPACE_OPEN +template<> ::tensorflow::tf2xla::Config* Arena::CreateMaybeMessage<::tensorflow::tf2xla::Config>(Arena*); +template<> ::tensorflow::tf2xla::Feed* Arena::CreateMaybeMessage<::tensorflow::tf2xla::Feed>(Arena*); +template<> ::tensorflow::tf2xla::Fetch* Arena::CreateMaybeMessage<::tensorflow::tf2xla::Fetch>(Arena*); +template<> ::tensorflow::tf2xla::TensorId* Arena::CreateMaybeMessage<::tensorflow::tf2xla::TensorId>(Arena*); +template<> ::tensorflow::tf2xla::Variable* Arena::CreateMaybeMessage<::tensorflow::tf2xla::Variable>(Arena*); +PROTOBUF_NAMESPACE_CLOSE +namespace tensorflow { +namespace tf2xla { + +// =================================================================== + +class TensorId final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:tensorflow.tf2xla.TensorId) */ { + public: + inline TensorId() : TensorId(nullptr) {} + ~TensorId() override; + explicit PROTOBUF_CONSTEXPR TensorId(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + TensorId(const TensorId& from); + TensorId(TensorId&& from) noexcept + : TensorId() { + *this = ::std::move(from); + } + + inline TensorId& operator=(const TensorId& from) { + CopyFrom(from); + return *this; + } + inline TensorId& operator=(TensorId&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const TensorId& default_instance() { + return *internal_default_instance(); + } + static inline const TensorId* internal_default_instance() { + return reinterpret_cast( + &_TensorId_default_instance_); + } + static constexpr int kIndexInFileMessages = + 0; + + friend void swap(TensorId& a, TensorId& b) { + a.Swap(&b); + } + inline void Swap(TensorId* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(TensorId* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + TensorId* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const TensorId& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom( const TensorId& from) { + TensorId::MergeImpl(*this, from); + } + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); + public: + 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(TensorId* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "tensorflow.tf2xla.TensorId"; + } + protected: + explicit TensorId(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kNodeNameFieldNumber = 1, + kOutputIndexFieldNumber = 2, + }; + // string node_name = 1; + void clear_node_name(); + const std::string& node_name() const; + template + void set_node_name(ArgT0&& arg0, ArgT... args); + std::string* mutable_node_name(); + PROTOBUF_NODISCARD std::string* release_node_name(); + void set_allocated_node_name(std::string* node_name); + private: + const std::string& _internal_node_name() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_node_name(const std::string& value); + std::string* _internal_mutable_node_name(); + public: + + // int64 output_index = 2; + void clear_output_index(); + int64_t output_index() const; + void set_output_index(int64_t value); + private: + int64_t _internal_output_index() const; + void _internal_set_output_index(int64_t value); + public: + + // @@protoc_insertion_point(class_scope:tensorflow.tf2xla.TensorId) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr node_name_; + int64_t output_index_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_tensorflow_2fcompiler_2ftf2xla_2ftf2xla_2eproto; +}; +// ------------------------------------------------------------------- + +class Feed final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:tensorflow.tf2xla.Feed) */ { + public: + inline Feed() : Feed(nullptr) {} + ~Feed() override; + explicit PROTOBUF_CONSTEXPR Feed(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + Feed(const Feed& from); + Feed(Feed&& from) noexcept + : Feed() { + *this = ::std::move(from); + } + + inline Feed& operator=(const Feed& from) { + CopyFrom(from); + return *this; + } + inline Feed& operator=(Feed&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const Feed& default_instance() { + return *internal_default_instance(); + } + static inline const Feed* internal_default_instance() { + return reinterpret_cast( + &_Feed_default_instance_); + } + static constexpr int kIndexInFileMessages = + 1; + + friend void swap(Feed& a, Feed& b) { + a.Swap(&b); + } + inline void Swap(Feed* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(Feed* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + Feed* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const Feed& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom( const Feed& from) { + Feed::MergeImpl(*this, from); + } + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); + public: + 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(Feed* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "tensorflow.tf2xla.Feed"; + } + protected: + explicit Feed(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kNameFieldNumber = 3, + kIdFieldNumber = 1, + kShapeFieldNumber = 2, + kTypeFieldNumber = 4, + }; + // string name = 3; + void clear_name(); + const std::string& name() const; + template + void set_name(ArgT0&& arg0, ArgT... args); + std::string* mutable_name(); + PROTOBUF_NODISCARD std::string* release_name(); + void set_allocated_name(std::string* name); + private: + const std::string& _internal_name() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_name(const std::string& value); + std::string* _internal_mutable_name(); + public: + + // .tensorflow.tf2xla.TensorId id = 1; + bool has_id() const; + private: + bool _internal_has_id() const; + public: + void clear_id(); + const ::tensorflow::tf2xla::TensorId& id() const; + PROTOBUF_NODISCARD ::tensorflow::tf2xla::TensorId* release_id(); + ::tensorflow::tf2xla::TensorId* mutable_id(); + void set_allocated_id(::tensorflow::tf2xla::TensorId* id); + private: + const ::tensorflow::tf2xla::TensorId& _internal_id() const; + ::tensorflow::tf2xla::TensorId* _internal_mutable_id(); + public: + void unsafe_arena_set_allocated_id( + ::tensorflow::tf2xla::TensorId* id); + ::tensorflow::tf2xla::TensorId* unsafe_arena_release_id(); + + // .tensorflow.TensorShapeProto shape = 2; + bool has_shape() const; + private: + bool _internal_has_shape() const; + public: + void clear_shape(); + const ::tensorflow::TensorShapeProto& shape() const; + PROTOBUF_NODISCARD ::tensorflow::TensorShapeProto* release_shape(); + ::tensorflow::TensorShapeProto* mutable_shape(); + void set_allocated_shape(::tensorflow::TensorShapeProto* shape); + private: + const ::tensorflow::TensorShapeProto& _internal_shape() const; + ::tensorflow::TensorShapeProto* _internal_mutable_shape(); + public: + void unsafe_arena_set_allocated_shape( + ::tensorflow::TensorShapeProto* shape); + ::tensorflow::TensorShapeProto* unsafe_arena_release_shape(); + + // .tensorflow.DataType type = 4; + void clear_type(); + ::tensorflow::DataType type() const; + void set_type(::tensorflow::DataType value); + private: + ::tensorflow::DataType _internal_type() const; + void _internal_set_type(::tensorflow::DataType value); + public: + + // @@protoc_insertion_point(class_scope:tensorflow.tf2xla.Feed) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_; + ::tensorflow::tf2xla::TensorId* id_; + ::tensorflow::TensorShapeProto* shape_; + int type_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_tensorflow_2fcompiler_2ftf2xla_2ftf2xla_2eproto; +}; +// ------------------------------------------------------------------- + +class Fetch final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:tensorflow.tf2xla.Fetch) */ { + public: + inline Fetch() : Fetch(nullptr) {} + ~Fetch() override; + explicit PROTOBUF_CONSTEXPR Fetch(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + Fetch(const Fetch& from); + Fetch(Fetch&& from) noexcept + : Fetch() { + *this = ::std::move(from); + } + + inline Fetch& operator=(const Fetch& from) { + CopyFrom(from); + return *this; + } + inline Fetch& operator=(Fetch&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const Fetch& default_instance() { + return *internal_default_instance(); + } + static inline const Fetch* internal_default_instance() { + return reinterpret_cast( + &_Fetch_default_instance_); + } + static constexpr int kIndexInFileMessages = + 2; + + friend void swap(Fetch& a, Fetch& b) { + a.Swap(&b); + } + inline void Swap(Fetch* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(Fetch* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + Fetch* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const Fetch& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom( const Fetch& from) { + Fetch::MergeImpl(*this, from); + } + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); + public: + 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(Fetch* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "tensorflow.tf2xla.Fetch"; + } + protected: + explicit Fetch(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kNameFieldNumber = 2, + kIdFieldNumber = 1, + kShapeFieldNumber = 3, + kTypeFieldNumber = 4, + }; + // string name = 2; + void clear_name(); + const std::string& name() const; + template + void set_name(ArgT0&& arg0, ArgT... args); + std::string* mutable_name(); + PROTOBUF_NODISCARD std::string* release_name(); + void set_allocated_name(std::string* name); + private: + const std::string& _internal_name() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_name(const std::string& value); + std::string* _internal_mutable_name(); + public: + + // .tensorflow.tf2xla.TensorId id = 1; + bool has_id() const; + private: + bool _internal_has_id() const; + public: + void clear_id(); + const ::tensorflow::tf2xla::TensorId& id() const; + PROTOBUF_NODISCARD ::tensorflow::tf2xla::TensorId* release_id(); + ::tensorflow::tf2xla::TensorId* mutable_id(); + void set_allocated_id(::tensorflow::tf2xla::TensorId* id); + private: + const ::tensorflow::tf2xla::TensorId& _internal_id() const; + ::tensorflow::tf2xla::TensorId* _internal_mutable_id(); + public: + void unsafe_arena_set_allocated_id( + ::tensorflow::tf2xla::TensorId* id); + ::tensorflow::tf2xla::TensorId* unsafe_arena_release_id(); + + // .tensorflow.TensorShapeProto shape = 3; + bool has_shape() const; + private: + bool _internal_has_shape() const; + public: + void clear_shape(); + const ::tensorflow::TensorShapeProto& shape() const; + PROTOBUF_NODISCARD ::tensorflow::TensorShapeProto* release_shape(); + ::tensorflow::TensorShapeProto* mutable_shape(); + void set_allocated_shape(::tensorflow::TensorShapeProto* shape); + private: + const ::tensorflow::TensorShapeProto& _internal_shape() const; + ::tensorflow::TensorShapeProto* _internal_mutable_shape(); + public: + void unsafe_arena_set_allocated_shape( + ::tensorflow::TensorShapeProto* shape); + ::tensorflow::TensorShapeProto* unsafe_arena_release_shape(); + + // .tensorflow.DataType type = 4; + void clear_type(); + ::tensorflow::DataType type() const; + void set_type(::tensorflow::DataType value); + private: + ::tensorflow::DataType _internal_type() const; + void _internal_set_type(::tensorflow::DataType value); + public: + + // @@protoc_insertion_point(class_scope:tensorflow.tf2xla.Fetch) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_; + ::tensorflow::tf2xla::TensorId* id_; + ::tensorflow::TensorShapeProto* shape_; + int type_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_tensorflow_2fcompiler_2ftf2xla_2ftf2xla_2eproto; +}; +// ------------------------------------------------------------------- + +class Variable final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:tensorflow.tf2xla.Variable) */ { + public: + inline Variable() : Variable(nullptr) {} + ~Variable() override; + explicit PROTOBUF_CONSTEXPR Variable(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + Variable(const Variable& from); + Variable(Variable&& from) noexcept + : Variable() { + *this = ::std::move(from); + } + + inline Variable& operator=(const Variable& from) { + CopyFrom(from); + return *this; + } + inline Variable& operator=(Variable&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const Variable& default_instance() { + return *internal_default_instance(); + } + static inline const Variable* internal_default_instance() { + return reinterpret_cast( + &_Variable_default_instance_); + } + static constexpr int kIndexInFileMessages = + 3; + + friend void swap(Variable& a, Variable& b) { + a.Swap(&b); + } + inline void Swap(Variable* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(Variable* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + Variable* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const Variable& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom( const Variable& from) { + Variable::MergeImpl(*this, from); + } + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); + public: + 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(Variable* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "tensorflow.tf2xla.Variable"; + } + protected: + explicit Variable(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kNodeNameFieldNumber = 1, + kNameFieldNumber = 2, + kShapeFieldNumber = 3, + kTypeFieldNumber = 4, + kReadonlyFieldNumber = 5, + }; + // string node_name = 1; + void clear_node_name(); + const std::string& node_name() const; + template + void set_node_name(ArgT0&& arg0, ArgT... args); + std::string* mutable_node_name(); + PROTOBUF_NODISCARD std::string* release_node_name(); + void set_allocated_node_name(std::string* node_name); + private: + const std::string& _internal_node_name() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_node_name(const std::string& value); + std::string* _internal_mutable_node_name(); + public: + + // string name = 2; + void clear_name(); + const std::string& name() const; + template + void set_name(ArgT0&& arg0, ArgT... args); + std::string* mutable_name(); + PROTOBUF_NODISCARD std::string* release_name(); + void set_allocated_name(std::string* name); + private: + const std::string& _internal_name() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_name(const std::string& value); + std::string* _internal_mutable_name(); + public: + + // .tensorflow.TensorShapeProto shape = 3; + bool has_shape() const; + private: + bool _internal_has_shape() const; + public: + void clear_shape(); + const ::tensorflow::TensorShapeProto& shape() const; + PROTOBUF_NODISCARD ::tensorflow::TensorShapeProto* release_shape(); + ::tensorflow::TensorShapeProto* mutable_shape(); + void set_allocated_shape(::tensorflow::TensorShapeProto* shape); + private: + const ::tensorflow::TensorShapeProto& _internal_shape() const; + ::tensorflow::TensorShapeProto* _internal_mutable_shape(); + public: + void unsafe_arena_set_allocated_shape( + ::tensorflow::TensorShapeProto* shape); + ::tensorflow::TensorShapeProto* unsafe_arena_release_shape(); + + // .tensorflow.DataType type = 4; + void clear_type(); + ::tensorflow::DataType type() const; + void set_type(::tensorflow::DataType value); + private: + ::tensorflow::DataType _internal_type() const; + void _internal_set_type(::tensorflow::DataType value); + public: + + // bool readonly = 5; + void clear_readonly(); + bool readonly() const; + void set_readonly(bool value); + private: + bool _internal_readonly() const; + void _internal_set_readonly(bool value); + public: + + // @@protoc_insertion_point(class_scope:tensorflow.tf2xla.Variable) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr node_name_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_; + ::tensorflow::TensorShapeProto* shape_; + int type_; + bool readonly_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_tensorflow_2fcompiler_2ftf2xla_2ftf2xla_2eproto; +}; +// ------------------------------------------------------------------- + +class Config final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:tensorflow.tf2xla.Config) */ { + public: + inline Config() : Config(nullptr) {} + ~Config() override; + explicit PROTOBUF_CONSTEXPR Config(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + Config(const Config& from); + Config(Config&& from) noexcept + : Config() { + *this = ::std::move(from); + } + + inline Config& operator=(const Config& from) { + CopyFrom(from); + return *this; + } + inline Config& operator=(Config&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const Config& default_instance() { + return *internal_default_instance(); + } + static inline const Config* internal_default_instance() { + return reinterpret_cast( + &_Config_default_instance_); + } + static constexpr int kIndexInFileMessages = + 4; + + friend void swap(Config& a, Config& b) { + a.Swap(&b); + } + inline void Swap(Config* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(Config* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + Config* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const Config& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom( const Config& from) { + Config::MergeImpl(*this, from); + } + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); + public: + 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(Config* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "tensorflow.tf2xla.Config"; + } + protected: + explicit Config(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kFeedFieldNumber = 1, + kFetchFieldNumber = 2, + kVariableFieldNumber = 3, + }; + // repeated .tensorflow.tf2xla.Feed feed = 1; + int feed_size() const; + private: + int _internal_feed_size() const; + public: + void clear_feed(); + ::tensorflow::tf2xla::Feed* mutable_feed(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::tensorflow::tf2xla::Feed >* + mutable_feed(); + private: + const ::tensorflow::tf2xla::Feed& _internal_feed(int index) const; + ::tensorflow::tf2xla::Feed* _internal_add_feed(); + public: + const ::tensorflow::tf2xla::Feed& feed(int index) const; + ::tensorflow::tf2xla::Feed* add_feed(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::tensorflow::tf2xla::Feed >& + feed() const; + + // repeated .tensorflow.tf2xla.Fetch fetch = 2; + int fetch_size() const; + private: + int _internal_fetch_size() const; + public: + void clear_fetch(); + ::tensorflow::tf2xla::Fetch* mutable_fetch(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::tensorflow::tf2xla::Fetch >* + mutable_fetch(); + private: + const ::tensorflow::tf2xla::Fetch& _internal_fetch(int index) const; + ::tensorflow::tf2xla::Fetch* _internal_add_fetch(); + public: + const ::tensorflow::tf2xla::Fetch& fetch(int index) const; + ::tensorflow::tf2xla::Fetch* add_fetch(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::tensorflow::tf2xla::Fetch >& + fetch() const; + + // repeated .tensorflow.tf2xla.Variable variable = 3; + int variable_size() const; + private: + int _internal_variable_size() const; + public: + void clear_variable(); + ::tensorflow::tf2xla::Variable* mutable_variable(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::tensorflow::tf2xla::Variable >* + mutable_variable(); + private: + const ::tensorflow::tf2xla::Variable& _internal_variable(int index) const; + ::tensorflow::tf2xla::Variable* _internal_add_variable(); + public: + const ::tensorflow::tf2xla::Variable& variable(int index) const; + ::tensorflow::tf2xla::Variable* add_variable(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::tensorflow::tf2xla::Variable >& + variable() const; + + // @@protoc_insertion_point(class_scope:tensorflow.tf2xla.Config) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::tensorflow::tf2xla::Feed > feed_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::tensorflow::tf2xla::Fetch > fetch_; + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::tensorflow::tf2xla::Variable > variable_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_tensorflow_2fcompiler_2ftf2xla_2ftf2xla_2eproto; +}; +// =================================================================== + + +// =================================================================== + +#ifdef __GNUC__ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wstrict-aliasing" +#endif // __GNUC__ +// TensorId + +// string node_name = 1; +inline void TensorId::clear_node_name() { + _impl_.node_name_.ClearToEmpty(); +} +inline const std::string& TensorId::node_name() const { + // @@protoc_insertion_point(field_get:tensorflow.tf2xla.TensorId.node_name) + return _internal_node_name(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void TensorId::set_node_name(ArgT0&& arg0, ArgT... args) { + + _impl_.node_name_.Set(static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:tensorflow.tf2xla.TensorId.node_name) +} +inline std::string* TensorId::mutable_node_name() { + std::string* _s = _internal_mutable_node_name(); + // @@protoc_insertion_point(field_mutable:tensorflow.tf2xla.TensorId.node_name) + return _s; +} +inline const std::string& TensorId::_internal_node_name() const { + return _impl_.node_name_.Get(); +} +inline void TensorId::_internal_set_node_name(const std::string& value) { + + _impl_.node_name_.Set(value, GetArenaForAllocation()); +} +inline std::string* TensorId::_internal_mutable_node_name() { + + return _impl_.node_name_.Mutable(GetArenaForAllocation()); +} +inline std::string* TensorId::release_node_name() { + // @@protoc_insertion_point(field_release:tensorflow.tf2xla.TensorId.node_name) + return _impl_.node_name_.Release(); +} +inline void TensorId::set_allocated_node_name(std::string* node_name) { + if (node_name != nullptr) { + + } else { + + } + _impl_.node_name_.SetAllocated(node_name, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.node_name_.IsDefault()) { + _impl_.node_name_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:tensorflow.tf2xla.TensorId.node_name) +} + +// int64 output_index = 2; +inline void TensorId::clear_output_index() { + _impl_.output_index_ = int64_t{0}; +} +inline int64_t TensorId::_internal_output_index() const { + return _impl_.output_index_; +} +inline int64_t TensorId::output_index() const { + // @@protoc_insertion_point(field_get:tensorflow.tf2xla.TensorId.output_index) + return _internal_output_index(); +} +inline void TensorId::_internal_set_output_index(int64_t value) { + + _impl_.output_index_ = value; +} +inline void TensorId::set_output_index(int64_t value) { + _internal_set_output_index(value); + // @@protoc_insertion_point(field_set:tensorflow.tf2xla.TensorId.output_index) +} + +// ------------------------------------------------------------------- + +// Feed + +// .tensorflow.tf2xla.TensorId id = 1; +inline bool Feed::_internal_has_id() const { + return this != internal_default_instance() && _impl_.id_ != nullptr; +} +inline bool Feed::has_id() const { + return _internal_has_id(); +} +inline void Feed::clear_id() { + if (GetArenaForAllocation() == nullptr && _impl_.id_ != nullptr) { + delete _impl_.id_; + } + _impl_.id_ = nullptr; +} +inline const ::tensorflow::tf2xla::TensorId& Feed::_internal_id() const { + const ::tensorflow::tf2xla::TensorId* p = _impl_.id_; + return p != nullptr ? *p : reinterpret_cast( + ::tensorflow::tf2xla::_TensorId_default_instance_); +} +inline const ::tensorflow::tf2xla::TensorId& Feed::id() const { + // @@protoc_insertion_point(field_get:tensorflow.tf2xla.Feed.id) + return _internal_id(); +} +inline void Feed::unsafe_arena_set_allocated_id( + ::tensorflow::tf2xla::TensorId* id) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.id_); + } + _impl_.id_ = id; + if (id) { + + } else { + + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.tf2xla.Feed.id) +} +inline ::tensorflow::tf2xla::TensorId* Feed::release_id() { + + ::tensorflow::tf2xla::TensorId* temp = _impl_.id_; + _impl_.id_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::tensorflow::tf2xla::TensorId* Feed::unsafe_arena_release_id() { + // @@protoc_insertion_point(field_release:tensorflow.tf2xla.Feed.id) + + ::tensorflow::tf2xla::TensorId* temp = _impl_.id_; + _impl_.id_ = nullptr; + return temp; +} +inline ::tensorflow::tf2xla::TensorId* Feed::_internal_mutable_id() { + + if (_impl_.id_ == nullptr) { + auto* p = CreateMaybeMessage<::tensorflow::tf2xla::TensorId>(GetArenaForAllocation()); + _impl_.id_ = p; + } + return _impl_.id_; +} +inline ::tensorflow::tf2xla::TensorId* Feed::mutable_id() { + ::tensorflow::tf2xla::TensorId* _msg = _internal_mutable_id(); + // @@protoc_insertion_point(field_mutable:tensorflow.tf2xla.Feed.id) + return _msg; +} +inline void Feed::set_allocated_id(::tensorflow::tf2xla::TensorId* id) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete _impl_.id_; + } + if (id) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(id); + if (message_arena != submessage_arena) { + id = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, id, submessage_arena); + } + + } else { + + } + _impl_.id_ = id; + // @@protoc_insertion_point(field_set_allocated:tensorflow.tf2xla.Feed.id) +} + +// .tensorflow.TensorShapeProto shape = 2; +inline bool Feed::_internal_has_shape() const { + return this != internal_default_instance() && _impl_.shape_ != nullptr; +} +inline bool Feed::has_shape() const { + return _internal_has_shape(); +} +inline const ::tensorflow::TensorShapeProto& Feed::_internal_shape() const { + const ::tensorflow::TensorShapeProto* p = _impl_.shape_; + return p != nullptr ? *p : reinterpret_cast( + ::tensorflow::_TensorShapeProto_default_instance_); +} +inline const ::tensorflow::TensorShapeProto& Feed::shape() const { + // @@protoc_insertion_point(field_get:tensorflow.tf2xla.Feed.shape) + return _internal_shape(); +} +inline void Feed::unsafe_arena_set_allocated_shape( + ::tensorflow::TensorShapeProto* shape) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.shape_); + } + _impl_.shape_ = shape; + if (shape) { + + } else { + + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.tf2xla.Feed.shape) +} +inline ::tensorflow::TensorShapeProto* Feed::release_shape() { + + ::tensorflow::TensorShapeProto* temp = _impl_.shape_; + _impl_.shape_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::tensorflow::TensorShapeProto* Feed::unsafe_arena_release_shape() { + // @@protoc_insertion_point(field_release:tensorflow.tf2xla.Feed.shape) + + ::tensorflow::TensorShapeProto* temp = _impl_.shape_; + _impl_.shape_ = nullptr; + return temp; +} +inline ::tensorflow::TensorShapeProto* Feed::_internal_mutable_shape() { + + if (_impl_.shape_ == nullptr) { + auto* p = CreateMaybeMessage<::tensorflow::TensorShapeProto>(GetArenaForAllocation()); + _impl_.shape_ = p; + } + return _impl_.shape_; +} +inline ::tensorflow::TensorShapeProto* Feed::mutable_shape() { + ::tensorflow::TensorShapeProto* _msg = _internal_mutable_shape(); + // @@protoc_insertion_point(field_mutable:tensorflow.tf2xla.Feed.shape) + return _msg; +} +inline void Feed::set_allocated_shape(::tensorflow::TensorShapeProto* shape) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete reinterpret_cast< ::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.shape_); + } + if (shape) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena( + reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(shape)); + if (message_arena != submessage_arena) { + shape = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, shape, submessage_arena); + } + + } else { + + } + _impl_.shape_ = shape; + // @@protoc_insertion_point(field_set_allocated:tensorflow.tf2xla.Feed.shape) +} + +// string name = 3; +inline void Feed::clear_name() { + _impl_.name_.ClearToEmpty(); +} +inline const std::string& Feed::name() const { + // @@protoc_insertion_point(field_get:tensorflow.tf2xla.Feed.name) + return _internal_name(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void Feed::set_name(ArgT0&& arg0, ArgT... args) { + + _impl_.name_.Set(static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:tensorflow.tf2xla.Feed.name) +} +inline std::string* Feed::mutable_name() { + std::string* _s = _internal_mutable_name(); + // @@protoc_insertion_point(field_mutable:tensorflow.tf2xla.Feed.name) + return _s; +} +inline const std::string& Feed::_internal_name() const { + return _impl_.name_.Get(); +} +inline void Feed::_internal_set_name(const std::string& value) { + + _impl_.name_.Set(value, GetArenaForAllocation()); +} +inline std::string* Feed::_internal_mutable_name() { + + return _impl_.name_.Mutable(GetArenaForAllocation()); +} +inline std::string* Feed::release_name() { + // @@protoc_insertion_point(field_release:tensorflow.tf2xla.Feed.name) + return _impl_.name_.Release(); +} +inline void Feed::set_allocated_name(std::string* name) { + if (name != nullptr) { + + } else { + + } + _impl_.name_.SetAllocated(name, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.name_.IsDefault()) { + _impl_.name_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:tensorflow.tf2xla.Feed.name) +} + +// .tensorflow.DataType type = 4; +inline void Feed::clear_type() { + _impl_.type_ = 0; +} +inline ::tensorflow::DataType Feed::_internal_type() const { + return static_cast< ::tensorflow::DataType >(_impl_.type_); +} +inline ::tensorflow::DataType Feed::type() const { + // @@protoc_insertion_point(field_get:tensorflow.tf2xla.Feed.type) + return _internal_type(); +} +inline void Feed::_internal_set_type(::tensorflow::DataType value) { + + _impl_.type_ = value; +} +inline void Feed::set_type(::tensorflow::DataType value) { + _internal_set_type(value); + // @@protoc_insertion_point(field_set:tensorflow.tf2xla.Feed.type) +} + +// ------------------------------------------------------------------- + +// Fetch + +// .tensorflow.tf2xla.TensorId id = 1; +inline bool Fetch::_internal_has_id() const { + return this != internal_default_instance() && _impl_.id_ != nullptr; +} +inline bool Fetch::has_id() const { + return _internal_has_id(); +} +inline void Fetch::clear_id() { + if (GetArenaForAllocation() == nullptr && _impl_.id_ != nullptr) { + delete _impl_.id_; + } + _impl_.id_ = nullptr; +} +inline const ::tensorflow::tf2xla::TensorId& Fetch::_internal_id() const { + const ::tensorflow::tf2xla::TensorId* p = _impl_.id_; + return p != nullptr ? *p : reinterpret_cast( + ::tensorflow::tf2xla::_TensorId_default_instance_); +} +inline const ::tensorflow::tf2xla::TensorId& Fetch::id() const { + // @@protoc_insertion_point(field_get:tensorflow.tf2xla.Fetch.id) + return _internal_id(); +} +inline void Fetch::unsafe_arena_set_allocated_id( + ::tensorflow::tf2xla::TensorId* id) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.id_); + } + _impl_.id_ = id; + if (id) { + + } else { + + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.tf2xla.Fetch.id) +} +inline ::tensorflow::tf2xla::TensorId* Fetch::release_id() { + + ::tensorflow::tf2xla::TensorId* temp = _impl_.id_; + _impl_.id_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::tensorflow::tf2xla::TensorId* Fetch::unsafe_arena_release_id() { + // @@protoc_insertion_point(field_release:tensorflow.tf2xla.Fetch.id) + + ::tensorflow::tf2xla::TensorId* temp = _impl_.id_; + _impl_.id_ = nullptr; + return temp; +} +inline ::tensorflow::tf2xla::TensorId* Fetch::_internal_mutable_id() { + + if (_impl_.id_ == nullptr) { + auto* p = CreateMaybeMessage<::tensorflow::tf2xla::TensorId>(GetArenaForAllocation()); + _impl_.id_ = p; + } + return _impl_.id_; +} +inline ::tensorflow::tf2xla::TensorId* Fetch::mutable_id() { + ::tensorflow::tf2xla::TensorId* _msg = _internal_mutable_id(); + // @@protoc_insertion_point(field_mutable:tensorflow.tf2xla.Fetch.id) + return _msg; +} +inline void Fetch::set_allocated_id(::tensorflow::tf2xla::TensorId* id) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete _impl_.id_; + } + if (id) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(id); + if (message_arena != submessage_arena) { + id = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, id, submessage_arena); + } + + } else { + + } + _impl_.id_ = id; + // @@protoc_insertion_point(field_set_allocated:tensorflow.tf2xla.Fetch.id) +} + +// string name = 2; +inline void Fetch::clear_name() { + _impl_.name_.ClearToEmpty(); +} +inline const std::string& Fetch::name() const { + // @@protoc_insertion_point(field_get:tensorflow.tf2xla.Fetch.name) + return _internal_name(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void Fetch::set_name(ArgT0&& arg0, ArgT... args) { + + _impl_.name_.Set(static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:tensorflow.tf2xla.Fetch.name) +} +inline std::string* Fetch::mutable_name() { + std::string* _s = _internal_mutable_name(); + // @@protoc_insertion_point(field_mutable:tensorflow.tf2xla.Fetch.name) + return _s; +} +inline const std::string& Fetch::_internal_name() const { + return _impl_.name_.Get(); +} +inline void Fetch::_internal_set_name(const std::string& value) { + + _impl_.name_.Set(value, GetArenaForAllocation()); +} +inline std::string* Fetch::_internal_mutable_name() { + + return _impl_.name_.Mutable(GetArenaForAllocation()); +} +inline std::string* Fetch::release_name() { + // @@protoc_insertion_point(field_release:tensorflow.tf2xla.Fetch.name) + return _impl_.name_.Release(); +} +inline void Fetch::set_allocated_name(std::string* name) { + if (name != nullptr) { + + } else { + + } + _impl_.name_.SetAllocated(name, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.name_.IsDefault()) { + _impl_.name_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:tensorflow.tf2xla.Fetch.name) +} + +// .tensorflow.TensorShapeProto shape = 3; +inline bool Fetch::_internal_has_shape() const { + return this != internal_default_instance() && _impl_.shape_ != nullptr; +} +inline bool Fetch::has_shape() const { + return _internal_has_shape(); +} +inline const ::tensorflow::TensorShapeProto& Fetch::_internal_shape() const { + const ::tensorflow::TensorShapeProto* p = _impl_.shape_; + return p != nullptr ? *p : reinterpret_cast( + ::tensorflow::_TensorShapeProto_default_instance_); +} +inline const ::tensorflow::TensorShapeProto& Fetch::shape() const { + // @@protoc_insertion_point(field_get:tensorflow.tf2xla.Fetch.shape) + return _internal_shape(); +} +inline void Fetch::unsafe_arena_set_allocated_shape( + ::tensorflow::TensorShapeProto* shape) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.shape_); + } + _impl_.shape_ = shape; + if (shape) { + + } else { + + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.tf2xla.Fetch.shape) +} +inline ::tensorflow::TensorShapeProto* Fetch::release_shape() { + + ::tensorflow::TensorShapeProto* temp = _impl_.shape_; + _impl_.shape_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::tensorflow::TensorShapeProto* Fetch::unsafe_arena_release_shape() { + // @@protoc_insertion_point(field_release:tensorflow.tf2xla.Fetch.shape) + + ::tensorflow::TensorShapeProto* temp = _impl_.shape_; + _impl_.shape_ = nullptr; + return temp; +} +inline ::tensorflow::TensorShapeProto* Fetch::_internal_mutable_shape() { + + if (_impl_.shape_ == nullptr) { + auto* p = CreateMaybeMessage<::tensorflow::TensorShapeProto>(GetArenaForAllocation()); + _impl_.shape_ = p; + } + return _impl_.shape_; +} +inline ::tensorflow::TensorShapeProto* Fetch::mutable_shape() { + ::tensorflow::TensorShapeProto* _msg = _internal_mutable_shape(); + // @@protoc_insertion_point(field_mutable:tensorflow.tf2xla.Fetch.shape) + return _msg; +} +inline void Fetch::set_allocated_shape(::tensorflow::TensorShapeProto* shape) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete reinterpret_cast< ::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.shape_); + } + if (shape) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena( + reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(shape)); + if (message_arena != submessage_arena) { + shape = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, shape, submessage_arena); + } + + } else { + + } + _impl_.shape_ = shape; + // @@protoc_insertion_point(field_set_allocated:tensorflow.tf2xla.Fetch.shape) +} + +// .tensorflow.DataType type = 4; +inline void Fetch::clear_type() { + _impl_.type_ = 0; +} +inline ::tensorflow::DataType Fetch::_internal_type() const { + return static_cast< ::tensorflow::DataType >(_impl_.type_); +} +inline ::tensorflow::DataType Fetch::type() const { + // @@protoc_insertion_point(field_get:tensorflow.tf2xla.Fetch.type) + return _internal_type(); +} +inline void Fetch::_internal_set_type(::tensorflow::DataType value) { + + _impl_.type_ = value; +} +inline void Fetch::set_type(::tensorflow::DataType value) { + _internal_set_type(value); + // @@protoc_insertion_point(field_set:tensorflow.tf2xla.Fetch.type) +} + +// ------------------------------------------------------------------- + +// Variable + +// string node_name = 1; +inline void Variable::clear_node_name() { + _impl_.node_name_.ClearToEmpty(); +} +inline const std::string& Variable::node_name() const { + // @@protoc_insertion_point(field_get:tensorflow.tf2xla.Variable.node_name) + return _internal_node_name(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void Variable::set_node_name(ArgT0&& arg0, ArgT... args) { + + _impl_.node_name_.Set(static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:tensorflow.tf2xla.Variable.node_name) +} +inline std::string* Variable::mutable_node_name() { + std::string* _s = _internal_mutable_node_name(); + // @@protoc_insertion_point(field_mutable:tensorflow.tf2xla.Variable.node_name) + return _s; +} +inline const std::string& Variable::_internal_node_name() const { + return _impl_.node_name_.Get(); +} +inline void Variable::_internal_set_node_name(const std::string& value) { + + _impl_.node_name_.Set(value, GetArenaForAllocation()); +} +inline std::string* Variable::_internal_mutable_node_name() { + + return _impl_.node_name_.Mutable(GetArenaForAllocation()); +} +inline std::string* Variable::release_node_name() { + // @@protoc_insertion_point(field_release:tensorflow.tf2xla.Variable.node_name) + return _impl_.node_name_.Release(); +} +inline void Variable::set_allocated_node_name(std::string* node_name) { + if (node_name != nullptr) { + + } else { + + } + _impl_.node_name_.SetAllocated(node_name, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.node_name_.IsDefault()) { + _impl_.node_name_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:tensorflow.tf2xla.Variable.node_name) +} + +// string name = 2; +inline void Variable::clear_name() { + _impl_.name_.ClearToEmpty(); +} +inline const std::string& Variable::name() const { + // @@protoc_insertion_point(field_get:tensorflow.tf2xla.Variable.name) + return _internal_name(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void Variable::set_name(ArgT0&& arg0, ArgT... args) { + + _impl_.name_.Set(static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:tensorflow.tf2xla.Variable.name) +} +inline std::string* Variable::mutable_name() { + std::string* _s = _internal_mutable_name(); + // @@protoc_insertion_point(field_mutable:tensorflow.tf2xla.Variable.name) + return _s; +} +inline const std::string& Variable::_internal_name() const { + return _impl_.name_.Get(); +} +inline void Variable::_internal_set_name(const std::string& value) { + + _impl_.name_.Set(value, GetArenaForAllocation()); +} +inline std::string* Variable::_internal_mutable_name() { + + return _impl_.name_.Mutable(GetArenaForAllocation()); +} +inline std::string* Variable::release_name() { + // @@protoc_insertion_point(field_release:tensorflow.tf2xla.Variable.name) + return _impl_.name_.Release(); +} +inline void Variable::set_allocated_name(std::string* name) { + if (name != nullptr) { + + } else { + + } + _impl_.name_.SetAllocated(name, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.name_.IsDefault()) { + _impl_.name_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:tensorflow.tf2xla.Variable.name) +} + +// .tensorflow.TensorShapeProto shape = 3; +inline bool Variable::_internal_has_shape() const { + return this != internal_default_instance() && _impl_.shape_ != nullptr; +} +inline bool Variable::has_shape() const { + return _internal_has_shape(); +} +inline const ::tensorflow::TensorShapeProto& Variable::_internal_shape() const { + const ::tensorflow::TensorShapeProto* p = _impl_.shape_; + return p != nullptr ? *p : reinterpret_cast( + ::tensorflow::_TensorShapeProto_default_instance_); +} +inline const ::tensorflow::TensorShapeProto& Variable::shape() const { + // @@protoc_insertion_point(field_get:tensorflow.tf2xla.Variable.shape) + return _internal_shape(); +} +inline void Variable::unsafe_arena_set_allocated_shape( + ::tensorflow::TensorShapeProto* shape) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.shape_); + } + _impl_.shape_ = shape; + if (shape) { + + } else { + + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:tensorflow.tf2xla.Variable.shape) +} +inline ::tensorflow::TensorShapeProto* Variable::release_shape() { + + ::tensorflow::TensorShapeProto* temp = _impl_.shape_; + _impl_.shape_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::tensorflow::TensorShapeProto* Variable::unsafe_arena_release_shape() { + // @@protoc_insertion_point(field_release:tensorflow.tf2xla.Variable.shape) + + ::tensorflow::TensorShapeProto* temp = _impl_.shape_; + _impl_.shape_ = nullptr; + return temp; +} +inline ::tensorflow::TensorShapeProto* Variable::_internal_mutable_shape() { + + if (_impl_.shape_ == nullptr) { + auto* p = CreateMaybeMessage<::tensorflow::TensorShapeProto>(GetArenaForAllocation()); + _impl_.shape_ = p; + } + return _impl_.shape_; +} +inline ::tensorflow::TensorShapeProto* Variable::mutable_shape() { + ::tensorflow::TensorShapeProto* _msg = _internal_mutable_shape(); + // @@protoc_insertion_point(field_mutable:tensorflow.tf2xla.Variable.shape) + return _msg; +} +inline void Variable::set_allocated_shape(::tensorflow::TensorShapeProto* shape) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete reinterpret_cast< ::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.shape_); + } + if (shape) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena( + reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(shape)); + if (message_arena != submessage_arena) { + shape = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, shape, submessage_arena); + } + + } else { + + } + _impl_.shape_ = shape; + // @@protoc_insertion_point(field_set_allocated:tensorflow.tf2xla.Variable.shape) +} + +// .tensorflow.DataType type = 4; +inline void Variable::clear_type() { + _impl_.type_ = 0; +} +inline ::tensorflow::DataType Variable::_internal_type() const { + return static_cast< ::tensorflow::DataType >(_impl_.type_); +} +inline ::tensorflow::DataType Variable::type() const { + // @@protoc_insertion_point(field_get:tensorflow.tf2xla.Variable.type) + return _internal_type(); +} +inline void Variable::_internal_set_type(::tensorflow::DataType value) { + + _impl_.type_ = value; +} +inline void Variable::set_type(::tensorflow::DataType value) { + _internal_set_type(value); + // @@protoc_insertion_point(field_set:tensorflow.tf2xla.Variable.type) +} + +// bool readonly = 5; +inline void Variable::clear_readonly() { + _impl_.readonly_ = false; +} +inline bool Variable::_internal_readonly() const { + return _impl_.readonly_; +} +inline bool Variable::readonly() const { + // @@protoc_insertion_point(field_get:tensorflow.tf2xla.Variable.readonly) + return _internal_readonly(); +} +inline void Variable::_internal_set_readonly(bool value) { + + _impl_.readonly_ = value; +} +inline void Variable::set_readonly(bool value) { + _internal_set_readonly(value); + // @@protoc_insertion_point(field_set:tensorflow.tf2xla.Variable.readonly) +} + +// ------------------------------------------------------------------- + +// Config + +// repeated .tensorflow.tf2xla.Feed feed = 1; +inline int Config::_internal_feed_size() const { + return _impl_.feed_.size(); +} +inline int Config::feed_size() const { + return _internal_feed_size(); +} +inline void Config::clear_feed() { + _impl_.feed_.Clear(); +} +inline ::tensorflow::tf2xla::Feed* Config::mutable_feed(int index) { + // @@protoc_insertion_point(field_mutable:tensorflow.tf2xla.Config.feed) + return _impl_.feed_.Mutable(index); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::tensorflow::tf2xla::Feed >* +Config::mutable_feed() { + // @@protoc_insertion_point(field_mutable_list:tensorflow.tf2xla.Config.feed) + return &_impl_.feed_; +} +inline const ::tensorflow::tf2xla::Feed& Config::_internal_feed(int index) const { + return _impl_.feed_.Get(index); +} +inline const ::tensorflow::tf2xla::Feed& Config::feed(int index) const { + // @@protoc_insertion_point(field_get:tensorflow.tf2xla.Config.feed) + return _internal_feed(index); +} +inline ::tensorflow::tf2xla::Feed* Config::_internal_add_feed() { + return _impl_.feed_.Add(); +} +inline ::tensorflow::tf2xla::Feed* Config::add_feed() { + ::tensorflow::tf2xla::Feed* _add = _internal_add_feed(); + // @@protoc_insertion_point(field_add:tensorflow.tf2xla.Config.feed) + return _add; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::tensorflow::tf2xla::Feed >& +Config::feed() const { + // @@protoc_insertion_point(field_list:tensorflow.tf2xla.Config.feed) + return _impl_.feed_; +} + +// repeated .tensorflow.tf2xla.Fetch fetch = 2; +inline int Config::_internal_fetch_size() const { + return _impl_.fetch_.size(); +} +inline int Config::fetch_size() const { + return _internal_fetch_size(); +} +inline void Config::clear_fetch() { + _impl_.fetch_.Clear(); +} +inline ::tensorflow::tf2xla::Fetch* Config::mutable_fetch(int index) { + // @@protoc_insertion_point(field_mutable:tensorflow.tf2xla.Config.fetch) + return _impl_.fetch_.Mutable(index); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::tensorflow::tf2xla::Fetch >* +Config::mutable_fetch() { + // @@protoc_insertion_point(field_mutable_list:tensorflow.tf2xla.Config.fetch) + return &_impl_.fetch_; +} +inline const ::tensorflow::tf2xla::Fetch& Config::_internal_fetch(int index) const { + return _impl_.fetch_.Get(index); +} +inline const ::tensorflow::tf2xla::Fetch& Config::fetch(int index) const { + // @@protoc_insertion_point(field_get:tensorflow.tf2xla.Config.fetch) + return _internal_fetch(index); +} +inline ::tensorflow::tf2xla::Fetch* Config::_internal_add_fetch() { + return _impl_.fetch_.Add(); +} +inline ::tensorflow::tf2xla::Fetch* Config::add_fetch() { + ::tensorflow::tf2xla::Fetch* _add = _internal_add_fetch(); + // @@protoc_insertion_point(field_add:tensorflow.tf2xla.Config.fetch) + return _add; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::tensorflow::tf2xla::Fetch >& +Config::fetch() const { + // @@protoc_insertion_point(field_list:tensorflow.tf2xla.Config.fetch) + return _impl_.fetch_; +} + +// repeated .tensorflow.tf2xla.Variable variable = 3; +inline int Config::_internal_variable_size() const { + return _impl_.variable_.size(); +} +inline int Config::variable_size() const { + return _internal_variable_size(); +} +inline void Config::clear_variable() { + _impl_.variable_.Clear(); +} +inline ::tensorflow::tf2xla::Variable* Config::mutable_variable(int index) { + // @@protoc_insertion_point(field_mutable:tensorflow.tf2xla.Config.variable) + return _impl_.variable_.Mutable(index); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::tensorflow::tf2xla::Variable >* +Config::mutable_variable() { + // @@protoc_insertion_point(field_mutable_list:tensorflow.tf2xla.Config.variable) + return &_impl_.variable_; +} +inline const ::tensorflow::tf2xla::Variable& Config::_internal_variable(int index) const { + return _impl_.variable_.Get(index); +} +inline const ::tensorflow::tf2xla::Variable& Config::variable(int index) const { + // @@protoc_insertion_point(field_get:tensorflow.tf2xla.Config.variable) + return _internal_variable(index); +} +inline ::tensorflow::tf2xla::Variable* Config::_internal_add_variable() { + return _impl_.variable_.Add(); +} +inline ::tensorflow::tf2xla::Variable* Config::add_variable() { + ::tensorflow::tf2xla::Variable* _add = _internal_add_variable(); + // @@protoc_insertion_point(field_add:tensorflow.tf2xla.Config.variable) + return _add; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::tensorflow::tf2xla::Variable >& +Config::variable() const { + // @@protoc_insertion_point(field_list:tensorflow.tf2xla.Config.variable) + return _impl_.variable_; +} + +#ifdef __GNUC__ + #pragma GCC diagnostic pop +#endif // __GNUC__ +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + + +// @@protoc_insertion_point(namespace_scope) + +} // namespace tf2xla +} // namespace tensorflow + +// @@protoc_insertion_point(global_scope) + +#include +#endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_tensorflow_2fcompiler_2ftf2xla_2ftf2xla_2eproto diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/tf2xla_defs.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/tf2xla_defs.h new file mode 100644 index 0000000000000000000000000000000000000000..2f81d2dd4543aa04abbb98cfe9bef860d4d5e377 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/tf2xla_defs.h @@ -0,0 +1,65 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_TF2XLA_TF2XLA_DEFS_H_ +#define TENSORFLOW_COMPILER_TF2XLA_TF2XLA_DEFS_H_ + +#include + +#include "absl/strings/string_view.h" + +namespace tensorflow { + +// Marks a node for XLA compilation. The attribute value indicates the +// compilation device type. +inline constexpr absl::string_view kCompileDeviceTypeAttr = + "_xla_compile_device_type"; +// Marks a node for XLA compilation. +inline constexpr absl::string_view kMustCompileAttr = "_XlaMustCompile"; +// Marks a node for replication. The attribute value indicates the replication +// metadata op. +inline constexpr absl::string_view kReplicationInfoAttr = "_replication_info"; +// Marks a node for XLA-TPU compilation. The attribute value indicates the +// associated compilation cluster and replication metadata op. +inline constexpr absl::string_view kTpuReplicateAttr = "_tpu_replicate"; +// Marks a node inside of an XLA compilation cluster to be placed outside of the +// cluster. +inline constexpr absl::string_view kXlaOutsideCompilationAttr = + "_xla_outside_compilation"; +// Frontend attributes ID. +inline constexpr absl::string_view kXlaFrontendAttributesAttrName = + "_XlaFrontendAttributes"; +// Device types. +inline constexpr absl::string_view kDeviceAttr = "device"; +inline constexpr absl::string_view kCpuDevice = "CPU"; +inline constexpr absl::string_view kGpuDevice = "GPU"; +inline constexpr absl::string_view kTpuDevice = "TPU"; +inline constexpr absl::string_view kEmptyDevice = ""; +// Device type may be empty in ops such as TF.PartitionedCall. +inline constexpr std::array kValidDeviceTypes = { + kCpuDevice, kGpuDevice, kTpuDevice, kEmptyDevice}; +// Attributes that need to be propagated during rewrites (e.g., in +// functionalization). +inline constexpr std::array kAttrsToPropagate = { + kCompileDeviceTypeAttr, + kReplicationInfoAttr, + kXlaFrontendAttributesAttrName, + kXlaOutsideCompilationAttr, + kTpuReplicateAttr, +}; + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_TF2XLA_TF2XLA_DEFS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/tf2xla_util.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/tf2xla_util.h new file mode 100644 index 0000000000000000000000000000000000000000..694d33f969ddfc952525cbd7dbf977d07bb199ad --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/tf2xla_util.h @@ -0,0 +1,225 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_TF2XLA_TF2XLA_UTIL_H_ +#define TENSORFLOW_COMPILER_TF2XLA_TF2XLA_UTIL_H_ + +#include + +#include "absl/types/optional.h" +#include "tensorflow/compiler/tf2xla/tf2xla.pb.h" +#include "tensorflow/compiler/tf2xla/tf2xla_defs.h" +#include "xla/status_macros.h" +#include "tensorflow/core/framework/function.h" +#include "tensorflow/core/framework/graph.pb.h" +#include "tensorflow/core/framework/kernel_def.pb.h" +#include "tensorflow/core/framework/op.h" +#include "tensorflow/core/graph/graph.h" +#include "tensorflow/core/lib/core/status.h" + +namespace tensorflow { + +// ValidateConfig returns OK iff config is valid. +Status ValidateConfig(const tf2xla::Config& config); + +// Modifies to include placeholders for each fed tensor, and +// update references to the fed tensors to refer to the placeholders. +// The existing nodes referenced by the feeds are not removed or modified +// (except where their input edges are modified by the replacement of other +// feeds). +Status AddPlaceholdersForFeeds( + const tf2xla::Config& config, const OpRegistryInterface* op_registry, + std::unordered_map* feed_remapping, GraphDef* graph_def); + +// Returns in a copy of , pruned to only include fetches from +// . +Status PruneGraphDefInto(const tf2xla::Config& config, const GraphDef& in, + GraphDef* out); + +// Returns node:port for the given . +string TensorIdToString(const tf2xla::TensorId& id); + +// Updates the sharding of based on the sharding of its neighbors. +// If is true, outgoing edges from are considered; else incoming +// edges are considered. +Status SetNodeShardingFromNeighbors(Node* n, bool out_edges); + +// Add an allowed data type to the AttrConstraint with the given name. +void AddDtypeToKernelDefConstraint(absl::string_view name, DataType dtype, + KernelDef* kdef); + +// Returns the next random seed to use for seeding xla rng. +uint32 GetXLARandomSeed(); + +// Indicates how a FunctionDef is associated with a graph node (e.g. the node is +// a function call, or the node has function attrs). +class AssociatedFunctionInfo { + public: + enum AssociatedFunctionType { + kFunctionAttr = 0, + kFunctionCallNode = 1, + kSymbolicGradient = 2, + }; + + // The function is an attr of the node. + static AssociatedFunctionInfo FunctionAttr(const string& func_name, + const AttrValueMap& attrs, + const string& attr_name) { + return AssociatedFunctionInfo(kFunctionAttr, func_name, attrs, attr_name); + } + + // The node is a function call. + static AssociatedFunctionInfo FunctionCall(const string& func_name, + const AttrValueMap& attrs) { + // attr_name will not be used in this case. + return AssociatedFunctionInfo(kFunctionCallNode, func_name, attrs, + /*attr_name=*/""); + } + + // The node is a SymbolicGradient op. + static AssociatedFunctionInfo SymbolicGradient(const string& func_name, + const AttrValueMap& attrs) { + // attr_name will not be used in this case. + return AssociatedFunctionInfo(kSymbolicGradient, func_name, attrs, + /*attr_name=*/""); + } + + AssociatedFunctionType type() const { return type_; } + + const string& func_name() const { return func_name_; } + + const string& attr_name() const { return attr_name_; } + + const AttrValueMap& attrs() const { return attrs_; } + + private: + AssociatedFunctionInfo(AssociatedFunctionType type, const string& func_name, + const AttrValueMap& attrs, const string& attr_name) + : type_(type), + func_name_(func_name), + attrs_(attrs), + attr_name_(attr_name) {} + + // Available for all instances. + AssociatedFunctionType type_; + string func_name_; + AttrValueMap attrs_; + + // Only available if the function is defined in an attr. + string attr_name_; +}; + +// Returns if the NodeDef has associated function. +bool HasAssociatedFunction(const NodeDef& node_def, + const FunctionLibraryDefinition* fld); + +// Gets functions associated with the node. Current cases: +// 1. For function call node, its function name; +// 2. For SymbolicGradient op, returned func_name will be "SymbolicGradient", +// and returned attrs will be this node's attributes; +// 3. For nodes like XlaWhile/XlaIf, all their function attributes. +std::vector GetAssociatedFunctions( + const Node& node, const FunctionLibraryDefinition* fld); + +// Changes associated functions for the node. Current cases: +// 1. For function call node, creates a new node with the new function name and +// remove the old node; +// 2. For SymbolicGradient op, add or replace GradientDef in +// FunctionLibraryDefinition; +// 3. For nodes like XlaWhile/XlaIf, modify their function attributes. +Status RewriteAssociatedFunction( + Graph* graph, Node* node, FunctionLibraryDefinition* fld, + const AssociatedFunctionInfo& associated_function, + const string& rewritten_function_name); + +// Class to act as cache for FunctionLibraryRuntime::Handle objects. +class CachedFunctionHandles { + public: + CachedFunctionHandles(FunctionLibraryRuntime* flr) : flr_(flr) {} + + // Populates `handle` for requested function and attributes. If we have + // instantiated the function with the same attributes before, `handle` will be + // cached handle; otherwise instantiate the function and populate `handle`. + Status GetOrInstantiate(const string& func_name, AttrSlice attrs, + FunctionLibraryRuntime::Handle* handle); + + // Releases all handles in the cache. Returns first non-OK status if any; + // returns OK otherwise. + Status ReleaseAllHandles(); + + ~CachedFunctionHandles() { ReleaseAllHandles().IgnoreError(); } + + private: + FunctionLibraryRuntime* flr_; + std::map handles_; + + CachedFunctionHandles(const CachedFunctionHandles&) = delete; + void operator=(const CachedFunctionHandles&) = delete; +}; + +// Struct for node's output edge info. +struct OutEdgeInfo { + Node* dst; + int src_output, dst_input; +}; + +// Replaces node `n` with a new node whose NodeDef is `node_def`. +StatusOr ReplaceNode(Graph* g, Node* n, const NodeDef& node_def); + +// Helper function that builds an Identity node. +StatusOr BuildIdentityNode(Graph* graph, const string& node_name, + DataType dtype, const Node* input, + std::optional requested_device); + +// For "If"/"While" nodes, if some of their inputs are Const nodes, rewrite +// body functions to use the Const nodes instead of original _Arg nodes. +// +// For example, say we have the following computation: +// shape = constant_op.constant([1]) +// return tf.cond(pred, lambda: tf.ones(shape), lambda: tf.zeros(shape)) +// If we do not rewrite then/else function, they will use _Arg node as shape +// input for tf.ones/tf.zeros. But XLA requires that shape input to be compile +// time constant, so XLA compilation will fail. This rewriting process will +// change the shape input to Const node. +Status PropagateConstIntoFunctionalNodes( + Graph* g, const FunctionLibraryDefinition* lookup_fld, + FunctionLibraryDefinition* fld); + +// Prunes unreachable FunctionDefs from FunctionLibraryDefinition. +Status PruneUnreachableFunctionsFromGraph(const Graph& g, + FunctionLibraryDefinition* fld); + +// Finds the following pattern in the graph: +// 1) EmptyTensorList -> forward While op -> backward While op, +// 2) in forward While op, a Const node is pushed, +// 3) in backward While op, data is popped from the tensor list. +// And rewrites backward While op to use Const node instead of TensorListPopBack +// result. +// TODO(b/128633174) remove the TensorList and related TensorList ops. +Status RewriteTensorListWithConstElement(Graph* g, + FunctionLibraryDefinition* fld); + +inline bool IsConstTraversableOpType(const Node* node) { + return node->type_string() == "Identity" || + node->type_string() == "IdentityN" || node->IsWhileNode(); +} + +// Determines whether a loop body is invariant for the given argument index. +StatusOr IsLoopInvariant(const FunctionBody* loop_body, int index, + const FunctionLibraryDefinition* lookup_fld); + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_TF2XLA_TF2XLA_UTIL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/type_util.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/type_util.h new file mode 100644 index 0000000000000000000000000000000000000000..e7a6e9b4d86a53f535fac161f0574ed83a403c0f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/type_util.h @@ -0,0 +1,41 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_TF2XLA_TYPE_UTIL_H_ +#define TENSORFLOW_COMPILER_TF2XLA_TYPE_UTIL_H_ + +#include "xla/xla_data.pb.h" +#include "tensorflow/core/framework/types.pb.h" +#include "tensorflow/core/lib/core/status.h" +#include "tensorflow/core/platform/statusor.h" + +namespace tensorflow { + +// Converts a Tensorflow DataType to an XLA PrimitiveType. +Status DataTypeToPrimitiveType(DataType data_type, xla::PrimitiveType* type); + +// Converts an XLA PrimitiveType to a TensorFlow DataType. +// Caution: The mapping from TF types to XLA types is not one-to-one: for +// example, both DT_INT8 and DT_QINT8 map to xla::S8. So the inverse is not a +// uniquely defined function. This is fine if you want a way to encode an XLA +// object as a TensorFlow object (e.g., in XRT); whereas if you started with a +// TensorFlow object in the first place, you most likely should preserve the +// original TensorFlow type, rather than trying to convert an XLA type back into +// a TensorFlow type. +StatusOr EncodePrimitiveTypeAsDataType(xla::PrimitiveType type); + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_TF2XLA_TYPE_UTIL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/xla_argument.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/xla_argument.h new file mode 100644 index 0000000000000000000000000000000000000000..49ee115b953d6dcbc3d0bec51062488d78961255 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/xla_argument.h @@ -0,0 +1,136 @@ +/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_TF2XLA_XLA_ARGUMENT_H_ +#define TENSORFLOW_COMPILER_TF2XLA_XLA_ARGUMENT_H_ + +#include "absl/types/optional.h" +#include "absl/types/span.h" +#include "tensorflow/compiler/tf2xla/host_compute_metadata.pb.h" +#include "tensorflow/compiler/tf2xla/xla_resource.h" +#include "xla/client/xla_builder.h" +#include "xla/hlo/ir/hlo_sharding.h" +#include "tensorflow/core/framework/tensor.h" + +namespace tensorflow { + +// Describes how to derive the value of each _Arg node in the graph/function +// being compiled. There must be one Argument for each _Arg index. +struct XlaArgument { + enum Kind { + // Default value; not a valid kind. + kInvalid, + + // Argument is a compile-time constant. No associated runtime parameter. + kConstant, + + // Argument is a Variable, TensorArray, or Stack resource. Has an + // associated runtime parameter iff `initialized` is true. + kResource, + + // A resource variable with a constant value known at compile time. + kConstantResource, + + // Argument is a run-time parameter. + kParameter, + + // Argument is an XLA token. + kToken, + + // Argument is a TensorList. + kTensorList, + }; + + Kind kind = kInvalid; + + // The type of the argument. If the argument is a resource, this + // is the type of the variable's value, not DT_RESOURCE. + DataType type = DT_INVALID; + + // The shape of the argument. For: + // * a parameter: the shape of the parameter. We allow setting the xla shape + // if known. This helps avoid conversions to and from TensorShape. + // * a constant: ignored; the shape given by constant_value is used + // instead. + // * an uninitialized resource: ignored. We don't yet know the shape of an + // uninitialized resource (otherwise we would have initialized it!) + // * an initialized variable: the shape of the variable's value. + // * an initialized TensorArray or Stack resource: the shape of an entry in + // the TensorArray/Stack. Note this is the size of a single entry, not the + // XLA data structure that represents the complete stack/array. + absl::variant shape; + + // The value of the argument, if it is a compile-time constant. Must be a + // host-memory tensor. + Tensor constant_value; + + // The upper bounds of the value. + std::optional value_bound; + + // Indicates whether each value is dynamic or constant. + std::optional value_dynamism; + + // The name of this argument, used for debugging. + string name; + + // The name of TensorFlow _Arg node, used for debugging. + string node_name; + + // For a kResource, what kind of resource is it? + XlaResource::Kind resource_kind = XlaResource::kInvalid; + + // For a kResource, has this resource been initialized? + bool initialized = false; + + // For a kResource, is this resource on Fast Memory. + bool fast_mem = false; + + // For a TensorArray or Stack resource, what is the array's declared size? + // (Used for lazy initialization.) + int64_t max_array_size = -1; + + // TensorArray resource parameters are passed as (array, gradient array 0, + // ..., gradient array k), where the gradient arrays are in the same order + // as `tensor_array_gradients`. + std::set tensor_array_gradients; + + // Whether this argument will receive the same data across all replicas. + bool is_same_data_across_replicas = false; + + bool operator==(const XlaArgument& other) const; + + // Returns a human-readable summary of the argument. + string HumanString() const; + + // Returns the dimension sizes for either TensorShape or xla::Shape. + std::vector DimensionSizes() const; + absl::InlinedVector DimensionSizesAsInlinedVector() const; + + // Returns the human-readable string for either TensorShape or xla::Shape. + string ShapeHumanString() const; + + // Whether to broadcast this parameter to all replicas before use. + // When true, xla_compiler should input/output alias this arg to prevent + // unnecessary HBM usage. + bool requires_broadcast = false; + std::optional definition_stack_trace; +}; + +// Returns true if any of `args` is an uninitialized resource variable. +bool AnyUninitializedResourceArg(absl::Span args); + +} // end namespace tensorflow + +#endif // TENSORFLOW_COMPILER_TF2XLA_XLA_ARGUMENT_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/xla_compilation_device.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/xla_compilation_device.h new file mode 100644 index 0000000000000000000000000000000000000000..de6a3356e05d8ab45c269d7c6c653853d2c63a79 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/xla_compilation_device.h @@ -0,0 +1,69 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_TF2XLA_XLA_COMPILATION_DEVICE_H_ +#define TENSORFLOW_COMPILER_TF2XLA_XLA_COMPILATION_DEVICE_H_ + +#include + +#include "tensorflow/core/common_runtime/local_device.h" +#include "tensorflow/core/framework/device_base.h" +#include "tensorflow/core/framework/tensor.h" +#include "tensorflow/core/lib/core/status.h" +#include "tensorflow/core/platform/mem.h" +#include "tensorflow/core/public/session_options.h" + +namespace tensorflow { + +// Class is defined in xla_compilation_device.cc, reference +// included here only so the XlaCompilationDevice allocator_ member can be +// declared. +class XlaCompilationAllocator; + +// This is a 'dummy' TensorFlow device that is only used to execute a +// subgraph of XLA compilation Ops to construct a compiled version +// of the subgraph's computation. It has a 'dummy' allocator that +// backs each Tensor with an XlaExpression. The shape of the Tensor +// matches the shape of XlaExpression. +// +// We deliberately don't register a device factory because we *never* +// want placement to put Ops on a compilation device. The device is created +// manually, not using a factory. +// +// XLA compilation is not thread-safe. OpKernels registered on the +// XlaCompilationDevice must not use threads or concurrency. +class XlaCompilationDevice : public LocalDevice { + public: + XlaCompilationDevice(const SessionOptions& options, DeviceType type); + + ~XlaCompilationDevice() override; + + Allocator* GetAllocator(AllocatorAttributes attr) override; + + void Compute(OpKernel* op_kernel, OpKernelContext* context) override; + + Status Sync() override; + + Status MakeTensorFromProto(const TensorProto& tensor_proto, + const AllocatorAttributes alloc_attrs, + Tensor* tensor) override; + + private: + std::unique_ptr allocator_; +}; + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_TF2XLA_XLA_COMPILATION_DEVICE_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/xla_compiled_cpu_function.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/xla_compiled_cpu_function.h new file mode 100644 index 0000000000000000000000000000000000000000..871ddb32d2652a26e46850945f36faf18f1ab1c1 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/xla_compiled_cpu_function.h @@ -0,0 +1,493 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_TF2XLA_XLA_COMPILED_CPU_FUNCTION_H_ +#define TENSORFLOW_COMPILER_TF2XLA_XLA_COMPILED_CPU_FUNCTION_H_ + +#include +#include +#include + +#include "xla/cpu_function_runtime.h" +#include "xla/executable_run_options.h" +#include "xla/service/cpu/buffer_desc.h" +#include "xla/service/custom_call_status_internal.h" +#include "tensorflow/core/platform/types.h" + +// Forward-declare, rather than include, to reduce code size for users that +// never use this functionality. +namespace xla { +class ProgramShapeProto; +class HloProfilePrinterData; + +namespace cpu { +class CpuExecutable; +} // namespace cpu +} // namespace xla + +namespace tensorflow { + +// Represents a function compiled by XLA, produced via either JIT or AOT. +// +// The Run method invokes the actual computation, with inputs read from arg +// buffers, and outputs written to result buffers. Each Run call may also use a +// set of temporary buffers for the computation. +// +// By default each instance of this class manages its own arg, result and temp +// buffers. The AllocMode constructor parameter may be used to modify the buffer +// allocation strategy. +// +// Under the default allocation strategy, this class is thread-compatible: +// o Calls to non-const methods require exclusive access to the object. +// o Concurrent calls to const methods are OK, if those calls are made while it +// is guaranteed that no thread may call a non-const method. +class XlaCompiledCpuFunction { + public: + // Type of the raw XLA Classic function, produced by either JIT or AOT. + using RawFunction = void (*)(void* result, + const xla::ExecutableRunOptions* run_options, + const void** args, void** temps, + XlaCustomCallStatus*, int64_t* profile_counters); + + // Signature of the XLA Runtime raw function. Used only by XLA Runtime AOT. + using XlaRuntimeRawFunction = void (*)(void**); + + // Signature of an external run function. Used only by XLA Runtime JIT. + using ExternalRunFunction = + bool (*)(const xla::cpu::CpuExecutable* cpu_executable, + const std::vector& descriptor_table, + const xla::ExecutableRunOptions* run_options); + + // Simple struct to describe a tensor's shape. + // Note: this is a poor man's substitute for xla::ShapeProto, but we cannot + // depend on protobuf's in this library. + // TODO(ecg): extend ShapeInfo to support tuples, if needed. + struct ShapeInfo { + const int32_t* dimensions = nullptr; + int32_t num_dimensions = 0; + }; + + // StaticData represents the state necessary to run an XLA-compiled + // function. For JIT this is backed by data in XlaJitCompiledCpuFunction; for + // AOT this is backed by data compiled into the object file. + // + // The contents of StaticData are XLA-internal implementation details and + // should not be relied on by clients (and therefore are private). + class StaticData { + private: + // The raw function to call. + RawFunction raw_function_; + + ExternalRunFunction external_run_function_ = nullptr; + const xla::cpu::CpuExecutable* cpu_executable_ = nullptr; + + // Contains information about the buffers used by the XLA computation. + const xla::cpu_function_runtime::BufferInfo* buffer_infos_ = nullptr; + int32_t num_buffers_ = 0; + + // Result parameter i is described by + // buffer_infos[result_index_table[i]]. + const int32* result_index_table_ = nullptr; + + // There are num_results result parameters. + int64_t num_results_ = 0; + + // Entry parameter i is described by + // buffer_infos[arg_index_table[i]]. + const int32* arg_index_table_ = nullptr; + + // There are num_args entry parameters. + int64_t num_args_ = 0; + + // There are num_variables variables. + int64_t num_variables_ = 0; + + // The 0-based index of the result tuple, in the temp buffers. + size_t result_index_ = 0; + + const ShapeInfo* arg_shape_infos_ = nullptr; + const ShapeInfo* result_shape_infos_ = nullptr; + + // [Optional] Arrays of arg and result names. These are arrays of C-style + // strings, where the array is terminated by nullptr. + const char** arg_names_ = nullptr; + const char** variable_names_ = nullptr; + const char** result_names_ = nullptr; + + // [Optional] Arg and result shapes. + const xla::ProgramShapeProto* program_shape_ = nullptr; + + // [Optional] Profile printer data. Null if profiling is disabled. + const xla::HloProfilePrinterData* hlo_profile_printer_data_ = nullptr; + + // [Optional] The number of profile counters expected in the profile counter + // buffer by the generated code and hlo_profile_printer. 0 if profiling is + // disabled. This information is already present in + // hlo_profile_printer_data but xla::HloProfilePrinterData is forward + // declared so we don't have access to that information here. + int64_t profile_counters_size_ = 0; + + bool use_xla_runtime_ = false; + + // Only XlaCompiledCpuFunction is allowed to read and write the above + // fields. + friend class XlaCompiledCpuFunction; + }; + + // AllocMode controls the buffer allocation mode. + enum class AllocMode { + // Allocate all buffers - args, results, profile and temps. + ARGS_VARIABLES_RESULTS_PROFILES_AND_TEMPS, + + // Only allocate result, profile and temp buffers. + // Use set_arg_data to set argument buffers before Run is called. + RESULTS_PROFILES_AND_TEMPS_ONLY, + }; + + explicit XlaCompiledCpuFunction( + const StaticData& static_data, + AllocMode alloc_mode = + AllocMode::ARGS_VARIABLES_RESULTS_PROFILES_AND_TEMPS); + virtual ~XlaCompiledCpuFunction(); + + XlaCompiledCpuFunction(const XlaCompiledCpuFunction&) = delete; + XlaCompiledCpuFunction& operator=(const XlaCompiledCpuFunction&) = delete; + + // Sets the intra-op thread pool used to run individual ops concurrently. + void set_thread_pool(const Eigen::ThreadPoolDevice* pool) { + run_options_.set_intra_op_thread_pool(pool); + } + + // Runs the computation, with inputs read from arg buffers, and outputs + // written to result buffers. Returns true on success and false on failure. + bool Run(); + + // Returns the error message from the previous failed Run call. + // + // TODO(fschneider): For now this always returns an empty string because there + // is no support for error reporting in XLA. Remove this once all callers are + // updated. + string error_msg() const { return {}; } + + // ------------------------------ + // Arg methods for managing input buffers. Buffers are in row-major order. + + // Returns the buffer for the positional argument at the given `index`. + void* arg_data(size_t index) { + return buffer_table_[arg_index_table_[index]]; + } + const void* arg_data(size_t index) const { + return buffer_table_[arg_index_table_[index]]; + } + + int num_results() const { return num_results_; } + + int num_args() const { return num_args_; } + + int num_variables() const { return num_variables_; } + + // Returns the size of entry parameter `idx`. + // + // There is a static version of this method on tfcompile generated subclasses + // of XlaCompiledCpuFunction, but try to prefer this when possible since it + // works both for XlaJitCompiledCpuFunction and AOT compiled subclasses. + int arg_size(int idx) const { + assert(idx < num_args()); + return buffer_infos_[arg_index_table_[idx]].size(); + } + + // Sets the buffer for the positional argument at the given `index` to `data`. + // Must be called before Run to have an effect. May be called under any + // AllocMode; if the AllocMode is RESULTS_AND_TEMPS_ONLY, this method must be + // called for each positional argument, in order to set the argument buffers. + // + // Allocated memory must be aligned to the size specified by + // xla::cpu_function_runtime::MinAlign(). If possible, use the functions in + // tensorflow/compiler/tf2xla/cpu_function_runtime.h to ensure correct + // alignment. + // + // Aliasing of argument and result buffers is not allowed, and results in + // undefined behavior. + void set_arg_data(size_t index, const void* data) { + assert((arg_size(index) < xla::cpu_function_runtime::MinAlign() || + (uintptr_t)data % xla::cpu_function_runtime::MinAlign() == 0) && + "Underaligned pointer!"); + // The const_cast is safe because the generated code does not write to arg + // buffers. + // + // buffer_table_ contains pointers to buffers that _will_ be written to by + // generated code so it would be misleading to make buffer_table_ a `const + // void**`. + buffer_table_[arg_index_table_[index]] = const_cast(data); + } + + // ------------------------------ + // Result methods for managing output buffers. Buffers are in row-major order. + // Must only be called after a successful Run call. Unlike the arg methods, + // there is no set_resultN_data method. The result buffers are managed + // internally, and may change after each call to Run. + + // Returns the underlying array of result buffers, where results()[I] is the + // buffer for the positional result at index I. + void** results() { return static_cast(buffer_table_[result_index_]); } + const void* const* results() const { + return static_cast(buffer_table_[result_index_]); + } + + // Profile counters for this XLA computation. + // + // When Hlo profiling is enabled (`hlo_profiling_enabled()` return true in + // this case) these counters are non-null and are automatically populated by + // `Run`. The counters can then be pretty-printed using + // `hlo_profile_printer()`. + // + // When Hlo profiling is disabled, this accessor returns null. + const int64_t* profile_counters() const { return profile_counters_; } + + // Returns the buffer for the positional result at the given `index`. + void* result_data(size_t index) { return results()[index]; } + const void* result_data(size_t index) const { return results()[index]; } + + // ------------------------------ + // Methods for extracting optional metadata. + + // Returns true iff data is available for the Lookup{Arg,Variable,Result}Index + // methods. E.g. the data might not be compiled into the binary for AOT. + bool HasNameIndices() const { + return arg_names_ != nullptr && variable_names_ != nullptr && + result_names_ != nullptr; + } + + // Returns the 0-based index for the argument with the given `name`. + // Returns -1 if the name wasn't found, or data isn't available. + // + // The index remains constant for every instance of XlaCompiledCpuFunction + // generated from the same static data, and might not be cheap to determine. + // Recommended usage is to capture this in a variable for re-use. + int LookupArgIndex(const string& name) const; + + // Returns the 0-based index for the variable with the given `name`. + // Returns -1 if the name wasn't found, or data isn't available. + // + // The index remains constant for every instance of XlaCompiledCpuFunction + // generated from the same static data, and might not be cheap to determine. + // Recommended usage is to capture this in a variable for re-use. + int LookupVariableIndex(const string& name) const; + + // Returns the 0-based index for the result with the given `name`. + // Returns -1 if the name wasn't found, or data isn't available. + // + // The index remains constant for every instance of XlaCompiledCpuFunction + // generated from the same static data, and might not be cheap to determine. + // Recommended usage is to capture this in a variable for re-use. + int LookupResultIndex(const string& name) const; + + // Returns the shape of the args and results. May return nullptr if the + // program shape isn't available. + const xla::ProgramShapeProto* ProgramShape() const { return program_shape_; } + + bool hlo_profiling_enabled() const { + return hlo_profile_printer_data_ != nullptr; + } + const xla::HloProfilePrinterData& hlo_profile_printer_data() const { + assert(hlo_profiling_enabled()); + return *hlo_profile_printer_data_; + } + + protected: + // --------------------------------------------------------------------------- + // Accessors for reading from and writing to instances of `StaticData`. + // + // Classes generated by tfcompile can call these because the generated classes + // inherit from `XlaCompiledCpuFunction`. `XlaJitCompiledCpuFunction` can + // call these because it is explicitly added as a friend. + + static void set_static_data_raw_function(StaticData* static_data, + RawFunction raw_function) { + static_data->raw_function_ = raw_function; + } + + static void set_static_data_external_run_function( + StaticData* static_data, ExternalRunFunction external_run_function) { + static_data->external_run_function_ = external_run_function; + } + + static void set_static_data_cpu_executable( + StaticData* static_data, const xla::cpu::CpuExecutable* cpu_executable) { + static_data->cpu_executable_ = cpu_executable; + } + + static void set_static_data_buffer_infos( + StaticData* static_data, + const xla::cpu_function_runtime::BufferInfo* buffer_infos) { + static_data->buffer_infos_ = buffer_infos; + } + + static void set_static_data_num_buffers(StaticData* static_data, + size_t num_buffers) { + static_data->num_buffers_ = num_buffers; + } + + static void set_static_data_result_index_table( + StaticData* static_data, const int32* result_index_table) { + static_data->result_index_table_ = result_index_table; + } + + static void set_static_data_num_results(StaticData* static_data, + int64_t num_results) { + static_data->num_results_ = num_results; + } + + static void set_static_data_arg_index_table(StaticData* static_data, + const int32* arg_index_table) { + static_data->arg_index_table_ = arg_index_table; + } + + static void set_static_data_num_args(StaticData* static_data, + int64_t num_args) { + static_data->num_args_ = num_args; + } + + static void set_static_data_num_variables(StaticData* static_data, + int64_t num_variables) { + static_data->num_variables_ = num_variables; + } + + static void set_static_data_result_index(StaticData* static_data, + size_t result_index) { + static_data->result_index_ = result_index; + } + + static void set_static_data_arg_shape_infos(StaticData* static_data, + const ShapeInfo* shape_infos) { + static_data->arg_shape_infos_ = shape_infos; + } + + static void set_static_data_result_shape_infos(StaticData* static_data, + const ShapeInfo* shape_infos) { + static_data->result_shape_infos_ = shape_infos; + } + + static void set_static_data_arg_names(StaticData* static_data, + const char** arg_names) { + static_data->arg_names_ = arg_names; + } + + static void set_static_data_variable_names(StaticData* static_data, + const char** variable_names) { + static_data->variable_names_ = variable_names; + } + + static void set_static_data_result_names(StaticData* static_data, + const char** result_names) { + static_data->result_names_ = result_names; + } + + static void set_static_data_program_shape( + StaticData* static_data, const xla::ProgramShapeProto* program_shape) { + static_data->program_shape_ = program_shape; + } + + static void set_static_data_hlo_profile_printer_data( + StaticData* static_data, + const xla::HloProfilePrinterData* hlo_profile_printer_data) { + static_data->hlo_profile_printer_data_ = hlo_profile_printer_data; + } + + static const xla::HloProfilePrinterData* + get_static_data_hlo_profile_printer_data(StaticData* static_data) { + return static_data->hlo_profile_printer_data_; + } + + static void set_static_data_profile_counters_size( + StaticData* static_data, int64_t profile_counters_size) { + static_data->profile_counters_size_ = profile_counters_size; + } + + static void set_static_data_use_xla_runtime(StaticData* static_data, + bool use_xla_runtime) { + static_data->use_xla_runtime_ = use_xla_runtime; + } + + private: + const RawFunction raw_function_; + + // [Optional] External Run() function. + const ExternalRunFunction external_run_function_; + // [Maybe Optional] CpuExecutable to be passed to external_run_function_. + const xla::cpu::CpuExecutable* cpu_executable_; + + const size_t result_index_; + + // Array containing pointers to argument and temp buffers (slots corresponding + // to constant and on-stack buffers are null). + void** const buffer_table_; + + // Describes the buffers used by the XLA computation. + const xla::cpu_function_runtime::BufferInfo* const buffer_infos_; + const int32 num_buffers_; + + // Indices of expanded result tuple. + const int32 num_results_; + const int32* const result_index_table_; + + // Argument i needs to be placed in buffer_table_[arg_index_to_temp_index_[i]] + // for XLA generated code to be able to find it. + const int32* const arg_index_table_; + + // The number of incoming arguments. + const int32 num_args_; + + // The number of incoming variables. + const int32 num_variables_; + + // Shapes of the input arguments. + const ShapeInfo* const arg_shape_infos_; + + // Shapes of the results. + const ShapeInfo* const result_shape_infos_; + + // Backing memory for buffer_table_ and args_, the latter depending on + // AllocMode. + void* alloc_buffer_table_ = nullptr; + + // Backing memory for profiling counters. + int64_t* profile_counters_ = nullptr; + + // Options and context passed to the compiled function. + xla::ExecutableRunOptions run_options_; + + // Optional metadata. + const char** arg_names_ = nullptr; + const char** variable_names_ = nullptr; + const char** result_names_ = nullptr; + const xla::ProgramShapeProto* program_shape_ = nullptr; + const xla::HloProfilePrinterData* hlo_profile_printer_data_ = nullptr; + + const bool use_xla_runtime_ = false; + + // Creates a descriptor table for XLA Runtime. + std::vector MakeXlaRuntimeDescriptorTable(); + + bool RunXlaRuntime(); + + // Add `XlaJitCompiledCpuFunction` as a friend so that it can access the + // `set_static_data_*` static methods above. + friend class XlaJitCompiledCpuFunction; +}; + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_TF2XLA_XLA_COMPILED_CPU_FUNCTION_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/xla_compiler.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/xla_compiler.h new file mode 100644 index 0000000000000000000000000000000000000000..57df97b7d1e9b376018d7143b8911163e48e530c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/xla_compiler.h @@ -0,0 +1,397 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_TF2XLA_XLA_COMPILER_H_ +#define TENSORFLOW_COMPILER_TF2XLA_XLA_COMPILER_H_ + +#include + +#include "absl/types/span.h" +#include "absl/types/variant.h" +#include "tensorflow/compiler/tf2xla/host_compute_metadata.pb.h" +#include "tensorflow/compiler/tf2xla/layout_util.h" +#include "tensorflow/compiler/tf2xla/xla_argument.h" +#include "tensorflow/compiler/tf2xla/xla_compilation_device.h" +#include "tensorflow/compiler/tf2xla/xla_expression.h" +#include "tensorflow/compiler/tf2xla/xla_helpers.h" +#include "tensorflow/compiler/tf2xla/xla_op_registry.h" +#include "xla/client/local_client.h" +#include "xla/client/xla_builder.h" +#include "xla/client/xla_computation.h" +#include "xla/status_macros.h" +#include "tensorflow/core/common_runtime/device.h" +#include "tensorflow/core/common_runtime/device_mgr.h" +#include "tensorflow/core/common_runtime/function.h" +#include "tensorflow/core/framework/function.h" +#include "tensorflow/core/lib/core/errors.h" +#include "tensorflow/core/platform/env.h" +#include "tensorflow/core/platform/mutex.h" +#include "tensorflow/core/platform/notification.h" +#include "tensorflow/core/platform/thread_annotations.h" +#include "tensorflow/core/protobuf/config.pb.h" +#include "tensorflow/core/public/version.h" + +namespace tensorflow { + +class XlaContext; + +// The XlaCompiler class is responsible for compilation of a self-contained +// subgraph of a TensorFlow computation using the XLA linear algebra runtime. +// It does a symbolic execution of the graph starting from specific input +// shapes, using a JIT device to convert operators into XLA computations. +// +// XlaCompiler is typically invoked from an `XlaLaunch` operator once the +// shapes of all input parameters to the computation are known. This is +// because the symbolic execution requires known shapes for all operations. +// +// XlaCompiler compiles Tensorflow graphs that received inputs via _Arg nodes, +// and return outputs via _Retval nodes. +// +// The XlaCompiler requires one Argument struct for each _Arg index, that +// describes each argument. Arguments can be compile-time constants +// (kind kConstant), run-time parameters (kind kParameter), or resources +// (kind kResource). +// +// Only kParameter and initialized kResource arguments become runtime parameters +// to the generated XLA computation. +// +// The run-time outputs of the XLA computation are arranged in the following +// order: +// +------------------+-----------------------------------------+ +// | _Retval values | Updated values of kResource arguments | +// +------------------+-----------------------------------------+ +// _Retval values are ordered by _Retval index, whereas kResource values are +// ordered by the original _Arg position of the variable. +// +// If a shape representation function is provided as part of +// XlaCompiler::CompileOptions, kParameter arguments and return values to an +// entry computation will be reshaped in accordance to the shape function. +// Arguments and return values to a non-entry computation are not reshaped. +// Variable resource arguments are passed and returned in reshaped form, even +// for non-entry computations. This feature allows TensorFlow to keep on-device +// tensors with a different shape to their representation inside the XLA +// computation. +// +// In computation outputs, updated kResource values are placed the end. When +// emitting While loop bodies, we must ensure that the loop body has +// identical input and output signatures. By passing variable values +// at the end of the argument list and using the +// `return_updated_values_for_all_variables` option, we can ensure that the +// input and output values of resources appear at the same positions. +// +// Resources are passed as parameters or returned as resource updates in +// "packed" form. +// kStack resources are packed as (array, size of stack) XLA tuples. +// kTensorArray resources without gradients are packed as the array that +// backs the TensorArray. If gradients are present (`tensor_array_gradients`), +// the packed representation is a (array, gradient0, gradient1, ...) tuple, +// where gradient_k is the value of the k-th gradient in the +// `tensor_array_gradients` ordered set. +class XlaCompiler { + public: + // TODO(b/255826209): Remove this alias. Depending on XlaCompiler just to use + // XlaArgument seeems weird and can cause circular dependencies. + using Argument = ::tensorflow::XlaArgument; + + // Options pertaining to an individual call to CompileGraph() or + // CompileFunction(). + struct CompileOptions { + // If `use_tuple_arg` is true, a single tuple parameter will be used for all + // arguments; if false, each argument gets its own parameter. + bool use_tuple_arg = false; + + // If 'return_updated_values_for_all_resources' is true, then updated + // values of all resource arguments will be included in the + // 'resource_updates' of the computation, even if the resource was not + // modified by the computation. Used when compiling loop bodies to ensure + // the input and output signatures match. + bool return_updated_values_for_all_resources = false; + + // If 'always_return_tuple' is true, then the output of a computation will + // always be a tuple. Otherwise, a single-element output will not be wrapped + // in a tuple. + bool always_return_tuple = true; + + // True when compiling the entry computation, false for subcomputations + // (while, call, etc.) + bool is_entry_computation = true; + + // True when we should add XLA input & output to the graph/function. + bool add_token_input_output = false; + + // Resource updates are converted into input / output of xla. The two + // buffers are aliased with other if this option is true. + bool alias_resource_update = false; + }; + + using OutputDescription = ::tensorflow::XlaOutputDescription; + + using ResourceUpdate = ::tensorflow::XlaResourceUpdate; + + using CompilationResult = ::tensorflow::XlaCompilationResult; + + struct Options { + // Name of the compilation device to use. It must be set by the caller. + // The default empty value is invalid. + DeviceType device_type = DeviceType(""); + + // The device to use during compilation to execute instructions on, for + // example for auto-tuning. + // Valid values are defined by `xla::Backend::devices_ordinal_supported()`. + // -1 indicates the default device should be used. + int device_ordinal = -1; + + xla::Client* client = nullptr; + + // Function library in which to find function definitions. Must be non-null. + const FunctionLibraryDefinition* flib_def = nullptr; + + // The graph def version to be compiled. + int graph_def_version = TF_GRAPH_DEF_VERSION; + + // If 'allow_cpu_custom_calls' is true, kernels may make use of CustomCall() + // for CPU. + bool allow_cpu_custom_calls = false; + + // A ShapeDeterminationFns (i.e., a bundle of LayoutSelectionFn and + // ShapeRepresentationFn). Each bundle describes the XLA representation of + // arguments represented to XLA as the shape given by this shape function. + // Arguments are input activations or weights to an XLA entry computation. + // Variables are reshaped to this shape on write, and reshaped to their + // original shape on read. + XlaShapeLayoutHelpers::ShapeDeterminationFns shape_determination_fns; + + // If not nullptr, populate_resource_manager is called with the + // compilation device's resource manager when the compilation + // device is created, and can be used to create metadata objects + // that can be accessed by XLA op kernels. + std::function* populate_resource_manager = nullptr; + + // If not nullptr, this memory allocator can be used by the compiler for + // temporary allocations it might want to make during compilation. + // + // For example, the compiler may want to try out different algorithms and + // choose the fastest one, and it might run those algorithms over buffers + // created using this allocator. + // + // The compiler can function correctly without an explicit allocator given + // here, but on some devices (notably, GPUs), TensorFlow tends to eagerly + // allocate most or all available memory on the device, leaving none for the + // compiler to access, unless it can use TensorFlow's allocator. + // This must be a shared_ptr, as this is passed all the way down to the + // cluster compilation. This allows asynchronous compilation to hold a + // reference until the compilation is finished. + std::shared_ptr device_allocator; + + // Alias input and output buffers for parameters that are passed-through XLA + // modules without being changed. + bool alias_passthrough_params = false; + + // Enable detailed logging of compilation metadata. + bool detailed_logging = true; + }; + + // Argument for compiling a single op. + struct SingleOpCompileArgument { + // Data type of the output tensors. This is used to create _Retval node. + std::vector output_dtypes; + + // The NodeDef representing the op. + NodeDef node_def; + + // This is currently only used to obtain MLIR TPU bridge rollout state. + // Can be removed once full rollout is complete. + ConfigProto config_proto; + + SingleOpCompileArgument() = default; + + explicit SingleOpCompileArgument(const OpKernelContext& ctx); + }; + + explicit XlaCompiler(Options options); + + ~XlaCompiler(); + + // Helper function to populate an XlaCompiler::Argument from XlaResource. + static void PopulateArgumentFromResource(const XlaResource& resource, + Argument* arg); + + Status CompileFunction(const CompileOptions& options, + const NameAttrList& fn_name_attrs, + absl::Span args, + CompilationResult* result); + + Status CompileSingleOp( + const CompileOptions& options, + const SingleOpCompileArgument& single_op_compile_argument, + absl::Span args, CompilationResult* result); + + // Compiles a tensorflow::Graph into an xla::XlaComputation. + // Similar to CompileFunction, but takes a Graph as input rather than a + // function. + Status CompileGraph( + const CompileOptions& options, string const& name, + std::unique_ptr graph, absl::Span args, + CompilationResult* result); + + // Returns the shape of the XLA parameter for an argument 'arg'. + // See the class comment for more details about the argument passing + // convention. + Status XLAShapeForArgument( + const Argument& arg, bool is_entry_computation, + const std::optional& arg_sharding, + xla::Shape* xla_shape) const; + + // Retrieves the channel handle associated with `key`. Allocates + // a new channel handle if none exists. + // Channel handles can be used to communicate between different + // computations. Computations that communicate should be compiled with the + // same XlaCompiler. + Status GetChannelHandle(const string& key, xla::ChannelHandle* channel); + + // Retrieves the host-to-device channel handle associated with `key`. + // Allocates a new channel handle if none exists. + Status GetHostToDeviceChannelHandle(const string& key, + xla::ChannelHandle* channel); + + // Retrieves the device-to-host channel handle associated with `key`. + // Allocates a new channel handle if none exists. + Status GetDeviceToHostChannelHandle(const string& key, + xla::ChannelHandle* channel); + + // Sets the shapes and types for the device to host transfer associated with + // 'key'. + Status SetDeviceToHostMetadata(const string& key, + absl::Span types, + absl::Span shapes); + + // Gets the shapes the device to host transfer associated with 'key'. + Status GetDeviceToHostShapes(const string& key, + std::vector* shapes) const; + + // Sets the shapes and types for the host to device transfer associated with + // 'key'. + Status SetHostToDeviceMetadata(const string& key, + absl::Span types, + absl::Span shapes); + + // In order to avoid deadlocks from dependencies in host computations, it can + // be necessary to enforce a partial order on the execution of HostCompute + // Ops. In particular it may be necessary to constrain the SendToHost for one + // HostCompute to run before blocking on the RecvAtHost for another + // HostCompute. The compiler maintains a mapping from 'host_compute_name' to + // handle, where the handle is an 'output' of the HostCompute Op corresponding + // to 'host_compute_name'. Another HostCompute Op that needs to be sequenced + // later can add the handle as an 'input' to enforce the constraints. + // 'host_compute_name' can be any string the client wishes to use to identify + // a given HostCompute Op as long as the names are unique within the + // compilation. + Status GetHostComputeControlDependency(const string& host_compute_name, + xla::XlaOp* handle); + Status SetHostComputeControlDependency(const string& host_compute_name, + xla::XlaOp handle); + + const Options& options() const { return options_; } + xla::Client* client() const { return options_.client; } + FunctionLibraryRuntime* flib_runtime() const { return flib_runtime_; } + + void PushNodeTokenMapping(); + Status PopNodeTokenMapping(); + Status SetNodeToken(const string& node_name, xla::XlaOp op); + StatusOr GetNodeToken(const string& node_name); + + // Sets the function body `fbody` to the one registered as `function`. + Status FindFunctionBody(const NameAttrList& function, + const FunctionBody** fbody, + const ConfigProto** config_proto = nullptr); + + private: + // Returns the optimized graph object in this function body. + std::unique_ptr GetGraph(const FunctionBody* fbody); + + // Builds XLA computations for each of the arguments to the computation. + // `args` are the arguments to the computation. + Status BuildArguments(const Graph& graph, + const std::vector& args, + bool use_tuple_arg, xla::XlaBuilder* builder, + XlaContext* context, + const std::map& arg_shardings, + std::vector* arg_expressions, + std::vector* input_to_args, + std::vector* input_shapes, + bool is_entry_computation); + + // Graph compiler needs to know how to get an optimized graph from a function + // body. + friend class GraphCompiler; + friend class XlaCompilerTest; + + Options options_; + + // Status set to non-OK in the constructor if initialization fails. + Status initialization_status_; + + // Returns the next step sequence number. + int64_t NextStepId(); + + // Internal sequence number for steps executed on the compilation device. + int64_t next_step_id_; + + XlaCompilationDevice* device_; // Owned by device_mgr_ + StaticDeviceMgr device_mgr_; + + // To avoid copying the client's function library, use a local function + // library and runtime for functions created as part of the functionalize + // control flow transformation. + std::unique_ptr local_flib_def_; + std::unique_ptr pflr_; + std::unique_ptr local_pflr_; + + FunctionLibraryRuntime* local_flib_runtime_; // owned by local_pflr_. + FunctionLibraryRuntime* flib_runtime_; // owned by pflr_. + + struct SignatureHash { + uint64 operator()( + const std::pair>& signature) const; + }; + + std::unordered_map>, + CompilationResult, SignatureHash> + cache_; + + std::unordered_map channels_; + + std::unordered_map host_compute_sends_; + std::unordered_map host_compute_recvs_; + + std::unordered_map host_compute_control_output_; + + // This is used to store mapping. Side-effecting + // ops call SetNodeToken() to record its token output, so later side-effecting + // ops can use GetNodeToken() to get it and use it as token input. + // + // It's a stack because we need a mapping like this for each level of nested + // CompileGraph() call. In CompileGraph(), we will push a new mapping to the + // stack, and pop the mapping before returning. + std::stack> node_token_mapping_stack_; + + XlaCompiler(const XlaCompiler&) = delete; + void operator=(const XlaCompiler&) = delete; +}; + + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_TF2XLA_XLA_COMPILER_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/xla_context.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/xla_context.h new file mode 100644 index 0000000000000000000000000000000000000000..f3b46fe0e853c90142a95da128f91106022982b6 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/xla_context.h @@ -0,0 +1,184 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +// This file defines the contexts used during XLA compilation. + +#ifndef TENSORFLOW_COMPILER_TF2XLA_XLA_CONTEXT_H_ +#define TENSORFLOW_COMPILER_TF2XLA_XLA_CONTEXT_H_ + +#include + +#include "tensorflow/compiler/tf2xla/xla_expression.h" +#include "tensorflow/compiler/tf2xla/xla_helpers.h" +#include "xla/client/xla_builder.h" +#include "xla/client/xla_computation.h" +#include "xla/status_macros.h" +#include "xla/xla_data.pb.h" +#include "tensorflow/core/framework/op_kernel.h" +#include "tensorflow/core/framework/resource_mgr.h" +#include "tensorflow/core/graph/graph.h" +#include "tensorflow/core/platform/macros.h" + +namespace tensorflow { + +class XlaOpKernelContext; +class XlaCompiler; + +// The XlaContext is the data structure that holds the state of an XLA +// compilation, that is accessible from OpKernelContexts when compiling a +// subgraph of Ops using XLA. +class XlaContext : public ResourceBase { + public: + // Retrieves the XlaContext of the current compilation. + static XlaContext& Get(const OpKernelContext* ctx); + + // Creates a new XlaContext. See the documentation on the class data fields + // for descriptions of the arguments. + XlaContext(XlaCompiler* compiler, xla::XlaBuilder* builder, + const Graph* graph); + + // Virtual method defined by ResourceBase. + string DebugString() const override; + + XlaCompiler* compiler() const { return compiler_; } + + const AbstractStackTrace* StackTraceForNodeName(const std::string& name) { + const auto& it = stack_traces_.find(name); + if (it != stack_traces_.end()) { + return it->second.get(); + } + return nullptr; + } + + // Returns the XlaBuilder that Ops use for compiling new expressions. + xla::XlaBuilder* builder() { return builder_; } + + const std::vector& args() const { return args_; } + void set_args(std::vector args); + + const std::vector& retvals() { return retvals_; } + + // Sets a return value. + // Since we do not always know in advance how many return values there are, + // grows the return values vector to size index+1 if it is smaller. + void SetRetval(int index, const XlaExpression& expression); + + // Adds 'resource' to the set of resources owned by the context. + XlaResource* AddResource(std::unique_ptr resource); + + const std::vector>& resources() { + return resources_; + } + + // Get an XLA lambda to compute Max. This is cached in the + // XlaContext since it may be used by multiple Ops. There is a + // separate specialization of the computation for each DataType. + const xla::XlaComputation* GetOrCreateMax(const DataType type); + + // Get an XLA lambda to compute Min. This is cached in the + // XlaContext since it may be used by multiple Ops. There is a + // separate specialization of the computation for each DataType. + const xla::XlaComputation* GetOrCreateMin(const DataType type); + + // Get an XLA lambda to compute Add. This is cached in the + // XlaContext since it may be used by multiple Ops. There is a + // separate specialization of the computation for each DataType. + const xla::XlaComputation* GetOrCreateAdd(const DataType type); + + // Get an XLA lambda to compute LogAddExp. This is cached in the + // XlaContext since it may be used by multiple Ops. There is a + // separate specialization of the computation for each DataType. + const xla::XlaComputation* GetOrCreateLogAddExp(const DataType type); + + // Get an XLA lambda to compute Mul. This is cached in the + // XlaContext since it may be used by multiple Ops. There is a + // separate specialization of the computation for each DataType. + const xla::XlaComputation* GetOrCreateMul(const DataType type); + + // The name of the XlaContext resource during symbolic graph execution. + static const char kXlaContextResourceName[]; + + // Records the collective information from the nested compilation `result`. + Status RecordCollectiveInfoFromNestedCompilationResult( + const XlaCompilationResult& result); + + // Records the collective configurations for all the collectives in the XLA + // cluster and returns the channel_id to be used for the next collective. + StatusOr RecordCollectiveInfo(int group_key, int group_size); + + const std::optional& + GetCollectiveInfo() { + return collective_info_; + } + + private: + XlaCompiler* const compiler_; + + // The XlaBuilder used to construct the subgraph's compiled representation. + xla::XlaBuilder* builder_; + + // Stack traces for the graph used for compilation. + StackTracesMap stack_traces_; + + // Arguments to the Tensorflow graph, indexed by _Arg index. + // Includes both compile-time constant arguments and runtime parameters. + std::vector args_; + + // Return values of the Tensorflow graph, indexed by _Retval index. + std::vector retvals_; + + // Holds ownership of resources. The resources are not ordered. + std::vector> resources_; + + // Information about encountered collective ops. We allow only a + // single configuration per cluster. + std::optional collective_info_; + + // Cache of prebuilt computations indexed by their type. + using ComputationMap = std::map; + + // Finds the value for the given type in out map if it already + // exists or makes a new value with create function and keeps it the + // map. The returned value != nullptr and is owned by the map. + const xla::XlaComputation* LookupOrCreate( + DataType type, ComputationMap* out, + const std::function& create); + + // Cached computation to compute Max of two elements, specialized by type. + ComputationMap max_func_; + + // Cached computation to compute Min of two elements, specialized by type. + ComputationMap min_func_; + + // Cached computation to compute Sum of two elements, specialized by type. + ComputationMap add_func_; + + // Cached computation to compute Mul of two elements, specialized by type. + ComputationMap mul_func_; + + // Cached computation to compute Log(Add(Exp())) of two elements, specialized + // by type. + ComputationMap log_add_exp_func_; + + // Cached computation to compute Sigmoid of an element, specialized by type. + ComputationMap sigmoid_func_; + + XlaContext(const XlaContext&) = delete; + void operator=(const XlaContext&) = delete; +}; + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_TF2XLA_XLA_CONTEXT_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/xla_expression.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/xla_expression.h new file mode 100644 index 0000000000000000000000000000000000000000..2447eb3919b80c00b3124f781acdb18b5b1c73e2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/xla_expression.h @@ -0,0 +1,173 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_TF2XLA_XLA_EXPRESSION_H_ +#define TENSORFLOW_COMPILER_TF2XLA_XLA_EXPRESSION_H_ + +#include "absl/types/optional.h" +#include "tensorflow/compiler/tf2xla/xla_resource.h" +#include "xla/client/client.h" +#include "xla/client/value_inference.h" +#include "xla/client/xla_builder.h" +#include "tensorflow/core/framework/tensor.h" +#include "tensorflow/core/lib/core/status.h" +#include "tensorflow/core/platform/statusor.h" + +namespace tensorflow { + +// A XlaExpression represents a symbolic TensorFlow value in a TF->XLA +// compilation. +// An expression is one of: +// * a constant tensor. +// * an xla::XlaOp, representing a symbolic XLA value. +// * a resource, e.g., a variable, represented as an XlaResource pointer. +// * a tensor list, represented by a tuple of tensors and the list length. +// +// Constant tensors are mostly an optimization to avoid passing large constants +// to XLA, but are also sometimes used to represent tensors that have no XLA +// representation, for example, DT_STRING tensors. A canonical use case might be +// an error message string. +// +// Tensor lists are very similar to xla::XlaOp, however they require some +// specific logic around shape management since the tuples are not supported by +// TensorFlow. +class XlaExpression { + public: + enum class Kind { + kInvalid, + kConstant, + kXlaOp, + kResource, + kTensorList, + }; + + XlaExpression(); + XlaExpression(const XlaExpression&) = default; + XlaExpression& operator=(const XlaExpression&) = default; + + // Builds an invalid expression. (Same as the default constructor, but makes + // the intent clearer.) + static XlaExpression Invalid(); + + // Builds a constant XLA expression. + static XlaExpression Constant(Tensor value); + + // Builds a XlaOp expression. Since the mapping from TF data types to XLA + // types is not 1-1, the TF type must also be provided; in general it cannot + // be derived from the XLA type. + static XlaExpression XlaOp(xla::XlaOp value, DataType dtype); + + // Builds a tensor list expression. + static XlaExpression TensorList(xla::XlaOp tensor_list); + + // Builds a resource expression. + static XlaExpression Resource(XlaResource* resource); + + // Builds a resource whose value is known at a compile time. + static XlaExpression ConstantResource(Tensor value, XlaResource* resource); + + Kind kind() const { return kind_; } + + DataType dtype() const { return dtype_; } + + // handle() returns the XlaOp that backs a kXlaOp expression. + const xla::XlaOp& handle() const { return handle_; } + + // Return a constant value associated with this expression. Always set for + // constants, might be set for resources. + std::optional constant_value() const { + if (kind_ == Kind::kResource && resource_->IsOverwritten()) { + // The constant is no longer available if the value was overwritten. + return std::nullopt; + } + return constant_value_; + } + + // Set the bound of the expression. + void set_value_bound(Tensor tensor) { + value_bound_.emplace(std::move(tensor)); + } + + // Return the bound of the expression, if available. + std::optional value_bound() const { return value_bound_; } + + // Set the dynamism of the expression, indicating whether or not each value in + // this expression is dynamic. + void set_value_dynamism(Tensor tensor) { + value_dynamism_.emplace(std::move(tensor)); + } + + // Return the dynamism of the expression, if available. + std::optional value_dynamism() const { return value_dynamism_; } + + XlaResource* resource() const { return resource_; } + + // Returns a human-readable summary of the expression. + string HumanString() const; + + // Returns the value of a kValue or kXlaOp as an xla::XlaOp. Returns + // an erroneous XlaOp if the expression is not a constant or an expression. + xla::XlaOp AsXlaOp(xla::XlaBuilder* builder) const; + + // If a kXlaOp or kValue expression can be resolved to a compile-time + // constant, returns the value as a host-memory Tensor. Returns an empty + // optional if it cannot be resolved. Returns an error if passed a resource + // expression. + StatusOr> ResolveConstant( + xla::Client* client, bool dynamic_dimension_is_minus_one = false, + xla::ValueInferenceMode mode = xla::ValueInferenceMode::kValue) const; + + // ResolveDynamism computes where a value inside this op is dynamic or can be + // inferred at compile time. + StatusOr ResolveDynamism() const; + + // Returns the shape of the tensor. + // The shape of a resource is the shape of a resource handle (i.e., a scalar), + // not the shape of the resource's value. + StatusOr GetShape() const; + StatusOr GetXlaShape() const; + + // Retrieves an XlaExpression that was allocated by a previous Op. + static const XlaExpression* CastExpressionFromTensor(const Tensor& tensor); + + // Assigns an XlaExpression to a tensor on an XLA compilation device. + static void AssignExpressionToTensor(const XlaExpression& value, + Tensor* tensor); + + private: + Kind kind_ = Kind::kInvalid; + + DataType dtype_ = DT_INVALID; + + // The XLA handle of the expression's computation, if kind_ == kXlaOp or + // a tuple expression if kind_ == kTensorList. + xla::XlaOp handle_; + + // The value of the constant, if available. + std::optional constant_value_; + + // The bound of the expression, if available. + std::optional value_bound_; + + // Indicate whether each value inside a tensor is dynamic or not. + std::optional value_dynamism_; + + // The resource, if kind_ == kResource. Not owned. + XlaResource* resource_ = nullptr; +}; + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_TF2XLA_XLA_EXPRESSION_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/xla_helpers.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/xla_helpers.h new file mode 100644 index 0000000000000000000000000000000000000000..0bebf471ecfbe9ed6cc66636a08114d2a7adf54a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/xla_helpers.h @@ -0,0 +1,202 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +// This file defines helper routines for the XLA device. + +#ifndef TENSORFLOW_COMPILER_TF2XLA_XLA_HELPERS_H_ +#define TENSORFLOW_COMPILER_TF2XLA_XLA_HELPERS_H_ + +#include "absl/types/optional.h" +#include "absl/types/span.h" +#include "tensorflow/compiler/tf2xla/host_compute_metadata.pb.h" +#include "xla/client/xla_builder.h" +#include "xla/executable_run_options.h" +#include "xla/hlo/ir/hlo_sharding.h" +#include "xla/service/computation_placer.h" +#include "xla/translate/mhlo_to_hlo/layout_util.h" +#include "tensorflow/core/framework/op_kernel.h" +#include "tensorflow/core/framework/tensor.h" + +namespace tensorflow { + +using XlaLayoutPreference = mlir::XlaLayoutPreference; + +// Helper methods for building XLA computations. +class XlaHelpers { + public: + // Returns a handle representing the zero value of a scalar + // element of data_type. + static xla::XlaOp Zero(xla::XlaBuilder* b, DataType data_type); + + // Returns a handle representing the one value of a scalar + // element of data_type. + static xla::XlaOp One(xla::XlaBuilder* b, DataType data_type); + + // Returns a handle representing the given value of an integer scalar + // element of data_type. + // Note that unlike One and Zero, does not work on boolean types. + static xla::XlaOp IntegerLiteral(xla::XlaBuilder* b, DataType data_type, + int64_t value); + + // Returns a handle representing the given value of a floating-point scalar + // element of data_type. + static xla::XlaOp FloatLiteral(xla::XlaBuilder* b, DataType data_type, + double value); + + // Reshapes literal 'input' to have 'shape'. Both the original shape and + // 'shape' must contain the same number of elements. + static Status ReshapeLiteral(const xla::Literal& input, + absl::Span shape, + xla::Literal* output); + + // Converts `indices` into a one-hot representation. `depth` is the size + // of the new axis to add. `axis` is the position at which to add the new + // axis. `indices_shape` is the shape of `indices`. `on_value` and + // `off_value` represent the values to use for the on and off positions, + // respectively. + static Status OneHot(xla::XlaBuilder* builder, int64_t depth, int axis, + DataType index_type, const TensorShape& indices_shape, + xla::XlaOp indices, xla::XlaOp on_value, + xla::XlaOp off_value, xla::XlaOp* one_hot); + + // Certain DataTypes should use increased precision DataTypes when performing + // reductions. This function remaps a given DataType to a higher precision + // DataType if needed. + static DataType SumAccumulationType(const DataType& dtype); + + // A helper for creating a ConvertElementType xla op given a DataType rather + // than the xla::PrimitiveType. + static xla::XlaOp ConvertElementType(xla::XlaOp operand, + const DataType new_element_type); + + typedef std::function(const TensorShape&, DataType, bool, + XlaLayoutPreference)> + ShapeRepresentationFn; +}; + +// Creates an identity shape representation function. +XlaHelpers::ShapeRepresentationFn IdentityShapeRepresentationFn(); + +struct XlaOutputDescription { + // Type and shape of the output. The shape is the unflattened shape. + // When `type` is DT_RESOURCE, `shape` is the shape of the resource + // variable's value. + DataType type; + TensorShape shape; + + // Constant output value, if known to be constant at JIT compilation time. + // 'Tensor' is in host memory. + bool is_constant = false; + Tensor constant_value; + + // When this output is a resource, i.e. `type == DT_RESOURCE`, this is + // the index of the input that contains the resource. + int input_index; + + // Whether this output is a TensorList. + bool is_tensor_list = false; +}; + +// Describes a variable write side effect of the computation. +struct XlaResourceUpdate { + // Index of the input that contains the variable resource to write to. + int input_index; + + // Type and shape of the tensor to be written back. + // The `shape` field has the same meaning as the Argument::shape field. + DataType type; + TensorShape shape; + + // Was the value of the variable modified by the computation? + // (Always true, unless `return_updated_values_for_all_resources` is true.) + bool modified; + + // If the resource is a TensorArray, the set of gradients read or written. + std::set tensor_array_gradients_accessed; +}; + +struct XlaCompilationResult { + // Vector that maps from the parameters of the XLA computation to their + // original argument positions. To handle compile-time constant inputs, the + // parameters to the XLA computation may be a subset of the original + // arguments. The relative ordering of parameters are maintained. + std::vector input_mapping; + + // Input shapes of the computation. If we are flattening inputs, these are + // the flattened shapes. + std::vector xla_input_shapes; + + // Output shape in XLA format. The output shape is always a tuple. If we + // are flattening outputs, these are the flattened shapes. + xla::Shape xla_output_shape; + + // TensorFlow shapes of outputs, together with the values of any + // constant arguments. Vector indexed by Tensorflow _Retval number, + // containing both constant and non-constant results. + std::vector outputs; + + // TensorFlow shapes and types of sends/recvs from HostCompute Ops to their + // matching RecvAtHost/SendFromHost Ops in the outer graph. + tf2xla::HostComputeMetadata host_compute_metadata; + + // Resources whose values were updated by the computation, ordered + // by return value position (which is the same as the order the resources + // were passed as arguments). Resource updates follow the non-constant + // results in the outputs of XLA computation. + std::vector resource_updates; + + // The XLA computation built from the tensorflow subgraph. + std::shared_ptr computation; + + // Meta-info about encountered collective ops. + struct CollectiveInfo { + int group_key; + int group_size; + int next_id; + + template + friend H AbslHashValue(H h, const CollectiveInfo& info) { + return H::combine(std::move(h), info.group_key, info.group_size, + info.next_id); + } + + friend bool operator==(const CollectiveInfo& lhs, + const CollectiveInfo& rhs) { + return lhs.group_key == rhs.group_key && + lhs.group_size == rhs.group_size && lhs.next_id == rhs.next_id; + } + }; + + // Information of the collectives encountered during the translation. + std::optional collective_info; +}; + +// Resolves the device assignment based on CollectiveInfo. +// CollectiveInfo records collective ops in the cluster. Note that +// this relies on a rendezvous and blocks until all replicas are there. +// +// Takes several extra configuration objects by reference since +// xla::ExecutableRunOptions does not take ownership; these are configured and +// bundled into `run_options` if applicable. +Status ResolveDeviceAssignment( + OpKernelContext* ctx, + const XlaCompilationResult::CollectiveInfo& collective_info, + xla::ExecutableRunOptions& run_options, + xla::DeviceAssignment& device_assignment, + xla::gpu::GpuExecutableRunOptions& gpu_options); + +} // end namespace tensorflow + +#endif // TENSORFLOW_COMPILER_TF2XLA_XLA_HELPERS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/xla_op_kernel.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/xla_op_kernel.h new file mode 100644 index 0000000000000000000000000000000000000000..7fc7beef6ecb04292ec0198bf8e0fef2bb7e5128 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/xla_op_kernel.h @@ -0,0 +1,376 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_TF2XLA_XLA_OP_KERNEL_H_ +#define TENSORFLOW_COMPILER_TF2XLA_XLA_OP_KERNEL_H_ + +#include "tensorflow/compiler/tf2xla/xla_compiler.h" +#include "tensorflow/compiler/tf2xla/xla_context.h" +#include "tensorflow/compiler/tf2xla/xla_expression.h" +#include "tensorflow/compiler/tf2xla/xla_resource.h" +#include "xla/client/value_inference.h" +#include "xla/client/xla_builder.h" +#include "xla/client/xla_computation.h" +#include "xla/xla_data.pb.h" +#include "tensorflow/core/framework/op_kernel.h" +#include "tensorflow/core/platform/macros.h" + +namespace tensorflow { + +class XlaOpKernelContext; + +// Implementations of operators that generate XLA code should usually subclass +// XlaOpKernel and implement the Compile() method. Unlike a regular OpKernel, +// an XlaOpKernel produces and consumes symbolic values during compilation. +// +// See the comments in xla_context.h for more details. +class XlaOpKernel : public OpKernel { + public: + explicit XlaOpKernel(OpKernelConstruction* construction); + + // Subclasses should implement Compile(), much as standard OpKernels implement + // Compute(). + virtual void Compile(XlaOpKernelContext* context) = 0; + + private: + void Compute(OpKernelContext* context) final; +}; + +// The context passed to the Compile() method of XlaOpKernel. An +// XlaOpKernelContext is a variant of the standard OpKernel class, tailored for +// implementing operators that perform symbolic execution as part of the XLA +// compiler. The key difference is that XlaOpKernelContext produces and consumes +// data as XLA computations, rather than as standard Tensors. +// +// Under the hood, symbolic execution communicates using special Tensors that +// wrap XlaExpression objects, however this is an implementation detail that +// this class hides. The *only* correct way to allocate a Tensor during +// compilation is using the XlaOpKernelContext methods, since they ensure there +// is a valid XlaExpression backing the tensor. No Op should ever call +// allocate_output or allocate_temp directly on the underlying OpKernelContext. +class XlaOpKernelContext { + public: + explicit XlaOpKernelContext(OpKernelContext* context); + + XlaContext* xla_context() const; + + // Returns the XLA XlaBuilder containing the output of compilation. + xla::XlaBuilder* builder() const; + + xla::ValueInference& value_inference(); + + // Inputs + + // Returns the number of inputs to the operator. + int num_inputs() const { return context_->num_inputs(); } + + // Returns the type of input `index`. + DataType input_type(int index) const; + + // Returns the type of input `name`. + DataType InputType(absl::string_view name); + + // Returns the type of input `index` as an xla::PrimitiveType. If the type + // is not representable as an XLA type, sets an error status and returns + // xla::PRIMITIVE_TYPE_INVALID. + xla::PrimitiveType input_xla_type(int index); + + // Returns the type of input `name` as an xla::PrimitiveType. If the type + // is not representable as an XLA type, sets an error status and returns + // xla::PRIMITIVE_TYPE_INVALID. + xla::PrimitiveType InputXlaType(absl::string_view name); + + // Returns the shape of input at `index` or input the given `name`. Note that + // in case the shape of the input is not static, then the returned shape has + // bounds as the dimension size instead of having unknown dimensions. Use + // InputXlaShape instead that provides shapes with dynamism information. + // + ABSL_DEPRECATED( + "Prefer InputXlaShape which handles dynamic shapes accurately.") + TensorShape InputShape(int index); + ABSL_DEPRECATED( + "Prefer InputXlaShape which handles dynamic shapes accurately.") + TensorShape InputShape(absl::string_view name); + + // Returns input `index` as a XlaOp. Unlike + // OpKernelContext::Input returns a symbolic value rather than a concrete + // Tensor. + xla::XlaOp Input(int index); + // Returns input `name` as a XlaOp. + xla::XlaOp Input(absl::string_view name); + + // Returns the xla input shape for a given index. + StatusOr InputXlaShape(int index); + StatusOr InputXlaShape(absl::string_view name); + + // Returns true if all inputs are the same shape, otherwise sets the + // status to a non-OK value and returns false. + // Usage: if (!context->ValidateInputsAreSameShape(this)) return; + bool ValidateInputsAreSameShape(OpKernel* op) TF_MUST_USE_RESULT; + + // Returns the named list-valued immutable input in "list", as + // defined in the OpDef. If the named output is not list-valued, + // returns a one-element list. + Status InputList(absl::string_view name, std::vector* handles, + std::vector* shapes); + // Evaluates input and returns their dynamism vector in a vector of + // predicates. + Status ResolveInputDynamismIntoPredVector(int index, std::vector* out); + Status ResolveInputDynamismIntoPred(int index, bool* out); + Status ResolveInputDynamismIntoPredVector(absl::string_view name, + std::vector* out); + Status ResolveInputDynamismIntoPred(absl::string_view name, bool* out); + + Status ResolveInputDynamism(int index, xla::Literal* dynamism_literal); + Status ResolveInputDynamism(absl::string_view name, + xla::Literal* dynamism_literal); + + Status ResolveInputDynamismReshaped(int index, + absl::Span new_dims, + xla::Literal* dynamism_literal); + // Helper methods for constant inputs. + + // Evaluates input `index` and stores it in `*constant_literal`. If the + // expression cannot be evaluated, e.g., because it depends on unbound + // parameters, returns a non-OK status. This function can also be used to + // infer constant input upper or lower bounds, by changing the `mode` + // parameter. + Status ConstantInput( + int index, xla::Literal* constant_literal, + xla::ValueInferenceMode mode = xla::ValueInferenceMode::kValue); + Status ConstantInput( + absl::string_view name, xla::Literal* constant_literal, + xla::ValueInferenceMode mode = xla::ValueInferenceMode::kValue); + + // Converts a constant scalar int32 or int64 tensor into an int64. + Status ConstantInputAsIntScalar( + int index, int64_t* out, + xla::ValueInferenceMode mode = xla::ValueInferenceMode::kValue); + Status ConstantInputAsIntScalar( + absl::string_view name, int64_t* out, + xla::ValueInferenceMode mode = xla::ValueInferenceMode::kValue); + + StatusOr ConstantInputAsIntScalar( + absl::string_view name, + xla::ValueInferenceMode mode = xla::ValueInferenceMode::kValue); + + // Converts a constant scalar float32 or float64 tensor into a float64. + Status ConstantInputAsFloatScalar( + int index, double* out, + xla::ValueInferenceMode mode = xla::ValueInferenceMode::kValue); + + // Converts a constant 1D int32 or int64 tensor into a vector of int64s. + Status ConstantInputAsIntVector( + int index, std::vector* out, + xla::ValueInferenceMode mode = xla::ValueInferenceMode::kValue); + Status ConstantInputAsIntVector( + absl::string_view name, std::vector* out, + xla::ValueInferenceMode mode = xla::ValueInferenceMode::kValue); + + // Reshapes and converts a constant int32 or int64 tensor into a vector of + // int64s. + Status ConstantInputReshapedToIntVector( + int index, std::vector* out, + xla::ValueInferenceMode mode = xla::ValueInferenceMode::kValue); + Status ConstantInputReshapedToIntVector( + absl::string_view name, std::vector* out, + xla::ValueInferenceMode mode = xla::ValueInferenceMode::kValue); + + // Converts a constant int32 or int64 Tensor into an xla int64 Literal. + Status ConstantInputAsInt64Literal( + int index, xla::Literal* out, + xla::ValueInferenceMode mode = xla::ValueInferenceMode::kValue); + Status ConstantInputAsInt64Literal( + absl::string_view name, xla::Literal* out, + xla::ValueInferenceMode mode = xla::ValueInferenceMode::kValue); + + // Converts a constant 1D int32 or int64 tensor into a TensorShape. + Status ConstantInputAsShape( + int index, TensorShape* shape, + xla::ValueInferenceMode mode = xla::ValueInferenceMode::kValue); + + // Converts a constant 1D int32 or int64 tensor, or a scalar with value -1 + // into a PartialTensorShape. + Status ConstantInputAsPartialShape(int index, PartialTensorShape* shape); + + // Returns the named list-valued immutable input in "list", as + // defined in the OpDef. If the named output is not list-valued, + // returns a one-element list. + Status ConstantInputList( + absl::string_view name, std::vector* outputs, + xla::ValueInferenceMode mode = xla::ValueInferenceMode::kValue); + + // Returns the Tensor representation of the constant input. + StatusOr ConstantInputTensor( + int index, + xla::ValueInferenceMode mode = xla::ValueInferenceMode::kValue); + + // Returns an XlaExpression describing the value of 'index'. + const XlaExpression& InputExpression(int index); + const XlaExpression& InputExpression(absl::string_view name); + + // Outputs + + int num_outputs() const { return context_->num_outputs(); } + DataType expected_output_dtype(int index) const { + return context_->expected_output_dtype(index); + } + + // Returns the type of output `index` as an xla::PrimitiveType. If the type + // is not representable as an XLA type, sets an error status and returns + // xla::PRIMITIVE_TYPE_INVALID. + xla::PrimitiveType output_xla_type(int index); + + // Sets output `index` to the XlaOp `handle`. + // All outputs should be set using SetOutput and SetConstantOutput, not + // via the underlying OpKernelContext. + void SetOutput(int index, const xla::XlaOp& handle); + + // Sets output `index` to compile-time constant `host_tensor`, where + // `host_tensor` is a tensor in host memory. It is preferable to use + // SetConstantOutput where possible. + void SetConstantOutput(int index, const Tensor& host_tensor); + + // Returns an XlaExpression describing the value of 'index'. + void SetOutputExpression(int index, const XlaExpression& expression); + + // Sets output `index` to the Tensor List `handle`. + void SetTensorListOutput(int index, const xla::XlaOp& handle); + + // Status handling. + void SetStatus(const Status& status) { context_->SetStatus(status); } + Status status() { return context_->status(); } + + // Variables + + // Sets `*resource` to the resource associated with input `index`. + Status GetResourceInput(int index, XlaResource** resource); + + // Sets output `index` to be a reference to resource `resource`. + void SetResourceOutput(int index, XlaResource* resource); + + // Sets `*type` and `*shape` to the current type and shape of a variable's + // value. + Status GetVariableTypeAndShape(int index, DataType* type, + TensorShape* shape) const; + + // When dynamic_dimension_is_minus_one is set, querying a dynamic dimension + // returns "-1", this is useful when the underlying ops expect explicit + // dynamic index like reshape. + void set_dynamic_dimension_is_minus_one(bool value) { + dynamic_dimension_is_minus_one_ = value; + } + + bool dynamic_dimension_is_minus_one() const { + return dynamic_dimension_is_minus_one_; + } + + bool is_dynamic_dimension(int64_t dim_size) { return dim_size == -1; } + + // Reads the current value of the resource variable referred to by input + // `index`. If `shape` is not nullptr, sets `*shape` to the shape of the + // variable. Returns an error if the variable has not been initialized, or if + // its type does not match `type`. + Status ReadVariableInput(int index, DataType type, TensorShape* shape, + xla::XlaOp* value); + // Reads the current value of the resource variable referred to by input + // `name`. + Status ReadVariableInput(absl::string_view name, DataType type, + TensorShape* shape, xla::XlaOp* value); + + // Assigns the value `handle` to the variable referenced by input + // `input_index`. The variable must be of `type`. Returns an error if the + // variable has been initialized with a different type or with a + // different shape. + Status AssignVariable(int input_index, DataType type, xla::XlaOp handle); + // Assigns the value `handle` to the variable referenced by input `name`. + Status AssignVariable(absl::string_view name, DataType type, + xla::XlaOp handle); + + // Helper routines for the OP_REQUIRES macros + void CtxFailure(const Status& s); + void CtxFailureWithWarning(const Status& s); + void CtxFailure(const char* file, int line, const Status& s); + void CtxFailureWithWarning(const char* file, int line, const Status& s); + + // If this kernel invocation is within a function execution, + // call_frame() returns the call frame for the function call. + CallFrameInterface* call_frame() const { return context_->call_frame(); } + + FunctionLibraryRuntime* function_library() const { + return context_->function_library(); + } + + const OpKernel& op_kernel() const { return context_->op_kernel(); } + + // Returns the underlying OpKernelContext. Use rarely. + OpKernelContext* op_kernel_context() const { return context_; } + + // Returns the XlaCompiler that is performing the compilation. Used for, e.g., + // While to compile nested computations. + XlaCompiler* compiler() const; + + // TODO(phawkins): find a better home for these helpers. + + // Gets an XLA lambda to compute Max. This is cached in the + // XlaContext since it may be used by multiple Ops. There is a + // separate specialization of the computation for each DataType. + const xla::XlaComputation* GetOrCreateMax(const DataType type); + + // Gets an XLA lambda to compute Min. This is cached in the + // XlaContext since it may be used by multiple Ops. There is a + // separate specialization of the computation for each DataType. + const xla::XlaComputation* GetOrCreateMin(const DataType type); + + // Gets an XLA lambda to compute Add. This is cached in the + // XlaContext since it may be used by multiple Ops. There is a + // separate specialization of the computation for each DataType. + const xla::XlaComputation* GetOrCreateAdd(const DataType type); + + // Gets an XLA lambda to compute LogAddExp. This is cached in the + // XlaContext since it may be used by multiple Ops. There is a + // separate specialization of the computation for each DataType. + const xla::XlaComputation* GetOrCreateLogAddExp(const DataType type); + + // Gets an XLA lambda to compute Mul. This is cached in the + // XlaContext since it may be used by multiple Ops. There is a + // separate specialization of the computation for each DataType. + const xla::XlaComputation* GetOrCreateMul(const DataType type); + + // Returns stack trace encoded as a string at a given module, or an empty + // string if none found. + std::string StackTrace() const; + + private: + // Returns the tensor of input `name`. + const Tensor& GetInputTensorByName(absl::string_view name); + // Evaluates input `index`, reshapes it to `new_shape` if new_shape != + // InputShape(index), and stores it in `*constant_literal`. If the input + // cannot be evaluated, e.g., because it depends on unbound parameters, + // returns a non-Ok status. If InputShape(index).num_elements() != + // new_shape.num_elements(), returns an error status. + Status ConstantInputReshaped( + int index, absl::Span new_dims, + xla::Literal* constant_literal, + xla::ValueInferenceMode mode = xla::ValueInferenceMode::kValue); + + OpKernelContext* const context_; + bool dynamic_dimension_is_minus_one_; + xla::ValueInference value_inference_; +}; + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_TF2XLA_XLA_OP_KERNEL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/xla_op_registry.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/xla_op_registry.h new file mode 100644 index 0000000000000000000000000000000000000000..41fa4d2c3850e1c09aef6a02a2d02f9f01be3e67 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/xla_op_registry.h @@ -0,0 +1,431 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_TF2XLA_XLA_OP_REGISTRY_H_ +#define TENSORFLOW_COMPILER_TF2XLA_XLA_OP_REGISTRY_H_ + +#include +#include +#include +#include +#include + +#include "tensorflow/core/common_runtime/device_factory.h" +#include "tensorflow/core/common_runtime/local_device.h" +#include "tensorflow/core/framework/device_base.h" +#include "tensorflow/core/framework/tensor.h" +#include "tensorflow/core/framework/types.pb.h" +#include "tensorflow/core/lib/core/status.h" +#include "tensorflow/core/platform/mem.h" +#include "tensorflow/core/platform/mutex.h" +#include "tensorflow/core/platform/thread_annotations.h" +#include "tensorflow/core/public/session_options.h" + +namespace tensorflow { + +// Names of the XLA compilation devices. These are not user-visible, and are +// used internally by the Tensorflow/XLA bridge to perform symbolic execution of +// a Tensorflow graph. + +extern const char* const DEVICE_CPU_XLA_JIT; // "CPU_XLA_JIT" +extern const char* const DEVICE_GPU_XLA_JIT; // "GPU_XLA_JIT" + +extern const char* const DEVICE_XLA_CPU; +extern const char* const DEVICE_XLA_GPU; + +// Do not include DT_FLOAT8_* as float or numeric types since they are only +// supported in a very limited set of ops. +constexpr std::array kFloatTypes = { + {DT_HALF, DT_FLOAT, DT_DOUBLE, DT_BFLOAT16}}; +constexpr std::array kFloatAndComplexTypes = { + {DT_HALF, DT_FLOAT, DT_DOUBLE, DT_BFLOAT16, DT_COMPLEX64, DT_COMPLEX128}}; +constexpr std::array kNumericTypes = { + {DT_UINT8, DT_UINT16, DT_UINT32, DT_UINT64, DT_INT8, DT_INT16, DT_INT32, + DT_INT64, DT_HALF, DT_FLOAT, DT_DOUBLE, DT_COMPLEX64, DT_COMPLEX128, + DT_BFLOAT16}}; + +constexpr std::array kCpuAllTypes = { + {DT_UINT8, DT_QUINT8, DT_UINT16, DT_UINT32, DT_UINT64, + DT_INT8, DT_QINT8, DT_INT16, DT_INT32, DT_QINT32, + DT_INT64, DT_HALF, DT_FLOAT, DT_DOUBLE, DT_COMPLEX64, + DT_COMPLEX128, DT_BOOL, DT_BFLOAT16, DT_FLOAT8_E5M2, DT_FLOAT8_E4M3FN, + DT_INT4, DT_UINT4}}; + +constexpr std::array kGpuAllTypes = { + {DT_UINT8, DT_QUINT8, DT_UINT16, DT_UINT32, DT_UINT64, + DT_INT8, DT_QINT8, DT_INT16, DT_INT32, DT_QINT32, + DT_INT64, DT_HALF, DT_FLOAT, DT_DOUBLE, DT_COMPLEX64, + DT_COMPLEX128, DT_BOOL, DT_BFLOAT16, DT_FLOAT8_E5M2, DT_FLOAT8_E4M3FN, + DT_INT4, DT_UINT4}}; + +// Class that manages registrations of operators and devices for the XLA JIT. +// Not thread-safe. +class XlaOpRegistry { + public: + typedef OpKernel* (*Factory)(OpKernelConstruction*); + + enum class AutoclusteringPolicy { + // Enable autoclustering if the user requests it, e.g., via + // experimental_jit_scope. Does not autocluster if the JIT is enabled + // globally (e.g., via the OptimizerOptions in the TF session + // configuration.) + kIfExplicitlyRequested, + // Enable autoclustering if explicitly requested, or if the JIT is enabled + // globally in the session options, or via TF_XLA_FLAGS=--tf_xla_auto_jit=N. + kIfEnabledGlobally, + // Always try to autocluster ops placed on this device. + kAlways, + }; + + // Describes how to compile operators assigned to a device. + struct DeviceRegistration { + // The name of the an XLA compilation device to use to compile code. + string compilation_device_name; + + // When should we autocluster operators assigned to this device? + AutoclusteringPolicy autoclustering_policy; + + // If we should ignore the resource variable memory model when clustering + // resource variable reads and writes placed on this device. + bool cluster_resource_variable_ops_unsafely = false; + + // If we should auto-cluster Stack operations placed on this device. + bool cluster_stack_ops = false; + + // If we should auto-cluster TensorArray operations placed on this device. + bool cluster_tensor_array_ops = false; + + // If we should auto-cluster stateful RNG operations placed on this device. + // Stateful RNG semantics are not properly supported by XLA so it is not + // necessarily correct to auto-cluster stateful RNG ops in general. + bool cluster_stateful_rng_ops = false; + + // If we should auto-cluster ControlTrigger operations placed on this + // device. ControlTrigger operations are not necessarily safe to cluster + // since they affect deadness (a dead ControlTrigger produces a live + // output). + bool cluster_control_trigger = false; + + // If we should cluster Assert and CheckNumerics by eliding them (XLA does + // not natively support Assert or CheckNumerics). + bool elide_assert_and_checknumerics = false; + + // If we should cluster operations returning DT_VARIANT. + bool cluster_variant_ops = false; + + // Whether ops known to be slow should be auto-clustered. + bool cluster_slow_ops = false; + + // Whether ops known to have numerical accuracy issues should be + // auto-clustered. + bool cluster_inaccurate_ops = false; + }; + + // Registers an XLA backend. `compilation_device_name` is the name of the + // device used for symbolic execution during compilation. `supported_types` + // is the list of non-resource types supported by the device. Each operators + // will be registered for the intersection of the operator's supported types + // and the device's supported types. `backend_op_filter` is a function used + // to exclude or modify operator registrations on the device; it may be + // nullptr, in which case all ops are included. + // `backend_op_filter` should return true if the op should be registered on + // the device; it may optionally modify the KernelDef. + typedef bool (*BackendOpFilter)(KernelDef* kdef); + static void RegisterBackend(const string& compilation_device_name, + absl::Span supported_types, + BackendOpFilter op_filter); + + // Returns the names of the registered backends. + static std::vector BackendNames(); + + // Returns true iff a backend with the given name is registered. + static bool IsBackendRegistered(const string& name); + + // Registers `device_name` for XLA compilation, using information from + // `registration`. + // Does nothing if a registration for `device_name` already exists. + static void RegisterCompilationDevice(const string& device_name, + const DeviceRegistration& registration); + + // Returns whether the device name is for the JIT device used exclusively for + // TF2XLA conversion. + static bool IsCompilationDevice(const string& device_name); + + // Returns the JIT device name associated with 'device_name', setting + // 'jit_device_name', 'requires_jit', and 'enabled_jit_by_default', if they + // are not null. Returns false and leaves the outputs unchanged if no matching + // JIT device is registered. + // '*enable_jit_by_default' is set to true if we should try to JIT using this + // device when the JIT is enabled via the Session OptimizerOptions. + static bool GetCompilationDevice(const string& device_name, + const DeviceRegistration** registration); + + // Registers all JIT kernels on JIT devices, if not already registered. + // Does nothing otherwise. + static void RegisterCompilationKernels(); + + // Returns KernelDefs for compilation ops registered on + // 'compilation_device_name'. Does not include kernels registered as + // CompilationOnly, iff include_compilation_only_kernels=false. + static std::vector DeviceKernels( + const string& compilation_device_name, + bool include_compilation_only_kernels); + + // Returns all operations for which there are XLA kernels on any device. + static std::vector GetAllRegisteredOps(); + + // Returns (via `result`) the indices of inputs to `node_def` that must be + // compile-time constants. Returns an empty vector if the op is not + // registered. + // + // `result` is sorted. + static Status CompileTimeConstantInputs(const NodeDef& node_def, + const OpDef& op_def, + std::vector* result) { + return CompileTimeConstantInputs(node_def, /*op_kernel=*/nullptr, &op_def, + result); + } + + static StatusOr> CompileTimeConstantInputs( + const NodeDef& node_def, const OpDef& op_def) { + std::vector out; + TF_RETURN_IF_ERROR(CompileTimeConstantInputs(node_def, op_def, &out)); + return out; + } + + // Returns (via `result`) the indices of inputs to `op_kernel` that must be + // compile-time constants. + // + // `result` is sorted. + static Status CompileTimeConstantInputs(const OpKernel& op_kernel, + std::vector* result) { + return CompileTimeConstantInputs(op_kernel.def(), /*op_kernel=*/&op_kernel, + /*op_def=*/nullptr, result); + } + + // Return names of arguments for a given op which are supposed to be + // constants. + static const std::unordered_set* + CompileTimeConstantInputArgNames(const string& op); + + // Returns true if `op` is a "metadata" op, one that only looks at the shapes + // of its operands and not their values. + static bool IsMetadataOp(const string& op); + + private: + friend class XlaBackendRegistrar; + friend class XlaOpRegistrar; + friend class XlaOpRegistrationBuilder; + + static XlaOpRegistry& Instance(); + + XlaOpRegistry(); + ~XlaOpRegistry(); + + mutex mutex_; + + // Describes an XLA backend. + struct Backend { + // Which types are supported by this device? + std::set supported_types; + + // The per-backend operator filter function. See the comment on + // RegisterBackend() for details. + BackendOpFilter op_filter; + + // KernelDefs built by RegisterCompilationKernels() for each op supported + // by the device. + std::vector> kernel_defs; + }; + + // Map from compilation device names to a description of the backend. + std::unordered_map backends_ TF_GUARDED_BY(mutex_); + + // Map from Tensorflow device names to the corresponding JIT device metadata. + std::unordered_map compilation_devices_ + TF_GUARDED_BY(mutex_); + + // A description of a Tensorflow operator that can be compiled to XLA. + struct OpRegistration { + string name; + + // Should this operator be registered only on compilation devices, without a + // dummy kernel registered on the corresponding XLA device? + bool compilation_only = false; + + // Should we allow resource types for type attributes? Used by _Arg to + // allow DT_RESOURCE. + bool allow_resource_types = false; + + // Should we allow variant types for type attributes? Used by While to + // allow TensorList which is of type DT_VARIANT. + bool allow_variant_types = false; + + // Should we allow string type for type attributes? Used by PartitionedCall + // to allow DT_STRING. + bool allow_string_type = false; + + // Mapping from attribute name to a list of supported types. + std::unordered_map> type_constraints; + + // An optional allowlist of devices. If there is no allowlist, all devices + // are permitted. + bool has_device_allowlist = false; + std::unordered_set device_allowlist; + + // Names of arguments that must be compile-time constants. + std::unordered_set compile_time_constant_inputs; + + // True if this is a "metadata" op, one that only looks at the shapes of its + // operands and not their values. + bool is_metadata_op = false; + + std::string label; + + // Factory used to build OpKernels that perform symbolic execution. + Factory factory; + }; + + // Returns true if registrations x and y can both be added to the registry. + // This is always the case if they refer to different ops. If they refer to + // the same op name, they must: have the same values for compilation_only, + // allow_resource_types and allow_variant_types; use a device_allowlist; and + // their allowlists must not intersect. + static bool IsCompatible(const OpRegistration& x, const OpRegistration& y); + + static Status CompileTimeConstantInputs(const NodeDef& node_def, + const OpKernel* op_kernel, + const OpDef* op_def, + std::vector* result); + + // Map from operator name to OpRegistrations, populated by REGISTER_XLA_OP. + // Registrations present under the same key must satisfy IsCompatible above, + // and this is checked during registration. + std::unordered_map>> ops_ + TF_GUARDED_BY(mutex_); + + // Have we already registered the JIT kernels on the JIT devices? + bool jit_kernels_registered_ = false; + + // Holds ownership of OpKernelRegistrars that represent the Tensorflow kernel + // registrations created by RegisterCompilationKernels() and + // RegisterDeviceKernels(). + std::vector> + kernel_registrars_ TF_GUARDED_BY(mutex_); +}; + +// REGISTER_XLA_OP() registers an XLA OpKernel by name, for example: +// REGISTER_XLA_OP(Name("Add"), AddOp); +// where 'AddOp' is the name of a JIT OpKernel class that implements "Add". +// +// We don't use a variadic macro here because we don't expect JIT operators to +// be templated. + +#define REGISTER_XLA_OP(NAME, OP) \ + REGISTER_XLA_OP_UNIQ_HELPER(__COUNTER__, NAME, OP) + +#define REGISTER_XLA_CONV_OP(BUILDER, OP) \ + REGISTER_XLA_OP(BUILDER.TypeConstraint("T", GetXlaConvTypesForNonGpu()), OP) \ + REGISTER_XLA_OP(BUILDER.TypeConstraint("T", GetXlaConvTypesForGpu()) \ + .Device(DEVICE_GPU_XLA_JIT), \ + OP) + +class XlaOpRegistrationBuilder { + public: + // Starts an operator registration chain. + static XlaOpRegistrationBuilder Name(absl::string_view name); + + // Specifies a allowlist of devices on which the operator may run. + XlaOpRegistrationBuilder& Device(absl::string_view devices); + XlaOpRegistrationBuilder& Device(absl::Span devices); + + // Specifies a type constraint for a type variable attribute. Each constraint + // specifies the set of types that the type variable may assume. + XlaOpRegistrationBuilder& TypeConstraint(absl::string_view attr_name, + DataType allowed); + + XlaOpRegistrationBuilder& TypeConstraint(absl::string_view attr_name, + absl::Span allowed); + + // Specifies that a dummy copy of this operator should not be registered on + // XLA_* devices, but may be used during compilation. + XlaOpRegistrationBuilder& CompilationOnly(); + + // Allow DT_RESOURCE types for type parameters. + XlaOpRegistrationBuilder& AllowResourceTypes(); + + // Allow DT_VARIANT types for type parameters. + XlaOpRegistrationBuilder& AllowVariantTypes(); + + // Allow DT_STRING type for type parameters. + XlaOpRegistrationBuilder& AllowStringType(); + + // Mark 'input_name' as an argument whose value must be known at compile-time. + XlaOpRegistrationBuilder& CompileTimeConstantInput( + absl::string_view input_name); + + // Mark this op as a "metadata" op, one that only looks at the shapes of its + // operands and not their values. + XlaOpRegistrationBuilder& IsMetadataOp(); + + // Specifies a particular value for the "_kernel" attr. + XlaOpRegistrationBuilder& Label(std::string label); + + std::unique_ptr Build( + XlaOpRegistry::Factory factory); + + private: + XlaOpRegistrationBuilder(absl::string_view name); + + std::unique_ptr registration_; +}; + +// REGISTER_XLA_BACKEND() registers an XLA backend. Example usage: +// REGISTER_XLA_BACKEND(DEVICE_GPU_XLA_JIT, kGpuAllTypes, GpuOpFilter); +#define REGISTER_XLA_BACKEND(NAME, ...) \ + REGISTER_XLA_BACKEND_UNIQ_HELPER(__COUNTER__, NAME, __VA_ARGS__) + +// Implementation details. + +class XlaOpRegistrar { + public: + XlaOpRegistrar(std::unique_ptr registration); +}; + +#define REGISTER_XLA_OP_UNIQ_HELPER(COUNTER, BUILDER, OP) \ + REGISTER_XLA_OP_UNIQ(COUNTER, BUILDER, OP) + +#define REGISTER_XLA_OP_UNIQ(CTR, BUILDER, OP) \ + static ::tensorflow::XlaOpRegistrar xla_op_registrar__body__##CTR##__object( \ + ::tensorflow::XlaOpRegistrationBuilder::BUILDER.Build( \ + [](::tensorflow::OpKernelConstruction* context) \ + -> ::tensorflow::OpKernel* { return new OP(context); })); + +class XlaBackendRegistrar { + public: + XlaBackendRegistrar(absl::string_view name, absl::Span types, + XlaOpRegistry::BackendOpFilter op_filter = nullptr); +}; + +#define REGISTER_XLA_BACKEND_UNIQ_HELPER(COUNTER, NAME, ...) \ + REGISTER_XLA_BACKEND_UNIQ(COUNTER, NAME, __VA_ARGS__) + +#define REGISTER_XLA_BACKEND_UNIQ(CTR, NAME, ...) \ + static ::tensorflow::XlaBackendRegistrar \ + xla_backend_registrar__body__##CTR##__object(NAME, __VA_ARGS__); + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_TF2XLA_XLA_OP_REGISTRY_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/xla_resource.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/xla_resource.h new file mode 100644 index 0000000000000000000000000000000000000000..902c62edd5664ac262c301d701f056aea0530818 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/tf2xla/xla_resource.h @@ -0,0 +1,194 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef TENSORFLOW_COMPILER_TF2XLA_XLA_RESOURCE_H_ +#define TENSORFLOW_COMPILER_TF2XLA_XLA_RESOURCE_H_ + +#include + +#include "absl/strings/string_view.h" +#include "xla/client/xla_builder.h" +#include "xla/xla_data.pb.h" +#include "tensorflow/core/framework/tensor_shape.h" +#include "tensorflow/core/framework/types.pb.h" +#include "tensorflow/core/lib/core/status.h" +#include "tensorflow/core/util/managed_stack_trace.h" + +namespace tensorflow { + +// Represents a resource, such as a Variable or TensorArray. +class XlaResource { + public: + enum Kind { + kInvalid, + kVariable, + kTensorArray, + kStack, + }; + static absl::string_view KindToString(Kind kind); + + // Creates a new Stack resource. + static std::unique_ptr CreateStack(string name, DataType type, + int64_t max_size); + + // Creates a new TensorArray resource. + static std::unique_ptr CreateTensorArray( + string name, DataType type, TensorShape shape, xla::XlaOp initial_value, + int64_t max_array_size); + + XlaResource(Kind kind, int arg_num, string name, DataType type, + TensorShape shape, xla::XlaOp initial_value, + int64_t max_array_size, + const std::set& tensor_array_gradients, + bool tensor_array_multiple_writes_aggregate, + const std::optional& definition_stack_trace = + std::nullopt); + + XlaResource(const XlaResource&) = delete; + XlaResource(XlaResource&&) = delete; + XlaResource& operator=(const XlaResource&) = delete; + XlaResource& operator=(XlaResource&&) = delete; + + Kind kind() const { return kind_; } + + // If this resource is visible externally to the computation, what was its + // argument number? + // < 0 means "not visible externally". + int arg_num() const { return arg_num_; } + + // A descriptive name for the resource, used in error messages. + const string& name() const { return name_; } + + // Current type and value of the resource. Uninitialized resources are + // represented by a default (zero) handle and type DT_INVALID. + // While the type of a resource is notionally fixed during execution, when + // a resource is first initialized we do not yet know its type, so we keep + // track of its type dynamically. + DataType type() const { return type_; } + + // Shape of the resource. For an uninitialized resource, this is ignored. + // For a Variable, this is the shape of the value. For a TensorArray or Stack + // this is the shape of each entry in the TensorArray/Stack. + const TensorShape& shape() const { return shape_; } + + const xla::XlaOp& value() const { return value_; } + + // Value of the resource at computation entry. Used to detect which + // variables have new values that need to be written back. + const xla::XlaOp& initial_value() const { return initial_value_; } + + // An xla shape that indicates how this resource variable is represented on + // device. + const std::optional& representation_shape() const { + return representation_shape_; + } + + // A variable is initialized if it has a value. + bool initialized() const { return value_.valid(); } + + // Sets the type and shape of the resource. The type and shape of a resource + // must not change once the variable has been initialized. + Status SetTypeAndShape(DataType type, const TensorShape& shape); + + // Sets the current value of the resource. Returns an error if the type is not + // set to a valid value. + Status SetValue(const xla::XlaOp& value); + + // Sets the current value of the resource to an all-zero value. + Status SetZeroValue(xla::XlaBuilder* builder); + + // Sets the representational shape of the resource on device. + void SetRepresentationShape(const xla::Shape& shape) { + representation_shape_ = absl::make_optional(shape); + } + + // Looks up the gradient for `source`, or creates it if it does not already + // exist. The call target must be an initialized TensorArray resource. A + // TensorArray can have multiple named gradients; see the operator + // documentation for TensorArrayGradV3 for details. + Status GetOrCreateTensorArrayGradient(const string& source, + xla::XlaBuilder* builder, + XlaResource** gradient_out); + + // Packs a resource into a single XLA value `pack`, suitable for use as + // an XlaCompiler::Argument. For non-TensorArrays or TensorArrays without + // gradients, sets `*pack` to `value`. + // For TensorArrays with gradients, packs the value and its gradient values in + // a tuple; the gradients values are packed in order by source name. + Status Pack(xla::XlaOp* pack, xla::XlaBuilder* builder) const; + + // Updates the resource with values from `pack`. If `gradient_sources` is + // non-empty, treats `pack` as a tuple that represents a TensorArray and + // its gradients, and unpacks and updates the gradient resources. + // If `reset_initial_values` is true, sets the initial_values as well as the + // values. + // Opposite of Pack(). + Status SetFromPack(const std::set& gradient_sources, + const xla::XlaOp& pack, xla::XlaBuilder* builder); + + bool IsOverwritten() { return is_overwritten_; } + + // TensorArray and Stack specific fields + // TODO(phawkins): refactor this code to use subclasses, rather than putting + // kind-specific fields in XlaResource. + + // 'max_array_size' stores the expected size of the TensorArray or Stack. + // We need to store this since sometimes TensorArrays must be initialized + // lazily since we do not know the element shape at construction time. + // Used by both TensorArrays and Stacks. + int64_t max_array_size() const { return max_array_size_; } + void set_max_array_size(int64_t size) { max_array_size_ = size; } + + bool tensor_array_multiple_writes_aggregate() const { + return tensor_array_multiple_writes_aggregate_; + } + + // 'tensor_array_gradient' is a map from TensorArrayGradV3 'source' attributes + // to an XlaResource containing the gradient TensorArrays. We store a pointer + // here since there should only be one gradient TensorArray per 'source' + // string, irrespective of the number of calls to TensorArrayGrad. The map + // is ordered since values are packed into tuples by Pack() sorted by name + // order. + const std::map>& tensor_array_gradients() + const { + return tensor_array_gradients_; + } + + private: + const Kind kind_; + const int arg_num_; + const string name_; + + DataType type_; + TensorShape shape_; + xla::XlaOp value_; + xla::XlaOp initial_value_; + + // An xla shape that indicates how this resource variable is represented on + // device. + std::optional representation_shape_; + + int64_t max_array_size_ = -1; + bool tensor_array_multiple_writes_aggregate_ = false; + + std::map> tensor_array_gradients_; + bool is_overwritten_ = false; + + std::optional definition_stack_trace_; +}; + +} // namespace tensorflow + +#endif // TENSORFLOW_COMPILER_TF2XLA_XLA_RESOURCE_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/array.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/array.h new file mode 100644 index 0000000000000000000000000000000000000000..93c956beaeff8a6f5c484f4322289713fff53be7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/array.h @@ -0,0 +1,702 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_ARRAY_H_ +#define XLA_ARRAY_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "absl/functional/function_ref.h" +#include "absl/strings/str_cat.h" +#include "absl/types/span.h" +#include "xla/status.h" +#include "xla/types.h" + +namespace xla { + +namespace array_impl { + +template +using overload_for_float = std::enable_if_t< + is_specialized_floating_point_v && std::is_same::value, bool>; + +// A type trait that is valid when all elements in a parameter pack are of +// integral type. Not using an alias template to work around MSVC 14.00 bug. +template +struct pack_is_integral : std::conjunction...> {}; + +// Compares three same-sized vectors elementwise. For each item in `values`, +// returns false if any of values[i] is outside the half-open range [starts[i], +// ends[i]). +template +bool all_inside_range(const C1& values, const C2& range_starts, + const C3& range_ends) { + for (size_t i = 0, e = values.size(); i < e; ++i) { + if (values[i] < range_starts[i] || values[i] >= range_ends[i]) { + return false; + } + } + return true; +} + +} // namespace array_impl + +// General N dimensional array class with arbitrary value type. +template +class Array { + public: + // Type inference can have a hard time parsing very deep initializer list + // nests, especially if one or more dimensions is one as the compiler just + // sees a single-element integer initializer. These typedefs allow casting + // explicitly with less typing. + template + using InitializerList1D = std::initializer_list; + template + using InitializerList2D = std::initializer_list>; + template + using InitializerList3D = std::initializer_list>; + template + using InitializerList4D = std::initializer_list>; + + using value_type = T; + + // Creates a new array with the specified dimensions and initialized elements. + explicit Array(absl::Span sizes) + : sizes_(sizes.size()), + values_(calculate_elements(sizes), default_init_t{}) { + std::memcpy(sizes_.data.get(), sizes.data(), + sizeof(int64_t) * sizes.size()); + } + + // Creates a new array with the specified dimensions and specified value for + // every cell. + Array(absl::Span sizes, T value) + : Array(sizes, no_default_init_t{}) { + Fill(value); + } + + // Creates a 2D array from the given nested initializer list. The outer + // initializer list is the first dimension, the inner is the second dimension. + // For example, {{1, 2, 3}, {4, 5, 6}} results in an array with n1=2 and n2=3. + Array(InitializerList2D values) + : Array(ToInt64Array(values), no_default_init_t{}) { + int64_t idx = 0; + for (const auto& it1 : values) { + for (const auto& it2 : it1) { + values_[idx] = it2; + ++idx; + } + } + CHECK(idx == num_elements()); + } + + // Creates a 1D array of a floating-point type (half, bfloat16, float, + // or double) from an initializer list of float values. + template = true> + Array(std::initializer_list values) + : Array(ToInt64Array(values), no_default_init_t{}) { + int64_t idx = 0; + for (const auto& it1 : values) { + values_[idx] = static_cast(it1); + ++idx; + } + CHECK(idx == num_elements()); + } + + // Creates a 2D array of a floating-point type (float8, half, bfloat16, float, + // or double) from an initializer list of float values. + template = true> + Array(std::initializer_list> values) + : Array(ToInt64Array(values), no_default_init_t{}) { + int64_t idx = 0; + for (const auto& it1 : values) { + for (const auto& it2 : it1) { + values_[idx] = static_cast(it2); + ++idx; + } + } + CHECK(idx == num_elements()); + } + + // Creates a 3D array from the given nested initializer list. The outer + // initializer list is the first dimension, and so on. + Array(InitializerList3D values) + : Array(ToInt64Array(values), no_default_init_t{}) { + int64_t idx = 0; + for (const auto& it1 : values) { + for (const auto& it2 : it1) { + for (const auto& it3 : it2) { + values_[idx] = it3; + ++idx; + } + } + } + CHECK(idx == num_elements()); + } + + // Creates a 3D array of a floating-point type (half, bfloat16, float, + // or double) from an initializer list of float values. + template = true> + Array(std::initializer_list>> + values) + : Array(ToInt64Array(values), no_default_init_t{}) { + int64_t idx = 0; + for (const auto& it1 : values) { + for (const auto& it2 : it1) { + for (const auto& it3 : it2) { + values_[idx] = static_cast(it3); + ++idx; + } + } + } + CHECK(idx == num_elements()); + } + + // Creates a 4D array from the given nested initializer list. The outer + // initializer list is the first dimension, and so on. + Array(InitializerList4D values) + : Array(ToInt64Array(values), no_default_init_t{}) { + int64_t idx = 0; + for (const auto& it1 : values) { + for (const auto& it2 : it1) { + for (const auto& it3 : it2) { + for (const auto& it4 : it3) { + values_[idx] = it4; + ++idx; + } + } + } + } + CHECK(idx == num_elements()); + } + + // Creates a 4D array of a floating-point type (half, bfloat16, float, + // or double) from an initializer list of float values. + template = true> + Array(std::initializer_list< + std::initializer_list>>> + values) + : Array(ToInt64Array(values), no_default_init_t{}) { + int64_t idx = 0; + for (const auto& it1 : values) { + for (const auto& it2 : it1) { + for (const auto& it3 : it2) { + for (const auto& it4 : it3) { + values_[idx] = static_cast(it4); + ++idx; + } + } + } + } + CHECK(idx == num_elements()); + } + + Array(const Array& other) + : sizes_(other.sizes_.Clone()), values_(other.values_.Clone()) {} + + Array(Array&& other) = default; + + Array& operator=(const Array& other) { + sizes_ = other.sizes_.Clone(); + values_ = other.values_.Clone(); + return *this; + } + + Array& operator=(Array&& other) = default; + + // Fills the array with the specified value. + void Fill(const T& value) { std::fill(begin(), end(), value); } + + // Fills the array with sequentially increasing values. + void FillIota(const T& value) { std::iota(begin(), end(), value); } + + // Fills the array with a repeating sequence: + // [value, value + 1, ..., value + length - 1, value, ... ] + void FillRepeatedIota(const T& value, int64_t length) { + for (int64_t i = 0; i < num_elements(); i += length) { + std::iota(begin() + i, begin() + std::min(i + length, num_elements()), + value); + } + } + + // Fills the array with the sequence i*multiplier for i=0,1,... + void FillWithMultiples(const T& multiplier) { + for (int64_t i = 0; i < num_elements(); ++i) { + values_[i] = static_cast(i) * multiplier; + } + } + + // Fills the array with random normal variables with the specified mean. + void FillRandom(const T& stddev, double mean = 0.0, int seed = 12345) { + FillRandomDouble(static_cast(stddev), mean, seed); + } + + void FillRandomDouble(double stddev, double mean = 0.0, int seed = 12345) { + std::mt19937 g(seed); + std::normal_distribution distribution(mean, stddev); + for (int64_t i = 0; i < num_elements(); ++i) { + if (std::is_same()) { + values_[i] = static_cast(distribution(g) > 0.0); + } else { + values_[i] = static_cast(distribution(g)); + } + } + } + + // Fills the array with random uniform variables in the [min_value, max_value] + // range. Defined for integral types. + template ::value>> + void FillRandomUniform(const T& min_value, const T& max_value, + int seed = 12345) { + std::mt19937 g(seed); + std::uniform_int_distribution distribution(min_value, max_value); + for (int64_t i = 0; i < num_elements(); ++i) { + values_[i] = static_cast(distribution(g)); + } + } + + // Fills the array with random uniform variables that's either True or False. + // Defined for boolean type. + void FillRandomBool(int seed = 12345) { + std::mt19937 g(seed); + std::uniform_int_distribution distribution(0, 1); + for (int64_t i = 0; i < num_elements(); ++i) { + values_[i] = static_cast(distribution(g)); + } + } + + // Sets all the values in the array to values specified in the container. + template > + void SetValues(const Container& container) { + CHECK_EQ(std::distance(std::begin(container), std::end(container)), + num_elements()); + std::copy(std::begin(container), std::end(container), begin()); + } + + // Invokes a callback with the (indices, value_ptr) for each cell in the + // array. + void Each(absl::FunctionRef, T*)> f) { + OwnedBuffer index(sizes_.size, default_init_t{}); + for (int64_t i = 0; i < num_elements(); ++i, next_index(&index)) { + f(index.span(), &values_[i]); + } + } + + // Invokes a callback with the (indices, value) for each cell in the array. + void Each(absl::FunctionRef, T)> f) const { + OwnedBuffer index(sizes_.size, default_init_t{}); + for (int64_t i = 0; i < num_elements(); ++i, next_index(&index)) { + f(index.span(), values_[i]); + } + } + + // Invokes a callback with the (indices, value_ptr) for each cell in the + // array. If a callback returns a non-OK status, returns that else returns + // OkStatus(). + Status EachStatus( + absl::FunctionRef, T*)> f) { + OwnedBuffer index(sizes_.size, default_init_t{}); + for (int64_t i = 0; i < num_elements(); ++i, next_index(&index)) { + Status s = f(index.span(), &values_[i]); + if (!s.ok()) { + return s; + } + } + return OkStatus(); + } + + // Invokes a callback with the (indices, value) for each cell in the array. + // If a callback returns a non-OK status, returns that else returns + // OkStatus(). + Status EachStatus( + absl::FunctionRef, T)> f) const { + OwnedBuffer index(sizes_.size, default_init_t{}); + for (int64_t i = 0; i < num_elements(); ++i, next_index(&index)) { + Status s = f(index.span(), values_[i]); + if (!s.ok()) { + return s; + } + } + return OkStatus(); + } + + // Returns the value at the cell specified by the indexes. The number of + // arguments have to match with the number of dimensions for the array. + // + // The type trait is required to avoid this overload participating too + // eagerly; a parameter pack can take zero or more elements, so we must + // restrict this to only parameter packs that are all of integral type. + template + typename std::enable_if::value, + const T&>::type + operator()(Dims... dims) const { + CHECK_EQ(sizeof...(dims), num_dimensions()); + // We are using a std::array to avoid having to allocate memory in this + // function for performance reasons. + std::array indexes{ + {static_cast(dims)...}}; + return values_[calculate_index(indexes)]; + } + + // Returns the value at the cell specified by the indexes. The number of + // arguments have to match with the number of dimensions for the array. + template + typename std::enable_if::value, + T&>::type + operator()(Dims... dims) { + return const_cast(const_cast(this)->operator()( + std::forward(dims)...)); + } + + // Returns the value at the cell specified by the indexes. The number of + // arguments have to match with the number of dimensions for the array. + const T& operator()(absl::Span indexes) const { + CHECK_EQ(indexes.size(), num_dimensions()); + return values_[calculate_index(indexes)]; + } + + // Returns the value at the cell specified by the indexes. The number of + // arguments have to match with the number of dimensions for the array. + T& operator()(absl::Span indexes) { + return const_cast(const_cast(this)->operator()(indexes)); + } + + // Low-level accessor for stuff like memcmp, handle with care. Returns pointer + // to the underlying storage of the array (similarly to std::vector::data()). + T* data() const { + // TODO(tberghammer): Get rid of the const_cast. Currently it is needed + // because the Eigen backend needs a non-const pointers even for reading + // from the array. + return const_cast(this)->values_.data.get(); + } + + // Returns the size of the dimension at the given index. + int64_t dim(int64_t n) const { + DCHECK_LT(n, sizes_.size); + return sizes_[n]; + } + + // Returns a vector containing the dimensions of the array. + absl::Span dimensions() const { return sizes_.span(); } + + int64_t num_dimensions() const { return sizes_.size; } + + // Returns the total number of elements in the array. + int64_t num_elements() const { return values_.size; } + + const T* begin() const { return values_.data.get(); } + T* begin() { return values_.data.get(); } + const T* end() const { return values_.data.get() + num_elements(); } + T* end() { return values_.data.get() + num_elements(); } + + bool operator==(const Array& other) const { + if (sizes_.size != other.sizes_.size) { + return false; + } + for (int64_t i = 0, end = sizes_.size; i < end; ++i) { + if (sizes_[i] != other.sizes_[i]) { + return false; + } + } + for (int64_t i = 0; i < num_elements(); ++i) { + if (values_[i] != other.values_[i]) { + return false; + } + } + return true; + } + + bool operator!=(const Array& other) const { return !(*this == other); } + + // Performs the equivalent of a slice operation on this array. + Array Slice(absl::Span starts, + absl::Span limits) const { + CHECK_EQ(starts.size(), num_dimensions()); + CHECK_EQ(limits.size(), num_dimensions()); + + OwnedBuffer sizes(starts.size()); + for (int64_t i = 0; i < starts.size(); ++i) { + sizes[i] = limits[i] - starts[i]; + } + Array result(sizes.span()); + + OwnedBuffer index(sizes_.size, default_init_t{}); + int64_t slice_i = 0; + for (int64_t i = 0; i < num_elements(); ++i, next_index(&index)) { + if (array_impl::all_inside_range(index.span(), starts, limits)) { + // Even though the bounds of result are different to our bounds, we're + // iterating in the same order. So we can simply write successive linear + // indices instead of recalculating a multi-dimensional index. + result.values_[slice_i++] = values_[i]; + } + } + return result; + } + + // Performs the equivalent of a DynamicUpdateSlice in-place on this array. + void UpdateSlice(const Array& from, + absl::Span start_indices) { + CHECK_EQ(from.num_dimensions(), num_dimensions()); + OwnedBuffer limit_indices(start_indices.size()); + for (int64_t i = 0; i < start_indices.size(); ++i) { + limit_indices[i] = from.sizes_[i] + start_indices[i]; + } + OwnedBuffer index(sizes_.size, default_init_t{}); + int64_t from_i = 0; + for (int64_t i = 0; i < num_elements(); ++i, next_index(&index)) { + if (array_impl::all_inside_range(index.span(), start_indices, + limit_indices)) { + // Even though the bounds of from are different to our bounds, we're + // iterating in the same order. So we can simply write successive linear + // indices instead of recalculating a multi-dimensional index. + values_[i] = from.values_[from_i++]; + } + } + } + + // Performs an in-place reshape, modifying the dimensions but not the + // underlying data. + void Reshape(absl::Span new_dimensions) { + const int64_t new_num_elements = + std::accumulate(new_dimensions.begin(), new_dimensions.end(), 1LL, + std::multiplies()); + CHECK_EQ(new_num_elements, num_elements()); + if (sizes_.size != new_dimensions.size()) { + sizes_ = OwnedBuffer(new_dimensions.size()); + } + std::memcpy(sizes_.data.get(), new_dimensions.data(), + new_dimensions.size() * sizeof(int64_t)); + } + + // Performs a permutation of dimensions. + void TransposeDimensions(absl::Span permutation) { + return TransposeDimensionsImpl(permutation); + } + void TransposeDimensions(absl::Span permutation) { + return TransposeDimensionsImpl(permutation); + } + void TransposeDimensions(std::initializer_list permutation) { + return TransposeDimensionsImpl(permutation); + } + template >* = nullptr> + void TransposeDimensionsImpl(absl::Span permutation) { + CHECK_EQ(sizes_.size, permutation.size()); + OwnedBuffer permuted_dims(permutation.size()); + for (int64_t i = 0; i < permutation.size(); ++i) { + permuted_dims[i] = this->dim(permutation[i]); + } + Array permuted(permuted_dims.span()); + OwnedBuffer src_indices(sizes_.size, -1); + permuted.Each([&](absl::Span indices, T* value) { + for (int64_t i = 0; i < sizes_.size; ++i) { + src_indices[permutation[i]] = indices[i]; + } + *value = (*this)(src_indices.span()); + }); + *this = std::move(permuted); + } + + template + friend H AbslHashValue(H h, const Array& array) { + return H::combine(std::move(h), array.values_.span(), array.dimensions()); + } + + // Returns a string representation of the array suitable for debugging. + std::string ToString() const { + if (sizes_.size == 0) { + return ""; + } + std::string result; + OwnedBuffer index(sizes_.size, default_init_t{}); + do { + // Emit leading spaces and opening square brackets + if (index[index.size - 1] == 0) { + for (int64_t i = sizes_.size - 1; i >= 0; --i) { + if (i == 0 || index[i - 1] != 0) { + for (int64_t j = 0; j < sizes_.size; ++j) { + absl::StrAppend(&result, j < i ? " " : "["); + } + break; + } + } + } + int value_index = calculate_index(index.span()); + if (value_index < num_elements()) { + absl::StrAppend(&result, values_[value_index]); + } + + // Emit comma if it isn't the last element + if (index[index.size - 1] < sizes_[sizes_.size - 1] - 1) { + absl::StrAppend(&result, ", "); + } + + // Emit closing square brackets + for (int64_t i = sizes_.size - 1; i >= 0; --i) { + if (index[i] < sizes_[i] - 1) { + break; + } + absl::StrAppend(&result, "]"); + if (i != 0 && index[i - 1] < sizes_[i - 1] - 1) { + absl::StrAppend(&result, ",\n"); + } + } + } while (next_index(&index)); + return result; + } + + private: + struct default_init_t {}; + struct no_default_init_t {}; + // A fixed sized dynamically allocated buffer to replace std::vector usage. It + // saves one word for storing capacity which is always the same as size and it + // provides the ability to leave its elements uninitialized if the element + // type is trivially destructible. + template + struct OwnedBuffer { + explicit OwnedBuffer(size_t size) + : data(std::is_trivially_destructible_v ? new D[size] + : new D[size]()), + size(size) {} + explicit OwnedBuffer(size_t size, default_init_t) + : data(new D[size]()), size(size) {} + + explicit OwnedBuffer(size_t size, D init) : OwnedBuffer(size) { + std::fill(data.get(), data.get() + size, init); + } + + OwnedBuffer(OwnedBuffer&& other) + : data(std::move(other.data)), size(other.size) { + other.size = 0; + } + + OwnedBuffer& operator=(OwnedBuffer&& other) { + data = std::move(other.data); + size = other.size; + other.size = 0; + return *this; + } + + OwnedBuffer Clone() const { + OwnedBuffer clone(size); + std::memcpy(clone.data.get(), data.get(), size * sizeof(D)); + return clone; + } + + D& operator[](int64_t index) { return data[index]; } + const D& operator[](int64_t index) const { return data[index]; } + + absl::Span span() const { + return absl::MakeConstSpan(data.get(), size); + } + + std::unique_ptr data; + size_t size; + }; + + explicit Array(absl::Span sizes, no_default_init_t) + : sizes_(sizes.size()), values_(calculate_elements(sizes)) { + std::memcpy(sizes_.data.get(), sizes.data(), + sizeof(int64_t) * sizes.size()); + } + + // Extracts the dimensions of an initializer_list to an array type int64_t. + // Used by the initializer list based constructors to convert the size type + // into int64_t to be passed to the size based constructor. + template + static std::array ToInt64Array(const InitializerList1D& data) { + return std::array{static_cast(data.size())}; + } + + template + static std::array ToInt64Array(const InitializerList2D& data) { + return std::array{static_cast(data.size()), + static_cast(data.begin()->size())}; + } + + template + static std::array ToInt64Array(const InitializerList3D& data) { + return std::array{ + static_cast(data.size()), + static_cast(data.begin()->size()), + static_cast(data.begin()->begin()->size())}; + } + + template + static std::array ToInt64Array(const InitializerList4D& data) { + return std::array{ + static_cast(data.size()), + static_cast(data.begin()->size()), + static_cast(data.begin()->begin()->size()), + static_cast(data.begin()->begin()->begin()->size())}; + } + + // Returns the linear index from the list of per-dimension indexes. Function + // is templated so can be used with an std::array from operator() to avoid + // memory allocation. + // The returned value may be larger than or equal to the number of elements if + // the indexes exceed the array's corresponding dimension size. + int64_t calculate_index(absl::Span indexes) const { + DCHECK_EQ(sizes_.size, indexes.size()); + int64_t index = 0; + for (int64_t i = 0; i < sizes_.size; ++i) { + index *= sizes_[i]; + index += indexes[i]; + } + return index; + } + + // Advances the specified set of indexes and returns true if we haven't + // wrapped around (i.e. result isn't {0, 0, ...}). + bool next_index(OwnedBuffer* index) const { + DCHECK_EQ(index->size, sizes_.size); + for (int64_t i = sizes_.size - 1; i >= 0; --i) { + (*index)[i]++; + if ((*index)[i] < sizes_[i]) { + return true; + } + (*index)[i] = 0; + } + return false; + } + + static size_t calculate_elements(absl::Span sizes) { + return std::accumulate(sizes.begin(), sizes.end(), 1LL, + std::multiplies()); + } + + OwnedBuffer sizes_; + OwnedBuffer values_; +}; + +// Specialization of FillRandom() method for complex64 type. Uses real part of +// the stddev parameter as the standard deviation value. +template <> +void Array::FillRandom(const complex64& stddev, double mean, + int seed); + +} // namespace xla + +#endif // XLA_ARRAY_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/array2d.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/array2d.h new file mode 100644 index 0000000000000000000000000000000000000000..8f86c09d4fc37dd0f73b0a80c446889a72ff0def --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/array2d.h @@ -0,0 +1,112 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_ARRAY2D_H_ +#define XLA_ARRAY2D_H_ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "absl/functional/function_ref.h" +#include "absl/strings/str_cat.h" +#include "xla/array.h" +#include "xla/types.h" +#include "xla/util.h" + +namespace xla { + +template +class Array2D : public Array { + public: + Array2D() : Array(std::vector{0, 0}) {} + + Array2D(const int64_t n1, const int64_t n2) + : Array(std::vector{n1, n2}) {} + + Array2D(const int64_t n1, const int64_t n2, const T value) + : Array({n1, n2}, value) {} + + // Creates an array from the given nested initializer list. The outer + // initializer list is the first dimension; the inner is the second dimension. + // For example, {{1, 2, 3}, {4, 5, 6}} results in an array with n1=2 and n2=3. + Array2D(std::initializer_list> values) + : Array(values) {} + + // Creates an array of a floating-point type (float8, half, bfloat16, float, + // or double) from the given nested initializer list of float values. + template = true> + Array2D(std::initializer_list> values) + : Array(values) {} + + Array2D(const Array2D& other) : Array(other) {} + + int64_t n1() const { return this->dim(0); } + int64_t n2() const { return this->dim(1); } + + int64_t height() const { return this->dim(0); } + int64_t width() const { return this->dim(1); } + + // Fills the array with a pattern of values of the form: + // + // (rowno << log2ceil(width) | colno) + start_value + // + // This makes it easy to see distinct row/column values in the array. + void FillUnique(T start_value = 0) { + int shift = Log2Ceiling(n2()); + for (int64_t i0 = 0; i0 < n1(); ++i0) { + for (int64_t i1 = 0; i1 < n2(); ++i1) { + (*this)(i0, i1) = ((i0 << shift) | i1) + start_value; + } + } + } + + // Applies f to all cells in this array, in row-major order. + void Each(absl::FunctionRef f) { + for (int64_t i0 = 0; i0 < n1(); ++i0) { + for (int64_t i1 = 0; i1 < n2(); ++i1) { + f(i0, i1, &(*this)(i0, i1)); + } + } + } +}; + +// Returns a linspace-populated Array2D in the range [from, to] (inclusive) +// with dimensions n1 x n2. +template +std::unique_ptr> MakeLinspaceArray2D(double from, double to, + int64_t n1, int64_t n2) { + auto array = std::make_unique>(n1, n2); + int64_t count = n1 * n2; + NativeT step = + static_cast((count > 1) ? (to - from) / (count - 1) : 0); + auto set = [&array, n2](int64_t index, NativeT value) { + (*array)(index / n2, index % n2) = value; + }; + for (int64_t i = 0; i < count - 1; ++i) { + set(i, (static_cast(from) + + static_cast(i) * static_cast(step))); + } + set(count - 1, static_cast(to)); + return array; +} +} // namespace xla + +#endif // XLA_ARRAY2D_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/array3d.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/array3d.h new file mode 100644 index 0000000000000000000000000000000000000000..6c8b81d165ec10292badd180be1dd54cbb10a66c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/array3d.h @@ -0,0 +1,73 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_ARRAY3D_H_ +#define XLA_ARRAY3D_H_ + +#include +#include +#include +#include +#include +#include +#include + +#include "xla/array.h" +#include "xla/types.h" +#include "tsl/platform/logging.h" + +namespace xla { + +// Simple 3D array structure. +template +class Array3D : public Array { + public: + Array3D() : Array(std::vector{0, 0, 0}) {} + + // Creates an array of dimensions n1 x n2 x n3, uninitialized values. + Array3D(const int64_t n1, const int64_t n2, const int64_t n3) + : Array(std::vector{n1, n2, n3}) {} + + // Creates an array of dimensions n1 x n2 x n3, initialized to value. + Array3D(const int64_t n1, const int64_t n2, const int64_t n3, const T value) + : Array(std::vector{n1, n2, n3}, value) {} + + // Creates an array from the given nested initializer list. The outer + // initializer list is the first dimension, and so on. + // + // For example {{{1, 2}, {3, 4}, {5, 6}, {7, 8}}, + // {{9, 10}, {11, 12}, {13, 14}, {15, 16}}, + // {{17, 18}, {19, 20}, {21, 22}, {23, 24}}} + // results in an array with n1=3, n2=4, n3=2. + Array3D(std::initializer_list>> + values) + : Array(values) {} + + // Creates an array of a floating-point type (half, bfloat16, float, + // or double) from the given nested initializer list of float values. + template = true> + Array3D( + std::initializer_list>> + values) + : Array(values) {} + + int64_t n1() const { return this->dim(0); } + int64_t n2() const { return this->dim(1); } + int64_t n3() const { return this->dim(2); } +}; + +} // namespace xla + +#endif // XLA_ARRAY3D_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/array4d.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/array4d.h new file mode 100644 index 0000000000000000000000000000000000000000..0b4549dd0a85909f5fa86e89fc50e0baffadb1a9 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/array4d.h @@ -0,0 +1,170 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_ARRAY4D_H_ +#define XLA_ARRAY4D_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "absl/strings/str_cat.h" +#include "absl/types/span.h" +#include "xla/array.h" +#include "xla/array2d.h" +#include "xla/types.h" +#include "tsl/platform/logging.h" + +namespace xla { + +// Simple 4D array structure, similar in form to Array2D, for use primarily in +// testing and describing to XLA APIs values in the 4D array structures used +// in convolutions. +// +// The data layout is, in order from major to minor: +// +// First dimension: plane, batch, n1 +// Second dimension: depth, feature, z, n2 +// Third dimension: height, y, n3 +// Fourth dimension: width, x, n4 +// +// These dimensions are referred to by various names, so that is why +// more than one name is given above. See operator() for the exact +// calculation of 1d indices from 4d indices. +template +class Array4D : public Array { + public: + Array4D() : Array(std::vector{0, 0, 0, 0}) {} + + // Creates a 4D array, uninitialized values. + Array4D(int64_t planes, int64_t depth, int64_t height, int64_t width) + : Array(std::vector{planes, depth, height, width}) {} + + // Creates a 4D array, initialized to value. + Array4D(int64_t planes, int64_t depth, int64_t height, int64_t width, T value) + : Array(std::vector{planes, depth, height, width}, value) {} + + // Creates a 4D array, filled with values. + // + // We need to set a default type for Container so that code like + // Array4D(1, 1, 1, 1, {1}) will work. The template cannot infer the + // initializer_list type in that case without this default. + template > + Array4D(int64_t planes, int64_t depth, int64_t height, int64_t width, + const Container& values) + : Array4D(planes, depth, height, width) { + this->SetValues(values); + } + + // Construct an Array4D with the given nested initializer list. + Array4D(std::initializer_list>>> + values) + : Array(values) {} + + // Creates an array of a floating-point type (half, bfloat16, float, + // or double) from the given nested initializer list of float values. + template = true> + Array4D(std::initializer_list>>> + values) + : Array(values) {} + + // Numerically-named aliases for the various dimensions. This matches the + // dimension names used in array3d. + int64_t n4() const { return this->dim(3); } + int64_t n3() const { return this->dim(2); } + int64_t n2() const { return this->dim(1); } + int64_t n1() const { return this->dim(0); } + + int64_t width() const { return this->dim(3); } + int64_t height() const { return this->dim(2); } + int64_t depth() const { return this->dim(1); } + int64_t planes() const { return this->dim(0); } + + // Fills all of the {p,z} with the array provided, which specifies {y,x}. + void FillWithYX(const Array2D& value) { + CHECK_EQ(value.height(), height()); + CHECK_EQ(value.width(), width()); + for (int64_t plane = 0; plane < planes(); ++plane) { + for (int64_t depth = 0; depth < this->depth(); ++depth) { + for (int64_t height = 0; height < this->height(); ++height) { + for (int64_t width = 0; width < this->width(); ++width) { + (*this)(plane, depth, height, width) = value(height, width); + } + } + } + } + } + + // Fills all of the {p,x} with the array provided, which specifies {z,y}. + void FillWithZY(const Array2D& value) { + CHECK_EQ(value.height(), depth()); + CHECK_EQ(value.width(), height()); + for (int64_t plane = 0; plane < planes(); ++plane) { + for (int64_t depth = 0; depth < this->depth(); ++depth) { + for (int64_t height = 0; height < this->height(); ++height) { + for (int64_t width = 0; width < this->width(); ++width) { + (*this)(plane, depth, height, width) = value(depth, height); + } + } + } + } + } + + // Fills all of the {x,y} with the array provided, which specifies {p,z}. + void FillWithPZ(const Array2D& value) { + CHECK_EQ(value.height(), planes()); + CHECK_EQ(value.width(), depth()); + for (int64_t height = 0; height < this->height(); ++height) { + for (int64_t width = 0; width < this->width(); ++width) { + for (int64_t plane = 0; plane < planes(); ++plane) { + for (int64_t depth = 0; depth < this->depth(); ++depth) { + (*this)(plane, depth, height, width) = value(plane, depth); + } + } + } + } + } + + // Fills each of the minor-dim matrices with a number designating which minor + // dim matrix is enclosed by the shape. + void FillWithMinorDimNum() { + LOG(INFO) << "width: " << this->width(); + LOG(INFO) << "height: " << this->height(); + LOG(INFO) << "depth: " << this->depth(); + LOG(INFO) << "planes: " << this->planes(); + for (int64_t height = 0; height < this->height(); ++height) { + for (int64_t width = 0; width < this->width(); ++width) { + for (int64_t plane = 0; plane < planes(); ++plane) { + for (int64_t depth = 0; depth < this->depth(); ++depth) { + float this_val = plane * this->depth() + depth; + (*this)(plane, depth, height, width) = this_val; + } + } + } + } + } +}; + +} // namespace xla + +#endif // XLA_ARRAY4D_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/autotune_results.pb.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/autotune_results.pb.h new file mode 100644 index 0000000000000000000000000000000000000000..9795b63d93bb86ea80a2a15a4ab3194c03878d6c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/autotune_results.pb.h @@ -0,0 +1,694 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: xla/autotune_results.proto + +#ifndef GOOGLE_PROTOBUF_INCLUDED_xla_2fautotune_5fresults_2eproto +#define GOOGLE_PROTOBUF_INCLUDED_xla_2fautotune_5fresults_2eproto + +#include +#include + +#include +#if PROTOBUF_VERSION < 3021000 +#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 3021009 < 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 // IWYU pragma: export +#include // IWYU pragma: export +#include +#include "xla/autotuning.pb.h" +// @@protoc_insertion_point(includes) +#include +#define PROTOBUF_INTERNAL_EXPORT_xla_2fautotune_5fresults_2eproto +PROTOBUF_NAMESPACE_OPEN +namespace internal { +class AnyMetadata; +} // namespace internal +PROTOBUF_NAMESPACE_CLOSE + +// Internal implementation detail -- do not use these members. +struct TableStruct_xla_2fautotune_5fresults_2eproto { + static const uint32_t offsets[]; +}; +extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_xla_2fautotune_5fresults_2eproto; +namespace xla { +class AutotuneResults; +struct AutotuneResultsDefaultTypeInternal; +extern AutotuneResultsDefaultTypeInternal _AutotuneResults_default_instance_; +class AutotuneResults_Entry; +struct AutotuneResults_EntryDefaultTypeInternal; +extern AutotuneResults_EntryDefaultTypeInternal _AutotuneResults_Entry_default_instance_; +} // namespace xla +PROTOBUF_NAMESPACE_OPEN +template<> ::xla::AutotuneResults* Arena::CreateMaybeMessage<::xla::AutotuneResults>(Arena*); +template<> ::xla::AutotuneResults_Entry* Arena::CreateMaybeMessage<::xla::AutotuneResults_Entry>(Arena*); +PROTOBUF_NAMESPACE_CLOSE +namespace xla { + +// =================================================================== + +class AutotuneResults_Entry final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:xla.AutotuneResults.Entry) */ { + public: + inline AutotuneResults_Entry() : AutotuneResults_Entry(nullptr) {} + ~AutotuneResults_Entry() override; + explicit PROTOBUF_CONSTEXPR AutotuneResults_Entry(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + AutotuneResults_Entry(const AutotuneResults_Entry& from); + AutotuneResults_Entry(AutotuneResults_Entry&& from) noexcept + : AutotuneResults_Entry() { + *this = ::std::move(from); + } + + inline AutotuneResults_Entry& operator=(const AutotuneResults_Entry& from) { + CopyFrom(from); + return *this; + } + inline AutotuneResults_Entry& operator=(AutotuneResults_Entry&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const AutotuneResults_Entry& default_instance() { + return *internal_default_instance(); + } + static inline const AutotuneResults_Entry* internal_default_instance() { + return reinterpret_cast( + &_AutotuneResults_Entry_default_instance_); + } + static constexpr int kIndexInFileMessages = + 0; + + friend void swap(AutotuneResults_Entry& a, AutotuneResults_Entry& b) { + a.Swap(&b); + } + inline void Swap(AutotuneResults_Entry* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(AutotuneResults_Entry* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + AutotuneResults_Entry* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const AutotuneResults_Entry& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom( const AutotuneResults_Entry& from) { + AutotuneResults_Entry::MergeImpl(*this, from); + } + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); + public: + 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(AutotuneResults_Entry* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "xla.AutotuneResults.Entry"; + } + protected: + explicit AutotuneResults_Entry(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kDeviceFieldNumber = 1, + kHloFieldNumber = 2, + kResultFieldNumber = 3, + }; + // string device = 1; + void clear_device(); + const std::string& device() const; + template + void set_device(ArgT0&& arg0, ArgT... args); + std::string* mutable_device(); + PROTOBUF_NODISCARD std::string* release_device(); + void set_allocated_device(std::string* device); + private: + const std::string& _internal_device() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_device(const std::string& value); + std::string* _internal_mutable_device(); + public: + + // string hlo = 2; + void clear_hlo(); + const std::string& hlo() const; + template + void set_hlo(ArgT0&& arg0, ArgT... args); + std::string* mutable_hlo(); + PROTOBUF_NODISCARD std::string* release_hlo(); + void set_allocated_hlo(std::string* hlo); + private: + const std::string& _internal_hlo() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_hlo(const std::string& value); + std::string* _internal_mutable_hlo(); + public: + + // .xla.AutotuneResult result = 3; + bool has_result() const; + private: + bool _internal_has_result() const; + public: + void clear_result(); + const ::xla::AutotuneResult& result() const; + PROTOBUF_NODISCARD ::xla::AutotuneResult* release_result(); + ::xla::AutotuneResult* mutable_result(); + void set_allocated_result(::xla::AutotuneResult* result); + private: + const ::xla::AutotuneResult& _internal_result() const; + ::xla::AutotuneResult* _internal_mutable_result(); + public: + void unsafe_arena_set_allocated_result( + ::xla::AutotuneResult* result); + ::xla::AutotuneResult* unsafe_arena_release_result(); + + // @@protoc_insertion_point(class_scope:xla.AutotuneResults.Entry) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr device_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr hlo_; + ::xla::AutotuneResult* result_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_xla_2fautotune_5fresults_2eproto; +}; +// ------------------------------------------------------------------- + +class AutotuneResults final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:xla.AutotuneResults) */ { + public: + inline AutotuneResults() : AutotuneResults(nullptr) {} + ~AutotuneResults() override; + explicit PROTOBUF_CONSTEXPR AutotuneResults(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + AutotuneResults(const AutotuneResults& from); + AutotuneResults(AutotuneResults&& from) noexcept + : AutotuneResults() { + *this = ::std::move(from); + } + + inline AutotuneResults& operator=(const AutotuneResults& from) { + CopyFrom(from); + return *this; + } + inline AutotuneResults& operator=(AutotuneResults&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const AutotuneResults& default_instance() { + return *internal_default_instance(); + } + static inline const AutotuneResults* internal_default_instance() { + return reinterpret_cast( + &_AutotuneResults_default_instance_); + } + static constexpr int kIndexInFileMessages = + 1; + + friend void swap(AutotuneResults& a, AutotuneResults& b) { + a.Swap(&b); + } + inline void Swap(AutotuneResults* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(AutotuneResults* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + AutotuneResults* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const AutotuneResults& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom( const AutotuneResults& from) { + AutotuneResults::MergeImpl(*this, from); + } + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); + public: + 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(AutotuneResults* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "xla.AutotuneResults"; + } + protected: + explicit AutotuneResults(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + typedef AutotuneResults_Entry Entry; + + // accessors ------------------------------------------------------- + + enum : int { + kResultsFieldNumber = 4, + kVersionFieldNumber = 1, + }; + // repeated .xla.AutotuneResults.Entry results = 4; + int results_size() const; + private: + int _internal_results_size() const; + public: + void clear_results(); + ::xla::AutotuneResults_Entry* mutable_results(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::xla::AutotuneResults_Entry >* + mutable_results(); + private: + const ::xla::AutotuneResults_Entry& _internal_results(int index) const; + ::xla::AutotuneResults_Entry* _internal_add_results(); + public: + const ::xla::AutotuneResults_Entry& results(int index) const; + ::xla::AutotuneResults_Entry* add_results(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::xla::AutotuneResults_Entry >& + results() const; + + // int32 version = 1; + void clear_version(); + int32_t version() const; + void set_version(int32_t value); + private: + int32_t _internal_version() const; + void _internal_set_version(int32_t value); + public: + + // @@protoc_insertion_point(class_scope:xla.AutotuneResults) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::xla::AutotuneResults_Entry > results_; + int32_t version_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_xla_2fautotune_5fresults_2eproto; +}; +// =================================================================== + + +// =================================================================== + +#ifdef __GNUC__ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wstrict-aliasing" +#endif // __GNUC__ +// AutotuneResults_Entry + +// string device = 1; +inline void AutotuneResults_Entry::clear_device() { + _impl_.device_.ClearToEmpty(); +} +inline const std::string& AutotuneResults_Entry::device() const { + // @@protoc_insertion_point(field_get:xla.AutotuneResults.Entry.device) + return _internal_device(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void AutotuneResults_Entry::set_device(ArgT0&& arg0, ArgT... args) { + + _impl_.device_.Set(static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:xla.AutotuneResults.Entry.device) +} +inline std::string* AutotuneResults_Entry::mutable_device() { + std::string* _s = _internal_mutable_device(); + // @@protoc_insertion_point(field_mutable:xla.AutotuneResults.Entry.device) + return _s; +} +inline const std::string& AutotuneResults_Entry::_internal_device() const { + return _impl_.device_.Get(); +} +inline void AutotuneResults_Entry::_internal_set_device(const std::string& value) { + + _impl_.device_.Set(value, GetArenaForAllocation()); +} +inline std::string* AutotuneResults_Entry::_internal_mutable_device() { + + return _impl_.device_.Mutable(GetArenaForAllocation()); +} +inline std::string* AutotuneResults_Entry::release_device() { + // @@protoc_insertion_point(field_release:xla.AutotuneResults.Entry.device) + return _impl_.device_.Release(); +} +inline void AutotuneResults_Entry::set_allocated_device(std::string* device) { + if (device != nullptr) { + + } else { + + } + _impl_.device_.SetAllocated(device, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.device_.IsDefault()) { + _impl_.device_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:xla.AutotuneResults.Entry.device) +} + +// string hlo = 2; +inline void AutotuneResults_Entry::clear_hlo() { + _impl_.hlo_.ClearToEmpty(); +} +inline const std::string& AutotuneResults_Entry::hlo() const { + // @@protoc_insertion_point(field_get:xla.AutotuneResults.Entry.hlo) + return _internal_hlo(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void AutotuneResults_Entry::set_hlo(ArgT0&& arg0, ArgT... args) { + + _impl_.hlo_.Set(static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:xla.AutotuneResults.Entry.hlo) +} +inline std::string* AutotuneResults_Entry::mutable_hlo() { + std::string* _s = _internal_mutable_hlo(); + // @@protoc_insertion_point(field_mutable:xla.AutotuneResults.Entry.hlo) + return _s; +} +inline const std::string& AutotuneResults_Entry::_internal_hlo() const { + return _impl_.hlo_.Get(); +} +inline void AutotuneResults_Entry::_internal_set_hlo(const std::string& value) { + + _impl_.hlo_.Set(value, GetArenaForAllocation()); +} +inline std::string* AutotuneResults_Entry::_internal_mutable_hlo() { + + return _impl_.hlo_.Mutable(GetArenaForAllocation()); +} +inline std::string* AutotuneResults_Entry::release_hlo() { + // @@protoc_insertion_point(field_release:xla.AutotuneResults.Entry.hlo) + return _impl_.hlo_.Release(); +} +inline void AutotuneResults_Entry::set_allocated_hlo(std::string* hlo) { + if (hlo != nullptr) { + + } else { + + } + _impl_.hlo_.SetAllocated(hlo, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.hlo_.IsDefault()) { + _impl_.hlo_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:xla.AutotuneResults.Entry.hlo) +} + +// .xla.AutotuneResult result = 3; +inline bool AutotuneResults_Entry::_internal_has_result() const { + return this != internal_default_instance() && _impl_.result_ != nullptr; +} +inline bool AutotuneResults_Entry::has_result() const { + return _internal_has_result(); +} +inline const ::xla::AutotuneResult& AutotuneResults_Entry::_internal_result() const { + const ::xla::AutotuneResult* p = _impl_.result_; + return p != nullptr ? *p : reinterpret_cast( + ::xla::_AutotuneResult_default_instance_); +} +inline const ::xla::AutotuneResult& AutotuneResults_Entry::result() const { + // @@protoc_insertion_point(field_get:xla.AutotuneResults.Entry.result) + return _internal_result(); +} +inline void AutotuneResults_Entry::unsafe_arena_set_allocated_result( + ::xla::AutotuneResult* result) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.result_); + } + _impl_.result_ = result; + if (result) { + + } else { + + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:xla.AutotuneResults.Entry.result) +} +inline ::xla::AutotuneResult* AutotuneResults_Entry::release_result() { + + ::xla::AutotuneResult* temp = _impl_.result_; + _impl_.result_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::xla::AutotuneResult* AutotuneResults_Entry::unsafe_arena_release_result() { + // @@protoc_insertion_point(field_release:xla.AutotuneResults.Entry.result) + + ::xla::AutotuneResult* temp = _impl_.result_; + _impl_.result_ = nullptr; + return temp; +} +inline ::xla::AutotuneResult* AutotuneResults_Entry::_internal_mutable_result() { + + if (_impl_.result_ == nullptr) { + auto* p = CreateMaybeMessage<::xla::AutotuneResult>(GetArenaForAllocation()); + _impl_.result_ = p; + } + return _impl_.result_; +} +inline ::xla::AutotuneResult* AutotuneResults_Entry::mutable_result() { + ::xla::AutotuneResult* _msg = _internal_mutable_result(); + // @@protoc_insertion_point(field_mutable:xla.AutotuneResults.Entry.result) + return _msg; +} +inline void AutotuneResults_Entry::set_allocated_result(::xla::AutotuneResult* result) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete reinterpret_cast< ::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.result_); + } + if (result) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena( + reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(result)); + if (message_arena != submessage_arena) { + result = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, result, submessage_arena); + } + + } else { + + } + _impl_.result_ = result; + // @@protoc_insertion_point(field_set_allocated:xla.AutotuneResults.Entry.result) +} + +// ------------------------------------------------------------------- + +// AutotuneResults + +// int32 version = 1; +inline void AutotuneResults::clear_version() { + _impl_.version_ = 0; +} +inline int32_t AutotuneResults::_internal_version() const { + return _impl_.version_; +} +inline int32_t AutotuneResults::version() const { + // @@protoc_insertion_point(field_get:xla.AutotuneResults.version) + return _internal_version(); +} +inline void AutotuneResults::_internal_set_version(int32_t value) { + + _impl_.version_ = value; +} +inline void AutotuneResults::set_version(int32_t value) { + _internal_set_version(value); + // @@protoc_insertion_point(field_set:xla.AutotuneResults.version) +} + +// repeated .xla.AutotuneResults.Entry results = 4; +inline int AutotuneResults::_internal_results_size() const { + return _impl_.results_.size(); +} +inline int AutotuneResults::results_size() const { + return _internal_results_size(); +} +inline void AutotuneResults::clear_results() { + _impl_.results_.Clear(); +} +inline ::xla::AutotuneResults_Entry* AutotuneResults::mutable_results(int index) { + // @@protoc_insertion_point(field_mutable:xla.AutotuneResults.results) + return _impl_.results_.Mutable(index); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::xla::AutotuneResults_Entry >* +AutotuneResults::mutable_results() { + // @@protoc_insertion_point(field_mutable_list:xla.AutotuneResults.results) + return &_impl_.results_; +} +inline const ::xla::AutotuneResults_Entry& AutotuneResults::_internal_results(int index) const { + return _impl_.results_.Get(index); +} +inline const ::xla::AutotuneResults_Entry& AutotuneResults::results(int index) const { + // @@protoc_insertion_point(field_get:xla.AutotuneResults.results) + return _internal_results(index); +} +inline ::xla::AutotuneResults_Entry* AutotuneResults::_internal_add_results() { + return _impl_.results_.Add(); +} +inline ::xla::AutotuneResults_Entry* AutotuneResults::add_results() { + ::xla::AutotuneResults_Entry* _add = _internal_add_results(); + // @@protoc_insertion_point(field_add:xla.AutotuneResults.results) + return _add; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::xla::AutotuneResults_Entry >& +AutotuneResults::results() const { + // @@protoc_insertion_point(field_list:xla.AutotuneResults.results) + return _impl_.results_; +} + +#ifdef __GNUC__ + #pragma GCC diagnostic pop +#endif // __GNUC__ +// ------------------------------------------------------------------- + + +// @@protoc_insertion_point(namespace_scope) + +} // namespace xla + +// @@protoc_insertion_point(global_scope) + +#include +#endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_xla_2fautotune_5fresults_2eproto diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/autotuning.pb.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/autotuning.pb.h new file mode 100644 index 0000000000000000000000000000000000000000..9256f38d7bb87839909e757a69e9cfe98c4305c2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/autotuning.pb.h @@ -0,0 +1,3760 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: xla/autotuning.proto + +#ifndef GOOGLE_PROTOBUF_INCLUDED_xla_2fautotuning_2eproto +#define GOOGLE_PROTOBUF_INCLUDED_xla_2fautotuning_2eproto + +#include +#include + +#include +#if PROTOBUF_VERSION < 3021000 +#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 3021009 < 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 // IWYU pragma: export +#include // IWYU pragma: export +#include +#include +#include +#include +#include "tsl/protobuf/dnn.pb.h" +// @@protoc_insertion_point(includes) +#include +#define PROTOBUF_INTERNAL_EXPORT_xla_2fautotuning_2eproto +PROTOBUF_NAMESPACE_OPEN +namespace internal { +class AnyMetadata; +} // namespace internal +PROTOBUF_NAMESPACE_CLOSE + +// Internal implementation detail -- do not use these members. +struct TableStruct_xla_2fautotuning_2eproto { + static const uint32_t offsets[]; +}; +extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_xla_2fautotuning_2eproto; +namespace xla { +class AutotuneResult; +struct AutotuneResultDefaultTypeInternal; +extern AutotuneResultDefaultTypeInternal _AutotuneResult_default_instance_; +class AutotuneResult_ConvKey; +struct AutotuneResult_ConvKeyDefaultTypeInternal; +extern AutotuneResult_ConvKeyDefaultTypeInternal _AutotuneResult_ConvKey_default_instance_; +class AutotuneResult_CudaConvPlanKey; +struct AutotuneResult_CudaConvPlanKeyDefaultTypeInternal; +extern AutotuneResult_CudaConvPlanKeyDefaultTypeInternal _AutotuneResult_CudaConvPlanKey_default_instance_; +class AutotuneResult_FailureResult; +struct AutotuneResult_FailureResultDefaultTypeInternal; +extern AutotuneResult_FailureResultDefaultTypeInternal _AutotuneResult_FailureResult_default_instance_; +class AutotuneResult_GemmKey; +struct AutotuneResult_GemmKeyDefaultTypeInternal; +extern AutotuneResult_GemmKeyDefaultTypeInternal _AutotuneResult_GemmKey_default_instance_; +class AutotuneResult_TritonGemmKey; +struct AutotuneResult_TritonGemmKeyDefaultTypeInternal; +extern AutotuneResult_TritonGemmKeyDefaultTypeInternal _AutotuneResult_TritonGemmKey_default_instance_; +class AutotuningLog; +struct AutotuningLogDefaultTypeInternal; +extern AutotuningLogDefaultTypeInternal _AutotuningLog_default_instance_; +class ComputeCapability; +struct ComputeCapabilityDefaultTypeInternal; +extern ComputeCapabilityDefaultTypeInternal _ComputeCapability_default_instance_; +class CudnnVersion; +struct CudnnVersionDefaultTypeInternal; +extern CudnnVersionDefaultTypeInternal _CudnnVersion_default_instance_; +} // namespace xla +PROTOBUF_NAMESPACE_OPEN +template<> ::xla::AutotuneResult* Arena::CreateMaybeMessage<::xla::AutotuneResult>(Arena*); +template<> ::xla::AutotuneResult_ConvKey* Arena::CreateMaybeMessage<::xla::AutotuneResult_ConvKey>(Arena*); +template<> ::xla::AutotuneResult_CudaConvPlanKey* Arena::CreateMaybeMessage<::xla::AutotuneResult_CudaConvPlanKey>(Arena*); +template<> ::xla::AutotuneResult_FailureResult* Arena::CreateMaybeMessage<::xla::AutotuneResult_FailureResult>(Arena*); +template<> ::xla::AutotuneResult_GemmKey* Arena::CreateMaybeMessage<::xla::AutotuneResult_GemmKey>(Arena*); +template<> ::xla::AutotuneResult_TritonGemmKey* Arena::CreateMaybeMessage<::xla::AutotuneResult_TritonGemmKey>(Arena*); +template<> ::xla::AutotuningLog* Arena::CreateMaybeMessage<::xla::AutotuningLog>(Arena*); +template<> ::xla::ComputeCapability* Arena::CreateMaybeMessage<::xla::ComputeCapability>(Arena*); +template<> ::xla::CudnnVersion* Arena::CreateMaybeMessage<::xla::CudnnVersion>(Arena*); +PROTOBUF_NAMESPACE_CLOSE +namespace xla { + +enum AutotuneResult_FailureKind : int { + AutotuneResult_FailureKind_UNKNOWN = 0, + AutotuneResult_FailureKind_REDZONE_MODIFIED = 1, + AutotuneResult_FailureKind_WRONG_RESULT = 2, + AutotuneResult_FailureKind_DISQUALIFIED = 3, + AutotuneResult_FailureKind_AutotuneResult_FailureKind_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits::min(), + AutotuneResult_FailureKind_AutotuneResult_FailureKind_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits::max() +}; +bool AutotuneResult_FailureKind_IsValid(int value); +constexpr AutotuneResult_FailureKind AutotuneResult_FailureKind_FailureKind_MIN = AutotuneResult_FailureKind_UNKNOWN; +constexpr AutotuneResult_FailureKind AutotuneResult_FailureKind_FailureKind_MAX = AutotuneResult_FailureKind_DISQUALIFIED; +constexpr int AutotuneResult_FailureKind_FailureKind_ARRAYSIZE = AutotuneResult_FailureKind_FailureKind_MAX + 1; + +const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* AutotuneResult_FailureKind_descriptor(); +template +inline const std::string& AutotuneResult_FailureKind_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function AutotuneResult_FailureKind_Name."); + return ::PROTOBUF_NAMESPACE_ID::internal::NameOfEnum( + AutotuneResult_FailureKind_descriptor(), enum_t_value); +} +inline bool AutotuneResult_FailureKind_Parse( + ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, AutotuneResult_FailureKind* value) { + return ::PROTOBUF_NAMESPACE_ID::internal::ParseNamedEnum( + AutotuneResult_FailureKind_descriptor(), name, value); +} +// =================================================================== + +class CudnnVersion final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:xla.CudnnVersion) */ { + public: + inline CudnnVersion() : CudnnVersion(nullptr) {} + ~CudnnVersion() override; + explicit PROTOBUF_CONSTEXPR CudnnVersion(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + CudnnVersion(const CudnnVersion& from); + CudnnVersion(CudnnVersion&& from) noexcept + : CudnnVersion() { + *this = ::std::move(from); + } + + inline CudnnVersion& operator=(const CudnnVersion& from) { + CopyFrom(from); + return *this; + } + inline CudnnVersion& operator=(CudnnVersion&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const CudnnVersion& default_instance() { + return *internal_default_instance(); + } + static inline const CudnnVersion* internal_default_instance() { + return reinterpret_cast( + &_CudnnVersion_default_instance_); + } + static constexpr int kIndexInFileMessages = + 0; + + friend void swap(CudnnVersion& a, CudnnVersion& b) { + a.Swap(&b); + } + inline void Swap(CudnnVersion* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(CudnnVersion* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + CudnnVersion* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const CudnnVersion& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom( const CudnnVersion& from) { + CudnnVersion::MergeImpl(*this, from); + } + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); + public: + 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(CudnnVersion* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "xla.CudnnVersion"; + } + protected: + explicit CudnnVersion(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kMajorFieldNumber = 1, + kMinorFieldNumber = 2, + kPatchFieldNumber = 3, + }; + // int32 major = 1; + void clear_major(); + int32_t major() const; + void set_major(int32_t value); + private: + int32_t _internal_major() const; + void _internal_set_major(int32_t value); + public: + + // int32 minor = 2; + void clear_minor(); + int32_t minor() const; + void set_minor(int32_t value); + private: + int32_t _internal_minor() const; + void _internal_set_minor(int32_t value); + public: + + // int32 patch = 3; + void clear_patch(); + int32_t patch() const; + void set_patch(int32_t value); + private: + int32_t _internal_patch() const; + void _internal_set_patch(int32_t value); + public: + + // @@protoc_insertion_point(class_scope:xla.CudnnVersion) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + int32_t major_; + int32_t minor_; + int32_t patch_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_xla_2fautotuning_2eproto; +}; +// ------------------------------------------------------------------- + +class ComputeCapability final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:xla.ComputeCapability) */ { + public: + inline ComputeCapability() : ComputeCapability(nullptr) {} + ~ComputeCapability() override; + explicit PROTOBUF_CONSTEXPR ComputeCapability(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + ComputeCapability(const ComputeCapability& from); + ComputeCapability(ComputeCapability&& from) noexcept + : ComputeCapability() { + *this = ::std::move(from); + } + + inline ComputeCapability& operator=(const ComputeCapability& from) { + CopyFrom(from); + return *this; + } + inline ComputeCapability& operator=(ComputeCapability&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const ComputeCapability& default_instance() { + return *internal_default_instance(); + } + static inline const ComputeCapability* internal_default_instance() { + return reinterpret_cast( + &_ComputeCapability_default_instance_); + } + static constexpr int kIndexInFileMessages = + 1; + + friend void swap(ComputeCapability& a, ComputeCapability& b) { + a.Swap(&b); + } + inline void Swap(ComputeCapability* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(ComputeCapability* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + ComputeCapability* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const ComputeCapability& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom( const ComputeCapability& from) { + ComputeCapability::MergeImpl(*this, from); + } + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); + public: + 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(ComputeCapability* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "xla.ComputeCapability"; + } + protected: + explicit ComputeCapability(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kMajorFieldNumber = 1, + kMinorFieldNumber = 2, + }; + // int32 major = 1; + void clear_major(); + int32_t major() const; + void set_major(int32_t value); + private: + int32_t _internal_major() const; + void _internal_set_major(int32_t value); + public: + + // int32 minor = 2; + void clear_minor(); + int32_t minor() const; + void set_minor(int32_t value); + private: + int32_t _internal_minor() const; + void _internal_set_minor(int32_t value); + public: + + // @@protoc_insertion_point(class_scope:xla.ComputeCapability) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + int32_t major_; + int32_t minor_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_xla_2fautotuning_2eproto; +}; +// ------------------------------------------------------------------- + +class AutotuneResult_FailureResult final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:xla.AutotuneResult.FailureResult) */ { + public: + inline AutotuneResult_FailureResult() : AutotuneResult_FailureResult(nullptr) {} + ~AutotuneResult_FailureResult() override; + explicit PROTOBUF_CONSTEXPR AutotuneResult_FailureResult(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + AutotuneResult_FailureResult(const AutotuneResult_FailureResult& from); + AutotuneResult_FailureResult(AutotuneResult_FailureResult&& from) noexcept + : AutotuneResult_FailureResult() { + *this = ::std::move(from); + } + + inline AutotuneResult_FailureResult& operator=(const AutotuneResult_FailureResult& from) { + CopyFrom(from); + return *this; + } + inline AutotuneResult_FailureResult& operator=(AutotuneResult_FailureResult&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const AutotuneResult_FailureResult& default_instance() { + return *internal_default_instance(); + } + enum KeyCase { + kReferenceConv = 11, + kReferenceGemm = 12, + kReferenceCudaConvPlan = 14, + kReferenceAlgorithm = 15, + KEY_NOT_SET = 0, + }; + + static inline const AutotuneResult_FailureResult* internal_default_instance() { + return reinterpret_cast( + &_AutotuneResult_FailureResult_default_instance_); + } + static constexpr int kIndexInFileMessages = + 2; + + friend void swap(AutotuneResult_FailureResult& a, AutotuneResult_FailureResult& b) { + a.Swap(&b); + } + inline void Swap(AutotuneResult_FailureResult* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(AutotuneResult_FailureResult* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + AutotuneResult_FailureResult* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const AutotuneResult_FailureResult& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom( const AutotuneResult_FailureResult& from) { + AutotuneResult_FailureResult::MergeImpl(*this, from); + } + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); + public: + 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(AutotuneResult_FailureResult* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "xla.AutotuneResult.FailureResult"; + } + protected: + explicit AutotuneResult_FailureResult(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kMsgFieldNumber = 2, + kBufferAddressFieldNumber = 13, + kKindFieldNumber = 1, + kReferenceConvFieldNumber = 11, + kReferenceGemmFieldNumber = 12, + kReferenceCudaConvPlanFieldNumber = 14, + kReferenceAlgorithmFieldNumber = 15, + }; + // string msg = 2; + void clear_msg(); + const std::string& msg() const; + template + void set_msg(ArgT0&& arg0, ArgT... args); + std::string* mutable_msg(); + PROTOBUF_NODISCARD std::string* release_msg(); + void set_allocated_msg(std::string* msg); + private: + const std::string& _internal_msg() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_msg(const std::string& value); + std::string* _internal_mutable_msg(); + public: + + // int64 buffer_address = 13; + void clear_buffer_address(); + int64_t buffer_address() const; + void set_buffer_address(int64_t value); + private: + int64_t _internal_buffer_address() const; + void _internal_set_buffer_address(int64_t value); + public: + + // .xla.AutotuneResult.FailureKind kind = 1; + void clear_kind(); + ::xla::AutotuneResult_FailureKind kind() const; + void set_kind(::xla::AutotuneResult_FailureKind value); + private: + ::xla::AutotuneResult_FailureKind _internal_kind() const; + void _internal_set_kind(::xla::AutotuneResult_FailureKind value); + public: + + // .xla.AutotuneResult.ConvKey reference_conv = 11; + bool has_reference_conv() const; + private: + bool _internal_has_reference_conv() const; + public: + void clear_reference_conv(); + const ::xla::AutotuneResult_ConvKey& reference_conv() const; + PROTOBUF_NODISCARD ::xla::AutotuneResult_ConvKey* release_reference_conv(); + ::xla::AutotuneResult_ConvKey* mutable_reference_conv(); + void set_allocated_reference_conv(::xla::AutotuneResult_ConvKey* reference_conv); + private: + const ::xla::AutotuneResult_ConvKey& _internal_reference_conv() const; + ::xla::AutotuneResult_ConvKey* _internal_mutable_reference_conv(); + public: + void unsafe_arena_set_allocated_reference_conv( + ::xla::AutotuneResult_ConvKey* reference_conv); + ::xla::AutotuneResult_ConvKey* unsafe_arena_release_reference_conv(); + + // .xla.AutotuneResult.GemmKey reference_gemm = 12; + bool has_reference_gemm() const; + private: + bool _internal_has_reference_gemm() const; + public: + void clear_reference_gemm(); + const ::xla::AutotuneResult_GemmKey& reference_gemm() const; + PROTOBUF_NODISCARD ::xla::AutotuneResult_GemmKey* release_reference_gemm(); + ::xla::AutotuneResult_GemmKey* mutable_reference_gemm(); + void set_allocated_reference_gemm(::xla::AutotuneResult_GemmKey* reference_gemm); + private: + const ::xla::AutotuneResult_GemmKey& _internal_reference_gemm() const; + ::xla::AutotuneResult_GemmKey* _internal_mutable_reference_gemm(); + public: + void unsafe_arena_set_allocated_reference_gemm( + ::xla::AutotuneResult_GemmKey* reference_gemm); + ::xla::AutotuneResult_GemmKey* unsafe_arena_release_reference_gemm(); + + // .xla.AutotuneResult.CudaConvPlanKey reference_cuda_conv_plan = 14; + bool has_reference_cuda_conv_plan() const; + private: + bool _internal_has_reference_cuda_conv_plan() const; + public: + void clear_reference_cuda_conv_plan(); + const ::xla::AutotuneResult_CudaConvPlanKey& reference_cuda_conv_plan() const; + PROTOBUF_NODISCARD ::xla::AutotuneResult_CudaConvPlanKey* release_reference_cuda_conv_plan(); + ::xla::AutotuneResult_CudaConvPlanKey* mutable_reference_cuda_conv_plan(); + void set_allocated_reference_cuda_conv_plan(::xla::AutotuneResult_CudaConvPlanKey* reference_cuda_conv_plan); + private: + const ::xla::AutotuneResult_CudaConvPlanKey& _internal_reference_cuda_conv_plan() const; + ::xla::AutotuneResult_CudaConvPlanKey* _internal_mutable_reference_cuda_conv_plan(); + public: + void unsafe_arena_set_allocated_reference_cuda_conv_plan( + ::xla::AutotuneResult_CudaConvPlanKey* reference_cuda_conv_plan); + ::xla::AutotuneResult_CudaConvPlanKey* unsafe_arena_release_reference_cuda_conv_plan(); + + // .stream_executor.dnn.AlgorithmProto reference_algorithm = 15; + bool has_reference_algorithm() const; + private: + bool _internal_has_reference_algorithm() const; + public: + void clear_reference_algorithm(); + const ::stream_executor::dnn::AlgorithmProto& reference_algorithm() const; + PROTOBUF_NODISCARD ::stream_executor::dnn::AlgorithmProto* release_reference_algorithm(); + ::stream_executor::dnn::AlgorithmProto* mutable_reference_algorithm(); + void set_allocated_reference_algorithm(::stream_executor::dnn::AlgorithmProto* reference_algorithm); + private: + const ::stream_executor::dnn::AlgorithmProto& _internal_reference_algorithm() const; + ::stream_executor::dnn::AlgorithmProto* _internal_mutable_reference_algorithm(); + public: + void unsafe_arena_set_allocated_reference_algorithm( + ::stream_executor::dnn::AlgorithmProto* reference_algorithm); + ::stream_executor::dnn::AlgorithmProto* unsafe_arena_release_reference_algorithm(); + + void clear_key(); + KeyCase key_case() const; + // @@protoc_insertion_point(class_scope:xla.AutotuneResult.FailureResult) + private: + class _Internal; + void set_has_reference_conv(); + void set_has_reference_gemm(); + void set_has_reference_cuda_conv_plan(); + void set_has_reference_algorithm(); + + inline bool has_key() const; + inline void clear_has_key(); + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr msg_; + int64_t buffer_address_; + int kind_; + union KeyUnion { + constexpr KeyUnion() : _constinit_{} {} + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized _constinit_; + ::xla::AutotuneResult_ConvKey* reference_conv_; + ::xla::AutotuneResult_GemmKey* reference_gemm_; + ::xla::AutotuneResult_CudaConvPlanKey* reference_cuda_conv_plan_; + ::stream_executor::dnn::AlgorithmProto* reference_algorithm_; + } key_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + uint32_t _oneof_case_[1]; + + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_xla_2fautotuning_2eproto; +}; +// ------------------------------------------------------------------- + +class AutotuneResult_ConvKey final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:xla.AutotuneResult.ConvKey) */ { + public: + inline AutotuneResult_ConvKey() : AutotuneResult_ConvKey(nullptr) {} + ~AutotuneResult_ConvKey() override; + explicit PROTOBUF_CONSTEXPR AutotuneResult_ConvKey(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + AutotuneResult_ConvKey(const AutotuneResult_ConvKey& from); + AutotuneResult_ConvKey(AutotuneResult_ConvKey&& from) noexcept + : AutotuneResult_ConvKey() { + *this = ::std::move(from); + } + + inline AutotuneResult_ConvKey& operator=(const AutotuneResult_ConvKey& from) { + CopyFrom(from); + return *this; + } + inline AutotuneResult_ConvKey& operator=(AutotuneResult_ConvKey&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const AutotuneResult_ConvKey& default_instance() { + return *internal_default_instance(); + } + static inline const AutotuneResult_ConvKey* internal_default_instance() { + return reinterpret_cast( + &_AutotuneResult_ConvKey_default_instance_); + } + static constexpr int kIndexInFileMessages = + 3; + + friend void swap(AutotuneResult_ConvKey& a, AutotuneResult_ConvKey& b) { + a.Swap(&b); + } + inline void Swap(AutotuneResult_ConvKey* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(AutotuneResult_ConvKey* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + AutotuneResult_ConvKey* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const AutotuneResult_ConvKey& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom( const AutotuneResult_ConvKey& from) { + AutotuneResult_ConvKey::MergeImpl(*this, from); + } + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); + public: + 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(AutotuneResult_ConvKey* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "xla.AutotuneResult.ConvKey"; + } + protected: + explicit AutotuneResult_ConvKey(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kAlgorithmFieldNumber = 1, + kTensorOpsEnabledFieldNumber = 2, + }; + // int64 algorithm = 1; + void clear_algorithm(); + int64_t algorithm() const; + void set_algorithm(int64_t value); + private: + int64_t _internal_algorithm() const; + void _internal_set_algorithm(int64_t value); + public: + + // bool tensor_ops_enabled = 2; + void clear_tensor_ops_enabled(); + bool tensor_ops_enabled() const; + void set_tensor_ops_enabled(bool value); + private: + bool _internal_tensor_ops_enabled() const; + void _internal_set_tensor_ops_enabled(bool value); + public: + + // @@protoc_insertion_point(class_scope:xla.AutotuneResult.ConvKey) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + int64_t algorithm_; + bool tensor_ops_enabled_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_xla_2fautotuning_2eproto; +}; +// ------------------------------------------------------------------- + +class AutotuneResult_GemmKey final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:xla.AutotuneResult.GemmKey) */ { + public: + inline AutotuneResult_GemmKey() : AutotuneResult_GemmKey(nullptr) {} + ~AutotuneResult_GemmKey() override; + explicit PROTOBUF_CONSTEXPR AutotuneResult_GemmKey(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + AutotuneResult_GemmKey(const AutotuneResult_GemmKey& from); + AutotuneResult_GemmKey(AutotuneResult_GemmKey&& from) noexcept + : AutotuneResult_GemmKey() { + *this = ::std::move(from); + } + + inline AutotuneResult_GemmKey& operator=(const AutotuneResult_GemmKey& from) { + CopyFrom(from); + return *this; + } + inline AutotuneResult_GemmKey& operator=(AutotuneResult_GemmKey&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const AutotuneResult_GemmKey& default_instance() { + return *internal_default_instance(); + } + static inline const AutotuneResult_GemmKey* internal_default_instance() { + return reinterpret_cast( + &_AutotuneResult_GemmKey_default_instance_); + } + static constexpr int kIndexInFileMessages = + 4; + + friend void swap(AutotuneResult_GemmKey& a, AutotuneResult_GemmKey& b) { + a.Swap(&b); + } + inline void Swap(AutotuneResult_GemmKey* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(AutotuneResult_GemmKey* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + AutotuneResult_GemmKey* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const AutotuneResult_GemmKey& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom( const AutotuneResult_GemmKey& from) { + AutotuneResult_GemmKey::MergeImpl(*this, from); + } + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); + public: + 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(AutotuneResult_GemmKey* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "xla.AutotuneResult.GemmKey"; + } + protected: + explicit AutotuneResult_GemmKey(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kAlgorithmFieldNumber = 1, + }; + // int64 algorithm = 1; + void clear_algorithm(); + int64_t algorithm() const; + void set_algorithm(int64_t value); + private: + int64_t _internal_algorithm() const; + void _internal_set_algorithm(int64_t value); + public: + + // @@protoc_insertion_point(class_scope:xla.AutotuneResult.GemmKey) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + int64_t algorithm_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_xla_2fautotuning_2eproto; +}; +// ------------------------------------------------------------------- + +class AutotuneResult_CudaConvPlanKey final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:xla.AutotuneResult.CudaConvPlanKey) */ { + public: + inline AutotuneResult_CudaConvPlanKey() : AutotuneResult_CudaConvPlanKey(nullptr) {} + ~AutotuneResult_CudaConvPlanKey() override; + explicit PROTOBUF_CONSTEXPR AutotuneResult_CudaConvPlanKey(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + AutotuneResult_CudaConvPlanKey(const AutotuneResult_CudaConvPlanKey& from); + AutotuneResult_CudaConvPlanKey(AutotuneResult_CudaConvPlanKey&& from) noexcept + : AutotuneResult_CudaConvPlanKey() { + *this = ::std::move(from); + } + + inline AutotuneResult_CudaConvPlanKey& operator=(const AutotuneResult_CudaConvPlanKey& from) { + CopyFrom(from); + return *this; + } + inline AutotuneResult_CudaConvPlanKey& operator=(AutotuneResult_CudaConvPlanKey&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const AutotuneResult_CudaConvPlanKey& default_instance() { + return *internal_default_instance(); + } + static inline const AutotuneResult_CudaConvPlanKey* internal_default_instance() { + return reinterpret_cast( + &_AutotuneResult_CudaConvPlanKey_default_instance_); + } + static constexpr int kIndexInFileMessages = + 5; + + friend void swap(AutotuneResult_CudaConvPlanKey& a, AutotuneResult_CudaConvPlanKey& b) { + a.Swap(&b); + } + inline void Swap(AutotuneResult_CudaConvPlanKey* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(AutotuneResult_CudaConvPlanKey* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + AutotuneResult_CudaConvPlanKey* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const AutotuneResult_CudaConvPlanKey& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom( const AutotuneResult_CudaConvPlanKey& from) { + AutotuneResult_CudaConvPlanKey::MergeImpl(*this, from); + } + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); + public: + 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(AutotuneResult_CudaConvPlanKey* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "xla.AutotuneResult.CudaConvPlanKey"; + } + protected: + explicit AutotuneResult_CudaConvPlanKey(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kExecPlanIdFieldNumber = 1, + }; + // string exec_plan_id = 1; + void clear_exec_plan_id(); + const std::string& exec_plan_id() const; + template + void set_exec_plan_id(ArgT0&& arg0, ArgT... args); + std::string* mutable_exec_plan_id(); + PROTOBUF_NODISCARD std::string* release_exec_plan_id(); + void set_allocated_exec_plan_id(std::string* exec_plan_id); + private: + const std::string& _internal_exec_plan_id() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_exec_plan_id(const std::string& value); + std::string* _internal_mutable_exec_plan_id(); + public: + + // @@protoc_insertion_point(class_scope:xla.AutotuneResult.CudaConvPlanKey) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr exec_plan_id_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_xla_2fautotuning_2eproto; +}; +// ------------------------------------------------------------------- + +class AutotuneResult_TritonGemmKey final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:xla.AutotuneResult.TritonGemmKey) */ { + public: + inline AutotuneResult_TritonGemmKey() : AutotuneResult_TritonGemmKey(nullptr) {} + ~AutotuneResult_TritonGemmKey() override; + explicit PROTOBUF_CONSTEXPR AutotuneResult_TritonGemmKey(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + AutotuneResult_TritonGemmKey(const AutotuneResult_TritonGemmKey& from); + AutotuneResult_TritonGemmKey(AutotuneResult_TritonGemmKey&& from) noexcept + : AutotuneResult_TritonGemmKey() { + *this = ::std::move(from); + } + + inline AutotuneResult_TritonGemmKey& operator=(const AutotuneResult_TritonGemmKey& from) { + CopyFrom(from); + return *this; + } + inline AutotuneResult_TritonGemmKey& operator=(AutotuneResult_TritonGemmKey&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const AutotuneResult_TritonGemmKey& default_instance() { + return *internal_default_instance(); + } + static inline const AutotuneResult_TritonGemmKey* internal_default_instance() { + return reinterpret_cast( + &_AutotuneResult_TritonGemmKey_default_instance_); + } + static constexpr int kIndexInFileMessages = + 6; + + friend void swap(AutotuneResult_TritonGemmKey& a, AutotuneResult_TritonGemmKey& b) { + a.Swap(&b); + } + inline void Swap(AutotuneResult_TritonGemmKey* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(AutotuneResult_TritonGemmKey* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + AutotuneResult_TritonGemmKey* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const AutotuneResult_TritonGemmKey& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom( const AutotuneResult_TritonGemmKey& from) { + AutotuneResult_TritonGemmKey::MergeImpl(*this, from); + } + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); + public: + 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(AutotuneResult_TritonGemmKey* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "xla.AutotuneResult.TritonGemmKey"; + } + protected: + explicit AutotuneResult_TritonGemmKey(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kBlockMFieldNumber = 1, + kBlockNFieldNumber = 2, + kBlockKFieldNumber = 3, + kSplitKFieldNumber = 4, + kNumStagesFieldNumber = 5, + kNumWarpsFieldNumber = 6, + }; + // int64 block_m = 1; + void clear_block_m(); + int64_t block_m() const; + void set_block_m(int64_t value); + private: + int64_t _internal_block_m() const; + void _internal_set_block_m(int64_t value); + public: + + // int64 block_n = 2; + void clear_block_n(); + int64_t block_n() const; + void set_block_n(int64_t value); + private: + int64_t _internal_block_n() const; + void _internal_set_block_n(int64_t value); + public: + + // int64 block_k = 3; + void clear_block_k(); + int64_t block_k() const; + void set_block_k(int64_t value); + private: + int64_t _internal_block_k() const; + void _internal_set_block_k(int64_t value); + public: + + // int64 split_k = 4; + void clear_split_k(); + int64_t split_k() const; + void set_split_k(int64_t value); + private: + int64_t _internal_split_k() const; + void _internal_set_split_k(int64_t value); + public: + + // int64 num_stages = 5; + void clear_num_stages(); + int64_t num_stages() const; + void set_num_stages(int64_t value); + private: + int64_t _internal_num_stages() const; + void _internal_set_num_stages(int64_t value); + public: + + // int64 num_warps = 6; + void clear_num_warps(); + int64_t num_warps() const; + void set_num_warps(int64_t value); + private: + int64_t _internal_num_warps() const; + void _internal_set_num_warps(int64_t value); + public: + + // @@protoc_insertion_point(class_scope:xla.AutotuneResult.TritonGemmKey) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + int64_t block_m_; + int64_t block_n_; + int64_t block_k_; + int64_t split_k_; + int64_t num_stages_; + int64_t num_warps_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_xla_2fautotuning_2eproto; +}; +// ------------------------------------------------------------------- + +class AutotuneResult final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:xla.AutotuneResult) */ { + public: + inline AutotuneResult() : AutotuneResult(nullptr) {} + ~AutotuneResult() override; + explicit PROTOBUF_CONSTEXPR AutotuneResult(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + AutotuneResult(const AutotuneResult& from); + AutotuneResult(AutotuneResult&& from) noexcept + : AutotuneResult() { + *this = ::std::move(from); + } + + inline AutotuneResult& operator=(const AutotuneResult& from) { + CopyFrom(from); + return *this; + } + inline AutotuneResult& operator=(AutotuneResult&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const AutotuneResult& default_instance() { + return *internal_default_instance(); + } + enum KeyCase { + kConv = 5, + kGemm = 6, + kTriton = 17, + kCudaConvPlan = 15, + kAlgorithm = 16, + KEY_NOT_SET = 0, + }; + + static inline const AutotuneResult* internal_default_instance() { + return reinterpret_cast( + &_AutotuneResult_default_instance_); + } + static constexpr int kIndexInFileMessages = + 7; + + friend void swap(AutotuneResult& a, AutotuneResult& b) { + a.Swap(&b); + } + inline void Swap(AutotuneResult* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(AutotuneResult* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + AutotuneResult* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const AutotuneResult& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom( const AutotuneResult& from) { + AutotuneResult::MergeImpl(*this, from); + } + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); + public: + 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(AutotuneResult* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "xla.AutotuneResult"; + } + protected: + explicit AutotuneResult(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + typedef AutotuneResult_FailureResult FailureResult; + typedef AutotuneResult_ConvKey ConvKey; + typedef AutotuneResult_GemmKey GemmKey; + typedef AutotuneResult_CudaConvPlanKey CudaConvPlanKey; + typedef AutotuneResult_TritonGemmKey TritonGemmKey; + + typedef AutotuneResult_FailureKind FailureKind; + static constexpr FailureKind UNKNOWN = + AutotuneResult_FailureKind_UNKNOWN; + static constexpr FailureKind REDZONE_MODIFIED = + AutotuneResult_FailureKind_REDZONE_MODIFIED; + static constexpr FailureKind WRONG_RESULT = + AutotuneResult_FailureKind_WRONG_RESULT; + static constexpr FailureKind DISQUALIFIED = + AutotuneResult_FailureKind_DISQUALIFIED; + static inline bool FailureKind_IsValid(int value) { + return AutotuneResult_FailureKind_IsValid(value); + } + static constexpr FailureKind FailureKind_MIN = + AutotuneResult_FailureKind_FailureKind_MIN; + static constexpr FailureKind FailureKind_MAX = + AutotuneResult_FailureKind_FailureKind_MAX; + static constexpr int FailureKind_ARRAYSIZE = + AutotuneResult_FailureKind_FailureKind_ARRAYSIZE; + static inline const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* + FailureKind_descriptor() { + return AutotuneResult_FailureKind_descriptor(); + } + template + static inline const std::string& FailureKind_Name(T enum_t_value) { + static_assert(::std::is_same::value || + ::std::is_integral::value, + "Incorrect type passed to function FailureKind_Name."); + return AutotuneResult_FailureKind_Name(enum_t_value); + } + static inline bool FailureKind_Parse(::PROTOBUF_NAMESPACE_ID::ConstStringParam name, + FailureKind* value) { + return AutotuneResult_FailureKind_Parse(name, value); + } + + // accessors ------------------------------------------------------- + + enum : int { + kFailureFieldNumber = 7, + kRunTimeFieldNumber = 9, + kScratchBytesFieldNumber = 8, + kConvFieldNumber = 5, + kGemmFieldNumber = 6, + kTritonFieldNumber = 17, + kCudaConvPlanFieldNumber = 15, + kAlgorithmFieldNumber = 16, + }; + // .xla.AutotuneResult.FailureResult failure = 7; + bool has_failure() const; + private: + bool _internal_has_failure() const; + public: + void clear_failure(); + const ::xla::AutotuneResult_FailureResult& failure() const; + PROTOBUF_NODISCARD ::xla::AutotuneResult_FailureResult* release_failure(); + ::xla::AutotuneResult_FailureResult* mutable_failure(); + void set_allocated_failure(::xla::AutotuneResult_FailureResult* failure); + private: + const ::xla::AutotuneResult_FailureResult& _internal_failure() const; + ::xla::AutotuneResult_FailureResult* _internal_mutable_failure(); + public: + void unsafe_arena_set_allocated_failure( + ::xla::AutotuneResult_FailureResult* failure); + ::xla::AutotuneResult_FailureResult* unsafe_arena_release_failure(); + + // .google.protobuf.Duration run_time = 9; + bool has_run_time() const; + private: + bool _internal_has_run_time() const; + public: + void clear_run_time(); + const ::PROTOBUF_NAMESPACE_ID::Duration& run_time() const; + PROTOBUF_NODISCARD ::PROTOBUF_NAMESPACE_ID::Duration* release_run_time(); + ::PROTOBUF_NAMESPACE_ID::Duration* mutable_run_time(); + void set_allocated_run_time(::PROTOBUF_NAMESPACE_ID::Duration* run_time); + private: + const ::PROTOBUF_NAMESPACE_ID::Duration& _internal_run_time() const; + ::PROTOBUF_NAMESPACE_ID::Duration* _internal_mutable_run_time(); + public: + void unsafe_arena_set_allocated_run_time( + ::PROTOBUF_NAMESPACE_ID::Duration* run_time); + ::PROTOBUF_NAMESPACE_ID::Duration* unsafe_arena_release_run_time(); + + // int64 scratch_bytes = 8; + void clear_scratch_bytes(); + int64_t scratch_bytes() const; + void set_scratch_bytes(int64_t value); + private: + int64_t _internal_scratch_bytes() const; + void _internal_set_scratch_bytes(int64_t value); + public: + + // .xla.AutotuneResult.ConvKey conv = 5; + bool has_conv() const; + private: + bool _internal_has_conv() const; + public: + void clear_conv(); + const ::xla::AutotuneResult_ConvKey& conv() const; + PROTOBUF_NODISCARD ::xla::AutotuneResult_ConvKey* release_conv(); + ::xla::AutotuneResult_ConvKey* mutable_conv(); + void set_allocated_conv(::xla::AutotuneResult_ConvKey* conv); + private: + const ::xla::AutotuneResult_ConvKey& _internal_conv() const; + ::xla::AutotuneResult_ConvKey* _internal_mutable_conv(); + public: + void unsafe_arena_set_allocated_conv( + ::xla::AutotuneResult_ConvKey* conv); + ::xla::AutotuneResult_ConvKey* unsafe_arena_release_conv(); + + // .xla.AutotuneResult.GemmKey gemm = 6; + bool has_gemm() const; + private: + bool _internal_has_gemm() const; + public: + void clear_gemm(); + const ::xla::AutotuneResult_GemmKey& gemm() const; + PROTOBUF_NODISCARD ::xla::AutotuneResult_GemmKey* release_gemm(); + ::xla::AutotuneResult_GemmKey* mutable_gemm(); + void set_allocated_gemm(::xla::AutotuneResult_GemmKey* gemm); + private: + const ::xla::AutotuneResult_GemmKey& _internal_gemm() const; + ::xla::AutotuneResult_GemmKey* _internal_mutable_gemm(); + public: + void unsafe_arena_set_allocated_gemm( + ::xla::AutotuneResult_GemmKey* gemm); + ::xla::AutotuneResult_GemmKey* unsafe_arena_release_gemm(); + + // .xla.AutotuneResult.TritonGemmKey triton = 17; + bool has_triton() const; + private: + bool _internal_has_triton() const; + public: + void clear_triton(); + const ::xla::AutotuneResult_TritonGemmKey& triton() const; + PROTOBUF_NODISCARD ::xla::AutotuneResult_TritonGemmKey* release_triton(); + ::xla::AutotuneResult_TritonGemmKey* mutable_triton(); + void set_allocated_triton(::xla::AutotuneResult_TritonGemmKey* triton); + private: + const ::xla::AutotuneResult_TritonGemmKey& _internal_triton() const; + ::xla::AutotuneResult_TritonGemmKey* _internal_mutable_triton(); + public: + void unsafe_arena_set_allocated_triton( + ::xla::AutotuneResult_TritonGemmKey* triton); + ::xla::AutotuneResult_TritonGemmKey* unsafe_arena_release_triton(); + + // .xla.AutotuneResult.CudaConvPlanKey cuda_conv_plan = 15; + bool has_cuda_conv_plan() const; + private: + bool _internal_has_cuda_conv_plan() const; + public: + void clear_cuda_conv_plan(); + const ::xla::AutotuneResult_CudaConvPlanKey& cuda_conv_plan() const; + PROTOBUF_NODISCARD ::xla::AutotuneResult_CudaConvPlanKey* release_cuda_conv_plan(); + ::xla::AutotuneResult_CudaConvPlanKey* mutable_cuda_conv_plan(); + void set_allocated_cuda_conv_plan(::xla::AutotuneResult_CudaConvPlanKey* cuda_conv_plan); + private: + const ::xla::AutotuneResult_CudaConvPlanKey& _internal_cuda_conv_plan() const; + ::xla::AutotuneResult_CudaConvPlanKey* _internal_mutable_cuda_conv_plan(); + public: + void unsafe_arena_set_allocated_cuda_conv_plan( + ::xla::AutotuneResult_CudaConvPlanKey* cuda_conv_plan); + ::xla::AutotuneResult_CudaConvPlanKey* unsafe_arena_release_cuda_conv_plan(); + + // .stream_executor.dnn.AlgorithmProto algorithm = 16; + bool has_algorithm() const; + private: + bool _internal_has_algorithm() const; + public: + void clear_algorithm(); + const ::stream_executor::dnn::AlgorithmProto& algorithm() const; + PROTOBUF_NODISCARD ::stream_executor::dnn::AlgorithmProto* release_algorithm(); + ::stream_executor::dnn::AlgorithmProto* mutable_algorithm(); + void set_allocated_algorithm(::stream_executor::dnn::AlgorithmProto* algorithm); + private: + const ::stream_executor::dnn::AlgorithmProto& _internal_algorithm() const; + ::stream_executor::dnn::AlgorithmProto* _internal_mutable_algorithm(); + public: + void unsafe_arena_set_allocated_algorithm( + ::stream_executor::dnn::AlgorithmProto* algorithm); + ::stream_executor::dnn::AlgorithmProto* unsafe_arena_release_algorithm(); + + void clear_key(); + KeyCase key_case() const; + // @@protoc_insertion_point(class_scope:xla.AutotuneResult) + private: + class _Internal; + void set_has_conv(); + void set_has_gemm(); + void set_has_triton(); + void set_has_cuda_conv_plan(); + void set_has_algorithm(); + + inline bool has_key() const; + inline void clear_has_key(); + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + ::xla::AutotuneResult_FailureResult* failure_; + ::PROTOBUF_NAMESPACE_ID::Duration* run_time_; + int64_t scratch_bytes_; + union KeyUnion { + constexpr KeyUnion() : _constinit_{} {} + ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized _constinit_; + ::xla::AutotuneResult_ConvKey* conv_; + ::xla::AutotuneResult_GemmKey* gemm_; + ::xla::AutotuneResult_TritonGemmKey* triton_; + ::xla::AutotuneResult_CudaConvPlanKey* cuda_conv_plan_; + ::stream_executor::dnn::AlgorithmProto* algorithm_; + } key_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + uint32_t _oneof_case_[1]; + + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_xla_2fautotuning_2eproto; +}; +// ------------------------------------------------------------------- + +class AutotuningLog final : + public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:xla.AutotuningLog) */ { + public: + inline AutotuningLog() : AutotuningLog(nullptr) {} + ~AutotuningLog() override; + explicit PROTOBUF_CONSTEXPR AutotuningLog(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized); + + AutotuningLog(const AutotuningLog& from); + AutotuningLog(AutotuningLog&& from) noexcept + : AutotuningLog() { + *this = ::std::move(from); + } + + inline AutotuningLog& operator=(const AutotuningLog& from) { + CopyFrom(from); + return *this; + } + inline AutotuningLog& operator=(AutotuningLog&& from) noexcept { + if (this == &from) return *this; + if (GetOwningArena() == from.GetOwningArena() + #ifdef PROTOBUF_FORCE_COPY_IN_MOVE + && GetOwningArena() != nullptr + #endif // !PROTOBUF_FORCE_COPY_IN_MOVE + ) { + InternalSwap(&from); + } else { + CopyFrom(from); + } + return *this; + } + + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() { + return GetDescriptor(); + } + static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() { + return default_instance().GetMetadata().descriptor; + } + static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() { + return default_instance().GetMetadata().reflection; + } + static const AutotuningLog& default_instance() { + return *internal_default_instance(); + } + static inline const AutotuningLog* internal_default_instance() { + return reinterpret_cast( + &_AutotuningLog_default_instance_); + } + static constexpr int kIndexInFileMessages = + 8; + + friend void swap(AutotuningLog& a, AutotuningLog& b) { + a.Swap(&b); + } + inline void Swap(AutotuningLog* other) { + if (other == this) return; + #ifdef PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() != nullptr && + GetOwningArena() == other->GetOwningArena()) { + #else // PROTOBUF_FORCE_COPY_IN_SWAP + if (GetOwningArena() == other->GetOwningArena()) { + #endif // !PROTOBUF_FORCE_COPY_IN_SWAP + InternalSwap(other); + } else { + ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other); + } + } + void UnsafeArenaSwap(AutotuningLog* other) { + if (other == this) return; + GOOGLE_DCHECK(GetOwningArena() == other->GetOwningArena()); + InternalSwap(other); + } + + // implements Message ---------------------------------------------- + + AutotuningLog* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final { + return CreateMaybeMessage(arena); + } + using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom; + void CopyFrom(const AutotuningLog& from); + using ::PROTOBUF_NAMESPACE_ID::Message::MergeFrom; + void MergeFrom( const AutotuningLog& from) { + AutotuningLog::MergeImpl(*this, from); + } + private: + static void MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg); + public: + 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; + uint8_t* _InternalSerialize( + uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final; + int GetCachedSize() const final { return _impl_._cached_size_.Get(); } + + private: + void SharedCtor(::PROTOBUF_NAMESPACE_ID::Arena* arena, bool is_message_owned); + void SharedDtor(); + void SetCachedSize(int size) const final; + void InternalSwap(AutotuningLog* other); + + private: + friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata; + static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() { + return "xla.AutotuningLog"; + } + protected: + explicit AutotuningLog(::PROTOBUF_NAMESPACE_ID::Arena* arena, + bool is_message_owned = false); + public: + + static const ClassData _class_data_; + const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*GetClassData() const final; + + ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + enum : int { + kResultsFieldNumber = 2, + kDevicePciBusIdFieldNumber = 5, + kBlasVersionFieldNumber = 6, + kInstrFieldNumber = 1, + kCudnnVersionFieldNumber = 3, + kComputeCapabilityFieldNumber = 4, + }; + // repeated .xla.AutotuneResult results = 2; + int results_size() const; + private: + int _internal_results_size() const; + public: + void clear_results(); + ::xla::AutotuneResult* mutable_results(int index); + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::xla::AutotuneResult >* + mutable_results(); + private: + const ::xla::AutotuneResult& _internal_results(int index) const; + ::xla::AutotuneResult* _internal_add_results(); + public: + const ::xla::AutotuneResult& results(int index) const; + ::xla::AutotuneResult* add_results(); + const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::xla::AutotuneResult >& + results() const; + + // string device_pci_bus_id = 5; + void clear_device_pci_bus_id(); + const std::string& device_pci_bus_id() const; + template + void set_device_pci_bus_id(ArgT0&& arg0, ArgT... args); + std::string* mutable_device_pci_bus_id(); + PROTOBUF_NODISCARD std::string* release_device_pci_bus_id(); + void set_allocated_device_pci_bus_id(std::string* device_pci_bus_id); + private: + const std::string& _internal_device_pci_bus_id() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_device_pci_bus_id(const std::string& value); + std::string* _internal_mutable_device_pci_bus_id(); + public: + + // string blas_version = 6; + void clear_blas_version(); + const std::string& blas_version() const; + template + void set_blas_version(ArgT0&& arg0, ArgT... args); + std::string* mutable_blas_version(); + PROTOBUF_NODISCARD std::string* release_blas_version(); + void set_allocated_blas_version(std::string* blas_version); + private: + const std::string& _internal_blas_version() const; + inline PROTOBUF_ALWAYS_INLINE void _internal_set_blas_version(const std::string& value); + std::string* _internal_mutable_blas_version(); + public: + + // .google.protobuf.Any instr = 1; + bool has_instr() const; + private: + bool _internal_has_instr() const; + public: + void clear_instr(); + const ::PROTOBUF_NAMESPACE_ID::Any& instr() const; + PROTOBUF_NODISCARD ::PROTOBUF_NAMESPACE_ID::Any* release_instr(); + ::PROTOBUF_NAMESPACE_ID::Any* mutable_instr(); + void set_allocated_instr(::PROTOBUF_NAMESPACE_ID::Any* instr); + private: + const ::PROTOBUF_NAMESPACE_ID::Any& _internal_instr() const; + ::PROTOBUF_NAMESPACE_ID::Any* _internal_mutable_instr(); + public: + void unsafe_arena_set_allocated_instr( + ::PROTOBUF_NAMESPACE_ID::Any* instr); + ::PROTOBUF_NAMESPACE_ID::Any* unsafe_arena_release_instr(); + + // .xla.CudnnVersion cudnn_version = 3; + bool has_cudnn_version() const; + private: + bool _internal_has_cudnn_version() const; + public: + void clear_cudnn_version(); + const ::xla::CudnnVersion& cudnn_version() const; + PROTOBUF_NODISCARD ::xla::CudnnVersion* release_cudnn_version(); + ::xla::CudnnVersion* mutable_cudnn_version(); + void set_allocated_cudnn_version(::xla::CudnnVersion* cudnn_version); + private: + const ::xla::CudnnVersion& _internal_cudnn_version() const; + ::xla::CudnnVersion* _internal_mutable_cudnn_version(); + public: + void unsafe_arena_set_allocated_cudnn_version( + ::xla::CudnnVersion* cudnn_version); + ::xla::CudnnVersion* unsafe_arena_release_cudnn_version(); + + // .xla.ComputeCapability compute_capability = 4; + bool has_compute_capability() const; + private: + bool _internal_has_compute_capability() const; + public: + void clear_compute_capability(); + const ::xla::ComputeCapability& compute_capability() const; + PROTOBUF_NODISCARD ::xla::ComputeCapability* release_compute_capability(); + ::xla::ComputeCapability* mutable_compute_capability(); + void set_allocated_compute_capability(::xla::ComputeCapability* compute_capability); + private: + const ::xla::ComputeCapability& _internal_compute_capability() const; + ::xla::ComputeCapability* _internal_mutable_compute_capability(); + public: + void unsafe_arena_set_allocated_compute_capability( + ::xla::ComputeCapability* compute_capability); + ::xla::ComputeCapability* unsafe_arena_release_compute_capability(); + + // @@protoc_insertion_point(class_scope:xla.AutotuningLog) + private: + class _Internal; + + template friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper; + typedef void InternalArenaConstructable_; + typedef void DestructorSkippable_; + struct Impl_ { + ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::xla::AutotuneResult > results_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr device_pci_bus_id_; + ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr blas_version_; + ::PROTOBUF_NAMESPACE_ID::Any* instr_; + ::xla::CudnnVersion* cudnn_version_; + ::xla::ComputeCapability* compute_capability_; + mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_; + }; + union { Impl_ _impl_; }; + friend struct ::TableStruct_xla_2fautotuning_2eproto; +}; +// =================================================================== + + +// =================================================================== + +#ifdef __GNUC__ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wstrict-aliasing" +#endif // __GNUC__ +// CudnnVersion + +// int32 major = 1; +inline void CudnnVersion::clear_major() { + _impl_.major_ = 0; +} +inline int32_t CudnnVersion::_internal_major() const { + return _impl_.major_; +} +inline int32_t CudnnVersion::major() const { + // @@protoc_insertion_point(field_get:xla.CudnnVersion.major) + return _internal_major(); +} +inline void CudnnVersion::_internal_set_major(int32_t value) { + + _impl_.major_ = value; +} +inline void CudnnVersion::set_major(int32_t value) { + _internal_set_major(value); + // @@protoc_insertion_point(field_set:xla.CudnnVersion.major) +} + +// int32 minor = 2; +inline void CudnnVersion::clear_minor() { + _impl_.minor_ = 0; +} +inline int32_t CudnnVersion::_internal_minor() const { + return _impl_.minor_; +} +inline int32_t CudnnVersion::minor() const { + // @@protoc_insertion_point(field_get:xla.CudnnVersion.minor) + return _internal_minor(); +} +inline void CudnnVersion::_internal_set_minor(int32_t value) { + + _impl_.minor_ = value; +} +inline void CudnnVersion::set_minor(int32_t value) { + _internal_set_minor(value); + // @@protoc_insertion_point(field_set:xla.CudnnVersion.minor) +} + +// int32 patch = 3; +inline void CudnnVersion::clear_patch() { + _impl_.patch_ = 0; +} +inline int32_t CudnnVersion::_internal_patch() const { + return _impl_.patch_; +} +inline int32_t CudnnVersion::patch() const { + // @@protoc_insertion_point(field_get:xla.CudnnVersion.patch) + return _internal_patch(); +} +inline void CudnnVersion::_internal_set_patch(int32_t value) { + + _impl_.patch_ = value; +} +inline void CudnnVersion::set_patch(int32_t value) { + _internal_set_patch(value); + // @@protoc_insertion_point(field_set:xla.CudnnVersion.patch) +} + +// ------------------------------------------------------------------- + +// ComputeCapability + +// int32 major = 1; +inline void ComputeCapability::clear_major() { + _impl_.major_ = 0; +} +inline int32_t ComputeCapability::_internal_major() const { + return _impl_.major_; +} +inline int32_t ComputeCapability::major() const { + // @@protoc_insertion_point(field_get:xla.ComputeCapability.major) + return _internal_major(); +} +inline void ComputeCapability::_internal_set_major(int32_t value) { + + _impl_.major_ = value; +} +inline void ComputeCapability::set_major(int32_t value) { + _internal_set_major(value); + // @@protoc_insertion_point(field_set:xla.ComputeCapability.major) +} + +// int32 minor = 2; +inline void ComputeCapability::clear_minor() { + _impl_.minor_ = 0; +} +inline int32_t ComputeCapability::_internal_minor() const { + return _impl_.minor_; +} +inline int32_t ComputeCapability::minor() const { + // @@protoc_insertion_point(field_get:xla.ComputeCapability.minor) + return _internal_minor(); +} +inline void ComputeCapability::_internal_set_minor(int32_t value) { + + _impl_.minor_ = value; +} +inline void ComputeCapability::set_minor(int32_t value) { + _internal_set_minor(value); + // @@protoc_insertion_point(field_set:xla.ComputeCapability.minor) +} + +// ------------------------------------------------------------------- + +// AutotuneResult_FailureResult + +// .xla.AutotuneResult.FailureKind kind = 1; +inline void AutotuneResult_FailureResult::clear_kind() { + _impl_.kind_ = 0; +} +inline ::xla::AutotuneResult_FailureKind AutotuneResult_FailureResult::_internal_kind() const { + return static_cast< ::xla::AutotuneResult_FailureKind >(_impl_.kind_); +} +inline ::xla::AutotuneResult_FailureKind AutotuneResult_FailureResult::kind() const { + // @@protoc_insertion_point(field_get:xla.AutotuneResult.FailureResult.kind) + return _internal_kind(); +} +inline void AutotuneResult_FailureResult::_internal_set_kind(::xla::AutotuneResult_FailureKind value) { + + _impl_.kind_ = value; +} +inline void AutotuneResult_FailureResult::set_kind(::xla::AutotuneResult_FailureKind value) { + _internal_set_kind(value); + // @@protoc_insertion_point(field_set:xla.AutotuneResult.FailureResult.kind) +} + +// string msg = 2; +inline void AutotuneResult_FailureResult::clear_msg() { + _impl_.msg_.ClearToEmpty(); +} +inline const std::string& AutotuneResult_FailureResult::msg() const { + // @@protoc_insertion_point(field_get:xla.AutotuneResult.FailureResult.msg) + return _internal_msg(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void AutotuneResult_FailureResult::set_msg(ArgT0&& arg0, ArgT... args) { + + _impl_.msg_.Set(static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:xla.AutotuneResult.FailureResult.msg) +} +inline std::string* AutotuneResult_FailureResult::mutable_msg() { + std::string* _s = _internal_mutable_msg(); + // @@protoc_insertion_point(field_mutable:xla.AutotuneResult.FailureResult.msg) + return _s; +} +inline const std::string& AutotuneResult_FailureResult::_internal_msg() const { + return _impl_.msg_.Get(); +} +inline void AutotuneResult_FailureResult::_internal_set_msg(const std::string& value) { + + _impl_.msg_.Set(value, GetArenaForAllocation()); +} +inline std::string* AutotuneResult_FailureResult::_internal_mutable_msg() { + + return _impl_.msg_.Mutable(GetArenaForAllocation()); +} +inline std::string* AutotuneResult_FailureResult::release_msg() { + // @@protoc_insertion_point(field_release:xla.AutotuneResult.FailureResult.msg) + return _impl_.msg_.Release(); +} +inline void AutotuneResult_FailureResult::set_allocated_msg(std::string* msg) { + if (msg != nullptr) { + + } else { + + } + _impl_.msg_.SetAllocated(msg, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.msg_.IsDefault()) { + _impl_.msg_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:xla.AutotuneResult.FailureResult.msg) +} + +// .xla.AutotuneResult.ConvKey reference_conv = 11; +inline bool AutotuneResult_FailureResult::_internal_has_reference_conv() const { + return key_case() == kReferenceConv; +} +inline bool AutotuneResult_FailureResult::has_reference_conv() const { + return _internal_has_reference_conv(); +} +inline void AutotuneResult_FailureResult::set_has_reference_conv() { + _impl_._oneof_case_[0] = kReferenceConv; +} +inline void AutotuneResult_FailureResult::clear_reference_conv() { + if (_internal_has_reference_conv()) { + if (GetArenaForAllocation() == nullptr) { + delete _impl_.key_.reference_conv_; + } + clear_has_key(); + } +} +inline ::xla::AutotuneResult_ConvKey* AutotuneResult_FailureResult::release_reference_conv() { + // @@protoc_insertion_point(field_release:xla.AutotuneResult.FailureResult.reference_conv) + if (_internal_has_reference_conv()) { + clear_has_key(); + ::xla::AutotuneResult_ConvKey* temp = _impl_.key_.reference_conv_; + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + _impl_.key_.reference_conv_ = nullptr; + return temp; + } else { + return nullptr; + } +} +inline const ::xla::AutotuneResult_ConvKey& AutotuneResult_FailureResult::_internal_reference_conv() const { + return _internal_has_reference_conv() + ? *_impl_.key_.reference_conv_ + : reinterpret_cast< ::xla::AutotuneResult_ConvKey&>(::xla::_AutotuneResult_ConvKey_default_instance_); +} +inline const ::xla::AutotuneResult_ConvKey& AutotuneResult_FailureResult::reference_conv() const { + // @@protoc_insertion_point(field_get:xla.AutotuneResult.FailureResult.reference_conv) + return _internal_reference_conv(); +} +inline ::xla::AutotuneResult_ConvKey* AutotuneResult_FailureResult::unsafe_arena_release_reference_conv() { + // @@protoc_insertion_point(field_unsafe_arena_release:xla.AutotuneResult.FailureResult.reference_conv) + if (_internal_has_reference_conv()) { + clear_has_key(); + ::xla::AutotuneResult_ConvKey* temp = _impl_.key_.reference_conv_; + _impl_.key_.reference_conv_ = nullptr; + return temp; + } else { + return nullptr; + } +} +inline void AutotuneResult_FailureResult::unsafe_arena_set_allocated_reference_conv(::xla::AutotuneResult_ConvKey* reference_conv) { + clear_key(); + if (reference_conv) { + set_has_reference_conv(); + _impl_.key_.reference_conv_ = reference_conv; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:xla.AutotuneResult.FailureResult.reference_conv) +} +inline ::xla::AutotuneResult_ConvKey* AutotuneResult_FailureResult::_internal_mutable_reference_conv() { + if (!_internal_has_reference_conv()) { + clear_key(); + set_has_reference_conv(); + _impl_.key_.reference_conv_ = CreateMaybeMessage< ::xla::AutotuneResult_ConvKey >(GetArenaForAllocation()); + } + return _impl_.key_.reference_conv_; +} +inline ::xla::AutotuneResult_ConvKey* AutotuneResult_FailureResult::mutable_reference_conv() { + ::xla::AutotuneResult_ConvKey* _msg = _internal_mutable_reference_conv(); + // @@protoc_insertion_point(field_mutable:xla.AutotuneResult.FailureResult.reference_conv) + return _msg; +} + +// .xla.AutotuneResult.GemmKey reference_gemm = 12; +inline bool AutotuneResult_FailureResult::_internal_has_reference_gemm() const { + return key_case() == kReferenceGemm; +} +inline bool AutotuneResult_FailureResult::has_reference_gemm() const { + return _internal_has_reference_gemm(); +} +inline void AutotuneResult_FailureResult::set_has_reference_gemm() { + _impl_._oneof_case_[0] = kReferenceGemm; +} +inline void AutotuneResult_FailureResult::clear_reference_gemm() { + if (_internal_has_reference_gemm()) { + if (GetArenaForAllocation() == nullptr) { + delete _impl_.key_.reference_gemm_; + } + clear_has_key(); + } +} +inline ::xla::AutotuneResult_GemmKey* AutotuneResult_FailureResult::release_reference_gemm() { + // @@protoc_insertion_point(field_release:xla.AutotuneResult.FailureResult.reference_gemm) + if (_internal_has_reference_gemm()) { + clear_has_key(); + ::xla::AutotuneResult_GemmKey* temp = _impl_.key_.reference_gemm_; + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + _impl_.key_.reference_gemm_ = nullptr; + return temp; + } else { + return nullptr; + } +} +inline const ::xla::AutotuneResult_GemmKey& AutotuneResult_FailureResult::_internal_reference_gemm() const { + return _internal_has_reference_gemm() + ? *_impl_.key_.reference_gemm_ + : reinterpret_cast< ::xla::AutotuneResult_GemmKey&>(::xla::_AutotuneResult_GemmKey_default_instance_); +} +inline const ::xla::AutotuneResult_GemmKey& AutotuneResult_FailureResult::reference_gemm() const { + // @@protoc_insertion_point(field_get:xla.AutotuneResult.FailureResult.reference_gemm) + return _internal_reference_gemm(); +} +inline ::xla::AutotuneResult_GemmKey* AutotuneResult_FailureResult::unsafe_arena_release_reference_gemm() { + // @@protoc_insertion_point(field_unsafe_arena_release:xla.AutotuneResult.FailureResult.reference_gemm) + if (_internal_has_reference_gemm()) { + clear_has_key(); + ::xla::AutotuneResult_GemmKey* temp = _impl_.key_.reference_gemm_; + _impl_.key_.reference_gemm_ = nullptr; + return temp; + } else { + return nullptr; + } +} +inline void AutotuneResult_FailureResult::unsafe_arena_set_allocated_reference_gemm(::xla::AutotuneResult_GemmKey* reference_gemm) { + clear_key(); + if (reference_gemm) { + set_has_reference_gemm(); + _impl_.key_.reference_gemm_ = reference_gemm; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:xla.AutotuneResult.FailureResult.reference_gemm) +} +inline ::xla::AutotuneResult_GemmKey* AutotuneResult_FailureResult::_internal_mutable_reference_gemm() { + if (!_internal_has_reference_gemm()) { + clear_key(); + set_has_reference_gemm(); + _impl_.key_.reference_gemm_ = CreateMaybeMessage< ::xla::AutotuneResult_GemmKey >(GetArenaForAllocation()); + } + return _impl_.key_.reference_gemm_; +} +inline ::xla::AutotuneResult_GemmKey* AutotuneResult_FailureResult::mutable_reference_gemm() { + ::xla::AutotuneResult_GemmKey* _msg = _internal_mutable_reference_gemm(); + // @@protoc_insertion_point(field_mutable:xla.AutotuneResult.FailureResult.reference_gemm) + return _msg; +} + +// .xla.AutotuneResult.CudaConvPlanKey reference_cuda_conv_plan = 14; +inline bool AutotuneResult_FailureResult::_internal_has_reference_cuda_conv_plan() const { + return key_case() == kReferenceCudaConvPlan; +} +inline bool AutotuneResult_FailureResult::has_reference_cuda_conv_plan() const { + return _internal_has_reference_cuda_conv_plan(); +} +inline void AutotuneResult_FailureResult::set_has_reference_cuda_conv_plan() { + _impl_._oneof_case_[0] = kReferenceCudaConvPlan; +} +inline void AutotuneResult_FailureResult::clear_reference_cuda_conv_plan() { + if (_internal_has_reference_cuda_conv_plan()) { + if (GetArenaForAllocation() == nullptr) { + delete _impl_.key_.reference_cuda_conv_plan_; + } + clear_has_key(); + } +} +inline ::xla::AutotuneResult_CudaConvPlanKey* AutotuneResult_FailureResult::release_reference_cuda_conv_plan() { + // @@protoc_insertion_point(field_release:xla.AutotuneResult.FailureResult.reference_cuda_conv_plan) + if (_internal_has_reference_cuda_conv_plan()) { + clear_has_key(); + ::xla::AutotuneResult_CudaConvPlanKey* temp = _impl_.key_.reference_cuda_conv_plan_; + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + _impl_.key_.reference_cuda_conv_plan_ = nullptr; + return temp; + } else { + return nullptr; + } +} +inline const ::xla::AutotuneResult_CudaConvPlanKey& AutotuneResult_FailureResult::_internal_reference_cuda_conv_plan() const { + return _internal_has_reference_cuda_conv_plan() + ? *_impl_.key_.reference_cuda_conv_plan_ + : reinterpret_cast< ::xla::AutotuneResult_CudaConvPlanKey&>(::xla::_AutotuneResult_CudaConvPlanKey_default_instance_); +} +inline const ::xla::AutotuneResult_CudaConvPlanKey& AutotuneResult_FailureResult::reference_cuda_conv_plan() const { + // @@protoc_insertion_point(field_get:xla.AutotuneResult.FailureResult.reference_cuda_conv_plan) + return _internal_reference_cuda_conv_plan(); +} +inline ::xla::AutotuneResult_CudaConvPlanKey* AutotuneResult_FailureResult::unsafe_arena_release_reference_cuda_conv_plan() { + // @@protoc_insertion_point(field_unsafe_arena_release:xla.AutotuneResult.FailureResult.reference_cuda_conv_plan) + if (_internal_has_reference_cuda_conv_plan()) { + clear_has_key(); + ::xla::AutotuneResult_CudaConvPlanKey* temp = _impl_.key_.reference_cuda_conv_plan_; + _impl_.key_.reference_cuda_conv_plan_ = nullptr; + return temp; + } else { + return nullptr; + } +} +inline void AutotuneResult_FailureResult::unsafe_arena_set_allocated_reference_cuda_conv_plan(::xla::AutotuneResult_CudaConvPlanKey* reference_cuda_conv_plan) { + clear_key(); + if (reference_cuda_conv_plan) { + set_has_reference_cuda_conv_plan(); + _impl_.key_.reference_cuda_conv_plan_ = reference_cuda_conv_plan; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:xla.AutotuneResult.FailureResult.reference_cuda_conv_plan) +} +inline ::xla::AutotuneResult_CudaConvPlanKey* AutotuneResult_FailureResult::_internal_mutable_reference_cuda_conv_plan() { + if (!_internal_has_reference_cuda_conv_plan()) { + clear_key(); + set_has_reference_cuda_conv_plan(); + _impl_.key_.reference_cuda_conv_plan_ = CreateMaybeMessage< ::xla::AutotuneResult_CudaConvPlanKey >(GetArenaForAllocation()); + } + return _impl_.key_.reference_cuda_conv_plan_; +} +inline ::xla::AutotuneResult_CudaConvPlanKey* AutotuneResult_FailureResult::mutable_reference_cuda_conv_plan() { + ::xla::AutotuneResult_CudaConvPlanKey* _msg = _internal_mutable_reference_cuda_conv_plan(); + // @@protoc_insertion_point(field_mutable:xla.AutotuneResult.FailureResult.reference_cuda_conv_plan) + return _msg; +} + +// .stream_executor.dnn.AlgorithmProto reference_algorithm = 15; +inline bool AutotuneResult_FailureResult::_internal_has_reference_algorithm() const { + return key_case() == kReferenceAlgorithm; +} +inline bool AutotuneResult_FailureResult::has_reference_algorithm() const { + return _internal_has_reference_algorithm(); +} +inline void AutotuneResult_FailureResult::set_has_reference_algorithm() { + _impl_._oneof_case_[0] = kReferenceAlgorithm; +} +inline ::stream_executor::dnn::AlgorithmProto* AutotuneResult_FailureResult::release_reference_algorithm() { + // @@protoc_insertion_point(field_release:xla.AutotuneResult.FailureResult.reference_algorithm) + if (_internal_has_reference_algorithm()) { + clear_has_key(); + ::stream_executor::dnn::AlgorithmProto* temp = _impl_.key_.reference_algorithm_; + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + _impl_.key_.reference_algorithm_ = nullptr; + return temp; + } else { + return nullptr; + } +} +inline const ::stream_executor::dnn::AlgorithmProto& AutotuneResult_FailureResult::_internal_reference_algorithm() const { + return _internal_has_reference_algorithm() + ? *_impl_.key_.reference_algorithm_ + : reinterpret_cast< ::stream_executor::dnn::AlgorithmProto&>(::stream_executor::dnn::_AlgorithmProto_default_instance_); +} +inline const ::stream_executor::dnn::AlgorithmProto& AutotuneResult_FailureResult::reference_algorithm() const { + // @@protoc_insertion_point(field_get:xla.AutotuneResult.FailureResult.reference_algorithm) + return _internal_reference_algorithm(); +} +inline ::stream_executor::dnn::AlgorithmProto* AutotuneResult_FailureResult::unsafe_arena_release_reference_algorithm() { + // @@protoc_insertion_point(field_unsafe_arena_release:xla.AutotuneResult.FailureResult.reference_algorithm) + if (_internal_has_reference_algorithm()) { + clear_has_key(); + ::stream_executor::dnn::AlgorithmProto* temp = _impl_.key_.reference_algorithm_; + _impl_.key_.reference_algorithm_ = nullptr; + return temp; + } else { + return nullptr; + } +} +inline void AutotuneResult_FailureResult::unsafe_arena_set_allocated_reference_algorithm(::stream_executor::dnn::AlgorithmProto* reference_algorithm) { + clear_key(); + if (reference_algorithm) { + set_has_reference_algorithm(); + _impl_.key_.reference_algorithm_ = reference_algorithm; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:xla.AutotuneResult.FailureResult.reference_algorithm) +} +inline ::stream_executor::dnn::AlgorithmProto* AutotuneResult_FailureResult::_internal_mutable_reference_algorithm() { + if (!_internal_has_reference_algorithm()) { + clear_key(); + set_has_reference_algorithm(); + _impl_.key_.reference_algorithm_ = CreateMaybeMessage< ::stream_executor::dnn::AlgorithmProto >(GetArenaForAllocation()); + } + return _impl_.key_.reference_algorithm_; +} +inline ::stream_executor::dnn::AlgorithmProto* AutotuneResult_FailureResult::mutable_reference_algorithm() { + ::stream_executor::dnn::AlgorithmProto* _msg = _internal_mutable_reference_algorithm(); + // @@protoc_insertion_point(field_mutable:xla.AutotuneResult.FailureResult.reference_algorithm) + return _msg; +} + +// int64 buffer_address = 13; +inline void AutotuneResult_FailureResult::clear_buffer_address() { + _impl_.buffer_address_ = int64_t{0}; +} +inline int64_t AutotuneResult_FailureResult::_internal_buffer_address() const { + return _impl_.buffer_address_; +} +inline int64_t AutotuneResult_FailureResult::buffer_address() const { + // @@protoc_insertion_point(field_get:xla.AutotuneResult.FailureResult.buffer_address) + return _internal_buffer_address(); +} +inline void AutotuneResult_FailureResult::_internal_set_buffer_address(int64_t value) { + + _impl_.buffer_address_ = value; +} +inline void AutotuneResult_FailureResult::set_buffer_address(int64_t value) { + _internal_set_buffer_address(value); + // @@protoc_insertion_point(field_set:xla.AutotuneResult.FailureResult.buffer_address) +} + +inline bool AutotuneResult_FailureResult::has_key() const { + return key_case() != KEY_NOT_SET; +} +inline void AutotuneResult_FailureResult::clear_has_key() { + _impl_._oneof_case_[0] = KEY_NOT_SET; +} +inline AutotuneResult_FailureResult::KeyCase AutotuneResult_FailureResult::key_case() const { + return AutotuneResult_FailureResult::KeyCase(_impl_._oneof_case_[0]); +} +// ------------------------------------------------------------------- + +// AutotuneResult_ConvKey + +// int64 algorithm = 1; +inline void AutotuneResult_ConvKey::clear_algorithm() { + _impl_.algorithm_ = int64_t{0}; +} +inline int64_t AutotuneResult_ConvKey::_internal_algorithm() const { + return _impl_.algorithm_; +} +inline int64_t AutotuneResult_ConvKey::algorithm() const { + // @@protoc_insertion_point(field_get:xla.AutotuneResult.ConvKey.algorithm) + return _internal_algorithm(); +} +inline void AutotuneResult_ConvKey::_internal_set_algorithm(int64_t value) { + + _impl_.algorithm_ = value; +} +inline void AutotuneResult_ConvKey::set_algorithm(int64_t value) { + _internal_set_algorithm(value); + // @@protoc_insertion_point(field_set:xla.AutotuneResult.ConvKey.algorithm) +} + +// bool tensor_ops_enabled = 2; +inline void AutotuneResult_ConvKey::clear_tensor_ops_enabled() { + _impl_.tensor_ops_enabled_ = false; +} +inline bool AutotuneResult_ConvKey::_internal_tensor_ops_enabled() const { + return _impl_.tensor_ops_enabled_; +} +inline bool AutotuneResult_ConvKey::tensor_ops_enabled() const { + // @@protoc_insertion_point(field_get:xla.AutotuneResult.ConvKey.tensor_ops_enabled) + return _internal_tensor_ops_enabled(); +} +inline void AutotuneResult_ConvKey::_internal_set_tensor_ops_enabled(bool value) { + + _impl_.tensor_ops_enabled_ = value; +} +inline void AutotuneResult_ConvKey::set_tensor_ops_enabled(bool value) { + _internal_set_tensor_ops_enabled(value); + // @@protoc_insertion_point(field_set:xla.AutotuneResult.ConvKey.tensor_ops_enabled) +} + +// ------------------------------------------------------------------- + +// AutotuneResult_GemmKey + +// int64 algorithm = 1; +inline void AutotuneResult_GemmKey::clear_algorithm() { + _impl_.algorithm_ = int64_t{0}; +} +inline int64_t AutotuneResult_GemmKey::_internal_algorithm() const { + return _impl_.algorithm_; +} +inline int64_t AutotuneResult_GemmKey::algorithm() const { + // @@protoc_insertion_point(field_get:xla.AutotuneResult.GemmKey.algorithm) + return _internal_algorithm(); +} +inline void AutotuneResult_GemmKey::_internal_set_algorithm(int64_t value) { + + _impl_.algorithm_ = value; +} +inline void AutotuneResult_GemmKey::set_algorithm(int64_t value) { + _internal_set_algorithm(value); + // @@protoc_insertion_point(field_set:xla.AutotuneResult.GemmKey.algorithm) +} + +// ------------------------------------------------------------------- + +// AutotuneResult_CudaConvPlanKey + +// string exec_plan_id = 1; +inline void AutotuneResult_CudaConvPlanKey::clear_exec_plan_id() { + _impl_.exec_plan_id_.ClearToEmpty(); +} +inline const std::string& AutotuneResult_CudaConvPlanKey::exec_plan_id() const { + // @@protoc_insertion_point(field_get:xla.AutotuneResult.CudaConvPlanKey.exec_plan_id) + return _internal_exec_plan_id(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void AutotuneResult_CudaConvPlanKey::set_exec_plan_id(ArgT0&& arg0, ArgT... args) { + + _impl_.exec_plan_id_.Set(static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:xla.AutotuneResult.CudaConvPlanKey.exec_plan_id) +} +inline std::string* AutotuneResult_CudaConvPlanKey::mutable_exec_plan_id() { + std::string* _s = _internal_mutable_exec_plan_id(); + // @@protoc_insertion_point(field_mutable:xla.AutotuneResult.CudaConvPlanKey.exec_plan_id) + return _s; +} +inline const std::string& AutotuneResult_CudaConvPlanKey::_internal_exec_plan_id() const { + return _impl_.exec_plan_id_.Get(); +} +inline void AutotuneResult_CudaConvPlanKey::_internal_set_exec_plan_id(const std::string& value) { + + _impl_.exec_plan_id_.Set(value, GetArenaForAllocation()); +} +inline std::string* AutotuneResult_CudaConvPlanKey::_internal_mutable_exec_plan_id() { + + return _impl_.exec_plan_id_.Mutable(GetArenaForAllocation()); +} +inline std::string* AutotuneResult_CudaConvPlanKey::release_exec_plan_id() { + // @@protoc_insertion_point(field_release:xla.AutotuneResult.CudaConvPlanKey.exec_plan_id) + return _impl_.exec_plan_id_.Release(); +} +inline void AutotuneResult_CudaConvPlanKey::set_allocated_exec_plan_id(std::string* exec_plan_id) { + if (exec_plan_id != nullptr) { + + } else { + + } + _impl_.exec_plan_id_.SetAllocated(exec_plan_id, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.exec_plan_id_.IsDefault()) { + _impl_.exec_plan_id_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:xla.AutotuneResult.CudaConvPlanKey.exec_plan_id) +} + +// ------------------------------------------------------------------- + +// AutotuneResult_TritonGemmKey + +// int64 block_m = 1; +inline void AutotuneResult_TritonGemmKey::clear_block_m() { + _impl_.block_m_ = int64_t{0}; +} +inline int64_t AutotuneResult_TritonGemmKey::_internal_block_m() const { + return _impl_.block_m_; +} +inline int64_t AutotuneResult_TritonGemmKey::block_m() const { + // @@protoc_insertion_point(field_get:xla.AutotuneResult.TritonGemmKey.block_m) + return _internal_block_m(); +} +inline void AutotuneResult_TritonGemmKey::_internal_set_block_m(int64_t value) { + + _impl_.block_m_ = value; +} +inline void AutotuneResult_TritonGemmKey::set_block_m(int64_t value) { + _internal_set_block_m(value); + // @@protoc_insertion_point(field_set:xla.AutotuneResult.TritonGemmKey.block_m) +} + +// int64 block_n = 2; +inline void AutotuneResult_TritonGemmKey::clear_block_n() { + _impl_.block_n_ = int64_t{0}; +} +inline int64_t AutotuneResult_TritonGemmKey::_internal_block_n() const { + return _impl_.block_n_; +} +inline int64_t AutotuneResult_TritonGemmKey::block_n() const { + // @@protoc_insertion_point(field_get:xla.AutotuneResult.TritonGemmKey.block_n) + return _internal_block_n(); +} +inline void AutotuneResult_TritonGemmKey::_internal_set_block_n(int64_t value) { + + _impl_.block_n_ = value; +} +inline void AutotuneResult_TritonGemmKey::set_block_n(int64_t value) { + _internal_set_block_n(value); + // @@protoc_insertion_point(field_set:xla.AutotuneResult.TritonGemmKey.block_n) +} + +// int64 block_k = 3; +inline void AutotuneResult_TritonGemmKey::clear_block_k() { + _impl_.block_k_ = int64_t{0}; +} +inline int64_t AutotuneResult_TritonGemmKey::_internal_block_k() const { + return _impl_.block_k_; +} +inline int64_t AutotuneResult_TritonGemmKey::block_k() const { + // @@protoc_insertion_point(field_get:xla.AutotuneResult.TritonGemmKey.block_k) + return _internal_block_k(); +} +inline void AutotuneResult_TritonGemmKey::_internal_set_block_k(int64_t value) { + + _impl_.block_k_ = value; +} +inline void AutotuneResult_TritonGemmKey::set_block_k(int64_t value) { + _internal_set_block_k(value); + // @@protoc_insertion_point(field_set:xla.AutotuneResult.TritonGemmKey.block_k) +} + +// int64 split_k = 4; +inline void AutotuneResult_TritonGemmKey::clear_split_k() { + _impl_.split_k_ = int64_t{0}; +} +inline int64_t AutotuneResult_TritonGemmKey::_internal_split_k() const { + return _impl_.split_k_; +} +inline int64_t AutotuneResult_TritonGemmKey::split_k() const { + // @@protoc_insertion_point(field_get:xla.AutotuneResult.TritonGemmKey.split_k) + return _internal_split_k(); +} +inline void AutotuneResult_TritonGemmKey::_internal_set_split_k(int64_t value) { + + _impl_.split_k_ = value; +} +inline void AutotuneResult_TritonGemmKey::set_split_k(int64_t value) { + _internal_set_split_k(value); + // @@protoc_insertion_point(field_set:xla.AutotuneResult.TritonGemmKey.split_k) +} + +// int64 num_stages = 5; +inline void AutotuneResult_TritonGemmKey::clear_num_stages() { + _impl_.num_stages_ = int64_t{0}; +} +inline int64_t AutotuneResult_TritonGemmKey::_internal_num_stages() const { + return _impl_.num_stages_; +} +inline int64_t AutotuneResult_TritonGemmKey::num_stages() const { + // @@protoc_insertion_point(field_get:xla.AutotuneResult.TritonGemmKey.num_stages) + return _internal_num_stages(); +} +inline void AutotuneResult_TritonGemmKey::_internal_set_num_stages(int64_t value) { + + _impl_.num_stages_ = value; +} +inline void AutotuneResult_TritonGemmKey::set_num_stages(int64_t value) { + _internal_set_num_stages(value); + // @@protoc_insertion_point(field_set:xla.AutotuneResult.TritonGemmKey.num_stages) +} + +// int64 num_warps = 6; +inline void AutotuneResult_TritonGemmKey::clear_num_warps() { + _impl_.num_warps_ = int64_t{0}; +} +inline int64_t AutotuneResult_TritonGemmKey::_internal_num_warps() const { + return _impl_.num_warps_; +} +inline int64_t AutotuneResult_TritonGemmKey::num_warps() const { + // @@protoc_insertion_point(field_get:xla.AutotuneResult.TritonGemmKey.num_warps) + return _internal_num_warps(); +} +inline void AutotuneResult_TritonGemmKey::_internal_set_num_warps(int64_t value) { + + _impl_.num_warps_ = value; +} +inline void AutotuneResult_TritonGemmKey::set_num_warps(int64_t value) { + _internal_set_num_warps(value); + // @@protoc_insertion_point(field_set:xla.AutotuneResult.TritonGemmKey.num_warps) +} + +// ------------------------------------------------------------------- + +// AutotuneResult + +// int64 scratch_bytes = 8; +inline void AutotuneResult::clear_scratch_bytes() { + _impl_.scratch_bytes_ = int64_t{0}; +} +inline int64_t AutotuneResult::_internal_scratch_bytes() const { + return _impl_.scratch_bytes_; +} +inline int64_t AutotuneResult::scratch_bytes() const { + // @@protoc_insertion_point(field_get:xla.AutotuneResult.scratch_bytes) + return _internal_scratch_bytes(); +} +inline void AutotuneResult::_internal_set_scratch_bytes(int64_t value) { + + _impl_.scratch_bytes_ = value; +} +inline void AutotuneResult::set_scratch_bytes(int64_t value) { + _internal_set_scratch_bytes(value); + // @@protoc_insertion_point(field_set:xla.AutotuneResult.scratch_bytes) +} + +// .google.protobuf.Duration run_time = 9; +inline bool AutotuneResult::_internal_has_run_time() const { + return this != internal_default_instance() && _impl_.run_time_ != nullptr; +} +inline bool AutotuneResult::has_run_time() const { + return _internal_has_run_time(); +} +inline const ::PROTOBUF_NAMESPACE_ID::Duration& AutotuneResult::_internal_run_time() const { + const ::PROTOBUF_NAMESPACE_ID::Duration* p = _impl_.run_time_; + return p != nullptr ? *p : reinterpret_cast( + ::PROTOBUF_NAMESPACE_ID::_Duration_default_instance_); +} +inline const ::PROTOBUF_NAMESPACE_ID::Duration& AutotuneResult::run_time() const { + // @@protoc_insertion_point(field_get:xla.AutotuneResult.run_time) + return _internal_run_time(); +} +inline void AutotuneResult::unsafe_arena_set_allocated_run_time( + ::PROTOBUF_NAMESPACE_ID::Duration* run_time) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.run_time_); + } + _impl_.run_time_ = run_time; + if (run_time) { + + } else { + + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:xla.AutotuneResult.run_time) +} +inline ::PROTOBUF_NAMESPACE_ID::Duration* AutotuneResult::release_run_time() { + + ::PROTOBUF_NAMESPACE_ID::Duration* temp = _impl_.run_time_; + _impl_.run_time_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::PROTOBUF_NAMESPACE_ID::Duration* AutotuneResult::unsafe_arena_release_run_time() { + // @@protoc_insertion_point(field_release:xla.AutotuneResult.run_time) + + ::PROTOBUF_NAMESPACE_ID::Duration* temp = _impl_.run_time_; + _impl_.run_time_ = nullptr; + return temp; +} +inline ::PROTOBUF_NAMESPACE_ID::Duration* AutotuneResult::_internal_mutable_run_time() { + + if (_impl_.run_time_ == nullptr) { + auto* p = CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::Duration>(GetArenaForAllocation()); + _impl_.run_time_ = p; + } + return _impl_.run_time_; +} +inline ::PROTOBUF_NAMESPACE_ID::Duration* AutotuneResult::mutable_run_time() { + ::PROTOBUF_NAMESPACE_ID::Duration* _msg = _internal_mutable_run_time(); + // @@protoc_insertion_point(field_mutable:xla.AutotuneResult.run_time) + return _msg; +} +inline void AutotuneResult::set_allocated_run_time(::PROTOBUF_NAMESPACE_ID::Duration* run_time) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete reinterpret_cast< ::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.run_time_); + } + if (run_time) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena( + reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(run_time)); + if (message_arena != submessage_arena) { + run_time = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, run_time, submessage_arena); + } + + } else { + + } + _impl_.run_time_ = run_time; + // @@protoc_insertion_point(field_set_allocated:xla.AutotuneResult.run_time) +} + +// .xla.AutotuneResult.FailureResult failure = 7; +inline bool AutotuneResult::_internal_has_failure() const { + return this != internal_default_instance() && _impl_.failure_ != nullptr; +} +inline bool AutotuneResult::has_failure() const { + return _internal_has_failure(); +} +inline void AutotuneResult::clear_failure() { + if (GetArenaForAllocation() == nullptr && _impl_.failure_ != nullptr) { + delete _impl_.failure_; + } + _impl_.failure_ = nullptr; +} +inline const ::xla::AutotuneResult_FailureResult& AutotuneResult::_internal_failure() const { + const ::xla::AutotuneResult_FailureResult* p = _impl_.failure_; + return p != nullptr ? *p : reinterpret_cast( + ::xla::_AutotuneResult_FailureResult_default_instance_); +} +inline const ::xla::AutotuneResult_FailureResult& AutotuneResult::failure() const { + // @@protoc_insertion_point(field_get:xla.AutotuneResult.failure) + return _internal_failure(); +} +inline void AutotuneResult::unsafe_arena_set_allocated_failure( + ::xla::AutotuneResult_FailureResult* failure) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.failure_); + } + _impl_.failure_ = failure; + if (failure) { + + } else { + + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:xla.AutotuneResult.failure) +} +inline ::xla::AutotuneResult_FailureResult* AutotuneResult::release_failure() { + + ::xla::AutotuneResult_FailureResult* temp = _impl_.failure_; + _impl_.failure_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::xla::AutotuneResult_FailureResult* AutotuneResult::unsafe_arena_release_failure() { + // @@protoc_insertion_point(field_release:xla.AutotuneResult.failure) + + ::xla::AutotuneResult_FailureResult* temp = _impl_.failure_; + _impl_.failure_ = nullptr; + return temp; +} +inline ::xla::AutotuneResult_FailureResult* AutotuneResult::_internal_mutable_failure() { + + if (_impl_.failure_ == nullptr) { + auto* p = CreateMaybeMessage<::xla::AutotuneResult_FailureResult>(GetArenaForAllocation()); + _impl_.failure_ = p; + } + return _impl_.failure_; +} +inline ::xla::AutotuneResult_FailureResult* AutotuneResult::mutable_failure() { + ::xla::AutotuneResult_FailureResult* _msg = _internal_mutable_failure(); + // @@protoc_insertion_point(field_mutable:xla.AutotuneResult.failure) + return _msg; +} +inline void AutotuneResult::set_allocated_failure(::xla::AutotuneResult_FailureResult* failure) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete _impl_.failure_; + } + if (failure) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(failure); + if (message_arena != submessage_arena) { + failure = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, failure, submessage_arena); + } + + } else { + + } + _impl_.failure_ = failure; + // @@protoc_insertion_point(field_set_allocated:xla.AutotuneResult.failure) +} + +// .xla.AutotuneResult.ConvKey conv = 5; +inline bool AutotuneResult::_internal_has_conv() const { + return key_case() == kConv; +} +inline bool AutotuneResult::has_conv() const { + return _internal_has_conv(); +} +inline void AutotuneResult::set_has_conv() { + _impl_._oneof_case_[0] = kConv; +} +inline void AutotuneResult::clear_conv() { + if (_internal_has_conv()) { + if (GetArenaForAllocation() == nullptr) { + delete _impl_.key_.conv_; + } + clear_has_key(); + } +} +inline ::xla::AutotuneResult_ConvKey* AutotuneResult::release_conv() { + // @@protoc_insertion_point(field_release:xla.AutotuneResult.conv) + if (_internal_has_conv()) { + clear_has_key(); + ::xla::AutotuneResult_ConvKey* temp = _impl_.key_.conv_; + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + _impl_.key_.conv_ = nullptr; + return temp; + } else { + return nullptr; + } +} +inline const ::xla::AutotuneResult_ConvKey& AutotuneResult::_internal_conv() const { + return _internal_has_conv() + ? *_impl_.key_.conv_ + : reinterpret_cast< ::xla::AutotuneResult_ConvKey&>(::xla::_AutotuneResult_ConvKey_default_instance_); +} +inline const ::xla::AutotuneResult_ConvKey& AutotuneResult::conv() const { + // @@protoc_insertion_point(field_get:xla.AutotuneResult.conv) + return _internal_conv(); +} +inline ::xla::AutotuneResult_ConvKey* AutotuneResult::unsafe_arena_release_conv() { + // @@protoc_insertion_point(field_unsafe_arena_release:xla.AutotuneResult.conv) + if (_internal_has_conv()) { + clear_has_key(); + ::xla::AutotuneResult_ConvKey* temp = _impl_.key_.conv_; + _impl_.key_.conv_ = nullptr; + return temp; + } else { + return nullptr; + } +} +inline void AutotuneResult::unsafe_arena_set_allocated_conv(::xla::AutotuneResult_ConvKey* conv) { + clear_key(); + if (conv) { + set_has_conv(); + _impl_.key_.conv_ = conv; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:xla.AutotuneResult.conv) +} +inline ::xla::AutotuneResult_ConvKey* AutotuneResult::_internal_mutable_conv() { + if (!_internal_has_conv()) { + clear_key(); + set_has_conv(); + _impl_.key_.conv_ = CreateMaybeMessage< ::xla::AutotuneResult_ConvKey >(GetArenaForAllocation()); + } + return _impl_.key_.conv_; +} +inline ::xla::AutotuneResult_ConvKey* AutotuneResult::mutable_conv() { + ::xla::AutotuneResult_ConvKey* _msg = _internal_mutable_conv(); + // @@protoc_insertion_point(field_mutable:xla.AutotuneResult.conv) + return _msg; +} + +// .xla.AutotuneResult.GemmKey gemm = 6; +inline bool AutotuneResult::_internal_has_gemm() const { + return key_case() == kGemm; +} +inline bool AutotuneResult::has_gemm() const { + return _internal_has_gemm(); +} +inline void AutotuneResult::set_has_gemm() { + _impl_._oneof_case_[0] = kGemm; +} +inline void AutotuneResult::clear_gemm() { + if (_internal_has_gemm()) { + if (GetArenaForAllocation() == nullptr) { + delete _impl_.key_.gemm_; + } + clear_has_key(); + } +} +inline ::xla::AutotuneResult_GemmKey* AutotuneResult::release_gemm() { + // @@protoc_insertion_point(field_release:xla.AutotuneResult.gemm) + if (_internal_has_gemm()) { + clear_has_key(); + ::xla::AutotuneResult_GemmKey* temp = _impl_.key_.gemm_; + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + _impl_.key_.gemm_ = nullptr; + return temp; + } else { + return nullptr; + } +} +inline const ::xla::AutotuneResult_GemmKey& AutotuneResult::_internal_gemm() const { + return _internal_has_gemm() + ? *_impl_.key_.gemm_ + : reinterpret_cast< ::xla::AutotuneResult_GemmKey&>(::xla::_AutotuneResult_GemmKey_default_instance_); +} +inline const ::xla::AutotuneResult_GemmKey& AutotuneResult::gemm() const { + // @@protoc_insertion_point(field_get:xla.AutotuneResult.gemm) + return _internal_gemm(); +} +inline ::xla::AutotuneResult_GemmKey* AutotuneResult::unsafe_arena_release_gemm() { + // @@protoc_insertion_point(field_unsafe_arena_release:xla.AutotuneResult.gemm) + if (_internal_has_gemm()) { + clear_has_key(); + ::xla::AutotuneResult_GemmKey* temp = _impl_.key_.gemm_; + _impl_.key_.gemm_ = nullptr; + return temp; + } else { + return nullptr; + } +} +inline void AutotuneResult::unsafe_arena_set_allocated_gemm(::xla::AutotuneResult_GemmKey* gemm) { + clear_key(); + if (gemm) { + set_has_gemm(); + _impl_.key_.gemm_ = gemm; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:xla.AutotuneResult.gemm) +} +inline ::xla::AutotuneResult_GemmKey* AutotuneResult::_internal_mutable_gemm() { + if (!_internal_has_gemm()) { + clear_key(); + set_has_gemm(); + _impl_.key_.gemm_ = CreateMaybeMessage< ::xla::AutotuneResult_GemmKey >(GetArenaForAllocation()); + } + return _impl_.key_.gemm_; +} +inline ::xla::AutotuneResult_GemmKey* AutotuneResult::mutable_gemm() { + ::xla::AutotuneResult_GemmKey* _msg = _internal_mutable_gemm(); + // @@protoc_insertion_point(field_mutable:xla.AutotuneResult.gemm) + return _msg; +} + +// .xla.AutotuneResult.TritonGemmKey triton = 17; +inline bool AutotuneResult::_internal_has_triton() const { + return key_case() == kTriton; +} +inline bool AutotuneResult::has_triton() const { + return _internal_has_triton(); +} +inline void AutotuneResult::set_has_triton() { + _impl_._oneof_case_[0] = kTriton; +} +inline void AutotuneResult::clear_triton() { + if (_internal_has_triton()) { + if (GetArenaForAllocation() == nullptr) { + delete _impl_.key_.triton_; + } + clear_has_key(); + } +} +inline ::xla::AutotuneResult_TritonGemmKey* AutotuneResult::release_triton() { + // @@protoc_insertion_point(field_release:xla.AutotuneResult.triton) + if (_internal_has_triton()) { + clear_has_key(); + ::xla::AutotuneResult_TritonGemmKey* temp = _impl_.key_.triton_; + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + _impl_.key_.triton_ = nullptr; + return temp; + } else { + return nullptr; + } +} +inline const ::xla::AutotuneResult_TritonGemmKey& AutotuneResult::_internal_triton() const { + return _internal_has_triton() + ? *_impl_.key_.triton_ + : reinterpret_cast< ::xla::AutotuneResult_TritonGemmKey&>(::xla::_AutotuneResult_TritonGemmKey_default_instance_); +} +inline const ::xla::AutotuneResult_TritonGemmKey& AutotuneResult::triton() const { + // @@protoc_insertion_point(field_get:xla.AutotuneResult.triton) + return _internal_triton(); +} +inline ::xla::AutotuneResult_TritonGemmKey* AutotuneResult::unsafe_arena_release_triton() { + // @@protoc_insertion_point(field_unsafe_arena_release:xla.AutotuneResult.triton) + if (_internal_has_triton()) { + clear_has_key(); + ::xla::AutotuneResult_TritonGemmKey* temp = _impl_.key_.triton_; + _impl_.key_.triton_ = nullptr; + return temp; + } else { + return nullptr; + } +} +inline void AutotuneResult::unsafe_arena_set_allocated_triton(::xla::AutotuneResult_TritonGemmKey* triton) { + clear_key(); + if (triton) { + set_has_triton(); + _impl_.key_.triton_ = triton; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:xla.AutotuneResult.triton) +} +inline ::xla::AutotuneResult_TritonGemmKey* AutotuneResult::_internal_mutable_triton() { + if (!_internal_has_triton()) { + clear_key(); + set_has_triton(); + _impl_.key_.triton_ = CreateMaybeMessage< ::xla::AutotuneResult_TritonGemmKey >(GetArenaForAllocation()); + } + return _impl_.key_.triton_; +} +inline ::xla::AutotuneResult_TritonGemmKey* AutotuneResult::mutable_triton() { + ::xla::AutotuneResult_TritonGemmKey* _msg = _internal_mutable_triton(); + // @@protoc_insertion_point(field_mutable:xla.AutotuneResult.triton) + return _msg; +} + +// .xla.AutotuneResult.CudaConvPlanKey cuda_conv_plan = 15; +inline bool AutotuneResult::_internal_has_cuda_conv_plan() const { + return key_case() == kCudaConvPlan; +} +inline bool AutotuneResult::has_cuda_conv_plan() const { + return _internal_has_cuda_conv_plan(); +} +inline void AutotuneResult::set_has_cuda_conv_plan() { + _impl_._oneof_case_[0] = kCudaConvPlan; +} +inline void AutotuneResult::clear_cuda_conv_plan() { + if (_internal_has_cuda_conv_plan()) { + if (GetArenaForAllocation() == nullptr) { + delete _impl_.key_.cuda_conv_plan_; + } + clear_has_key(); + } +} +inline ::xla::AutotuneResult_CudaConvPlanKey* AutotuneResult::release_cuda_conv_plan() { + // @@protoc_insertion_point(field_release:xla.AutotuneResult.cuda_conv_plan) + if (_internal_has_cuda_conv_plan()) { + clear_has_key(); + ::xla::AutotuneResult_CudaConvPlanKey* temp = _impl_.key_.cuda_conv_plan_; + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + _impl_.key_.cuda_conv_plan_ = nullptr; + return temp; + } else { + return nullptr; + } +} +inline const ::xla::AutotuneResult_CudaConvPlanKey& AutotuneResult::_internal_cuda_conv_plan() const { + return _internal_has_cuda_conv_plan() + ? *_impl_.key_.cuda_conv_plan_ + : reinterpret_cast< ::xla::AutotuneResult_CudaConvPlanKey&>(::xla::_AutotuneResult_CudaConvPlanKey_default_instance_); +} +inline const ::xla::AutotuneResult_CudaConvPlanKey& AutotuneResult::cuda_conv_plan() const { + // @@protoc_insertion_point(field_get:xla.AutotuneResult.cuda_conv_plan) + return _internal_cuda_conv_plan(); +} +inline ::xla::AutotuneResult_CudaConvPlanKey* AutotuneResult::unsafe_arena_release_cuda_conv_plan() { + // @@protoc_insertion_point(field_unsafe_arena_release:xla.AutotuneResult.cuda_conv_plan) + if (_internal_has_cuda_conv_plan()) { + clear_has_key(); + ::xla::AutotuneResult_CudaConvPlanKey* temp = _impl_.key_.cuda_conv_plan_; + _impl_.key_.cuda_conv_plan_ = nullptr; + return temp; + } else { + return nullptr; + } +} +inline void AutotuneResult::unsafe_arena_set_allocated_cuda_conv_plan(::xla::AutotuneResult_CudaConvPlanKey* cuda_conv_plan) { + clear_key(); + if (cuda_conv_plan) { + set_has_cuda_conv_plan(); + _impl_.key_.cuda_conv_plan_ = cuda_conv_plan; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:xla.AutotuneResult.cuda_conv_plan) +} +inline ::xla::AutotuneResult_CudaConvPlanKey* AutotuneResult::_internal_mutable_cuda_conv_plan() { + if (!_internal_has_cuda_conv_plan()) { + clear_key(); + set_has_cuda_conv_plan(); + _impl_.key_.cuda_conv_plan_ = CreateMaybeMessage< ::xla::AutotuneResult_CudaConvPlanKey >(GetArenaForAllocation()); + } + return _impl_.key_.cuda_conv_plan_; +} +inline ::xla::AutotuneResult_CudaConvPlanKey* AutotuneResult::mutable_cuda_conv_plan() { + ::xla::AutotuneResult_CudaConvPlanKey* _msg = _internal_mutable_cuda_conv_plan(); + // @@protoc_insertion_point(field_mutable:xla.AutotuneResult.cuda_conv_plan) + return _msg; +} + +// .stream_executor.dnn.AlgorithmProto algorithm = 16; +inline bool AutotuneResult::_internal_has_algorithm() const { + return key_case() == kAlgorithm; +} +inline bool AutotuneResult::has_algorithm() const { + return _internal_has_algorithm(); +} +inline void AutotuneResult::set_has_algorithm() { + _impl_._oneof_case_[0] = kAlgorithm; +} +inline ::stream_executor::dnn::AlgorithmProto* AutotuneResult::release_algorithm() { + // @@protoc_insertion_point(field_release:xla.AutotuneResult.algorithm) + if (_internal_has_algorithm()) { + clear_has_key(); + ::stream_executor::dnn::AlgorithmProto* temp = _impl_.key_.algorithm_; + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } + _impl_.key_.algorithm_ = nullptr; + return temp; + } else { + return nullptr; + } +} +inline const ::stream_executor::dnn::AlgorithmProto& AutotuneResult::_internal_algorithm() const { + return _internal_has_algorithm() + ? *_impl_.key_.algorithm_ + : reinterpret_cast< ::stream_executor::dnn::AlgorithmProto&>(::stream_executor::dnn::_AlgorithmProto_default_instance_); +} +inline const ::stream_executor::dnn::AlgorithmProto& AutotuneResult::algorithm() const { + // @@protoc_insertion_point(field_get:xla.AutotuneResult.algorithm) + return _internal_algorithm(); +} +inline ::stream_executor::dnn::AlgorithmProto* AutotuneResult::unsafe_arena_release_algorithm() { + // @@protoc_insertion_point(field_unsafe_arena_release:xla.AutotuneResult.algorithm) + if (_internal_has_algorithm()) { + clear_has_key(); + ::stream_executor::dnn::AlgorithmProto* temp = _impl_.key_.algorithm_; + _impl_.key_.algorithm_ = nullptr; + return temp; + } else { + return nullptr; + } +} +inline void AutotuneResult::unsafe_arena_set_allocated_algorithm(::stream_executor::dnn::AlgorithmProto* algorithm) { + clear_key(); + if (algorithm) { + set_has_algorithm(); + _impl_.key_.algorithm_ = algorithm; + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:xla.AutotuneResult.algorithm) +} +inline ::stream_executor::dnn::AlgorithmProto* AutotuneResult::_internal_mutable_algorithm() { + if (!_internal_has_algorithm()) { + clear_key(); + set_has_algorithm(); + _impl_.key_.algorithm_ = CreateMaybeMessage< ::stream_executor::dnn::AlgorithmProto >(GetArenaForAllocation()); + } + return _impl_.key_.algorithm_; +} +inline ::stream_executor::dnn::AlgorithmProto* AutotuneResult::mutable_algorithm() { + ::stream_executor::dnn::AlgorithmProto* _msg = _internal_mutable_algorithm(); + // @@protoc_insertion_point(field_mutable:xla.AutotuneResult.algorithm) + return _msg; +} + +inline bool AutotuneResult::has_key() const { + return key_case() != KEY_NOT_SET; +} +inline void AutotuneResult::clear_has_key() { + _impl_._oneof_case_[0] = KEY_NOT_SET; +} +inline AutotuneResult::KeyCase AutotuneResult::key_case() const { + return AutotuneResult::KeyCase(_impl_._oneof_case_[0]); +} +// ------------------------------------------------------------------- + +// AutotuningLog + +// .google.protobuf.Any instr = 1; +inline bool AutotuningLog::_internal_has_instr() const { + return this != internal_default_instance() && _impl_.instr_ != nullptr; +} +inline bool AutotuningLog::has_instr() const { + return _internal_has_instr(); +} +inline const ::PROTOBUF_NAMESPACE_ID::Any& AutotuningLog::_internal_instr() const { + const ::PROTOBUF_NAMESPACE_ID::Any* p = _impl_.instr_; + return p != nullptr ? *p : reinterpret_cast( + ::PROTOBUF_NAMESPACE_ID::_Any_default_instance_); +} +inline const ::PROTOBUF_NAMESPACE_ID::Any& AutotuningLog::instr() const { + // @@protoc_insertion_point(field_get:xla.AutotuningLog.instr) + return _internal_instr(); +} +inline void AutotuningLog::unsafe_arena_set_allocated_instr( + ::PROTOBUF_NAMESPACE_ID::Any* instr) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.instr_); + } + _impl_.instr_ = instr; + if (instr) { + + } else { + + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:xla.AutotuningLog.instr) +} +inline ::PROTOBUF_NAMESPACE_ID::Any* AutotuningLog::release_instr() { + + ::PROTOBUF_NAMESPACE_ID::Any* temp = _impl_.instr_; + _impl_.instr_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::PROTOBUF_NAMESPACE_ID::Any* AutotuningLog::unsafe_arena_release_instr() { + // @@protoc_insertion_point(field_release:xla.AutotuningLog.instr) + + ::PROTOBUF_NAMESPACE_ID::Any* temp = _impl_.instr_; + _impl_.instr_ = nullptr; + return temp; +} +inline ::PROTOBUF_NAMESPACE_ID::Any* AutotuningLog::_internal_mutable_instr() { + + if (_impl_.instr_ == nullptr) { + auto* p = CreateMaybeMessage<::PROTOBUF_NAMESPACE_ID::Any>(GetArenaForAllocation()); + _impl_.instr_ = p; + } + return _impl_.instr_; +} +inline ::PROTOBUF_NAMESPACE_ID::Any* AutotuningLog::mutable_instr() { + ::PROTOBUF_NAMESPACE_ID::Any* _msg = _internal_mutable_instr(); + // @@protoc_insertion_point(field_mutable:xla.AutotuningLog.instr) + return _msg; +} +inline void AutotuningLog::set_allocated_instr(::PROTOBUF_NAMESPACE_ID::Any* instr) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete reinterpret_cast< ::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.instr_); + } + if (instr) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena( + reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(instr)); + if (message_arena != submessage_arena) { + instr = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, instr, submessage_arena); + } + + } else { + + } + _impl_.instr_ = instr; + // @@protoc_insertion_point(field_set_allocated:xla.AutotuningLog.instr) +} + +// repeated .xla.AutotuneResult results = 2; +inline int AutotuningLog::_internal_results_size() const { + return _impl_.results_.size(); +} +inline int AutotuningLog::results_size() const { + return _internal_results_size(); +} +inline void AutotuningLog::clear_results() { + _impl_.results_.Clear(); +} +inline ::xla::AutotuneResult* AutotuningLog::mutable_results(int index) { + // @@protoc_insertion_point(field_mutable:xla.AutotuningLog.results) + return _impl_.results_.Mutable(index); +} +inline ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::xla::AutotuneResult >* +AutotuningLog::mutable_results() { + // @@protoc_insertion_point(field_mutable_list:xla.AutotuningLog.results) + return &_impl_.results_; +} +inline const ::xla::AutotuneResult& AutotuningLog::_internal_results(int index) const { + return _impl_.results_.Get(index); +} +inline const ::xla::AutotuneResult& AutotuningLog::results(int index) const { + // @@protoc_insertion_point(field_get:xla.AutotuningLog.results) + return _internal_results(index); +} +inline ::xla::AutotuneResult* AutotuningLog::_internal_add_results() { + return _impl_.results_.Add(); +} +inline ::xla::AutotuneResult* AutotuningLog::add_results() { + ::xla::AutotuneResult* _add = _internal_add_results(); + // @@protoc_insertion_point(field_add:xla.AutotuningLog.results) + return _add; +} +inline const ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::xla::AutotuneResult >& +AutotuningLog::results() const { + // @@protoc_insertion_point(field_list:xla.AutotuningLog.results) + return _impl_.results_; +} + +// .xla.CudnnVersion cudnn_version = 3; +inline bool AutotuningLog::_internal_has_cudnn_version() const { + return this != internal_default_instance() && _impl_.cudnn_version_ != nullptr; +} +inline bool AutotuningLog::has_cudnn_version() const { + return _internal_has_cudnn_version(); +} +inline void AutotuningLog::clear_cudnn_version() { + if (GetArenaForAllocation() == nullptr && _impl_.cudnn_version_ != nullptr) { + delete _impl_.cudnn_version_; + } + _impl_.cudnn_version_ = nullptr; +} +inline const ::xla::CudnnVersion& AutotuningLog::_internal_cudnn_version() const { + const ::xla::CudnnVersion* p = _impl_.cudnn_version_; + return p != nullptr ? *p : reinterpret_cast( + ::xla::_CudnnVersion_default_instance_); +} +inline const ::xla::CudnnVersion& AutotuningLog::cudnn_version() const { + // @@protoc_insertion_point(field_get:xla.AutotuningLog.cudnn_version) + return _internal_cudnn_version(); +} +inline void AutotuningLog::unsafe_arena_set_allocated_cudnn_version( + ::xla::CudnnVersion* cudnn_version) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.cudnn_version_); + } + _impl_.cudnn_version_ = cudnn_version; + if (cudnn_version) { + + } else { + + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:xla.AutotuningLog.cudnn_version) +} +inline ::xla::CudnnVersion* AutotuningLog::release_cudnn_version() { + + ::xla::CudnnVersion* temp = _impl_.cudnn_version_; + _impl_.cudnn_version_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::xla::CudnnVersion* AutotuningLog::unsafe_arena_release_cudnn_version() { + // @@protoc_insertion_point(field_release:xla.AutotuningLog.cudnn_version) + + ::xla::CudnnVersion* temp = _impl_.cudnn_version_; + _impl_.cudnn_version_ = nullptr; + return temp; +} +inline ::xla::CudnnVersion* AutotuningLog::_internal_mutable_cudnn_version() { + + if (_impl_.cudnn_version_ == nullptr) { + auto* p = CreateMaybeMessage<::xla::CudnnVersion>(GetArenaForAllocation()); + _impl_.cudnn_version_ = p; + } + return _impl_.cudnn_version_; +} +inline ::xla::CudnnVersion* AutotuningLog::mutable_cudnn_version() { + ::xla::CudnnVersion* _msg = _internal_mutable_cudnn_version(); + // @@protoc_insertion_point(field_mutable:xla.AutotuningLog.cudnn_version) + return _msg; +} +inline void AutotuningLog::set_allocated_cudnn_version(::xla::CudnnVersion* cudnn_version) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete _impl_.cudnn_version_; + } + if (cudnn_version) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(cudnn_version); + if (message_arena != submessage_arena) { + cudnn_version = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, cudnn_version, submessage_arena); + } + + } else { + + } + _impl_.cudnn_version_ = cudnn_version; + // @@protoc_insertion_point(field_set_allocated:xla.AutotuningLog.cudnn_version) +} + +// .xla.ComputeCapability compute_capability = 4; +inline bool AutotuningLog::_internal_has_compute_capability() const { + return this != internal_default_instance() && _impl_.compute_capability_ != nullptr; +} +inline bool AutotuningLog::has_compute_capability() const { + return _internal_has_compute_capability(); +} +inline void AutotuningLog::clear_compute_capability() { + if (GetArenaForAllocation() == nullptr && _impl_.compute_capability_ != nullptr) { + delete _impl_.compute_capability_; + } + _impl_.compute_capability_ = nullptr; +} +inline const ::xla::ComputeCapability& AutotuningLog::_internal_compute_capability() const { + const ::xla::ComputeCapability* p = _impl_.compute_capability_; + return p != nullptr ? *p : reinterpret_cast( + ::xla::_ComputeCapability_default_instance_); +} +inline const ::xla::ComputeCapability& AutotuningLog::compute_capability() const { + // @@protoc_insertion_point(field_get:xla.AutotuningLog.compute_capability) + return _internal_compute_capability(); +} +inline void AutotuningLog::unsafe_arena_set_allocated_compute_capability( + ::xla::ComputeCapability* compute_capability) { + if (GetArenaForAllocation() == nullptr) { + delete reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(_impl_.compute_capability_); + } + _impl_.compute_capability_ = compute_capability; + if (compute_capability) { + + } else { + + } + // @@protoc_insertion_point(field_unsafe_arena_set_allocated:xla.AutotuningLog.compute_capability) +} +inline ::xla::ComputeCapability* AutotuningLog::release_compute_capability() { + + ::xla::ComputeCapability* temp = _impl_.compute_capability_; + _impl_.compute_capability_ = nullptr; +#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE + auto* old = reinterpret_cast<::PROTOBUF_NAMESPACE_ID::MessageLite*>(temp); + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + if (GetArenaForAllocation() == nullptr) { delete old; } +#else // PROTOBUF_FORCE_COPY_IN_RELEASE + if (GetArenaForAllocation() != nullptr) { + temp = ::PROTOBUF_NAMESPACE_ID::internal::DuplicateIfNonNull(temp); + } +#endif // !PROTOBUF_FORCE_COPY_IN_RELEASE + return temp; +} +inline ::xla::ComputeCapability* AutotuningLog::unsafe_arena_release_compute_capability() { + // @@protoc_insertion_point(field_release:xla.AutotuningLog.compute_capability) + + ::xla::ComputeCapability* temp = _impl_.compute_capability_; + _impl_.compute_capability_ = nullptr; + return temp; +} +inline ::xla::ComputeCapability* AutotuningLog::_internal_mutable_compute_capability() { + + if (_impl_.compute_capability_ == nullptr) { + auto* p = CreateMaybeMessage<::xla::ComputeCapability>(GetArenaForAllocation()); + _impl_.compute_capability_ = p; + } + return _impl_.compute_capability_; +} +inline ::xla::ComputeCapability* AutotuningLog::mutable_compute_capability() { + ::xla::ComputeCapability* _msg = _internal_mutable_compute_capability(); + // @@protoc_insertion_point(field_mutable:xla.AutotuningLog.compute_capability) + return _msg; +} +inline void AutotuningLog::set_allocated_compute_capability(::xla::ComputeCapability* compute_capability) { + ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation(); + if (message_arena == nullptr) { + delete _impl_.compute_capability_; + } + if (compute_capability) { + ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = + ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(compute_capability); + if (message_arena != submessage_arena) { + compute_capability = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage( + message_arena, compute_capability, submessage_arena); + } + + } else { + + } + _impl_.compute_capability_ = compute_capability; + // @@protoc_insertion_point(field_set_allocated:xla.AutotuningLog.compute_capability) +} + +// string device_pci_bus_id = 5; +inline void AutotuningLog::clear_device_pci_bus_id() { + _impl_.device_pci_bus_id_.ClearToEmpty(); +} +inline const std::string& AutotuningLog::device_pci_bus_id() const { + // @@protoc_insertion_point(field_get:xla.AutotuningLog.device_pci_bus_id) + return _internal_device_pci_bus_id(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void AutotuningLog::set_device_pci_bus_id(ArgT0&& arg0, ArgT... args) { + + _impl_.device_pci_bus_id_.Set(static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:xla.AutotuningLog.device_pci_bus_id) +} +inline std::string* AutotuningLog::mutable_device_pci_bus_id() { + std::string* _s = _internal_mutable_device_pci_bus_id(); + // @@protoc_insertion_point(field_mutable:xla.AutotuningLog.device_pci_bus_id) + return _s; +} +inline const std::string& AutotuningLog::_internal_device_pci_bus_id() const { + return _impl_.device_pci_bus_id_.Get(); +} +inline void AutotuningLog::_internal_set_device_pci_bus_id(const std::string& value) { + + _impl_.device_pci_bus_id_.Set(value, GetArenaForAllocation()); +} +inline std::string* AutotuningLog::_internal_mutable_device_pci_bus_id() { + + return _impl_.device_pci_bus_id_.Mutable(GetArenaForAllocation()); +} +inline std::string* AutotuningLog::release_device_pci_bus_id() { + // @@protoc_insertion_point(field_release:xla.AutotuningLog.device_pci_bus_id) + return _impl_.device_pci_bus_id_.Release(); +} +inline void AutotuningLog::set_allocated_device_pci_bus_id(std::string* device_pci_bus_id) { + if (device_pci_bus_id != nullptr) { + + } else { + + } + _impl_.device_pci_bus_id_.SetAllocated(device_pci_bus_id, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.device_pci_bus_id_.IsDefault()) { + _impl_.device_pci_bus_id_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:xla.AutotuningLog.device_pci_bus_id) +} + +// string blas_version = 6; +inline void AutotuningLog::clear_blas_version() { + _impl_.blas_version_.ClearToEmpty(); +} +inline const std::string& AutotuningLog::blas_version() const { + // @@protoc_insertion_point(field_get:xla.AutotuningLog.blas_version) + return _internal_blas_version(); +} +template +inline PROTOBUF_ALWAYS_INLINE +void AutotuningLog::set_blas_version(ArgT0&& arg0, ArgT... args) { + + _impl_.blas_version_.Set(static_cast(arg0), args..., GetArenaForAllocation()); + // @@protoc_insertion_point(field_set:xla.AutotuningLog.blas_version) +} +inline std::string* AutotuningLog::mutable_blas_version() { + std::string* _s = _internal_mutable_blas_version(); + // @@protoc_insertion_point(field_mutable:xla.AutotuningLog.blas_version) + return _s; +} +inline const std::string& AutotuningLog::_internal_blas_version() const { + return _impl_.blas_version_.Get(); +} +inline void AutotuningLog::_internal_set_blas_version(const std::string& value) { + + _impl_.blas_version_.Set(value, GetArenaForAllocation()); +} +inline std::string* AutotuningLog::_internal_mutable_blas_version() { + + return _impl_.blas_version_.Mutable(GetArenaForAllocation()); +} +inline std::string* AutotuningLog::release_blas_version() { + // @@protoc_insertion_point(field_release:xla.AutotuningLog.blas_version) + return _impl_.blas_version_.Release(); +} +inline void AutotuningLog::set_allocated_blas_version(std::string* blas_version) { + if (blas_version != nullptr) { + + } else { + + } + _impl_.blas_version_.SetAllocated(blas_version, GetArenaForAllocation()); +#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING + if (_impl_.blas_version_.IsDefault()) { + _impl_.blas_version_.Set("", GetArenaForAllocation()); + } +#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING + // @@protoc_insertion_point(field_set_allocated:xla.AutotuningLog.blas_version) +} + +#ifdef __GNUC__ + #pragma GCC diagnostic pop +#endif // __GNUC__ +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + + +// @@protoc_insertion_point(namespace_scope) + +} // namespace xla + +PROTOBUF_NAMESPACE_OPEN + +template <> struct is_proto_enum< ::xla::AutotuneResult_FailureKind> : ::std::true_type {}; +template <> +inline const EnumDescriptor* GetEnumDescriptor< ::xla::AutotuneResult_FailureKind>() { + return ::xla::AutotuneResult_FailureKind_descriptor(); +} + +PROTOBUF_NAMESPACE_CLOSE + +// @@protoc_insertion_point(global_scope) + +#include +#endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_xla_2fautotuning_2eproto diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/backends/profiler/cpu/host_tracer.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/backends/profiler/cpu/host_tracer.h new file mode 100644 index 0000000000000000000000000000000000000000..fb2bdd20fedb31788baa0247273a7f2485a34169 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/backends/profiler/cpu/host_tracer.h @@ -0,0 +1,43 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ +#ifndef XLA_BACKENDS_PROFILER_CPU_HOST_TRACER_H_ +#define XLA_BACKENDS_PROFILER_CPU_HOST_TRACER_H_ + +#include + +#include "tsl/profiler/lib/profiler_interface.h" + +namespace xla { +namespace profiler { + +struct HostTracerOptions { + // Levels of host tracing: + // - Level 0 is used to disable host traces. + // - Level 1 enables tracing of only user instrumented (or default) TraceMe. + // - Level 2 enables tracing of all level 1 TraceMe(s) and instrumented high + // level program execution details (expensive TF ops, XLA ops, etc). + // This is the default. + // - Level 3 enables tracing of all level 2 TraceMe(s) and more verbose + // (low-level) program execution details (cheap TF ops, etc). + int trace_level = 2; +}; + +std::unique_ptr CreateHostTracer( + const HostTracerOptions& options); + +} // namespace profiler +} // namespace xla + +#endif // XLA_BACKENDS_PROFILER_CPU_HOST_TRACER_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/backends/profiler/cpu/metadata_utils.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/backends/profiler/cpu/metadata_utils.h new file mode 100644 index 0000000000000000000000000000000000000000..1e3c8a215faa5945f6e687475555ed13c1cd3cac --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/backends/profiler/cpu/metadata_utils.h @@ -0,0 +1,55 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_BACKENDS_PROFILER_CPU_METADATA_UTILS_H_ +#define XLA_BACKENDS_PROFILER_CPU_METADATA_UTILS_H_ + +#include "xla/service/hlo.pb.h" +#include "tsl/profiler/convert/xla_op_utils.h" +#include "tsl/profiler/protobuf/xplane.pb.h" +#include "tsl/profiler/utils/xplane_builder.h" +#include "tsl/profiler/utils/xplane_schema.h" + +namespace xla { +namespace profiler { + +class MetadataXPlaneBuilder { + public: + explicit MetadataXPlaneBuilder(tsl::profiler::XPlane* raw_plane) + : plane_(raw_plane), + hlo_proto_stat_(plane_.GetOrCreateStatMetadata( + GetStatTypeStr(tsl::profiler::StatType::kHloProto))) {} + + void AddHloProto(uint64_t program_id, const xla::HloProto& hlo_proto) { + tsl::profiler::XEventMetadata* event_metadata = + plane_.GetOrCreateEventMetadata(program_id); + if (event_metadata->name().empty()) { + event_metadata->set_name(tsl::profiler::HloModuleNameWithProgramId( + hlo_proto.hlo_module().name(), program_id)); + tsl::profiler::XStatsBuilder event_stats( + event_metadata, &plane_); + event_stats.AddStatValue(*hlo_proto_stat_, hlo_proto); + } + } + + private: + tsl::profiler::XPlaneBuilder plane_; + const tsl::profiler::XStatMetadata* hlo_proto_stat_ = nullptr; +}; + +} // namespace profiler +} // namespace xla + +#endif // XLA_BACKENDS_PROFILER_CPU_METADATA_UTILS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/backends/profiler/gpu/cupti_collector.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/backends/profiler/gpu/cupti_collector.h new file mode 100644 index 0000000000000000000000000000000000000000..8af5927269de52ffe90967096eac79ccf9ccea1e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/backends/profiler/gpu/cupti_collector.h @@ -0,0 +1,297 @@ +/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_BACKENDS_PROFILER_GPU_CUPTI_COLLECTOR_H_ +#define XLA_BACKENDS_PROFILER_GPU_CUPTI_COLLECTOR_H_ + +#include + +#include "absl/container/fixed_array.h" +#include "absl/container/flat_hash_map.h" +#include "absl/container/node_hash_set.h" +#include "absl/strings/string_view.h" +#include "tsl/platform/macros.h" +#include "tsl/platform/status.h" +#include "tsl/platform/types.h" +#include "tsl/profiler/protobuf/xplane.pb.h" + +namespace xla { +namespace profiler { + +struct MemcpyDetails { + // The amount of data copied for memcpy events. + size_t num_bytes; + // The destination device for peer-2-peer communication (memcpy). The source + // device is implicit: it's the current device. + tsl::uint32 destination; + // Whether or not the memcpy is asynchronous. + bool async; + // This contains CUpti_ActivityMemcpyKind for activity event (on device). + // For events from other CuptiTracerEventSource, it is always 0. + tsl::int8 copy_kind; + // CUpti_ActivityMemoryKind of source. + tsl::int8 src_mem_kind; + // CUpti_ActivityMemoryKind of destination. + tsl::int8 dst_mem_kind; + + // ID of the hardware channel on which this operation ran. + uint32_t channel_id = -1; + // CUpti_ChannelType of the channel above. + int8_t channel_type = 0; // CUPTI_CHANNEL_TYPE_INVALID +}; + +struct MemAllocDetails { + // Size of memory to be written over in bytes. + size_t num_bytes; + // The CUpti_ActivityMemoryKind value for this activity event. + tsl::int8 mem_kind; + // The virtual address of allocation. 0 if it is a free operation. + tsl::uint64 address; +}; + +using MemFreeDetails = MemAllocDetails; + +// Memory residency contains details read from CUpti_ActivityMemory type. This +// is populated in the CUPTI tracer encounters a CUPTI_ACTIVITY_KIND_MEMORY +// event. The start of this even corresponse to a cudaMalloc, and the end +// corresponds to a cudaFree. +using MemoryResidencyDetails = MemAllocDetails; + +// cudaHostRegister +struct HostRegisterDetails { + size_t num_bytes; + tsl::uint64 address; + unsigned int flags; +}; + +// cudaHostUnregister +struct HostUnregisterDetails { + tsl::uint64 address; +}; + +struct MemsetDetails { + // Size of memory to be written over in bytes. + size_t num_bytes; + // The CUpti_ActivityMemoryKind value for this activity event. + tsl::int8 mem_kind; + // Whether or not the memset is asynchronous. + bool async; + + // ID of the hardware channel on which this operation ran. + uint32_t channel_id = -1; + // CUpti_ChannelType of the channel above. + int8_t channel_type = 0; // CUPTI_CHANNEL_TYPE_INVALID +}; + +struct KernelDetails { + // The number of registers used in this kernel. + tsl::uint32 registers_per_thread; + // The amount of shared memory space used by a thread block. + tsl::uint32 static_shared_memory_usage; + // The amount of dynamic memory space used by a thread block. + tsl::uint32 dynamic_shared_memory_usage; + // X-dimension of a thread block. + tsl::uint32 block_x; + // Y-dimension of a thread block. + tsl::uint32 block_y; + // Z-dimension of a thread block. + tsl::uint32 block_z; + // X-dimension of a grid. + tsl::uint32 grid_x; + // Y-dimension of a grid. + tsl::uint32 grid_y; + // Z-dimension of a grid. + tsl::uint32 grid_z; + + // ID of the hardware channel on which this operation ran. + uint32_t channel_id = -1; + // CUpti_ChannelType of the channel above. + int8_t channel_type = 0; // CUPTI_CHANNEL_TYPE_INVALID +}; + +inline std::string ToXStat(const KernelDetails& kernel_info, + double occupancy_pct) { + return absl::StrCat( + "regs:", kernel_info.registers_per_thread, + " static_shared:", kernel_info.static_shared_memory_usage, + " dynamic_shared:", kernel_info.dynamic_shared_memory_usage, + " grid:", kernel_info.grid_x, ",", kernel_info.grid_y, ",", + kernel_info.grid_z, " block:", kernel_info.block_x, ",", + kernel_info.block_y, ",", kernel_info.block_z, + " occ_pct:", occupancy_pct); +} + +// Gets the name of the CUpti_ActivityMemoryKind value. +absl::string_view GetMemoryKindName(int8_t memory_kind); + +enum class CuptiTracerEventType { + Unsupported = 0, + Kernel = 1, + MemcpyH2D = 2, + MemcpyD2H = 3, + MemcpyD2D = 4, + MemcpyP2P = 5, + MemcpyOther = 6, + MemoryAlloc = 7, + Overhead = 8, + UnifiedMemory = 9, + MemoryFree = 10, + Memset = 11, + MemoryResidency = 12, + HostRegister = 13, + HostUnregister = 14, + Generic = 100, +}; + +const char* GetTraceEventTypeName(const CuptiTracerEventType& type); + +enum class CuptiTracerEventSource { + Invalid = 0, + DriverCallback = 1, + Activity = 2, + // Maybe consider adding runtime callback and metric api in the future. +}; + +struct CuptiTracerEvent { + static constexpr tsl::uint32 kInvalidThreadId = + std::numeric_limits::max(); + static constexpr tsl::uint32 kInvalidCorrelationId = + std::numeric_limits::max(); + static constexpr tsl::uint64 kInvalidContextId = + std::numeric_limits::max(); + static constexpr tsl::uint64 kInvalidStreamId = + std::numeric_limits::max(); + CuptiTracerEventType type = CuptiTracerEventType::Unsupported; + CuptiTracerEventSource source = CuptiTracerEventSource::Invalid; + // Although CUpti_CallbackData::functionName is persistent, however + // CUpti_ActivityKernel4::name is not persistent, therefore we need a copy of + // it. + std::string name; + // This points to strings in AnnotationMap, which should outlive the point + // where serialization happens. + absl::string_view annotation; + absl::string_view nvtx_range; + tsl::uint64 start_time_ns = 0; + tsl::uint64 end_time_ns = 0; + tsl::uint32 device_id = 0; + tsl::uint32 correlation_id = kInvalidCorrelationId; + tsl::uint32 thread_id = kInvalidThreadId; + int64_t context_id = kInvalidContextId; + int64_t stream_id = kInvalidStreamId; + union { + // For Memcpy API and activities. `type` must be Memcpy*. + MemcpyDetails memcpy_info; + // Used for MemAlloc API. `type` must be MemoryAlloc. + MemAllocDetails memalloc_info; + // Used for kernel activities. `type` must be Kernel. + KernelDetails kernel_info; + // Used for MemFree activities. `type` must be MemoryFree. + MemFreeDetails memfree_info; + // Used for cuMemHostRegister. `type` must be HostRegister. + HostRegisterDetails host_register_info; + // Used for cuMemHostUnregister. `type` must be HostUnregister. + HostUnregisterDetails host_unregister_info; + // Used for Memset API and activities. `type` must be Memset. + MemsetDetails memset_info; + // Used for Memory residency activities. `type` must be MemoryResidency. + MemoryResidencyDetails memory_residency_info; + }; +}; + +struct CuptiTracerCollectorOptions { + // Maximum number of events to collect from callback API; if -1, no limit. + // if 0, the callback API is enabled to build a correlation map, but no + // events are collected. + tsl::uint64 max_callback_api_events = 2 * 1024 * 1024; + // Maximum number of events to collect from activity API; if -1, no limit. + tsl::uint64 max_activity_api_events = 2 * 1024 * 1024; + // Maximum number of annotation strings that we can accommodate. + tsl::uint64 max_annotation_strings = 1024 * 1024; + // Number of GPUs involved. + tsl::uint32 num_gpus; +}; + +class AnnotationMap { + public: + struct AnnotationInfo { + absl::string_view annotation; + absl::string_view nvtx_range; + }; + + explicit AnnotationMap(tsl::uint64 max_size, tsl::uint32 num_gpus) + : max_size_(max_size), per_device_map_(num_gpus) {} + void Add(tsl::uint32 device_id, tsl::uint32 correlation_id, + const absl::string_view annotation, + const absl::string_view nvtx_range); + AnnotationInfo LookUp(tsl::uint32 device_id, tsl::uint32 correlation_id); + + private: + struct PerDeviceAnnotationMap { + // The population/consumption of annotations might happen from multiple + // callback/activity api related threads. + absl::Mutex mutex; + // Annotation tends to be repetitive, use a hash_set to store the strings, + // an use the reference to the string in the map. + absl::node_hash_set annotations; + absl::node_hash_set nvtx_ranges; + absl::flat_hash_map correlation_map; + }; + const tsl::uint64 max_size_; + absl::FixedArray per_device_map_; + + AnnotationMap(const AnnotationMap&) = delete; + void operator=(const AnnotationMap&) = delete; +}; + +class CuptiTraceCollector { + public: + explicit CuptiTraceCollector(const CuptiTracerCollectorOptions& options) + : options_(options), + annotation_map_(options.max_annotation_strings, options.num_gpus) {} + virtual ~CuptiTraceCollector() {} + + // Producer side functions (i.e. called by CuptiTracer). + virtual void AddEvent(CuptiTracerEvent&& event) = 0; + virtual void OnEventsDropped(const std::string& reason, + tsl::uint32 num_events) = 0; + virtual void Flush() = 0; + + // Consumer side functions (i.e. called by GPU tracer); + virtual bool Export(tensorflow::profiler::XSpace* space, + tsl::uint64 end_gpu_ns) { + return true; + } + virtual std::string ReportNumEventsIfDropped() { return ""; } + + AnnotationMap* annotation_map() { return &annotation_map_; } + + protected: + CuptiTracerCollectorOptions options_; + + private: + AnnotationMap annotation_map_; + + CuptiTraceCollector(const CuptiTraceCollector&) = delete; + void operator=(const CuptiTraceCollector&) = delete; +}; + +std::unique_ptr CreateCuptiCollector( + const CuptiTracerCollectorOptions& options, + const tsl::uint64 start_walltime_ns, const tsl::uint64 start_gputime_ns); + +} // namespace profiler +} // namespace xla + +#endif // XLA_BACKENDS_PROFILER_GPU_CUPTI_COLLECTOR_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/backends/profiler/gpu/cupti_error_manager.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/backends/profiler/gpu/cupti_error_manager.h new file mode 100644 index 0000000000000000000000000000000000000000..9ee29433b6a7db07bb5d6dda5e7a91ac6059ccf5 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/backends/profiler/gpu/cupti_error_manager.h @@ -0,0 +1,278 @@ +/* Copyright 2021 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_BACKENDS_PROFILER_GPU_CUPTI_ERROR_MANAGER_H_ +#define XLA_BACKENDS_PROFILER_GPU_CUPTI_ERROR_MANAGER_H_ + +#include +#include + +#include +#include +#include +#include +#include + +#include "xla/backends/profiler/gpu/cupti_interface.h" +#include "tsl/platform/mutex.h" +#include "tsl/platform/thread_annotations.h" + +namespace xla { +namespace profiler { + +class CuptiErrorManager : public xla::profiler::CuptiInterface { + public: + explicit CuptiErrorManager(std::unique_ptr interface); + + // Returns whether CUPTI is disabled. + bool Disabled() const override { return disabled_.load(); } + + // CUPTI activity API: all thread-safe + // Disables activity monitoring. + CUptiResult ActivityDisable(CUpti_ActivityKind kind) override; + + // Enables activity monitoring. If this is successfully executed, we add + // ActivityDisable to the undo log. + CUptiResult ActivityEnable(CUpti_ActivityKind kind) override; + + // Flushes all outstanding activities. + CUptiResult ActivityFlushAll(uint32_t flag) override; + + // Gets a next activity record from a pool of already collected activity + // records. + CUptiResult ActivityGetNextRecord(uint8_t* buffer, + size_t valid_buffer_size_bytes, + CUpti_Activity** record) override; + + // Reports the number of dropped activity records. + CUptiResult ActivityGetNumDroppedRecords(CUcontext context, + uint32_t stream_id, + size_t* dropped) override; + + CUptiResult ActivityConfigureUnifiedMemoryCounter( + CUpti_ActivityUnifiedMemoryCounterConfig* config, + uint32_t count) override; + + // Registers callback functions handling activity. + CUptiResult ActivityRegisterCallbacks( + CUpti_BuffersCallbackRequestFunc func_buffer_requested, + CUpti_BuffersCallbackCompleteFunc func_buffer_completed) override; + + // Returns device ID for a given context. + CUptiResult GetDeviceId(CUcontext context, uint32_t* device_id) override; + + // Returns CUPTI timestamp. + CUptiResult GetTimestamp(uint64_t* timestamp) override; + + // Explicitly destroys and cleans up all resources associated with CUPTI in + // the current process. + CUptiResult Finalize() override; + + // CUPTI callback API + // Enables or disables callback. If we successfully enables callback, we add + // EnableCallback to disable callback to the undo log. + CUptiResult EnableCallback(uint32_t enable, CUpti_SubscriberHandle subscriber, + CUpti_CallbackDomain domain, + CUpti_CallbackId callback_id) override; + + // Enables or disables callback domain. If we successfully enables a domain, + // we add EnableDomain to disable the domain to the undo log. + CUptiResult EnableDomain(uint32_t enable, CUpti_SubscriberHandle subscriber, + CUpti_CallbackDomain domain) override; + + // Subscribes callbacks. If we successfully subscribes the callback, we add + // Unsubscribe to the undo log. + CUptiResult Subscribe(CUpti_SubscriberHandle* subscriber, + CUpti_CallbackFunc callback, void* userdata) override; + + // Unsubscribes callbacks. + CUptiResult Unsubscribe(CUpti_SubscriberHandle subscriber) override; + + // CUPTI event API + // Returns a list of event domains. + CUptiResult DeviceEnumEventDomains( + CUdevice device, size_t* array_size_bytes, + CUpti_EventDomainID* domain_array) override; + + // Returns domain attributes. + CUptiResult DeviceGetEventDomainAttribute(CUdevice device, + CUpti_EventDomainID event_domain, + CUpti_EventDomainAttribute attrib, + size_t* value_size, + void* value) override; + + // Disables kernel replay mode. + CUptiResult DisableKernelReplayMode(CUcontext context) override; + + // Enables kernel replay mode. If we successfully enable kernel replay mode, + // we add DisableKernelReplayMode to the undo log. + CUptiResult EnableKernelReplayMode(CUcontext context) override; + + // Returns the number of event domains. + CUptiResult DeviceGetNumEventDomains(CUdevice device, + uint32_t* num_domains) override; + + // Returns a list of events. + CUptiResult EventDomainEnumEvents(CUpti_EventDomainID event_domain, + size_t* array_size_bytes, + CUpti_EventID* event_array) override; + + // Returns the number of events. + CUptiResult EventDomainGetNumEvents(CUpti_EventDomainID event_domain, + uint32_t* num_events) override; + + // Returns an event attribute. + CUptiResult EventGetAttribute(CUpti_EventID event, + CUpti_EventAttribute attrib, size_t* value_size, + void* value) override; + + // Convverts event ID from event name. + CUptiResult EventGetIdFromName(CUdevice device, const char* event_name, + CUpti_EventID* event) override; + + // Disables event group. + CUptiResult EventGroupDisable(CUpti_EventGroup event_group) override; + + // Enables event group. If we successfully enable an event group, we add + // EventGroupDisable to the undo log. + CUptiResult EventGroupEnable(CUpti_EventGroup event_group) override; + + // Returns an event group attribute. + CUptiResult EventGroupGetAttribute(CUpti_EventGroup event_group, + CUpti_EventGroupAttribute attrib, + size_t* value_size, void* value) override; + + // Returns a performance counter value. + CUptiResult EventGroupReadEvent(CUpti_EventGroup event_group, + CUpti_ReadEventFlags flags, + CUpti_EventID event, + size_t* event_value_buffer_size_bytes, + uint64_t* event_value_buffer) override; + + // Returns an event group set attribute. + CUptiResult EventGroupSetAttribute(CUpti_EventGroup event_group, + CUpti_EventGroupAttribute attrib, + size_t value_size, void* value) override; + + // Creates an event group set. If we successfully creates an event group set, + // we add EventGroupSetsDestroy to the undo log. + CUptiResult EventGroupSetsCreate( + CUcontext context, size_t event_id_array_size_bytes, + CUpti_EventID* event_id_array, + CUpti_EventGroupSets** event_group_passes) override; + + // Destroys an event group set. + CUptiResult EventGroupSetsDestroy( + CUpti_EventGroupSets* event_group_sets) override; + + // CUPTI metric API: all thread-safe + // Enumerates metrics. + CUptiResult DeviceEnumMetrics(CUdevice device, size_t* arraySizeBytes, + CUpti_MetricID* metricArray) override; + + // Returns the number of metrics. + CUptiResult DeviceGetNumMetrics(CUdevice device, + uint32_t* num_metrics) override; + + // Converts a metric ID to a metric name. + CUptiResult MetricGetIdFromName(CUdevice device, const char* metric_name, + CUpti_MetricID* metric) override; + + // Returns the number of events required to calculate a particular metric. + CUptiResult MetricGetNumEvents(CUpti_MetricID metric, + uint32_t* num_events) override; + + // Returns a list of events required to calculate a particular metric. + CUptiResult MetricEnumEvents(CUpti_MetricID metric, + size_t* event_id_array_size_bytes, + CUpti_EventID* event_id_array) override; + + // Returns a metric attribute. + CUptiResult MetricGetAttribute(CUpti_MetricID metric, + CUpti_MetricAttribute attrib, + size_t* value_size, void* value) override; + + // Returns a metric value. + CUptiResult MetricGetValue(CUdevice device, CUpti_MetricID metric, + size_t event_id_array_size_bytes, + CUpti_EventID* event_id_array, + size_t event_value_array_size_bytes, + uint64_t* event_value_array, + uint64_t time_duration, + CUpti_MetricValue* metric_value) override; + + CUptiResult GetResultString(CUptiResult result, const char** str) override; + + CUptiResult GetContextId(CUcontext context, uint32_t* context_id) override; + + CUptiResult GetStreamIdEx(CUcontext context, CUstream stream, + uint8_t per_thread_stream, + uint32_t* stream_id) override; + + // Clears Undo stack. We are maintaining undo stack for each profiling phase. + // Once the profiling is done, we need to clear the undo stack. + void CleanUp() override; + + private: + typedef std::function UndoFunction; + + // Register undo function. + void RegisterUndoFunction(const UndoFunction& func); + + // Resets profiling status by calling some undo functions registered, + // and then disables profiling. + void UndoAndDisable(); + + // Returns a descriptive string for a CUptiResult. + std::string ResultString(CUptiResult result) const; + + // Contains a pointer to a cupti interface instance. Normally, this will point + // to a real CUPTI interface that interacts with underlying hardware, but for + // testing, we often replace this with a CUPTI mock object to mock hardware + // behavior. This will be set when CuptiBase singleton was created and an + // object that this variable points to will die when CuptiBase singleton dies, + // i.e., at the end of program execution. + std::unique_ptr interface_; + + // A vector of functions that needs to be called by Undo upon an error + // detected. This vector is managed like a statck through push_back and + // pop_back. Whenever an API function is successfully executed, its + // corresponding undo function will be pushed into this stack and Undo will + // pop and execute the unroll function upon detecting an error. + std::vector undo_stack_ TF_GUARDED_BY(undo_stack_mu_); + + // A mutex to guarantee atomicity for undo_stack_. Given that threads that + // can update undo_stack_ are a profiling control thread such as a webserver + // thread or a thread that executes a kernel during performance counter + // profiling, which is already serialized, the contention for this lock will + // be extremely low. In other words, it will be contended only when the + // profiling is being enabled or disabled, and we will have at most two + // threads that will contend for this mutex. + tsl::mutex undo_stack_mu_; + + // Once an error is detected, we will ignore any CUPTI API call. + std::atomic disabled_; + + // Prevent recursive undo if an UndoFunction fails. + bool undo_disabled_; + + CuptiErrorManager(const CuptiErrorManager&) = delete; + void operator=(const CuptiErrorManager&) = delete; +}; + +} // namespace profiler +} // namespace xla + +#endif // XLA_BACKENDS_PROFILER_GPU_CUPTI_ERROR_MANAGER_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/backends/profiler/gpu/cupti_interface.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/backends/profiler/gpu/cupti_interface.h new file mode 100644 index 0000000000000000000000000000000000000000..631780e1792de70fdce7c0e9bda575bd70542f3e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/backends/profiler/gpu/cupti_interface.h @@ -0,0 +1,205 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_BACKENDS_PROFILER_GPU_CUPTI_INTERFACE_H_ +#define XLA_BACKENDS_PROFILER_GPU_CUPTI_INTERFACE_H_ + +#include +#include + +#include "third_party/gpus/cuda/extras/CUPTI/include/cupti.h" +#include "third_party/gpus/cuda/include/cuda.h" +#include "tsl/platform/macros.h" +#include "tsl/platform/types.h" + +namespace xla { +namespace profiler { + +// Provides a wrapper interface to every single CUPTI API function. This class +// is needed to create an easy mock object for CUPTI API calls. All member +// functions are defined in the following order: activity related APIs, callback +// related APIs, Event APIs, and metric APIs. Within each category, we follow +// the order in the original CUPTI documentation. +class CuptiInterface { + public: + CuptiInterface() {} + + virtual ~CuptiInterface() {} + + // CUPTI activity API + virtual CUptiResult ActivityDisable(CUpti_ActivityKind kind) = 0; + + virtual CUptiResult ActivityEnable(CUpti_ActivityKind kind) = 0; + + virtual CUptiResult ActivityFlushAll(uint32_t flag) = 0; + + virtual CUptiResult ActivityGetNextRecord(uint8_t* buffer, + size_t valid_buffer_size_bytes, + CUpti_Activity** record) = 0; + + virtual CUptiResult ActivityGetNumDroppedRecords(CUcontext context, + uint32_t stream_id, + size_t* dropped) = 0; + + virtual CUptiResult ActivityConfigureUnifiedMemoryCounter( + CUpti_ActivityUnifiedMemoryCounterConfig* config, uint32_t count) = 0; + + virtual CUptiResult ActivityRegisterCallbacks( + CUpti_BuffersCallbackRequestFunc func_buffer_requested, + CUpti_BuffersCallbackCompleteFunc func_buffer_completed) = 0; + + virtual CUptiResult GetDeviceId(CUcontext context, tsl::uint32* deviceId) = 0; + + virtual CUptiResult GetTimestamp(uint64_t* timestamp) = 0; + + virtual CUptiResult Finalize() = 0; + + // CUPTI callback API + virtual CUptiResult EnableCallback(uint32_t enable, + CUpti_SubscriberHandle subscriber, + CUpti_CallbackDomain domain, + CUpti_CallbackId cbid) = 0; + + virtual CUptiResult EnableDomain(uint32_t enable, + CUpti_SubscriberHandle subscriber, + CUpti_CallbackDomain domain) = 0; + + virtual CUptiResult Subscribe(CUpti_SubscriberHandle* subscriber, + CUpti_CallbackFunc callback, + void* userdata) = 0; + + virtual CUptiResult Unsubscribe(CUpti_SubscriberHandle subscriber) = 0; + + // CUPTI event API + virtual CUptiResult DeviceEnumEventDomains( + CUdevice device, size_t* array_size_bytes, + CUpti_EventDomainID* domain_array) = 0; + + virtual CUptiResult DeviceGetEventDomainAttribute( + CUdevice device, CUpti_EventDomainID event_domain, + CUpti_EventDomainAttribute attrib, size_t* value_size, void* value) = 0; + + virtual CUptiResult DisableKernelReplayMode(CUcontext context) = 0; + + virtual CUptiResult EnableKernelReplayMode(CUcontext context) = 0; + + virtual CUptiResult DeviceGetNumEventDomains(CUdevice device, + uint32_t* num_domains) = 0; + + virtual CUptiResult EventDomainEnumEvents(CUpti_EventDomainID event_domain, + size_t* array_size_bytes, + CUpti_EventID* event_array) = 0; + + virtual CUptiResult EventDomainGetNumEvents(CUpti_EventDomainID event_domain, + uint32_t* num_events) = 0; + + virtual CUptiResult EventGetAttribute(CUpti_EventID event, + CUpti_EventAttribute attrib, + size_t* value_size, void* value) = 0; + + virtual CUptiResult EventGetIdFromName(CUdevice device, + const char* event_name, + CUpti_EventID* event) = 0; + + virtual CUptiResult EventGroupDisable(CUpti_EventGroup event_group) = 0; + + virtual CUptiResult EventGroupEnable(CUpti_EventGroup event_group) = 0; + + virtual CUptiResult EventGroupGetAttribute(CUpti_EventGroup event_group, + CUpti_EventGroupAttribute attrib, + size_t* value_size, + void* value) = 0; + + virtual CUptiResult EventGroupReadEvent(CUpti_EventGroup event_group, + CUpti_ReadEventFlags flags, + CUpti_EventID event, + size_t* event_value_buffer_size_bytes, + uint64_t* eventValueBuffer) = 0; + + virtual CUptiResult EventGroupSetAttribute(CUpti_EventGroup event_group, + CUpti_EventGroupAttribute attrib, + size_t value_size, + void* value) = 0; + + virtual CUptiResult EventGroupSetsCreate( + CUcontext context, size_t event_id_array_size_bytes, + CUpti_EventID* event_id_array, + CUpti_EventGroupSets** event_group_passes) = 0; + + virtual CUptiResult EventGroupSetsDestroy( + CUpti_EventGroupSets* event_group_sets) = 0; + + // CUPTI metric API + virtual CUptiResult DeviceEnumMetrics(CUdevice device, size_t* arraySizeBytes, + CUpti_MetricID* metricArray) = 0; + + virtual CUptiResult DeviceGetNumMetrics(CUdevice device, + uint32_t* num_metrics) = 0; + + virtual CUptiResult MetricGetIdFromName(CUdevice device, + const char* metric_name, + CUpti_MetricID* metric) = 0; + + virtual CUptiResult MetricGetNumEvents(CUpti_MetricID metric, + uint32_t* num_events) = 0; + + virtual CUptiResult MetricEnumEvents(CUpti_MetricID metric, + size_t* event_id_array_size_bytes, + CUpti_EventID* event_id_array) = 0; + + virtual CUptiResult MetricGetAttribute(CUpti_MetricID metric, + CUpti_MetricAttribute attrib, + size_t* value_size, void* value) = 0; + + virtual CUptiResult MetricGetValue(CUdevice device, CUpti_MetricID metric, + size_t event_id_array_size_bytes, + CUpti_EventID* event_id_array, + size_t event_value_array_size_bytes, + uint64_t* event_value_array, + uint64_t time_duration, + CUpti_MetricValue* metric_value) = 0; + + virtual CUptiResult GetResultString(CUptiResult result, const char** str) = 0; + + virtual CUptiResult GetContextId(CUcontext context, uint32_t* context_id) = 0; + + virtual CUptiResult GetStreamIdEx(CUcontext context, CUstream stream, + uint8_t per_thread_stream, + uint32_t* stream_id) = 0; + + // Interface maintenance functions. Not directly related to CUPTI, but + // required for implementing an error resilient layer over CUPTI API. + + // Performance any clean up work that is required each time profile session + // is done. Therefore this can be called multiple times during process life + // time. + virtual void CleanUp() = 0; + + // Whether CUPTI API is currently disabled due to unrecoverable errors. + // All subsequent calls will fail immediately without forwarding calls to + // CUPTI library. + virtual bool Disabled() const = 0; + + private: + CuptiInterface(const CuptiInterface&) = delete; + void operator=(const CuptiInterface&) = delete; +}; + +CuptiInterface* GetCuptiInterface(); + +} // namespace profiler +} // namespace xla + +#endif // XLA_BACKENDS_PROFILER_GPU_CUPTI_INTERFACE_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/backends/profiler/gpu/cupti_tracer.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/backends/profiler/gpu/cupti_tracer.h new file mode 100644 index 0000000000000000000000000000000000000000..a7ed77160d0e817f07192bdae940b8eee1656540 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/backends/profiler/gpu/cupti_tracer.h @@ -0,0 +1,156 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_BACKENDS_PROFILER_GPU_CUPTI_TRACER_H_ +#define XLA_BACKENDS_PROFILER_GPU_CUPTI_TRACER_H_ + +#include "absl/types/optional.h" +#include "third_party/gpus/cuda/extras/CUPTI/include/cupti.h" +#include "third_party/gpus/cuda/include/nvtx3/nvToolsExt.h" +#include "xla/backends/profiler/gpu/cupti_collector.h" +#include "xla/backends/profiler/gpu/cupti_interface.h" +#include "tsl/platform/errors.h" +#include "tsl/platform/status.h" +#include "tsl/platform/types.h" +#include "tsl/profiler/utils/buffer_pool.h" + +namespace xla { +namespace profiler { + +struct CuptiTracerOptions { + bool enable_activity_api = true; + + // Use cuda events to enclose the kernel/memcpy to measure device activity. + // enable_event_based_activity, if true, will override the enable_activity_api + // setting. + bool enable_event_based_activity = false; + + bool required_callback_api_events = true; + // The callback ids that will be enabled and monitored, if empty, all + // Callback ids to be enabled using Callback API. + // We only care CUPTI_CB_DOMAIN_DRIVER_API domain for now. It is kind of + // redundant to have both CUPTI_CB_DOMAIN_DRIVER_API and + // CUPTI_CB_DOMAIN_RUNTIME_API. + std::vector cbids_selected; + // Activity kinds to be collected using Activity API. If empty, the Activity + // API is disable. + std::vector activities_selected; + // Whether to call cuptiFinalize. + bool cupti_finalize = false; + // Whether to call cuCtxSynchronize for each device before Stop(). + bool sync_devices_before_stop = false; + // Whether to enable NVTX tracking, we need this for TensorRT tracking. + bool enable_nvtx_tracking = false; +}; + +class CuptiDriverApiHook { + public: + virtual ~CuptiDriverApiHook() {} + + virtual tsl::Status OnDriverApiEnter( + int device_id, CUpti_CallbackDomain domain, CUpti_CallbackId cbid, + const CUpti_CallbackData* callback_info) = 0; + virtual tsl::Status OnDriverApiExit( + int device_id, CUpti_CallbackDomain domain, CUpti_CallbackId cbid, + const CUpti_CallbackData* callback_info) = 0; + virtual tsl::Status SyncAndFlush() = 0; + + protected: + static tsl::Status AddDriverApiCallbackEvent( + CuptiTraceCollector* collector, CuptiInterface* cupti_interface, + int device_id, tsl::uint64 start_tsc, tsl::uint64 end_tsc, + CUpti_CallbackDomain domain, CUpti_CallbackId cbid, + const CUpti_CallbackData* callback_info); +}; + +// The class use to enable cupti callback/activity API and forward the collected +// trace events to CuptiTraceCollector. There should be only one CuptiTracer +// per process. +class CuptiTracer { + public: + // Not copyable or movable + CuptiTracer(const CuptiTracer&) = delete; + CuptiTracer& operator=(const CuptiTracer&) = delete; + + // Returns a pointer to singleton CuptiTracer. + static CuptiTracer* GetCuptiTracerSingleton(); + + // Only one profile session can be live in the same time. + bool IsAvailable() const; + bool NeedRootAccess() const { return need_root_access_; } + + void Enable(const CuptiTracerOptions& option, CuptiTraceCollector* collector); + void Disable(); + + tsl::Status HandleCallback(CUpti_CallbackDomain domain, CUpti_CallbackId cbid, + const CUpti_CallbackData* callback_info); + + // Returns a buffer and its size for CUPTI to store activities. This buffer + // will be reclaimed when CUPTI makes a callback to ProcessActivityBuffer. + void RequestActivityBuffer(uint8_t** buffer, size_t* size); + + // Parses CUPTI activity events from activity buffer, and emits events for + // CuptiTraceCollector. This function is public because called from registered + // callback. + tsl::Status ProcessActivityBuffer(CUcontext context, uint32_t stream_id, + uint8_t* buffer, size_t size); + + static uint64_t GetTimestamp(); + static int NumGpus(); + // Returns the error (if any) when using libcupti. + static std::string ErrorIfAny(); + + protected: + // protected constructor for injecting mock cupti interface for testing. + explicit CuptiTracer(CuptiInterface* cupti_interface); + + private: + // Buffer size and alignment, 32K and 8 as in CUPTI samples. + static constexpr size_t kBufferSizeInBytes = 32 * 1024; + + tsl::Status EnableApiTracing(); + tsl::Status EnableActivityTracing(); + tsl::Status DisableApiTracing(); + tsl::Status DisableActivityTracing(); + tsl::Status Finalize(); + void ConfigureActivityUnifiedMemoryCounter(bool enable); + tsl::Status HandleNVTXCallback(CUpti_CallbackId cbid, + const CUpti_CallbackData* cbdata); + + int num_gpus_; + std::optional option_; + CuptiInterface* cupti_interface_ = nullptr; + CuptiTraceCollector* collector_ = nullptr; + + // CUPTI 10.1 and higher need root access to profile. + bool need_root_access_ = false; + + bool api_tracing_enabled_ = false; + // Cupti handle for driver or runtime API callbacks. Cupti permits a single + // subscriber to be active at any time and can be used to trace Cuda runtime + // as and driver calls for all contexts and devices. + CUpti_SubscriberHandle subscriber_; // valid when api_tracing_enabled_. + + bool activity_tracing_enabled_ = false; + + std::unique_ptr cupti_driver_api_hook_; + + tsl::profiler::BufferPool buffer_pool_; +}; + +} // namespace profiler +} // namespace xla + +#endif // XLA_BACKENDS_PROFILER_GPU_CUPTI_TRACER_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/backends/profiler/gpu/cupti_wrapper.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/backends/profiler/gpu/cupti_wrapper.h new file mode 100644 index 0000000000000000000000000000000000000000..658148106d272f9190a476fe27353330b3a84c1d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/backends/profiler/gpu/cupti_wrapper.h @@ -0,0 +1,186 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_BACKENDS_PROFILER_GPU_CUPTI_WRAPPER_H_ +#define XLA_BACKENDS_PROFILER_GPU_CUPTI_WRAPPER_H_ + +#include +#include + +#include "third_party/gpus/cuda/extras/CUPTI/include/cupti.h" +#include "third_party/gpus/cuda/include/cuda.h" +#include "xla/backends/profiler/gpu/cupti_interface.h" + +namespace xla { +namespace profiler { + +class CuptiWrapper : public xla::profiler::CuptiInterface { + public: + CuptiWrapper() {} + + ~CuptiWrapper() override {} + + // CUPTI activity API + CUptiResult ActivityDisable(CUpti_ActivityKind kind) override; + + CUptiResult ActivityEnable(CUpti_ActivityKind kind) override; + + CUptiResult ActivityFlushAll(uint32_t flag) override; + + CUptiResult ActivityGetNextRecord(uint8_t* buffer, + size_t valid_buffer_size_bytes, + CUpti_Activity** record) override; + + CUptiResult ActivityGetNumDroppedRecords(CUcontext context, + uint32_t stream_id, + size_t* dropped) override; + + CUptiResult ActivityConfigureUnifiedMemoryCounter( + CUpti_ActivityUnifiedMemoryCounterConfig* config, + uint32_t count) override; + + CUptiResult ActivityRegisterCallbacks( + CUpti_BuffersCallbackRequestFunc func_buffer_requested, + CUpti_BuffersCallbackCompleteFunc func_buffer_completed) override; + + CUptiResult GetDeviceId(CUcontext context, tsl::uint32* deviceId) override; + + CUptiResult GetTimestamp(uint64_t* timestamp) override; + + // cuptiFinalize is only defined in CUDA8 and above. + // To enable it in CUDA8, the environment variable CUPTI_ENABLE_FINALIZE must + // be set to 1. + CUptiResult Finalize() override; + + // CUPTI callback API + CUptiResult EnableCallback(uint32_t enable, CUpti_SubscriberHandle subscriber, + CUpti_CallbackDomain domain, + CUpti_CallbackId cbid) override; + + CUptiResult EnableDomain(uint32_t enable, CUpti_SubscriberHandle subscriber, + CUpti_CallbackDomain domain) override; + + CUptiResult Subscribe(CUpti_SubscriberHandle* subscriber, + CUpti_CallbackFunc callback, void* userdata) override; + + CUptiResult Unsubscribe(CUpti_SubscriberHandle subscriber) override; + + // CUPTI event API + CUptiResult DeviceEnumEventDomains( + CUdevice device, size_t* array_size_bytes, + CUpti_EventDomainID* domain_array) override; + + CUptiResult DeviceGetEventDomainAttribute(CUdevice device, + CUpti_EventDomainID event_domain, + CUpti_EventDomainAttribute attrib, + size_t* value_size, + void* value) override; + + CUptiResult DisableKernelReplayMode(CUcontext context) override; + + CUptiResult EnableKernelReplayMode(CUcontext context) override; + + CUptiResult DeviceGetNumEventDomains(CUdevice device, + uint32_t* num_domains) override; + + CUptiResult EventDomainEnumEvents(CUpti_EventDomainID event_domain, + size_t* array_size_bytes, + CUpti_EventID* event_array) override; + + CUptiResult EventDomainGetNumEvents(CUpti_EventDomainID event_domain, + uint32_t* num_events) override; + + CUptiResult EventGetAttribute(CUpti_EventID event, + CUpti_EventAttribute attrib, size_t* value_size, + void* value) override; + + CUptiResult EventGetIdFromName(CUdevice device, const char* event_name, + CUpti_EventID* event) override; + + CUptiResult EventGroupDisable(CUpti_EventGroup event_group) override; + + CUptiResult EventGroupEnable(CUpti_EventGroup event_group) override; + + CUptiResult EventGroupGetAttribute(CUpti_EventGroup event_group, + CUpti_EventGroupAttribute attrib, + size_t* value_size, void* value) override; + + CUptiResult EventGroupReadEvent(CUpti_EventGroup event_group, + CUpti_ReadEventFlags flags, + CUpti_EventID event, + size_t* event_value_buffer_size_bytes, + uint64_t* event_value_buffer) override; + + CUptiResult EventGroupSetAttribute(CUpti_EventGroup event_group, + CUpti_EventGroupAttribute attrib, + size_t value_size, void* value) override; + + CUptiResult EventGroupSetsCreate( + CUcontext context, size_t event_id_array_size_bytes, + CUpti_EventID* event_id_array, + CUpti_EventGroupSets** event_group_passes) override; + + CUptiResult EventGroupSetsDestroy( + CUpti_EventGroupSets* event_group_sets) override; + + // CUPTI metric API + CUptiResult DeviceEnumMetrics(CUdevice device, size_t* arraySizeBytes, + CUpti_MetricID* metricArray) override; + + CUptiResult DeviceGetNumMetrics(CUdevice device, + uint32_t* num_metrics) override; + + CUptiResult MetricGetIdFromName(CUdevice device, const char* metric_name, + CUpti_MetricID* metric) override; + + CUptiResult MetricGetNumEvents(CUpti_MetricID metric, + uint32_t* num_events) override; + + CUptiResult MetricEnumEvents(CUpti_MetricID metric, + size_t* event_id_array_size_bytes, + CUpti_EventID* event_id_array) override; + + CUptiResult MetricGetAttribute(CUpti_MetricID metric, + CUpti_MetricAttribute attrib, + size_t* value_size, void* value) override; + + CUptiResult MetricGetValue(CUdevice device, CUpti_MetricID metric, + size_t event_id_array_size_bytes, + CUpti_EventID* event_id_array, + size_t event_value_array_size_bytes, + uint64_t* event_value_array, + uint64_t time_duration, + CUpti_MetricValue* metric_value) override; + + CUptiResult GetResultString(CUptiResult result, const char** str) override; + + CUptiResult GetContextId(CUcontext context, uint32_t* context_id) override; + + CUptiResult GetStreamIdEx(CUcontext context, CUstream stream, + uint8_t per_thread_stream, + uint32_t* stream_id) override; + + void CleanUp() override {} + bool Disabled() const override { return false; } + + private: + CuptiWrapper(const CuptiWrapper&) = delete; + void operator=(const CuptiWrapper&) = delete; +}; + +} // namespace profiler +} // namespace xla + +#endif // XLA_BACKENDS_PROFILER_GPU_CUPTI_WRAPPER_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/backends/profiler/gpu/nvtx_utils.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/backends/profiler/gpu/nvtx_utils.h new file mode 100644 index 0000000000000000000000000000000000000000..58be1980e2a293bb25c6337138f54e9832f31411 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/backends/profiler/gpu/nvtx_utils.h @@ -0,0 +1,59 @@ +/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_BACKENDS_PROFILER_GPU_NVTX_UTILS_H_ +#define XLA_BACKENDS_PROFILER_GPU_NVTX_UTILS_H_ + +#include + +#include "absl/strings/string_view.h" +#include "tsl/platform/macros.h" + +namespace xla { +namespace profiler { + +/*** + * We have no intention to use NVTX in tensorflow right now, we use this class + * to track NVTX instrumentation inside NVIDIA libraries (such as TensorRT). + * This bears a lot of resemblance to ScopedAnnotation for now. In the future, + * we will use TraceMe to keep track trace context within a thread. + */ +class NVTXRangeTracker { + public: + static void EnterRange(const std::string& range) { + auto& range_stack = GetRangeStack(); + range_stack.push(range); + } + static void ExitRange() { + auto& range_stack = GetRangeStack(); + if (!range_stack.empty()) range_stack.pop(); + } + static const absl::string_view CurrentRange() { + auto& range_stack = GetRangeStack(); + if (!range_stack.empty()) return range_stack.top(); + return ""; + } + + private: + static std::stack& GetRangeStack(); + + NVTXRangeTracker(const NVTXRangeTracker&) = delete; + void operator=(const NVTXRangeTracker&) = delete; +}; + +} // namespace profiler +} // namespace xla + +#endif // XLA_BACKENDS_PROFILER_GPU_NVTX_UTILS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/c/c_api_decl.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/c/c_api_decl.h new file mode 100644 index 0000000000000000000000000000000000000000..a7c0c3b61fd5069c9f85ccc7617d41bb6aa12ef5 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/c/c_api_decl.h @@ -0,0 +1,29 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_C_C_API_DECL_H_ +#define XLA_C_C_API_DECL_H_ + +extern "C" { + +// XLA Layout preferences. +typedef enum { + XLA_LayoutPreference_kNoPreference, + XLA_LayoutPreference_kTpuPreferCompactChunkPaddedLayout, + XLA_LayoutPreference_kTpuPreferLinearLayout, +} XLA_LayoutPreference; +} + +#endif // XLA_C_C_API_DECL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/client.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/client.h new file mode 100644 index 0000000000000000000000000000000000000000..bdd7cfaaa93d3a185c8f209014b2e0b77bde4c7c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/client.h @@ -0,0 +1,247 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_CLIENT_CLIENT_H_ +#define XLA_CLIENT_CLIENT_H_ + +#include +#include +#include +#include + +#include "absl/types/span.h" +#include "xla/client/global_data.h" +#include "xla/client/xla_computation.h" +#include "xla/literal.h" +#include "xla/service/hlo.pb.h" +#include "xla/service_interface.h" +#include "xla/statusor.h" +#include "xla/types.h" +#include "xla/xla.pb.h" +#include "xla/xla_data.pb.h" + +namespace xla { + +// XLA service's client object -- wraps the service with convenience and +// lifetime-oriented methods. +class Client { + public: + explicit Client(ServiceInterface* stub); + virtual ~Client(); + + // Compile the computation with the given argument shapes and returns the + // handle to the compiled executable. The compiled executable is cached on the + // service, and the returned handle can be used for execution without + // re-compile. + // * The shape and layout of the arguments being executed with will affect how + // the computation is compiled. If argument_shapes is empty, the parameters' + // shape and layout will be used in the compilation. + // * If execution_options is not nullptr, these options are passed to the + // service to affect how it compiles our computation. (The pointer does not + // need to live beyond this call.) + // * If execution_options.device_handles should be empty. If you need + // non-empty device handles, call 'Execute' instead. + // + // TODO(b/122731460): This call caches the resulting Executable in the Service + // *forever*. If you're only going to run the computation once, you may want + // to call the Execute(const XlaComputation&) overload. If you're going to + // run the computation more than once but you want control over when the + // Executable is unloaded, use the LocalClient API. + StatusOr Compile( + const XlaComputation& computation, + absl::Span argument_shapes, + const ExecutionOptions* execution_options = nullptr); + + // Executes the compiled executable for the given handle with the given + // arguments and returns the global data that was produced from the execution. + // * If execution_profile is not nullptr then the pointed-to ExecutionProfile + // will be filled with profile data from the execution. + StatusOr> Execute( + const ExecutionHandle& handle, absl::Span arguments, + ExecutionProfile* execution_profile = nullptr); + + // Executes the computation with the given arguments and returns the global + // data that was produced from the execution. + // * If execution_options is not nullptr, these options are passed to the + // service to affect how it compiles our computation. (The pointer does not + // need to live beyond this call.) + // * If execution_options.device_handles is not empty, the computation is + // executed on the devices associated with the handles by partitioning the + // computation based on the attached sharding attributes. Otherwise, a + // device is chosen by the service. + // * If execution_profile is not nullptr then the pointed-to ExecutionProfile + // will be filled with profile data from the execution. + // + // TODO(b/122731460): The given computation is compiled and then thrown away + // immediately after it's run. If you want control over how long the + // resulting Executable lives, use the LocalClient API. + StatusOr> Execute( + const XlaComputation& computation, + absl::Span arguments, + const ExecutionOptions* execution_options = nullptr, + ExecutionProfile* execution_profile = nullptr); + + // A struct to represent a computation instance to be executed. + // * If execution_options.device_handles is not empty, the computation is + // executed on the devices associated with the handles by partitioning the + // computation based on the attached sharding attributes. Otherwise, a + // device is chosen by the service. + struct XlaComputationInstance { + const XlaComputation& computation; + std::vector arguments; + ExecutionOptions execution_options; + ExecutionProfile* execution_profile; + + XlaComputationInstance(const XlaComputation& computation, + std::vector arguments, + ExecutionOptions execution_options, + ExecutionProfile* execution_profile) + : computation(computation), + arguments(std::move(arguments)), + execution_options(execution_options), + execution_profile(execution_profile) {} + }; + + // Executes a list XlaComputationInstances and returns global data produced + // from each computation. + // + StatusOr>> ExecuteParallel( + absl::Span computations); + + // Requests device_count device handles available on the target. The returned + // device handles are used to specify the devices to execute the computations + // (see ExecuteParallel) or to transfer data (see TransferToServer or + // TransferToInfeed). + StatusOr> GetDeviceHandles(int64_t device_count); + + // Transfer the global data provided to this client process, which is + // returned in the provided literal. Use sparingly to avoid transfer + // overheads. + // + // If shape_with_layout is not nullptr, it points to a shape whose layout will + // be the layout of the returned literal. + StatusOr Transfer(const GlobalData& data, + const Shape* shape_with_layout = nullptr); + + // Transfer the given literal to the server. This allocates memory on the + // device and copies the literal's contents over. Returns a global data handle + // that can be used to refer to this value from the client. + // + // If device_handle is not nullptr, data is transferred to the associated + // device (and its replicas if replication is enabled). Otherwise, data is + // transferred to the default device (and its replicas). + StatusOr> TransferToServer( + const LiteralSlice& literal, const DeviceHandle* device_handle = nullptr); + + // Transfer the given literal to the Infeed interface of the device. + // + // device_handle and replica_id together specify a particular device; a device + // assigned for the given replica_id among the replicas that the given device + // handle belongs to. + Status TransferToInfeed(const LiteralSlice& literal, int64_t replica_id = 0, + const DeviceHandle* device_handle = nullptr); + + // Transfers from the Outfeed of the device. + // + // device_handle and replica_id together specify a particular device; a device + // assigned for the given replica_id among the replicas that the given device + // handle belongs to. + StatusOr TransferFromOutfeed( + const Shape* shape_with_layout, int64_t replica_id = 0, + const DeviceHandle* device_handle = nullptr); + + // Resets the device, clearing all existing state on the device. + Status ResetDevice(); + + // Executes the computation with the given arguments and transfers the result + // to the client as a literal. Parameters are defined the same as for + // Execute() and Transfer(). + StatusOr ExecuteAndTransfer( + const XlaComputation& computation, + absl::Span arguments, + const ExecutionOptions* execution_options = nullptr, + ExecutionProfile* execution_profile = nullptr); + + // Computes the value of the given computation using a non-optimized + // interpreter on the host. + // + // The computation must not depend on any parameters, or on stateful operators + // such as `RngNormal` or `Infeed`. + // + // This functionality can be useful when translating a computation into XLA + // where something that looked dynamic is required by XLA to be specified as a + // constant. E.g. the source computation (outside of XLA) may include a + // dynamic computation of the shape of something and ComputeConstant lets you + // determine what the value of that computation is in the case where the value + // can be determined at compile time. + // + // If output_layout is non-null, then the output of the computation will be + // stored using that layout. + StatusOr ComputeConstant( + const XlaComputation& computation, + const Layout* output_layout = nullptr) const; + + // Unregister the memory for the given GlobalData on the device. + Status Unregister(const GlobalData& data); + + // Returns a vector of global data handles that point to the tuple elements. + StatusOr>> DeconstructTuple( + const GlobalData& data); + + // Retrieves the statistics of the given computation. + StatusOr GetComputationStats( + const XlaComputation& computation, + const DebugOptions& debug_options) const; + + // Returns the Shape of the given array specified by 'data'. The shape + // includes the Layout of the array as it is stored on the service. + StatusOr GetShape(const GlobalData& data); + + // As above, but returns the shape of the provided computation (parameter + // types/names and return type). + StatusOr> GetComputationShape( + const XlaComputation& computation); + + // Creates a channel handle that can be used to transfer data between two + // computations on different devices via a pair of Send and Recv instructions. + StatusOr CreateChannelHandle(); + + // Create a channel for communicating with the host via a SendtoHost or + // RecvFromHost operation. + StatusOr CreateHostToDeviceChannelHandle(); + StatusOr CreateDeviceToHostChannelHandle(); + + StatusOr LoadSnapshot(const HloSnapshot& module); + + ServiceInterface* stub() { return stub_; } + + private: + // Returns the execution statistics (e.g., gflop/s) as a string from the + // ExecutionProfile returned from an execution of the computation. + StatusOr ExecutionStatsAsString( + const XlaComputation& computation, const ExecutionProfile& profile); + + StatusOr CreateChannelHandleByType( + ChannelHandle::ChannelType type); + + ServiceInterface* stub_; // Stub that this client is connected on. + + Client(const Client&) = delete; + Client& operator=(const Client&) = delete; +}; + +} // namespace xla + +#endif // XLA_CLIENT_CLIENT_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/client_library.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/client_library.h new file mode 100644 index 0000000000000000000000000000000000000000..f98a01aa9697ad0616af9885c5c432633fe6b08c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/client_library.h @@ -0,0 +1,146 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +// The "client library" instantiates a local (in-process) XLA service for +// use by this process, and connects to it with a singleton XLA local +// client. ClientLibrary::GetOrCreateLocalClient will spawn a local service, +// and return a client that's connected to it and ready to run XLA +// computations. +#ifndef XLA_CLIENT_CLIENT_LIBRARY_H_ +#define XLA_CLIENT_CLIENT_LIBRARY_H_ + +#include +#include +#include +#include +#include +#include + +#include "absl/container/flat_hash_map.h" +#include "xla/client/compile_only_client.h" +#include "xla/client/local_client.h" +#include "xla/service/compile_only_service.h" +#include "xla/service/local_service.h" +#include "xla/statusor.h" +#include "xla/stream_executor/device_memory_allocator.h" +#include "xla/stream_executor/stream_executor.h" +#include "xla/types.h" + +namespace xla { + +// Options to configure the local client when it is created. +class LocalClientOptions { + public: + LocalClientOptions( + se::Platform* platform = nullptr, int number_of_replicas = 1, + int intra_op_parallelism_threads = -1, + const std::optional>& allowed_devices = std::nullopt); + + // Set the platform backing the service, or nullptr for the default platform. + LocalClientOptions& set_platform(se::Platform* platform); + se::Platform* platform() const; + + // Set the number of replicas to use when compiling replicated + // programs. + LocalClientOptions& set_number_of_replicas(int number_of_replicas); + int number_of_replicas() const; + + // Sets the thread pool size for parallel execution of an individual operator. + LocalClientOptions& set_intra_op_parallelism_threads(int num_threads); + int intra_op_parallelism_threads() const; + + // Sets the allowed_devices set for selectively constructing stream executors + // on the platform. + LocalClientOptions& set_allowed_devices( + const std::optional>& allowed_devices); + const std::optional>& allowed_devices() const; + + private: + se::Platform* platform_; + int number_of_replicas_; + int intra_op_parallelism_threads_; + std::optional> allowed_devices_; +}; + +class ClientLibrary { + public: + // Singleton constructor-or-accessor -- returns a client for the application + // to issue XLA commands on. Arguments: + // + // platform : The platform the underlying XLA service should target. If + // null then default platform is used. + // device_set: Set of device IDs for which the stream executor will be + // created, for the given platform. + static StatusOr GetOrCreateLocalClient( + se::Platform* platform = nullptr, + const std::optional>& device_set = std::nullopt); + static StatusOr GetOrCreateLocalClient( + const LocalClientOptions& options); + + // Convenience "or-die" wrapper around the above which returns the existing + // client library or creates one with default platform and allocator. + static LocalClient* LocalClientOrDie(); + + // Returns the service from the service thread. Only used in unit tests to + // access user computations from client. + static LocalService* GetXlaService(se::Platform* platform); + + // Singleton constructor-or-accessor for compile-only clients. Arguments: + // + // platform : The platform the underlying XLA service should target. If + // null then default platform is used. + static StatusOr GetOrCreateCompileOnlyClient( + se::Platform* platform = nullptr); + + // Clears the local instance and compile only instance caches. The client + // pointers returned by the previous GetOrCreateLocalClient() or + // GetOrCreateCompileOnlyClient() invocations are not valid anymore. + static void DestroyLocalInstances(); + + private: + // Returns the singleton instance of ClientLibrary. + static ClientLibrary& Singleton(); + + ClientLibrary(); + ~ClientLibrary(); + + struct LocalInstance { + // Service that is wrapped by the singleton client object. + std::unique_ptr service; + // Singleton client object. + std::unique_ptr client; + }; + + struct CompileOnlyInstance { + // Service that is wrapped by the singleton client object. + std::unique_ptr service; + // Singleton client object. + std::unique_ptr client; + }; + + absl::Mutex service_mutex_; // Guards the singleton creation state. + absl::flat_hash_map> + local_instances_ ABSL_GUARDED_BY(service_mutex_); + + absl::flat_hash_map> + compile_only_instances_ ABSL_GUARDED_BY(service_mutex_); + + ClientLibrary(const ClientLibrary&) = delete; + ClientLibrary& operator=(const ClientLibrary&) = delete; +}; + +} // namespace xla + +#endif // XLA_CLIENT_CLIENT_LIBRARY_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/compile_only_client.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/compile_only_client.h new file mode 100644 index 0000000000000000000000000000000000000000..3b737fc26cf89d10b4cfa10f4ad39bce211765ac --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/compile_only_client.h @@ -0,0 +1,78 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_CLIENT_COMPILE_ONLY_CLIENT_H_ +#define XLA_CLIENT_COMPILE_ONLY_CLIENT_H_ + +#include +#include + +#include "xla/client/client.h" +#include "xla/client/xla_computation.h" +#include "xla/service/compile_only_service.h" +#include "xla/service/compiler.h" +#include "xla/statusor.h" +#include "xla/stream_executor/stream_executor.h" +#include "xla/xla_data.pb.h" + +namespace xla { + +// An XLA Client specialization for doing ahead-of-time compilation. This does +// not require (or attempt to instantiate) an execution-capable backend for the +// relevant platform. +class CompileOnlyClient : public Client { + public: + explicit CompileOnlyClient(CompileOnlyService* service) + : Client(service), compiler_service_(service) {} + + CompileOnlyClient(const CompileOnlyClient&) = delete; + void operator=(const CompileOnlyClient&) = delete; + + // A description of an xla computation to compile using CompileAheadOfTime. + struct AotXlaComputationInstance { + const XlaComputation* computation; + // Inform the compiler of the expected layout for arguments. + std::vector argument_layouts; + // Specifies the expected result layout. + const Shape* result_layout; + }; + + // Compiles a list of xla computations for ahead-of-time execution. + // This is intended for use in static compilation. The |options| + // parameter describes the target for which the compiler should emit + // code. |metadata|, if provided, is populated during compilation. + StatusOr>> + CompileAheadOfTime( + absl::Span computations, + const AotCompilationOptions& options, + std::unique_ptr* metadata = nullptr); + + // Create a Hlo module config for the given program shape and arguments. + // execution_options is optional; if not given a default is used. + StatusOr> CreateModuleConfig( + const ProgramShape& program_shape, + absl::Span argument_shapes, + const ExecutionOptions* execution_options); + + // Returns the size of a pointer in bytes for a given triple. + static int64_t PointerSizeForTriple(absl::string_view triple); + + private: + CompileOnlyService* compiler_service_; +}; + +} // namespace xla + +#endif // XLA_CLIENT_COMPILE_ONLY_CLIENT_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/executable_build_options.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/executable_build_options.h new file mode 100644 index 0000000000000000000000000000000000000000..bc0a039f565101bceef6bca25d48cf5c225d45bd --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/executable_build_options.h @@ -0,0 +1,255 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_CLIENT_EXECUTABLE_BUILD_OPTIONS_H_ +#define XLA_CLIENT_EXECUTABLE_BUILD_OPTIONS_H_ + +#include +#include +#include +#include +#include + +#include "absl/algorithm/container.h" +#include "absl/container/inlined_vector.h" +#include "xla/pjrt/compile_options.pb.h" +#include "xla/service/compilation_environments.h" +#include "xla/service/computation_placer.h" +#include "xla/shape.h" +#include "xla/xla.pb.h" +#include "tsl/platform/threadpool.h" + +namespace stream_executor { + +// Forward-declared to avoid StreamExecutor dependency. +class DeviceMemoryAllocator; + +} // namespace stream_executor + +namespace xla { +class HloModule; + +// Class containing options for building an LocalExecutable with +// LocalClient::Compile. +class ExecutableBuildOptions { + public: + // If set, this is the device to build the computation for. Valid + // device_ordinal values are: 0 to # of devices - 1. These values are + // identical to the device ordinal values used by StreamExecutor. The built + // executable will be executable on any device equivalent to the specified + // device as determined by Backend::devices_equivalent(). A value of -1 + // indicates this option has not been set. + ExecutableBuildOptions& set_device_ordinal(int device_ordinal); + int device_ordinal() const; + + // If set, this specifies the layout of the result of the computation. If not + // set, the service will chose the layout of the result. A Shape is used to + // store the layout to accommodate tuple result shapes. A value of nullptr + // indicates the option has not been set. + ExecutableBuildOptions& set_result_layout(const Shape& shape_with_layout); + const Shape* result_layout() const; + + // Expose access to the XLA compilation environments, which will be passed to + // the compilation process. `comp_envs()` must not be called if + // `has_comp_envs()` returns false. + bool has_comp_envs() const { return comp_envs_.has_value(); } + const CompilationEnvironments& comp_envs() const { return *comp_envs_; } + CompilationEnvironments* mutable_comp_envs(); + + // Expose access to the XLA debug options which will be passed to the + // compilation process. `debug_options()` must not be called if + // `has_debug_options()` returns false. + bool has_debug_options() const { return debug_options_.has_value(); } + const DebugOptions& debug_options() const { return *debug_options_; } + DebugOptions* mutable_debug_options(); + + // If set, this specifies an allocator that can be used to allocate temporary + // space on the device during compilation. For example, the compiler might + // want to run various algorithms on the device and pick the fastest one -- it + // might allocate buffers for use by these algorithms using this allocator. + // + // This does not need to be the same as the se::DeviceMemoryAllocator passed + // when running the executable. + ExecutableBuildOptions& set_device_allocator( + se::DeviceMemoryAllocator* allocator); + se::DeviceMemoryAllocator* device_allocator() const; + + // The number of replicas of this computation that are to be executed. + // Defaults to 1. + int num_replicas() const { return num_replicas_; } + ExecutableBuildOptions& set_num_replicas(int num_replicas); + + // The number of partitions in this computation. Defaults to 1. + int num_partitions() const { return num_partitions_; } + ExecutableBuildOptions& set_num_partitions(int num_partitions); + + // Indicates whether to use SPMD (true) or MPMD (false) partitioning when + // num_partitions > 1 and XLA is requested to partition the input program. + bool use_spmd_partitioning() const { return use_spmd_partitioning_; } + ExecutableBuildOptions& set_use_spmd_partitioning(bool use_spmd_partitioning); + + // Whether to automatically generate XLA shardings for SPMD partitioner. + bool use_auto_spmd_partitioning() const { + return use_auto_spmd_partitioning_; + } + ExecutableBuildOptions& set_use_auto_spmd_partitioning( + bool use_auto_spmd_partitioning); + + std::vector auto_spmd_partitioning_mesh_shape() const { + return auto_spmd_partitioning_mesh_shape_; + } + ExecutableBuildOptions& set_auto_spmd_partitioning_mesh_shape( + std::vector mesh_shape); + + std::vector auto_spmd_partitioning_mesh_ids() const { + return auto_spmd_partitioning_mesh_ids_; + } + ExecutableBuildOptions& set_auto_spmd_partitioning_mesh_ids( + std::vector mesh_ids); + + bool deduplicate_hlo() const { return deduplicate_hlo_; } + ExecutableBuildOptions& set_deduplicate_hlo(bool deduplicate_hlo); + + // If set, this specifies a static device assignment for the computation. + // Otherwise, the computation will be compiled generically and can be run with + // any device assignment compatible with the computation's replica and + // partition counts. + bool has_device_assignment() const { return device_assignment_.has_value(); } + ExecutableBuildOptions& set_device_assignment( + const DeviceAssignment& device_assignment); + const DeviceAssignment& device_assignment() const { + CHECK(device_assignment_.has_value()); + return device_assignment_.value(); + } + void clear_device_assignment() { device_assignment_.reset(); } + + // Whether input and output buffers are aliased if the associated parameter is + // passed-through XLA modules without being changed. + bool alias_passthrough_params() const { return alias_passthrough_params_; } + void set_alias_passthrough_params(bool alias_passthrough_params) { + alias_passthrough_params_ = alias_passthrough_params; + } + + bool run_backend_only() const { return run_backend_only_; } + // By default, XLA builds an executable by invoking standard compilation, i.e, + // running Compiler::Compile, or both Compiler::RunHloPasses and + // Compiler::RunBackend. When run_backend_only is set to true, XLA builds an + // executable by invoking only RunBackend and skip invoking RunHloPasses, + // which can be used to compile post-optimizations HLO modules. + ExecutableBuildOptions& set_run_backend_only(bool run_backend_only) { + run_backend_only_ = run_backend_only; + return *this; + } + + absl::Span allow_spmd_sharding_propagation_to_output() const { + return allow_spmd_sharding_propagation_to_output_; + } + bool any_allow_spmd_sharding_propagation_to_output() const { + return absl::c_linear_search(allow_spmd_sharding_propagation_to_output_, + true); + } + // Allows sharding propagation to propagate to the outputs. This changes the + // output shape of the computation (which is undesirable), but it can be used + // to allow to run partial compilation to determine what would be the output + // sharding of a computation if XLA would be allowed to propagate the sharding + // which can be used by higher level framework as a way to query intermediate + // sharding of operations when multiple computation would be chained and + // merged together. + ExecutableBuildOptions& set_allow_spmd_sharding_propagation_to_output( + absl::Span allow_spmd_sharding_propagation_to_output) { + allow_spmd_sharding_propagation_to_output_.assign( + allow_spmd_sharding_propagation_to_output.begin(), + allow_spmd_sharding_propagation_to_output.end()); + return *this; + } + + // Thread pool for parallel compilation. + tsl::thread::ThreadPool* compile_thread_pool() const { + return compile_thread_pool_; + } + ExecutableBuildOptions& set_compile_thread_pool( + tsl::thread::ThreadPool* compile_thread_pool) { + compile_thread_pool_ = compile_thread_pool; + return *this; + } + + using LayoutCanonicalizationCallback = + std::function, Shape>>( + const HloModule& module)>; + void set_layout_canonicalization_callback( + LayoutCanonicalizationCallback callback) { + layout_canonicalization_callback_ = std::move(callback); + } + LayoutCanonicalizationCallback layout_canonicalization_callback() const { + return layout_canonicalization_callback_; + } + + absl::string_view fdo_profile() const { return fdo_profile_; } + void set_fdo_profile(const std::string& fdo_profile) { + fdo_profile_ = fdo_profile; + } + std::string* mutable_fdo_profile() { return &fdo_profile_; } + + // The amount of device memory available for the executable. + int64_t device_memory_size() const { return device_memory_size_; } + ExecutableBuildOptions& set_device_memory_size(int64_t device_memory_size) { + device_memory_size_ = device_memory_size; + return *this; + } + + // Returns a string representation of the build options, suitable for + // debugging. + std::string ToString() const; + + StatusOr ToProto() const; + + private: + int device_ordinal_ = -1; + Shape result_layout_; + bool result_layout_set_ = false; + std::optional comp_envs_; + std::optional debug_options_; + se::DeviceMemoryAllocator* device_allocator_ = nullptr; + int num_replicas_ = 1; + int num_partitions_ = 1; + bool use_spmd_partitioning_ = false; + bool use_auto_spmd_partitioning_ = false; + std::vector auto_spmd_partitioning_mesh_shape_; + std::vector auto_spmd_partitioning_mesh_ids_; + bool deduplicate_hlo_ = false; + bool broadcast_replicated_params_ = false; + std::optional device_assignment_; + bool alias_passthrough_params_ = false; + bool run_backend_only_ = false; + absl::InlinedVector allow_spmd_sharding_propagation_to_output_ = { + false}; + tsl::thread::ThreadPool* compile_thread_pool_ = nullptr; + LayoutCanonicalizationCallback layout_canonicalization_callback_; + std::string fdo_profile_; + int64_t device_memory_size_ = 0; +}; + +StatusOr ExecutableBuildOptionsFromProto( + const ExecutableBuildOptionsProto& input); + +// Creates an ExecutionOptions based on a given ExecutableBuildOptions and +// ProgramShape. +ExecutionOptions CreateExecutionOptions( + const ExecutableBuildOptions& build_options, + const ProgramShape* program_shape); + +} // namespace xla + +#endif // XLA_CLIENT_EXECUTABLE_BUILD_OPTIONS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/global_data.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/global_data.h new file mode 100644 index 0000000000000000000000000000000000000000..f54735d4429ca4fec74935cc7f56a4e6bb1d0f83 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/global_data.h @@ -0,0 +1,63 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_CLIENT_GLOBAL_DATA_H_ +#define XLA_CLIENT_GLOBAL_DATA_H_ + +#include +#include + +#include "absl/types/span.h" +#include "xla/service_interface.h" +#include "xla/xla.pb.h" +#include "xla/xla_data.pb.h" + +namespace xla { + +// A GlobalData object represents a globally-accessible allocation of +// data in the associated XLA service. +class GlobalData { + public: + // Gives ownership of the global data handle to this object. + GlobalData(ServiceInterface* parent, GlobalDataHandle handle); + + // Unregisters the wrapped handle, which causes the service to + // deallocate the associated data. + ~GlobalData(); + + const GlobalDataHandle& handle() const { return handle_; } + + // Releases a set of GlobalData handles. A single RPC will be issued + // per unique ServiceInterface of the given GlobalData objects. + static void Release(std::vector> instances); + + private: + // Detaches the global data handle from the object, such that the destructor + // will not try to release it. + GlobalDataHandle Release() { + parent_ = nullptr; + return handle_; + } + + GlobalDataHandle handle_; // Handle being wrapped. + ServiceInterface* parent_; // Service used to unregister handle_. + + GlobalData(const GlobalData&) = delete; + GlobalData& operator=(const GlobalData&) = delete; +}; + +} // namespace xla + +#endif // XLA_CLIENT_GLOBAL_DATA_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/approx_topk.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/approx_topk.h new file mode 100644 index 0000000000000000000000000000000000000000..d92c784b9de65686aee5fe530f0218fdb7d684ee --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/approx_topk.h @@ -0,0 +1,70 @@ +/* Copyright 2021 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_CLIENT_LIB_APPROX_TOPK_H_ +#define XLA_CLIENT_LIB_APPROX_TOPK_H_ + +#include "xla/client/xla_builder.h" +#include "xla/xla_data.pb.h" + +namespace xla { + +// Computes approximate top-ks by aggregating top-1s in equal-sized windows. +// The number and the size of the windows are determined by the `recall_target`. +// +// operand: A sequence of multi-dimensional arrays of type T_0, ..., T_{N-1} +// init_values: N starting values for top-1 reductions +// top_k: Determines the k in top-k operation. +// reduction_dim: Determines the dimension to compute top-k. +// comparator: The comparator computation to use, which should have function +// signatore of (T_0, T_0, T_1, T_1, ..., T_{N-1}, T_{N-1}) -> bool. +// recall_target: Valid range (0, 1]. User can trade-off quality and performance +// with this knob. +// aggregate_to_topk: When true, sorts the set of approximate top-k elements and +// only keep the final k elements on TPU. This option is useful when user +// wanted to forward the approximate results to host and aggregate the results +// on CPU for better throughput. +// reduction_input_size_override: When set to a positive value, it overrides the +// size determined by operands[reduction_dim] for evaluating the recall. This +// option is useful when the given operand is only a subset of the overall +// computation in SPMD or distributed pipelines, where the true input size +// cannot be deferred by the operand shape. +// +// Returns a sequence of multidimensional arrays of type T_0, ..., T_{N-1}, +// which contains the approximate top-ks from the input operands. When +// `aggregate_to_topk` is set to true, the output size is just top_k. When +// `aggregate_to_topk` is set to false, the output size varied by the target +// recall. For target recall = 0.9, the output size is roughly 10 * top_k. For +// target recall = 0.99, the output size is roughly 100 * top_k. +// +// TODO(fchern): Support other hardware platforms. +XlaOp ApproxTopK(XlaBuilder* builder, absl::Span operands, + absl::Span init_values, int64_t top_k, + int64_t reduction_dim, const XlaComputation& comparator, + float recall_target = 0.9, bool aggregate_to_topk = true, + int64_t reduction_input_size_override = -1); + +// Fallback for platforms that haven't been optimized. +XlaOp ApproxTopKFallback(XlaBuilder* builder, absl::Span operands, + absl::Span init_values, int64_t top_k, + int64_t reduction_dim, + const XlaComputation& comparator, + float recall_target = 0.9, + bool aggregate_to_topk = true, + int64_t reduction_input_size_override = -1); + +} // namespace xla + +#endif // XLA_CLIENT_LIB_APPROX_TOPK_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/approx_topk_shape.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/approx_topk_shape.h new file mode 100644 index 0000000000000000000000000000000000000000..c569aa3aa40c15ee1ca6a12317c7ea2031fdf6bf --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/approx_topk_shape.h @@ -0,0 +1,50 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_CLIENT_LIB_APPROX_TOPK_SHAPE_H_ +#define XLA_CLIENT_LIB_APPROX_TOPK_SHAPE_H_ + +#include + +#include "xla/statusor.h" + +namespace xla { + +// Determine the output size of the reduction dimension. This is useful for jax +// abstract eval to determine the output size. +// +// input_size: Input size of the reduction dimension. +// rank: Rank of the input operand. +// top_k: Determines the k in top-k operation. +// recall_target: Valid range (0, 1]. User can trade-off quality and performance +// with this knob. +// aggregate_to_topk: When true, sorts the set of approximate top-k elements and +// only keep the final k elements on TPU. This option is useful when user +// wanted to forward the approximate results to host and aggregate the results +// on CPU for better throughput. +// +// Returns a pair of +// 1. Reduction output size +// 2. Reduction amount in log2 form. +// +// 2. is invalid and set to -1 when the approximate output is disabled, i.e. +// top_k = 1 or aggregate_to_topk = true. +StatusOr> ApproxTopKReductionOutputSize( + int64_t input_size, int64_t rank, int64_t top_k, float recall_target, + bool aggregate_to_topk, int64_t input_size_override = -1); + +} // namespace xla + +#endif // XLA_CLIENT_LIB_APPROX_TOPK_SHAPE_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/arithmetic.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/arithmetic.h new file mode 100644 index 0000000000000000000000000000000000000000..d7b0d2cb5d8adca9a204587664419508f8e3d38f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/arithmetic.h @@ -0,0 +1,94 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_CLIENT_LIB_ARITHMETIC_H_ +#define XLA_CLIENT_LIB_ARITHMETIC_H_ + +#include +#include +#include + +#include "xla/client/xla_builder.h" +#include "xla/client/xla_computation.h" +#include "xla/xla_data.pb.h" + +namespace xla { + +using XlaOpGenerator = std::function; + +// Creates a scalar computation based on a lambda and returns it. +XlaComputation CreateScalarComputation(const std::string& name, + PrimitiveType type, XlaBuilder* builder, + XlaOpGenerator generator); + +// Creates a scalar add computation and returns it. +XlaComputation CreateScalarAddComputation(PrimitiveType type, + XlaBuilder* builder); + +// Creates a scalar multiply computation and returns it. +XlaComputation CreateScalarMultiplyComputation(PrimitiveType type, + XlaBuilder* builder); + +// Creates a scalar ge computation and returns it. +XlaComputation CreateScalarGeComputation(PrimitiveType type, + XlaBuilder* builder); + +// Creates a scalar max computation and returns it. +XlaComputation CreateScalarMaxComputation(PrimitiveType type, + XlaBuilder* builder); + +// Creates a scalar min computation and returns it. +XlaComputation CreateScalarMinComputation(PrimitiveType type, + XlaBuilder* builder); + +// Creates a scalar logical AND computation and returns it. +XlaComputation CreateScalarAndComputation(PrimitiveType type, + XlaBuilder* builder); + +// Creates a scalar logical OR computation and returns it. +XlaComputation CreateScalarOrComputation(PrimitiveType type, + XlaBuilder* builder); + +// This is to be used for general purpose "identity" like reductions with zero +// for any type (ie. boolean operations for PRED and Add for real numbers). +// As an example, this operation can be used for a situation of: +// x_type = type(x) +// op = CreateScalarIdentityWithZeroComputation(x_type) +// ASSERT_TRUE(op(x, 0) == x) +// +// This functionality is used for operations that are similar to a slice, +// gather, or broadcast, but are created through a reduction. +XlaComputation CreateScalarIdentityWithZeroComputation(PrimitiveType type, + XlaBuilder* builder); + +// Returns whether any predicate in "predicates" is set. +// +// Note: if predicates is zero-sized, Any() vacuously returns false. +XlaOp Any(XlaOp predicates); + +// Returns the argmax of `input` along `axis`. `output_type` is the type to +// use for the output. In case of ties always prefers smaller index. +XlaOp ArgMax(XlaOp input, PrimitiveType output_type, int axis); + +// Returns the argmin of `input` along `axis`. `output_type` is the type to +// use for the output. In case of ties always prefers smaller index. +XlaOp ArgMin(XlaOp input, PrimitiveType output_type, int axis); + +// Dispatch to ArgMin or ArgMax above, depending on bool. +XlaOp ArgMinMax(XlaOp input, PrimitiveType output_type, int axis, bool is_min); + +} // namespace xla + +#endif // XLA_CLIENT_LIB_ARITHMETIC_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/broadcast.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/broadcast.h new file mode 100644 index 0000000000000000000000000000000000000000..50a8ab2124f37c911c71068403f4f533e4a982fc --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/broadcast.h @@ -0,0 +1,32 @@ +/* Copyright 2021 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_CLIENT_LIB_BROADCAST_H_ +#define XLA_CLIENT_LIB_BROADCAST_H_ + +#include "xla/client/xla_builder.h" +#include "xla/primitive_util.h" +#include "xla/types.h" +#include "xla/xla_data.pb.h" + +namespace xla { + +// Broadcasts 'input' up to shape 'output_dims', using TensorFlow broadcasting +// rules. Supports broadcasting a dimension of size x to size x*y, i.e., tiling. +StatusOr BroadcastTo(XlaOp input, absl::Span output_dims); + +} // namespace xla + +#endif // XLA_CLIENT_LIB_BROADCAST_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/comparators.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/comparators.h new file mode 100644 index 0000000000000000000000000000000000000000..952a804eddfa31b3b3fcc441182a5f16cf4ea95d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/comparators.h @@ -0,0 +1,59 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_CLIENT_LIB_COMPARATORS_H_ +#define XLA_CLIENT_LIB_COMPARATORS_H_ + +#include +#include +#include + +#include "xla/client/xla_builder.h" +#include "xla/client/xla_computation.h" +#include "xla/xla_data.pb.h" + +namespace xla { + +// Creates a scalar less-than computation and returns it. The created +// computation has 2 * 'operand_types.size()' many parameters, where parameters +// 2 * i and 2 * i + 1 are a scalar with primitive type 'operand_types[i]'. The +// computation compares the first two parameters. For floating point types, a +// total order is created where +// -NaN < -infinity < ... < -0 < 0 < ... < infinity < NaN +XlaComputation CreateScalarLtComputation( + const std::vector& operand_types, XlaBuilder* builder); + +// Creates a scalar greater-than computation and returns it. The created +// computation has 2 * 'operand_types.size()' many parameters, where parameters +// 2 * i and 2 * i + 1 are a scalar with primitive type 'operand_types[i]'. The +// computation compares the first two parameters. For floating point types, a +// total order is created where +// NaN > infinity > ... > 0 > -0 > ... > -infinity > -NaN +XlaComputation CreateScalarGtComputation( + const std::vector& operand_types, XlaBuilder* builder); + +// Creates a scalar comparison computation and returns it. This function takes +// a vector of comparator functions to compare the operands where the function +// isn't nullopt with the specified comparator at that location. +XlaComputation CreateScalarComparisonComputation( + const std::string& name, const std::vector& operand_types, + const std::vector< + std::optional)>>& + generators, + XlaBuilder* builder); + +} // namespace xla + +#endif // XLA_CLIENT_LIB_COMPARATORS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/constants.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/constants.h new file mode 100644 index 0000000000000000000000000000000000000000..d6c968540eae0bbe07e6989c4d3f6d1afa125a74 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/constants.h @@ -0,0 +1,135 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_CLIENT_LIB_CONSTANTS_H_ +#define XLA_CLIENT_LIB_CONSTANTS_H_ + +#include + +#include "xla/client/xla_builder.h" +#include "xla/primitive_util.h" +#include "xla/types.h" +#include "xla/xla_data.pb.h" +#include "tsl/platform/float8.h" + +namespace xla { + +// Returns scalar 'value' as a scalar of 'type'. Unlike ConstantR0, 'type' is +// determined at C++ run-time, rather than C++ compile-time. +// If 'value' is floating point but 'type' is not, or if 'value' is complex but +// 'type' is not, an error will be returned. This is to catch accidental +// truncation; in such cases, use an explicit cast. +template +XlaOp ConstantR0WithType(XlaBuilder* builder, PrimitiveType type, T value) { + if (std::is_floating_point::value && + !(primitive_util::IsFloatingPointType(type) || + primitive_util::IsComplexType(type))) { + return builder->ReportError(InvalidArgument( + "Invalid cast from floating point type to %s in ConstantR0WithType.", + PrimitiveType_Name(type))); + } + if (std::is_same::value && + !primitive_util::IsComplexType(type)) { + return builder->ReportError(InvalidArgument( + "Invalid cast from complex type to %s in ConstantR0WithType.", + PrimitiveType_Name(type))); + } + return primitive_util::PrimitiveTypeSwitch( + [&](auto primitive_type_constant) -> XlaOp { + if constexpr (primitive_util::IsArrayType(primitive_type_constant)) { + using NativeT = primitive_util::NativeTypeOf; + return ConstantR0(builder, static_cast(value)); + } + return builder->ReportError( + InvalidArgument("Invalid type for ConstantR0WithType (%s).", + PrimitiveType_Name(type))); + }, + type); +} + +// Returns a scalar containing 'value' cast to the same run-time type as +// 'prototype'. +// If 'value' is floating point but 'prototype' is not, or if 'value' is complex +// 'prototype' is not, an error will be returned. +template +XlaOp ScalarLike(XlaOp prototype, T value) { + XlaBuilder* builder = prototype.builder(); + return builder->ReportErrorOrReturn([&]() -> StatusOr { + TF_ASSIGN_OR_RETURN(Shape shape, builder->GetShape(prototype)); + return ConstantR0WithType(builder, shape.element_type(), value); + }); +} + +// Returns an array or scalar containing copies of `value` cast to the same +// run-type type as `prototype` and broadcast to the same dimensions as +// `prototype`. +// +// If `prototype` is not a scalar or array, returns an error. +template +XlaOp FullLike(XlaOp prototype, T value) { + XlaBuilder* builder = prototype.builder(); + return builder->ReportErrorOrReturn([&]() -> StatusOr { + TF_ASSIGN_OR_RETURN(Shape shape, builder->GetShape(prototype)); + if (ShapeUtil::IsScalar(shape) || shape.IsArray()) { + return Broadcast(ScalarLike(prototype, value), shape.dimensions()); + } else { + return InvalidArgument( + "Prototype shape for BroadcastConstantLike must be a scalar or " + "array, but was %s", + shape.ToString()); + } + }); +} + +// Returns a scalar with value '0' of 'type'. +XlaOp Zero(XlaBuilder* builder, PrimitiveType type); + +// Returns a zero-filled tensor with shape `shape`. +XlaOp Zeros(XlaBuilder* builder, const Shape& shape); + +// Returns a zero-filled tensor with the same shape as `prototype`. +XlaOp ZerosLike(XlaOp prototype); + +// Returns a scalar with value '1' of 'type'. +XlaOp One(XlaBuilder* builder, PrimitiveType type); + +// Returns the machine epsilon for floating-point type `type`, i.e., +// the difference between 1.0 and the next representable value. +XlaOp Epsilon(XlaBuilder* builder, PrimitiveType type); + +// Returns the minimum representable finite or infinite value for 'type'. +// Returns '-inf' for floating-point types. +XlaOp MinValue(XlaBuilder* builder, PrimitiveType type); + +// Returns the minimum representable finite value for 'type'. For a floating +// point type, this is equal to -MaxFiniteValue(). +XlaOp MinFiniteValue(XlaBuilder* builder, PrimitiveType type); + +// Returns the minimum positive normal value for floating-point type `type`. +XlaOp MinPositiveNormalValue(XlaBuilder* builder, PrimitiveType type); + +// Returns the maximum representable finite or infinite value for 'type'. +// Returns 'inf' for floating-point types. +XlaOp MaxValue(XlaBuilder* builder, PrimitiveType type); + +// Returns the maximum representable finite value for 'type'. +XlaOp MaxFiniteValue(XlaBuilder* builder, PrimitiveType type); + +// Returns a nan for the given type. Only valid for real-valued fp types. +XlaOp NanValue(XlaBuilder* builder, PrimitiveType type); + +} // namespace xla + +#endif // XLA_CLIENT_LIB_CONSTANTS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/conv_grad_size_util.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/conv_grad_size_util.h new file mode 100644 index 0000000000000000000000000000000000000000..1de80450492215cb9197380f338d5264061e6a6e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/conv_grad_size_util.h @@ -0,0 +1,43 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_CLIENT_LIB_CONV_GRAD_SIZE_UTIL_H_ +#define XLA_CLIENT_LIB_CONV_GRAD_SIZE_UTIL_H_ + +#include "xla/client/padding.h" + +namespace xla { + +// Information about a single spatial dimension for a convolution gradients and +// windowed operations. +struct SpatialDimensionOutputSizeAndPadding { + // Effective size of the operation output (potentially expanded). + int64_t output_size; + // Number of padding elements to be added before/after this dimension of + // the input when computing the input gradient. + int64_t pad_before; + int64_t pad_after; +}; + +// Verifies that the dimensions all match, and computes the size and padding of +// a spatial dimension for convolution gradient operations. +StatusOr +ConvGradExtractAndVerifyDimension(int64_t input_size, int64_t filter_size, + int64_t output_size, int64_t dilation, + int64_t stride, Padding padding); + +} // namespace xla + +#endif // XLA_CLIENT_LIB_CONV_GRAD_SIZE_UTIL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/dynamic_shaped_ops.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/dynamic_shaped_ops.h new file mode 100644 index 0000000000000000000000000000000000000000..969d0ddadf971676773bca111bc18184c079b812 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/dynamic_shaped_ops.h @@ -0,0 +1,56 @@ +/* Copyright 2021 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_CLIENT_LIB_DYNAMIC_SHAPED_OPS_H_ +#define XLA_CLIENT_LIB_DYNAMIC_SHAPED_OPS_H_ + +#include "xla/client/lib/constants.h" +#include "xla/client/value_inference.h" +#include "xla/client/xla_builder.h" +#include "xla/primitive_util.h" +#include "xla/types.h" +#include "xla/xla_data.pb.h" + +namespace xla { + +// Similar to static shaped conditional, but allows true_computation and +// false_computation to have different dimension sizes (ranks still have to be +// the same). Fall back to static conditional if dynamism is not presented. +XlaOp DynamicConditional(XlaBuilder* builder, XlaOp predicate, + XlaOp true_operand, + const XlaComputation& true_computation, + XlaOp false_operand, + const XlaComputation& false_computation); + +// Similar to DynamicConditional, but support multiple branches. +XlaOp DynamicConditional( + XlaBuilder* builder, XlaOp branch_index, + absl::Span branch_computations, + absl::Span branch_operands); + +// Similar to SetDimensionSize, but automatically adjust the bound of output if +// a tighter one can be inferred by `value_inference`. +StatusOr SetDimensionSizeWithRebound(ValueInference* value_inference, + XlaOp operand, XlaOp dimension_size, + int64_t dimension); + +// Take a `operand` tensor and a R1 tensor `size_vector` representing the sizes +// of `operand`, Call SetDimensionSize if for each dimension whose size is +// dynamic. +StatusOr SetAllDimensionSizes(ValueInference* value_inference, + XlaOp operand, XlaOp size_vector); +} // namespace xla + +#endif // XLA_CLIENT_LIB_DYNAMIC_SHAPED_OPS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/loops.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/loops.h new file mode 100644 index 0000000000000000000000000000000000000000..6ee295be155ee25f6de320fe60b5a0ec2ffa77c1 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/loops.h @@ -0,0 +1,72 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_CLIENT_LIB_LOOPS_H_ +#define XLA_CLIENT_LIB_LOOPS_H_ + +#include +#include + +#include "absl/strings/string_view.h" +#include "absl/types/span.h" +#include "xla/client/xla_builder.h" +#include "xla/client/xla_computation.h" +#include "xla/statusor.h" + +namespace xla { + +// Function that builds a loop condition. Takes as input a sequence of input +// values, and returns a boolean value representing if the condition succeeds. +typedef std::function(absl::Span, XlaBuilder*)> + WhileLoopHelperConditionFunction; + +// Function that builds a loop body. Takes as input a sequence of input values +// and returns a sequence of output values. +typedef std::function>(absl::Span, + XlaBuilder*)> + WhileLoopHelperBodyFunction; + +// Helper function for building an XLA while loop, where the values carried by +// the loop are a tuple of values, e.g., (a, b, c): +// while( +// condition: (a, b, c) -> bool, +// body: (a, b, c) -> (a, b, c) +// init: (a, b, c) +// ) +// 'name' is a descriptive name for the loop. +StatusOr> WhileLoopHelper( + const WhileLoopHelperConditionFunction& condition_function, + const WhileLoopHelperBodyFunction& body_function, + absl::Span initial_values, absl::string_view name, + XlaBuilder* builder); + +// Builds an XLA loop that repeats a computation `num_iterations` times. +// +// The body function (ForEachIndexBodyFunction) takes as input a pair of +// (current iteration number, loop-carried values), and returns an updated +// vector of the loop-carried values. +typedef std::function>( + XlaOp, absl::Span, XlaBuilder*)> + ForEachIndexBodyFunction; + +StatusOr> ForEachIndex( + int64_t num_iterations, PrimitiveType num_iterations_type, + const ForEachIndexBodyFunction& body_function, + absl::Span initial_values, absl::string_view name, + XlaBuilder* builder); + +} // namespace xla + +#endif // XLA_CLIENT_LIB_LOOPS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/math.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/math.h new file mode 100644 index 0000000000000000000000000000000000000000..9ef7a5967d7a099db9aadf0476ab6df01677cbb5 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/math.h @@ -0,0 +1,130 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_CLIENT_LIB_MATH_H_ +#define XLA_CLIENT_LIB_MATH_H_ + +#include "xla/client/xla_builder.h" + +namespace xla { + +// Determines whether operand is +/-inf or nan. +// +// Raises an error if called on integral or complex values. +XlaOp IsPosInf(XlaOp operand); +XlaOp IsNegInf(XlaOp operand); +XlaOp IsInf(XlaOp operand); +XlaOp IsNan(XlaOp operand); + +// Determines whether operand is equal to -0. +// +// Raises an error for integral or complex values. +XlaOp IsNegZero(XlaOp operand); + +// Returns the next number after 'from' in the direction of 'to' the same way +// std::nextafter(from, to) would. +XlaOp NextAfter(XlaOp from, XlaOp to); + +// Computes the square of 'operand'. +XlaOp Square(XlaOp operand); + +// Computes the reciprocal of 'operand'. +XlaOp Reciprocal(XlaOp operand); + +// Computes an approximation of the error function complement (1 - erf(x)). +XlaOp Erfc(XlaOp x); + +// Computes an approximation of the error function. +XlaOp Erf(XlaOp x); + +// Computes an approximation of the inverse of the error function. +XlaOp ErfInv(XlaOp x); + +// Computes an approximation of the lgamma function. +XlaOp Lgamma(XlaOp input); + +// Computes an approximation of the digamma function. +XlaOp Digamma(XlaOp input); + +// Computes an approximation of the incomplete gamma function. +XlaOp Igamma(XlaOp a, XlaOp x); + +// Computes an approximation of the derivative of the incomplete gamma function +// with respect to a. +XlaOp IgammaGradA(XlaOp a, XlaOp x); + +// Computes an approximation of the derivative of a sample `x` from a `Gamma(a, +// 1)` distribution with respect to a. +XlaOp RandomGammaGrad(XlaOp a, XlaOp x); + +// Computes an approximation of the complementary incomplete gamma function. +XlaOp Igammac(XlaOp a, XlaOp x); + +// Computes the Polygamma of two arguments. +XlaOp Polygamma(XlaOp n, XlaOp x); + +// Computes the Riemann zeta function of two arguments. +XlaOp Zeta(XlaOp x, XlaOp q); + +// Rounds the given number to even when the number is equidistant between two +// integers. +XlaOp RoundToEven(XlaOp x); + +// Trigonometric functions + +// Computes the arc cosine of 'x'. +XlaOp Acos(XlaOp x); + +// Computes the arc sine of 'x'. +XlaOp Asin(XlaOp x); + +// Computes the arc tangent of 'x'. +XlaOp Atan(XlaOp x); + +// Hyperbolic trigonometric functions + +// Computes the inverse hyperbolic cosine of 'x'. +XlaOp Acosh(XlaOp x); + +// Computes the inverse hyperbolic sine of 'x'. +XlaOp Asinh(XlaOp x); + +// Computes the inverse hyperbolic tangent of 'x'. +XlaOp Atanh(XlaOp x); + +// Computes the hyperbolic cosine of 'x'. +XlaOp Cosh(XlaOp x); + +// Computes the hyperbolic sine of 'x'. +XlaOp Sinh(XlaOp x); + +// Applies a complex conjugation operation if 'a' is complex and 'conjugate' +// is true, otherwise returns its argument. +xla::XlaOp MaybeConjugate(xla::XlaOp x, bool conjugate); + +// Computes the Modified Bessel function of the first kind of the zeroth order +// at x. +XlaOp BesselI0e(XlaOp x); + +// Computes the Modified Bessel function of the first kind of the first order +// at x. +XlaOp BesselI1e(XlaOp x); + +// Computes the Regularized Incomplete Beta function. +XlaOp RegularizedIncompleteBeta(XlaOp a, XlaOp b, XlaOp x); + +} // namespace xla + +#endif // XLA_CLIENT_LIB_MATH_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/matrix.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/matrix.h new file mode 100644 index 0000000000000000000000000000000000000000..bead189147d3b4d353e7b12bf0623ac8490bced5 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/matrix.h @@ -0,0 +1,157 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_CLIENT_LIB_MATRIX_H_ +#define XLA_CLIENT_LIB_MATRIX_H_ + +#include +#include +#include +#include + +#include "absl/strings/string_view.h" +#include "absl/types/span.h" +#include "xla/client/xla_builder.h" +#include "xla/statusor.h" +#include "xla/types.h" +#include "xla/xla_data.pb.h" + +namespace xla { + +// Returns an m x n matrix with 1s on the diagonal elements, zeros everywhere +// else. +XlaOp IdentityMatrix(XlaBuilder* builder, PrimitiveType type, int64_t m, + int64_t n); + +// Returns a mask where the 'diagonal'-th diagonal is true and everything else +// is false. +XlaOp GetDiagonalMask(XlaOp x, int diagonal = 0); + +// Get the diagonals of the last two dimensions. Use k>0 for diagonals above the +// main diagonal, and k<0 for diagonals below the main diagonal. +// +// If 'x' has shape [..., M, N] +// If k >= 0: then the output has shape [..., min(M, N - k)], containing the +// diagonal elements (i.e., with indices [..., i, i + k]). +// If k < 0: then the output has shape [..., min(M + k, N)], containing the +// diagonal elements (i.e., with indices [..., i - k, i]). +XlaOp GetMatrixDiagonal(XlaOp x, int k = 0); +XlaOp GetMatrixDiagonalViaGather(XlaOp x, int k = 0); + +// Places diag along the kth diagonal of target. +XlaOp SetMatrixDiagonal(XlaOp matrix, XlaOp diag, int k = 0); + +// Returns a lower-triangular mask, i.e., true below and including the +// `diagonal`-th diagonal and false above that diagonal. +XlaOp TriangleMask(XlaOp x, int diagonal); + +// Get the upper or lower triangle part of the last two dimensions +XlaOp Triangle(XlaOp x, bool lower); + +// Get the upper triangle part of the last two dimensions +XlaOp UpperTriangle(XlaOp x); + +// Get the lower triangle part of the last two dimensions +XlaOp LowerTriangle(XlaOp x); + +// If x is an array of shape [..., n, n], symmetrizes the matrix by replacing +// the upper triangle with the transpose of the lower triangle (if lower is +// True, vice-versa otherwise). If the type of `x` is complex, makes the matrix +// Hermitian by taking the conjugate of the complex part and setting the +// complex diagonal to zero. +XlaOp Symmetrize(XlaOp x, bool lower); + +// Multiplies slices of two tensors in batches. + +// Multiplies all slices of `Tensor` `x` and `y` (each slice can be +// viewed as an element of a batch), and arranges the individual results +// in a single output tensor of the same batch size. +// +// The input tensors `x` and `y` are 2-D or higher with shape `[..., r_x, c_x]` +// and `[..., r_y, c_y]`. +// +// The output tensor is 2-D or higher with shape `[..., r_o, c_o]`, where: +// +// r_o = c_x if transpose_x else r_x +// c_o = r_y if transpose_y else c_y +// +// It is computed as: +// +// output[..., :, :] = matrix(x[..., :, :]) * matrix(y[..., :, :]) +xla::XlaOp BatchDot( + xla::XlaOp x, xla::XlaOp y, + xla::PrecisionConfig::Precision precision = xla::PrecisionConfig::DEFAULT, + std::optional preferred_element_type = std::nullopt); +xla::XlaOp BatchDot( + xla::XlaOp x, bool transpose_x, xla::XlaOp y, bool transpose_y, + xla::PrecisionConfig::Precision precision = xla::PrecisionConfig::DEFAULT, + std::optional preferred_element_type = std::nullopt); + +// Parse an einsum string into dimension numbers: +// "ab,cb->ac" +// becomes: +// {{0, 1},{2, 1},{0, 2}} +// +// Each occurrence of ellipsis ("...") occurring in the input is replaced with +// the same numeric dimensions. The number of such dimensions is inferred from +// x_rank and y_rank. For example: +// einsum_config: "...ab,...bcd->...acd" +// x_rank: 4 +// y_rank: 5 +// becomes: +// {{0, 1, 2, 3},{0, 1, 3, 4, 5},{0, 1, 2, 4, 5}} +// +// NOTE: This function is meant for testing, there is no need to call it +// directly. + +StatusOr, 3>> ParseEinsumString( + absl::string_view einsum_config, int64_t x_rank, int64_t y_rank); + +// If an einsum config does not contain an -> one will be added and the output +// config will be the sorted characters with any ellipsis at the beginning. +// Returns an empty string if the einsum string already has an ->. +std::string NormalizeEinsumString(absl::string_view einsum_config); + +// Supports two operand einsum notation like "ab,cb->ac". +xla::XlaOp Einsum( + xla::XlaOp x, xla::XlaOp y, absl::string_view einsum_config, + xla::PrecisionConfig::Precision precision = xla::PrecisionConfig::DEFAULT, + std::optional preferred_element_type = std::nullopt); +xla::XlaOp Einsum( + xla::XlaOp x, absl::string_view einsum_config, + xla::PrecisionConfig::Precision precision = xla::PrecisionConfig::DEFAULT); + + +// Same as above but supporting numeric labels on dimensions. So "ab,cb->ac" +// becomes: +// x_config = {0, 1} +// y_config = {2, 1} +// output_config = {0, 2} +xla::XlaOp Einsum( + xla::XlaOp x, absl::Span x_config, xla::XlaOp y, + absl::Span y_config, absl::Span output_config, + xla::PrecisionConfig::Precision precision = xla::PrecisionConfig::DEFAULT, + std::optional preferred_element_type = std::nullopt); + +// Transposes a stack of matrices `x` by swapping the last two dimensions. +xla::XlaOp TransposeInMinorDims(xla::XlaOp x); + +// Transposes `x` in its minor dimensions if `transpose` is true, otherwise +// returns `x` unchanged. +xla::XlaOp MaybeTransposeInMinorDims(xla::XlaOp x, bool transpose); + +} // namespace xla + +#endif // XLA_CLIENT_LIB_MATRIX_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/pooling.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/pooling.h new file mode 100644 index 0000000000000000000000000000000000000000..d8f0ff0a91654654a082f0676fba3b58657bc32e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/pooling.h @@ -0,0 +1,81 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_CLIENT_LIB_POOLING_H_ +#define XLA_CLIENT_LIB_POOLING_H_ + +#include +#include + +#include "absl/container/inlined_vector.h" +#include "xla/client/xla_builder.h" + +namespace xla { + +// Tensor format for reduce window operations. +class TensorFormat { + public: + TensorFormat(int batch_dimension, int feature_dimension, + absl::Span spatial_dimensions) + : batch_dimension_(batch_dimension), + feature_dimension_(feature_dimension), + spatial_dimensions_(spatial_dimensions.begin(), + spatial_dimensions.end()) {} + + int batch_dimension() const { return batch_dimension_; } + + int feature_dimension() const { return feature_dimension_; } + + int spatial_dimension(int dim) const { return spatial_dimensions_[dim]; } + + int num_spatial_dims() const { return spatial_dimensions_.size(); } + + private: + // The number of the dimension that represents the batch. + int batch_dimension_; + // The number of the dimension that represents the features. + int feature_dimension_; + // The dimension numbers for the spatial dimensions. + absl::InlinedVector spatial_dimensions_; +}; + +// Computes the max pool of 'operand'. +XlaOp MaxPool(XlaOp operand, absl::Span kernel_size, + absl::Span stride, Padding padding, + const TensorFormat& data_format); + +// Computes the average pool of 'operand'. +XlaOp AvgPool(XlaOp operand, absl::Span kernel_size, + absl::Span stride, + absl::Span> padding, + const TensorFormat& data_format, bool counts_include_padding); + +// Returns the list of low and high padding elements in each spatial dimension +// for the given 'padding' specification. +std::vector> MakeSpatialPadding( + absl::Span input_size, absl::Span kernel_size, + absl::Span stride, Padding padding, + const TensorFormat& data_format); + +// Computes the average pool gradient. +XlaOp AvgPoolGrad(XlaOp out_backprop, absl::Span gradients_size, + absl::Span kernel_size, + absl::Span stride, + absl::Span> spatial_padding, + const TensorFormat& data_format, bool counts_include_padding); + +} // namespace xla + +#endif // XLA_CLIENT_LIB_POOLING_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/prng.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/prng.h new file mode 100644 index 0000000000000000000000000000000000000000..77d931ef074ad62e00d6999a8f1382a57da208a2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/prng.h @@ -0,0 +1,99 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_CLIENT_LIB_PRNG_H_ +#define XLA_CLIENT_LIB_PRNG_H_ + +#include +#include +#include + +#include "xla/client/xla_builder.h" +#include "xla/xla_data.pb.h" + +namespace xla { + +// Records the bits and state generated by a random number generator. +struct RngOutput { + XlaOp value; + XlaOp state; +}; + +// A BitGenerator returns random bits and updated random bit generator state. +// +// key: is a value input to a random number generator that can affect the +// sequence of number it will generate. A random number generator constructs +// its seed using the key and the initial state. The tf2xla bridge passes the +// seed operand of a tensorflow random operation as a key to the random bit +// generator, for example. +// initial_state: initial_state is the initial state of the current random +// number generation. It could be 0 for a stateless random operation, and +// the returned state from a previous execution for a stateful random +// operation. +// shape: the shape of the random bits. +using BitGeneratorTy = std::function; + +// Implements the ThreeFry counter-based PRNG algorithm. +// Salmon et al. SC 2011. Parallel random numbers: as easy as 1, 2, 3. +// http://www.thesalmons.org/john/random123/papers/random123sc11.pdf +RngOutput ThreeFryBitGenerator(XlaOp key, XlaOp initial_state, + const xla::Shape& shape); + +// Implements the Philox algorithm to generate random numbers in parallel. +// Salmon et al. SC 2011. Parallel random numbers: as easy as 1, 2, 3. +// http://www.thesalmons.org/john/random123/papers/random123sc11.pdf +// +// The paper presents a few variants of the Philox algorithm, we picked the +// 4x32_10 version of the algorithm for the following reasons: +// . 4x32 uses 32-bit multiplication which is fast on GPUs. +// . The authors recommend the 10-round variant, and TensorFlow also uses it. +RngOutput PhiloxBitGenerator(XlaOp key, XlaOp initial_state, + const Shape& shape); +// Returns a scrambled pair of (state, key) from a single key. +std::pair ScramblePhiloxKey(XlaOp key); + +// Uses the given bit generator to generate random bits and then converts the +// random bits to random numbers of uniform distribution in the given range. +// Returns the random numbers and the state of the random number generator. +// This function is for shape with floating point element types. +RngOutput UniformFloatingPointDistribution(XlaOp key, XlaOp initial_state, + BitGeneratorTy bit_generator, + XlaOp minval, XlaOp maxval, + const xla::Shape& shape); + +// Similar to UniformFloatingPointDistribution but for shape with integer +// element types. +RngOutput UniformIntDistribution(XlaOp key, XlaOp initial_state, + BitGeneratorTy bit_generator, XlaOp minval, + XlaOp maxval, const xla::Shape& shape); + +// Uses the given bit generator to generate random bits and then converts the +// random bits to random numbers of normal distribution. +// Returns the random numbers and the state of the random number generator. +RngOutput NormalFloatingPointDistribution(XlaOp key, XlaOp initial_state, + BitGeneratorTy bit_generator, + const xla::Shape& shape); + +// Concatenates scalars into a vector. +xla::XlaOp ConcatScalars(xla::XlaBuilder* builder, + absl::Span scalars); + +// Increases Philox counter (an uint128_t) by a delta (an uint64_t). +xla::XlaOp PhiloxIncreaseCounter(xla::XlaOp counter, xla::XlaOp delta); + +} // namespace xla + +#endif // XLA_CLIENT_LIB_PRNG_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/qr.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/qr.h new file mode 100644 index 0000000000000000000000000000000000000000..6d8a102b28fc196993969edad6565652cc41fc24 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/qr.h @@ -0,0 +1,52 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_CLIENT_LIB_QR_H_ +#define XLA_CLIENT_LIB_QR_H_ + +#include "xla/client/xla_builder.h" +#include "xla/xla_data.pb.h" + +namespace xla { + +// Computes the QR decompositions of a batch of matrices. That is, +// given a (batched) matrix a, computes an orthonormal matrix Q and an +// upper-triangular matrix R such that a = QR. +// `a` must be a (batched) matrix of size [..., m, n]. +struct QrDecomposition { + // A matrix with the same shape as the input matrix `a`, whose upper triangle + // (inclusive of the diagonal) is the matrix R, and whose lower triangle + // (exclusive of the diagonal) contains the elementary Householder reflectors. + // This is the same output format as used by LAPACK's xGEQRF routine. + XlaOp q_and_r; + // A vector of shape [..., min(m, n)] containing the scalar factors of the + // elementary Householder reflectors. + XlaOp taus; +}; + +QrDecomposition Qr(XlaOp a); + +// Given `a` and `taus` as returned by `QRDecomposition`, compute the product of +// the elementary Householder reflectors (i.e., the matrix Q of the QR +// decomposition). The equivalent LAPACK routine is xORGQR/xUNGQR. +XlaOp ProductOfElementaryHouseholderReflectors(XlaOp a, XlaOp taus); + +// Helper that combines `Qr` and `ProductOfElementaryHouseholderReflectors` to +// compute explicit matrices `q` and `r`. +void QrExplicit(XlaOp a, bool full_matrices, XlaOp& q, XlaOp& r); + +} // namespace xla + +#endif // XLA_CLIENT_LIB_QR_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/quantize.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/quantize.h new file mode 100644 index 0000000000000000000000000000000000000000..a510651e1e640eb0c07ac6dd02c9d52feb5c1ade --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/quantize.h @@ -0,0 +1,184 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_CLIENT_LIB_QUANTIZE_H_ +#define XLA_CLIENT_LIB_QUANTIZE_H_ + +#include +#include +#include +#include + +#include "xla/client/lib/constants.h" +#include "xla/client/xla_builder.h" +#include "xla/types.h" +#include "xla/util.h" +#include "xla/xla_data.pb.h" +#include "tsl/platform/bfloat16.h" + +namespace xla { + +// Represents the range used for quantization +struct QuantizedRange { + QuantizedRange() = default; + QuantizedRange(float min_in, float max_in) : min(min_in), max(max_in) {} + + bool operator==(const QuantizedRange& rhs) const { + return this->min == rhs.min && this->max == rhs.max; + } + + bool operator!=(const QuantizedRange& rhs) const { return !(*this == rhs); } + + tsl::bfloat16 min = tsl::bfloat16(0.0f); + tsl::bfloat16 max = tsl::bfloat16(0.0f); +}; + +template +inline std::vector PackToUint32(absl::Span input) { + const int64_t kElementsPerPack = sizeof(uint32_t) / sizeof(T); + const int64_t input_size = input.size(); + const int64_t output_size = CeilOfRatio(input_size, kElementsPerPack); + + std::vector output_vec; + constexpr int64_t kShiftBits = sizeof(T) / sizeof(uint8_t) * CHAR_BIT; + + for (int64_t i = 0; i < output_size; i++) { + uint32_t result = 0; + for (int64_t p = 0; p < kElementsPerPack; p++) { + int64_t index = i * kElementsPerPack + p; + if (index < input_size) { + int64_t total_shift_bits = kShiftBits * (kElementsPerPack - p - 1); + result |= (input[index] << total_shift_bits); + } + } + output_vec.push_back(result); + } + + return output_vec; +} + +// Dequantize the quantized input of packed uint32_t to bfloat16. +// Only uint8_t or uint16_t is supported for the original unpacked input. +// Returns a tensor of shape [d0,..., dn * unpack_size] if +// input shape is [d0, ..., dn], where unpack_size = sizeof(unit32) / sizeof(T). +// If transpose_output is true, will return a tensor of shape +// [dn * unpack_size, dn-1, ..., d1, d0]. transpose_output is faster when +// input's rank higher than 1. The input needs to be transposed to use +// transpose_output feature. +template +inline XlaOp Dequantize(XlaOp input, const QuantizedRange& range, + absl::string_view mode_string = "MIN_COMBINED", + bool transpose_output = false) { + XlaBuilder* const builder = input.builder(); + return builder->ReportErrorOrReturn([&]() -> StatusOr { + float half_range = + !std::is_signed::value + ? 0.0f + : (static_cast(std::numeric_limits::max()) - + std::numeric_limits::min() + 1) / + 2.0f; + const int64_t unpack_size = sizeof(uint32_t) / sizeof(T); + TF_ASSIGN_OR_RETURN(Shape shape, builder->GetShape(input)); + + auto element_type = shape.element_type(); + if (element_type != U32) { + return InvalidArgument( + "Only U32 is supported for input type of xla::Dequantize Op."); + } + + // Broadcast the input to [unpack_size, d0, ..., dn] if input size is + // [d0, ..., dn]. + auto broadcast_input = Broadcast(input, {unpack_size}); + + XlaOp iota_r1 = Iota(builder, U32, unpack_size); + // Highest significant bytes needs to shift more bytes than lower + // significant bytes. + XlaOp shift_bytes = + xla::ConstantR0(builder, unpack_size - 1) - iota_r1; + + const int bytes_of_type = sizeof(T) / sizeof(uint8_t); + std::vector shift_vec(unpack_size, CHAR_BIT * bytes_of_type); + XlaOp shift_bits = + shift_bytes * xla::ConstantR1(builder, shift_vec); + + // Make bit_mask for different data type T. + uint32_t bit_mask = 0x00000000; + for (int i = 0; i < bytes_of_type; i++) { + bit_mask <<= CHAR_BIT; + bit_mask |= 0x000000ff; + } + + std::vector shift_transpose_dimensions(shape.dimensions_size()); + std::iota(shift_transpose_dimensions.begin(), + shift_transpose_dimensions.end(), 0); + shift_transpose_dimensions.insert(shift_transpose_dimensions.begin(), 1, + shape.dimensions_size()); + + // Shift the input by sizeof(T) bytes and apply bit_mask to unpack. + XlaOp shifted_input = ShiftRightLogical( + broadcast_input, Transpose(Broadcast(shift_bits, shape.dimensions()), + shift_transpose_dimensions)); + XlaOp unpack_input = + And(shifted_input, xla::ConstantR0(builder, bit_mask)); + + XlaOp result; + + if (mode_string == "MIN_COMBINED") { + const tsl::bfloat16 scale_factor = + (range.max - range.min) / + (static_cast(std::numeric_limits::max() - + std::numeric_limits::min())); + // result = bfloat16(input + half_range) * scale_factor + range.min + XlaOp unpack_input_bf16 = ConvertElementType(unpack_input, BF16); + XlaOp half_range_bf16 = xla::ConstantR0( + builder, static_cast(half_range)); + XlaOp sum = unpack_input_bf16 + half_range_bf16; + + result = sum * xla::ConstantR0(builder, scale_factor) + + xla::ConstantR0(builder, range.min); + } else { + // TODO(wangtao): support other modes. + return InvalidArgument( + "Only MIN_COMBINED mode is supported in xla::Dequantize Op."); + } + + std::vector transpose_dimensions(shape.dimensions_size()); + std::iota(transpose_dimensions.begin(), transpose_dimensions.end(), 1); + std::reverse(transpose_dimensions.begin(), transpose_dimensions.end()); + transpose_dimensions.insert(transpose_dimensions.begin() + 1, 1, 0); + + // Transpose the result to be [dn, unpack_size, dn-1, ..., d1, d0]. + XlaOp transposed_result = Transpose(result, transpose_dimensions); + + // Reshape to be [dn * unpack_size, dn-1, ..., d1, d0]. + XlaOp reshaped_result = Collapse(transposed_result, {0, 1}); + + // Return the transpose result if transpose_output is true. + if (transpose_output) { + return reshaped_result; + } + + // Transpose the result to be [d0, d1, ..., dn-1, dn * unpack_size]. + std::vector result_dimensions(shape.dimensions_size()); + std::iota(result_dimensions.begin(), result_dimensions.end(), 0); + std::reverse(result_dimensions.begin(), result_dimensions.end()); + + return Transpose(reshaped_result, result_dimensions); + }); +} + +} // namespace xla + +#endif // XLA_CLIENT_LIB_QUANTIZE_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/self_adjoint_eig.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/self_adjoint_eig.h new file mode 100644 index 0000000000000000000000000000000000000000..c21163dff056b9166e4d24b1c2c79149f4246583 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/self_adjoint_eig.h @@ -0,0 +1,41 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_CLIENT_LIB_SELF_ADJOINT_EIG_H_ +#define XLA_CLIENT_LIB_SELF_ADJOINT_EIG_H_ + +#include "xla/client/xla_builder.h" +#include "xla/xla_data.pb.h" + +namespace xla { + +// The eigenvalue decomposition of a symmetric matrix, the original matrix is +// recovered by v * w * v_t. +struct SelfAdjointEigResult { + // The i-th column is the normalized eigenvector corresponding to the + // eigenvalue w[i]. Will return a matrix object if a is a matrix object. + XlaOp v; + // The eigenvalues in ascending order, each repeated according to its + // multiplicity. + XlaOp w; +}; + +SelfAdjointEigResult SelfAdjointEig(XlaOp a, bool lower = true, + int64_t max_iter = 15, float tol = 1e-5, + bool sort_eigenvalues = true); + +} // namespace xla + +#endif // XLA_CLIENT_LIB_SELF_ADJOINT_EIG_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/slicing.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/slicing.h new file mode 100644 index 0000000000000000000000000000000000000000..b0b955c0234201feebd6b21d130dc9a0d3f4c6ae --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/slicing.h @@ -0,0 +1,90 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#include + +#include "absl/types/span.h" +#include "xla/client/xla_builder.h" +#include "xla/types.h" + +#ifndef XLA_CLIENT_LIB_SLICING_H_ +#define XLA_CLIENT_LIB_SLICING_H_ + +namespace xla { + +// Slices input starting from the base_indices and within the window_sizes, +// using the supplied strides. This is the equivalent of the Python slicing op +// [base_indices : base_indices+window_sizes : stride]. +XlaOp DynamicStridedSlice(XlaOp input, absl::Span base_indices, + absl::Span window_sizes, + absl::Span strides); + +// Updates a slice of 'x', i.e., +// x[start[0], ..., start[n]] = update +XlaOp UpdateSlice(XlaOp x, XlaOp update, absl::Span start); + +// Performs a slice in the minor dimensions of a tensor. +// x[..., start[0]:end[0], ..., start[n]:end[n]] +XlaOp SliceInMinorDims(XlaOp x, absl::Span start, + absl::Span end); + +// Updates a slice of 'x', where 'start' contains a list of minor dimensions: +// x[..., start[0]:..., ..., start[n]:...] = update +XlaOp UpdateSliceInMinorDims(XlaOp x, XlaOp update, + absl::Span start); + +// Performs a dynamic slice in the minor dimensions of a tensor. +XlaOp DynamicSliceInMinorDims(XlaOp x, absl::Span starts, + absl::Span sizes); + +XlaOp DynamicUpdateSliceInMinorDims(XlaOp x, XlaOp update, + absl::Span starts); + +// Gathers values along an axis specified by dim. +// +// For a 3-D tensor the output is specified by: +// +// out[i][j][k] = input[index[i][j][k]][j][k] # if dim == 0 +// out[i][j][k] = input[i][index[i][j][k]][k] # if dim == 1 +// out[i][j][k] = input[i][j][index[i][j][k]] # if dim == 2 +// +// If `input` is an n-dimensional tensor with size +// [X0,X1,X2,..XN] and dim = i `index` must be an n-dimensional tensor with size +// [X0,X1,...Y,Xi+1,...,X[N] where y >= 1 and `out` will have the same sizes as +// `index`. +XlaOp TorchGather(XlaOp input, XlaOp index, int64_t dim, bool sparse = true); + +// idx = index[i][j][k] +// output[idx][j][k] = combiner(input[idx][j][k], src[i][j][k]) # if dim == 0 +// output[i][idx][k] = combiner(input[i][idx][k], src[i][j][k]) # if dim == 1 +// output[i][j][idx] = combiner(input[i][j][idx], src[i][j][k]) # if dim == 2 +XlaOp TorchScatterDense(XlaOp input, XlaOp index, XlaOp src, int64_t dim, + const std::function& combiner); + +// Returns a new tensor which indexes the input tensor along dimension dim using +// the entries in index. +// +// The returned tensor has the same number of dimensions as the original tensor +// (input). The dimth dimension has the same size as the length of index; other +// dimensions have the same size as in the original tensor. +// +// This operation supports 0 or more major batch dimensions that act like a +// multidimensional loop over both the input and the index. +XlaOp TorchIndexSelect(XlaOp input, XlaOp index, int64_t dim, + int64_t batch_dims = 0); + +} // namespace xla + +#endif // XLA_CLIENT_LIB_SLICING_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/sorting.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/sorting.h new file mode 100644 index 0000000000000000000000000000000000000000..03b317037df4888111121b1856a2aabb1a403166 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/sorting.h @@ -0,0 +1,38 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_CLIENT_LIB_SORTING_H_ +#define XLA_CLIENT_LIB_SORTING_H_ + +#include "xla/client/xla_builder.h" +#include "xla/types.h" +#include "xla/xla_data.pb.h" + +namespace xla { + +// Returns a tuple composed of the top `k` values and corresponding indices in +// `input`. Output values are in descending order, from largest to smallest. +XlaOp TopK(XlaOp input, int64_t k, + PrimitiveType index_type = PrimitiveType::S32); + +// Split sort in TopK into smaller sorts. +// Returns a tuple composed of the top `k` values and corresponding indices in +// `input`. Output values are in descending order, from largest to smallest. +XlaOp TopKWithPartitions(XlaOp input, int64_t k, int64_t num_partitions = 1, + PrimitiveType index_type = PrimitiveType::S32); + +} // namespace xla + +#endif // XLA_CLIENT_LIB_SORTING_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/svd.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/svd.h new file mode 100644 index 0000000000000000000000000000000000000000..177d84f3153d867ee0cc0432ffa63dc7c5ccd5d4 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/svd.h @@ -0,0 +1,49 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_CLIENT_LIB_SVD_H_ +#define XLA_CLIENT_LIB_SVD_H_ + +#include "xla/client/xla_builder.h" +#include "xla/xla_data.pb.h" + +namespace xla { + +// The singular value decomposition of a given matrix A[..., M, N], the original +// matrix is recovered by u * diag(d) * v_t, where the first dims(A) - 2 +// dimensions are batch dimensions. +struct SVDResult { + // The columns of U are the left-singular vectors, e.g., + // U[..., :, :]_T * U[..., :, :] = I. + XlaOp u; + // Vector(s) with the singular values, within each vector sorted in descending + // order. The first dims(D) - 1 dimensions have the same size as the batch + // dimensions of A. And U[..., :, i] * D[..., i] = A[..., :, :] * V[..., :, + // i]. + XlaOp d; + // The columns of V are the right-singular vectors. e.g., + // V[..., :, :]_T * V[..., :, :] = I. + XlaOp v; +}; + +// TODO(kuny): Add a bool flag that supports SVD with economy (reduced) +// representation, which is more memory efficient, especially in the case of +// tall-skinny matrices. +SVDResult SVD(XlaOp a, int64_t max_iter = 100, float epsilon = 1e-6, + PrecisionConfig::Precision precision = PrecisionConfig::HIGHEST); + +} // namespace xla + +#endif // XLA_CLIENT_LIB_SVD_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/tridiagonal.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/tridiagonal.h new file mode 100644 index 0000000000000000000000000000000000000000..f458a1934711d1764102e6dd9c1efd51649b70c8 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/tridiagonal.h @@ -0,0 +1,40 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_CLIENT_LIB_TRIDIAGONAL_H_ +#define XLA_CLIENT_LIB_TRIDIAGONAL_H_ + +#include "xla/client/xla_builder.h" +#include "xla/xla_data.pb.h" + +namespace xla { +namespace tridiagonal { + +enum SolverAlgorithm { kThomas }; + +StatusOr TridiagonalSolver(SolverAlgorithm algo, XlaOp lower_diagonal, + XlaOp main_diagonal, XlaOp upper_diagonal, + XlaOp rhs); + +StatusOr TridiagonalSolver(SolverAlgorithm algo, XlaOp diagonals, + XlaOp rhs); + +StatusOr TridiagonalMatMul(XlaOp upper_diagonal, XlaOp main_diagonal, + XlaOp lower_diagonal, XlaOp rhs); + +} // namespace tridiagonal +} // namespace xla + +#endif // XLA_CLIENT_LIB_TRIDIAGONAL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/tuple.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/tuple.h new file mode 100644 index 0000000000000000000000000000000000000000..59cbb24f5353b90e4cd9f6b298179de3ae8f0612 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/lib/tuple.h @@ -0,0 +1,36 @@ +/* Copyright 2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_CLIENT_LIB_TUPLE_H_ +#define XLA_CLIENT_LIB_TUPLE_H_ + +#include "xla/client/xla_builder.h" +#include "xla/shape_tree.h" +#include "xla/statusor.h" + +namespace xla { + +// Returns a ShapeTree where each index is a GetTupleElement instruction for +// that subshape of the tuple. The root index is the original argument. +StatusOr> DisassembleTuple(XlaOp tuple); + +// Assembles a tuple from a ShapeTree that contains the leaves of the tuple. +// Non-leaf elements of the ShapeTree are ignored. DisassembleTuple and +// AssembleTuple are essentially inverse operations. +XlaOp AssembleTuple(XlaBuilder* builder, ShapeTree elements); + +} // namespace xla + +#endif // XLA_CLIENT_LIB_TUPLE_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/local_client.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/local_client.h new file mode 100644 index 0000000000000000000000000000000000000000..f14b98581a9fb257a5744c8f255c1106f743410b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/local_client.h @@ -0,0 +1,236 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_CLIENT_LOCAL_CLIENT_H_ +#define XLA_CLIENT_LOCAL_CLIENT_H_ + +#include +#include +#include +#include + +#include "absl/types/span.h" +#include "xla/client/client.h" +#include "xla/client/executable_build_options.h" +#include "xla/client/xla_computation.h" +#include "xla/executable_run_options.h" +#include "xla/service/compiler.h" +#include "xla/service/executable.h" +#include "xla/service/hlo.pb.h" +#include "xla/service/local_service.h" +#include "xla/service/maybe_owning_device_memory.h" +#include "xla/service/shaped_buffer.h" +#include "xla/shape_tree.h" +#include "xla/statusor.h" +#include "xla/stream_executor/device_memory_allocator.h" +#include "xla/stream_executor/stream_executor.h" +#include "xla/xla_data.pb.h" + +namespace xla { + +class LocalExecutable { + public: + // Low-level constructor; LocalClient::Compile() is the usual way to create + // executables. + LocalExecutable(std::unique_ptr executable, Backend* backend, + ExecutableBuildOptions build_options); + + // Run the compiled computation with the given arguments and options and + // return the result. + StatusOr Run( + absl::Span arguments, + ExecutableRunOptions run_options); + + // Similar to Run(), but allows for donating argument buffers to the + // executable. + StatusOr Run(std::vector arguments, + ExecutableRunOptions run_options); + + // Similar to Run(), but need not block the host waiting for the computation + // to complete before returning. + StatusOr RunAsync( + absl::Span arguments, + ExecutableRunOptions run_options); + + // Similar to RunAsync(), but allows for donating argument buffers to the + // executable. + StatusOr RunAsync(std::vector arguments, + ExecutableRunOptions run_options); + + // Return the options used to build the executable. + const ExecutableBuildOptions& build_options() const { return build_options_; } + + // Return the built executable. + Executable* executable() const { return executable_.get(); } + + private: + StatusOr RunAsync( + absl::Span argument_host_shapes, + std::vector arguments, ExecutableRunOptions run_options); + + // Validates that the given arguments and options satisfy various constraints + // of the computation. + // + // The given ExecutableRunOptions override any values from TF_XLA_FLAGS + // environment variable. + Status ValidateExecutionOptions(const ExecutableRunOptions& run_options, + const Backend& backend); + + // Returns a literal containing the contents of the given ShapedBuffer. + StatusOr LiteralFromShapedBuffer(const ShapedBuffer& shaped_buffer); + + StatusOr> RunHelper( + absl::Span argument_shapes, + ExecutableRunOptions run_options); + + // The ordinal of the device which this executable was compiled for. The + // executable can run on all equivalent devices (as determined by + // Backend::devices_equivalent). + int build_device_ordinal() const { return build_options_.device_ordinal(); } + + template + StatusOr AsyncCallAndBlockHostUntilDone( + absl::Span argument_shapes, + const ExecutableRunOptions& run_options, + std::function(const ExecutableRunOptions&)> async_callback) { + TF_ASSIGN_OR_RETURN(auto options_and_stream, + RunHelper(argument_shapes, run_options)); + ExecutableRunOptions options = options_and_stream.first.run_options(); + options.set_device_ordinal(-1); + StatusOr result = async_callback(options); + Status block_status = options.stream()->BlockHostUntilDone(); + TF_RETURN_IF_ERROR(result.status()); + TF_RETURN_IF_ERROR(block_status); + return result; + } + + // Compiled computation. + std::unique_ptr executable_; + + // Execution backend. + Backend* backend_ = nullptr; + + // Options used to build the executable. + const ExecutableBuildOptions build_options_; +}; + +// An XLA Client specialization for use when the client and service run in +// the same process. +class LocalClient : public Client { + public: + explicit LocalClient(LocalService* service) + : Client(service), local_service_(service) {} + + LocalClient(const LocalClient&) = delete; + void operator=(const LocalClient&) = delete; + + // Build and return LocalExecutable objects (one per partition, as specified + // by the build options). The executable is compiled using the given + // XlaComputation, argument layouts and options. + // + // The given ExecutableBuildOptions overrides any values from XLA_FLAGS + // environment variable. + StatusOr>> Compile( + const XlaComputation& computation, + absl::Span argument_layouts, + const ExecutableBuildOptions& options); + + // Same as Compile() above, but return AotCompilationResult objects (instead + // of LocalExecutable objects), which can be persisted to later load + // LocalExecutable(s) using the Load() method below. + StatusOr>> + CompileAheadOfTime(const XlaComputation& computation, + absl::Span argument_layouts, + const ExecutableBuildOptions& options); + + // Return a LocalExecutable object loaded from a serialized + // AotCompilationResult. + StatusOr> Load( + const std::string& serialized_aot_result, + const ExecutableBuildOptions& options); + + // Copy the literal data to the device with the given ordinal and return as a + // ScopedShapedBuffer. If non-null the given memory allocator is used for + // device memory allocation. If null, the default memory allocator for the + // device is used. + StatusOr LiteralToShapedBuffer( + const LiteralSlice& literal, int device_ordinal, + se::DeviceMemoryAllocator* allocator = nullptr); + + // Transfer the BorrowingLiteral to the device with the given ordinal. + StatusOr TransferToLocalServer( + const ::xla::BorrowingLiteral& literal, int device_ordinal); + + // Copy the data from the device contained in the given ShapedBuffer and + // return as a Literal. + StatusOr ShapedBufferToLiteral(const ShapedBuffer& shaped_buffer); + + // Converts a GlobalDataHandle into a pointer to a ShapedBuffer that's valid + // as long as the handle is valid. + StatusOr GlobalDataToShapedBuffer( + const GlobalDataHandle& data, int replica_number); + + // Transfer the given literal to the infeed queue of the given device. + // TODO(b/69670845): Remove the 'Local' from the name when LocalClient does + // not inherit from Client and there is no possibility of confusion with + // Client::TransferToInfeed. + Status TransferToInfeedLocal(const LiteralSlice& literal, int device_ordinal); + + // Transfer and return a value from the outfeed of the given device. The + // shape of the object to transfer is determined by `literal`'s shape. + // TODO(b/69670845): Remove the 'Local' from the name when LocalClient does + // not inherit from Client and there is no possibility of confusion with + // Client::TransferFromOutfeed. + Status TransferFromOutfeedLocal(int device_ordinal, + MutableBorrowingLiteral literal); + + // Returns the device ordinal that corresponds to the given replica number. + // + // This returns an error if there is not a one-to-one correspondence of + // replicas to device ordinals, but is useful as a short term mechanism for + // the "easy" case where a single replica is a single device. + StatusOr ReplicaNumberToDeviceOrdinal(int replica_number); + + // Returns the platform that the underlying service targets. + se::Platform* platform() const; + + // Returns the number of devices on the system of the service platform + // type. Not all devices may be supported by the service (see + // device_ordinal_supported method). + int device_count() const; + + // Returns the default device ordinal that the service will run computations + // on if no device ordinal is specified in execute options. + int default_device_ordinal() const; + + // Returns whether the device with the given ordinal can be used by the + // service to execute computations. Not all devices of a particular platform + // may be usable by the service (eg, a GPU with insufficient CUDA compute + // capability). + bool device_ordinal_supported(int device_ordinal) const; + + // Returns the backend used to execute computations. + const Backend& backend() const; + Backend* mutable_backend(); + + LocalService* local_service() { return local_service_; } + + private: + LocalService* local_service_; +}; + +} // namespace xla + +#endif // XLA_CLIENT_LOCAL_CLIENT_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/padding.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/padding.h new file mode 100644 index 0000000000000000000000000000000000000000..38a55c3a5816deaa3210da9979d7166dc94a800a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/padding.h @@ -0,0 +1,66 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_CLIENT_PADDING_H_ +#define XLA_CLIENT_PADDING_H_ + +#include +#include + +#include "absl/types/span.h" +#include "xla/statusor.h" +#include "xla/types.h" + +namespace xla { + +// Describes the padding applied for a windowed operation like +// convolution, where a window is placed inside a base area. +enum class Padding { + // Make the output have the same dimensions as the base area. For + // example, for a 3x3 base area and a 2x2 window, the output will be + // 3x3, so that requires padding the 3x3 base area to 4x4. + kSame, + + // Use no padding. For example, for a 4x4 base area and a 2x2 + // window, the output will be 3x3. + kValid, +}; + +// Validates that the slices are acceptable for determining padding -- this can +// be used to check the preconditions of MakePadding below to produce an error +// message that can be returned to the user. +Status ValidatePaddingValues(absl::Span input_dimensions, + absl::Span window_dimensions, + absl::Span window_strides); + +// Returns the padding needed for the base area, given the base area dimensions, +// window dimensions, strides, and the type of padding. +// +// If v is the returned vector, then for each dimension number i, +// v[i].first is the padding to the left (i.e. in the direction of +// lower indices) and v[i].second is the padding to the right (i.e. in +// the direction of higher indices). +// +// Precondition: The number of dimensions (i.e., rank) in input_dimensions, +// window_dimensions, and strides must match, which is equal to the number +// of elements in the result vector. +std::vector> MakePadding( + absl::Span input_dimensions, + absl::Span window_dimensions, + absl::Span window_strides, Padding padding); + +} // namespace xla + +#endif // XLA_CLIENT_PADDING_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/sharding_builder.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/sharding_builder.h new file mode 100644 index 0000000000000000000000000000000000000000..b4f2424458df52c01239a145e4777e3e43440aec --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/sharding_builder.h @@ -0,0 +1,62 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_CLIENT_SHARDING_BUILDER_H_ +#define XLA_CLIENT_SHARDING_BUILDER_H_ + +#include + +#include "xla/array.h" +#include "xla/shape_tree.h" +#include "xla/shape_util.h" +#include "xla/types.h" +#include "xla/util.h" +#include "xla/xla_data.pb.h" + +namespace xla { +namespace sharding_builder { +// A shaped array used to describe the assignment of tiles to devices. +using TileAssignment = Array; + +// Creates a replicated sharding - replicate a tensor on every device. +OpSharding Replicate(); + +// Creates a manual sharding - the partitioner will not change the shape. +OpSharding Manual(); + +// Creates a sharding that assigns a tensor to just one device. +OpSharding AssignDevice(int device); + +// Creates a tiled sharding with the given tile shape and assignment of tiles +// to devices. +// +// If tile_shape is not evenly divisible by the number of devices in +// tile_assignment, operations behave as if implicit padding had been inserted. +// The value of this padding is undefined. +OpSharding Tile(const Shape& tile_shape, const TileAssignment& tile_assignment); + +// Creates a sharding in one dimension, with the given tile shape which must +// be rank 1 and using devices [0..num_tiles). +// +// This is simply a convenience wrapper for Tile(). +OpSharding Tile1D(const Shape& tile_shape, int64_t num_tiles); + +// Creates a tuple sharding from the given ShapeTree of element shardings. +OpSharding Tuple(const ShapeTree& shardings); + +} // namespace sharding_builder +} // namespace xla + +#endif // XLA_CLIENT_SHARDING_BUILDER_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/value_inference.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/value_inference.h new file mode 100644 index 0000000000000000000000000000000000000000..47f9f7129ed9f47bda8cf9540be19e44a73bfd76 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/value_inference.h @@ -0,0 +1,112 @@ +/* Copyright 2021 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ +#ifndef XLA_CLIENT_VALUE_INFERENCE_H_ +#define XLA_CLIENT_VALUE_INFERENCE_H_ + +#include +#include + +#include "absl/container/flat_hash_map.h" +#include "xla/client/xla_builder.h" +#include "xla/hlo/evaluator/hlo_evaluator.h" +#include "xla/hlo/ir/dfs_hlo_visitor.h" +#include "xla/hlo/ir/hlo_computation.h" +#include "xla/hlo/ir/hlo_opcode.h" +#include "xla/literal.h" +#include "xla/literal_util.h" +#include "xla/util.h" +#include "xla/xla_data.pb.h" + +namespace xla { +// OptionalLiteral is an augmented literal class which returns optional +// values for each index (the value can be either valid or invalid). The +// implementation keeps two literals, a value literal, holding both the valid +// and garabage value, and a masking literal representing if a value is valid or +// garbage. +class OptionalLiteral { + public: + explicit OptionalLiteral(Literal value, Literal mask) + : value_(std::move(value)), mask_(std::move(mask)) {} + + template + std::optional Get(absl::Span element_index, + ShapeIndex shape_index = {}) const { + if (mask_.Get(element_index, shape_index)) { + return std::nullopt; + } else { + return value_.Get(element_index, shape_index); + } + } + + // Returns true if all values in this literal slice are value. + bool AllValid() { return mask_.IsAll(0); } + + // Get value out of this slice if all values are valid. Otherwise returns + // nullopt. + std::optional GetValue() { + if (!AllValid()) { + return std::nullopt; + } + return LiteralSlice(value_); + } + + private: + Literal value_; + Literal mask_; +}; + +enum ValueInferenceMode { + // Inference the constant value itself. + kValue = 0, + // Inference upper-bound and lower-bound of the value. Bounds are inclusive. + kUpperBound, + kLowerBound, +}; + +class ValueInference { + public: + // ValueInference analyzes values in XlaOp answers following questions: + // - What's the upper-bound of each value in a tensor. + // - What's the lower-bound of each value in a tensor. + // - What's the constant value of each tensor. + // - Whether or not each value in a tensor is dynamic. + explicit ValueInference(XlaBuilder* builder) : builder_(builder) { + CHECK(builder_); + } + StatusOr AnalyzeIsDynamic(XlaOp op); + // Returns an OptionalLiteral. Each individual value of the literal is + // the concrete constant value if it can be inferred, otherwise a nullopt. + StatusOr AnalyzeConstant(XlaOp op, ValueInferenceMode mode); + + // Returns underlying xla builder. + XlaBuilder* builder() { return builder_; } + + private: + // Given an op handle, returns a simplified version of the handle inside a + // int64_t Literal. If the a -1 value for the handle means invalid + // simplification and the result shouldn't be used. + StatusOr SimplifyOp(int64_t handle); + + // Perform CSE on a given handle, and return an equivalent handle if seen + // before. Otherwise, returns nullopt. + StatusOr> CseOpHandle(int64_t handle); + XlaBuilder* builder_; + HloEvaluator evaluator_; + // A map from instruction_hash to handle that helps perform CSE. + absl::flat_hash_map cse_map_; +}; +} // namespace xla + +#endif // XLA_CLIENT_VALUE_INFERENCE_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/xla_builder.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/xla_builder.h new file mode 100644 index 0000000000000000000000000000000000000000..00e288c6ca1ce3a1f33ce5f3426c8b25e85732d3 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/xla_builder.h @@ -0,0 +1,2932 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_CLIENT_XLA_BUILDER_H_ +#define XLA_CLIENT_XLA_BUILDER_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "absl/container/flat_hash_map.h" +#include "absl/container/flat_hash_set.h" +#include "absl/functional/function_ref.h" +#include "absl/strings/string_view.h" +#include "absl/types/span.h" +#include "xla/client/padding.h" +#include "xla/client/xla_computation.h" +#include "xla/comparison_util.h" +#include "xla/hlo/ir/dynamic_parameter_binding.h" +#include "xla/hlo/ir/hlo_input_output_alias_config.h" +#include "xla/hlo/ir/hlo_opcode.h" +#include "xla/literal.h" +#include "xla/literal_util.h" +#include "xla/service/hlo.pb.h" +#include "xla/shape_util.h" +#include "xla/statusor.h" +#include "xla/xla_data.pb.h" +#include "tsl/platform/stacktrace.h" + +namespace xla { + +class XlaBuilder; +class XlaOp; +class HloInstruction; + +namespace internal { + +struct XlaBuilderFriend { + static XlaOp BuildAddDependency(XlaBuilder* builder, XlaOp operand, + XlaOp token, const Shape& shape); + + static std::pair BuildAsyncStart( + XlaBuilder* builder, absl::Span operands, + std::string execution_thread, int64_t group_id, + const XlaComputation& called_computation, const Shape& shape); + static std::pair BuildAsyncStart( + XlaBuilder* builder, absl::Span operands, + std::string execution_thread, const XlaComputation& called_computation, + const Shape& shape); + static XlaOp BuildAsyncUpdate(XlaBuilder* builder, XlaOp operands, + std::string execution_thread, int64_t group_id, + int64_t called_computation, const Shape& shape); + static XlaOp BuildAsyncUpdate(XlaBuilder* builder, XlaOp operands, + std::string execution_thread, + int64_t called_computation, const Shape& shape); + static XlaOp BuildAsyncDone(XlaBuilder* builder, XlaOp operands, + std::string execution_thread, int64_t group_id, + int64_t called_computation, const Shape& shape); + static XlaOp BuildAsyncDone(XlaBuilder* builder, XlaOp operands, + std::string execution_thread, + int64_t called_computation, const Shape& shape); + + static XlaOp BuildAllGatherStart( + XlaBuilder* builder, XlaOp operand, int64_t all_gather_dimension, + int64_t shard_count, absl::Span replica_groups = {}, + const std::optional& channel_id = std::nullopt, + const std::optional& layout = std::nullopt, + std::optional use_global_device_ids = std::nullopt); + static XlaOp BuildAllGatherDone(XlaBuilder* builder, XlaOp operands, + const Shape& shape); + + static XlaOp BuildAllReduceStart( + XlaBuilder* builder, XlaOp operand, const XlaComputation& computation, + absl::Span replica_groups = {}, + const std::optional& channel_id = std::nullopt, + const std::optional& layout = std::nullopt, + std::optional use_global_device_ids = std::nullopt); + static XlaOp BuildAllReduceDone(XlaBuilder* builder, XlaOp operands, + const Shape& shape); + + static XlaOp BuildCollectivePermuteStart( + XlaBuilder* builder, XlaOp operand, + const std::vector>& source_target_pairs, + const std::optional& channel_id = std::nullopt); + static XlaOp BuildCollectivePermuteDone(XlaBuilder* builder, XlaOp operands, + const Shape& shape); + + static XlaOp BuildCopyStart( + XlaBuilder* builder, XlaOp operand, + std::optional cross_program_prefetch_index = std::nullopt); + static XlaOp BuildCopyDone(XlaBuilder* builder, XlaOp operand, + const Shape& shape); + + static XlaOp BuildFusion( + XlaBuilder* builder, absl::Span operands, + absl::string_view fusion_kind, const XlaComputation& fused_computation, + absl::Span>> + output_operand_aliasing = {}); + + static XlaOp BuildBitcast(XlaBuilder* builder, XlaOp operand, + const Shape& shape); + + static XlaOp BuildPartitionId(XlaBuilder* builder, const Shape& shape); + + static XlaOp BuildSend(XlaBuilder* builder, XlaOp operand, XlaOp token, + const ChannelHandle& handle, bool is_host_transfer); + static XlaOp BuildSendDone(XlaBuilder* builder, XlaOp operand, + const ChannelHandle& handle, + bool is_host_transfer); + + static XlaOp BuildRecv(XlaBuilder* builder, XlaOp token, const Shape& shape, + const ChannelHandle& handle, bool is_host_transfer); + static XlaOp BuildRecvDone(XlaBuilder* builder, XlaOp token, + const Shape& shape, const ChannelHandle& handle, + bool is_host_transfer); + + static XlaOp BuildDomain(XlaBuilder* builder, XlaOp operand, OpSharding entry, + OpSharding exit, const Shape& shape); + + static XlaOp BuildRngGetAndUpdateState(XlaBuilder* builder, int64_t delta, + const Shape& shape); + + static HloInstructionProto* GetInstruction(XlaOp op); + static HloInstructionProto* GetInstructionByHandle(XlaBuilder* builder, + int64_t handle); +}; + +} // namespace internal + +// This represents an instruction that has been enqueued using the XlaBuilder. +// This is used to pass to subsequent computations that depends upon the +// instruction as an operand. +class XlaOp { + public: + XlaOp() : handle_(-1), builder_(nullptr) { + static_assert(std::is_trivially_destructible::value, + "XlaOp should be trivially destructible"); + } + ~XlaOp() = default; + + XlaOp(const XlaOp& other) = default; + XlaOp& operator=(const XlaOp& other) = default; + + // Precondition: !IsUninitialized(). + // + // It's very common to do foo.builder()->bar(). Without this precondition, if + // foo.builder() is null, the call to bar will segfault at some point possibly + // deep in the callstack when we finally dereference `this`. The precondition + // lets us avoid this tricky-to-debug problem. + XlaBuilder* builder() const { + CHECK(builder_ != nullptr); + return builder_; + } + + // Returns true if the XlaOp represents valid, non-erroneous value. + bool valid() const { return handle_ >= 0; } + + // Returns true if the XlaOp was created by the XlaOp() constructor and + // not returned by a builder. + bool IsUninitialized() const { return builder_ == nullptr; } + + bool IsIdenticalTo(XlaOp rhs) const { + return handle_ == rhs.handle_ && builder_ == rhs.builder_; + } + + friend std::ostream& operator<<(std::ostream& out, XlaOp op) { + out << op.handle(); + return out; + } + + private: + explicit XlaOp(XlaBuilder* builder) : handle_(-1), builder_(builder) {} + XlaOp(int64_t handle, XlaBuilder* builder) + : handle_(handle), builder_(builder) {} + + int64_t handle() const { return handle_; } + + friend class XlaBuilder; + friend class ValueInference; + friend struct internal::XlaBuilderFriend; + + // < 0 means "invalid handle". + int64_t handle_; + + // Not owned. Non-null for any handle returned by XlaBuilder, even if the + // handle is invalid. + XlaBuilder* builder_; +}; + +// Arithmetic operator overloads for the XlaOp type. +XlaOp operator-(XlaOp x); +XlaOp operator+(XlaOp x, XlaOp y); +XlaOp operator-(XlaOp x, XlaOp y); +XlaOp operator*(XlaOp x, XlaOp y); +XlaOp operator/(XlaOp x, XlaOp y); +XlaOp operator%(XlaOp x, XlaOp y); + +// Bitwise operator overloads for the XlaOp type. +XlaOp operator~(XlaOp x); +XlaOp operator&(XlaOp x, XlaOp y); +XlaOp operator|(XlaOp x, XlaOp y); +XlaOp operator^(XlaOp x, XlaOp y); +XlaOp operator<<(XlaOp x, XlaOp y); +// Performs a right arithmetic shift if 'x' is a signed type, otherwise performs +// a right logical shift. +XlaOp operator>>(XlaOp x, XlaOp y); + +// We don't overload the relational operators (==, !=, <, <=, >, >=) because the +// semantics might be surprising since their result types are usually 'bool'. +// Further programmers may expect == to be a structural equality. +// We also choose not to overload any of the mutating operators (e.g., +=, -=) +// because the semantics might be misleading — XLA computations are immutable. + +// A convenient interface for building up computations. +// +// Thread-compatible. +class XlaBuilder { + public: + // computation_name: name to use for the built computation. + explicit XlaBuilder(const std::string& computation_name); + + XlaBuilder(const XlaBuilder&) = delete; + XlaBuilder& operator=(const XlaBuilder&) = delete; + + virtual ~XlaBuilder(); + + // Returns the computation name. + const std::string& name() const { return name_; } + + // Sets OpMetadata that will be added to all instructions until cleared. + // + // OpMetadata is often applied to a series of XLA HLO instructions. As a + // result, OpMetadata is set on the computation builder. All subsequent + // instructions generated via this computation builder will have the same + // OpMetadata attached until a call to ClearOpMetadata. + void SetOpMetadata(OpMetadata metadata) { metadata_ = std::move(metadata); } + + // Swaps the passed op metadata with the ones currently set. + // + // Returns the old op metadata. + OpMetadata SwapOpMetadata(OpMetadata metadata) { + OpMetadata old_metadata = std::move(metadata_); + metadata_ = std::move(metadata); + return old_metadata; + } + + // Similar to SetOpMetadata, but only set the metadata for the next op. + void SetOneShotOpMetadata(OpMetadata metadata) { + one_shot_metadata_ = std::move(metadata); + } + + // Clears the HloMetadata state. + void ClearOpMetadata() { metadata_.Clear(); } + + // Sets an OpSharding that will be attached to all instructions until cleared. + void SetSharding(const OpSharding& sharding) { sharding_ = sharding; } + + // Sets the FrontendAttributes that will be added to all instructions until + // cleared. + // + // FrontendAttributes are often applied to a series of XLA HLO instructions. + // As a result they are set on the computation builder and all the + // instructions generated via the computation builder will have the same + // frontend attributes attached to them. + virtual void SetFrontendAttributes( + const FrontendAttributes& frontend_attributes) { + frontend_attributes_ = frontend_attributes; + } + + // Swap the passed FrontendAttributes with the ones currently set. + // + // Return the old attributes. + FrontendAttributes SwapFrontendAttributes( + const FrontendAttributes& frontend_attributes) { + FrontendAttributes old_attributes = std::move(frontend_attributes_); + frontend_attributes_ = frontend_attributes; + return old_attributes; + } + + // Returns the FrontendAttributes that will be attached to all instructions. + const FrontendAttributes& frontend_attributes() const { + return frontend_attributes_; + } + + // Clears all the frontend attributes. + void ClearFrontendAttributes() { frontend_attributes_.Clear(); } + + // Clears the sharding. Ops will be sharded according to the default placement + // policy. + void ClearSharding() { sharding_ = std::nullopt; } + + // Returns the OpSharding that will be attached to all instructions. + const std::optional& sharding() const { return sharding_; } + + // Sets the builder to a mode where it will die immediately when an error is + // encountered, rather than producing it in a deferred fashion when Build() is + // called (which is the default). + void set_die_immediately_on_error(bool enabled) { + die_immediately_on_error_ = enabled; + } + + // Default dimension numbers used for a 2D convolution. + static constexpr int64_t kConvBatchDimension = 0; + static constexpr int64_t kConvFeatureDimension = 1; + static constexpr int64_t kConvFirstSpatialDimension = 2; + static constexpr int64_t kConvSecondSpatialDimension = 3; + static constexpr int64_t kConvKernelOutputDimension = 0; + static constexpr int64_t kConvKernelInputDimension = 1; + static constexpr int64_t kConvKernelFirstSpatialDimension = 2; + static constexpr int64_t kConvKernelSecondSpatialDimension = 3; + + // Creates a default ConvolutionDimensionNumbers. For a 2D convolution, for + // the input operand {batch, feature, height, width} = {0, 1, 2, 3} and for + // the kernel operand + // {output_feature, input_feature, height, width} = {0, 1, 2, 3}. + static ConvolutionDimensionNumbers CreateDefaultConvDimensionNumbers( + int num_spatial_dims = 2); + + // Returns an error if the convolution dimension numbers have conflicts. + static Status Validate(const ConvolutionDimensionNumbers& dnum); + + // Returns a new XlaBuilder whose resultant Computation is used only by this + // XlaBuilder. The sub-XlaBuilder has the same die_immediately_on_error + // behavior as the parent. + std::unique_ptr CreateSubBuilder( + const std::string& computation_name); + + // Builds the computation with the requested operations, or returns a non-ok + // status. Note that all ops that have been enqueued will be moved to the + // computation being returned. The root of the computation will be the last + // added operation. + // + // `remove_dynamic_dimensions` tells the builder whether to remove the + // dynamic dimensions information in all ops. + // + // TODO(b/121223198): Delete `remove_dynamic_dimensions` and keeps the + // dynamic dimensions information when XLA backend can handle dynamic + // dimensions. + StatusOr Build(bool remove_dynamic_dimensions = false); + + // Overload of Build which specifies a particular root instruction for the + // computation. + StatusOr Build(XlaOp root, + bool remove_dynamic_dimensions = false); + + // Builds the computation with the requested operations, or notes an error in + // the parent XlaBuilder and returns an empty computation if building failed. + // This function is intended to be used where the returned XlaComputation is + // only used by the parent XlaBuilder and hence further operation on the + // returned XlaComputation will simply be error'ed out if an error occurred + // while building this computation. If the built computation is to be used by + // a XlaBuilder other than the parent XlaBuilder then Build() should be used + // instead. + XlaComputation BuildAndNoteError(); + + // Returns a subgraph that roots on the given root. If the root is not a + // compile-time constant (see `IsConstant`), returns an error. + // + // This will copy the needed ops/computations to the subgraph. + StatusOr BuildConstantSubGraph( + XlaOp root_op, bool dynamic_dimension_is_minus_one = false); + + // Returns the first error that was encountered while building the + // computation. When an error is encountered, by default we return a vacuous + // XlaOp and inform the user of the error that occurred while + // building the computation when they make a final call to Build(). + // + // See also set_die_immediately_on_error(). + Status first_error() const { return first_error_; } + + // Returns the current status of the builder, complete with the stack trace + // information. + Status GetCurrentStatus() const; + + // Returns the shape of the given op. + StatusOr GetShape(XlaOp op) const; + + // Returns the shape of the given op. + virtual StatusOr GetShapePtr(XlaOp op) const; + + // Returns the (inferred) result for the current computation's shape. This + // assumes the root instruction is the last added instruction. + StatusOr GetProgramShape() const; + + // Returns the (inferred) result for the current computation's shape using the + // given operation as the root. + StatusOr GetProgramShape(XlaOp root) const; + + // Reports an error to the builder, by + // * storing it internally and capturing a backtrace if it's the first error + // (this deferred value will be produced on the call to + // Build()/GetShape()/...) + // * dying if die_immediately_on_error_ is true. + // Returns an XlaOp with an invalid handle but a valid builder. This value can + // be returned in place of a value in APIs that return an XlaOp. + XlaOp ReportError(const Status& error); + + // A helper function that converts a StatusOr into an XlaOp. + // If the Status was an error, reports the error to builder and returns an + // invalid XlaOp handle. + XlaOp ReportErrorOrReturn(const StatusOr& op); + + // A helper function that runs a function that returns a StatusOr and + // returns an XlaOp. + XlaOp ReportErrorOrReturn(absl::FunctionRef()> op_creator); + + // Returns true if 'operand' is a compile-time constant. A compile-time + // constant does not depend on any parameters, or on stateful operators such + // as `RngNormal` or `Infeed`. + // + // This tests whether a computation is a compile-time constant without + // evaluating the computation. + StatusOr IsConstant(XlaOp operand) const; + + // Adds a new input/output alias. Since the input/output shape information are + // not available until the computation is built, any eventual error in the + // arguments of this API will be detected only at computation Build() time. + // + // Note: Except when 'must-alias' is true, alias is assumed to be 'may-alias' + // and only donated buffer at runtime will be aliased with output. If a buffer + // is not donated at runtime, a copy will be inserted by XLA to prevent buffer + // clobbering. + void SetUpAlias(const ShapeIndex& output_index, int64_t param_number, + const ShapeIndex& param_index, + HloInputOutputAliasConfig::AliasKind kind = + HloInputOutputAliasConfig::AliasKind::kMayAlias) { + input_output_aliases_.push_back( + {output_index, param_number, param_index, kind}); + } + + // Describes an input/output alias as inserted by the SetUpAlias() API. + struct InputOutputAlias { + // Specifies the index of the aliased buffer in the result tuple. + ShapeIndex output_index; + // Specifies the parameter containing the buffer to be aliased. + int64_t param_number; + // Specifies the index of the aliased buffer in the parameter. + ShapeIndex param_index; + // Specifies if the alias is a must alias or may alias. + HloInputOutputAliasConfig::AliasKind kind; + }; + + // Adds a new buffer donor. The donated buffer may be paired with any valid + // output. On the contrary, the buffer aliasing bonds the input output pair. + // The input can only donate the buffer to the paired output. + void AddBufferDonor(int64_t param_number, const ShapeIndex& param_index) { + buffer_donors_.insert({param_number, param_index}); + } + + // Looks up the HloInstruction and sets the frontend attribute "attribute" to + // "value". + // + // If the attribute already existed then its value is updated. + // + // Note: the attribute is only added to the HloInstruction, not to the + // builder. + Status SetInstructionFrontendAttribute(XlaOp op, std::string attribute, + std::string value); + + // Returns shapes for the operands. + StatusOr> GetOperandShapes( + absl::Span operands) const; + + // Converts the op to string for the ease of debugging. + std::string OpToString(XlaOp op) const; + + private: + void ToStringHelper(std::string* out, int ident, int64_t op_handle) const; + + // Build helper which takes the id of the root operation.. + StatusOr Build(int64_t root_id, + bool remove_dynamic_dimensions); + + // Description for the methods below can be found in the corresponding public + // functions section in this file. + + XlaOp Parameter(int64_t parameter_number, const Shape& shape, + const std::string& name, + const std::vector& replicated_at_leaf_buffers); + XlaOp Parameter(int64_t parameter_number, const Shape& shape, + const std::string& name) { + std::vector empty_bools; + return Parameter(parameter_number, shape, name, empty_bools); + } + + virtual XlaOp ConstantLiteral(const LiteralSlice& literal); + + XlaOp Broadcast(XlaOp operand, absl::Span broadcast_sizes); + + XlaOp BroadcastInDim(XlaOp operand, absl::Span out_dim_size, + absl::Span broadcast_dimensions); + + XlaOp Pad(XlaOp operand, XlaOp padding_value, + const PaddingConfig& padding_config); + XlaOp PadInDim(XlaOp operand, XlaOp padding_value, int64_t dimno, + int64_t pad_lo, int64_t pad_hi); + + virtual StatusOr PadInternal(const Shape& shape, XlaOp operand, + XlaOp padding_value, + const PaddingConfig& padding_config); + + XlaOp Reshape(XlaOp operand, absl::Span dimensions, + absl::Span new_sizes, + int64_t inferred_dimension = -1); + + XlaOp Reshape(XlaOp operand, absl::Span new_sizes, + int64_t inferred_dimension = -1); + + XlaOp Reshape(const Shape& shape, XlaOp operand, + int64_t inferred_dimension = -1); + + XlaOp DynamicReshape(XlaOp operand, absl::Span dim_sizes, + absl::Span new_size_bounds, + const std::vector& dims_are_dynamic); + + XlaOp Collapse(XlaOp operand, absl::Span dimensions); + + XlaOp Slice(XlaOp operand, absl::Span start_indices, + absl::Span limit_indices, + absl::Span strides); + virtual StatusOr SliceInternal(const Shape& shape, XlaOp operand, + absl::Span start_indices, + absl::Span limit_indices, + absl::Span strides); + virtual XlaOp SliceInDim(XlaOp operand, int64_t start_index, + int64_t limit_index, int64_t stride, int64_t dimno); + + XlaOp DynamicSlice(XlaOp operand, absl::Span start_indices, + absl::Span slice_sizes); + virtual StatusOr DynamicSliceInternal( + const Shape& shape, XlaOp operand, absl::Span start_indices, + absl::Span slice_sizes); + + XlaOp DynamicUpdateSlice(XlaOp operand, XlaOp update, + absl::Span start_indices); + virtual StatusOr DynamicUpdateSliceInternal( + const Shape& shape, XlaOp operand, XlaOp update, + absl::Span start_indices); + + XlaOp ConcatInDim(absl::Span operands, int64_t dimension); + virtual StatusOr ConcatInDimInternal(const Shape& shape, + absl::Span operands, + int64_t dimension); + + XlaOp Select(XlaOp pred, XlaOp on_true, XlaOp on_false); + + XlaOp Tuple(absl::Span elements); + virtual StatusOr TupleInternal(const Shape& shape, + absl::Span elements); + + XlaOp GetTupleElement(XlaOp tuple_data, int64_t index); + virtual StatusOr GetTupleElementInternal(const Shape& shape, + XlaOp tuple_data, + int64_t index); + + XlaOp Dot(XlaOp lhs, XlaOp rhs, + const PrecisionConfig* precision_config = nullptr, + std::optional preferred_element_type = std::nullopt); + + XlaOp DotGeneral( + XlaOp lhs, XlaOp rhs, const DotDimensionNumbers& dimension_numbers, + const PrecisionConfig* precision_config = nullptr, + std::optional preferred_element_type = std::nullopt); + + XlaOp Conv( + XlaOp lhs, XlaOp rhs, absl::Span window_strides, + Padding padding, int64_t feature_group_count = 1, + int64_t batch_group_count = 1, + const PrecisionConfig* precision_config = nullptr, + std::optional preferred_element_type = std::nullopt); + + XlaOp ConvWithGeneralPadding( + XlaOp lhs, XlaOp rhs, absl::Span window_strides, + absl::Span> padding, + int64_t feature_group_count = 1, int64_t batch_group_count = 1, + const PrecisionConfig* precision_config = nullptr, + std::optional preferred_element_type = std::nullopt); + + XlaOp ConvWithGeneralDimensions( + XlaOp lhs, XlaOp rhs, absl::Span window_strides, + Padding padding, const ConvolutionDimensionNumbers& dimension_numbers, + int64_t feature_group_count = 1, int64_t batch_group_count = 1, + const PrecisionConfig* precision_config = nullptr, + std::optional preferred_element_type = std::nullopt); + + XlaOp ConvGeneral( + XlaOp lhs, XlaOp rhs, absl::Span window_strides, + absl::Span> padding, + const ConvolutionDimensionNumbers& dimension_numbers, + int64_t feature_group_count = 1, int64_t batch_group_count = 1, + const PrecisionConfig* precision_config = nullptr, + std::optional preferred_element_type = std::nullopt); + + XlaOp ConvGeneralDilated( + XlaOp lhs, XlaOp rhs, absl::Span window_strides, + absl::Span> padding, + absl::Span lhs_dilation, + absl::Span rhs_dilation, + const ConvolutionDimensionNumbers& dimension_numbers, + int64_t feature_group_count = 1, int64_t batch_group_count = 1, + const PrecisionConfig* precision_config = nullptr, + std::optional preferred_element_type = std::nullopt, + std::optional> window_reversal = std::nullopt); + + XlaOp DynamicConvForward( + XlaOp lhs, XlaOp rhs, absl::Span window_strides, + absl::Span> padding, + absl::Span lhs_dilation, + absl::Span rhs_dilation, + const ConvolutionDimensionNumbers& dimension_numbers, + int64_t feature_group_count, int64_t batch_group_count, + const PrecisionConfig* precision_config, PaddingType padding_type, + std::optional preferred_element_type = std::nullopt); + + XlaOp DynamicConvInputGrad( + XlaOp input_sizes, XlaOp lhs, XlaOp rhs, + absl::Span window_strides, + absl::Span> padding, + absl::Span lhs_dilation, + absl::Span rhs_dilation, + const ConvolutionDimensionNumbers& dimension_numbers, + int64_t feature_group_count, int64_t batch_group_count, + const PrecisionConfig* precision_config, PaddingType padding_type, + std::optional preferred_element_type = std::nullopt); + + XlaOp DynamicConvKernelGrad( + XlaOp activations, XlaOp gradients, + absl::Span window_strides, + absl::Span> padding, + absl::Span lhs_dilation, + absl::Span rhs_dilation, + const ConvolutionDimensionNumbers& dimension_numbers, + int64_t feature_group_count, int64_t batch_group_count, + const PrecisionConfig* precision_config, PaddingType padding_type, + std::optional preferred_element_type = std::nullopt); + + StatusOr DynamicConvInstruction( + XlaOp lhs, XlaOp rhs, absl::Span window_strides, + absl::Span> padding, + absl::Span lhs_dilation, + absl::Span rhs_dilation, + const ConvolutionDimensionNumbers& dimension_numbers, + int64_t feature_group_count, int64_t batch_group_count, + const PrecisionConfig* precision_config, PaddingType padding_type, + std::optional preferred_element_type = std::nullopt); + + virtual StatusOr ConvGeneralDilatedInternal( + const Shape& shape, XlaOp lhs, XlaOp rhs, const Window& window, + absl::Span window_strides, + absl::Span> padding, + absl::Span lhs_dilation, + absl::Span rhs_dilation, + const ConvolutionDimensionNumbers& dimension_numbers, + int64_t feature_group_count, int64_t batch_group_count, + const PrecisionConfig* precision_config); + + XlaOp Fft(XlaOp operand, FftType fft_type, + absl::Span fft_length); + virtual StatusOr FftInternal(const Shape& shape, XlaOp operand, + FftType fft_type, + absl::Span fft_length); + + virtual StatusOr TriangularSolveInternal( + const Shape& shape, XlaOp a, XlaOp b, TriangularSolveOptions options); + + virtual StatusOr CholeskyInternal(const Shape& shape, XlaOp a, + bool lower); + + XlaOp Infeed(const Shape& shape, const std::string& config = ""); + XlaOp InfeedWithToken(XlaOp token, const Shape& shape, + const std::string& config); + virtual StatusOr InfeedWithTokenInternal( + const Shape& infeed_instruction_shape, XlaOp token, + const std::string& config); + + void Outfeed(XlaOp operand, const Shape& shape_with_layout, + const std::string& outfeed_config); + XlaOp OutfeedWithToken(XlaOp operand, XlaOp token, + const Shape& shape_with_layout, + const std::string& outfeed_config); + virtual StatusOr OutfeedWithTokenInternal( + XlaOp operand, XlaOp token, const Shape& shape_with_layout, + const std::string& outfeed_config); + XlaOp Call(const XlaComputation& computation, + absl::Span operands); + + XlaOp CustomCall( + const std::string& call_target_name, absl::Span operands, + const Shape& shape_with_layout, const std::string& opaque, + std::optional> operand_shapes_with_layout, + bool has_side_effect, + absl::Span>> + output_operand_aliasing, + const Literal* literal, std::optional window, + std::optional dnums, + CustomCallSchedule schedule, CustomCallApiVersion api_version); + + // Internal version of CustomCall without computation that doesn't do op + // specific error handling and expects arguments to be legal. CustomCall + // method above calls this method after error handling. + virtual StatusOr CustomCallInternal( + const std::string& call_target_name, absl::Span operands, + const XlaComputation* computation, const Shape& shape_with_layout, + const std::string& opaque, + std::optional> operand_shapes_with_layout, + bool has_side_effect, + absl::Span>> + output_operand_aliasing, + const Literal* literal, std::optional window, + std::optional dnums, + CustomCallSchedule schedule, CustomCallApiVersion api_version); + + // TODO(b/239474321) Remove this overload as it has simply led to code + // duplication. + XlaOp CustomCall( + const std::string& call_target_name, absl::Span operands, + const XlaComputation& computation, const Shape& shape_with_layout, + const std::string& opaque, + std::optional> operand_shapes_with_layout, + bool has_side_effect, + absl::Span>> + output_operand_aliasing, + const Literal* literal, CustomCallSchedule schedule, + CustomCallApiVersion api_version); + + XlaOp OptimizationBarrier(XlaOp operand); + + XlaOp Reduce(XlaOp operand, XlaOp init_value, + const XlaComputation& computation, + absl::Span dimensions_to_reduce); + + XlaOp Reduce(absl::Span operands, + absl::Span init_values, + const XlaComputation& computation, + absl::Span dimensions_to_reduce); + + virtual StatusOr ReduceInternal( + const Shape& shape, absl::Span all_operands, + const XlaComputation& computation, + absl::Span dimensions_to_reduce); + + XlaOp ReduceAll(XlaOp operand, XlaOp init_value, + const XlaComputation& computation); + + XlaOp ReduceWindow(XlaOp operand, XlaOp init_value, + const XlaComputation& computation, + absl::Span window_dimensions, + absl::Span window_strides, Padding padding); + + XlaOp ReduceWindow(absl::Span operands, + absl::Span init_values, + const XlaComputation& computation, + absl::Span window_dimensions, + absl::Span window_strides, Padding padding); + + XlaOp ReduceWindowWithGeneralPadding( + absl::Span operands, absl::Span init_values, + const XlaComputation& computation, + absl::Span window_dimensions, + absl::Span window_strides, + absl::Span base_dilations, + absl::Span window_dilations, + absl::Span> padding); + StatusOr ReduceWindowInternal( + absl::Span operands, absl::Span init_values, + const XlaComputation& computation, + absl::Span window_dimensions, + absl::Span window_strides, + absl::Span base_dilations, + absl::Span window_dilations, + absl::Span> padding); + virtual StatusOr ReduceWindowInternal( + const Shape& shape, XlaOp operand, XlaOp init_value, + const XlaComputation& computation, Window window); + XlaOp CrossReplicaSum(XlaOp operand, + absl::Span replica_groups = {}); + + XlaOp AllGather(XlaOp operand, int64_t all_gather_dimension, + int64_t shard_count, + absl::Span replica_groups = {}, + const std::optional& channel_id = std::nullopt, + const std::optional& layout = std::nullopt, + std::optional use_global_device_ids = std::nullopt); + + XlaOp AllReduce(XlaOp operand, const XlaComputation& computation, + absl::Span replica_groups = {}, + const std::optional& channel_id = std::nullopt, + const std::optional& shape_with_layout = std::nullopt, + std::optional use_global_device_ids = std::nullopt); + + XlaOp ReduceScatter( + XlaOp operand, const XlaComputation& computation, + int64_t scatter_dimension, int64_t shard_count, + absl::Span replica_groups = {}, + const std::optional& channel_id = std::nullopt, + const std::optional& layout = std::nullopt, + std::optional use_global_device_ids = std::nullopt); + + XlaOp AllToAll(XlaOp operand, int64_t split_dimension, + int64_t concat_dimension, int64_t split_count, + absl::Span replica_groups, + const std::optional& layout = std::nullopt, + const std::optional& channel_id = std::nullopt); + + XlaOp AllToAllTuple( + absl::Span operands, + absl::Span replica_groups, + const std::optional& layout, + const std::optional& channel_id = std::nullopt); + + XlaOp AllToAllTuple( + XlaOp operand, int64_t split_dimension, int64_t concat_dimension, + int64_t split_count, absl::Span replica_groups, + const std::optional& layout, + const std::optional& channel_id = std::nullopt); + + XlaOp CollectivePermute( + XlaOp operand, + const std::vector>& source_target_pairs, + const std::optional& channel_id = std::nullopt); + + XlaOp ReplicaId(); + + XlaOp SelectAndScatter(XlaOp operand, const XlaComputation& select, + absl::Span window_dimensions, + absl::Span window_strides, + Padding padding, XlaOp source, XlaOp init_value, + const XlaComputation& scatter); + + XlaOp SelectAndScatterWithGeneralPadding( + XlaOp operand, const XlaComputation& select, + absl::Span window_dimensions, + absl::Span window_strides, + absl::Span> padding, XlaOp source, + XlaOp init_value, const XlaComputation& scatter); + + StatusOr SelectAndScatterInternal( + XlaOp operand, const XlaComputation& select, + absl::Span window_dimensions, + absl::Span window_strides, + absl::Span> padding, XlaOp source, + XlaOp init_value, const XlaComputation& scatter); + + virtual XlaOp Iota(const Shape& shape, int64_t iota_dimension); + + XlaOp Iota(PrimitiveType type, int64_t size); + + XlaOp ConvertElementType(XlaOp operand, PrimitiveType new_element_type); + + XlaOp BitcastConvertType(XlaOp operand, PrimitiveType new_element_type); + virtual StatusOr BitcastConvertTypeInternal(const Shape& shape, + XlaOp operand); + + XlaOp StochasticConvertType(XlaOp operand, XlaOp random, + PrimitiveType new_element_type); + + XlaOp Transpose(XlaOp operand, absl::Span permutation); + virtual StatusOr TransposeInternal( + const Shape& shape, XlaOp operand, absl::Span permutation); + + XlaOp Rev(XlaOp operand, absl::Span dimensions); + virtual StatusOr RevInternal(const Shape& shape, XlaOp operand, + absl::Span dimensions); + + XlaOp Sort(absl::Span operands, const XlaComputation& comparator, + int64_t dimension = -1, bool is_stable = false); + virtual StatusOr SortInternal(const Shape& shape, + absl::Span operands, + const XlaComputation& comparator, + int64_t dimension, bool is_stable); + + XlaOp Clamp(XlaOp min, XlaOp operand, XlaOp max); + + XlaOp Map(absl::Span operands, const XlaComputation& computation, + absl::Span dimensions, + absl::Span static_operands = {}); + + XlaOp RngNormal(XlaOp mu, XlaOp sigma, const Shape& shape); + + XlaOp RngUniform(XlaOp a, XlaOp b, const Shape& shape); + + XlaOp RngBitGenerator(RandomAlgorithm algorithm, XlaOp initial_state, + const Shape& shape); + // Internal variant for the op with the full result shape containing both data + // and state shape as a tuple. + virtual StatusOr RngBitGeneratorInternal( + const Shape& full_result_shape, RandomAlgorithm algorithm, + XlaOp initial_state); + + XlaOp While(const XlaComputation& condition, const XlaComputation& body, + XlaOp init); + virtual StatusOr WhileInternal(const Shape& shape, + const XlaComputation& condition, + const XlaComputation& body, XlaOp init); + + XlaOp Conditional(XlaOp predicate, XlaOp true_operand, + const XlaComputation& true_computation, XlaOp false_operand, + const XlaComputation& false_computation); + + XlaOp Conditional(XlaOp branch_index, + absl::Span branch_computations, + absl::Span branch_operands); + + XlaOp ReducePrecision(XlaOp operand, int exponent_bits, int mantissa_bits); + virtual StatusOr ReducePrecisionInternal(const Shape& shape, + XlaOp operand, + int exponent_bits, + int mantissa_bits); + + XlaOp Gather(XlaOp input, XlaOp start_indices, + const GatherDimensionNumbers& dimension_numbers, + absl::Span slice_sizes, + bool indices_are_sorted = false); + + virtual StatusOr GatherInternal( + const Shape& shape, XlaOp input, XlaOp start_indices, + const GatherDimensionNumbers& dimension_numbers, + absl::Span slice_sizes, bool indices_are_sorted); + + XlaOp Scatter(XlaOp input, XlaOp scatter_indices, XlaOp updates, + const XlaComputation& update_computation, + const ScatterDimensionNumbers& dimension_numbers, + bool indices_are_sorted = false, bool unique_indices = false); + XlaOp Scatter(absl::Span inputs, XlaOp scatter_indices, + absl::Span updates, + const XlaComputation& update_computation, + const ScatterDimensionNumbers& dimension_numbers, + bool indices_are_sorted = false, bool unique_indices = false); + + virtual StatusOr ScatterInternal( + const Shape& shape, absl::Span inputs, XlaOp scatter_indices, + absl::Span updates, const XlaComputation& update_computation, + const ScatterDimensionNumbers& dimension_numbers, bool indices_are_sorted, + bool unique_indices); + + void Send(XlaOp operand, const ChannelHandle& handle); + XlaOp SendWithToken(XlaOp operand, XlaOp token, const ChannelHandle& handle); + + XlaOp SendToHost(XlaOp operand, XlaOp token, const Shape& shape_with_layout, + const ChannelHandle& handle); + + XlaOp RecvFromHost(XlaOp token, const Shape& shape, + const ChannelHandle& handle); + + virtual XlaOp CreateToken(); + + XlaOp AfterAll(absl::Span tokens); + + XlaOp Recv(const Shape& shape, const ChannelHandle& handle); + XlaOp RecvWithToken(XlaOp token, const Shape& shape, + const ChannelHandle& handle); + + XlaOp BatchNormTraining(XlaOp operand, XlaOp scale, XlaOp offset, + float epsilon, int64_t feature_index); + + XlaOp BatchNormInference(XlaOp operand, XlaOp scale, XlaOp offset, XlaOp mean, + XlaOp variance, float epsilon, + int64_t feature_index); + + XlaOp BatchNormGrad(XlaOp operand, XlaOp scale, XlaOp batch_mean, + XlaOp batch_var, XlaOp grad_output, float epsilon, + int64_t feature_index); + + XlaOp GetDimensionSize(XlaOp operand, int64_t dimension); + + XlaOp SetDimensionSize(XlaOp operand, XlaOp val, int64_t dimension); + + virtual StatusOr SetDimensionSizeInternal(const Shape& shape, + XlaOp operand, XlaOp val, + int64_t dimension); + + XlaOp RemoveDynamicDimension(XlaOp operand, int64_t dimension); + + virtual StatusOr AddInstruction(HloInstructionProto&& instr, + HloOpcode opcode, + absl::Span operands); + StatusOr AddInstruction(HloInstructionProto&& instr, + HloOpcode opcode) { + return AddInstruction(std::move(instr), opcode, /*operands=*/{}); + } + + void AddCalledComputation(const XlaComputation& computation, + HloInstructionProto* instr); + + StatusOr LookUpInstruction(XlaOp op) const; + StatusOr LookUpInstructionByHandle( + int64_t handle) const; + StatusOr LookUpMutableInstruction(XlaOp op); + StatusOr LookUpMutableInstructionByHandle( + int64_t handle); + + // Internal helper method that does the building for an arbitrary unary op. + virtual XlaOp UnaryOp(HloOpcode unop, XlaOp operand); + + // Internal helper method that does the building for an arbitrary binary op. + // broadcast_dimensions specifies which dimensions to use for broadcasting + // when the operation is between tensors of different ranks. The direction is + // only used if opcode is kCompare. + XlaOp BinaryOp(HloOpcode binop, XlaOp lhs, XlaOp rhs, + absl::Span broadcast_dimensions, + std::optional direction = std::nullopt, + std::optional type = std::nullopt); + + StatusOr Compare(const Shape& shape, XlaOp lhs, XlaOp rhs, + ComparisonDirection direction); + + // Internal helper method for binary op compare without broadcast dimensions. + virtual StatusOr Compare(const Shape& shape, XlaOp lhs, XlaOp rhs, + ComparisonDirection direction, + Comparison::Type type); + + // Internal helper method that does the building for an arbitrary binary op + // with same ranked operands that doesn't broadcast. + virtual XlaOp BinaryOpNoBroadcast(HloOpcode binop, const Shape& shape, + XlaOp lhs, XlaOp rhs); + + // Internal helper method that does the building for an arbitrary ternary op. + XlaOp TernaryOp(HloOpcode triop, XlaOp lhs, XlaOp rhs, XlaOp ehs); + + XlaOp RngOp(RandomDistribution distribution, + absl::Span parameters, const Shape& shape); + + virtual StatusOr RngOpInternal(RandomDistribution distribution, + absl::Span parameters, + const Shape& shape); + + virtual StatusOr InDimBroadcast( + const Shape& shape, XlaOp operand, + absl::Span broadcast_dimensions); + + // Internal helper method that creates a sequence of instructions that + // performs an explicit broadcast of the operand to the target shape. + StatusOr AddBroadcastSequence(const Shape& output_shape, + XlaOp operand); + + // Internal helper method for creating a Reshape op with the already inferred + // shape. + virtual StatusOr ReshapeInternal(const Shape& shape, XlaOp operand, + int64_t inferred_dimension); + + // Returns the (inferred) result for the program shape using the given root. + StatusOr GetProgramShape(int64_t root_id) const; + + // A visitor which checks whether an operation is a compile-time constant, + // meaning that it doesn't depend on any parameters, or on any stateful + // operation such as `RngNormal` or `Infeed`. The visitor walks the + // computation starting at a given operation and sets is_constant to false iff + // a parameter or stateful operation is encountered. + void IsConstantVisitor(int64_t op_handle, int depth, + absl::flat_hash_set* visited, + bool* is_constant) const; + + // Checks bounds for convolution parameters. + Status VerifyConvolution( + const Shape& lhs_shape, const Shape& rhs_shape, + const ConvolutionDimensionNumbers& dimension_numbers) const; + + int64_t GetNextId() { return ++next_id_; } + + // Populates the module with the input/output alias information stored within + // the input_output_aliases vector. + static Status PopulateInputOutputAliasAndBufferDonor( + HloModuleProto* module, const ProgramShape& program_shape, + const std::vector& input_output_aliases, + const absl::flat_hash_set& + buffer_donors); + + std::string name_; // Name to use for the built computation. + + // The next sequential ID for every instruction/computation contained within + // this computation. + int64_t next_id_ = 0; + + // The first error encountered while building the computation. + // This is OK until the first error is encountered. + Status first_error_; + + // The saved stack trace from the point at which the first error occurred. + tsl::SavedStackTrace first_error_backtrace_; + + // The instructions of this computation. + // Use a deque so pointers into this are stable, for example the return + // value of LookUpInstructionByHandle(). + std::deque instructions_; + // A cache for the HloInstructionProto shapes, to avoid recreating Shape + // objects from protos and to support the GetShapePtr() API. + std::vector> instruction_shapes_; + + // Dynamic parameter configuration of this computation. + DynamicParameterBinding dynamic_parameter_binding_; + + // Holds the input/output alias information populated by the SetUpAlias() API. + std::vector input_output_aliases_; + + // Holds the buffer donor information populated by the AddBufferDonor() API. + absl::flat_hash_set buffer_donors_; + + // A map from XlaOp::Handle to the index in the instructions_ vector where the + // instruction is held. + absl::flat_hash_map handle_to_index_; + + // Track imported instructions by their computation id and the position in + // their computation's instruction list. + struct ImportedInstruction { + int64_t computation_id; + int64_t instruction_index; + }; + + absl::flat_hash_map handle_to_imported_index_; + + // The embedded computations used by this computation. Each computation was + // the entry computation of some XlaComputation, the key is the unique id of + // that XlaComputation. + std::map embedded_; + + // The unique parameter numbers. + absl::flat_hash_set parameter_numbers_; + + // The metadata to attach to each op. This is structured as a "modal"-like + // operation, in order to simplify client code (and not sprinkle this metadata + // throughout the TensorFlow op kernel implementations). + OpMetadata metadata_; + + // A temporary metadata that will only be applied to the next op created. + std::optional one_shot_metadata_; + + // Sharding for this operator. This is structured as a "model"-like operation, + // in order to simplify client code, similar to metadata_. + std::optional sharding_; + + // Mode bit that indicates whether to die when a first error is encountered. + bool die_immediately_on_error_ = false; + + XlaBuilder* parent_builder_{nullptr}; + + FrontendAttributes frontend_attributes_; + + friend XlaOp Parameter(XlaBuilder* builder, int64_t parameter_number, + const Shape& shape, const std::string& name, + const std::vector& replicated_at_leaf_buffers); + friend XlaOp ConstantLiteral(XlaBuilder* builder, + const LiteralSlice& literal); + + friend XlaOp Broadcast(XlaOp operand, + absl::Span broadcast_sizes); + + friend XlaOp BroadcastInDim(XlaOp operand, + absl::Span out_dim_size, + absl::Span broadcast_dimensions); + + friend XlaOp Copy(XlaOp operand); + + friend XlaOp Pad(XlaOp operand, XlaOp padding_value, + const PaddingConfig& padding_config); + + friend XlaOp PadInDim(XlaOp operand, XlaOp padding_value, int64_t dimno, + int64_t pad_lo, int64_t pad_hi); + + friend XlaOp Reshape(XlaOp operand, absl::Span dimensions, + absl::Span new_sizes); + + friend XlaOp Reshape(XlaOp operand, absl::Span new_sizes); + + friend XlaOp Reshape(const Shape& shape, XlaOp operand); + + friend XlaOp DynamicReshape(XlaOp operand, absl::Span dim_sizes, + absl::Span new_size_bounds, + const std::vector& dims_are_dynamic); + + friend XlaOp ReshapeWithInferredDimension(XlaOp operand, + absl::Span new_sizes, + int64_t inferred_dimension); + + friend XlaOp Collapse(XlaOp operand, absl::Span dimensions); + + friend XlaOp Slice(XlaOp operand, absl::Span start_indices, + absl::Span limit_indices, + absl::Span strides); + + friend XlaOp SliceInDim(XlaOp operand, int64_t start_index, + int64_t limit_index, int64_t stride, int64_t dimno); + + friend XlaOp DynamicSlice(XlaOp operand, + absl::Span start_indices, + absl::Span slice_sizes); + + friend XlaOp DynamicUpdateSlice(XlaOp operand, XlaOp update, + absl::Span start_indices); + + friend XlaOp ConcatInDim(XlaBuilder* builder, + absl::Span operands, int64_t dimension); + + friend XlaOp Select(XlaOp pred, XlaOp on_true, XlaOp on_false); + friend XlaOp Tuple(XlaBuilder* builder, absl::Span elements); + friend XlaOp GetTupleElement(XlaOp tuple_data, int64_t index); + friend XlaOp Compare(XlaOp lhs, XlaOp rhs, + absl::Span broadcast_dimensions, + ComparisonDirection direction); + friend XlaOp Compare(XlaOp lhs, XlaOp rhs, + absl::Span broadcast_dimensions, + ComparisonDirection direction, + Comparison::Type compare_type); + friend XlaOp Dot(XlaOp lhs, XlaOp rhs, + const PrecisionConfig* precision_config, + std::optional preferred_element_type); + friend XlaOp DotGeneral(XlaOp lhs, XlaOp rhs, + const DotDimensionNumbers& dimension_number, + const PrecisionConfig* precision_config, + std::optional preferred_element_type); + virtual StatusOr DotGeneralInternal( + const Shape& shape, XlaOp lhs, XlaOp rhs, + const DotDimensionNumbers& dimension_number, + const PrecisionConfig* precision_config); + friend XlaOp Conv(XlaOp lhs, XlaOp rhs, + absl::Span window_strides, Padding padding, + int64_t feature_group_count, int64_t batch_group_count, + const PrecisionConfig* precision_config, + std::optional preferred_element_type); + friend XlaOp ConvWithGeneralPadding( + XlaOp lhs, XlaOp rhs, absl::Span window_strides, + absl::Span> padding, + int64_t feature_group_count, int64_t batch_group_count, + const PrecisionConfig* precision_config, + std::optional preferred_element_type); + friend XlaOp ConvWithGeneralDimensions( + XlaOp lhs, XlaOp rhs, absl::Span window_strides, + Padding padding, const ConvolutionDimensionNumbers& dimension_numbers, + int64_t feature_group_count, int64_t batch_group_count, + const PrecisionConfig* precision_config, + std::optional preferred_element_type); + friend XlaOp ConvGeneral( + XlaOp lhs, XlaOp rhs, absl::Span window_strides, + absl::Span> padding, + const ConvolutionDimensionNumbers& dimension_numbers, + int64_t feature_group_count, int64_t batch_group_count, + const PrecisionConfig* precision_config, + std::optional preferred_element_type); + friend XlaOp DynamicConvForward( + XlaOp lhs, XlaOp rhs, absl::Span window_strides, + absl::Span> padding, + absl::Span lhs_dilation, + absl::Span rhs_dilation, + const ConvolutionDimensionNumbers& dimension_numbers, + int64_t feature_group_count, int64_t batch_group_count, + const PrecisionConfig* precision_config, PaddingType padding_type, + std::optional preferred_element_type); + friend XlaOp DynamicConvKernelGrad( + XlaOp activations, XlaOp gradients, + absl::Span window_strides, + absl::Span> padding, + absl::Span lhs_dilation, + absl::Span rhs_dilation, + const ConvolutionDimensionNumbers& dimension_numbers, + int64_t feature_group_count, int64_t batch_group_count, + const PrecisionConfig* precision_config, PaddingType padding_type, + std::optional preferred_element_type); + friend XlaOp DynamicConvInputGrad( + XlaOp input_sizes, XlaOp lhs, XlaOp rhs, + absl::Span window_strides, + absl::Span> padding, + absl::Span lhs_dilation, + absl::Span rhs_dilation, + const ConvolutionDimensionNumbers& dimension_numbers, + int64_t feature_group_count, int64_t batch_group_count, + const PrecisionConfig* precision_config, PaddingType padding_type, + std::optional preferred_element_type); + + friend XlaOp ConvKernelGrad( + XlaOp lhs, XlaOp rhs, absl::Span window_strides, + absl::Span> padding, + absl::Span lhs_dilation, + absl::Span rhs_dilation, + const ConvolutionDimensionNumbers& dimension_numbers, + int64_t feature_group_count, int64_t batch_group_count, + const PrecisionConfig* precision_config, + std::optional preferred_element_type); + + friend XlaOp ConvGeneralDilated( + XlaOp lhs, XlaOp rhs, absl::Span window_strides, + absl::Span> padding, + absl::Span lhs_dilation, + absl::Span rhs_dilation, + const ConvolutionDimensionNumbers& dimension_numbers, + int64_t feature_group_count, int64_t batch_group_count, + const PrecisionConfig* precision_config, + std::optional preferred_element_type, + std::optional> window_reversal); + + friend XlaOp Fft(XlaOp operand, FftType fft_type, + absl::Span fft_length); + friend XlaOp TriangularSolve(XlaOp a, XlaOp b, bool left_side, bool lower, + bool unit_diagonal, + TriangularSolveOptions::Transpose transpose_a); + friend XlaOp Cholesky(XlaOp a, bool lower); + friend XlaOp Infeed(XlaBuilder* builder, const Shape& shape, + const std::string& config); + friend void Outfeed(XlaOp operand, const Shape& shape_with_layout, + const std::string& outfeed_config); + friend XlaOp Call(XlaBuilder* builder, const XlaComputation& computation, + absl::Span operands); + friend XlaOp CustomCall( + XlaBuilder* builder, const std::string& call_target_name, + absl::Span operands, const Shape& shape, + const std::string& opaque, bool has_side_effect, + absl::Span>> + output_operand_aliasing, + const Literal* literal, CustomCallSchedule schedule, + CustomCallApiVersion api_version); + friend XlaOp CustomCallWithComputation( + XlaBuilder* builder, const std::string& call_target_name, + absl::Span operands, const XlaComputation& computation, + const Shape& shape, const std::string& opaque, bool has_side_effect, + absl::Span>> + output_operand_aliasing, + const Literal* literal, CustomCallSchedule schedule, + CustomCallApiVersion api_version); + friend XlaOp CustomCallWithLayout( + XlaBuilder* builder, const std::string& call_target_name, + absl::Span operands, const Shape& shape_with_layout, + absl::Span operand_shapes_with_layout, + const std::string& opaque, bool has_side_effect, + absl::Span>> + output_operand_aliasing, + const Literal* literal, CustomCallSchedule schedule, + CustomCallApiVersion api_version); + friend XlaOp CustomCallWithConvDnums( + XlaBuilder* builder, const std::string& call_target_name, + absl::Span operands, const Shape& shape, + absl::Span operand_shapes_with_layout, + const std::string& opaque, bool has_side_effect, + absl::Span>> + output_operand_aliasing, + const Literal* literal, Window window, ConvolutionDimensionNumbers dnums, + CustomCallSchedule schedule, CustomCallApiVersion api_version); + friend XlaOp OptimizationBarrier(XlaOp operand); + friend XlaOp Complex(XlaOp real, XlaOp imag, + absl::Span broadcast_dimensions); + friend XlaOp Conj(XlaOp operand); + friend XlaOp Add(XlaOp lhs, XlaOp rhs, + absl::Span broadcast_dimensions); + friend XlaOp Sub(XlaOp lhs, XlaOp rhs, + absl::Span broadcast_dimensions); + friend XlaOp Mul(XlaOp lhs, XlaOp rhs, + absl::Span broadcast_dimensions); + friend XlaOp Div(XlaOp lhs, XlaOp rhs, + absl::Span broadcast_dimensions); + friend XlaOp Rem(XlaOp lhs, XlaOp rhs, + absl::Span broadcast_dimensions); + friend XlaOp Max(XlaOp lhs, XlaOp rhs, + absl::Span broadcast_dimensions); + friend XlaOp Min(XlaOp lhs, XlaOp rhs, + absl::Span broadcast_dimensions); + friend XlaOp And(XlaOp lhs, XlaOp rhs, + absl::Span broadcast_dimensions); + friend XlaOp Or(XlaOp lhs, XlaOp rhs, + absl::Span broadcast_dimensions); + friend XlaOp Xor(XlaOp lhs, XlaOp rhs, + absl::Span broadcast_dimensions); + friend XlaOp Not(XlaOp operand); + friend XlaOp PopulationCount(XlaOp operand); + friend XlaOp ShiftLeft(XlaOp lhs, XlaOp rhs, + absl::Span broadcast_dimensions); + friend XlaOp ShiftRightArithmetic( + XlaOp lhs, XlaOp rhs, absl::Span broadcast_dimensions); + friend XlaOp ShiftRightLogical( + XlaOp lhs, XlaOp rhs, absl::Span broadcast_dimensions); + friend XlaOp Reduce(XlaOp operand, XlaOp init_value, + const XlaComputation& computation, + absl::Span dimensions_to_reduce); + friend XlaOp Reduce(XlaBuilder* builder, absl::Span operands, + absl::Span init_values, + const XlaComputation& computation, + absl::Span dimensions_to_reduce); + friend XlaOp ReduceAll(XlaOp operand, XlaOp init_value, + const XlaComputation& computation); + friend XlaOp ReduceWindow(XlaOp operand, XlaOp init_value, + const XlaComputation& computation, + absl::Span window_dimensions, + absl::Span window_strides, + Padding padding); + friend XlaOp ReduceWindow(absl::Span operands, + absl::Span init_values, + const XlaComputation& computation, + absl::Span window_dimensions, + absl::Span window_strides, + Padding padding); + friend XlaOp ReduceWindowWithGeneralPadding( + XlaOp operand, XlaOp init_value, const XlaComputation& computation, + absl::Span window_dimensions, + absl::Span window_strides, + absl::Span base_dilations, + absl::Span window_dilations, + absl::Span> padding); + friend XlaOp ReduceWindowWithGeneralPadding( + absl::Span operands, absl::Span init_values, + const XlaComputation& computation, + absl::Span window_dimensions, + absl::Span window_strides, + absl::Span base_dilations, + absl::Span window_dilations, + absl::Span> padding); + + friend XlaOp CrossReplicaSum(XlaOp operand, + absl::Span replica_groups); + friend XlaOp AllGather(XlaOp operand, int64_t all_gather_dimension, + int64_t shard_count, + absl::Span replica_groups, + const std::optional& channel_id, + const std::optional& layout, + std::optional use_global_device_ids); + friend XlaOp AllReduce(XlaOp operand, const XlaComputation& computation, + absl::Span replica_groups, + const std::optional& channel_id, + const std::optional& shape_with_layout, + std::optional use_global_device_ids); + friend XlaOp AllReduceTuple(absl::Span operand, + const XlaComputation& computation, + absl::Span replica_groups, + const std::optional& channel_id, + const std::optional& shape_with_layout, + std::optional use_global_device_ids); + friend XlaOp ReduceScatter(XlaOp operand, const XlaComputation& computation, + int64_t scatter_dimension, int64_t shard_count, + absl::Span replica_groups, + const std::optional& channel_id, + const std::optional& layout, + std::optional use_global_device_ids); + + friend XlaOp AllToAll(XlaOp operand, int64_t split_dimension, + int64_t concat_dimension, int64_t split_count, + absl::Span replica_groups, + const std::optional& layout, + const std::optional& channel_id); + friend XlaOp AllToAllTuple(absl::Span operands, + absl::Span replica_groups, + const std::optional& layout, + const std::optional& channel_id); + friend XlaOp AllToAllTuple(XlaOp operand, int64_t split_dimension, + int64_t concat_dimension, int64_t split_count, + absl::Span replica_groups, + const std::optional& layout, + const std::optional& channel_id); + friend XlaOp CollectivePermute( + XlaOp operand, + const std::vector>& source_target_pairs, + const std::optional& channel_id); + friend XlaOp ReplicaId(XlaBuilder* builder); + friend XlaOp SelectAndScatter(XlaOp operand, const XlaComputation& select, + absl::Span window_dimensions, + absl::Span window_strides, + Padding padding, XlaOp source, XlaOp init_value, + const XlaComputation& scatter); + friend XlaOp SelectAndScatterWithGeneralPadding( + XlaOp operand, const XlaComputation& select, + absl::Span window_dimensions, + absl::Span window_strides, + absl::Span> padding, XlaOp source, + XlaOp init_value, const XlaComputation& scatter); + friend XlaOp Abs(XlaOp operand); + friend XlaOp Atan2(XlaOp y, XlaOp x, + absl::Span broadcast_dimensions); + friend XlaOp Exp(XlaOp operand); + friend XlaOp Expm1(XlaOp operand); + friend XlaOp Floor(XlaOp operand); + friend XlaOp Ceil(XlaOp operand); + friend XlaOp Round(XlaOp operand); + friend XlaOp RoundNearestEven(XlaOp operand); + friend XlaOp Log(XlaOp operand); + friend XlaOp Log1p(XlaOp operand); + friend XlaOp Logistic(XlaOp operand); + friend XlaOp Sign(XlaOp operand); + friend XlaOp Clz(XlaOp operand); + friend XlaOp Cos(XlaOp operand); + friend XlaOp Sin(XlaOp operand); + friend XlaOp Tan(XlaOp operand); + friend XlaOp Tanh(XlaOp operand); + friend XlaOp Real(XlaOp operand); + friend XlaOp Imag(XlaOp operand); + friend XlaOp Sqrt(XlaOp operand); + friend XlaOp Rsqrt(XlaOp operand); + friend XlaOp Cbrt(XlaOp operand); + friend XlaOp Pow(XlaOp lhs, XlaOp rhs, + absl::Span broadcast_dimensions); + friend XlaOp IsFinite(XlaOp operand); + friend XlaOp Iota(XlaBuilder* builder, const Shape& shape, + int64_t iota_dimension); + friend XlaOp Iota(XlaBuilder* builder, PrimitiveType type, int64_t size); + friend XlaOp ConvertElementType(XlaOp operand, + PrimitiveType new_element_type); + friend XlaOp BitcastConvertType(XlaOp operand, + PrimitiveType new_element_type); + friend XlaOp StochasticConvertType(XlaOp operand, XlaOp random, + PrimitiveType new_element_type); + friend XlaOp Neg(XlaOp operand); + friend XlaOp Transpose(XlaOp operand, absl::Span permutation); + friend XlaOp Rev(XlaOp operand, absl::Span dimensions); + friend XlaOp Sort(absl::Span operands, + const XlaComputation& comparator, int64_t dimension, + bool is_stable); + friend XlaOp Clamp(XlaOp min, XlaOp operand, XlaOp max); + friend XlaOp Map(XlaBuilder* builder, absl::Span operands, + const XlaComputation& computation, + absl::Span dimensions, + absl::Span static_operands); + friend XlaOp RngNormal(XlaOp mu, XlaOp sigma, const Shape& shape); + friend XlaOp RngUniform(XlaOp a, XlaOp b, const Shape& shape); + friend XlaOp RngBitGenerator(RandomAlgorithm algorithm, XlaOp initial_state, + const Shape& shape); + friend XlaOp While(const XlaComputation& condition, + const XlaComputation& body, XlaOp init); + friend XlaOp Conditional(XlaOp predicate, XlaOp true_operand, + const XlaComputation& true_computation, + XlaOp false_operand, + const XlaComputation& false_computation); + friend XlaOp Conditional( + XlaOp branch_index, + absl::Span branch_computations, + absl::Span branch_operands); + friend XlaOp ConditionalImpl( + XlaOp branch_index, + absl::Span branch_computations, + absl::Span branch_operands); + friend XlaOp ReducePrecision(XlaOp operand, int exponent_bits, + int mantissa_bits); + friend XlaOp Gather(XlaOp input, XlaOp start_indices, + const GatherDimensionNumbers& dimension_numbers, + absl::Span slice_sizes, + bool indices_are_sorted); + friend XlaOp Scatter(XlaOp input, XlaOp scatter_indices, XlaOp updates, + const XlaComputation& update_computation, + const ScatterDimensionNumbers& dimension_numbers, + bool indices_are_sorted, bool unique_indices); + friend XlaOp Scatter(absl::Span inputs, XlaOp scatter_indices, + absl::Span updates, + const XlaComputation& update_computation, + const ScatterDimensionNumbers& dimension_numbers, + bool indices_are_sorted, bool unique_indices); + friend void Send(XlaOp operand, const ChannelHandle& handle); + friend XlaOp Recv(XlaBuilder* builder, const Shape& shape, + const ChannelHandle& handle); + friend XlaOp BatchNormTraining(XlaOp operand, XlaOp scale, XlaOp offset, + float epsilon, int64_t feature_index); + friend XlaOp BatchNormInference(XlaOp operand, XlaOp scale, XlaOp offset, + XlaOp mean, XlaOp variance, float epsilon, + int64_t feature_index); + friend XlaOp BatchNormGrad(XlaOp operand, XlaOp scale, XlaOp batch_mean, + XlaOp batch_var, XlaOp grad_output, float epsilon, + int64_t feature_index); + friend XlaOp SendWithToken(XlaOp operand, XlaOp token, + const ChannelHandle& handle); + friend XlaOp RecvWithToken(XlaOp token, const Shape& shape, + const ChannelHandle& handle); + friend XlaOp SendToHost(XlaOp operand, XlaOp token, + const Shape& shape_with_layout, + const ChannelHandle& handle); + friend XlaOp RecvFromHost(XlaOp token, const Shape& shape, + const ChannelHandle& handle); + friend XlaOp InfeedWithToken(XlaOp token, const Shape& shape, + const std::string& config); + friend XlaOp OutfeedWithToken(XlaOp operand, XlaOp token, + const Shape& shape_with_layout, + const std::string& outfeed_config); + friend XlaOp CreateToken(XlaBuilder* builder); + friend XlaOp AfterAll(XlaBuilder* builder, absl::Span tokens); + + friend XlaOp GetDimensionSize(XlaOp operand, int64_t dimension); + friend XlaOp SetDimensionSize(XlaOp operand, XlaOp val, int64_t dimension); + friend XlaOp RemoveDynamicDimension(XlaOp operand, int64_t dimension); + + protected: + // Returns OK status if the given op was built using this builder. Otherwise, + // returns an error. + Status CheckOpBuilder(XlaOp op) const; + + private: + XlaOp AllGatherImpl(XlaOp operand, int64_t all_gather_dimension, + int64_t shard_count, + absl::Span replica_groups, + const std::optional& channel_id, + const std::optional& layout, + std::optional use_global_device_ids, bool async); + + XlaOp AllReduceImpl(XlaOp operand, const XlaComputation& computation, + absl::Span replica_groups, + const std::optional& channel_id, + const std::optional& layout, + std::optional use_global_device_ids, bool async); + + XlaOp CollectivePermuteImpl( + XlaOp operand, + const std::vector>& source_target_pairs, + const std::optional& channel_id, bool async); + + XlaOp ConditionalImpl( + XlaOp branch_index, + absl::Span branch_computations, + absl::Span branch_operands); + + XlaOp AllToAllArray( + XlaOp operand, int64_t split_dimension, int64_t concat_dimension, + int64_t split_count, absl::Span replica_groups, + const std::optional& channel_id = std::nullopt); + + // Creates an op with the given opcode and the output shape. + virtual StatusOr AddOpWithShape(HloOpcode opcode, const Shape& shape, + absl::Span operands); + + // Here, InstructionType is either const HloInstructionProto* or non-const + // HloInstructionProto*. + template + StatusOr LookUpInstructionByHandleInternal( + int64_t handle) const { + auto it = handle_to_index_.find(handle); + if (it == handle_to_index_.end()) { + // Try look for the instruction in the imported instructions. + auto imported_it = handle_to_imported_index_.find(handle); + if (imported_it != handle_to_imported_index_.end()) { + ImportedInstruction imported = imported_it->second; + return const_cast( + &embedded_.at(imported.computation_id) + .instructions(imported.instruction_index)); + } + return InvalidArgument("No XlaOp with handle %d", handle); + } + return const_cast(&instructions_.at(it->second)); + } + + // Here, InstructionType is either const HloInstructionProto* or non-const + // HloInstructionProto*. + // + // TODO(hinsu): Return const pointer within StatusOr and use + // absl::implicit_cast at callsites. This requires implicit_cast support in + // xla::StatusOr similar to absl::StatusOr. + template + StatusOr LookUpInstructionInternal(XlaOp op) const { + TF_RETURN_IF_ERROR(CheckOpBuilder(op)); + return LookUpInstructionByHandleInternal(op.handle()); + } + + friend struct internal::XlaBuilderFriend; + + friend class ValueInference; +}; + +// RAII-style object: sets the current sharding assignment in builder on +// construction, and sets back to the previous assignment on destruction. +class XlaScopedShardingAssignment { + public: + XlaScopedShardingAssignment(xla::XlaBuilder* builder, + std::optional sharding) + : builder_(builder), prev_sharding_(builder->sharding()) { + SetSharding(sharding); + } + + XlaScopedShardingAssignment(const XlaScopedShardingAssignment&) = delete; + XlaScopedShardingAssignment& operator=(const XlaScopedShardingAssignment&) = + delete; + + ~XlaScopedShardingAssignment() { SetSharding(prev_sharding_); } + + private: + void SetSharding(const std::optional& sharding) { + if (sharding.has_value()) { + builder_->SetSharding(sharding.value()); + } else { + builder_->ClearSharding(); + } + } + + xla::XlaBuilder* const builder_; + std::optional prev_sharding_; +}; + +// RAII-style object: save the current builder's frontend attributes, and merge +// them with the new ones on construction. +// Restore the original attributes on destruction. +class XlaScopedFrontendAttributesAssignment { + public: + XlaScopedFrontendAttributesAssignment(xla::XlaBuilder* builder, + FrontendAttributes attributes) + : builder_(builder) { + saved_ = builder_->SwapFrontendAttributes(attributes); + } + + ~XlaScopedFrontendAttributesAssignment() { + builder_->SetFrontendAttributes(saved_); + } + + private: + xla::XlaBuilder* const builder_; + FrontendAttributes saved_; + + XlaScopedFrontendAttributesAssignment( + const XlaScopedFrontendAttributesAssignment&) = delete; + XlaScopedFrontendAttributesAssignment& operator=( + const XlaScopedFrontendAttributesAssignment&) = delete; +}; + +// RAII-style object: sets the current op metadata in builder on construction, +// and sets back to the previous assignment on destruction. +class XlaScopedOpMetadataAssignment { + public: + XlaScopedOpMetadataAssignment(xla::XlaBuilder* builder, OpMetadata metadata) + : builder_(builder) { + saved_ = builder_->SwapOpMetadata(metadata); + } + + ~XlaScopedOpMetadataAssignment() { builder_->SwapOpMetadata(saved_); } + + private: + xla::XlaBuilder* const builder_; + OpMetadata saved_; + + XlaScopedOpMetadataAssignment(const XlaScopedOpMetadataAssignment&) = delete; + XlaScopedOpMetadataAssignment& operator=( + const XlaScopedOpMetadataAssignment&) = delete; +}; + +// Free functions for building XlaOps. The intention is that these will +// become the public API for building XlaOps rather than calling methods on +// XlaBuilder directly. +// + +// Enqueues a "retrieve parameter value" instruction for a parameter that was +// passed to the computation. +XlaOp Parameter(XlaBuilder* builder, int64_t parameter_number, + const Shape& shape, const std::string& name); + +// Same as above, but with leaf buffer replication annotation. +XlaOp Parameter(XlaBuilder* builder, int64_t parameter_number, + const Shape& shape, const std::string& name, + const std::vector& replicated_at_leaf_buffers); + +// Enqueues a constant with the value of the given literal onto the +// computation. +XlaOp ConstantLiteral(XlaBuilder* builder, const LiteralSlice& literal); + +// Enqueues a constant onto the computation. Methods are templated on the +// native host type (NativeT) which corresponds to a specific XLA +// PrimitiveType as given in the following table: +// +// Native Type PrimitiveType +// ----------------------------- +// bool PRED +// int32_t S32 +// int64_t S64 +// uint32_t U32 +// uint64_t U64 +// float F32 +// double F64 +// +// Note: not all primitive types defined in xla_data.proto have a +// corresponding native type yet. +template +XlaOp ConstantR0(XlaBuilder* builder, NativeT value); +template +XlaOp ConstantR1(XlaBuilder* builder, absl::Span values); +XlaOp ConstantR1(XlaBuilder* builder, const tsl::core::Bitmap& values); +template +XlaOp ConstantR2(XlaBuilder* builder, + std::initializer_list> values); +template +XlaOp ConstantFromArrayWithLayout(XlaBuilder* builder, + const Array& values, + const Layout& layout); +template +XlaOp ConstantFromArray(XlaBuilder* builder, const Array& values); +template +XlaOp ConstantR2FromArray2DWithLayout(XlaBuilder* builder, + const Array2D& values, + const Layout& layout); +template +XlaOp ConstantR2FromArray2D(XlaBuilder* builder, + const Array2D& values); +template +XlaOp ConstantR3FromArray3DWithLayout(XlaBuilder* builder, + const Array3D& values, + const Layout& layout); +template +XlaOp ConstantR3FromArray3D(XlaBuilder* builder, + const Array3D& values); +template +XlaOp ConstantR4FromArray4DWithLayout(XlaBuilder* builder, + const Array4D& values, + const Layout& layout); +template +XlaOp ConstantR4FromArray4D(XlaBuilder* builder, + const Array4D& values); + +// Enqueues a rank one constant (XlaBuilder* builder, vector) onto the +// computation. The vector has size 'length' and every element has the value +// 'value'. +template +XlaOp ConstantR1(XlaBuilder* builder, int64_t length, NativeT value); + +// Adds dimensions to an array by duplicating the data in the array. +// +// The new dimensions are inserted on the left, i.e. if +// broadcast_sizes has values {a0, ..., aN} and the operand shape +// has dimensions {b0, ..., bM} then the shape of the output has +// dimensions {a0, ..., aN, b0, ..., bM}. +// +// The new dimensions index into copies of the operand, i.e. +// +// output[i0, ..., iN, j0, ..., jM] = operand[j0, ..., jM] +XlaOp Broadcast(XlaOp operand, absl::Span broadcast_sizes); + +// This op broadcasts the `operand` to an output with the given `shape`. +// `broadcast_dimensions` are the dimensions to be broadcasting into, i.e., the +// i'th dimension of the operand is mapped to the broadcast_dimensions[i]'th +// dimension of the output. This also requires that the i'th input dimension is +// either 1 or is the same as the output dimension it's broadcasting into. +// +// For example, say operand = {1, 2}, i.e., a 1D tensor in shape s32[2]; the +// output shape is s32[2,2]: +// - Specifying {1} as broadcast_dimension will generate output +// {{1, 2}, +// {1, 2}} +// - On the other hand, specifying {0} as broadcast_dimension +// will generate output +// {{1 , 1}, +// {2 , 2}} +XlaOp BroadcastInDim(XlaOp operand, absl::Span out_dim_size, + absl::Span broadcast_dimensions); + +// Copies the input operand to the output. This operation is for internal +// purpose and is only used by the compiler for optimization purposes or to +// ensure correctness. The XLA client should never have to generate this +// instruction. +// +// Copy has two potential use cases: +// +// * Create a copy of the operand with a new layout. +// +// * Create a copy of the operand in a separately allocated buffer. This is +// necessary for some backends if the operand is a parameter or constant and +// the operand is returned within a tuple. In this case, the lifetime of the +// operand buffer must be the same as the lifetime of the output result. +// However, the lifetimes of parameters and constants are managed separately +// from the lifetime of the output result. Creating a separate copy of the +// parameter or constant buffer resolves this issue. +XlaOp Copy(XlaOp operand); + +// Enqueues a pad operation onto the computation that pads the given value on +// the edges as well as between the elements of the input. padding_config +// specifies the padding amount for each dimension. +XlaOp Pad(XlaOp operand, XlaOp padding_value, + const PaddingConfig& padding_config); + +// Enqueues a pad operation in a given dimension, taking all other +// dimensions as they are. +XlaOp PadInDim(XlaOp operand, XlaOp padding_value, int64_t dimno, + int64_t pad_lo, int64_t pad_hi); + +// Enqueues an operation onto the computation that flattens the operand based +// on the dimension order (major/slowest-varying to minor/fastest-varying) +// given, followed by reshaping it into the shape with the given dimension +// sizes (also major to minor). Conceptually, this is a limited form of +// "shape casting". +XlaOp Reshape(XlaOp operand, absl::Span dimensions, + absl::Span new_sizes); + +// Enqueues a dynamic reshape operation. The dynamic reshape takes additional +// XlaOps as sizes for the result dimension. The result dim i is a dynamic +// dimension dimension if dims_are_dynamic[i] is true. +XlaOp DynamicReshape(XlaOp operand, absl::Span dim_sizes, + absl::Span new_size_bounds, + const std::vector& dims_are_dynamic); + +// Enqueues an operation onto the computation that collapses the operand, +// from first to last dimension (C order), then reshapes it to the given +// dimension sizes. Conceptually, this is a limited form of "shape casting". +XlaOp Reshape(XlaOp operand, absl::Span new_sizes); + +// Enqueues a Reshape op that uses an explicit target shape. +XlaOp Reshape(const Shape& shape, XlaOp operand); + +// `inferred_dimension` represents the output dimension that's inferred by +// upper-level framework by dividing the input element count by the known +// output element count. While an inferred_dimension can be static, if there +// is a dynamic dimension in the output, it must be the inferred dimension. +XlaOp ReshapeWithInferredDimension(XlaOp operand, + absl::Span new_sizes, + int64_t inferred_dimension); + +// Wrapper for Reshape. +// Enqueues an operation to collapse the provided dimensions; e.g. an +// operand with dimensions {x=256, y=2, z=2, p=32} can be collapsed to +// {x=1024, y=32} by collapsing dims {0, 1, 2}. Collapsing dimensions must +// be a consecutive, in-order subsequence of the operand dimensions. +// +// Note that collapsing a single dimension does nothing: +// +// {256} collapsing {0} => {256} +// {1} collapsing {0} => {1} +// +// Collapsing multiple dimensions produces a single result dimension: +// +// {256, 2} collapsing {0,1} => {512} +// {256, 2, 3} collapsing {0,1} => {512, 3} +// +// This could potentially cause data to be moved -- it provides a more +// structured form of reshaping than an arbitrary Reshape operation. +XlaOp Collapse(XlaOp operand, absl::Span dimensions); + +// Enqueues a slice operation onto the computation that slices the operand +// from the start indices to the limit indices; e.g. +// +// x +// [ 0 1 2 3 ] +// y [ 4 5 6 7 ] => slice(start={1, 1}, limit={2, 3}) => [ 5 6 ] +// [ 8 9 a b ] +// +// Note that "limit" means up-to-but-not-including; i.e. [start, limit) in 1D +// range notation. +// The strides parameter determines the stride over the slice +XlaOp Slice(XlaOp operand, absl::Span start_indices, + absl::Span limit_indices, + absl::Span strides); + +// Enqueues a slice operation in a given dimension, taking all other +// dimensions as they are; e.g. if dimno is 1 from start_index 2 to +// limit_index 4 by 1, and the shape is f32[7,8,9], this call is short-hand +// for: +// +// array[:, 2:4:1, :] +XlaOp SliceInDim(XlaOp operand, int64_t start_index, int64_t limit_index, + int64_t stride, int64_t dimno); + +// Enqueues a slice operation onto the computation that slices the 'operand' +// from dynamic start indices which are passed in 'start_indices'. +// The size of the slice in each dimension is passed in 'slice_sizes', +// which specify the end point of exclusive slice intervals in each +// dimension [start, start + size). +// The shape of each element of 'start_indices' must be scalar, with the span +// size equal to the rank of the 'operand'. All elements of 'start_indices' must +// have the same shape. +// Slice index calculations are computed modulo input dimension sizes to +// prevent dynamic start indices from generating out-of-bound array accesses. +XlaOp DynamicSlice(XlaOp operand, absl::Span start_indices, + absl::Span slice_sizes); + +// Enqueues a dynamic update slice operation onto the computation, which +// updates a slice of 'operand' with 'update' at dynamic 'start_indices'. +// The shape of 'update' determines the shape of the slice of 'operand' +// which is updated. +// The indices specified in 'start_indices' specify the offset of the slice +// of 'operand' which is updated. +// +// update = {10, 11} // calculated at runtime. +// [1 2 3] start = {1, 1} // calculated at runtime. [1 2 3 ] +// [4 5 6] => DynamicUpdateslice(data, update, start) => [4 10 11] +// [7 8 9] [7 8 9 ] +// +// The shape of each element of 'start_indices' must be scalar, with the span +// size equal to the rank of the 'operand'. All elements of 'start_indices' must +// have the same shape. +// Slice index calculations are computed modulo update dimension sizes to +// prevent dynamic start indices from generating out-of-bound array accesses. +XlaOp DynamicUpdateSlice(XlaOp operand, XlaOp update, + absl::Span start_indices); + +// Enqueues a concatenate instruction onto the computation. 'operands' must +// have >= 1 entry. +XlaOp ConcatInDim(XlaBuilder* builder, absl::Span operands, + int64_t dimension); + +// Enqueues a conditional-move-like select operation onto the computation; +// predicated on pred, selects between on_true and on_false. +XlaOp Select(XlaOp pred, XlaOp on_true, XlaOp on_false); + +// Enqueues a tuple-creation instruction onto the computation. +XlaOp Tuple(XlaBuilder* builder, absl::Span elements); + +// Enqueues a tuple-element-get instruction onto the computation. +XlaOp GetTupleElement(XlaOp tuple_data, int64_t index); + +// Enqueues an equal-to comparison instruction onto the computation. +XlaOp Eq(XlaOp lhs, XlaOp rhs, + absl::Span broadcast_dimensions = {}); +XlaOp EqTotalOrder(XlaOp lhs, XlaOp rhs, + absl::Span broadcast_dimensions = {}); + +// Enqueues a not-equal comparison instruction onto the computation. +XlaOp Ne(XlaOp lhs, XlaOp rhs, + absl::Span broadcast_dimensions = {}); +XlaOp NeTotalOrder(XlaOp lhs, XlaOp rhs, + absl::Span broadcast_dimensions = {}); + +// Enqueues a greater-or-equal comparison instruction onto the computation. +XlaOp Ge(XlaOp lhs, XlaOp rhs, + absl::Span broadcast_dimensions = {}); +XlaOp GeTotalOrder(XlaOp lhs, XlaOp rhs, + absl::Span broadcast_dimensions = {}); + +// Enqueues a greater-than comparison instruction onto the computation. +XlaOp Gt(XlaOp lhs, XlaOp rhs, + absl::Span broadcast_dimensions = {}); +XlaOp GtTotalOrder(XlaOp lhs, XlaOp rhs, + absl::Span broadcast_dimensions = {}); + +// Enqueues a less-than comparison instruction onto the computation. +XlaOp Lt(XlaOp lhs, XlaOp rhs, + absl::Span broadcast_dimensions = {}); +XlaOp LtTotalOrder(XlaOp lhs, XlaOp rhs, + absl::Span broadcast_dimensions = {}); + +// Enqueues a less-or-equal comparison instruction onto the computation. +XlaOp Le(XlaOp lhs, XlaOp rhs, + absl::Span broadcast_dimensions = {}); +XlaOp LeTotalOrder(XlaOp lhs, XlaOp rhs, + absl::Span broadcast_dimensions = {}); + +// Enqueues a comparison instruction onto the computation (optionally without +// broadcast_dimensions for consistency with others). +XlaOp Compare(XlaOp lhs, XlaOp rhs, + absl::Span broadcast_dimensions, + ComparisonDirection direction, Comparison::Type compare_type); +XlaOp Compare(XlaOp lhs, XlaOp rhs, + absl::Span broadcast_dimensions, + ComparisonDirection direction); +XlaOp Compare(XlaOp lhs, XlaOp rhs, ComparisonDirection direction); + +// Enqueues a dot instruction onto the computation. +XlaOp Dot(XlaOp lhs, XlaOp rhs, + const PrecisionConfig* precision_config = nullptr, + std::optional preferred_element_type = std::nullopt); + +// Enqueues a general dot instruction onto the computation. +XlaOp DotGeneral( + XlaOp lhs, XlaOp rhs, const DotDimensionNumbers& dimension_numbers, + const PrecisionConfig* precision_config = nullptr, + std::optional preferred_element_type = std::nullopt); + +// Enqueues a convolution instruction onto the computation, which uses the +// default convolution dimension numbers. +XlaOp Conv(XlaOp lhs, XlaOp rhs, absl::Span window_strides, + Padding padding, int64_t feature_group_count = 1, + int64_t batch_group_count = 1, + const PrecisionConfig* precision_config = nullptr, + std::optional preferred_element_type = std::nullopt); + +// Enqueues a convolution instruction onto the computation, with the caller +// provided padding configuration in the format returned by MakePadding(). +XlaOp ConvWithGeneralPadding( + XlaOp lhs, XlaOp rhs, absl::Span window_strides, + absl::Span> padding, + int64_t feature_group_count = 1, int64_t batch_group_count = 1, + const PrecisionConfig* precision_config = nullptr, + std::optional preferred_element_type = std::nullopt); + +// Enqueues a convolution instruction onto the computation, with the caller +// provided dimension numbers configuration. +XlaOp ConvWithGeneralDimensions( + XlaOp lhs, XlaOp rhs, absl::Span window_strides, + Padding padding, const ConvolutionDimensionNumbers& dimension_numbers, + int64_t feature_group_count = 1, int64_t batch_group_count = 1, + const PrecisionConfig* precision_config = nullptr, + std::optional preferred_element_type = std::nullopt); + +// Enqueues a convolution instruction onto the computation, with the caller +// provided padding configuration as well as the dimension numbers. +XlaOp ConvGeneral( + XlaOp lhs, XlaOp rhs, absl::Span window_strides, + absl::Span> padding, + const ConvolutionDimensionNumbers& dimension_numbers, + int64_t feature_group_count = 1, int64_t batch_group_count = 1, + const PrecisionConfig* precision_config = nullptr, + std::optional preferred_element_type = std::nullopt); + +// Enqueues a convolution instruction onto the computation, with the caller +// provided padding configuration, dilation factors and dimension numbers. +XlaOp ConvGeneralDilated( + XlaOp lhs, XlaOp rhs, absl::Span window_strides, + absl::Span> padding, + absl::Span lhs_dilation, + absl::Span rhs_dilation, + const ConvolutionDimensionNumbers& dimension_numbers, + int64_t feature_group_count = 1, int64_t batch_group_count = 1, + const PrecisionConfig* precision_config = nullptr, + std::optional preferred_element_type = std::nullopt, + std::optional> window_reversal = std::nullopt); + +XlaOp DynamicConvForward( + XlaOp lhs, XlaOp rhs, absl::Span window_strides, + absl::Span> padding, + absl::Span lhs_dilation, + absl::Span rhs_dilation, + const ConvolutionDimensionNumbers& dimension_numbers, + int64_t feature_group_count, int64_t batch_group_count, + const PrecisionConfig* precision_config, PaddingType padding_type, + std::optional preferred_element_type = std::nullopt); + +XlaOp DynamicConvInputGrad( + XlaOp input_sizes, XlaOp lhs, XlaOp rhs, + absl::Span window_strides, + absl::Span> padding, + absl::Span lhs_dilation, + absl::Span rhs_dilation, + const ConvolutionDimensionNumbers& dimension_numbers, + int64_t feature_group_count, int64_t batch_group_count, + const PrecisionConfig* precision_config, PaddingType padding_type, + std::optional preferred_element_type = std::nullopt); + +XlaOp DynamicConvKernelGrad( + XlaOp activations, XlaOp gradients, + absl::Span window_strides, + absl::Span> padding, + absl::Span lhs_dilation, + absl::Span rhs_dilation, + const ConvolutionDimensionNumbers& dimension_numbers, + int64_t feature_group_count, int64_t batch_group_count, + const PrecisionConfig* precision_config, PaddingType padding_type, + std::optional preferred_element_type = std::nullopt); + +// Enqueues an FFT instruction onto the computation, of the given type and +// with the given FFT length. +XlaOp Fft(XlaOp operand, FftType fft_type, + absl::Span fft_length); + +// Solves systems of linear equations with lower or upper triangular coefficient +// matrices by forward- or back-substitution. Broadcasting along leading +// dimensions, this routine solves for x in one of the matrix systems +// `op(a) * x = b`, or `x * op(a) = b`, +// for the variable `x` given `a` and `b`, where `op(a)` is either +// `op(a) = a`, or `op(a) = transpose(a)`, or `op(a) = conj(transpose(a))`. +// +// * `a` is a tensor of shape `[..., M, M]` whose innermost 2 dimensions form +// square matrices. If `lower` is true (false), then the strictly upper +// (lower) triangular part of each innermost matrix in `a` is assumed to be +// zero and is not accessed. +// * `b` is a tensor of shape `[..., M, K]` if `left_side` is true, otherwise a +// tensor of shape `[..., K, M]`. +// * `left_side` is a boolean, indicating whether to solve a system of the form +// op(a) * x = b (true) or x * op(a) = b (false). +// * `lower` is a boolean, indicating whether the argument `a` is +// lower-triangular (true) or upper-triangular (false). +// * If `unit_diagonal` is true, the diagonal elements of `a` are assumed to be +// 1 and not accessed. +// * `transpose_a` indicates which function `op` we use to transform the tensor +// `a`: the identity function, transpose(a), or conjugate(transpose(a)) +XlaOp TriangularSolve(XlaOp a, XlaOp b, bool left_side, bool lower, + bool unit_diagonal, + TriangularSolveOptions::Transpose transpose_a); + +// Computes the Cholesky decompositions of a batch of symmetric (Hermitian) +// positive definite matrices. +// `a` must be a (batched) square matrix; i.e., it must have rank >= 2 with the +// two minor dimensions equal. +// If `lower` is true, the data from the lower triangle is used; if false, the +// upper triangle is used. The input data in the other triangle of the input +// does not affect the output. Returns the output in the same lower/upper +// triangle. The data returned in the other output triangle is arbitrary and +// implementation-defined. +// +// If `a` is not Hermitian positive definite, returns an array full of NaNs. +XlaOp Cholesky(XlaOp a, bool lower); + +// Enqueues an infeed instruction onto the computation, which writes data of +// the given shape to the infeed buffer of the device. +XlaOp Infeed(XlaBuilder* builder, const Shape& shape, + const std::string& config = ""); + +// Variant of Infeed which takes a token-shaped operand and produces a +// two-element tuple containing the data value and a token-shaped value. +// Tokens are used for ordering side-effecting operations. +// TODO(b/110532604): Replace all uses of the non-token form with this variant. +XlaOp InfeedWithToken(XlaOp token, const Shape& shape, + const std::string& config = ""); + +// Enqueues an outfeed instruction onto the computation. This instruction +// generates outgoing data transfers for the given data. +// +// shape_with_layout communicates the laid out shape that we want to outfeed +// -- if !ShapeUtil::Compatible(GetShape(operand), shape_with_layout) an error +// will occur. +void Outfeed(XlaOp operand, const Shape& shape_with_layout, + const std::string& outfeed_config); + +// Variant of Outfeed which takes a token-shaped operand and produces a +// token-shaped value. Tokens are used for ordering side-effecting operations. +// TODO(b/110532604): Replace all uses of the non-token form with this variant. +XlaOp OutfeedWithToken(XlaOp operand, XlaOp token, + const Shape& shape_with_layout, + const std::string& outfeed_config); + +// Enqueues a call instruction onto the computation. +XlaOp Call(XlaBuilder* builder, const XlaComputation& computation, + absl::Span operands); + +// Enqueues a custom call instruction onto the computation. A custom call +// invokes code external to XLA. The |operands| are passed to the external code, +// and the external code is expected to produce a result of the given +// |shape|. The exact mechanism is backend-specific. For example, in the CPU +// backend, a call instruction is emitted which targets a symbol with the name +// |call_target_name|. |call_target_name| and |opaque| can arbitrary strings, +// but |call_target_name| should be short as it may be used in labels. |opaque| +// can encode arbitrarily large amounts of information. |has_side_effect| +// specifies whether the instruction can have side effects. +// |output_operand_aliasing| specifies a list of output/operand buffer pairs +// that alias each other, where the output buffer is represented as a +// ShapeIndex, and the operand buffer is represented as the operand index and +// the ShapeIndex. +XlaOp CustomCall( + XlaBuilder* builder, const std::string& call_target_name, + absl::Span operands, const Shape& shape, + const std::string& opaque = "", bool has_side_effect = false, + absl::Span>> + output_operand_aliasing = {}, + const Literal* literal = nullptr, + CustomCallSchedule schedule = CustomCallSchedule::SCHEDULE_NONE, + CustomCallApiVersion api_version = API_VERSION_ORIGINAL); + +// Overload which constructs a custom call that applies an Xla computation. +XlaOp CustomCallWithComputation( + XlaBuilder* builder, const std::string& call_target_name, + absl::Span operands, const XlaComputation& computation, + const Shape& shape, const std::string& opaque = "", + bool has_side_effect = false, + absl::Span>> + output_operand_aliasing = {}, + const Literal* literal = nullptr, + CustomCallSchedule schedule = CustomCallSchedule::SCHEDULE_NONE, + CustomCallApiVersion api_version = API_VERSION_ORIGINAL); + +// Overload which constructs a custom call with fixed layouts. The operands will +// have the layouts specified by |operand_shapes_with_layout| when provided to +// external code, and the external code is expected to produce a result with the +// layout specified by |shape_with_layout|. All shapes in |shape_with_layout| +// and |operand_shapes_with_layout| must have layouts. +XlaOp CustomCallWithLayout( + XlaBuilder* builder, const std::string& call_target_name, + absl::Span operands, const Shape& shape_with_layout, + absl::Span operand_shapes_with_layout, + const std::string& opaque = "", bool has_side_effect = false, + absl::Span>> + output_operand_aliasing = {}, + const Literal* literal = nullptr, + CustomCallSchedule schedule = CustomCallSchedule::SCHEDULE_NONE, + CustomCallApiVersion api_version = API_VERSION_ORIGINAL); + +// Overload which annotates a custom call with the given Window and +// ConvolutionDimensionNumbers. Useful for custom-calls which represent +// convolutions. +// +// This sets the layout of its operands if operand_shapes_with_layout is +// nonempty, and it sets the layout of its result if `shape` has a layout. +XlaOp CustomCallWithConvDnums( + XlaBuilder* builder, const std::string& call_target_name, + absl::Span operands, const Shape& shape, + absl::Span operand_shapes_with_layout, + const std::string& opaque, bool has_side_effect, + absl::Span>> + output_operand_aliasing, + const Literal* literal, Window window, ConvolutionDimensionNumbers dnums, + CustomCallSchedule schedule = CustomCallSchedule::SCHEDULE_NONE, + CustomCallApiVersion api_version = API_VERSION_ORIGINAL); + +// Enqueues an optimization barrier onto the computation. +XlaOp OptimizationBarrier(XlaOp operand); + +// The following methods enqueue element-wise binary arithmetic operations +// onto the computation. The shapes of the operands have to match unless one +// of the operands is a scalar, or an explicit broadcast dimension is given +// (see g3doc for more details). + +// Enqueues a complex compose instruction onto the computation. +XlaOp Complex(XlaOp real, XlaOp imag, + absl::Span broadcast_dimensions = {}); + +// Enqueues a complex conjugate instruction onto the computation. +XlaOp Conj(XlaOp operand); + +// Enqueues an add instruction onto the computation. +XlaOp Add(XlaOp lhs, XlaOp rhs, + absl::Span broadcast_dimensions = {}); + +// Enqueues a subtract instruction onto the computation. +XlaOp Sub(XlaOp lhs, XlaOp rhs, + absl::Span broadcast_dimensions = {}); + +// Enqueues a multiply instruction onto the computation. +XlaOp Mul(XlaOp lhs, XlaOp rhs, + absl::Span broadcast_dimensions = {}); + +// Enqueues a divide instruction onto the computation. +XlaOp Div(XlaOp lhs, XlaOp rhs, + absl::Span broadcast_dimensions = {}); + +// Enqueues a remainder instruction onto the computation. +XlaOp Rem(XlaOp lhs, XlaOp rhs, + absl::Span broadcast_dimensions = {}); + +// Enqueues a max instruction onto the computation. +XlaOp Max(XlaOp lhs, XlaOp rhs, + absl::Span broadcast_dimensions = {}); + +// Enqueues a min instruction onto the computation. +XlaOp Min(XlaOp lhs, XlaOp rhs, + absl::Span broadcast_dimensions = {}); + +// Element-wise logical operators +XlaOp And(XlaOp lhs, XlaOp rhs, + absl::Span broadcast_dimensions = {}); + +// Overload to call And with 3 or more operands. We need the following somewhat +// convoluted overload set to disambiguate with the overload that takes the +// `broadcast_dimensions` optional param. +inline XlaOp And(XlaOp op1, XlaOp op2, XlaOp op3) { + return And(op1, And(op2, op3)); +} +template +XlaOp And(XlaOp op1, XlaOp op2, XlaOp op3, const XlaOpTs&... operands) { + return And(op1, And(op2, And(op3, operands...))); +} + +XlaOp Or(XlaOp lhs, XlaOp rhs, + absl::Span broadcast_dimensions = {}); + +// Overload to call Or with 3 or more operands. As with `And`, we need the +// following complicated overload set to handle the default arg in the `Or` +// overload above. +inline XlaOp Or(XlaOp op1, XlaOp op2, XlaOp op3) { + return Or(op1, Or(op2, op3)); +} +template +XlaOp Or(XlaOp op1, XlaOp op2, XlaOp op3, const XlaOpTs&... operands) { + return Or(op1, Or(op2, Or(op3, operands...))); +} + +XlaOp Xor(XlaOp lhs, XlaOp rhs, + absl::Span broadcast_dimensions = {}); + +XlaOp Not(XlaOp operand); + +XlaOp PopulationCount(XlaOp operand); + +XlaOp ShiftLeft(XlaOp lhs, XlaOp rhs, + absl::Span broadcast_dimensions = {}); +XlaOp ShiftRightArithmetic(XlaOp lhs, XlaOp rhs, + absl::Span broadcast_dimensions = {}); +XlaOp ShiftRightLogical(XlaOp lhs, XlaOp rhs, + absl::Span broadcast_dimensions = {}); +// Reduces an array among the provided dimensions, given "computation" as a +// reduction operator. +XlaOp Reduce(XlaOp operand, XlaOp init_value, const XlaComputation& computation, + absl::Span dimensions_to_reduce); + +// Reduces several arrays simultaneously among the provided dimensions, given +// "computation" as a reduction operator. +XlaOp Reduce(XlaBuilder* builder, absl::Span operands, + absl::Span init_values, + const XlaComputation& computation, + absl::Span dimensions_to_reduce); + +// Convenience wrapper around the above that reduces all the dimensions in the +// operand shape. +XlaOp ReduceAll(XlaOp operand, XlaOp init_value, + const XlaComputation& computation); + +// Enqueues a windowed reduce instruction onto the computation. +XlaOp ReduceWindow(XlaOp operand, XlaOp init_value, + const XlaComputation& computation, + absl::Span window_dimensions, + absl::Span window_strides, Padding padding); + +XlaOp ReduceWindow(absl::Span operands, + absl::Span init_values, + const XlaComputation& computation, + absl::Span window_dimensions, + absl::Span window_strides, Padding padding); + +// As ReduceWindow(), but the padding is given in the format +// returned by MakePadding(). +XlaOp ReduceWindowWithGeneralPadding( + XlaOp operand, XlaOp init_value, const XlaComputation& computation, + absl::Span window_dimensions, + absl::Span window_strides, + absl::Span base_dilations, + absl::Span window_dilations, + absl::Span> padding); +XlaOp ReduceWindowWithGeneralPadding( + absl::Span operands, absl::Span init_values, + const XlaComputation& computation, + absl::Span window_dimensions, + absl::Span window_strides, + absl::Span base_dilations, + absl::Span window_dilations, + absl::Span> padding); + +// Returns the sum of the operand value within each subgroup of replicas. All +// replicas supply one input to the sum and all replicas receive the resulting +// sum for each subgroup. +XlaOp CrossReplicaSum(XlaOp operand, + absl::Span replica_groups = {}); + +XlaOp AllGather(XlaOp operand, int64_t all_gather_dimension, + int64_t shard_count, + absl::Span replica_groups = {}, + const std::optional& channel_id = std::nullopt, + const std::optional& layout = std::nullopt, + std::optional use_global_device_ids = std::nullopt); + +// Enqueues an operation that do an AllReduce of the operand cross cores. Here +// AllReduce means doing a reduction on the input operand cross cores and then +// broadcasting the reduction result to those cores. The reduction function is +// defined by `computation`, which should be a commutative computation on +// scalars, e.g., add, min, or max. The way that AllReduce is applied is +// configured by: +// +// - `replica_groups`: each ReplicaGroup contains a list of replica id. If +// empty, all replicas belong to one group. Allreduce will be applied within +// subgroups. For example, we have 4 replicas, then replica_groups={{0,2},{1,3}} +// means, replica 0 and 2 are in subgroup 0, replica 1 and 3 are in subgroup 1. +// +// - `channel_id`: for Allreduce nodes from different modules, if they have the +// same channel_id, they will be 'AllReduce'd. If empty, AllReduce will not be +// applied cross modules. +// +// - `shape_with_layout`: forces the layout of the AllReduce to the given +// layout. This is used to guarantee the same layout for a group of AllReduce +// ops compiled separately. +XlaOp AllReduce(XlaOp operand, const XlaComputation& computation, + absl::Span replica_groups = {}, + const std::optional& channel_id = std::nullopt, + const std::optional& shape_with_layout = std::nullopt, + std::optional use_global_device_ids = std::nullopt); + +XlaOp AllReduceTuple( + absl::Span operand, const XlaComputation& computation, + absl::Span replica_groups = {}, + const std::optional& channel_id = std::nullopt, + const std::optional& shape_with_layout = std::nullopt, + std::optional use_global_device_ids = std::nullopt); + +XlaOp ReduceScatter( + XlaOp operand, const XlaComputation& computation, int64_t scatter_dimension, + int64_t shard_count, absl::Span replica_groups = {}, + const std::optional& channel_id = std::nullopt, + const std::optional& layout = std::nullopt, + std::optional use_global_device_ids = std::nullopt); + +// Enqueues an operation that do an Alltoall of the operand cross cores. +// An optional `layout` can be specified to force the layout of the instruction. +// This is used to guarantee the same layout for a group of AllToAll ops +// compiled separately. +XlaOp AllToAll(XlaOp operand, int64_t split_dimension, int64_t concat_dimension, + int64_t split_count, + absl::Span replica_groups = {}, + const std::optional& layout = std::nullopt, + const std::optional& channel_id = std::nullopt); + +XlaOp AllToAllTuple( + absl::Span operand, + absl::Span replica_groups = {}, + const std::optional& layout = std::nullopt, + const std::optional& channel_id = std::nullopt); + +XlaOp AllToAllTuple( + XlaOp operand, int64_t split_dimension, int64_t concat_dimension, + int64_t split_count, absl::Span replica_groups = {}, + const std::optional& layout = std::nullopt, + const std::optional& channel_id = std::nullopt); + +// Enqueues an collective operation that sends and receives data cross replicas. +// +// - `source_target_pair`: a list of (source_replica_id, target_replica_id) +// pairs. For each pair, the operand is sent from source replica to target +// replica. Note that, 1) any two pairs should not have the same target replica +// id, and they should not have the same source replica id; 2) if a replica id +// is not a target in any pair, then the output on that replica is a tensor +// consists of 0(s) with the same shape as the input. +XlaOp CollectivePermute( + XlaOp operand, + const std::vector>& source_target_pairs, + const std::optional& channel_id = std::nullopt); + +// Enqueues an operation that returns the replica ID. +XlaOp ReplicaId(XlaBuilder* builder); + +// Enqueues an operation that scatters the `source` array to the selected +// indices of each window. +XlaOp SelectAndScatter(XlaOp operand, const XlaComputation& select, + absl::Span window_dimensions, + absl::Span window_strides, + Padding padding, XlaOp source, XlaOp init_value, + const XlaComputation& scatter); + +// As SelectAndScatter(), but the padding is given in the format +// returned by MakePadding(). +XlaOp SelectAndScatterWithGeneralPadding( + XlaOp operand, const XlaComputation& select, + absl::Span window_dimensions, + absl::Span window_strides, + absl::Span> padding, XlaOp source, + XlaOp init_value, const XlaComputation& scatter); + +// Enqueues an abs instruction onto the computation. +XlaOp Abs(XlaOp operand); + +// Enqueues a atan2 instruction onto the computation. +XlaOp Atan2(XlaOp y, XlaOp x, + absl::Span broadcast_dimensions = {}); + +// Enqueues an exp instruction onto the computation. +XlaOp Exp(XlaOp operand); + +// Enqueues an expm1 instruction onto the computation. +XlaOp Expm1(XlaOp operand); + +// Enqueues a floor instruction onto the computation. +XlaOp Floor(XlaOp operand); + +// Enqueues a ceil instruction onto the computation. +XlaOp Ceil(XlaOp operand); + +// Enqueues a round instruction onto the computation, +// with half-way cases rounding away from zero. +XlaOp Round(XlaOp operand); + +// Enqueues a round instruction onto the computation, rounding to nearest even +XlaOp RoundNearestEven(XlaOp operand); + +// Enqueues an log instruction (natural logarithm) onto the computation. +XlaOp Log(XlaOp operand); + +// Enqueues an log1p instruction (log(x+1)) onto the computation. +XlaOp Log1p(XlaOp operand); + +// Enqueues a logistic instruction onto the computation. +XlaOp Logistic(XlaOp operand); + +// Enqueues a sign instruction onto the computation. +XlaOp Sign(XlaOp operand); + +// Enqueues a count leading zeros instruction onto the computation. +XlaOp Clz(XlaOp operand); + +// Enqueues a cosine instruction onto the computation. +XlaOp Cos(XlaOp operand); + +// Enqueues a sine instruction onto the computation. +XlaOp Sin(XlaOp operand); + +// Enqueues a tan instruction onto the computation. +XlaOp Tan(XlaOp operand); + +// Enqueues a tanh instruction onto the computation. +XlaOp Tanh(XlaOp operand); + +// Enqueues a real-part instruction onto the computation. +XlaOp Real(XlaOp operand); + +// Enqueues an imaginary-part instruction onto the computation. +XlaOp Imag(XlaOp operand); + +// Enqueues a sqrt computation onto the computation. +XlaOp Sqrt(XlaOp operand); + +// Enqueues a cbrt computation onto the computation. +XlaOp Cbrt(XlaOp operand); + +// Enqueues a rsqrt computation onto the computation. +XlaOp Rsqrt(XlaOp operand); + +// Enqueues a lhs^rhs computation onto the computation. +XlaOp Pow(XlaOp lhs, XlaOp rhs, + absl::Span broadcast_dimensions = {}); + +// Enqueues an operator that tests if the operand's values are finite, i.e., not +// +/-Inf or NaN. Returns an array of booleans with the same shape where +// entries are true iff the corresponding entry was not infinite or NaN. +// +// Defined only for real-valued (i.e. not complex) floating-point types; raises +// an error for other types. +// +// See also IsInf, IsPosInf, IsNegInf, and IsNan in lib/math.h. +XlaOp IsFinite(XlaOp operand); + +// Enqueues an iota operation onto the computation. +XlaOp Iota(XlaBuilder* builder, const Shape& shape, int64_t iota_dimension); + +// Enqueues a rank-1 iota operation onto the computation. +XlaOp Iota(XlaBuilder* builder, PrimitiveType type, int64_t size); + +// Enqueues a convert instruction onto the computation that changes the +// element type of the operand array to primitive_type. +XlaOp ConvertElementType(XlaOp operand, PrimitiveType new_element_type); + +// Enqueues a no-op instruction onto the computation that changes +// the element type of the operand array to primitive_type. The +// bit-widths of the source and destination element types must be +// identical. +XlaOp BitcastConvertType(XlaOp operand, PrimitiveType new_element_type); + +// Enqueues a stochastic convert instruction onto the computation that changes +// the element type of the operand array with stochastic rounding to +// primitive_type. +XlaOp StochasticConvertType(XlaOp operand, XlaOp random, + PrimitiveType new_element_type); + +// Enqueues a negate instruction onto the computation. +XlaOp Neg(XlaOp operand); + +// Enqueues a transpose instruction onto the computation. +XlaOp Transpose(XlaOp operand, absl::Span permutation); + +// Enqueues a reverse instruction onto the computation. The order of the +// elements in the given dimensions is reversed (i.e., the element at index i +// is moved to index dimension_size - 1 - i). +XlaOp Rev(XlaOp operand, absl::Span dimensions); + +// Enqueues a sort instruction onto the computation, using 'comparator' for +// comparisons. 'comparator' needs to define a strict weak order. 'is_stable' +// determines whether the stable sorting should be used. +// If only one operand is provided: +// * If the operand is a rank-1 tensor (an array), the result is a sorted array. +// The resulting sorting order has the property that for all index positions +// i, j with i < j, either +// comparator(value[i], value[j]) = comparator(value[j], value[i]) = false or +// comparator(value[i], value[j]) = true. +// * If the operand has higher rank, the operand is sorted along the provided +// dimension. For example, for a rank-2 tensor (a matrix), a dimension value +// of 0 will independently sort every column, and a dimension value of 1 will +// independently sort each row. If no dimension number is provided, then the +// last dimension is chosen by default. For the dimension which is sorted, the +// same sorting order applies as in the rank-1 case. +// +// If more than one operand is provided: +// * All operands must be tensors with the same dimensions. The element types of +// the tensors may be different. +// * The result is a tuple that consists of the operands in sorted order (along +// the provided dimension, as above). The same permutation as implied by the +// comparison computation is applied to all operand tensors. When comparing +// two index positions, 'comparator' is called with 2 * n scalar parameters, +// where parameter 2 * i and 2 * i + 1 correspond to the value of operand i at +// two index positions. +// Default comparator computations can be found in lib/comparators.h +XlaOp Sort(absl::Span operands, const XlaComputation& comparator, + int64_t dimension = -1, bool is_stable = false); + +// Enqueues a clamp instruction onto the computation. +XlaOp Clamp(XlaOp min, XlaOp operand, XlaOp max); + +// Enqueues a map instruction onto the computation. +XlaOp Map(XlaBuilder* builder, absl::Span operands, + const XlaComputation& computation, + absl::Span dimensions, + absl::Span static_operands = {}); + +// Enqueues a N(mu, sigma) random number generation instruction onto the +// computation. +XlaOp RngNormal(XlaOp mu, XlaOp sigma, const Shape& shape); + +// Enqueues a U(a, b) random number generation instruction onto the +// computation. Returns values in the semi-open interval [a, b). +XlaOp RngUniform(XlaOp a, XlaOp b, const Shape& shape); + +// Enqueues a B(initial_state) random bit generation instruction onto the +// computation. Returns the new key and random bits with the specified shape. +XlaOp RngBitGenerator(RandomAlgorithm algorithm, XlaOp initial_state, + const Shape& shape); + +// Enqueues a while node onto the computation. +XlaOp While(const XlaComputation& condition, const XlaComputation& body, + XlaOp init); + +// Enqueues a conditional node onto the computation. +XlaOp Conditional(XlaOp predicate, XlaOp true_operand, + const XlaComputation& true_computation, XlaOp false_operand, + const XlaComputation& false_computation); + +// Enqueues either a predicated (if/else) or indexed (switch/case/default) +// conditional node onto the computation. N >= 1 branch_computations and +// branch_operands are matched by index. branch_index selects the branch that +// will be executed. Out of range branch_index uses the N-1'th +// branch_computation as default. +XlaOp Conditional(XlaOp branch_index, + absl::Span branch_computations, + absl::Span branch_operands); + +// Enqueues a ReducePrecision node onto the computation. +XlaOp ReducePrecision(XlaOp operand, int exponent_bits, int mantissa_bits); + +// Enqueues a Gather node onto the computation. +XlaOp Gather(XlaOp input, XlaOp start_indices, + const GatherDimensionNumbers& dimension_numbers, + absl::Span slice_sizes, + bool indices_are_sorted = false); + +// Enqueues a Scatter node onto the computation. +XlaOp Scatter(XlaOp input, XlaOp scatter_indices, XlaOp updates, + const XlaComputation& update_computation, + const ScatterDimensionNumbers& dimension_numbers, + bool indices_are_sorted = false, bool unique_indices = false); +XlaOp Scatter(absl::Span inputs, XlaOp scatter_indices, + absl::Span updates, + const XlaComputation& update_computation, + const ScatterDimensionNumbers& dimension_numbers, + bool indices_are_sorted = false, bool unique_indices = false); + +// Enqueues a Send node onto the computation for device-to-device +// communication. This operation sends the given operand to +// a Recv instruction in a different computation that shares the same channel +// handle. +void Send(XlaOp operand, const ChannelHandle& handle); + +// Variant of Send which takes a token-shaped operand and produces a +// token-shaped value. Tokens are used for ordering side-effecting operations. +// TODO(b/110532604): Replace all uses of the non-token form with this variant. +XlaOp SendWithToken(XlaOp operand, XlaOp token, const ChannelHandle& handle); + +// Enqueues a Recv node onto the computation for device-to-device +// communication. The data comes from a Send instruction in a different +// computation that shares the same channel handle and its shape must be the +// same as the given shape. +XlaOp Recv(XlaBuilder* builder, const Shape& shape, + const ChannelHandle& handle); + +// Variant of Recv which takes a token-shaped operand and produces a two-element +// tuple containing the data value and a token-shaped value. Tokens are used +// for ordering side-effecting operations. +// TODO(b/110532604): Replace all uses of the non-token form with this variant. +XlaOp RecvWithToken(XlaOp token, const Shape& shape, + const ChannelHandle& handle); + +// Enqueues a Send node which transfers data from the device to the host. The +// 'shape_with_layout' argument defines the layout of the data transferred; its +// shape must be compatible with the shape of the operand. The operand must be +// array-shaped. +// TODO(b/111544877): Support tuple shapes. +XlaOp SendToHost(XlaOp operand, XlaOp token, const Shape& shape_with_layout, + const ChannelHandle& handle); + +// Enqueues a Recv node which transfers data from the host to the device. The +// given shape must contain a layout and must be an array. +// TODO(b/111544877): Support tuple shapes. +XlaOp RecvFromHost(XlaOp token, const Shape& shape, + const ChannelHandle& handle); + +// Enqueues an operation (AfterAll) with no operands that produces a +// token-shaped value. Tokens are used for ordering side-effecting operations. +// This is a separate method from AfterAll to facility the removal of +// operand-less AfterAll instructions. +// TODO(b/110532604): Remove this function when all tokens are derived from a +// single token generated or passed into the entry computation. +XlaOp CreateToken(XlaBuilder* builder); + +// Enqueues an AfterAll instruction which produces a token-shaped value and +// takes a variadic number of token-shaped operands. The number of operands must +// be greater than zero. Used for joining tokens. +XlaOp AfterAll(XlaBuilder* builder, absl::Span tokens); + +// Normalizes operand across spatial and batch dimensions for each feature. +// +// Returns a tuple (normalized, batch_mean, batch_var) where `normalized` +// is the normalized result and batch_mean and batch_var are the mean and +// variance, respectively, across batch for the operand. +XlaOp BatchNormTraining(XlaOp operand, XlaOp scale, XlaOp offset, float epsilon, + int64_t feature_index); + +// Normalizes operand across spatial and batch dimensions for each feature. +// +// `BatchNormInference` is equivalent to calling `BatchNormTraining` without +// computing `mean` and `variance` for each batch inside the operation. It +// uses the input `mean` and `variance` instead as estimated values. The +// purpose of this op is to reduce latency in inference, hence the name +// `BatchNormInference`. +// +// The output has the same shape as `operand`, and contains the normalized +// values for each batch. +XlaOp BatchNormInference(XlaOp operand, XlaOp scale, XlaOp offset, XlaOp mean, + XlaOp variance, float epsilon, int64_t feature_index); + +// Calculates the gradients of a batch norm op. +// +// The inputs `batch_mean` and `batch_var` represent the mean and variance +// across the batch. +// +// Returns a tuple of three elements: +// - grad_operand: Gradient with respect to input `operand` +// - grad_offset: Gradient with respect to input `offset` +// - grad_scale: Gradient with respect to input `scale` +XlaOp BatchNormGrad(XlaOp operand, XlaOp scale, XlaOp batch_mean, + XlaOp batch_var, XlaOp grad_output, float epsilon, + int64_t feature_index); + +// Returns the size of the given dimension of the operand. The operand must be +// array shaped. +XlaOp GetDimensionSize(XlaOp operand, int64_t dimension); + +// Sets the size of the given dimension of the operand. The operand must be +// array shaped. The result will have the same shape as the operand, but the +// given dimension will be dynamic (if not already). +XlaOp SetDimensionSize(XlaOp operand, XlaOp val, int64_t dimension); + +// Returns the same op but with dynamic dimension removed. +XlaOp RemoveDynamicDimension(XlaOp operand, int64_t dimension); + +// Implementation details below this point. +// + +// Free function template implementations. + +template +XlaOp ConstantR0(XlaBuilder* builder, NativeT value) { + return ConstantLiteral(builder, LiteralUtil::CreateR0(value)); +} + +template +XlaOp ConstantR1(XlaBuilder* builder, absl::Span values) { + BorrowingLiteral literal( + reinterpret_cast(values.begin()), + ShapeUtil::MakeShape(primitive_util::NativeToPrimitiveType(), + {static_cast(values.size())})); + return ConstantLiteral(builder, literal); +} + +template +XlaOp ConstantR1(XlaBuilder* builder, int64_t length, NativeT value) { + Literal literal(ShapeUtil::MakeShape( + primitive_util::NativeToPrimitiveType(), {length})); + literal.PopulateWithValue(value); + return ConstantLiteral(builder, literal); +} + +inline XlaOp ConstantR1(XlaBuilder* builder, const tsl::core::Bitmap& values) { + return ConstantLiteral(builder, LiteralUtil::CreateR1(values)); +} + +template +XlaOp ConstantR2(XlaBuilder* builder, + std::initializer_list> values) { + return ConstantLiteral(builder, LiteralUtil::CreateR2(values)); +} + +template +XlaOp ConstantFromArrayWithLayout(XlaBuilder* builder, + const Array& values, + const Layout& layout) { + return ConstantLiteral( + builder, LiteralUtil::CreateFromArrayWithLayout(values, layout)); +} + +template +XlaOp ConstantFromArray(XlaBuilder* builder, const Array& values) { + return ConstantLiteral(builder, + LiteralUtil::CreateFromArray(values)); +} + +template +XlaOp ConstantR2FromArray2DWithLayout(XlaBuilder* builder, + const Array2D& values, + const Layout& layout) { + return ConstantLiteral( + builder, LiteralUtil::CreateFromArrayWithLayout(values, layout)); +} + +template +XlaOp ConstantR2FromArray2D(XlaBuilder* builder, + const Array2D& values) { + return ConstantLiteral(builder, + LiteralUtil::CreateR2FromArray2D(values)); +} + +template +XlaOp ConstantR3FromArray3DWithLayout(XlaBuilder* builder, + const Array3D& values, + const Layout& layout) { + return ConstantLiteral( + builder, + LiteralUtil::CreateR3FromArray3DWithLayout(values, layout)); +} + +template +XlaOp ConstantR3FromArray3D(XlaBuilder* builder, + const Array3D& values) { + return ConstantFromArray(builder, values); +} + +template +XlaOp ConstantR4FromArray4DWithLayout(XlaBuilder* builder, + const Array4D& values, + const Layout& layout) { + return ConstantFromArrayWithLayout(builder, values, layout); +} + +template +XlaOp ConstantR4FromArray4D(XlaBuilder* builder, + const Array4D& values) { + return ConstantFromArray(builder, values); +} + +// Switches from automatic SPMD partitioning to manual partitioning. Converts a +// full-shaped tensor (to be automatically partitioned by SPMD partitioner) to a +// shard-shaped tensor to be consumed by manually partitioned ops. +StatusOr ConvertSpmdFullToShardShape( + xla::XlaBuilder* builder, xla::XlaOp input, int single_dim, + const xla::OpSharding& manual_sharding, + absl::Span unspecified_dims); + +// Switches from manual partitioning to automatic SPMD partitioning. Converts a +// shard-shaped tensor (manually partitioned in SPMD-style) to a full-shaped +// tensor to be partitioned automatically by the SPMD partitioner. +StatusOr ConvertSpmdShardToFullShape( + xla::XlaBuilder* builder, xla::XlaOp input, const xla::Shape& output_shape, + int single_dim, const xla::OpSharding& manual_sharding, + absl::Span unspecified_dims); + +} // namespace xla + +#endif // XLA_CLIENT_XLA_BUILDER_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/xla_computation.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/xla_computation.h new file mode 100644 index 0000000000000000000000000000000000000000..4f70662d79c6d9c12e2d6c625c2360bea001ea66 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/client/xla_computation.h @@ -0,0 +1,72 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_CLIENT_XLA_COMPUTATION_H_ +#define XLA_CLIENT_XLA_COMPUTATION_H_ + +#include +#include +#include + +#include "xla/service/hlo.pb.h" +#include "xla/shape.h" +#include "xla/status_macros.h" +#include "xla/xla_data.pb.h" + +namespace xla { + +// The computation graph that the user builds up with the XlaBuilder. +class XlaComputation { + public: + XlaComputation() : unique_id_(-1) {} + XlaComputation(HloModuleProto proto) + : unique_id_(proto.id()), proto_(std::move(proto)) {} + + ~XlaComputation() = default; + + XlaComputation(const XlaComputation&) = delete; + XlaComputation& operator=(const XlaComputation&) = delete; + + XlaComputation(XlaComputation&& from) = default; + + XlaComputation& operator=(XlaComputation&& from) = default; + + // Returns the "program shape" (parameter and return shapes) for this + // computation. + StatusOr GetProgramShape() const; + + const std::string& name() const { return proto().name(); } + + const HloModuleProto& proto() const { return proto_; } + HloModuleProto* mutable_proto() { return &proto_; } + + // Requests that we snapshot the computation into a serializable protocol + // buffer form. + StatusOr> Snapshot() const; + + // Returns true if this object is a null Computation. + bool IsNull() const { return unique_id_ == -1; } + + private: + XlaComputation(const int64_t unique_id) : unique_id_(unique_id) {} + friend class XlaBuilder; + + int64_t unique_id_; + HloModuleProto proto_; +}; + +} // namespace xla + +#endif // XLA_CLIENT_XLA_COMPUTATION_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/comparison_util.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/comparison_util.h new file mode 100644 index 0000000000000000000000000000000000000000..0c11edf302d464640432c43c1df2c41b80d079eb --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/comparison_util.h @@ -0,0 +1,259 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_COMPARISON_UTIL_H_ +#define XLA_COMPARISON_UTIL_H_ + +#include +#include +#include +#include +#include + +#include "absl/strings/string_view.h" +#include "xla/primitive_util.h" +#include "xla/statusor.h" +#include "xla/types.h" +#include "xla/util.h" +#include "xla/xla_data.pb.h" +#include "tsl/platform/logging.h" // IWYU pragma: keep + +namespace xla { + +// A utility class for primitive comparisons. A comparison includes three +// components: the type of the elements being compared (F32, S16, etc), whether +// it is a partial or total order comparison, and the actual comparison operator +// (==, <=, >, etc). +// +// Note that integer comparisons are always total order. Float comparisons can +// be either total or partial order. +// +// Some examples: +// +// Comparison a( +// Comparison::Direction::kLt, +// xla::PrimitiveType::BF16, +// Comparison::Order::kTotal +// ); +// a.ToString(); /* ".LT.BF16.TOTALORDER" */ +// +// Comparison b(Comparison::Direction::kEq, xla::PrimitiveType::U32); +// b.IsTotalOrder(); /* true */ +class Comparison { + public: + // Represents the ordering of the comparison. + enum class Order : uint8_t { + // https://en.wikipedia.org/wiki/Total_order + kTotal, + // https://en.wikipedia.org/wiki/Partially_ordered_set + kPartial, + }; + + // Represents different comparison operations. + enum class Direction : uint8_t { + kEq, + kNe, + kGe, + kGt, + kLe, + kLt, + }; + + // (DEPRECATED) Represents the type of comparison. Prefer xla::PrimitiveType + // and Comparison::Order, since there are multiple floating point + // representations that support total ordering. + enum class [[deprecated("Use PrimitiveType and Order")]] Type : uint8_t{ + kFloat, + kFloatTotalOrder, + kSigned, + kUnsigned, + }; + + Comparison() = delete; + + // This will default to the expected behavior for Comparison::Order: integers + // will use total ordering, and floats will use partial ordering. + explicit Comparison(Direction dir, PrimitiveType type); + + // Pass in a Comparison::Order to specify a non-default ordering, e.g., some + // targets may support total order floating point type comparisons. + explicit Comparison(Direction dir, PrimitiveType type, Order order); + + // Returns a comparison with a primitive type matching the Comparison::Type + // and using a default bit width of 32. For example, + // Comparison(Direction::kLt, Type::kFloat).PrimitiveType() /* F32 */ + [[deprecated( + "Use Comparison(Comparison::Direction, " + "PrimitiveType)")]] explicit Comparison(Direction dir, Type type); + + inline Direction GetDirection() const { return dir_; } + inline PrimitiveType GetPrimitiveType() const { return primitive_type_; } + inline Order GetOrder() const { return order_; } + + [[deprecated("Use GetPrimitiveType() and GetOrder()")]] inline Type GetType() + const { + return type_; + } + + inline bool IsEq() const { return dir_ == Direction::kEq; } + inline bool IsNe() const { return dir_ == Direction::kNe; } + inline bool IsGe() const { return dir_ == Direction::kGe; } + inline bool IsGt() const { return dir_ == Direction::kGt; } + inline bool IsLt() const { return dir_ == Direction::kLt; } + inline bool IsTotalOrder() const { return order_ == Order::kTotal; } + inline bool IsPartialOrder() const { return order_ == Order::kPartial; } + + // Returns whether this is a floating point total order comparison. + inline bool IsF32TotalOrder() const { + return primitive_type_ == PrimitiveType::F32 && IsTotalOrder(); + } + inline bool IsBf16TotalOrder() const { + return primitive_type_ == PrimitiveType::BF16 && IsTotalOrder(); + } + + // Returns whether this is a standard comparison, i.e., what you would expect + // as the industry standard on most architectures. + inline bool IsStandardF32() const { + return primitive_type_ == PrimitiveType::F32 && IsPartialOrder(); + } + inline bool IsStandardBf16() const { + return primitive_type_ == PrimitiveType::BF16 && IsPartialOrder(); + } + inline bool IsStandardS32() const { + return primitive_type_ == PrimitiveType::S32 && IsTotalOrder(); + } + inline bool IsStandardU32() const { + return primitive_type_ == PrimitiveType::U32 && IsTotalOrder(); + } + + inline bool IsIntegralPrimitiveType() const { + return primitive_util::IsIntegralType(primitive_type_); + } + inline bool IsFloatingPointPrimitiveType() const { + return primitive_util::IsFloatingPointType(primitive_type_); + } + + // Returns whether (a dir a) is always true for this comparison. + bool IsReflexive() const; + + // Returns whether (a dir a) is always false for this comparison. + bool IsAntireflexive() const; + + // Gets the converse of the given comparison direction (e.g. >= turns to <=). + // Useful when commuting operands to get constants into immediate-accepting + // positions in the ISA. + Comparison Converse() const; + + // Gets the inverse of the given comparison if it exists (e.g. >= turns to <). + // Returns optional value because not all inversions may be supported. + std::optional Inverse() const; + + // Returns a string version of this comparison, e.g., ".GT.F32.TOTALORDER" + std::string ToString(std::string prefix1 = ".", std::string prefix2 = ".", + std::string prefix3 = ".") const; + + // Returns a comparison operator: (T, T) -> bool for this Comparison's + // Direction. + template + inline std::function GetComparator() const { + switch (GetDirection()) { + case Direction::kEq: + return std::equal_to(); + case Direction::kNe: + return std::not_equal_to(); + case Direction::kGe: + return std::greater_equal(); + case Direction::kGt: + return std::greater(); + case Direction::kLe: + return std::less_equal(); + case Direction::kLt: + return std::less(); + } + } + + template + inline bool Compare(const T a, const T b) const { + DCHECK(primitive_util::IsCanonicalRepresentation(primitive_type_)); + if constexpr (is_specialized_floating_point_v) { + if (IsTotalOrder()) { + // -NaN < -Inf < -Finite < -0 < +0 < +Finite < +Inf < +NaN + // Reference: + // https://www.tensorflow.org/xla/operation_semantics#element-wise_comparison_operations + using R = SignedIntegerTypeForSizeType; + return GetComparator()(ToSignMagnitude(a), ToSignMagnitude(b)); + } + } + // Applies the comparison from this Comparison's direction and ordering. + return GetComparator()(a, b); + } + + // Returns the Comparison::Type for the given primitive type. This assumes + // that each numerical representation follows the standard behavior, e.g., + // integers are total order and floats are partial order. + [[deprecated("Use PrimitiveType and Order")]] static Comparison::Type + DefaultComparisonType(PrimitiveType type); + + private: + // The direction of the Comparison, e.g., GT. + const Direction dir_; + // The primitive type of the Comparison operands, e.g., F32. + const PrimitiveType primitive_type_; + // The ordering of the Comparison, e.g., kPartial. + const Order order_; + // The Type of the Comparison. This tries to mesh together the ordering and + // the numerical data classification. + [[deprecated]] const Type type_; +}; + +using ComparisonDirection = Comparison::Direction; +using ComparisonOrder = Comparison::Order; + +inline std::ostream& operator<<(std::ostream& os, const Comparison& cmp) { + return os << cmp.ToString(); +} + +std::string ComparisonDirectionToString(Comparison::Direction direction); +std::string ComparisonTypeToString(Comparison::Type type); +absl::string_view ComparisonPrimitiveTypeToString(PrimitiveType type); +absl::string_view ComparisonOrderToString(Comparison::Order order); + +StatusOr StringToComparisonDirection( + absl::string_view direction); +StatusOr StringToComparisonType(absl::string_view comparison); +StatusOr StringToComparisonOrder(absl::string_view order); + +// Returns a comparison function using the provided key function on each value, +// i.e. `key_fn(a) < key_fn(b)`. +template +auto LessThanByKey(KeyFn&& key_fn) { + return [=](const auto& a, const auto& b) { return key_fn(a) < key_fn(b); }; +} + +// Two comparisons are equivalent iff they have the same direction, precision, +// and ordering. +inline bool operator==(const Comparison& a, const Comparison& b) { + return a.GetDirection() == b.GetDirection() && + a.GetPrimitiveType() == b.GetPrimitiveType() && + a.GetOrder() == b.GetOrder(); +} + +inline bool operator!=(const Comparison& a, const Comparison& b) { + return !(a == b); +} + +} // namespace xla + +#endif // XLA_COMPARISON_UTIL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/cpu_function_runtime.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/cpu_function_runtime.h new file mode 100644 index 0000000000000000000000000000000000000000..99e0eaa1c578c70d0a086f64c89a3b2111cab511 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/cpu_function_runtime.h @@ -0,0 +1,224 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_CPU_FUNCTION_RUNTIME_H_ +#define XLA_CPU_FUNCTION_RUNTIME_H_ + +#include + +#include +#include + +namespace xla { +namespace cpu_function_runtime { + +struct EncodedBufferInfo { + uint64_t packed_kind_and_size = 0; + uint32_t entry_param_number = -1; + uint32_t result_param_number = -1; +}; + +// Stores information about one buffer used by an XLA:CPU compiled function. +// These buffers are used for holding inputs to the computation, outputs from +// the computation and as temporary scratch space. +class BufferInfo { + public: + // Creates a BufferInfo from a serialized encoding generated by `Encode`. + explicit constexpr BufferInfo(const EncodedBufferInfo& encoded) + : kind_(UnpackKind(encoded.packed_kind_and_size)), + size_(UnpackSize(encoded.packed_kind_and_size)), + entry_param_number_(encoded.entry_param_number), + result_param_number_(encoded.result_param_number) {} + + // Returns true if this buffer stores a constant. These never need to be + // allocated by the runtime. + bool is_constant() const { return kind() == Kind::kConstant; } + + // Returns true if this buffer stores an entry parameter. These may or may + // not need to be allocated by the runtime, depending on + // XlaCompiledCpuFunction::AllocMode. + bool is_entry_parameter() const { + return kind() == Kind::kParameter && entry_param_number_ >= 0; + } + + // Returns the entry parameter number of this buffer. + uint32_t entry_parameter_number() const { + assert(is_entry_parameter()); + return entry_param_number_; + } + + void set_result_parameter_number(uint32_t param_number) { + result_param_number_ = param_number; + } + + bool is_result_parameter() const { + // Note: the kind is not unique, e.g. could be a kTempBuffer, or a + // kParameter if it is an in-out argument. + return result_param_number_ >= 0; + } + + uint32_t result_parameter_number() const { + assert(is_result_parameter()); + return result_param_number_; + } + + // Returns true if this buffer is temporary scratch space required by the XLA + // computations. These are always allocated by the runtime. + bool is_temp_buffer() const { return kind() == Kind::kTempBuffer; } + + // Returns true if this buffer is allocated on the C stack or into registers. + // These buffers are never allocated by the runtime. + bool is_on_stack_buffer() const { return kind() == Kind::kOnStackBuffer; } + + // Returns the size for this buffer. + uint64_t size() const { return size_; } + + // Encodes this BufferInfo into two 64 bit integers that can be used to + // reconstruct the BufferInfo later using the constructor. We need this + // because we use BufferInfo in places where using protocol buffers would + // negatively impact binary size. + EncodedBufferInfo Encode() const { + static_assert(sizeof(*this) == 16, ""); + EncodedBufferInfo ret; + ret.packed_kind_and_size = Pack(kind(), size_); + ret.entry_param_number = entry_param_number_; + ret.result_param_number = result_param_number_; + return ret; + } + + bool operator==(const BufferInfo& buffer_info) const { + if (kind() != buffer_info.kind() || size() != buffer_info.size()) { + return false; + } + return !is_entry_parameter() || + entry_parameter_number() == buffer_info.entry_parameter_number(); + } + + // Factory methods: + + static BufferInfo MakeTempBuffer(uint64_t size) { + return BufferInfo(Kind::kTempBuffer, size); + } + static BufferInfo MakeConstant(uint64_t size) { + return BufferInfo(Kind::kConstant, size); + } + // Note: in-out parameters are possible by first creating an entry parameter + // and then calling set_result_parameter_number(). + static BufferInfo MakeEntryParameter(uint64_t size, + uint32_t entry_param_number) { + return BufferInfo(Kind::kParameter, size, entry_param_number); + } + // Only used in tests. Here we use kTempBuffer but it is unimportant. + static BufferInfo MakeResultParameter(uint64_t size, + uint32_t result_param_number) { + // Here we + return BufferInfo(Kind::kTempBuffer, size, /*entry_param_number=*/-1, + result_param_number); + } + static BufferInfo MakeOnStackBuffer(uint64_t size) { + return BufferInfo(Kind::kOnStackBuffer, size); + } + + private: + BufferInfo() = default; + + enum class Kind : uint64_t { + kConstant, + kTempBuffer, + kParameter, + kOnStackBuffer + }; + + Kind kind() const { return static_cast(kind_); } + + explicit BufferInfo(Kind kind, uint64_t size) + : BufferInfo(kind, size, + /*entry_param_number=*/-1, + /*result_param_number=*/-1) {} + explicit BufferInfo(Kind kind, uint64_t size, uint32_t entry_param_number) + : BufferInfo(kind, size, entry_param_number, + /*result_param_number=*/-1) {} + explicit BufferInfo(Kind kind, uint64_t size, uint32_t entry_param_number, + uint32_t result_param_number) + : kind_(kind), + size_(size), + entry_param_number_(entry_param_number), + result_param_number_(result_param_number) {} + + static uint64_t Pack(Kind kind, uint64_t size) { + return (static_cast(size) << 2) | static_cast(kind); + } + + static inline constexpr Kind UnpackKind(uint64_t packed) { + return static_cast((packed << 62) >> 62); + } + + static inline constexpr uint64_t UnpackSize(uint64_t packed) { + return packed >> 2; + } + + Kind kind_ : 2; + uint64_t size_ : 62; + int32_t entry_param_number_ = -1; + int32_t result_param_number_ = -1; +}; + +// Align to 64-bytes, to mimic tsl::Allocator::kAllocatorAlignment. +inline constexpr size_t Align() { return 64; } + +// The minimum alignment of buffers passed to XLA:CPU. +inline constexpr size_t MinAlign() { return 16; } + +// When declaring variables that will be passed to an XLA instance as input via +// set_arg_data(), be it a regular input or a resource variable in the graph, +// the C++ variables must be aligned. +// +// Example usage: +// XLA_ALIGN std::array arg_x; +// XLA_ALIGN float arg_y; +// xla_instance.set_arg_data(0, arg_x.date()); +// xla_instance.set_arg_data(0, &arg_y); +#define XLA_ALIGN alignas(xla::cpu_function_runtime::Align()) + +// AlignedBufferBytes returns the sum of the size of each buffer in +// `buffer_infos`, skipping constants, on-stack buffers and, if +// allocate_entry_params is false, entry parameters. There are `n` entries in +// `buffer_infos`. Each buffer is aligned to Align() byte boundaries. +size_t AlignedBufferBytes(const BufferInfo* buffer_infos, size_t n, + bool allocate_entry_params); + +// MallocContiguousBuffers allocates buffers for use by the entry point +// generated by tfcompile. There are `n` entries in `buffer_infos`. If +// `annotate_initialized` is set, the allocated memory will be annotated as +// having been initialized - this is useful when allocating temporary buffers. +// If allocate_entry_params is true then allocates temp buffers and entry +// parameters, otherwise allocated only temp buffers. Slots in `bufs` +// corresponding to unallocated buffers are set to nullptr. +// +// A single contiguous block of memory is allocated, and portions of it are +// parceled out into `bufs`, which must have space for `n` entries. Returns +// the head of the allocated contiguous block, which should be passed to +// FreeContiguous when the buffers are no longer in use. +void* MallocContiguousBuffers(const BufferInfo* buffer_infos, size_t n, + bool allocate_entry_params, void** bufs, + bool annotate_initialized); + +// FreeContiguous frees the contiguous block of memory allocated by +// MallocContiguousBuffers. +void FreeContiguous(void* contiguous); +} // namespace cpu_function_runtime +} // namespace xla + +#endif // XLA_CPU_FUNCTION_RUNTIME_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/debug_options_flags.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/debug_options_flags.h new file mode 100644 index 0000000000000000000000000000000000000000..6ec89d7746e058a811c1b42b8ac3d3a33052eead --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/debug_options_flags.h @@ -0,0 +1,108 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_DEBUG_OPTIONS_FLAGS_H_ +#define XLA_DEBUG_OPTIONS_FLAGS_H_ + +#include + +#include "absl/strings/string_view.h" +#include "xla/xla.pb.h" +#include "tsl/platform/logging.h" +#include "tsl/util/command_line_flags.h" + +namespace xla { + +// Construct flags which write to the debug_options proto when parsed. Existing +// contents of debug_options is used as the default. Can be called multiple +// times. +void MakeDebugOptionsFlags(std::vector* flag_list, + DebugOptions* debug_options); + +// Appends flag definitions for debug options to flag_list. Existing +// contents of debug_options is used as the default. If debug_options is null, +// uses global defaults. Modifies global state on first call. +void AppendDebugOptionsFlags(std::vector* flag_list, + DebugOptions* debug_options = nullptr); + +// Fetches a DebugOptions proto message from flags provided to the program. +// Flags must be registered with the flags parser using AppendDebugOptionsFlags +// first. +DebugOptions GetDebugOptionsFromFlags(); + +// Gets a DebugOptions proto that reflects the defaults as if no flags were set. +DebugOptions DefaultDebugOptionsIgnoringFlags(); + +// Consumes a unit of "compiler fuel" for the given pass, and returns false if +// we're out of fuel for that pass. +// +// Compiler fuel is a debugging tool useful for bisecting compiler passes. Each +// time a pass "does something", it consumes a unit of fuel, and once it's out +// of fuel, it stops doing any transformations. This way if you suspect a pass +// has a bug, you can bisect the amount of fuel it gets and find exactly which +// change causes the problem. +// +// The very first time a pass runs out of fuel, `just_ran_out` is set to true. +// This lets you take action (e.g. log a message). But see also the convenience +// overload below. +// +// By default all passes have infinite fuel. You can restrict how much fuel a +// pass has by specifying XLA_FLAGS=--xla_fuel=PASS1=NUM1,PASS2=NUM2,... +// +// If a user specifies --xla_fuel=PASS=NUM but ConsumeFuel(PASS) is not called +// before the program exits, we'll print a warning. +// +// We recommend as a convention you use a pass's name for the `pass` argument, +// but any value is accepted. +bool ConsumeFuel(absl::string_view pass, bool* just_ran_out = nullptr); + +// Overload of ConsumeFuel that lets you pass in a functor which generates a log +// message when we first run out of fuel for a pass. This is useful because +// you're usually interested in what *would have* happened right when we ran out +// of fuel. +// +// Example usage: +// +// if (ConsumeFuel("pass-name", [&] { return "Not fooing bar."; })) { +// return; +// } +// +template +bool ConsumeFuel(absl::string_view pass, + const MsgGenerator& ran_out_of_fuel_msg) { + bool just_ran_out = false; + bool ret = ConsumeFuel(pass, &just_ran_out); + if (just_ran_out) { + LOG(ERROR) << "Out of fuel for \"" << pass + << "\": " << ran_out_of_fuel_msg(); + } + return ret; +} + +// By default compiler fuel is global; if you run two compiler threads, they +// will consume from the same fuel pool. +// +// Calling this function changes the behavior of fuel for the current thread: +// From this point onward, it will use a private fuel pool. The thread-local +// fuel pool is initialized to the values the global fuel pool had at process +// startup. +// +// You may call this function twice in the same thread to reset its fuel pool +// back to the initial state. +void ResetThreadLocalFuel(); + +} // namespace xla + +#endif // XLA_DEBUG_OPTIONS_FLAGS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/debug_options_parsers.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/debug_options_parsers.h new file mode 100644 index 0000000000000000000000000000000000000000..0350acccff3f34af05fee1db32b1c0f797d39c37 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/debug_options_parsers.h @@ -0,0 +1,52 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_DEBUG_OPTIONS_PARSERS_H_ +#define XLA_DEBUG_OPTIONS_PARSERS_H_ + +#include +#include + +#include "absl/strings/numbers.h" +#include "absl/strings/str_split.h" +#include "xla/xla.pb.h" + +namespace xla { + +template +void parse_xla_backend_extra_options(T* extra_options_map, + std::string comma_separated_values) { + std::vector extra_options_parts = + absl::StrSplit(comma_separated_values, ','); + + // The flag contains a comma-separated list of options; some options + // have arguments following "=", some don't. + for (const auto& part : extra_options_parts) { + size_t eq_pos = part.find_first_of('='); + if (eq_pos == std::string::npos) { + (*extra_options_map)[part] = ""; + } else { + std::string value = ""; + if (eq_pos + 1 < part.size()) { + value = part.substr(eq_pos + 1); + } + (*extra_options_map)[part.substr(0, eq_pos)] = value; + } + } +} + +} // namespace xla + +#endif // XLA_DEBUG_OPTIONS_PARSERS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/error_spec.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/error_spec.h new file mode 100644 index 0000000000000000000000000000000000000000..cde904940ecec08388ad48e93a6ef101ea74e99d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/error_spec.h @@ -0,0 +1,54 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_ERROR_SPEC_H_ +#define XLA_ERROR_SPEC_H_ + +namespace xla { + +// Structure describing permissible absolute and relative error bounds. +struct ErrorSpec { + explicit ErrorSpec(float aabs, float arel = 0, bool relaxed_nans = false) + : abs(aabs), rel(arel), relaxed_nans(relaxed_nans) {} + + float abs; // Absolute error bound. + float rel; // Relative error bound. + + // If relaxed_nans is true then any result is valid if we are expecting NaNs. + // In effect, this allows the tested operation to produce incorrect results + // for inputs outside its mathematical domain. + bool relaxed_nans; + + // If true, then we don't check for bitwise equality of NaNs. All NaNs are + // considered equivalent. + bool all_nans_are_equivalent = true; + + // If this is true, then we treat each +/-inf in the actual result as + // equivalent to our choice of either +/-inf or the min/max floating-point + // value. + // + // If the expected result is +/-inf, the actual result must still be +/-inf. + // + // In effect, this allows the tested operation to overflow, so long as it's + // overflowing on "large" values. + // + // (We could have a symmetric more_infs_ok flag if necessary; right now it + // appears not to be.) + bool fewer_infs_ok = false; +}; + +} // namespace xla + +#endif // XLA_ERROR_SPEC_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/executable_run_options.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/executable_run_options.h new file mode 100644 index 0000000000000000000000000000000000000000..31ba23bf3b7a141aa85e540dd84b70f1c5e77627 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/executable_run_options.h @@ -0,0 +1,239 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_EXECUTABLE_RUN_OPTIONS_H_ +#define XLA_EXECUTABLE_RUN_OPTIONS_H_ + +#include +#include +#include +#include + +#include "absl/container/flat_hash_map.h" +#include "absl/status/statusor.h" + +// These classes are forward declared so that ExecutableRunOptions can be linked +// into an XLA-compiled binary without having to link all of the pointed-to +// objects (e.g., for an ahead-of-time compiled CPU binary, the gpu tools don't +// need to be linked). +namespace stream_executor { +class Stream; +class Event; +class Platform; +class DeviceMemoryAllocator; +class DeviceMemoryBase; +} // namespace stream_executor + +namespace Eigen { +struct ThreadPoolDevice; +} // namespace Eigen + +namespace tsl { +template +class AsyncValueRef; +} // namespace tsl + +namespace xla { + +class DeviceAssignment; +class ExecutionProfile; +class Shape; + +namespace gpu { +class GpuExecutableRunOptions; +} // namespace gpu + +// A unique identifier for a particular "logical execution" of an XLA model. +// +// A logical execution might encompass multiple executions of one or more +// HloModules. Runs that are part of the same logical execution can +// communicate via collective ops (e.g. kAllToAll), whereas runs that are part +// of different logical executions are isolated. +class RunId { + public: + // Creates a new, unique RunId. + RunId(); + explicit RunId(int64_t value) : data_(value) {} + + RunId(const RunId&) = default; + RunId& operator=(const RunId&) = default; + friend bool operator==(const RunId& a, const RunId& b); + std::string ToString() const; + int64_t ToInt() const; + + template + friend H AbslHashValue(H h, const RunId& id) { + return H::combine(std::move(h), id.data_); + } + + private: + int64_t data_; +}; + +// Callback used by the GPU backend only. This is an "one-sided" version of +// ThenDoHostCallback that enqueues a callback onto a stream. The difference +// with ThenDoHostCallback is that the device does not block waiting for the +// callback to complete; instead the callback is scheduled by the runtime. +// This functionality must be provided by the caller, and hence is provided in +// callback form. +using ThenExecuteFunction = + std::function)>; + +// Callback for sending device buffer to a channel. Returned event will be +// recorded on a `stream` once the send operation is completed and data was +// copied from the `src` memory. `frontend_attrs` contains frontend specific +// attributes for the send. +using SendDeviceMemoryFunction = + std::function>( + int64_t channel_id, stream_executor::Stream* stream, const Shape& shape, + const stream_executor::DeviceMemoryBase& src, + const absl::flat_hash_map& frontend_attrs)>; + +// Callback for receiving device buffer from a channel. Returned event will be +// recorded on a `stream` once the recv operation is completed and data was +// copied into the `dst` memory. `frontend_attrs` contains frontend specific +// attributes for the receive. +using RecvDeviceMemoryFunction = + std::function>( + int64_t channel_id, stream_executor::Stream* stream, const Shape& shape, + stream_executor::DeviceMemoryBase* dst, + const absl::flat_hash_map& frontend_attrs)>; + +// Class containing options for running a LocalExecutable. +class ExecutableRunOptions { + public: + // Specifies the allocator to use during execution. + ExecutableRunOptions& set_allocator( + stream_executor::DeviceMemoryAllocator* allocator); + stream_executor::DeviceMemoryAllocator* allocator() const; + + // If set, this is the device to run the computation on. Valid device_ordinal + // values are: 0 to # of devices - 1. These values are identical to the device + // ordinal values used by StreamExecutor. The device must be of the same type + // as the executable was compiled for. A value of -1 indicates this option has + // not been set. + ExecutableRunOptions& set_device_ordinal(int device_ordinal); + int device_ordinal() const; + + // If set, this is the stream to run the computation on. The platform of the + // stream must match the platform the executable was built for. A value of + // nullptr indicates the option has not been set. + ExecutableRunOptions& set_stream(stream_executor::Stream* stream); + stream_executor::Stream* stream() const; + + // If set, this is the stream to perform host to device transfers on (e.g. any + // pre-computation transfers). The platform of the stream must match the + // platform the executable was built for. A value of nullptr indicates the + // option has not been set. + ExecutableRunOptions& set_host_to_device_stream( + stream_executor::Stream* stream); + stream_executor::Stream* host_to_device_stream() const; + + // If set, this is the stream to perform device to host transfers on. + // The platform of the stream must match the platform the executable was + // built for. A value of nullptr indicates the option has not been set. + ExecutableRunOptions& set_device_to_host_stream( + stream_executor::Stream* stream); + stream_executor::Stream* device_to_host_stream() const; + + // Sets the thread pool device on which to run Eigen subcomputations. + // + // This field must be set for XLA:CPU models that call Eigen routines, but may + // be null otherwise. Routines that use this field should always CHECK (or + // TF_RET_CHECK) that it's not null before dereferencing it, so that users get + // a clean crash rather than a segfault. + // + // Does not take ownership. + ExecutableRunOptions& set_intra_op_thread_pool( + const Eigen::ThreadPoolDevice* intra_op_thread_pool); + const Eigen::ThreadPoolDevice* intra_op_thread_pool() const; + + // If set, profiling information is written to 'profile'. + ExecutionProfile* execution_profile() const; + ExecutableRunOptions& set_execution_profile(ExecutionProfile* profile); + + ExecutableRunOptions& set_device_assignment( + const DeviceAssignment* device_assignment); + const DeviceAssignment* device_assignment() const; + + ExecutableRunOptions& set_rng_seed(int rng_seed); + int rng_seed() const; + + ExecutableRunOptions& set_launch_id(int32_t launch_id) { + launch_id_ = launch_id; + return *this; + } + + int32_t launch_id() const { return launch_id_; } + + ExecutableRunOptions& set_run_id(RunId id); + RunId run_id() const; + + // See documentation on ThenExecuteFunction. + ExecutableRunOptions& set_then_execute_function(ThenExecuteFunction* f) { + then_execute_function_ = f; + return *this; + } + ThenExecuteFunction* then_execute_function() const { + return then_execute_function_; + } + + // See documentation on SendDeviceMemoryFunction. + ExecutableRunOptions& set_send_device_memory_function( + SendDeviceMemoryFunction* f) { + send_device_memory_function_ = f; + return *this; + } + SendDeviceMemoryFunction* send_device_memory_function() const { + return send_device_memory_function_; + } + + // See documentation on RecvDeviceMemoryFunction. + ExecutableRunOptions& set_recv_device_memory_function( + RecvDeviceMemoryFunction* f) { + recv_device_memory_function_ = f; + return *this; + } + RecvDeviceMemoryFunction* recv_device_memory_function() const { + return recv_device_memory_function_; + } + + // GPU-backend specific options. These are kept out-of-line to avoid bloating + // the size of this dependency for CPU-only AOT builds. + ExecutableRunOptions& set_gpu_executable_run_options( + const gpu::GpuExecutableRunOptions* gpu_executable_run_options); + const gpu::GpuExecutableRunOptions* gpu_executable_run_options() const; + + private: + stream_executor::DeviceMemoryAllocator* allocator_ = nullptr; + int device_ordinal_ = -1; + const DeviceAssignment* device_assignment_ = nullptr; + stream_executor::Stream* stream_ = nullptr; + const Eigen::ThreadPoolDevice* intra_op_thread_pool_ = nullptr; + ExecutionProfile* execution_profile_ = nullptr; + int rng_seed_ = 0; + int32_t launch_id_ = 0; + stream_executor::Stream* device_to_host_stream_ = nullptr; + stream_executor::Stream* host_to_device_stream_ = nullptr; + ThenExecuteFunction* then_execute_function_ = nullptr; + SendDeviceMemoryFunction* send_device_memory_function_ = nullptr; + RecvDeviceMemoryFunction* recv_device_memory_function_ = nullptr; + RunId run_id_; + const gpu::GpuExecutableRunOptions* gpu_executable_run_options_ = nullptr; +}; + +} // namespace xla + +#endif // XLA_EXECUTABLE_RUN_OPTIONS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/execution_options_util.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/execution_options_util.h new file mode 100644 index 0000000000000000000000000000000000000000..2a69fa2aab2ec5d7f51876bcd433e98c9e2e879e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/execution_options_util.h @@ -0,0 +1,29 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_EXECUTION_OPTIONS_UTIL_H_ +#define XLA_EXECUTION_OPTIONS_UTIL_H_ + +#include "xla/xla.pb.h" + +namespace xla { + +// Create a default ExecutionOptions proto; this proto has its debug options +// populated to the default values taken from flags. +ExecutionOptions CreateDefaultExecutionOptions(); + +} // namespace xla + +#endif // XLA_EXECUTION_OPTIONS_UTIL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/frontend_attributes.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/frontend_attributes.h new file mode 100644 index 0000000000000000000000000000000000000000..de2643beeebb514b5bbaddb9c7d25951c0d6a0c7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/frontend_attributes.h @@ -0,0 +1,38 @@ +#ifndef XLA_FRONTEND_ATTRIBUTES_H_ +#define XLA_FRONTEND_ATTRIBUTES_H_ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ +#include + +#include "xla/hlo/ir/hlo_instruction.h" + +namespace xla { + +// Attribute which indicates that an in-place instruction has disjoint read +// and write regions w.r.t aliased input/output buffers. +inline constexpr char kXlaDisjointReadWriteRegions[] = + "_xla_disjoint_read_write_regions"; + +// Set frontend attribute on 'instruction' which indices that in-place +// 'instruction' has disjoint read/write buffer regions. +void SetDisjointReadWriteRegionsAttr(HloInstruction* instruction); + +// Returns 'true' if in-place 'instruction' has the kXlaDisjointReadWriteRegions +// frontend attribute set (returns false otherwise). +bool HasDisjointReadWriteRegionsAttr(HloInstruction* instruction); + +} // namespace xla + +#endif // XLA_FRONTEND_ATTRIBUTES_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/evaluator/hlo_evaluator.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/evaluator/hlo_evaluator.h new file mode 100644 index 0000000000000000000000000000000000000000..f2095fa1d756c1a87be0140e7d8d5f9d9f8ef5d0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/evaluator/hlo_evaluator.h @@ -0,0 +1,485 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_HLO_EVALUATOR_HLO_EVALUATOR_H_ +#define XLA_HLO_EVALUATOR_HLO_EVALUATOR_H_ + +#define _USE_MATH_DEFINES + +#include +#include +#include + +#include "absl/container/flat_hash_map.h" +#include "absl/container/node_hash_map.h" +#include "absl/types/span.h" +#include "xla/array2d.h" +#include "xla/hlo/ir/dfs_hlo_visitor_with_default.h" +#include "xla/hlo/ir/hlo_computation.h" +#include "xla/hlo/ir/hlo_instruction.h" +#include "xla/hlo/ir/hlo_module.h" +#include "xla/literal.h" +#include "xla/literal_util.h" +#include "xla/service/call_graph.h" +#include "xla/service/dynamic_dimension_inference.h" +#include "xla/service/shape_inference.h" +#include "xla/service/tuple_points_to_analysis.h" +#include "xla/shape_util.h" +#include "xla/statusor.h" +#include "xla/util.h" +#include "xla/xla_data.pb.h" + +namespace xla { + +// Represents a parsed static while loop. We normalize the loop representation +// so that it starts from the induction_var_init_value and increments by +// step_size until it exceeds or goes below loop_bound. +struct ParsedStaticWhileLoop { + // The number of iterations to be executed. + int64_t trip_count = -1; + // The tuple index of the induction variable in the while argument tuple. + int64_t induction_var_index = -1; + // The induction variable's initial value. + int64_t induction_var_init_value = -1; + // The induction variable is incremented by this number (could be negative) + // in each iteration. + int64_t step_size = -1; + int64_t loop_bound = -1; +}; + +// Indicates whether a parsed while loop is static or dynamic. If the loop is +// static, it contains a value for StaticLoopInfo; otherwise the loop is +// dynamic. We consider a loop dynamic if its induction variable's initial +// value or the loop bound's value depends on the while's parent computation's +// parameter. +struct ParsedWhileLoop { + std::optional static_while_loop; + bool is_dynamic() const { return !static_while_loop.has_value(); } +}; +constexpr ParsedWhileLoop kParsedDynamicWhileLoop = ParsedWhileLoop(); + +// Tries to parse a while loop using a set of predefined patterns. +// Returns the parsing result. +std::optional PatternMatchParseWhileLoop( + const HloInstruction* while_op); + +// Responsible for evaluating HLO and obtain literal as the evaluation results. +// +// This class is not thread-safe. +class HloEvaluator : public ConstDfsHloVisitorWithDefault { + public: + // Only evaluate up to max_loop_iterations per while-loop execution if + // specified. + explicit HloEvaluator(int64_t max_loop_iterations = -1); + + // Called by the evaluator to create an embedded evaluator to execute a + // sub-region of control flow. Subclasses should override this to return an + // instance of the subclass instead. + virtual std::unique_ptr CreateEmbedded( + int64_t max_loop_iterations) { + return std::make_unique(max_loop_iterations); + } + + // Enables subclasses to be notified when a new computation is being + // evaluated. + virtual void OnEvaluateComputation(const HloComputation& computation) {} + + // Evaluates an HLO module and an array of pointers to literals. Returns the + // evaluated result as a literal if successful. + // + // Precondition: The indices of arg_literals correspond to the parameter + // numbers of the HLO parameters in the computation. See comment below for an + // example. + // + // (Dummy template arg is to reduce the overloading priority of one overload + // so that Evaluate(module, {}) resolves unambiguously.) + StatusOr Evaluate(const HloModule& module, + absl::Span arg_literals) { + return Evaluate(*module.entry_computation(), arg_literals); + } + template + StatusOr Evaluate(const HloModule& module, + absl::Span arg_literals) { + return Evaluate(*module.entry_computation(), arg_literals); + } + + // Evaluates an HLO computation and an array of pointers to literals. + // Returns the evaluated result as a literal if successful. + // Precondition: The indices of arg_literals correspond to the parameter + // numbers of the HLO parameters in the computation. For e.g., consider the + // following graph: + // + // * + // / \ + // + Parameter1 + // / \ + // / \ + // Parameter0 Constant + // + // where Parameter0 has parameter_number 0 and Parameter1 has parameter_number + // 1 in this computation. The input literals array will then have its first + // literal map to Parameter0 and the second map to Parameter1. + // + // (Dummy template arg is to reduce the overloading priority of one overload + // so that Evaluate(module, {}) resolves unambiguously.) + StatusOr Evaluate(const HloComputation& computation, + absl::Span arg_literals); + template + StatusOr Evaluate(const HloComputation& computation, + absl::Span arg_literals) { + std::vector arg_literal_ptrs; + for (const auto& l : arg_literals) { + arg_literal_ptrs.push_back(&l); + } + return Evaluate(computation, arg_literal_ptrs); + } + + // Gets the value of running a single HLO instruction. + // + // This function may recursively evaluate the dependency of this instruction + // within its parent computation until it encounters something that cannot be + // evaluated, such as an Infeed or a Parameter instruction. + // It makes best effort to partially evaluate a dependency if possible. + StatusOr Evaluate( + const HloInstruction* instruction, + bool recursively_evaluate_nonconstant_operands = false); + + // Same as Evaluate, except returning false on error and accepts an output + // pointer. + bool TryEvaluate(const HloInstruction* instruction, Literal* result, + bool recursively_evaluate_nonconstant_operands = false); + + // Evaluates a single HLO instruction, substituting the given literals for + // some of the instruction's operands. + // + // For example, given instruction = op(A, B, C) and the map + // {A = x, C = y}, this evaluates op(x, B, y). + StatusOr EvaluateWithSubstitutions( + const HloInstruction* instruction, + const absl::flat_hash_map& + substitutions); + + StatusOr EvaluateElementwiseBinaryOp(HloOpcode opcode, + const Literal& lhs, + const Literal& rhs); + + StatusOr EvaluateElementwiseUnaryOp(HloOpcode opcode, + const Literal& operand); + + StatusOr EvaluateElementwiseTernaryOp(HloOpcode opcode, + const Literal& lhs, + const Literal& rhs, + const Literal& ehs); + + StatusOr EvaluateElementwiseCompareOp(ComparisonDirection direction, + const Literal& lhs, + const Literal& rhs); + + StatusOr EvaluateDotOp(const DotDimensionNumbers& dim_numbers, + const PrecisionConfig& precision_config, + const Literal& lhs, const Literal& rhs); + + void set_dynamic_dimension_inference( + DynamicDimensionInference* dynamic_dimension_inference) { + dynamic_dimension_inference_ = dynamic_dimension_inference; + } + + DynamicDimensionInference* dynamic_dimension_inference() { + return dynamic_dimension_inference_; + } + + // Enable the fast path for certain operations like dot or convolution. + void set_use_fast_path(bool value) { use_fast_path_ = value; } + + // Handles evaluation of a custom-call op. + // Operand literals are provided in |operands| and implementations must + // populate |output| before returning. + using CustomCallHandler = std::function( + const HloInstruction* custom_call, absl::Span operands)>; + + // Sets a handler that is called during evaluation for custom-call ops. + // If no handler is defined the default error behavior will occur. The handler + // will be provided evaluated literals for all operands and is expected to + // return an output literal of the appropriate shape. + void set_custom_call_handler(CustomCallHandler handler) { + custom_call_handler_ = std::move(handler); + } + + // Returns the result of a matrix multiply `lhs x rhs`. + static std::unique_ptr> MatmulArray2D( + const Array2D& lhs, const Array2D& rhs); + static std::unique_ptr> MatmulArray2D( + const Array2D& lhs, const Array2D& rhs); + static std::unique_ptr> MatmulArray2D( + const Array2D& lhs, const Array2D& rhs); + static std::unique_ptr>> MatmulArray2D( + const Array2D>& lhs, + const Array2D>& rhs); + static std::unique_ptr>> MatmulArray2D( + const Array2D>& lhs, + const Array2D>& rhs); + static std::unique_ptr> MatmulArray2D( + const Array2D& lhs, const Array2D& rhs); + + protected: + // Evaluates the given instruction, and stores the evaluation result in the + // evaluated_ map. + // When a non-empty shape_index is given, the instruction may be partially + // evaluated at the given shape_index and the rest of the result could be + // marked as undetermined unless it has been previously evaluated using + // EvaluateInternal. Such partial evaluation reduces the computation and + // memory overhead in cases where we need only one tuple element by avoiding + // the evaluation of a full tuple. + Status EvaluateInternal( + const HloInstruction* instruction, const ShapeIndex& shape_index = {}, + bool recursively_evaluate_nonconstant_operands = false); + + Status EvaluateParameterFromCallerArgument(const HloInstruction* parameter, + const ShapeIndex& shape_index); + + // Helper method to extract a list of int64_t from evaluated instruction for + // start_indices for DynamicSlice and DynamicUpdateSlice. + std::vector GetS64Indices( + absl::Span start_indices); + + // Creates a vector of multipliers which can be used to create a linear index + // into shape. + // + // Given the multidimensional index {i1, ..., iN} and + // M = MakeDimMultipliers(shape), the corresponding linear index LI is simply + // + // LI = i1 * M[1] + i2 * M[2] + ... + iN * M[N]. + // + // This lets you calculate LI given the multidimensional indices in any order. + static DimensionVector MakeDimMultipliers(const Shape& shape); + + // Make HloEvaluatorTypedVisitor a friend because it is logically part of this + // class. + // + // A straightforward implementation would be to make it a nested class + // declared and defined in hlo_evaluator.cc. Instead HloEvaluatorTypedVisitor + // lives as a separate class with its own header because its template gets + // instantiated many times and we want to use extern templates to shard out + // the compilation of those instantiations across multiple cc files. + template + friend class HloEvaluatorTypedVisitor; + + // Wraps around instruction handling to infer types before dispatching to + // the corresponding typed Visitor. + Status DefaultAction(const HloInstruction* hlo) override { + return hlo->Visit(typed_visitors_[hlo->shape().element_type()].get()); + } + + Status Preprocess(const HloInstruction* hlo) override; + Status Postprocess(const HloInstruction* hlo) override; + + // Operations that are type-agnostic or always return a specific type, such as + // HandleIsFinite where boolean is always returned. + // + Status HandleBitcast(const HloInstruction* bitcast) override; + Status HandleBitcastConvert(const HloInstruction* convert) override; + Status HandleGetDimensionSize( + const HloInstruction* get_dimension_size) override; + Status HandleSetDimensionSize( + const HloInstruction* set_dimension_size) override; + Status HandleParameter(const HloInstruction* parameter) override; + Status HandleInfeed(const HloInstruction* infeed) override; + Status HandleConstant(const HloInstruction* constant) override; + Status HandleConcatenate(const HloInstruction* concatenate) override; + Status HandleReshape(const HloInstruction* reshape) override; + Status HandleTranspose(const HloInstruction* transpose) override; + Status HandleIsFinite(const HloInstruction* is_finite) override; + Status HandleCompare(const HloInstruction* compare) override; + Status HandleTuple(const HloInstruction* tuple) override; + Status HandleFft(const HloInstruction* fft) override; + Status HandleGather(const HloInstruction* gather) override; + Status HandleScatter(const HloInstruction* hlo) override; + Status HandleGetTupleElement( + const HloInstruction* get_tuple_element) override; + Status HandleAsyncStart(const HloInstruction* async_start) override; + Status HandleAsyncUpdate(const HloInstruction* async_update) override; + Status HandleAsyncDone(const HloInstruction* async_done) override; + Status HandleCopy(const HloInstruction* copy) override; + Status HandleCopyStart(const HloInstruction* copy_start) override; + Status HandleCopyDone(const HloInstruction* copy_done) override; + Status HandleConditional(const HloInstruction* conditional) override; + Status HandleConvert(const HloInstruction* convert) override; + Status HandleCall(const HloInstruction* call) override; + Status HandleDynamicSlice(const HloInstruction* dynamic_slice) override; + Status HandleDynamicUpdateSlice(const HloInstruction* dus) override; + Status HandleFusion(const HloInstruction* fusion) override; + Status HandleWhile(const HloInstruction* while_hlo) override; + Status HandleSelect(const HloInstruction* select) override; + Status HandleBroadcast(const HloInstruction* broadcast) override; + Status HandleAfterAll(const HloInstruction* after_all) override; + Status HandleAddDependency(const HloInstruction* add_dependency) override; + Status HandleReverse(const HloInstruction* reverse) override; + Status HandleSelectAndScatter( + const HloInstruction* select_and_scatter) override; + Status HandleSlice(const HloInstruction* slice) override; + Status HandleSort(const HloInstruction* sort) override; + Status HandleStochasticConvert( + const HloInstruction* stochastic_convert) override; + Status HandleReal(const HloInstruction* real) override; + Status HandleImag(const HloInstruction* imag) override; + Status HandleComplex(const HloInstruction* complex) override; + Status HandleReduce(const HloInstruction* hlo) override; + Status HandleReduceWindow(const HloInstruction* hlo) override; + Status HandleMap(const HloInstruction* map) override; + Status HandleCustomCall(const HloInstruction* custom_call) override; + + // Unsupported HLOs, note some of them (such as BatchNorm*) are typically + // expanded in a semantic-preserving way into other HLOs by adding expansion + // HLO pass to the HLO optimization pass during compilation, which can then be + // handled by the evaluator. + Status HandleBatchNormGrad(const HloInstruction* batch_norm_grad) override { + return Unimplemented("BatchNormGrad HLO is unsupported by the evaluator."); + } + Status HandleBatchNormInference( + const HloInstruction* batch_norm_inference) override { + return Unimplemented( + "BatchNormInference HLO is unsupported by the evaluator."); + } + Status HandleBatchNormTraining( + const HloInstruction* batch_norm_training) override { + return Unimplemented( + "BatchNormTraining HLO is unsupported by the evaluator."); + } + Status HandleOutfeed(const HloInstruction* outfeed) override { + return Unimplemented("Outfeed HLO is unsupported by the evaluator."); + } + + // Returns the already-evaluated literal result for the instruction. + // + // A Constant instruction is considered evaluated and its literal will be + // returned directly without looking up the cache. + // + // Similarly, a Parameter instruction is considered evaluated and its literal + // is looked up in arg_literals. + // + // Crash with log if the given instruction has not been evaluated previously. + const Literal& GetEvaluatedLiteralFor(const HloInstruction* hlo) { + if (hlo->IsConstant()) { + return hlo->literal(); + } + if (hlo->opcode() == HloOpcode::kParameter && !arg_literals_.empty()) { + return *arg_literals_.at(hlo->parameter_number()); + } + + auto it = evaluated_.find(hlo); + CHECK(it != evaluated_.end()) + << "could not find evaluated value for: " << hlo->ToString(); + return it->second; + } + + // Returns true if the given hlo has been evaluated and cached. + bool IsAlreadyEvaluated(const HloInstruction* hlo, + const ShapeIndex& shape_index = {}) { + if (hlo->IsConstant()) { + return true; + } + if (hlo->opcode() == HloOpcode::kParameter && !arg_literals_.empty()) { + return true; + } + auto it = evaluated_.find(hlo); + if (it == evaluated_.end()) { + return false; + } + // We may evaluate some elements of a tuple-shaped instruction and mark + // the other elements as undetermined. This way we avoid the computation + // and memory overhead of evaluating a large tuple when only some elements + // are needed. By marking the other elements undetermined, we allow the + // evaluator to update the cached tuple literal when more elements are + // evaluated. + return it->second.IsDetermined(shape_index); + } + + // Tracks the HLO instruction and its evaluated literal result. + // + // Parameters and constants aren't stored here, see implementation of + // GetEvaluatedLiteralFor. + // + // TODO(b/35950897): have better memory management here to free instructions + // that are no longer a parent for any other subsequent instruction in + // post-ordering. + // + // Must be cleared for each evaluation. + // + // Storing Literal in place requires the container to have pointer stability + // so we cannot use flat_hash_map any more. + absl::node_hash_map evaluated_; + // Set by EvaluateInternal and opportunitiscally used by the HandleXXX + // functions. When non-empty, the HandleXXX function may evaluate the + // instruction at only the given shape index. + ShapeIndex visitor_shape_index_; + bool enable_partial_evaluation_ = false; + + std::unique_ptr call_graph_cache_; + std::unique_ptr tuple_points_to_analysis_cache_; + + // Use fast path that uses eigen in the evaluator. + bool use_fast_path_ = false; + + private: + template + static StatusOr ElementWiseUnaryOpImpl( + const HloInstruction* instruction, + const std::function& unary_op, + const Literal& operand_literal) { + const Shape& shape = instruction->shape(); + const auto* operand = instruction->operand(0); + TF_RET_CHECK(ShapeUtil::SameDimensions(shape, operand->shape())); + + Literal result(shape); + TF_RETURN_IF_ERROR(result.PopulateParallel( + [&](absl::Span multi_index, int) { + return unary_op(operand_literal.Get(multi_index)); + })); + return std::move(result); + } + + // Map from a primitive type to its associated (templated) DfsHloVisitor. + std::unique_ptr typed_visitors_[PrimitiveType_ARRAYSIZE]; + + // Caches pointers to input literals, assuming they are in post-order. + // Literals are not owned by this class, and they must outlive the lifetime of + // each invocation to the Evaluate* method. + // Must be cleared for each evaluation. + std::vector arg_literals_; + + // Max loop iterations to execute with no maximum if negative. + int64_t max_loop_iterations_ = 0; + + // Module-level seed handle. + uint64_t seed_ = 0; + // RNG engine. + std::minstd_rand0 engine_; + + // DynamicDimensionInference is used to evaluate GetDimensionSize, which + // returns the dynamic dimension size of its operand. + DynamicDimensionInference* dynamic_dimension_inference_ = nullptr; + + // Optional handler for custom_call ops. + CustomCallHandler custom_call_handler_; + + HloEvaluator(const HloEvaluator&) = delete; + HloEvaluator& operator=(const HloEvaluator&) = delete; +}; + +std::unique_ptr> MatmulArray2D(const Array2D& lhs, + const Array2D& rhs); +} // namespace xla + +#endif // XLA_HLO_EVALUATOR_HLO_EVALUATOR_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/evaluator/hlo_evaluator_typed_visitor.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/evaluator/hlo_evaluator_typed_visitor.h new file mode 100644 index 0000000000000000000000000000000000000000..274a5431fa6b4f1239ac470fcc15a8f446c9090f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/evaluator/hlo_evaluator_typed_visitor.h @@ -0,0 +1,1662 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_HLO_EVALUATOR_HLO_EVALUATOR_TYPED_VISITOR_H_ +#define XLA_HLO_EVALUATOR_HLO_EVALUATOR_TYPED_VISITOR_H_ + +#include // NOLINT + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "absl/algorithm/container.h" +#include "absl/base/casts.h" +#include "absl/container/inlined_vector.h" +#include "absl/types/span.h" +#include "xla/array2d.h" +#include "xla/hlo/evaluator/hlo_evaluator.h" +#include "xla/hlo/ir/hlo_casting_utils.h" +#include "xla/hlo/ir/hlo_instructions.h" +#include "xla/literal.h" +#include "xla/literal_util.h" +#include "xla/primitive_util.h" +#include "xla/service/shape_inference.h" +#include "xla/util.h" +#include "xla/xla_data.pb.h" +#include "tsl/platform/statusor.h" + +namespace xla { + +template +T Nibble0(T t) { + if constexpr (std::is_integral_v) { + constexpr auto shift = (8 * sizeof(T)) - 4; + return (t << shift) >> shift; + } + return t; +} + +template +T Nibble1(T t) { + if constexpr (std::is_integral_v) { + return t >> 4; + } + return t; +} + +namespace detail { +template +using unsigned_promoted_type_t = + std::make_unsigned_t() + std::declval())>; +} + +// ToArithmeticSafeType(T t): +// - converts `t` to an unsigned integer at least as wide as `int` if T is an +// integer, and +// - otherwise returns `t` unchanged. +// +// It's UB in C++ to under/overflow a signed integer, so we wrap all arithmetic +// in this type to force 2's complement behavior. +template +auto ToArithmeticSafeType(T t) { + if constexpr (std::is_integral_v) { + return static_cast>(t); + } + if constexpr (!std::is_integral_v) { + return std::move(t); + } +} + +// Templated DfsHloVisitor for use by HloEvaluator. +// +// Typically ReturnT here indicates the resulting literal type of each evaluated +// Handle* method of a TypedVisitor. There are however a few exceptions to this +// rule, notably: +// - HandleCompare and HandleIsFinite: where the resulting literal type is +// always boolean. +// - HandleImag and HandleReal: where the resulting literal type is always float +// and the operand is always complex, or real in the case of HandleReal. +// These operations are handled outside of the parent HloEvaluator handlers +// instead of from within TypedVisitor. +// +// Type params: +// - ReturnT: The type of input and output of each operation. +// - ElementwiseT: The type in which internal computation are done. +// +// This is logically a private part of HloEvaluator. It lives in this header +// file rather than in hlo_evaluator.cc because we use extern templates and a +// bunch of independent cc files to speed up compiling the many instantiations +// of this class. +// +// NOTE: Prefer putting new implementation to HloEvalator rather than +// HloEvaluatorTypedVisitor whenever possible, because this class is templated +// for all primitive types and is an order of magnitude larger in code size as +// well as compile time. Only put op handling that involves compute using native +// C++ types here, such as elementwise ops with compute, convolution, dot, etc. +template +class HloEvaluatorTypedVisitor : public ConstDfsHloVisitorWithDefault { + private: + ABSL_ATTRIBUTE_NOINLINE Status + UnsupportedTypeError(const HloInstruction* instruction) { + return InvalidArgument( + "Unsupported type for %s: %s", HloOpcodeString(instruction->opcode()), + PrimitiveType_Name(instruction->shape().element_type())); + } + + public: + explicit HloEvaluatorTypedVisitor(HloEvaluator* p) : parent_(p) {} + + // The following higher-order functions convert a function with ElementwiseT + // to a function with ReturnT. + std::function ConvertUnaryFunction( + const std::function& unary_op) { + return [&unary_op](ReturnT arg) { + return static_cast(unary_op(static_cast(arg))); + }; + } + std::function ConvertBinaryFunction( + const std::function& + binary_op) { + return [&binary_op](ReturnT arg1, ReturnT arg2) { + return static_cast(binary_op(static_cast(arg1), + static_cast(arg2))); + }; + } + std::function ConvertTernaryFunction( + const std::function& ternary_op) { + return [&ternary_op](ReturnT arg1, ReturnT arg2, ReturnT arg3) { + return static_cast(ternary_op(static_cast(arg1), + static_cast(arg2), + static_cast(arg3))); + }; + } + + Status DefaultAction(const HloInstruction* hlo_instruction) override { + return Unimplemented("unhandled HLO ops for HloEvaluator: %s.", + HloOpcodeString(hlo_instruction->opcode())); + } + + template >* = nullptr> + Status HandleAbs(const HloInstruction* abs) { + TF_ASSIGN_OR_RETURN(parent_->evaluated_[abs], + ElementWiseUnaryOp(abs, [](NativeT elem_operand) { + return elem_operand; + })); + return OkStatus(); + } + + template >* = nullptr> + Status HandleAbs(const HloInstruction* abs) { + TF_ASSIGN_OR_RETURN(parent_->evaluated_[abs], + ElementWiseUnaryOp(abs, [](NativeT elem_operand) { + return std::abs(elem_operand); + })); + return OkStatus(); + } + + template >* = nullptr> + Status HandleAbs(const HloInstruction* abs) { + const Literal& operand_literal = + parent_->GetEvaluatedLiteralFor(abs->operand(0)); + TF_ASSIGN_OR_RETURN( + parent_->evaluated_[abs], + (HloEvaluator::ElementWiseUnaryOpImpl( + abs, [](NativeT elem_operand) { return std::abs(elem_operand); }, + operand_literal))); + + return OkStatus(); + } + + Status HandleAbs(const HloInstruction* abs) override { + // If the operand is of C64 type, the return type of abs will be F32. + // However, ElementwiseT would still be the return type, F32, and thus + // specifying the ElementwiseT explicitly as C64 is needed below. + if (abs->operand(0)->shape().element_type() == C64) { + return HandleAbs(abs); + } else if (abs->operand(0)->shape().element_type() == C128) { + return HandleAbs(abs); + } + return HandleAbs(abs); + } + + Status HandleRound(const HloInstruction* round) override { + if constexpr (!is_complex_v) { + TF_ASSIGN_OR_RETURN( + parent_->evaluated_[round], + ElementWiseUnaryOp(round, [](ElementwiseT elem_operand) { + return std::round(elem_operand); + })); + return OkStatus(); + } + return UnsupportedTypeError(round); + } + + Status HandleRoundNearestEven(const HloInstruction* round) override { + if constexpr (!is_complex_v) { + // Verify the current rounding direction. + TF_RET_CHECK(fegetround() == FE_TONEAREST); + TF_ASSIGN_OR_RETURN( + parent_->evaluated_[round], + ElementWiseUnaryOp(round, [](ElementwiseT elem_operand) { + return std::nearbyint(elem_operand); + })); + return OkStatus(); + } + return UnsupportedTypeError(round); + } + + Status HandleCeil(const HloInstruction* ceil) override { + if constexpr (!is_complex_v) { + TF_ASSIGN_OR_RETURN( + parent_->evaluated_[ceil], + ElementWiseUnaryOp(ceil, [](ElementwiseT elem_operand) { + return std::ceil(elem_operand); + })); + return OkStatus(); + } + return UnsupportedTypeError(ceil); + } + + Status HandleExp(const HloInstruction* exp) override { + TF_ASSIGN_OR_RETURN(parent_->evaluated_[exp], + ElementWiseUnaryOp(exp, [](ElementwiseT elem_operand) { + return std::exp(elem_operand); + })); + return OkStatus(); + } + + Status HandleExpm1(const HloInstruction* expm1) override { + if constexpr (!is_complex_v) { + TF_ASSIGN_OR_RETURN( + parent_->evaluated_[expm1], + ElementWiseUnaryOp(expm1, [](ElementwiseT elem_operand) { + return std::expm1(elem_operand); + })); + return OkStatus(); + } + return UnsupportedTypeError(expm1); + } + + Status HandleFloor(const HloInstruction* floor) override { + if constexpr (!is_complex_v) { + TF_ASSIGN_OR_RETURN( + parent_->evaluated_[floor], + ElementWiseUnaryOp(floor, [](ElementwiseT elem_operand) { + return std::floor(elem_operand); + })); + return OkStatus(); + } + return UnsupportedTypeError(floor); + } + + Status HandleLog(const HloInstruction* log) override { + TF_ASSIGN_OR_RETURN(parent_->evaluated_[log], + ElementWiseUnaryOp(log, [](ElementwiseT elem_operand) { + return std::log(elem_operand); + })); + return OkStatus(); + } + + Status HandleLog1p(const HloInstruction* log1p) override { + if constexpr (!is_complex_v) { + TF_ASSIGN_OR_RETURN( + parent_->evaluated_[log1p], + ElementWiseUnaryOp(log1p, [](ElementwiseT elem_operand) { + return std::log1p(elem_operand); + })); + return OkStatus(); + } + return UnsupportedTypeError(log1p); + } + + Status HandleNot(const HloInstruction* not_) override { + if constexpr (std::is_arithmetic_v) { + TF_ASSIGN_OR_RETURN( + parent_->evaluated_[not_], + ElementWiseUnaryOp(not_, [](ElementwiseT elem_operand) { + if constexpr (std::is_floating_point_v || + std::is_same_v) { + return !elem_operand; + } else { + static_assert(std::is_integral_v); + return ~elem_operand; + } + })); + return OkStatus(); + } + return UnsupportedTypeError(not_); + } + + template < + typename NativeT, + typename std::enable_if_t && + !std::is_floating_point_v>* = nullptr> + Status HandleNegate(const HloInstruction* negate) { + using type = std::make_unsigned_t; + TF_ASSIGN_OR_RETURN( + parent_->evaluated_[negate], + ElementWiseUnaryOp(negate, [](ElementwiseT elem_operand) { + return NativeT(-type(elem_operand)); + })); + return OkStatus(); + } + + template || + std::is_floating_point_v>* = nullptr> + Status HandleNegate(const HloInstruction* negate) { + TF_ASSIGN_OR_RETURN( + parent_->evaluated_[negate], + ElementWiseUnaryOp( + negate, [](ElementwiseT elem_operand) { return -elem_operand; })); + return OkStatus(); + } + + Status HandleNegate(const HloInstruction* negate) override { + return HandleNegate(negate); + } + + Status HandleLogistic(const HloInstruction* logistic) override { + TF_ASSIGN_OR_RETURN( + parent_->evaluated_[logistic], + ElementWiseUnaryOp(logistic, [](ElementwiseT elem_operand) { + return static_cast(1) / + (static_cast(1) + std::exp(-elem_operand)); + })); + return OkStatus(); + } + + Status HandleSign(const HloInstruction* sign) override { + using NativeT = ElementwiseT; + TF_ASSIGN_OR_RETURN( + parent_->evaluated_[sign], + ElementWiseUnaryOp(sign, [](ElementwiseT elem_operand) { + if constexpr (std::is_integral_v) { + return (ElementwiseT(0) < elem_operand) - + (elem_operand < ElementwiseT(0)); + } + if constexpr (std::is_floating_point_v) { + return std::isnan(elem_operand) + ? elem_operand + : std::copysign(elem_operand != ElementwiseT(0), + elem_operand); + } + if constexpr (is_complex_v) { + auto abs_val = std::abs(elem_operand); + return 0 == abs_val ? ElementwiseT(0) : elem_operand / abs_val; + } + })); + return OkStatus(); + } + + Status HandleAtan2(const HloInstruction* atan2) override { + if constexpr (std::is_floating_point_v) { + TF_ASSIGN_OR_RETURN(parent_->evaluated_[atan2], + ElementWiseBinaryOp(atan2, [](ElementwiseT lhs_elem, + ElementwiseT rhs_elem) { + return std::atan2(lhs_elem, rhs_elem); + })); + return OkStatus(); + } + if constexpr (is_complex_v) { + TF_ASSIGN_OR_RETURN( + parent_->evaluated_[atan2], + ElementWiseBinaryOp(atan2, [](ElementwiseT y, ElementwiseT x) { + // atan2(y,x) = -i * log((x + i * y)/sqrt(x**2+y**2)) + auto i = ElementwiseT(0.0, 1.0); + return (-i) * (std::log((x + i * y) / std::sqrt(x * x + y * y))); + })); + return OkStatus(); + } + return UnsupportedTypeError(atan2); + } + + Status HandleTanh(const HloInstruction* tanh) override { + TF_ASSIGN_OR_RETURN(parent_->evaluated_[tanh], + ElementWiseUnaryOp(tanh, [](ElementwiseT elem_operand) { + return std::tanh(elem_operand); + })); + return OkStatus(); + } + + Status HandleMultiply(const HloInstruction* multiply) override { + TF_ASSIGN_OR_RETURN( + parent_->evaluated_[multiply], + ElementWiseBinaryOp( + multiply, [](ElementwiseT lhs_elem, ElementwiseT rhs_elem) { + return ElementwiseT(ToArithmeticSafeType(lhs_elem) * + ToArithmeticSafeType(rhs_elem)); + })); + return OkStatus(); + } + + Status HandleSubtract(const HloInstruction* subtract) override { + TF_ASSIGN_OR_RETURN( + parent_->evaluated_[subtract], + ElementWiseBinaryOp( + subtract, [](ElementwiseT lhs_elem, ElementwiseT rhs_elem) { + return ElementwiseT(ToArithmeticSafeType(lhs_elem) - + ToArithmeticSafeType(rhs_elem)); + })); + return OkStatus(); + } + + Status HandleAdd(const HloInstruction* add) override { + TF_ASSIGN_OR_RETURN(parent_->evaluated_[add], + ElementWiseBinaryOp(add, [](ElementwiseT lhs_elem, + ElementwiseT rhs_elem) { + return ElementwiseT(ToArithmeticSafeType(lhs_elem) + + ToArithmeticSafeType(rhs_elem)); + })); + return OkStatus(); + } + + Status HandleDivide(const HloInstruction* divide) override { + TF_ASSIGN_OR_RETURN( + parent_->evaluated_[divide], + ElementWiseBinaryOp( + divide, + [](ElementwiseT lhs_elem, ElementwiseT rhs_elem) -> ElementwiseT { + if constexpr (std::is_integral_v) { + if constexpr (std::is_unsigned_v) { + if (rhs_elem == 0) { + return std::numeric_limits::max(); + } + } + if constexpr (std::is_signed_v) { + if (rhs_elem == 0) { + return static_cast(-1); + } + if (rhs_elem == -1 && + lhs_elem == std::numeric_limits::min()) { + return lhs_elem; + } + } + } + return lhs_elem / rhs_elem; + })); + return OkStatus(); + } + + Status HandleMaximum(const HloInstruction* maximum) override { + if constexpr (!is_complex_v) { + TF_ASSIGN_OR_RETURN( + parent_->evaluated_[maximum], + ElementWiseBinaryOp(maximum, [](ElementwiseT lhs, ElementwiseT rhs) { + if constexpr (std::numeric_limits::has_quiet_NaN) { + if (std::isnan(lhs)) { + return lhs; + } + if (std::isnan(rhs)) { + return rhs; + } + } + return std::max(lhs, rhs); + })); + return OkStatus(); + } + return UnsupportedTypeError(maximum); + } + + Status HandleMinimum(const HloInstruction* minimum) override { + if constexpr (!is_complex_v) { + TF_ASSIGN_OR_RETURN( + parent_->evaluated_[minimum], + ElementWiseBinaryOp(minimum, [](ElementwiseT lhs, ElementwiseT rhs) { + if constexpr (std::numeric_limits::has_quiet_NaN) { + if (std::isnan(lhs)) { + return lhs; + } + if (std::isnan(rhs)) { + return rhs; + } + } + return std::min(lhs, rhs); + })); + return OkStatus(); + } + return UnsupportedTypeError(minimum); + } + + Status HandlePower(const HloInstruction* power) override { + TF_ASSIGN_OR_RETURN( + parent_->evaluated_[power], + ElementWiseBinaryOp( + power, [](ElementwiseT lhs_el, ElementwiseT rhs_el) { + return lhs_el == ElementwiseT(1) ? static_cast(1) + : lhs_el == ElementwiseT(0) && rhs_el == ElementwiseT(0) + ? static_cast(1) + : std::pow(lhs_el, rhs_el); + })); + return OkStatus(); + } + + Status HandleSqrt(const HloInstruction* sqrt) override { + TF_ASSIGN_OR_RETURN(parent_->evaluated_[sqrt], + ElementWiseUnaryOp(sqrt, [](ElementwiseT elem_operand) { + return std::sqrt(elem_operand); + })); + return OkStatus(); + } + + Status HandleCbrt(const HloInstruction* cbrt) override { + if constexpr (!is_complex_v) { + TF_ASSIGN_OR_RETURN( + parent_->evaluated_[cbrt], + ElementWiseUnaryOp(cbrt, [](ElementwiseT elem_operand) { + return std::cbrt(elem_operand); + })); + return OkStatus(); + } + return UnsupportedTypeError(cbrt); + } + + Status HandleRsqrt(const HloInstruction* rsqrt) override { + TF_ASSIGN_OR_RETURN( + parent_->evaluated_[rsqrt], + ElementWiseUnaryOp(rsqrt, [](ElementwiseT elem_operand) { + return static_cast(1) / std::sqrt(elem_operand); + })); + return OkStatus(); + } + + Status HandleRemainder(const HloInstruction* remainder) override { + if constexpr (!is_complex_v) { + TF_ASSIGN_OR_RETURN( + parent_->evaluated_[remainder], + ElementWiseBinaryOp( + remainder, + [](ElementwiseT lhs_el, ElementwiseT rhs_el) -> ElementwiseT { + if constexpr (std::is_integral_v) { + if (rhs_el == 0) { + return lhs_el; + } + if constexpr (std::is_signed_v) { + if (rhs_el == -1 && + lhs_el == std::numeric_limits::min()) { + return 0; + } + } + return lhs_el % rhs_el; + } + if constexpr (std::is_floating_point_v) { + return std::fmod(lhs_el, rhs_el); + } + })); + return OkStatus(); + } + return UnsupportedTypeError(remainder); + } + + Status HandleAnd(const HloInstruction* and_inst) override { + if constexpr (std::is_integral_v) { + TF_ASSIGN_OR_RETURN( + parent_->evaluated_[and_inst], + ElementWiseBinaryOp(and_inst, + [](ElementwiseT lhs_el, ElementwiseT rhs_el) { + return lhs_el & rhs_el; + })); + return OkStatus(); + } + return UnsupportedTypeError(and_inst); + } + + Status HandleOr(const HloInstruction* or_inst) override { + if constexpr (std::is_integral_v) { + TF_ASSIGN_OR_RETURN(parent_->evaluated_[or_inst], + ElementWiseBinaryOp(or_inst, [](ElementwiseT lhs_el, + ElementwiseT rhs_el) { + return lhs_el | rhs_el; + })); + return OkStatus(); + } + return UnsupportedTypeError(or_inst); + } + + Status HandleXor(const HloInstruction* xor_inst) override { + if constexpr (std::is_integral_v) { + TF_ASSIGN_OR_RETURN( + parent_->evaluated_[xor_inst], + ElementWiseBinaryOp(xor_inst, + [](ElementwiseT lhs_el, ElementwiseT rhs_el) { + return lhs_el ^ rhs_el; + })); + return OkStatus(); + } + return UnsupportedTypeError(xor_inst); + } + + Status HandleShiftLeft(const HloInstruction* shl) override { + if constexpr (std::is_integral_v && + !std::is_same_v) { + TF_ASSIGN_OR_RETURN(parent_->evaluated_[shl], + ElementWiseBinaryOp(shl, [](ElementwiseT lhs_elem, + ElementwiseT rhs_elem) { + return IsShiftOutOfBounds(rhs_elem) + ? 0 + : (lhs_elem << rhs_elem); + })); + return OkStatus(); + } + return UnsupportedTypeError(shl); + } + + Status HandleShiftRightArithmetic(const HloInstruction* shr) override { + if constexpr (std::is_integral_v && + !std::is_same_v) { + using SignedT = make_specialized_signed_t; + TF_ASSIGN_OR_RETURN( + parent_->evaluated_[shr], + ElementWiseBinaryOp( + shr, [](ElementwiseT lhs_elem, ElementwiseT rhs_elem) { + SignedT lhs_signed = static_cast(lhs_elem); + if (IsShiftOutOfBounds(rhs_elem)) { + return lhs_signed < 0 ? static_cast(-1) : 0; + } else { + return static_cast(lhs_signed >> rhs_elem); + } + })); + return OkStatus(); + } + return UnsupportedTypeError(shr); + } + + Status HandleShiftRightLogical(const HloInstruction* shr) override { + if constexpr (std::is_integral_v && + !std::is_same_v) { + using UnsignedT = make_specialized_unsigned_t; + TF_ASSIGN_OR_RETURN(parent_->evaluated_[shr], + ElementWiseBinaryOp(shr, [](ElementwiseT lhs_elem, + ElementwiseT rhs_elem) { + // If shift amount is greater than the number of + // bits, then return 0. + if (IsShiftOutOfBounds(rhs_elem)) { + return static_cast(0); + } + return static_cast( + static_cast(lhs_elem) >> rhs_elem); + })); + return OkStatus(); + } + return UnsupportedTypeError(shr); + } + + Status HandleClamp(const HloInstruction* clamp) override { + if constexpr (!is_complex_v) { + auto clamp_op = [](ElementwiseT low, ElementwiseT value, + ElementwiseT high) { + if constexpr (std::numeric_limits::has_quiet_NaN) { + if (std::isnan(low)) { + return low; + } + if (std::isnan(value)) { + return value; + } + if (std::isnan(high)) { + return high; + } + } + return std::min(high, std::max(value, low)); + }; + TF_ASSIGN_OR_RETURN( + parent_->evaluated_[clamp], + ElementwiseTernaryOp(clamp, + std::move(ConvertTernaryFunction(clamp_op)))); + return OkStatus(); + } + return UnsupportedTypeError(clamp); + } + + Status HandleSelect(const HloInstruction* select) override { + CHECK(!ShapeUtil::IsScalar(select->operand(0)->shape())); + CHECK(select->shape().IsArray()); + std::function select_op = + [](bool pred, ReturnT on_true, ReturnT on_false) { + if (pred) { + return on_true; + } + return on_false; + }; + TF_ASSIGN_OR_RETURN(parent_->evaluated_[select], + ElementwiseTernaryOp(select, std::move(select_op))); + return OkStatus(); + } + + Status HandleConvolutionWithLiterals(const HloInstruction* conv, + const Literal& lhs_literal, + const Literal& rhs_literal) { + const auto& window = conv->window(); + const Shape& result_shape = conv->shape(); + const Shape& lhs_shape = lhs_literal.shape(); + const Shape& rhs_shape = rhs_literal.shape(); + const auto packed_nibble_count = + absl::c_count(conv->precision_config().operand_precision(), + PrecisionConfig::PACKED_NIBBLE); + CHECK_NE(packed_nibble_count, 1); + const bool is_packed_nibble = packed_nibble_count == 2; + + TF_CHECK_OK(ShapeUtil::ValidateShape(lhs_shape)); + TF_CHECK_OK(ShapeUtil::ValidateShape(rhs_shape)); + CHECK(lhs_shape.IsArray()); + CHECK(rhs_shape.IsArray()); + CHECK(ShapeUtil::SameElementType(lhs_shape, rhs_shape)); + CHECK(ShapeUtil::SameElementType(lhs_shape, result_shape)); + + const auto& dnums = conv->convolution_dimension_numbers(); + const int64_t num_spatial_dims = dnums.output_spatial_dimensions_size(); + CHECK_EQ(num_spatial_dims, dnums.input_spatial_dimensions_size()); + CHECK_EQ(num_spatial_dims, dnums.kernel_spatial_dimensions_size()); + CHECK_GE(num_spatial_dims, 0); + CHECK_EQ(window.dimensions_size(), num_spatial_dims); + + std::vector window_dimension_sizes; + for (auto i : dnums.kernel_spatial_dimensions()) { + window_dimension_sizes.push_back(ShapeUtil::GetDimension(rhs_shape, i)); + } + + const Shape& window_shape = + ShapeUtil::MakeShape(rhs_shape.element_type(), window_dimension_sizes); + + DimensionVector lhs_dim_multipliers = + HloEvaluator::MakeDimMultipliers(lhs_shape); + DimensionVector rhs_dim_multipliers = + HloEvaluator::MakeDimMultipliers(rhs_shape); + + auto lhs_literal_data = lhs_literal.data(); + auto rhs_literal_data = rhs_literal.data(); + + const int64_t feature_group_count = conv->feature_group_count(); + const int64_t batch_group_count = conv->batch_group_count(); + + auto func = [&window_shape, &dnums, &lhs_shape, &rhs_shape, &window, + &lhs_dim_multipliers, &rhs_dim_multipliers, lhs_literal_data, + rhs_literal_data, feature_group_count, batch_group_count, + is_packed_nibble](const absl::Span out_index, + int /*thread_id*/) { + // Dimension number applicable for input (lhs). + const int64_t input_batch_dim = dnums.input_batch_dimension(); + const int64_t input_z_dim = dnums.input_feature_dimension(); + // Dimension number applicable for kernel (rhs). + const int64_t kernel_input_z_dim = dnums.kernel_input_feature_dimension(); + const int64_t kernel_output_z_dim = + dnums.kernel_output_feature_dimension(); + // Dimension number applicable for output. + const int64_t output_batch_dim = dnums.output_batch_dimension(); + const int64_t output_z_dim = dnums.output_feature_dimension(); + + const int64_t input_z_size = + ShapeUtil::GetDimension(lhs_shape, input_z_dim); + + const int64_t input_batch_size = + ShapeUtil::GetDimension(lhs_shape, input_batch_dim); + + const int64_t batch_group_size = input_batch_size / batch_group_count; + + // The size of an input feature group. + const int64_t input_feature_group_size = + input_z_size / feature_group_count; + + const int64_t output_z_size = + ShapeUtil::GetDimension(rhs_shape, kernel_output_z_dim); + // The output feature dimension is a concatenation of convolution results + // from the different groups. + const int64_t output_feature_group_size = + output_z_size / feature_group_count; + + // Calculate the group index to which the current output index + // belongs. + const int64_t feature_group_index = + out_index[output_z_dim] / output_feature_group_size; + + const int64_t depthwise_multiplier = output_z_size / batch_group_count; + const int64_t batch_group_index = + out_index[output_z_dim] / depthwise_multiplier; + + ElementwiseT result_val = static_cast(0); + DimensionVector rhs_spatial_index(dnums.kernel_spatial_dimensions_size(), + 0); + + // Convolve input feature with kernel. + // The mechanism indexes into the correct LHS (input) and RHS (kernel) + // locations and accumulates multiplications for a given output index. + do { + // Find corresponding spatial dimension index for input (lhs). + int64_t lhs_linear_spatial_index = 0; + int64_t rhs_linear_spatial_index = 0; + for (int64_t ki = 0; ki < rhs_spatial_index.size(); ++ki) { + // Spatial dimension number for input (lhs) and output. + const int64_t input_spatial_dim = dnums.input_spatial_dimensions(ki); + const int64_t output_spatial_dim = + dnums.output_spatial_dimensions(ki); + + // Calculate lhs (input) index without taking base dilation into + // account. + const auto& window_dim = window.dimensions(ki); + const int64_t undilated_index = + out_index[output_spatial_dim] * window_dim.stride() - + window_dim.padding_low() + + rhs_spatial_index[ki] * window_dim.window_dilation(); + // Skip if the lhs (input) index is to be dilated. As an + // optimization, skip this mod if there's no dilation. + if (window_dim.base_dilation() > 1 && + undilated_index % window_dim.base_dilation() != 0) { + goto cnt; + } + + // Calculate the actual lhs (input) index after dilation. As an + // optimization, skip this integer divide if there's no dilation. + int64_t lhs_spatial_index; + if (window_dim.base_dilation() > 1) { + lhs_spatial_index = undilated_index / window_dim.base_dilation(); + } else { + lhs_spatial_index = undilated_index; + } + + // Skip if input index is not in bounds. + if (!(lhs_spatial_index >= 0 && + lhs_spatial_index < lhs_shape.dimensions(input_spatial_dim))) { + goto cnt; + } + + lhs_linear_spatial_index += + lhs_spatial_index * lhs_dim_multipliers[input_spatial_dim]; + rhs_linear_spatial_index += + (window_dim.window_reversal() + ? ((window_dim.size() - 1) - rhs_spatial_index[ki]) + : rhs_spatial_index[ki]) * + rhs_dim_multipliers[dnums.kernel_spatial_dimensions(ki)]; + } + + for (int64_t rhs_iz = 0; rhs_iz < input_feature_group_size; ++rhs_iz) { + const int64_t iz = + feature_group_index * input_feature_group_size + rhs_iz; + + int64_t lhs_linear_index = lhs_linear_spatial_index; + lhs_linear_index += out_index[output_batch_dim] * + lhs_dim_multipliers[input_batch_dim]; + + // We are scraping only the diagonal elements in the resultant + // convolution output when batch_group_count is greater than 1, + // where 1 is the default. No scraping is done in that case. + // This approach works out automatically for 'groups' in batches + // with group_size > 1, because we already descend down the batch + // dimension for the 'output_batch_dim' above. + lhs_linear_index += (batch_group_index * batch_group_size) * + lhs_dim_multipliers[input_batch_dim]; + + lhs_linear_index += iz * lhs_dim_multipliers[input_z_dim]; + int64_t rhs_linear_index = rhs_linear_spatial_index; + + rhs_linear_index += out_index[output_z_dim] * + rhs_dim_multipliers[kernel_output_z_dim]; + rhs_linear_index += rhs_iz * rhs_dim_multipliers[kernel_input_z_dim]; + auto lhs = + static_cast(lhs_literal_data[lhs_linear_index]); + auto rhs = + static_cast(rhs_literal_data[rhs_linear_index]); + if (is_packed_nibble) { + auto lhs_n0 = ToArithmeticSafeType(Nibble0(lhs)); + auto lhs_n1 = ToArithmeticSafeType(Nibble1(lhs)); + auto rhs_n0 = ToArithmeticSafeType(Nibble0(rhs)); + auto rhs_n1 = ToArithmeticSafeType(Nibble1(rhs)); + result_val += (lhs_n0 * rhs_n0) + (lhs_n1 * rhs_n1); + } else { + result_val += ToArithmeticSafeType(lhs) * ToArithmeticSafeType(rhs); + } + } + cnt: {} + } while (IndexUtil::BumpIndices(window_shape, + absl::MakeSpan(rhs_spatial_index))); + + if constexpr (std::is_integral_v) { + auto l = static_cast(std::numeric_limits::min()); + auto h = static_cast(std::numeric_limits::max()); + result_val = std::max(l, std::min(h, result_val)); + } + return static_cast(result_val); + }; + + Literal result(result_shape); + TF_RETURN_IF_ERROR(result.PopulateParallel(func)); + + parent_->evaluated_[conv] = std::move(result); + return OkStatus(); + } + + Status HandleConvolution(const HloInstruction* conv) override { + auto lhs = conv->operand(0); + auto rhs = conv->operand(1); + const auto& window = conv->window(); + const Shape& result_shape = conv->shape(); + const Shape& lhs_shape = lhs->shape(); + const Shape& rhs_shape = rhs->shape(); + + TF_CHECK_OK(ShapeUtil::ValidateShape(lhs_shape)); + TF_CHECK_OK(ShapeUtil::ValidateShape(rhs_shape)); + CHECK(lhs_shape.IsArray()); + CHECK(rhs_shape.IsArray()); + + const auto& dnums = conv->convolution_dimension_numbers(); + const int64_t num_spatial_dims = dnums.output_spatial_dimensions_size(); + CHECK_EQ(num_spatial_dims, dnums.input_spatial_dimensions_size()); + CHECK_EQ(num_spatial_dims, dnums.kernel_spatial_dimensions_size()); + CHECK_GE(num_spatial_dims, 0); + CHECK_EQ(window.dimensions_size(), num_spatial_dims); + + const auto lhs_rank = lhs_shape.rank(); + const auto rhs_rank = rhs_shape.rank(); + + CHECK_EQ(num_spatial_dims + 2, lhs_rank); + CHECK_EQ(num_spatial_dims + 2, rhs_rank); + + TF_ASSIGN_OR_RETURN( + auto inferred_return_shape, + ShapeInference::InferConvolveShape( + lhs_shape, rhs_shape, conv->feature_group_count(), + conv->batch_group_count(), window, dnums, + /*preferred_element_type=*/conv->shape().element_type())); + CHECK(ShapeUtil::Compatible(result_shape, inferred_return_shape)) + << "return shape set to: " << ShapeUtil::HumanString(result_shape) + << " but is inferred to be: " + << ShapeUtil::HumanString(inferred_return_shape); + + const Literal& lhs_literal = parent_->GetEvaluatedLiteralFor(lhs); + const Literal& rhs_literal = parent_->GetEvaluatedLiteralFor(rhs); + const bool lhs_same = ShapeUtil::SameElementType(lhs_shape, result_shape); + const bool rhs_same = ShapeUtil::SameElementType(rhs_shape, result_shape); + if (rhs_same && lhs_same) { + return HandleConvolutionWithLiterals(conv, lhs_literal, rhs_literal); + } + if (rhs_same) { + return HandleConvolutionWithLiterals( + conv, lhs_literal.Convert(result_shape.element_type()).value(), + rhs_literal); + } + if (lhs_same) { + return HandleConvolutionWithLiterals( + conv, lhs_literal, + rhs_literal.Convert(result_shape.element_type()).value()); + } + return HandleConvolutionWithLiterals( + conv, lhs_literal.Convert(result_shape.element_type()).value(), + rhs_literal.Convert(result_shape.element_type()).value()); + } + + Status HandleDot(const HloInstruction* dot) override { + if (dot->dot_dimension_numbers().rhs_contracting_dimensions_size() == 1 && + parent_->use_fast_path_ && + ShapeUtil::SameElementType(dot->operand(0)->shape(), dot->shape()) && + ShapeUtil::SameElementType(dot->operand(1)->shape(), dot->shape())) { + return HandleDot(dot); + } + return HandleDotSlowPath(dot); + } + + template >* = nullptr> + Status HandleDot(const HloInstruction* dot) { + const HloInstruction* lhs = dot->operand(0); + const HloInstruction* rhs = dot->operand(1); + CHECK(dot->shape().IsArray()); + CHECK(lhs->shape().IsArray()); + CHECK(rhs->shape().IsArray()); + + const auto& dnums = dot->dot_dimension_numbers(); + + const int64_t lhs_rank = lhs->shape().rank(); + const int64_t rhs_rank = rhs->shape().rank(); + + CHECK(ShapeUtil::SameElementType(lhs->shape(), rhs->shape())); + CHECK(ShapeUtil::SameElementType(lhs->shape(), dot->shape())); + + // There must be 1 and only 1 Contracting dimension for lhs and rhs. + const int64_t lhs_contracting_dimension = + dnums.lhs_contracting_dimensions(0); + const int64_t rhs_contracting_dimension = + dnums.rhs_contracting_dimensions(0); + // Contracted dimension sizes must be the same. + CHECK_EQ(lhs->shape().dimensions(lhs_contracting_dimension), + rhs->shape().dimensions(rhs_contracting_dimension)) + << "lhs contracted dimension: " + << lhs->shape().dimensions(lhs_contracting_dimension) + << " rhs contracted dimension: " + << rhs->shape().dimensions(rhs_contracting_dimension); + + // The fast path is for a simple rank 2 dot with default layout operands. + if (lhs_rank != 2 || rhs_rank != 2 || lhs_contracting_dimension != 1 || + rhs_contracting_dimension != 0 || + !LayoutUtil::Equal(lhs->shape().layout(), + LayoutUtil::GetDefaultLayoutForR2()) || + !LayoutUtil::Equal(rhs->shape().layout(), + LayoutUtil::GetDefaultLayoutForR2()) || + !LayoutUtil::Equal(dot->shape().layout(), + LayoutUtil::GetDefaultLayoutForR2())) { + return HandleDotSlowPath(dot); + } + + const PrimitiveType native_ty = + primitive_util::NativeToPrimitiveType(); + Literal lhs_literal = + parent_->GetEvaluatedLiteralFor(lhs).Convert(native_ty).value(); + Literal rhs_literal = + parent_->GetEvaluatedLiteralFor(rhs).Convert(native_ty).value(); + const int64_t contracted_dimension_size = + lhs->shape().dimensions(lhs_contracting_dimension); + Array2D lhs_array(lhs->shape().dimensions(0), + contracted_dimension_size); + lhs_array.SetValues(lhs_literal.data()); + Array2D rhs_array(contracted_dimension_size, + rhs->shape().dimensions(1)); + rhs_array.SetValues(rhs_literal.data()); + std::unique_ptr> result_array = + HloEvaluator::MatmulArray2D(lhs_array, rhs_array); + Literal result(ShapeUtil::MakeShape(native_ty, dot->shape().dimensions())); + result.PopulateR2FromArray2D(*result_array); + parent_->evaluated_[dot] = + std::move(result).Convert(dot->shape().element_type()).value(); + return OkStatus(); + } + + template >* = nullptr> + Status HandleDot(const HloInstruction* dot) { + return HandleDotSlowPath(dot); + } + + Status HandleDotSlowPathWithLiterals(const HloInstruction* dot, + const Literal& lhs_literal, + const Literal& rhs_literal) { + const auto& dnums = dot->dot_dimension_numbers(); + + const auto lhs_rank = lhs_literal.shape().rank(); + const auto rhs_rank = rhs_literal.shape().rank(); + + CHECK(ShapeUtil::SameElementType(lhs_literal.shape(), rhs_literal.shape())); + CHECK(ShapeUtil::SameElementType(lhs_literal.shape(), dot->shape())); + + const auto packed_nibble_count = + absl::c_count(dot->precision_config().operand_precision(), + PrecisionConfig::PACKED_NIBBLE); + CHECK_NE(packed_nibble_count, 1); + const bool is_packed_nibble = packed_nibble_count == 2; + CHECK_EQ(dnums.lhs_batch_dimensions_size(), + dnums.rhs_batch_dimensions_size()); + + DimensionVector lhs_non_contracting_dims; + DimensionVector rhs_non_contracting_dims; + for (int64_t i = 0; i < lhs_rank; i++) { + if (!absl::c_linear_search(dnums.lhs_contracting_dimensions(), i) && + !absl::c_linear_search(dnums.lhs_batch_dimensions(), i)) { + lhs_non_contracting_dims.push_back(i); + } + } + for (int64_t i = 0; i < rhs_rank; i++) { + if (!absl::c_linear_search(dnums.rhs_contracting_dimensions(), i) && + !absl::c_linear_search(dnums.rhs_batch_dimensions(), i)) { + rhs_non_contracting_dims.push_back(i); + } + } + + DimensionVector contracting_dim_sizes; + contracting_dim_sizes.reserve(dnums.lhs_contracting_dimensions_size()); + DimensionVector lhs_contracting_dims; + DimensionVector rhs_contracting_dims; + for (int64_t i = 0; i < dnums.lhs_contracting_dimensions_size(); ++i) { + const int64_t lhs_dnum = dnums.lhs_contracting_dimensions(i); + const int64_t rhs_dnum = dnums.rhs_contracting_dimensions(i); + lhs_contracting_dims.push_back(lhs_dnum); + rhs_contracting_dims.push_back(rhs_dnum); + const int64_t dim_size = lhs_literal.shape().dimensions(lhs_dnum); + contracting_dim_sizes.push_back(dim_size); + } + const int64_t total_contraction_size = Product(contracting_dim_sizes); + Literal result(dot->shape()); + TF_RETURN_IF_ERROR(result.PopulateParallel( + [&](absl::Span result_index, int /*thread_id*/) { + // Locations in LHS and RHS that we read from. + DimensionVector lhs_index(lhs_rank); + DimensionVector rhs_index(rhs_rank); + + // First come the batch dimensions. + int64_t idx = 0; + for (int64_t i = 0; i < dnums.lhs_batch_dimensions_size(); i++) { + lhs_index[dnums.lhs_batch_dimensions(i)] = result_index[idx]; + rhs_index[dnums.rhs_batch_dimensions(i)] = result_index[idx]; + idx++; + } + + // Next we have non-contracting dimensions, if any. + for (int64_t i = 0; i < lhs_non_contracting_dims.size(); i++) { + lhs_index[lhs_non_contracting_dims[i]] = result_index[idx++]; + } + for (int64_t i = 0; i < rhs_non_contracting_dims.size(); i++) { + rhs_index[rhs_non_contracting_dims[i]] = result_index[idx++]; + } + + // Accumulate resulting product along the contracting dimensions. + ElementwiseT result_val = static_cast(0); + for (int64_t k = 0; k < total_contraction_size; k++) { + const auto lhs = + static_cast(lhs_literal.Get(lhs_index)); + const auto rhs = + static_cast(rhs_literal.Get(rhs_index)); + if (is_packed_nibble) { + auto lhs_n0 = ToArithmeticSafeType(Nibble0(lhs)); + auto lhs_n1 = ToArithmeticSafeType(Nibble1(lhs)); + auto rhs_n0 = ToArithmeticSafeType(Nibble0(rhs)); + auto rhs_n1 = ToArithmeticSafeType(Nibble1(rhs)); + result_val += (lhs_n0 * rhs_n0) + (lhs_n1 * rhs_n1); + } else { + result_val += + ToArithmeticSafeType(lhs) * ToArithmeticSafeType(rhs); + } + + // If there are no contracting dimensions, do not try to count down + // from -1 to 0; that's an infinite loop. + if (!contracting_dim_sizes.empty()) { + for (int64_t i = contracting_dim_sizes.size() - 1; i >= 0; --i) { + lhs_index[lhs_contracting_dims[i]]++; + rhs_index[rhs_contracting_dims[i]]++; + if (lhs_index[lhs_contracting_dims[i]] != + contracting_dim_sizes[i]) { + break; + } + lhs_index[lhs_contracting_dims[i]] = 0; + rhs_index[rhs_contracting_dims[i]] = 0; + } + } + } + + return static_cast(result_val); + })); + + parent_->evaluated_[dot] = std::move(result); + return OkStatus(); + } + + Status HandleDotSlowPath(const HloInstruction* dot) { + auto lhs = dot->operand(0); + auto rhs = dot->operand(1); + CHECK(dot->shape().IsArray()); + CHECK(lhs->shape().IsArray()); + CHECK(rhs->shape().IsArray()); + const bool lhs_same = + ShapeUtil::SameElementType(lhs->shape(), dot->shape()); + const bool rhs_same = + ShapeUtil::SameElementType(rhs->shape(), dot->shape()); + const Literal& lhs_literal = parent_->GetEvaluatedLiteralFor(lhs); + const Literal& rhs_literal = parent_->GetEvaluatedLiteralFor(rhs); + if (lhs_same && rhs_same) { + return HandleDotSlowPathWithLiterals(dot, lhs_literal, rhs_literal); + } + if (lhs_same) { + return HandleDotSlowPathWithLiterals( + dot, lhs_literal, + rhs_literal.Convert(dot->shape().element_type()).value()); + } + if (rhs_same) { + return HandleDotSlowPathWithLiterals( + dot, lhs_literal.Convert(dot->shape().element_type()).value(), + rhs_literal); + } + return HandleDotSlowPathWithLiterals( + dot, lhs_literal.Convert(dot->shape().element_type()).value(), + rhs_literal.Convert(dot->shape().element_type()).value()); + } + + Status HandlePad(const HloInstruction* pad) override { + CHECK(pad->operand(0)->shape().IsArray()); + // Padding value must be scalar. + CHECK(ShapeUtil::IsScalar(pad->operand(1)->shape())); + CHECK_EQ(pad->operand(0)->shape().rank(), + pad->padding_config().dimensions_size()); + + TF_ASSIGN_OR_RETURN(auto inferred_return_shape, + ShapeInference::InferPadShape( + /*operand_shape=*/pad->operand(0)->shape(), + /*padding_value_shape=*/pad->operand(1)->shape(), + /*padding_config=*/pad->padding_config())); + CHECK(ShapeUtil::Compatible(pad->shape(), inferred_return_shape)) + << "return shape is set to: " << ShapeUtil::HumanString(pad->shape()) + << " but is inferred to be: " + << ShapeUtil::HumanString(inferred_return_shape); + + // Create new HLO of padded shape with padding value. + ReturnT scalar = + parent_->GetEvaluatedLiteralFor(pad->operand(1)).Get({}); + Literal result(pad->shape()); + TF_RETURN_IF_ERROR(result.PopulateParallel( + [&scalar](absl::Span multi_index, int) { + return scalar; + })); + + const Literal& evaluated_operand = + parent_->GetEvaluatedLiteralFor(pad->operand(0)); + + std::vector target_index(result.shape().rank(), 0); + + // Loop through each element of the operand, assign them to the + // corresponding index of the resulting padded literal. + const PaddingConfig& pad_config = pad->padding_config(); + + auto func = [&](absl::Span input_index) { + for (auto i = 0; i < input_index.size(); ++i) { + // Interior padding occurs logically before edge padding, so in the case + // of negative edge padding elements are removed from the + // interior-padded operand. + target_index[i] = + pad_config.dimensions(i).edge_padding_low() + + input_index[i] * (pad_config.dimensions(i).interior_padding() + 1); + + // Account for negative low and high padding: skip assignment if the + // any target index is out of range. + if (!(target_index[i] >= 0 && + target_index[i] < pad->shape().dimensions(i))) { + return true; + } + } + result.Set(target_index, + evaluated_operand.Get(input_index)); + return true; + }; + + std::vector zero_base(evaluated_operand.shape().dimensions_size(), + 0); + std::vector step(evaluated_operand.shape().dimensions_size(), 1); + + ShapeUtil::ForEachIndexNoStatus(evaluated_operand.shape(), zero_base, + evaluated_operand.shape().dimensions(), + step, func); + + parent_->evaluated_[pad] = std::move(result); + return OkStatus(); + } + + Status HandleClz(const HloInstruction* clz) override { + // Enable CLZ only for integer types. + if constexpr (std::is_integral_v && + !std::is_same_v) { + TF_ASSIGN_OR_RETURN( + parent_->evaluated_[clz], + ElementWiseUnaryOp(clz, [](ElementwiseT elem_operand) { + int64_t unsigned_digits = std::numeric_limits::digits + + std::numeric_limits::is_signed; + return (unsigned_digits - 1) - Log2Floor(elem_operand); + })); + return OkStatus(); + } + return UnsupportedTypeError(clz); + } + + Status HandlePopulationCount(const HloInstruction* popcnt) override { + if constexpr (std::is_integral_v && + !std::is_same_v) { + TF_ASSIGN_OR_RETURN( + parent_->evaluated_[popcnt], + ElementWiseUnaryOp(popcnt, [](ElementwiseT elem_operand) { + return std::bitset(elem_operand) + .count(); + })); + return OkStatus(); + } + return UnsupportedTypeError(popcnt); + } + + Status HandleSin(const HloInstruction* sin) override { + if constexpr (std::is_floating_point_v || + is_complex_v) { + TF_ASSIGN_OR_RETURN( + parent_->evaluated_[sin], + ElementWiseUnaryOp(sin, [](ElementwiseT elem_operand) { + return std::sin(elem_operand); + })); + return OkStatus(); + } + return UnsupportedTypeError(sin); + } + + Status HandleCos(const HloInstruction* cos) override { + if constexpr (std::is_floating_point_v || + is_complex_v) { + TF_ASSIGN_OR_RETURN( + parent_->evaluated_[cos], + ElementWiseUnaryOp(cos, [](ElementwiseT elem_operand) { + return std::cos(elem_operand); + })); + return OkStatus(); + } + return UnsupportedTypeError(cos); + } + + Status HandleTan(const HloInstruction* tan) override { + if constexpr (std::is_floating_point_v) { + TF_ASSIGN_OR_RETURN( + parent_->evaluated_[tan], + ElementWiseUnaryOp(tan, [](ElementwiseT elem_operand) { + return std::tan(elem_operand); + })); + return OkStatus(); + } + return UnsupportedTypeError(tan); + } + + template >* = nullptr> + Status HandleReducePrecision(const HloInstruction* reduce_precision) { + TF_ASSIGN_OR_RETURN( + parent_->evaluated_[reduce_precision], + ElementWiseUnaryOp(reduce_precision, [&](ElementwiseT elem) { + const uint32_t src_mantissa_bits = + std::numeric_limits::digits - 1; + const uint32_t src_exponent_bits = + 8 * sizeof(NativeT) - src_mantissa_bits - 1; + const uint32_t dest_mantissa_bits = reduce_precision->mantissa_bits(); + const uint32_t dest_exponent_bits = reduce_precision->exponent_bits(); + + using Uint = UnsignedIntegerTypeForSizeType; + Uint value_as_int = absl::bit_cast(elem); + + // Code is based on the CPU/GPU implementation in LLVM-emitting code. + // + // Bits in float32 type: + // mantissa : bits [0:22] + // exponent : bits [23:30] + // sign : bits [31] + if (dest_mantissa_bits < src_mantissa_bits) { + const Uint last_mantissa_bit_mask = + Uint{1} << (src_mantissa_bits - dest_mantissa_bits); + + // Compute rounding bias for round-to-nearest with ties to even. + // This is equal to a base value of 0111... plus one bit if the last + // remaining mantissa bit is 1. + const Uint base_rounding_bias = (last_mantissa_bit_mask >> 1) - 1; + const Uint x_last_mantissa_bit = + (value_as_int & last_mantissa_bit_mask) >> + (src_mantissa_bits - dest_mantissa_bits); + const Uint x_rounding_bias = + x_last_mantissa_bit + base_rounding_bias; + + // Add rounding bias, and mask out truncated bits. Note that the + // case where adding the rounding bias overflows into the exponent + // bits is correct; the non-masked mantissa bits will all be zero, + // and the exponent will be incremented by one. + const Uint truncation_mask = ~(last_mantissa_bit_mask - 1); + value_as_int = value_as_int + x_rounding_bias; + value_as_int = value_as_int & truncation_mask; + } + if (dest_exponent_bits < src_exponent_bits) { + // Masks for f32 values. + const Uint sign_bit_mask = Uint{1} << 8 * sizeof(NativeT) - 1; + const Uint exp_bits_mask = (Uint{1 << src_exponent_bits} - 1) + << src_mantissa_bits; + + // An exponent of 2^(n-1)-1 -- that is, 0111... with the zero in the + // most- significant bit -- is equal to 1.0f for all exponent sizes. + // Adding 2^(n-1)-1 to this gives us the highest non-infinite + // exponent for a bit- size of n, and subtracting 2^(n-1)-1 from + // this gives us the lowest' exponent (corresponding to 0.0f). + // + // Thus, the f32 exponent corresponding to the highest non-infinite + // exponent for a bit size of n is (2^7-1) + 2^(n-1)-1, and the f32 + // exponent corresponding to the lowest exponent for a bit size of n + // is (2^7-1) - 2^(n-1)-1. + // + // Note that we have already checked that exponents_bits >= 1. + const Uint exponent_bias = (Uint{1} << (src_exponent_bits - 1)) - 1; + const Uint reduced_exponent_bias = + (1 << (dest_exponent_bits - 1)) - 1; + const Uint reduced_max_exponent = + exponent_bias + reduced_exponent_bias; + const Uint reduced_min_exponent = + exponent_bias - reduced_exponent_bias; + + // Do we overflow or underflow? + const Uint x_exponent = value_as_int & exp_bits_mask; + const bool x_overflows = + x_exponent > (reduced_max_exponent << src_mantissa_bits); + const bool x_underflows = + x_exponent <= (reduced_min_exponent << src_mantissa_bits); + + // Compute appropriately-signed values of zero and infinity. + const Uint x_signed_zero = value_as_int & sign_bit_mask; + const Uint x_signed_inf = x_signed_zero | exp_bits_mask; + + // Force to zero or infinity if overflow or underflow. (Note that + // this truncates all denormal values to zero, rather than rounding + // them.) + value_as_int = x_overflows ? x_signed_inf : value_as_int; + value_as_int = x_underflows ? x_signed_zero : value_as_int; + } + + NativeT reduced_result = absl::bit_cast(value_as_int); + if (std::isnan(elem)) { + reduced_result = dest_mantissa_bits > 0 + ? elem + : std::numeric_limits::infinity(); + } + return reduced_result; + })); + return OkStatus(); + } + + template || + is_complex_v>* = nullptr> + Status HandleReducePrecision(const HloInstruction* reduce_precision) { + return UnsupportedTypeError(reduce_precision); + } + + Status HandleReducePrecision( + const HloInstruction* reduce_precision) override { + return HandleReducePrecision(reduce_precision); + } + + Status HandleIota(const HloInstruction* instruction) override { + auto* iota = Cast(instruction); + if constexpr (std::is_integral_v || + is_complex_v || + std::is_floating_point_v) { + Literal result(iota->shape()); + ShapeUtil::ForEachIndexNoStatus( + iota->shape(), [&](absl::Span idx) { + result.Set(idx, static_cast(idx[iota->iota_dimension()])); + return true; + }); + parent_->evaluated_[iota] = std::move(result); + return OkStatus(); + } + return UnsupportedTypeError(iota); + } + + Status HandleRng(const HloInstruction* random) override { + RandomDistribution distribution = random->random_distribution(); + const Shape& result_shape = random->shape(); + Literal result(result_shape); + + if constexpr (std::is_floating_point_v) { + switch (distribution) { + case RNG_UNIFORM: { + const Literal& low = + parent_->GetEvaluatedLiteralFor(random->operand(0)); + const Literal& high = + parent_->GetEvaluatedLiteralFor(random->operand(1)); + + // std::uniform_real_distribution(a, b) can sometimes return a value + // equal to b. Unclear if this is a spec bug or an implementation bug + // or WAI [0] [1] [2]. Anyway for our purposes we want a half-open + // interval, so we have to re-sample if we get `b` out. + // + // [0] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63176 + // [1] https://bugs.llvm.org/show_bug.cgi?id=18767 + // [2] http://open-std.org/JTC1/SC22/WG21/docs/lwg-active.html#2524 + const ReturnT low_val = low.Get({}); + const ReturnT high_val = high.Get({}); + std::uniform_real_distribution generator( + static_cast(low_val), + static_cast(high_val)); + TF_RETURN_IF_ERROR(result.Populate( + [&](absl::Span /*indexes*/) { + while (true) { + const ReturnT v = + static_cast(generator(parent_->engine_)); + if (v >= low_val && v < high_val) { + return v; + } + } + })); + break; + } + case RNG_NORMAL: { + const Literal& mean = + parent_->GetEvaluatedLiteralFor(random->operand(0)); + const Literal& stddev = + parent_->GetEvaluatedLiteralFor(random->operand(1)); + + std::normal_distribution generator( + static_cast(mean.Get({})), + static_cast(stddev.Get({}))); + + TF_RETURN_IF_ERROR(result.Populate( + [&](absl::Span /*indexes*/) { + return static_cast(generator(parent_->engine_)); + })); + break; + } + default: + return UnimplementedStrCat("The distribution ", + RandomDistribution_Name(distribution), + " is not implemented."); + } + parent_->evaluated_[random] = std::move(result); + return OkStatus(); + } + if constexpr (std::is_integral_v) { + switch (distribution) { + case RNG_UNIFORM: { + const Literal& low = + parent_->GetEvaluatedLiteralFor(random->operand(0)); + const Literal& high = + parent_->GetEvaluatedLiteralFor(random->operand(1)); + + // Note std::uniform_int_distribution assumes interval is closed, + // i.e., [low, high], but we want [low, high) instead. Hence high-1 is + // used as the upper range. + std::uniform_int_distribution generator( + static_cast(low.Get({})), + static_cast(high.Get({})) - 1); + + TF_RETURN_IF_ERROR(result.Populate( + [&](absl::Span /*indexes*/) { + return static_cast(generator(parent_->engine_)); + })); + break; + } + case RNG_NORMAL: { + return Unimplemented( + "Normal distribution is not supported for integral types."); + } + default: + return UnimplementedStrCat("The distribution ", + RandomDistribution_Name(distribution), + " is not implemented."); + } + parent_->evaluated_[random] = std::move(result); + return OkStatus(); + } + return UnsupportedTypeError(random); + } + + private: + StatusOr ElementWiseUnaryOp( + const HloInstruction* instruction, + const std::function& unary_op) { + const Literal& operand_literal = + parent_->GetEvaluatedLiteralFor(instruction->operand(0)); + TF_ASSIGN_OR_RETURN( + auto result_literal, + (HloEvaluator::ElementWiseUnaryOpImpl( + instruction, ConvertUnaryFunction(unary_op), operand_literal))); + + return std::move(result_literal); + } + + StatusOr ElementWiseBinaryOp( + const HloInstruction* instruction, + const std::function& + binary_op) { + const auto& shape = instruction->shape(); + const auto* lhs = instruction->operand(0); + const auto* rhs = instruction->operand(1); + TF_RET_CHECK(ShapeUtil::SameDimensions(shape, rhs->shape())); + TF_RET_CHECK(ShapeUtil::SameDimensions(lhs->shape(), rhs->shape())); + + const Literal& lhs_literal = parent_->GetEvaluatedLiteralFor(lhs); + const Literal& rhs_literal = parent_->GetEvaluatedLiteralFor(rhs); + + Literal result(shape); + + TF_RETURN_IF_ERROR(result.PopulateParallel( + [&](absl::Span multi_index, int) { + return ConvertBinaryFunction(binary_op)( + lhs_literal.Get(multi_index), + rhs_literal.Get(multi_index)); + })); + return std::move(result); + } + + template + StatusOr ElementwiseTernaryOp( + const HloInstruction* instruction, + const std::function& ternary_op) { + const auto& shape = instruction->shape(); + const auto* lhs = instruction->operand(0); + const auto* rhs = instruction->operand(1); + const auto* ehs = instruction->operand(2); + TF_RET_CHECK(ShapeUtil::SameDimensions(shape, lhs->shape())); + TF_RET_CHECK(ShapeUtil::SameDimensions(lhs->shape(), rhs->shape())); + TF_RET_CHECK(ShapeUtil::SameDimensions(rhs->shape(), ehs->shape())); + + const Literal& lhs_literal = parent_->GetEvaluatedLiteralFor(lhs); + const Literal& rhs_literal = parent_->GetEvaluatedLiteralFor(rhs); + const Literal& ehs_literal = parent_->GetEvaluatedLiteralFor(ehs); + + Literal result(shape); + + TF_RETURN_IF_ERROR(result.PopulateParallel( + [&](absl::Span multi_index, int) { + return ternary_op(lhs_literal.Get(multi_index), + rhs_literal.Get(multi_index), + ehs_literal.Get(multi_index)); + })); + + return std::move(result); + } + + template + static bool IsShiftOutOfBounds(ElementwiseT rhs) { + using UnsignedT = make_specialized_unsigned_t; + UnsignedT lhs_bits_unsigned = + static_cast(std::numeric_limits::digits); + UnsignedT rhs_unsigned = static_cast(rhs); + return rhs_unsigned >= lhs_bits_unsigned; + } + + HloEvaluator* parent_; +}; + +// These extern templates prevent users of this class from implicitly +// instantiating it. We explicitly instantiate this class in the various +// hlo_evaluator_typed_visitor*.cc files. +extern template class HloEvaluatorTypedVisitor; +extern template class HloEvaluatorTypedVisitor; +extern template class HloEvaluatorTypedVisitor; +extern template class HloEvaluatorTypedVisitor; +extern template class HloEvaluatorTypedVisitor; +extern template class HloEvaluatorTypedVisitor; +extern template class HloEvaluatorTypedVisitor; +extern template class HloEvaluatorTypedVisitor; +extern template class HloEvaluatorTypedVisitor; +extern template class HloEvaluatorTypedVisitor; +extern template class HloEvaluatorTypedVisitor; +extern template class HloEvaluatorTypedVisitor; +extern template class HloEvaluatorTypedVisitor; +extern template class HloEvaluatorTypedVisitor; +extern template class HloEvaluatorTypedVisitor; +extern template class HloEvaluatorTypedVisitor; +extern template class HloEvaluatorTypedVisitor; +extern template class HloEvaluatorTypedVisitor; +extern template class HloEvaluatorTypedVisitor; +extern template class HloEvaluatorTypedVisitor; +extern template class HloEvaluatorTypedVisitor; +extern template class HloEvaluatorTypedVisitor; + +} // namespace xla + +#endif // XLA_HLO_EVALUATOR_HLO_EVALUATOR_TYPED_VISITOR_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/dfs_hlo_visitor.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/dfs_hlo_visitor.h new file mode 100644 index 0000000000000000000000000000000000000000..1d981823c74797aeb9d1d49b27c772ed2018ae38 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/dfs_hlo_visitor.h @@ -0,0 +1,431 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_HLO_IR_DFS_HLO_VISITOR_H_ +#define XLA_HLO_IR_DFS_HLO_VISITOR_H_ + +#include +#include + +#include "absl/container/flat_hash_map.h" +#include "absl/strings/string_view.h" +#include "absl/types/span.h" +#include "xla/hlo/ir/hlo_opcode.h" +#include "xla/literal.h" +#include "xla/status.h" +#include "xla/types.h" +#include "xla/xla_data.pb.h" +#include "tsl/platform/status.h" + +namespace xla { + +class HloComputation; +class HloInstruction; + +// A postorder depth-first HloInstruction visitor. When Handle* is called on an +// instruction, all its operands were already visited. User code can subclass +// this to iterate over an HloInstruction DAG. The Handle* routines have +// operands / data unpacked for ease of use in the visitor subclass. +// +// No instruction will ever be visited twice; however, the root instruction will +// be reported again when the traversal is done via a call to FinishVisit. +// +// If new HloInstructions are added during the traversal (e.g. by replacing an +// instruction), they will also be visited if they are the operand of an +// instruction that has not been visited yet (i.e. the instruction is in state +// kNotVisited). If you want to avoid that a newly added instruction 'hlo' is +// visited, you can call SetVisited(hlo). This may be necessary in normalization +// passes that replace all instructions, otherwise already replaced instructions +// might be visited (and replaced) again. +// +// A subclass must override at least +// (either HandleElementwiseUnary or all the Handle methods for unary ops) and +// (either HandleElementwiseBinary or all the Handle methods for binary ops)). +// The default Handle methods for (unary, binary) ops call +// (HandleElementwiseUnary, HandleElementwiseBinary). +// The default (HandleElementwiseUnary, HandleElementwiseBinary) return an +// "unimplemented" error status. +// +// Note: this may change to an iterator in the future for flexibility purposes. +// +// Users should not use this class directly, but use the type-aliases +// DfsHloVisitor/ConstDfsHloVisitor instead. +template +class DfsHloVisitorBase { + static_assert( + std::is_same::value || + std::is_same::value, + "Template argument expected to be HloInstruction* or const " + "HloInstruction*"); + + public: + DfsHloVisitorBase() = default; + virtual ~DfsHloVisitorBase() = default; + + // These routines are self-descriptive, see class comment for usage + // information. + + virtual Status HandleElementwiseUnary(HloInstructionPtr hlo); + virtual Status HandleElementwiseBinary(HloInstructionPtr hlo); + + virtual Status HandleClamp(HloInstructionPtr hlo) = 0; + virtual Status HandleSelect(HloInstructionPtr hlo) = 0; + virtual Status HandleMaximum(HloInstructionPtr hlo) { + return HandleElementwiseBinary(hlo); + } + virtual Status HandleMinimum(HloInstructionPtr hlo) { + return HandleElementwiseBinary(hlo); + } + virtual Status HandleConcatenate(HloInstructionPtr hlo) = 0; + virtual Status HandleConvert(HloInstructionPtr hlo) { + return HandleElementwiseUnary(hlo); + } + virtual Status HandleBitcastConvert(HloInstructionPtr hlo) { + return HandleElementwiseUnary(hlo); + } + virtual Status HandleStochasticConvert(HloInstructionPtr hlo) { + return HandleElementwiseBinary(hlo); + } + virtual Status HandleCopy(HloInstructionPtr hlo) { + return HandleElementwiseUnary(hlo); + } + virtual Status HandleComplex(HloInstructionPtr hlo) { + return HandleElementwiseBinary(hlo); + } + virtual Status HandleMultiply(HloInstructionPtr hlo) { + return HandleElementwiseBinary(hlo); + } + virtual Status HandleDot(HloInstructionPtr hlo) = 0; + virtual Status HandlePower(HloInstructionPtr hlo) { + return HandleElementwiseBinary(hlo); + } + virtual Status HandleSqrt(HloInstructionPtr hlo) { + return HandleElementwiseUnary(hlo); + } + virtual Status HandleRsqrt(HloInstructionPtr hlo) { + return HandleElementwiseUnary(hlo); + } + virtual Status HandleCbrt(HloInstructionPtr hlo) { + return HandleElementwiseUnary(hlo); + } + /* go/keep-sorted start */ + virtual Status HandleAllGather(HloInstructionPtr hlo) = 0; + virtual Status HandleAllGatherDone(HloInstructionPtr hlo) = 0; + virtual Status HandleAllGatherStart(HloInstructionPtr hlo) = 0; + virtual Status HandleAllReduce(HloInstructionPtr hlo) = 0; + virtual Status HandleAllReduceDone(HloInstructionPtr hlo) = 0; + virtual Status HandleAllReduceStart(HloInstructionPtr hlo) = 0; + virtual Status HandleAllToAll(HloInstructionPtr hlo) = 0; + virtual Status HandleCollectivePermute(HloInstructionPtr hlo) = 0; + virtual Status HandleCollectivePermuteDone(HloInstructionPtr hlo) = 0; + virtual Status HandleCollectivePermuteStart(HloInstructionPtr hlo) = 0; + virtual Status HandleConvolution(HloInstructionPtr hlo) = 0; + virtual Status HandleOptimizationBarrier(HloInstructionPtr hlo) = 0; + virtual Status HandlePartitionId(HloInstructionPtr hlo) = 0; + virtual Status HandleReduceScatter(HloInstructionPtr hlo) = 0; + virtual Status HandleReplicaId(HloInstructionPtr hlo) = 0; + /* go/keep-sorted end */ + + /* go/keep-sorted start */ + virtual Status HandleCholesky(HloInstructionPtr hlo) = 0; + virtual Status HandleFft(HloInstructionPtr fft) = 0; + virtual Status HandleTopK(HloInstructionPtr hlo) = 0; + virtual Status HandleTriangularSolve(HloInstructionPtr hlo) = 0; + /* go/keep-sorted end */ + + virtual Status HandleGetDimensionSize(HloInstructionPtr hlo) = 0; + virtual Status HandleSetDimensionSize(HloInstructionPtr hlo) = 0; + + virtual Status HandleCompare(HloInstructionPtr hlo) { + return HandleElementwiseBinary(hlo); + } + virtual Status HandleAdd(HloInstructionPtr hlo) { + return HandleElementwiseBinary(hlo); + } + virtual Status HandleDivide(HloInstructionPtr hlo) { + return HandleElementwiseBinary(hlo); + } + virtual Status HandleRemainder(HloInstructionPtr hlo) { + return HandleElementwiseBinary(hlo); + } + virtual Status HandleSubtract(HloInstructionPtr hlo) { + return HandleElementwiseBinary(hlo); + } + virtual Status HandleAbs(HloInstructionPtr hlo) { + return HandleElementwiseUnary(hlo); + } + virtual Status HandleAtan2(HloInstructionPtr hlo) { + return HandleElementwiseBinary(hlo); + } + virtual Status HandleRound(HloInstructionPtr hlo) { + return HandleElementwiseUnary(hlo); + } + virtual Status HandleRoundNearestEven(HloInstructionPtr hlo) { + return HandleElementwiseUnary(hlo); + } + virtual Status HandleLogistic(HloInstructionPtr hlo) { + return HandleElementwiseUnary(hlo); + } + virtual Status HandleSign(HloInstructionPtr hlo) { + return HandleElementwiseUnary(hlo); + } + virtual Status HandleNegate(HloInstructionPtr hlo) { + return HandleElementwiseUnary(hlo); + } + virtual Status HandleExp(HloInstructionPtr hlo) { + return HandleElementwiseUnary(hlo); + } + virtual Status HandleExpm1(HloInstructionPtr hlo) { + return HandleElementwiseUnary(hlo); + } + virtual Status HandleFloor(HloInstructionPtr hlo) { + return HandleElementwiseUnary(hlo); + } + virtual Status HandleCeil(HloInstructionPtr hlo) { + return HandleElementwiseUnary(hlo); + } + virtual Status HandleLog(HloInstructionPtr hlo) { + return HandleElementwiseUnary(hlo); + } + virtual Status HandleClz(HloInstructionPtr hlo) { + return HandleElementwiseUnary(hlo); + } + virtual Status HandleLog1p(HloInstructionPtr hlo) { + return HandleElementwiseUnary(hlo); + } + virtual Status HandleCos(HloInstructionPtr hlo) { + return HandleElementwiseUnary(hlo); + } + virtual Status HandleSin(HloInstructionPtr hlo) { + return HandleElementwiseUnary(hlo); + } + virtual Status HandleTan(HloInstructionPtr hlo) { + return HandleElementwiseUnary(hlo); + } + virtual Status HandleTanh(HloInstructionPtr hlo) { + return HandleElementwiseUnary(hlo); + } + virtual Status HandleReal(HloInstructionPtr hlo) { + return HandleElementwiseUnary(hlo); + } + virtual Status HandleImag(HloInstructionPtr hlo) { + return HandleElementwiseUnary(hlo); + } + virtual Status HandleIsFinite(HloInstructionPtr hlo) { + return HandleElementwiseUnary(hlo); + } + virtual Status HandleAnd(HloInstructionPtr hlo) { + return HandleElementwiseBinary(hlo); + } + virtual Status HandleNot(HloInstructionPtr hlo) { + return HandleElementwiseUnary(hlo); + } + virtual Status HandleOr(HloInstructionPtr hlo) { + return HandleElementwiseBinary(hlo); + } + virtual Status HandleXor(HloInstructionPtr hlo) { + return HandleElementwiseBinary(hlo); + } + virtual Status HandlePopulationCount(HloInstructionPtr hlo) { + return HandleElementwiseUnary(hlo); + } + virtual Status HandleShiftLeft(HloInstructionPtr hlo) { + return HandleElementwiseBinary(hlo); + } + virtual Status HandleShiftRightArithmetic(HloInstructionPtr hlo) { + return HandleElementwiseBinary(hlo); + } + virtual Status HandleShiftRightLogical(HloInstructionPtr hlo) { + return HandleElementwiseBinary(hlo); + } + + virtual Status HandleReducePrecision(HloInstructionPtr hlo) { + return HandleElementwiseUnary(hlo); + } + + virtual Status HandleDomain(HloInstructionPtr hlo) { + return HandleElementwiseUnary(hlo); + } + + /* go/keep-sorted start */ + virtual Status HandleInfeed(HloInstructionPtr hlo) = 0; + virtual Status HandleOutfeed(HloInstructionPtr hlo) = 0; + /* go/keep-sorted end */ + + /* go/keep-sorted start */ + virtual Status HandleBitcast(HloInstructionPtr hlo) = 0; + virtual Status HandleBroadcast(HloInstructionPtr hlo) = 0; + virtual Status HandleCall(HloInstructionPtr hlo) = 0; + virtual Status HandleConditional(HloInstructionPtr hlo) = 0; + virtual Status HandleConstant(HloInstructionPtr hlo) = 0; + virtual Status HandleCustomCall(HloInstructionPtr hlo) = 0; + virtual Status HandleDynamicReshape(HloInstructionPtr hlo) = 0; + virtual Status HandleDynamicSlice(HloInstructionPtr hlo) = 0; + virtual Status HandleDynamicUpdateSlice(HloInstructionPtr hlo) = 0; + virtual Status HandleFusion(HloInstructionPtr hlo) = 0; + virtual Status HandleGather(HloInstructionPtr hlo) = 0; + virtual Status HandleGetTupleElement(HloInstructionPtr hlo) = 0; + virtual Status HandleIota(HloInstructionPtr hlo) = 0; + virtual Status HandleMap(HloInstructionPtr hlo) = 0; + virtual Status HandleParameter(HloInstructionPtr hlo) = 0; + virtual Status HandleReduce(HloInstructionPtr hlo) = 0; + virtual Status HandleReduceWindow(HloInstructionPtr hlo) = 0; + virtual Status HandleReshape(HloInstructionPtr hlo) = 0; + virtual Status HandleReverse(HloInstructionPtr hlo) = 0; + virtual Status HandleRng(HloInstructionPtr hlo) = 0; + virtual Status HandleRngBitGenerator(HloInstructionPtr hlo) = 0; + virtual Status HandleRngGetAndUpdateState(HloInstructionPtr hlo) = 0; + virtual Status HandleScatter(HloInstructionPtr hlo) = 0; + virtual Status HandleSelectAndScatter(HloInstructionPtr hlo) = 0; + virtual Status HandleSlice(HloInstructionPtr hlo) = 0; + virtual Status HandleSort(HloInstructionPtr hlo) = 0; + virtual Status HandleTranspose(HloInstructionPtr hlo) = 0; + virtual Status HandleTuple(HloInstructionPtr hlo) = 0; + virtual Status HandleWhile(HloInstructionPtr hlo) = 0; + /* go/keep-sorted end */ + + virtual Status HandlePad(HloInstructionPtr hlo) = 0; + + virtual Status HandleAsyncStart(HloInstructionPtr hlo) = 0; + virtual Status HandleAsyncUpdate(HloInstructionPtr hlo) = 0; + virtual Status HandleAsyncDone(HloInstructionPtr hlo) = 0; + + virtual Status HandleCopyStart(HloInstructionPtr copy_start) = 0; + virtual Status HandleCopyDone(HloInstructionPtr copy_done) = 0; + + virtual Status HandleSend(HloInstructionPtr send) = 0; + virtual Status HandleSendDone(HloInstructionPtr send_done) = 0; + + virtual Status HandleRecv(HloInstructionPtr recv) = 0; + virtual Status HandleRecvDone(HloInstructionPtr recv_done) = 0; + + virtual Status HandleBatchNormTraining(HloInstructionPtr hlo) = 0; + + virtual Status HandleBatchNormInference(HloInstructionPtr hlo) = 0; + + virtual Status HandleBatchNormGrad(HloInstructionPtr hlo) = 0; + + virtual Status HandleAddDependency(HloInstructionPtr add_dependency) = 0; + virtual Status HandleAfterAll(HloInstructionPtr token) = 0; + + // Invoked to inform the visitor that the traversal has completed, and that + // the root was "root". + virtual Status FinishVisit(HloInstructionPtr root) = 0; + + // 3 possible visitation states of HLO instructions. Each instruction's + // state only flows one way: kNotVisited -> kVisiting -> kVisited. + enum VisitState { + kNotVisited = 0, + kVisiting = 1, + kVisited = 2, + }; + + VisitState GetVisitState(int id) { + auto iter = visit_state_.find(id); + if (iter == visit_state_.end()) { + return VisitState::kNotVisited; + } + return iter->second; + } + VisitState GetVisitState(const HloInstruction& instruction); + + // Resize internal state if necessary to hold state for ids <= num. + // This call is purely a performance hint and can be omitted without + // affecting correctness. + void ReserveVisitStates(int num) { visit_state_.reserve(num); } + size_t VisitStateCapacity() const { return visit_state_.capacity(); } + + // Useful when we want to visit the same computation more than once with the + // same visitor. + void ResetVisitStates() { + // Clear the map, but don't resize the capacity across uses -- Calculating + // and reserving space could be expensive, and we always use the same + // module->instruction_count() as the capacity. + visit_state_.erase(visit_state_.begin(), visit_state_.end()); + } + + // Useful when we want to free up the memory used by the visit state without + // destroying the actual visitor subclass. + void DestroyVisitState() { + visit_state_ = absl::flat_hash_map{}; + } + + void SetVisitState(int id, VisitState state) { visit_state_[id] = state; } + + // Sets the visitation state of the given instruction as kVisiting. + // + // Precondition: current state must be kNotVisited. + void SetVisiting(const HloInstruction& instruction); + + // Sets the visitation state of the given instruction as kVisited. + // + // Precondition: current state must be either kNotVisited or kVisiting. + void SetVisited(const HloInstruction& instruction); + + // Returns whether the state of the given instruction is kVisiting. + bool IsVisiting(const HloInstruction& instruction) { + return GetVisitState(instruction) == kVisiting; + } + + // Returns whether the state of the given instruction is kVisited. + bool DidVisit(const HloInstruction& instruction) { + return GetVisitState(instruction) == kVisited; + } + + // Returns whether the state of the given instruction is kNotVisited. + bool NotVisited(const HloInstruction& instruction) { + return GetVisitState(instruction) == kNotVisited; + } + + // This method should be overridden by subclasses that wish to run some + // operation on an op before its Handle* visitor method is called. + // + // For any HLO op, the order of calls is: + // + // Preprocess(op); + // Handle/OpType/(op); + // Postprocess(op); + // + // Overriding methods should call DfsHloVisitor::Preprocess before doing their + // own preprocessing. + virtual Status Preprocess(HloInstructionPtr hlo); + + // This method should be overridden by subclasses that wish to run some + // operation on an op after its Handle* visitor method is called. See + // Preprocess for more details. + // + // Overriding methods should call DfsHloVisitor::Postprocess after doing their + // own postprocessing. + virtual Status Postprocess(HloInstructionPtr hlo); + + private: + absl::flat_hash_map visit_state_; + + DfsHloVisitorBase(const DfsHloVisitorBase&) = delete; + DfsHloVisitorBase& operator=(const DfsHloVisitorBase&) = delete; +}; + +// Explicit instantiations in dfs_hlo_visitor.cc. +extern template class DfsHloVisitorBase; +extern template class DfsHloVisitorBase; + +// Users should use one of these two type aliases, which are the only two valid +// instantiations of DfsHloVisitorBase. +using DfsHloVisitor = DfsHloVisitorBase; +using ConstDfsHloVisitor = DfsHloVisitorBase; + +} // namespace xla + +#endif // XLA_HLO_IR_DFS_HLO_VISITOR_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/dfs_hlo_visitor_with_default.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/dfs_hlo_visitor_with_default.h new file mode 100644 index 0000000000000000000000000000000000000000..93cf5a6dba06d96c8e80506ae3fdd142317cf0b7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/dfs_hlo_visitor_with_default.h @@ -0,0 +1,401 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_HLO_IR_DFS_HLO_VISITOR_WITH_DEFAULT_H_ +#define XLA_HLO_IR_DFS_HLO_VISITOR_WITH_DEFAULT_H_ + +#include +#include + +#include "absl/base/optimization.h" +#include "absl/strings/string_view.h" +#include "xla/hlo/ir/dfs_hlo_visitor.h" +#include "xla/hlo/ir/hlo_computation.h" +#include "xla/hlo/ir/hlo_instruction.h" +#include "xla/hlo/ir/hlo_module.h" +#include "xla/statusor.h" +#include "tsl/platform/status.h" + +namespace xla { + +// DfsHloVisitor with default action based on the HloInstruction being visited. +// Users should not use this class directly, but use the type aliases +// DfsHloVisitorWithDefault/ConstDfsHloVisitorWithDefault instead. +// +// Do *not* add an override to this class if the opcode is covered by +// HandleElementwiseUnary/Binary. These opcode handlers dispatch to +// HandleElementwiseUnary/Binary in DfsHloVisitorBase. Adding such a handler +// here will break passes which rely on the HandleElementwiseUnary/Binary +// handling these opcodes. +template +class DfsHloVisitorWithDefaultBase + : public DfsHloVisitorBase { + public: + DfsHloVisitorWithDefaultBase() = default; + ~DfsHloVisitorWithDefaultBase() override = default; + + // Default action performed on HloInstruction. + virtual Status DefaultAction(HloInstructionPtr hlo_instruction) = 0; + + Status HandleElementwiseUnary(HloInstructionPtr hlo) override { + return DefaultAction(hlo); + } + Status HandleElementwiseBinary(HloInstructionPtr hlo) override { + return DefaultAction(hlo); + } + + Status HandleBatchNormTraining(HloInstructionPtr hlo) override { + return DefaultAction(hlo); + } + + Status HandleBatchNormInference(HloInstructionPtr hlo) override { + return DefaultAction(hlo); + } + + Status HandleBatchNormGrad(HloInstructionPtr hlo) override { + return DefaultAction(hlo); + } + + Status HandleClamp(HloInstructionPtr clamp) override { + return DefaultAction(clamp); + } + Status HandleConcatenate(HloInstructionPtr concatenate) override { + return DefaultAction(concatenate); + } + Status HandleSelect(HloInstructionPtr select) override { + return DefaultAction(select); + } + Status HandleDot(HloInstructionPtr dot) override { + return DefaultAction(dot); + } + Status HandleConvolution(HloInstructionPtr convolution) override { + return DefaultAction(convolution); + } + Status HandleFft(HloInstructionPtr fft) override { + return DefaultAction(fft); + } + Status HandleTriangularSolve(HloInstructionPtr hlo) override { + return DefaultAction(hlo); + } + Status HandleCholesky(HloInstructionPtr hlo) override { + return DefaultAction(hlo); + } + Status HandleOptimizationBarrier(HloInstructionPtr hlo) override { + return DefaultAction(hlo); + } + Status HandleAllGather(HloInstructionPtr crs) override { + return DefaultAction(crs); + } + Status HandleAllGatherStart(HloInstructionPtr crs) override { + return DefaultAction(crs); + } + Status HandleAllGatherDone(HloInstructionPtr crs) override { + return DefaultAction(crs); + } + Status HandleAllReduce(HloInstructionPtr crs) override { + return DefaultAction(crs); + } + Status HandleReduceScatter(HloInstructionPtr hlo) override { + return DefaultAction(hlo); + } + Status HandleAllReduceStart(HloInstructionPtr hlo) override { + return DefaultAction(hlo); + } + Status HandleAllReduceDone(HloInstructionPtr hlo) override { + return DefaultAction(hlo); + } + Status HandleAllToAll(HloInstructionPtr hlo) override { + return DefaultAction(hlo); + } + Status HandleCollectivePermute(HloInstructionPtr hlo) override { + return DefaultAction(hlo); + } + Status HandleCollectivePermuteStart(HloInstructionPtr hlo) override { + return DefaultAction(hlo); + } + Status HandleCollectivePermuteDone(HloInstructionPtr hlo) override { + return DefaultAction(hlo); + } + Status HandleReplicaId(HloInstructionPtr hlo) override { + return DefaultAction(hlo); + } + Status HandlePartitionId(HloInstructionPtr hlo) override { + return DefaultAction(hlo); + } + Status HandleRng(HloInstructionPtr random) override { + return DefaultAction(random); + } + Status HandleRngBitGenerator(HloInstructionPtr random) override { + return DefaultAction(random); + } + Status HandleRngGetAndUpdateState(HloInstructionPtr random) override { + return DefaultAction(random); + } + Status HandleInfeed(HloInstructionPtr infeed) override { + return DefaultAction(infeed); + } + Status HandleOutfeed(HloInstructionPtr outfeed) override { + return DefaultAction(outfeed); + } + Status HandleReverse(HloInstructionPtr reverse) override { + return DefaultAction(reverse); + } + Status HandleSort(HloInstructionPtr sort) override { + return DefaultAction(sort); + } + Status HandleConstant(HloInstructionPtr constant) override { + return DefaultAction(constant); + } + Status HandleIota(HloInstructionPtr iota) override { + return DefaultAction(iota); + } + Status HandleGetTupleElement(HloInstructionPtr get_tuple_element) override { + return DefaultAction(get_tuple_element); + } + Status HandleParameter(HloInstructionPtr parameter) override { + return DefaultAction(parameter); + } + Status HandleFusion(HloInstructionPtr fusion) override { + return DefaultAction(fusion); + } + Status HandleCall(HloInstructionPtr call) override { + return DefaultAction(call); + } + Status HandleCustomCall(HloInstructionPtr custom_call) override { + return DefaultAction(custom_call); + } + Status HandleSlice(HloInstructionPtr slice) override { + return DefaultAction(slice); + } + Status HandleDynamicSlice(HloInstructionPtr dynamic_slice) override { + return DefaultAction(dynamic_slice); + } + Status HandleDynamicUpdateSlice( + HloInstructionPtr dynamic_update_slice) override { + return DefaultAction(dynamic_update_slice); + } + Status HandleTuple(HloInstructionPtr tuple) override { + return DefaultAction(tuple); + } + Status HandleMap(HloInstructionPtr map) override { + return DefaultAction(map); + } + Status HandleReduce(HloInstructionPtr reduce) override { + return DefaultAction(reduce); + } + Status HandleReduceWindow(HloInstructionPtr reduce_window) override { + return DefaultAction(reduce_window); + } + Status HandleSelectAndScatter(HloInstructionPtr select_and_scatter) override { + return DefaultAction(select_and_scatter); + } + Status HandleBitcast(HloInstructionPtr bitcast) override { + return DefaultAction(bitcast); + } + Status HandleBroadcast(HloInstructionPtr broadcast) override { + return DefaultAction(broadcast); + } + Status HandlePad(HloInstructionPtr pad) override { + return DefaultAction(pad); + } + Status HandleDynamicReshape(HloInstructionPtr dynamic_reshape) override { + return DefaultAction(dynamic_reshape); + } + Status HandleReshape(HloInstructionPtr reshape) override { + return DefaultAction(reshape); + } + Status HandleTranspose(HloInstructionPtr transpose) override { + return DefaultAction(transpose); + } + Status HandleWhile(HloInstructionPtr xla_while) override { + return DefaultAction(xla_while); + } + Status HandleConditional(HloInstructionPtr conditional) override { + return DefaultAction(conditional); + } + Status HandleAsyncStart(HloInstructionPtr async_start) override { + return DefaultAction(async_start); + } + Status HandleAsyncUpdate(HloInstructionPtr async_update) override { + return DefaultAction(async_update); + } + Status HandleAsyncDone(HloInstructionPtr async_done) override { + return DefaultAction(async_done); + } + Status HandleCopyStart(HloInstructionPtr copy_start) override { + return DefaultAction(copy_start); + } + Status HandleCopyDone(HloInstructionPtr copy_done) override { + return DefaultAction(copy_done); + } + Status HandleRecv(HloInstructionPtr recv) override { + return DefaultAction(recv); + } + Status HandleRecvDone(HloInstructionPtr recv_done) override { + return DefaultAction(recv_done); + } + Status HandleSend(HloInstructionPtr send) override { + return DefaultAction(send); + } + Status HandleTopK(HloInstructionPtr topk) override { + return DefaultAction(topk); + } + Status HandleSendDone(HloInstructionPtr send_done) override { + return DefaultAction(send_done); + } + Status HandleGather(HloInstructionPtr gather) override { + return DefaultAction(gather); + } + Status HandleScatter(HloInstructionPtr scatter) override { + return DefaultAction(scatter); + } + Status HandleAfterAll(HloInstructionPtr token) override { + return DefaultAction(token); + } + Status HandleGetDimensionSize(HloInstructionPtr get_size) override { + return DefaultAction(get_size); + } + Status HandleSetDimensionSize(HloInstructionPtr get_size) override { + return DefaultAction(get_size); + } + Status HandleAddDependency(HloInstructionPtr add_dependency) override { + return DefaultAction(add_dependency); + } + + // Invoked to inform the visitor that the traversal has completed, and that + // the root was "root". + Status FinishVisit(HloInstructionPtr /*root*/) override { return OkStatus(); } + + private: + DfsHloVisitorWithDefaultBase(const DfsHloVisitorWithDefaultBase&) = delete; + DfsHloVisitorWithDefaultBase& operator=(const DfsHloVisitorWithDefaultBase&) = + delete; +}; + +// Users should use these type aliases which are only two valid instantiations. +using DfsHloVisitorWithDefault = DfsHloVisitorWithDefaultBase; +using ConstDfsHloVisitorWithDefault = + DfsHloVisitorWithDefaultBase; + +// A common base class for visitors performing rewriting operation. +// +// Subclasses call ReplaceWithNewInstruction and ReplaceInstruction while +// visiting. +class DfsHloRewriteVisitor : public DfsHloVisitorWithDefault { + public: + // Runs a visitor on the module and returns whether the module has changed. + StatusOr RunOnModule( + HloModule* module, + const absl::flat_hash_set& execution_threads = {}) { + Status status; + for (HloComputation* computation : + module->MakeNonfusionComputations(execution_threads)) { + status = computation->Accept(this); + if (ABSL_PREDICT_FALSE(!status.ok())) return status; + } + return changed(); + } + + // Default visitor action is to do nothing and return OK. + Status DefaultAction(HloInstruction* /*hlo_instruction*/) override { + return OkStatus(); + } + + bool changed() const { return changed_; } + + protected: + // Replaces the existing HLO instruction old_instruction, with + // new_instruction, and marks the optimizer status as changed. + // Returns the Status representing the result of the replace operation. + Status ReplaceWithNewInstruction( + HloInstruction* old_instruction, + std::unique_ptr new_instruction) { + VLOG(3) << "Replacing instruction:" + << "\n old: " << old_instruction->ToString() + << "\n new: " << new_instruction->ToString(); + Status status = old_instruction->parent()->ReplaceWithNewInstruction( + old_instruction, std::move(new_instruction)); + if (ABSL_PREDICT_TRUE(status.ok())) { + changed_ = true; + } + return status; + } + + // Replaces the existing HLO instruction old_instruction, with + // new_instruction, and marks the optimizer status as changed. + // Returns the Status representing the result of the replace operation. + StatusOr ReplaceInstruction(HloInstruction* old_instruction, + HloInstruction* new_instruction, + bool preserve_sharding) { + VLOG(3) << "Replacing instruction:" + << "\n old: " << old_instruction->ToString() + << "\n new: " << new_instruction->ToString(); + StatusOr changed_or = old_instruction->parent()->ReplaceInstruction( + old_instruction, new_instruction, preserve_sharding); + if (ABSL_PREDICT_TRUE(changed_or.ok())) { + changed_ |= changed_or.value(); + } + return changed_or; + } + + Status ReplaceInstruction(HloInstruction* old_instruction, + HloInstruction* new_instruction) { + StatusOr changed_or = + ReplaceInstruction(old_instruction, new_instruction, + /*preserve_sharding=*/false); + if (ABSL_PREDICT_TRUE(changed_or.ok())) { + DCHECK(changed_or.value()); + } + return changed_or.status(); + } + + // Mark the computation as having changed. + void MarkAsChanged() { changed_ = true; } + + private: + bool changed_ = false; +}; + +// (Const)FunctionVisitor lets you transform an +// std::function into a (Const)DfsHloVisitor. +// +// This is useful if you have code that needs to handle visitors in the form of +// both std::function and DfsHloVisitor. You can wrap the function in a +// FunctionVisitor and then treat it like any other DfsHloVisitor. +template +class FunctionVisitorBase + : public DfsHloVisitorWithDefaultBase { + public: + explicit FunctionVisitorBase( + std::function visitor_func) + : visitor_func_(std::move(visitor_func)) {} + + Status DefaultAction(HloInstructionPtr hlo_instruction) override { + return visitor_func_(hlo_instruction); + } + + private: + FunctionVisitorBase(const FunctionVisitorBase&) = delete; + FunctionVisitorBase& operator=(const FunctionVisitorBase&) = delete; + + std::function visitor_func_; +}; + +using FunctionVisitor = FunctionVisitorBase; +using ConstFunctionVisitor = FunctionVisitorBase; + +} // namespace xla + +#endif // XLA_HLO_IR_DFS_HLO_VISITOR_WITH_DEFAULT_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/dynamic_parameter_binding.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/dynamic_parameter_binding.h new file mode 100644 index 0000000000000000000000000000000000000000..b40569d249a9e2645618190810e570da56523d6e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/dynamic_parameter_binding.h @@ -0,0 +1,123 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_HLO_IR_DYNAMIC_PARAMETER_BINDING_H_ +#define XLA_HLO_IR_DYNAMIC_PARAMETER_BINDING_H_ + +#include +#include +#include +#include +#include + +#include "absl/container/flat_hash_map.h" +#include "xla/service/hlo.pb.h" +#include "xla/shape_tree.h" +#include "xla/shape_util.h" + +namespace xla { + +class HloModule; +// We currently use an explicit API that takes an extra parameter to indicate +// the runtime size of a dynamic dimension. DynamicParameterBinding indicates +// the relationship between parameter: We can have a dynamic parameter that +// points to another target parameter to indicate that the target parameter is +// dynamic. +// +// +// TODO(b/119520625): Remove this API once we have more dynamic shape infra +// ready. +class DynamicParameterBinding { + public: + // DynamicParameter represents a special parameter that is used to represent + // the runtime size of a dimension of another parameter. A dynamic parameter + // has to be a scalar value. + struct DynamicParameter { + // The parameter number of dynamic parameter. + int64_t parameter_num; + // The index of the parameter. + ShapeIndex parameter_index; + }; + + // DynamicDimension represents a dimension whose size is determined at + // runtime. A DynamicDimension's runtime size is determined by the binded + // DynamicParameter using `DynamicParameterBinding::Bind` method. + struct DynamicDimension { + // The parameter number of dynamic dimension. + int64_t parameter_num; + // The subshape index of the parameter. + ShapeIndex parameter_index; + // The dimension number in the subshape. + int64_t dimension; + + // "friend" keyword are added so these functions can be found by ADL. + template + friend H AbslHashValue(H h, const DynamicDimension& m) { + return H::combine(std::move(h), m.parameter_num, m.parameter_index, + m.dimension); + } + + friend bool operator==(const DynamicDimension& lhs, + const DynamicDimension& rhs) { + return lhs.parameter_num == rhs.parameter_num && + lhs.parameter_index == rhs.parameter_index && + lhs.dimension == rhs.dimension; + } + }; + + DynamicParameterBinding() = default; + + virtual ~DynamicParameterBinding() = default; + + // Adds binding which indicates that the dimension indicated by + // `dynamic_dimension` is dynamic, and its runtime size is represented by + // `dynamic_parameter`. + Status Bind(const DynamicParameter& dynamic_parameter, + const DynamicDimension& dynamic_dimension); + + // Returns the parameter and the index representing the runtime size of + // dimension `dim_num` of parameter `param_num` at `param_index`. + // + // Returns nullopt if the binding is not set. + std::optional GetBinding( + const DynamicDimension& dynamic_dimension) const; + + using BindingFn = + std::function; + + // Iterate through each binding. + Status ForEachBinding(BindingFn fn) const; + + std::string ToString() const; + + // Verifies that the given binding is valid for the given module. + // Specifically, the binding's parameter and parameter size should be valid. + Status Verify(const HloModule& module) const; + + private: + // Keeps track of mappings from DynamicDimension to DynamicParameter. The + // direction of is chosen so that we can easily query if a dimension is + // dynamic and which dynamic parameter represents the real size of that + // dimension. + absl::flat_hash_map bindings_; +}; + +std::ostream& operator<<(std::ostream& out, + const DynamicParameterBinding& binding); + +} // namespace xla + +#endif // XLA_HLO_IR_DYNAMIC_PARAMETER_BINDING_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/hlo_casting_utils.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/hlo_casting_utils.h new file mode 100644 index 0000000000000000000000000000000000000000..38549d68fad5fdb9254fc98a299e69ce6bd80479 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/hlo_casting_utils.h @@ -0,0 +1,115 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +// Casting utility functions for HLO instructions. + +#ifndef XLA_HLO_IR_HLO_CASTING_UTILS_H_ +#define XLA_HLO_IR_HLO_CASTING_UTILS_H_ + +#include + +#include "xla/hlo/ir/hlo_instruction.h" +#include "tsl/platform/logging.h" + +namespace xla { + +template +using EnableIfDerivedFromHlo = + typename std::enable_if::value>::type; + +// Casts an HloInstruction pointer to one of its subclasses, dies if argument is +// nullptr or runtime information does not match. +// +// Similar to LLVM's cast. +template * = nullptr> +const T* Cast(const HloInstruction* instruction) { + CHECK(instruction != nullptr); + CHECK(T::ClassOf(instruction)) + << "Invalid HloInstruction casting. Destination type: " + << typeid(T).name() << ". Instruction: " << instruction->name(); + const T* casted = static_cast(instruction); +#ifndef NDEBUG + const T* dynamic_casted = dynamic_cast(instruction); + CHECK(dynamic_casted != nullptr) + << "Invalid HloInstruction casting. Destination type: " + << typeid(T).name() << ". Instruction: " << instruction->name(); +#endif + return casted; +} + +// Non-const overload of Cast. +template * = nullptr> +T* Cast(HloInstruction* instruction) { + return const_cast( + Cast(const_cast(instruction))); +} + +// Works just like the Cast, except that it allows for a null pointer as an +// argument which it then propagates. +// +// Similar to LLVM's cast_or_null. +template * = nullptr> +const T* CastOrNull(const HloInstruction* instruction) { + return instruction != nullptr ? Cast(instruction) : nullptr; +} + +// Non-const overload of CastOrNull. +template * = nullptr> +T* CastOrNull(HloInstruction* instruction) { + return const_cast( + CastOrNull(const_cast(instruction))); +} + +// Casts an HloInstruction pointer to one of its subclasses, dies if argument is +// nullptr, returns nullptr if runtime information does not match. +// +// Similar to LLVM's dyn_cast. +template * = nullptr> +const T* DynCast(const HloInstruction* instruction) { + CHECK(instruction != nullptr); + const T* casted = + T::ClassOf(instruction) ? static_cast(instruction) : nullptr; +#ifndef NDEBUG + CHECK_EQ(casted, dynamic_cast(instruction)); +#endif + return casted; +} + +// Non-const overload of DynCast. +template * = nullptr> +T* DynCast(HloInstruction* instruction) { + return const_cast( + DynCast(const_cast(instruction))); +} + +// Works just like the DynCast, except that it allows for a null pointer as an +// argument which it then propagates. +// +// Similar to LLVM's dyn_cast_or_null. +template * = nullptr> +const T* DynCastOrNull(const HloInstruction* instruction) { + return instruction != nullptr ? DynCast(instruction) : nullptr; +} + +// Non-const overload of DynCastOrNull. +template * = nullptr> +T* DynCastOrNull(HloInstruction* instruction) { + return const_cast( + DynCastOrNull(const_cast(instruction))); +} + +} // namespace xla + +#endif // XLA_HLO_IR_HLO_CASTING_UTILS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/hlo_clone_context.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/hlo_clone_context.h new file mode 100644 index 0000000000000000000000000000000000000000..b9115bb46cae48358026b8deecdf9dc860a992b6 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/hlo_clone_context.h @@ -0,0 +1,98 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_HLO_IR_HLO_CLONE_CONTEXT_H_ +#define XLA_HLO_IR_HLO_CLONE_CONTEXT_H_ + +#include + +#include "absl/container/flat_hash_map.h" +#include "xla/map_util.h" + +namespace xla { + +class HloInstruction; +class HloComputation; +class HloModule; + +// Data structure used to track the cloning of HloInstruction and HloComputation +// objects. +class HloCloneContext { + public: + // Creates a new HloCloneContext object to clone HloInstruction and + // HloComputation objects to be added to the module specified as argument. + // The suffix string will be appended to computation names. + explicit HloCloneContext(HloModule* module, const std::string& suffix = "") + : module_(module), suffix_(suffix) {} + + HloModule* module() const { return module_; } + + const std::string& suffix() const { return suffix_; } + + void MapInstruction(const HloInstruction* old_instruction, + HloInstruction* new_instruction) { + instructions_[old_instruction] = new_instruction; + } + + void MapComputation(const HloComputation* old_computation, + HloComputation* new_computation) { + computations_[old_computation] = new_computation; + } + + // Finds the new instruction mapped to its old copy, or return nullptr in case + // it is not found. + HloInstruction* FindInstruction(const HloInstruction* old_instruction) const { + return FindOrDefault(instructions_, old_instruction, nullptr); + } + + // Finds the new computation mapped to its old copy, or return nullptr in case + // it is not found. + HloComputation* FindComputation(const HloComputation* old_computation) const { + return FindOrDefault(computations_, old_computation, nullptr); + } + + // Retrieves the new instruction mapped to its old copy, or fail if not found. + HloInstruction* GetInstruction(const HloInstruction* old_instruction) const { + return FindOrDie(instructions_, old_instruction); + } + + // Retrieves the new computation mapped to its old copy, or fail if not found. + HloComputation* GetComputation(const HloComputation* old_computation) const { + return FindOrDie(computations_, old_computation); + } + + const absl::flat_hash_map& + cloned_instructions() const { + return instructions_; + } + + const absl::flat_hash_map& + cloned_computations() const { + return computations_; + } + + private: + HloCloneContext(const HloCloneContext&) = delete; + const HloCloneContext& operator=(const HloCloneContext&) = delete; + + HloModule* module_; + std::string suffix_; + absl::flat_hash_map instructions_; + absl::flat_hash_map computations_; +}; + +} // namespace xla + +#endif // XLA_HLO_IR_HLO_CLONE_CONTEXT_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/hlo_computation.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/hlo_computation.h new file mode 100644 index 0000000000000000000000000000000000000000..af2b80496d6c252b24c94ce9930d8cb128d76406 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/hlo_computation.h @@ -0,0 +1,927 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_HLO_IR_HLO_COMPUTATION_H_ +#define XLA_HLO_IR_HLO_COMPUTATION_H_ + +#include +#include +#include +#include +#include +#include + +#include "absl/container/flat_hash_map.h" +#include "absl/container/flat_hash_set.h" +#include "absl/functional/function_ref.h" +#include "absl/strings/cord.h" +#include "absl/strings/string_view.h" +#include "absl/types/span.h" +#include "xla/hlo/ir/dfs_hlo_visitor.h" +#include "xla/hlo/ir/hlo_clone_context.h" +#include "xla/hlo/ir/hlo_instruction.h" +#include "xla/iterator_util.h" +#include "xla/printer.h" +#include "xla/service/hlo.pb.h" +#include "xla/service/name_uniquer.h" +#include "xla/shape_tree.h" +#include "xla/statusor.h" +#include "xla/util.h" +#include "xla/xla_data.pb.h" + +namespace xla { + +class HloModule; + +// Describes a computation at the HLO level. +// +// You can think of an HloComputation like a function. It has some inputs +// (parameters) and returns exactly one value (the value of its root node). If +// you want to return multiple values, you can return a tuple. +// +// The instructions inside of a computation do not have an explicit total order. +// Instead, they have a partial order determined by their data and control +// dependencies. +// +// An HloModule contains one "entry computation" -- this is like main() in a C +// program. Every other computation inside of a module is attached to one or +// more HloInstructions, as a "nested computation". For example, the kMap +// instruction has a nested computation and "applies" it to every element of its +// input, elementwise. (That is, the input [x, y, z] is transformed to [f(x), +// f(y), f(z)].) +class HloComputation { + public: + // Used by instructions_. + using InstructionList = std::list>; + + // Builder class for HloComputation. + class Builder { + public: + explicit Builder(absl::string_view name, + HloInstruction* fusion_instruction = nullptr) + : name_(name), fusion_instruction_(fusion_instruction) {} + Builder(Builder&& b) = default; + virtual ~Builder() = default; + + // Build and return an HloComputation. The parameter root_instruction + // specifies the already-added instruction to use as the root. If + // root_instruction is nullptr then use the last added instruction as the + // root. + std::unique_ptr Build( + HloInstruction* root_instruction = nullptr); + + // Add the instruction to be part of this computation. + // If the new instruction is derived from another one, + // you probably want to do + // `original_inst->AddInstruction(new_inst)` instead. + virtual HloInstruction* AddInstruction( + std::unique_ptr instruction) { + auto* added_instruction = instruction.get(); + instructions_.push_back(std::move(instruction)); + return added_instruction; + } + + HloInstruction* AddInstruction(std::unique_ptr instruction, + std::optional new_name) { + instruction->SetAndSanitizeName(new_name.value()); + return AddInstruction(std::move(instruction)); + } + + StatusOr AddParameter( + std::unique_ptr parameter) { + if (!parameter_numbers_.insert(parameter->parameter_number()).second) { + return InternalError("Duplicate parameter number %d", + parameter->parameter_number()); + } + return AddInstruction(std::move(parameter)); + } + + Status ForEachInstruction( + absl::FunctionRef func) const { + for (const auto& instruction : instructions_) { + TF_RETURN_IF_ERROR(func(instruction.get())); + } + return OkStatus(); + } + + HloInstruction* last_added_instruction() const { + return instructions_.empty() ? nullptr : instructions_.back().get(); + } + + private: + const std::string name_; + HloInstruction* fusion_instruction_; + std::vector> instructions_; + absl::flat_hash_set parameter_numbers_; + + Builder(const Builder&) = delete; + Builder& operator=(const Builder&) = delete; + }; + + // Helper class to automatically set the OpMetadata for every instruction + // added to a computation. + class MetadataBuilder { + public: + MetadataBuilder(HloComputation* computation, const OpMetadata& metadata) + : computation_(computation), metadata_(metadata) {} + + HloInstruction* AddInstruction( + std::unique_ptr instruction) { + instruction->set_metadata(metadata_); + return computation_->AddInstruction(std::move(instruction)); + } + + private: + HloComputation* computation_; + OpMetadata metadata_; + }; + + ~HloComputation(); + + // Add an instruction to the computation. The computation takes ownership of + // the instruction. + HloInstruction* AddInstruction(std::unique_ptr instruction, + absl::string_view new_name = ""); + + HloInstruction* AddInstruction(std::unique_ptr instruction, + const OpMetadata* metadata); + + // Replace the old parameter at index param_no with + // `instruction`. Updates uses and root instruction. Removes old + // instruction from computation. No check is done on the shape. + HloInstruction* ReplaceParameter(int64_t param_no, + std::unique_ptr instruction); + + // Remove the param_no'th parameter from the computation. + // Note this is only applicatable to the computation for the fusion + // instruction. + Status RemoveParameter(int64_t param_no); + + // Remove unused parameters from the computation. + // Note this is only applicatable to the computation for the fusion + // instruction. + Status RemoveUnusedParametersFromFusedComputation(); + + // Remove unused parameters from the computation. Unlike + // RemoveUnusedParametersFromFusedComputation, this function can be used + // to remove parameters from non-fusion computations. + Status RemoveUnusedParametersFromAnyComputation(); + + // Adds a new parameter instruction to a fusion computation. + // + // This should be a new parameter. Instruction will be appended to parameters + // and inserted to the instruction list. + HloInstruction* AddParameter(std::unique_ptr instruction); + + // Adds a new parameter instruction to the entry computation and update + // the parent module config to reflect the change. + // + // This should be a new parameter. Instruction will be appended to parameters + // and inserted to the instruction list. + HloInstruction* AddEntryComputationParameter( + std::unique_ptr instruction); + + // Replaces an old parameter with a new parameter. Adds the new parameter + // instruction to the entry computation. Updates users instruction. + Status ReplaceEntryComputationParameter( + int64_t param_no, HloInstruction* old_instruction, + std::unique_ptr instruction); + + // Remove an instruction from the computation. The instruction must have no + // users. Instruction is deallocated with this call. + Status RemoveInstruction(HloInstruction* instruction); + + // Removes an instruction from the computation. The instruction must have no + // users. Instruction is deallocated with this call. The instruction will be + // removed even if it is marked as not removable. + Status ForceRemoveInstruction(HloInstruction* instruction); + + // Remove an instruction (including side effecting ones) from the computation + // and also transitively any operand that has no side effect and no users post + // removing an instruction. The instruction must have no users. Instruction is + // deallocated with this call. If given, the cleanup routine is executed on a + // removed instruction before its deallocation. If ignore_control_dependencies + // is set to true, if will remove the unused operands even when they have + // control dependencies, and transitively pass the control dependencies from + // the predecessors to the succesors of the removed instructions, so that the + // logical exeuction order of the remaining unremoved instructions are + // preserved. + Status RemoveInstructionAndUnusedOperands( + HloInstruction* instruction, + std::optional> cleanup = + std::nullopt, + bool ignore_control_dependencies = false); + + // Set the root of the computation to the given instruction. The instruction + // must have already been added to the computation. In addition it must have + // the same shape as the result of the computation for non fusion + // computations, except if accept_different_shape is set to true. + void set_root_instruction(HloInstruction* new_root_instruction, + bool accept_different_shape = false); + + // Return the root instruction of the computation. The root instruction is the + // instruction which produces the output of the computation. + HloInstruction* root_instruction() const { return root_instruction_; } + + // Returns the number of parameters for this computation. + int64_t num_parameters() const { return param_instructions_.size(); } + + // Returns the parameter instruction for the given parameter number. + HloInstruction* parameter_instruction(int64_t param_no) const { + CHECK_GE(param_no, 0); + CHECK_LT(param_no, static_cast(param_instructions_.size())) + << "Computation " << name() << " has no parameter number " << param_no; + return param_instructions_[param_no]; + } + + const HloInstruction::InstructionVector& parameter_instructions() const { + return param_instructions_; + } + + absl::string_view name() const { return name_; } + + // Use the given NameUniquer to select a unique name for the computation based + // on the computation's existing name. + void UniquifyName(NameUniquer* name_uniquer); + + // Prints a string representation of the computation. + // + // (We express the default options using an overload rather than a default + // param because gdb ignores default params, but does resolve overloads.) + void Print(Printer* printer) const { + return Print(printer, HloPrintOptions::Default()); + } + void Print(Printer* printer, const HloPrintOptions& options) const; + void Print(Printer* printer, const HloPrintOptions& options, + absl::Span instruction_order) const; + + // Return a string representation of the computation. + // + // (We express the default options using an overload rather than a default + // param because gdb ignores default params, but does resolve overloads.) + std::string ToString() const; + std::string ToString(const HloPrintOptions& options) const; + + // Overload which accepts an order to emit the instructions in. + std::string ToString( + const HloPrintOptions& options, + absl::Span instruction_order) const; + + // Returns a Cord representation of the computation. + // + // (We express the default options using an overload rather than a default + // param because gdb ignores default params, but does resolve overloads.) + absl::Cord ToCord() const { return ToCord(HloPrintOptions::Default()); } + absl::Cord ToCord(const HloPrintOptions& options) const; + + // Overload which accepts an order to emit the instructions in. + absl::Cord ToCord( + const HloPrintOptions& options, + absl::Span instruction_order) const; + + // Returns a serialized representation of this computation. + HloComputationProto ToProto() const; + + // Creates a computation from the given proto. Arguments: + // + // proto: the proto to convert from. + // computation_map: a map from computation id to HloComputation*. This map + // must contain all computations which the newly constructed computation + // calls. + static StatusOr> CreateFromProto( + const HloComputationProto& proto, + const absl::flat_hash_map& computation_map, + bool prohibit_empty_literal = true); + + // Generates a hash value of an HLO computation. Hash considers + // information on opcode, shape, operands, and typically a root instruction. + // This function returns the same hash value for equivalent HLO computations, + // with respect to HloComputation::Equal() method. + template + friend H AbslHashValue(H h, const HloComputation& computation) { + auto instructions = computation.MakeInstructionPostOrder(); + for (auto* instruction : instructions) { + h = H::combine(std::move(h), *instruction); + } + return H::combine(std::move(h), instructions.size()); + } + + using InstructionSequence = tsl::gtl::iterator_range< + UnwrappingIterator>::iterator>>; + + using ConstInstructionSequence = tsl::gtl::iterator_range>::const_iterator>>; + + // Gets the instructions in this computation. + // + // The returned type is a range of HloInstruction*s, so you can iterate over + // it using a range-based for loop in the natural way: + // + // for (HloInstruction* instr : computation->instructions()) { ... } + // + ConstInstructionSequence instructions() const { + return {MakeUnwrappingIterator(instructions_.begin()), + MakeUnwrappingIterator(instructions_.end())}; + } + InstructionSequence instructions() { + return {MakeUnwrappingIterator(instructions_.begin()), + MakeUnwrappingIterator(instructions_.end())}; + } + + using ChannelDependencies = + absl::flat_hash_map>; + + // Compute and return a post-order of the instructions in the computation. In + // this order, definitions of values always appear before their uses. + std::vector MakeInstructionPostOrder() const; + // Same as MakeInstructionPostOrder but starting at any instruction in the + // computation, not just the root. Describes the corresponding subgraph. + std::vector MakeInstructionPostOrderFrom( + HloInstruction&) const; + std::vector MakeInstructionPostOrder( + const ChannelDependencies& channel_dependencies) const; + // Same as MakeInstructionPostOrder but with special tie-breaking behavior. + // Specifically, when ties (in ordering) between instructions occur, Reshapes + // will be sorted before other operations. + std::vector MakeInstructionPostOrderWithReshapeFirst() const; + + // Calls `func` with each instruction in the computation in post-order. + void ForEachInstructionPostOrder( + absl::FunctionRef func) const; + + int64_t instruction_count() const { return instruction_iterators_.size(); } + + // Creates and returns a list of the embedded computations called by this + // computation. This includes all embedded computations called directly or + // transitively. The embedded computations are sorted such that if computation + // A calls computation B (eg, via a map instruction) then A will appear after + // B in the list. + std::vector MakeEmbeddedComputationsList() const; + + // Creates a fusion instruction containing the given instructions. + // `fusion_kind` indicates the type of the fusion, e.g., loop fusion or fusion + // into a library call. Instructions must be in reverse topological order + // (root of the fused expression first). Replaces all uses of the original + // root instruction with the fusion instruction. The original instructions are + // removed if they have no uses after fusion (this is necessarily true for at + // least the root). + HloInstruction* CreateFusionInstruction( + absl::Span instructions_to_fuse, + HloInstruction::FusionKind fusion_kind); + + // Creates a call instruction containing the given instructions. Instructions + // must be in reverse topological order (root of the called computation + // first). Replaces all uses of the original root instruction with the call + // instruction. The original instructions are removed if they have no uses + // after creating the call (this is necessarily true for at least the root). + HloInstruction* CreateCallInstruction( + absl::Span instructions_to_call); + + // Creates an async start/done instruction pair where instruction is wrapped + // inside an asynchronous computation. The context shapes are appended to the + // output tuple of the asynchronous start which is backend specific. Returns + // the async done instruction. The new async start instruction is the operand + // of the async done instruction so that can be accessed using that. If + // present, `async_execution_thread` will be attached to the + // async-start/update/done instructions as well as wrapped computations. + // If `replace` is true, replace instruction with the async done instruction. + // If `override_names` is true, the clone on `instruction` and the async op + // created will get non-default names. + StatusOr CreateAsyncInstructions( + HloInstruction* instruction, absl::Span context_shapes, + absl::string_view async_execution_thread = + HloInstruction::kMainExecutionThread, + bool replace = true, bool override_names = false); + + // Create a deep copy of the given instruction and return the instruction + // producing the copied result. All instructions performing the copy are added + // to the computation. For array-shaped values, this method trivially returns + // a kCopy instruction. For tuple-shaped instructions, the copy is performed + // with a series of kGetTupleElement and kTuple instructions. If + // indices_to_copy is non-null then this ShapeTree indicates which elements + // (arrays) of the shape to copy. Non-copied elements are passed through + // transparently. If copies_added is non-null, then the added kCopy + // instructions will be inserted in the respective index in the given + // ShapeTree. + StatusOr DeepCopyInstruction( + HloInstruction* instruction, + const ShapeTree* indices_to_copy = nullptr, + ShapeTree* copies_added = nullptr); + + // As above, but uses a custom function to copy the leaf nodes, which could + // create alternative HLOs other than kCopy, or even pass-throughs. + StatusOr DeepCopyInstructionWithCustomCopier( + HloInstruction* instruction, + absl::FunctionRef + copy_leaf); + + // Computes and returns the ProgramShape of this computation (shape of + // parameters and result with layout). + ProgramShape ComputeProgramShape(bool include_ids = true) const; + + // Return whether `*this` and `other` are functionally equivalent. + bool Equal( + const HloComputation& other, bool is_layout_sensitive, + std::optional< + absl::FunctionRef> + computations_comparator = std::nullopt) const { + return EqualInternal(other, is_layout_sensitive, computations_comparator, + /*ignore_channel_id_values=*/false, + /*ignore_execution_thread=*/false); + } + + // Same as Equal() but ignores channel ID value mismatches on instructions, as + // long as the two instructions both have channel IDs or neither has a channel + // ID. + bool EqualIgnoringChannelIdValues( + const HloComputation& other, bool is_layout_sensitive, + std::optional< + absl::FunctionRef> + computations_comparator = std::nullopt) const { + return EqualInternal(other, is_layout_sensitive, computations_comparator, + /*ignore_channel_id_values=*/true, + /*ignore_execution_thread=*/false); + } + + bool EqualIgnoringExecutionThread( + const HloComputation& other, bool is_layout_sensitive, + bool ignore_channel_id_values, + std::optional< + absl::FunctionRef> + computations_comparator = std::nullopt) const { + return EqualInternal(other, is_layout_sensitive, computations_comparator, + ignore_channel_id_values, + /*ignore_execution_thread=*/true); + } + + // Return whether `*this` and `other` are functionally equivalent. + bool operator==(const HloComputation& other) const { + return Equal(other, true); + } + bool operator!=(const HloComputation& other) const { + return !(*this == other); + } + + // Replaces old instruction with newly created instruction. Removes old + // instruction from computation. Updates uses and root instruction. + Status ReplaceWithNewInstruction( + HloInstruction* old_instruction, + std::unique_ptr new_instruction); + + // Replaces an old instruction with a newly created instruction, and adds the + // new instruction as an entry computation's parameter. Removes old + // instruction from computation. Updates uses and root instruction. + Status ReplaceWithNewEntryComputationParameter( + HloInstruction* old_instruction, + std::unique_ptr new_instruction); + + // Replace old instruction with new instruction. Updates uses and root + // instruction. Removes old instruction from computation. Transitively removes + // non-side effecting operands of old instruction that no longer have users, + // similar to RemoveInstructionAndUnusedOperands(). Precondition: + // old_instruction and new_instruction must have the compatible shapes. + // If preserve_sharding is true, the replacement will fail if both new and old + // instruction have sharding that is not compatible, and the function will + // return false. Otherwise, when the replacement happens, if |new_instruction| + // doesn't have any sharding information it will receive the sharding + // information of |old_instruction|, and function will return true. + StatusOr ReplaceInstruction(HloInstruction* old_instruction, + HloInstruction* new_instruction, + bool preserve_sharding, + bool relay_control_dependency = false); + + // Same as above, with preserve_sharding=false. Since this replacement always + // happens, it returns just a Status as opposed to StatusOr + Status ReplaceInstruction(HloInstruction* old_instruction, + HloInstruction* new_instruction); + + // Same as ReplaceInstruction, but the new instruction can have a different + // shape. + StatusOr ReplaceInstructionWithDifferentShape( + HloInstruction* old_instruction, HloInstruction* new_instruction, + bool preserve_sharding, bool relay_control_dependency = false); + Status ReplaceInstructionWithDifferentShape(HloInstruction* old_instruction, + HloInstruction* new_instruction); + + // Set/get the module containing this computation. + void set_parent(HloModule* module) { parent_ = module; } + const HloModule* parent() const { return parent_; } + HloModule* parent() { return parent_; } + + // Visit every node in the computation in DFS post-order with the given + // visitor. This is similar to calling HloInstruction::Accept on the root of + // the computation except this method also visits instructions not reachable + // via the root. The root instruction of the computation is visited last, and + // the visitor's FinishVisit method is called once upon completion (with the + // root instruction as the argument). + template + Status Accept(DfsHloVisitorBase* visitor) const; + + // Same as Accept() above, but the order of operand and control predecessor + // visitation is determined by the given operand order; if compare(A, B) == + // true, A is visited before B. + Status AcceptWithOperandOrder( + DfsHloVisitor* visitor, + const HloInstruction::CompareFunction& operand_order) const; + + // Visit every node in the computation in the given order. 'order' must + // be a topological sort of all instructions in the computation. + template + Status AcceptOrdered(DfsHloVisitorBase* visitor, + absl::Span order) const; + + // Returns a deep copy of this computation including all instructions. + // If the clone context is specified, it will be populated with the cloned + // object mappings, and its module() will be used to add new computations + // into. + std::unique_ptr Clone(const std::string& suffix = "clone", + HloCloneContext* context = nullptr); + + // Like Clone(), but if an instruction is present in replacement_map, we use + // the map's value to replace that instruction in the cloned computation. + // + // If replacements is nullptr, don't perform replacement. + // If replacements maps a key to nullptr, we remove that instruction from the + // new computation. If an element of `replacements` references an instruction + // that's not already in the computation, it's cloned and added to the new + // computation. + // + // 'extra_parameters' allows to specify additional parameters that should be + // added to the computation. + // + // All relevant instructions are cloned, *including* unique_ptr in the + // `replacements` map. + std::unique_ptr CloneWithReplacements( + const absl::flat_hash_map>* replacements, + absl::Span extra_parameters = {}, + HloCloneContext* context = nullptr, const std::string& suffix = "clone", + const HloInstruction* new_root = nullptr); + + // Like CloneWithReplacements(), but this is a const method and `context` must + // be specified. + std::unique_ptr CloneInContext( + HloCloneContext& context, + const absl::flat_hash_map>* replacements = + nullptr, + absl::Span extra_parameters = {}, + const std::string& suffix = "clone", + const HloInstruction* new_root = nullptr) const; + + // Convenience overloads for CloneWithReplacements. You want to do + // + // CloneWithReplacements({{a, std::move(b)}, {c, std::move(d)}}) // ERROR + // + // but that doesn't work because std::initializer_list is not movable. These + // overloads let you do + // + // CloneWithReplacementPairs({a, std::move(b)}, {c, std::move(d)}); // OK + // + std::unique_ptr CloneWithReplacementPairs( + std::pair> r1, + HloCloneContext* context = nullptr, const std::string& suffix = "clone"); + std::unique_ptr CloneWithReplacementPairs( + std::pair> r1, + std::pair> r2, + HloCloneContext* context = nullptr, const std::string& suffix = "clone"); + std::unique_ptr CloneWithReplacementPairs( + std::pair> r1, + std::pair> r2, + std::pair> r3, + HloCloneContext* context = nullptr, const std::string& suffix = "clone"); + + // Returns true if the given instruction can be removed from the computation. + // Parameter instructions cannot be removed without violating invariants of + // the HLO computation with the exception of fusion computation. A parameter + // instruction is removable for a fusion computation. + // + // Note that IsSafelyRemovable() is a necessary condition to remove an + // instruction rather than a sufficient condition. For example, instructions + // with side-effect (e.g., Send, Infeed) may be removed from a computation, + // but the transformation must guarantee the invariants relevant to the + // instructions still hold (e.g., Send and Recv must be removed together to + // make each channel complete). + bool IsSafelyRemovable(const HloInstruction* instruction, + bool ignore_control_dependency = false); + + // Returns a map from an instruction to the group of instructions associated + // with the same channel. These instructions will be considered as a single + // node for dependency purposes. + // RecvDone ops will map to the corresponding Send op. + // Cross-partition collectives will map to every other instruction with the + // same channel ID (it doesn't map to itself). + ChannelDependencies ComputeChannelDependencies() const; + + // Returns true if this computation has a side effect. A computation has a + // side effect if it contains one or more instructions with a side effect. + bool HasSideEffect() const; + + // Returns if this computation is a fusion computation. + // Do not use this method to determine if fusion_instruction_ != nullptr. + // Instead, directly do: FusionInstruction() != nullptr + bool IsFusionComputation() const { return is_fusion_computation_; } + + // Returns if this computation is the entry computation of the module. + bool IsEntryComputation() const; + + // Returns the owning fusion instruction, or nullptr if this is not a fusion + // computation. + HloInstruction* FusionInstruction() const { return fusion_instruction_; } + void SetFusionInstruction(HloInstruction* fusion_instruction) { + CHECK(!IsCustomCallComputation() && !IsAsyncComputation()); + fusion_instruction_ = fusion_instruction; + is_fusion_computation_ |= (fusion_instruction != nullptr); + } + + // Returns if this computation is a custom-call computation. + bool IsCustomCallComputation() const { return is_custom_call_computation_; } + + // Returns the owning custom call instruction, or nullptr if this is not a + // custom call computation. + HloInstruction* CustomCallInstruction() const { + return custom_call_instruction_; + } + void SetCustomCallInstruction(HloInstruction* custom_call_instruction) { + CHECK(!IsFusionComputation() && !IsAsyncComputation()); + custom_call_instruction_ = custom_call_instruction; + is_custom_call_computation_ |= (custom_call_instruction != nullptr); + } + + // Returns if this computation is a to_apply region of a collective. + bool IsCollectiveCalledComputation() const { + return is_collective_called_computation_; + } + + // Returns the owning collective call instruction, or nullptr if this is not a + // collective call computation. + HloInstruction* CollectiveCallInstruction() const { + return collective_call_instruction_; + } + + void SetCollectiveCallInstruction( + HloInstruction* collective_call_instruction) { + CHECK(!IsFusionComputation() && !IsAsyncComputation() && + !IsCustomCallComputation()); + collective_call_instruction_ = collective_call_instruction; + is_collective_called_computation_ |= + (collective_call_instruction != nullptr); + } + + // Returns if this computation is an async computation. + bool IsAsyncComputation() const { return !async_instructions_.empty(); } + + // Returns the owning async instruction. It's empty if this is not an async + // computation. + const std::vector& AsyncInstructions() const { + return async_instructions_; + } + + std::vector& AsyncInstructions() { + return async_instructions_; + } + + void AddAsyncInstruction(HloInstruction& async_instruction) { + CHECK(!IsFusionComputation() && !IsCustomCallComputation()); + CHECK(async_instruction.opcode() == HloOpcode::kAsyncStart || + async_instruction.opcode() == HloOpcode::kAsyncUpdate || + async_instruction.opcode() == HloOpcode::kAsyncDone); + async_instructions_.push_back(&async_instruction); + } + + void RemoveAsyncInstruction(HloInstruction* async_instruction) { + if (async_instruction == nullptr) { + return; + } + async_instructions_.erase( + std::remove(async_instructions_.begin(), async_instructions_.end(), + async_instruction), + async_instructions_.end()); + } + + // Returns if this computation is invoked by an Hlo instruction. + bool IsCalledComputation() const { + return IsFusionComputation() || IsCustomCallComputation(); + } + + // Clear the unique ID of the computation so that it can be re-assigned, such + // as for the purpose of compacting the unique IDs. + void ClearUniqueIdInternal() { unique_id_ = -1; } + + // The id of this computation should be unique within the module. + void SetUniqueId(int64_t id) { + CHECK_EQ(unique_id_, -1); + CHECK_GE(id, 0); + unique_id_ = id; + } + + // Returns the instruction in this computation that has name `name`. Returns + // null if there is no such computation. + HloInstruction* GetInstructionWithName(absl::string_view name); + + int64_t unique_id() const { return unique_id_; } + + void SetExecutionThread(absl::string_view execution_thread) { + execution_thread_ = std::string(execution_thread); + } + + absl::string_view execution_thread() const { return execution_thread_; } + // Returns true if this computation is annotated on "main" execution thread. + bool IsMainThread() const { + return execution_thread_ == HloInstruction::kMainExecutionThread; + } + + // Deallocate instructions that are marked by "RemoveInstruction". The two + // stage clean up process is designed such that HloPass can have stable + // internal pointers to HloInstructions while we create and remove + // HloInstructions in a pass. + void Cleanup() { to_be_deleted_.clear(); } + + // Returns true if a given instruction is marked dead in this computation. + bool IsMarkedAsDead(const HloInstruction* inst); + + // Returns true iff this computation can be inlined as a single instruction. + bool CanExpandIntoSingleInstruction() const; + + private: + explicit HloComputation( + const std::string& name, int parameter_count, + std::vector>* instructions, + HloInstruction* root_instruction, HloInstruction* fusion_instruction); + + // Internal helper for adding instructions. + HloInstruction* AddInstructionInternal( + std::unique_ptr instruction); + + // Internal helper for comparison with different options. + bool EqualInternal( + const HloComputation& other, bool is_layout_sensitive, + std::optional< + absl::FunctionRef> + computations_comparator, + bool ignore_channel_id_values, bool ignore_execution_thread) const; + // Appends (fuses) HLOs in instructions_to_append into the called computation + // of the caller. + void AppendInstructionsIntoCalledComputation( + absl::Span instructions_to_append, + HloInstruction* caller); + + // Internal helper for recursive copying of an instruction. Creates and + // returns a deep copy of the given instruction. + StatusOr DeepCopyHelper( + HloInstruction* instruction, ShapeIndex* index, + absl::FunctionRef + copy_leaf); + + // Internal helper to collect unreachable roots. + std::vector CollectUnreachableRoots() const; + + enum VisitState { kVisiting, kVisited }; + void ComputeInstructionPostOrder( + HloInstruction* root, const ChannelDependencies& channel_dependencies, + absl::flat_hash_map& visited, + std::vector& post_order) const; + + void ForEachInstructionPostOrderImpl( + absl::FunctionRef func, HloInstruction* root, + const ChannelDependencies& channel_dependencies, + absl::flat_hash_map& visited) const; + + Status RemoveUnusedParametersImpl(bool allow_non_fusion); + + Status RemoveInstructionImpl(HloInstruction* instruction, + bool ignore_safety_check); + + std::string name_; + int64_t unique_id_; + HloInstruction* root_instruction_; + + // If this computation is a fusion computation, this field points to the + // corresponding fusion instruction (if it is live). Otherwise, this is null. + HloInstruction* fusion_instruction_; + + // Determines whether this computation is a fusion computation. A fusion + // computation ordinarily also has a non-null fusion_instruction_. However, if + // a fusion instruction is removed during compilation, the fusion computation + // becomes unreachable, and its fusion_instruction_ is set to null. We still + // need to regard such computations as fusion computations for HLO scheduling + // purposes. + bool is_fusion_computation_; + + // If this computation is a custom-call computation, this field points to the + // corresponding custom-call instruction (if it is live). Otherwise, this is + // null. + HloInstruction* custom_call_instruction_; + + // Determines whether this computation is a custom-call computation. + bool is_custom_call_computation_; + + // If this computation is a collective sub-computation, this field points to + // the corresponding collective instruction. Otherwise, this is null. + HloInstruction* collective_call_instruction_; + + // Determines whether this computation is a collective sub-computation. + bool is_collective_called_computation_; + + // If this computation is an async computation, this field points to the + // corresponding async instructions (if live) that call this computation. + // Otherwise, this is empty. + std::vector async_instructions_; + + // Execution thread of this computation. By default, it's main thread. + std::string execution_thread_ = HloInstruction::kMainExecutionThread; + + // Module containing this computation. + HloModule* parent_ = nullptr; + + // Store instructions in std::list as they can be added and removed + // arbitrarily and we want a stable iteration order. Keep a map from + // instruction pointer to location in the list for fast lookup. + InstructionList instructions_; + absl::flat_hash_map + instruction_iterators_; + + // Removed instructions are moved into to_be_deleted_ first and then + // deallocated when Cleanup is called. + std::vector> to_be_deleted_; + + HloInstruction::InstructionVector param_instructions_; + + HloComputation(const HloComputation&) = delete; + HloComputation& operator=(const HloComputation&) = delete; +}; + +template +Status HloComputation::Accept( + DfsHloVisitorBase* visitor) const { + // Visit unreachable roots. Beware that the visitor might delete the currently + // visited root, which would invalidate iterators if the unreachable roots + // weren't computed ahead of time. + for (HloInstruction* root : CollectUnreachableRoots()) { + VLOG(3) << "Traversing unreachable root: " << root->ToString(); + // Call FinishVisit only at the end. + TF_RETURN_IF_ERROR(root->Accept(visitor, /*call_finish_visit=*/false)); + } + // Visit the computation root instruction last. + return root_instruction()->Accept(visitor, /*call_finish_visit=*/true); +} + +// Explicit instantiations. +template Status HloComputation::Accept(DfsHloVisitor* visitor) const; +template Status HloComputation::Accept(ConstDfsHloVisitor* visitor) const; + +template +Status HloComputation::AcceptOrdered( + DfsHloVisitorBase* visitor, + absl::Span order) const { + VLOG(3) << "Accepting visitor with order."; + for (HloInstruction* root : CollectUnreachableRoots()) { + TF_RET_CHECK(absl::c_linear_search(order, root)) << root->ToString(); + } + TF_RET_CHECK(order.size() == instruction_count()); + absl::flat_hash_set visited; + for (const HloInstruction* instruction : order) { + VLOG(3) << "Visiting ordered: " << instruction->ToString(); + TF_RET_CHECK(instruction_iterators_.contains(instruction)) + << "Instruction " << instruction->name() << " is not in computation " + << name(); + TF_RET_CHECK(!visited.contains(instruction)) + << "Instruction " << instruction->name() + << " appears more than once in order"; + HloInstruction* mutable_instruction = + const_cast(instruction); + TF_RETURN_IF_ERROR(visitor->Preprocess(mutable_instruction)); + TF_RETURN_IF_ERROR(mutable_instruction->Visit(visitor)); + visitor->SetVisited(*mutable_instruction); + TF_RETURN_IF_ERROR(visitor->Postprocess(mutable_instruction)); + visited.insert(instruction); + } + return visitor->FinishVisit(root_instruction()); +} + +// Explicit instantiations. +template Status HloComputation::AcceptOrdered( + DfsHloVisitor*, absl::Span) const; +template Status HloComputation::AcceptOrdered( + ConstDfsHloVisitor*, absl::Span) const; + +} // namespace xla + +#endif // XLA_HLO_IR_HLO_COMPUTATION_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/hlo_domain_metadata.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/hlo_domain_metadata.h new file mode 100644 index 0000000000000000000000000000000000000000..2849dd2e3b44c747052a1d5056142e309965171b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/hlo_domain_metadata.h @@ -0,0 +1,84 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_HLO_IR_HLO_DOMAIN_METADATA_H_ +#define XLA_HLO_IR_HLO_DOMAIN_METADATA_H_ + +#include +#include +#include + +#include "absl/container/flat_hash_set.h" +#include "absl/strings/string_view.h" +#include "xla/statusor.h" +#include "xla/types.h" +#include "tsl/platform/status.h" + +namespace xla { + +// Cannot include hlo_instruction.h as this file is included from there. +class HloInstruction; + +// The DomainMetadata represents the base class for metadata which can be +// attached to kDomain HLO instructions. +class DomainMetadata { + public: + // A Domain data structure captures all the information about a kDomain + // bounded instruction set. + struct Domain { + // The set of instructions which are reachable from each other via + // operand/user pathways, without crossing a kDomain instruction of a given + // kind. The reach_set can contain kDomain instructions of other kinds, if + // two domains of different kind intersect each other. + absl::flat_hash_set reach_set; + + // The same instructions in reach_set, but purged from kDomain instructions + // and ordered according to their computation graph post-order, i.e. + // if instructions[pos_a] depends on instructions[pos_b], then pos_a > + // pos_b. + std::vector instructions; + + // If we consider a graph edge as an arrow oriented from the operand to the + // user, the enter_domains will contain the set of kDomain instructions + // whose dataflow enters the reach set (domain), while the exit_domains + // contains the set of kDomain instructions whose dataflow exit the reach + // set. + absl::flat_hash_set enter_domains; + absl::flat_hash_set exit_domains; + }; + + virtual ~DomainMetadata() = default; + + // Clones the metadata object. + virtual std::unique_ptr Clone() const = 0; + + // Returns the metadata type. A unique identifier which describes the real + // metadata type. + virtual absl::string_view Kind() const = 0; + + // Compares the metadata object with another one and returns true if the + // two matches. + virtual bool Matches(const DomainMetadata& other) const = 0; + + // Returns the hash value of the metadata. + virtual size_t Hash() const = 0; + + // Returns a string representation of the metadata. + virtual std::string ToString() const = 0; +}; + +} // namespace xla + +#endif // XLA_HLO_IR_HLO_DOMAIN_METADATA_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/hlo_frontend_attributes.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/hlo_frontend_attributes.h new file mode 100644 index 0000000000000000000000000000000000000000..7e38d15806dced518187d3e016082a97b2a72342 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/hlo_frontend_attributes.h @@ -0,0 +1,28 @@ +/* Copyright 2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_HLO_IR_HLO_FRONTEND_ATTRIBUTES_H_ +#define XLA_HLO_IR_HLO_FRONTEND_ATTRIBUTES_H_ + +#include + +#include "xla/xla_data.pb.h" + +namespace xla { +std::string FrontendAttributesToString( + const FrontendAttributes& frontend_attributes); +} // namespace xla + +#endif // XLA_HLO_IR_HLO_FRONTEND_ATTRIBUTES_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/hlo_input_output_alias_config.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/hlo_input_output_alias_config.h new file mode 100644 index 0000000000000000000000000000000000000000..ab06940319aa397a9fcbb53d01e965c1b59c5528 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/hlo_input_output_alias_config.h @@ -0,0 +1,220 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_HLO_IR_HLO_INPUT_OUTPUT_ALIAS_CONFIG_H_ +#define XLA_HLO_IR_HLO_INPUT_OUTPUT_ALIAS_CONFIG_H_ + +#include +#include +#include +#include +#include + +#include "absl/container/flat_hash_set.h" +#include "absl/functional/function_ref.h" +#include "xla/service/hlo.pb.h" +#include "xla/shape_tree.h" +#include "xla/shape_util.h" + +namespace xla { + +class HloModule; + +// This class specifies the alias map from output index to parameter number and +// parameter index in the entry computation. +class HloInputOutputAliasConfig { + public: + // The kind of aliases which can be set. A kMayAlias is one setup at + // compilation time by the user, and has to be respected. A kMustAlias one + // might be setup by the compiler, if it decides it is convenient to do so. + enum AliasKind { + kMayAlias, + kMustAlias, + }; + // Defines the alias information for a given output buffer. A given output + // buffer shape index can refer only to one parameter+index. + struct Alias { + Alias(int64_t parameter_number, ShapeIndex parameter_index, + AliasKind kind = kMayAlias) + : parameter_number(parameter_number), + parameter_index(std::move(parameter_index)), + kind(kind) {} + + int64_t parameter_number; + ShapeIndex parameter_index; + AliasKind kind; + + bool must_alias() const { return kind == kMustAlias; } + + std::string ToString() const { + return absl::StrFormat("(%lld, %s, %s)", parameter_number, + parameter_index.ToString(), + kind == kMustAlias ? "must-alias" : "may-alias"); + } + }; + + HloInputOutputAliasConfig() = default; + + explicit HloInputOutputAliasConfig(Shape output_shape) + : alias_(std::move(output_shape)) {} + + virtual ~HloInputOutputAliasConfig() = default; + + // Sets up alias config from `output_index` to `param_index` at + // `param_number`. + Status SetUpAlias(const ShapeIndex& output_index, int64_t param_number, + const ShapeIndex& param_index, + AliasKind must_alias = kMayAlias); + + // Returns true if the given parameter is aliased with one of the output + // buffers. + bool ParameterHasAlias(int64_t param_number, + const ShapeIndex& param_index) const { + return GetAliasedOutput(param_number, param_index).has_value(); + } + + // Checks whether the provided output index has already been aliased. + bool OutputHasAlias(const ShapeIndex& output_index) const; + + // (De)Serializes an HloInputOutputAliasConfig to/from an + // HloInputOutputAliasProto. + HloInputOutputAliasProto ToProto() const; + + static StatusOr CreateFromProto( + Shape output_shape, const HloInputOutputAliasProto& proto); + + // Returns the output index that the given parameter and parameter index is + // aliased with. A nullopt is returned if there is no output that is aliased + // with the parameter number and index. + std::optional GetAliasedOutput( + int64_t param_number, const ShapeIndex& param_index) const; + + // Returns the number of parameter and index of the parameter buffer that the + // given output buffer index is aliased with. A nullopt is returned if there + // is no parameter is aliased with the specific output. + std::optional GetAliasedParameter( + const ShapeIndex& output_index) const; + + // Returns if the parameter at the given parameter number and parameter + // index must-alias with an output. + bool ParameterMustAlias(int64_t param_number, + const ShapeIndex& param_index) const; + + using AliasFn = + absl::FunctionRef; + + // Iterates through each aliased output and input. + void ForEachAlias(AliasFn fn) const; + + using AliasFnWithStatus = + absl::FunctionRef; + + // Verifies that the given config is valid for the given module. + // Specifically, the config's input and output should be in-bound and size of + // the aliased buffers should match. + Status Verify(const HloModule& module, + absl::FunctionRef size_func) const; + + Status ForEachAliasWithStatus(AliasFnWithStatus fn) const; + + // Returns the shape of the output of the alias config. + const Shape& shape() const; + + std::string ToString() const; + + std::string ToShortString() const; + + private: + // A ShapeTree which indicates the list of buffers that's expected to be + // aliased. The key on this shape tree represents the output index. The value + // is an Alias data structure which defines the input parameter coordinates. + // If the value is nullopt, it means there is no parameter aliasing for this + // output. + ShapeTree> alias_; +}; + +// This class specifies donors of the input buffer (specified by parameter +// number and parameter index in the entry computation). The donated buffer can +// be matched with any valid output tensor, which differs from +// HloInputOutputAliasConfig. +class HloBufferDonorConfig { + public: + // Defines a input buffer donor. In real world, organ donors refer to the + // persons agreeing to remove their organs (usually after death). Similarly, a + // registered buffer donor indicates that the input parameter can be removed + // when there is no dependency. Therefore, the memory buffer can be reused by + // a matched output. + struct BufferDonor { + BufferDonor(int64_t param_number, ShapeIndex param_index) + : param_number(param_number), param_index(std::move(param_index)) {} + + int64_t param_number; + ShapeIndex param_index; + + bool operator==(const BufferDonor& other) const { + return param_number == other.param_number && + param_index == other.param_index; + } + + // A hash function borrowed from go/absl-hash. + template + friend H AbslHashValue(H h, const BufferDonor& donor) { + return H::combine(std::move(h), donor.param_number, donor.param_index); + } + }; + + HloBufferDonorConfig() = default; + virtual ~HloBufferDonorConfig() = default; + + // Register and unregister the parameter with `param_index` at `param_number` + // as a buffer donor. + Status AddBufferDonor(int64_t param_number, const ShapeIndex& param_index); + Status RemoveBufferDonor(int64_t param_number, const ShapeIndex& param_index); + + // Returns true if the given parameter is registered as a buffer donor. + bool ParameterIsBufferDonor(int64_t param_number, + const ShapeIndex& param_index) const; + + // (De)Serializes an HloBufferDonorConfig to/from an HloBufferDonorProto. + HloBufferDonorProto ToProto() const; + static StatusOr CreateFromProto( + const HloBufferDonorProto& proto); + + // Verifies that the given config is valid for the given module. + // The config's input should be in-bound and this config cannot overlap with + // the given module's input_output_alias_config. + Status Verify(const HloModule& module) const; + + // Returns the registered buffer donors + const absl::flat_hash_set& buffer_donor() const { + return buffer_donor_; + } + + std::string ToString() const; + + std::string ToShortString() const; + + private: + // A set recording the registered buffer donors. + absl::flat_hash_set buffer_donor_; +}; + +std::ostream& operator<<(std::ostream& out, + const HloInputOutputAliasConfig& config); +std::ostream& operator<<(std::ostream& out, const HloBufferDonorConfig& config); + +} // namespace xla + +#endif // XLA_HLO_IR_HLO_INPUT_OUTPUT_ALIAS_CONFIG_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/hlo_instruction.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/hlo_instruction.h new file mode 100644 index 0000000000000000000000000000000000000000..aca2ace1b6cd7fcf15c116a57ca6a3d400153ae4 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/hlo_instruction.h @@ -0,0 +1,2586 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +// HLO instructions are in DAG form and represent the computations that the user +// has built up via the XLA service interface. They are ultimately lowered +// in a platform-aware way by traversing the HLO DAG and emitting a lowered +// form; e.g. see DfsHloVisitor. + +#ifndef XLA_HLO_IR_HLO_INSTRUCTION_H_ +#define XLA_HLO_IR_HLO_INSTRUCTION_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "absl/base/attributes.h" +#include "absl/container/flat_hash_map.h" +#include "absl/container/flat_hash_set.h" +#include "absl/container/inlined_vector.h" +#include "absl/functional/function_ref.h" +#include "absl/strings/str_cat.h" +#include "absl/strings/string_view.h" +#include "absl/types/span.h" +#include "xla/comparison_util.h" +#include "xla/hlo/ir/dfs_hlo_visitor.h" +#include "xla/hlo/ir/hlo_clone_context.h" +#include "xla/hlo/ir/hlo_domain_metadata.h" +#include "xla/hlo/ir/hlo_opcode.h" +#include "xla/hlo/ir/hlo_sharding.h" +#include "xla/iterator_util.h" +#include "xla/layout.h" +#include "xla/literal.h" +#include "xla/printer.h" +#include "xla/service/hlo.pb.h" +#include "xla/service/mapped_ptr_container_sorter.h" +#include "xla/service/name_uniquer.h" +#include "xla/shape.h" +#include "xla/shape_util.h" +#include "xla/status.h" +#include "xla/statusor.h" +#include "xla/xla_data.pb.h" +#include "tsl/lib/gtl/iterator_range.h" +#include "tsl/platform/errors.h" +#include "tsl/platform/logging.h" // IWYU pragma: keep +#include "tsl/platform/protobuf.h" + +namespace xla { + +class HloComputation; +class HloModule; + +absl::string_view PrintName(absl::string_view name, bool print_ids); + +// A bunch of switches that control how the hlo text should be printed. +class HloPrintOptions { + public: + enum class PrintSubcomputationMode { + kOff, // Do not print anything about subcomputations. + kNameOnly, // Only print the name of subcomputations. + kFullBodies, // Print the full bodies of subcomputations. + kNonSequentialBodies, // Print the full bodies of subcomputations that are + // not in a sequential context. + }; + + // Constructs the default print options: don't print large constants, don't + // compact operands, no indentation. + constexpr HloPrintOptions() + : print_operand_index_annotation_interval_(5), + print_subcomputation_mode_(PrintSubcomputationMode::kNameOnly), + indent_amount_(0), + print_large_constants_(false), + print_only_essential_constants_(false), + print_metadata_(true), + print_backend_config_(true), + print_infeed_outfeed_config_(true), + compact_operands_(false), + include_layout_in_shapes_(true), + print_result_shape_(true), + print_operand_shape_(true), + print_operand_names_(true), + print_program_shape_(true), + print_percent_(true), + print_control_dependencies_(true), + canonicalize_instruction_names_(false), + is_in_nested_computation_(false), + print_ids_(true), + canonicalize_computations_(false), + print_extra_attributes_(true), + syntax_sugar_async_ops_(true), + print_name_after_closing_brace_(false) {} + // Static reference to a default construction HloPrintOptions, to avoid + // constructing a new one each time default is needed. + static const HloPrintOptions& Default() { + ABSL_CONST_INIT static const HloPrintOptions options; + return options; + } + + static HloPrintOptions ShortParsable() { + return HloPrintOptions() + .set_print_large_constants(true) + .set_print_subcomputation_mode(PrintSubcomputationMode::kNameOnly) + .set_print_metadata(false) + .set_print_backend_config(false) + .set_print_operand_shape(false) + .set_print_operand_index_annotation_interval(0) + .set_print_program_shape(false) + .set_print_percent(false) + .set_print_control_dependencies(false); + } + + // Options to produce the canonical string representing an isomorphic + // computation graph. + static HloPrintOptions Canonical() { + return HloPrintOptions() + .set_print_subcomputation_mode(PrintSubcomputationMode::kFullBodies) + .set_print_metadata(false) + .set_print_backend_config(false) + // Compact option won't print name of operand_k, where k > a threshold. + // Canonical (and Fingerprint) must include all operands. + .set_compact_operands(false) + .set_print_operand_names(false) + .set_print_operand_shape(true) + // No index annotations as they are only for ease of human inspection. + .set_print_operand_index_annotation_interval(0) + .set_print_program_shape(false) + .set_print_percent(false) + .set_print_control_dependencies(false) + .set_canonicalize_instruction_names(true); + } + + // Options to produce a fingerprint of an HLO instruction. + // Based on Canonical() with some important changes commented below. + static HloPrintOptions Fingerprint() { + return Canonical() + // Exclude because they do not affect HLO optimizations. + .set_print_infeed_outfeed_config(false) + // Exclude floating point constant literals that are not all zeros, all + // ones, or integers because they may be randomly initialized weights, + // which may be changed across different runs. + .set_print_only_essential_constants(true) + // Remove "id" in "name.id" (after period) because it can be + // non-deterministic. This mainly affects computations' names because + // canonicalized instructions' names are in "tmp_id" format. + .set_print_ids(false) + // Sort computations. + .set_canonicalize_computations(true); + } + + // Options to produce a fingerprint of an HLO module and computation. + // Shorter (and therefore faster) than Fingerprint(). + static HloPrintOptions ModuleFingerprint() { + return Fingerprint() + // Operand shapes can be inferred from output shapes and canonicalized + // names when we have an entire computation. + .set_print_operand_shape(false); + } + + // If true, large constants will be printed out. + HloPrintOptions& set_print_large_constants(bool value) { + print_large_constants_ = value; + return *this; + } + + // If true, only integer, all-zero, are all-one constants will be printed out. + HloPrintOptions& set_print_only_essential_constants(bool value) { + print_only_essential_constants_ = value; + return *this; + } + + HloPrintOptions& set_print_subcomputation_mode( + PrintSubcomputationMode value) { + print_subcomputation_mode_ = value; + return *this; + } + + // If true, metadata will be printed. + HloPrintOptions& set_print_metadata(bool value) { + print_metadata_ = value; + return *this; + } + + // If true, backend_config will be printed. + HloPrintOptions& set_print_backend_config(bool value) { + print_backend_config_ = value; + return *this; + } + + // If true, infeed_config and outfeed_config will be printed. + HloPrintOptions& set_print_infeed_outfeed_config(bool value) { + print_infeed_outfeed_config_ = value; + return *this; + } + + // If true, result shapes will be printed. + HloPrintOptions& set_print_result_shape(bool value) { + print_result_shape_ = value; + return *this; + } + + // If true, operands' shapes will be printed. + HloPrintOptions& set_print_operand_shape(bool value) { + print_operand_shape_ = value; + return *this; + } + + // If true, operands' shapes will be printed. + HloPrintOptions& set_print_operand_index_annotation_interval(int64_t value) { + print_operand_index_annotation_interval_ = value; + return *this; + } + + // If true, the operand names will be printed. + HloPrintOptions& set_print_operand_names(bool value) { + print_operand_names_ = value; + return *this; + } + + // If true, all printed names include unique identifiers. + HloPrintOptions& set_print_ids(bool value) { + print_ids_ = value; + return *this; + } + + // If true, the HLO includes its attributes. + HloPrintOptions& set_print_extra_attributes(bool value) { + print_extra_attributes_ = value; + return *this; + } + + // If true, program shape of hlo computations will be printed. + HloPrintOptions& set_print_program_shape(bool value) { + print_program_shape_ = value; + return *this; + } + + // If true, names will be printed with prefix '%'. + HloPrintOptions& set_print_percent(bool value) { + print_percent_ = value; + return *this; + } + + // If true, control dependencies will be printed. + HloPrintOptions& set_print_control_dependencies(bool value) { + print_control_dependencies_ = value; + return *this; + } + + // If true, uses the async operation syntax sugar to print async-start, + // async-update, and async-done HLOs. If the syntax sugar is enabled and the + // async computation is trivial (i.e. only a single instruction taking + // computation parameters as operands, and otherwise is illegal), the + // computations called by these instructions will not be printed and instead + // the root of the called computation will be printed instead of these + // instructions and -start, -update, and -done suffixes will be appended to + // the opcode of the async operation. For example, for an HLO module where the + // syntax sugar is off: + // + // HloModule Module + // + // %AsyncOp (p0.1: f32[10]) -> f32[20] { + // %p0.1 = f32[10]{0} parameter(0) + // ROOT %custom-call = f32[20]{0} custom-call(f32[10]{0} %p0.1), + // custom_call_target="foo" + // } + // + // ENTRY %Entry (p0: f32[10]) -> f32[20] { + // %p0 = f32[10]{0} parameter(0) + // %async-start = ((f32[10]{0}), f32[20]{0}, s32[]) async-start(%p0), + // calls=%AsyncOp + // %async-update = ((f32[10]{0}), f32[20]{0}, s32[]) async-update( + // %async-start), + // calls=%AsyncOp + // ROOT %async-done = f32[20]{0} async-done(%async-update), calls=%AsyncOp + // } + // + // will be printed as following if the syntax sugar is enabled: + // + // HloModule Module + // + // ENTRY %Entry (p0: f32[10]) -> f32[20] { + // %p0 = f32[10]{0} parameter(0) + // %async-start = ((f32[10]{0}), f32[20]{0}, s32[]) custom-call-start(%p0), + // custom_call_target="foo" + // %async-update = ((f32[10]{0}), f32[20]{0}, s32[]) custom-call-update( + // %async-start), + // custom_call_target="foo" + // ROOT %async-done = f32[20]{0} custom-call-done(%async-update), + // custom_call_target="foo" + // } + HloPrintOptions& set_syntax_sugar_async_ops(bool value) { + syntax_sugar_async_ops_ = value; + return *this; + } + + // If true, only a part of operands will be printed out (note that in this + // case the text will not be parsable). + HloPrintOptions& set_compact_operands(bool value) { + compact_operands_ = value; + return *this; + } + + // If true, include the layout in any shapes that are printed (instruction + // and operands). + HloPrintOptions& set_include_layout_in_shapes(bool value) { + include_layout_in_shapes_ = value; + return *this; + } + + // If true, canonicalizes instructions' name. Instead of using "%foo.1" as + // the name of an instruction, we use "%tmp_1", "%tmp_2" etc. + HloPrintOptions& set_canonicalize_instruction_names(bool value) { + canonicalize_instruction_names_ = value; + return *this; + } + + // If true, canonicalizes computations, sorting by computations' names. + HloPrintOptions& set_canonicalize_computations(bool value) { + canonicalize_computations_ = value; + return *this; + } + + // The indent of the hlo text block. + HloPrintOptions& set_indent_amount(int value) { + indent_amount_ = value; + return *this; + } + + // If true, indicates the instruction being printed is inside a nested + // computation. + HloPrintOptions& set_is_in_nested_computation(bool value) { + is_in_nested_computation_ = value; + return *this; + } + + HloPrintOptions& set_print_name_after_closing_brace(bool value) { + print_name_after_closing_brace_ = value; + return *this; + } + + bool print_large_constants() const { return print_large_constants_; } + bool print_only_essential_constants() const { + return print_only_essential_constants_; + } + PrintSubcomputationMode print_subcomputation_mode() const { + return print_subcomputation_mode_; + } + bool print_metadata() const { return print_metadata_; } + bool print_backend_config() const { return print_backend_config_; } + bool print_infeed_outfeed_config() const { + return print_infeed_outfeed_config_; + } + bool compact_operands() const { return compact_operands_; } + bool include_layout_in_shapes() const { return include_layout_in_shapes_; } + bool print_result_shape() const { return print_result_shape_; } + bool print_operand_shape() const { return print_operand_shape_; } + bool print_operand_names() const { return print_operand_names_; } + int64_t print_operand_index_annotation_interval() const { + return print_operand_index_annotation_interval_; + } + bool print_ids() const { return print_ids_; } + bool print_program_shape() const { return print_program_shape_; } + bool print_percent() const { return print_percent_; } + bool print_control_dependencies() const { + return print_control_dependencies_; + } + bool print_extra_attributes() const { return print_extra_attributes_; } + bool syntax_sugar_async_ops() const { return syntax_sugar_async_ops_; } + bool canonicalize_instruction_names() const { + return canonicalize_instruction_names_; + } + bool canonicalize_computations() const { return canonicalize_computations_; } + int indent_amount() const { return indent_amount_; } + int is_in_nested_computation() const { return is_in_nested_computation_; } + int print_name_after_closing_brace() const { + return print_name_after_closing_brace_; + } + + private: + // The interval between the /*index=*/ annotated operands. 0 means never print + // the annotation, 1 means print annotation for every operand. + int64_t print_operand_index_annotation_interval_; + PrintSubcomputationMode print_subcomputation_mode_; + int indent_amount_; + bool print_large_constants_; + bool print_only_essential_constants_; + bool print_metadata_; + bool print_backend_config_; + bool print_infeed_outfeed_config_; + bool compact_operands_; + bool include_layout_in_shapes_; + bool print_result_shape_; + bool print_operand_shape_; + bool print_operand_names_; + bool print_program_shape_; + bool print_percent_; + bool print_control_dependencies_; + bool canonicalize_instruction_names_; + bool is_in_nested_computation_; + bool print_ids_; + bool canonicalize_computations_; + bool print_extra_attributes_; + bool syntax_sugar_async_ops_; + bool print_name_after_closing_brace_; +}; + +// For canonical string output, we need to have a canonical way to rename +// each instruction and its operands. Each operand is renamed as "tmp_", +// where is an index starting from 0. +class CanonicalNameMap { + public: + const std::string& LookupOrInsert(int unique_id) { + std::string& canonical_name = canonical_name_map_[unique_id]; + if (canonical_name.empty()) { + absl::StrAppend(&canonical_name, "tmp_", canonical_name_map_.size() - 1); + } + return canonical_name; + } + + void Reserve(size_t size) { canonical_name_map_.reserve(size); } + + private: + absl::flat_hash_map canonical_name_map_; +}; + +// HLO instructions are the atomic unit of the high-level compiler's IR. +// +// HloInstructions live inside of an HloComputation, which is analogous to a +// function in other programming languages. Nodes have no total order within +// their computation. Instead, they have a partial ordering determined by their +// data and control dependencies. +// +// HLO does not have basic blocks or explicit "branch" instructions. Instead, +// certain HloInstructions -- namely, kWhile, kConditional, and kCall -- encode +// control flow. For example, the kConditional HLO executes one of two possible +// computations, depending on the runtime value of a predicate. +// +// HLO is pure (mostly). It has no concept of mutable state. Instead, data +// values are produced by one HLO and flow into consumers across dependency +// edges. +class HloInstruction { + public: + // A fusion node computes the same value a call to its fusion computation + // would compute. However, the choice of fusion kind dictates codegen + // strategy for the backend. + // + // To generate code for a kFusion HloInstruction, most backends do something + // like the following: + // + // 1) Identify the "primary" HloInstruction of the fused computation. + // 2) Emit code that does the work of the primary node, creating its inputs + // and transforming its outputs as specified by the fused computation. + // + // In step (2), the code emitted is usually similar to the code that would be + // emitted for an *unfused* version of the primary node, except that + // + // - when the primary node reads an element of one of its operands, instead + // of loading the value from memory, it *computes* the value based on the + // contents of the fused computation. + // - when the primary node outputs a value, instead of storing it to memory, + // it forwards the value to its users, which then perform additional + // computations before the value is finally stored to memory at the root of + // the fusion node. + // + // An HloInstruction's FusionKind helps us find the kFusion instruction's + // primary node, and can also affect how we generate code in step (2). + // + // - kInput: The primary node is the root of the fused instruction. + // + // - kOutput: The primary node is not the root of the fused instruction. + // This fusion kind requires that one operand buffer of the fusion + // instruction be able to alias the output buffer. This constraint is + // usually enough to let backends find the primary node unambiguously. + // + // - kLoop: The primary node is the root of the fused computation, but, + // unlike in input fusion, we prescribe a specific implementation for + // codegen. Rather than generating code that looks like the code we'd emit + // for an unfused version of the primary/root node, we emit code that + // generates one element of the root at a time. + // + // - kCustom: Custom category for backend-specific fusions that don't fit + // into the above patterns. + // + // Not all backends support all fusion kinds, and given a particular fused + // computation, it's not in general safe to change its fusion kind. Creation + // of fusion nodes is always backend-specific. + // + // For elementwise ops (e.g. kAdd), most backends would emit a + // one-element-at-a-time implementation for the unfused version, so loop + // fusion and input fusion are probably equivalent if the root node is + // elementwise. They're not necessarily equivalent e.g. for kReduce, where an + // implementation might emit something more sophisticated for an unfused or + // input-fusion reduce, but will emit the naive code that reduces one element + // at a time for loop fusion with a reduce as the root. + // + // Another way to think of loop fusion is that it's equivalent to input + // fusion, but where the root node is an implicit identity node, whose + // unfused implementation is "read one element, write one element". + // + // TODO(b/79869434): This categorization scheme is not great. For one thing, + // input and loop fusion are basically the same thing: There is no reason for + // the HLO to encode backend-specific decisions about how e.g. a reduce that's + // the root of a fusion should be lowered. In addition, this scheme as + // written doesn't work for multi-output fusion, where the primary node is + // never actually the root (which is a kTuple instruction that gathers the + // multiple outputs of the fusion). + enum class FusionKind { + kLoop, + kInput, + kOutput, + kCustom, + }; + + inline static constexpr char kMainExecutionThread[] = "main"; + + virtual ~HloInstruction() { DetachFromOperandsAndUsers(); } + + // Detaches an instruction from its operands and users. That is, remove the + // instruction from each operand's user set and user's operand set. + void DetachFromOperandsAndUsers(); + + // Adds a derived instruction to the parent computation of this instruction. + // Also update setup the new instruction as a derived instruction. + HloInstruction* AddInstruction( + std::unique_ptr derived_instruction); + + // Creates an instruction from the given proto. Arguments: + // + // proto: the proto to convert from. + // instruction_map: a map from instruction id to HloInstruction*. This map + // must contain all operands of the newly constructed instruction. + // computation_map: a map from computation id to HloComputation*. This map + // must contain all computations which the newly constructed instruction + // calls. + static StatusOr> CreateFromProto( + const HloInstructionProto& proto, + const absl::flat_hash_map& instruction_map, + const absl::flat_hash_map& computation_map = {}, + bool prohibit_empty_literal = true); + + // Creates a parameter-retrieving instruction. + static std::unique_ptr CreateParameter( + int64_t parameter_number, const Shape& shape, absl::string_view name); + + // Creates a literal constant instruction. + static std::unique_ptr CreateConstant(Literal literal); + + // Creates an Iota instruction. + static std::unique_ptr CreateIota(const Shape& shape, + int64_t iota_dimension); + + // Creates a Top-K instruction. + static std::unique_ptr CreateTopK(const Shape& shape, + HloInstruction* input, + int64_t k, + HloComputation* compare); + + // Creates a get tuple element instruction. + static std::unique_ptr CreateGetTupleElement( + const Shape& shape, HloInstruction* operand, int64_t index); + + // Creates a get tuple element instruction. + static std::unique_ptr CreateGetTupleElement( + HloInstruction* operand, int64_t index); + + // Creates a random number generation instruction that fills a shape with + // random numbers from a given distribution. + // + // The parameters to the instruction are interpreted as follows: + // + // - If `distribution` is RNG_UNIFORM, generates a number in range + // [param0, param1). + // + // - If `distribution` is RNG_NORMAL, generates a normally-distributed value + // with mean `param0` and standard deviation `param1`. + static std::unique_ptr CreateRng( + const Shape& shape, RandomDistribution distribution, + absl::Span parameters); + + // Creates a stateless random bit generator instruction that fills a shape + // with random bits. + static std::unique_ptr CreateRngBitGenerator( + const Shape& shape, HloInstruction* state, RandomAlgorithm algorithm); + + // Creates an instruction to update the random number generator state to + // reflect the new state after `delta` units of 32 random bits are generated + // and returns the old state. + static std::unique_ptr CreateRngGetAndUpdateState( + const Shape& shape, int64_t delta); + + // Creates a unary instruction (one operand). + // Precondition: opcode must be a legitimate unary operation. + static std::unique_ptr CreateUnary(const Shape& shape, + HloOpcode opcode, + HloInstruction* operand); + + // Creates a binary instruction (two operands). + // Precondition: opcode must be a legitimate binary operation. + static std::unique_ptr CreateBinary(const Shape& shape, + HloOpcode opcode, + HloInstruction* lhs, + HloInstruction* rhs); + + // Creates a ternary instruction (three operands). + // Precondition: opcode must be a legitimate ternary operation. + static std::unique_ptr CreateTernary(const Shape& shape, + HloOpcode opcode, + HloInstruction* lhs, + HloInstruction* rhs, + HloInstruction* ehs); + + // Creates a variadic instruction (variable number of operands). + // Precondition: opcode must be a legitimate variadic operation. + static std::unique_ptr CreateVariadic( + const Shape& shape, HloOpcode opcode, + absl::Span operands); + + // Creates a map instruction, where the computation (given by the handle) is + // applied element-wise to every element in operands (across the operands, + // at a given index) + static std::unique_ptr CreateMap( + const Shape& shape, absl::Span operands, + HloComputation* map_computation); + + // Creates a convolution op, where rhs is the convolutional filter + // and window describes how the filter is applied to lhs. + static std::unique_ptr CreateConvolve( + const Shape& shape, HloInstruction* lhs, HloInstruction* rhs, + int64_t feature_group_count, int64_t batch_group_count, + const Window& window, + const ConvolutionDimensionNumbers& dimension_numbers, + const PrecisionConfig& precision_config); + + // Creates an FFT op, of the type indicated by fft_type. + static std::unique_ptr CreateFft( + const Shape& shape, HloInstruction* operand, FftType fft_type, + absl::Span fft_length); + + // Creates an asynchronous start, update, and done op. + static std::unique_ptr CreateAsyncStart( + const Shape& shape, absl::Span operands, + HloComputation* async_computation, + std::optional async_group_id = std::nullopt, + absl::string_view async_execution_thread = kMainExecutionThread); + static std::unique_ptr CreateAsyncUpdate( + const Shape& shape, HloInstruction* operand, + HloComputation* async_computation, + std::optional async_group_id = std::nullopt, + absl::string_view async_execution_thread = kMainExecutionThread); + static std::unique_ptr CreateAsyncDone( + const Shape& shape, HloInstruction* operand, + HloComputation* async_computation, + std::optional async_group_id = std::nullopt, + absl::string_view async_execution_thread = kMainExecutionThread); + + // Creates a copy-start op, indicating whether this is a cross-program + // prefetch or not. + static std::unique_ptr CreateCopyStart( + const Shape& shape, HloInstruction* operand, + std::optional cross_program_prefetch_index = std::nullopt); + + // Creates a compare op, performing the comparison specified in direction. + static std::unique_ptr CreateCompare( + const Shape& shape, HloInstruction* lhs, HloInstruction* rhs, + Comparison::Direction direction, + std::optional type = std::nullopt); + + static std::unique_ptr CreateTriangularSolve( + const Shape& shape, HloInstruction* a, HloInstruction* b, + const TriangularSolveOptions& options); + + static std::unique_ptr CreateCholesky( + const Shape& shape, HloInstruction* a, const CholeskyOptions& options); + + // Creates a dot op with operands 'lhs' and 'rhs' with contracting and batch + // dimensions specified in 'dimension_numbers'. + static std::unique_ptr CreateDot( + const Shape& shape, HloInstruction* lhs, HloInstruction* rhs, + const DotDimensionNumbers& dimension_numbers, + const PrecisionConfig& precision_config); + + // Creates a reduce-precision op, where operand is the data to reduce in + // precision, and exponent_bits and mantissa_bits describe the precision to + // reduce it to. + static std::unique_ptr CreateReducePrecision( + const Shape& shape, HloInstruction* operand, int exponent_bits, + int mantissa_bits); + + // Creates an all-gather op, which concats the operands of all participants + // along all_gather_dimension. The replica_groups, channel_id, and + // use_global_device_ids arguments are identical to those in all-reduce, + // except that the order of the group members determines the concatenation + // order of inputs from different participants. + static std::unique_ptr CreateAllGather( + const Shape& shape, absl::Span operands, + int64_t all_gather_dimension, + absl::Span replica_groups, bool constrain_layout, + const std::optional& channel_id, bool use_global_device_ids); + + // Creates an all-gather-start op, which concats the operands of all + // participants + // along all_gather_dimension. The replica_groups, channel_id, and + // use_global_device_ids arguments are identical to those in all-reduce, + // except that the order of the group members determines the concatenation + // order of inputs from different participants. Needs to be used in + // conjunction of a AllGatherDone op that synchronizes and returns the result. + static std::unique_ptr CreateAllGatherStart( + const Shape& shape, absl::Span operands, + int64_t all_gather_dimension, + absl::Span replica_groups, bool constrain_layout, + const std::optional& channel_id, bool use_global_device_ids); + + // Creates a cross replica reduction op. + // + // `reduction_computation`: the reduction function. + // + // `replica_groups`: each ReplicaGroup contains a list of replica id. If + // empty, all replicas belong to one group in the order of 0 - (n-1). + // Allreduce will be applied within subgroups. + // For example, we have 4 replicas, then replica_groups={{0,2},{1,3}} means, + // replica 0 and 2 are in subgroup 0, replica 1 and 3 are in subgroup 1. + // + // `channel_id`: for Allreduce nodes from different modules, if + // they have the same channel_id, they will be 'Allreduce'd. If + // empty, Allreduce will not be applied cross modules. + static std::unique_ptr CreateAllReduce( + const Shape& shape, absl::Span operands, + HloComputation* reduce_computation, + absl::Span replica_groups, bool constrain_layout, + const std::optional& channel_id, bool use_global_device_ids); + + // Creates a reduce-scatter operation which reduces its inputs across the + // given replica groups and then scatters the reduced data across the N + // participants. + static std::unique_ptr CreateReduceScatter( + const Shape& shape, absl::Span operands, + HloComputation* reduce_computation, + absl::Span replica_groups, bool constrain_layout, + const std::optional& channel_id, bool use_global_device_ids, + int64_t scatter_dimension); + + // Creates an asynchronous cross replica reduction op. + // + // `reduction_computation`: the reduction function. + // + // `replica_groups`: each ReplicaGroup contains a list of replica id. If + // empty, all replicas belong to one group in the order of 0 - (n-1). + // Allreduce will be applied within subgroups. + // For example, we have 4 replicas, then replica_groups={{0,2},{1,3}} means, + // replica 0 and 2 are in subgroup 0, replica 1 and 3 are in subgroup 1. + // + // `channel_id`: for Allreduce nodes from different modules, if + // they have the same channel_id, they will be 'Allreduce'd. If + // empty, Allreduce will not be applied cross modules. + static std::unique_ptr CreateAllReduceStart( + const Shape& shape, absl::Span operands, + HloComputation* reduce_computation, + absl::Span replica_groups, bool constrain_layout, + const std::optional& channel_id, bool use_global_device_ids); + + // An all-to-all op takes N array operands of the same shape and scatters them + // to N replicas. Each replica gathers the results into a tuple. + // + // For example, suppose we have 3 replicas, with replica i passing inputs + // [a_i, b_i, c_i] to its all-to-all op. Then the resulting tuples are + // + // replica 0: (a_0, a_1, a_2) + // replica 1: (b_0, b_1, b_2) + // replica 2: (c_0, c_1, c_2). + // + // If replica_groups is set, the op is sharded and the replicas are permuted. + // To explain by way of example, suppose we have replica_groups={{1,2},{3,0}}. + // Then each replica passes two operands, say [a_i, b_i], and the result is + // + // replica 0: (b_3, b_0) + // replica 1: (a_1, a_2) + // replica 2: (b_1, b_2) + // replica 3: (a_3, a_0). + // + // All replica groups must have the same number of elements, and the number of + // operands must be equal to the size of one replica group. Each replica must + // appear in exactly one group. + // + // Note that in addition to supporting this instruction, XlaBuilder also + // supports a higher-level instruction which takes one input and slices it, + // performs AllToAll and then concatenates the results into a single array. + static std::unique_ptr CreateAllToAll( + const Shape& shape, absl::Span operands, + absl::Span replica_groups, bool constrain_layout, + const std::optional& channel_id, + const std::optional& split_dimension = std::nullopt); + + // Creates a communication instruction that permutes data cross replicas. + // Data is sent/received according to the (source_replica_id, + // target_replica_id) pairs in `source_target_pairs`. If a replica id is not a + // target_replica_id in any pair, the output on that replica is a tensor + // consists of 0(s) in `shape`. + static std::unique_ptr CreateCollectivePermute( + const Shape& shape, HloInstruction* operand, + const std::vector>& source_target_pairs, + const std::optional& channel_id); + + static std::unique_ptr CreateCollectivePermute( + const Shape& shape, HloInstruction* input, HloInstruction* output, + HloInstruction* input_start_indices, HloInstruction* output_start_indices, + absl::Span> source_target_pairs, + absl::Span> slice_sizes, + const std::optional& channel_id); + + // Creates a communication instruction that initiates the start of + // CollectivePermute. + static std::unique_ptr CreateCollectivePermuteStart( + const Shape& shape, HloInstruction* operand, + const std::vector>& source_target_pairs, + const std::optional& channel_id); + + static std::unique_ptr CreateCollectivePermuteStart( + const Shape& shape, HloInstruction* input, HloInstruction* output, + HloInstruction* input_start_indices, HloInstruction* output_start_indices, + absl::Span> source_target_pairs, + absl::Span> slice_sizes, + const std::optional& channel_id); + + // Creates an instruction that returns a U32 replica ID. + static std::unique_ptr CreateReplicaId( + const Shape& shape = ShapeUtil::MakeShape(U32, {})); + + // Creates an instruction that returns a U32 partition ID. + static std::unique_ptr CreatePartitionId( + const Shape& shape = ShapeUtil::MakeShape(U32, {})); + + // Creates a conversion instruction, where operand is the data to convert and + // shape is the target shape for the conversion. + static std::unique_ptr CreateConvert(const Shape& shape, + HloInstruction* operand); + + // Creates a bitcast instruction, where operand is the data to + // convert and shape is the target shape for the conversion. + static std::unique_ptr CreateBitcast(const Shape& shape, + HloInstruction* operand); + + // Creates a bitcast conversion instruction, where operand is the data to + // convert and shape is the target shape for the conversion. + static std::unique_ptr CreateBitcastConvert( + const Shape& shape, HloInstruction* operand); + + // Creates a stochastic conversion instruction, where operand is the data to + // convert, random is a given random input to determine the rounding direction + // and shape is the target shape for the conversion. + static std::unique_ptr CreateStochasticConvert( + const Shape& shape, HloInstruction* operand, HloInstruction* random); + + // Creates an infeed instruction, which reads data of the given shape from the + // Infeed interface of the device. infeed_shape is the shape of the data + // received from the infeed *not* the shape of the infeed instruction which + // is a tuple containing the infeed_shape and the TOKEN. + static std::unique_ptr CreateInfeed( + const Shape& infeed_shape, HloInstruction* token_operand, + const std::string& config); + + // Creates an outfeed instruction, which outputs data. outfeed_shape is the + // shape of the data being outfed *not* the shape of the outfeed instruction + // which is a TOKEN. + static std::unique_ptr CreateOutfeed( + const Shape& outfeed_shape, HloInstruction* operand, + HloInstruction* token_operand, absl::string_view outfeed_config); + + // Creates an asynchronous send instruction with the given channel id, which + // initiates sending the operand data to a unique receive instruction in + // another computation that has the same channel id. If is_host_transfer is + // true, then this Send operation transfers data to the host. + static std::unique_ptr CreateSend( + HloInstruction* operand, HloInstruction* token, int64_t channel_id, + bool is_host_transfer = false); + + // Blocks until data transfer for the Send instruction (operand) is complete. + // The operand must be kSend. + static std::unique_ptr CreateSendDone( + HloInstruction* operand, bool is_host_transfer = false); + + // Creates an asynchronous receive instruction with the given channel id, + // which allocates resources to receive data of the given shape from a unique + // send instruction in another computation that has the same channel id. If + // is_host_transfer is true, then this Recv operation transfers data from the + // host. + static std::unique_ptr CreateRecv( + const Shape& shape, HloInstruction* token, int64_t channel_id, + bool is_host_transfer = false); + + // Blocks until data transfer for the Recv instruction (operand) is complete + // and returns the receive buffer. The operand must be kRecv. + static std::unique_ptr CreateRecvDone( + HloInstruction* operand, bool is_host_transfer = false); + + // Creates a slice instruction, where the operand is sliced by the given + // start/limit indices. + static std::unique_ptr CreateSlice( + const Shape& shape, HloInstruction* operand, + absl::Span start_indices, + absl::Span limit_indices, + absl::Span strides); + + // Creates a slice instruction, where the first operand is sliced by + // start indices specified in the second operand, and by size specified in + // 'slice_sizes'. + static std::unique_ptr CreateDynamicSlice( + const Shape& shape, HloInstruction* operand, + absl::Span start_indices, + absl::Span slice_sizes); + + // Creates a dynamic update slice instruction, which updates a slice + // of 'operand' with 'update' and 'start_indices'. + static std::unique_ptr CreateDynamicUpdateSlice( + const Shape& shape, HloInstruction* operand, HloInstruction* update, + absl::Span start_indices); + + // Creates a concatenate instruction, where the operands are concatenated on + // the provided dimension. + static std::unique_ptr CreateConcatenate( + const Shape& shape, absl::Span operands, + int64_t dimension); + + // Creates a reduce instruction, where the computation (given by the handle) + // is applied successively to every element in operand. For example, let f be + // the function to apply, which takes 2 arguments, an accumulator and the + // current value. Let init be an initial value (which is normally chosen to be + // the identity element for f, e.g. 0 if f is addition). + // Then the reduce HLO will compute: + // f(f(init, value0), value1), ...) + static std::unique_ptr CreateReduce( + const Shape& shape, HloInstruction* operand, HloInstruction* init_value, + absl::Span dimensions_to_reduce, + HloComputation* reduce_computation); + + // A more general, multiple-argument version of the above. + // The function to apply, f, now takes N arguments: + // [accumulator0, accumulator1, ..., accumulatorN, value0, value1, ..., + // init_valueN], and returns an N-tuple. The performed computation is (for + // commutative and associative f operators) equivalent to: + // + // f_1 = f(init0, ... initN, input0.value0, ..., inputN.value0) + // f_2 = f(f_1.tuple_element(0), ..., f_1.tuple_element(N), input0.value1, + // ..., inputN.value1) + // ... + static std::unique_ptr CreateReduce( + const Shape& shape, absl::Span operands, + absl::Span init_values, + absl::Span dimensions_to_reduce, + HloComputation* reduce_computation); + + // Helper version where the operands are given by a single instruction which + // either is a tuple of size `init_values`, or a single input, in which case + // size of `init_values` is one. + static std::unique_ptr CreateReduce( + const Shape& shape, HloInstruction* tuple_of_instructions, + absl::Span init_values, + absl::Span dimensions_to_reduce, + HloComputation* reduce_computation); + + // Creates a reduce-window instruction, where the computation (given + // by the handle) is applied window-wise at each valid window + // position in the operand. + static std::unique_ptr CreateReduceWindow( + const Shape& shape, HloInstruction* operand, HloInstruction* init_value, + const Window& window, HloComputation* reduce_computation); + + // A more general, multiple-argument version of the above. + // The reduce_computation being applied,now takes N arguments: + // [accumulator0, accumulator1, ..., accumulatorN, value0, value1, ..., + // valueN], and returns an N-tuple. The operands and init_values now each + // contain a span of N input arrays and n initial values. + static std::unique_ptr CreateReduceWindow( + const Shape& shape, absl::Span operands, + absl::Span init_values, const Window& window, + HloComputation* reduce_computation); + + // Creates a batch-norm-training instruction. + static std::unique_ptr CreateBatchNormTraining( + const Shape& shape, HloInstruction* operand, HloInstruction* scale, + HloInstruction* offset, float epsilon, int64_t feature_index); + + // Creates a batch-norm-inference instruction. + static std::unique_ptr CreateBatchNormInference( + const Shape& shape, HloInstruction* operand, HloInstruction* scale, + HloInstruction* offset, HloInstruction* mean, HloInstruction* variance, + float epsilon, int64_t feature_index); + + // Creates a batch-norm-grad instruction. + static std::unique_ptr CreateBatchNormGrad( + const Shape& shape, HloInstruction* operand, HloInstruction* scale, + HloInstruction* mean, HloInstruction* variance, + HloInstruction* grad_output, float epsilon, int64_t feature_index); + + // Creates a scatter computation that scatters the `source` array to the + // selected indices of each window. + static std::unique_ptr CreateSelectAndScatter( + const Shape& shape, HloInstruction* operand, HloComputation* select, + const Window& window, HloInstruction* source, HloInstruction* init_value, + HloComputation* scatter); + + // Creates a broadcast instruction. + static std::unique_ptr CreateBroadcast( + const Shape& shape, HloInstruction* operand, + absl::Span broadcast_dimensions); + + // Creates a sequence of instructions that performs an explicit broadcast of + // the operand to the target shape. + // + // Interior HLOs are passed to "adder", but the "root" HLO of the sequence is + // returned as a unique_ptr for API consistency with other factory methods in + // this interface. + // + // TODO(b/72173833) Ideally HloComputations would always be present, and so + // the adder being passed by the caller would not be necessary. + static std::unique_ptr CreateBroadcastSequence( + const Shape& output_shape, HloInstruction* operand, + absl::FunctionRef)> + adder); + + // Creates a pad instruction, where the operand is padded on the edges and + // between the elements with the given padding value. + static std::unique_ptr CreatePad( + const Shape& shape, HloInstruction* operand, + HloInstruction* padding_value, const PaddingConfig& padding_config); + + // Creates a reshape instruction, where the operand is flattened row-major + // order and then reshaped to the given result shape. + static std::unique_ptr CreateReshape( + const Shape& shape, HloInstruction* operand, + int64_t inferred_dimension = -1); + + // Creates a dynamic reshape instruction. Similar to reshape but dynamic + // dimensions sizes are provided as additional variadic arguments. + // + // Precondition: dim_sizes.size() == shape.rank() + static std::unique_ptr CreateDynamicReshape( + const Shape& shape, HloInstruction* data_operand, + absl::Span dim_sizes); + + // Creates a transpose instruction which permutes the operand dimensions. + static std::unique_ptr CreateTranspose( + const Shape& shape, HloInstruction* operand, + absl::Span dimensions); + + // Creates a n-ary sort op with a 'compare' computation which is used for + // comparisons in the sorting algorithm. 'compare' gets 2 * n parameters, + // where parameters 2 * i and 2 * i + 1 are the values of the i-th operand at + // specific index positions which should be compared, and should return a + // PRED. 'is_stable' specifies whether stable sorting is required. + static std::unique_ptr CreateSort( + const Shape& shape, int64_t dimension, + absl::Span operands, HloComputation* compare, + bool is_stable); + + // Creates a while instruction, given a condition computation, a body + // computation, and the initial value for the input of the computations. For + // example, shape: S32, condition: i -> i < 1000, body: i -> i * 2, init: 1 + // corresponds to the C code below. + // int32_t i = 1; int32_t result = while(i < 1000) { i = i * 2 } + static std::unique_ptr CreateWhile(const Shape& shape, + HloComputation* condition, + HloComputation* body, + HloInstruction* init); + + static std::unique_ptr CreateConditional( + const Shape& shape, HloInstruction* pred, + HloInstruction* true_computation_arg, HloComputation* true_computation, + HloInstruction* false_computation_arg, HloComputation* false_computation); + + static std::unique_ptr CreateConditional( + const Shape& shape, HloInstruction* branch_index, + absl::Span branch_computations, + absl::Span branch_computation_args); + + static std::unique_ptr CreateGather( + const Shape& shape, HloInstruction* operand, + HloInstruction* start_indices, + const GatherDimensionNumbers& gather_dim_numbers, + absl::Span slice_sizes, bool indices_are_sorted); + + static std::unique_ptr CreateScatter( + const Shape& shape, absl::Span operands, + HloInstruction* scatter_indices, + absl::Span updates, + HloComputation* update_computation, + const ScatterDimensionNumbers& scatter_dim_numbers, + bool indices_are_sorted, bool unique_indices); + + static std::unique_ptr CreateScatter( + const Shape& shape, HloInstruction* operand, + HloInstruction* scatter_indices, HloInstruction* updates, + HloComputation* update_computation, + const ScatterDimensionNumbers& scatter_dim_numbers, + bool indices_are_sorted, bool unique_indices); + + // Creates a kDomain instruction which delimits an HLO domain which have + // the provided user and operand side metadata. + static std::unique_ptr CreateDomain( + const Shape& shape, HloInstruction* operand, + std::unique_ptr operand_side_metadata, + std::unique_ptr user_side_metadata); + + // Creates a fusion instruction. A fusion instruction contains one or more + // fused instructions forming an expression with a single root + // "fused_root". Additional instructions can be added to the fusion + // instruction with the method FuseInstruction. + static std::unique_ptr CreateFusion( + const Shape& shape, FusionKind fusion_kind, HloInstruction* fused_root); + + static std::unique_ptr CreateFusion( + const Shape& shape, FusionKind fusion_kind, + absl::Span operands, + HloComputation* fusion_computation, absl::string_view prefix = ""); + + // Creates a call instruction that applies the given computation on the given + // operands. "shape" is the resultant shape. + static std::unique_ptr CreateCall( + const Shape& shape, HloInstruction* called_computation_root); + + static std::unique_ptr CreateCall( + const Shape& shape, absl::Span operands, + HloComputation* computation); + + // Creates a custom call instruction that applies the given custom call target + // to the given operands. "opaque" can be an arbitrary string with a + // backend-specific interpretation. "shape" is the resultant shape. + static std::unique_ptr CreateCustomCall( + const Shape& shape, absl::Span operands, + absl::string_view custom_call_target, std::string opaque = "", + CustomCallApiVersion api_version = API_VERSION_ORIGINAL); + + // Overload with a to_apply computation. + static std::unique_ptr CreateCustomCall( + const Shape& shape, absl::Span operands, + HloComputation* to_apply, absl::string_view custom_call_target, + std::string opaque = "", + CustomCallApiVersion api_version = API_VERSION_ORIGINAL); + + // Overload with multiple computations. The called computations can have + // different function signatures. + static std::unique_ptr CreateCustomCall( + const Shape& shape, absl::Span operands, + absl::Span called_computations, + absl::string_view custom_call_target, std::string opaque = "", + CustomCallApiVersion api_version = API_VERSION_ORIGINAL); + + // Overload which constrains the layouts of the operand and result. 'shape' + // and 'operand_shapes_with_layout' must have layouts. + // 'operand_shapes_with_layout' must have a compatible element for each + // operand. + static std::unique_ptr CreateCustomCall( + const Shape& shape, absl::Span operands, + absl::string_view custom_call_target, + absl::Span operand_shapes_with_layout, + std::string opaque = "", + CustomCallApiVersion api_version = API_VERSION_ORIGINAL); + + // Creates a tuple instruction with the given elements. This is a convenience + // wrapper around CreateVariadic. + static std::unique_ptr CreateTuple( + absl::Span elements); + + // Creates a reverse instruction, which reverses the order of the elements + // in the specified dimensions. + static std::unique_ptr CreateReverse( + const Shape& shape, HloInstruction* operand, + absl::Span dimensions); + + // Creates a Afterall instruction used for joining or creating new values of + // token type which thread through side-effecting operations. Operands must + // all be tokens, and there must be at least one operand. + static std::unique_ptr CreateAfterAll( + absl::Span operands); + + // Creates an AfterAll instruction which creates a token type out of thin air + // (no operands). This is a separate method from CreateAfterAll to facility + // the removal of operand-less AfterAll instructions. + // TODO(b/110532604): Remove this capability of creating a token from nothing + // when we plumb a primordial token from the entry computation. + static std::unique_ptr CreateToken(); + + static std::unique_ptr CreateGetDimensionSize( + const Shape& shape, HloInstruction* operand, int64_t dimension); + + static std::unique_ptr CreateSetDimensionSize( + const Shape& shape, HloInstruction* operand, HloInstruction* val, + int64_t dimension); + + static std::unique_ptr CreateAddDependency( + HloInstruction* data_operand, HloInstruction* token_operand); + + // Returns true if `execution_thread` is included in the + // `execution_threads_set`. + static bool IsThreadIncluded( + absl::string_view execution_thread, + const absl::flat_hash_set& execution_threads_set); + + // Returns the opcode for this instruction. + HloOpcode opcode() const { return opcode_; } + HloOpcode* mutable_opcode() { return &opcode_; } + + // Returns whether this instruction is the root of its parent computation. + bool IsRoot() const; + + // Does this instruction have no users. + bool IsDead() const { return users_.empty() && !IsRoot(); } + + // Returns true if this instruction has a side effect, irrespective of whether + // any called computations may contain an instruction with side effects. + bool HasSideEffectNoRecurse() const; + + // Returns true if this instruction has a side effect. An instruction has a + // side effect if it uses certain opcodes or calls a computation with a side + // effect. + bool HasSideEffect() const; + + // Returns the result shape of this instruction. + const Shape& shape() const; + + // Returns the (mutable) result shape of this instruction. + Shape* mutable_shape() { return &shape_; } + + // Returns the ith operand to this instruction. + const HloInstruction* operand(int64_t i) const; + + // Returns the ith operand to this instruction. + HloInstruction* mutable_operand(int64_t i); + + // Returns the number of operands to this instruction. + int64_t operand_count() const { return operands_.size(); } + + // Returns the vector of operands of this instruction. + using InstructionVector = absl::InlinedVector; + const InstructionVector& operands() const { return operands_; } + InstructionVector mutable_operands() { return operands_; } + + // Returns the vector of unique operands, in the same order they are found + // within the operand vector. + InstructionVector unique_operands() const; + + // Returns the index of 'target' in the operands sequence. + // Precondition: target must be an operand (or a fatal error will occur). + int64_t operand_index(const HloInstruction* target) const; + + // Returns the number of users of this instruction. + int64_t user_count() const { return users_.size(); } + + // Returns the users of this instruction. + const std::vector& users() const { return users_; } + + // Returns the index of the user in the users() vector. + // + // Precondition: `user` is a user of the instruction. + int64_t UserId(HloInstruction* user); + + // Returns true if this instruction is a user of 'instruction'. + bool IsUserOf(const HloInstruction* instruction) const { + return instruction->user_map_.contains(this); + } + + // Adds a control dependency from this instruction to the given + // instruction. This instruction becomes a control predecessor of + // 'instruction', and 'instruction' becomes a control successor of this + // instruction. Returns an error status if either of the given instructions + // does not belong to the same computation. + // + // This is used to enforce an additional ordering requirement that is not + // captured by normal data dependencies, such as ordering among Send or Recv + // operations to avoid deadlock. + Status AddControlDependencyTo(HloInstruction* instruction); + + // Removes a previously added control dependency from this instruction to + // 'instruction'. + Status RemoveControlDependencyTo(HloInstruction* instruction); + + // Drops all control predecessors and successors from this HLO instruction. + Status DropAllControlDeps(); + + // Drops all control predecessors and successors from this HLO instruction, + // and the maintain the transitivie control dependencies between + // control predecessors and control successors. + Status SafelyDropAllControlDependencies(); + + // Returns if instruction has any control dependencies. + bool HasControlDependencies() const; + + // Copies the control predecessors and successors on this HLO instruction to + // `inst`. Does not do a deep copy so this makes sense only if `inst` and + // this HLO are in the same module. + // + // Depending on the use cases we see in practice, in the future we may + // consider folding the logic here into Clone, CloneWithNewOperands and + // ReplaceAllUsesWith by treating control dependencies like data dependencies. + Status CopyAllControlDepsFrom(const HloInstruction* inst); + + // Returns the set of control predecessors (successors) of this + // instruction. Control predecessors (successors) must execute before (after) + // the current instruction. + const std::vector& control_predecessors() const { + return control_predecessors_; + } + const std::vector& control_successors() const { + return control_successors_; + } + + // Returns true if 'other' performs the same computation as this instruction. + bool Identical( + const HloInstruction& other, + absl::FunctionRef + eq_operands = std::equal_to(), + absl::FunctionRef + eq_computations = std::equal_to(), + bool layout_sensitive = true, bool sharding_sensitive = false) const { + return IdenticalInternal(other, eq_operands, eq_computations, + layout_sensitive, sharding_sensitive, + /*ignore_channel_id_values=*/false, + /*ignore_commutative_operand_order=*/false); + } + // Returns true if 'other' is the same kind of op as this instruction. For + // regular ops, it just checks whether the opcode is the same, for ops like + // e.g. kCompare, it also checks extra attributes. + bool SameOp(const HloInstruction& other) const { + return opcode() == other.opcode() && + IdenticalSlowPath(other, std::equal_to()); + } + + // Same as Identical() but ignores the order of commutative operands (e.g. + // considers add(a,b) equal to add(b,a)). + bool IdenticalIgnoringCommutativeOperandOrder( + const HloInstruction& other, + absl::FunctionRef + eq_operands = std::equal_to(), + absl::FunctionRef + eq_computations = std::equal_to(), + bool layout_sensitive = true, bool sharding_sensitive = false) const { + return IdenticalInternal(other, eq_operands, eq_computations, + layout_sensitive, sharding_sensitive, + /*ignore_channel_id_values=*/false, + /*ignore_commutative_operand_order=*/true); + } + + // Same as Identical() but ignores channel ID value mismatches, as long as + // both have channel IDs or neither has a channel ID. + bool IdenticalIgnoringChannelIdValues( + const HloInstruction& other, + absl::FunctionRef + eq_operands = std::equal_to(), + absl::FunctionRef + eq_computations = std::equal_to(), + bool layout_sensitive = true, bool sharding_sensitive = false) const { + return IdenticalInternal(other, eq_operands, eq_computations, + layout_sensitive, sharding_sensitive, + /*ignore_channel_id_values=*/true, + /*ignore_commutative_operand_order=*/true); + } + + // Generates a hash value of an HLO instruction. Hash considers + // information on opcode, shape, operands, and typically a root instruction. + // This function returns the same hash value for equivalent HLO instructions, + // with respect to HloInstruction::Identical() method. + // TODO(majnemer): Make the comment here more crisp & accurate. + template + friend H AbslHashValue(H h, const HloInstruction& hlo) { + h = H::combine(std::move(h), hlo.opcode(), hlo.shape()); + + if (!hlo.IsCrossModuleAllReduce()) { + for (size_t i = 0; i < hlo.operands().size(); ++i) { + h = H::combine(std::move(h), hlo.operand(i)->shape()); + } + h = H::combine(std::move(h), hlo.operand_count()); + } + + if (hlo.opcode() == HloOpcode::kFusion) { + h = H::combine(std::move(h), *hlo.fused_expression_root(), + hlo.fusion_kind(), hlo.fused_instruction_count(), + hlo.fused_parameters().size()); + } + return h; + } + + // Returns whether the instruction has a constant operand. + bool HasConstantOperand() const; + + // Replaces the use of this instruction in "user" with "new_producer". Note + // that there might be multiple uses of this instruction in "user"; all will + // be replaced. + // + // If user is a fusion instruction, this function will remove any duplicated + // operands of it which could be created due to this replacement. + Status ReplaceUseWith(HloInstruction* user, HloInstruction* new_producer); + + // Same as ReplaceUseWith(), but new_producer can have a different shape. + Status ReplaceUseWithDifferentShape(HloInstruction* user, + HloInstruction* new_producer); + + // Same as ReplaceUseWith but only replaces the use at the given operand + // number. + Status ReplaceUseWith(HloInstruction* user, int operand_number, + HloInstruction* new_producer); + Status ReplaceUseWithDifferentShape(HloInstruction* user, int operand_number, + HloInstruction* new_producer); + + // Replaces the specified operand with new_operand. The old and new operands + // must have compatible shapes ignoring floating-point precision. + // + // This function does NOT remove duplicated operands even if this instruction + // is a fusion, so that the existing operand numbers do not change. + Status ReplaceOperandWith(int64_t operand_num, HloInstruction* new_operand); + + // Same as ReplaceOperandWith(), but new_operand can have a different shape. + Status ReplaceOperandWithDifferentShape(int64_t operand_num, + HloInstruction* new_operand); + + // Replaces all uses of this instruction with the new producer. If + // new_producer is a user of this instruction then new_producer remains a use + // of this instruction to avoid introducing cycles into the graph. + // + // If this instruction is the root of its computation, sets the computation's + // root to new_producer. + // + // The new producer must have a compatible shape ignoring floating-point + // precision. + // + // If a user is a fusion instruction, this function will remove any duplicated + // operands of it which could be created due to this replacement. + // + // trigger is a string used in the error message if the new and the + // current instruction don't have a compatible shape. + Status ReplaceAllUsesWith(HloInstruction* new_producer, + absl::string_view trigger = ""); + + // Same as ReplaceAllUsesWith, but new_producer can have a different shape. + Status ReplaceAllUsesWithDifferentShape(HloInstruction* new_producer); + + // Same as ReplaceAllUsesWith, but only replace given set of users. + Status ReplaceUsesWith(absl::Span users, + HloInstruction* new_producer); + Status ReplaceAllUsesWithDifferentShape( + absl::Span users, HloInstruction* new_producer); + + // Performs a postorder DFS visit using this node as the root. If + // call_finish_visit is true, then DfsHloVisitor::FinishVisit is called when + // complete. If ignore_control_predecessors is true, instructions only + // reachable via control dependencies will not be visited, and the postorder + // will not take control dependencies into account. It is as if the control + // dependencies didn't exist in the graph at all. If cross_computation is + // true, DFS will go across the computation boundary (i.e., from an + // instruction to the root instruction of a computation it calls). + template + Status Accept(DfsHloVisitorBase* visitor, + bool call_finish_visit = true, + bool ignore_control_predecessors = false, + bool cross_computation = false); + Status Accept(ConstDfsHloVisitor* visitor, bool call_finish_visit = true, + bool ignore_control_predecessors = false, + bool cross_computation = false) const { + return const_cast(this)->Accept( + visitor, call_finish_visit, ignore_control_predecessors, + cross_computation); + } + + // Same as Accept() above, but the order of operand and control predecessor + // visitation is determined by the given operand order; if compare(A, B) == + // true, A is visited before B. + using CompareFunction = + absl::FunctionRef; + Status AcceptWithOperandOrder(DfsHloVisitor* visitor, + CompareFunction operand_order, + bool call_finish_visit = true); + + // Visit this instruction and only this instruction with the given visitor. + template + Status Visit(DfsHloVisitorBase* visitor); + Status Visit(ConstDfsHloVisitor* visitor) const { + return const_cast(this)->Visit(visitor); + } + + // Returns the first non-GetTupleElement ancestor instruction of 'hlo'. + // If the first non-GTE ancestor is tuple-shaped, populates 'index' with the + // (possibly nested) tuple indices used on the path from ancestor to 'hlo'. + std::pair LatestNonGteAncestorAndIndex() + const; + + std::pair LatestNonGteAncestorAndIndex() { + auto rv = + const_cast(this)->LatestNonGteAncestorAndIndex(); + return {const_cast(rv.first), rv.second}; + } + + // Same as LatestNonGteAncestorAndIndex, but just returns the HloInstruction. + const HloInstruction* LatestNonGteAncestor() const; + + HloInstruction* LatestNonGteAncestor() { + return const_cast( + const_cast(this)->LatestNonGteAncestor()); + } + + // Returns true whether this instruction is effectively a bitcast. Currently, + // this means it either is a bitcast, or it is a transpose that is effectively + // a bitcast. + bool IsEffectiveBitcast() const; + + // Gets/sets the to_apply HloComputation for Call, Map, Reduce, etc. + // The setter should only be called by HloModule or HloComputation methods. + // + // Precondition: The instruction has a valid to_apply_ field. + HloComputation* to_apply() const; + void set_to_apply(HloComputation* computation); + // Whether the instruction has a valid to_apply_ field. + bool has_to_apply() const; + + // Gets/sets the while_condition or while_body HloComputation for While. The + // setters should only be called by HloModule or HloComputation methods. + // + // Precondition: The instruction is a While instruction. + HloComputation* while_condition() const; + HloComputation* while_body() const; + void set_while_condition(HloComputation* computation); + void set_while_body(HloComputation* computation); + + HloInstruction* while_init() const; + + // Gets/sets the true and false HloComputation for Conditional. + // + // Precondition: The instruction is a predicated Conditional instruction. + HloComputation* true_computation() const; + HloComputation* false_computation() const; + + // Gets the branch HloComputations for Conditional. + // + // Precondition: The instruction is a Conditional instruction. + const std::vector& branch_computations() const; + int branch_count() const; + HloComputation* branch_computation(int b) const; + // Sets a branch HloComputation for Conditional. + // The setter should only be called by HloModule or HloComputation methods. + // + // Precondition: The instruction is a Conditional instruction. + void set_branch_computation(int b, HloComputation* computation); + + // Returns a string for the signature of this instruction if considered as a + // function, e.g. the signature of an F32 add is (F32, F32) -> F32. + std::string SignatureString() const; + + // Prints a debugging string that represents this instruction. + void Print(Printer* printer) const { + return Print(printer, HloPrintOptions::Default()); + } + void Print(Printer* printer, const HloPrintOptions& options) const; + + // Returns a debugging string that represents this instruction. + // + // (We express the default options using an overload rather than a default + // param because gdb ignores default params, but does resolve overloads.) + // + // TODO(b/73348663): Make ToString() adaptive to the size of the string by + // default, backing off on providing full information for very large strings, + // or provide a different name for a ToString-like function that does that. + std::string ToString() const; + std::string ToString(const HloPrintOptions& options) const; + + // Components of the Print() and ToString() representation: + + // Helper class for PrintExtraAttributes. + class AttributePrinter { + public: + explicit AttributePrinter(std::function next_printer) + : next_printer_(std::move(next_printer)) {} + + void Next(absl::FunctionRef print_func) { + print_func(next_printer_()); + } + + private: + std::function next_printer_; + }; + // Prints the string representation of op-specific attributes. + void PrintExtraAttributes(AttributePrinter& printer, + const HloPrintOptions& options) const; + + // Returns string representation of op-specific attributes. + std::vector ExtraAttributesToString( + const HloPrintOptions& options) const; + + // As ToString, but returns a shorter string. + std::string ToShortString() const; + + // Prints an instruction to a string. + // + // The canonical string representation needs to name operands and instruction + // names in a consistent way. This is implemented through the + // canonical_name_map. + void PrintWithCanonicalNameMap(Printer* printer, + const HloPrintOptions& options, + CanonicalNameMap* canonical_name_map) const; + + // Returns a serialized representation of this instruction. + virtual HloInstructionProto ToProto() const; + + // Returns a category for the HLO. This could be something like "convolution" + // or "elementwise". + virtual std::string ToCategory() const; + + // Returns true if this instruction is fused, ie contained within a fusion + // instruction. + bool IsFused() const; + + bool IsLoopFusion() const; + bool IsInputFusion() const; + bool IsOutputFusion() const; + bool IsCustomFusion() const; + + // Returns true if this instruction can be legally fused into a fusion + // instruction. + bool IsFusible() const; + + bool IsCustomCall(absl::string_view target) const; + bool IsCustomCall(absl::Span targets) const; + + // Returns the sharding applied to this operator. + // REQUIRES: has_sharding() is true. + const HloSharding& sharding() const { + CHECK(has_sharding()); + return *sharding_; + } + std::shared_ptr sharding_ptr() const { return sharding_; } + + // Returns the sharding applied to this operator, or default_ if none exists. + const HloSharding& sharding_or_default(const HloSharding& default_) const { + return sharding_ ? *sharding_ : default_; + } + // Returns the sharding unique device, if any. + std::optional sharding_unique_device() const { + if (sharding_ == nullptr) { + return std::nullopt; + } + return sharding_->UniqueDevice(); + } + // Sets the sharding of this operator. Should only be called by HloModule or + // HloComputation methods. + void set_sharding(const HloSharding& sharding) { + set_sharding(std::make_shared(sharding)); + } + void set_sharding(std::shared_ptr sharding) { + sharding_ = std::move(sharding); + } + // Copies the sharding of another instruction, this is more efficient than + // set_sharding(hlo->sharding()) because it avoids a deep copy and shares the + // storage. Note that if the other instruction has no sharding set, it also + // clears the sharding of the current instruction. + void copy_sharding(const HloInstruction* hlo) { + set_sharding(hlo->sharding_ptr()); + } + void set_single_sharding(const HloSharding& sharding); + // Sets a sharding that assigns the current instruction to device. + void set_device_sharding(int64_t device) { + set_single_sharding(HloSharding::AssignDevice(device)); + } + // Remove any sharding from this operator. + void clear_sharding() { sharding_ = nullptr; } + // Return true if this operator has a sharding assigned. + bool has_sharding() const { return sharding_ != nullptr; } + // Checks whether the instruction has compatible sharding with the other + // instruction. + bool has_compatible_sharding(const HloInstruction* other) const { + if (!has_sharding()) { + return !other->has_sharding(); + } + return other->has_sharding() ? sharding() == other->sharding() : false; + } + + // When creating a new instruction which either replaces, or shifts up (kCopy + // insertion case), another instruction, we need to make sure the certain + // properties of the new instruction are copied into the derived one. As of + // today, the metadata and sharding will be propagated to the derived + // instruction. + void SetupDerivedInstruction(HloInstruction* derived_instruction) const; + + // Clones the HLO instruction. The clone will have the same opcode, shape, and + // operands. After creation the clone has no uses. "this" (the instruction + // cloned from) is not changed. Suffix is the string to append to the name of + // the instruction to form the name of the cloned instruction. + // Ignores the control predecessors and successors of this HLO instruction. + std::unique_ptr Clone( + const std::string& suffix = "clone", + HloCloneContext* context = nullptr) const; + + // Clones the HLO instruction as above but with new shape. + std::unique_ptr CloneWithNewShape( + const Shape& shape, const std::string& suffix = "clone", + HloCloneContext* context = nullptr) const; + + // Clones the HLO instruction as above but with new shape and operands. + std::unique_ptr CloneWithNewOperands( + const Shape& shape, absl::Span new_operands, + HloCloneContext* context = nullptr) const; + + // Returns the computations this instruction directly calls (if any). + const std::vector& called_computations() const { + return called_computations_; + } + + // Replaces all called computations based on a map function. This is needed + // when we clone hlo_computations and want to let the instructions to point + // to the newly cloned nodes. + void ReplaceCalledComputations( + absl::FunctionRef map_function) { + for (int64_t i = 0; i < called_computations_.size(); ++i) { + called_computations_[i] = map_function(called_computations_[i]); + } + } + + // Clears out the called computations. + // + // This is, in particular, necessary when inlining function bodies into their + // caller. If there were side-effecting operations in the called computations, + // the call itself is considered side-effecting and thus cannot be removed. By + // clearing out the computations, we reflect the fact that all side-effecting + // properties have been reflected in the caller, and make the call HLO + // removable. + virtual void ClearCalledComputations() { called_computations_.clear(); } + + // Returns true if this instruction performs an elementwise operation on + // `operand_idx`-th operand. An instruction is elementwise on an operand iff, + // to compute the output at index {i_0,i_1,...,i_n}, the only element required + // from the operand (if any) is the element at {i_0,i_1,...,i_n}. + // + // Note on performance: when this instruction is kFusion, this method, in the + // worst case, scans all fused instructions. We could speed this up by + // caching. + bool IsElementwiseOnOperand(int64_t operand_idx) const; + + // Returns true if this instruction is elementwise on all its operands. + bool IsElementwise() const; + + static bool IsOpElementwise(HloOpcode opcode); + + // Returns true if this is a cross module all-reduce instruction. + bool IsCrossModuleAllReduce() const; + + // Returns true if this is a cross-replica all-reduce instruction. + bool IsCrossReplicaAllReduce() const; + + // Returns true if this instruction is binary and elementwise. + bool IsElementwiseBinary() const; + + // Returns whether this instruction may reuse elements of its `i`th operand. + bool ReusesOperandElements(int64_t i) const; + + // Returns the indices that the given operand appear in the operand list of + // this instruction. Note that an instruction can use the same operand + // multiple times. + absl::InlinedVector OperandIndices( + const HloInstruction* operand) const; + + // Convenience helper for ShapeUtil::InsertedOrDeleted1SizedDimensions. If + // this reshape merely inserts or deletes 1-sized dimensions, return the input + // indices of the deleted dimensions and the output indices of the inserted + // dimensions. + // + // Precondition: this op must be a reshape. + std::optional + ReshapeMerelyInsertsOrDeletes1SizedDimensions() const; + + // Gets the string identifier for this instruction. + absl::string_view name() const { return name_; } + + // Sets the string identifier for this instruction. Name will be sanitized to + // match the regexp "[a-zA-Z_][a-zA-Z0-9_.-]*". + // + // See also HloModule::SetAndUniquifyInstrName(), which does this plus + // UniqufyName(). + void SetAndSanitizeName(absl::string_view name) { + name_ = NameUniquer::GetSanitizedName(name); + } + + // Use the given NameUniquer to select a unique name for the instruction based + // on the instruction's existing name. + // + // See also HloModule::SetAndUniquifyInstrName(), which does this plus + // SetAndSanitizeName(). + void UniquifyName(NameUniquer* name_uniquer); + + // Clear the unique ID of the instruction so that it can be re-assigned, such + // as for the purpose of compacting the instruction unique IDs. + void ClearUniqueIdInternal() { unique_id_ = -1; } + + // Set the unique id for this instruction to "id" + void SetUniqueId(int id) { + CHECK_EQ(unique_id_, -1); // Should not be assigned already + CHECK_GE(id, 0); + unique_id_ = id; + } + + // Return the unique ID assigned to this node via SetUniqueId (or -1 + // if no id has been assigned yet). + int unique_id() const { return unique_id_; } + + template + using EnableIfProto = typename std::enable_if_t< + std::is_base_of::value>; + + // Returns the backend-specific configuration for how a backend should compile + // this HLO. The meaning of the field is backend specific. Not for use before + // or during general HLO optimization, since HLO optimizations do not preserve + // this field and they cannot interpret it due to its meaning being backend + // specific. Except for CustomCall, where this field is preserved and no + // general HLO optimization needs to interpret it. + // + // ConfigProto should be a protobuf Message type. + template * = nullptr> + StatusOr backend_config() const { + ConfigProto proto; + TF_RETURN_IF_ERROR(GetBackendConfigInternal(&proto)); + return std::move(proto); + } + + Status set_backend_config(const tsl::protobuf::Message& proto) { + backend_config_ = proto; + return OkStatus(); + } + + bool preserve_layout() const { return metadata_.preserve_layout(); } + + bool has_backend_config() const { return !backend_config_.empty(); } + + void clear_backend_config() { backend_config_.clear(); } + + void CopyBackendConfigFrom(const HloInstruction* other) { + backend_config_ = other->backend_config_.Clone(); + } + + void set_frontend_attributes(FrontendAttributes frontend_attributes) { + frontend_attributes_ = std::move(frontend_attributes); + } + + void add_frontend_attributes(FrontendAttributes frontend_attributes) { + frontend_attributes_.mutable_map()->insert( + frontend_attributes.map().begin(), frontend_attributes.map().end()); + } + + const FrontendAttributes& frontend_attributes() const { + return frontend_attributes_; + } + + void add_single_statistic(Statistic statistic) { + *statistics_viz_.add_statistics() = std::move(statistic); + } + + void set_stat_index_to_visualize(int64_t index) { + statistics_viz_.set_stat_index_to_visualize(index); + } + + // Whether this specific instruction has statistics + bool has_statistics() const { return !statistics_viz_.statistics().empty(); } + + // Whether any instruction within the same HLO module as this has statistics + bool module_has_statistics() const { + return statistics_viz_.stat_index_to_visualize() == -1; + } + + const Statistic& statistic_to_visualize() const { + return statistics_viz_.statistics().at( + statistics_viz_.stat_index_to_visualize()); + } + + void set_statistics_viz(StatisticsViz statistics_viz) { + statistics_viz_ = std::move(statistics_viz); + } + + const StatisticsViz& statistics_viz() const { return statistics_viz_; } + + // Getter/setter for raw JSON-encoded backend config. Prefer the + // functions above that deal in proto Messages where possible. + const std::string& raw_backend_config_string() const { + return backend_config_.GetRawString(); + } + void set_raw_backend_config_string(std::string config_str) { + backend_config_ = std::move(config_str); + } + + bool is_default_config() const { return is_default_config_; } + void set_default_config() { is_default_config_ = true; } + + // Returns a string representation of a proto in the format used by + // raw_backend_config_string. + // + // This is morally equivalent to: + // + // HloInstruction instr; + // TF_RETURN_IF_ERROR(instr.set_backend_config(proto)); + // return instr.raw_backend_config_string(); + // + static StatusOr BackendConfigToRawString( + const tsl::protobuf::Message& proto); + + // Returns the information used to tell the implementation information about + // what sort of precision is requested. The meaning of the field is backend + // specific. At the moment, it is only supported for kConvolution and kDot. + // Transformations on one kDot or kConvolution to another will preserve this + // information. Transformations to other HLOs will not preserve this + // information but it is presumed that the alternate lowering is strictly + // superior. + // Precondition: opcode must be kConvolution or kDot. + const PrecisionConfig& precision_config() const; + PrecisionConfig* mutable_precision_config(); + + // Sets the debug metadata for this instruction, excluding creation_pass_id, + // which should never be copied anywhere. + void set_metadata(const OpMetadata& metadata) { + int64_t creation_pass_id = metadata_.creation_pass_id(); + metadata_ = metadata; + metadata_.set_creation_pass_id(creation_pass_id); + } + + void set_size_of_generated_code_in_bytes(int64_t code_size_in_bytes) { + metadata_.set_size_of_generated_code_in_bytes(code_size_in_bytes); + } + void set_size_of_memory_working_set_in_bytes( + int64_t working_set_size_in_bytes) { + metadata_.set_size_of_memory_working_set_in_bytes( + working_set_size_in_bytes); + } + void set_creation_pass_id(int64_t pass_id) { + metadata_.set_creation_pass_id(pass_id); + } + void set_metadata_op_name(const std::string& name) { + metadata_.set_op_name(name); + } + void set_logical_creation_pass_id(int64_t pass_id) { + metadata_.set_logical_creation_pass_id(pass_id); + } + void set_metadata_deduplicated_name(std::string deduplicated_name) { + metadata_.set_deduplicated_name(std::move(deduplicated_name)); + } + void set_metadata_preserve_layout(bool preserve_layout) { + metadata_.set_preserve_layout(preserve_layout); + } + const OpMetadata& metadata() const { return metadata_; } + + // Set/get the computation containing this instruction. set_parent should only + // be called by HloComputation methods which add/remove instructions to + // computations. + void set_parent(HloComputation* computation) { parent_ = computation; } + const HloComputation* parent() const { return parent_; } + HloComputation* parent() { return parent_; } + + // Returns the module for this instruction. + HloModule* GetModule() const; + + // A method that sorts users_, control_predecessors_, and control_successors_ + // according to the orders used in sorted_instruction. The sorting is used + // during cloning, to make clone behavior match uncloned behavior. + void SortInstructionUsersAndControlLists( + const MappedPtrContainerSorter::MapPtrFn& map_fn, + const HloInstruction& sorted_instruction); + + // Old methods kept for smooth subclassing transition BEGIN. + // NOTE: Refrain from adding more delegates, prefer down casting to subclasses + // rather than using these methods. + // TODO(b/80131774): Remove this code. + + // Delegates to HloBatchNormInstruction::feature_index. + int64_t feature_index() const; + + // Delegates to HloBatchNormInstruction::epsilon. + float epsilon() const; + + // Delegates to HloFftInstruction::fft_type. + FftType fft_type() const; + + // Delegates to HloFftInstruction::fft_length. + const std::vector& fft_length() const; + + // Delegates to HloChannelInstruction::channel_id. + std::optional channel_id() const; + void set_channel_id(const std::optional& channel_id); + + // Returns the dimension sizes or numbers associated with this instruction. + virtual absl::Span dimensions() const { + LOG(FATAL) << "Unimplemented method."; + } + + int64_t dimensions(int64_t index) const { return dimensions()[index]; } + + virtual std::vector* mutable_dimensions() { + LOG(FATAL) << "Unimplemented method."; + } + + // Delegates to HloConcatenateInstruction::concatenate_dimension. + virtual int64_t concatenate_dimension() const; + + // Delegates to HloGetDimensionSizeInstruction::dimension. + int64_t dimension() const; + + // Delegates to HloReshapeInstruction::inferred_dimension. + int64_t inferred_dimension() const; + + // Returns whether this instruction does a rank-2 transposition. + bool IsRank2Transpose() const; + + // Delegates to HloSliceInstruction::slice_start. + int64_t slice_starts(int64_t dimension) const; + const std::vector& slice_starts() const; + std::vector* mutable_slice_starts(); + + // Delegates to HloSliceInstruction::slice_limits. + int64_t slice_limits(int64_t dimension) const; + const std::vector& slice_limits() const; + std::vector* mutable_slice_limits(); + + // Delegates to HloSliceInstruction::slice_strides. + int64_t slice_strides(int64_t dimension) const; + const std::vector& slice_strides() const; + std::vector* mutable_slice_strides(); + + // Returns the literal associated with this instruction. + const Literal& literal() const; + + // Returns whether the instruction is a constant. + bool IsConstant() const; + + // Delegate to HloConstantInstruction::RelayoutConstant. + void RelayoutConstant(const Layout& new_layout, + const ShapeIndex& shape_index = {}); + + // Delegates to + // HloCallableInstruction::AppendInstructionIntoCalledComputation. + HloInstruction* AppendInstructionIntoCalledComputation( + HloInstruction* instruction_to_append, bool add_output = false); + + // Delegates to HloFusionInstruction::AddFusionOperand. + HloInstruction* AddFusionOperand(HloInstruction* new_operand); + + // Delegates to HloFusionInstruction::MergeFusionInstruction. + void MergeFusionInstruction(HloInstruction* instruction_to_merge); + + // Delegates to HloFusionInstruction::MergeFusionInstructionIntoMultiOutput. + void MergeFusionInstructionIntoMultiOutput( + HloInstruction* instruction_to_merge); + + // Delegates to HloFusionInstruction::FuseInstruction. + HloInstruction* FuseInstruction(HloInstruction* instruction_to_fuse); + + // Delegates to HloFusionInstruction::FuseInstructionIntoMultiOutput. + HloInstruction* FuseInstructionIntoMultiOutput( + HloInstruction* instruction_to_fuse); + + // Delegates to HloFusionInstruction::fused_instruction. + HloComputation* fused_instructions_computation() const; + + // Delegates to HloFusionInstruction::fused_expression_root. + HloInstruction* fused_expression_root() const; + + // Delegates to HloFusionInstruction::fused_instructions. + tsl::gtl::iterator_range>::const_iterator>> + fused_instructions() const; + + tsl::gtl::iterator_range< + UnwrappingIterator>::iterator>> + fused_instructions(); + + // Delegates to HloFusionInstruction::fused_instruction_count. + int64_t fused_instruction_count() const; + + // Delegates to HloFusionInstruction::fused_parameter. + HloInstruction* fused_parameter(int64_t parameter_number) const; + + // Delegates to HloFusionInstruction::fused_parameters. + const InstructionVector& fused_parameters() const; + + // Returns true if this instruction is a fusion instruction that generates + // multiple outputs. + bool IsMultiOutputFusion() const; + + // Delegates to HloFusionInstruction::fusion_kind. + FusionKind fusion_kind() const; + + // Delegates to HloFusionInstruction::set_fusion_kind. + void set_fusion_kind(FusionKind kind); + + // Delegates to HloRngInstruction::random_distribution. + RandomDistribution random_distribution() const; + + // Delegates to HloParameterInstruction::parameter_number. + int64_t parameter_number() const; + + // Delegates to + // HloParameterInstruction::set_parameter_replicated_at_leaf_buffers. + void set_parameter_replicated_at_leaf_buffers( + absl::Span parameter_replicated_at_leaf_buffers); + void set_parameter_replicated_at_leaf_buffers( + const std::vector& parameter_replicated_at_leaf_buffers); + + // Delegates to HloParameterInstruction::parameter_replicated_at_leaf_buffers. + const std::optional>& parameter_replicated_at_leaf_buffers() + const; + + // Delegates to HloGetTupleElementInstruction::tuple_index. + int64_t tuple_index() const; + + // Delegates to HloGetTupleElementInstruction::set_tuple_index. + void set_tuple_index(int64_t new_tuple_index); + + // Delegates to HloReducePrecisionInstruction::exponent_bits. + int32_t exponent_bits() const; + + // Delegates to HloReducePrecisionInstruction::mantissa_bits. + int32_t mantissa_bits() const; + + // Delegates to HloInfeedInstruction::infeed_config. + std::string infeed_config() const; + + // Delegates to HloInfeedInstruction::set_infeed_config. + void set_infeed_config(const std::string& config); + + // Returns the config for the Outfeed instruction. + const std::string& outfeed_config() const; + + // Delegates to HloOutfeedInstruction::set_outfeed_config. + void set_outfeed_config(const std::string& config); + + // Returns the shape for the Outfeed instruction. + const Shape& outfeed_shape() const; + + // Returns the mutable shape for the Outfeed instruction. + Shape* mutable_outfeed_shape(); + + // Delegates to HloCollectiveInstruction::replica_groups. + const std::vector& replica_groups() const; + + // Delegates to HloCollectivePermuteInstruction::source_target_pairs. + const std::vector>& source_target_pairs() const; + + // Returns data on the window in a windowed operation such as + // convolution. + virtual const Window& window() const { + LOG(FATAL) << "Unimplemented method."; + } + + // Sets the window data in a windowed operation such as convolution. + virtual void set_window(const Window& window) { + LOG(FATAL) << "Unimplemented method."; + } + + // Returns the unique_indices field. + virtual bool unique_indices() const { LOG(FATAL) << "Unimplemented method."; } + + // Returns data on the dimension numbers used for a convolution operation, + // which may be a kConvolution instruction or a kCustomCall that implements a + // convolution. + const ConvolutionDimensionNumbers& convolution_dimension_numbers() const; + + // Sets the convolution dimension numbers on this instruction. In general you + // shouldn't need to call this; instead, specify the convolution dimension + // numbers when you create the instruction. + void set_convolution_dimension_numbers( + const ConvolutionDimensionNumbers& dnums); + + // The number of feature groups. Must be a divisor of the input feature + // dimension and output feature dimension. + int64_t feature_group_count() const; + + void set_feature_group_count(int64_t feature_group_count); + + // The number of batch groups. Must be a divisor of the input batch dimension + int64_t batch_group_count() const; + + void set_batch_group_count(int64_t batch_group_count); + + // Delegates to HloSelectAndScatterInstruction::select. + HloComputation* select() const; + + // Delegates to HloSelectAndScatterInstruction::scatter. + HloComputation* scatter() const; + + // Delegates to HloSelectAndScatterInstruction::set_select. + void set_select(HloComputation* computation); + + // Delegates to HloSelectAndScatterInstruction::set_scatter. + void set_scatter(HloComputation* computation); + + // Delegates to HloCustomCallInstruction::custom_call_target. + const std::string& custom_call_target() const; + void set_custom_call_target(absl::string_view target); + + // Delegates to HloPadInstruction::padding_config. + const PaddingConfig& padding_config() const; + PaddingConfig* mutable_padding_config(); + + // Delegates to HloConvolutionInstruction::padding_type. + PaddingType padding_type() const; + + // Delegates to HloDynamicSliceInstruction::slice_sizes. + int64_t slice_sizes(int64_t dimension) const; + + // Delegates to HloDynamicSliceInstruction::dynamic_slice_sizes. + const std::vector& dynamic_slice_sizes() const; + + // Delegates to HloCollectivePermuteInstruction::dynamic_slice_sizes. + const std::vector>& dynamic_slice_sizes_list() const; + + // Delegates to HloGatherInstruction::gather_dimension_numbers. + const GatherDimensionNumbers& gather_dimension_numbers() const; + // Delegates to HloGatherInstruction::gather_slice_sizes. + absl::Span gather_slice_sizes() const; + + // Delegates to HloScatterInstruction::scatter_dimension_numbers(). + const ScatterDimensionNumbers& scatter_dimension_numbers() const; + + // Delegates to HloDotInstruction::dot_dimension_numbers(). + const DotDimensionNumbers& dot_dimension_numbers() const; + + // Delegates to HloDomainInstruction::operand_side_metadata(). + const DomainMetadata& operand_side_metadata() const; + + // Delegates to HloDomainInstruction::user_side_metadata(). + const DomainMetadata& user_side_metadata() const; + + // Returns true if the instruction is an async-start, async-update, or + // async-done. + bool IsAsynchronous() const; + + // Returns the computation that will executed asynchronously. + HloComputation* async_wrapped_computation() const; + + // Delagates to HloAsyncInstruction::async_wrapped_instruction(). + HloInstruction* async_wrapped_instruction() const; + + // Delagates to HloAsyncInstruction::async_wrapped_opcode(). + HloOpcode async_wrapped_opcode() const; + + // Delegates to HloAsyncInstruction::async_group_id(). + std::optional async_group_id() const; + + // Delegates to HloAsyncInstruction::set_async_group_id(). + void set_async_group_id(std::optional async_group_id); + + // Delegates to HloAsyncInstruction::async_execution_thread(). + absl::string_view async_execution_thread() const; + + // Delegates to HloAsyncInstruction::set_async_execution_thread(). + void set_async_execution_thread(absl::string_view async_execution_thread); + + // Delegates to + // HloCallableInstruction::RecursivelySetComputationsThreadName(). + void set_called_computations_execution_thread( + absl::string_view async_execution_thread, + bool skip_async_execution_thread_overwrite); + + // Delegates to HloCopyStartInstruction::is_cross_program_prefetch_index(). + std::optional cross_program_prefetch_index() const; + + // Delegates to HloCompareInstruction::direction(). + ComparisonDirection comparison_direction() const; + // Delegates to HloCompareInstruction::order(). + ComparisonOrder comparison_order() const; + + // Delegates to HloTriangularSolveInstruction::triangular_solve_options(). + const TriangularSolveOptions& triangular_solve_options() const; + + // Delegates to HloCholeskyInstruction::cholesky_options(). + const CholeskyOptions& cholesky_options() const; + + // Delegates to HloCallableInstruction::output_to_operand_aliasing(). + const std::vector>>& + output_operand_aliasing() const; + + // Appends operand to the list of operands and adds this instruction as a user + // of the operand. + void AppendOperand(HloInstruction* operand); + + // Old methods kept for smooth subclassing transition END. + + HloInstruction(const HloInstruction&) = delete; + HloInstruction& operator=(const HloInstruction&) = delete; + + protected: + // Internal constructor for a given opcode/shape, other fields must be filled + // by factory methods. + HloInstruction(HloOpcode opcode, const Shape& shape); + + void RemoveAllOperands() { operands_.clear(); } + + void RemoveOperandAt(int index) { + operands_.erase(operands_.begin() + index); + } + + // Removes a list of operands with the given indices in ascending order. + void RemoveOperandsAtAscendingIndices( + absl::Span ascending_indices); + + void AppendComputation(HloComputation* computation) { + called_computations_.push_back(computation); + } + + void DetachFrom(HloInstruction* usee) { usee->RemoveUser(this); } + + void set_called_computation(int index, HloComputation* computation) { + called_computations_[index] = computation; + } + // Indices of computations in called_computations_ for instructions which call + // multiple computations. + enum { + // kWhile computations. + kBodyComputationIndex = 0, + kConditionComputationIndex = 1, + + // kSelectAndScatter computations. + kSelectComputationIndex = 0, + kScatterComputationIndex = 1, + + // kConditional computations. + kTrueComputationIndex = 0, + kFalseComputationIndex = 1, + }; + + private: + friend class HloComputation; + // Wrapper class of string format and protobuf format of BackendConfig. + class BackendConfigRep { + public: + const tsl::protobuf::Message* GetProtoPtr() const { return proto_.get(); } + + const std::string& GetRawString() const; + + BackendConfigRep Clone() const; + + bool operator==(const BackendConfigRep& other) const; + bool operator!=(const BackendConfigRep& other) const { + return !(*this == other); + } + + bool empty() const { return proto_ == nullptr && raw_string_.empty(); } + + void clear() { + proto_.reset(); + raw_string_.clear(); + } + + BackendConfigRep& operator=(std::string raw_string); + BackendConfigRep& operator=(const tsl::protobuf::Message& proto); + void SetProto(const tsl::protobuf::Message& proto); + + private: + std::unique_ptr proto_; + // If proto_ is not null, raw_string_ is a lazy cache of its string format. + mutable std::string raw_string_; + }; + + bool IdenticalInternal( + const HloInstruction& other, + absl::FunctionRef + eq_operands, + absl::FunctionRef + eq_computations, + bool layout_sensitive, bool sharding_sensitive, + bool ignore_channel_id_values, + bool ignore_commutative_operand_order) const; + + // Implementation for non-common logic of CloneWithNewOperands. + virtual std::unique_ptr CloneWithNewOperandsImpl( + const Shape& shape, absl::Span new_operands, + HloCloneContext* context) const { + // TODO(b/80131774): This should be pure virtual. + LOG(FATAL) << "Unimplemented method."; + } + + // Implementation for non-common logic of PrintExtraAttributes. + virtual void PrintExtraAttributesImpl(AttributePrinter& printer, + const HloPrintOptions& options) const {} + + // Implementation for IsElementwise if operand_idx is nullopt and for + // IsElementwiseOnOperand if otherwise. + // + // NOTE: For all instructions other than kFusion, being elementwise on one of + // the operands is equivalent to being elementwise on all the operands. + virtual bool IsElementwiseImpl( + const std::optional& operand_idx) const; + + // Prints an operand to a string. Accessed by friend class HloInstruction. + virtual void PrintOperandsWithCanonicalNameMap( + Printer* printer, const HloPrintOptions& options, + CanonicalNameMap* canonical_name_map) const; + + // See comments on Identical(). + virtual bool IdenticalSlowPath( + const HloInstruction& other, + absl::FunctionRef + eq_computations) const; + + // Creates an n-ary elementwise operation. + static std::unique_ptr CreateNary( + const Shape& shape, HloOpcode opcode, + absl::Span operands); + + // Adds a user for this instruction. + void AddUser(HloInstruction* user); + + // Removes a user for this instruction. + void RemoveUser(HloInstruction* user); + + // Helper for implementing backend_config(). Parses backend_config_ into the + // given proto. + Status GetBackendConfigInternal(tsl::protobuf::Message* proto) const; + + // Mark this instruction as dead. Accessed by friend class HloInstruction. + void MarkAsDead() { marked_as_dead_ = true; } + + // Has this instruction been marked as dead? Accessed by friend class + // HloInstruction. + bool IsMarkedAsDead() const { return marked_as_dead_; } + + int unique_id_; // Unique to this HloInstruction within a HloModule + + // Opcode for this instruction. + HloOpcode opcode_; + + // Instruction operands. + InstructionVector operands_; + + // The set of control predecessors of this instruction. + // Note that the order of the instructions in the vector influences the order + // computed in HloComputation::ComputeInstructionPostOrder, which may + // influence the result of the compilation by changing the scheduling. We are + // not sure if it matters. + std::vector control_predecessors_; + + // The users of this instruction. Users are HLOs where this instruction is an + // operand. The vector users_ and the map user_map_ contain identical members. + // The map enables fast membership testing and the vector enables fast, stable + // iteration. The value in the map contains the index of the instruction in + // the vector what enables fast removal. + std::vector users_; + absl::flat_hash_map user_map_; + + // The set of control successors of this instruction. + std::vector control_successors_; + + // The computation in which this instruction is contained. + HloComputation* parent_ = nullptr; + + // Result shape of this instruction. + Shape shape_; + + // The sharding, if one exists. + // Uses std::shared_ptr to allow reuse of the same sharding object between + // HloInstructions and other components as HloSharding can be very large for + // many element tuples. + std::shared_ptr sharding_; + + // Computations called by this instruction. + std::vector called_computations_; + + // The backend-specific configuration for how a backend should compile this + // HLO. See the documentation on backend_config(). + mutable BackendConfigRep backend_config_; + + // Attributes passed from the frontend to give hints to the backend about + // how to compile this HLO. + // HLO -> HLO transforms are expected to preserve these attributes on a + // "best effort" basis only. + // For example: + // x = const(10, frontend_attributes={x} + // y = const(10, frontend_attributes={y} + // z = add(x,y), frontend_attributes={y} + // Could be simplified to: + // z' = const(20), frontend_attributes={?} + FrontendAttributes frontend_attributes_; + + // Used to render an HLO graph when tracking the propagation desired values + // through it. + StatisticsViz statistics_viz_; + + // String identifier for instruction. + std::string name_; + + // Metadata for debugging. + OpMetadata metadata_; + + // This field is assigned to true when backend_config_ is assigned to + // a default configuration. + bool is_default_config_ = false; + + // True if this instruction has already been detached from its user and + // operands. + bool cleaned_up_ = false; + + // Intrusive flag used by HloComputation, whether this instruction has + // been marked as dead. + bool marked_as_dead_; +}; + +// Explicit instantiations in hlo_instruction.cc. +extern template Status HloInstruction::Accept(DfsHloVisitor*, bool, bool, bool); +extern template Status HloInstruction::Accept(ConstDfsHloVisitor*, bool, bool, + bool); +extern template Status HloInstruction::Visit(DfsHloVisitor* visitor); +extern template Status HloInstruction::Visit(ConstDfsHloVisitor* visitor); + +absl::string_view ToString(HloInstruction::FusionKind kind); +StatusOr StringToFusionKind( + absl::string_view kind_name); + +// Custom (de)stringification functions for protos that live inside +// HloInstruction. +std::string PaddingConfigToString(const PaddingConfig& padding); +std::string StatisticsVizToString(const StatisticsViz& statistics_viz); +std::string RandomAlgorithmToString(const RandomAlgorithm& algorithm); +std::string RandomDistributionToString(const RandomDistribution& distribution); +std::string PrecisionToString(const PrecisionConfig::Precision& precision); +std::string DotDimensionNumbersToString(const DotDimensionNumbers& dnums); +std::string ConvolutionDimensionNumbersToString( + const ConvolutionDimensionNumbers& dnums); +std::string ReplicaGroupsToString( + absl::Span replica_groups); + +StatusOr StringToRandomAlgorithm(const std::string& name); +StatusOr StringToRandomDistribution( + const std::string& name); +StatusOr StringToPrecision(const std::string& name); +StatusOr StringToCustomCallSchedule(absl::string_view name); +StatusOr StringToCustomCallApiVersion( + absl::string_view name); + +std::ostream& operator<<(std::ostream& os, HloInstruction::FusionKind kind); + +// Map classes that guarantee a deterministic iteration order when the key is +// an HloInstruction* or a const HloInstruction*. +// To make the iteration order over the map deterministic, the comparator +// should not be using the pointer values, but rather an intrinsic property of +// the hlo. Exception: null pointer values compare less than non-null. +struct HloPtrComparator { + bool operator()(const HloInstruction* const& lhs, + const HloInstruction* const& rhs) const; +}; + +template +using HloInstructionMap = std::map; + +template +using ConstHloInstructionMap = + std::map; + +using HloInstructionSet = std::set; +using ConstHloInstructionSet = + std::set; + +template +bool HloPredicateIsOp(const HloInstruction* instruction) { + if (instruction->opcode() == op) { + return true; + } + if constexpr (sizeof...(rest) == 0) { + return false; + } else { + return HloPredicateIsOp(instruction); + } +} + +} // namespace xla + +#endif // XLA_HLO_IR_HLO_INSTRUCTION_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/hlo_instructions.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/hlo_instructions.h new file mode 100644 index 0000000000000000000000000000000000000000..b9c9889ee59b2d3f631b3337be397a6a06d7bccd --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/hlo_instructions.h @@ -0,0 +1,2520 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +// All HloInstruction subclasses are put in this file. + +#ifndef XLA_HLO_IR_HLO_INSTRUCTIONS_H_ +#define XLA_HLO_IR_HLO_INSTRUCTIONS_H_ + +#include +#include +#include +#include +#include +#include +#include + +#include "absl/container/inlined_vector.h" +#include "absl/functional/function_ref.h" +#include "absl/strings/string_view.h" +#include "absl/types/span.h" +#include "xla/comparison_util.h" +#include "xla/hlo/ir/hlo_clone_context.h" +#include "xla/hlo/ir/hlo_computation.h" +#include "xla/hlo/ir/hlo_domain_metadata.h" +#include "xla/hlo/ir/hlo_instruction.h" +#include "xla/hlo/ir/hlo_opcode.h" +#include "xla/iterator_util.h" +#include "xla/layout.h" +#include "xla/literal.h" +#include "xla/printer.h" +#include "xla/service/hlo.pb.h" +#include "xla/shape.h" +#include "xla/shape_util.h" +#include "xla/status.h" +#include "xla/xla_data.pb.h" +#include "tsl/lib/gtl/iterator_range.h" +#include "tsl/platform/logging.h" // IWYU pragma: keep +#include "tsl/platform/status.h" + +namespace xla { + +// Base class for instructions with a dimensions vector. +class HloDimensionsInstruction : public HloInstruction { + public: + absl::Span dimensions() const override { return dimensions_; } + + std::vector* mutable_dimensions() override { return &dimensions_; } + + HloInstructionProto ToProto() const override; + + static bool ClassOf(const HloInstruction* hlo) { + switch (hlo->opcode()) { + case HloOpcode::kBroadcast: + case HloOpcode::kConcatenate: + case HloOpcode::kReduce: + case HloOpcode::kReverse: + case HloOpcode::kSort: + case HloOpcode::kTopK: + case HloOpcode::kTranspose: + return true; + default: + return false; + } + } + + protected: + HloDimensionsInstruction(HloOpcode opcode, const Shape& shape, + absl::Span dimensions) + : HloInstruction(opcode, shape), + dimensions_(dimensions.begin(), dimensions.end()) {} + void PrintExtraAttributesImpl(AttributePrinter& printer, + const HloPrintOptions& options) const override; + + bool IdenticalSlowPath( + const HloInstruction& other, + absl::FunctionRef + eq_computations) const override; + + std::vector dimensions_; +}; + +class HloBatchNormInstruction : public HloInstruction { + public: + // Returns feature_index field associated with the instruction. The index + // represents the index of the feature dimension. + int64_t feature_index() const { return feature_index_; } + + // Returns a epsilon value associated with the instruction. The is a small + // number added to the variance to avoid divide-by-zero error. + float epsilon() const { return epsilon_; } + + // Returns a serialized representation of this instruction. + HloInstructionProto ToProto() const override; + + static bool ClassOf(const HloInstruction* hlo) { + switch (hlo->opcode()) { + case HloOpcode::kBatchNormGrad: + case HloOpcode::kBatchNormInference: + case HloOpcode::kBatchNormTraining: + return true; + default: + return false; + } + } + + protected: + explicit HloBatchNormInstruction(HloOpcode opcode, const Shape& shape, + HloInstruction* operand, + HloInstruction* scale, float epsilon, + int64_t feature_index); + + private: + void PrintExtraAttributesImpl(AttributePrinter& printer, + const HloPrintOptions& options) const override; + bool IdenticalSlowPath( + const HloInstruction& other, + absl::FunctionRef + eq_computations) const override; + // A small float number added to the variance to avoid divide-by-zero error. + float epsilon_ = 0.0f; + + // An integer value representing the index of the feature dimension. + int64_t feature_index_ = -1; +}; + +class HloBatchNormTrainingInstruction : public HloBatchNormInstruction { + public: + explicit HloBatchNormTrainingInstruction( + const Shape& shape, HloInstruction* operand, HloInstruction* scale, + HloInstruction* offset, float epsilon, int64_t feature_index); + + static bool ClassOf(const HloInstruction* hlo) { + return hlo->opcode() == HloOpcode::kBatchNormTraining; + } + + private: + // Implementation for non-common logic of CloneWithNewOperands. + std::unique_ptr CloneWithNewOperandsImpl( + const Shape& shape, absl::Span new_operands, + HloCloneContext* context) const override; +}; + +class HloBatchNormInferenceInstruction : public HloBatchNormInstruction { + public: + explicit HloBatchNormInferenceInstruction( + const Shape& shape, HloInstruction* operand, HloInstruction* scale, + HloInstruction* offset, HloInstruction* mean, HloInstruction* variance, + float epsilon, int64_t feature_index); + + static bool ClassOf(const HloInstruction* hlo) { + return hlo->opcode() == HloOpcode::kBatchNormInference; + } + + private: + // Implementation for non-common logic of CloneWithNewOperands. + std::unique_ptr CloneWithNewOperandsImpl( + const Shape& shape, absl::Span new_operands, + HloCloneContext* context) const override; +}; + +class HloBatchNormGradInstruction : public HloBatchNormInstruction { + public: + explicit HloBatchNormGradInstruction( + const Shape& shape, HloInstruction* operand, HloInstruction* scale, + HloInstruction* mean, HloInstruction* variance, + HloInstruction* grad_output, float epsilon, int64_t feature_index); + + static bool ClassOf(const HloInstruction* hlo) { + return hlo->opcode() == HloOpcode::kBatchNormGrad; + } + + private: + // Implementation for non-common logic of CloneWithNewOperands. + std::unique_ptr CloneWithNewOperandsImpl( + const Shape& shape, absl::Span new_operands, + HloCloneContext* context) const override; +}; + +class HloFftInstruction : public HloInstruction { + public: + explicit HloFftInstruction(const Shape& shape, HloInstruction* operand, + FftType fft_type, + absl::Span fft_length); + FftType fft_type() const { return fft_type_; } + + const std::vector& fft_length() const { return fft_length_; } + + // Returns a serialized representation of this instruction. + HloInstructionProto ToProto() const override; + + static bool ClassOf(const HloInstruction* hlo) { + return hlo->opcode() == HloOpcode::kFft; + } + + private: + void PrintExtraAttributesImpl(AttributePrinter& printer, + const HloPrintOptions& options) const override; + bool IdenticalSlowPath( + const HloInstruction& other, + absl::FunctionRef + eq_computations) const override; + + // Implementation for non-common logic of CloneWithNewOperands. + std::unique_ptr CloneWithNewOperandsImpl( + const Shape& shape, absl::Span new_operands, + HloCloneContext* context) const override; + + // Describes FFT type for an FFT instruction. + FftType fft_type_ = FftType::FFT; + + // Indicates the FFT length for an FFT instruction. + std::vector fft_length_; +}; + +class HloAsyncInstruction : public HloInstruction { + public: + HloAsyncInstruction( + HloOpcode opcode, const Shape& shape, + absl::Span operands, + HloComputation* async_computation, + std::optional async_group_id = std::nullopt, + absl::string_view async_execution_thread = kMainExecutionThread); + HloAsyncInstruction( + HloOpcode opcode, const Shape& shape, HloInstruction* operand, + HloComputation* async_computation, + std::optional async_group_id = std::nullopt, + absl::string_view async_execution_thread = kMainExecutionThread); + + ~HloAsyncInstruction() override; + // When an async instruction is being destructed, remove it from the vector of + // pointers of its called computation, to avoid referencing freed memory. + void ClearAsyncComputationInstruction(); + + HloInstruction* async_wrapped_instruction() const; + HloOpcode async_wrapped_opcode() const; + + // Async group id is a unique id given to a group of async operations that + // consist of one async start, one async done, and zero or more async update + // operations. The async group participates in a single async operation. The + // async operation canonicalizer pass assigns async group ids. + std::optional async_group_id() const { return async_group_id_; } + + // Async thread name is a unique thread name for one or more async groups. + // Typically one HLO module contains a main thread as well as one or more + // parallel threads. + absl::string_view async_execution_thread() const { + return async_execution_thread_; + } + void set_async_group_id(std::optional async_group_id); + void set_async_execution_thread(absl::string_view async_execution_thread); + HloInstructionProto ToProto() const override; + + static bool ClassOf(const HloInstruction* hlo) { + switch (hlo->opcode()) { + case HloOpcode::kAsyncStart: + case HloOpcode::kAsyncUpdate: + case HloOpcode::kAsyncDone: + return true; + default: + return false; + } + } + + private: + void PrintExtraAttributesImpl(AttributePrinter& printer, + const HloPrintOptions& options) const override; + bool IdenticalSlowPath( + const HloInstruction& other, + absl::FunctionRef + eq_computations) const override; + std::unique_ptr CloneWithNewOperandsImpl( + const Shape& shape, absl::Span new_operands, + HloCloneContext* context) const override; + std::optional async_group_id_; + std::string async_execution_thread_ = kMainExecutionThread; +}; + +class HloCopyStartInstruction : public HloInstruction { + public: + explicit HloCopyStartInstruction( + const Shape& shape, HloInstruction* operand, + std::optional cross_program_prefetch_index); + + std::optional cross_program_prefetch_index() const { + return cross_program_prefetch_index_; + } + HloInstructionProto ToProto() const override; + + static bool ClassOf(const HloInstruction* hlo) { + return hlo->opcode() == HloOpcode::kCopyStart; + } + + private: + void PrintExtraAttributesImpl(AttributePrinter& printer, + const HloPrintOptions& options) const override; + bool IdenticalSlowPath( + const HloInstruction& other, + absl::FunctionRef + eq_computations) const override; + std::unique_ptr CloneWithNewOperandsImpl( + const Shape& shape, absl::Span new_operands, + HloCloneContext* context) const override; + + // Each cross program prefetched buffer has a unique index. The indices are + // assigned contiguously starting from zero in + // AlternateMemoryBestFitHeap::AllocateCrossProgramPrefetchBuffer. This value + // is used during codegen to determine which buffer is being speculated at + // runtime. One possible implementation is to initialize an array with boolean + // values indicating whether the cross program prefetch succeeds or fails for + // each buffer. + std::optional cross_program_prefetch_index_; +}; + +class HloCompareInstruction : public HloInstruction { + public: + explicit HloCompareInstruction(const Shape& shape, HloInstruction* lhs, + HloInstruction* rhs, + ComparisonDirection direction, + std::optional type); + ComparisonDirection direction() const { return compare_.GetDirection(); } + ComparisonOrder order() const { return compare_.GetOrder(); } + Comparison::Type type() const { return compare_.GetType(); } + HloInstructionProto ToProto() const override; + + static bool ClassOf(const HloInstruction* hlo) { + return hlo->opcode() == HloOpcode::kCompare; + } + + private: + void PrintExtraAttributesImpl(AttributePrinter& printer, + const HloPrintOptions& options) const override; + bool IdenticalSlowPath( + const HloInstruction& other, + absl::FunctionRef + eq_computations) const override; + std::unique_ptr CloneWithNewOperandsImpl( + const Shape& shape, absl::Span new_operands, + HloCloneContext* context) const override; + + Comparison compare_; +}; + +class HloTriangularSolveInstruction : public HloInstruction { + public: + explicit HloTriangularSolveInstruction(const Shape& shape, HloInstruction* a, + HloInstruction* b, + const TriangularSolveOptions& options); + const TriangularSolveOptions& triangular_solve_options() const { + return triangular_solve_options_; + } + + // Returns a serialized representation of this instruction. + HloInstructionProto ToProto() const override; + + static bool ClassOf(const HloInstruction* hlo) { + return hlo->opcode() == HloOpcode::kTriangularSolve; + } + + private: + void PrintExtraAttributesImpl(AttributePrinter& printer, + const HloPrintOptions& options) const override; + bool IdenticalSlowPath( + const HloInstruction& other, + absl::FunctionRef + eq_computations) const override; + + // Implementation for non-common logic of CloneWithNewOperands. + std::unique_ptr CloneWithNewOperandsImpl( + const Shape& shape, absl::Span new_operands, + HloCloneContext* context) const override; + + TriangularSolveOptions triangular_solve_options_; +}; + +class HloCholeskyInstruction : public HloInstruction { + public: + explicit HloCholeskyInstruction(const Shape& shape, HloInstruction* a, + const CholeskyOptions& options); + const CholeskyOptions& cholesky_options() const { return cholesky_options_; } + + // Returns a serialized representation of this instruction. + HloInstructionProto ToProto() const override; + + static bool ClassOf(const HloInstruction* hlo) { + return hlo->opcode() == HloOpcode::kCholesky; + } + + private: + void PrintExtraAttributesImpl(AttributePrinter& printer, + const HloPrintOptions& options) const override; + bool IdenticalSlowPath( + const HloInstruction& other, + absl::FunctionRef + eq_computations) const override; + + // Implementation for non-common logic of CloneWithNewOperands. + std::unique_ptr CloneWithNewOperandsImpl( + const Shape& shape, absl::Span new_operands, + HloCloneContext* context) const override; + + CholeskyOptions cholesky_options_; +}; + +// Class that represents instructions that synchronize and transfer data between +// partitioned devices. Send/Recv and collective instructions (AllReduce, +// AllToAll, CollectivePermute) belong to this instruction type. A group of +// instructions (of the same opcode) with the same channel_id communicate during +// execution. +class HloChannelInstruction : public HloInstruction { + public: + // Returns the channel id associated with the instruction. The id is + // shared between each Send/Recv pair or a group of collective instructions + // and is globally unique to identify each channel. + std::optional channel_id() const { return channel_id_; } + void set_channel_id(const std::optional& channel_id); + + // Whether this instruction is identical to `other` except for the values of + // channel IDs, as long as both have channel IDs or neither has a channel ID. + virtual bool IdenticalSlowPathIgnoringChannelIdValues( + const HloInstruction& other, + absl::FunctionRef + eq_computations) const { + return channel_id_.has_value() == other.channel_id().has_value(); + } + + static bool ClassOf(const HloInstruction* hlo); + + protected: + explicit HloChannelInstruction(HloOpcode opcode, const Shape& shape, + const std::optional& channel_id); + + HloInstructionProto ToProto() const override; + + void PrintExtraAttributesImpl(AttributePrinter& printer, + const HloPrintOptions& options) const override; + + // Do not override IdenticalSlowPath(). Override + // IdenticalSlowPathIgnoringChannelIdValues() instead. + bool IdenticalSlowPath( + const HloInstruction& other, + absl::FunctionRef + eq_computations) const final; + + std::optional channel_id_; +}; + +// Class that represents a top-k instruction. +class HloTopKInstruction : public HloInstruction { + public: + HloTopKInstruction(const Shape& shape, HloInstruction* input, int64_t k, + HloComputation* compare); + + HloInstructionProto ToProto() const override; + + static bool ClassOf(const HloInstruction* hlo) { + return hlo->opcode() == HloOpcode::kTopK; + } + + // Returns how many K-s does it need. + int64_t k() const { return k_; } + + void PrintExtraAttributesImpl(AttributePrinter& printer, + const HloPrintOptions& options) const override; + + private: + bool IdenticalSlowPath( + const HloInstruction& other, + absl::FunctionRef + eq_computations) const override; + std::unique_ptr CloneWithNewOperandsImpl( + const Shape& shape, absl::Span new_operands, + HloCloneContext* context) const override; + + int64_t k_; +}; + +class HloSendRecvInstruction : public HloChannelInstruction { + public: + // Returns whether this send/recv instruction sends data to/from the host. + bool is_host_transfer() const { return is_host_transfer_; } + + // Returns a serialized representation of this instruction. + HloInstructionProto ToProto() const override; + + static bool ClassOf(const HloInstruction* hlo) { + switch (hlo->opcode()) { + case HloOpcode::kSend: + case HloOpcode::kSendDone: + case HloOpcode::kRecv: + case HloOpcode::kRecvDone: + return true; + default: + return false; + } + } + + protected: + explicit HloSendRecvInstruction(HloOpcode opcode, const Shape& shape, + int64_t channel_id, bool is_host_transfer); + + private: + void PrintExtraAttributesImpl(AttributePrinter& printer, + const HloPrintOptions& options) const override; + bool IdenticalSlowPathIgnoringChannelIdValues( + const HloInstruction& other, + absl::FunctionRef + eq_computations) const override; + // Whether this send/recv instruction sends data to/from the host. + bool is_host_transfer_; +}; + +class HloSendInstruction : public HloSendRecvInstruction { + public: + explicit HloSendInstruction(HloInstruction* operand, HloInstruction* token, + int64_t channel_id, bool is_host_transfer); + + static bool ClassOf(const HloInstruction* hlo) { + return hlo->opcode() == HloOpcode::kSend; + } + + private: + // Implementation for non-common logic of CloneWithNewOperands. + std::unique_ptr CloneWithNewOperandsImpl( + const Shape& shape, absl::Span new_operands, + HloCloneContext* context) const override; +}; + +class HloSendDoneInstruction : public HloSendRecvInstruction { + public: + explicit HloSendDoneInstruction(HloSendInstruction* operand, + bool is_host_transfer); + + static bool ClassOf(const HloInstruction* hlo) { + return hlo->opcode() == HloOpcode::kSendDone; + } + + private: + // Implementation for non-common logic of CloneWithNewOperands. + std::unique_ptr CloneWithNewOperandsImpl( + const Shape& shape, absl::Span new_operands, + HloCloneContext* context) const override; +}; + +class HloRecvInstruction : public HloSendRecvInstruction { + public: + explicit HloRecvInstruction(const Shape& shape, HloInstruction* token, + int64_t channel_id, bool is_host_transfer); + + static bool ClassOf(const HloInstruction* hlo) { + return hlo->opcode() == HloOpcode::kRecv; + } + + private: + // Implementation for non-common logic of CloneWithNewOperands. + std::unique_ptr CloneWithNewOperandsImpl( + const Shape& shape, absl::Span new_operands, + HloCloneContext* context) const override; +}; + +class HloRecvDoneInstruction : public HloSendRecvInstruction { + public: + explicit HloRecvDoneInstruction(HloRecvInstruction* operand, + bool is_host_transfer); + + static bool ClassOf(const HloInstruction* hlo) { + return hlo->opcode() == HloOpcode::kRecvDone; + } + + private: + // Implementation for non-common logic of CloneWithNewOperands. + std::unique_ptr CloneWithNewOperandsImpl( + const Shape& shape, absl::Span new_operands, + HloCloneContext* context) const override; +}; + +class HloCollectiveInstruction : public HloChannelInstruction { + public: + const std::vector& replica_groups() const { + return replica_groups_; + } + + // Returns true if the layout of the AllReduce is enforced by XLA client (as + // the layout set in the shape). The only reason for the client to set the + // layout is to separately compile computations that communicate with + // AllReduce. Since this field is only set `true` by the client, the compiler + // only needs to propagate existing values (e.g., Clone, X64Rewriter) or set + // `false` for all other cases. + // + // When this is `true`, there may be communication endpoints outside the + // current compilation unit, so the compiler considers this AllReduce as + // side-effecting to disable compiler transformations. The compiler is free to + // transform unconstrained AllReduces differently across compilation units. + // It is an error for an HloModule to have a mix of constrained and + // unconstrained AllReduce instructions (checked by HloVerifier). + bool constrain_layout() const { return constrain_layout_; } + + static bool ClassOf(const HloInstruction* hlo); + + protected: + explicit HloCollectiveInstruction( + HloOpcode opcode, const Shape& shape, + absl::Span operands, + absl::Span replica_groups, bool constrain_layout, + const std::optional& channel_id); + + HloInstructionProto ToProto() const override; + + void PrintExtraAttributesImpl(AttributePrinter& printer, + const HloPrintOptions& options) const override; + bool IdenticalSlowPathIgnoringChannelIdValues( + const HloInstruction& other, + absl::FunctionRef + eq_computations) const override; + + std::vector replica_groups_; + bool constrain_layout_; +}; + +class HloAllGatherInstruction : public HloCollectiveInstruction { + public: + explicit HloAllGatherInstruction( + HloOpcode opcode, const Shape& shape, + absl::Span operands, int64_t all_gather_dimension, + absl::Span replica_groups, bool constrain_layout, + const std::optional& channel_id, bool use_global_device_ids); + // Same as HloAllReduceInstruction::use_global_device_ids. + bool use_global_device_ids() const { return use_global_device_ids_; } + + // The dimension on which data from different participants are concatenated. + int64_t all_gather_dimension() const { return all_gather_dimension_; } + absl::Span dimensions() const override { + return absl::MakeConstSpan(&all_gather_dimension_, 1); + } + + void set_all_gather_dimension(int64_t dim) { all_gather_dimension_ = dim; } + + static bool ClassOf(const HloInstruction* hlo) { + return hlo->opcode() == HloOpcode::kAllGather || + hlo->opcode() == HloOpcode::kAllGatherStart; + } + + protected: + void PrintExtraAttributesImpl(AttributePrinter& printer, + const HloPrintOptions& options) const override; + HloInstructionProto ToProto() const override; + + private: + bool IdenticalSlowPathIgnoringChannelIdValues( + const HloInstruction& other, + absl::FunctionRef + eq_computations) const override; + + // Implementation for non-common logic of CloneWithNewOperands. + std::unique_ptr CloneWithNewOperandsImpl( + const Shape& shape, absl::Span new_operands, + HloCloneContext* context) const override; + + int64_t all_gather_dimension_; + bool use_global_device_ids_; +}; + +// Base class for all-reduce and all-reduce scatter instructions. +class HloAllReduceInstructionBase : public HloCollectiveInstruction { + public: + explicit HloAllReduceInstructionBase( + HloOpcode opcode, const Shape& shape, + absl::Span operands, + HloComputation* reduce_computation, + absl::Span replica_groups, bool constrain_layout, + const std::optional& channel_id, bool use_global_device_ids); + + // Returns true if the ids in the ReplicaGroup config represent a global id of + // (replica_id * partition_count + partition_id) instead of a replica id. + // This enables more flexible grouping of devices if this all-reduce is both + // cross-partition and cross-replica. + // + // For example with 2 replicas and 4 partitions, + // replica_groups={{0,1,4,5},{2,3,6,7}}, use_global_device_ids=true means that + // group[0] = (0,0), (0,1), (1,0), (1,1) + // group[1] = (0,2), (0,3), (1,2), (1,3) + // where each pair is (replica_id, partition_id). + bool use_global_device_ids() const { return use_global_device_ids_; } + void set_use_global_device_ids(bool value) { use_global_device_ids_ = value; } + + static bool ClassOf(const HloInstruction* hlo); + + protected: + void PrintExtraAttributesImpl(AttributePrinter& printer, + const HloPrintOptions& options) const override; + HloInstructionProto ToProto() const override; + + bool IdenticalSlowPathIgnoringChannelIdValues( + const HloInstruction& other, + absl::FunctionRef + eq_computations) const override; + + private: + bool use_global_device_ids_; +}; + +class HloAllReduceInstruction : public HloAllReduceInstructionBase { + public: + using HloAllReduceInstructionBase::HloAllReduceInstructionBase; + + static bool ClassOf(const HloInstruction* hlo) { + return hlo->opcode() == HloOpcode::kAllReduce || + hlo->opcode() == HloOpcode::kAllReduceStart; + } + + // Returns true if the AllReduce does no communication, so it's equivalent + // to a mem copy. + bool IsNoop() const; + + private: + // Implementation for non-common logic of CloneWithNewOperands. + std::unique_ptr CloneWithNewOperandsImpl( + const Shape& shape, absl::Span new_operands, + HloCloneContext* context) const override; +}; + +class HloReduceScatterInstruction : public HloAllReduceInstructionBase { + public: + explicit HloReduceScatterInstruction( + const Shape& shape, absl::Span operands, + HloComputation* reduce_computation, + absl::Span replica_groups, bool constrain_layout, + const std::optional& channel_id, bool use_global_device_ids, + int64_t scatter_dimension); + + // The dimension on which reduced data is scattered to different participants. + int64_t scatter_dimension() const { return scatter_dimension_; } + absl::Span dimensions() const override { + return absl::MakeConstSpan(&scatter_dimension_, 1); + } + + static bool ClassOf(const HloInstruction* hlo) { + return hlo->opcode() == HloOpcode::kReduceScatter; + } + + protected: + void PrintExtraAttributesImpl(AttributePrinter& printer, + const HloPrintOptions& options) const override; + HloInstructionProto ToProto() const override; + + private: + bool IdenticalSlowPathIgnoringChannelIdValues( + const HloInstruction& other, + absl::FunctionRef + eq_computations) const override; + + // Implementation for non-common logic of CloneWithNewOperands. + std::unique_ptr CloneWithNewOperandsImpl( + const Shape& shape, absl::Span new_operands, + HloCloneContext* context) const override; + + int64_t scatter_dimension_; +}; + +class HloAllToAllInstruction : public HloCollectiveInstruction { + public: + explicit HloAllToAllInstruction( + const Shape& shape, absl::Span operands, + absl::Span replica_groups, bool constrain_layout, + const std::optional& channel_id, + const std::optional& split_dimension); + + // AllToAll can optionally take a split dimension, which means that this + // AllToAll takes a single (flattened) array operand and produces an array + // output (instead of taking a list of operands and producing a tuple). + // + // split_dimension specifies which dimension in the operand is split across + // devices in each replica_group, and also means the concatenated dimension + // on the output (i.e., input and the output shapes are the same). + std::optional split_dimension() const { return split_dimension_; } + void set_split_dimension(int64_t dim) { split_dimension_ = dim; } + + static bool ClassOf(const HloInstruction* hlo) { + return hlo->opcode() == HloOpcode::kAllToAll; + } + + protected: + void PrintExtraAttributesImpl(AttributePrinter& printer, + const HloPrintOptions& options) const override; + HloInstructionProto ToProto() const override; + + private: + bool IdenticalSlowPathIgnoringChannelIdValues( + const HloInstruction& other, + absl::FunctionRef + eq_computations) const override; + + // Implementation for non-common logic of CloneWithNewOperands. + std::unique_ptr CloneWithNewOperandsImpl( + const Shape& shape, absl::Span new_operands, + HloCloneContext* context) const override; + + std::optional split_dimension_; +}; + +class HloCollectivePermuteInstruction : public HloChannelInstruction { + public: + explicit HloCollectivePermuteInstruction( + HloOpcode opcode, const Shape& shape, HloInstruction* operand, + const std::vector>& source_target_pairs, + const std::optional& channel_id); + + explicit HloCollectivePermuteInstruction( + HloOpcode opcode, const Shape& shape, HloInstruction* input, + HloInstruction* output, HloInstruction* input_start_indices, + HloInstruction* output_start_indices, + absl::Span> source_target_pairs, + absl::Span> slice_sizes, + const std::optional& channel_id); + + const std::vector>& source_target_pairs() const { + return source_target_pairs_; + } + + const std::vector>& dynamic_slice_sizes_list() const { + return slice_sizes_; + } + + // Returns a serialized representation of this instruction. + HloInstructionProto ToProto() const override; + + static bool ClassOf(const HloInstruction* hlo) { + return hlo->opcode() == HloOpcode::kCollectivePermute || + hlo->opcode() == HloOpcode::kCollectivePermuteStart; + } + + private: + void PrintExtraAttributesImpl(AttributePrinter& printer, + const HloPrintOptions& options) const override; + bool IdenticalSlowPathIgnoringChannelIdValues( + const HloInstruction& other, + absl::FunctionRef + eq_computations) const override; + + // Implementation for non-common logic of CloneWithNewOperands. + std::unique_ptr CloneWithNewOperandsImpl( + const Shape& shape, absl::Span new_operands, + HloCloneContext* context) const override; + + const std::vector> source_target_pairs_; + const std::vector> slice_sizes_; +}; + +inline bool HloAllReduceInstructionBase::ClassOf(const HloInstruction* hlo) { + return HloAllReduceInstruction::ClassOf(hlo) || + hlo->opcode() == HloOpcode::kReduceScatter; +} + +inline bool HloCollectiveInstruction::ClassOf(const HloInstruction* hlo) { + return HloAllReduceInstructionBase::ClassOf(hlo) || + HloAllGatherInstruction::ClassOf(hlo) || + HloAllToAllInstruction::ClassOf(hlo); +} + +inline bool HloChannelInstruction::ClassOf(const HloInstruction* hlo) { + return HloCollectiveInstruction::ClassOf(hlo) || + HloCollectivePermuteInstruction::ClassOf(hlo) || + HloSendRecvInstruction::ClassOf(hlo); +} + +class HloReverseInstruction : public HloDimensionsInstruction { + public: + explicit HloReverseInstruction(const Shape& shape, HloInstruction* operand, + absl::Span dimensions); + + static bool ClassOf(const HloInstruction* hlo) { + return hlo->opcode() == HloOpcode::kReverse; + } + + private: + // Implementation for non-common logic of CloneWithNewOperands. + std::unique_ptr CloneWithNewOperandsImpl( + const Shape& shape, absl::Span new_operands, + HloCloneContext* context) const override; +}; + +class HloConcatenateInstruction : public HloDimensionsInstruction { + public: + explicit HloConcatenateInstruction(const Shape& shape, + absl::Span operands, + int64_t dimension); + // Accessor for the dimension in which a concatenate HLO should occur. + int64_t concatenate_dimension() const override { + return HloInstruction::dimensions(0); + } + + static bool ClassOf(const HloInstruction* hlo) { + return hlo->opcode() == HloOpcode::kConcatenate; + } + + private: + // Implementation for non-common logic of CloneWithNewOperands. + std::unique_ptr CloneWithNewOperandsImpl( + const Shape& shape, absl::Span new_operands, + HloCloneContext* context) const override; +}; + +class HloReduceInstruction : public HloDimensionsInstruction { + public: + explicit HloReduceInstruction(const Shape& shape, + absl::Span args, + absl::Span dimensions_to_reduce, + HloComputation* reduce_computation); + + // Returns the number of input arrays (and, consequentially, the number of + // init values) this reduce has. + int64_t input_count() const { return operand_count() / 2; } + + // Returns the input tensors to be reduced. + absl::Span inputs() const { + return absl::MakeSpan(operands()).subspan(0, input_count()); + } + + // Returns the init values of the reduction. + absl::Span init_values() const { + return absl::MakeSpan(operands()).subspan(input_count(), operand_count()); + } + + static bool ClassOf(const HloInstruction* hlo) { + return hlo->opcode() == HloOpcode::kReduce; + } + + private: + bool IdenticalSlowPath( + const HloInstruction& other, + absl::FunctionRef + eq_computations) const override; + // Implementation for non-common logic of CloneWithNewOperands. + std::unique_ptr CloneWithNewOperandsImpl( + const Shape& shape, absl::Span new_operands, + HloCloneContext* context) const override; +}; + +class HloSortInstruction : public HloDimensionsInstruction { + public: + explicit HloSortInstruction(const Shape& shape, int64_t dimension, + absl::Span operands, + HloComputation* compare, bool is_stable); + // Returns the sort dimension for this instruction + int64_t sort_dimension() const { return HloInstruction::dimensions(0); } + // Returns a serialized representation of this instruction. + HloInstructionProto ToProto() const override; + // Returns the key operand to this instruction. + const HloInstruction* keys() const { return operand(0); } + HloInstruction* mutable_keys() { return mutable_operand(0); } + // Returns the number of value operands. + int64_t values_count() const { return operand_count() - 1; } + bool is_stable() const { return is_stable_; } + + static bool ClassOf(const HloInstruction* hlo) { + return hlo->opcode() == HloOpcode::kSort; + } + + private: + void PrintExtraAttributesImpl(AttributePrinter& printer, + const HloPrintOptions& options) const override; + bool IdenticalSlowPath( + const HloInstruction& other, + absl::FunctionRef + eq_computations) const override; + // Implementation for non-common logic of CloneWithNewOperands. + std::unique_ptr CloneWithNewOperandsImpl( + const Shape& shape, absl::Span new_operands, + HloCloneContext* context) const override; + + bool is_stable_; +}; + +class HloTransposeInstruction : public HloDimensionsInstruction { + public: + explicit HloTransposeInstruction(const Shape& shape, HloInstruction* operand, + absl::Span dimensions); + // Returns whether this instruction does a rank-2 transposition. + bool IsRank2Transpose() const; + + static bool ClassOf(const HloInstruction* hlo) { + return hlo->opcode() == HloOpcode::kTranspose; + } + + private: + // Implementation for non-common logic of CloneWithNewOperands. + std::unique_ptr CloneWithNewOperandsImpl( + const Shape& shape, absl::Span new_operands, + HloCloneContext* context) const override; +}; + +class HloBroadcastInstruction : public HloDimensionsInstruction { + public: + explicit HloBroadcastInstruction( + const Shape& shape, HloInstruction* operand, + absl::Span broadcast_dimension); + + static bool ClassOf(const HloInstruction* hlo) { + return hlo->opcode() == HloOpcode::kBroadcast; + } + + private: + // Implementation for non-common logic of CloneWithNewOperands. + std::unique_ptr CloneWithNewOperandsImpl( + const Shape& shape, absl::Span new_operands, + HloCloneContext* context) const override; +}; + +class HloDynamicReshapeInstruction : public HloInstruction { + public: + explicit HloDynamicReshapeInstruction( + const Shape& shape, HloInstruction* data_operand, + absl::Span dim_sizes); + + // Returns the input dim sizes dimensions, which is operands[1:] + absl::Span dim_sizes() const { + return absl::MakeSpan(operands()).subspan(1, operand_count()); + } + + std::unique_ptr CloneWithNewOperandsImpl( + const Shape& shape, absl::Span new_operands, + HloCloneContext* context) const override; + + // Returns the input dim size dimension, which is operands[1+i] + HloInstruction* dim_sizes(int64_t i) const { return operands()[i + 1]; } + + static bool ClassOf(const HloInstruction* hlo) { + return hlo->opcode() == HloOpcode::kDynamicReshape; + } +}; + +class HloReshapeInstruction : public HloInstruction { + public: + explicit HloReshapeInstruction(const Shape& shape, HloInstruction* operand, + int64_t inferred_dimension); + int64_t inferred_dimension() const { return inferred_dimension_; } + HloInstructionProto ToProto() const override; + + static bool ClassOf(const HloInstruction* hlo) { + return hlo->opcode() == HloOpcode::kReshape; + } + + private: + void PrintExtraAttributesImpl(AttributePrinter& printer, + const HloPrintOptions& options) const override; + bool IdenticalSlowPath( + const HloInstruction& other, + absl::FunctionRef + eq_computations) const override; + // Implementation for non-common logic of CloneWithNewOperands. + std::unique_ptr CloneWithNewOperandsImpl( + const Shape& shape, absl::Span new_operands, + HloCloneContext* context) const override; + int64_t inferred_dimension_; +}; + +class HloMapInstruction : public HloInstruction { + public: + explicit HloMapInstruction(const Shape& shape, + absl::Span operands, + HloComputation* map_computation); + // Returns the dimension sizes or numbers associated with this instruction. + absl::Span dimensions() const override { return dimensions_; } + + std::vector* mutable_dimensions() override { return &dimensions_; } + // Returns a serialized representation of this instruction. + HloInstructionProto ToProto() const override; + + static bool ClassOf(const HloInstruction* hlo) { + return hlo->opcode() == HloOpcode::kMap; + } + + private: + bool IsElementwiseImpl( + const std::optional& operand_idx) const override; + void PrintExtraAttributesImpl(AttributePrinter& printer, + const HloPrintOptions& options) const override; + bool IdenticalSlowPath( + const HloInstruction& other, + absl::FunctionRef + eq_computations) const override; + // Implementation for non-common logic of CloneWithNewOperands. + std::unique_ptr CloneWithNewOperandsImpl( + const Shape& shape, absl::Span new_operands, + HloCloneContext* context) const override; + + std::vector dimensions_; +}; + +class HloSliceInstruction : public HloInstruction { + public: + explicit HloSliceInstruction(const Shape& shape, HloInstruction* operand, + absl::Span start_indices, + absl::Span limit_indices, + absl::Span strides); + + HloInstructionProto ToProto() const override; + + // Returns the start index in the given dimension for a slice node. + int64_t slice_starts(int64_t dimension) const { + return slice_starts_[dimension]; + } + const std::vector& slice_starts() const { return slice_starts_; } + std::vector* mutable_slice_starts() { return &slice_starts_; } + + // Returns the (exclusive) limit index in the given dimension for a slice + // node. + int64_t slice_limits(int64_t dimension) const { + return slice_limits_[dimension]; + } + const std::vector& slice_limits() const { return slice_limits_; } + std::vector* mutable_slice_limits() { return &slice_limits_; } + + // Returns the stride in the given dimension for a slice node. + int64_t slice_strides(int64_t dimension) const { + return slice_strides_[dimension]; + } + const std::vector& slice_strides() const { return slice_strides_; } + std::vector* mutable_slice_strides() { return &slice_strides_; } + + static bool ClassOf(const HloInstruction* hlo) { + return hlo->opcode() == HloOpcode::kSlice; + } + + private: + void PrintExtraAttributesImpl(AttributePrinter& printer, + const HloPrintOptions& options) const override; + bool IdenticalSlowPath( + const HloInstruction& other, + absl::FunctionRef + eq_computations) const override; + // Implementation for non-common logic of CloneWithNewOperands. + std::unique_ptr CloneWithNewOperandsImpl( + const Shape& shape, absl::Span new_operands, + HloCloneContext* context) const override; + + // Describes the [begin, end) index range for a slice. + std::vector slice_starts_; + std::vector slice_limits_; + std::vector slice_strides_; +}; + +class HloConstantInstruction : public HloInstruction { + public: + explicit HloConstantInstruction(Literal literal); + HloConstantInstruction(Literal literal, const Shape& shape); + HloConstantInstruction(std::shared_ptr literal, const Shape& shape); + // Used when the literal is too large and dropped. + explicit HloConstantInstruction(const Shape& shape); + // Returns the literal associated with this instruction. + const Literal& literal() const { return *literal_; } + // Returns the (mutable) literal associated with this instruction. + // Clone the literal if necessary (do not modify the shared instance). + Literal* mutable_literal() { + if (literal_.use_count() > 1) { + literal_.reset(new Literal(literal_->Clone())); + } + return literal_.get(); + } + // Returns whether there is literal associated with this instruction. + bool HasLiteral() const { return static_cast(literal_); } + // Returns a serialized representation of this instruction. + HloInstructionProto ToProto() const override; + + // Change the layout for an Constant Hlo instruction to match new_layout. For + // tuple shaped constants shape_index is the path to the internal array + // subshape whose layout needs to be changed. + void RelayoutConstant(const Layout& new_layout, + const ShapeIndex& shape_index = {}); + + static bool ClassOf(const HloInstruction* hlo) { + return hlo->opcode() == HloOpcode::kConstant; + } + + private: + bool IsElementwiseImpl( + const std::optional& operand_idx) const override; + bool IdenticalSlowPath( + const HloInstruction& other, + absl::FunctionRef + eq_computations) const override; + void PrintOperandsWithCanonicalNameMap( + Printer* printer, const HloPrintOptions& options, + CanonicalNameMap* canonical_name_map) const override; + // Implementation for non-common logic of CloneWithNewOperands. + std::unique_ptr CloneWithNewOperandsImpl( + const Shape& shape, absl::Span new_operands, + HloCloneContext* context) const override; + std::shared_ptr literal_; +}; + +// Abstract class that represents an HLO instruction that "calls" a computation. +// Fusion and Call HLOs inherit from this class. +class HloCallableInstruction : public HloInstruction { + public: + HloCallableInstruction(HloOpcode opcode, const Shape& shape); + + HloCallableInstruction(HloOpcode opcode, const Shape& shape, + absl::Span operands); + + HloCallableInstruction(HloOpcode opcode, const Shape& shape, + absl::Span operands, + HloComputation* called_computation, + absl::string_view prefix = ""); + + HloCallableInstruction(HloOpcode opcode, const Shape& shape, + absl::Span operands, + absl::Span called_computations); + + ~HloCallableInstruction() override; + + // Adds a new operand to the callable instruction. + HloInstruction* AddCallOperand(HloInstruction* new_operand); + + // Appends (fuses) the given instruction into this callable instruction. + // instruction_to_append is cloned and the clone is placed in the callable + // instruction. The users of instruction_to_append will be redirected to this + // callable instruction. instruction_to_append is unchanged otherwise. When + // add_output is true, a clone of the instruction_to_append will be added as + // additional output resulting in a multi-output callable instruction. + HloInstruction* AppendInstructionIntoCalledComputation( + HloInstruction* instruction_to_append, bool add_output = false); + // Clones the given instruction_to_append and inserts the clone into this + // callable instruction. If add_output is true, a clone of + // instruction_to_append will be in the output of the this callable + // instruction (part of the tuple of the callable root). + HloInstruction* CloneAndAppendInstructionIntoCalledComputation( + HloInstruction* instruction_to_append, bool add_output = false); + + // Retrieves the called computations of an HloCallableInstruction that is + // being cloned. If the called computations have not yet been cloned, then + // they are first cloned and added to the context. + absl::InlinedVector GetOrCloneCalledComputations( + HloCloneContext* context) const; + + HloComputation* called_computation() const; + + HloInstruction* called_computation_root() const; + + // Recursively sets all nested called computation to have thread name as + // `execution_thread`. if `skip_async_execution_thread_overwrite` is true, + // skip overwrite async instruction and its comptuations thread name + // overwriting. + void RecursivelySetComputationsThreadName( + absl::string_view execution_thread, + bool skip_async_execution_thread_overwrite); + + static bool ClassOf(const HloInstruction* hlo) { + return hlo->opcode() == HloOpcode::kFusion || + hlo->opcode() == HloOpcode::kCall || + hlo->opcode() == HloOpcode::kCustomCall; + } + + // Gets a list of output/operand buffer pairs that alias each other, where the + // output buffer is represented as a ShapeIndex, and the operand buffer is + // represented as the operand index and the ShapeIndex. By default this list + // is empty. + const std::vector>>& + output_to_operand_aliasing() const { + return output_to_operand_aliasing_; + } + // Sets the list of output/operand buffer pairs that alias each other. + void set_output_to_operand_aliasing( + std::vector>> + aliasing) { + output_to_operand_aliasing_ = std::move(aliasing); + } + + protected: + // Returns the default called computation name. + virtual std::string default_called_computation_name() const = 0; + + private: + // A list of output/operand buffer pairs that alias each other. See comment of + // output_to_operand_aliasing(). + std::vector>> + output_to_operand_aliasing_; +}; + +class HloFusionInstruction : public HloCallableInstruction { + public: + explicit HloFusionInstruction(const Shape& shape, FusionKind fusion_kind, + HloInstruction* fused_root); + + explicit HloFusionInstruction(const Shape& shape, FusionKind fusion_kind, + absl::Span operands, + HloComputation* fusion_computation, + absl::string_view prefix = ""); + + ~HloFusionInstruction() override; + + void ClearCalledComputations() override; + + // When a fusion instruction is being destructed, clear the back pointer of + // its fusion computation, to avoid referencing freed memory. + void ClearFusionComputationInstruction(); + + std::string ToCategory() const override; + // Returns a serialized representation of this instruction. + HloInstructionProto ToProto() const override; + + // Adds a new operand the fusion instruction. + HloInstruction* AddFusionOperand(HloInstruction* new_operand); + + // Merges the fused instructions from 'instruction_to_merge' into the + // fused instruction set of 'this', updating operands as necessary. + // + // Precondition: 'instruction_to_merge' must be an operand of 'this'. + void MergeFusionInstruction(HloFusionInstruction* instruction_to_merge); + + // Merges the fused instructions from instruction_to_merge into the fused + // instruction set of 'this' and generates multioutput fusion instructions. + // All the users of instruction_to_merge will be redirected to 'this' + // instruction. instruction_to_merge will be removed from its parent + // computation. + void MergeFusionInstructionIntoMultiOutput( + HloFusionInstruction* instruction_to_merge); + + // Fuses the given instruction in this fusion instruction. instruction_to_fuse + // is cloned and the clone is placed in the fusion + // instruction. instruction_to_fuse is unchanged. Instruction is cloned rather + // than moved to cleanly handle the case where the instruction has a use + // outside the fusion instruction. Moving such an instruction into a fusion + // instruction would violate the single-result invariant of HLO instructions + // and significantly complicate code generation. + HloInstruction* FuseInstruction(HloInstruction* instruction_to_fuse) { + CHECK(instruction_to_fuse->IsFusible()) << instruction_to_fuse->ToString(); + return AppendInstructionIntoCalledComputation(instruction_to_fuse); + } + + // Fuses the given instruction in this fusion instruction and generates a + // multioutput fusion instruction. A clone of the instruction_to_fuse will + // be part of the output of fusion instructions. The users of + // instruction_to_fuse will be redirected to this fusion instructions. + // instruction_to_fuse is unchanged otherwise. + HloInstruction* FuseInstructionIntoMultiOutput( + HloInstruction* instruction_to_fuse) { + return AppendInstructionIntoCalledComputation(instruction_to_fuse, + /*add_output=*/true); + } + + // Returns the computation for this fused instruction. + HloComputation* fused_instructions_computation() const; + + // Returns the root instruction of the fused expression contained within this + // fusion instruction. + HloInstruction* fused_expression_root() const; + + // Returns the list of fused instructions inside this fusion instruction. The + // returned type is a range of HloInstruction*s. + tsl::gtl::iterator_range>::const_iterator>> + fused_instructions() const; + + tsl::gtl::iterator_range< + UnwrappingIterator>::iterator>> + fused_instructions(); + + // Gets the number of instructions inside this fusion instruction. + int64_t fused_instruction_count() const; + + // Returns the fused parameter instruction in this fusion instruction + // corresponding to the given parameter number. + HloInstruction* fused_parameter(int64_t parameter_number) const; + + // Returns the vector of fused parameters inside this fusion instruction. + const HloInstruction::InstructionVector& fused_parameters() const; + + // Returns true if this instruction is a fusion instruction that generates + // multiple outputs. + bool IsMultiOutputFusion() const { + return fused_expression_root()->opcode() == HloOpcode::kTuple; + } + + FusionKind fusion_kind() const { return fusion_kind_; } + + void set_fusion_kind(FusionKind kind) { fusion_kind_ = kind; } + + // If multiple operands are the same instruction, keeps only one of them. + Status DeduplicateFusionOperands(); + + static bool ClassOf(const HloInstruction* hlo) { + return hlo->opcode() == HloOpcode::kFusion; + } + + protected: + std::string default_called_computation_name() const override { + return "fused_computation"; + } + + private: + bool IsElementwiseImpl( + const std::optional& operand_idx) const override; + void PrintExtraAttributesImpl(AttributePrinter& printer, + const HloPrintOptions& options) const override; + bool IdenticalSlowPath( + const HloInstruction& other, + absl::FunctionRef + eq_computations) const override; + + // Implementation for non-common logic of CloneWithNewOperands. + std::unique_ptr CloneWithNewOperandsImpl( + const Shape& shape, absl::Span new_operands, + HloCloneContext* context) const override; + + // The type of the fusion. + FusionKind fusion_kind_; +}; + +class HloCallInstruction : public HloCallableInstruction { + public: + HloCallInstruction(const Shape& shape, + HloInstruction* called_computation_root); + + HloCallInstruction(const Shape& shape, + absl::Span operands, + HloComputation* called_computation); + + static bool ClassOf(const HloInstruction* hlo) { + return hlo->opcode() == HloOpcode::kCall; + } + + protected: + std::string default_called_computation_name() const override { + return "called_computation"; + } +}; + +class HloRngInstruction : public HloInstruction { + public: + explicit HloRngInstruction(const Shape& shape, + RandomDistribution distribution, + absl::Span parameters); + // Returns the random distribution for this rng node. + RandomDistribution random_distribution() const { return distribution_; } + // Returns a serialized representation of this instruction. + HloInstructionProto ToProto() const override; + + static bool ClassOf(const HloInstruction* hlo) { + return hlo->opcode() == HloOpcode::kRng; + } + + private: + bool IsElementwiseImpl( + const std::optional& operand_idx) const override; + void PrintExtraAttributesImpl(AttributePrinter& printer, + const HloPrintOptions& options) const override; + bool IdenticalSlowPath( + const HloInstruction& other, + absl::FunctionRef + eq_computations) const override; + // Implementation for non-common logic of CloneWithNewOperands. + std::unique_ptr CloneWithNewOperandsImpl( + const Shape& shape, absl::Span new_operands, + HloCloneContext* context) const override; + + // The distribution requested for random number generation. + RandomDistribution distribution_; +}; + +class HloParameterInstruction : public HloInstruction { + public: + explicit HloParameterInstruction(int64_t parameter_number, const Shape& shape, + absl::string_view name); + int64_t parameter_number() const { return parameter_number_; } + + // Sets and gets the whether all replicas will receive the same parameter data + // for each leaf buffer in data parallelism. + void set_parameter_replicated_at_leaf_buffers( + absl::Span parameter_replicated_at_leaf_buffers) { + CHECK_EQ(ShapeUtil::GetLeafCount(shape()), + parameter_replicated_at_leaf_buffers.size()); + parameter_replicated_at_leaf_buffers_.emplace( + parameter_replicated_at_leaf_buffers.begin(), + parameter_replicated_at_leaf_buffers.end()); + } + void set_parameter_replicated_at_leaf_buffers( + const std::vector& parameter_replicated_at_leaf_buffers) { + CHECK_EQ(ShapeUtil::GetLeafCount(shape()), + parameter_replicated_at_leaf_buffers.size()); + parameter_replicated_at_leaf_buffers_ = + parameter_replicated_at_leaf_buffers; + } + const std::optional>& parameter_replicated_at_leaf_buffers() + const { + return parameter_replicated_at_leaf_buffers_; + } + + // Returns a serialized representation of this instruction. + HloInstructionProto ToProto() const override; + + static bool ClassOf(const HloInstruction* hlo) { + return hlo->opcode() == HloOpcode::kParameter; + } + + private: + void PrintExtraAttributesImpl(AttributePrinter& printer, + const HloPrintOptions& options) const override; + bool IdenticalSlowPath( + const HloInstruction& other, + absl::FunctionRef + eq_computations) const override; + void PrintOperandsWithCanonicalNameMap( + Printer* printer, const HloPrintOptions& options, + CanonicalNameMap* canonical_name_map) const override; + // Implementation for non-common logic of CloneWithNewOperands. + std::unique_ptr CloneWithNewOperandsImpl( + const Shape& shape, absl::Span new_operands, + HloCloneContext* context) const override; + + int64_t parameter_number_ = 0; + + // Specifies whether each buffer has the same parameter value on all replicas + // in data parallelism. + std::optional> parameter_replicated_at_leaf_buffers_; +}; + +class HloGetTupleElementInstruction : public HloInstruction { + public: + explicit HloGetTupleElementInstruction(const Shape& shape, + HloInstruction* operand, + int64_t index); + // Returns the tuple index associated with this instruction. + int64_t tuple_index() const { return tuple_index_; } + // Sets the tuple index associated with this instruction. + void set_tuple_index(int64_t new_tuple_index) { + tuple_index_ = new_tuple_index; + } + // Returns a serialized representation of this instruction. + HloInstructionProto ToProto() const override; + + static bool ClassOf(const HloInstruction* hlo) { + return hlo->opcode() == HloOpcode::kGetTupleElement; + } + + private: + void PrintExtraAttributesImpl(AttributePrinter& printer, + const HloPrintOptions& options) const override; + bool IdenticalSlowPath( + const HloInstruction& other, + absl::FunctionRef + eq_computations) const override; + // Implementation for non-common logic of CloneWithNewOperands. + std::unique_ptr CloneWithNewOperandsImpl( + const Shape& shape, absl::Span new_operands, + HloCloneContext* context) const override; + + int64_t tuple_index_ = -1; +}; + +class HloReducePrecisionInstruction : public HloInstruction { + public: + explicit HloReducePrecisionInstruction(const Shape& shape, + HloInstruction* operand, + int exponent_bits, int mantissa_bits); + // Returns the number of exponent bits for a reduce-precision node. + int32_t exponent_bits() const { return exponent_bits_; } + // Returns the number of mantissa bits for a reduce-precision node. + int32_t mantissa_bits() const { return mantissa_bits_; } + // Returns a serialized representation of this instruction. + HloInstructionProto ToProto() const override; + + static bool ClassOf(const HloInstruction* hlo) { + return hlo->opcode() == HloOpcode::kReducePrecision; + } + + private: + void PrintExtraAttributesImpl(AttributePrinter& printer, + const HloPrintOptions& options) const override; + bool IdenticalSlowPath( + const HloInstruction& other, + absl::FunctionRef + eq_computations) const override; + // Implementation for non-common logic of CloneWithNewOperands. + std::unique_ptr CloneWithNewOperandsImpl( + const Shape& shape, absl::Span new_operands, + HloCloneContext* context) const override; + + // The bit sizes for a reduce-precision operation. + int32_t exponent_bits_ = 0; + int32_t mantissa_bits_ = 0; +}; + +class HloInfeedInstruction : public HloInstruction { + public: + explicit HloInfeedInstruction(const Shape& infeed_shape, + HloInstruction* token_operand, + const std::string& config); + // Returns the infeed configuration string. The infeed configuration includes + // any metadata needed for the backend compiler (e.g., infeed buffer address) + // and is target-dependent. + std::string infeed_config() const { return infeed_config_; } + void set_infeed_config(const std::string& config) { infeed_config_ = config; } + // Returns the shape of the data received by the infeed. This is not the same + // as the shape of the infeed instruction which produces a tuple containing + // the infeed data shape and a TOKEN. + const Shape& infeed_shape() const { + TF_DCHECK_OK(ShapeUtil::ValidateShapeWithOptionalLayout(shape())); + return ShapeUtil::GetSubshape(shape(), {0}); + } + // Returns a serialized representation of this instruction. + HloInstructionProto ToProto() const override; + + static bool ClassOf(const HloInstruction* hlo) { + return hlo->opcode() == HloOpcode::kInfeed; + } + + private: + void PrintExtraAttributesImpl(AttributePrinter& printer, + const HloPrintOptions& options) const override; + bool IdenticalSlowPath( + const HloInstruction& other, + absl::FunctionRef + eq_computations) const override; + // Implementation for non-common logic of CloneWithNewOperands. + std::unique_ptr CloneWithNewOperandsImpl( + const Shape& shape, absl::Span new_operands, + HloCloneContext* context) const override; + + // The string representation of the infeed configuration. + std::string infeed_config_; +}; + +class HloOutfeedInstruction : public HloInstruction { + public: + explicit HloOutfeedInstruction(const Shape& outfeed_shape, + HloInstruction* operand, + HloInstruction* token_operand, + absl::string_view outfeed_config); + // Returns the shape for the Outfeed instruction. + const Shape& outfeed_shape() const { return outfeed_shape_; } + // Returns the mutable shape for the Outfeed instruction. + Shape* mutable_outfeed_shape() { return &outfeed_shape_; } + // Returns the config for the Outfeed instruction. + const std::string& outfeed_config() const { return outfeed_config_; } + void set_outfeed_config(const std::string& config) { + outfeed_config_ = config; + } + // Returns a serialized representation of this instruction. + HloInstructionProto ToProto() const override; + + static bool ClassOf(const HloInstruction* hlo) { + return hlo->opcode() == HloOpcode::kOutfeed; + } + + private: + void PrintExtraAttributesImpl(AttributePrinter& printer, + const HloPrintOptions& options) const override; + bool IdenticalSlowPath( + const HloInstruction& other, + absl::FunctionRef + eq_computations) const override; + // Implementation for non-common logic of CloneWithNewOperands. + std::unique_ptr CloneWithNewOperandsImpl( + const Shape& shape, absl::Span new_operands, + HloCloneContext* context) const override; + + // Shape of outfeed request. + Shape outfeed_shape_; + // Outfeed configuration information, only present for kOutfeed. + std::string outfeed_config_; +}; + +class HloConvolutionInstruction : public HloInstruction { + public: + explicit HloConvolutionInstruction( + const Shape& shape, HloInstruction* lhs, HloInstruction* rhs, + int64_t feature_group_count, int64_t batch_group_count, + const Window& window, + const ConvolutionDimensionNumbers& dimension_numbers, + const PrecisionConfig& precision_config); + const Window& window() const override { return window_; } + void set_window(const Window& window) override { window_ = window; } + const ConvolutionDimensionNumbers& convolution_dimension_numbers() const { + return convolution_dimension_numbers_; + } + void set_convolution_dimension_numbers( + const ConvolutionDimensionNumbers& dnums) { + convolution_dimension_numbers_ = dnums; + } + // The number of feature groups. Must be a divisor of the input feature + // dimension and output feature dimension. + int64_t feature_group_count() const { return feature_group_count_; } + void set_feature_group_count(int64_t num_feature_groups) { + feature_group_count_ = num_feature_groups; + } + // The number of batch groups. Must be a divisor of the input batch dimension. + int64_t batch_group_count() const { return batch_group_count_; } + void set_batch_group_count(int64_t num_batch_groups) { + batch_group_count_ = num_batch_groups; + } + + // Returns the information used to tell the implementation information about + // what sort of precision is requested. The meaning of the field is backend + // specific. At the moment, it is only supported for kConvolution and kDot. + // Transformations on one kDot or kConvolution to another will preserve this + // information. Transformations to other HLOs will not preserve this + // information but it is presumed that the alternate lowering is strictly + // superior. + const PrecisionConfig& precision_config() const { return precision_config_; } + PrecisionConfig* mutable_precision_config() { return &precision_config_; } + + std::string ToCategory() const override; + // Returns a serialized representation of this instruction. + HloInstructionProto ToProto() const override; + + static bool ClassOf(const HloInstruction* hlo) { + return hlo->opcode() == HloOpcode::kConvolution; + } + + private: + void PrintExtraAttributesImpl(AttributePrinter& printer, + const HloPrintOptions& options) const override; + bool IdenticalSlowPath( + const HloInstruction& other, + absl::FunctionRef + eq_computations) const override; + // Implementation for non-common logic of CloneWithNewOperands. + std::unique_ptr CloneWithNewOperandsImpl( + const Shape& shape, absl::Span new_operands, + HloCloneContext* context) const override; + // The number of feature groups. Must be a divisor of the input feature + // dimension and output feature dimension. + int64_t feature_group_count_; + // The number of batch groups. Must be a divisor of the input batch dimension. + int64_t batch_group_count_; + // Describes the window used for a convolution. + Window window_; + // Describes the dimension numbers used for a convolution. + ConvolutionDimensionNumbers convolution_dimension_numbers_; + // Information used to communicate to the implementation about the algorithm + // used to produce results. See the documentation on precision_config(). + PrecisionConfig precision_config_; +}; + +class HloReduceWindowInstruction : public HloInstruction { + public: + explicit HloReduceWindowInstruction(const Shape& shape, + HloInstruction* operand, + HloInstruction* init_value, + const Window& window, + HloComputation* reduce_computation); + explicit HloReduceWindowInstruction( + const Shape& shape, absl::Span operands, + absl::Span init_values, const Window& window, + HloComputation* reduce_computation); + const Window& window() const override { return window_; } + void set_window(const Window& window) override { window_ = window; } + // Returns a serialized representation of this instruction. + HloInstructionProto ToProto() const override; + // Returns the number of input arrays (and, consequentially, the number of + // init values) this reduce has. + int64_t input_count() const { return operand_count() / 2; } + // Returns the input tensors to be reduced. + absl::Span inputs() const { + return absl::MakeSpan(operands()).subspan(0, input_count()); + } + // Returns the init values of the reduction. + absl::Span init_values() const { + return absl::MakeSpan(operands()).subspan(input_count(), operand_count()); + } + // Returns the shapes of input tensors to be reduced. + absl::InlinedVector input_shapes() const { + absl::InlinedVector shapes; + for (const auto* op : inputs()) { + shapes.push_back(&op->shape()); + } + return shapes; + } + // Returns the init values of the reduction. + absl::InlinedVector init_value_shapes() const { + absl::InlinedVector shapes; + for (const auto* op : init_values()) { + shapes.push_back(&op->shape()); + } + return shapes; + } + // Returns the shapes of the reduced output tensors. + absl::InlinedVector output_shapes() const { + absl::InlinedVector shapes; + if (shape().IsArray()) { + shapes.push_back(&shape()); + } else { + for (const Shape& tuple_element_shape : shape().tuple_shapes()) { + shapes.push_back(&tuple_element_shape); + } + } + return shapes; + } + + static bool ClassOf(const HloInstruction* hlo) { + return hlo->opcode() == HloOpcode::kReduceWindow; + } + + private: + void PrintExtraAttributesImpl(AttributePrinter& printer, + const HloPrintOptions& options) const override; + bool IdenticalSlowPath( + const HloInstruction& other, + absl::FunctionRef + eq_computations) const override; + // Implementation for non-common logic of CloneWithNewOperands. + std::unique_ptr CloneWithNewOperandsImpl( + const Shape& shape, absl::Span new_operands, + HloCloneContext* context) const override; + + Window window_; +}; + +class HloSelectAndScatterInstruction : public HloInstruction { + public: + explicit HloSelectAndScatterInstruction( + const Shape& shape, HloInstruction* operand, HloComputation* select, + const Window& window, HloInstruction* source, HloInstruction* init_value, + HloComputation* scatter); + const Window& window() const override { return window_; } + void set_window(const Window& window) override { window_ = window; } + // Gets/sets the select or scatter HloComputation for SelectAndScatter. The + // setters should only be called by HloModule or HloComputation methods. + HloComputation* select() const { + return called_computations()[kSelectComputationIndex]; + } + + HloComputation* scatter() const { + return called_computations()[kScatterComputationIndex]; + } + + void set_select(HloComputation* computation) { + set_called_computation(kSelectComputationIndex, computation); + } + + void set_scatter(HloComputation* computation) { + set_called_computation(kScatterComputationIndex, computation); + } + // Returns a serialized representation of this instruction. + HloInstructionProto ToProto() const override; + + static bool ClassOf(const HloInstruction* hlo) { + return hlo->opcode() == HloOpcode::kSelectAndScatter; + } + + private: + void PrintExtraAttributesImpl(AttributePrinter& printer, + const HloPrintOptions& options) const override; + bool IdenticalSlowPath( + const HloInstruction& other, + absl::FunctionRef + eq_computations) const override; + // Implementation for non-common logic of CloneWithNewOperands. + std::unique_ptr CloneWithNewOperandsImpl( + const Shape& shape, absl::Span new_operands, + HloCloneContext* context) const override; + Window window_; +}; + +class HloCustomCallInstruction : public HloCallableInstruction { + public: + HloCustomCallInstruction(const Shape& shape, + absl::Span operands, + absl::string_view custom_call_target, + std::string opaque, + CustomCallApiVersion api_version); + + // Constructor for a custom call with constrained layout. 'shape' and + // 'operands_with_layout' must all have layouts. + HloCustomCallInstruction(const Shape& shape, + absl::Span operands, + absl::string_view custom_call_target, + std::string opaque, + absl::Span operand_shapes_with_layout, + CustomCallApiVersion api_version); + + // Constructor for a custom call with a to_apply computation. + HloCustomCallInstruction(const Shape& shape, + absl::Span operands, + HloComputation* to_apply, + absl::string_view custom_call_target, + std::string opaque, + CustomCallApiVersion api_version); + + // Constructor for a custom call with multiple computations. + HloCustomCallInstruction( + const Shape& shape, absl::Span operands, + absl::Span called_computations, + absl::string_view custom_call_target, std::string opaque, + CustomCallApiVersion api_version); + + const Window& window() const override { + CHECK(window_ != nullptr); + return *window_; + } + + void set_window(const Window& window) override { + window_ = std::make_unique(window); + } + + const ConvolutionDimensionNumbers& convolution_dimension_numbers() const { + CHECK(convolution_dimension_numbers_ != nullptr); + return *convolution_dimension_numbers_; + } + + void set_convolution_dimension_numbers( + const ConvolutionDimensionNumbers& dnums) { + convolution_dimension_numbers_ = + std::make_unique(dnums); + } + // TODO(jpienaar): Remove this accessor in the follow up. + const std::string& opaque() const { return raw_backend_config_string(); } + const std::string& custom_call_target() const { return custom_call_target_; } + void set_custom_call_target(absl::string_view target) { + custom_call_target_ = std::string(target); + } + void set_feature_group_count(int64_t feature_group_count) { + feature_group_count_ = feature_group_count; + } + void set_batch_group_count(int64_t batch_group_count) { + batch_group_count_ = batch_group_count; + } + // Sets whether this custom call has a side-effect - by default a custom call + // has no side-effects. + void set_custom_call_has_side_effect(bool custom_call_has_side_effect) { + custom_call_has_side_effect_ = custom_call_has_side_effect; + } + int64_t feature_group_count() const { return feature_group_count_; } + int64_t batch_group_count() const { return batch_group_count_; } + bool custom_call_has_side_effect() const { + return custom_call_has_side_effect_; + } + // Returns padding type used for ops like convolution. + PaddingType padding_type() const { return padding_type_; } + + void set_padding_type(PaddingType padding_type) { + padding_type_ = padding_type; + } + + // Returns the literal associated with this instruction. + const Literal& literal() const { return *literal_; } + // Set the value of literal to a new one. + void set_literal(Literal&& literal) { literal_.emplace(std::move(literal)); } + // Returns whether there is literal associated with this instruction. + bool HasLiteral() const { return literal_.has_value(); } + + const PrecisionConfig& precision_config() const { return precision_config_; } + PrecisionConfig* mutable_precision_config() { return &precision_config_; } + + // Returns a serialized representation of this instruction. + HloInstructionProto ToProto() const override; + + // Returns whether the result and operand layouts are constrained. + bool layout_constrained() const { return layout_constrained_; } + + // Returns the shapes (with layout) of the operands. CHECKs if this custom + // call does not have constrained layouts. + const std::vector& operand_shapes_with_layout() const { + CHECK(layout_constrained()); + return operand_shapes_with_layout_; + } + void set_custom_call_schedule(CustomCallSchedule custom_call_schedule) { + custom_call_schedule_ = custom_call_schedule; + } + CustomCallSchedule custom_call_schedule() const { + return custom_call_schedule_; + } + void set_api_version(CustomCallApiVersion api_version) { + api_version_ = api_version; + } + CustomCallApiVersion api_version() const { return api_version_; } + + static bool ClassOf(const HloInstruction* hlo) { + return hlo->opcode() == HloOpcode::kCustomCall; + } + + protected: + std::string default_called_computation_name() const override { + return "custom_call_computation"; + } + + private: + void PrintExtraAttributesImpl(AttributePrinter& printer, + const HloPrintOptions& options) const override; + bool IdenticalSlowPath( + const HloInstruction& other, + absl::FunctionRef + eq_computations) const override; + // Implementation for non-common logic of CloneWithNewOperands. + std::unique_ptr CloneWithNewOperandsImpl( + const Shape& shape, absl::Span new_operands, + HloCloneContext* context) const override; + // Name of a global symbol to call. + std::string custom_call_target_; + // Describes the window in a windowed operation such as convolution. + std::unique_ptr window_; + // Describes the dimension numbers used for a convolution. + std::unique_ptr convolution_dimension_numbers_; + // The number of feature groups. This is used for grouped convolutions. + int64_t feature_group_count_; + int64_t batch_group_count_; + // Whether the result and operand layouts are constrained. + bool layout_constrained_; + // Information used to communicate to the implementation about the algorithm + // used to produce results for convolution instructions. + PrecisionConfig precision_config_; + // Describes the padding type for convolution instructions. + PaddingType padding_type_; + // For layout-constrained custom calls, this vector holds the shape with + // layout for each operand. + std::vector operand_shapes_with_layout_; + // Whether this custom call has a side-effect. + bool custom_call_has_side_effect_; + std::optional literal_; + // A custom-call schedule hint. + CustomCallSchedule custom_call_schedule_; + // The version of the API used by the custom call function. + // TODO(b/189822916): Remove this field when all clients are migrated to the + // status-returning API. + CustomCallApiVersion api_version_; +}; + +class HloPadInstruction : public HloInstruction { + public: + explicit HloPadInstruction(const Shape& shape, HloInstruction* operand, + HloInstruction* padding_value, + const PaddingConfig& padding_config); + // Returns the padding configuration for a pad node. + const PaddingConfig& padding_config() const { return padding_config_; } + PaddingConfig* mutable_padding_config() { return &padding_config_; } + // Returns the operand being padded. + const HloInstruction* padded_operand() const { return operand(0); } + HloInstruction* mutable_padded_operand() { return mutable_operand(0); } + // Returns the padding value. + const HloInstruction* padding_value() const { return operand(1); } + HloInstruction* mutable_padding_value() { return mutable_operand(1); } + // Returns a serialized representation of this instruction. + HloInstructionProto ToProto() const override; + + static bool ClassOf(const HloInstruction* hlo) { + return hlo->opcode() == HloOpcode::kPad; + } + + private: + void PrintExtraAttributesImpl(AttributePrinter& printer, + const HloPrintOptions& options) const override; + bool IdenticalSlowPath( + const HloInstruction& other, + absl::FunctionRef + eq_computations) const override; + // Implementation for non-common logic of CloneWithNewOperands. + std::unique_ptr CloneWithNewOperandsImpl( + const Shape& shape, absl::Span new_operands, + HloCloneContext* context) const override; + + // The padding configuration that describes the edge padding and interior + // padding of this pad instruction. + PaddingConfig padding_config_; +}; + +class HloDynamicIndexInstruction : public HloInstruction { + public: + explicit HloDynamicIndexInstruction(HloOpcode opcode, const Shape& shape) + : HloInstruction(opcode, shape) {} + virtual int64_t first_index_operand_number() const = 0; + + // Returns a subspan of operands which represent the start indices. + absl::Span index_operands() const { + return absl::MakeSpan(operands()).subspan(first_index_operand_number()); + } + + // Returns the shapes of the index operands. + std::vector index_shapes() const { + std::vector shapes; + auto indices = index_operands(); + for (const HloInstruction* index : indices) { + shapes.push_back(index->shape()); + } + return shapes; + } + + static bool ClassOf(const HloInstruction* hlo) { + return hlo->opcode() == HloOpcode::kDynamicSlice || + hlo->opcode() == HloOpcode::kDynamicUpdateSlice; + } +}; + +class HloDynamicSliceInstruction : public HloDynamicIndexInstruction { + public: + explicit HloDynamicSliceInstruction(const Shape& shape, + HloInstruction* operand, + HloInstruction* start_indices, + absl::Span slice_sizes); + explicit HloDynamicSliceInstruction( + const Shape& shape, HloInstruction* operand, + absl::Span start_indices, + absl::Span slice_sizes); + // Old methods kept for smooth subclassing transition END. + // Returns the size of the slice in the given dimension for a dynamic + // slice node. + int64_t slice_sizes(int64_t dimension) const { + return dynamic_slice_sizes_[dimension]; + } + const std::vector& dynamic_slice_sizes() const { + return dynamic_slice_sizes_; + } + // Returns a serialized representation of this instruction. + HloInstructionProto ToProto() const override; + + int64_t first_index_operand_number() const override { return 1; } + static bool ClassOf(const HloInstruction* hlo) { + return hlo->opcode() == HloOpcode::kDynamicSlice; + } + + private: + void PrintExtraAttributesImpl(AttributePrinter& printer, + const HloPrintOptions& options) const override; + bool IdenticalSlowPath( + const HloInstruction& other, + absl::FunctionRef + eq_computations) const override; + // Implementation for non-common logic of CloneWithNewOperands. + std::unique_ptr CloneWithNewOperandsImpl( + const Shape& shape, absl::Span new_operands, + HloCloneContext* context) const override; + + // Describes the [start, start + size) range size for a dynamic slice + // ('start' is specified dynamically in the second operand of the operation). + std::vector dynamic_slice_sizes_; +}; + +class HloDynamicUpdateSliceInstruction : public HloDynamicIndexInstruction { + public: + explicit HloDynamicUpdateSliceInstruction(const Shape& shape, + HloInstruction* operand, + HloInstruction* update, + HloInstruction* start_indices); + explicit HloDynamicUpdateSliceInstruction( + const Shape& shape, HloInstruction* operand, HloInstruction* update, + absl::Span start_indices); + + int64_t first_index_operand_number() const override { return 2; } + + static bool ClassOf(const HloInstruction* hlo) { + return hlo->opcode() == HloOpcode::kDynamicUpdateSlice; + } +}; + +class HloGatherInstruction : public HloInstruction { + public: + explicit HloGatherInstruction( + const Shape& shape, HloInstruction* operand, + HloInstruction* start_indices, + const GatherDimensionNumbers& gather_dim_numbers, + absl::Span slice_sizes, bool indices_are_sorted); + const GatherDimensionNumbers& gather_dimension_numbers() const { + CHECK(gather_dimension_numbers_ != nullptr); + return *gather_dimension_numbers_; + } + absl::Span gather_slice_sizes() const { + return gather_slice_sizes_; + } + bool indices_are_sorted() const { return indices_are_sorted_; } + void set_indices_are_sorted(bool indices_are_sorted) { + indices_are_sorted_ = indices_are_sorted; + } + // Returns a serialized representation of this instruction. + HloInstructionProto ToProto() const override; + + // Creates an instance of GatherDimensionNumbers. + static GatherDimensionNumbers MakeGatherDimNumbers( + absl::Span offset_dims, + absl::Span collapsed_slice_dims, + absl::Span start_index_map, int64_t index_vector_dim); + // Returns the dump string of the given gather dimension numbers. + static std::string GatherDimensionNumbersToString( + const GatherDimensionNumbers& dim_numbers); + // Prints the dump string of the given gather dimension numbers. + static void PrintGatherDimensionNumbers( + Printer* printer, const GatherDimensionNumbers& dim_numbers); + + static bool ClassOf(const HloInstruction* hlo) { + return hlo->opcode() == HloOpcode::kGather; + } + + private: + void PrintExtraAttributesImpl(AttributePrinter& printer, + const HloPrintOptions& options) const override; + bool IdenticalSlowPath( + const HloInstruction& other, + absl::FunctionRef + eq_computations) const override; + std::unique_ptr CloneWithNewOperandsImpl( + const Shape& shape, absl::Span new_operands, + HloCloneContext* context) const override; + + std::unique_ptr gather_dimension_numbers_; + std::vector gather_slice_sizes_; + bool indices_are_sorted_; +}; + +class HloScatterInstruction : public HloInstruction { + public: + explicit HloScatterInstruction( + const Shape& shape, absl::Span args, + HloComputation* update_computation, + const ScatterDimensionNumbers& scatter_dim_numbers, + bool indices_are_sorted, bool unique_indices); + const ScatterDimensionNumbers& scatter_dimension_numbers() const { + CHECK(scatter_dimension_numbers_ != nullptr); + return *scatter_dimension_numbers_; + } + bool indices_are_sorted() const { return indices_are_sorted_; } + void set_indices_are_sorted(bool indices_are_sorted) { + indices_are_sorted_ = indices_are_sorted; + } + bool unique_indices() const override { return unique_indices_; } + // Returns a serialized representation of this instruction. + HloInstructionProto ToProto() const override; + int64_t scatter_operand_count() const { return operand_count() / 2; } + absl::Span scatter_operands() const { + return absl::MakeConstSpan(operands()).first(scatter_operand_count()); + } + absl::Span scatter_updates() const { + return absl::MakeConstSpan(operands()).last(scatter_operand_count()); + } + const HloInstruction* scatter_indices() const { + return operand(scatter_operand_count()); + } + HloInstruction* scatter_indices() { + return mutable_operand(scatter_operand_count()); + } + + // Creates an instance of ScatterDimensionNumbers. + static ScatterDimensionNumbers MakeScatterDimNumbers( + absl::Span update_window_dims, + absl::Span inserted_window_dims, + absl::Span scatter_dims_to_operand_dims, + int64_t index_vector_dim); + // Returns the dump string of the given scatter dimension numbers. + static std::string ScatterDimensionNumbersToString( + const ScatterDimensionNumbers& dim_numbers); + // Prints the dump string of the given scatter dimension numbers. + static void PrintScatterDimensionNumbers( + Printer* printer, const ScatterDimensionNumbers& dim_numbers); + + static bool ClassOf(const HloInstruction* hlo) { + return hlo->opcode() == HloOpcode::kScatter; + } + + private: + void PrintExtraAttributesImpl(AttributePrinter& printer, + const HloPrintOptions& options) const override; + bool IdenticalSlowPath( + const HloInstruction& other, + absl::FunctionRef + eq_computations) const override; + // Implementation for non-common logic of CloneWithNewOperands. + std::unique_ptr CloneWithNewOperandsImpl( + const Shape& shape, absl::Span new_operands, + HloCloneContext* context) const override; + + std::unique_ptr scatter_dimension_numbers_; + bool indices_are_sorted_; + bool unique_indices_; +}; + +class HloIotaInstruction : public HloInstruction { + public: + explicit HloIotaInstruction(const Shape& shape, int64_t iota_dimension); + + // Returns the dimension sizes or numbers associated with this instruction. + int64_t iota_dimension() const { return iota_dimension_; } + absl::Span dimensions() const override { + return absl::MakeConstSpan(&iota_dimension_, 1); + } + // Returns a serialized representation of this instruction. + HloInstructionProto ToProto() const override; + + static bool ClassOf(const HloInstruction* hlo) { + return hlo->opcode() == HloOpcode::kIota; + } + + private: + void PrintExtraAttributesImpl(AttributePrinter& printer, + const HloPrintOptions& options) const override; + bool IdenticalSlowPath( + const HloInstruction& other, + absl::FunctionRef + eq_computations) const override; + // Implementation for non-common logic of CloneWithNewOperands. + std::unique_ptr CloneWithNewOperandsImpl( + const Shape& shape, absl::Span new_operands, + HloCloneContext* context) const override; + + int64_t iota_dimension_; +}; + +class HloDotInstruction : public HloInstruction { + public: + // Creates a dot op with operands 'lhs' and 'rhs' with contracting and batch + // dimensions specified in 'dimension_numbers'. + explicit HloDotInstruction(const Shape& shape, HloInstruction* lhs, + HloInstruction* rhs, + const DotDimensionNumbers& dimension_numbers, + const PrecisionConfig& precision_config); + + // Returns data on the dimension numbers used for a dot operation. + const DotDimensionNumbers& dot_dimension_numbers() const { + return dot_dimension_numbers_; + } + + // Sets dimension numbers used for a dot operation. + DotDimensionNumbers* mutable_dot_dimension_numbers() { + return &dot_dimension_numbers_; + } + + // Returns the information used to tell the implementation information about + // what sort of precision is requested. The meaning of the field is backend + // specific. At the moment, it is only supported for kConvolution and kDot. + // Transformations on one kDot or kConvolution to another will preserve this + // information. Transformations to other HLOs will not preserve this + // information but it is presumed that the alternate lowering is strictly + // superior. + const PrecisionConfig& precision_config() const { return precision_config_; } + PrecisionConfig* mutable_precision_config() { return &precision_config_; } + + // Returns a serialized representation of this instruction. + HloInstructionProto ToProto() const override; + + static bool ClassOf(const HloInstruction* hlo) { + return hlo->opcode() == HloOpcode::kDot; + } + + private: + void PrintExtraAttributesImpl(AttributePrinter& printer, + const HloPrintOptions& options) const override; + bool IdenticalSlowPath( + const HloInstruction& other, + absl::FunctionRef + eq_computations) const override; + // Implementation for non-common logic of CloneWithNewOperands. + std::unique_ptr CloneWithNewOperandsImpl( + const Shape& shape, absl::Span new_operands, + HloCloneContext* context) const override; + + // Describes the dimension numbers used for a dot. + DotDimensionNumbers dot_dimension_numbers_; + + // Information used to communicate to the implementation about the algorithm + // used to produce results. See the documentation on precision_config(). + PrecisionConfig precision_config_; +}; + +class HloDomainInstruction : public HloInstruction { + public: + explicit HloDomainInstruction( + const Shape& shape, HloInstruction* operand, + std::unique_ptr operand_side_metadata, + std::unique_ptr user_side_metadata); + + // Returns a serialized representation of this instruction. + HloInstructionProto ToProto() const override; + + // Retrieves the operand side metadata of a kDomain instruction. + const DomainMetadata& operand_side_metadata() const { + return *operand_side_metadata_; + } + // Retrieves the user side metadata of a kDomain instruction. + const DomainMetadata& user_side_metadata() const { + return *user_side_metadata_; + } + + static bool ClassOf(const HloInstruction* hlo) { + return hlo->opcode() == HloOpcode::kDomain; + } + + private: + void PrintExtraAttributesImpl(AttributePrinter& printer, + const HloPrintOptions& options) const override; + bool IdenticalSlowPath( + const HloInstruction& other, + absl::FunctionRef + eq_computations) const override; + // Implementation for non-common logic of CloneWithNewOperands. + std::unique_ptr CloneWithNewOperandsImpl( + const Shape& shape, absl::Span new_operands, + HloCloneContext* context) const override; + + std::unique_ptr operand_side_metadata_; + std::unique_ptr user_side_metadata_; +}; + +class HloGetDimensionSizeInstruction : public HloInstruction { + public: + explicit HloGetDimensionSizeInstruction(const Shape& shape, + HloInstruction* operand, + int64_t dimension); + + // Returns the dimension sizes or numbers associated with this instruction. + int64_t dimension() const { return dimension_; } + // Returns a serialized representation of this instruction. + HloInstructionProto ToProto() const override; + + static bool ClassOf(const HloInstruction* hlo) { + return hlo->opcode() == HloOpcode::kGetDimensionSize; + } + + private: + void PrintExtraAttributesImpl(AttributePrinter& printer, + const HloPrintOptions& options) const override; + bool IdenticalSlowPath( + const HloInstruction& other, + absl::FunctionRef + eq_computations) const override; + // Implementation for non-common logic of CloneWithNewOperands. + std::unique_ptr CloneWithNewOperandsImpl( + const Shape& shape, absl::Span new_operands, + HloCloneContext* context) const override; + + int64_t dimension_; +}; + +class HloSetDimensionSizeInstruction : public HloInstruction { + public: + explicit HloSetDimensionSizeInstruction(const Shape& shape, + HloInstruction* operand, + HloInstruction* val, + int64_t dimension); + + // Returns the dimension sizes or numbers associated with this instruction. + int64_t dimension() const { return dimension_; } + // Returns a serialized representation of this instruction. + HloInstructionProto ToProto() const override; + + static bool ClassOf(const HloInstruction* hlo) { + return hlo->opcode() == HloOpcode::kSetDimensionSize; + } + + private: + void PrintExtraAttributesImpl(AttributePrinter& printer, + const HloPrintOptions& options) const override; + bool IdenticalSlowPath( + const HloInstruction& other, + absl::FunctionRef + eq_computations) const override; + // Implementation for non-common logic of CloneWithNewOperands. + std::unique_ptr CloneWithNewOperandsImpl( + const Shape& shape, absl::Span new_operands, + HloCloneContext* context) const override; + + int64_t dimension_; +}; + +class HloRngGetAndUpdateStateInstruction : public HloInstruction { + public: + explicit HloRngGetAndUpdateStateInstruction(const Shape& shape, + int64_t delta); + + // Returns the delta value. + int64_t delta() const { return delta_; } + void set_delta(int64_t delta) { delta_ = delta; } + // Returns a serialized representation of this instruction. + HloInstructionProto ToProto() const override; + + static bool ClassOf(const HloInstruction* hlo) { + return hlo->opcode() == HloOpcode::kRngGetAndUpdateState; + } + + private: + void PrintExtraAttributesImpl(AttributePrinter& printer, + const HloPrintOptions& options) const override; + bool IdenticalSlowPath( + const HloInstruction& other, + absl::FunctionRef + eq_computations) const override; + // Implementation for non-common logic of CloneWithNewOperands. + std::unique_ptr CloneWithNewOperandsImpl( + const Shape& shape, absl::Span new_operands, + HloCloneContext* context) const override; + + int64_t delta_; +}; + +class HloRngBitGeneratorInstruction : public HloInstruction { + public: + HloRngBitGeneratorInstruction(const Shape& shape, HloInstruction* state, + RandomAlgorithm algorithm); + + RandomAlgorithm algorithm() const { return algorithm_; } + HloInstructionProto ToProto() const override; + + static bool ClassOf(const HloInstruction* hlo) { + return hlo->opcode() == HloOpcode::kRngBitGenerator; + } + + private: + void PrintExtraAttributesImpl(AttributePrinter& printer, + const HloPrintOptions& options) const override; + bool IdenticalSlowPath( + const HloInstruction& other, + absl::FunctionRef + eq_computations) const override; + std::unique_ptr CloneWithNewOperandsImpl( + const Shape& shape, absl::Span new_operands, + HloCloneContext* context) const override; + + RandomAlgorithm algorithm_; +}; + +} // namespace xla + +#endif // XLA_HLO_IR_HLO_INSTRUCTIONS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/hlo_module.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/hlo_module.h new file mode 100644 index 0000000000000000000000000000000000000000..c448cfa76a261d60c7b72dd9ec0a4c4405b620c2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/hlo_module.h @@ -0,0 +1,732 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_HLO_IR_HLO_MODULE_H_ +#define XLA_HLO_IR_HLO_MODULE_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "absl/container/flat_hash_map.h" +#include "absl/strings/cord.h" +#include "absl/strings/string_view.h" +#include "absl/types/span.h" +#include "xla/hlo/ir/dynamic_parameter_binding.h" +#include "xla/hlo/ir/hlo_clone_context.h" +#include "xla/hlo/ir/hlo_computation.h" +#include "xla/hlo/ir/hlo_input_output_alias_config.h" +#include "xla/hlo/ir/hlo_instruction.h" +#include "xla/hlo/ir/hlo_module_metadata.h" +#include "xla/hlo/ir/hlo_schedule.h" +#include "xla/iterator_util.h" +#include "xla/printer.h" +#include "xla/service/compilation_environments.h" +#include "xla/service/hlo.pb.h" +#include "xla/service/hlo_module_config.h" +#include "xla/service/name_uniquer.h" +#include "xla/xla.pb.h" +#include "tsl/lib/gtl/iterator_range.h" +#include "tsl/platform/logging.h" + +namespace xla { + +using LayoutCanonicalizationCallback = + std::function, Shape>>( + const HloModule& module)>; + +// Describes a compilation unit at the HLO level. +// +// HloModule is the top-level unit in the HLO IR. It corresponds to a whole +// "program". Running a module, from beginning to end, is the only way to run +// an XLA program. +// +// A module contains one "entry computation"; this HloComputation is like main() +// in a C program. The result of running the module is the result of running +// this computation. +// +// A module also contains some number of "nested computations". Each nested +// computation is attached to an HloInstruction within some other computation. +// The meaning of the nested computation depends on the instruction it's +// attached to. +class HloModule { + public: + // Constructor. + HloModule(const std::string& name, HloModuleConfig config); + // REQUIRED: + // - comp_envs must not be null. + HloModule(const std::string& name, HloModuleConfig config, + std::unique_ptr comp_envs); + virtual ~HloModule() = default; + + // Adds an entry computation to the module. A module can only have one entry + // computation. Returns a pointer to the newly added computation. + HloComputation* AddEntryComputation( + std::unique_ptr computation); + + // Same as the AddEntryComputation function above but the module's + // entry_computation_layout is updated to match the layout of the new entry + // computation. + HloComputation* AddEntryComputationWithLayouts( + std::unique_ptr computation); + + // Replaces the current entry computation with another computation. + // The new entry computation must be a computation that is already in the + // module. + void ReplaceEntryComputation(HloComputation* entry_computation); + + // Adds an embedded computation to the module. + HloComputation* AddEmbeddedComputation( + std::unique_ptr computation); + + // Removes an embedded computation. + Status RemoveEmbeddedComputation(HloComputation* to_remove); + + // Removes unused computations. + Status RemoveUnusedComputations(); + + // Marks duplicate fusions with the same name to be able to group them for + // analysis purposes (e.g. through Xprof). + void MarkFusionDuplications( + const absl::flat_hash_map& + replacements); + + // Replaces all uses of computations that are keys of 'replacements' with + // the corresponding values in 'replacements'. Replaces the entry computation, + // if applicable. + // + // This function iterates over all instructions in the module to find + // computations to replace. We could speed it up by keeping track of users of + // computations. + // + // N.B.: This function does not update the computations_ field of the + // HloModule with the newly added compututations. Therefore, along with + // invoking this function, if a replacement computation is not already present + // in module, it should be separately added into the module using + // `AddEmbeddedComputation`. + void ReplaceComputations( + const absl::flat_hash_map& + replacements); + + const std::string& name() const { return name_; } + void set_name(std::string name) { name_ = std::move(name); } + + // Move computations from the input module to this one, while ensuring that + // the names of instructions within the computations are unchanged. + void MoveComputationsFrom(HloModule* module, bool make_names_unique = false); + + // Returns a deep copy of this module including all computations. + std::unique_ptr Clone(const std::string& suffix = "clone") const; + std::unique_ptr Clone(const HloModuleConfig& config, + const std::string& suffix = "clone") const; + + // Performs a deep clone of the computation, by recursively cloning all + // the called computations as well. If the clone context is specified, it + // will be populated with the cloned object mappings. + HloComputation* DeepCloneComputation(HloComputation* computation, + HloCloneContext* context = nullptr); + + // Return a pointer to the entry computation of the module. + HloComputation* entry_computation() const { + CHECK_NE(nullptr, entry_computation_); + return entry_computation_; + } + + bool has_entry_computation() const { return entry_computation_ != nullptr; } + + // Returns the root instruction shape of entry computation. + // + // Precondition: entry_computation_ is not nullptr. + const Shape& result_shape() const { + CHECK_NE(nullptr, entry_computation_); + return entry_computation()->root_instruction()->shape(); + } + + // Creates the ComputationLayout which describes the current status of the HLO + // module entry computation. + ComputationLayout compute_computation_layout() const { + return ComputationLayout(entry_computation()->ComputeProgramShape(), + /*ignore_layouts=*/false); + } + + ComputationLayout* mutable_entry_computation_layout() { + return config_.mutable_entry_computation_layout(); + } + + const ComputationLayout& entry_computation_layout() const { + return config_.entry_computation_layout(); + } + + void set_frontend_attributes(FrontendAttributes frontend_attributes) { + frontend_attributes_ = std::move(frontend_attributes); + } + + void add_frontend_attributes(FrontendAttributes frontend_attributes) { + frontend_attributes_.mutable_map()->insert( + frontend_attributes.map().begin(), frontend_attributes.map().end()); + } + + const FrontendAttributes& frontend_attributes() const { + return frontend_attributes_; + } + + void set_use_auto_spmd_partitioning(bool use) { + use_auto_spmd_partitioning_ = use; + } + + bool use_auto_spmd_partitioning() const { + return use_auto_spmd_partitioning_; + } + + // Based on module's entry_computation sharded shapes, + // layout_canonicalization_callback_ computes and + // returns for module's entry computation. + // argument_layouts is std::vector and results_layout is Shape. + // layout_canonicalization_callback_ is used only when + // use_auto_spmd_partitioning_ = true. + void set_layout_canonicalization_callback( + LayoutCanonicalizationCallback callback) { + layout_canonicalization_callback_ = std::move(callback); + } + + LayoutCanonicalizationCallback layout_canonicalization_callback() const { + return layout_canonicalization_callback_; + } + + // Generates a hash value of an HLO module. Hash considers + // information on opcode, shape, operands, and typically a root instruction. + // This function returns the same hash value for equivalent HLO modules, + // with respect to HloInstruction::Identical() method. + template + friend H AbslHashValue(H h, const HloModule& module) { + h = H::combine(std::move(h), module.entry_computation_layout()); + // Use MakeComputationSorted() instead of MakeComputationPostOrder() + // because naming may affect the order of MakeComputationPostOrder() but not + // MakeComputationSorted(). + auto computations = module.MakeComputationSorted(); + for (auto* computation : computations) { + h = H::combine(std::move(h), *computation); + } + return H::combine(std::move(h), computations.size()); + } + + // Gets the computations in this module. + // + // Returns a view of HloComputation*s, so you can iterate over this in the + // natural way: + // + // for (HloComputation* c : module->computations()) { ... } + // + tsl::gtl::iterator_range>::const_iterator>> + computations() const { + return {MakeUnwrappingIterator(computations_.begin()), + MakeUnwrappingIterator(computations_.end())}; + } + tsl::gtl::iterator_range>::iterator>> + computations() { + return {MakeUnwrappingIterator(computations_.begin()), + MakeUnwrappingIterator(computations_.end())}; + } + + // Similar as above, but return a filtered view of computations for specified + // `execution_threads`. Empty `execution_threads` list means all execution + // threads are included. + tsl::gtl::iterator_range>::const_iterator, + std::function>> + computations( + const absl::flat_hash_set& execution_threads) const { + // Pass execution_threads by value to the predicate to ensure it lives + // beyond this function. + std::function pred = + [execution_threads](const HloComputation* computation) { + if (execution_threads.empty()) { + return true; + } + return execution_threads.contains(computation->execution_thread()); + }; + return MakeFilteringUnwrappingIteratorRange(computations_.begin(), + computations_.end(), pred); + } + + // Returns the computation in this module that has the name `name`. Returns + // null if there is no such computation. + HloComputation* GetComputationWithName(absl::string_view name); + + // Gets the number of computations in this module. + int64_t computation_count() const { return computations_.size(); } + + // Returns the mutable computation for the given index. + HloComputation* mutable_computation(int64_t idx) { + CHECK(idx >= 0 && idx < computations_.size()); + return computations_[idx].get(); + } + + // Gets the number of instructions in this module. + int64_t instruction_count() const; + + // Deallocate removed instructions in each computation. + void Cleanup() { + for (auto& comp : computations_) { + comp->Cleanup(); + } + } + + // Compute and return a post order of all computations in the module. The sort + // is defined like so: if computation A has an instruction which calls + // computation B, then A will appear after B in the sort. + std::vector MakeComputationPostOrder() const { + return MakeComputationPostOrder({}); + } + // Similar as above but only returns computations with specified + // `execution_threads`. Empty `execution_threads` list means all execution + // threads are included. + std::vector MakeComputationPostOrder( + const absl::flat_hash_set& execution_threads) const; + // Same as MakeComputationPostOrder() but only returns the computations that + // are on specified `execution_threads` and are also found in the passed in + // allowList. Empty `execution_threads` list means all execution threads are + // included. + std::vector MakeComputationPostOrder( + const absl::flat_hash_set& execution_threads, + const absl::flat_hash_set& allow_list) const; + + // If config().content_aware_computation_sorting() is true, sorts computations + // by their contents, otherwise returns MakeComputationPostOrder(). + std::vector MakeComputationSorted() const { + return MakeComputationSorted({}); + } + // Same as above but only for specified `execution_threads`. Empty + // `execution_threads` list means all execution threads are included. + std::vector MakeComputationSorted( + const absl::flat_hash_set& execution_threads) const; + + // Gets the computations in this module which aren't for fusion nodes. + // + // Postcondition: All computations in the returned list have + // !IsFusionComputation(). + // + // Note: Callers can and do rely on the return value here being a *snapshot* + // of the module's non-fusion computations -- that is, it's OK to add or + // remove computations from a module while iterating over + // MakeNonfusionComputations(). + std::vector MakeNonfusionComputations() const { + return MakeNonfusionComputations({}); + } + // Same as above but only for specified `execution_threads`. Empty + // `execution_threads` list means all execution threads are included. + std::vector MakeNonfusionComputations( + const absl::flat_hash_set& execution_threads) const; + + // Same as MakeNonfusionComputations() but sorting computations by content. + std::vector MakeNonfusionComputationsSorted() const { + return MakeNonfusionComputationsSorted({}); + } + // Same as above but only for specified `execution_threads`. Empty + // `execution_threads` list means all execution threads are included. + std::vector MakeNonfusionComputationsSorted( + const absl::flat_hash_set& execution_threads) const; + + HloModuleConfig& config() { return config_; } + const HloModuleConfig& config() const { return config_; } + void set_config(const HloModuleConfig& config) { config_ = config; } + + bool is_dynamic() const { return is_dynamic_; } + void set_is_dynamic(bool is_dynamic) { is_dynamic_ = is_dynamic; } + + // Prints a string representation of the module. + // + // (We express the default options using an overload rather than a default + // param because gdb ignores default params, but does resolve overloads.) + void Print(Printer* printer) const { + return Print(printer, HloPrintOptions::Default()); + } + void Print(Printer* printer, const HloPrintOptions& options) const; + + // Return a string representation of the module. + // + // (We express the default options using an overload rather than a default + // param because gdb ignores default params, but does resolve overloads.) + std::string ToString() const { return ToString(HloPrintOptions::Default()); } + std::string ToString(const HloPrintOptions& options) const; + + // Returns a Cord representation of the module. + // + // (We express the default options using an overload rather than a default + // param because gdb ignores default params, but does resolve overloads.) + absl::Cord ToCord() const { return ToCord(HloPrintOptions::Default()); } + absl::Cord ToCord(const HloPrintOptions& options) const; + + // Convert an HloModule to or from a proto. + HloModuleProto ToProto() const; + static StatusOr> CreateFromProto( + const HloModuleProto& proto, const HloModuleConfig& module_config, + bool prohibit_empty_literal = true); + + // Convert an HloModule to or from a proto that includes module configuration + StatusOr ToProtoWithConfig() const; + static StatusOr> CreateFromProtoWithConfig( + const HloModuleProtoWithConfig& proto, + bool prohibit_empty_literal = true); + + // Creates and returns an HloModuleConfig with an appropriate program shape + // for the HLO module in the given proto. + static StatusOr CreateModuleConfigFromProto( + const HloModuleProto& module, const DebugOptions& debug_options, + const ExecutionOptions* execution_options = nullptr); + + // Creates and returns an HloModuleConfig with an appropriate program shape + // for the HLO module in the given proto. + static StatusOr CreateModuleConfigFromShape( + const ProgramShape& program_shape, const DebugOptions& debug_options, + const ExecutionOptions* execution_options = nullptr); + + // Outlines the given expression from the given computation. + // instructions_to_outline contains the instructions that form the expression. + // + // Precondition: instructions in instructions_to_outline are in topological + // order (root of outlined instructions last). TODO(jingyue): takes a set of + // instructions and topologically sorts them. + HloInstruction* OutlineExpressionFromComputation( + absl::Span instructions_to_outline, + const std::string& outlined_computation_name, + HloComputation* computation); + + // Returns a randomly generated uint64_t. + uint64_t RandomNew64() const; + + // Returns the NameUniquer for uniquing instruction names in this module. + NameUniquer& instruction_name_uniquer() { return instruction_name_uniquer_; } + + // Assign a new unique dense id for an instruction + int NewUniqueInstructionId() { + int result = next_unique_id_; + next_unique_id_++; + return result; + } + + // input_output_alias_config indicates the list of aliased buffers that are + // expected from the module. + HloInputOutputAliasConfig& input_output_alias_config() { + return input_output_alias_config_; + } + const HloInputOutputAliasConfig& input_output_alias_config() const { + return input_output_alias_config_; + } + + // buffer_donor_config_ indicates the set of input buffer donors that are + // expected from the module. + HloBufferDonorConfig& buffer_donor_config() { return buffer_donor_config_; } + const HloBufferDonorConfig& buffer_donor_config() const { + return buffer_donor_config_; + } + + // Returns an id that is unique to this module across all modules created over + // the lifetime of this process. + int unique_id() const { return unique_id_; } + + // Sets the schedule of the module to the given schedule. + Status set_schedule(HloSchedule schedule); + + // Clears the schedule of the module. + void clear_schedule() { schedule_.reset(); } + + // Returns true if the module has a schedule set. + bool has_schedule() const { return schedule_.has_value(); } + + // Returns the schedule of the module. CHECK fails if no schedule is set. + const HloSchedule& schedule() const { return *schedule_; } + HloSchedule& schedule() { return *schedule_; } + + HloComputation* AddComputationAndUnifyNamesAndIds( + std::unique_ptr computation, bool is_entry) { + computation->ClearUniqueIdInternal(); + for (auto* instruction : computation->instructions()) { + instruction->ClearUniqueIdInternal(); + } + return AddComputationInternal(std::move(computation), is_entry, + /*uniquify_identifiers=*/true, + /*preserve_entry_layouts=*/true); + } + + void SetAndUniquifyInstrName(HloInstruction* instr, absl::string_view name) { + instr->SetAndSanitizeName(name); + instr->UniquifyName(&instruction_name_uniquer_); + } + + Status CheckUniqueNamesAndIdsForComputationsAndInstructions() const; + + // Checks if this config has a list of entry parameters' HLO shardings for + // SPMD. + bool has_spmd_parameters_shardings() const { + return spmd_parameters_shardings_.has_value(); + } + + // Getter and setter for the list of entry parameters' HLO shardings for SPMD. + const std::vector& spmd_parameters_shardings() const { + CHECK(spmd_parameters_shardings_.has_value()); + return *spmd_parameters_shardings_; + } + void set_spmd_parameters_shardings( + const std::vector& shardings) { + spmd_parameters_shardings_ = shardings; + } + + // Checks if this config has the entry computation output's HLO sharding for + // SPMD. + bool has_spmd_output_sharding() const { + return spmd_output_sharding_.has_value(); + } + + // Getter and setter for the entry computation output's HLO shardings for + // SPMD. + const HloSharding& spmd_output_sharding() const { + CHECK(spmd_output_sharding_.has_value()); + return *spmd_output_sharding_; + } + void set_spmd_output_sharding(const HloSharding& sharding) { + spmd_output_sharding_ = sharding; + } + + // Describes a buffer to be used for cross program prefetching. + struct CrossProgramPrefetchInfo { + // The parameter to prefetch. + int64_t parameter; + // Index of the buffer within a tuple-typed parameter. + ShapeIndex index; + // Offset into alt memory where the cross program pretched buffer will be + // stored. + std::optional alt_memory_offset; + }; + + // Add a program argument to be prefetched across programs. + void AddCrossProgramPrefetch( + int64_t parameter, const ShapeIndex& index, + std::optional alt_memory_offset = std::nullopt) { + cross_program_prefetches_.emplace_back( + CrossProgramPrefetchInfo{parameter, index, alt_memory_offset}); + } + + Status SetCrossProgramPrefetchOffset(int64_t prefetch_index, int64_t offset) { + TF_RET_CHECK(prefetch_index < cross_program_prefetches_.size()); + auto& [parameter, index, optional_offset] = + cross_program_prefetches_[prefetch_index]; + TF_RET_CHECK(!optional_offset.has_value()); + optional_offset = offset; + return OkStatus(); + } + + // Get the list of program arguments to be prefetch across programs. + absl::Span CrossProgramPrefetches() const { + return cross_program_prefetches_; + } + + const HloModuleMetadata& metadata() const { return metadata_; } + HloModuleMetadata* metadata() { return &metadata_; } + + // Moves (not copies) metadata from this HloModule to `module`. To be used + // in cases like HloModuleGroup::ReplaceModule when metadata should be + // transferred out of a module before it's destroyed. + void MoveMetadataToModule(HloModule* module) { + module->metadata_ = std::move(metadata_); + } + + int64_t profile_version() const { return profile_version_; } + + void set_profile_version(int64_t profile_version) { + profile_version_ = profile_version; + } + + void add_profile_info(const HloModuleProto::ProfileInfo& profile_info) { + profile_info_list_.push_back(profile_info); + } + + void set_profile_info( + const std::vector& profile_info) { + profile_info_list_ = profile_info; + } + + const std::vector& profile_info() const { + return profile_info_list_; + } + + void set_autofdo_profile_key(HloModuleProto::ProfileType profile_type, + absl::string_view profile_key) { + autofdo_profile_keys_[profile_type] = std::string(profile_key); + } + + void set_autofdo_profile_keys( + const absl::flat_hash_map& + profile_keys) { + for (const auto& [profile_type, profile_key] : profile_keys) { + autofdo_profile_keys_[profile_type] = profile_key; + } + } + + const absl::flat_hash_map& + autofdo_profile_keys() const { + return autofdo_profile_keys_; + } + + bool has_module_autofdo_profiles() const { + return !autofdo_profile_keys_.empty(); + } + + void set_relative_speedup(double relative_speedup) { + relative_speedup_ = relative_speedup; + } + + // Sets the **unoptimized** fingerprint for the module. This fingerprint is + // prior to any optimizations. + void set_autofdo_fingerprint(absl::string_view fingerprint) { + autofdo_fingerprint_ = std::string(fingerprint); + } + + absl::string_view autofdo_fingerprint() const { return autofdo_fingerprint_; } + + CompilationEnvironments& comp_envs() const { return *comp_envs_; } + + // Get 128-bit fingerprint of the module by printing it using the given print + // options. + std::string GetFingerprint128(const HloPrintOptions& options = + HloPrintOptions::ModuleFingerprint()) const; + + // Describes a stack frame. + struct StackFrame { + std::string_view file_name; + std::string_view function_name; + int line = 0; + int column = 0; + + // 1-based index of the parent frame. + // 0 value indicates that the current frame is the root. + int parent_frame_id = 0; + + bool empty() const { + return line == 0 && column == 0 && file_name.empty() && + function_name.empty(); + } + }; + + // Getter for the specific stack frame. Argument is a 1-based index. + StackFrame get_stack_frame(int id) const; + + private: + HloComputation* AddComputationInternal( + std::unique_ptr computation, bool is_entry, + bool uniquify_identifiers, bool preserve_entry_layouts); + + std::string name_; + HloModuleConfig config_; + HloComputation* entry_computation_ = nullptr; + std::vector> computations_; + + // Random number generator engine to use when generating random numbers per + // HloModule compilation. + // TODO(b/25995601): Replace with better seed setting or dev/random for + // where we don't need deterministic execution. + mutable std::mt19937_64 rng_{42}; + mutable absl::Mutex rng_mutex_; + + // Unique name generator for computation and instruction names, which are + // unique per module. + NameUniquer computation_name_uniquer_{/*separator=*/"."}; + NameUniquer instruction_name_uniquer_{/*separator=*/"."}; + int next_unique_id_ = 0; + + // Used to keep track of the next unique module id that should be assigned. + static std::atomic next_unique_module_id_; + // A unique id to label modules with. + const int unique_id_; + + // The HloSchedule of the module. The schedule if it exists contains a + // sequential order of instructions for each non-fusion computation in the + // module. + std::optional schedule_; + + // alias_config indicates the alias information of input/output buffers that + // are expected from the module. + HloInputOutputAliasConfig input_output_alias_config_; + + // buffer_donor_config_ indicates the donor information of input buffers that + // are expected from the module. + HloBufferDonorConfig buffer_donor_config_; + + // Attributes passed from the frontend to give hints to the backend about + // how to compile this HLO. + FrontendAttributes frontend_attributes_; + + // The HLO shardings of the entry computation's parameters for + // SPMD-partitioned programs. + std::optional> spmd_parameters_shardings_; + + // The HLO sharding of the entry computation's output (root) for + // SPMD-partitioned programs. + std::optional spmd_output_sharding_; + + // Arguments to be prefetched across programs. + std::vector cross_program_prefetches_; + + // Metadata for this module, such as its canonical id and the HLO passes run. + HloModuleMetadata metadata_; + + // True if the module contains dynamic computation. + bool is_dynamic_ = false; + + // Optional compilation profile handle. + int64_t profile_version_ = 0; + + // An array of ProfileInfo specifying what optimization profiles this module + // contains, along with the relative speedups. + std::vector profile_info_list_; + + // Relative speedup of best config compared to default config. + double relative_speedup_; + + // The unoptimized module fingerprint. + std::string autofdo_fingerprint_; + + // The keys used to retrieve the optimization profiles this module is compiled + // with, per profile type. + absl::flat_hash_map + autofdo_profile_keys_; + + bool use_auto_spmd_partitioning_ = false; + + // Layout canonicalization callback, used only when + // use_auto_spmd_partitioning_ = true. + LayoutCanonicalizationCallback layout_canonicalization_callback_; + + // Compilation environments (protos that carry command line flags and + // environment variables). + std::unique_ptr comp_envs_ = + std::make_unique(); + + // Stack frame indexes flat representation. + std::optional stack_frame_index_; +}; + +} // namespace xla + +#endif // XLA_HLO_IR_HLO_MODULE_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/hlo_module_group.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/hlo_module_group.h new file mode 100644 index 0000000000000000000000000000000000000000..c9afd22ec44e6010795eebd097be18492004581f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/hlo_module_group.h @@ -0,0 +1,117 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_HLO_IR_HLO_MODULE_GROUP_H_ +#define XLA_HLO_IR_HLO_MODULE_GROUP_H_ + +#include +#include +#include +#include + +#include "absl/strings/string_view.h" +#include "absl/types/span.h" +#include "xla/hlo/ir/hlo_module.h" +#include "xla/service/hlo.pb.h" + +namespace xla { + +// An abstraction representing a ordered set of HLO module built to run +// concurrently across different devices. +class HloModuleGroup { + public: + // Construct an empty module group. + explicit HloModuleGroup(absl::string_view name) : name_(name) {} + + // Construct a module group containing a single module. + explicit HloModuleGroup(std::unique_ptr module); + + // Construct a module group containing any number of modules. + HloModuleGroup(absl::string_view name, + absl::Span> modules); + HloModuleGroup(absl::string_view name, + std::vector>&& modules); + + // Returns the modules contained in the group. + const std::vector& modules() const { return module_ptrs_; } + + // Returns a module at a particular index. + HloModule& module(int index) const { return *module_ptrs_.at(index); } + + // Add a module to the back of vector of modules in the group. + void push_back(std::unique_ptr module); + + // Replaces the existing module at the given index with the given module. The + // existing module is discarded. + void ReplaceModule(int index, std::unique_ptr module); + + // Moves all modules from the group into the returned vector. After this + // method runs, the module group will be empty. + std::vector> ConsumeModules(); + + std::string name() const { return name_; } + + std::string ToString() const; + + // Deallocate removed instructions in each module. + void Cleanup() { + for (auto& module : modules_) { + module->Cleanup(); + } + } + + template + friend H AbslHashValue(H h, const HloModuleGroup& group) { + for (auto& module : group.modules_) { + h = H::combine(std::move(h), *module); + } + return H::combine(std::move(h), group.modules_.size()); + } + + // Serialize the module group to/from a proto. + HloModuleGroupProto ToProto() const; + static StatusOr CreateFromProto( + const HloModuleGroupProto& proto, + absl::Span module_configs); + + // Returns the number of modules in the module group. + int size() const { return modules_.size(); } + + // Returns true if there are no modules in the module group. + bool empty() const { return modules_.empty(); } + + absl::string_view cache_key() const { return cache_key_; } + void set_cache_key(absl::string_view cache_key) { + cache_key_ = std::string(cache_key); + } + + private: + std::string name_; + + // Vector of modules as std::unique_ptrs. + std::vector> modules_; + + // Vector of modules as normal pointers. This vector is kept in sync with + // modules_ as modules are added to the group with push_back. + std::vector module_ptrs_; + + std::string cache_key_; +}; + +std::ostream& operator<<(std::ostream& out, const HloModuleGroup& group); + +} // namespace xla + +#endif // XLA_HLO_IR_HLO_MODULE_GROUP_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/hlo_module_metadata.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/hlo_module_metadata.h new file mode 100644 index 0000000000000000000000000000000000000000..27fcc5361348e52a5b07b9122e88a15d43858ee5 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/hlo_module_metadata.h @@ -0,0 +1,134 @@ +/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_HLO_IR_HLO_MODULE_METADATA_H_ +#define XLA_HLO_IR_HLO_MODULE_METADATA_H_ + +#include +#include +#include +#include + +#include "xla/service/hlo.pb.h" +#include "xla/status_macros.h" +#include "xla/util.h" +#include "tsl/platform/env.h" + +namespace xla { + +// Wrapper class for HloModuleMetadataProto to avoid allowing callers to mutate +// arbitrary fields. Specifically, callers cannot set timestamps or ids or +// set the fields of any pass not currently running. +class HloModuleMetadata { + public: + explicit HloModuleMetadata(tsl::Env* env) : env_(env) {} + + const HloModuleMetadataProto& proto() const { return module_metadata_; } + + // Creates a new HloPassMetadata. All calls to RecordPassStart should be + // matched by a later call to RecordPassEnd. + void RecordPassStart(); + + // Marks the currently running pass as finished. Returns NotFound if metadata + // for the currently running pass cannot be found. + Status RecordPassEnd(); + + const std::optional& prepartitioning_metadata() + const { + return prepartitioning_metadata_; + } + void set_prepartitioning_metadata( + const HloModuleMetadata& prepartitioning_metadata); + + // Setters for HloModuleMetadataProto. + void set_module_group_name(const std::string& name) { + module_metadata_.set_module_group_name(name); + } + void set_canonical_module_id(int64_t id) { + module_metadata_.set_canonical_module_id(id); + } + void add_partitioned_module_id(int64_t id) { + module_metadata_.add_partitioned_module_ids(id); + } + + StatusOr current_pass_id() { + TF_ASSIGN_OR_RETURN(HloPassMetadata * pass_metadata, + GetCurrentHloPassMetadata()); + return pass_metadata->pass_id(); + } + + // Setters for the current HloPassMetadata. + Status set_current_pass_name(const std::string& pass_name) { + return MutateCurrentHloPassMetadata( + [&pass_name](HloPassMetadata* pass_metadata) { + pass_metadata->set_pass_name(pass_name); + }); + } + Status set_current_pass_pipeline_name(const std::string& pipeline_name) { + return MutateCurrentHloPassMetadata( + [&pipeline_name](HloPassMetadata* pass_metadata) { + pass_metadata->set_pipeline_name(pipeline_name); + }); + } + Status add_current_pass_dump_filename(const std::string& dump_filename) { + return MutateCurrentHloPassMetadata( + [&dump_filename](HloPassMetadata* pass_metadata) { + pass_metadata->add_dump_filenames(dump_filename); + }); + } + Status set_current_pass_module_changed(bool module_changed) { + return MutateCurrentHloPassMetadata( + [&module_changed](HloPassMetadata* pass_metadata) { + pass_metadata->set_module_changed(module_changed); + }); + } + Status set_current_pass_module_id(int64_t module_id) { + return MutateCurrentHloPassMetadata( + [&module_id](HloPassMetadata* pass_metadata) { + pass_metadata->set_module_id(module_id); + }); + } + Status add_current_pass_module_group_module_id(int64_t module_id) { + return MutateCurrentHloPassMetadata( + [&module_id](HloPassMetadata* pass_metadata) { + pass_metadata->add_module_group_module_ids(module_id); + }); + } + + private: + // Gets mutable metadata for the currently running pass. If passes are nested, + // finds the deepest one still running. Returns NotFound if metadata for the + // currently running pass cannot be found. + StatusOr GetCurrentHloPassMetadata(); + + Status MutateCurrentHloPassMetadata( + absl::FunctionRef mutator); + + HloModuleMetadataProto module_metadata_; + tsl::Env* env_; + int64_t next_pass_id_ = 1; + + // Stack of metadata for passes that are currently running. Size > 1 iff + // passes are nested. + std::vector running_passes_; + + // Metadata from before the module was partitioned, if applicable. + std::optional prepartitioning_metadata_ = + std::nullopt; +}; + +} // namespace xla + +#endif // XLA_HLO_IR_HLO_MODULE_METADATA_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/hlo_op_metadata.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/hlo_op_metadata.h new file mode 100644 index 0000000000000000000000000000000000000000..ebf7f51e597d2133a7a3d7bd64c187f63549aa73 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/hlo_op_metadata.h @@ -0,0 +1,27 @@ +/* Copyright 2021 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_HLO_IR_HLO_OP_METADATA_H_ +#define XLA_HLO_IR_HLO_OP_METADATA_H_ + +#include + +#include "xla/xla_data.pb.h" + +namespace xla { +std::string OpMetadataToString(const OpMetadata& metadata); +} // namespace xla + +#endif // XLA_HLO_IR_HLO_OP_METADATA_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/hlo_opcode.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/hlo_opcode.h new file mode 100644 index 0000000000000000000000000000000000000000..0bf4751cd5bc6b38954c269879a8bc168a958736 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/hlo_opcode.h @@ -0,0 +1,232 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_HLO_IR_HLO_OPCODE_H_ +#define XLA_HLO_IR_HLO_OPCODE_H_ + +#include +#include + +#include "absl/strings/string_view.h" +#include "xla/statusor.h" +#include "xla/xla_data.pb.h" + +namespace xla { + +// High-level optimizer instruction opcodes -- these are linear-algebra level +// opcodes. They are a flattened form of the UnaryOp, BinaryOp, ... opcodes +// present in the XLA service protobuf. +// +// See the XLA documentation for the semantics of each opcode. +// +// Each entry has the format: +// (enum_name, opcode_name, arity) +// +// Note: Do not use ':' in opcode names. It is used as a special character +// in these places: +// - In extended opcode strings (HloInstruction::ExtendedOpcodeString()), to +// separate the opcode from the fusion kind +// - In fully qualified names (HloInstruction::FullyQualifiedName()), to +// separate the qualifiers (name of the computation and potentially the +// fusion instruction) from the name +// +// If you change one of these opcodes, please make the corresponding change to +// the MHLO opset to keep both opsets synchronized. +// LINT.IfChange +#define HLO_OPCODE_LIST(V) \ + /* go/keep-sorted start */ \ + V(kAbs, "abs", 1) \ + V(kAdd, "add", 2) \ + V(kAddDependency, "add-dependency", 2) \ + V(kAfterAll, "after-all", kHloOpcodeIsVariadic) \ + V(kAllGather, "all-gather", kHloOpcodeIsVariadic) \ + V(kAllGatherDone, "all-gather-done", 1) \ + V(kAllGatherStart, "all-gather-start", kHloOpcodeIsVariadic) \ + V(kAllReduce, "all-reduce", kHloOpcodeIsVariadic) \ + V(kAllReduceDone, "all-reduce-done", 1) \ + V(kAllReduceStart, "all-reduce-start", kHloOpcodeIsVariadic) \ + V(kAllToAll, "all-to-all", kHloOpcodeIsVariadic) \ + V(kAnd, "and", 2) \ + V(kAsyncDone, "async-done", 1) \ + V(kAsyncStart, "async-start", kHloOpcodeIsVariadic) \ + V(kAsyncUpdate, "async-update", 1) \ + V(kAtan2, "atan2", 2) \ + V(kBatchNormGrad, "batch-norm-grad", 5) \ + V(kBatchNormInference, "batch-norm-inference", 5) \ + V(kBatchNormTraining, "batch-norm-training", 3) \ + V(kBitcast, "bitcast", 1) \ + V(kBitcastConvert, "bitcast-convert", 1) \ + V(kBroadcast, "broadcast", 1) \ + V(kCall, "call", kHloOpcodeIsVariadic) \ + V(kCbrt, "cbrt", 1) \ + V(kCeil, "ceil", 1) \ + V(kCholesky, "cholesky", 1) \ + V(kClamp, "clamp", 3) \ + V(kClz, "count-leading-zeros", 1) \ + V(kCollectivePermute, "collective-permute", kHloOpcodeIsVariadic) \ + V(kCollectivePermuteDone, "collective-permute-done", 1) \ + V(kCollectivePermuteStart, "collective-permute-start", kHloOpcodeIsVariadic) \ + V(kCompare, "compare", 2) \ + V(kComplex, "complex", 2) \ + V(kConcatenate, "concatenate", kHloOpcodeIsVariadic) \ + V(kConditional, "conditional", kHloOpcodeIsVariadic) \ + V(kConstant, "constant", 0) \ + V(kConvert, "convert", 1) \ + V(kConvolution, "convolution", 2) \ + V(kCopy, "copy", 1) \ + V(kCopyDone, "copy-done", 1) \ + V(kCopyStart, "copy-start", 1) \ + V(kCos, "cosine", 1) \ + V(kCustomCall, "custom-call", kHloOpcodeIsVariadic) \ + V(kDivide, "divide", 2) \ + V(kDomain, "domain", 1) \ + V(kDot, "dot", 2) \ + V(kDynamicReshape, "dynamic-reshape", kHloOpcodeIsVariadic) \ + V(kDynamicSlice, "dynamic-slice", kHloOpcodeIsVariadic) \ + V(kDynamicUpdateSlice, "dynamic-update-slice", kHloOpcodeIsVariadic) \ + V(kExp, "exponential", 1) \ + V(kExpm1, "exponential-minus-one", 1) \ + V(kFft, "fft", 1) \ + V(kFloor, "floor", 1) \ + V(kFusion, "fusion", kHloOpcodeIsVariadic) \ + V(kGather, "gather", 2) \ + V(kGetDimensionSize, "get-dimension-size", 1) \ + V(kGetTupleElement, "get-tuple-element", 1) \ + V(kImag, "imag", 1) \ + V(kInfeed, "infeed", 1) \ + V(kIota, "iota", 0) \ + V(kIsFinite, "is-finite", 1) \ + V(kLog, "log", 1) \ + V(kLog1p, "log-plus-one", 1) \ + V(kLogistic, "logistic", 1) \ + V(kMap, "map", kHloOpcodeIsVariadic) \ + V(kMaximum, "maximum", 2) \ + V(kMinimum, "minimum", 2) \ + V(kMultiply, "multiply", 2) \ + V(kNegate, "negate", 1) \ + V(kNot, "not", 1) \ + V(kOptimizationBarrier, "opt-barrier", 1) \ + V(kOr, "or", 2) \ + V(kOutfeed, "outfeed", 2) \ + V(kPad, "pad", 2) \ + V(kParameter, "parameter", 0) \ + V(kPartitionId, "partition-id", 0) \ + V(kPopulationCount, "popcnt", 1) \ + V(kPower, "power", 2) \ + V(kReal, "real", 1) \ + V(kRecv, "recv", 1) \ + V(kRecvDone, "recv-done", 1) \ + V(kReduce, "reduce", kHloOpcodeIsVariadic) \ + V(kReducePrecision, "reduce-precision", 1) \ + V(kReduceScatter, "reduce-scatter", kHloOpcodeIsVariadic) \ + V(kReduceWindow, "reduce-window", kHloOpcodeIsVariadic) \ + V(kRemainder, "remainder", 2) \ + V(kReplicaId, "replica-id", 0) \ + V(kReshape, "reshape", 1) \ + V(kReverse, "reverse", 1) \ + V(kRng, "rng", kHloOpcodeIsVariadic) \ + V(kRngBitGenerator, "rng-bit-generator", 1) \ + V(kRngGetAndUpdateState, "rng-get-and-update-state", 0) \ + V(kRoundNearestAfz, "round-nearest-afz", 1) \ + V(kRoundNearestEven, "round-nearest-even", 1) \ + V(kRsqrt, "rsqrt", 1) \ + V(kScatter, "scatter", kHloOpcodeIsVariadic) \ + V(kSelect, "select", 3) \ + V(kSelectAndScatter, "select-and-scatter", 3) \ + V(kSend, "send", 2) \ + V(kSendDone, "send-done", 1) \ + V(kSetDimensionSize, "set-dimension-size", 2) \ + V(kShiftLeft, "shift-left", 2) \ + V(kShiftRightArithmetic, "shift-right-arithmetic", 2) \ + V(kShiftRightLogical, "shift-right-logical", 2) \ + V(kSign, "sign", 1) \ + V(kSin, "sine", 1) \ + V(kSlice, "slice", 1) \ + V(kSort, "sort", kHloOpcodeIsVariadic) \ + V(kSqrt, "sqrt", 1) \ + V(kStochasticConvert, "stochastic-convert", 2) \ + V(kSubtract, "subtract", 2) \ + V(kTan, "tan", 1) \ + V(kTanh, "tanh", 1) \ + V(kTopK, "topk", 1) \ + V(kTranspose, "transpose", 1) \ + V(kTriangularSolve, "triangular-solve", 2) \ + V(kTuple, "tuple", kHloOpcodeIsVariadic) \ + V(kWhile, "while", 1) \ + V(kXor, "xor", 2) \ + /* go/keep-sorted end */ +// LINT.ThenChange(../../mlir_hlo/mhlo/IR/hlo_ops.td) + +enum class HloOpcode { +#define DECLARE_ENUM(enum_name, opcode_name, ...) enum_name, + HLO_OPCODE_LIST(DECLARE_ENUM) +#undef DECLARE_ENUM +}; + +// Arity value that denotes that an operator is variadic. +enum { + kHloOpcodeIsVariadic = -1, +}; + +// Returns a string representation of the opcode. +absl::string_view HloOpcodeString(HloOpcode opcode); + +// Retrieves the opcode enum by name if the opcode exists. +StatusOr StringToHloOpcode(absl::string_view opcode_name); + +inline std::ostream& operator<<(std::ostream& os, HloOpcode opcode) { + return os << HloOpcodeString(opcode); +} + +// Returns true iff the given opcode is a comparison operation. +bool HloOpcodeIsComparison(HloOpcode opcode); + +// Returns true iff the given opcode has variadic operands. +bool HloOpcodeIsVariadic(HloOpcode opcode); + +// Returns the arity of opcode. If the opcode is variadic, +// returns nullopt. +std::optional HloOpcodeArity(HloOpcode opcode); + +// Returns true if the given opcode is one of kAsyncStart, kAsyncUpdate, or +// kAsyncDone. +bool HloOpcodeIsAsync(HloOpcode opcode); + +// True if the op takes two arguments and order doesn't matter. +inline bool HloOpcodeIsBinaryCommutative(HloOpcode opcode) { + switch (opcode) { + case HloOpcode::kAdd: + case HloOpcode::kMultiply: + case HloOpcode::kMaximum: + case HloOpcode::kMinimum: + case HloOpcode::kAnd: + case HloOpcode::kOr: + case HloOpcode::kXor: + return true; + default: + return false; + } +} + +// Returns the number of HloOpcode values. +inline constexpr uint32_t HloOpcodeCount() { +#define HLO_COUNT_ONE(...) +1 +#define HLO_XLIST_LENGTH(list) list(HLO_COUNT_ONE) + return HLO_XLIST_LENGTH(HLO_OPCODE_LIST); +} + +} // namespace xla + +#endif // XLA_HLO_IR_HLO_OPCODE_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/hlo_reachability.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/hlo_reachability.h new file mode 100644 index 0000000000000000000000000000000000000000..bdceed946180dc3af7dd1a70127587737f072ad2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/hlo_reachability.h @@ -0,0 +1,211 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_HLO_IR_HLO_REACHABILITY_H_ +#define XLA_HLO_IR_HLO_REACHABILITY_H_ + +#include +#include +#include + +#include "absl/algorithm/container.h" +#include "absl/container/flat_hash_map.h" +#include "absl/types/span.h" +#include "xla/hlo/ir/hlo_computation.h" +#include "xla/hlo/ir/hlo_instruction.h" +#include "xla/hlo/ir/hlo_module.h" +#include "xla/types.h" + +namespace xla { + +// A class for representing reachability between HloInstructions. +// +// It has an adjacency matrix and it is up to the user of the class to set the +// adjacency matrix such that it represents reachability, i.e. such that it is +// transitive. That the graph be transitive is thus not an invariant of this +// class, but it is required for the name of the class and its methods to make +// sense. +class HloReachabilityMap { + public: + using Index = size_t; + + // Sets up a graph with no edges and where the nodes correspond to the given + // instructions. + explicit HloReachabilityMap( + absl::Span instructions); + + // Computes and returns the reachability between HLO instructions in the + // computation. The returned HloReachabilityMap is constructed such that + // HloReachabilityMap::IsReachable(a, b) returns true iff there exists a + // directed path (from producer to consumer) from 'a' to 'b'. Both data + // dependencies (operands) and control dependencies are considered for + // reachability. Trivially an instruction is reachable from itself. + static std::unique_ptr Build( + const HloComputation* computation); + + // Similar to the above Build operation except that it tries to identify + // paths between instructions that do not contain control instructions + // and multiple operands, i.e., b is_reachable a == true iff + // b = f(f(f(f(f(a), constant), constant), constant). + // Further, the only ops allowed in a path are basic math operations such + // as add, sub, mul, div. + static std::unique_ptr BuildWithRestrictions( + const HloComputation* computation, + absl::FunctionRef*)> + add_dependencies); + + // Set the reachability set of 'instruction' to the union of the reachability + // sets of 'inputs'. Upon return, IsReachable(x, instruction) where + // 'x' is not 'instruction' will return true iff IsReachable(x, input) is true + // for some 'input' in 'inputs'. Also sets 'instruction' to be reachable from + // itself. Returns whether the reachability set of 'instruction' changed. + // + // !!! THIS FUNCTION DOES NOT COMPUTE REACHABILITY !!! It sets the adjacency + // vector in the internal graph of this HloReachabilityMap for the given + // instruction and does not transitively update any other part of the + // adjacency matrix. + bool SetReachabilityToUnion(absl::Span inputs, + const HloInstruction* instruction); + + // As above, but faster because it does not check if the reachability changed. + void FastSetReachabilityToUnion( + absl::Span inputs, + const HloInstruction* instruction); + // As above, but use Index instead if it's already looked up which is even + // faster since no hash map lookup will occur. + void FastSetReachabilityToUnion(absl::Span input_indices, + Index index); + + Index GetIndex(const HloInstruction* instruction) const { + return indices_.at(GetKey(instruction)); + } + + // Sets entry so that IsReachable(a, b) will return true + // + // !!! THIS FUNCTION DOES NOT COMPUTE REACHABILITY !!! It sets the adjacency + // matrix in the internal graph of this HloReachabilityMap to have an edge + // from a to b and does not transitively update any other part of the + // adjacency matrix. + void SetReachable(const HloInstruction* a, const HloInstruction* b) { + SetReachable(GetIndex(a), GetIndex(b)); + } + void SetReachable(Index a, Index b) { bit_sets_[b].Set(a); } + + // Updates the given reachability map after the immediate predecessor set + // (operands and control predecessors) of 'instruction' has changed. + void UpdateReachabilityThroughInstruction(const HloInstruction* instruction); + + // Returns true if "b" is reachable from "a" + // + // Note that this function only correctly answers queries about reachability + // if the set of edges that have been provided to this class are transitive. + bool IsReachable(const HloInstruction* a, const HloInstruction* b) const { + return IsReachable(GetIndex(a), GetIndex(b)); + } + bool IsReachable(Index a, Index b) const { return bit_sets_[b].Get(a); } + + // Returns true if "b" is reachable from "a" or "a" is reachable from "b" + // + // Note that this function only correctly answers queries about reachability + // if the set of edges that have been provided to this class are transitive. + bool IsConnected(const HloInstruction* a, const HloInstruction* b) const { + return IsConnected(GetIndex(a), GetIndex(b)); + } + bool IsConnected(Index a, Index b) const { + return IsReachable(a, b) || IsReachable(b, a); + } + + // Checks if an instruction is in the Reachability map. + bool IsPresent(const HloInstruction* instruction) const { + return indices_.contains(GetKey(instruction)); + } + + // Replace the instruction "original" with "replacement" in the reachability + // map. + void Replace(const HloInstruction* original, + const HloInstruction* replacement); + + private: + // A dynamically sized bit-set implementation specialized for this use case + // providing fast bitwise OR (not available in tsl::gtl::BitMap). + class BitSet { + public: + BitSet() = default; + explicit BitSet(size_t size) + : size_(size), vector_((size + kBits - 1) / kBits, 0) {} + + // Returns the bit at the given index. + bool Get(Index index) const { + DCHECK(index >= 0 && index < size_); + return vector_[index / kBits] & (1ull << (index % kBits)); + } + + // Sets the bit at the given index. + void Set(Index index) { + DCHECK(index >= 0 && index < size_); + vector_[index / kBits] |= 1ull << (index % kBits); + } + + // Sets this bit-set to union of this bit-set and `other`. + void operator|=(const BitSet& other) { + for (size_t i = 0; i < vector_.size(); ++i) { + vector_[i] |= other.vector_[i]; + } + } + + // Sets the bitvector to all zeros. + void SetToZero() { absl::c_fill(vector_, 0); } + + bool operator==(const BitSet& other) const { + return vector_ == other.vector_; + } + bool operator!=(const BitSet& other) const { return !(*this == other); } + + private: + using Word = uint64_t; + static constexpr size_t kBits = 64; + + size_t size_; // Number of bits in the set. + std::vector vector_; + }; + + using Key = std::pair; // module ID, instruction ID. + static Key GetKey(const HloInstruction* instruction) { + return {instruction->GetModule()->unique_id(), instruction->unique_id()}; + } + + // Helper for SetReachabilityToUnion/FastSetReachabilityToUnion. + void SetReachabilityToUnionHelper( + absl::Span inputs, Index index); + void SetReachabilityToUnionHelper(absl::Span input_indices, + Index index); + + // Map from instruction to index. The index is used for bit_set_ and the bits + // within a BitSet. + absl::flat_hash_map indices_; + + // Bit-sets holding the reachability to each instruction. The bit-set for + // instruction X includes ones for each instruction which X is reachable from. + std::vector bit_sets_; + + // A temporary used by SetReachabilityToUnion to avoid an allocation with each + // call to the method. + BitSet tmp_bit_set_; +}; + +} // namespace xla + +#endif // XLA_HLO_IR_HLO_REACHABILITY_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/hlo_schedule.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/hlo_schedule.h new file mode 100644 index 0000000000000000000000000000000000000000..597ed2881a9eb5de0df8b328a733d6502476df89 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/hlo_schedule.h @@ -0,0 +1,221 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_HLO_IR_HLO_SCHEDULE_H_ +#define XLA_HLO_IR_HLO_SCHEDULE_H_ + +#include +#include +#include +#include + +#include "absl/algorithm/container.h" +#include "absl/container/flat_hash_map.h" +#include "absl/strings/string_view.h" +#include "absl/types/span.h" +#include "xla/hlo/ir/hlo_computation.h" +#include "xla/hlo/ir/hlo_instruction.h" +#include "xla/status.h" + +namespace xla { + +class HloModule; + +// Class representing a sequence of HLO instructions such as the sequential +// execution order of an HLO computation. +class HloInstructionSequence { + public: + HloInstructionSequence() = default; + explicit HloInstructionSequence( + absl::Span instructions) { + for (HloInstruction* instruction : instructions) { + push_back(instruction); + } + } + + // Adds the instruction to the end of the sequence. + void push_back(HloInstruction* instruction) { + instruction_sequence_.push_back(instruction); + id_sequence_.push_back(instruction->unique_id()); + } + + // Removes the instruction from the sequence. + void remove_instruction(HloInstruction* instruction) { + auto instruction_it = std::find(instruction_sequence_.begin(), + instruction_sequence_.end(), instruction); + if (instruction_it != instruction_sequence_.end()) { + auto id_it = std::find(id_sequence_.begin(), id_sequence_.end(), + instruction->unique_id()); + instruction_sequence_.erase(instruction_it); + id_sequence_.erase(id_it); + } + } + + // Replaces the old instruction with the new instruction in the sequence. + void replace_instruction(HloInstruction* old_instruction, + HloInstruction* new_instruction) { + auto instruction_it = + std::find(instruction_sequence_.begin(), instruction_sequence_.end(), + old_instruction); + auto id_it = std::find(id_sequence_.begin(), id_sequence_.end(), + old_instruction->unique_id()); + CHECK(instruction_it != instruction_sequence_.end()) + << "Do not find instruction id " << old_instruction->unique_id(); + CHECK(id_it != id_sequence_.end()); + *instruction_it = new_instruction; + *id_it = new_instruction->unique_id(); + } + + // Clears the sequence of all instructions. + void clear() { + instruction_sequence_.clear(); + id_sequence_.clear(); + } + + int64_t size() const { return instruction_sequence_.size(); } + + // Returns the sequence of HLO instructions. + const std::vector& instructions() const { + return instruction_sequence_; + } + + // Returns the unique IDs of the instructions in the sequence (in order). + const std::vector& ids() const { return id_sequence_; } + + private: + // The sequence as HloInstructions. + std::vector instruction_sequence_; + + // The sequence of HLO instructions, represented by their unique IDs. The + // sequence is stored as both HloInstructions and unique IDs because the + // sequence may be referenced after transformations to the HLO graph and HLO + // pointers can be invalidated or recycled in this process (see + // HloSchedule::Update). + std::vector id_sequence_; +}; + +// A class representing a sequential schedule of instructions for an HLO +// module. A complete HLO schedule contains an instruction sequence for every +// non-fusion computation in the HLO module. +class HloSchedule { + public: + explicit HloSchedule(const HloModule* module) : module_(module) {} + + // (De)Serialize an HloSchedule to/from a HloScheduleProto. + static StatusOr CreateFromProto(const HloModule* module, + const HloScheduleProto& proto); + StatusOr ToProto() const; + + // Returns a reference to the sequence for the given computation. + const HloInstructionSequence& sequence( + const HloComputation* computation) const; + + // Returns the sequence for the given computation. An empty sequence is + // created if none exists for the computation. + HloInstructionSequence& GetOrCreateSequence( + const HloComputation* computation); + + // Sets the sequence for the given computation to the given sequence. + void set_sequence(const HloComputation* computation, + absl::Span sequence); + void set_sequence(const HloComputation* computation, + HloInstructionSequence sequence); + + // Returns a map from HloComputation unique ID to instruction sequence. The + // map contains all sequences in the schedule. + const absl::flat_hash_map& sequences() + const { + return sequences_; + } + + absl::flat_hash_map num_sequences_by_execution_thread() + const; + + // Returns true if the schedule has a sequence for the given computation. + bool is_computation_scheduled(const HloComputation* computation) const { + return sequences_.contains(computation->unique_id()); + } + + // Removes the computation from the sequences. + void remove_computation(const HloComputation* computation) { + auto it = sequences_.find(computation->unique_id()); + CHECK(it != sequences_.end()); + sequences_.erase(it); + execution_threads_.erase(computation->unique_id()); + } + + // Removes the instruction from the computation's sequence. + void remove_instruction(const HloComputation* computation, + HloInstruction* instruction) { + sequences_[computation->unique_id()].remove_instruction(instruction); + } + + // Replaces the old instruction with the new instruction in the computation's + // sequence. + void replace_instruction(const HloComputation* computation, + HloInstruction* old_instruction, + HloInstruction* new_instruction) { + sequences_[computation->unique_id()].replace_instruction(old_instruction, + new_instruction); + } + + // Updates the schedule for specified threads such that it is (again) a valid + // schedule for the module. This is used to update a schedule after the HLO + // module has been transformed in some way. In general, the only + // transformations to the module for which a schedule can be updated is the + // addition or removal of instructions and computations. + // + // Instructions in the module which also exist in the given schedule will + // remain in the same order in the updated schedule. Instructions which exist + // in the module but not in the given schedule will be placed as early as + // possible in the updated schedule. + Status Update( + const absl::flat_hash_set& execution_threads = {}); + + // Verifies that the given schedule is valid for the given module. + // Specifically, the schedule contains exactly the instructions in the + // non-fusion computations in the module and every dependency in the module is + // satisfied in the schedule. + Status Verify() const; + + std::string ToString() const; + + bool empty() const { return sequences_.empty(); } + + const HloModule* module() const { return module_; } + + private: + // Updates the instruction sequence for the given computation. + Status UpdateComputationSchedule(const HloComputation* computation); + + const HloModule* module_; + + // A map from computation unique ID to instruction sequence. Unique IDs are + // used rather than HloComputation pointers because HLO pointers are not + // unique across HLO transformations because pointers may be recycled. + absl::flat_hash_map sequences_; + + // A corresponding map of `sequences_`, mapping the computation unique ID + // included in the shedule to execution threads. We need to store this since + // sometimes, computation could be removed while we still need the execution + // thread info for the remaining sequences. + absl::flat_hash_map execution_threads_; +}; + +std::ostream& operator<<(std::ostream& out, const HloSchedule& schedule); + +} // namespace xla + +#endif // XLA_HLO_IR_HLO_SCHEDULE_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/hlo_sharding.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/hlo_sharding.h new file mode 100644 index 0000000000000000000000000000000000000000..430f95799a7badecbb45ab33c0a5d2209c2350d1 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/hlo_sharding.h @@ -0,0 +1,662 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +// HLO shardings describe how an HLO instruction is split across multiple +// computations. + +#ifndef XLA_HLO_IR_HLO_SHARDING_H_ +#define XLA_HLO_IR_HLO_SHARDING_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "absl/algorithm/container.h" +#include "absl/types/span.h" +#include "xla/array.h" +#include "xla/hlo/ir/tile_assignment.h" // IWYU pragma: export +#include "xla/shape_tree.h" +#include "xla/xla_data.pb.h" + +namespace xla { + +// HLO shardings describe how an HLO instruction is split across multiple +// computations. +class HloSharding { + public: + // Creates a trivial sharding that replicates a maximal tile across all + // devices. + static HloSharding Replicate(absl::Span metadata = {}) { + return HloSharding(/*manual=*/false, /*replicated=*/true, /*unknown=*/false, + metadata); + } + + // Creates a sharding that represents the op is manually partitioned. + static HloSharding Manual(absl::Span metadata = {}) { + return HloSharding(/*manual=*/true, /*replicated=*/false, /*unknown=*/false, + metadata); + } + + // Creates a sharding that represents the op has a placeholder sharding. + static HloSharding Unknown(absl::Span metadata = {}) { + return HloSharding(/*manual=*/false, /*replicated=*/false, /*unknown=*/true, + metadata); + } + + // Creates a sharding that emulates device placement; a tile shape equal to + // the input shape (one tile) assigned to a single device. + static HloSharding AssignDevice(int64_t device_id, + absl::Span metadata = {}); + + // Creates a new sharding which splits a shape into tiles amongst the devices + // specified by `tile_assignment`. + static HloSharding Tile(TileAssignment tile_assignment, + absl::Span metadata = {}) { + return HloSharding(tile_assignment, /*replicate_on_last_tile_dim=*/false, + metadata); + } + static HloSharding Tile(Array tile_assignment, + absl::Span metadata = {}) { + return HloSharding(TileAssignment(std::make_shared>( + std::move(tile_assignment))), + /*replicate_on_last_tile_dim=*/false, metadata); + } + // Similar to `Tile` but use IotaTileAssignment format. + static HloSharding IotaTile(absl::Span tile_assignment_dims, + absl::Span metadata = {}) { + return HloSharding(TileAssignment(tile_assignment_dims), + /*replicate_on_last_tile_dim=*/false, metadata); + } + static HloSharding IotaTile(absl::Span tile_assignment_dims, + absl::Span reshape_dims, + absl::Span transpose_perm, + absl::Span metadata = {}) { + return HloSharding( + TileAssignment(tile_assignment_dims, reshape_dims, transpose_perm), + /*replicate_on_last_tile_dim=*/false, metadata); + } + + // Creates a partially replicated tiled sharding with device-level tile + // assignment, where the last dimension is the additional replication + // dimension. Replication group members will be sorted. + static HloSharding PartialTile( + const TileAssignment& tile_assignment_last_dim_replicate, + absl::Span metadata = {}); + static HloSharding PartialTile( + Array tile_assignment_last_dim_replicate, + absl::Span metadata = {}) { + return PartialTile(TileAssignment(std::make_shared>( + std::move(tile_assignment_last_dim_replicate))), + metadata); + } + + // Creates a subgroup sharding with device-level tile assignment, the + // sharding type of each subgroup is defined by subgroup_types. When creating + // the HloSharding, subgroup dims of the same type will be merged. + static HloSharding Subgroup(const TileAssignment& tile_assignment, + absl::Span subgroup_types, + absl::Span metadata = {}); + static HloSharding Subgroup(Array tile_assignment, + absl::Span subgroup_types, + absl::Span metadata = {}) { + return Subgroup( + TileAssignment(std::make_shared>(tile_assignment)), + subgroup_types, metadata); + } + + // Creates a new sharding which splits a one-dimensional input shape into + // `num_tiles` tiles. + static HloSharding Tile1D(const Shape& input_shape, int64_t num_tiles, + absl::Span metadata = {}); + + // Creates a new sharding for a tuple type. The given ShapeTree must have + // elements for every leaf shape contained in the tuple. + static HloSharding Tuple(const ShapeTree& sub_shardings); + + // Creates a new sharding for a tuple type. The number of elements in + // shardings must match the number of leaf nodes in tuple_shape. For + // empty tuples, the shardings array must have one element. + static HloSharding Tuple(const Shape& tuple_shape, + absl::Span shardings); + + // Creates a new sharding for a tuple type, with a single input sharding + // repeated on each leaf. + static HloSharding SingleTuple(const Shape& tuple_shape, + const HloSharding& sharding); + + // If shape is an array, returns sharding, otherwise returns the tuple shaped + // sharding with all the leaf nodes having the same input sharding. + static HloSharding Single(const Shape& shape, const HloSharding& sharding); + + // Create a new sharding from a protobuf OpSharding. + static StatusOr FromProto(const OpSharding& proto); + + // Checks whether device is a reserved device number. A reserved device number + // has usually a special meaning, with dedicated handling logic. + static bool IsReservedDevice(int64_t device) { return device < 0; } + + OpSharding ToProto() const; + + // Prints the string representation of this sharding.Note that this string + // canonically has outer curly braces, e.g. "{replicated}". + void Print(Printer* printer, bool include_metadata = false) const; + + // Returns the content printed by Print as a string. + std::string ToString(bool include_metadata = false) const; + + // Validate that this sharding can be applied to a tensor with shape `shape`. + Status Validate(const Shape& shape, + std::optional num_devices = {}) const; + + // Returns true if the sharding has tuple type. + bool IsTuple() const { return tuple_; } + + // Returns true if the sharding is trivial: replicate on all devices. + bool IsReplicated() const { + if (!IsTuple()) { + return replicated_; + } + return absl::c_all_of( + tuple_elements_, [](const HloSharding& s) { return s.IsReplicated(); }); + } + + // Returns true if the tile size is the same as the input size. + bool IsTileMaximal() const { + if (!IsTuple()) { + return maximal_; + } + return absl::c_all_of(tuple_elements_, [](const HloSharding& s) { + return s.IsTileMaximal(); + }); + } + + // Returns whether the sharding represents manual partitioning. + bool IsManual() const { + if (!IsTuple()) { + return manual_; + } + return absl::c_all_of(tuple_elements_, + [](const HloSharding& s) { return s.IsManual(); }); + } + + // Returns whether the sharding represents a placeholder sharding. + bool IsUnknown() const { + if (!IsTuple()) { + return unknown_; + } + return absl::c_all_of(tuple_elements_, + [](const HloSharding& s) { return s.IsUnknown(); }); + } + + bool IsShardGroup() const { + if (!IsTuple()) { + return shard_group_.shard_group_id != -1 && + (shard_group_.shard_like || shard_group_.shard_as); + } + return !tuple_elements_.empty() && + absl::c_all_of(tuple_elements_, [](const HloSharding& s) { + return s.IsShardGroup(); + }); + } + + bool IsShardAs() const { + if (!IsTuple()) { + return shard_group_.shard_group_id != -1 && shard_group_.shard_as; + } + return !tuple_elements_.empty() && + absl::c_all_of(tuple_elements_, + [](const HloSharding& s) { return s.IsShardAs(); }); + } + + bool IsShardLike() const { + if (!IsTuple()) { + return shard_group_.shard_group_id != -1 && shard_group_.shard_like; + } + return !tuple_elements_.empty() && + absl::c_all_of(tuple_elements_, + [](const HloSharding& s) { return s.IsShardLike(); }); + } + + // Returns whether the sharding represents manual subgroup sharding. + bool IsManualSubgroup() const { + if (!IsTuple()) { + return absl::c_linear_search(subgroup_types_, OpSharding::MANUAL); + } + return absl::c_all_of(tuple_elements_, [](const HloSharding& s) { + return s.IsManualSubgroup(); + }); + } + + // Returns weather the sharding represents a tiled sharding where the mapping + // between devices and tiles is represented through 'tile_assignment()'. + bool IsTiled() const { + return !IsTileMaximal() && !IsManual() && !IsUnknown(); + } + + // Returns if the sharding has partial replication and partial sharding. If + // true, data is sharded according to other dimensions of tile_assignment(), + // but replicated across devices along the last dimension. + bool ReplicateOnLastTileDim() const { return replicate_on_last_tile_dim_; } + + // Returns whether there is any partial replication. This can be using + // ReplicateOnLastTileDim or subgroups with REPLICATED. + bool HasPartialReplication() const { + return replicate_on_last_tile_dim_ || + absl::c_linear_search(subgroup_types_, OpSharding::REPLICATED); + } + + // Returns true if the sharding defines an operation on the given device. + bool UsesDevice(int64_t device) const; + + // Retrieves a histogram of the devices used by the sharding. The returned + // map has the device number as key, and the occurrence count as value. + // If a sharding does not have a device, it will not be included in the + // histogram. The count argument, if not nullptr, will receive the total + // number of elements this sharding is made of (one for array, N leaves for + // tuples). + std::map UsedDevices(int64_t* count) const; + + // Returns the tile that should be executed on the given device. + // REQUIRES: !IsTuple() + std::vector TileIndexForDevice(int64_t device) const; + + // Returns the device that should execute the given tile. + // It is an error to call this if is_replicated() is true. + // When ReplicateOnLastTileDim() == true, if index.size() == data rank, it + // returns the first device in that replicated subgroup; otherwise, + // index.size() should be the same as tile_assignment()'s rank and specifies + // the member of the replication subgroup. + // REQUIRES: !IsTuple() + int64_t DeviceForTileIndex(absl::Span index) const; + + // Given a device ID, returns the offset within the specified shape of the + // tile that should be executed on the given core. This returns the lower + // extent of the tile in the input space. + // REQUIRES: !IsTuple() + std::vector TileOffsetForDevice(const Shape& shape, + int64_t device) const; + + // Given a device ID, returns the limit within the specified shape of the + // tile that should be executed on the given core. This returns the upper + // extent of the tile in the input space. + // REQUIRES: !IsTuple() + std::vector TileLimitForDevice(const Shape& shape, + int64_t device) const; + + // Returns the single device this op operates on. If the sharding does not + // span a single device, the return value will be empty. + // In order for a sharding to span a single device, every leaf sharding must + // be maximal and not replicated, and the used device must match. + std::optional UniqueDevice() const; + + // Retrieves the unique device or fails with a CHECK. + int64_t GetUniqueDevice() const; + + // Returns true if this op only uses a single device. + bool HasUniqueDevice() const { return UniqueDevice().has_value(); } + + // Returns the ShapeTree containing the shardings for each element of this + // tuple, if IsTuple, or a ShapeTree with a single element containing this + // sharding. Only the leaf elements are populated. This creates a new + // ShapeTree object so is not cheap. + StatusOr> AsShapeTree(const Shape& shape) const; + ShapeTree GetAsShapeTree(const Shape& shape) const { + return AsShapeTree(shape).value(); + } + + // Retrieves the sub sharding at a given index, out of a tuple sharding. + // REQUIRES: IsTuple() + HloSharding GetSubSharding(const Shape& shape, const ShapeIndex& index) const; + + // If the current sharding is a tuple sharding, return itself as result. + // Otherwise returns a tuple sharding for the input shape, with all the leaves + // having this object sharding. + StatusOr GetTupleSharding(const Shape& shape) const; + + // If the shape is tuple and the current sharding is not a tuple, attempt to + // construct a sharding that is compatible with the shape by replicating the + // current sharding across all tuple elements. Note that the returned + // sharding is not guaranteed to be compatible with the input shape. + HloSharding NormalizeTupleSharding(const Shape& shape) const; + + // Extracts the sharding that is common within the current sharding. + // If the current sharding is not a tuple sharding, the current sharding will + // be returned. If it is a tuple, and all the tuple elements are common, the + // common element will be returned. Otherwise the optional will contain no + // value. + std::optional ExtractSingleSharding() const; + + // Returns a copy of the sharding with no metadata. If sharding is of tuple + // type, sub shardings will have no metadata. + HloSharding WithoutMetadata() const; + + // Returns a copy of the sharding with specified metadata. If metadata is + // already present, that metadata will not be replaced unless `overwrite` is + // set to true. If sharding is of tuple type, sub shardings metadata will be + // assigned instead. + HloSharding WithMetadata(absl::Span metadata, + bool overwrite) const; + + bool operator==(const HloSharding& other) const { + return replicated_ == other.replicated_ && maximal_ == other.maximal_ && + manual_ == other.manual_ && unknown_ == other.unknown_ && + tile_assignment_ == other.tile_assignment_ && + tuple_elements_ == other.tuple_elements_ && + replicate_on_last_tile_dim_ == other.replicate_on_last_tile_dim_ && + subgroup_types_ == other.subgroup_types_ && + shard_group_ == other.shard_group_; + } + bool operator!=(const HloSharding& other) const { return !(*this == other); } + + template + friend H AbslHashValue(H h, const HloSharding& sharding) { + if (sharding.tuple_) { + return H::combine(std::move(h), sharding.tuple_elements_); + } + return H::combine(std::move(h), sharding.replicated_, sharding.manual_, + sharding.unknown_, sharding.tile_assignment_.array(), + sharding.replicate_on_last_tile_dim_, + sharding.shard_group_.ToString()); + } + + // Gets the tile assignment tensor. + // REQUIRES: !IsReplicated() && !IsTuple() + const TileAssignment& tile_assignment() const { return tile_assignment_; } + + // Gets the subgroup types array. + // REQUIRES: !IsTuple() + const std::vector& subgroup_types() const { + return subgroup_types_; + } + + // Returns the flattened list of all the leaf shardings in a tuple shape, by + // pre-order walk (ShapeTree iterator order). + // REQUIRES: IsTuple(). + std::vector& tuple_elements() { return tuple_elements_; } + const std::vector& tuple_elements() const { + return tuple_elements_; + } + + // Gets the tile shape. + // REQUIRES: !IsTuple() + Shape TileShape(const Shape& shape) const; + + // Gets the tile shape on the device. + // REQUIRES: !IsTuple() + Shape TileShape(const Shape& shape, int64_t device) const; + + // Gets the total number of tiles including subgroups and partial replication. + int64_t TotalNumTiles() const; + // Gets the number of tiles. If it has partial replication, this will not + // equal the device count. + int64_t NumTiles() const; + // Like NumTiles() but considers only some specific dimensions passed as + // argument + int64_t NumTiles(absl::Span dims) const; + + // Gets metadata from sharding. + std::vector& metadata() { return metadata_; } + const std::vector& metadata() const { return metadata_; } + + // Returns the replication subgroup dim, or -1 if it doesn't exist. + int64_t SubgroupReplicationDim() const { + auto it = absl::c_find(subgroup_types_, OpSharding::REPLICATED); + if (it != subgroup_types_.end()) { + return (it - subgroup_types_.begin()) + TiledDataRank(); + } + if (replicate_on_last_tile_dim_) { + return tile_assignment_.num_dimensions() - 1; + } + return -1; + } + + // Returns the manual subgroup dim, or -1 if it doesn't exist. + int64_t SubgroupManualDim() const { + auto it = absl::c_find(subgroup_types_, OpSharding::MANUAL); + if (it != subgroup_types_.end()) { + return (it - subgroup_types_.begin()) + TiledDataRank(); + } + return -1; + } + + // Returns the data rank for tiled sharding. It doesn't include subgroup dims. + int64_t TiledDataRank() const { + CHECK(IsTiled()); + int64_t rank = tile_assignment_.num_dimensions(); + if (ReplicateOnLastTileDim()) { + rank--; + } + rank -= subgroup_types_.size(); + return rank; + } + + // Returns the number of tuple_elements_ entries to fit the shape. + static int64_t RequiredLeaves(const Shape& shape); + + struct ShardGroup { + ShardGroup(int64_t shard_group_id, bool shard_as, bool shard_like) + : shard_group_id(shard_group_id), + shard_as(shard_as), + shard_like(shard_like) {} + + bool operator==(const ShardGroup& rhs) const { + return shard_group_id == rhs.shard_group_id && shard_as == rhs.shard_as && + shard_like == rhs.shard_like; + } + + std::string ToString() const { + std::ostringstream result; + if (shard_as) { + result << "shard_as " << shard_group_id; + } else if (shard_like) { + result << "shard_like " << shard_group_id; + } + return result.str(); + } + + int64_t shard_group_id = 0; + bool shard_as; + bool shard_like; + }; + static ShardGroup NotShardGroup() { + return ShardGroup( + /*shard_group_id=*/-1, + /*shard_as=*/false, + /*shard_like=*/false); + } + + static ShardGroup ShardAs(int64_t shard_group_id) { + return ShardGroup(shard_group_id, + /*shard_as=*/true, + /*shard_like=*/false); + } + + static ShardGroup ShardLike(int64_t shard_group_id) { + return ShardGroup(shard_group_id, + /*shard_as=*/false, + /*shard_like=*/true); + } + + HloSharding& SetShardGroup(const ShardGroup& shard_group) { + shard_group_ = shard_group; + return *this; + } + + HloSharding& SetShardGroupFromProto(const OpSharding& proto) { + ShardGroup shard_group = NotShardGroup(); + if (proto.is_shard_group()) { + if (proto.shard_group_type() == OpSharding::AS) { + shard_group = ShardAs(proto.shard_group_id()); + } else { + shard_group = ShardLike(proto.shard_group_id()); + } + } + SetShardGroup(shard_group); + return *this; + } + + HloSharding& ClearShardGroup() { + shard_group_ = NotShardGroup(); + return *this; + } + + const ShardGroup& GetShardGroup() const { return shard_group_; } + + private: + explicit HloSharding(bool manual, bool replicated, bool unknown, + absl::Span metadata) + : metadata_(metadata.begin(), metadata.end()), + replicated_(replicated), + maximal_(replicated), + tuple_(false), + manual_(manual), + unknown_(unknown), + replicate_on_last_tile_dim_(false) {} + // device_id values: + // -2: magic number to mean unassigned device, used by spatial partitioning + // -1: the id of the host + // 0 or positive: the id of a device + // NOTE(dimvar): -1 is needed for outside compilation. It can be removed once + // we have fully switched to the side-effect tokens. + explicit HloSharding(int64_t device_id, absl::Span metadata) + : tile_assignment_(device_id), + metadata_(metadata.begin(), metadata.end()), + replicated_(false), + maximal_(true), + tuple_(false), + manual_(false), + unknown_(false), + replicate_on_last_tile_dim_(false) {} + explicit HloSharding(TileAssignment tile_assignment, + bool replicate_on_last_tile_dim, + absl::Span metadata = {}) + : tile_assignment_(std::move(tile_assignment)), + metadata_(metadata.begin(), metadata.end()), + replicated_(false), + maximal_(false), + tuple_(false), + manual_(false), + unknown_(false), + replicate_on_last_tile_dim_(replicate_on_last_tile_dim) {} + explicit HloSharding(TileAssignment tile_assignment, + absl::Span subgroup_types, + absl::Span metadata = {}) + : tile_assignment_(std::move(tile_assignment)), + metadata_(metadata.begin(), metadata.end()), + subgroup_types_(subgroup_types.begin(), subgroup_types.end()), + replicated_(false), + maximal_(false), + tuple_(false), + manual_(false), + unknown_(false), + replicate_on_last_tile_dim_(false) {} + explicit HloSharding(const std::vector& tuple_shardings) + : tuple_elements_(tuple_shardings), + replicated_(false), + maximal_(false), + tuple_(true), + manual_(false), + unknown_(false), + replicate_on_last_tile_dim_(false) {} + + // Test-only constructor for sharding format code coverage. Copies the + // original sharding with provided tile assignment. + explicit HloSharding(const HloSharding& other, TileAssignment tile_assignment) + : tile_assignment_(std::move(tile_assignment)), + tuple_elements_(other.tuple_elements_), + metadata_(other.metadata_), + subgroup_types_(other.subgroup_types_), + replicated_(other.replicated_), + maximal_(other.maximal_), + tuple_(other.tuple_), + manual_(other.manual_), + unknown_(other.unknown_), + replicate_on_last_tile_dim_(other.replicate_on_last_tile_dim_) { + CHECK(tile_assignment_ == other.tile_assignment_) + << tile_assignment_.ToString() << " v.s. " + << other.tile_assignment_.ToString(); + } + friend class HloShardingTestHelper; + + // Checks that the number of elements in tuple_elements_ is consistent with + // the tuple shape passes as argument. + Status CheckLeafCount(const Shape& shape) const; + + // Internal helper to validate a tuple sharding. + Status ValidateTuple(const Shape& shape, + std::optional num_devices) const; + + // Internal helper to validate a non-tuple (leaf) sharding. + Status ValidateNonTuple(const Shape& shape, + std::optional num_devices) const; + + // This field is only used if replicated_ is false. If maximal_ is true, then + // the field contains a rank 1 array with a single element, which is the + // device the HLO is assigned to. If maximal_ is false, the field contains an + // array with the same rank as the corresponding HLO. The dimension sizes of + // the array describe the number of ways the HLO is partitioned along each + // dimension. The values of the array specify which device each tile of + // the HLO is assigned to. The index of each value determines which tile it + // takes. + // For example, {{{2, 3}}, {{5, 7}}} (whose ToString representation is + // "{devices=[2,1,2]2,3,5,7}"), means that dimension 1 is split two way and + // dimension 3 is split 2 way. Core 5, whose index is [2,1,1] will take the + // tile that contains the 2nd half of dimension 1 and the 1st half of + // dimension 3. + TileAssignment tile_assignment_; + // Only non-empty when tuple_ is true. If a tuple is empty then one entry is + // present for the root. This is a flattened list of all the leaf shardings in + // a tuple shape, by pre-order walk (ShapeTree iterator order). + std::vector tuple_elements_; + // This field is used to track the source of this sharding, usually derived + // from instructions. Multiple metadata may be populated if sharding is + // combined with other shardings. Metadata are to not be populated when + // tuple_ == true and instead metadata should be set on individual tuple + // elements. + std::vector metadata_; + // This field is used to represented the sharding type of each subgroup. + // For example, sharding={devices=[2,2,2,2]0,1,2,...,15 last_tile_dims={ + // replicate, manual, unreduced}} means that each of the last 3 dimensions + // in [2,2,2,2] represents a subgrouping in replicate, manual. + // When creating HloSharding, subgroup dims of the same type will be merged, + // so that there is at most one dim with a given type. + std::vector subgroup_types_; + bool replicated_; + bool maximal_; + bool tuple_; + bool manual_; + bool unknown_; + // This flag is to support partial replication and partial sharding. If it is + // true, tile_assignment_ will have an extra dimension in addition to the data + // shape rank, and the added last dimension represents the subgroups of + // replications, i.e., elements in slice [..., :] will be replicated. + bool replicate_on_last_tile_dim_; + // This field is used to store the shard group information. Instructions + // within the same shard group(i.e. under the same shard_group_id) will be + // sharded alike or exactly the same as each other. + ShardGroup shard_group_ = NotShardGroup(); +}; + +std::ostream& operator<<(std::ostream& out, const HloSharding& sharding); + +} // namespace xla + +#endif // XLA_HLO_IR_HLO_SHARDING_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/hlo_sharding_metadata.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/hlo_sharding_metadata.h new file mode 100644 index 0000000000000000000000000000000000000000..7fa15698e586e5b214efeb5b61fd3e4dfbc5cd3f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/hlo_sharding_metadata.h @@ -0,0 +1,110 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_HLO_IR_HLO_SHARDING_METADATA_H_ +#define XLA_HLO_IR_HLO_SHARDING_METADATA_H_ + +#include +#include +#include + +#include "absl/container/flat_hash_map.h" +#include "absl/types/span.h" +#include "xla/hlo/ir/hlo_domain_metadata.h" +#include "xla/hlo/ir/hlo_instruction.h" +#include "xla/hlo/ir/hlo_sharding.h" +#include "tsl/platform/status.h" + +namespace xla { + +// A DomainMetadata implementation that internally wraps a sharding attribute. +class ShardingMetadata : public DomainMetadata { + public: + explicit ShardingMetadata(std::shared_ptr sharding) + : sharding_(std::move(sharding)) {} + + std::unique_ptr Clone() const override; + + absl::string_view Kind() const override { return KindName(); } + + bool Matches(const DomainMetadata& other) const override; + + template + friend H AbslHashValue(H h, const ShardingMetadata& sharding_metadata) { + const bool has_sharding = sharding_metadata.sharding_ != nullptr; + if (has_sharding) { + h = H::combine(std::move(h), *sharding_metadata.sharding_); + } + return H::combine(std::move(h), has_sharding); + } + + size_t Hash() const override { return absl::HashOf(*this); } + + std::string ToString() const override; + + const HloSharding* sharding() const { return sharding_.get(); } + + static absl::string_view KindName() { return "sharding"; } + + static StatusOr ToShardingMetadata( + const DomainMetadata* metadata); + + // Apply the specified domain metadata onto the specified domain. If no + // metadata is specified then apply sharding heuristics and normalize the + // instructions whose sharding deviates from the one which is inferred as to + // be the original one. Policy wise, HLO passes are allowed to create new + // unassigned instructions, but if they do create assigned ones, they have to + // conform to the ones around. + static Status NormalizeShardingDomain(const DomainMetadata::Domain& domain, + const DomainMetadata* metadata); + + private: + std::shared_ptr sharding_; +}; + +// If the sharding between root and instruction changes then returns a +// ShardingMetadata based kDomain instruction what can be used to separate +// operand and instruction. +// Returns nullptr if there is no need for a domain separation. +class ShardingDomainCreator { + public: + HloInstruction* operator()(HloInstruction* instruction, HloInstruction* root, + HloInstruction* operand); + + private: + // Map from instruction and user sharding to domain users to CSE identical + // domains. + struct DomainCseMapKey { + const HloInstruction* instruction; + std::shared_ptr sharding; + + bool operator==(const DomainCseMapKey& other) const; + + template + friend H AbslHashValue(H h, const DomainCseMapKey& key) { + h = H::combine(std::move(h), key.instruction); + const bool has_sharding = key.sharding != nullptr; + if (has_sharding) { + h = H::combine(std::move(h), *key.sharding); + } + return H::combine(std::move(h), has_sharding); + } + }; + absl::flat_hash_map domain_cse_map_; +}; + +} // namespace xla + +#endif // XLA_HLO_IR_HLO_SHARDING_METADATA_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/tile_assignment.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/tile_assignment.h new file mode 100644 index 0000000000000000000000000000000000000000..871b6e6aeabb383c852e154456eae5c356b5ef71 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/ir/tile_assignment.h @@ -0,0 +1,270 @@ +/* Copyright 2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_HLO_IR_TILE_ASSIGNMENT_H_ +#define XLA_HLO_IR_TILE_ASSIGNMENT_H_ + +#include +#include +#include +#include +#include + +#include "absl/algorithm/container.h" +#include "absl/types/span.h" +#include "xla/array.h" +#include "xla/printer.h" + +namespace xla { + +class TileAssignment; + +// Describes a TileAssignment with a device array generated from reshaping and +// transposing an iota array, a.k.a. HloShardingV2. This is a more scalable +// format for large number of devices since it does not materialize the full +// list of devices, while being less general since it cannot represent +// arbitrary sequence of devices. It is however sufficient to represent the +// most commonly generated SPMD shardings from ML frameworks that arrange +// devices using mesh axes. +class IotaTileAssignment { + public: + // Create a trivial (i.e. the device array is a trivial iota without reshape + // and transpose) IotaTileAssignment with given dimensions. + static IotaTileAssignment Create(absl::Span dims); + // Creates an IotaTileAssignment canonicalizing `reshape_dims` and + // `transpose_perm`. More specifically the tile assignment array is as if it + // is produced by the following numpy code: + // numpy.arange(math.prod(dims)).reshape(reshape_dims) + // .transpose(transpose_perm).reshape(math.prod(dims)) + // where: + // `dims`: is the dimensions of the tile assignment array. + // `reshape_dims`: is the dimensions the 1D iota array is reshaped to. + // `transpose_perm`: is the dimension permutation to transpose `reshape_dims`. + // + // e.g. dims=[8,8,8] reshape_dims=[4,2,2], transpose_perm=[0,1,2] (no + // transpose) corresponds to [8,8,8]<=[16] which in full array V1 format is + // [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]. + // e.g. dims=[8,8,8] reshape_dims=[4,2,2], transpose_perm=[1,0,2] (swap dim 0 + // and dim 1) corresponds to [8,8,8]<=[4,2,2]T(1,0,2) which in full array V1 + // format is [0,1,4,5,8,9,12,13,2,3,6,7,10,11,14,15]. + static IotaTileAssignment Create(absl::Span dims, + absl::Span reshape_dims, + absl::Span transpose_perm); + + ~IotaTileAssignment() = default; + IotaTileAssignment(const IotaTileAssignment& other); + IotaTileAssignment(IotaTileAssignment&& other) = default; + IotaTileAssignment& operator=(const IotaTileAssignment& other); + IotaTileAssignment& operator=(IotaTileAssignment&& other) = default; + + bool operator==(const IotaTileAssignment& other) const { + return dims() == other.dims() && reshape_dims() == other.reshape_dims() && + transpose_perm() == other.transpose_perm(); + } + + int64_t value_at(absl::Span index) const; + + int64_t ndims() const { return ndims_; } + + absl::Span dims() const { + return absl::MakeSpan(dims_ptr(), ndims_); + } + + int64_t dim(int n) const { return dims_ptr()[n]; } + + absl::Span reshape_dims() const { + return absl::MakeSpan(reshape_dims_ptr(), reshape_ndims_); + } + + absl::Span transpose_perm() const { + return absl::MakeSpan(transpose_perm_ptr(), reshape_ndims_); + } + + int64_t num_elements() const { + return absl::c_accumulate(dims(), 1LL, std::multiplies()); + } + + // TODO(b/281892190): This should really not return optional, when we are + // sure we can handle all cases. + std::optional Transpose(absl::Span perm) const; + + void Print(Printer* printer) const; + + std::string ToString() const; + + private: + friend class TileAssignment; + static constexpr int kPerDimBytes = sizeof(int64_t); + static constexpr int kPerReshapeDimBytes = sizeof(int64_t) + sizeof(int); + + explicit IotaTileAssignment(absl::Span dims, + absl::Span reshape_dims, + absl::Span transpose_perm); + + explicit IotaTileAssignment(int ndims, int reshape_ndims); + + int64_t* dims_ptr() { return reinterpret_cast(storage_.get()); } + const int64_t* dims_ptr() const { + return reinterpret_cast(storage_.get()); + } + const int64_t* reshape_dims_ptr() const { return dims_ptr() + ndims_; } + int64_t* reshape_dims_ptr() { + return const_cast( + const_cast(this)->reshape_dims_ptr()); + } + const int* transpose_perm_ptr() const { + return reinterpret_cast(reshape_dims_ptr() + reshape_ndims_); + } + int* transpose_perm_ptr() { + return const_cast( + const_cast(this)->transpose_perm_ptr()); + } + + int size_bytes() const { + return ndims_ * kPerDimBytes + reshape_ndims_ * kPerReshapeDimBytes; + } + + bool next_index(absl::Span index) const { + DCHECK_EQ(index.size(), ndims_); + for (int64_t i = ndims_ - 1; i >= 0; --i) { + index[i]++; + if (index[i] < dims_ptr()[i]) { + return true; + } + index[i] = 0; + } + return false; + } + int32_t ndims_; + int32_t reshape_ndims_; + // Contiguous buffer storing `int64_t dims[]`, `int64_t reshape_dims[]`, + // `int transpose_perm[]` in order. + std::unique_ptr storage_; +}; + +// Internal class that represents how an ordered list of device IDs are sharded +// along different dimensions. It manages full or compact representation of the +// device IDs without having callers worry about what underlying format is used. +// This class is meant to be included ONLY by HloSharding so it does not return +// error status on invalid arguments but rather assert preconditions in its +// implementation, assuming it should always get valid data. +// NOTE: This class is immutable. +class TileAssignment { + public: + TileAssignment() : array_(ReplicatedArray()) {} + explicit TileAssignment(std::shared_ptr> array) + : shared_array_(std::move(array)), array_(shared_array_.get()) {} + explicit TileAssignment(int64_t device_id) + : TileAssignment(std::make_shared>( + std::initializer_list{1}, device_id)) {} + explicit TileAssignment(IotaTileAssignment iota) : iota_(std::move(iota)) {} + explicit TileAssignment(absl::Span dims) + : iota_(IotaTileAssignment::Create(dims)) {} + explicit TileAssignment(absl::Span dims, + absl::Span reshape_dims, + absl::Span transpose_perm) + : iota_(IotaTileAssignment::Create(dims, reshape_dims, transpose_perm)) {} + + bool operator==(const TileAssignment& other) const; + bool operator!=(const TileAssignment& other) const { + return !operator==(other); + } + // Methods that mirrors those of xla::Array. + template + typename std::enable_if_t::value, + int64_t> + operator()(Dims... dims) const { + DCHECK_EQ(sizeof...(dims), num_dimensions()); + std::array indexes{ + {static_cast(dims)...}}; + return operator()(indexes); + } + int64_t operator()(absl::Span indexes) const; + + absl::Span dimensions() const; + int64_t num_dimensions() const; + int64_t dim(int64_t n) const; + int64_t num_elements() const; + int64_t first() const; + + void Each( + absl::FunctionRef, int64_t)> f) const; + + Status EachStatus( + absl::FunctionRef, int64_t)> f) const; + + // Returns a tile assignment reshaped to the given dimensions. + // REQUIRES: new shape has the same number of elements. + [[nodiscard]] TileAssignment Reshape( + absl::Span new_dimensions) const; + + // Returns a tile assignment transposd using the given dimension permutations. + // REQUIRES: `perm` must a an array of num_dimensions elements, with unique + // values within [0, num_dimensions). + [[nodiscard]] TileAssignment Transpose(absl::Span perm) const; + + void Print(Printer* printer) const; + + std::string ToString() const; + + bool UsesDevice(int64_t device) const; + + // Returns non-nullopt iota tile assignment iff it holds that format. + const std::optional& iota() const { return iota_; } + // Returns reference to the full array representation. If it holds iota + // format, reference to a lazily materialized array is returned. + const Array& array() const; + // Similar to array() but returns the underlying shared_ptr to avoid deep + // copy. + const std::shared_ptr>& shared_array() const; + // Makes a deep copy of shared_array(). + std::shared_ptr> shared_array_clone() const; + + template + friend H AbslHashValue(H h, const TileAssignment& tile) { + // TODO(b/281892190): Ideally hashing a TileAssignment should not force iota + // -> full array conversion, but a requirement is that they should have + // equivalence. Consider providing a faster hash function for iota tile + // assignment. + return H::combine(std::move(h), tile.array()); + } + + private: + friend class HloSharding; + // TODO(b/281892190): Consider changing int64_t to int32_t since it's unlikely + // to have so many devices to overflow int32_t in practice. + explicit TileAssignment(IotaTileAssignment iota, + std::shared_ptr> shared_array) + : iota_(std::move(iota)), + shared_array_(std::move(shared_array)), + array_(shared_array_.get()) {} + + void MaybeMaterializeFullArray() const; + + static const Array* ReplicatedArray() { + static auto* array = new Array({0}); + return array; + } + + std::optional iota_; + // If iota_ is set, shared_array_ is a lazy cache of the materialized array. + mutable std::shared_ptr> shared_array_; + // Pointer to the storage of the fully materialized array format. + mutable const Array* array_ = nullptr; +}; + +} // namespace xla + +#endif // XLA_HLO_IR_TILE_ASSIGNMENT_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/transforms/hlo_constant_splitter.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/transforms/hlo_constant_splitter.h new file mode 100644 index 0000000000000000000000000000000000000000..50ac60671235a84876a9d4de1db0d38672e72b9b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/transforms/hlo_constant_splitter.h @@ -0,0 +1,49 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_HLO_TRANSFORMS_HLO_CONSTANT_SPLITTER_H_ +#define XLA_HLO_TRANSFORMS_HLO_CONSTANT_SPLITTER_H_ + +#include "xla/service/hlo_pass_interface.h" + +namespace xla { + +// Splits the constant instructions such that they have a single user. +// This is typically used before domain placement, to make sure a shared +// constant does not short-circuit domains. It is also used before sharding +// propagation to prevent unintended propagation of sharding due to shared used +// of constants. +// +// CSE passes after domain placements will ensure that all the sharable +// constants within the same domain, will be rejoined back. +// +// This pass may generate dead instructions. Thus, HloDCE is recommended after +// this pass. +class HloConstantSplitter : public HloModulePass { + public: + explicit HloConstantSplitter(bool split_expressions = false) + : split_expressions_(split_expressions) {} + absl::string_view name() const override { return "hlo-constant-splitter"; } + using HloPassInterface::Run; + StatusOr Run( + HloModule* module, + const absl::flat_hash_set& execution_threads) override; + + private: + bool split_expressions_; +}; + +} // namespace xla + +#endif // XLA_HLO_TRANSFORMS_HLO_CONSTANT_SPLITTER_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/utils/hlo_live_range.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/utils/hlo_live_range.h new file mode 100644 index 0000000000000000000000000000000000000000..62a2f0d19abd54970af815f8a64265e15e6b2d3f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/utils/hlo_live_range.h @@ -0,0 +1,234 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +License for the specific language governing permissions and limitations under +the License. +==============================================================================*/ +#ifndef XLA_HLO_UTILS_HLO_LIVE_RANGE_H_ +#define XLA_HLO_UTILS_HLO_LIVE_RANGE_H_ + +#include +#include +#include + +#include "absl/container/flat_hash_map.h" +#include "absl/container/flat_hash_set.h" +#include "xla/hlo/ir/dfs_hlo_visitor.h" +#include "xla/hlo/ir/hlo_instruction.h" +#include "xla/hlo/ir/hlo_module.h" +#include "xla/service/hlo_alias_analysis.h" +#include "xla/service/hlo_buffer.h" +#include "xla/service/hlo_dataflow_analysis.h" +#include "xla/service/hlo_ordering.h" +#include "xla/service/hlo_value.h" +#include "xla/statusor.h" +#include "xla/types.h" +#include "tsl/platform/status.h" + +namespace xla { + +// Class which computes live range of the output buffers of HLOs and their +// interference by flattening all computations. The live range is only available +// when all global computations (while, if, call, etc) have total order +// sequential orders. +class HloLiveRange { + public: + // Constructs a hlo live range object for the given module and computation + // assuming the given HLO instruction ordering. + static StatusOr> Run( + const HloSchedule& schedule, const HloAliasAnalysis& alias_analysis, + const HloComputation* computation, bool module_scoped_analysis = true); + + // LogicalTime represents the time in a virtual clock. Each instruction has + // one monotonically increasing logical time assigned according to the + // schedule. + using LogicalTime = int64_t; + + struct TimeBound { + LogicalTime start; + LogicalTime end; + // The buffer can hold multiple instructions during its life time (each + // tenant exclusively owns the buffer at any given time). `end_instruction` + // represents the last instruction that the buffer holds. + HloPosition end_position; + + bool friend operator==(const TimeBound& a, const TimeBound& b) { + return a.start == b.start && a.end == b.end; + } + bool friend operator!=(const TimeBound& a, const TimeBound& b) { + return !(a == b); + } + }; + + std::string ToString() const; + + const HloInstructionSequence& flattened_instruction_sequence() const { + return flattened_instruction_sequence_; + } + + // Returns the map from instruction to the end time of that instruction. + const absl::flat_hash_map& + instruction_schedule() const { + return instruction_schedule_; + } + + // Returns the map from a hlo value to the definition time of that hlo value. + const absl::flat_hash_map& buffer_live_ranges() + const { + return buffer_live_ranges_; + } + + absl::flat_hash_map& buffer_live_ranges() { + return buffer_live_ranges_; + } + + // Returns the map from a computation and its time span in the schedule. + const absl::flat_hash_map& + computation_span_times() const { + return computation_span_times_; + } + + // Returns the time stamp of the end of the program. + LogicalTime schedule_end_time() const { + return flattened_instruction_sequence_.size(); + } + + // Returns whether hlo live range is available on this entire module. Hlo live + // range is not available if the module is partially ordered. + bool total_order_scheduled() const { return total_order_scheduled_; } + + private: + explicit HloLiveRange(const HloSchedule& schedule, + const HloAliasAnalysis& alias_analysis, + bool module_scoped_analysis) + : schedule_(schedule), + alias_analysis_(alias_analysis), + module_scoped_analysis_(module_scoped_analysis) {} + + // FlattenSchedule walks through the instructions in `computation`, and + // recurse into each called computations in module_scoped_analysis mode. As it + // walks it also tracks down the ordinal number of each instruction in the + // schedule and store it in the `instruction_schedule` and + // 'flattened_instruction_sequence`. async_context contains the asynchronous + // computation that this computation is in, if any. When this value is + // non-null, it means that this computation is called by an async op or + // another op in an asynchronous context. + void FlattenSchedule(const HloComputation& computation, + const HloComputation* async_context = nullptr); + + // Returns the last position of a value. + TimeBound GetLastPosition(const HloValue& value, + LogicalTime definition_end_time) const; + + // Returns the time of the last use of a value. + LogicalTime GetLastUsageTime(const HloValue& value) const; + + // Based on the flattened schedule, calculate the start and end of each + // buffer. + void CalculateBufferStartEndMap(); + + // The aliased buffers could have overlapping live ranges. + // NormalizeAliasedBuffers normalizes the buffer such that each alias buffer + // has disjoint live range while keeping the live range union the same. This + // avoid double counting aliased buffer sizes. + // + // Before(buffer1 and 2 are aliased): + // + // +----+ live range of buffer1 + // +------------------+ live range of buffer2 + // + // After: + // + // +----------+ live range of buffer1 + // +-------+ live range of buffer2 + // + // Before(buffer1 and 2 are aliased): + // + // +----------+ live range of buffer1 + // +------------+ live range of buffer2 + // + // After: + // + // +----------+ live range of buffer1 + // +-------+ live range of buffer2 + // + // Before(buffer1 and 2 are aliased): + // + // +----------+ live range of buffer1 + // +---+ live range of buffer2 + // + // After(unchanged): + // + // +----------+ live range of buffer1 + // +---+ live range of buffer2 + // + // As another example, imagine we have the following code sequence with live + // ranges of each while-aliased buffers: + // + // a p1 p2 e b + // a = ... + + // | + // { | + // p1 = param | + + // ROOT true | | + // } | + + // { // body | + // p2 = param + + + // c = p2 + 1 + + // d = c + 1 + // ROOT e = d + 1 + + // } | + // | + // b = while (a) + + + // | + // f = b + 1 + + // + // After normalization it becomes: + // + // a p1 p2 e b + // a = ... + + // | + // { | + // p1 = param + + + // ROOT true | + // } | + // { // body | + // p2 = param + + + // c = p2 + 1 + + // d = c + 1 + // ROOT e = d + 1 + + // } | + // | + // b = while (a) + + + // | + // f = b + 1 + + // + // Note there is no overlap of live ranges after normalization. + void NormalizeAliasedBuffers(); + + LogicalTime ComputePeakMemoryMoment() const; + + const HloSchedule& schedule_; + const HloAliasAnalysis& alias_analysis_; + bool module_scoped_analysis_; + bool total_order_scheduled_ = true; + + HloInstructionSequence flattened_instruction_sequence_; + absl::flat_hash_map instruction_schedule_; + absl::flat_hash_map computation_span_times_; + absl::flat_hash_map buffer_live_ranges_; + absl::flat_hash_map + computations_in_async_context_; +}; + +} // namespace xla + +#endif // XLA_HLO_UTILS_HLO_LIVE_RANGE_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/utils/hlo_query.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/utils/hlo_query.h new file mode 100644 index 0000000000000000000000000000000000000000..e166cbe9c9c0976d794356ef29543d8a8a07d31f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/utils/hlo_query.h @@ -0,0 +1,126 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_HLO_UTILS_HLO_QUERY_H_ +#define XLA_HLO_UTILS_HLO_QUERY_H_ + +#include "absl/container/flat_hash_set.h" +#include "xla/hlo/ir/hlo_computation.h" +#include "xla/hlo/ir/hlo_instruction.h" +#include "xla/hlo/ir/hlo_module.h" +#include "xla/hlo/ir/hlo_opcode.h" + +namespace xla { + +// Helper interface for making queries about the HLO IR. +namespace hlo_query { + +// Returns whether the given opcode is a collective communications operation +// that is represented as HloCollectiveInstruction. +bool IsCollectiveCommunicationOp(HloOpcode op); + +// Returns whether the given opcode represents the start operation for a +// collective communication, may include send & recv operations. +bool IsAsyncCollectiveStartOp(HloOpcode op, bool include_send_recv = false); +// Returns whether the given opcode represents the done operation for a +// collective communication, may include send & recv operations. +bool IsAsyncCollectiveDoneOp(HloOpcode op, bool include_send_recv = false); + +// Returns whether the instruction provided is a constant rank-0 float32, and +// if so, places the constant value into out. +// Precondition: out != nullptr +bool IsConstantR0F32(HloInstruction* instruction, float* out); + +// Returns whether all of an instruction's operands are of the types constants +// and parameters. +bool AllOperandsAreParametersOrConstants(const HloInstruction& instruction); + +// Returns whether all of an instruction's operands are of the type constant +// or parameter and the instruction is their only user. +bool AllOperandsAreParametersOrConstantsWithSingleUser( + const HloInstruction& instruction); + +// Returns whether all of an instruction's operands are parameters. +bool AllOperandsAreParameters(const HloInstruction& instruction); + +// Returns whether all of an instruction's operands are constants. +bool AllOperandsAreConstants(const HloInstruction& instruction); + +// Returns whether the instruction is a scalar constant. +bool IsScalarConstant(const HloInstruction* instruction); + +// Returns whether the `instr` is either a constant, a scalar, or a +// broadcasted constant/scalar. +bool IsBroadcastedConstantOrScalar(const HloInstruction& instr); + +// Returns whether the `instr` is a broadcast and its input is a +// scalar constant. +bool IsBroadcastOfScalarConstant(const HloInstruction& instr); + +// Returns first HLO of the computation with the opcode, otherwise nullptr. +HloInstruction* GetFirstInstructionWithOpcode(const HloComputation& computation, + HloOpcode opcode); + +// Determines whether the given computation contains an instruction with one of +// the given opcodes. Checks both comp's instructions and the instructions of +// any computations nested within it. +bool ContainsInstrWithOpcode(const HloComputation* comp, + const absl::flat_hash_set& opcodes); + +// Returns an operand of an instruction with the given opcode. If there are +// multiple matching operands, then the first matching operand is returned. If +// there are no matching operands then nullptr is returned. +HloInstruction* GetMatchingOperand(const HloPredicate& matcher, + HloInstruction* instruction); + +// Returns whether a binary instruction has a matching operand. Sets +// matching_operand to the matching operand and the other operand to +// other_operand. Note: in the case where both operands match, the first operand +// of the instruction is returned. +bool MatchBinaryInstructionOperand(const HloPredicate& matcher, + HloInstruction* instruction, + HloInstruction** matching_operand, + HloInstruction** other_operand); + +// Returns whether a binary instruction has a operand with a given opcode. +// This is a special case of MatchingBinaryInstructionOperand. +bool MatchBinaryInstructionOperandOpcode(HloOpcode opcode, + HloInstruction* instruction, + HloInstruction** matching_operand, + HloInstruction** other_operand); + +// Returns whether the module contains the given collective communication +// instructions with constrained layout. +bool ContainsLayoutConstrainedCollective(const HloModule& module, HloOpcode op); + +// Returns whether the module contains all-reduce instructions with constrained +// layout. +inline bool ContainsLayoutConstrainedAllReduce(const HloModule& module) { + return ContainsLayoutConstrainedCollective(module, HloOpcode::kAllReduce); +} + +// Returns the next available channel id that can be used in the given module +// (for HloChannelInstructions). +int64_t NextChannelId(const HloModule& module); + +// Returns whether the module contains host send/recv with X64 data type. +// This function is called after X64Rewriter, so X64 host transfers are already +// rewritten into tuple shaped transfers. +bool HasX64TransformedHostTransfer(const HloModule& module); + +} // namespace hlo_query +} // namespace xla + +#endif // XLA_HLO_UTILS_HLO_QUERY_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/utils/hlo_sharding_util.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/utils/hlo_sharding_util.h new file mode 100644 index 0000000000000000000000000000000000000000..d953f0cc5323341e85d3fb05d126e17f365d6dc0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/hlo/utils/hlo_sharding_util.h @@ -0,0 +1,473 @@ +/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_HLO_UTILS_HLO_SHARDING_UTIL_H_ +#define XLA_HLO_UTILS_HLO_SHARDING_UTIL_H_ + +#include +#include +#include +#include +#include +#include +#include + +#include "absl/container/inlined_vector.h" +#include "xla/hlo/ir/hlo_computation.h" +#include "xla/hlo/ir/hlo_instruction.h" +#include "xla/hlo/ir/hlo_instructions.h" +#include "xla/hlo/ir/hlo_module.h" +#include "xla/hlo/ir/hlo_sharding.h" +#include "xla/service/call_graph.h" + +namespace xla { +namespace hlo_sharding_util { + +struct GatherScatterParallelDims { + absl::InlinedVector indices_parallel_dims; + absl::InlinedVector operand_parallel_dims; + std::vector index_parallel_in_dim; +}; + +// Determines if the first operand 'potential_subsharding' is a subsharding of +// the second operand 'sharding'. Subsharding means that the tiles in +// 'potential_subsharding' define tiles that have a subset or the same data that +// the tiles in 'sharding' define. +bool IsSubTilingOrEqualSharding(const Shape& shape, + const HloSharding& potential_subsharding, + const HloSharding& sharding); + +// Returns true if the lhs sharding is preferable over the rhs sharding. +// The most specific sharding is tile maximal followed by single device tile +// maximal and finally replicated. This order aims to primarily reduce memory +// usage and secondly reduce total compute. +// Note: This does NOT provide a total ordering as we can have 2 different +// sharding with same preference level. +bool IsShardingMoreSpecific(const HloSharding& lhs, const HloSharding& rhs); + +// Tries to refine `to_merge` by combining with `old`. Returns if the final +// `to_merge` is more specific than `old`. +bool MergeSharding(const HloSharding& to_merge, HloSharding* dst, + bool may_combine_partial_sharding); + +// Merges `to_merge` into `dst` only if they are compatible, and the merged +// sharding has >= minimum_tiles tiles. Returns if merging happened. +bool MergeShardingIfCompatible(const HloSharding& to_merge, + int64_t minimum_tiles, HloSharding* dst); + +// Find a reasonable common sharding for a list of shardings. The reasonable +// sharding should incur little(the least) amount of total resharding cost when +// resharding all the shardings to this common sharding. +HloSharding FindCommonSharding(absl::Span shardings); + +// Given a map, selects the device with higher +// occurrence count (if any). If top_count in not nullptr, it will receive the +// count of the dominant device returned. +std::optional SelectDominantDevice( + const std::map& device_map, int64_t* top_count); + +// Assigns all the instructions of a computation, to a given device. +// This API does not recurse into called computations, and does not assign +// instructions which already have sharding. +void AssignComputationDevice(HloComputation* computation, int64_t device); + +// Given an instruction container, returns the device which is most commonly +// occurring among the instructions. +std::optional GetMostOccurringDevice( + absl::Span instructions); + +// Given a set of computations, tries to extract the dominant device. A device +// is dominant if the combined occurrence among all the instructions of the +// input computations, is greater/equal than/to dominant_factor (real number +// from 0 to 1). +// This API does not recurse into called computations. +// If no device exists that satisfies the condition, the returned optional will +// hold no value. +std::optional GetDominantDevice( + absl::Span computations, double dominant_factor); + +// Returns the HloSharding with the tile dimensions and tile assignment +// transposed based on the specified dimension numbers. In case of a tile +// maximal sharding returns the original sharding. +HloSharding TransposeSharding(const HloSharding& sharding, + absl::Span dimensions); + +// Returns the HloSharding with the tile shape reshaped based on the source and +// target shapes and the tile assignment adjusted to correspond to the new tile +// shape or std::nullopt if the resulting reshape would create an invalid +// sharding (non continuous or non uniformly sized tiles). In case of a tile +// maximal sharding returns the original sharding. +std::optional ReshapeSharding(const Shape& source_shape, + const Shape& target_shape, + const HloSharding& sharding); + +// Propagates sharding through reshape. It tries to find partial matches on +// subsets of dimensions that could satisfy ReshapeSharding() constraints, then +// combine them. It doesn't require all dimensions to satisfy the constraints +// of ReshapeSharding(). +HloSharding PropagateShardingThroughReshape(const Shape& source_shape, + const Shape& target_shape, + const HloSharding& sharding); + +// Returns the HloSharding with the tile dimensions and tile assignment +// reversed based on the specified dimension numbers. In case of a tile +// maximal sharding returns the original sharding. +HloSharding ReverseSharding(const HloSharding& sharding, + absl::Span dimensions); + +// Returns a sharding tiled on unique dimension dim by reshaping the tile +// assignment of the sharding argument. Only dimensions in the dims span +// argument are considered for reshaping, the others are ignored. +// Assumptions: sharding is tile sharded, and dim must be included in dims. +HloSharding ReshapeToTileDimension(const HloSharding& sharding, int64_t dim, + absl::Span dims); + +// Returns true if the provided module includes one or more instructions with +// a tile sharding. +bool ContainsTileSharding(const HloModule& module); + +// Returns the preferred output sharding for a gather op based on the sharding +// of the indces. +HloSharding GatherOutputShardingFromIndexIndexPassthroughDimensions( + const HloSharding& index_sharding, const HloInstruction* hlo); + +// Returns the preferred index sharding for a gather op based on the sharding +// of the output. +HloSharding GatherIndexShardingFromOutputIndexPassthroughDimensions( + const HloSharding& output_sharding, const HloInstruction* hlo); + +// Returns a new HloSharding for a gather op so that only non offset dimensions +// are sharded. Assume "result" is returned by this function. It is ensured that +// "GetIndexSharding(result, hlo)" will have the same number of elements as +// "result". +HloSharding GatherEffectiveOutputSharding(const HloInstruction& hlo); + +// Returns the preferred index sharding for a scatter op based on the sharding +// of the data. +HloSharding ScatterIndexShardingFromUpdateIndexPassthroughDimensions( + const HloSharding& update_sharding, const HloScatterInstruction* scatter); + +// Returns the preferred data sharding for a scatter op based on the sharding +// of the index. +HloSharding ScatterUpdateShardingFromIndexIndexPassthroughDimensions( + const HloSharding& index_sharding, const HloScatterInstruction* scatter); + +// Returns a new index sharding for a scatter op so that we only shard on first +// "number of scatter_window_dims" dimensions. Assume "result" is returned by +// this function. It is ensured that +// "ScatterUpdateShardingFromIndexIndexPassthroughDimensions(result, hlo)" will +// have the same number of elements as "result". +HloSharding ScatterEffectiveIndexSharding(const HloSharding& index_sharding, + const HloScatterInstruction& scatter); + +// Returns a new data sharding for a scatter op so that we only shard on +// scatter_window_dims. Assume "result" is returned by this function. It is +// ensured that +// "ScatterIndexShardingFromUpdateIndexPassthroughDimensions(result, hlo)" will +// have the same number of elements as "result". +HloSharding ScatterEffectiveDataSharding(const HloSharding& data_sharding, + const HloScatterInstruction& scatter); + +// Returns an output sharding of gather by passing through the data operand's +// sharding. +std::optional +GatherOutputShardingFromOperandOperandPassthroughDimensions( + const HloSharding& operand_sharding, const HloInstruction& hlo); + +// Returns an output sharding of gather by passing through the data operand's +// sharding. +std::optional +GatherOutputShardingFromOperandOperandPassthroughDimensions( + const Shape& operand_shape, const HloSharding& operand_sharding, + const HloInstruction& hlo, absl::Span slice_sizes); + +// Returns an output sharding of gather by passing through the data operand's +// sharding on index parallel dimensions +std::optional GatherOperandShardingFromOutputParallelDimensions( + const HloSharding& output_sharding, const HloScatterInstruction& scatter, + const CallGraph& call_graph); + +// Returns a data operand sharding of gather by passing through the output's +// sharding. +std::optional GatherOperandShardingFromOutput( + const HloSharding& output_sharding, const HloInstruction& hlo, + const CallGraph& call_graph); + +// Returns the slice size for a scatter with given operand and update shapes. +std::vector GetScatterSliceSize(const Shape& operand_shape, + const Shape& update_shape, + const ScatterDimensionNumbers& dnums); + +// Returns an output sharding of scatter by passing through the update operand's +// sharding. +std::optional ScatterOutputShardingFromUpdate( + const HloSharding& update_sharding, const HloScatterInstruction& scatter); + +// Returns an update operand sharding of scatter by passing through the output's +// sharding. +std::optional ScatterUpdateShardingFromOutput( + const HloSharding& per_output_sharding, + const HloScatterInstruction& scatter, const CallGraph& call_graph); + +// Returns an update operand sharding of scatter by passing through the output's +// sharding on operand pass-through dimensions. +std::optional +ScatterUpdateShardingFromOutputOperandPassthroughDimensions( + const HloSharding& output_sharding, const HloInstruction& hlo); + +// Returns an update operand sharding of scatter by passing through the output's +// sharding on operand pass-through dimensions. +std::optional +ScatterUpdateShardingFromOutputOperandPassthroughDimensions( + const Shape& output_shape, const HloSharding& output_sharding, + const HloInstruction& hlo, absl::Span slice_sizes); + +// Returns an update operand sharding of scatter by passing through the output's +// sharding on index parallel dimensions. +std::optional ScatterUpdateShardingFromOutputParallelDimensions( + const HloSharding& output_sharding, const HloScatterInstruction& scatter, + const CallGraph& call_graph); + +// Returns an output sharding of gather or update operand sharding of scatter by +// passing through the indices' sharding on index parallel dimensions. +HloSharding GatherOutputOrScatterUpdateShardingFromIndicesParallelDimensions( + const HloSharding& indices_sharding, + const int64_t output_or_update_shape_rank, + absl::Span indices_parallel_dims, + absl::Span output_or_update_parallel_dims); + +// Returns an identity value and an HloOpcode for reduce computation of scatter +// instruction. +// - If computation is add/or, return 0/false with corresponding op code; +// - If computation is multiply/and, return 1/true with corresponding op code. +// - If computation is min/max, return max value/min value with corresponding op +// code. +// - Otherwise, return error status. +StatusOr, HloOpcode>> +IdentityValueAndHloOpcodeForScatterReduceComputation( + const HloScatterInstruction& scatter); + +// Given a sharding and a list of devices in the topology, return a +// list of the devices that `sharding` applies to. +std::vector DevicesForSharding( + const HloSharding& sharding, absl::Span available_devices); + +// Returns a sharding that replicates data across devices along the given +// dimensions in the original sharding. +HloSharding PartiallyReplicateTiledShardingOnDims( + const HloSharding& sharding, absl::Span dims_to_replicate); + +// Returns a sharding that replicates data across devices along all dimensions +// but the given ones to keep in the original sharding. +HloSharding PartiallyReplicateTiledShardingOnAllDimsExcept( + const HloSharding& sharding, absl::Span dims_to_keep); + +// Returns a sharding that replicates all data dimensions, but keep manual +// subgroups. If data_rank is provided >= 0, the result sharding's data rank +// will be set to it. +HloSharding ReplicateAllDataDims(const HloSharding& sharding, + int64_t data_rank = -1); + +// Returns a sharding the removes given tile dimensions. +// +// Precondition: if not tile maximal, the size of each tile dimension must be 1. +HloSharding RemoveShapeDimensions(const HloSharding& sharding, + absl::Span dims_to_remove); + +// Similar to TransposeSharding(), but allows removing/adding non-partitioned +// dimensions. In src_to_tgt and tgt_to_src, -1 represents a non-existing +// dimension. +std::optional TransposeShardingWithCollapsedDims( + const HloSharding& source, absl::Span src_to_tgt, + absl::Span tgt_to_src); + +// Returns the iota dimension if maybe_iota is an kIota instruction or +// equivalent to kIota. +std::optional GetDimensionForIota(const HloInstruction* maybe_iota, + const CallGraph& call_graph); + +// Returns identified parallel dimensions of operands and indices for Gather. +std::optional GetGatherParallelBatchDims( + const HloInstruction& hlo, const CallGraph& call_graph); + +// Returns identified parallel dimensions of operands and indices for Scatter. +std::optional GetScatterParallelBatchDims( + const HloInstruction& hlo, const CallGraph& call_graph); + +// Returns the parallel dimensions of the output of a gather based on the +// parallel dimensions of the operands and indices. +absl::InlinedVector GetGatherParallelOutputDims( + const HloInstruction& hlo, const GatherScatterParallelDims& parallel_dim); + +// Returns the parallel dimensions of the update of a scatter based on the +// parallel dimensions of the operands and indices. +absl::InlinedVector GetScatterParallelUpdateDims( + const HloInstruction& hlo, const GatherScatterParallelDims& parallel_dim); + +// Returns the operand pass-through dimensions for gather operand. +absl::InlinedVector GetGatherOperandPassthroughOperandDims( + const Shape& operand_shape, const HloSharding& operand_sharding, + const HloInstruction& hlo, absl::Span slice_sizes); + +// Returns the operand pass-through dimensions for scatter operand(s). +absl::InlinedVector GetScatterOperandPassthroughOperandDims( + const Shape& operand_shape, const HloSharding& operand_sharding, + const HloInstruction& hlo, absl::Span slice_sizes); + +absl::InlinedVector GetGatherOperandPassthroughOutputDims( + const Shape& output_shape, const Shape& operand_shape, + const HloSharding& operand_sharding, const HloInstruction& hlo, + absl::Span slice_sizes); + +absl::InlinedVector GetScatterOperandPassthroughUpdateDims( + const Shape& update_shape, const Shape& operand_shape, + const HloSharding& operand_sharding, const HloInstruction& hlo, + absl::Span slice_sizes); + +// Returns the index pass-through dimensions for gather/scatter indices. +absl::InlinedVector GetGatherScatterIndexPassthroughIndexDims( + const int64_t indices_rank, const int64_t index_vector_dim); + +// Returns the index pass-through dimensions for gather output/scatter update. +absl::InlinedVector +GetGatherScatterIndexPassthroughOutputOrUpdateDims( + const int64_t output_or_update_rank, + absl::Span offset_or_window_dims); + +// Returns the parallel dimensions of the data operand of a gather/scatter with +// the order of the parallel dimensions matching that of the parallel dimensions +// of the indices. +absl::InlinedVector IndexAlignedOperandParallelDims( + const GatherScatterParallelDims& parallel_dims); + +// Represents grouping devices in a tiled sharding along certain dimensions. +// Elements in group dimensions define different device groups, and the sharding +// represents the in-group sharding. +struct GroupedSharding { + GroupedSharding(std::vector> device_groups, + std::vector group_dims, + std::vector group_dim_sizes, int64_t data_rank, + HloSharding grouped_sharding, bool subgroup_manual = false) + : device_groups(std::move(device_groups)), + group_dims(std::move(group_dims)), + group_dim_sizes(std::move(group_dim_sizes)), + data_rank(data_rank), + sharding(std::move(grouped_sharding)), + subgroup_manual(subgroup_manual) {} + std::string ToString() const; + std::vector> device_groups; + std::vector group_dims; + std::vector group_dim_sizes; + int64_t data_rank; + HloSharding sharding; + bool subgroup_manual; +}; + +// Creates a GroupedSharding for a tiled sharding with group dim shard sizes. +GroupedSharding GroupShardingOnDims(const HloSharding& sharding, + absl::Span group_dims, + absl::Span group_dim_shards, + bool subgroup_manual = false); + +// Creates a GroupedSharding for a tiled sharding. +GroupedSharding GroupShardingOnDims(const HloSharding& sharding, + absl::Span group_dims, + bool subgroup_manual = false); + +// Same as above, but exclude group dims instead. +GroupedSharding GroupShardingOnAllDimsExcept( + const HloSharding& sharding, absl::Span non_group_dims, + bool subgroup_manual = false); + +// Creates a GroupedSharding by trying to do the following in sequence: +// +// 1. Group on partially replicated dimensions, which preserves the existing +// tiled sharding in the group. +// 2. If option 1 doesn't have enough dimensions, try borrowing dimensions from +// replicable_dims in order, until it has enough dimensions. This partly +// preserves the existing tiled sharding in the group. (e.g. if we need 4 +// groups, while our sharding is {[4,8,2]<=[64] last_tile_dim_replicate}, and if +// we borrow 2 dimensions from the first dimension(i.e. the 4-way partition), +// combined with the partially replicated 2, we will be able to group the +// sharding into 4 groups, and we have grouped sub-sharding [2,8]<=[16] instead. +// 3. Otherwise replicate the whole thing. +// +// This does not guarantee the consistency of the ordering of the tile +// assignment, and should be used with AlignGroup where its tile assignment +// doesn't matter and will always align to some other tile assignment. +GroupedSharding GroupShardingOnReplicatedDim( + const HloSharding& sharding, int64_t num_groups, int64_t num_tiles, + int64_t data_rank, absl::Span replicable_dims = {}); + +// Get group sharding for replicated sharding. +GroupedSharding GetGroupedReplicatedSharding(const int64_t num_groups, + const int64_t num_tiles, + const int64_t data_rank); + +// Get group sharding for each manual subgroup. +GroupedSharding GetManualSubgroupSharding(const HloSharding& sharding); + +// Create a group sharding over the partially replicated dimension re-using an +// existing device group subdivision to avoid unexpected devices reordering. +std::optional +PartialReplicatedGroupShardingWithAssignedDeviceGroups( + const HloSharding& sharding, int64_t num_shards, + const std::vector>& device_groups); + +// Reconstructs the ungrouped sharding from a GroupedSharding. +HloSharding UngroupSharding(const GroupedSharding& grouped_sharding); + +// Check if the device groups are match for the LHS or RHS group shardings. +bool DeviceGroupsAreMatch(GroupedSharding& lhs, GroupedSharding& rhs, + bool ignore_group_order = true); + +// Spawns a new dimension by splitting an existing dimension and generating a +// new dimension to its right of the passed down size. The original dimension +// will be of size "original_dim_size / new_dim_size". The original dimension +// size needs to be divisible by new_dim_size. +HloSharding SplitShardingDimension(const HloSharding& sharding, + int64_t dimension, int64_t new_dim_size); + +// Merges a dimension +// to its left. The new dimension will be of size +// dimensions[dimension] * dimensions[dimension+1}. +HloSharding MergeShardingDimension(const HloSharding& sharding, + int64_t dimension); + +// Creates a tuple sharding by combining sharding on the elements of the tuple. +// If none of the elements have a sharding, return nullptr. +std::shared_ptr CreateTupleSharding( + const Shape& shape, absl::Span elements); + +// Tests whether the sort operand is sharded along the sort dimension and there +// exists a free (i.e., unsharded) dimension to move the sharding into. +bool IsSortOperandShardingMovable(const HloInstruction* sort_operand, + int64_t sort_dim); + +// Returns a set of parallel dimensions for Gather/Scatter instructions given +// the parameters for the op. +std::optional GetGatherScatterBatchParallelDims( + const HloInstruction* indices, absl::Span slice_sizes, + int64_t index_vector_dim, absl::Span index_map, + const CallGraph& call_graph); + +// Returns the sharding of an output of an instruction. Some instructions have +// special handling like Outfeed and this function takes care of those. +std::optional GetOutputSharding(const HloInstruction* instruction); + +} // namespace hlo_sharding_util +} // namespace xla + +#endif // XLA_HLO_UTILS_HLO_SHARDING_UTIL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/index_util.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/index_util.h new file mode 100644 index 0000000000000000000000000000000000000000..e096b93c00c4816014d13515b11c9ee9a2d91a2b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/index_util.h @@ -0,0 +1,159 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +// Utility functions related to layouts of Shapes. + +#ifndef XLA_INDEX_UTIL_H_ +#define XLA_INDEX_UTIL_H_ + +#include + +#include "absl/types/span.h" +#include "xla/shape.h" +#include "xla/shape_util.h" +#include "xla/types.h" +#include "xla/xla_data.pb.h" + +namespace xla { + +// Namespaced collection of (static) utilities related to indexing into +// multidimensional arrays. +class IndexUtil { + public: + // Converts a multidimensional index (eg {x, y, z}) into a linear index based + // on the shape and its layout. The first index in the multi_index is + // dimension 0. + static inline int64_t MultidimensionalIndexToLinearIndex( + const Shape& shape, absl::Span multi_index) { + return MultidimensionalIndexToLinearIndex( + shape, LayoutUtil::MinorToMajor(shape), multi_index); + } + + // Converts a multidimensional index (eg {x, y, z}) into a linear index based + // on the shape and its layout. The first index in the multi_index is + // dimension 0. + // + // This version can be used when the caller already has the minor_to_major + // array for shape available (and can therefore be faster). + // + // REQUIRES: minor_to_major provided is equal to + // shape.layout().minor_to_major() + static inline int64_t MultidimensionalIndexToLinearIndex( + const Shape& shape, absl::Span minor_to_major, + absl::Span multi_index) { + // Let the array be sized like so for dimensions i from 0 to n-1: + // + // [D{n-1} x D{n-2} x .. x D{0}] + // + // Let the order of the dimensions in the minor_to_major field in + // Layout be: + // + // L(0), L(1), ... , L(n-1) + // + // where L(0) is the most-minor dimension and L(n-1) the most-major. The + // multidimensional index: + // + // [I{0}, I{1}, ... , I{n-1}] + // + // then corresponds to the following linear index: + // + // linear_index = + // ((( ... + I{L(2)}) * D{L(1)} + I{L(1)}) * D{L(0)} + I{L(0)} + // + // or equivalently: + // + // linear_index = + // I{L(n-1)} * (D{L(n-2)} * D{L(n-3)} * D{L(n-4)} * .... D{L(0)}) + + // I{L(n-2)} * (D{L(n-3)} * D{L(n-4)} * .... D{L(0)}) + + // I{L(n-3)} * (D{L(n-4)} * .... D{L(0)}) + + // ... + + // I{L(2)} * (D{L(1)} * D{L(0)}) + + // I{L(1)} * D{L(0)} + + // I{L(0)} + // + // We compute the linear index value by accumulating the terms above from + // I{L(0)} up to I{L(n-1)}. Scale accumulates the product term D{L(0}} * + // D{L(1)} * ... + + // Scale factor holding the growing product of D{L(i)} terms. + for (size_t i = 0; i < multi_index.size(); ++i) { + DCHECK_GE(multi_index[i], 0); + DCHECK_LT(multi_index[i], shape.dimensions(i)) + << "indexing beyond extent in dimension " << i << ":" + << "\n\tindex: " << absl::StrJoin(multi_index, ",") + << "\n\tshape: " << ShapeUtil::HumanString(shape); + } + if (minor_to_major.empty()) { + return 0; + } + int64_t linear_index = multi_index[minor_to_major[0]]; + int64_t scale = 1; + for (int i = 1; i < minor_to_major.size(); ++i) { + scale *= shape.dimensions(minor_to_major[i - 1]); + linear_index += scale * multi_index[minor_to_major[i]]; + } + return linear_index; + } + + // Converts a linear index into multidimensional index (eg {x, y, z}) based on + // the shape and its layout. The first index in the returned multidimensional + // index is dimension 0. + static std::vector LinearIndexToMultidimensionalIndex( + const Shape& shape, int64_t linear_index); + + // Bumps a sequence of indices; e.g. {0,0,0,0} up by one index value; e.g. to + // {0,0,0,1}. This is akin to std::next_permutation. If the index hits a limit + // for the provided shape, the next most significant index is bumped, in a + // counting-up process. + // + // E.g. for shape f32[2,3] + // {0,0}=>{0,1} + // {0,1}=>{0,2} + // {0,2}=>{1,0} + // etc. + // + // This is useful for traversing the indices in a literal. + // + // Returns true iff the indices were successfully bumped; false if we've hit + // the limit where it can no longer be bumped in-bounds. + static bool BumpIndices(const Shape& shape, absl::Span indices); + + // Calculates the stride size (in number of elements, not byte size) of a + // given logical shape dimension (from 0 to rank-1). + // Example: + // GetDimensionStride(F32[5,8,10,4]{3,2,1,0}, 1) == + // sizeof(dimension(3)) * sizeof(dimension(2)) == 4 * 10 + static int64_t GetDimensionStride(const Shape& shape, int64_t dimension); + + // Returns true iff the given multi-index is contained in the bounds for the + // shape. + static bool IndexInBounds(const Shape& shape, + absl::Span index); + + // Compares the given indices in lexicographic order. lhs[0] and rhs[0] are + // compared first, and lhs[rank-1] and rhs[rank-1] last. If lhs is larger, + // then -1 is returned. If rhs is larger, then 1 is returned. Otherwise, 0 is + // returned. + static int CompareIndices(absl::Span lhs, + absl::Span rhs); + + private: + IndexUtil(const IndexUtil&) = delete; + IndexUtil& operator=(const IndexUtil&) = delete; +}; + +} // namespace xla + +#endif // XLA_INDEX_UTIL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/iterator_util.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/iterator_util.h new file mode 100644 index 0000000000000000000000000000000000000000..23367890adcc7f89f3e038d55fc9771a8097964e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/iterator_util.h @@ -0,0 +1,178 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_ITERATOR_UTIL_H_ +#define XLA_ITERATOR_UTIL_H_ + +#include +#include +#include + +#include "tsl/lib/gtl/iterator_range.h" + +namespace xla { + +// UnwrappingIterator is a transforming iterator that calls get() on the +// elements it returns. +// +// Together with tsl::gtl::iterator_range, this lets classes which +// contain a collection of smart pointers expose a view of raw pointers to +// consumers. For example: +// +// class MyContainer { +// public: +// tsl::gtl::iterator_range< +// UnwrappingIterator>::iterator>> +// things() { +// return {MakeUnwrappingIterator(things_.begin()), +// MakeUnwrappingIterator(things_.end())}; +// } +// +// tsl::gtl::iterator_range>::const_iterator>> +// things() const { +// return {MakeUnwrappingIterator(things_.begin()), +// MakeUnwrappingIterator(things_.end())}; +// } +// +// private: +// std::vector> things_; +// }; +// +// MyContainer container = ...; +// for (Thing* t : container.things()) { +// ... +// } +// +// For simplicity, UnwrappingIterator is currently unconditionally an +// input_iterator -- it doesn't inherit any superpowers NestedIterator may have. +template +class UnwrappingIterator { + public: + using iterator_category = std::input_iterator_tag; + using value_type = decltype(std::declval()->get()); + using difference_type = ptrdiff_t; + using pointer = value_type*; + using reference = value_type&; + + explicit UnwrappingIterator(NestedIter iter) : iter_(std::move(iter)) {} + + auto operator*() -> value_type { return iter_->get(); } + UnwrappingIterator& operator++() { + ++iter_; + return *this; + } + UnwrappingIterator operator++(int) { + UnwrappingIterator temp(iter_); + operator++(); + return temp; + } + + friend bool operator==(const UnwrappingIterator& a, + const UnwrappingIterator& b) { + return a.iter_ == b.iter_; + } + + friend bool operator!=(const UnwrappingIterator& a, + const UnwrappingIterator& b) { + return !(a == b); + } + + private: + NestedIter iter_; +}; + +template +UnwrappingIterator MakeUnwrappingIterator(NestedIter iter) { + return UnwrappingIterator(std::move(iter)); +} + +// An iterator that filters out values where the predicate(value) evaluates to +// false. An unwrapping iterator can be nested inside a filtering iterator to +// also unwrap smart pointers. +template +class FilteringIterator { + public: + using iterator_category = std::input_iterator_tag; + using value_type = decltype(*std::declval()); + using difference_type = ptrdiff_t; + using pointer = value_type*; + using reference = value_type&; + + FilteringIterator(NestedIter iter, NestedIter end_iter, UnaryPredicate pred) + : iter_(std::move(iter)), + end_iter_(std::move(end_iter)), + pred_(std::move(pred)) { + if (iter_ != end_iter_ && !pred_(**this)) { + ++*this; + } + } + + auto operator*() -> value_type { return *iter_; } + FilteringIterator& operator++() { + do { + ++iter_; + } while (iter_ != end_iter_ && !pred_(**this)); + return *this; + } + FilteringIterator operator++(int) { + FilteringIterator temp(iter_, end_iter_, pred_); + operator++(); + return temp; + } + + friend bool operator==(const FilteringIterator& a, + const FilteringIterator& b) { + return a.iter_ == b.iter_; + } + + friend bool operator!=(const FilteringIterator& a, + const FilteringIterator& b) { + return !(a == b); + } + + private: + NestedIter iter_; + NestedIter end_iter_; + UnaryPredicate pred_; +}; + +template +using FilteringUnwrappingIterator = + FilteringIterator, UnaryPredicate>; + +// Create and return a filtering unwrapping iterator. +template +FilteringUnwrappingIterator +MakeFilteringUnwrappingIterator(NestedIter iter, NestedIter end_iter, + UnaryPredicate pred) { + return FilteringUnwrappingIterator( + MakeUnwrappingIterator(iter), MakeUnwrappingIterator(end_iter), + std::move(pred)); +} + +// Create and return a filtering unwrapping iterator range. +template +tsl::gtl::iterator_range< + FilteringUnwrappingIterator> +MakeFilteringUnwrappingIteratorRange(NestedIter begin_iter, NestedIter end_iter, + UnaryPredicate pred) { + return {MakeFilteringUnwrappingIterator(begin_iter, end_iter, pred), + MakeFilteringUnwrappingIterator(end_iter, end_iter, pred)}; +} + +} // namespace xla + +#endif // XLA_ITERATOR_UTIL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/layout.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/layout.h new file mode 100644 index 0000000000000000000000000000000000000000..c64806c0b2644d0abe490ff9c86dd727f3964e88 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/layout.h @@ -0,0 +1,411 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_LAYOUT_H_ +#define XLA_LAYOUT_H_ + +#include +#include +#include +#include +#include + +#include "absl/container/inlined_vector.h" +#include "absl/types/span.h" +#include "xla/printer.h" +#include "xla/util.h" +#include "xla/xla_data.pb.h" +#include "tsl/platform/logging.h" // IWYU pragma: keep + +namespace xla { + +class Shape; + +// Describes a tile used in tiling-based layout. Refer to +// g3doc/third_party/tensorflow/compiler/xla/g3doc/tiled_layout.md for +// details. +class Tile { + public: + Tile() = default; + explicit Tile(absl::Span dimensions) + : dimensions_(dimensions.begin(), dimensions.end()) {} + + // De/Serialize a Tile to and from a TileProto. + static Tile CreateFromProto(const TileProto& tile_proto) { + return Tile(tile_proto.dimensions()); + } + TileProto ToProto() const; + + bool operator==(const Tile& other) const { + return dimensions() == other.dimensions(); + } + bool operator!=(const Tile& other) const { return !(*this == other); } + + void Print(Printer* printer) const; + + std::string ToString() const; + + // Returns the bound of the tile in the given dimension index. + int64_t dimension(int i) const { return dimensions_.at(i); } + + // Returns the dimensions of the tile. + absl::Span dimensions() const { return dimensions_; } + + Tile& add_dimensions(int64_t value) { + dimensions_.push_back(value); + return *this; + } + + Tile& clear_dimensions() { + dimensions_.clear(); + return *this; + } + + // This dimension size means the corresponding dimension in the shape is + // combined with the next minor dimension before tiling is applied. + static constexpr int64_t kCombineDimension = + std::numeric_limits::min(); + + template + friend H AbslHashValue(H h, const Tile& t) { + return H::combine(std::move(h), t.dimensions_); + } + + private: + // The bounds of the tile. + absl::InlinedVector dimensions_; +}; + +using TileVector = absl::InlinedVector; + +// TODO: Rename the `dim_level_types` field to `lvl_types`, so that it +// matches `mlir::sparse_tensor::SparseTensorEncodingAttr`. +class Layout { + public: + Layout(); + Layout(const Layout& other); + Layout(Layout&& other); + ~Layout(); + + // Constructs a dense layout with the given minor-to-major order. + explicit Layout(absl::Span minor_to_major); + + // Constructs a dense tiled layout with the given minor-to-major order, dim + // level types, and tiles. + explicit Layout(absl::Span minor_to_major, + absl::Span dim_level_types, + absl::Span dim_unique, + absl::Span dim_ordered, + absl::Span tiles, + PrimitiveType index_primitive_type = PRIMITIVE_TYPE_INVALID, + PrimitiveType element_primitive_type = PRIMITIVE_TYPE_INVALID, + int64_t element_size_in_bits = 0, int64_t memory_space = 0, + std::unique_ptr physical_shape = nullptr, + int64_t dynamic_shape_metadata_prefix_bytes = 0); + + Layout& operator=(const Layout& other); + Layout& operator=(Layout&& other); + + // Construct a shape from a LayoutProto. + static Layout CreateFromProto(const LayoutProto& proto); + + // Returns a LayoutProto representation of the Layout. + LayoutProto ToProto() const; + + // Prints a human-readable string that represents this layout. + void Print(Printer* printer) const; + + // Returns a human-readable string that represents this layout. + std::string ToString() const; + + // Equal is a configurable functor to check the equality of two layouts. + // + // Examples: + // + // - Comparing two layouts ignoring their difference in tiles: + // Equal().IgnoreTiles()(layout1, layout2); + class Equal { + public: + Equal() = default; + + bool operator()(const Layout& lhs, const Layout& rhs); + + Equal& IgnoreTiles() { + ignore_tiles_ = true; + return *this; + } + + Equal& IgnoreIndexPrimitiveType() { + ignore_index_primitive_type_ = true; + return *this; + } + + Equal& IgnorePointerPrimitiveType() { + ignore_pointer_primitive_type_ = true; + return *this; + } + + Equal& IgnoreMemorySpace() { + ignore_memory_space_ = true; + return *this; + } + + Equal& IgnorePhysicalShape() { + ignore_physical_shape_ = true; + return *this; + } + + Equal& IgnoreElementSize() { + ignore_element_size_ = true; + return *this; + } + + Equal& MinorToMajorOnly() { + return IgnoreTiles() + .IgnoreIndexPrimitiveType() + .IgnorePointerPrimitiveType() + .IgnoreMemorySpace() + .IgnorePhysicalShape() + .IgnoreElementSize(); + } + + private: + bool ignore_tiles_ = false; + bool ignore_element_size_ = false; + bool ignore_index_primitive_type_ = false; + bool ignore_pointer_primitive_type_ = false; + bool ignore_memory_space_ = false; + bool ignore_physical_shape_ = false; + }; + + bool operator==(const Layout& other) const; + bool operator!=(const Layout& other) const { return !(*this == other); } + + // The following methods mirror the protobuf generated code interface for the + // message LayoutProto. This enabled easy migration of this data structure + // from a proto to a proper C++ class. + // + // TODO(b/29771030): Replace or augment these methods with a more ergonomic + // interface. + + // Methods for accessing the DimLevelType array. + int dim_level_types_size() const { return dim_level_types_.size(); } + DimLevelType dim_level_type(int index) const { + return dim_level_types_.at(index); + } + Layout& set_dim_level_type(int index, DimLevelType dim_level_type) { + dim_level_types_.at(index) = dim_level_type; + return *this; + } + Layout& add_dim_level_type(DimLevelType dim_level_type) { + dim_level_types_.push_back(dim_level_type); + return *this; + } + Layout& clear_dim_level_types() { + dim_level_types_.clear(); + return *this; + } + absl::Span dim_level_types() const { + return dim_level_types_; + } + DimLevelTypeVector* mutable_dim_level_types() { return &dim_level_types_; } + + // Methods for accessing the dim_unique array. + int dim_unique_size() const { return dim_unique_.size(); } + bool dim_unique(int index) const { return dim_unique_.at(index); } + Layout& set_dim_unique(int index, bool unique) { + dim_unique_.at(index) = unique; + return *this; + } + Layout& add_dim_unique(bool unique) { + dim_unique_.push_back(unique); + return *this; + } + Layout& clear_dim_unique() { + dim_unique_.clear(); + return *this; + } + absl::Span dim_unique() const { return dim_unique_; } + absl::InlinedVector* mutable_dim_unique() { + return &dim_unique_; + } + + // Methods for accessing the dim_ordered array. + int dim_ordered_size() const { return dim_ordered_.size(); } + bool dim_ordered(int index) const { return dim_ordered_.at(index); } + Layout& set_dim_ordered(int index, bool ordered) { + dim_ordered_.at(index) = ordered; + return *this; + } + Layout& add_dim_ordered(bool ordered) { + dim_ordered_.push_back(ordered); + return *this; + } + Layout& clear_dim_ordered() { + dim_ordered_.clear(); + return *this; + } + absl::Span dim_ordered() const { return dim_ordered_; } + absl::InlinedVector* mutable_dim_ordered() { + return &dim_ordered_; + } + + // Methods for accessing the minor-to-major array. + int minor_to_major_size() const { return minor_to_major_.size(); } + int64_t minor_to_major(int index) const { return minor_to_major_.at(index); } + Layout& set_minor_to_major(int index, int64_t value) { + minor_to_major_.at(index) = value; + return *this; + } + Layout& add_minor_to_major(int64_t value) { + minor_to_major_.push_back(value); + return *this; + } + Layout& clear_minor_to_major() { + minor_to_major_.clear(); + return *this; + } + // Removes the given dimension from 'minor_to_major_', and adjusts the other + // dimensions accordingly. Also adjusts 'dim_level_types_', 'dim_ordered_' and + // 'dim_unique_' in case it is a sparse layout. + Layout& DeleteDimension(int64_t dim_to_delete); + absl::Span minor_to_major() const { return minor_to_major_; } + DimensionVector* mutable_minor_to_major() { return &minor_to_major_; } + + // Methods for accessing the tile field. + int64_t tiles_size() const { return tiles_.size(); } + const Tile& tiles(int index) const { return tiles_.at(index); } + Tile* mutable_tiles(int index) { return &tiles_.at(index); } + Tile* add_tiles() { + tiles_.push_back(Tile()); + return &tiles_.back(); + } + Layout& clear_tiles() { + tiles_.clear(); + return *this; + } + absl::Span tiles() const { return tiles_; } + TileVector* mutable_tiles() { return &tiles_; } + + int64_t element_size_in_bits() const { return element_size_in_bits_; } + Layout& set_element_size_in_bits(int64_t value) { + element_size_in_bits_ = value; + return *this; + } + + PrimitiveType index_primitive_type() const { return index_primitive_type_; } + Layout& set_index_primitive_type(PrimitiveType value) { + index_primitive_type_ = value; + return *this; + } + + PrimitiveType pointer_primitive_type() const { + return pointer_primitive_type_; + } + Layout& set_pointer_primitive_type(PrimitiveType value) { + pointer_primitive_type_ = value; + return *this; + } + + static constexpr int64_t kDefaultMemorySpace = 0; + static constexpr int64_t kGenericFastMemorySpace = 1; + int64_t memory_space() const { return memory_space_; } + Layout& set_memory_space(int64_t value) { + memory_space_ = value; + return *this; + } + + // Methods for accessing the physical shape. + bool has_physical_shape() const { return physical_shape_ != nullptr; } + const Shape& physical_shape() const { + CHECK(has_physical_shape()); + return *physical_shape_; + } + Shape* mutable_physical_shape(); + void clear_physical_shape(); + + int64_t dynamic_shape_metadata_prefix_bytes() const { + return dynamic_shape_metadata_prefix_bytes_; + } + void set_dynamic_shape_metadata_prefix_bytes(int64_t bytes) { + dynamic_shape_metadata_prefix_bytes_ = bytes; + } + + void Swap(Layout* other) { + using std::swap; + swap(*this, *other); + } + + void Clear() { *this = Layout(); } + + template + friend H AbslHashValue(H h, const Layout& l) { + return H::combine(std::move(h), l.minor_to_major_, l.tiles_, + l.element_size_in_bits_, l.index_primitive_type_, + l.pointer_primitive_type_, l.memory_space_); + } + + private: + // The list of dimension level types, indicating the method that will be used + // to represent each dimension of the array. + DimLevelTypeVector dim_level_types_; + + // Whether each DimLevelType is unique and ordered. + absl::InlinedVector dim_unique_; + absl::InlinedVector dim_ordered_; + + // A map from physical dimension numbers to logical dimension numbers. + // The first element is the most minor physical dimension (fastest varying + // index) and the last the most major (slowest varying index). The contents of + // the vector are the indices of the *logical* dimensions in the shape. + // + // For example, in shape f32[8,100,100,3]{3,0,2,1}, the logical dimensions + // are [8,100,100,3] and minor_to_major_ is {3,0,2,1}. + // So, the most minor physical dimension is [8,100,100,3][3], which is size 3. + // The second most minor is [8,100,100,3][0], which is size 8. + // The third most minor is [8,100,100,3][2], which is size 100. + // And the major dim is [8,100,100,3][1], which is size 100. + DimensionVector minor_to_major_; + + // The tiles used in tiling-based layout. + TileVector tiles_; + + // The primitive type to use for sparse array indices and pointers. Each of + // these must either be INVALID, or an unsigned integer type. + PrimitiveType index_primitive_type_ = PRIMITIVE_TYPE_INVALID; + PrimitiveType pointer_primitive_type_ = PRIMITIVE_TYPE_INVALID; + + // The number of bits used to store an individual array element. + // When the value is 0, default to ShapeUtil::ByteSizeOfPrimitiveType. + int64_t element_size_in_bits_ = 0; + + // The assigned memory space. + int64_t memory_space_ = 0; + + // The physical on-device shape used to represent a sparse array. + std::unique_ptr physical_shape_; + + // The dynamic shape metadata size in bytes in front of the shape data. The + // field may be non-zero for a static shape whose associated buffer is for a + // dynamic shape, e.g. a result of SliceToDynamic. + int64_t dynamic_shape_metadata_prefix_bytes_ = 0; +}; + +std::ostream& operator<<(std::ostream& out, const Tile& Tile); +std::ostream& operator<<(std::ostream& out, const Layout& layout); + +} // namespace xla + +#endif // XLA_LAYOUT_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/layout_util.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/layout_util.h new file mode 100644 index 0000000000000000000000000000000000000000..545d3659754049d167029710184ac5e3d9a226c9 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/layout_util.h @@ -0,0 +1,292 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +// Utility functions related to layouts of Shapes. + +#ifndef XLA_LAYOUT_UTIL_H_ +#define XLA_LAYOUT_UTIL_H_ + +#include +#include +#include +#include + +#include "absl/types/span.h" +#include "xla/layout.h" +#include "xla/printer.h" +#include "xla/shape.h" +#include "xla/status.h" +#include "xla/xla_data.pb.h" +#include "tsl/platform/logging.h" // IWYU pragma: keep + +namespace xla { + +// Namespaced collection of (static) Layout utilities. +class LayoutUtil { + public: + LayoutUtil(const LayoutUtil&) = delete; + LayoutUtil& operator=(const LayoutUtil&) = delete; + + // Creates a layout with the given minor-to-major dimension order. (This is a + // convenience function for protobuf construction.) + static Layout MakeLayout( + absl::Span minor_to_major, + absl::Span dim_level_types = {}, + absl::Span dim_unique = {}, + absl::Span dim_ordered = {}, + absl::Span tiles = {}, + PrimitiveType index_primitive_type = PRIMITIVE_TYPE_INVALID, + PrimitiveType pointer_primitive_type = PRIMITIVE_TYPE_INVALID, + int64_t element_size_in_bits = 0, int64_t memory_space = 0, + std::optional physical_shape = std::nullopt, + int64_t dynamic_shape_metadata_prefix_bytes = 0); + + // Similar to MakeLayout, but take indices in reverse order. + static Layout MakeLayoutFromMajorToMinor( + absl::Span major_to_minor); + + // Returns a layout with descending ((i.e. {n-1, n-2, ... 0}) minor-to-major + // dimensions. + static Layout MakeDescendingLayout(int64_t rank); + + // Returns a layout with ascending ((i.e. {0, 1, ... n-1}) minor-to-major + // dimensions. + static Layout MakeAscendingLayout(int64_t rank); + + // Returns default layout for the given shape. + static Layout GetDefaultLayoutForShape(const Shape& shape); + + // Helper functions that create default layouts for various ranks. + static Layout GetDefaultLayoutForRank(int64_t rank); + static Layout GetDefaultLayoutForR2(); + static Layout GetDefaultLayoutForR3(); + static Layout GetDefaultLayoutForR4(); + + // Sets the default layout on the Shape. + static void SetToDefaultLayout(Shape* shape); + + // Returns a shape with the same dimensions as `shape` but with the default + // layout. + static Shape GetWithDefaultLayout(const Shape& shape); + + // Sets the layouts of all Shapes within the given ProgramShape to the + // default. + static void SetToDefaultLayout(ProgramShape* program_shape); + + // Validates that the layout within the given shape is correct. The check + // is performed for all subshapes as well. If missing layouts are allowed + // the check does not fail on array shapes without layouts. + static Status ValidateLayoutInShape(const Shape& shape, + bool allow_missing_layouts = false); + + // Validates that the provided layout satisfies invariants for the given + // shape. + static Status ValidateLayoutForShape(const Layout& layout, + const Shape& shape); + + // Clears the layout in the given Shape. After this function is called, + // HasLayout will return false for the shape. + static void ClearLayout(Shape* shape); + + // Clears the layout on all Shapes within the given ProgramShape. + static void ClearLayout(ProgramShape* program_shape); + + // Clears the tiling fields from the shape and/or all of its subshapes. + static void ClearTiles(Shape* shape); + + // Returns whether the given Shape is an array and has a dense in-memory + // representation. + static bool IsDenseArray(const Shape& shape); + + // Returns whether the given Shape is an array and has a sparse in-memory + // representation. + static bool IsSparseArray(const Shape& shape); + + // Returns whether the given Shape is a sparse array and has a COO (coordinate + // matrix) in-memory representation. + static bool IsCOOArray(const Shape& shape); + + // Returns whether the given Shape is a sparse array and has a CSR (compressed + // sparse row) in-memory representation. + static bool IsCSRArray(const Shape& shape); + + // Returns whether the given Shape is a sparse array and has a CSR (compressed + // sparse row) in-memory representation. + static bool IsCSCArray(const Shape& shape); + + // Returns whether the given Layout has a dense in-memory representation. + static bool IsDense(const Layout& layout); + + // Returns whether the given Layout has a sparse in-memory representation. + static bool IsSparse(const Layout& layout); + + // Returns whether the given Layout represents a COO (coordinate matrix) + // sparse array. + static bool IsCOO(const Layout& layout); + + // Returns whether the given Layout represents a CSC (compressed sparse + // column) array. + static bool IsCSR(const Layout& layout); + + // Returns whether the given Layout represents a CSC (compressed sparse + // column) array. + static bool IsCSC(const Layout& layout); + + // Returns whether the layout is monotonic and dim 0 is minor in the layout. + // * R0 and R1: this is always trivially true. + // * R2+: equivalent to column-major. Dimension 0 is the minor, dimension 1 is + // more major, and so on until dimension N-1 which is the major. + static bool IsMonotonicWithDim0Minor(const Layout& layout); + + // Returns whether the layout is monotonic and dim 0 is major in the layout. + // * R0 and R1: this is always trivially true. + // * R2+: equivalent to row-major. Dimension 0 is the major, dimension 1 is + // more minor, and so on until dimension N-1 which is the minor. + // + // Returns `true` for "default", major-to-minor layouts (e.g. {3,2,1,0}). + static bool IsMonotonicWithDim0Major(const Layout& layout); + + // Returns whether the given shape has a layout. For tuple shapes, true is + // returned only if all elements have layouts. + static bool HasLayout(const Shape& shape); + + // Returns whether all Shapes within the given ProgramShape have layouts. + static bool HasLayout(const ProgramShape& program_shape); + + // Returns whether any subshapes of the shape have custom (!= 0) + // element_size_in_bits. + static bool HasCustomElementSizeInBits(const Shape& shape); + + // Returns whether lhs and rhs are identical. + static bool Equal(const Layout& lhs, const Layout& rhs); + + // Returns the minor_to_major array for the given Shape. Requires that the + // shape is an array. + static inline absl::Span MinorToMajor(const Shape& shape) { + DCHECK(shape.IsArray()); + return shape.layout().minor_to_major(); + } + + static inline absl::Span MinorToMajor(const Layout& layout) { + return layout.minor_to_major(); + } + + // Major(0) is the most major logical dimension number, Major(1) is the + // second-most-major logical dimension number and so on. + // + // This can be used to translate physical dimension numbers to logical + // dimension numbers. Assume that we are numbering the physical dimensions so + // that the most major physical dimension has physical dimension number 0 and + // so on. Then a physical dimension number p corresponds to the logical + // dimension number Major(p). So this function could also be called + // PhysicalToLogical(). + // + // As an example, consider physical dimension number 0, which by definition is + // the most major. Then Major(0) is the most major logical dimension, so Major + // maps the physical dimension number 0 to the most major logical dimension + // number Major(0). + static int64_t Major(const Layout& layout, + int64_t physical_dimension_number) { + DCHECK_LE(0, physical_dimension_number); + DCHECK_LT(physical_dimension_number, layout.minor_to_major_size()); + return Minor(layout, + layout.minor_to_major_size() - 1 - physical_dimension_number); + } + + // Minor(0) is the most minor logical dimension number, minor(1) is the + // second-most-minor logical dimension number and so on. + static inline int64_t Minor(const Layout& layout, + int64_t physical_dimension_number) { + DCHECK_LE(0, physical_dimension_number); + DCHECK_LT(physical_dimension_number, layout.minor_to_major_size()); + return layout.minor_to_major(physical_dimension_number); + } + + // Returns the inverse mapping of the Major() function. More precisely, return + // a vector v such that if l == Major(p), then v[l] == p. + // + // This can be used to translate logical dimension numbers into physical + // dimension numbers. Assume that we are numbering the physical dimensions so + // that the most major physical dimension has physical dimension number 0 and + // so on. Then a logical dimension number l corresponds to the physical + // dimension number MakeLogicalToPhysical(layout)[l]. + // + // In the returned vector, the first element represents the most major logical + // dimension. The element whose contents are 0 represents the most major + // physical dimension, and the element with contents (rank - 1) represents + // the most minor physical dimension. + static std::vector MakeLogicalToPhysical(const Layout& layout); + + // Prints a human-readable string that represents the given layout. + static void PrintHumanString(Printer* printer, const Layout& layout); + + // Returns a human-readable string that represents the given layout. + static std::string HumanString(const Layout& layout); + + // Copies the layout from 'src' to 'dst'. Recursively copies layouts of + // tuples. 'src' and 'dst' need not be compatible but the two shapes must + // have the same tuple structure (if any) and arrays must have the same + // rank. within the shapes must have the same number of dimensions. + static Status CopyLayoutBetweenShapes(const Shape& src, Shape* dst); + + // Returns true if the layouts of lhs and rhs are equal, false + // otherwise. Recursively compares layouts of tuples. + // + // lhs and rhs need not be compatible to have the same layout but the two + // shapes must have the same tuple structure (if any) and arrays must have the + // same rank. Element type is ignored. + static bool LayoutsInShapesEqual(const Shape& lhs, const Shape& rhs); + + // Returns whether the given dimensions are consecutive in the given layout, + // not necessarily in the order given. + static bool AreDimensionsConsecutive(const Layout& layout, + absl::Span dims); + + // Constructs a new layout by making the given dimension `dim` in the given + // layout `layout` as the most major dimension. + static Layout MoveDimToMajor(const Layout& layout, int64_t dim); + + // Returns the linearized index of the cell at the given indices. The unit + // of the offset is in elements of the shape. + // + // NOTE: this method only uses the top-level tile and disregards the sub-tile + // in the layout. This method is also performance critical. + static int64_t LinearIndex(const Shape& shape, + absl::Span indices); + + // If the shape has a layout, returns the contained memory space. Otherwise, + // returns Layout::kDefaultMemorySpace. + static int64_t MemorySpace(const Shape& shape); + + static xla::DimLevelType GetDimLevelType(const Layout& layout, int64_t dim); + static bool DimUnique(const Layout& layout, int64_t dim); + static bool DimOrdered(const Layout& layout, int64_t dim); + + // Return true iff the given DimLevelType and dim_unique/dim_ordered values + // represent a valid encoding. + static bool ValidateDimLevel(xla::DimLevelType dim_level_type, + bool dim_unique, bool dim_ordered); + + // Returns true if `byte_strides` is major to minor order, i.e. the strides + // form a cumulative product of the byte size and dimensions in reverse order + // and the smallest stride is the byte size for `element_type`. + static bool ByteStridesIsMajorToMinor(absl::Span byte_strides, + absl::Span dims, + PrimitiveType element_type); +}; + +} // namespace xla + +#endif // XLA_LAYOUT_UTIL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/lazy.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/lazy.h new file mode 100644 index 0000000000000000000000000000000000000000..e296a41403a1c8a6a6956826746ffd253191b44f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/lazy.h @@ -0,0 +1,45 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_LAZY_H_ +#define XLA_LAZY_H_ + +#include + +#include "absl/functional/any_invocable.h" + +namespace xla { + +template +class Lazy { + public: + explicit Lazy(absl::AnyInvocable func) + : maybe_value_(std::move(func)) {} + + const T& get() const { + if (!std::holds_alternative(maybe_value_)) { + maybe_value_ = + std::move(std::get>(maybe_value_))(); + } + return std::get(maybe_value_); + } + + private: + mutable std::variant, T> maybe_value_; +}; + +} // namespace xla + +#endif // XLA_LAZY_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/literal.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/literal.h new file mode 100644 index 0000000000000000000000000000000000000000..2c6b43cad4e1ca50bb374df175f085d4df9b7ce7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/literal.h @@ -0,0 +1,1603 @@ +/* Copyright 2016 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_LITERAL_H_ +#define XLA_LITERAL_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "absl/functional/function_ref.h" +#include "absl/strings/string_view.h" +#include "absl/types/span.h" +#include "xla/array.h" +#include "xla/array2d.h" +#include "xla/array3d.h" +#include "xla/array4d.h" +#include "xla/index_util.h" +#include "xla/layout.h" +#include "xla/layout_util.h" +#include "xla/primitive_util.h" +#include "xla/printer.h" +#include "xla/shape.h" +#include "xla/shape_util.h" +#include "xla/status.h" +#include "xla/status_macros.h" +#include "xla/statusor.h" +#include "xla/types.h" +#include "xla/util.h" +#include "xla/xla_data.pb.h" +#include "tsl/lib/core/bitmap.h" +#include "tsl/platform/errors.h" +#include "tsl/platform/logging.h" // IWYU pragma: keep +#include "tsl/platform/macros.h" + +namespace xla { + +// Forward declare Literal and LiteralSlice class to be used by the creation +// methods in the base class. +class Literal; +class LiteralSlice; + +// Abstract base class for literals. +class LiteralBase { + public: + virtual ~LiteralBase() = 0; + + // Literals are equal if they have compatible shapes and the same data + // values. Layout is not compared. + bool operator==(const LiteralBase& other) const; + bool operator!=(const LiteralBase& other) const { return !(*this == other); } + + // Returns the shape of the literal. + const Shape& shape() const; + + // Serialize to proto. + LiteralProto ToProto() const; + + // Returns a Span of the array for this literal for the given NativeT + // (e.g., float). CHECKs if the subshape of the literal at the given + // ShapeIndex is not array. See primitive_util.h for the mapping from XLA type + // to native type. + template + absl::Span data(const ShapeIndex& shape_index = {}) const; + + // Returns a const pointer to (or size of) the underlying buffer holding the + // array at the given shape index. CHECKs if the subshape of the literal at + // the given ShapeIndex is not array. + const void* untyped_data(const ShapeIndex& shape_index = {}) const; + int64_t size_bytes(const ShapeIndex& shape_index = {}) const; + + // Returns this literal's data as a string. This literal must be a rank-1 U8 + // array. + std::string GetR1U8AsString() const; + + // Prints a string representation of the literal value. The Shape of the + // literal is a prefix of the literal value in the string. + // + // Warning: this function can take minutes for multi-million element Literals. + void Print(Printer* printer) const; + + // Similar to Print, but prints the result in a compact one-line form. + void PrintOneline(Printer* printer) const; + + // Prints a string representation of the literal value which does *not* + // include the shape string. + void PrintWithoutShape(Printer* printer) const; + + // Similar to PrintWithoutShape, but prints the result in a compact one-line + // form. + void PrintWithoutShapeOneline(Printer* printer) const; + + // Prints a string representation of the literal value which includes the + // shape string with its layout.does *not* include the shape string. + void PrintWithLayout(Printer* printer) const; + + // Similar to PrintWithLayout, but prints the result in a compact one-line + // form. + void PrintWithLayoutOneline(Printer* printer) const; + + // Returns a string representation of the literal value. The Shape of the + // literal is a prefix of the literal value in the string. + // + // Warning: this function can take minutes for multi-million element Literals. + std::string ToString() const; + + // Similar to ToString, but return the result in a compact one-line form. + std::string ToStringOneline() const; + + // Returns a string representation of the literal value which does *not* + // include the shape string. + std::string ToStringWithoutShape() const; + + // Similar to ToStringWithoutShape, but return the result in a compact + // one-line form. + std::string ToStringWithoutShapeOneline() const; + + // Returns a string representation of the literal value which includes the + // shape string with its layout.does *not* include the shape string. + std::string ToStringWithLayout() const; + + // Similar to ToStringWithLayout, but return the result in a compact one-line + // form. + std::string ToStringWithLayoutOneline() const; + + // Gets an element in the literal at the given index. The multi_index is + // CHECKed against the dimension sizes. + template + NativeT Get(absl::Span multi_index, + const ShapeIndex& shape_index) const; + // Overloads of Get for array literals. CHECKs if the literal is not + // array-shaped and dense. + template + NativeT Get(absl::Span multi_index) const; + + // Get the dynamic size on dim_index in the literal at the given shape_index. + int32_t GetDynamicSize(int64_t dim_index, + const ShapeIndex& shape_index) const; + int32_t GetDynamicSize(int64_t dim_index) const; + + // Returns the element value at index (0, ..., 0), however many zeroes are + // required for that index. + template + NativeT GetFirstElement() const; + + // As above but returns any integer type casted to an int64_t. + std::optional GetFirstInteger() const; + + // As Get(), but determines the correct type and converts the value + // into text. + std::string GetAsString(absl::Span multi_index, + const ShapeIndex& shape_index = {}) const; + + // Return whether the value at the specified index is equal to the provided + // generic `value` (T must be an arithmetic type). + // + // Precondition: must be an array. + template + typename std::enable_if::is_specialized, bool>::type + IsEqualAt(absl::Span multi_index, T value) const { + if (auto as_s64 = GetIntegralAsS64(multi_index)) { + return *as_s64 == value; + } + complex128 as_complex128 = *GetAsComplex128(multi_index); + return as_complex128.imag() == 0 && as_complex128.real() == value; + } + + bool IsEqualAt(absl::Span multi_index, + complex128 value) const { + if (auto as_s64 = GetIntegralAsS64(multi_index)) { + return *as_s64 == value.real() && value.imag() == 0; + } + auto as_complex128 = GetAsComplex128(multi_index); + return *as_complex128 == value; + } + + // As Get(), but determines the correct type and converts the value into + // int64_t. This literal must be an array. + std::optional GetIntegralAsS64( + absl::Span multi_index) const; + + // As Get(), but determines the correct type, and converts the value into + // double. This literal must be an array. + std::optional GetAsDouble( + absl::Span multi_index) const; + + // As Get(), but determines the correct type, and converts the value into + // complex128. All floating point types can be converted into complex128. + // + // This literal must be an array. + std::optional GetAsComplex128( + absl::Span multi_index) const; + + // Convert each element whose *linear* index is listed in "linear_indices" + // to a double and return the sum of all of these elements. + std::optional GetSumAsDouble( + absl::Span linear_indices) const; + + // Invokes the "per cell" callback for each element in the provided + // literal with the element's indices and a string representation of + // the element's value. + // + // This function is useful if you want a polymorphic representation + // of the tensor's elements (turning it to a string for something + // like representation in a protobuf). + // + // This literal must have a dense layout. + void EachCellAsString( + absl::FunctionRef indices, + const std::string& value)> + per_cell) const; + template + void EachCell( + absl::FunctionRef indices, NativeT value)> + per_cell) const; + + // Checks whether all of this literal's values are equal to the given scalar + // literal. + // + // If `this` is not an array (e.g. it's a tuple), returns false. This is + // simpler than trying to handle subshapes here, and it's almost always what + // you want. + // + // Preconditions: + // - `scalar` is a scalar. + // - `scalar` has the same element-type as `this`. + bool IsAll(const Literal& scalar) const; + + // Returns whether every element in this literal is equal to value. + // + // value is an int8_t because we expect this to be called with small + // compile-time constants (0, -1, etc.) and so that whatever value you pass + // can be represented exactly by floating-point types as small as 16 bits. + // + // If value doesn't fit in this literal's type, returns false. Values of 1/0 + // are considered equal to true/false; other values are not considered equal + // to true. + // + // Returns false if this literal is not array-shaped. + bool IsAll(int8_t value) const; + + // Like IsAll(int8_t), except we check whether the literal is equal to a + // particular floating-point or complex number. + // + // Returns false if this literal is not a floating-point / complex value, or + // if it's not an array. + // + // This casts value to the type of literal, then compares using ==, with the + // caveat that NaNs are considered equal. Unlike IsAll, this does not + // necessarily return false if the value does not fit in this literal's type. + bool IsAllFloat(float value) const; + bool IsAllComplex(complex64 value) const; + + // Deetermines if this literal consists entirely of the first element of the + // literal. + // + // Returns false if this literal is not an array. + bool IsAllFirst() const; + + // Returns the number of elements that have value equal to the given value. + // Returns 0 if value does not fit in this literal's type or if the literal + // is not an array. + template + int64_t CountEqual(T value) const; + + // Returns the number of elements that have value equal to the given complex + // value. Returns 0 if value does not fit in this literal's type or if the + // literal is not an array. + template + int64_t CountEqual(std::complex value) const; + + // Literal consists entirely of an iota. + bool IsR1Iota() const; + + // Returns the stride if the literal is a strided iota. + std::optional IsR1StridedIota() const; + + // Returns whether this literal is zero at the specified index. This literal + // must be an array with a dense layout. + bool IsZero(absl::Span indices) const; + + // Returns the count of the elements in the array at the given shape index in + // this literal. + int64_t element_count(const ShapeIndex& index = {}) const { + if (index.empty()) { + // Common case, avoid GetSubshape(). + return ShapeUtil::ElementsIn(shape()); + } + return ShapeUtil::ElementsIn(ShapeUtil::GetSubshape(shape(), index)); + } + + // Compute a hash for this literal. + template + friend H AbslHashValue(H state, const LiteralBase& value) { + return LiteralBase::Hash(std::move(state), value); + } + + template ::max()> + static H Hash(H state, const LiteralBase& literal) { + state = + Shape::Hash(std::move(state), literal.shape()); + + ShapeUtil::ForEachSubshape( + literal.shape(), [&](const Shape& subshape, const ShapeIndex& index) { + if (!subshape.IsArray()) { + return; + } + + CHECK(LayoutUtil::IsDenseArray(subshape)); + auto data = absl::MakeConstSpan( + static_cast(literal.untyped_data(index)), + std::min(kByteLimit, literal.size_bytes(index))); + state = H::combine(std::move(state), data); + }); + + return std::move(state); + } + + // Converts this literal to the given shape. Returns an error is the + // conversion is not possible. + StatusOr ConvertToShape(const Shape& dest_shape) const; + + // Converts this literal to another primitive type using a bitcast + // conversion. Returns an error if the conversion is not possible. This + // literal must be array-shaped. + StatusOr BitcastConvert(const Shape& dest_shape) const; + + // Converts this literal to another primitive type. Returns an error if the + // conversion is not possible. This literal must be array-shaped. + StatusOr Convert(PrimitiveType primitive_dest_type) const; + + // Clones the underlying buffers into a new Literal. + Literal Clone() const; + std::unique_ptr CloneToUnique() const; + + // TODO(b/67651157): The methods below which perform computation on Literals + // (Reshape, Slice, etc) should be moved elsewhere, and perhaps combined with + // evaluator code which operates on Literals. + // + // Creates a new value that has the equivalent value as this + // literal, but conforms to new_layout; e.g. a literal matrix that was in {0, + // 1} minor-to-major dimension layout can be re-layed-out as {1, 0} + // minor-to-major dimension layout and the value in the cell at any given + // logical index (i0, i1) will be the same. + // + // For tuple shaped literals, shape_index should be used to select the inner + // array that the new layout applies to. + // + // Note: this is useful when the client wants to ensure that a value placed in + // the XLA allocation tracker has a particular layout; for efficiency + // purposes or avoiding unimplemented operation/layout combinations. + Literal Relayout(const Layout& new_layout, + const ShapeIndex& shape_index = {}) const; + + // An overload of Relayout which changes the layout of the entire shape rather + // than being limited to a single array within the shape. + Literal Relayout(const Shape& shape_with_layout) const; + + // Generate a new literal whose static sizes are equal to the previous + // literal's dynamic sizes. + Literal ToStatic() const; + + // Expand a static literal into a new one with a bounded dynamic literal. The + // static dimensions of the original literal becomes dynamic dimensions of the + // new literal, where the argument `bounded_shape` becomes the bounded shape + // of the new literal. + // + // Precondition: bounded_shape.is_dynamic() + Literal ToBoundedDynamic(const Shape& bounded_shape) const; + + // Creates a new literal by reshaping this literal to have the given + // dimensions. The total number of elements must not change; The + // implementation currently only supports monotonic dim0-major layouts. + // This literal must be an array. + StatusOr Reshape(absl::Span dimensions) const; + + // Creates a new literal by broadcasting this literal with `dimensions` to + // yield a literal of shape `result_shape`. + StatusOr Broadcast(const Shape& result_shape, + absl::Span dimensions) const; + + // Creates a new literal by reordering the dimensions of this literal. + // The given `permutation` must be a permutation of the dimension numbers + // in the original literal, and it specifies the order of the new dimensions + // in the result literal (i.e., new_order[i] = old_order[permutation[i]]). + // For example, a transpose call on a literal of shape [3 x 8 x 4] and + // `permutation` = {2, 0, 1} returns a new literal of shape [4 x 3 x 8]. + // This literal must be an array. + Literal Transpose(absl::Span permutation) const; + + // Creates a sub-array from this literal by extracting the indices + // [start_index, limit_index) of each dimension. The result literal has the + // same rank and layout as for the given literal. The number of indices in + // start_indices and limit_indices must be the rank of the literal, and the + // indices follow the order of the dimensions. + // This literal must be an array. + Literal Slice(absl::Span start_indices, + absl::Span limit_indices) const; + + // Creates a literal with a prepended dimension with bound "times"; e.g. a + // f32[3x2] with times=4 will produce a f32[4x3x2] with the 3x2 from this + // literal replicated four times. + // This literal must be an array. + template + Literal Replicate(int64_t times) const; + + // Returns true if the leaf arrays of the literal within the given shape index + // are all determined. + // See comments on ArrayValueState for detailed explanation. + bool IsDetermined(const ShapeIndex& shape_index = {}) const; + + // Returns true if the leaf arrays of the literal within the given shape index + // are all known. + // See comments on ArrayValueState for detailed explanation. + bool IsKnown(const ShapeIndex& shape_index = {}) const; + + // Creates a new Literal object with the shape specified as parameter. + // The content of the literal values is the default value of the primitive + // type of literal itself (0 for numeric types, and false for predicates). + // + // Note: It's an antipattern to use this method then immediately call + // MutableLiteralBase::Populate on the result (since that results in zero + // initialization, then reinitialization. Consider if a call to + // std::make_unique(shape), followed by the call to + // MutableLiteralBase::Populate can be used instead. + static Literal CreateFromShape(const Shape& shape); + + // WARNING: These two functions are only supposed to be used by HloEvaluator. + // The rest of XLA assumes all literals are known. + // Similar to CreateFromShape() but marks all leaf arrays as unknown. + static Literal CreateFromShapeWithUnknownLeafArrays(const Shape& shape); + // Similar to CreateFromShape() but marks all leaf arrays as undetermined. + static Literal CreateFromShapeWithUndeterminedLeafArrays(const Shape& shape); + + protected: + // Array literals could be in one of the following three states: + // 1) Known: we have evaluated and known the value of the array literal. + // 2) Unknown: we have tried to evaluate the array literal, but its value + // cannot be evaluated statically. + // 3) Undetermined: we haven't tried to evaluate the array literal. + // Unknown and Undetermined states are only meant to be used within + // HloEvaluator. The rest of XLA assumes array literals are all known. + // Literals that are unknown or undetermined can be copied from, using + // CopyFrom and Clone, or moved from using move constructor. Accessing values + // of such literals causes undefined behavior. + enum class ArrayValueState { kKnown = 0, kUnknown = 1, kUndetermined = 2 }; + + // A data structure representing a subshape at a particular ShapeIndex within + // the literal. For array-shaped ShapeIndexes, this data structure holds the + // pointer to the memory allocated for the array data. + class Piece { + public: + ArrayValueState get_array_value_state() const; + void set_array_value_state(ArrayValueState state); + // Returns the buffer holding the array data for this piece as an array + // slice. This piece must be array-shaped. + template + absl::Span data() const; + template + absl::Span data(); + + // Returns the buffer holding the array data for this piece as a void*. This + // piece must be array-shaped. + void* untyped_data(); + const void* untyped_data() const; + + // Gets or sets an element in the array at the given index. The multi_index + // is CHECKed against the dimension sizes of the array. This piece must be + // array-shaped. + template + NativeT Get(absl::Span index) const; + template + void Set(absl::Span index, NativeT value); + + int32_t GetDynamicSize(int64_t dim_index) const; + void SetDynamicSize(int64_t dim_index, int32_t size); + void AllocateBuffers(); + void DeallocateBuffers(); + // Gets/sets the buffer holding the array data. + const char* buffer() const; + char* buffer() { + return const_cast(const_cast(this)->buffer()); + } + void set_buffer(char* buffer) { + DCHECK(LayoutUtil::IsDenseArray(*subshape_)); + auto* dense_rep = std::holds_alternative(rep_) + ? &rep_.emplace() + : GetDenseRep(); + DCHECK(dense_rep); + dense_rep->data = buffer; + } + void MoveDataFrom(Piece& from) { + DCHECK(!std::holds_alternative(rep_)); + DCHECK(!std::holds_alternative(rep_)); + if (auto* dense_rep = from.GetDenseRep()) { + rep_.emplace().data = dense_rep->data; + } else if (auto* inlined_rep = from.GetDenseInlinedRep()) { + std::memcpy(rep_.emplace().data, inlined_rep->data, + from.total_bytes_dense()); + } + from.rep_.emplace(); + } + + using DynamicSizeType = int32_t; + + // Gets/sets the buffer holding dynamic sizes. + const DynamicSizeType* dynamic_size_buffer() const { + DCHECK(LayoutUtil::IsDenseArray(*subshape_)); + return reinterpret_cast( + buffer() + dynamic_size_buffer_offset()); + } + DynamicSizeType* dynamic_size_buffer() { + return const_cast( + const_cast(this)->dynamic_size_buffer()); + } + + int64_t dynamic_size_buffer_bytes() const { + DCHECK(LayoutUtil::IsDenseArray(*subshape_)); + return subshape().dimensions_size() * sizeof(DynamicSizeType); + } + + // Gets or sets the subshape of this piece. This reference points to a + // subshape within the shape in the containing Literal (Literal::shape_). + const Shape& subshape() const { return *subshape_; } + void set_subshape(const Shape* subshape) { + subshape_ = subshape; + if (std::holds_alternative(rep_)) { + if (subshape_->IsTuple()) { + rep_.emplace(); + } + } + } + + // Returns the size in bytes of the buffer holding the dense array data. + int64_t size_bytes_dense() const { + DCHECK(LayoutUtil::IsDenseArray(*subshape_)); + return ShapeUtil::ByteSizeOf(subshape()); + } + + // The dynamic metadata starts at the end of the data in the literal. + // The literal can have any number of bytes. For example, it could be a PRED + // with 7 elements. `dynamic_size_buffer_offset` returns the number of bytes + // before the dynamic size information including whatever padding is needed + // to align the start of the dynamic size information so that it is aligned + // to a multiple of `sizeof(DynamicSizeType)`. + int64_t dynamic_size_buffer_offset() const { + // Make sure the dynamic buffer starts on a boundary aligned to + // `sizeof(DynamicSizeType)`. + return RoundUpTo(size_bytes_dense(), sizeof(DynamicSizeType)); + } + + // Total size in bytes, including the dynamic size addition. + // + // The shape can become dynamic after this literal is allocated, so we + // over-allocate the margin for the dynamic shape description in case we + // need it. + int64_t total_bytes_dense() const { + return dynamic_size_buffer_offset() + dynamic_size_buffer_bytes(); + } + + // Returns the number of elements in this piece's array. + int64_t element_count() const { return ShapeUtil::ElementsIn(subshape()); } + + // Returns the child piece at 'index' of this piece. + Piece& child(int64_t index) { + return const_cast(const_cast(this)->child(index)); + } + const Piece& child(int64_t index) const { + auto* tuple_rep = GetTupleRep(); + DCHECK(tuple_rep); + return tuple_rep->children[index]; + } + + // Adds a child piece to this piece's children. + void emplace_back(Piece child_piece) { + auto* tuple_rep = GetTupleRep(); + DCHECK(tuple_rep); + tuple_rep->children.emplace_back(std::move(child_piece)); + } + + // Returns the size of children pieces of this piece. + int64_t children_size() const { + if (auto* tuple_rep = GetTupleRep()) { + return tuple_rep->children.size(); + } + return 0; + } + + // Visitor functions that recursively traverses the piece and calls the + // given function at each child piece. The function has the type: + // void (const ShapeIndex& index, const Piece& piece) + template + void ForEachSubpiece(const Fn& func) const { + ShapeIndex index; + return ForEachHelper( + [&func](const ShapeIndex& index, const Piece& piece) { + func(index, piece); + return OkStatus(); + }, + *this, &index) + .IgnoreError(); + } + // Same as above, but the function has the type: + // Status (const ShapeIndex& index, const Piece& piece) + // The first non-OK return value is returned by the function. + template + Status ForEachSubpieceWithStatus(const Fn& func) const { + ShapeIndex index; + return ForEachHelper(func, *this, &index); + } + // Same as above, but the function has the type: + // Bool (const ShapeIndex& index, const Piece& piece) + // The first non-true return value is returned by the function. + template + bool ForEachSubpieceWithBool(const Fn& func) const { + ShapeIndex index; + return ForEachHelperBool(func, *this, &index); + } + // Same as above, but the function has the type: + // Void (const ShapeIndex& index, Piece& piece) + template + void ForEachMutableSubpiece(const Fn& func) { + ShapeIndex index; + return ForEachMutableHelper( + [&func](const ShapeIndex& index, Piece* piece) { + func(index, piece); + return OkStatus(); + }, + const_cast(this), &index) + .IgnoreError(); + } + // Same as above, but the function has the type: + // Status (const ShapeIndex& index, Piece& piece) + // The first non-OK return value is returned by the function. + template + Status ForEachMutableSubpieceWithStatus(const Fn& func) { + ShapeIndex index; + return ForEachMutableHelper( + func, const_cast(this), &index); + } + + // Checks whether all elements of this Piece are equal to the given literal. + // + // Returns false if this Piece is not an array. + // + // Preconditions: + // - `scalar` is a scalar. + // - `scalar`'s type matches that of `this`. + bool IsAll(const Literal& scalar) const; + + // Returns the number of elements with equal value to the given literal. + // Returns 0 if this Piece is not an array. + int64_t CountAll(const Literal& scalar) const; + + // Returns true if this piece and 'other' contain the same data. This piece + // and 'other' must be array-shaped and compatible. If a literal has dynamic + // shape, comparison is done only for the valid elements. + bool EqualElements(const Piece& other) const; + + // Returns true if this piece and other pieces have the same dynamic + // dimension sizes. + bool EqualDynamicSize(const Piece& other) const; + + // Writes the shape and data (if array-shaped) into the given proto. + void WriteToProto(LiteralProto* proto) const; + + // Copy the data from 'src' into this piece's buffer. Shapes of this piece + // and src must be compatible. If only_dynamic_bound is true, only elements + // within dynamic bounds will be copied. + Status CopyFrom(const Piece& src, bool only_dynamic_bound); + + // Copies the data from the given proto into this piece. The shape of this + // piece must be equal (not just compatible) to the shape of the proto. + Status CopyFromProto(const LiteralProto& proto); + + // See comments on ArrayValueState for detailed explanation. + bool IsDetermined() const; + + bool IsKnown() const; + + private: + // Uninitialized state representation. + struct Uninitialized {}; + // Out of line dense array storage. + union DenseRep { + char* data; + }; + struct TupleRep { + // Children pieces for tuple shaped pieces. + std::vector children = {}; + }; + + // Use just so many bytes that we don't increase the sizeof(Piece). + static inline constexpr size_t kMaxInlinedBytes = + std::max(sizeof(DenseRep), sizeof(TupleRep)); + + // Inlined dense array storage. + struct DenseInlinedRep { + char data[kMaxInlinedBytes]; + }; + + const DenseInlinedRep* GetDenseInlinedRep() const { + return std::get_if(&rep_); + } + DenseInlinedRep* GetDenseInlinedRep() { + return std::get_if(&rep_); + } + + const DenseRep* GetDenseRep() const { return std::get_if(&rep_); } + DenseRep* GetDenseRep() { return std::get_if(&rep_); } + + const TupleRep* GetTupleRep() const { return std::get_if(&rep_); } + TupleRep* GetTupleRep() { return std::get_if(&rep_); } + // Helpers for traversing the piece via ForEachSubpiece rooted at 'index'. + // The first non-OK (or non-true) value is returned by the function. + // The callable 'func' has the same signature as described above in + // ForEachSubpiece*. + template + Status ForEachHelper(const Fn& func, const Piece& piece, + ShapeIndex* index) const { + TF_RETURN_IF_ERROR(func(*index, piece)); + if (auto* tuple_rep = piece.GetTupleRep()) { + for (int64_t i = 0; i < tuple_rep->children.size(); ++i) { + index->push_back(i); + TF_RETURN_IF_ERROR( + ForEachHelper(func, tuple_rep->children[i], index)); + index->pop_back(); + } + } + return OkStatus(); + } + template + bool ForEachHelperBool(const Fn& func, const Piece& piece, + ShapeIndex* index) const { + if (!func(*index, piece)) { + return false; + } + if (auto* tuple_rep = piece.GetTupleRep()) { + for (int64_t i = 0; i < tuple_rep->children.size(); ++i) { + index->push_back(i); + if (!ForEachHelperBool(func, tuple_rep->children[i], index)) { + return false; + } + index->pop_back(); + } + } + return true; + } + template + Status ForEachMutableHelper(const Fn& func, Piece* piece, + ShapeIndex* index) { + TF_RETURN_IF_ERROR(func(*index, piece)); + if (auto* tuple_rep = piece->GetTupleRep()) { + for (int64_t i = 0; i < tuple_rep->children.size(); ++i) { + index->push_back(i); + TF_RETURN_IF_ERROR( + ForEachMutableHelper(func, &tuple_rep->children[i], index)); + index->pop_back(); + } + } + return OkStatus(); + } + + // Recursive helper for EqualElements. + template + bool EqualElementsInternal(const Piece& other, + std::vector* multi_index) const; + + // Internal helper to copy elements from another given piece + template + void CopyElementsWithDynamicBound(const LiteralBase::Piece& src); + + // Storage representation of this piece. + std::variant rep_; + + // The shape of piece. This points into the shape of the containing Literal + // (Literal::shape_). + const Shape* subshape_ = nullptr; + + ArrayValueState array_value_state_ = ArrayValueState::kKnown; + }; // class Piece + + const Piece& piece(const ShapeIndex& shape_index) const; + + // Returns the piece at the root of the shape. + virtual const Piece& root_piece() const = 0; + + // LiteralSlice and Literal must access Pieces of other Literals. + friend class MutableLiteralBase; + friend class LiteralSlice; + friend class BorrowingLiteral; + + private: + // Like IsAllFloat, but if round_value is false and the value is not + // representable with the literal's type (e.g., due to rounding error or + // overflow/underflow when casting the value to the literal's type), returns + // false. + bool IsAllFloatImpl(float value, bool round_value) const; +}; + +// Abstract base class representing a mutable literal in XLA. +class MutableLiteralBase : public LiteralBase { + public: + ~MutableLiteralBase() override = 0; + + // Returns a Span view of the array for this literal for the + // given NativeT (e.g., float). CHECKs if the subshape of the literal at the + // given ShapeIndex is not array. See primitive_util.h for the mapping from + // XLA type to native type. + template + absl::Span data(const ShapeIndex& shape_index = {}); + // Unhide const method from parent class. + using LiteralBase::data; + + // TODO(b/67651157): Remove this accessor. Literal users should not be able to + // mutate the shape as this can produce malformed Literals. + Shape* mutable_shape_do_not_use(); + + // Set the dynamic size on dim_index in the literal at the given shape_index. + void SetDynamicSize(int64_t dim_index, const ShapeIndex& shape_index, + int32_t size); + void SetDynamicSize(int64_t dim_index, int32_t size); + + // Returns a pointer to the underlying buffer holding the array at the given + // shape index. CHECKs if the subshape of the literal at the given ShapeIndex + // is not array. + void* untyped_data(const ShapeIndex& shape_index = {}); + // Unhide const method from parent class. + using LiteralBase::untyped_data; + + template + void MutableEachCell(absl::FunctionRef indices, NativeT value)> + per_cell); + + // Copy values from 'src_literal' rooted at 'src_shape_index' into this + // literal rooted at 'dest_shape_index'. The subshape of this literal rooted + // at 'dest_shape_index' must be compatible with the subshape of 'src_literal' + // rooted at 'src_shape_index', but need not be arrays. If only_dynamic_bound + // is true, only elements within dynamic bounds will be copied. + Status CopyFrom(const LiteralSlice& src_literal, + const ShapeIndex& dest_shape_index = {}, + const ShapeIndex& src_shape_index = {}, + bool only_dynamic_bound = false); + + // Copies the values from src_literal, starting at src_base shape indexes, + // to this literal, starting at dest_base, where the copy size in each + // dimension is specified by copy_size. + // The src_literal and this literal must have the same primitive type, + // src_base+copy_size must fit the source literal dimensions, as well as + // dest_base+copy_size must fit the destination literal dimensions. + // Note: if either src_literal or this literal contains dimensions with zero + // element, then copy_size must be 0 in these dimensions while the + // corresponding base indices being 0. + // This literal and 'src_literal' must be arrays. + Status CopySliceFrom(const LiteralSlice& src_literal, + absl::Span src_base, + absl::Span dest_base, + absl::Span copy_size); + + // Copies one element from src_literal[src_index] to (*this)[dest_index]. + void CopyElementFrom(const LiteralSlice& src_literal, + absl::Span src_index, + absl::Span dest_index); + + // Sets an element in the literal at the given index. The multi_index is + // CHECKed against the dimension sizes. + template + void Set(absl::Span multi_index, const ShapeIndex& shape_index, + NativeT value); + // Overloads of Set for array literals. CHECKs if the literal is not + // array-shaped and dense. + template + void Set(absl::Span multi_index, NativeT value); + + // As Set(), but truncates `value` to the literal element type before storing. + // This literal must be an array. + Status SetIntegralAsS64(absl::Span multi_index, int64_t value); + + // As Set(), but truncates `value` to the literal element type before storing. + // This literal must be an array. + Status SetFromDouble(absl::Span multi_index, double value); + + // Populate this literal with the given values. Examples: + // + // // Populate with floats. + // Array2D float_values = ... + // literal.PopulateR2FromArray2D(values); + // + // // Populate with int32s. + // literal.PopulateR2({{1, 2}, {3, 4}}); + // + // The shape and element type of this literal must match given values. For + // example, in the call above to literal.PopulateR2(), 'literal' must be a 2x2 + // array of S32. + template + void PopulateR1(absl::Span values); + void PopulateR1(const tsl::core::Bitmap& values); + template + void PopulateR2(std::initializer_list> values); + template + void PopulateFromArray(const Array& values); + template + void PopulateR2FromArray2D(const Array2D& values); + template + void PopulateR3FromArray3D(const Array3D& values); + template + void PopulateR4FromArray4D(const Array4D& values); + + // Populates literal values by calling the generator function for every cell + // in this literal object. + // + // generator must be a callable of the type + // NativeT(absl::Span indexes) or compatible. + // + // This literal must have a dense layout. + template + Status Populate( + absl::FunctionRef)> generator); + + // A parallel version of Populate(). This can be used if the generator is + // thread-safe and the values for the shape's different elements are + // independent. + template + Status PopulateParallel( + absl::FunctionRef, int)> generator); + + // Similar to Populate() but takes a populator function that allows caller + // specify how to write to the destination buffer rather than a generator that + // returns the values. This is useful when the value population simply does + // memcpy without compute therefore can be written in a type agnostic way, so + // that we can avoid templatizing the method for better code size. + // + // This literal must have a dense layout. + Status PopulateInplace( + absl::FunctionRef)> populator); + + // A parallel version of PopulateInplace(). This can be used if the generator + // is thread-safe and the values for the shape's different elements are + // independent. + Status PopulateInplaceParallel( + absl::FunctionRef, int)> populator); + + // Fills this literal with the given value. + template + void PopulateWithValue(NativeT value); + + // This operation is the inverse of DecomposeTuple. The given elements are + // moved into the tuple elements of a new tuple-shaped Literal which is + // returned. Upon return, each of the Literals in 'elements' is set to a nil + // shape (empty tuple). + static Literal MoveIntoTuple(absl::Span elements); + + // Serialize from a proto. + static StatusOr CreateFromProto(const LiteralProto& proto, + bool prohibit_empty_literal = true); + + protected: + // Returns the piece at the given ShapeIndex. + Piece& piece(const ShapeIndex& shape_index) { + return const_cast(LiteralBase::piece(shape_index)); + } + + Piece& mutable_root_piece() { return const_cast(root_piece()); } + + // Internal template helper for the Literal::CopySliceFrom(), matching its + // arguments one by one. + template + Status CopySliceFromInternal(const LiteralBase& src_literal, + absl::Span src_base, + absl::Span dest_base, + absl::Span copy_size); + + // A unique_ptr like class which may or may not have ownership of its pointer. + // The literal may or may not own the storage of the shape. Creating/copying a + // shape can incur significant overhead which in many case we'd like to avoid, + // esp. for small literals. + class MaybeOwningShapePtr { + public: + MaybeOwningShapePtr() = default; + explicit MaybeOwningShapePtr(std::unique_ptr unique) + : ptr_and_owning_bit_(TakeUnique(std::move(unique))) {} + + explicit MaybeOwningShapePtr(const Shape* borrowed) + : ptr_and_owning_bit_(Borrow(borrowed)) {} + + ~MaybeOwningShapePtr() { MaybeDeleteOwned(); } + + const Shape* get() const { + return reinterpret_cast(ptr_and_owning_bit_ & kPointerMask); + } + Shape* get_mutable(bool ensure_owned = false) { + const Shape* const_ptr = get(); + // TODO(b/67651157): Remove this copy on write logic and combine get() and + // get_mutable() once we remove mutable_shape_do_not_use(). + if (const_ptr && !OwnsPtr()) { + ptr_and_owning_bit_ = TakeUnique(std::make_unique(*const_ptr)); + const_ptr = get(); + } + DCHECK(OwnsPtr()); + return const_cast(const_ptr); + } + const Shape* operator->() const { return get(); } + const Shape& operator*() const { return *get(); } + + MaybeOwningShapePtr& operator=(std::unique_ptr unique) { + MaybeDeleteOwned(); + ptr_and_owning_bit_ = TakeUnique(std::move(std::move(unique))); + return *this; + } + + MaybeOwningShapePtr& operator=(const Shape* borrowed) { + MaybeDeleteOwned(); + ptr_and_owning_bit_ = Borrow(borrowed); + return *this; + } + + MaybeOwningShapePtr& operator=(MaybeOwningShapePtr&& other) { + using std::swap; + swap(ptr_and_owning_bit_, other.ptr_and_owning_bit_); + return *this; + } + + MaybeOwningShapePtr(const MaybeOwningShapePtr&) = delete; + MaybeOwningShapePtr(MaybeOwningShapePtr&& other) + : ptr_and_owning_bit_(other.ptr_and_owning_bit_) { + other.ptr_and_owning_bit_ = 0; + } + + MaybeOwningShapePtr Clone() const { + const Shape* ptr = get(); + if (ptr && OwnsPtr()) { + return MaybeOwningShapePtr(std::make_unique(*ptr)); + } + return MaybeOwningShapePtr(ptr); + } + + private: + enum : uint64_t { + kOwningBitMask = 1UL, + kPointerMask = ~kOwningBitMask, + }; + static intptr_t TakeUnique(std::unique_ptr unique) { + Shape* released = unique.release(); + DCHECK_EQ(reinterpret_cast(released) & kOwningBitMask, 0); + return reinterpret_cast(released) | kOwningBitMask; + } + + static intptr_t Borrow(const Shape* borrowed) { + DCHECK_EQ(reinterpret_cast(borrowed) & kOwningBitMask, 0); + return reinterpret_cast(borrowed); + } + + bool OwnsPtr() const { return kOwningBitMask & ptr_and_owning_bit_; } + + void MaybeDeleteOwned() { + if (OwnsPtr()) { + delete get(); + } + } + + intptr_t ptr_and_owning_bit_ = 0; + }; + + // The parent class borrows this shape. + MaybeOwningShapePtr shape_; + + // Implementation details shared between Populate() and PopulateParallel() + // template + // Status PopulateInternal(const FnType& generator, bool parallel); + template + Status PopulateInternal( + absl::FunctionRef, int)> generator, + bool parallel); + void PopulateInplaceInternal( + absl::FunctionRef, int)> populator, + bool parallel); + + friend class LiteralBase; + friend class MutableBorrowingLiteral; +}; +std::ostream& operator<<(std::ostream& out, const Literal& literal); + +// The underlying buffer and shape is always owned by this class. +class Literal : public MutableLiteralBase { + public: + Literal(); + + // Create a literal of the given shape. The literal is allocated sufficient + // memory to hold the shape. Memory is uninitialized. + explicit Literal(const Shape& shape); + ~Literal() override; + + // Literals are moveable, but not copyable. To copy a literal use + // Literal::Clone or Literal::CloneToUnique. This prevents inadvertent copies + // of literals which can be expensive. + Literal(const Literal& other) = delete; + Literal& operator=(const Literal& other) = delete; + Literal(Literal&& other); + // 'allocate_arrays' indicates whether to allocate memory for the arrays in + // the shape. If false, buffer pointers inside of the Literal::Pieces are set + // to nullptr. + Literal(const Shape& shape, bool allocate_arrays, + ArrayValueState leaf_array_value_state = ArrayValueState::kKnown); + Literal& operator=(Literal&& other); + + // Similar to CopyFrom, but with move semantics. The subshape of this literal + // rooted at 'dest_shape_index' must be *equal* to the shape 'src_literal' + // (layouts and shapes must match), but need not be arrays. The memory + // allocated in this literal for the subshape at dest_shape_index is + // deallocated, and the respective buffers are replaced with those in + // src_literal. Upon return, src_literal is set to a nil shape (empty tuple). + virtual Status MoveFrom(Literal&& src_literal, + const ShapeIndex& dest_shape_index); + Status MoveFrom(Literal&& src_literal) { + return MoveFrom(std::move(src_literal), /*dest_shape_index=*/{}); + } + + // Returns a vector containing the tuple elements of this Literal as separate + // Literals. This Literal must be tuple-shaped and can be a nested tuple. The + // elements are moved into the new Literals; no data is copied. Upon return + // this Literal is set to a nil shape (empty tuple) + // + // TODO(jlebar): Because this function invalidates `this`, it should be + // ref-qualified with &&. + std::vector DecomposeTuple(); + + // Returns a subliteral specified by given shape_index. No data is copied, the + // current literal becomes invalid after this function call. + // + // TODO(jlebar): Because this function invalidates `this`, it should be + // ref-qualified with &&. + Literal SubLiteral(ShapeIndexView shape_index); + + private: + friend class LiteralBase; + friend class MutableLiteralBase; + const Piece& root_piece() const override { return root_piece_; }; + // Deallocate the buffers held by this literal. + void DeallocateBuffers(); + + // Recursively sets the subshapes and buffers of all subpieces rooted at + // 'piece'. If 'allocate_array' is true, memory is allocated for the arrays in + // the shape. + void SetPiece( + const Shape& shape, Piece* piece, bool allocate_arrays, + ArrayValueState leaf_array_value_state = ArrayValueState::kKnown); + Piece root_piece_; +}; + +// The underlying buffer is not owned by this class and is always owned by +// others. The shape is not owned by this class and not mutable. +class MutableBorrowingLiteral : public MutableLiteralBase { + public: + ~MutableBorrowingLiteral() override; + + MutableBorrowingLiteral() : MutableLiteralBase() {} + + MutableBorrowingLiteral(const MutableBorrowingLiteral& literal); + MutableBorrowingLiteral& operator=(const MutableBorrowingLiteral& literal); + + // Implicit conversion constructors. + // NOLINTNEXTLINE(google-explicit-constructor) + MutableBorrowingLiteral(MutableLiteralBase* literal); + MutableBorrowingLiteral(MutableBorrowingLiteral literal, + const ShapeIndex& view_root); + MutableBorrowingLiteral(const char* src_buf_ptr, const Shape& shape); + + // Create a literal from a list of buffers and a shape. + // Returns a tuple literal if `shape` is a tuple type. + MutableBorrowingLiteral(absl::Span src_buf_ptrs, const Shape& shape); + + private: + const Piece& root_piece() const override { return *root_piece_; }; + // Recursively copies the subtree from the `src_piece` at the given child + // index to the `dest_piece`. For buffers only the pointers are copied, but + // not the content. + void CopyPieceSubtree(const Shape& shape, const Piece* src_piece, + Piece* dest_piece); + Piece* root_piece_ = nullptr; +}; + +// A read-only view of a Literal. A LiteralSlice contains pointers to shape and +// literal buffers always owned by others. +class LiteralSlice : public LiteralBase { + public: + LiteralSlice() : LiteralBase() {} + + // Implicit conversion constructors. + // NOLINTNEXTLINE(google-explicit-constructor) + LiteralSlice(const LiteralBase& literal); + LiteralSlice(const LiteralBase& literal, const ShapeIndex& view_root); + + private: + const Piece& root_piece() const override { return *root_piece_; }; + + const Piece* root_piece_; // Not owned. +}; + +// A read-only Literal where the underlying buffers are never owned by this +// class. +class BorrowingLiteral : public LiteralBase { + public: + BorrowingLiteral() : LiteralBase() {} + + // 'src_buf_ptr' is not owned by this class and must outlive the + // lifetime of this class. It points to an appropriately sized buffer with + // data interpretered as indicated by 'shape'. + // This constructor is only used for array shapes. + BorrowingLiteral(const char* src_buf_ptr, const Shape& shape); + // Similar as above, except to be used for constructing non-nested tuples. + BorrowingLiteral(absl::Span src_buf_ptrs, + const Shape& shape); + // TODO(b/79707221): adding constructors for nested tuples as well. + + private: + // Recursively builds the subtree for the given piece and sets the subshapes + // of the given piece with the given shape. + void BuildPieceSubtree(const Shape& shape, Piece* piece); + + // Accessor for the root piece of this literal. + const Piece& root_piece() const override { return root_piece_; }; + Piece root_piece_; + + // Shape of this literal. Stored as unique_ptr such that the (default) move + // construction of this class would be trivially correct: the pointer to Shape + // root_piece_ stores will still point to the correct address. + std::unique_ptr shape_; +}; + +template +absl::Span LiteralBase::Piece::data() const { + DCHECK(LayoutUtil::IsDenseArray(subshape())) + << __func__ << " is only supported for dense arrays: " << subshape(); + DCHECK(!subshape().has_layout() || + subshape().layout().element_size_in_bits() == 0) + << __func__ + << " is not supported for layouts with custom bit size: " << subshape(); + DCHECK_EQ(subshape().element_type(), + primitive_util::NativeToPrimitiveType()) + << "Attempting to access " + << PrimitiveType_Name(primitive_util::NativeToPrimitiveType()) + << " type, but literal element type is " + << PrimitiveType_Name(subshape().element_type()); + return absl::Span(reinterpret_cast(buffer()), + element_count()); +} + +template +absl::Span LiteralBase::Piece::data() { + DCHECK(LayoutUtil::IsDenseArray(subshape())) + << __func__ << " is only supported for dense arrays: " << subshape(); + DCHECK(!subshape().has_layout() || + subshape().layout().element_size_in_bits() == 0) + << __func__ + << " is not supported for layouts with custom bit size: " << subshape(); + DCHECK_EQ(subshape().element_type(), + primitive_util::NativeToPrimitiveType()) + << "Attempting to access " + << PrimitiveType_Name(primitive_util::NativeToPrimitiveType()) + << " type, but literal element type is " + << PrimitiveType_Name(subshape().element_type()); + return absl::Span(reinterpret_cast(buffer()), + element_count()); +} + +template +NativeT LiteralBase::Piece::Get(absl::Span multi_index) const { + DCHECK(LayoutUtil::IsDenseArray(subshape())) + << __func__ << " is only supported for dense arrays: " << subshape(); + return data()[IndexUtil::MultidimensionalIndexToLinearIndex( + subshape(), multi_index)]; +} + +template +void LiteralBase::Piece::Set(absl::Span multi_index, + NativeT value) { + DCHECK(LayoutUtil::IsDenseArray(subshape())) + << __func__ << " is only supported for dense arrays: " << subshape(); + data()[IndexUtil::MultidimensionalIndexToLinearIndex( + subshape(), multi_index)] = value; +} + +template +absl::Span LiteralBase::data( + const ShapeIndex& shape_index) const { + return piece(shape_index).data(); +} + +template +absl::Span MutableLiteralBase::data(const ShapeIndex& shape_index) { + return piece(shape_index).data(); +} + +template +inline NativeT LiteralBase::Get(absl::Span multi_index, + const ShapeIndex& shape_index) const { + return piece(shape_index).Get(multi_index); +} + +template +inline NativeT LiteralBase::Get(absl::Span multi_index) const { + return root_piece().Get(multi_index); +} + +template +inline void MutableLiteralBase::Set(absl::Span multi_index, + const ShapeIndex& shape_index, + NativeT value) { + return piece(shape_index).Set(multi_index, value); +} + +template +inline void MutableLiteralBase::Set(absl::Span multi_index, + NativeT value) { + return mutable_root_piece().Set(multi_index, value); +} + +template +NativeT LiteralBase::GetFirstElement() const { + CHECK(LayoutUtil::IsDenseArray(shape())) + << __func__ << " is only supported for dense arrays: " << shape(); + return data().at(0); +} + +template +int64_t LiteralBase::CountEqual(T value) const { + if (!shape().IsArray()) { + return 0; + } + PrimitiveType ty = shape().element_type(); + Literal scalar(ShapeUtil::MakeScalarShape(ty)); + return primitive_util::PrimitiveTypeSwitch( + [&](auto primitive_type_constant) -> int64_t { + if constexpr (primitive_util::IsArrayType(primitive_type_constant)) { + using NativeT = primitive_util::NativeTypeOf; + scalar.Set({}, static_cast(value)); + return root_piece().CountAll(scalar); + } + return 0; + }, + ty); +} + +template +int64_t LiteralBase::CountEqual(std::complex value) const { + if (!shape().IsArray()) { + return 0; + } + PrimitiveType ty = shape().element_type(); + Literal scalar(ShapeUtil::MakeScalarShape(ty)); + return primitive_util::PrimitiveTypeSwitch( + [&](auto primitive_type_constant) -> int64_t { + if constexpr (primitive_util::IsComplexType(primitive_type_constant)) { + using NativeT = primitive_util::NativeTypeOf; + scalar.Set({}, static_cast(value)); + return root_piece().CountAll(scalar); + } + return 0; + }, + ty); +} + +template +TF_ATTRIBUTE_NOINLINE void LiteralBase::EachCell( + absl::FunctionRef indices, NativeT value)> + per_cell) const { + CHECK(LayoutUtil::IsDenseArray(shape())) + << __func__ << " is only supported for dense arrays: " << shape(); + if (ShapeUtil::IsZeroElementArray(shape())) { + return; + } + std::vector indices(shape().rank(), 0); + + Shape shape_dynamic = shape(); + for (int64_t i = 0; i < shape_dynamic.rank(); ++i) { + shape_dynamic.set_dimensions(i, GetDynamicSize(i)); + } + do { + per_cell(indices, Get(indices)); + } while (IndexUtil::BumpIndices(shape_dynamic, absl::MakeSpan(indices))); +} + +template +TF_ATTRIBUTE_NOINLINE void MutableLiteralBase::MutableEachCell( + absl::FunctionRef indices, NativeT value)> + per_cell) { + CHECK(LayoutUtil::IsDenseArray(shape())) + << __func__ << " is only supported for dense arrays: " << shape(); + if (ShapeUtil::IsZeroElementArray(shape())) { + return; + } + std::vector indices(shape().rank(), 0); + Shape shape_dynamic = shape(); + for (int64_t i = 0; i < shape_dynamic.rank(); ++i) { + shape_dynamic.set_dimensions(i, GetDynamicSize(i)); + } + do { + Set(indices, per_cell(indices, Get(indices))); + } while (IndexUtil::BumpIndices(shape_dynamic, absl::MakeSpan(indices))); +} + +template +TF_ATTRIBUTE_NOINLINE void MutableLiteralBase::PopulateR1( + absl::Span values) { + CHECK(LayoutUtil::IsDenseArray(shape())) + << __func__ << " is only supported for dense arrays: " << shape(); + CHECK_EQ(shape().rank(), 1); + if (shape().is_static()) { + CHECK_EQ(ShapeUtil::ElementsIn(shape()), values.size()); + } else { + CHECK_EQ(GetDynamicSize(0), values.size()); + } + CHECK_EQ(shape().element_type(), + primitive_util::NativeToPrimitiveType()); + auto data_span = data(); + std::copy(values.begin(), values.end(), data_span.begin()); +} + +template +TF_ATTRIBUTE_NOINLINE void MutableLiteralBase::PopulateR2( + std::initializer_list> values) { + CHECK(LayoutUtil::IsDenseArray(shape())) + << __func__ << " is only supported for dense arrays: " << shape(); + CHECK_EQ(shape().rank(), 2); + CHECK_EQ(shape().element_type(), + primitive_util::NativeToPrimitiveType()); + + const int64_t values_dim0_size = values.size(); + const int64_t values_dim1_size = values.begin()->size(); + const int64_t literal_dim0_size = shape().is_dynamic_dimension(0) + ? GetDynamicSize(0) + : shape().dimensions(0); + const int64_t literal_dim1_size = shape().is_dynamic_dimension(1) + ? GetDynamicSize(1) + : shape().dimensions(1); + + CHECK_EQ(values_dim0_size, literal_dim0_size); + CHECK_EQ(values_dim1_size, literal_dim1_size); + + int64_t dim0 = 0; + for (auto inner_list : values) { + int64_t dim1 = 0; + for (auto value : inner_list) { + Set({dim0, dim1}, value); + ++dim1; + } + CHECK_EQ(values_dim1_size, dim1); + ++dim0; + } +} + +template +TF_ATTRIBUTE_NOINLINE void MutableLiteralBase::PopulateFromArray( + const Array& values) { + CHECK(LayoutUtil::IsDenseArray(shape())) + << __func__ << " is only supported for dense arrays: " << shape(); + CHECK(shape().IsArray()); + CHECK_EQ(shape().element_type(), + primitive_util::NativeToPrimitiveType()); + CHECK_EQ(shape().rank(), values.num_dimensions()); + for (int dim = 0; dim < values.num_dimensions(); ++dim) { + int64_t shape_size = shape().is_dynamic_dimension(dim) + ? GetDynamicSize(dim) + : shape().dimensions(dim); + CHECK_EQ(values.dim(dim), shape_size); + } + values.Each([this](absl::Span indices, NativeT value) { + this->Set(indices, value); + }); +} + +template +void MutableLiteralBase::PopulateR2FromArray2D(const Array2D& values) { + PopulateFromArray(values); +} + +template +void MutableLiteralBase::PopulateR3FromArray3D(const Array3D& values) { + PopulateFromArray(values); +} + +template +void MutableLiteralBase::PopulateR4FromArray4D(const Array4D& values) { + PopulateFromArray(values); +} + +template +TF_ATTRIBUTE_NOINLINE Status MutableLiteralBase::PopulateInternal( + absl::FunctionRef, int)> generator, + bool parallel) { + const Shape& this_shape = shape(); + DCHECK(LayoutUtil::IsDenseArray(this_shape)); + TF_RET_CHECK(this_shape.element_type() == + primitive_util::NativeToPrimitiveType()) + << "Failing to populate literal with element type " + << primitive_util::LowercasePrimitiveTypeName(this_shape.element_type()) + << " using data of type " + << primitive_util::LowercasePrimitiveTypeName( + primitive_util::NativeToPrimitiveType()); + PopulateInplaceInternal( + [&](void* dest, absl::Span indices, int thread_id) { + *static_cast(dest) = generator(indices, thread_id); + }, + parallel); + return OkStatus(); +} + +template +TF_ATTRIBUTE_NOINLINE Status MutableLiteralBase::Populate( + absl::FunctionRef)> generator) { + TF_RET_CHECK(LayoutUtil::IsDenseArray(shape())) + << __func__ << " is only supported for dense arrays: " << shape(); + return PopulateInternal( + [&](absl::Span indexes, int /*thread_id*/) { + return generator(indexes); + }, + /*parallel=*/false); +} +template +TF_ATTRIBUTE_NOINLINE Status MutableLiteralBase::PopulateParallel( + absl::FunctionRef, int)> generator) { + TF_RET_CHECK(LayoutUtil::IsDenseArray(shape())) + << __func__ << " is only supported for dense arrays: " << shape(); + return PopulateInternal(generator, + /*parallel=*/data().size() > 32); +} + +template +void MutableLiteralBase::PopulateWithValue(NativeT value) { + CHECK(LayoutUtil::IsDenseArray(shape())) + << __func__ << " is only supported for dense arrays: " << shape(); + CHECK_EQ(shape().element_type(), + primitive_util::NativeToPrimitiveType()); + for (NativeT& element : data()) { + element = value; + } +} + +template +Literal LiteralBase::Replicate(int64_t times) const { + CHECK(LayoutUtil::IsDenseArray(shape())) + << __func__ << " is only supported for dense arrays: " << shape(); + DimensionVector bounds = {times}; + bounds.reserve(shape().dimensions_size() + 1); + for (int64_t bound : shape().dimensions()) { + bounds.push_back(bound); + } + Literal literal(ShapeUtil::MakeShape(shape().element_type(), bounds)); + int64_t elements = ShapeUtil::ElementsIn(literal.shape()); + if (elements == 0) { + return literal; + } + + DimensionVector output_indices(bounds.size(), 0); + absl::Span input_indices = output_indices; + input_indices.remove_prefix(1); + + bool done = false; + while (!done) { + const auto element = Get(input_indices); + literal.Set(output_indices, element); + + done = true; + for (int n = 0; n < output_indices.size(); ++n) { + ++output_indices[n]; + if (output_indices[n] < bounds[n]) { + done = false; + break; + } + output_indices[n] = 0; + } + } + return literal; +} + +} // namespace xla + +#endif // XLA_LITERAL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/literal_comparison.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/literal_comparison.h new file mode 100644 index 0000000000000000000000000000000000000000..fc30fea3b243cb603d444254385ba6df908b7e67 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/literal_comparison.h @@ -0,0 +1,104 @@ +/* Copyright 2018 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +// Library for comparing literals without taking a dependency on testing +// libraries. + +#ifndef XLA_LITERAL_COMPARISON_H_ +#define XLA_LITERAL_COMPARISON_H_ + +#include +#include +#include +#include +#include + +#include "xla/error_spec.h" +#include "xla/literal.h" +#include "xla/shape.h" +#include "xla/shape_util.h" +#include "xla/status.h" + +namespace xla { +namespace literal_comparison { + +// Returns ok if the given shapes have the same rank, dimension sizes, and +// primitive types. +Status EqualShapes(const Shape& expected, const Shape& actual); + +// Returns ok if the given literals share identical dynamic shapes and +// dimension sizes. +Status EqualDynamicShapesAndDimensions(const LiteralSlice& expected, + const LiteralSlice& actual); + +// Returns ok if the expected and actual literals are (bitwise) equal for all +// elements in the literal. Also, asserts that the rank, dimensions sizes, and +// primitive type are equal. +Status Equal(const LiteralSlice& expected, const LiteralSlice& actual); + +// Structure that contains the distribution of absolute and relative errors, +// bucketized into five buckets: [0.0001, 0.001, 0.01, 0.1, 1]. +// Useful to understand the distribution of errors and set the permissible +// error bounds in an ErrorSpec. +struct ErrorBuckets { + explicit ErrorBuckets(const std::vector& absolute_error_buckets = {}, + const std::vector& rel_error_buckets = {}) + : abs_error_buckets(absolute_error_buckets), + rel_error_buckets(rel_error_buckets) {} + + const std::vector abs_error_buckets; + const std::vector rel_error_buckets; +}; + +using MiscompareCallback = std::function; + +// Inspects whether the expected and actual literals are within the given error +// bound for all elements. Also, inspects whether the rank, dimensions sizes, +// and dimension bounds are equivalent. +// +// Tuples are matched recursively. +// +// When comparing tensors of non-floating-point type, this inspects for exact +// equality, ignoring the ErrorSpec. +// +// If the shape of the literals is neither a complex/floating-point tensor nor a +// tuple which contains a complex/floating-point tensor, Near() is equivalent to +// Equal(). We don't raise an error in this case, because we want to allow +// callers to call Near() even if they have no preconceptions about the shapes +// being compared. +// +// If detailed_message is true, then the error message in the assertion result +// will contain a more detailed breakdown of mismatches. By default, we display +// a detailed message only for "large" inputs. +// +// If miscompare_callback is nullptr, Near will return an error on the first +// detected mismatch. +Status Near(const LiteralSlice& expected, const LiteralSlice& actual, + const ErrorSpec& error, std::optional detailed_message, + const MiscompareCallback& miscompare_callback); + +// Calling ToString on a literal with over 100 million elements takes around +// 3 minutes. The utility of printing a literal with >1000 elements is +// questionable, especially when writing the Literal proto to disk is orders +// of magnitude faster. +std::string ToStringTruncated(const LiteralSlice& literal); + +} // namespace literal_comparison +} // namespace xla + +#endif // XLA_LITERAL_COMPARISON_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/literal_util.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/literal_util.h new file mode 100644 index 0000000000000000000000000000000000000000..e125ef7fe30b766eec17b7778eb564af726fc9fd --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/literal_util.h @@ -0,0 +1,556 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +// Utilities for dealing with Literal protobufs. + +#ifndef XLA_LITERAL_UTIL_H_ +#define XLA_LITERAL_UTIL_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "absl/functional/function_ref.h" +#include "absl/strings/string_view.h" +#include "absl/types/span.h" +#include "xla/array.h" +#include "xla/array2d.h" +#include "xla/array3d.h" +#include "xla/array4d.h" +#include "xla/layout.h" +#include "xla/layout_util.h" +#include "xla/literal.h" +#include "xla/primitive_util.h" +#include "xla/shape.h" +#include "xla/shape_util.h" +#include "xla/status_macros.h" +#include "xla/statusor.h" +#include "xla/xla_data.pb.h" +#include "tsl/lib/core/bitmap.h" +#include "tsl/platform/errors.h" +#include "tsl/platform/logging.h" // IWYU pragma: keep + +namespace xla { + +class LiteralUtil { + public: + LiteralUtil() = delete; + + // Returns a literal scalar representing the first element. + static Literal GetFirstScalarLiteral(const LiteralSlice& literal); + // Returns a literal scalar representing the element at `multi_index`. + static Literal GetScalarLiteral(const LiteralBase& literal, + absl::Span multi_index); + // Sets the value of the element at `multi_index` with a scalar literal. + static void SetScalarLiteral(MutableLiteralBase& literal, + absl::Span multi_index, + const LiteralBase& scalar); + + // Creates a new literal of a given rank. To minimize ambiguity (for users + // and the compiler) these CreateR[0-2] methods should explicitly specify the + // native type. For example: + // + // CreateR1({1.0, 42.0}); + // CreateR2({{1, 2}, {3, 4}}); + // + // The variants not ending with WithLayout use the default XLA layout for the + // literal's linear representation in memory. + template + static Literal CreateR0(NativeT value); + template + static Literal CreateR1(absl::Span values); + static Literal CreateR1(const tsl::core::Bitmap& values); + template + static Literal CreateR2( + std::initializer_list> values); + template + static Literal CreateR2WithLayout( + std::initializer_list> values, + const Layout& layout); + template + static Literal CreateR3(std::initializer_list< + std::initializer_list>> + values); + template + static Literal CreateR3WithLayout( + std::initializer_list< + std::initializer_list>> + values, + const Layout& layout); + template + static Literal CreateR4( + std::initializer_list>>> + values); + template + static Literal CreateR4WithLayout( + std::initializer_list>>> + values, + const Layout& layout); + + // Creates a scalar literal value zero of the given primitive type. + static Literal Zero(PrimitiveType primitive_type); + // Creates a scalar literal value one of the given primitive type. + static Literal One(PrimitiveType primitive_type); + // Creates a scalar literal value containing the minimum value of the given + // primitive type. For floating-point types supporting inf, returns -inf. + static Literal MinValue(PrimitiveType primitive_type); + // Creates a scalar literal value containing the maximum value of the given + // primitive type. For floating-point types supporting inf, returns inf. + static Literal MaxValue(PrimitiveType primitive_type); + // Creates a scalar literal value containing the NaN value of the given + // primitive type. Fail for non-inexact types. For complex types, returns a + // nan + nan * j value. + static StatusOr NanValue(PrimitiveType primitive_type); + // Creates a literal of the given shape where each element is `value`. + template + static Literal CreateFullWithDescendingLayout( + absl::Span dimensions, NativeT value); + + // Creates a new literal from an Array type. The variants not ending with + // WithLayout use the default XLA layout for the literal's linear + // representation in memory. + template + static Literal CreateFromArray(const Array& values); + template + static Literal CreateFromArrayWithLayout(const Array& values, + const Layout& layout); + template + static Literal CreateR2FromArray2D(const Array2D& values); + template + static Literal CreateR2FromArray2DWithLayout(const Array2D& values, + const Layout& layout); + template + static Literal CreateR3FromArray3D(const Array3D& values); + template + static Literal CreateR3FromArray3DWithLayout(const Array3D& values, + const Layout& layout); + template + static Literal CreateR4FromArray4D(const Array4D& values); + template + static Literal CreateR4FromArray4DWithLayout(const Array4D& values, + const Layout& layout); + + // Creates a new vector of U8s literal value from a string. + static Literal CreateR1U8(absl::string_view value); + + // Creates a linspace-populated literal with the given number of rows and + // columns. + static Literal CreateR2F32Linspace(float from, float to, int64_t rows, + int64_t cols); + + // Creates a literal that projects the (x, y) dimensions given in values into + // the z dimension given by "projection". + template + static Literal CreateR3Projected( + std::initializer_list> values, + int64_t projection); + + // Creates a literal that projects the (x, y) dimensions given in values into + // the z and p dimensions given. + template + static Literal CreateR4Projected( + std::initializer_list> values, + int64_t projection_p, int64_t projection_z); + + // Returns an identity matrix (rank 2) with the given row and column count. + template + static Literal MakeIdentityR2(int64_t size); + + // Returns a tuple literal composed of given literals. Data is copied from the + // given elements into the returned literal. + static Literal MakeTuple(absl::Span elements); + + static Literal MakeTupleFromSlices(absl::Span elements); + + // As above, but intended to be invoked with move semantics; i.e. + // + // std::vector elements = ...; + // auto result = LiteralUtil::MakeTupleOwned(std::move(elements)); + // + // This would have been declared as an overload, but there is ambiguity + // in invocation between the above signature and this one. + static Literal MakeTupleOwned(std::vector elements); + + // This overload lets you pass a list of Literals to MakeTupleOwned: + // + // LiteralUtil::MakeTupleOwned(LiteralUtil::CreateR1(...), ...). + // + // Simply relying on the MakeTupleOwned(std::vector) + // overload doesn't work because std::initializer_list's elements are always + // const. + // + // The arguments to this function must all be Literal. + template + static Literal MakeTupleOwned(Ts... elements) { + std::array arr{std::move(elements)...}; + std::vector v; + v.insert(v.begin(), std::make_move_iterator(arr.begin()), + std::make_move_iterator(arr.end())); + return MakeTupleOwned(std::move(v)); + } + + // Create a constant token literal. Token types have no value. + static Literal CreateToken(); + + // Creates a new Literal object with its values havings the primitive_type + // type, and with dimensions defined by the dimensions parameter. + // The content of the literal values is the default value of the primitive + // type of literal itself (0 for numeric types, and false for predicates). + static Literal CreateFromDimensions(PrimitiveType primitive_type, + absl::Span dimensions); + + // ConvertTo family of functions: + // If the given literal's data type is , converts it to a + // literal; otherwise, returns a copy of it. If the literal is a tuple, + // recursively converts its elements. + static Literal ConvertBF16ToF32(const LiteralSlice& bf16_literal); + static Literal ConvertBF16ToF64(const LiteralSlice& bf16_literal); + static Literal ConvertF32ToF8E4M3FNUZ(const LiteralSlice& f32_literal); + static Literal ConvertF32ToF8E5M2FNUZ(const LiteralSlice& f32_literal); + static Literal ConvertF32ToBF16(const LiteralSlice& f32_literal); + static Literal ConvertF32ToS8(const LiteralSlice& f32_literal); + static Literal ConvertF32ToF64(const LiteralSlice& f32_literal); + static Literal ConvertF64ToBF16(const LiteralSlice& f64_literal); + static Literal ConvertF64ToF32(const LiteralSlice& f64_literal); + static Literal ConvertS32ToF32(const LiteralSlice& s32_literal); + + // Creates a scalar literal whose value is the maximum value of a given + // literal slice. + static Literal MaxElement(const LiteralSlice& literal); + + // Creates a literal with a new shape with the given new dimensions using the + // data in the given input literal. For reshaping purposes the (flat) data + // buffer of the input literal is assumed to have the given minor_to_major + // layout order. + static Literal ReshapeSlice(absl::Span new_dimensions, + absl::Span minor_to_major, + const LiteralSlice& literal); + + // Creates a literal with the supplied shape, and uses the provided value + // generator to populate the literal's values. + // Returns the new literal object, or an error Status if failed. + template > + static StatusOr CreateLiteralWithGenerator( + const Shape& shape, + absl::FunctionRef)> generator); + + // Creates a literal with the supplied shape, and initializes the literal + // values using a normal distribution with given mean and stddev standard + // deviation, and using the engine as entropy generator. + // Returns the new literal object, or an error Status if failed. + template > + static StatusOr CreateRandomLiteral(const Shape& shape, E* engine, + T mean, T stddev); + + // Creates a literal with the supplied shape, and initializes the literal + // values using a normal distribution with given mean and stddev standard + // deviation. + // Returns the new literal object, or an error Status if failed. + template > + static StatusOr CreateRandomLiteral(const Shape& shape, T mean, + T stddev); + + // + // End of factory methods. + + // Returns a multi-dimensional index as a string. For example: '{7, 8}' will + // be returned for a 2-dimensional index with dimension 0 index equal to 7, + // dimension 1 equal to 8. + static std::string MultiIndexAsString(absl::Span multi_index); + + // Converts the given literal to a scalar int64_t, if possible. + // + // Fails if the literal is not an integral type or if the value it contains + // cannot be represented as an int64_t. + static std::optional LiteralAsScalarInt64(const Literal& l); +}; + +std::ostream& operator<<(std::ostream& out, const Literal& literal); + +template +/* static */ Literal LiteralUtil::CreateR0(NativeT value) { + Literal literal(ShapeUtil::MakeShape( + primitive_util::NativeToPrimitiveType(), {})); + literal.Set({}, value); + return literal; +} + +template +/* static */ Literal LiteralUtil::CreateR1(absl::Span values) { + Literal literal( + ShapeUtil::MakeShape(primitive_util::NativeToPrimitiveType(), + {static_cast(values.size())})); + literal.PopulateR1(values); + return literal; +} + +template +/* static */ Literal LiteralUtil::CreateR2WithLayout( + std::initializer_list> values, + const Layout& layout) { + Literal literal(ShapeUtil::MakeShapeWithDenseLayout( + primitive_util::NativeToPrimitiveType(), + {static_cast(values.size()), + static_cast(values.begin()->size())}, + layout.minor_to_major())); + literal.PopulateR2(values); + return literal; +} + +template +/* static */ Literal LiteralUtil::CreateR2( + std::initializer_list> values) { + return CreateR2WithLayout(values, LayoutUtil::GetDefaultLayoutForR2()); +} + +template +/* static */ Literal LiteralUtil::CreateR3WithLayout( + std::initializer_list>> + values, + const Layout& layout) { + const int64_t d0 = values.size(); + const int64_t d1 = values.begin()->size(); + const int64_t d2 = values.begin()->begin()->size(); + Array3D tmp(d0, d1, d2); + int64_t i0 = 0; + for (auto d1_values : values) { + int64_t i1 = 0; + for (auto d2_values : d1_values) { + int64_t i2 = 0; + for (auto value : d2_values) { + tmp(i0, i1, i2) = value; + ++i2; + } + ++i1; + } + ++i0; + } + return CreateR3FromArray3DWithLayout(tmp, layout); +} + +template +/* static */ Literal LiteralUtil::CreateR3( + std::initializer_list>> + values) { + return CreateR3WithLayout(values, LayoutUtil::GetDefaultLayoutForR3()); +} + +template +/* static */ Literal LiteralUtil::CreateR4WithLayout( + std::initializer_list>>> + values, + const Layout& layout) { + const int64_t d0 = values.size(); + const int64_t d1 = values.begin()->size(); + const int64_t d2 = values.begin()->begin()->size(); + const int64_t d3 = values.begin()->begin()->begin()->size(); + Array4D tmp(d0, d1, d2, d3); + int64_t i0 = 0; + for (auto d1_values : values) { + int64_t i1 = 0; + for (auto d2_values : d1_values) { + int64_t i2 = 0; + for (auto d3_values : d2_values) { + int64_t i3 = 0; + for (auto value : d3_values) { + tmp(i0, i1, i2, i3) = value; + ++i3; + } + ++i2; + } + ++i1; + } + ++i0; + } + return CreateR4FromArray4DWithLayout(tmp, layout); +} + +template +/* static */ Literal LiteralUtil::CreateR4( + std::initializer_list>>> + values) { + return CreateR4WithLayout(values, LayoutUtil::GetDefaultLayoutForR4()); +} + +template +/* static */ Literal LiteralUtil::CreateFromArrayWithLayout( + const Array& values, const Layout& layout) { + Literal literal(ShapeUtil::MakeShapeWithDenseLayout( + primitive_util::NativeToPrimitiveType(), values.dimensions(), + layout.minor_to_major())); + literal.PopulateFromArray(values); + return literal; +} + +template +/* static */ Literal LiteralUtil::CreateFromArray( + const Array& values) { + return CreateFromArrayWithLayout( + values, LayoutUtil::GetDefaultLayoutForRank(values.num_dimensions())); +} + +template +/* static */ Literal LiteralUtil::CreateR2FromArray2DWithLayout( + const Array2D& values, const Layout& layout) { + return CreateFromArrayWithLayout(values, layout); +} + +template +/* static */ Literal LiteralUtil::CreateR2FromArray2D( + const Array2D& values) { + return CreateFromArray(values); +} + +template +/* static */ Literal LiteralUtil::CreateR3FromArray3DWithLayout( + const Array3D& values, const Layout& layout) { + return CreateFromArrayWithLayout(values, layout); +} + +template +/* static */ Literal LiteralUtil::CreateR3FromArray3D( + const Array3D& values) { + return CreateFromArray(values); +} + +template +/* static */ Literal LiteralUtil::CreateR3Projected( + std::initializer_list> values, + int64_t projection) { + int64_t dim0_size = projection; + int64_t dim1_size = values.size(); + int64_t dim2_size = values.begin()->size(); + + Array3D array(dim0_size, dim1_size, dim2_size); + for (int64_t dim0 = 0; dim0 < dim0_size; ++dim0) { + int64_t dim1 = 0; + for (auto inner_list : values) { + int64_t dim2 = 0; + for (auto value : inner_list) { + array(dim0, dim1, dim2) = value; + ++dim2; + } + CHECK_EQ(dim2_size, dim2); + ++dim1; + } + CHECK_EQ(dim1_size, dim1); + } + return CreateR3FromArray3D(array); +} + +template +/* static */ Literal LiteralUtil::CreateR4Projected( + std::initializer_list> values, + int64_t projection_p, int64_t projection_z) { + int64_t dim0_size = projection_p; + int64_t dim1_size = projection_z; + int64_t dim2_size = values.size(); + int64_t dim3_size = values.begin()->size(); + + Array4D array(dim0_size, dim1_size, dim2_size, dim3_size); + for (int64_t dim0 = 0; dim0 < dim0_size; ++dim0) { + for (int64_t dim1 = 0; dim1 < dim1_size; ++dim1) { + int64_t dim2 = 0; + for (auto inner_list : values) { + int64_t dim3 = 0; + for (auto value : inner_list) { + array(dim0, dim1, dim2, dim3) = value; + ++dim3; + } + CHECK_EQ(dim3_size, dim3); + ++dim2; + } + CHECK_EQ(dim2_size, dim2); + } + } + return CreateR4FromArray4D(array); +} + +template +/* static */ Literal LiteralUtil::CreateR4FromArray4D( + const Array4D& values) { + return CreateFromArray(values); +} + +template +/* static */ Literal LiteralUtil::CreateR4FromArray4DWithLayout( + const Array4D& values, const Layout& layout) { + return CreateFromArrayWithLayout(values, layout); +} + +// Returns an identity matrix (rank 2) with the given row and column count. +template +/* static */ Literal LiteralUtil::MakeIdentityR2(int64_t size) { + Array2D array(size, size, 0); + for (int64_t i = 0; i < size; ++i) { + array(i, i) = 1; + } + return CreateR2FromArray2D(array); +} + +template +/* static */ Literal LiteralUtil::CreateFullWithDescendingLayout( + absl::Span dimensions, NativeT value) { + Literal literal(ShapeUtil::MakeShapeWithDescendingLayout( + primitive_util::NativeToPrimitiveType(), dimensions)); + literal.PopulateWithValue(value); + return literal; +} + +template +/* static */ StatusOr LiteralUtil::CreateLiteralWithGenerator( + const Shape& shape, + absl::FunctionRef)> generator) { + using NativeT = primitive_util::NativeTypeOf; + TF_RET_CHECK(shape.element_type() == type); + Literal literal(shape); + TF_RETURN_IF_ERROR(literal.Populate( + [=](absl::Span indexes) { return generator(indexes); })); + return std::move(literal); +} + +template +/* static */ StatusOr LiteralUtil::CreateRandomLiteral( + const Shape& shape, E* engine, T mean, T stddev) { + using NativeT = primitive_util::NativeTypeOf; + std::normal_distribution generator(mean, stddev); + return CreateLiteralWithGenerator( + shape, [&](absl::Span /*indexes*/) { + return static_cast(generator(*engine)); + }); +} + +template +/* static */ StatusOr LiteralUtil::CreateRandomLiteral( + const Shape& shape, T mean, T stddev) { + std::minstd_rand0 engine; + return CreateRandomLiteral(shape, &engine, mean, stddev); +} + +} // namespace xla + +#endif // XLA_LITERAL_UTIL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/map_util.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/map_util.h new file mode 100644 index 0000000000000000000000000000000000000000..b6321bcba40b21c5ed294f3fe3f88c34b9a08121 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/map_util.h @@ -0,0 +1,125 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_MAP_UTIL_H_ +#define XLA_MAP_UTIL_H_ + +#include +#include + +#include "absl/container/flat_hash_map.h" +#include "absl/container/flat_hash_set.h" +#include "xla/statusor.h" +#include "xla/util.h" +#include "tsl/platform/logging.h" + +namespace xla { + +// FindOrDie returns a const reference to the value associated with +// the given key if it exists. Crashes otherwise. +// +// This is intended as a replacement for operator[] as an rvalue (for reading) +// when the key is guaranteed to exist. +template +const typename Collection::value_type::second_type& FindOrDie( + const Collection& collection, + const typename Collection::value_type::first_type& key) { + typename Collection::const_iterator it = collection.find(key); + CHECK(it != collection.end()) << "Map key not found: " << key; + return it->second; +} + +// Same as above, but returns a non-const reference. +template +typename Collection::value_type::second_type& FindOrDie( + Collection& collection, // NOLINT + const typename Collection::value_type::first_type& key) { + typename Collection::iterator it = collection.find(key); + CHECK(it != collection.end()) << "Map key not found: " << key; + return it->second; +} + +// Like FindOrDie but returns an error instead of dying if `key` is not in +// `container`. +template +StatusOr< + std::reference_wrapper> +MaybeFind(const Collection& collection, + const typename Collection::value_type::first_type& key) { + typename Collection::const_iterator it = collection.find(key); + if (it == collection.end()) { + std::ostringstream os; + os << key; + return NotFound("key not found: %s", os.str()); + } + return {it->second}; +} + +// Returns a const reference to the value associated with the given key if it +// exists, otherwise returns a const reference to the provided default value. +// +// WARNING: If a temporary object is passed as the default "value," +// this function will return a reference to that temporary object, +// which will be destroyed at the end of the statement. A common +// example: if you have a map with string values, and you pass a char* +// as the default "value," either use the returned value immediately +// or store it in a string (not string&). +template +const typename Collection::value_type::second_type& FindOrDefault( + const Collection& collection, + const typename Collection::value_type::first_type& key, + const typename Collection::value_type::second_type& value) { + auto it = collection.find(key); + if (it != collection.end()) return it->second; + return value; +} + +// Inserts the key-value pair into the collection. Dies if key was already +// present. +template +void InsertOrDie(Collection* const collection, Key&& key, Value&& value) { + auto p = collection->insert( + std::make_pair(std::forward(key), std::forward(value))); + CHECK(p.second) << "duplicate key: " << key; +} + +// Returns true if and only if the given collection contains the given key. +template +bool ContainsKey(const Collection& collection, const Key& key) { + return collection.find(key) != collection.end(); +} + +// Returns a function that returns whether the map contains the given key. +template +auto IsKeyIn(const absl::flat_hash_map& map) { + return [&](const Key& key) { return map.contains(key); }; +} + +// Returns a function that returns whether the set contains the given value. +template +auto IsValueIn(const absl::flat_hash_set& set) { + return [&](const T& value) { return set.contains(value); }; +} + +// Inserts `value` into `set`. Dies if it was already present. +template +void InsertOrDie(Set* const set, Value&& value) { + CHECK(set->insert(std::forward(value)).second) + << "duplicate value: " << value; +} + +} // namespace xla + +#endif // XLA_MAP_UTIL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/metric_table_report.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/metric_table_report.h new file mode 100644 index 0000000000000000000000000000000000000000..9c3659363e8b8fc92d235df2d2b2440d12c2971f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/metric_table_report.h @@ -0,0 +1,175 @@ +/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_METRIC_TABLE_REPORT_H_ +#define XLA_METRIC_TABLE_REPORT_H_ + +#include +#include + +#include "absl/strings/str_cat.h" + +namespace xla { + +// Class for creating a text format table showing entries with a metric +// (e.g. cycles) and a text (e.g. name of function taking that many +// cycles). Entries are grouped by a category and sorted in decreasing order of +// the metric. +// +// Example of a categories table generated using this class: +// +// ********** microseconds report ********** +// There are 3,912,517 microseconds in total. +// There are 123 microseconds ( 0.00%) not accounted for by the data. +// There are 3002 ops. +// +// ********** categories table ********** +// The left hand side numbers are microseconds. +// 1,749,414 (44.71% Σ44.72%) convolution (206 ops) +// * 10.51% %convolution.202 +// * 10.51% %convolution.204 +// * 10.51% %convolution.203 +// * ... (203 more ops) +// 884,939 (22.62% Σ67.33%) convolution window-dilated (7 ops) +// * 7.50% %convolution-window-dilated.7 +// [...] +// +// The entry table is similar, it just has the entries directly as the entries +// instead of grouping by categories first. +class MetricTableReport { + public: + // Represents an entry in the table. + struct Entry { + // Text to show in the entry table for this entry. + std::string text; + + // Text to show in the category table for this entry. + std::string short_text; + + // Text that represents the category of this entry - entries with the same + // category are grouped together in the category table. + std::string category_text; + + // The value of the metric for this entry. + double metric = 0.0; + }; + + void AddEntry(Entry entry); + + // The default name for the metric is "units", this function allows setting a + // more meaningful name. + void SetMetricName(std::string metric_name); + + // The default name for referring to entries is "entries", this functions + // allows setting a more meaningful name. + void SetEntryName(std::string entry_name); + + // By default the size of the table is limited. Calling this function forces + // all entries to be shown no matter how many there are. + void SetShowAllEntries(); + + // Set option to show a table with data on the categories of entries. + void SetShowCategoryTable(); + + // Set option to show a table with data on the entries. + void SetShowEntryTable(); + + // Returns the report as a string. expected_metric_sum is the expected sum of + // the metric across the entries. It is not an error for the actual sum to be + // different from the expectation - the report will include the + // discrepancy. All metric percentages are for the ratio with respect to the + // expected sum, not the actual sum. + std::string MakeReport(double expected_metric_sum); + + // As MakeReport(), but writes the report to the INFO log in a way that avoids + // cutting the report off if it is longer than the maximum line length for a + // logged line. Individual lines in the report may still be cut off, but they + // would have to be very long for that to happen. + void WriteReportToInfoLog(double expected_metric_sum); + + private: + static constexpr double kDefaultMaxMetricProportionToShow = 0.99; + static constexpr int64_t kDefaultMaxEntriesToShow = 100; + static constexpr int64_t kDefaultMaxEntriesPerCategoryToShow = 5; + + // Append all parameters to the report. + template + void AppendLine(Args... args) { + absl::StrAppend(&report_, std::forward(args)..., "\n"); + } + + // Represents a set of entries with the same category_text. + struct Category { + std::string category_text; + double metric_sum = 0.0; // Sum of metric across entries. + std::vector entries; + }; + + // Returns a vector of categories of entries with the same category_text. The + // vector is sorted in order of decreasing metric sum. + // + // The returned categories contain pointers into the entries parameter. The + // style guide requires parameters to which references/pointers are retained + // to be taken by pointer, even for const parameters, so that is why entries + // is taken by pointer. + static std::vector MakeCategories( + const std::vector* entries); + + // Append a header to the report. + void AppendHeader(); + + // Append a table of categories to the report. + void AppendCategoryTable(); + + // Append a table of entries to the report. + void AppendEntryTable(); + + // Appends a row of a table to the report. + void AppendTableRow(const std::string& text, const double metric, + const double running_metric_sum); + + // Returns the discrepancy between the expected sum of the metric of the + // entries and the actual sum. + double UnaccountedMetric(); + + // Formats the metric value as a string. + std::string MetricString(double metric); + + // Returns a string representing the metric value as a proportion of the + // expected metric sum. + std::string MetricPercent(double metric); + + // The entries to make a report about. + std::vector entries_; + + double expected_metric_sum_ = 0.0; + std::string metric_name_ = "units"; + std::string entry_name_ = "entries"; + bool show_category_table_ = false; + bool show_entry_table_ = false; + + // These members control how many categories and entries to show in tables. + int64_t max_entries_to_show_ = kDefaultMaxEntriesToShow; + int64_t max_entries_per_category_to_show_ = + kDefaultMaxEntriesPerCategoryToShow; + double max_metric_proportion_to_show_ = kDefaultMaxMetricProportionToShow; + + // The report that is being created. + std::string report_; +}; + +} // namespace xla + +#endif // XLA_METRIC_TABLE_REPORT_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/backends/cpu/transforms/passes.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/backends/cpu/transforms/passes.h new file mode 100644 index 0000000000000000000000000000000000000000..0310dbf0a9689a319ad318ec399014c984f7c6b5 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/backends/cpu/transforms/passes.h @@ -0,0 +1,64 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_MLIR_BACKENDS_CPU_TRANSFORMS_PASSES_H_ +#define XLA_MLIR_BACKENDS_CPU_TRANSFORMS_PASSES_H_ + +#include + +#include "mlir/Dialect/Func/IR/FuncOps.h" // from @llvm-project +#include "mlir/IR/BuiltinOps.h" // from @llvm-project +#include "mlir/Pass/Pass.h" // from @llvm-project + +namespace xla { +namespace cpu { + +//===----------------------------------------------------------------------===// +// Auxiliary passes for lowering to XLA Cpu runtime. +//===----------------------------------------------------------------------===// + +std::unique_ptr> +createConvertXlaCpuToCpuRuntimePass(); + +std::unique_ptr> +createXlaAbiLegalizationPass(); + +std::unique_ptr> +createLegalizeLibraryOpsPass(); + +std::unique_ptr> +createLegalizeI1VectorTransferOpsPass(); + +std::unique_ptr> +createConvertXlaCpuMemRefElementCastToLLVMPass(); + +std::unique_ptr> +createRemoveCopiesToOutParamsPass(); + +std::unique_ptr> +createSparseCustomCallRewritingPass(); + +std::unique_ptr> +createRewriteReallocToAllocPass(); + +//===-----------------------------------------------------------------------===/ + +#define GEN_PASS_REGISTRATION +#include "xla/mlir/backends/cpu/transforms/passes.h.inc" + +} // namespace cpu +} // namespace xla + +#endif // XLA_MLIR_BACKENDS_CPU_TRANSFORMS_PASSES_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/backends/cpu/transforms/passes.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/backends/cpu/transforms/passes.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..85bf402aeb96ff961a24851db7df895b46fdfefe --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/backends/cpu/transforms/passes.h.inc @@ -0,0 +1,1040 @@ +/* Autogenerated by mlir-tblgen; don't manually edit */ + +#ifdef GEN_PASS_DECL +// Generate declarations for all passes. +#define GEN_PASS_DECL_CONVERTXLACPUMEMREFELEMENTCASTTOLLVMPASS +#define GEN_PASS_DECL_CONVERTXLACPUTOCPURUNTIMEPASS +#define GEN_PASS_DECL_LEGALIZEI1VECTORTRANSFEROPSPASS +#define GEN_PASS_DECL_LEGALIZELIBRARYOPSPASS +#define GEN_PASS_DECL_LEGALIZEXLAABIPASS +#define GEN_PASS_DECL_REMOVECOPIESTOOUTPARAMSPASS +#define GEN_PASS_DECL_REWRITEREALLOCTOALLOCPASS +#define GEN_PASS_DECL_SPARSECUSTOMCALLREWRITINGPASS +#undef GEN_PASS_DECL +#endif // GEN_PASS_DECL + +//===----------------------------------------------------------------------===// +// ConvertXlaCpuMemRefElementCastToLLVMPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTXLACPUMEMREFELEMENTCASTTOLLVMPASS +#undef GEN_PASS_DECL_CONVERTXLACPUMEMREFELEMENTCASTTOLLVMPASS +#endif // GEN_PASS_DECL_CONVERTXLACPUMEMREFELEMENTCASTTOLLVMPASS +#ifdef GEN_PASS_DEF_CONVERTXLACPUMEMREFELEMENTCASTTOLLVMPASS +namespace impl { + +template +class ConvertXlaCpuMemRefElementCastToLLVMPassBase : public ::mlir::OperationPass { +public: + using Base = ConvertXlaCpuMemRefElementCastToLLVMPassBase; + + ConvertXlaCpuMemRefElementCastToLLVMPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertXlaCpuMemRefElementCastToLLVMPassBase(const ConvertXlaCpuMemRefElementCastToLLVMPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-convert-memref-element-cast-to-llvm"); + } + ::llvm::StringRef getArgument() const override { return "xla-convert-memref-element-cast-to-llvm"; } + + ::llvm::StringRef getDescription() const override { return "Converts xla_cpu.memref_element_cast ops to LLVM."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertXlaCpuMemRefElementCastToLLVMPass"); + } + ::llvm::StringRef getName() const override { return "ConvertXlaCpuMemRefElementCastToLLVMPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertXlaCpuMemRefElementCastToLLVMPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_CONVERTXLACPUMEMREFELEMENTCASTTOLLVMPASS +#endif // GEN_PASS_DEF_CONVERTXLACPUMEMREFELEMENTCASTTOLLVMPASS + +//===----------------------------------------------------------------------===// +// ConvertXlaCpuToCpuRuntimePass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTXLACPUTOCPURUNTIMEPASS +#undef GEN_PASS_DECL_CONVERTXLACPUTOCPURUNTIMEPASS +#endif // GEN_PASS_DECL_CONVERTXLACPUTOCPURUNTIMEPASS +#ifdef GEN_PASS_DEF_CONVERTXLACPUTOCPURUNTIMEPASS +namespace impl { + +template +class ConvertXlaCpuToCpuRuntimePassBase : public ::mlir::OperationPass { +public: + using Base = ConvertXlaCpuToCpuRuntimePassBase; + + ConvertXlaCpuToCpuRuntimePassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertXlaCpuToCpuRuntimePassBase(const ConvertXlaCpuToCpuRuntimePassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-cpu-to-cpu-runtime"); + } + ::llvm::StringRef getArgument() const override { return "xla-cpu-to-cpu-runtime"; } + + ::llvm::StringRef getDescription() const override { return "Converts xla_cpu operations to XLA Cpu runtime custom calls"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertXlaCpuToCpuRuntimePass"); + } + ::llvm::StringRef getName() const override { return "ConvertXlaCpuToCpuRuntimePass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertXlaCpuToCpuRuntimePassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_CONVERTXLACPUTOCPURUNTIMEPASS +#endif // GEN_PASS_DEF_CONVERTXLACPUTOCPURUNTIMEPASS + +//===----------------------------------------------------------------------===// +// LegalizeI1VectorTransferOpsPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_LEGALIZEI1VECTORTRANSFEROPSPASS +#undef GEN_PASS_DECL_LEGALIZEI1VECTORTRANSFEROPSPASS +#endif // GEN_PASS_DECL_LEGALIZEI1VECTORTRANSFEROPSPASS +#ifdef GEN_PASS_DEF_LEGALIZEI1VECTORTRANSFEROPSPASS +namespace impl { + +template +class LegalizeI1VectorTransferOpsPassBase : public ::mlir::OperationPass { +public: + using Base = LegalizeI1VectorTransferOpsPassBase; + + LegalizeI1VectorTransferOpsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + LegalizeI1VectorTransferOpsPassBase(const LegalizeI1VectorTransferOpsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-legalize-i1-vector-transfers"); + } + ::llvm::StringRef getArgument() const override { return "xla-legalize-i1-vector-transfers"; } + + ::llvm::StringRef getDescription() const override { return "Legalizes transfer ops operating on vectors of i1."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LegalizeI1VectorTransferOpsPass"); + } + ::llvm::StringRef getName() const override { return "LegalizeI1VectorTransferOpsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LegalizeI1VectorTransferOpsPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_LEGALIZEI1VECTORTRANSFEROPSPASS +#endif // GEN_PASS_DEF_LEGALIZEI1VECTORTRANSFEROPSPASS + +//===----------------------------------------------------------------------===// +// LegalizeLibraryOpsPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_LEGALIZELIBRARYOPSPASS +#undef GEN_PASS_DECL_LEGALIZELIBRARYOPSPASS +#endif // GEN_PASS_DECL_LEGALIZELIBRARYOPSPASS +#ifdef GEN_PASS_DEF_LEGALIZELIBRARYOPSPASS +namespace impl { + +template +class LegalizeLibraryOpsPassBase : public ::mlir::OperationPass { +public: + using Base = LegalizeLibraryOpsPassBase; + + LegalizeLibraryOpsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + LegalizeLibraryOpsPassBase(const LegalizeLibraryOpsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-legalize-library-ops"); + } + ::llvm::StringRef getArgument() const override { return "xla-legalize-library-ops"; } + + ::llvm::StringRef getDescription() const override { return "Legalizes ops that map to runtime library calls."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LegalizeLibraryOpsPass"); + } + ::llvm::StringRef getName() const override { return "LegalizeLibraryOpsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LegalizeLibraryOpsPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_LEGALIZELIBRARYOPSPASS +#endif // GEN_PASS_DEF_LEGALIZELIBRARYOPSPASS + +//===----------------------------------------------------------------------===// +// LegalizeXlaAbiPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_LEGALIZEXLAABIPASS +#undef GEN_PASS_DECL_LEGALIZEXLAABIPASS +#endif // GEN_PASS_DECL_LEGALIZEXLAABIPASS +#ifdef GEN_PASS_DEF_LEGALIZEXLAABIPASS +namespace impl { + +template +class LegalizeXlaAbiPassBase : public ::mlir::OperationPass { +public: + using Base = LegalizeXlaAbiPassBase; + + LegalizeXlaAbiPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + LegalizeXlaAbiPassBase(const LegalizeXlaAbiPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-legalize-abi"); + } + ::llvm::StringRef getArgument() const override { return "xla-legalize-abi"; } + + ::llvm::StringRef getDescription() const override { return "Converts layouts and data formats at ABI boundaries"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LegalizeXlaAbiPass"); + } + ::llvm::StringRef getName() const override { return "LegalizeXlaAbiPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LegalizeXlaAbiPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_LEGALIZEXLAABIPASS +#endif // GEN_PASS_DEF_LEGALIZEXLAABIPASS + +//===----------------------------------------------------------------------===// +// RemoveCopiesToOutParamsPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_REMOVECOPIESTOOUTPARAMSPASS +#undef GEN_PASS_DECL_REMOVECOPIESTOOUTPARAMSPASS +#endif // GEN_PASS_DECL_REMOVECOPIESTOOUTPARAMSPASS +#ifdef GEN_PASS_DEF_REMOVECOPIESTOOUTPARAMSPASS +namespace impl { + +template +class RemoveCopiesToOutParamsPassBase : public ::mlir::OperationPass { +public: + using Base = RemoveCopiesToOutParamsPassBase; + + RemoveCopiesToOutParamsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + RemoveCopiesToOutParamsPassBase(const RemoveCopiesToOutParamsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-remove-copies-to-out-params"); + } + ::llvm::StringRef getArgument() const override { return "xla-remove-copies-to-out-params"; } + + ::llvm::StringRef getDescription() const override { return "Removes redundant alloc/copy pairs to out params."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("RemoveCopiesToOutParamsPass"); + } + ::llvm::StringRef getName() const override { return "RemoveCopiesToOutParamsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(RemoveCopiesToOutParamsPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_REMOVECOPIESTOOUTPARAMSPASS +#endif // GEN_PASS_DEF_REMOVECOPIESTOOUTPARAMSPASS + +//===----------------------------------------------------------------------===// +// RewriteReallocToAllocPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_REWRITEREALLOCTOALLOCPASS +#undef GEN_PASS_DECL_REWRITEREALLOCTOALLOCPASS +#endif // GEN_PASS_DECL_REWRITEREALLOCTOALLOCPASS +#ifdef GEN_PASS_DEF_REWRITEREALLOCTOALLOCPASS +namespace impl { + +template +class RewriteReallocToAllocPassBase : public ::mlir::OperationPass { +public: + using Base = RewriteReallocToAllocPassBase; + + RewriteReallocToAllocPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + RewriteReallocToAllocPassBase(const RewriteReallocToAllocPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-rewrite-realloc-to-alloc"); + } + ::llvm::StringRef getArgument() const override { return "xla-rewrite-realloc-to-alloc"; } + + ::llvm::StringRef getDescription() const override { return "Rewrites realloc to alloc + copy"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("RewriteReallocToAllocPass"); + } + ::llvm::StringRef getName() const override { return "RewriteReallocToAllocPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(RewriteReallocToAllocPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_REWRITEREALLOCTOALLOCPASS +#endif // GEN_PASS_DEF_REWRITEREALLOCTOALLOCPASS + +//===----------------------------------------------------------------------===// +// SparseCustomCallRewritingPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_SPARSECUSTOMCALLREWRITINGPASS +#undef GEN_PASS_DECL_SPARSECUSTOMCALLREWRITINGPASS +#endif // GEN_PASS_DECL_SPARSECUSTOMCALLREWRITINGPASS +#ifdef GEN_PASS_DEF_SPARSECUSTOMCALLREWRITINGPASS +namespace impl { + +template +class SparseCustomCallRewritingPassBase : public ::mlir::OperationPass { +public: + using Base = SparseCustomCallRewritingPassBase; + + SparseCustomCallRewritingPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + SparseCustomCallRewritingPassBase(const SparseCustomCallRewritingPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-sparse-custom-call-to-pack"); + } + ::llvm::StringRef getArgument() const override { return "xla-sparse-custom-call-to-pack"; } + + ::llvm::StringRef getDescription() const override { return "Converts CustomCall operations to sparse operations"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("SparseCustomCallRewritingPass"); + } + ::llvm::StringRef getName() const override { return "SparseCustomCallRewritingPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(SparseCustomCallRewritingPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_SPARSECUSTOMCALLREWRITINGPASS +#endif // GEN_PASS_DEF_SPARSECUSTOMCALLREWRITINGPASS +#ifdef GEN_PASS_REGISTRATION + +//===----------------------------------------------------------------------===// +// ConvertXlaCpuMemRefElementCastToLLVMPass Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertXlaCpuMemRefElementCastToLLVMPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createConvertXlaCpuMemRefElementCastToLLVMPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertXlaCpuMemRefElementCastToLLVMPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createConvertXlaCpuMemRefElementCastToLLVMPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertXlaCpuToCpuRuntimePass Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertXlaCpuToCpuRuntimePass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createConvertXlaCpuToCpuRuntimePass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertXlaCpuToCpuRuntimePassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createConvertXlaCpuToCpuRuntimePass(); + }); +} + +//===----------------------------------------------------------------------===// +// LegalizeI1VectorTransferOpsPass Registration +//===----------------------------------------------------------------------===// + +inline void registerLegalizeI1VectorTransferOpsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createLegalizeI1VectorTransferOpsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerLegalizeI1VectorTransferOpsPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createLegalizeI1VectorTransferOpsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// LegalizeLibraryOpsPass Registration +//===----------------------------------------------------------------------===// + +inline void registerLegalizeLibraryOpsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createLegalizeLibraryOpsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerLegalizeLibraryOpsPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createLegalizeLibraryOpsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// LegalizeXlaAbiPass Registration +//===----------------------------------------------------------------------===// + +inline void registerLegalizeXlaAbiPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createXlaAbiLegalizationPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerLegalizeXlaAbiPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createXlaAbiLegalizationPass(); + }); +} + +//===----------------------------------------------------------------------===// +// RemoveCopiesToOutParamsPass Registration +//===----------------------------------------------------------------------===// + +inline void registerRemoveCopiesToOutParamsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createRemoveCopiesToOutParamsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerRemoveCopiesToOutParamsPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createRemoveCopiesToOutParamsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// RewriteReallocToAllocPass Registration +//===----------------------------------------------------------------------===// + +inline void registerRewriteReallocToAllocPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createRewriteReallocToAllocPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerRewriteReallocToAllocPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createRewriteReallocToAllocPass(); + }); +} + +//===----------------------------------------------------------------------===// +// SparseCustomCallRewritingPass Registration +//===----------------------------------------------------------------------===// + +inline void registerSparseCustomCallRewritingPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createSparseCustomCallRewritingPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerSparseCustomCallRewritingPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createSparseCustomCallRewritingPass(); + }); +} + +//===----------------------------------------------------------------------===// +// CpuTransforms Registration +//===----------------------------------------------------------------------===// + +inline void registerCpuTransformsPasses() { + registerConvertXlaCpuMemRefElementCastToLLVMPass(); + registerConvertXlaCpuToCpuRuntimePass(); + registerLegalizeI1VectorTransferOpsPass(); + registerLegalizeLibraryOpsPass(); + registerLegalizeXlaAbiPass(); + registerRemoveCopiesToOutParamsPass(); + registerRewriteReallocToAllocPass(); + registerSparseCustomCallRewritingPass(); +} +#undef GEN_PASS_REGISTRATION +#endif // GEN_PASS_REGISTRATION +// Deprecated. Please use the new per-pass macros. +#ifdef GEN_PASS_CLASSES + +template +class ConvertXlaCpuMemRefElementCastToLLVMPassBase : public ::mlir::OperationPass { +public: + using Base = ConvertXlaCpuMemRefElementCastToLLVMPassBase; + + ConvertXlaCpuMemRefElementCastToLLVMPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertXlaCpuMemRefElementCastToLLVMPassBase(const ConvertXlaCpuMemRefElementCastToLLVMPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-convert-memref-element-cast-to-llvm"); + } + ::llvm::StringRef getArgument() const override { return "xla-convert-memref-element-cast-to-llvm"; } + + ::llvm::StringRef getDescription() const override { return "Converts xla_cpu.memref_element_cast ops to LLVM."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertXlaCpuMemRefElementCastToLLVMPass"); + } + ::llvm::StringRef getName() const override { return "ConvertXlaCpuMemRefElementCastToLLVMPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertXlaCpuMemRefElementCastToLLVMPassBase) + +protected: +}; + +template +class ConvertXlaCpuToCpuRuntimePassBase : public ::mlir::OperationPass { +public: + using Base = ConvertXlaCpuToCpuRuntimePassBase; + + ConvertXlaCpuToCpuRuntimePassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertXlaCpuToCpuRuntimePassBase(const ConvertXlaCpuToCpuRuntimePassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-cpu-to-cpu-runtime"); + } + ::llvm::StringRef getArgument() const override { return "xla-cpu-to-cpu-runtime"; } + + ::llvm::StringRef getDescription() const override { return "Converts xla_cpu operations to XLA Cpu runtime custom calls"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertXlaCpuToCpuRuntimePass"); + } + ::llvm::StringRef getName() const override { return "ConvertXlaCpuToCpuRuntimePass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertXlaCpuToCpuRuntimePassBase) + +protected: +}; + +template +class LegalizeI1VectorTransferOpsPassBase : public ::mlir::OperationPass { +public: + using Base = LegalizeI1VectorTransferOpsPassBase; + + LegalizeI1VectorTransferOpsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + LegalizeI1VectorTransferOpsPassBase(const LegalizeI1VectorTransferOpsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-legalize-i1-vector-transfers"); + } + ::llvm::StringRef getArgument() const override { return "xla-legalize-i1-vector-transfers"; } + + ::llvm::StringRef getDescription() const override { return "Legalizes transfer ops operating on vectors of i1."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LegalizeI1VectorTransferOpsPass"); + } + ::llvm::StringRef getName() const override { return "LegalizeI1VectorTransferOpsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LegalizeI1VectorTransferOpsPassBase) + +protected: +}; + +template +class LegalizeLibraryOpsPassBase : public ::mlir::OperationPass { +public: + using Base = LegalizeLibraryOpsPassBase; + + LegalizeLibraryOpsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + LegalizeLibraryOpsPassBase(const LegalizeLibraryOpsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-legalize-library-ops"); + } + ::llvm::StringRef getArgument() const override { return "xla-legalize-library-ops"; } + + ::llvm::StringRef getDescription() const override { return "Legalizes ops that map to runtime library calls."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LegalizeLibraryOpsPass"); + } + ::llvm::StringRef getName() const override { return "LegalizeLibraryOpsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LegalizeLibraryOpsPassBase) + +protected: +}; + +template +class LegalizeXlaAbiPassBase : public ::mlir::OperationPass { +public: + using Base = LegalizeXlaAbiPassBase; + + LegalizeXlaAbiPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + LegalizeXlaAbiPassBase(const LegalizeXlaAbiPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-legalize-abi"); + } + ::llvm::StringRef getArgument() const override { return "xla-legalize-abi"; } + + ::llvm::StringRef getDescription() const override { return "Converts layouts and data formats at ABI boundaries"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LegalizeXlaAbiPass"); + } + ::llvm::StringRef getName() const override { return "LegalizeXlaAbiPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LegalizeXlaAbiPassBase) + +protected: +}; + +template +class RemoveCopiesToOutParamsPassBase : public ::mlir::OperationPass { +public: + using Base = RemoveCopiesToOutParamsPassBase; + + RemoveCopiesToOutParamsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + RemoveCopiesToOutParamsPassBase(const RemoveCopiesToOutParamsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-remove-copies-to-out-params"); + } + ::llvm::StringRef getArgument() const override { return "xla-remove-copies-to-out-params"; } + + ::llvm::StringRef getDescription() const override { return "Removes redundant alloc/copy pairs to out params."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("RemoveCopiesToOutParamsPass"); + } + ::llvm::StringRef getName() const override { return "RemoveCopiesToOutParamsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(RemoveCopiesToOutParamsPassBase) + +protected: +}; + +template +class RewriteReallocToAllocPassBase : public ::mlir::OperationPass { +public: + using Base = RewriteReallocToAllocPassBase; + + RewriteReallocToAllocPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + RewriteReallocToAllocPassBase(const RewriteReallocToAllocPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-rewrite-realloc-to-alloc"); + } + ::llvm::StringRef getArgument() const override { return "xla-rewrite-realloc-to-alloc"; } + + ::llvm::StringRef getDescription() const override { return "Rewrites realloc to alloc + copy"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("RewriteReallocToAllocPass"); + } + ::llvm::StringRef getName() const override { return "RewriteReallocToAllocPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(RewriteReallocToAllocPassBase) + +protected: +}; + +template +class SparseCustomCallRewritingPassBase : public ::mlir::OperationPass { +public: + using Base = SparseCustomCallRewritingPassBase; + + SparseCustomCallRewritingPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + SparseCustomCallRewritingPassBase(const SparseCustomCallRewritingPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-sparse-custom-call-to-pack"); + } + ::llvm::StringRef getArgument() const override { return "xla-sparse-custom-call-to-pack"; } + + ::llvm::StringRef getDescription() const override { return "Converts CustomCall operations to sparse operations"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("SparseCustomCallRewritingPass"); + } + ::llvm::StringRef getName() const override { return "SparseCustomCallRewritingPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(SparseCustomCallRewritingPassBase) + +protected: +}; +#undef GEN_PASS_CLASSES +#endif // GEN_PASS_CLASSES diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/backends/gpu/transforms/dataflow_analysis.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/backends/gpu/transforms/dataflow_analysis.h new file mode 100644 index 0000000000000000000000000000000000000000..033037af1131003f908dff81b011362b2c2396fc --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/backends/gpu/transforms/dataflow_analysis.h @@ -0,0 +1,56 @@ +/* Copyright 2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_MLIR_BACKENDS_GPU_TRANSFORMS_DATAFLOW_ANALYSIS_H_ +#define XLA_MLIR_BACKENDS_GPU_TRANSFORMS_DATAFLOW_ANALYSIS_H_ + +#include +#include + +#include "mlir/Dialect/Func/IR/FuncOps.h" // from @llvm-project + +namespace xla { +namespace gpu { + +class DataflowAnalysis { + public: + explicit DataflowAnalysis(mlir::Operation* op) {} + + struct Node { + mlir::Operation* operation; + size_t index; + std::vector children; + }; + + using DataflowGraph = std::vector; + + // This function creates a dataflow graph that represent data dependencies in + // the graph capture function. The analysis relies on some properties of the + // IR in XLA: + // (1) Buffer arguments do not alias. It is guaranteed that two buffer + // arguments to the graph capture function do not overlap. + // (2) XLA operations do not have any side effects beyond writing to its + // buffer arguments. So it is safe to reorder operations if they do not + // have write-conflicts. + // (3) We have information about read-only and read-write buffer arguments. + DataflowGraph GetDataflowGraph(mlir::func::FuncOp graph_capture_function); + + std::string ToDot(const DataflowGraph& graph); +}; + +} // namespace gpu +} // namespace xla + +#endif // XLA_MLIR_BACKENDS_GPU_TRANSFORMS_DATAFLOW_ANALYSIS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/backends/gpu/transforms/passes.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/backends/gpu/transforms/passes.h new file mode 100644 index 0000000000000000000000000000000000000000..4c3fc987ea74b518b7efba234d05ca690f041afa --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/backends/gpu/transforms/passes.h @@ -0,0 +1,133 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_MLIR_BACKENDS_GPU_TRANSFORMS_PASSES_H_ +#define XLA_MLIR_BACKENDS_GPU_TRANSFORMS_PASSES_H_ + +#include +#include + +#include "mlir/Dialect/Func/IR/FuncOps.h" // from @llvm-project +#include "mlir/IR/BuiltinOps.h" // from @llvm-project +#include "mlir/Pass/Pass.h" // from @llvm-project +#include "xla/stream_executor/device_description.h" + +namespace xla { +namespace gpu { + +#define GEN_PASS_DECL_ADDHLOTRACEANNOTATIONSPASS +#define GEN_PASS_DECL_CONVERTGPUTOGPURUNTIMEPASS +#define GEN_PASS_DECL_CONVERTLMHLOGPUTOGPURUNTIMEPASS +#define GEN_PASS_DECL_CONVERTLMHLOTOGPULAUNCHPASS +#define GEN_PASS_DECL_CONVERTLMHLOTOGPURUNTIMEPASS +#define GEN_PASS_DECL_CONVERTMEMREFGETGLOBALTOARGPASS +#define GEN_PASS_DECL_OUTLINEGPUGRAPHSPASS +#define GEN_PASS_DECL_ADDCONCURRENTREGIONSPASS +#define GEN_PASS_DECL_STREAMASSIGNMENTPASS +#include "xla/mlir/backends/gpu/transforms/passes.h.inc" + +class ThunkSequence; // forward declare + +struct GpuPipelineOpts { + // Enable experimental pass that outlines parts of the XLA computation into + // CUDA Graphs, which allows us to amortize the cost of launching multiple + // device kernels. + int32_t gpu_graph_level = 0; + int32_t min_graph_size = 0; + bool enable_concurrent_region = false; + stream_executor::GpuComputeCapability compute_capability; +}; + +// Populate passes that lower MLIR modules from a combination of LMHLO and +// LMHLO_GPU dialects to the XLA Gpu runtime. This pipeline is composed from +// the passes defined below, and few builtin MLIR passes. +void populateXlaGpuRuntimePasses(mlir::OpPassManager& pm, + ThunkSequence* thunk_sequence, + const GpuPipelineOpts& opts = {}); + +//===----------------------------------------------------------------------===// +// Auxiliary passes for lowering to XLA Gpu runtime. +//===----------------------------------------------------------------------===// + +std::unique_ptr> +createConvertMemrefGetGlobalToArgPass(); + +std::unique_ptr> +createConvertMemrefGetGlobalToArgPass(int64_t min_num_elements); + +//===-----------------------------------------------------------------------===/ +// Passes for lowering from the `gpu` dialect. +//===-----------------------------------------------------------------------===/ + +std::unique_ptr> +createConvertGpuToGpuRuntimePass(); + +//===----------------------------------------------------------------------===// +// Passes for lowering from the `lmhlo` dialect. +//===----------------------------------------------------------------------===// + +std::unique_ptr> +createConvertLmhloToGpuLaunchPass(ThunkSequence* thunk_sequence = nullptr); + +std::unique_ptr> +createConvertLmhloToGpuRuntimePass(); + +//===----------------------------------------------------------------------===// +// Passes for lowering from the `lmhlo_gpu` dialect. +//===----------------------------------------------------------------------===// + +std::unique_ptr> +createConvertLmhloGpuToGpuRuntimePass(); + +//===----------------------------------------------------------------------===// +// XLA runtime performance tracing passes. +//===----------------------------------------------------------------------===// + +std::unique_ptr> +createAddHloTraceAnnotationsPass(); + +//===----------------------------------------------------------------------===// +// XLA runtime <-> Cuda Graphs integration. +//===----------------------------------------------------------------------===// + +std::unique_ptr> +createOutlineGpuGraphsPass(); + +std::unique_ptr> createOutlineGpuGraphsPass( + int32_t gpu_graph_level, int32_t min_graph_size); + +//===----------------------------------------------------------------------===// +// Passes for marking concurrent region in CUDA graph capture function. +//===----------------------------------------------------------------------===// + +std::unique_ptr> +createAddConcurrentRegionsPass(); + +//===----------------------------------------------------------------------===// +// Passes for assigning kernels to streams in CUDA graph capture function. +//===----------------------------------------------------------------------===// + +std::unique_ptr> +createStreamAssignmentPass(); + +//===-----------------------------------------------------------------------===/ + +#define GEN_PASS_REGISTRATION +#include "xla/mlir/backends/gpu/transforms/passes.h.inc" + +} // namespace gpu +} // namespace xla + +#endif // XLA_MLIR_BACKENDS_GPU_TRANSFORMS_PASSES_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/backends/gpu/transforms/passes.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/backends/gpu/transforms/passes.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..7eabe8c5e637ae8464bd59ce5502662a7ecfe0e8 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/backends/gpu/transforms/passes.h.inc @@ -0,0 +1,1134 @@ +/* Autogenerated by mlir-tblgen; don't manually edit */ + +#ifdef GEN_PASS_DECL +// Generate declarations for all passes. +#define GEN_PASS_DECL_ADDCONCURRENTREGIONSPASS +#define GEN_PASS_DECL_ADDHLOTRACEANNOTATIONSPASS +#define GEN_PASS_DECL_CONVERTGPUTOGPURUNTIMEPASS +#define GEN_PASS_DECL_CONVERTLMHLOGPUTOGPURUNTIMEPASS +#define GEN_PASS_DECL_CONVERTLMHLOTOGPULAUNCHPASS +#define GEN_PASS_DECL_CONVERTLMHLOTOGPURUNTIMEPASS +#define GEN_PASS_DECL_CONVERTMEMREFGETGLOBALTOARGPASS +#define GEN_PASS_DECL_OUTLINEGPUGRAPHSPASS +#define GEN_PASS_DECL_STREAMASSIGNMENTPASS +#undef GEN_PASS_DECL +#endif // GEN_PASS_DECL + +//===----------------------------------------------------------------------===// +// AddConcurrentRegionsPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_ADDCONCURRENTREGIONSPASS +#undef GEN_PASS_DECL_ADDCONCURRENTREGIONSPASS +#endif // GEN_PASS_DECL_ADDCONCURRENTREGIONSPASS +#ifdef GEN_PASS_DEF_ADDCONCURRENTREGIONSPASS +namespace impl { + +template +class AddConcurrentRegionsPassBase : public ::mlir::OperationPass { +public: + using Base = AddConcurrentRegionsPassBase; + + AddConcurrentRegionsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + AddConcurrentRegionsPassBase(const AddConcurrentRegionsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-gpu-add-concurrent-regions"); + } + ::llvm::StringRef getArgument() const override { return "xla-gpu-add-concurrent-regions"; } + + ::llvm::StringRef getDescription() const override { return "Identify and mark concurrent regions in CUDA graph capture functions"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("AddConcurrentRegionsPass"); + } + ::llvm::StringRef getName() const override { return "AddConcurrentRegionsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(AddConcurrentRegionsPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_ADDCONCURRENTREGIONSPASS +#endif // GEN_PASS_DEF_ADDCONCURRENTREGIONSPASS + +//===----------------------------------------------------------------------===// +// AddHloTraceAnnotationsPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_ADDHLOTRACEANNOTATIONSPASS +#undef GEN_PASS_DECL_ADDHLOTRACEANNOTATIONSPASS +#endif // GEN_PASS_DECL_ADDHLOTRACEANNOTATIONSPASS +#ifdef GEN_PASS_DEF_ADDHLOTRACEANNOTATIONSPASS +namespace impl { + +template +class AddHloTraceAnnotationsPassBase : public ::mlir::OperationPass { +public: + using Base = AddHloTraceAnnotationsPassBase; + + AddHloTraceAnnotationsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + AddHloTraceAnnotationsPassBase(const AddHloTraceAnnotationsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-add-hlo-trace-annotations"); + } + ::llvm::StringRef getArgument() const override { return "xla-add-hlo-trace-annotations"; } + + ::llvm::StringRef getDescription() const override { return "Adds HLO trace annotations to the supported operations"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("AddHloTraceAnnotationsPass"); + } + ::llvm::StringRef getName() const override { return "AddHloTraceAnnotationsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(AddHloTraceAnnotationsPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_ADDHLOTRACEANNOTATIONSPASS +#endif // GEN_PASS_DEF_ADDHLOTRACEANNOTATIONSPASS + +//===----------------------------------------------------------------------===// +// ConvertGpuToGpuRuntimePass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTGPUTOGPURUNTIMEPASS +#undef GEN_PASS_DECL_CONVERTGPUTOGPURUNTIMEPASS +#endif // GEN_PASS_DECL_CONVERTGPUTOGPURUNTIMEPASS +#ifdef GEN_PASS_DEF_CONVERTGPUTOGPURUNTIMEPASS +namespace impl { + +template +class ConvertGpuToGpuRuntimePassBase : public ::mlir::OperationPass { +public: + using Base = ConvertGpuToGpuRuntimePassBase; + + ConvertGpuToGpuRuntimePassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertGpuToGpuRuntimePassBase(const ConvertGpuToGpuRuntimePassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-gpu-to-gpu-runtime"); + } + ::llvm::StringRef getArgument() const override { return "xla-gpu-to-gpu-runtime"; } + + ::llvm::StringRef getDescription() const override { return "Converts gpu operations to XLA Gpu runtime custom calls"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertGpuToGpuRuntimePass"); + } + ::llvm::StringRef getName() const override { return "ConvertGpuToGpuRuntimePass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertGpuToGpuRuntimePassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_CONVERTGPUTOGPURUNTIMEPASS +#endif // GEN_PASS_DEF_CONVERTGPUTOGPURUNTIMEPASS + +//===----------------------------------------------------------------------===// +// ConvertLmhloGpuToGpuRuntimePass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTLMHLOGPUTOGPURUNTIMEPASS +#undef GEN_PASS_DECL_CONVERTLMHLOGPUTOGPURUNTIMEPASS +#endif // GEN_PASS_DECL_CONVERTLMHLOGPUTOGPURUNTIMEPASS +#ifdef GEN_PASS_DEF_CONVERTLMHLOGPUTOGPURUNTIMEPASS +namespace impl { + +template +class ConvertLmhloGpuToGpuRuntimePassBase : public ::mlir::OperationPass { +public: + using Base = ConvertLmhloGpuToGpuRuntimePassBase; + + ConvertLmhloGpuToGpuRuntimePassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertLmhloGpuToGpuRuntimePassBase(const ConvertLmhloGpuToGpuRuntimePassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-lmhlo-gpu-to-gpu-runtime"); + } + ::llvm::StringRef getArgument() const override { return "xla-lmhlo-gpu-to-gpu-runtime"; } + + ::llvm::StringRef getDescription() const override { return "Converts lmhlo_gpu operations to XLA Gpu runtime custom calls"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertLmhloGpuToGpuRuntimePass"); + } + ::llvm::StringRef getName() const override { return "ConvertLmhloGpuToGpuRuntimePass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertLmhloGpuToGpuRuntimePassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_CONVERTLMHLOGPUTOGPURUNTIMEPASS +#endif // GEN_PASS_DEF_CONVERTLMHLOGPUTOGPURUNTIMEPASS + +//===----------------------------------------------------------------------===// +// ConvertLmhloToGpuLaunchPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTLMHLOTOGPULAUNCHPASS +#undef GEN_PASS_DECL_CONVERTLMHLOTOGPULAUNCHPASS +#endif // GEN_PASS_DECL_CONVERTLMHLOTOGPULAUNCHPASS +#ifdef GEN_PASS_DEF_CONVERTLMHLOTOGPULAUNCHPASS +namespace impl { + +template +class ConvertLmhloToGpuLaunchPassBase : public ::mlir::OperationPass { +public: + using Base = ConvertLmhloToGpuLaunchPassBase; + + ConvertLmhloToGpuLaunchPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertLmhloToGpuLaunchPassBase(const ConvertLmhloToGpuLaunchPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-lmhlo-to-gpu-launch"); + } + ::llvm::StringRef getArgument() const override { return "xla-lmhlo-to-gpu-launch"; } + + ::llvm::StringRef getDescription() const override { return "Converts lmhlo fusions to Gpu dialect kernel launch"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertLmhloToGpuLaunchPass"); + } + ::llvm::StringRef getName() const override { return "ConvertLmhloToGpuLaunchPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertLmhloToGpuLaunchPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_CONVERTLMHLOTOGPULAUNCHPASS +#endif // GEN_PASS_DEF_CONVERTLMHLOTOGPULAUNCHPASS + +//===----------------------------------------------------------------------===// +// ConvertLmhloToGpuRuntimePass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTLMHLOTOGPURUNTIMEPASS +#undef GEN_PASS_DECL_CONVERTLMHLOTOGPURUNTIMEPASS +#endif // GEN_PASS_DECL_CONVERTLMHLOTOGPURUNTIMEPASS +#ifdef GEN_PASS_DEF_CONVERTLMHLOTOGPURUNTIMEPASS +namespace impl { + +template +class ConvertLmhloToGpuRuntimePassBase : public ::mlir::OperationPass { +public: + using Base = ConvertLmhloToGpuRuntimePassBase; + + ConvertLmhloToGpuRuntimePassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertLmhloToGpuRuntimePassBase(const ConvertLmhloToGpuRuntimePassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-lmhlo-to-gpu-runtime"); + } + ::llvm::StringRef getArgument() const override { return "xla-lmhlo-to-gpu-runtime"; } + + ::llvm::StringRef getDescription() const override { return "Converts lmhlo operations to XLA Gpu runtime custom calls"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertLmhloToGpuRuntimePass"); + } + ::llvm::StringRef getName() const override { return "ConvertLmhloToGpuRuntimePass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertLmhloToGpuRuntimePassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_CONVERTLMHLOTOGPURUNTIMEPASS +#endif // GEN_PASS_DEF_CONVERTLMHLOTOGPURUNTIMEPASS + +//===----------------------------------------------------------------------===// +// ConvertMemrefGetGlobalToArgPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTMEMREFGETGLOBALTOARGPASS +struct ConvertMemrefGetGlobalToArgPassOptions { + int64_t min_num_elements_ = 0; +}; +#undef GEN_PASS_DECL_CONVERTMEMREFGETGLOBALTOARGPASS +#endif // GEN_PASS_DECL_CONVERTMEMREFGETGLOBALTOARGPASS +#ifdef GEN_PASS_DEF_CONVERTMEMREFGETGLOBALTOARGPASS +namespace impl { + +template +class ConvertMemrefGetGlobalToArgPassBase : public ::mlir::OperationPass { +public: + using Base = ConvertMemrefGetGlobalToArgPassBase; + + ConvertMemrefGetGlobalToArgPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertMemrefGetGlobalToArgPassBase(const ConvertMemrefGetGlobalToArgPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-memref-get-global-to-arg"); + } + ::llvm::StringRef getArgument() const override { return "xla-memref-get-global-to-arg"; } + + ::llvm::StringRef getDescription() const override { return "Converts memref.get_global corresponding to lmhlo constants"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertMemrefGetGlobalToArgPass"); + } + ::llvm::StringRef getName() const override { return "ConvertMemrefGetGlobalToArgPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertMemrefGetGlobalToArgPassBase) + + ConvertMemrefGetGlobalToArgPassBase(const ConvertMemrefGetGlobalToArgPassOptions &options) : ConvertMemrefGetGlobalToArgPassBase() { + min_num_elements_ = options.min_num_elements_; + } +protected: + ::mlir::Pass::Option min_num_elements_{*this, "min-num-elements", ::llvm::cl::desc("Do not convert `memref.get_global` operation if the number of elements is smaller than the given value."), ::llvm::cl::init(0)}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_CONVERTMEMREFGETGLOBALTOARGPASS +#endif // GEN_PASS_DEF_CONVERTMEMREFGETGLOBALTOARGPASS + +//===----------------------------------------------------------------------===// +// OutlineGpuGraphsPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_OUTLINEGPUGRAPHSPASS +struct OutlineGpuGraphsPassOptions { + int64_t min_graph_size_ = 2; +}; +#undef GEN_PASS_DECL_OUTLINEGPUGRAPHSPASS +#endif // GEN_PASS_DECL_OUTLINEGPUGRAPHSPASS +#ifdef GEN_PASS_DEF_OUTLINEGPUGRAPHSPASS +namespace impl { + +template +class OutlineGpuGraphsPassBase : public ::mlir::OperationPass { +public: + using Base = OutlineGpuGraphsPassBase; + + OutlineGpuGraphsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + OutlineGpuGraphsPassBase(const OutlineGpuGraphsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-gpu-outline-gpu-graphs"); + } + ::llvm::StringRef getArgument() const override { return "xla-gpu-outline-gpu-graphs"; } + + ::llvm::StringRef getDescription() const override { return "Outline sequences of Xla Gpu operations into CUDA Graphs"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("OutlineGpuGraphsPass"); + } + ::llvm::StringRef getName() const override { return "OutlineGpuGraphsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(OutlineGpuGraphsPassBase) + + OutlineGpuGraphsPassBase(const OutlineGpuGraphsPassOptions &options) : OutlineGpuGraphsPassBase() { + min_graph_size_ = options.min_graph_size_; + } +protected: + ::mlir::Pass::Option min_graph_size_{*this, "min_graph_size", ::llvm::cl::desc("The minimum size of the outlined CUDA graph function."), ::llvm::cl::init(2)}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_OUTLINEGPUGRAPHSPASS +#endif // GEN_PASS_DEF_OUTLINEGPUGRAPHSPASS + +//===----------------------------------------------------------------------===// +// StreamAssignmentPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_STREAMASSIGNMENTPASS +#undef GEN_PASS_DECL_STREAMASSIGNMENTPASS +#endif // GEN_PASS_DECL_STREAMASSIGNMENTPASS +#ifdef GEN_PASS_DEF_STREAMASSIGNMENTPASS +namespace impl { + +template +class StreamAssignmentPassBase : public ::mlir::OperationPass { +public: + using Base = StreamAssignmentPassBase; + + StreamAssignmentPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + StreamAssignmentPassBase(const StreamAssignmentPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-gpu-stream-assignment"); + } + ::llvm::StringRef getArgument() const override { return "xla-gpu-stream-assignment"; } + + ::llvm::StringRef getDescription() const override { return "Identify and mark concurrent regions in CUDA graph capture functions"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("StreamAssignmentPass"); + } + ::llvm::StringRef getName() const override { return "StreamAssignmentPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(StreamAssignmentPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_STREAMASSIGNMENTPASS +#endif // GEN_PASS_DEF_STREAMASSIGNMENTPASS +#ifdef GEN_PASS_REGISTRATION + +//===----------------------------------------------------------------------===// +// AddConcurrentRegionsPass Registration +//===----------------------------------------------------------------------===// + +inline void registerAddConcurrentRegionsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createAddConcurrentRegionsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerAddConcurrentRegionsPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createAddConcurrentRegionsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// AddHloTraceAnnotationsPass Registration +//===----------------------------------------------------------------------===// + +inline void registerAddHloTraceAnnotationsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createAddHloTraceAnnotationsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerAddHloTraceAnnotationsPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createAddHloTraceAnnotationsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertGpuToGpuRuntimePass Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertGpuToGpuRuntimePass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createConvertGpuToGpuRuntimePass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertGpuToGpuRuntimePassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createConvertGpuToGpuRuntimePass(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertLmhloGpuToGpuRuntimePass Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertLmhloGpuToGpuRuntimePass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createConvertLmhloGpuToGpuRuntimePass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertLmhloGpuToGpuRuntimePassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createConvertLmhloGpuToGpuRuntimePass(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertLmhloToGpuLaunchPass Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertLmhloToGpuLaunchPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createConvertLmhloToGpuLaunchPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertLmhloToGpuLaunchPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createConvertLmhloToGpuLaunchPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertLmhloToGpuRuntimePass Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertLmhloToGpuRuntimePass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createConvertLmhloToGpuRuntimePass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertLmhloToGpuRuntimePassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createConvertLmhloToGpuRuntimePass(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertMemrefGetGlobalToArgPass Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertMemrefGetGlobalToArgPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createConvertMemrefGetGlobalToArgPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertMemrefGetGlobalToArgPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createConvertMemrefGetGlobalToArgPass(); + }); +} + +//===----------------------------------------------------------------------===// +// OutlineGpuGraphsPass Registration +//===----------------------------------------------------------------------===// + +inline void registerOutlineGpuGraphsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createOutlineGpuGraphsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerOutlineGpuGraphsPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createOutlineGpuGraphsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// StreamAssignmentPass Registration +//===----------------------------------------------------------------------===// + +inline void registerStreamAssignmentPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createStreamAssignmentPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerStreamAssignmentPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createStreamAssignmentPass(); + }); +} + +//===----------------------------------------------------------------------===// +// GpuTransforms Registration +//===----------------------------------------------------------------------===// + +inline void registerGpuTransformsPasses() { + registerAddConcurrentRegionsPass(); + registerAddHloTraceAnnotationsPass(); + registerConvertGpuToGpuRuntimePass(); + registerConvertLmhloGpuToGpuRuntimePass(); + registerConvertLmhloToGpuLaunchPass(); + registerConvertLmhloToGpuRuntimePass(); + registerConvertMemrefGetGlobalToArgPass(); + registerOutlineGpuGraphsPass(); + registerStreamAssignmentPass(); +} +#undef GEN_PASS_REGISTRATION +#endif // GEN_PASS_REGISTRATION +// Deprecated. Please use the new per-pass macros. +#ifdef GEN_PASS_CLASSES + +template +class AddConcurrentRegionsPassBase : public ::mlir::OperationPass { +public: + using Base = AddConcurrentRegionsPassBase; + + AddConcurrentRegionsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + AddConcurrentRegionsPassBase(const AddConcurrentRegionsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-gpu-add-concurrent-regions"); + } + ::llvm::StringRef getArgument() const override { return "xla-gpu-add-concurrent-regions"; } + + ::llvm::StringRef getDescription() const override { return "Identify and mark concurrent regions in CUDA graph capture functions"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("AddConcurrentRegionsPass"); + } + ::llvm::StringRef getName() const override { return "AddConcurrentRegionsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(AddConcurrentRegionsPassBase) + +protected: +}; + +template +class AddHloTraceAnnotationsPassBase : public ::mlir::OperationPass { +public: + using Base = AddHloTraceAnnotationsPassBase; + + AddHloTraceAnnotationsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + AddHloTraceAnnotationsPassBase(const AddHloTraceAnnotationsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-add-hlo-trace-annotations"); + } + ::llvm::StringRef getArgument() const override { return "xla-add-hlo-trace-annotations"; } + + ::llvm::StringRef getDescription() const override { return "Adds HLO trace annotations to the supported operations"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("AddHloTraceAnnotationsPass"); + } + ::llvm::StringRef getName() const override { return "AddHloTraceAnnotationsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(AddHloTraceAnnotationsPassBase) + +protected: +}; + +template +class ConvertGpuToGpuRuntimePassBase : public ::mlir::OperationPass { +public: + using Base = ConvertGpuToGpuRuntimePassBase; + + ConvertGpuToGpuRuntimePassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertGpuToGpuRuntimePassBase(const ConvertGpuToGpuRuntimePassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-gpu-to-gpu-runtime"); + } + ::llvm::StringRef getArgument() const override { return "xla-gpu-to-gpu-runtime"; } + + ::llvm::StringRef getDescription() const override { return "Converts gpu operations to XLA Gpu runtime custom calls"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertGpuToGpuRuntimePass"); + } + ::llvm::StringRef getName() const override { return "ConvertGpuToGpuRuntimePass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertGpuToGpuRuntimePassBase) + +protected: +}; + +template +class ConvertLmhloGpuToGpuRuntimePassBase : public ::mlir::OperationPass { +public: + using Base = ConvertLmhloGpuToGpuRuntimePassBase; + + ConvertLmhloGpuToGpuRuntimePassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertLmhloGpuToGpuRuntimePassBase(const ConvertLmhloGpuToGpuRuntimePassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-lmhlo-gpu-to-gpu-runtime"); + } + ::llvm::StringRef getArgument() const override { return "xla-lmhlo-gpu-to-gpu-runtime"; } + + ::llvm::StringRef getDescription() const override { return "Converts lmhlo_gpu operations to XLA Gpu runtime custom calls"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertLmhloGpuToGpuRuntimePass"); + } + ::llvm::StringRef getName() const override { return "ConvertLmhloGpuToGpuRuntimePass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertLmhloGpuToGpuRuntimePassBase) + +protected: +}; + +template +class ConvertLmhloToGpuLaunchPassBase : public ::mlir::OperationPass { +public: + using Base = ConvertLmhloToGpuLaunchPassBase; + + ConvertLmhloToGpuLaunchPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertLmhloToGpuLaunchPassBase(const ConvertLmhloToGpuLaunchPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-lmhlo-to-gpu-launch"); + } + ::llvm::StringRef getArgument() const override { return "xla-lmhlo-to-gpu-launch"; } + + ::llvm::StringRef getDescription() const override { return "Converts lmhlo fusions to Gpu dialect kernel launch"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertLmhloToGpuLaunchPass"); + } + ::llvm::StringRef getName() const override { return "ConvertLmhloToGpuLaunchPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertLmhloToGpuLaunchPassBase) + +protected: +}; + +template +class ConvertLmhloToGpuRuntimePassBase : public ::mlir::OperationPass { +public: + using Base = ConvertLmhloToGpuRuntimePassBase; + + ConvertLmhloToGpuRuntimePassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertLmhloToGpuRuntimePassBase(const ConvertLmhloToGpuRuntimePassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-lmhlo-to-gpu-runtime"); + } + ::llvm::StringRef getArgument() const override { return "xla-lmhlo-to-gpu-runtime"; } + + ::llvm::StringRef getDescription() const override { return "Converts lmhlo operations to XLA Gpu runtime custom calls"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertLmhloToGpuRuntimePass"); + } + ::llvm::StringRef getName() const override { return "ConvertLmhloToGpuRuntimePass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertLmhloToGpuRuntimePassBase) + +protected: +}; + +template +class ConvertMemrefGetGlobalToArgPassBase : public ::mlir::OperationPass { +public: + using Base = ConvertMemrefGetGlobalToArgPassBase; + + ConvertMemrefGetGlobalToArgPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertMemrefGetGlobalToArgPassBase(const ConvertMemrefGetGlobalToArgPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-memref-get-global-to-arg"); + } + ::llvm::StringRef getArgument() const override { return "xla-memref-get-global-to-arg"; } + + ::llvm::StringRef getDescription() const override { return "Converts memref.get_global corresponding to lmhlo constants"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertMemrefGetGlobalToArgPass"); + } + ::llvm::StringRef getName() const override { return "ConvertMemrefGetGlobalToArgPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertMemrefGetGlobalToArgPassBase) + +protected: + ::mlir::Pass::Option min_num_elements_{*this, "min-num-elements", ::llvm::cl::desc("Do not convert `memref.get_global` operation if the number of elements is smaller than the given value."), ::llvm::cl::init(0)}; +}; + +template +class OutlineGpuGraphsPassBase : public ::mlir::OperationPass { +public: + using Base = OutlineGpuGraphsPassBase; + + OutlineGpuGraphsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + OutlineGpuGraphsPassBase(const OutlineGpuGraphsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-gpu-outline-gpu-graphs"); + } + ::llvm::StringRef getArgument() const override { return "xla-gpu-outline-gpu-graphs"; } + + ::llvm::StringRef getDescription() const override { return "Outline sequences of Xla Gpu operations into CUDA Graphs"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("OutlineGpuGraphsPass"); + } + ::llvm::StringRef getName() const override { return "OutlineGpuGraphsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(OutlineGpuGraphsPassBase) + +protected: + ::mlir::Pass::Option min_graph_size_{*this, "min_graph_size", ::llvm::cl::desc("The minimum size of the outlined CUDA graph function."), ::llvm::cl::init(2)}; +}; + +template +class StreamAssignmentPassBase : public ::mlir::OperationPass { +public: + using Base = StreamAssignmentPassBase; + + StreamAssignmentPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + StreamAssignmentPassBase(const StreamAssignmentPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-gpu-stream-assignment"); + } + ::llvm::StringRef getArgument() const override { return "xla-gpu-stream-assignment"; } + + ::llvm::StringRef getDescription() const override { return "Identify and mark concurrent regions in CUDA graph capture functions"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("StreamAssignmentPass"); + } + ::llvm::StringRef getName() const override { return "StreamAssignmentPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(StreamAssignmentPassBase) + +protected: +}; +#undef GEN_PASS_CLASSES +#endif // GEN_PASS_CLASSES diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/backends/gpu/transforms/uid_generator.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/backends/gpu/transforms/uid_generator.h new file mode 100644 index 0000000000000000000000000000000000000000..1a89d184ac04a68f33591459af6719e0ae1f0632 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/backends/gpu/transforms/uid_generator.h @@ -0,0 +1,42 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_MLIR_BACKENDS_GPU_TRANSFORMS_UID_GENERATOR_H_ +#define XLA_MLIR_BACKENDS_GPU_TRANSFORMS_UID_GENERATOR_H_ + +#include + +namespace xla { +namespace gpu { + +// Every stateful operation in the module gets assigned a unique id, that is +// passed to the custom call handler. This id is used for caching resources +// between the different invocations of the same custom call (e.g. cache +// convolution descriptors). +// +// TODO(b/255600288): Improve stateful custom calls in Xla runtime. +class UidGenerator { + public: + UidGenerator() : uid_(0) {} + int64_t uid() { return uid_.fetch_add(1); } + + private: + std::atomic uid_; +}; + +} // namespace gpu +} // namespace xla + +#endif // XLA_MLIR_BACKENDS_GPU_TRANSFORMS_UID_GENERATOR_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/backends/gpu2/transforms/passes.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/backends/gpu2/transforms/passes.h new file mode 100644 index 0000000000000000000000000000000000000000..fc44bc29e253f687a3bf40eee8d7cf362a78e749 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/backends/gpu2/transforms/passes.h @@ -0,0 +1,78 @@ +/* Copyright 2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_MLIR_BACKENDS_GPU2_TRANSFORMS_PASSES_H_ +#define XLA_MLIR_BACKENDS_GPU2_TRANSFORMS_PASSES_H_ + +namespace xla::gpu { + +class ThunkSequence; // forward declare + +struct Gpu2PipelineOpts {}; + +} // namespace xla::gpu + +//===----------------------------------------------------------------------===// +// TODO(ezhulenev): We currently do not build with XLA:GPU experimental runtime +// in open source because we do not have bazel dependency from XLA to IREE. +#if XLA_DISABLE_GPU2_COMPILER +//===----------------------------------------------------------------------===// + +namespace mlir { +class OpPassManager; +} // namespace mlir + +namespace xla::gpu { +inline void populateGpu2RuntimePasses(mlir::OpPassManager&, ThunkSequence*, + const Gpu2PipelineOpts& opts) {} +inline void registerGpu2Pases() {} +} // namespace xla::gpu + +//===----------------------------------------------------------------------===// +#else // !XLA_DISABLE_GPU2_COMPILER +//===----------------------------------------------------------------------===// + +#include +#include + +#include "mlir/IR/BuiltinOps.h" // from @llvm-project +#include "mlir/Pass/Pass.h" // from @llvm-project + +namespace xla::gpu { + +// Populate passes that lower MLIR modules from a combination of LMHLO and +// LMHLO_GPU dialects to the XLA:GPU runtime (aka IREE input dialects + XLA:GPU +// custom calls implementing library integration). +void populateGpu2RuntimePasses(mlir::OpPassManager& pm, + ThunkSequence* thunk_sequence, + const Gpu2PipelineOpts& opts); + +//===----------------------------------------------------------------------===// +// Conversion from LMHLO dialects to XLA:GPU runtime +//===----------------------------------------------------------------------===// + +std::unique_ptr > +createConvertToGpu2RuntimePass(ThunkSequence* thunk_sequence = nullptr); + +//===----------------------------------------------------------------------===// +// XLA:GPU passes registration +//===----------------------------------------------------------------------===// + +void registerGpu2Pases(); + +} // namespace xla::gpu + +#endif // !XLA_DISABLE_GPU2_RUNTIME +#endif // XLA_MLIR_BACKENDS_GPU2_TRANSFORMS_PASSES_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/framework/ir/xla_framework.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/framework/ir/xla_framework.h new file mode 100644 index 0000000000000000000000000000000000000000..690fb63e84062c0ea336f177f6aeda4eb774e208 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/framework/ir/xla_framework.h @@ -0,0 +1,36 @@ +/* Copyright 2021 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +// This file defines the operations and types used in the XLAFramework dialect. +// +#ifndef XLA_MLIR_FRAMEWORK_IR_XLA_FRAMEWORK_H_ +#define XLA_MLIR_FRAMEWORK_IR_XLA_FRAMEWORK_H_ + +#include "mlir/IR/Attributes.h" // from @llvm-project +#include "mlir/IR/BuiltinTypes.h" // from @llvm-project +#include "mlir/IR/Dialect.h" // from @llvm-project +#include "mlir/IR/MLIRContext.h" // from @llvm-project +#include "mlir/IR/OpDefinition.h" // from @llvm-project +#include "mlir/IR/OpImplementation.h" // from @llvm-project + +#define GET_TYPEDEF_CLASSES +#include "xla/mlir/framework/ir/xla_framework_types.h.inc" +#define GET_OP_CLASSES +#include "xla/mlir/framework/ir/xla_framework.h.inc" +#include "xla/mlir/framework/ir/xla_framework_dialect.h.inc" + +#undef GET_OP_CLASSES + +#endif // XLA_MLIR_FRAMEWORK_IR_XLA_FRAMEWORK_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/framework/ir/xla_framework.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/framework/ir/xla_framework.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..b40f0ca5663e83692dd48c258dc0884f517e37b9 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/framework/ir/xla_framework.h.inc @@ -0,0 +1,234 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: xla_framework_ops.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#if defined(GET_OP_CLASSES) || defined(GET_OP_FWD_DEFINES) +#undef GET_OP_FWD_DEFINES +namespace mlir { +namespace xla_framework { +class MemToXLABufferOp; +} // namespace xla_framework +} // namespace mlir +namespace mlir { +namespace xla_framework { +class XLABufferToMemOp; +} // namespace xla_framework +} // namespace mlir +#endif + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace xla_framework { + +//===----------------------------------------------------------------------===// +// ::mlir::xla_framework::MemToXLABufferOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MemToXLABufferOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MemToXLABufferOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MemToXLABufferOpGenericAdaptorBase(MemToXLABufferOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MemToXLABufferOpGenericAdaptor : public detail::MemToXLABufferOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MemToXLABufferOpGenericAdaptorBase; +public: + MemToXLABufferOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MemToXLABufferOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MemToXLABufferOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MemToXLABufferOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getMemref() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MemToXLABufferOpAdaptor : public MemToXLABufferOpGenericAdaptor<::mlir::ValueRange> { +public: + using MemToXLABufferOpGenericAdaptor::MemToXLABufferOpGenericAdaptor; + MemToXLABufferOpAdaptor(MemToXLABufferOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MemToXLABufferOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = MemToXLABufferOpAdaptor; + template + using GenericAdaptor = MemToXLABufferOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("xla_framework.mem_to_buffer"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::BaseMemRefType> getMemref(); + ::mlir::OpOperand &getMemrefMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::xla_framework::BufferType> getBuffer(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type buffer, ::mlir::Value memref); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value memref); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace xla_framework +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::xla_framework::MemToXLABufferOp) + +namespace mlir { +namespace xla_framework { + +//===----------------------------------------------------------------------===// +// ::mlir::xla_framework::XLABufferToMemOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XLABufferToMemOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XLABufferToMemOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XLABufferToMemOpGenericAdaptorBase(XLABufferToMemOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class XLABufferToMemOpGenericAdaptor : public detail::XLABufferToMemOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XLABufferToMemOpGenericAdaptorBase; +public: + XLABufferToMemOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XLABufferToMemOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XLABufferToMemOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XLABufferToMemOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getBuffer() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XLABufferToMemOpAdaptor : public XLABufferToMemOpGenericAdaptor<::mlir::ValueRange> { +public: + using XLABufferToMemOpGenericAdaptor::XLABufferToMemOpGenericAdaptor; + XLABufferToMemOpAdaptor(XLABufferToMemOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XLABufferToMemOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = XLABufferToMemOpAdaptor; + template + using GenericAdaptor = XLABufferToMemOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("xla_framework.buffer_to_mem"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::xla_framework::BufferType> getBuffer(); + ::mlir::OpOperand &getBufferMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::BaseMemRefType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, MemRefType memref_type, Value buffer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value buffer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value buffer); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: + MemRefType getType() { return getResult().getType().cast(); } +}; +} // namespace xla_framework +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::xla_framework::XLABufferToMemOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/framework/ir/xla_framework_dialect.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/framework/ir/xla_framework_dialect.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..c11ca16d979585c076bc5ef3311d0963f5839b6a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/framework/ir/xla_framework_dialect.h.inc @@ -0,0 +1,37 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: xla_framework_ops.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace xla_framework { + +class XLAFrameworkDialect : public ::mlir::Dialect { + explicit XLAFrameworkDialect(::mlir::MLIRContext *context); + + void initialize(); + friend class ::mlir::MLIRContext; +public: + ~XLAFrameworkDialect() override; + static constexpr ::llvm::StringLiteral getDialectNamespace() { + return ::llvm::StringLiteral("xla_framework"); + } + + /// Parse a type registered to this dialect. + ::mlir::Type parseType(::mlir::DialectAsmParser &parser) const override; + + /// Print a type registered to this dialect. + void printType(::mlir::Type type, + ::mlir::DialectAsmPrinter &os) const override; + + // The attribute string tied to entry point functions honoring XLA's calling + // convention. + static constexpr StringRef kXLAEntryAttrName = "xla_entry"; + }; +} // namespace xla_framework +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::xla_framework::XLAFrameworkDialect) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/framework/ir/xla_framework_types.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/framework/ir/xla_framework_types.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..1b2b973e9116003fb3fb3526835518b5c06920db --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/framework/ir/xla_framework_types.h.inc @@ -0,0 +1,33 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* TypeDef Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_TYPEDEF_CLASSES +#undef GET_TYPEDEF_CLASSES + + +namespace mlir { +class AsmParser; +class AsmPrinter; +} // namespace mlir +namespace mlir { +namespace xla_framework { +class BufferType; +class BufferType : public ::mlir::Type::TypeBase { +public: + using Base::Base; + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"buffer"}; + } + +}; +} // namespace xla_framework +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::xla_framework::BufferType) + +#endif // GET_TYPEDEF_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/framework/transforms/passes.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/framework/transforms/passes.h new file mode 100644 index 0000000000000000000000000000000000000000..cb11e9e96deb938d9d7b3a057b0e073141aa3daa --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/framework/transforms/passes.h @@ -0,0 +1,49 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_MLIR_FRAMEWORK_TRANSFORMS_PASSES_H_ +#define XLA_MLIR_FRAMEWORK_TRANSFORMS_PASSES_H_ + +#include + +#include "mlir/IR/BuiltinOps.h" // from @llvm-project +#include "mlir/Pass/Pass.h" // from @llvm-project +#include "mlir/Pass/PassRegistry.h" // from @llvm-project + +namespace mlir { + +namespace func { +class FuncOp; +} // namespace func +template +class OperationPass; + +namespace xla_framework { + +// Wrap function with XLA:CPU's C interface. +std::unique_ptr> CreateOutlineWithXLAFrameworkPass(); + +// Convert XLAFramework operations to LLVM operations. +std::unique_ptr> CreateLegalizeXLAFrameworkToLLVMPass(); + +#define GEN_PASS_REGISTRATION +#define GEN_PASS_DECL_LEGALIZEXLAFRAMEWORKTOLLVM +#define GEN_PASS_DECL_OUTLINEWITHXLAFRAMEWORK +#include "xla/mlir/framework/transforms/passes.h.inc" + +} // namespace xla_framework +} // namespace mlir + +#endif // XLA_MLIR_FRAMEWORK_TRANSFORMS_PASSES_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/framework/transforms/passes.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/framework/transforms/passes.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..2112e8133fb5085ba9310785fa97d8a9742e9370 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/framework/transforms/passes.h.inc @@ -0,0 +1,272 @@ +/* Autogenerated by mlir-tblgen; don't manually edit */ + +#ifdef GEN_PASS_DECL +// Generate declarations for all passes. +#define GEN_PASS_DECL_LEGALIZEXLAFRAMEWORKTOLLVM +#define GEN_PASS_DECL_OUTLINEWITHXLAFRAMEWORK +#undef GEN_PASS_DECL +#endif // GEN_PASS_DECL + +//===----------------------------------------------------------------------===// +// LegalizeXLAFrameworkToLLVM +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_LEGALIZEXLAFRAMEWORKTOLLVM +#undef GEN_PASS_DECL_LEGALIZEXLAFRAMEWORKTOLLVM +#endif // GEN_PASS_DECL_LEGALIZEXLAFRAMEWORKTOLLVM +#ifdef GEN_PASS_DEF_LEGALIZEXLAFRAMEWORKTOLLVM +namespace impl { + +template +class LegalizeXLAFrameworkToLLVMBase : public ::mlir::OperationPass { +public: + using Base = LegalizeXLAFrameworkToLLVMBase; + + LegalizeXLAFrameworkToLLVMBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + LegalizeXLAFrameworkToLLVMBase(const LegalizeXLAFrameworkToLLVMBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-legalize-xla-framework-to-llvm"); + } + ::llvm::StringRef getArgument() const override { return "xla-legalize-xla-framework-to-llvm"; } + + ::llvm::StringRef getDescription() const override { return "Legalize XLAFramework to bare pointers and LLVM memref descriptors"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LegalizeXLAFrameworkToLLVM"); + } + ::llvm::StringRef getName() const override { return "LegalizeXLAFrameworkToLLVM"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert<::mlir::LLVM::LLVMDialect>(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LegalizeXLAFrameworkToLLVMBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_LEGALIZEXLAFRAMEWORKTOLLVM +#endif // GEN_PASS_DEF_LEGALIZEXLAFRAMEWORKTOLLVM + +//===----------------------------------------------------------------------===// +// OutlineWithXLAFramework +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_OUTLINEWITHXLAFRAMEWORK +#undef GEN_PASS_DECL_OUTLINEWITHXLAFRAMEWORK +#endif // GEN_PASS_DECL_OUTLINEWITHXLAFRAMEWORK +#ifdef GEN_PASS_DEF_OUTLINEWITHXLAFRAMEWORK +namespace impl { + +template +class OutlineWithXLAFrameworkBase : public ::mlir::OperationPass { +public: + using Base = OutlineWithXLAFrameworkBase; + + OutlineWithXLAFrameworkBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + OutlineWithXLAFrameworkBase(const OutlineWithXLAFrameworkBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("outline-with-xla-framework"); + } + ::llvm::StringRef getArgument() const override { return "outline-with-xla-framework"; } + + ::llvm::StringRef getDescription() const override { return "Create XLAFramework based wrapper function to match XLA:CPU's interface"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("OutlineWithXLAFramework"); + } + ::llvm::StringRef getName() const override { return "OutlineWithXLAFramework"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert<::mlir::xla_framework::XLAFrameworkDialect>(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(OutlineWithXLAFrameworkBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_OUTLINEWITHXLAFRAMEWORK +#endif // GEN_PASS_DEF_OUTLINEWITHXLAFRAMEWORK +#ifdef GEN_PASS_REGISTRATION + +//===----------------------------------------------------------------------===// +// LegalizeXLAFrameworkToLLVM Registration +//===----------------------------------------------------------------------===// + +inline void registerLegalizeXLAFrameworkToLLVM() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::xla_framework::CreateLegalizeXLAFrameworkToLLVMPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerLegalizeXLAFrameworkToLLVMPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::xla_framework::CreateLegalizeXLAFrameworkToLLVMPass(); + }); +} + +//===----------------------------------------------------------------------===// +// OutlineWithXLAFramework Registration +//===----------------------------------------------------------------------===// + +inline void registerOutlineWithXLAFramework() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::xla_framework::CreateOutlineWithXLAFrameworkPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerOutlineWithXLAFrameworkPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::xla_framework::CreateOutlineWithXLAFrameworkPass(); + }); +} + +//===----------------------------------------------------------------------===// +// XlaFramework Registration +//===----------------------------------------------------------------------===// + +inline void registerXlaFrameworkPasses() { + registerLegalizeXLAFrameworkToLLVM(); + registerOutlineWithXLAFramework(); +} +#undef GEN_PASS_REGISTRATION +#endif // GEN_PASS_REGISTRATION +// Deprecated. Please use the new per-pass macros. +#ifdef GEN_PASS_CLASSES + +template +class LegalizeXLAFrameworkToLLVMBase : public ::mlir::OperationPass { +public: + using Base = LegalizeXLAFrameworkToLLVMBase; + + LegalizeXLAFrameworkToLLVMBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + LegalizeXLAFrameworkToLLVMBase(const LegalizeXLAFrameworkToLLVMBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-legalize-xla-framework-to-llvm"); + } + ::llvm::StringRef getArgument() const override { return "xla-legalize-xla-framework-to-llvm"; } + + ::llvm::StringRef getDescription() const override { return "Legalize XLAFramework to bare pointers and LLVM memref descriptors"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LegalizeXLAFrameworkToLLVM"); + } + ::llvm::StringRef getName() const override { return "LegalizeXLAFrameworkToLLVM"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert<::mlir::LLVM::LLVMDialect>(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LegalizeXLAFrameworkToLLVMBase) + +protected: +}; + +template +class OutlineWithXLAFrameworkBase : public ::mlir::OperationPass { +public: + using Base = OutlineWithXLAFrameworkBase; + + OutlineWithXLAFrameworkBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + OutlineWithXLAFrameworkBase(const OutlineWithXLAFrameworkBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("outline-with-xla-framework"); + } + ::llvm::StringRef getArgument() const override { return "outline-with-xla-framework"; } + + ::llvm::StringRef getDescription() const override { return "Create XLAFramework based wrapper function to match XLA:CPU's interface"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("OutlineWithXLAFramework"); + } + ::llvm::StringRef getName() const override { return "OutlineWithXLAFramework"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert<::mlir::xla_framework::XLAFrameworkDialect>(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(OutlineWithXLAFrameworkBase) + +protected: +}; +#undef GEN_PASS_CLASSES +#endif // GEN_PASS_CLASSES diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/math/transforms/passes.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/math/transforms/passes.h new file mode 100644 index 0000000000000000000000000000000000000000..512f3eec1577c696b2dc40be75ee2b28c161111b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/math/transforms/passes.h @@ -0,0 +1,43 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_MLIR_MATH_TRANSFORMS_PASSES_H_ +#define XLA_MLIR_MATH_TRANSFORMS_PASSES_H_ + +#include +#include + +#include "mlir/Dialect/Func/IR/FuncOps.h" // from @llvm-project +#include "mlir/IR/BuiltinOps.h" // from @llvm-project +#include "mlir/Pass/Pass.h" // from @llvm-project + +namespace xla { + +#define GEN_PASS_DECL_MATHAPPROXIMATIONPASS +#define GEN_PASS_DECL_MATHOPTIMIZATIONPASS +#include "xla/mlir/math/transforms/passes.h.inc" + +std::unique_ptr> +CreateMathOptimizationPass(bool enable_avx2 = false); + +std::unique_ptr> +CreateMathApproximationPass(llvm::ArrayRef oplist = {}); + +#define GEN_PASS_REGISTRATION +#include "xla/mlir/math/transforms/passes.h.inc" + +} // namespace xla + +#endif // XLA_MLIR_MATH_TRANSFORMS_PASSES_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/math/transforms/passes.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/math/transforms/passes.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..3b12dc70934fa7795c06b386576ea0ceb7a7c959 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/math/transforms/passes.h.inc @@ -0,0 +1,288 @@ +/* Autogenerated by mlir-tblgen; don't manually edit */ + +#ifdef GEN_PASS_DECL +// Generate declarations for all passes. +#define GEN_PASS_DECL_MATHAPPROXIMATIONPASS +#define GEN_PASS_DECL_MATHOPTIMIZATIONPASS +#undef GEN_PASS_DECL +#endif // GEN_PASS_DECL + +//===----------------------------------------------------------------------===// +// MathApproximationPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_MATHAPPROXIMATIONPASS +struct MathApproximationPassOptions { + ::llvm::ArrayRef oplist; +}; +#undef GEN_PASS_DECL_MATHAPPROXIMATIONPASS +#endif // GEN_PASS_DECL_MATHAPPROXIMATIONPASS +#ifdef GEN_PASS_DEF_MATHAPPROXIMATIONPASS +namespace impl { + +template +class MathApproximationPassBase : public ::mlir::OperationPass { +public: + using Base = MathApproximationPassBase; + + MathApproximationPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + MathApproximationPassBase(const MathApproximationPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-math-approximation"); + } + ::llvm::StringRef getArgument() const override { return "xla-math-approximation"; } + + ::llvm::StringRef getDescription() const override { return "Approximate math operations for accuracy and speed."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("MathApproximationPass"); + } + ::llvm::StringRef getName() const override { return "MathApproximationPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(MathApproximationPassBase) + + MathApproximationPassBase(const MathApproximationPassOptions &options) : MathApproximationPassBase() { + oplist = options.oplist; + } +protected: + ::mlir::Pass::ListOption oplist{*this, "oplist", ::llvm::cl::desc("List of math operations to be approximated. Use 'all' to select all supported math operations.")}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_MATHAPPROXIMATIONPASS +#endif // GEN_PASS_DEF_MATHAPPROXIMATIONPASS + +//===----------------------------------------------------------------------===// +// MathOptimizationPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_MATHOPTIMIZATIONPASS +struct MathOptimizationPassOptions { + bool enable_avx2_ = false; +}; +#undef GEN_PASS_DECL_MATHOPTIMIZATIONPASS +#endif // GEN_PASS_DECL_MATHOPTIMIZATIONPASS +#ifdef GEN_PASS_DEF_MATHOPTIMIZATIONPASS +namespace impl { + +template +class MathOptimizationPassBase : public ::mlir::OperationPass { +public: + using Base = MathOptimizationPassBase; + + MathOptimizationPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + MathOptimizationPassBase(const MathOptimizationPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-math-optimization"); + } + ::llvm::StringRef getArgument() const override { return "xla-math-optimization"; } + + ::llvm::StringRef getDescription() const override { return "Optimize operations from the `math` dialect."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("MathOptimizationPass"); + } + ::llvm::StringRef getName() const override { return "MathOptimizationPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(MathOptimizationPassBase) + + MathOptimizationPassBase(const MathOptimizationPassOptions &options) : MathOptimizationPassBase() { + enable_avx2_ = options.enable_avx2_; + } +protected: + ::mlir::Pass::Option enable_avx2_{*this, "enable-avx2", ::llvm::cl::desc("Enable math approximations that emit AVX2 intrinsics."), ::llvm::cl::init(false)}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_MATHOPTIMIZATIONPASS +#endif // GEN_PASS_DEF_MATHOPTIMIZATIONPASS +#ifdef GEN_PASS_REGISTRATION + +//===----------------------------------------------------------------------===// +// MathApproximationPass Registration +//===----------------------------------------------------------------------===// + +inline void registerMathApproximationPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::xla::CreateMathApproximationPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerMathApproximationPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::xla::CreateMathApproximationPass(); + }); +} + +//===----------------------------------------------------------------------===// +// MathOptimizationPass Registration +//===----------------------------------------------------------------------===// + +inline void registerMathOptimizationPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::xla::CreateMathOptimizationPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerMathOptimizationPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::xla::CreateMathOptimizationPass(); + }); +} + +//===----------------------------------------------------------------------===// +// MathTransforms Registration +//===----------------------------------------------------------------------===// + +inline void registerMathTransformsPasses() { + registerMathApproximationPass(); + registerMathOptimizationPass(); +} +#undef GEN_PASS_REGISTRATION +#endif // GEN_PASS_REGISTRATION +// Deprecated. Please use the new per-pass macros. +#ifdef GEN_PASS_CLASSES + +template +class MathApproximationPassBase : public ::mlir::OperationPass { +public: + using Base = MathApproximationPassBase; + + MathApproximationPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + MathApproximationPassBase(const MathApproximationPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-math-approximation"); + } + ::llvm::StringRef getArgument() const override { return "xla-math-approximation"; } + + ::llvm::StringRef getDescription() const override { return "Approximate math operations for accuracy and speed."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("MathApproximationPass"); + } + ::llvm::StringRef getName() const override { return "MathApproximationPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(MathApproximationPassBase) + +protected: + ::mlir::Pass::ListOption oplist{*this, "oplist", ::llvm::cl::desc("List of math operations to be approximated. Use 'all' to select all supported math operations.")}; +}; + +template +class MathOptimizationPassBase : public ::mlir::OperationPass { +public: + using Base = MathOptimizationPassBase; + + MathOptimizationPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + MathOptimizationPassBase(const MathOptimizationPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-math-optimization"); + } + ::llvm::StringRef getArgument() const override { return "xla-math-optimization"; } + + ::llvm::StringRef getDescription() const override { return "Optimize operations from the `math` dialect."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("MathOptimizationPass"); + } + ::llvm::StringRef getName() const override { return "MathOptimizationPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(MathOptimizationPassBase) + +protected: + ::mlir::Pass::Option enable_avx2_{*this, "enable-avx2", ::llvm::cl::desc("Enable math approximations that emit AVX2 intrinsics."), ::llvm::cl::init(false)}; +}; +#undef GEN_PASS_CLASSES +#endif // GEN_PASS_CLASSES diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/memref/transforms/passes.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/memref/transforms/passes.h new file mode 100644 index 0000000000000000000000000000000000000000..da79f1c16400f309cfd2d195e720fe11a3d89b58 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/memref/transforms/passes.h @@ -0,0 +1,37 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_MLIR_MEMREF_TRANSFORMS_PASSES_H_ +#define XLA_MLIR_MEMREF_TRANSFORMS_PASSES_H_ + +#include + +#include "mlir/Dialect/Func/IR/FuncOps.h" // from @llvm-project +#include "mlir/Pass/Pass.h" // from @llvm-project + +namespace xla { + +#define GEN_PASS_DECL_ALIGNEDALLOCATIONSPASS +#include "xla/mlir/memref/transforms/passes.h.inc" + +std::unique_ptr> +CreateAlignedAllocationsPass(int64_t alignment = 64); + +#define GEN_PASS_REGISTRATION +#include "xla/mlir/memref/transforms/passes.h.inc" + +} // namespace xla + +#endif // XLA_MLIR_MEMREF_TRANSFORMS_PASSES_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/memref/transforms/passes.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/memref/transforms/passes.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..e67b7b63485928a91462d4128a8050625014808b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/memref/transforms/passes.h.inc @@ -0,0 +1,150 @@ +/* Autogenerated by mlir-tblgen; don't manually edit */ + +#ifdef GEN_PASS_DECL +// Generate declarations for all passes. +#define GEN_PASS_DECL_ALIGNEDALLOCATIONSPASS +#undef GEN_PASS_DECL +#endif // GEN_PASS_DECL + +//===----------------------------------------------------------------------===// +// AlignedAllocationsPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_ALIGNEDALLOCATIONSPASS +struct AlignedAllocationsPassOptions { + int64_t alignment_ = 64; +}; +#undef GEN_PASS_DECL_ALIGNEDALLOCATIONSPASS +#endif // GEN_PASS_DECL_ALIGNEDALLOCATIONSPASS +#ifdef GEN_PASS_DEF_ALIGNEDALLOCATIONSPASS +namespace impl { + +template +class AlignedAllocationsPassBase : public ::mlir::OperationPass { +public: + using Base = AlignedAllocationsPassBase; + + AlignedAllocationsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + AlignedAllocationsPassBase(const AlignedAllocationsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-memref-aligned-allocations"); + } + ::llvm::StringRef getArgument() const override { return "xla-memref-aligned-allocations"; } + + ::llvm::StringRef getDescription() const override { return "Add alignment attribute to all `alloc` operations."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("AlignedAllocationsPass"); + } + ::llvm::StringRef getName() const override { return "AlignedAllocationsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(AlignedAllocationsPassBase) + + AlignedAllocationsPassBase(const AlignedAllocationsPassOptions &options) : AlignedAllocationsPassBase() { + alignment_ = options.alignment_; + } +protected: + ::mlir::Pass::Option alignment_{*this, "alignment", ::llvm::cl::desc("Byte alignment for allocated memrefs."), ::llvm::cl::init(64)}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_ALIGNEDALLOCATIONSPASS +#endif // GEN_PASS_DEF_ALIGNEDALLOCATIONSPASS +#ifdef GEN_PASS_REGISTRATION + +//===----------------------------------------------------------------------===// +// AlignedAllocationsPass Registration +//===----------------------------------------------------------------------===// + +inline void registerAlignedAllocationsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::xla::CreateAlignedAllocationsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerAlignedAllocationsPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::xla::CreateAlignedAllocationsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// MemrefTransforms Registration +//===----------------------------------------------------------------------===// + +inline void registerMemrefTransformsPasses() { + registerAlignedAllocationsPass(); +} +#undef GEN_PASS_REGISTRATION +#endif // GEN_PASS_REGISTRATION +// Deprecated. Please use the new per-pass macros. +#ifdef GEN_PASS_CLASSES + +template +class AlignedAllocationsPassBase : public ::mlir::OperationPass { +public: + using Base = AlignedAllocationsPassBase; + + AlignedAllocationsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + AlignedAllocationsPassBase(const AlignedAllocationsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-memref-aligned-allocations"); + } + ::llvm::StringRef getArgument() const override { return "xla-memref-aligned-allocations"; } + + ::llvm::StringRef getDescription() const override { return "Add alignment attribute to all `alloc` operations."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("AlignedAllocationsPass"); + } + ::llvm::StringRef getName() const override { return "AlignedAllocationsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(AlignedAllocationsPassBase) + +protected: + ::mlir::Pass::Option alignment_{*this, "alignment", ::llvm::cl::desc("Byte alignment for allocated memrefs."), ::llvm::cl::init(64)}; +}; +#undef GEN_PASS_CLASSES +#endif // GEN_PASS_CLASSES diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/ir/rt_attr_interfaces.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/ir/rt_attr_interfaces.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..144c1394f1f2a5d87762ef1887c7d2764aa3afbd --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/ir/rt_attr_interfaces.h.inc @@ -0,0 +1,56 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Interface Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace xla { +namespace runtime { +class TraceAnnotationAttrInterface; +namespace detail { +struct TraceAnnotationAttrInterfaceInterfaceTraits { + struct Concept { + /// The methods defined by the interface. + }; + template + class Model : public Concept { + public: + using Interface = xla::runtime::TraceAnnotationAttrInterface; + Model() : Concept{} {} + + }; + template + class FallbackModel : public Concept { + public: + using Interface = xla::runtime::TraceAnnotationAttrInterface; + FallbackModel() : Concept{} {} + + }; + template + class ExternalModel : public FallbackModel { + public: + using ConcreteEntity = ConcreteAttr; + }; +};template +struct TraceAnnotationAttrInterfaceTrait; + +} // namespace detail +class TraceAnnotationAttrInterface : public ::mlir::AttributeInterface { +public: + using ::mlir::AttributeInterface::AttributeInterface; + template + struct Trait : public detail::TraceAnnotationAttrInterfaceTrait {}; +}; +namespace detail { + template + struct TraceAnnotationAttrInterfaceTrait : public ::mlir::AttributeInterface::Trait { + }; +}// namespace detail +} // namespace runtime +} // namespace xla +namespace xla { +namespace runtime { +} // namespace runtime +} // namespace xla diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/ir/rt_attrs.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/ir/rt_attrs.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..17608519265acd7c8bc6d31249e9de3d2960e817 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/ir/rt_attrs.h.inc @@ -0,0 +1,40 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* AttrDef Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_ATTRDEF_CLASSES +#undef GET_ATTRDEF_CLASSES + + +namespace mlir { +class AsmParser; +class AsmPrinter; +} // namespace mlir +namespace xla { +namespace runtime { +class HloTraceAttr; +namespace detail { +struct HloTraceAttrStorage; +} // namespace detail +class HloTraceAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static HloTraceAttr get(::mlir::MLIRContext *context, ::llvm::StringRef hlo_op); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"hlo_trace"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::llvm::StringRef getHloOp() const; +}; +} // namespace runtime +} // namespace xla +MLIR_DECLARE_EXPLICIT_TYPE_ID(::xla::runtime::HloTraceAttr) + +#endif // GET_ATTRDEF_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/ir/rt_dialect.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/ir/rt_dialect.h new file mode 100644 index 0000000000000000000000000000000000000000..5a690aacba7ac868da43902dfc0bf0f52b623c24 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/ir/rt_dialect.h @@ -0,0 +1,43 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_MLIR_RUNTIME_IR_RT_DIALECT_H_ +#define XLA_MLIR_RUNTIME_IR_RT_DIALECT_H_ + +#include "mlir/IR/Dialect.h" // from @llvm-project // IWYU pragma: keep +#include "mlir/IR/OpImplementation.h" // from @llvm-project // IWYU pragma: keep +#include "xla/mlir/runtime/ir/rt_interfaces.h" // IWYU pragma: keep + +// Runtime dialect definition. +#include "xla/mlir/runtime/ir/rt_dialect.h.inc" + +#define GET_TYPEDEF_CLASSES +#include "xla/mlir/runtime/ir/rt_types.h.inc" + +#define GET_ATTRDEF_CLASSES +#include "xla/mlir/runtime/ir/rt_attrs.h.inc" + +namespace xla { +namespace runtime { + +// Attribute name for marking functions exported to runtime. +static constexpr char const* kExportedAttrName = "rt.exported"; + +static constexpr char const* kRequiresBlasAttrName = "rt.requires_blas"; + +} // namespace runtime +} // namespace xla + +#endif // XLA_MLIR_RUNTIME_IR_RT_DIALECT_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/ir/rt_dialect.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/ir/rt_dialect.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..180cc10dcd00b449e5d4fb9f9e6576f88beec098 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/ir/rt_dialect.h.inc @@ -0,0 +1,46 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: rt_ops.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace xla { +namespace runtime { + +class RuntimeDialect : public ::mlir::Dialect { + explicit RuntimeDialect(::mlir::MLIRContext *context); + + void initialize(); + friend class ::mlir::MLIRContext; +public: + ~RuntimeDialect() override; + static constexpr ::llvm::StringLiteral getDialectNamespace() { + return ::llvm::StringLiteral("rt"); + } + + /// Parse an attribute registered to this dialect. + ::mlir::Attribute parseAttribute(::mlir::DialectAsmParser &parser, + ::mlir::Type type) const override; + + /// Print an attribute registered to this dialect. + void printAttribute(::mlir::Attribute attr, + ::mlir::DialectAsmPrinter &os) const override; + + /// Parse a type registered to this dialect. + ::mlir::Type parseType(::mlir::DialectAsmParser &parser) const override; + + /// Print a type registered to this dialect. + void printType(::mlir::Type type, + ::mlir::DialectAsmPrinter &os) const override; + + /// Provides a hook for verifying dialect attributes attached to the given + /// op. + ::mlir::LogicalResult verifyOperationAttribute( + ::mlir::Operation *op, ::mlir::NamedAttribute attribute) override; +}; +} // namespace runtime +} // namespace xla +MLIR_DECLARE_EXPLICIT_TYPE_ID(::xla::runtime::RuntimeDialect) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/ir/rt_interfaces.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/ir/rt_interfaces.h new file mode 100644 index 0000000000000000000000000000000000000000..8b310a6f6bc97f55656bb5ed400b16e31ec6d03c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/ir/rt_interfaces.h @@ -0,0 +1,24 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_MLIR_RUNTIME_IR_RT_INTERFACES_H_ +#define XLA_MLIR_RUNTIME_IR_RT_INTERFACES_H_ + +#include "mlir/IR/Attributes.h" // from @llvm-project // IWYU pragma: keep + +#define GET_ATTR_INTERFACE_CLASSES +#include "xla/mlir/runtime/ir/rt_attr_interfaces.h.inc" + +#endif // XLA_MLIR_RUNTIME_IR_RT_INTERFACES_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/ir/rt_ops.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/ir/rt_ops.h new file mode 100644 index 0000000000000000000000000000000000000000..d15d5c5e15e1020c4c73b7ff814a4965a18248d9 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/ir/rt_ops.h @@ -0,0 +1,30 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_MLIR_RUNTIME_IR_RT_OPS_H_ +#define XLA_MLIR_RUNTIME_IR_RT_OPS_H_ + +#include "mlir/Dialect/Func/IR/FuncOps.h" // from @llvm-project // IWYU pragma: keep +#include "mlir/IR/BuiltinOps.h" // from @llvm-project // IWYU pragma: keep +#include "mlir/IR/SymbolTable.h" // from @llvm-project // IWYU pragma: keep +#include "mlir/Interfaces/ControlFlowInterfaces.h" // from @llvm-project // IWYU pragma: keep +#include "mlir/Interfaces/SideEffectInterfaces.h" // from @llvm-project // IWYU pragma: keep +#include "xla/mlir/runtime/ir/rt_dialect.h" // IWYU pragma: keep +#include "xla/mlir/runtime/ir/rt_interfaces.h" // IWYU pragma: keep + +#define GET_OP_CLASSES +#include "xla/mlir/runtime/ir/rt_ops.h.inc" + +#endif // XLA_MLIR_RUNTIME_IR_RT_OPS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/ir/rt_ops.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/ir/rt_ops.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..aee835c6e2ba0d6ed8fffd127ee1db53eea55b70 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/ir/rt_ops.h.inc @@ -0,0 +1,1229 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: rt_ops.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#if defined(GET_OP_CLASSES) || defined(GET_OP_FWD_DEFINES) +#undef GET_OP_FWD_DEFINES +namespace xla { +namespace runtime { +class CallOp; +} // namespace runtime +} // namespace xla +namespace xla { +namespace runtime { +class ExportOp; +} // namespace runtime +} // namespace xla +namespace xla { +namespace runtime { +class IsOkOp; +} // namespace runtime +} // namespace xla +namespace xla { +namespace runtime { +class SetErrorOp; +} // namespace runtime +} // namespace xla +namespace xla { +namespace runtime { +class SetOutputOp; +} // namespace runtime +} // namespace xla +namespace xla { +namespace runtime { +class TraceOp; +} // namespace runtime +} // namespace xla +namespace xla { +namespace runtime { +class UnsignedCastOp; +} // namespace runtime +} // namespace xla +namespace xla { +namespace runtime { +class YieldOp; +} // namespace runtime +} // namespace xla +#endif + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace xla { +namespace runtime { + +//===----------------------------------------------------------------------===// +// ::xla::runtime::CallOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CallOpGenericAdaptorBase { +public: + struct Properties { + using calleeTy = ::mlir::StringAttr; + calleeTy callee; + + auto getCallee() { + auto &propStorage = this->callee; + return ::llvm::cast<::mlir::StringAttr>(propStorage); + } + void setCallee(const ::mlir::StringAttr &propValue) { + this->callee = propValue; + } + using dynamicTy = ::mlir::UnitAttr; + dynamicTy dynamic; + + auto getDynamic() { + auto &propStorage = this->dynamic; + return ::llvm::dyn_cast_or_null<::mlir::UnitAttr>(propStorage); + } + void setDynamic(const ::mlir::UnitAttr &propValue) { + this->dynamic = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.callee == this->callee && + rhs.dynamic == this->dynamic && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + CallOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + CallOpGenericAdaptorBase(CallOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getCalleeAttr(); + ::llvm::StringRef getCallee(); + ::mlir::UnitAttr getDynamicAttr(); + bool getDynamic(); +}; +} // namespace detail +template +class CallOpGenericAdaptor : public detail::CallOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CallOpGenericAdaptorBase; +public: + CallOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CallOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CallOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + CallOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getCtx() { + return (*getODSOperands(0).begin()); + } + + RangeT getArguments() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CallOpAdaptor : public CallOpGenericAdaptor<::mlir::ValueRange> { +public: + using CallOpGenericAdaptor::CallOpGenericAdaptor; + CallOpAdaptor(CallOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CallOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CallOpAdaptor; + template + using GenericAdaptor = CallOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("callee"), ::llvm::StringRef("dynamic")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getCalleeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getCalleeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDynamicAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDynamicAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rt.call"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::xla::runtime::ExecutionContextType> getCtx(); + ::mlir::Operation::operand_range getArguments(); + ::mlir::OpOperand &getCtxMutable(); + ::mlir::MutableOperandRange getArgumentsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::xla::runtime::StatusType> getStatus(); + ::mlir::Operation::result_range getResults(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::StringAttr getCalleeAttr(); + ::llvm::StringRef getCallee(); + ::mlir::UnitAttr getDynamicAttr(); + bool getDynamic(); + void setCalleeAttr(::mlir::StringAttr attr); + void setCallee(::llvm::StringRef attrValue); + void setDynamicAttr(::mlir::UnitAttr attr); + void setDynamic(bool attrValue); + ::mlir::Attribute removeDynamicAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type status, ::mlir::TypeRange results, ::mlir::Value ctx, ::mlir::StringAttr callee, /*optional*/::mlir::UnitAttr dynamic, ::mlir::ValueRange arguments); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ctx, ::mlir::StringAttr callee, /*optional*/::mlir::UnitAttr dynamic, ::mlir::ValueRange arguments); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type status, ::mlir::TypeRange results, ::mlir::Value ctx, ::llvm::StringRef callee, /*optional*/bool dynamic, ::mlir::ValueRange arguments); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ctx, ::llvm::StringRef callee, /*optional*/bool dynamic, ::mlir::ValueRange arguments); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace runtime +} // namespace xla +MLIR_DECLARE_EXPLICIT_TYPE_ID(::xla::runtime::CallOp) + +namespace xla { +namespace runtime { + +//===----------------------------------------------------------------------===// +// ::xla::runtime::ExportOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ExportOpGenericAdaptorBase { +public: + struct Properties { + using function_refTy = ::mlir::FlatSymbolRefAttr; + function_refTy function_ref; + + auto getFunctionRef() { + auto &propStorage = this->function_ref; + return ::llvm::cast<::mlir::FlatSymbolRefAttr>(propStorage); + } + void setFunctionRef(const ::mlir::FlatSymbolRefAttr &propValue) { + this->function_ref = propValue; + } + using ordinalTy = ::mlir::IntegerAttr; + ordinalTy ordinal; + + auto getOrdinal() { + auto &propStorage = this->ordinal; + return ::llvm::dyn_cast_or_null<::mlir::IntegerAttr>(propStorage); + } + void setOrdinal(const ::mlir::IntegerAttr &propValue) { + this->ordinal = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.function_ref == this->function_ref && + rhs.ordinal == this->ordinal && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + ExportOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + ExportOpGenericAdaptorBase(ExportOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::FlatSymbolRefAttr getFunctionRefAttr(); + ::llvm::StringRef getFunctionRef(); + ::mlir::IntegerAttr getOrdinalAttr(); + ::std::optional< ::llvm::APInt > getOrdinal(); +}; +} // namespace detail +template +class ExportOpGenericAdaptor : public detail::ExportOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ExportOpGenericAdaptorBase; +public: + ExportOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ExportOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ExportOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + ExportOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ExportOpAdaptor : public ExportOpGenericAdaptor<::mlir::ValueRange> { +public: + using ExportOpGenericAdaptor::ExportOpGenericAdaptor; + ExportOpAdaptor(ExportOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ExportOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::SymbolUserOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ExportOpAdaptor; + template + using GenericAdaptor = ExportOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("function_ref"), ::llvm::StringRef("ordinal")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFunctionRefAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFunctionRefAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOrdinalAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOrdinalAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rt.export"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::FlatSymbolRefAttr getFunctionRefAttr(); + ::llvm::StringRef getFunctionRef(); + ::mlir::IntegerAttr getOrdinalAttr(); + ::std::optional< ::llvm::APInt > getOrdinal(); + void setFunctionRefAttr(::mlir::FlatSymbolRefAttr attr); + void setFunctionRef(::llvm::StringRef attrValue); + void setOrdinalAttr(::mlir::IntegerAttr attr); + void setOrdinal(::std::optional<::llvm::APInt> attrValue); + ::mlir::Attribute removeOrdinalAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, mlir::FunctionOpInterface function_ref); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, mlir::FunctionOpInterface function_ref, unsigned ordinal); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verifySymbolUses(::mlir::SymbolTableCollection &symbolTable); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + std::optional ordinal(); + mlir::FunctionOpInterface exported(mlir::SymbolTable& sym_table); +}; +} // namespace runtime +} // namespace xla +MLIR_DECLARE_EXPLICIT_TYPE_ID(::xla::runtime::ExportOp) + +namespace xla { +namespace runtime { + +//===----------------------------------------------------------------------===// +// ::xla::runtime::IsOkOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IsOkOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IsOkOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IsOkOpGenericAdaptorBase(IsOkOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class IsOkOpGenericAdaptor : public detail::IsOkOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IsOkOpGenericAdaptorBase; +public: + IsOkOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IsOkOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IsOkOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IsOkOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getStatus() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IsOkOpAdaptor : public IsOkOpGenericAdaptor<::mlir::ValueRange> { +public: + using IsOkOpGenericAdaptor::IsOkOpGenericAdaptor; + IsOkOpAdaptor(IsOkOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IsOkOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = IsOkOpAdaptor; + template + using GenericAdaptor = IsOkOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rt.is_ok"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::xla::runtime::StatusType> getStatus(); + ::mlir::OpOperand &getStatusMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::IntegerType> getOk(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type ok, ::mlir::Value status); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value status); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace runtime +} // namespace xla +MLIR_DECLARE_EXPLICIT_TYPE_ID(::xla::runtime::IsOkOp) + +namespace xla { +namespace runtime { + +//===----------------------------------------------------------------------===// +// ::xla::runtime::SetErrorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SetErrorOpGenericAdaptorBase { +public: + struct Properties { + using errorTy = ::mlir::StringAttr; + errorTy error; + + auto getError() { + auto &propStorage = this->error; + return ::llvm::cast<::mlir::StringAttr>(propStorage); + } + void setError(const ::mlir::StringAttr &propValue) { + this->error = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.error == this->error && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + SetErrorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + SetErrorOpGenericAdaptorBase(SetErrorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getErrorAttr(); + ::llvm::StringRef getError(); +}; +} // namespace detail +template +class SetErrorOpGenericAdaptor : public detail::SetErrorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SetErrorOpGenericAdaptorBase; +public: + SetErrorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SetErrorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SetErrorOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + SetErrorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getCtx() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SetErrorOpAdaptor : public SetErrorOpGenericAdaptor<::mlir::ValueRange> { +public: + using SetErrorOpGenericAdaptor::SetErrorOpGenericAdaptor; + SetErrorOpAdaptor(SetErrorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SetErrorOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = SetErrorOpAdaptor; + template + using GenericAdaptor = SetErrorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("error")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getErrorAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getErrorAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rt.set_error"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::xla::runtime::ExecutionContextType> getCtx(); + ::mlir::OpOperand &getCtxMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::StringAttr getErrorAttr(); + ::llvm::StringRef getError(); + void setErrorAttr(::mlir::StringAttr attr); + void setError(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value ctx, ::mlir::StringAttr error); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ctx, ::mlir::StringAttr error); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value ctx, ::llvm::StringRef error); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ctx, ::llvm::StringRef error); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace runtime +} // namespace xla +MLIR_DECLARE_EXPLICIT_TYPE_ID(::xla::runtime::SetErrorOp) + +namespace xla { +namespace runtime { + +//===----------------------------------------------------------------------===// +// ::xla::runtime::SetOutputOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SetOutputOpGenericAdaptorBase { +public: + struct Properties { + using indexTy = ::mlir::IntegerAttr; + indexTy index; + + auto getIndex() { + auto &propStorage = this->index; + return ::llvm::cast<::mlir::IntegerAttr>(propStorage); + } + void setIndex(const ::mlir::IntegerAttr &propValue) { + this->index = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.index == this->index && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + SetOutputOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + SetOutputOpGenericAdaptorBase(SetOutputOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getIndexAttr(); + uint64_t getIndex(); +}; +} // namespace detail +template +class SetOutputOpGenericAdaptor : public detail::SetOutputOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SetOutputOpGenericAdaptorBase; +public: + SetOutputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SetOutputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SetOutputOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + SetOutputOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getCtx() { + return (*getODSOperands(0).begin()); + } + + ValueT getValue() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SetOutputOpAdaptor : public SetOutputOpGenericAdaptor<::mlir::ValueRange> { +public: + using SetOutputOpGenericAdaptor::SetOutputOpGenericAdaptor; + SetOutputOpAdaptor(SetOutputOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SetOutputOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SetOutputOpAdaptor; + template + using GenericAdaptor = SetOutputOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("index")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getIndexAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getIndexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rt.set_output"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::xla::runtime::ExecutionContextType> getCtx(); + ::mlir::Value getValue(); + ::mlir::OpOperand &getCtxMutable(); + ::mlir::OpOperand &getValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + ::mlir::IntegerAttr getIndexAttr(); + uint64_t getIndex(); + void setIndexAttr(::mlir::IntegerAttr attr); + void setIndex(uint64_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value ctx, ::mlir::IntegerAttr index, ::mlir::Value value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ctx, ::mlir::IntegerAttr index, ::mlir::Value value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value ctx, uint64_t index, ::mlir::Value value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value ctx, uint64_t index, ::mlir::Value value); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace runtime +} // namespace xla +MLIR_DECLARE_EXPLICIT_TYPE_ID(::xla::runtime::SetOutputOp) + +namespace xla { +namespace runtime { + +//===----------------------------------------------------------------------===// +// ::xla::runtime::TraceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TraceOpGenericAdaptorBase { +public: + struct Properties { + using annotationTy = xla::runtime::TraceAnnotationAttrInterface; + annotationTy annotation; + + auto getAnnotation() { + auto &propStorage = this->annotation; + return ::llvm::cast(propStorage); + } + void setAnnotation(const xla::runtime::TraceAnnotationAttrInterface &propValue) { + this->annotation = propValue; + } + bool operator==(const Properties &rhs) const { + return + rhs.annotation == this->annotation && + true; + } + bool operator!=(const Properties &rhs) const { + return !(*this == rhs); + } + }; +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + Properties properties; + ::mlir::RegionRange odsRegions; +public: + TraceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}); + + TraceOpGenericAdaptorBase(TraceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + const Properties &getProperties() { + return properties; + } + + ::mlir::DictionaryAttr getAttributes(); + xla::runtime::TraceAnnotationAttrInterface getAnnotationAttr(); + xla::runtime::TraceAnnotationAttrInterface getAnnotation(); + ::mlir::Region &getBody(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class TraceOpGenericAdaptor : public detail::TraceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TraceOpGenericAdaptorBase; +public: + TraceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const Properties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TraceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TraceOpGenericAdaptor(values, attrs, (properties ? *properties.as() : Properties{}), regions) {} + + template >> + TraceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getCtx() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TraceOpAdaptor : public TraceOpGenericAdaptor<::mlir::ValueRange> { +public: + using TraceOpGenericAdaptor::TraceOpGenericAdaptor; + TraceOpAdaptor(TraceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TraceOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::BytecodeOpInterface::Trait, ::mlir::OpTrait::AutomaticAllocationScope, ::mlir::OpAsmOpInterface::Trait, ::mlir::RegionBranchOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TraceOpAdaptor; + template + using GenericAdaptor = TraceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + using Properties = FoldAdaptor::Properties; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("annotation")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAnnotationAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAnnotationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rt.trace"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::xla::runtime::ExecutionContextType> getCtx(); + ::mlir::OpOperand &getCtxMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResults(); + ::mlir::Region &getBody(); + static ::mlir::LogicalResult setPropertiesFromAttr(Properties &prop, ::mlir::Attribute attr, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::Attribute getPropertiesAsAttr(::mlir::MLIRContext *ctx, const Properties &prop); + static llvm::hash_code computePropertiesHash(const Properties &prop); + static std::optional getInherentAttr(::mlir::MLIRContext *ctx, const Properties &prop, llvm::StringRef name); + static void setInherentAttr(Properties &prop, llvm::StringRef name, mlir::Attribute value); + static void populateInherentAttrs(::mlir::MLIRContext *ctx, const Properties &prop, ::mlir::NamedAttrList &attrs); + static ::mlir::LogicalResult verifyInherentAttrs(::mlir::OperationName opName, ::mlir::NamedAttrList &attrs, llvm::function_ref<::mlir::InFlightDiagnostic()> emitError); + static ::mlir::LogicalResult readProperties(::mlir::DialectBytecodeReader &reader, ::mlir::OperationState &state); + void writeProperties(::mlir::DialectBytecodeWriter &writer); + xla::runtime::TraceAnnotationAttrInterface getAnnotationAttr(); + xla::runtime::TraceAnnotationAttrInterface getAnnotation(); + void setAnnotationAttr(xla::runtime::TraceAnnotationAttrInterface attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, mlir::TypeRange results, mlir::Value exec_ctx, TraceAnnotationAttrInterface annotation, llvm::function_ref bodyBuilder = nullptr); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getSuccessorRegions(::mlir::RegionBranchPoint point, ::llvm::SmallVectorImpl<::mlir::RegionSuccessor> ®ions); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // OpAsmOpInterface: Allow the dialect prefix to be omitted. + static llvm::StringRef getDefaultDialect() { return "rt"; } +}; +} // namespace runtime +} // namespace xla +MLIR_DECLARE_EXPLICIT_TYPE_ID(::xla::runtime::TraceOp) + +namespace xla { +namespace runtime { + +//===----------------------------------------------------------------------===// +// ::xla::runtime::UnsignedCastOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class UnsignedCastOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + UnsignedCastOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + UnsignedCastOpGenericAdaptorBase(UnsignedCastOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class UnsignedCastOpGenericAdaptor : public detail::UnsignedCastOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::UnsignedCastOpGenericAdaptorBase; +public: + UnsignedCastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + UnsignedCastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : UnsignedCastOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + UnsignedCastOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getValue() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class UnsignedCastOpAdaptor : public UnsignedCastOpGenericAdaptor<::mlir::ValueRange> { +public: + using UnsignedCastOpGenericAdaptor::UnsignedCastOpGenericAdaptor; + UnsignedCastOpAdaptor(UnsignedCastOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class UnsignedCastOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = UnsignedCastOpAdaptor; + template + using GenericAdaptor = UnsignedCastOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rt.unsigned_cast"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getValue(); + ::mlir::OpOperand &getValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value value); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: +}; +} // namespace runtime +} // namespace xla +MLIR_DECLARE_EXPLICIT_TYPE_ID(::xla::runtime::UnsignedCastOp) + +namespace xla { +namespace runtime { + +//===----------------------------------------------------------------------===// +// ::xla::runtime::YieldOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class YieldOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + YieldOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + YieldOpGenericAdaptorBase(YieldOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class YieldOpGenericAdaptor : public detail::YieldOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::YieldOpGenericAdaptorBase; +public: + YieldOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + YieldOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : YieldOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + YieldOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArguments() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class YieldOpAdaptor : public YieldOpGenericAdaptor<::mlir::ValueRange> { +public: + using YieldOpGenericAdaptor::YieldOpGenericAdaptor; + YieldOpAdaptor(YieldOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class YieldOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::IsTerminator, ::mlir::RegionBranchTerminatorOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = YieldOpAdaptor; + template + using GenericAdaptor = YieldOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("rt.yield"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArguments(); + ::mlir::MutableOperandRange getArgumentsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange arguments); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::MutableOperandRange getMutableSuccessorOperands(::mlir::RegionBranchPoint point); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace runtime +} // namespace xla +MLIR_DECLARE_EXPLICIT_TYPE_ID(::xla::runtime::YieldOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/ir/rt_types.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/ir/rt_types.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..5a1a866feef57d4486c6f5c6ccd467ac80acca80 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/ir/rt_types.h.inc @@ -0,0 +1,53 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* TypeDef Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_TYPEDEF_CLASSES +#undef GET_TYPEDEF_CLASSES + + +namespace mlir { +class AsmParser; +class AsmPrinter; +} // namespace mlir +namespace xla { +namespace runtime { +class ExecutionContextType; +class OpaqueType; +class StatusType; +class ExecutionContextType : public ::mlir::Type::TypeBase { +public: + using Base::Base; + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"execution_context"}; + } + +}; +class OpaqueType : public ::mlir::Type::TypeBase { +public: + using Base::Base; + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"opaque"}; + } + +}; +class StatusType : public ::mlir::Type::TypeBase { +public: + using Base::Base; + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"status"}; + } + +}; +} // namespace runtime +} // namespace xla +MLIR_DECLARE_EXPLICIT_TYPE_ID(::xla::runtime::ExecutionContextType) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::xla::runtime::OpaqueType) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::xla::runtime::StatusType) + +#endif // GET_TYPEDEF_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/ir/tests/testlib.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/ir/tests/testlib.h new file mode 100644 index 0000000000000000000000000000000000000000..c7c60418680c731aa1e1252b331510f98c8d113d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/ir/tests/testlib.h @@ -0,0 +1,51 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_MLIR_RUNTIME_IR_TESTS_TESTLIB_H_ +#define XLA_MLIR_RUNTIME_IR_TESTS_TESTLIB_H_ + +#include + +#include "mlir/Dialect/LLVMIR/LLVMDialect.h" // from @llvm-project +#include "mlir/IR/Dialect.h" // from @llvm-project +#include "mlir/IR/Types.h" // from @llvm-project + +// clang-format off +#include "mlir/Transforms/DialectConversion.h" // from @llvm-project +#include "xla/mlir/runtime/ir/tests/testlib_dialect.h.inc" +#include "xla/mlir/runtime/ir/tests/testlib_enums.h.inc" +// clang-format on + +#define GET_ATTRDEF_CLASSES +#include "xla/mlir/runtime/ir/tests/testlib_attrs.h.inc" + +#define GET_TYPEDEF_CLASSES +#include "xla/mlir/runtime/ir/tests/testlib_types.h.inc" + +namespace xla { +namespace runtime { + +inline mlir::Type ConvertValueType(ValueType type) { + return mlir::LLVM::LLVMPointerType::get(type.getContext()); +} + +inline void AddTestlibTypeConversions(mlir::TypeConverter& converter) { + converter.addConversion(ConvertValueType); +} + +} // namespace runtime +} // namespace xla + +#endif // XLA_MLIR_RUNTIME_IR_TESTS_TESTLIB_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/ir/tests/testlib_attrs.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/ir/tests/testlib_attrs.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..a7cdfa3afb673320b50adde339d5c3e5e943257c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/ir/tests/testlib_attrs.h.inc @@ -0,0 +1,76 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* AttrDef Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_ATTRDEF_CLASSES +#undef GET_ATTRDEF_CLASSES + + +namespace mlir { +class AsmParser; +class AsmPrinter; +} // namespace mlir +namespace xla { +namespace runtime { +class PairOfDimsAttr; +class EnumType2Attr; +class EnumTypeAttr; +namespace detail { +struct PairOfDimsAttrStorage; +} // namespace detail +class PairOfDimsAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static PairOfDimsAttr get(::mlir::MLIRContext *context, int64_t rank, ::llvm::ArrayRef a, ::llvm::ArrayRef b); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"pair_of_dims"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + int64_t getRank() const; + ::llvm::ArrayRef getA() const; + ::llvm::ArrayRef getB() const; +}; +namespace detail { +struct EnumType2AttrStorage; +} // namespace detail +class EnumType2Attr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static EnumType2Attr get(::mlir::MLIRContext *context, ::xla::runtime::EnumType2 value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"another_enum_type"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::xla::runtime::EnumType2 getValue() const; +}; +namespace detail { +struct EnumTypeAttrStorage; +} // namespace detail +class EnumTypeAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static EnumTypeAttr get(::mlir::MLIRContext *context, ::xla::runtime::EnumType value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"enum_type"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::xla::runtime::EnumType getValue() const; +}; +} // namespace runtime +} // namespace xla +MLIR_DECLARE_EXPLICIT_TYPE_ID(::xla::runtime::PairOfDimsAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::xla::runtime::EnumType2Attr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::xla::runtime::EnumTypeAttr) + +#endif // GET_ATTRDEF_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/ir/tests/testlib_dialect.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/ir/tests/testlib_dialect.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..85a786769e77074e45b15e655a1d14522719a8b0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/ir/tests/testlib_dialect.h.inc @@ -0,0 +1,41 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: testlib.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace xla { +namespace runtime { + +class TestlibDialect : public ::mlir::Dialect { + explicit TestlibDialect(::mlir::MLIRContext *context); + + void initialize(); + friend class ::mlir::MLIRContext; +public: + ~TestlibDialect() override; + static constexpr ::llvm::StringLiteral getDialectNamespace() { + return ::llvm::StringLiteral("testlib"); + } + + /// Parse an attribute registered to this dialect. + ::mlir::Attribute parseAttribute(::mlir::DialectAsmParser &parser, + ::mlir::Type type) const override; + + /// Print an attribute registered to this dialect. + void printAttribute(::mlir::Attribute attr, + ::mlir::DialectAsmPrinter &os) const override; + + /// Parse a type registered to this dialect. + ::mlir::Type parseType(::mlir::DialectAsmParser &parser) const override; + + /// Print a type registered to this dialect. + void printType(::mlir::Type type, + ::mlir::DialectAsmPrinter &os) const override; +}; +} // namespace runtime +} // namespace xla +MLIR_DECLARE_EXPLICIT_TYPE_ID(::xla::runtime::TestlibDialect) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/ir/tests/testlib_enums.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/ir/tests/testlib_enums.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..4c46557f99e491678496bf514344d4b851894a5a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/ir/tests/testlib_enums.h.inc @@ -0,0 +1,173 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Enum Utility Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: testlib.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace xla { +namespace runtime { +// Custom Call Testlib Enum Type. +enum class EnumType : uint32_t { + Foo = 0, + Bar = 1, + Baz = 2, +}; + +::std::optional symbolizeEnumType(uint32_t); +::llvm::StringRef stringifyEnumType(EnumType); +::std::optional symbolizeEnumType(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForEnumType() { + return 2; +} + + +inline ::llvm::StringRef stringifyEnum(EnumType enumValue) { + return stringifyEnumType(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeEnumType(str); +} +} // namespace runtime +} // namespace xla + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::xla::runtime::EnumType, ::xla::runtime::EnumType> { + template + static FailureOr<::xla::runtime::EnumType> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for Custom Call Testlib Enum Type."); + + // Symbolize the keyword. + if (::std::optional<::xla::runtime::EnumType> attr = ::xla::runtime::symbolizeEnum<::xla::runtime::EnumType>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid Custom Call Testlib Enum Type. specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::xla::runtime::EnumType value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::xla::runtime::EnumType> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::xla::runtime::EnumType getEmptyKey() { + return static_cast<::xla::runtime::EnumType>(StorageInfo::getEmptyKey()); + } + + static inline ::xla::runtime::EnumType getTombstoneKey() { + return static_cast<::xla::runtime::EnumType>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::xla::runtime::EnumType &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::xla::runtime::EnumType &lhs, const ::xla::runtime::EnumType &rhs) { + return lhs == rhs; + } +}; +} + +namespace xla { +namespace runtime { +// Another Custom Call Testlib Enum Type. +enum class EnumType2 : uint32_t { + Foo = 0, + Bar = 1, + Baz = 2, +}; + +::std::optional symbolizeEnumType2(uint32_t); +::llvm::StringRef stringifyEnumType2(EnumType2); +::std::optional symbolizeEnumType2(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForEnumType2() { + return 2; +} + + +inline ::llvm::StringRef stringifyEnum(EnumType2 enumValue) { + return stringifyEnumType2(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeEnumType2(str); +} +} // namespace runtime +} // namespace xla + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::xla::runtime::EnumType2, ::xla::runtime::EnumType2> { + template + static FailureOr<::xla::runtime::EnumType2> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for Another Custom Call Testlib Enum Type."); + + // Symbolize the keyword. + if (::std::optional<::xla::runtime::EnumType2> attr = ::xla::runtime::symbolizeEnum<::xla::runtime::EnumType2>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid Another Custom Call Testlib Enum Type. specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::xla::runtime::EnumType2 value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::xla::runtime::EnumType2> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::xla::runtime::EnumType2 getEmptyKey() { + return static_cast<::xla::runtime::EnumType2>(StorageInfo::getEmptyKey()); + } + + static inline ::xla::runtime::EnumType2 getTombstoneKey() { + return static_cast<::xla::runtime::EnumType2>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::xla::runtime::EnumType2 &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::xla::runtime::EnumType2 &lhs, const ::xla::runtime::EnumType2 &rhs) { + return lhs == rhs; + } +}; +} + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/ir/tests/testlib_types.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/ir/tests/testlib_types.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..122a2ce34448232c180e4498dffc6ba6ec00d862 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/ir/tests/testlib_types.h.inc @@ -0,0 +1,43 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* TypeDef Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_TYPEDEF_CLASSES +#undef GET_TYPEDEF_CLASSES + + +namespace mlir { +class AsmParser; +class AsmPrinter; +} // namespace mlir +namespace xla { +namespace runtime { +class CustomArgType; +class ValueType; +class CustomArgType : public ::mlir::Type::TypeBase { +public: + using Base::Base; + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"custom_arg"}; + } + +}; +class ValueType : public ::mlir::Type::TypeBase { +public: + using Base::Base; + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"value"}; + } + +}; +} // namespace runtime +} // namespace xla +MLIR_DECLARE_EXPLICIT_TYPE_ID(::xla::runtime::CustomArgType) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::xla::runtime::ValueType) + +#endif // GET_TYPEDEF_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/transforms/calling_convention.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/transforms/calling_convention.h new file mode 100644 index 0000000000000000000000000000000000000000..6504af7e8b36e23e9733f5535d336a62f33a8874 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/transforms/calling_convention.h @@ -0,0 +1,91 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_MLIR_RUNTIME_TRANSFORMS_CALLING_CONVENTION_H_ +#define XLA_MLIR_RUNTIME_TRANSFORMS_CALLING_CONVENTION_H_ + +#include + +#include "mlir/IR/BuiltinTypes.h" // from @llvm-project +#include "mlir/Transforms/DialectConversion.h" // from @llvm-project + +namespace xla { +namespace runtime { + +// Calling convention converts exported function types to function types with +// a well-defined ABI (e.g. tensors do not have an ABI; they must be passed +// across the function boundary as memrefs). In a nutshell it tells the XLA +// runtime how to call the compiled executable at run time, and how to return +// results back to the caller. +// +// All types in the converted function signature should have a registered +// type conversion (see `type_converter` below) to a type with defined +// argument or result ABI (see Type::ArgumentAbi and Type::ResultAbi). +// +// If conversion is not possible, calling convention must return a null value. +// +// Example: abstract executable defined in high level dialect, e.g. MHLO +// +// ```mlir +// func @compute(%arg0: tensor, +// %arg1: tensor) -> tensor { ... } +// ``` +// +// after calling convention conversion becomes: +// +// ```mlir +// func @compute(%ctx: !rt.execution_context, +// %arg0: memref, +// %arg1: memref) -> memref { ... } +// ``` +// +// Calling convention function type is not the same as the exported function +// type produced by the compilation pipeline for several reasons: +// +// 1) Compilation pipeline produces LLVM functions with LLVM types, and high +// level information is lost, e.g. all memrefs are deconstructed into +// primitive fields when passed as inputs. +// +// 2) Exported function always returns void, and uses runtime API to return +// results back to the caller (see `xla-rt-export-functions` pass). +// +// Calling convention function type is a XLA-compatible description of the +// compiled executable ABI, so that XLA runtime can correctly initialize +// CallFrame arguments, allocate memory for returned results, and then correctly +// decode results memory into the high level types (e.g. convert returned memref +// descriptor to a Tensor). +class CallingConvention + : public std::function { + using function::function; +}; + +// Returns a calling convention that only adds the execution context argument. +CallingConvention DefaultCallingConvention(); + +// Returns a calling convention that uses user-provided type converter to +// convert all inputs and results types, and adds the execution context +// argument. +CallingConvention DefaultCallingConvention(mlir::TypeConverter); + +// Returns a calling convention that (1) prepends the execution context +// argument, (2) uses the user-provided type converter to convert all inputs and +// results types, and (3) converts result types into out-params by appending +// them to the arguments. +CallingConvention ResultsToOutsCallingConvention(mlir::TypeConverter); + +} // namespace runtime +} // namespace xla + +#endif // XLA_MLIR_RUNTIME_TRANSFORMS_CALLING_CONVENTION_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/transforms/compilation_pipeline_cpu.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/transforms/compilation_pipeline_cpu.h new file mode 100644 index 0000000000000000000000000000000000000000..91c5a9054f633142b5b8cdf0f86855f9d97f1f89 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/transforms/compilation_pipeline_cpu.h @@ -0,0 +1,64 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_MLIR_RUNTIME_TRANSFORMS_COMPILATION_PIPELINE_CPU_H_ +#define XLA_MLIR_RUNTIME_TRANSFORMS_COMPILATION_PIPELINE_CPU_H_ + +#include + +#include "xla/mlir/runtime/transforms/compilation_pipeline_options.h" +#include "xla/runtime/compiler.h" + +namespace xla { +namespace runtime { + +struct CpuPipelineOptions { + CompilationPipelineOptions common_options; + + // Byte alignment for allocated memrefs. Depending on the compiler flags + // Tensorflow requires tensors to be aligned on 16, 32 or 64 bytes. + int alignment = 0; + + // Accelerate sparse computations with CUDA threading. + // This is an experimental feature, so off by default. + int32_t xla_cpu_sparse_cuda_threads = 0; + std::string cuda_triplet = "nvptx64-nvidia-cuda"; + std::string cuda_arch = "sm_80"; + std::string cuda_features = "+ptx71"; + + // Enables math approximations that emit AVX2 intrinsics. +#ifdef __AVX2__ + bool math_avx2 = true; +#else + bool math_avx2 = false; +#endif +}; + +// Registers dialects, interfaces and dialects translations with the registry +// required by the default XLA-CPU runtime compilation pipeline. +void RegisterDefaultXlaCpuRuntimeDialects(DialectRegistry& dialects); + +// Creates default XLA-CPU runtime compilation pipeline that lowers from the +// `rt` and `memref` dialects to the LLVMIR dialect. This is a very simple +// pipeline that is mostly intended for writing tests for the XLA runtime, and +// it is expected that all end users will construct their own compilation +// pipelines from the available XLA and MLIR passes. +void CreateDefaultXlaCpuRuntimeCompilationPipeline( + PassManager& passes, const CpuPipelineOptions& opts); + +} // namespace runtime +} // namespace xla + +#endif // XLA_MLIR_RUNTIME_TRANSFORMS_COMPILATION_PIPELINE_CPU_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/transforms/compilation_pipeline_gpu.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/transforms/compilation_pipeline_gpu.h new file mode 100644 index 0000000000000000000000000000000000000000..a36235baff6bc332f2d7f1af99163742154a8f4b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/transforms/compilation_pipeline_gpu.h @@ -0,0 +1,51 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_MLIR_RUNTIME_TRANSFORMS_COMPILATION_PIPELINE_GPU_H_ +#define XLA_MLIR_RUNTIME_TRANSFORMS_COMPILATION_PIPELINE_GPU_H_ + +#include "xla/mlir/runtime/transforms/compilation_pipeline_options.h" +#include "xla/runtime/compiler.h" + +namespace mlir { +class MLIRContext; +} // namespace mlir + +namespace xla { +namespace runtime { + +// Registers dialects, interfaces and dialects translations with the registry +// required by the default XLA-GPU runtime compilation pipeline. +void RegisterDefaultXlaGpuRuntimeDialects(DialectRegistry& dialects); + +void RegisterLmhloGpuDialect(DialectRegistry& dialects); + +void RegisterTestlibDialect(DialectRegistry& dialects); + +// Creates default XLA-GPU runtime compilation pipeline that lowers from the +// `rt` and `memref` dialects to the LLVMIR dialect. This is a very simple +// pipeline that is mostly intended for writing tests for the XLA runtime, and +// it is expected that all end users will construct their own compilation +// pipelines from the available XLA and MLIR passes. +void CreateDefaultXlaGpuRuntimeCompilationPipeline( + PassManager& passes, const CompilationPipelineOptions& opts, + bool add_async_passes = false); + +void AppendXlaGpuDialectRegistry(mlir::MLIRContext& context); + +} // namespace runtime +} // namespace xla + +#endif // XLA_MLIR_RUNTIME_TRANSFORMS_COMPILATION_PIPELINE_GPU_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/transforms/compilation_pipeline_options.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/transforms/compilation_pipeline_options.h new file mode 100644 index 0000000000000000000000000000000000000000..a80876fb8bcb6ac99a84d009fa5db664c009f598 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/transforms/compilation_pipeline_options.h @@ -0,0 +1,52 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_MLIR_RUNTIME_TRANSFORMS_COMPILATION_PIPELINE_OPTIONS_H_ +#define XLA_MLIR_RUNTIME_TRANSFORMS_COMPILATION_PIPELINE_OPTIONS_H_ + +#include + +#include "mlir/Transforms/DialectConversion.h" // from @llvm-project +#include "xla/mlir/runtime/transforms/custom_call_encoding.h" +#include "xla/runtime/type_id.h" + +namespace xla { +namespace runtime { + +// Common options for default XLA-{CPU,GPU} compilation pipelines. +struct CompilationPipelineOptions { + // Register names for the TypeIDs used for encoding types of custom arguments + // and attributes. + std::function populate_type_id_names; + + // Add type conversions from user-defined types to LLVM types. These + // conversions are required for lowering runtime operations to the + // corresponding runtime APIs (including custom calls). + std::function populate_type_conversions; + + // Add user-defined encoding for JitRt custom call arguments and attributes. + // + // Custom encodings allow to pass dialect-specific attributes (enums and + // structs) to the custom calls, and decode them into dialect-specific runtime + // values in the custom call handlers (see custom_call_to_llvm.h for details). + std::function populate_arg_encodings; + std::function populate_ret_encodings; + std::function populate_attr_encodings; +}; + +} // namespace runtime +} // namespace xla + +#endif // XLA_MLIR_RUNTIME_TRANSFORMS_COMPILATION_PIPELINE_OPTIONS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/transforms/compiler.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/transforms/compiler.h new file mode 100644 index 0000000000000000000000000000000000000000..4db705a32bef58775046ecc489bce78bdbf31426 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/transforms/compiler.h @@ -0,0 +1,48 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_MLIR_RUNTIME_TRANSFORMS_COMPILER_H_ +#define XLA_MLIR_RUNTIME_TRANSFORMS_COMPILER_H_ + +#include "mlir/IR/DialectRegistry.h" // from @llvm-project +#include "mlir/Pass/PassManager.h" // from @llvm-project + +namespace xla { +namespace runtime { + +class DialectRegistry { + public: + DialectRegistry() = default; + mlir::DialectRegistry* operator->() { return ®istry_; } + mlir::DialectRegistry& operator*() { return registry_; } + + private: + mlir::DialectRegistry registry_; +}; + +class PassManager { + public: + explicit PassManager(mlir::PassManager* pm) : pm_(pm) {} + mlir::PassManager* operator->() { return pm_; } + mlir::PassManager& operator*() { return *pm_; } + + private: + mlir::PassManager* pm_; +}; + +} // namespace runtime +} // namespace xla + +#endif // XLA_MLIR_RUNTIME_TRANSFORMS_COMPILER_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/transforms/custom_call_encoding.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/transforms/custom_call_encoding.h new file mode 100644 index 0000000000000000000000000000000000000000..3582987c1fb653cc1b831def3f162f998360f5fa --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/transforms/custom_call_encoding.h @@ -0,0 +1,768 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_MLIR_RUNTIME_TRANSFORMS_CUSTOM_CALL_ENCODING_H_ +#define XLA_MLIR_RUNTIME_TRANSFORMS_CUSTOM_CALL_ENCODING_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "mlir/Dialect/LLVMIR/LLVMDialect.h" // from @llvm-project +#include "mlir/IR/Attributes.h" // from @llvm-project +#include "mlir/IR/BuiltinOps.h" // from @llvm-project +#include "mlir/IR/ImplicitLocOpBuilder.h" // from @llvm-project +#include "mlir/IR/Operation.h" // from @llvm-project +#include "mlir/IR/SymbolTable.h" // from @llvm-project +#include "mlir/IR/Types.h" // from @llvm-project +#include "mlir/IR/Value.h" // from @llvm-project +#include "mlir/Support/LogicalResult.h" // from @llvm-project +#include "mlir/Support/TypeID.h" // from @llvm-project +#include "xla/runtime/custom_call.h" +#include "xla/runtime/type_id.h" + +namespace xla { +namespace runtime { + +//===----------------------------------------------------------------------===// +// Helper classes to build XLA custom calls' lowering to the LLVM dialect. +//===----------------------------------------------------------------------===// +// +// Arguments to the custom call API intrinsic are encoded as an array of opaque +// pointers and at the runtime side available as `void**`. Runtime decodes +// opaque pointers to the C++ data structures (see runtime/custom_call.h), and +// passes them to the registered callback. Argument encoding/decoding must be +// compatible, otherwise it's very easy to get a segfault because of an illegal +// memory access. +// +// Attributes are encoded into a separate opaque storage together with names, +// so the runtime side can decode the attributes it needs and check that all +// required attributes were passed to the custom call handler. +// +// Custom call attributes are encoded as module global constants, and at run +// time we only need to pass a pointer to the constant section. +// +// Custom call arguments are encoded as an array of pointers allocated on the +// stack. Each individual argument is also encoded on the stack, because +// arguments are typically run time values and we can't encode them in the +// constant section. Statically known arguments (constants) can be encoded as +// global values together with attributes. + +// Forward declare class declared below. +class Globals; +class Allocas; + +//===----------------------------------------------------------------------===// +// Custom call arguments encoding. +//===----------------------------------------------------------------------===// + +// Encodes argument into stack allocated storage according to the ABI. +class CustomCallArgEncoding { + public: + struct Encoded { + mlir::LLVM::GlobalOp type_id; // llvm.mlir.global external $type_name : i64 + + // Statically known arguments might be encoded as global constants, + // otherwise it will be `!llvm.alloca 1 x ArgType`. + std::variant value; + }; + + virtual ~CustomCallArgEncoding() = default; + + virtual mlir::LogicalResult Match(mlir::Value value, + mlir::Value conterted) const = 0; + + virtual mlir::FailureOr Encode(Globals &g, Allocas &a, + mlir::ImplicitLocOpBuilder &b, + mlir::Value value, + mlir::Value converted) const = 0; +}; + +// A set of registered custom call arguments encodings. +class CustomCallArgEncodingSet { + public: + using Encoded = CustomCallArgEncoding::Encoded; + + // Finds matching argument encoding and tries to encode the values. Returns + // failure if didn't match values to any of the argument encodings. + mlir::FailureOr Encode(Globals &g, Allocas &a, + mlir::ImplicitLocOpBuilder &b, + mlir::Value value, + mlir::Value converted) const; + + template > + CustomCallArgEncodingSet &Add() { + (encodings_.emplace_back(std::make_unique()), ...); + return *this; + } + + template > + CustomCallArgEncodingSet &Add(Arg arg, Args... args) { + (encodings_.emplace_back(std::make_unique(std::forward(arg), + std::forward(args))), + ...); + return *this; + } + + private: + std::vector> encodings_; +}; + +//===----------------------------------------------------------------------===// +// Custom call results encoding. +//===----------------------------------------------------------------------===// + +// Encodes result into stack allocated storage according to the ABI. +class CustomCallRetEncoding { + public: + struct Encoded { + mlir::LLVM::GlobalOp type_id; // llvm.mlir.global external $type_name : i64 + mlir::LLVM::AllocaOp value; // !llvm.alloca 1 x ResultType + }; + + virtual ~CustomCallRetEncoding() = default; + + virtual mlir::LogicalResult Match(mlir::Type type, + mlir::Type converted) const = 0; + + virtual mlir::FailureOr Encode(Globals &g, Allocas &a, + mlir::ImplicitLocOpBuilder &b, + mlir::Type type, + mlir::Type converted) const = 0; + + virtual mlir::FailureOr Decode( + mlir::ImplicitLocOpBuilder &b, mlir::Type type, mlir::Type converted, + mlir::LLVM::AllocaOp alloca) const = 0; +}; + +// A set of registered custom call results encodings. +class CustomCallRetEncodingSet { + public: + using Encoded = CustomCallRetEncoding::Encoded; + + // Finds matching result encoding and tries to encode the values. Returns + // failure if didn't match values to any of the result encodings. + mlir::FailureOr Encode(Globals &g, Allocas &a, + mlir::ImplicitLocOpBuilder &b, + mlir::Type type, mlir::Type converted) const; + + // Convert the encoded value in alloca back to a value with the converted + // type. Return failure if the convertion failed. + mlir::FailureOr Decode(mlir::ImplicitLocOpBuilder &b, + mlir::Type type, mlir::Type converted, + mlir::LLVM::AllocaOp alloca) const; + + template > + CustomCallRetEncodingSet &Add() { + (encodings_.emplace_back(std::make_unique()), ...); + return *this; + } + + template > + CustomCallRetEncodingSet &Add(Arg arg, Args... args) { + (encodings_.emplace_back(std::make_unique(std::forward(arg), + std::forward(args))), + ...); + return *this; + } + + private: + std::vector> encodings_; +}; + +//===----------------------------------------------------------------------===// +// Custom call attributes encoding. +//===----------------------------------------------------------------------===// + +// Attributes encoding packs attribute name, data type and a value into the +// module global constant, and returns values pointing to the encoded data. +struct CustomCallAttrEncoding { + static constexpr char kAttrName[] = "__rt_attr_name"; + static constexpr char kAttrValue[] = "__rt_attr_value"; + + struct Encoded { + mlir::LLVM::GlobalOp name; // llvm.mlir.global + mlir::LLVM::GlobalOp type_id; // llvm.mlir.global external $type_name : i64 + mlir::LLVM::GlobalOp value; // llvm.mlir.global + }; + + virtual ~CustomCallAttrEncoding() = default; + + virtual mlir::LogicalResult Match(mlir::SymbolTable &sym_table, + std::string_view name, + mlir::Attribute attr) const = 0; + + virtual mlir::FailureOr Encode(mlir::SymbolTable &sym_table, + Globals &g, + mlir::ImplicitLocOpBuilder &b, + std::string_view name, + mlir::Attribute attr) const = 0; +}; + +// A set of registered custom call attributes encodings. +class CustomCallAttrEncodingSet { + public: + using Encoded = CustomCallAttrEncoding::Encoded; + + // Finds matching attribute encoding and tries to encode the attribute. + // Returns failure if didn't match attribute to any of the encodings. + mlir::FailureOr Encode(mlir::SymbolTable &sym_table, Globals &g, + mlir::ImplicitLocOpBuilder &b, + std::string_view name, + mlir::Attribute attr) const; + + template > + CustomCallAttrEncodingSet &Add() { + (encodings_.emplace_back(std::make_unique()), ...); + return *this; + } + + template > + CustomCallAttrEncodingSet &Add(ConstructorArg &&arg, + ConstructorArgs &&...args) { + (encodings_.emplace_back(std::make_unique(arg, args...)), ...); + return *this; + } + + private: + std::vector> encodings_; +}; + +//===----------------------------------------------------------------------===// +// A set of helper functions for packing encoding attributes. +//===----------------------------------------------------------------------===// + +// Encodes type id as an external LLVM global of type `i64`. The global name is +// defined by the type id name registry. Internally type id implemented as an +// opaque pointer (void*), and type equality check at run time is just a pointer +// comparison. All type id symbols at run time must be resolved to the type id +// instances defined in the current process. +mlir::LLVM::GlobalOp EncodeTypeId(Globals &g, mlir::ImplicitLocOpBuilder &b, + TypeID type_id); + +// Encodes string as a module global null-terminated string constant + size. We +// reuse the encoding scheme for arrays to store sting with its size, to avoid +// computing the length of the null-terminated string at run time. +mlir::LLVM::GlobalOp EncodeString(Globals &g, mlir::ImplicitLocOpBuilder &b, + std::string_view strref, + std::string_view symbol_base); + +// Encodes scalar attribute as a global constant. +mlir::LLVM::GlobalOp EncodeScalar(Globals &g, mlir::ImplicitLocOpBuilder &b, + mlir::Attribute value, + std::string_view symbol_base); + +//===----------------------------------------------------------------------===// +// A helper class to create global constants in the module. +//===----------------------------------------------------------------------===// + +class Globals { + public: + // Global value initializer that build the initialization region. + using GlobalInitializer = + std::function; + + // Global value initializer that can return failure if it can't initialize the + // global value from the given attribute. + using FailureOrGlobalInitializer = std::function; + + Globals(mlir::ModuleOp module, TypeIDNameRegistry type_id_names) + : module_(module), + sym_table_(module_), + type_id_names_(std::move(type_id_names)) {} + + // Creates a global external variable for the type id. + mlir::LLVM::GlobalOp GetOrCreate(mlir::ImplicitLocOpBuilder &b, + TypeID type_id); + + // Creates a global null-terminated string constant. + mlir::LLVM::GlobalOp GetOrCreate(mlir::ImplicitLocOpBuilder &b, + std::string_view strref, + std::string_view symbol_base); + + // Creates a global constant value from the attribute. Attribute type must be + // a valid type compatible with LLVM globals. + mlir::LLVM::GlobalOp GetOrCreate(mlir::ImplicitLocOpBuilder &b, + mlir::TypedAttr attr, + std::string_view symbol_base); + + // Creates a global constant value of the given type from the attribute, using + // optional user-provided global constant initialization. + mlir::LLVM::GlobalOp GetOrCreate( + mlir::ImplicitLocOpBuilder &b, mlir::Attribute attr, mlir::Type type, + std::string_view symbol_base, GlobalInitializer initialize = {}, + mlir::LLVM::Linkage linkage = mlir::LLVM::Linkage::Internal); + + // Creates a global constant value of the given type from the attribute, using + // optional user-provided global constant initialization. Returns failure if + // user-provided initialization failed to initialize the global value. + mlir::FailureOr TryGetOrCreate( + mlir::ImplicitLocOpBuilder &b, mlir::Attribute attr, mlir::Type type, + std::string_view symbol_base, FailureOrGlobalInitializer initialize = {}, + mlir::LLVM::Linkage linkage = mlir::LLVM::Linkage::Internal); + + // Returns the address of the global value. + static mlir::Value AddrOf(mlir::ImplicitLocOpBuilder &b, + mlir::LLVM::GlobalOp global); + + mlir::ModuleOp module() { return module_; } + + private: + // Globals key: {attribute, encoded-type, sym-name}. We can only have global + // constants of one of the LLVM types, and there could be multiple ways to + // encode an attribute as an LLVM type, e.g. strings can be stored as null + // terminated array of bytes, or a pair of string size and and array of bytes. + using Key = std::tuple; + + mlir::LLVM::GlobalOp Find(Key key); + + mlir::ModuleOp module_; + mlir::SymbolTable sym_table_; // symbol table for the `module_` + llvm::DenseMap globals_; + + // A mapping from the TypeID to the unique type name for encoding external + // globals corresponding to types ids. + TypeIDNameRegistry type_id_names_; +}; + +//===----------------------------------------------------------------------===// +// A helper class to create alloca operations for encoded arguments. +//===----------------------------------------------------------------------===// + +class EncodingAllocas; + +// We reuse allocas for encoding custom call arguments and results, because we +// potentially can have thousands of custom calls, and we do not want to +// accidentally blow up the stack size. It means that we might encode the same +// argument multiple times, but encoding is cheap (few store operations), and +// LLVM can potentially optimize them away. +// +// TODO(ezhulenev): Use `llvm.invariant.start` and `llvm.invariant.end` to mark +// encoded arguments allocas. +class Allocas { + public: + ~Allocas(); + + mlir::LLVM::AllocaOp GetOrCreate(mlir::ImplicitLocOpBuilder &b, + mlir::Type type); + + private: + friend class EncodingAllocas; + + struct TypedAllocas { + size_t offset = 0; + llvm::SmallVector allocas; + }; + + explicit Allocas(mlir::Block *block, + llvm::DenseMap *allocas); + + mlir::Block *block_; + llvm::DenseMap *allocas_; +}; + +// Mapping from basic block to allocas. +class EncodingAllocas { + public: + Allocas GetForOperation(mlir::Operation *op); + + private: + friend class Allocas; + + llvm::DenseMap> + allocas_; +}; + +//===----------------------------------------------------------------------===// +// Custom call attributes encoding. +//===----------------------------------------------------------------------===// + +// Encodes attribute using a scheme compatible with run time attributes decoding +// (see `internal::DecodedAttrs` in the custom call header file). +// +// Returns a value of `!llvm.ptr>` (void**) type pointing to the encoded +// attributes array (array of pointers). +// +// This function is used to encode: +// +// 1. Struct attributes as aggregates of nested attributes, where the order of +// attributes matches the order defined with the `AggregateAttrDef` schema +// defined below. +// +// 2. Custom call attributes, where the attributes sorted lexicographically by +// name, to be able to efficiently decode named attributes. +// +mlir::FailureOr EncodeAttributes( + mlir::SymbolTable &sym_table, Globals &g, mlir::ImplicitLocOpBuilder &b, + const CustomCallAttrEncodingSet &encoding, std::string_view symbol_base, + llvm::ArrayRef attrs); + +struct StringAttrEncoding : public CustomCallAttrEncoding { + mlir::LogicalResult Match(mlir::SymbolTable &, std::string_view, + mlir::Attribute) const final; + mlir::FailureOr Encode(mlir::SymbolTable &, Globals &, + mlir::ImplicitLocOpBuilder &, + std::string_view, + mlir::Attribute) const final; +}; + +struct ScalarAttrEncoding : public CustomCallAttrEncoding { + mlir::LogicalResult Match(mlir::SymbolTable &, std::string_view, + mlir::Attribute) const final; + mlir::FailureOr Encode(mlir::SymbolTable &, Globals &g, + mlir::ImplicitLocOpBuilder &, + std::string_view, + mlir::Attribute) const final; +}; + +struct DenseElementsAttrEncoding : public CustomCallAttrEncoding { + mlir::LogicalResult Match(mlir::SymbolTable &, std::string_view, + mlir::Attribute) const final; + mlir::FailureOr Encode(mlir::SymbolTable &, Globals &, + mlir::ImplicitLocOpBuilder &, + std::string_view, + mlir::Attribute) const final; +}; + +struct ArrayAttrEncoding : public CustomCallAttrEncoding { + mlir::LogicalResult Match(mlir::SymbolTable &, std::string_view, + mlir::Attribute) const final; + mlir::FailureOr Encode(mlir::SymbolTable &, Globals &, + mlir::ImplicitLocOpBuilder &, + std::string_view, + mlir::Attribute) const final; +}; + +struct DenseArrayAttrEncoding : public CustomCallAttrEncoding { + mlir::LogicalResult Match(mlir::SymbolTable &, std::string_view, + mlir::Attribute) const final; + mlir::FailureOr Encode(mlir::SymbolTable &, Globals &, + mlir::ImplicitLocOpBuilder &, + std::string_view, + mlir::Attribute) const final; +}; + +struct EmptyArrayAttrEncoding : public CustomCallAttrEncoding { + mlir::LogicalResult Match(mlir::SymbolTable &, std::string_view, + mlir::Attribute) const final; + mlir::FailureOr Encode(mlir::SymbolTable &, Globals &, + mlir::ImplicitLocOpBuilder &, + std::string_view, + mlir::Attribute) const final; +}; + +struct SymbolRefAttrEncoding : public CustomCallAttrEncoding { + mlir::LogicalResult Match(mlir::SymbolTable &, std::string_view, + mlir::Attribute) const final; + mlir::FailureOr Encode(mlir::SymbolTable &, Globals &, + mlir::ImplicitLocOpBuilder &, + std::string_view, + mlir::Attribute) const final; +}; + +struct UnitAttrEncoding : public CustomCallAttrEncoding { + mlir::LogicalResult Match(mlir::SymbolTable &, std::string_view, + mlir::Attribute) const final; + mlir::FailureOr Encode(mlir::SymbolTable &, Globals &, + mlir::ImplicitLocOpBuilder &, + std::string_view, + mlir::Attribute) const final; +}; + +struct DictionaryAttrEncoding : public CustomCallAttrEncoding { + mlir::LogicalResult Match(mlir::SymbolTable &, std::string_view, + mlir::Attribute) const final; + mlir::FailureOr Encode(mlir::SymbolTable &, Globals &, + mlir::ImplicitLocOpBuilder &, + std::string_view, + mlir::Attribute) const final; +}; + +// Custom call attribute encoding that encodes enums using their underlying +// scalar type. Type id is based on the enum type passed to the runtime. +// +// This encoding can convert enum types defined in the compiler (e.g. dialect +// enums defined in MLIR) to the enum types used at run time. +template +struct EnumAttrEncoding : public CustomCallAttrEncoding { + static_assert(std::is_enum::value, "must be an enum class"); + + // Convert from the compile time enum to the run time enum. + using Converter = std::function; + + EnumAttrEncoding() { + static_assert(std::is_same::value, + "requires enum converter"); + convert = [](EnumType value) { return value; }; + } + + explicit EnumAttrEncoding(Converter convert) : convert(std::move(convert)) {} + + mlir::LogicalResult Match(mlir::SymbolTable &, std::string_view, + mlir::Attribute attr) const final { + return mlir::success(attr.isa()); + } + + mlir::FailureOr Encode(mlir::SymbolTable &, Globals &g, + mlir::ImplicitLocOpBuilder &b, + std::string_view name, + mlir::Attribute attr) const final { + // Convert enum underlying integral value to an attribute. + EnumType compile_time_enum = attr.cast().getValue(); + RuntimeEnumType run_time_enum = convert(compile_time_enum); + + using T = std::underlying_type_t; + T underlying_value = static_cast(run_time_enum); + + TypeID type_id = TypeID::get>(); + mlir::Attribute underlying_attr = AsAttr(b, underlying_value); + + Encoded encoded; + encoded.name = EncodeString(g, b, name, kAttrName); + encoded.type_id = EncodeTypeId(g, b, type_id); + encoded.value = EncodeScalar(g, b, underlying_attr, kAttrValue); + + return encoded; + } + + static mlir::Attribute AsAttr(mlir::ImplicitLocOpBuilder &b, uint32_t value) { + return b.getI32IntegerAttr(value); + } + + Converter convert; +}; + +// A helper type to define `AttrType` encoding scheme. +template +struct AggregateAttrDef { + template + using Extract = T (AttrType::*)() const; + + template + using Encode = Attr (mlir::Builder::*)(T); + + template + AggregateAttrDef &Add(std::string name, Extract extract, + Encode encode) { + bindings.emplace_back([=](AttrType attr, mlir::Builder &b) { + auto encoded = std::invoke(encode, b, std::invoke(extract, attr)); + return mlir::NamedAttribute(b.getStringAttr(name), encoded); + }); + return *this; + } + + AggregateAttrDef &Add(std::string name, Extract extract) { + return Add(name, extract, &mlir::Builder::getBoolAttr); + } + + AggregateAttrDef &Add(std::string name, Extract extract) { + return Add(name, extract, &mlir::Builder::getI64IntegerAttr); + } + + AggregateAttrDef &Add(std::string name, Extract extract) { + return Add(name, extract, &mlir::Builder::getStringAttr); + } + + AggregateAttrDef &Add(std::string name, + Extract> extract) { + return Add(name, extract, &mlir::Builder::getI64TensorAttr); + } + + // A list of functions to destruct `AttrType` attribute into the aggregate + // attributes that will be used for encoding. + using Bind = std::function; + llvm::SmallVector bindings; +}; + +// Custom call attribute encoding for the user-defined attributes which encodes +// them as an aggregate of primitive attributes. It uses the encoding scheme +// compatible with the custom call attributes decoding. +template +struct AggregateAttrEncoding : public CustomCallAttrEncoding { + using AttrDef = AggregateAttrDef; + + AggregateAttrEncoding(const CustomCallAttrEncodingSet &encoding, + AttrDef attrdef) + : encoding(encoding), attrdef(std::move(attrdef)) {} + + mlir::LogicalResult Match(mlir::SymbolTable &, std::string_view, + mlir::Attribute attr) const final { + return mlir::success(attr.isa()); + } + + mlir::FailureOr Encode(mlir::SymbolTable &sym_table, Globals &g, + mlir::ImplicitLocOpBuilder &b, + std::string_view name, + mlir::Attribute attr) const final { + // Extract aggregate attributes from the user-defined attributes. + llvm::SmallVector attrs; + for (auto &bind : attrdef.bindings) + attrs.emplace_back(bind(attr.cast(), b)); + + // Encode extracted attributes as an aggregate. + auto type_id = TypeID::get>(); + auto sym = "__rt_aggregate_" + AttrType::getMnemonic(); + auto aggregate = + EncodeAttributes(sym_table, g, b, encoding, sym.str(), attrs); + if (mlir::failed(aggregate)) return mlir::failure(); + + Encoded encoded; + encoded.name = EncodeString(g, b, name, kAttrName); + encoded.type_id = EncodeTypeId(g, b, type_id); + encoded.value = *aggregate; + return encoded; + } + + const CustomCallAttrEncodingSet &encoding; + AttrDef attrdef; +}; + +//===----------------------------------------------------------------------===// +// Custom call arguments encoding. +//===----------------------------------------------------------------------===// + +// Encodes scalar arguments. +class ScalarArgEncoding : public CustomCallArgEncoding { + public: + mlir::LogicalResult Match(mlir::Value, mlir::Value) const final; + mlir::FailureOr Encode(Globals &g, Allocas &a, + mlir::ImplicitLocOpBuilder &b, mlir::Value, + mlir::Value) const final; +}; + +// Encodes custom call arguments passed as an opaque LLVM pointer (!llvm.ptr) +// using a custom type id. Default constructed encoding encodes `!rt.opaque` +// arguments using a `void*` type id. +class OpaqueArgEncoding : public CustomCallArgEncoding { + public: + OpaqueArgEncoding(); // encodes `!rt.opaque` with `void*` type id + OpaqueArgEncoding(std::function match, TypeID type_id); + + mlir::LogicalResult Match(mlir::Value, mlir::Value) const final; + mlir::FailureOr Encode(Globals &g, Allocas &a, + mlir::ImplicitLocOpBuilder &b, mlir::Value, + mlir::Value) const final; + + template + static auto Match() { + return [](mlir::Value value) { return value.getType().isa(); }; + } + + private: + std::function match_; + TypeID type_id_; +}; + +// Encodes MemRef arguments according to the (Strided)MemrefView ABI. +class MemrefArgEncoding : public CustomCallArgEncoding { + public: + mlir::LogicalResult Match(mlir::Value, mlir::Value) const final; + mlir::FailureOr Encode(Globals &g, Allocas &a, + mlir::ImplicitLocOpBuilder &b, mlir::Value, + mlir::Value) const final; +}; + +//===----------------------------------------------------------------------===// +// Custom call results encoding. +//===----------------------------------------------------------------------===// + +// Encodes scalar operands. +class ScalarRetEncoding : public CustomCallRetEncoding { + public: + mlir::LogicalResult Match(mlir::Type, mlir::Type) const final; + mlir::FailureOr Encode(Globals &g, Allocas &a, + mlir::ImplicitLocOpBuilder &b, mlir::Type, + mlir::Type) const final; + mlir::FailureOr Decode(mlir::ImplicitLocOpBuilder &b, mlir::Type, + mlir::Type, + mlir::LLVM::AllocaOp) const final; +}; + +// Encodes custom call results returned as an opaque LLVM pointer (!llvm.ptr) +// using a custom type id. Default constructed encoding encodes `!rt.opaque` +// results using a `void*` type id. +class OpaqueRetEncoding : public CustomCallRetEncoding { + public: + OpaqueRetEncoding(); // encodes `!rt.opaque` with `void*` type id + OpaqueRetEncoding(std::function match, TypeID type_id); + + mlir::LogicalResult Match(mlir::Type, mlir::Type) const final; + mlir::FailureOr Encode(Globals &g, Allocas &a, + mlir::ImplicitLocOpBuilder &b, mlir::Type, + mlir::Type) const final; + mlir::FailureOr Decode(mlir::ImplicitLocOpBuilder &b, mlir::Type, + mlir::Type, + mlir::LLVM::AllocaOp) const final; + + template + static auto Match() { + return [](mlir::Type type) { return type.isa(); }; + } + + private: + std::function match_; + TypeID type_id_; +}; + +// Encodes MemRef results according to the MemrefView ABI. +class MemrefRetEncoding : public CustomCallRetEncoding { + public: + mlir::LogicalResult Match(mlir::Type, mlir::Type) const final; + mlir::FailureOr Encode(Globals &g, Allocas &a, + mlir::ImplicitLocOpBuilder &b, mlir::Type, + mlir::Type) const final; + mlir::FailureOr Decode(mlir::ImplicitLocOpBuilder &b, mlir::Type, + mlir::Type, + mlir::LLVM::AllocaOp) const final; +}; + +class AsyncValueRetEncoding : public CustomCallRetEncoding { + public: + mlir::LogicalResult Match(mlir::Type, mlir::Type) const final; + mlir::FailureOr Encode(Globals &g, Allocas &a, + mlir::ImplicitLocOpBuilder &b, mlir::Type, + mlir::Type) const final; + mlir::FailureOr Decode(mlir::ImplicitLocOpBuilder &b, mlir::Type, + mlir::Type, + mlir::LLVM::AllocaOp) const final; +}; + +//===----------------------------------------------------------------------===// +// Default encodings for arguments, attributes and results. +//===----------------------------------------------------------------------===// + +// TODO(ezhulenev): Use `Populate...` functions for adding default encodings. + +CustomCallArgEncodingSet DefaultArgEncodings(); +CustomCallAttrEncodingSet DefaultAttrEncodings(); +CustomCallRetEncodingSet DefaultRetEncodings(); + +} // namespace runtime +} // namespace xla + +#endif // XLA_MLIR_RUNTIME_TRANSFORMS_CUSTOM_CALL_ENCODING_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/transforms/jit_compiler.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/transforms/jit_compiler.h new file mode 100644 index 0000000000000000000000000000000000000000..9da954c97ffd25e4d1087aedab34bc46b921d7a5 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/transforms/jit_compiler.h @@ -0,0 +1,206 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_MLIR_RUNTIME_TRANSFORMS_JIT_COMPILER_H_ +#define XLA_MLIR_RUNTIME_TRANSFORMS_JIT_COMPILER_H_ + +#include +#include +#include +#include +#include +#include + +#include "absl/status/status.h" +#include "absl/status/statusor.h" +#include "llvm/Support/SourceMgr.h" +#include "mlir/IR/BuiltinOps.h" // from @llvm-project +#include "mlir/IR/OwningOpRef.h" // from @llvm-project +#include "xla/mlir/runtime/transforms/calling_convention.h" +#include "xla/mlir/runtime/transforms/specialization.h" +#include "xla/mlir/runtime/transforms/type_converter.h" +#include "xla/runtime/arguments.h" +#include "xla/runtime/compiler.h" +#include "xla/runtime/constraints.h" +#include "xla/runtime/executable.h" +#include "xla/runtime/symbolic_shape.h" + +namespace xla { +namespace runtime { + +// JitCompiler manages parsing, specialization and compilation of a single XLA +// module to the XLA runtime executable. It owns the MLIR context where the +// module is created, and handlers to capture all compilation diagnostics +// messages. +// +// TODO(ezhulenev): Allow constructing JitCompiler (and JitExecutable) from the +// MLIR module directly without serializing it to string first. +class JitCompiler { + public: + using SymbolicShape = SymbolicShapesResolver::SymbolicShape; + + struct Options { + // Register dialects that are allowed in the serialized module. + std::function register_dialects; + + // Create a pass pipeline that is called whenever the compiled module + // gets specialized. This pipeline can use refined shape information and + // symbolic shape attributes to do the shape inference and canonicalization. + // + // Original input module might have an undefined calling convention (e.g. + // XLA runtime does not support unranked tensors), and specialization can be + // required as a precondition for compilation. + std::function create_specialization_pipeline; + + // Create a pass pipeline that lowers compiled module from high level + // dialects to the LLVM dialect. XLA runtime will use the LLVM ORC compiler + // API to compile the LLVM module at run time + // (https://llvm.org/docs/ORCv2.html). + // + // This compilation pipeline must export functions invocable by the runtime + // (convert them to an ABI compatible with the calling convention advertised + // to XLA through the `calling_convention` type conversion), and for + // that it usually must include `xla-rt-export-functions` pass. + std::function create_compilation_pipeline; + + // LLVM optimization level when JIT compiling a module. + llvm::CodeGenOptLevel jit_code_opt_level = llvm::CodeGenOptLevel::Default; + + // Runtime symbols binding allows to pass user-defined bindings for symbols + // at JIT compilation time, e.g. to bind type ids or custom calls. + ExecutionEngine::SymbolsBinding symbols_binding; + + // Calling convention defines an ABI for XLA runtime to call an executable. + // See `CallingConvention` documentation for details. + CallingConvention calling_convention = DefaultCallingConvention(); + + // Type converter converts MLIR types to the corresponding run-time types. + // Executable uses its own type hierarchy, parallel to MLIR's, so that it + // doesn't depend on any parts of the MLIR after compilation produces an + // executable artifact, because keeping MLIR context alive can be expensive + // in terms of memory usage. + // + // As a side effect, it allows loading AOT compiled executables from the + // object files without any dependencies on MLIR. + // + // Default type converter knows how to convert canonical MLIR types + // (memrefs, tensors, etc...). All user-defined types used at the compiled + // function boundary (arguments or results) should register a custom type + // conversion. + // + // When we compile the input IR, we first apply the `calling_convention` to + // get the MLIR function type for the exported function(s), and then we + // convert it to the corresponding run-time function type. + TypeConverter type_converter; + }; + + // Instantiates compiler from the serialized mlir source. + static absl::StatusOr> Instantiate( + Options opts, std::string_view mlir_module, + absl::Span exported); + + // Instantiates compiler from the mlir module. + static absl::StatusOr> Instantiate( + Options opts, mlir::ModuleOp mlir_module, + absl::Span exported); + + // Makes an executable from an instance of the JitCompiler. This is the end of + // life for the `JitCompiler`, it effectively converts the MLIR module + // to the executable (function pointer) using LLVM JIT code generation. + // Optional specialization identifier specifies if the compiled executable is + // a default one, or a specialization. + static absl::StatusOr Compile( + std::unique_ptr compiler, + std::string_view memory_region_name, + std::optional specialization = std::nullopt); + + // Specialize the exported function given by 'ordinal' to the arguments: + // + // - update all unknown dimensions according to the resolved symbolic shapes + // - attach symbolic shape attribute to the operands + // - sink small constants into the function body + // + // After the exported function's signature is updated, and all constant + // arguments are materialized in the function body, runs the user-provided + // specialization pipeline to optimize the module based on the new + // information in the IR. + // + // Returns an error if arguments are not compatible with the exported + // function's signature. + absl::Status Specialize(unsigned ordinal, ArgumentsRef arguments, + llvm::ArrayRef symbolic_shapes, + llvm::ArrayRef constraints, + const SpecializationListener* listener = nullptr); + + const Options& options() const { return opts_; } + + std::string_view name() const { + return module().getName().value_or(""); + } + + mlir::ModuleOp module() const { + assert(module_ && "failed to parse the mlir module"); + return *module_; + } + + size_t num_exported() const { return exported_.size(); } + + absl::Span exported() const { + return exported_; + } + + mlir::FunctionOpInterface exported(unsigned ordinal) const { + assert(exported_[ordinal] && "failed to resolve exported function"); + return exported_[ordinal]; + } + + private: + JitCompiler(Options opts, std::string_view mlir_module); + JitCompiler(Options opts, mlir::ModuleOp mlir_module); + + absl::Status ComputeOrdinalsForExportedFunctions( + absl::Span exported); + + absl::Status Error(std::string_view error) { + // TODO(ezhulenev): Pass diagnstic as a status payload. + return absl::InternalError(absl::StrCat(error, ":\n", diagnostic_)); + } + + Options opts_; + std::unique_ptr owned_context_; // set if context is owned + mlir::MLIRContext* context_; + + std::string diagnostic_; + llvm::raw_string_ostream diagnostic_os_; + + llvm::SourceMgr source_mgr_; + mlir::SourceMgrDiagnosticHandler handler_; + + mlir::OwningOpRef module_; // null if failed to parse + std::vector exported_; // empty if failed to parse + + bool specialized_; +}; + +// Adds "rt.export" with ordinal 0 to the "main" function in `module`. +// This is done by performing a run of the OrdinalAssignment pass using +// the given `mlir_context`. +absl::Status ExportMainWithOrdinal0(mlir::ModuleOp module, + mlir::MLIRContext& mlir_context); + +} // namespace runtime +} // namespace xla + +#endif // XLA_MLIR_RUNTIME_TRANSFORMS_JIT_COMPILER_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/transforms/passes.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/transforms/passes.h new file mode 100644 index 0000000000000000000000000000000000000000..8fa0918dc1ee138e6e59c8189d6b914f8451ccbd --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/transforms/passes.h @@ -0,0 +1,108 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_MLIR_RUNTIME_TRANSFORMS_PASSES_H_ +#define XLA_MLIR_RUNTIME_TRANSFORMS_PASSES_H_ + +#include +#include + +#include "mlir/IR/BuiltinOps.h" // from @llvm-project +#include "mlir/Pass/Pass.h" // from @llvm-project +#include "mlir/Transforms/DialectConversion.h" // from @llvm-project +#include "xla/mlir/runtime/ir/rt_ops.h" // IWYU pragma: keep + +namespace xla { +namespace runtime { + +#define GEN_PASS_DECL_ORDINALASSIGNMENT +#define GEN_PASS_DECL_EXPORTFUNCTIONS +#define GEN_PASS_DECL_CONVERTCUSTOMCALLS +#define GEN_PASS_DECL_CONVERTASSERTS +#define GEN_PASS_DECL_CONVERTRUNTIMETOLLVMPASS + +#include "xla/mlir/runtime/transforms/passes.h.inc" + +//===-----------------------------------------------------------------------===/ +// Transformations targeting `rt` dialect. +//===-----------------------------------------------------------------------===/ + +std::unique_ptr> +CreateOrdinalAssignmentPass(); + +std::unique_ptr> +CreateExportRuntimeFunctionsPass(); + +std::unique_ptr> +CreateConvertCustomCallsPass(); + +std::unique_ptr> +CreateAddInitializationsPass(); + +std::unique_ptr> CreateConvertAssertsPass(); + +//===-----------------------------------------------------------------------===/ +// Conversions targeting `rt` dialect. +//===-----------------------------------------------------------------------===/ + +class TypeIDNameRegistry; +class CustomCallArgEncodingSet; +class CustomCallAttrEncodingSet; +class CustomCallRetEncodingSet; + +// Extension points for converting `rt` dialect to the LLVM dialect. +// +// Runtime custom calls is an extension mechanism for enabling compiled programs +// to call into the APIs provided by the user. It relies on converting +// values and attributes to the LLVM types (structs and pointers) with a +// well-defined memory layout, so that they can be passed across the function +// boundary and safely decoded (without dependency on C++ ABI). +// +// All user-defined types (values and attributes) that are passed to the custom +// calls must define the argument or attribute encoding. +struct ConvertRuntimeToLLvmOpts { + // Register names for the TypeIDs used for encoding types of custom arguments + // and attributes. + std::function populate_type_id_names; + + // Add type conversions for user-defined types to the corresponding LLVM + // types. Conversion pass uses these extra conversions to convert arguments + // of the entrypoint function and values passed to the custom calls. Custom + // call argument encoding can further refine how values of LLVM types passed + // to the custom call handlers by passing custom encoding (see below). + std::function populate_type_conversions; + + // Add user-defined arguments encoding to the custom call lowering. + std::function populate_arg_encodings; + + // Add user-defined attributes type encoding to the custom call lowering. + std::function populate_ret_encodings; + + // Add user-defined attributes type encoding to the custom call lowering. + std::function populate_attr_encodings; +}; + +std::unique_ptr> +CreateConvertRuntimeToLLVMPass(ConvertRuntimeToLLvmOpts opts = {}); + +//===-----------------------------------------------------------------------===/ + +#define GEN_PASS_REGISTRATION +#include "xla/mlir/runtime/transforms/passes.h.inc" + +} // namespace runtime +} // namespace xla + +#endif // XLA_MLIR_RUNTIME_TRANSFORMS_PASSES_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/transforms/passes.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/transforms/passes.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..c9f453588d465d56a73726c00b22f255da686e51 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/transforms/passes.h.inc @@ -0,0 +1,776 @@ +/* Autogenerated by mlir-tblgen; don't manually edit */ + +#ifdef GEN_PASS_DECL +// Generate declarations for all passes. +#define GEN_PASS_DECL_ADDINITIALIZATIONS +#define GEN_PASS_DECL_CONVERTASSERTS +#define GEN_PASS_DECL_CONVERTCUSTOMCALLS +#define GEN_PASS_DECL_CONVERTRUNTIMETOLLVMPASS +#define GEN_PASS_DECL_EXPORTFUNCTIONS +#define GEN_PASS_DECL_ORDINALASSIGNMENT +#undef GEN_PASS_DECL +#endif // GEN_PASS_DECL + +//===----------------------------------------------------------------------===// +// AddInitializations +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_ADDINITIALIZATIONS +#undef GEN_PASS_DECL_ADDINITIALIZATIONS +#endif // GEN_PASS_DECL_ADDINITIALIZATIONS +#ifdef GEN_PASS_DEF_ADDINITIALIZATIONS +namespace impl { + +template +class AddInitializationsBase : public ::mlir::OperationPass { +public: + using Base = AddInitializationsBase; + + AddInitializationsBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + AddInitializationsBase(const AddInitializationsBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-rt-add-initializations"); + } + ::llvm::StringRef getArgument() const override { return "xla-rt-add-initializations"; } + + ::llvm::StringRef getDescription() const override { return "Add initialization custom calls"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("AddInitializations"); + } + ::llvm::StringRef getName() const override { return "AddInitializations"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(AddInitializationsBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_ADDINITIALIZATIONS +#endif // GEN_PASS_DEF_ADDINITIALIZATIONS + +//===----------------------------------------------------------------------===// +// ConvertAsserts +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTASSERTS +#undef GEN_PASS_DECL_CONVERTASSERTS +#endif // GEN_PASS_DECL_CONVERTASSERTS +#ifdef GEN_PASS_DEF_CONVERTASSERTS +namespace impl { + +template +class ConvertAssertsBase : public ::mlir::OperationPass { +public: + using Base = ConvertAssertsBase; + + ConvertAssertsBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertAssertsBase(const ConvertAssertsBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-rt-convert-asserts"); + } + ::llvm::StringRef getArgument() const override { return "xla-rt-convert-asserts"; } + + ::llvm::StringRef getDescription() const override { return "Converts asserts in exported functions to run-time errors"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertAsserts"); + } + ::llvm::StringRef getName() const override { return "ConvertAsserts"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertAssertsBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_CONVERTASSERTS +#endif // GEN_PASS_DEF_CONVERTASSERTS + +//===----------------------------------------------------------------------===// +// ConvertCustomCalls +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTCUSTOMCALLS +#undef GEN_PASS_DECL_CONVERTCUSTOMCALLS +#endif // GEN_PASS_DECL_CONVERTCUSTOMCALLS +#ifdef GEN_PASS_DEF_CONVERTCUSTOMCALLS +namespace impl { + +template +class ConvertCustomCallsBase : public ::mlir::OperationPass { +public: + using Base = ConvertCustomCallsBase; + + ConvertCustomCallsBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertCustomCallsBase(const ConvertCustomCallsBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-rt-convert-custom-calls"); + } + ::llvm::StringRef getArgument() const override { return "xla-rt-convert-custom-calls"; } + + ::llvm::StringRef getDescription() const override { return "Converts custom calls to explicit `rt.custom_call` operations"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertCustomCalls"); + } + ::llvm::StringRef getName() const override { return "ConvertCustomCalls"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertCustomCallsBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_CONVERTCUSTOMCALLS +#endif // GEN_PASS_DEF_CONVERTCUSTOMCALLS + +//===----------------------------------------------------------------------===// +// ConvertRuntimeToLLVMPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTRUNTIMETOLLVMPASS +#undef GEN_PASS_DECL_CONVERTRUNTIMETOLLVMPASS +#endif // GEN_PASS_DECL_CONVERTRUNTIMETOLLVMPASS +#ifdef GEN_PASS_DEF_CONVERTRUNTIMETOLLVMPASS +namespace impl { + +template +class ConvertRuntimeToLLVMPassBase : public ::mlir::OperationPass { +public: + using Base = ConvertRuntimeToLLVMPassBase; + + ConvertRuntimeToLLVMPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertRuntimeToLLVMPassBase(const ConvertRuntimeToLLVMPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-rt-to-llvm"); + } + ::llvm::StringRef getArgument() const override { return "xla-rt-to-llvm"; } + + ::llvm::StringRef getDescription() const override { return "Convert RT dialect to LLVM dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertRuntimeToLLVMPass"); + } + ::llvm::StringRef getName() const override { return "ConvertRuntimeToLLVMPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertRuntimeToLLVMPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_CONVERTRUNTIMETOLLVMPASS +#endif // GEN_PASS_DEF_CONVERTRUNTIMETOLLVMPASS + +//===----------------------------------------------------------------------===// +// ExportFunctions +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_EXPORTFUNCTIONS +#undef GEN_PASS_DECL_EXPORTFUNCTIONS +#endif // GEN_PASS_DECL_EXPORTFUNCTIONS +#ifdef GEN_PASS_DEF_EXPORTFUNCTIONS +namespace impl { + +template +class ExportFunctionsBase : public ::mlir::OperationPass { +public: + using Base = ExportFunctionsBase; + + ExportFunctionsBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ExportFunctionsBase(const ExportFunctionsBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-rt-export-functions"); + } + ::llvm::StringRef getArgument() const override { return "xla-rt-export-functions"; } + + ::llvm::StringRef getDescription() const override { return "Exports function(s) to Xla runtime"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ExportFunctions"); + } + ::llvm::StringRef getName() const override { return "ExportFunctions"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ExportFunctionsBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_EXPORTFUNCTIONS +#endif // GEN_PASS_DEF_EXPORTFUNCTIONS + +//===----------------------------------------------------------------------===// +// OrdinalAssignment +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_ORDINALASSIGNMENT +#undef GEN_PASS_DECL_ORDINALASSIGNMENT +#endif // GEN_PASS_DECL_ORDINALASSIGNMENT +#ifdef GEN_PASS_DEF_ORDINALASSIGNMENT +namespace impl { + +template +class OrdinalAssignmentBase : public ::mlir::OperationPass { +public: + using Base = OrdinalAssignmentBase; + + OrdinalAssignmentBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + OrdinalAssignmentBase(const OrdinalAssignmentBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-rt-ordinal-assignment"); + } + ::llvm::StringRef getArgument() const override { return "xla-rt-ordinal-assignment"; } + + ::llvm::StringRef getDescription() const override { return "Assigns ordinals to all exported functions"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("OrdinalAssignment"); + } + ::llvm::StringRef getName() const override { return "OrdinalAssignment"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(OrdinalAssignmentBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_ORDINALASSIGNMENT +#endif // GEN_PASS_DEF_ORDINALASSIGNMENT +#ifdef GEN_PASS_REGISTRATION + +//===----------------------------------------------------------------------===// +// AddInitializations Registration +//===----------------------------------------------------------------------===// + +inline void registerAddInitializations() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return xla::runtime::CreateAddInitializationsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerAddInitializationsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return xla::runtime::CreateAddInitializationsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertAsserts Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertAsserts() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return xla::runtime::CreateConvertAssertsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertAssertsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return xla::runtime::CreateConvertAssertsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertCustomCalls Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertCustomCalls() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return xla::runtime::CreateConvertCustomCallsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertCustomCallsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return xla::runtime::CreateConvertCustomCallsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertRuntimeToLLVMPass Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertRuntimeToLLVMPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::xla::runtime::CreateConvertRuntimeToLLVMPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertRuntimeToLLVMPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::xla::runtime::CreateConvertRuntimeToLLVMPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ExportFunctions Registration +//===----------------------------------------------------------------------===// + +inline void registerExportFunctions() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return xla::runtime::CreateExportRuntimeFunctionsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerExportFunctionsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return xla::runtime::CreateExportRuntimeFunctionsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// OrdinalAssignment Registration +//===----------------------------------------------------------------------===// + +inline void registerOrdinalAssignment() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return xla::runtime::CreateOrdinalAssignmentPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerOrdinalAssignmentPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return xla::runtime::CreateOrdinalAssignmentPass(); + }); +} + +//===----------------------------------------------------------------------===// +// RuntimeTransforms Registration +//===----------------------------------------------------------------------===// + +inline void registerRuntimeTransformsPasses() { + registerAddInitializations(); + registerConvertAsserts(); + registerConvertCustomCalls(); + registerConvertRuntimeToLLVMPass(); + registerExportFunctions(); + registerOrdinalAssignment(); +} +#undef GEN_PASS_REGISTRATION +#endif // GEN_PASS_REGISTRATION +// Deprecated. Please use the new per-pass macros. +#ifdef GEN_PASS_CLASSES + +template +class AddInitializationsBase : public ::mlir::OperationPass { +public: + using Base = AddInitializationsBase; + + AddInitializationsBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + AddInitializationsBase(const AddInitializationsBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-rt-add-initializations"); + } + ::llvm::StringRef getArgument() const override { return "xla-rt-add-initializations"; } + + ::llvm::StringRef getDescription() const override { return "Add initialization custom calls"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("AddInitializations"); + } + ::llvm::StringRef getName() const override { return "AddInitializations"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(AddInitializationsBase) + +protected: +}; + +template +class ConvertAssertsBase : public ::mlir::OperationPass { +public: + using Base = ConvertAssertsBase; + + ConvertAssertsBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertAssertsBase(const ConvertAssertsBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-rt-convert-asserts"); + } + ::llvm::StringRef getArgument() const override { return "xla-rt-convert-asserts"; } + + ::llvm::StringRef getDescription() const override { return "Converts asserts in exported functions to run-time errors"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertAsserts"); + } + ::llvm::StringRef getName() const override { return "ConvertAsserts"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertAssertsBase) + +protected: +}; + +template +class ConvertCustomCallsBase : public ::mlir::OperationPass { +public: + using Base = ConvertCustomCallsBase; + + ConvertCustomCallsBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertCustomCallsBase(const ConvertCustomCallsBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-rt-convert-custom-calls"); + } + ::llvm::StringRef getArgument() const override { return "xla-rt-convert-custom-calls"; } + + ::llvm::StringRef getDescription() const override { return "Converts custom calls to explicit `rt.custom_call` operations"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertCustomCalls"); + } + ::llvm::StringRef getName() const override { return "ConvertCustomCalls"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertCustomCallsBase) + +protected: +}; + +template +class ConvertRuntimeToLLVMPassBase : public ::mlir::OperationPass { +public: + using Base = ConvertRuntimeToLLVMPassBase; + + ConvertRuntimeToLLVMPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertRuntimeToLLVMPassBase(const ConvertRuntimeToLLVMPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-rt-to-llvm"); + } + ::llvm::StringRef getArgument() const override { return "xla-rt-to-llvm"; } + + ::llvm::StringRef getDescription() const override { return "Convert RT dialect to LLVM dialect"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertRuntimeToLLVMPass"); + } + ::llvm::StringRef getName() const override { return "ConvertRuntimeToLLVMPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertRuntimeToLLVMPassBase) + +protected: +}; + +template +class ExportFunctionsBase : public ::mlir::OperationPass { +public: + using Base = ExportFunctionsBase; + + ExportFunctionsBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ExportFunctionsBase(const ExportFunctionsBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-rt-export-functions"); + } + ::llvm::StringRef getArgument() const override { return "xla-rt-export-functions"; } + + ::llvm::StringRef getDescription() const override { return "Exports function(s) to Xla runtime"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ExportFunctions"); + } + ::llvm::StringRef getName() const override { return "ExportFunctions"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ExportFunctionsBase) + +protected: +}; + +template +class OrdinalAssignmentBase : public ::mlir::OperationPass { +public: + using Base = OrdinalAssignmentBase; + + OrdinalAssignmentBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + OrdinalAssignmentBase(const OrdinalAssignmentBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-rt-ordinal-assignment"); + } + ::llvm::StringRef getArgument() const override { return "xla-rt-ordinal-assignment"; } + + ::llvm::StringRef getDescription() const override { return "Assigns ordinals to all exported functions"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("OrdinalAssignment"); + } + ::llvm::StringRef getName() const override { return "OrdinalAssignment"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(OrdinalAssignmentBase) + +protected: +}; +#undef GEN_PASS_CLASSES +#endif // GEN_PASS_CLASSES diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/transforms/specialization.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/transforms/specialization.h new file mode 100644 index 0000000000000000000000000000000000000000..592a3dbd1020c9d58c88f8eff34e2f74ddf19273 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/transforms/specialization.h @@ -0,0 +1,69 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_MLIR_RUNTIME_TRANSFORMS_SPECIALIZATION_H_ +#define XLA_MLIR_RUNTIME_TRANSFORMS_SPECIALIZATION_H_ + +#include "mlir/IR/BuiltinAttributes.h" // from @llvm-project +#include "mlir/IR/Types.h" // from @llvm-project +#include "mlir/Interfaces/FunctionInterfaces.h" // from @llvm-project +#include "xla/runtime/arguments.h" +#include "xla/runtime/constraints.h" +#include "xla/runtime/symbolic_shape.h" + +namespace xla { +namespace runtime { + +// TODO(ezhulenev): A lot of specialization code is written with an assumption +// that we can only specialize Tensor arguments. Make this extendable +// to support user-defined types and user-defined specializations. + +// Symbolic shape attached to the argument as a dense i64 array attribute. +// TODO(ezhulenev): Change symbolic shape attribute type to match the comment. +constexpr const char* kSymbolicShapeAttrName = "rt.symbolic_shape"; + +// Listener class to control notifications during specialization. +struct SpecializationListener { + virtual ~SpecializationListener() {} + + // Called at the end of module specialization. + // - 'operands' is a reference to the specialized operands' types. + // - `attrs` is a list of attributes attached to operands. + virtual void notifyModuleSpecialized( + llvm::ArrayRef operands, + llvm::ArrayRef attrs) const {} + + // Called once for every value-specialized argument. + virtual void notifyValueSpecialized(unsigned index, mlir::Type type, + mlir::Attribute value) const {} +}; + +// Specializes function to the runtime arguments: +// +// - updates all unknown dimensions according to the resolved symbolic shapes +// - attaches symbolic shape attribute to the operands +// - for value-specialized operands sinks small constants into the function body +// +// Returns error if arguments are not compatible with the function signature. +absl::Status SpecializeFunction( + mlir::FunctionOpInterface func, ArgumentsRef arguments, + llvm::ArrayRef symbolic_shapes, + llvm::ArrayRef constraints, + const SpecializationListener* listener = nullptr); + +} // namespace runtime +} // namespace xla + +#endif // XLA_MLIR_RUNTIME_TRANSFORMS_SPECIALIZATION_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/transforms/type_converter.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/transforms/type_converter.h new file mode 100644 index 0000000000000000000000000000000000000000..2c99b81fa8b1d08c40055abf6d7e42b4d6192d5d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/transforms/type_converter.h @@ -0,0 +1,87 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_MLIR_RUNTIME_TRANSFORMS_TYPE_CONVERTER_H_ +#define XLA_MLIR_RUNTIME_TRANSFORMS_TYPE_CONVERTER_H_ + +#include +#include + +#include "absl/status/statusor.h" +#include "mlir/IR/BuiltinTypes.h" // from @llvm-project +#include "xla/runtime/types.h" + +namespace xla { +namespace runtime { + +//===----------------------------------------------------------------------===// +// Type conversion from the compile time types to the run-time types. +//===----------------------------------------------------------------------===// + +// Type converter converts MLIR types known at compile time to the corresponding +// types used at run time. It provides default conversions for the canonical +// types (memrefs, tensors, etc...) and allows users to register custom +// conversions for user-defined types. +class TypeConverter { + public: + // Conversion function must return run time type corresponding to the compile + // time type if the conversion is successful, or `nullptr` if failed. + using ConversionFn = std::function(mlir::Type)>; + + TypeConverter() = default; + + template + explicit TypeConverter(Fns&&... fn) { + (AddConversion(std::forward(fn)), ...); + } + + // Adds a type conversion function with a type predicate. + // + // Example: + // + // AddConversion([](mlir::TensorType) -> std::unique_ptr { ... }); + // + // The conversion function will match only the tensor type, and return empty + // result for all other types, and the type converter will try the next + // conversion function (see `Convert` implementation). + template > + void AddConversion(Fn&& fn) { + using ArgType = typename FnTraits::template arg_t<0>; + conversions_.emplace_back( + [fn = std::forward(fn)](mlir::Type type) -> std::unique_ptr { + if (auto arg = type.dyn_cast()) return fn(arg); + return {}; + }); + } + + // Converts MLIR element type to the PrimitiveType. + static absl::StatusOr ConvertElementType(mlir::Type type); + + // Converts MLIR type to the runtime type. Returns error if conversion was not + // successful and the type has no corresponding run time type. + absl::StatusOr> Convert(mlir::Type type) const; + + // Converts MLIR function type to the runtime function type. Returns error if + // function has unsupported operands or results types. + absl::StatusOr Convert(mlir::FunctionType type) const; + + private: + llvm::SmallVector conversions_; +}; + +} // namespace runtime +} // namespace xla + +#endif // XLA_MLIR_RUNTIME_TRANSFORMS_TYPE_CONVERTER_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/utils/async_runtime_api.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/utils/async_runtime_api.h new file mode 100644 index 0000000000000000000000000000000000000000..a07b4640f1eb31fa11c8839a143783cfff3dc913 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/utils/async_runtime_api.h @@ -0,0 +1,60 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_MLIR_RUNTIME_UTILS_ASYNC_RUNTIME_API_H_ +#define XLA_MLIR_RUNTIME_UTILS_ASYNC_RUNTIME_API_H_ + +#include "absl/functional/any_invocable.h" +#include "llvm/ExecutionEngine/Orc/Core.h" +#include "llvm/ExecutionEngine/Orc/Mangling.h" +#include "xla/runtime/async_runtime.h" +#include "tfrt/concurrency/async_value_ref.h" // from @tf_runtime +#include "tfrt/concurrency/chain.h" // from @tf_runtime + +namespace xla { +namespace runtime { + +// Converts MLIR Async Runtime token into the TFRT async chain, and drops the +// reference count on the token. +tsl::AsyncValueRef ConvertAsyncTokenToChain( + AsyncRuntime::Token* token); + +// Extracts a payload from the MLIR Async Runtime `value` and emplaces it into +// the TFRT async value `dst` using a user provided emplace function. Drops the +// reference on the runtime value after it is no longer needed. +void ExtractAsyncValue( + AsyncRuntime::Value* value, tsl::AsyncValue* dst, + absl::AnyInvocable emplace_fn); + +// A version of the `ExtractAsyncValue` function defined above that takes an +// additional opaque pointer that will be passed to the emplace function when +// async value will become ready. It is the caller responsibility to ensure that +// the pointed object will stay alive. +void ExtractAsyncValue( + AsyncRuntime::Value* value, tsl::AsyncValue* dst, void* context, + llvm::function_ref emplace_fn); + +// Builds a symbol map from the Async Runtime API functions. +llvm::orc::SymbolMap AsyncRuntimeApiSymbolMap( + llvm::orc::MangleAndInterner mangle); + +// TODO(ezhulenev): This should not be a part of async runtime api library. +llvm::orc::SymbolMap AsyncRuntimeMemoryAllocationSymbolMap( + llvm::orc::MangleAndInterner mangle); + +} // namespace runtime +} // namespace xla + +#endif // XLA_MLIR_RUNTIME_UTILS_ASYNC_RUNTIME_API_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/utils/c_runner_utils.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/utils/c_runner_utils.h new file mode 100644 index 0000000000000000000000000000000000000000..7a7910c141ab2d31bf74ef93d685542b4de68db0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/utils/c_runner_utils.h @@ -0,0 +1,48 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_MLIR_RUNTIME_UTILS_C_RUNNER_UTILS_H_ +#define XLA_MLIR_RUNTIME_UTILS_C_RUNNER_UTILS_H_ + +#include + +#include "llvm/ExecutionEngine/Orc/Core.h" +#include "llvm/ExecutionEngine/Orc/Mangling.h" +#include "mlir/ExecutionEngine/CRunnerUtils.h" // from @llvm-project + +namespace xla { +namespace runtime { + +inline llvm::orc::SymbolMap CRunnerUtilsSymbolMap( + llvm::orc::MangleAndInterner mangle) { + llvm::orc::SymbolMap symbol_map; + + auto bind = [&](std::string_view name, auto symbol_ptr) { + symbol_map[mangle(name)] = {llvm::orc::ExecutorAddr::fromPtr(symbol_ptr), + llvm::JITSymbolFlags()}; + }; + +#ifndef _WIN32 + // TODO(b/246980307): fails to link on windows because it's marked dllimport. + bind("memrefCopy", &memrefCopy); +#endif + + return symbol_map; +} + +} // namespace runtime +} // namespace xla + +#endif // XLA_MLIR_RUNTIME_UTILS_C_RUNNER_UTILS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/utils/constraints.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/utils/constraints.h new file mode 100644 index 0000000000000000000000000000000000000000..99cd314cfac38f365a405543a531a663911ce53d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/utils/constraints.h @@ -0,0 +1,49 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_MLIR_RUNTIME_UTILS_CONSTRAINTS_H_ +#define XLA_MLIR_RUNTIME_UTILS_CONSTRAINTS_H_ + +#include "absl/status/statusor.h" +#include "mlir/IR/BuiltinTypes.h" // from @llvm-project +#include "mlir/Interfaces/FunctionInterfaces.h" // from @llvm-project +#include "xla/runtime/constraints.h" + +namespace xla { +namespace runtime { +// Returns arguments constraints inferred from the function signature. +absl::StatusOr> GetArgumentsConstraints( + mlir::FunctionOpInterface func); + +// Resolves argument constraint based on the argument type, if constraint is +// fully satisfied by the type, returns `kResolved`. +absl::StatusOr ResolveArgumentConstraint( + ArgumentConstraint constraint, mlir::Type type); + +// Returns true iff the value of given type can be sunk into the function body +// at run time via value specialization. +inline bool SupportsValueSpecialization(mlir::Type type) { + // TODO(ezhulenev): Add support for sinking `memref` values once the value + // specialization will support it. + mlir::TensorType tensor = type.dyn_cast(); + return tensor && (tensor.getRank() == 0 || tensor.getRank() == 1) && + (tensor.getElementType().isInteger(32) || + tensor.getElementType().isInteger(64)); +} + +} // namespace runtime +} // namespace xla + +#endif // XLA_MLIR_RUNTIME_UTILS_CONSTRAINTS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/utils/custom_calls.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/utils/custom_calls.h new file mode 100644 index 0000000000000000000000000000000000000000..1b50fda35390b2f9e127f2e99577392d62782713 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/utils/custom_calls.h @@ -0,0 +1,74 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_MLIR_RUNTIME_UTILS_CUSTOM_CALLS_H_ +#define XLA_MLIR_RUNTIME_UTILS_CUSTOM_CALLS_H_ + +#include +#include + +#include "llvm/ADT/StringRef.h" +#include "mlir/Dialect/Func/IR/FuncOps.h" // from @llvm-project +#include "mlir/IR/Attributes.h" // from @llvm-project +#include "mlir/IR/BuiltinAttributes.h" // from @llvm-project +#include "mlir/IR/BuiltinTypes.h" // from @llvm-project +#include "mlir/IR/ImplicitLocOpBuilder.h" // from @llvm-project +#include "mlir/IR/SymbolTable.h" // from @llvm-project +#include "mlir/IR/TypeRange.h" // from @llvm-project + +namespace xla { +namespace runtime { + +// A helper class to create XLA runtime custom call declarations in the given +// symbol table. This class ensures that for each unique combination of the +// custom call target and function signature we create exaclty one custom call +// funcation declaration. +class CustomCallDeclarations { + public: + explicit CustomCallDeclarations(mlir::SymbolTable sym_table); + + // Returns existing custom call declaration or creates a new one. + mlir::func::FuncOp GetOrCreate(mlir::ImplicitLocOpBuilder& b, + llvm::StringRef target, + mlir::FunctionType type); + + // Returns existing custom call declaration or creates a new one with a + // function type constructed from `inputs` and `results`. + mlir::func::FuncOp GetOrCreate(mlir::ImplicitLocOpBuilder& b, + llvm::StringRef target, mlir::TypeRange inputs, + mlir::TypeRange results); + + // Returns existing custom call declaration or creates a new one with a + // function type constructed from the `op` operands and results. + mlir::func::FuncOp GetOrCreate(mlir::ImplicitLocOpBuilder& b, + llvm::StringRef target, mlir::Operation* op); + + mlir::SymbolTable& sym_table() { return sym_table_; } + + private: + mlir::SymbolTable sym_table_; + + using Key = std::pair; + llvm::DenseMap custom_calls_; +}; + +// Appends all attributes from the list to the operation. +void AppendCustomCallAttrs(mlir::Operation* op, + llvm::ArrayRef attrs); + +} // namespace runtime +} // namespace xla + +#endif // XLA_MLIR_RUNTIME_UTILS_CUSTOM_CALLS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/utils/float_16bits.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/utils/float_16bits.h new file mode 100644 index 0000000000000000000000000000000000000000..51b5ac419cb5bd8a015e0c4ff0db96aa22d8be13 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/runtime/utils/float_16bits.h @@ -0,0 +1,51 @@ +/* Copyright 2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_MLIR_RUNTIME_UTILS_FLOAT_16BITS_H_ +#define XLA_MLIR_RUNTIME_UTILS_FLOAT_16BITS_H_ + +#include + +#include "llvm/ExecutionEngine/Orc/Core.h" +#include "llvm/ExecutionEngine/Orc/Mangling.h" + +// Provided by compiler-rt and MLIR. +// Converts an F32 value to a BF16. +extern "C" uint16_t __truncsfbf2(float); +// Converts an F64 value to a BF16. +extern "C" uint16_t __truncdfbf2(double); + +namespace xla { +namespace runtime { + +inline llvm::orc::SymbolMap Float16bitsSymbolMap( + llvm::orc::MangleAndInterner mangle) { + llvm::orc::SymbolMap symbol_map; + + auto bind = [&](std::string_view name, auto symbol_ptr) { + symbol_map[mangle(name)] = {llvm::orc::ExecutorAddr::fromPtr(symbol_ptr), + llvm::JITSymbolFlags()}; + }; + + bind("__truncsfbf2", &__truncsfbf2); + bind("__truncdfbf2", &__truncdfbf2); + + return symbol_map; +} + +} // namespace runtime +} // namespace xla + +#endif // XLA_MLIR_RUNTIME_UTILS_FLOAT_16BITS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/utils/error_util.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/utils/error_util.h new file mode 100644 index 0000000000000000000000000000000000000000..ddf85ec63fdb6630625bcb417f58a7fdb55d156d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/utils/error_util.h @@ -0,0 +1,72 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef XLA_MLIR_UTILS_ERROR_UTIL_H_ +#define XLA_MLIR_UTILS_ERROR_UTIL_H_ + +#include + +#include "absl/status/status.h" +#include "llvm/Support/SourceMgr.h" +#include "llvm/Support/raw_ostream.h" +#include "mlir/IR/Diagnostics.h" // from @llvm-project +#include "mlir/IR/Location.h" // from @llvm-project +#include "mlir/IR/MLIRContext.h" // from @llvm-project + +// Error utilities for MLIR when interacting with code using Status returns. +namespace mlir { +// Diagnostic handler that collects all the diagnostics reported and can +// produce a Status to return to callers. This is for the case where MLIR +// functions are called from a function that will return a Status: MLIR code +// still uses the default error reporting, and the final return function can +// return the Status constructed from the diagnostics collected. +class BaseScopedDiagnosticHandler : public SourceMgrDiagnosticHandler { + public: + explicit BaseScopedDiagnosticHandler(MLIRContext* context, + bool propagate = false, + bool filter_stack = false); + // On destruction error consumption is verified. + ~BaseScopedDiagnosticHandler(); + // Returns whether any errors were reported. + bool ok() const; + + // Returns Status corresponding to the diagnostics reported. This consumes + // the diagnostics reported and returns a Status of type Unknown. It is + // required to consume the error status, if there is one, before destroying + // the object. + absl::Status ConsumeStatus(); + + // Returns the combination of the passed in status and consumed diagnostics. + // This consumes the diagnostics reported and either appends the diagnostics + // to the error message of 'status' (if 'status' is already an error state), + // or returns an Unknown status (if diagnostics reported), otherwise OK. + absl::Status Combine(absl::Status status); + + protected: + LogicalResult handler(Diagnostic* diag); + + // String stream to assemble the final error message. + std::string diag_str_; + llvm::raw_string_ostream diag_stream_; + + // A SourceMgr to use for the base handler class. + llvm::SourceMgr source_mgr_; + + // Whether to propagate diagnostics to the old diagnostic handler. + bool propagate_; +}; +} // namespace mlir + +#endif // XLA_MLIR_UTILS_ERROR_UTIL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/xla_cpu/ir/xla_cpu.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/xla_cpu/ir/xla_cpu.h new file mode 100644 index 0000000000000000000000000000000000000000..17197dfe1c5c2f8c1ec64accb3534fd3b5a08f6b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/xla_cpu/ir/xla_cpu.h @@ -0,0 +1,38 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +// This file defines the operations and types used in the XLAFramework dialect. +// +#ifndef XLA_MLIR_XLA_CPU_IR_XLA_CPU_H_ +#define XLA_MLIR_XLA_CPU_IR_XLA_CPU_H_ + +#include "mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h" // from @llvm-project +#include "mlir/IR/Attributes.h" // from @llvm-project +#include "mlir/IR/BuiltinTypes.h" // from @llvm-project +#include "mlir/IR/Dialect.h" // from @llvm-project +#include "mlir/IR/MLIRContext.h" // from @llvm-project +#include "mlir/IR/OpDefinition.h" // from @llvm-project +#include "mlir/IR/OpImplementation.h" // from @llvm-project +#include "mlir/Interfaces/InferTypeOpInterface.h" // from @llvm-project + +#define GET_OP_CLASSES +#include "xla/mlir/xla_cpu/ir/xla_cpu.h.inc" +#include "xla/mlir/xla_cpu/ir/xla_cpu_dialect.h.inc" +#include "xla/mlir/xla_cpu/ir/xla_cpu_enums.h.inc" +#define GET_ATTRDEF_CLASSES +#include "xla/mlir/xla_cpu/ir/xla_cpu_attrdefs.h.inc" +#undef GET_OP_CLASSES + +#endif // XLA_MLIR_XLA_CPU_IR_XLA_CPU_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/xla_cpu/ir/xla_cpu.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/xla_cpu/ir/xla_cpu.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..27e64b9788908511baba86881ac4f4d925e147e8 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/xla_cpu/ir/xla_cpu.h.inc @@ -0,0 +1,2028 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: xla_cpu_ops.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#if defined(GET_OP_CLASSES) || defined(GET_OP_FWD_DEFINES) +#undef GET_OP_FWD_DEFINES +namespace mlir { +namespace xla_cpu { +class AddDependencyOp; +} // namespace xla_cpu +} // namespace mlir +namespace mlir { +namespace xla_cpu { +class AllReduceOp; +} // namespace xla_cpu +} // namespace mlir +namespace mlir { +namespace xla_cpu { +class AllToAllOp; +} // namespace xla_cpu +} // namespace mlir +namespace mlir { +namespace xla_cpu { +class CollectivePermuteOp; +} // namespace xla_cpu +} // namespace mlir +namespace mlir { +namespace xla_cpu { +class ConvolutionOp; +} // namespace xla_cpu +} // namespace mlir +namespace mlir { +namespace xla_cpu { +class FftOp; +} // namespace xla_cpu +} // namespace mlir +namespace mlir { +namespace xla_cpu { +class InfeedOp; +} // namespace xla_cpu +} // namespace mlir +namespace mlir { +namespace xla_cpu { +class MemRefElementCastOp; +} // namespace xla_cpu +} // namespace mlir +namespace mlir { +namespace xla_cpu { +class OutfeedOp; +} // namespace xla_cpu +} // namespace mlir +namespace mlir { +namespace xla_cpu { +class PartitionIdOp; +} // namespace xla_cpu +} // namespace mlir +namespace mlir { +namespace xla_cpu { +class ReplicaIdOp; +} // namespace xla_cpu +} // namespace mlir +namespace mlir { +namespace xla_cpu { +class RngBitGeneratorOp; +} // namespace xla_cpu +} // namespace mlir +#endif + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace xla_cpu { + +//===----------------------------------------------------------------------===// +// ::mlir::xla_cpu::AddDependencyOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AddDependencyOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AddDependencyOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AddDependencyOpGenericAdaptorBase(AddDependencyOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AddDependencyOpGenericAdaptor : public detail::AddDependencyOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AddDependencyOpGenericAdaptorBase; +public: + AddDependencyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AddDependencyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AddDependencyOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AddDependencyOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + ValueT getToken() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AddDependencyOpAdaptor : public AddDependencyOpGenericAdaptor<::mlir::ValueRange> { +public: + using AddDependencyOpGenericAdaptor::AddDependencyOpGenericAdaptor; + AddDependencyOpAdaptor(AddDependencyOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AddDependencyOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::bufferization::BufferizableOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AddDependencyOpAdaptor; + template + using GenericAdaptor = AddDependencyOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("xla_cpu.add_dependency"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getOperand(); + ::mlir::Value getToken(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::OpOperand &getTokenMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value operand, ::mlir::Value token); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value token); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +public: + // Declarations for BufferizableOpInterface: + bool bufferizesToMemoryRead(OpOperand &opOperand, + const bufferization::AnalysisState &state) { + return opOperand.getOperandNumber() == 0; + } + bool bufferizesToMemoryWrite(OpOperand &opOperand, + const bufferization::AnalysisState &state) { + return false; + } + bufferization::AliasingValueList getAliasingValues( + OpOperand &opOperand, const bufferization::AnalysisState &state) { + if (opOperand.getOperandNumber() == 0 || opOperand.getOperandNumber() == 1) + return {}; + return {{getOperation()->getOpResult(0), + bufferization::BufferRelation::Unknown, /*isDefinite=*/false}}; + } + LogicalResult bufferize(RewriterBase &rewriter, + const bufferization::BufferizationOptions &options); +}; +} // namespace xla_cpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::xla_cpu::AddDependencyOp) + +namespace mlir { +namespace xla_cpu { + +//===----------------------------------------------------------------------===// +// ::mlir::xla_cpu::AllReduceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AllReduceOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AllReduceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AllReduceOpGenericAdaptorBase(AllReduceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getReplicaGroupsAttr(); + ::mlir::DenseIntElementsAttr getReplicaGroups(); + ::mlir::IntegerAttr getChannelHandleAttr(); + uint64_t getChannelHandle(); + ::mlir::IntegerAttr getUseGlobalDeviceIdsAttr(); + uint32_t getUseGlobalDeviceIds(); + ::mlir::IntegerAttr getReductionKindAttr(); + ::llvm::APInt getReductionKind(); +}; +} // namespace detail +template +class AllReduceOpGenericAdaptor : public detail::AllReduceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AllReduceOpGenericAdaptorBase; +public: + AllReduceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AllReduceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AllReduceOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AllReduceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperand() { + return getODSOperands(0); + } + + RangeT getDsts() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AllReduceOpAdaptor : public AllReduceOpGenericAdaptor<::mlir::ValueRange> { +public: + using AllReduceOpGenericAdaptor::AllReduceOpGenericAdaptor; + AllReduceOpAdaptor(AllReduceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AllReduceOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = AllReduceOpAdaptor; + template + using GenericAdaptor = AllReduceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("channel_handle"), ::llvm::StringRef("reduction_kind"), ::llvm::StringRef("replica_groups"), ::llvm::StringRef("use_global_device_ids")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getChannelHandleAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getChannelHandleAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getReductionKindAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getReductionKindAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getReplicaGroupsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getReplicaGroupsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getUseGlobalDeviceIdsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getUseGlobalDeviceIdsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("xla_cpu.all_reduce"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getOperand(); + ::mlir::Operation::operand_range getDsts(); + ::mlir::MutableOperandRange getOperandMutable(); + ::mlir::MutableOperandRange getDstsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::DenseIntElementsAttr getReplicaGroupsAttr(); + ::mlir::DenseIntElementsAttr getReplicaGroups(); + ::mlir::IntegerAttr getChannelHandleAttr(); + uint64_t getChannelHandle(); + ::mlir::IntegerAttr getUseGlobalDeviceIdsAttr(); + uint32_t getUseGlobalDeviceIds(); + ::mlir::IntegerAttr getReductionKindAttr(); + ::llvm::APInt getReductionKind(); + void setReplicaGroupsAttr(::mlir::DenseIntElementsAttr attr); + void setChannelHandleAttr(::mlir::IntegerAttr attr); + void setChannelHandle(uint64_t attrValue); + void setUseGlobalDeviceIdsAttr(::mlir::IntegerAttr attr); + void setUseGlobalDeviceIds(uint32_t attrValue); + void setReductionKindAttr(::mlir::IntegerAttr attr); + void setReductionKind(::llvm::APInt attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::mlir::ValueRange operand, ::mlir::ValueRange dsts, ::mlir::DenseIntElementsAttr replica_groups, ::mlir::IntegerAttr channel_handle, ::mlir::IntegerAttr use_global_device_ids, ::mlir::IntegerAttr reduction_kind); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::mlir::ValueRange operand, ::mlir::ValueRange dsts, ::mlir::DenseIntElementsAttr replica_groups, uint64_t channel_handle, uint32_t use_global_device_ids, ::llvm::APInt reduction_kind); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Declarations for BufferizableOpInterface: + bool bufferizesToMemoryRead(OpOperand &opOperand, + const bufferization::AnalysisState &state); + bool bufferizesToMemoryWrite(OpOperand &opOperand, + const bufferization::AnalysisState &state); + bufferization::AliasingValueList getAliasingValues( + OpOperand &opOperand, const bufferization::AnalysisState &state); + LogicalResult bufferize(RewriterBase &rewriter, + const bufferization::BufferizationOptions &options); +}; +} // namespace xla_cpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::xla_cpu::AllReduceOp) + +namespace mlir { +namespace xla_cpu { + +//===----------------------------------------------------------------------===// +// ::mlir::xla_cpu::AllToAllOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AllToAllOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AllToAllOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AllToAllOpGenericAdaptorBase(AllToAllOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getReplicaGroupsAttr(); + ::mlir::DenseIntElementsAttr getReplicaGroups(); + ::mlir::IntegerAttr getChannelIdPresentAttr(); + uint32_t getChannelIdPresent(); + ::mlir::IntegerAttr getOpIdAttr(); + uint64_t getOpId(); + ::mlir::IntegerAttr getSplitDimensionAttr(); + ::std::optional getSplitDimension(); + ::mlir::IntegerAttr getConcatDimensionAttr(); + ::std::optional getConcatDimension(); + ::mlir::IntegerAttr getSplitCountAttr(); + ::std::optional getSplitCount(); +}; +} // namespace detail +template +class AllToAllOpGenericAdaptor : public detail::AllToAllOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AllToAllOpGenericAdaptorBase; +public: + AllToAllOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AllToAllOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AllToAllOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AllToAllOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperand() { + return getODSOperands(0); + } + + RangeT getDst() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AllToAllOpAdaptor : public AllToAllOpGenericAdaptor<::mlir::ValueRange> { +public: + using AllToAllOpGenericAdaptor::AllToAllOpGenericAdaptor; + AllToAllOpAdaptor(AllToAllOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AllToAllOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = AllToAllOpAdaptor; + template + using GenericAdaptor = AllToAllOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("channel_id_present"), ::llvm::StringRef("concat_dimension"), ::llvm::StringRef("op_id"), ::llvm::StringRef("replica_groups"), ::llvm::StringRef("split_count"), ::llvm::StringRef("split_dimension")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getChannelIdPresentAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getChannelIdPresentAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getConcatDimensionAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getConcatDimensionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getOpIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getOpIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getReplicaGroupsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getReplicaGroupsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getSplitCountAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getSplitCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getSplitDimensionAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getSplitDimensionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("xla_cpu.all_to_all"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getOperand(); + ::mlir::Operation::operand_range getDst(); + ::mlir::MutableOperandRange getOperandMutable(); + ::mlir::MutableOperandRange getDstMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::DenseIntElementsAttr getReplicaGroupsAttr(); + ::mlir::DenseIntElementsAttr getReplicaGroups(); + ::mlir::IntegerAttr getChannelIdPresentAttr(); + uint32_t getChannelIdPresent(); + ::mlir::IntegerAttr getOpIdAttr(); + uint64_t getOpId(); + ::mlir::IntegerAttr getSplitDimensionAttr(); + ::std::optional getSplitDimension(); + ::mlir::IntegerAttr getConcatDimensionAttr(); + ::std::optional getConcatDimension(); + ::mlir::IntegerAttr getSplitCountAttr(); + ::std::optional getSplitCount(); + void setReplicaGroupsAttr(::mlir::DenseIntElementsAttr attr); + void setChannelIdPresentAttr(::mlir::IntegerAttr attr); + void setChannelIdPresent(uint32_t attrValue); + void setOpIdAttr(::mlir::IntegerAttr attr); + void setOpId(uint64_t attrValue); + void setSplitDimensionAttr(::mlir::IntegerAttr attr); + void setSplitDimension(::std::optional attrValue); + void setConcatDimensionAttr(::mlir::IntegerAttr attr); + void setConcatDimension(::std::optional attrValue); + void setSplitCountAttr(::mlir::IntegerAttr attr); + void setSplitCount(::std::optional attrValue); + ::mlir::Attribute removeSplitDimensionAttr(); + ::mlir::Attribute removeConcatDimensionAttr(); + ::mlir::Attribute removeSplitCountAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::mlir::ValueRange operand, ::mlir::ValueRange dst, ::mlir::DenseIntElementsAttr replica_groups, ::mlir::IntegerAttr channel_id_present, ::mlir::IntegerAttr op_id, /*optional*/::mlir::IntegerAttr split_dimension, /*optional*/::mlir::IntegerAttr concat_dimension, /*optional*/::mlir::IntegerAttr split_count); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::mlir::ValueRange operand, ::mlir::ValueRange dst, ::mlir::DenseIntElementsAttr replica_groups, uint32_t channel_id_present, uint64_t op_id, /*optional*/::mlir::IntegerAttr split_dimension, /*optional*/::mlir::IntegerAttr concat_dimension, /*optional*/::mlir::IntegerAttr split_count); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Declarations for BufferizableOpInterface: + bool bufferizesToMemoryRead(OpOperand &opOperand, + const bufferization::AnalysisState &state) { + return opOperand.getOperandNumber() < getNumOperands() / 2; + } + bool bufferizesToMemoryWrite(OpOperand &opOperand, + const bufferization::AnalysisState &state) { + return opOperand.getOperandNumber() >= getNumOperands() / 2; + } + bufferization::AliasingValueList getAliasingValues( + OpOperand &opOperand, const bufferization::AnalysisState &state) { + if (bufferizesToMemoryRead(opOperand, state)) return {}; + return {{getOperation()->getOpResult(opOperand.getOperandNumber() - getNumOperands() / 2), + bufferization::BufferRelation::Equivalent}}; + } + LogicalResult bufferize(RewriterBase &rewriter, + const bufferization::BufferizationOptions &options); +}; +} // namespace xla_cpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::xla_cpu::AllToAllOp) + +namespace mlir { +namespace xla_cpu { + +//===----------------------------------------------------------------------===// +// ::mlir::xla_cpu::CollectivePermuteOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CollectivePermuteOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CollectivePermuteOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CollectivePermuteOpGenericAdaptorBase(CollectivePermuteOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getSourceTargetPairsAttr(); + ::mlir::DenseIntElementsAttr getSourceTargetPairs(); + ::mlir::IntegerAttr getChannelHandleAttr(); + uint64_t getChannelHandle(); +}; +} // namespace detail +template +class CollectivePermuteOpGenericAdaptor : public detail::CollectivePermuteOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CollectivePermuteOpGenericAdaptorBase; +public: + CollectivePermuteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CollectivePermuteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CollectivePermuteOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CollectivePermuteOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + ValueT getDst() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CollectivePermuteOpAdaptor : public CollectivePermuteOpGenericAdaptor<::mlir::ValueRange> { +public: + using CollectivePermuteOpGenericAdaptor::CollectivePermuteOpGenericAdaptor; + CollectivePermuteOpAdaptor(CollectivePermuteOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CollectivePermuteOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::bufferization::BufferizableOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CollectivePermuteOpAdaptor; + template + using GenericAdaptor = CollectivePermuteOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("channel_handle"), ::llvm::StringRef("source_target_pairs")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getChannelHandleAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getChannelHandleAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getSourceTargetPairsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getSourceTargetPairsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("xla_cpu.collective_permute"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::ShapedType> getOperand(); + ::mlir::TypedValue<::mlir::ShapedType> getDst(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::OpOperand &getDstMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::DenseIntElementsAttr getSourceTargetPairsAttr(); + ::mlir::DenseIntElementsAttr getSourceTargetPairs(); + ::mlir::IntegerAttr getChannelHandleAttr(); + uint64_t getChannelHandle(); + void setSourceTargetPairsAttr(::mlir::DenseIntElementsAttr attr); + void setChannelHandleAttr(::mlir::IntegerAttr attr); + void setChannelHandle(uint64_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::mlir::Value operand, ::mlir::Value dst, ::mlir::DenseIntElementsAttr source_target_pairs, ::mlir::IntegerAttr channel_handle); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::mlir::Value operand, ::mlir::Value dst, ::mlir::DenseIntElementsAttr source_target_pairs, uint64_t channel_handle); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Declarations for BufferizableOpInterface: + bool bufferizesToMemoryRead(OpOperand &opOperand, + const bufferization::AnalysisState &state) { + return opOperand.getOperandNumber() == 0; + } + bool bufferizesToMemoryWrite(OpOperand &opOperand, + const bufferization::AnalysisState &state) { + return opOperand.getOperandNumber() == 1; + } + bufferization::AliasingValueList getAliasingValues( + OpOperand &opOperand, const bufferization::AnalysisState &state) { + if (opOperand.getOperandNumber() == 0) return {}; + return {{getOperation()->getOpResult(0), + bufferization::BufferRelation::Equivalent}}; + } + LogicalResult bufferize(RewriterBase &rewriter, + const bufferization::BufferizationOptions &options); +}; +} // namespace xla_cpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::xla_cpu::CollectivePermuteOp) + +namespace mlir { +namespace xla_cpu { + +//===----------------------------------------------------------------------===// +// ::mlir::xla_cpu::ConvolutionOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConvolutionOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ConvolutionOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ConvolutionOpGenericAdaptorBase(ConvolutionOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getWindowStridesAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getWindowStrides(); + ::mlir::DenseIntElementsAttr getPaddingAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getPadding(); + ::mlir::DenseIntElementsAttr getLhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getLhsDilation(); + ::mlir::DenseIntElementsAttr getRhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getRhsDilation(); + ::mlir::DenseElementsAttr getWindowReversalAttr(); + ::std::optional< ::mlir::DenseElementsAttr > getWindowReversal(); + ::mlir::IntegerAttr getInputBatchDimensionAttr(); + uint64_t getInputBatchDimension(); + ::mlir::IntegerAttr getInputFeatureDimensionAttr(); + uint64_t getInputFeatureDimension(); + ::mlir::ArrayAttr getInputSpatialDimensionsAttr(); + ::mlir::ArrayAttr getInputSpatialDimensions(); + ::mlir::IntegerAttr getKernelInputFeatureDimensionAttr(); + uint64_t getKernelInputFeatureDimension(); + ::mlir::IntegerAttr getKernelOutputFeatureDimensionAttr(); + uint64_t getKernelOutputFeatureDimension(); + ::mlir::ArrayAttr getKernelSpatialDimensionsAttr(); + ::mlir::ArrayAttr getKernelSpatialDimensions(); + ::mlir::IntegerAttr getOutputBatchDimensionAttr(); + uint64_t getOutputBatchDimension(); + ::mlir::IntegerAttr getOutputFeatureDimensionAttr(); + uint64_t getOutputFeatureDimension(); + ::mlir::ArrayAttr getOutputSpatialDimensionsAttr(); + ::mlir::ArrayAttr getOutputSpatialDimensions(); + ::mlir::IntegerAttr getFeatureGroupCountAttr(); + uint64_t getFeatureGroupCount(); + ::mlir::IntegerAttr getBatchGroupCountAttr(); + uint64_t getBatchGroupCount(); + ::mlir::ArrayAttr getPrecisionConfigAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrecisionConfig(); +}; +} // namespace detail +template +class ConvolutionOpGenericAdaptor : public detail::ConvolutionOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConvolutionOpGenericAdaptorBase; +public: + ConvolutionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConvolutionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConvolutionOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ConvolutionOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getKernel() { + return (*getODSOperands(1).begin()); + } + + ValueT getDst() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConvolutionOpAdaptor : public ConvolutionOpGenericAdaptor<::mlir::ValueRange> { +public: + using ConvolutionOpGenericAdaptor::ConvolutionOpGenericAdaptor; + ConvolutionOpAdaptor(ConvolutionOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConvolutionOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::bufferization::BufferizableOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ConvolutionOpAdaptor; + template + using GenericAdaptor = ConvolutionOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("batch_group_count"), ::llvm::StringRef("feature_group_count"), ::llvm::StringRef("inputBatchDimension"), ::llvm::StringRef("inputFeatureDimension"), ::llvm::StringRef("inputSpatialDimensions"), ::llvm::StringRef("kernelInputFeatureDimension"), ::llvm::StringRef("kernelOutputFeatureDimension"), ::llvm::StringRef("kernelSpatialDimensions"), ::llvm::StringRef("lhs_dilation"), ::llvm::StringRef("outputBatchDimension"), ::llvm::StringRef("outputFeatureDimension"), ::llvm::StringRef("outputSpatialDimensions"), ::llvm::StringRef("padding"), ::llvm::StringRef("precision_config"), ::llvm::StringRef("rhs_dilation"), ::llvm::StringRef("window_reversal"), ::llvm::StringRef("window_strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBatchGroupCountAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBatchGroupCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getFeatureGroupCountAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getFeatureGroupCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getInputBatchDimensionAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getInputBatchDimensionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getInputFeatureDimensionAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getInputFeatureDimensionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getInputSpatialDimensionsAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getInputSpatialDimensionsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getKernelInputFeatureDimensionAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getKernelInputFeatureDimensionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getKernelOutputFeatureDimensionAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getKernelOutputFeatureDimensionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getKernelSpatialDimensionsAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getKernelSpatialDimensionsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getLhsDilationAttrName() { + return getAttributeNameForIndex(8); + } + + static ::mlir::StringAttr getLhsDilationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 8); + } + + ::mlir::StringAttr getOutputBatchDimensionAttrName() { + return getAttributeNameForIndex(9); + } + + static ::mlir::StringAttr getOutputBatchDimensionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 9); + } + + ::mlir::StringAttr getOutputFeatureDimensionAttrName() { + return getAttributeNameForIndex(10); + } + + static ::mlir::StringAttr getOutputFeatureDimensionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 10); + } + + ::mlir::StringAttr getOutputSpatialDimensionsAttrName() { + return getAttributeNameForIndex(11); + } + + static ::mlir::StringAttr getOutputSpatialDimensionsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 11); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(12); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 12); + } + + ::mlir::StringAttr getPrecisionConfigAttrName() { + return getAttributeNameForIndex(13); + } + + static ::mlir::StringAttr getPrecisionConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 13); + } + + ::mlir::StringAttr getRhsDilationAttrName() { + return getAttributeNameForIndex(14); + } + + static ::mlir::StringAttr getRhsDilationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 14); + } + + ::mlir::StringAttr getWindowReversalAttrName() { + return getAttributeNameForIndex(15); + } + + static ::mlir::StringAttr getWindowReversalAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 15); + } + + ::mlir::StringAttr getWindowStridesAttrName() { + return getAttributeNameForIndex(16); + } + + static ::mlir::StringAttr getWindowStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 16); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("xla_cpu.convolution"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::ShapedType> getInput(); + ::mlir::TypedValue<::mlir::ShapedType> getKernel(); + ::mlir::TypedValue<::mlir::ShapedType> getDst(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getKernelMutable(); + ::mlir::OpOperand &getDstMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::DenseIntElementsAttr getWindowStridesAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getWindowStrides(); + ::mlir::DenseIntElementsAttr getPaddingAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getPadding(); + ::mlir::DenseIntElementsAttr getLhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getLhsDilation(); + ::mlir::DenseIntElementsAttr getRhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getRhsDilation(); + ::mlir::DenseElementsAttr getWindowReversalAttr(); + ::std::optional< ::mlir::DenseElementsAttr > getWindowReversal(); + ::mlir::IntegerAttr getInputBatchDimensionAttr(); + uint64_t getInputBatchDimension(); + ::mlir::IntegerAttr getInputFeatureDimensionAttr(); + uint64_t getInputFeatureDimension(); + ::mlir::ArrayAttr getInputSpatialDimensionsAttr(); + ::mlir::ArrayAttr getInputSpatialDimensions(); + ::mlir::IntegerAttr getKernelInputFeatureDimensionAttr(); + uint64_t getKernelInputFeatureDimension(); + ::mlir::IntegerAttr getKernelOutputFeatureDimensionAttr(); + uint64_t getKernelOutputFeatureDimension(); + ::mlir::ArrayAttr getKernelSpatialDimensionsAttr(); + ::mlir::ArrayAttr getKernelSpatialDimensions(); + ::mlir::IntegerAttr getOutputBatchDimensionAttr(); + uint64_t getOutputBatchDimension(); + ::mlir::IntegerAttr getOutputFeatureDimensionAttr(); + uint64_t getOutputFeatureDimension(); + ::mlir::ArrayAttr getOutputSpatialDimensionsAttr(); + ::mlir::ArrayAttr getOutputSpatialDimensions(); + ::mlir::IntegerAttr getFeatureGroupCountAttr(); + uint64_t getFeatureGroupCount(); + ::mlir::IntegerAttr getBatchGroupCountAttr(); + uint64_t getBatchGroupCount(); + ::mlir::ArrayAttr getPrecisionConfigAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrecisionConfig(); + void setWindowStridesAttr(::mlir::DenseIntElementsAttr attr); + void setPaddingAttr(::mlir::DenseIntElementsAttr attr); + void setLhsDilationAttr(::mlir::DenseIntElementsAttr attr); + void setRhsDilationAttr(::mlir::DenseIntElementsAttr attr); + void setWindowReversalAttr(::mlir::DenseElementsAttr attr); + void setInputBatchDimensionAttr(::mlir::IntegerAttr attr); + void setInputBatchDimension(uint64_t attrValue); + void setInputFeatureDimensionAttr(::mlir::IntegerAttr attr); + void setInputFeatureDimension(uint64_t attrValue); + void setInputSpatialDimensionsAttr(::mlir::ArrayAttr attr); + void setKernelInputFeatureDimensionAttr(::mlir::IntegerAttr attr); + void setKernelInputFeatureDimension(uint64_t attrValue); + void setKernelOutputFeatureDimensionAttr(::mlir::IntegerAttr attr); + void setKernelOutputFeatureDimension(uint64_t attrValue); + void setKernelSpatialDimensionsAttr(::mlir::ArrayAttr attr); + void setOutputBatchDimensionAttr(::mlir::IntegerAttr attr); + void setOutputBatchDimension(uint64_t attrValue); + void setOutputFeatureDimensionAttr(::mlir::IntegerAttr attr); + void setOutputFeatureDimension(uint64_t attrValue); + void setOutputSpatialDimensionsAttr(::mlir::ArrayAttr attr); + void setFeatureGroupCountAttr(::mlir::IntegerAttr attr); + void setFeatureGroupCount(uint64_t attrValue); + void setBatchGroupCountAttr(::mlir::IntegerAttr attr); + void setBatchGroupCount(uint64_t attrValue); + void setPrecisionConfigAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeWindowStridesAttr(); + ::mlir::Attribute removePaddingAttr(); + ::mlir::Attribute removeLhsDilationAttr(); + ::mlir::Attribute removeRhsDilationAttr(); + ::mlir::Attribute removeWindowReversalAttr(); + ::mlir::Attribute removePrecisionConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::mlir::Value input, ::mlir::Value kernel, ::mlir::Value dst, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::IntegerAttr inputBatchDimension, ::mlir::IntegerAttr inputFeatureDimension, ::mlir::ArrayAttr inputSpatialDimensions, ::mlir::IntegerAttr kernelInputFeatureDimension, ::mlir::IntegerAttr kernelOutputFeatureDimension, ::mlir::ArrayAttr kernelSpatialDimensions, ::mlir::IntegerAttr outputBatchDimension, ::mlir::IntegerAttr outputFeatureDimension, ::mlir::ArrayAttr outputSpatialDimensions, ::mlir::IntegerAttr feature_group_count, ::mlir::IntegerAttr batch_group_count, /*optional*/::mlir::ArrayAttr precision_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::mlir::Value input, ::mlir::Value kernel, ::mlir::Value dst, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, uint64_t inputBatchDimension, uint64_t inputFeatureDimension, ::mlir::ArrayAttr inputSpatialDimensions, uint64_t kernelInputFeatureDimension, uint64_t kernelOutputFeatureDimension, ::mlir::ArrayAttr kernelSpatialDimensions, uint64_t outputBatchDimension, uint64_t outputFeatureDimension, ::mlir::ArrayAttr outputSpatialDimensions, uint64_t feature_group_count, uint64_t batch_group_count, /*optional*/::mlir::ArrayAttr precision_config); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 17 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Declarations for BufferizableOpInterface: + bool bufferizesToMemoryRead(OpOperand &opOperand, + const bufferization::AnalysisState &state) { + return opOperand.getOperandNumber() < 2; + } + bool bufferizesToMemoryWrite(OpOperand &opOperand, + const bufferization::AnalysisState &state) { + return opOperand.getOperandNumber() == 2; + } + bufferization::AliasingValueList getAliasingValues( + OpOperand &opOperand, const bufferization::AnalysisState &state) { + if (opOperand.getOperandNumber() < 2) return {}; + return {{getOperation()->getOpResult(0), + bufferization::BufferRelation::Equivalent}}; + } + LogicalResult bufferize(RewriterBase &rewriter, + const bufferization::BufferizationOptions &options); +}; +} // namespace xla_cpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::xla_cpu::ConvolutionOp) + +namespace mlir { +namespace xla_cpu { + +//===----------------------------------------------------------------------===// +// ::mlir::xla_cpu::FftOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FftOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FftOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FftOpGenericAdaptorBase(FftOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getFftTypeAttr(); + uint32_t getFftType(); + ::mlir::ArrayAttr getFftLengthAttr(); + ::mlir::ArrayAttr getFftLength(); +}; +} // namespace detail +template +class FftOpGenericAdaptor : public detail::FftOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FftOpGenericAdaptorBase; +public: + FftOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FftOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FftOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FftOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + ValueT getDst() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FftOpAdaptor : public FftOpGenericAdaptor<::mlir::ValueRange> { +public: + using FftOpGenericAdaptor::FftOpGenericAdaptor; + FftOpAdaptor(FftOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FftOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::bufferization::BufferizableOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FftOpAdaptor; + template + using GenericAdaptor = FftOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fft_length"), ::llvm::StringRef("fft_type")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFftLengthAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFftLengthAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getFftTypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getFftTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("xla_cpu.fft"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::ShapedType> getOperand(); + ::mlir::TypedValue<::mlir::ShapedType> getDst(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::OpOperand &getDstMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getFftTypeAttr(); + uint32_t getFftType(); + ::mlir::ArrayAttr getFftLengthAttr(); + ::mlir::ArrayAttr getFftLength(); + void setFftTypeAttr(::mlir::IntegerAttr attr); + void setFftType(uint32_t attrValue); + void setFftLengthAttr(::mlir::ArrayAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::mlir::Value operand, ::mlir::Value dst, ::mlir::IntegerAttr fft_type, ::mlir::ArrayAttr fft_length); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::mlir::Value operand, ::mlir::Value dst, uint32_t fft_type, ::mlir::ArrayAttr fft_length); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Declarations for BufferizableOpInterface: + bool bufferizesToMemoryRead(OpOperand &opOperand, + const bufferization::AnalysisState &state) { + return opOperand.getOperandNumber() == 0; + } + bool bufferizesToMemoryWrite(OpOperand &opOperand, + const bufferization::AnalysisState &state) { + return opOperand.getOperandNumber() == 1; + } + bufferization::AliasingValueList getAliasingValues( + OpOperand &opOperand, const bufferization::AnalysisState &state) { + if (opOperand.getOperandNumber() == 0) return {}; + return {{getOperation()->getOpResult(0), + bufferization::BufferRelation::Equivalent}}; + } + LogicalResult bufferize(RewriterBase &rewriter, + const bufferization::BufferizationOptions &options); +}; +} // namespace xla_cpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::xla_cpu::FftOp) + +namespace mlir { +namespace xla_cpu { + +//===----------------------------------------------------------------------===// +// ::mlir::xla_cpu::InfeedOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class InfeedOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + InfeedOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + InfeedOpGenericAdaptorBase(InfeedOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + ::mlir::ArrayAttr getLayoutAttr(); + ::std::optional< ::mlir::ArrayAttr > getLayout(); +}; +} // namespace detail +template +class InfeedOpGenericAdaptor : public detail::InfeedOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::InfeedOpGenericAdaptorBase; +public: + InfeedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + InfeedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : InfeedOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + InfeedOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getDst() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class InfeedOpAdaptor : public InfeedOpGenericAdaptor<::mlir::ValueRange> { +public: + using InfeedOpGenericAdaptor::InfeedOpGenericAdaptor; + InfeedOpAdaptor(InfeedOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class InfeedOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = InfeedOpAdaptor; + template + using GenericAdaptor = InfeedOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("layout")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getLayoutAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getLayoutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("xla_cpu.infeed"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getDst(); + ::mlir::MutableOperandRange getDstMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + ::mlir::ArrayAttr getLayoutAttr(); + ::std::optional< ::mlir::ArrayAttr > getLayout(); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::llvm::StringRef attrValue); + void setLayoutAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeLayoutAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::mlir::ValueRange dst, ::mlir::StringAttr config, /*optional*/::mlir::ArrayAttr layout); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::mlir::ValueRange dst, ::llvm::StringRef config, /*optional*/::mlir::ArrayAttr layout); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultAttrs(const ::mlir::OperationName &opName, ::mlir::NamedAttrList &attributes); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Declarations for BufferizableOpInterface: + bool bufferizesToMemoryRead(OpOperand &opOperand, + const bufferization::AnalysisState &state) { + return false; + } + bool bufferizesToMemoryWrite(OpOperand &opOperand, + const bufferization::AnalysisState &state) { + return true; + } + bufferization::AliasingValueList getAliasingValues( + OpOperand &opOperand, const bufferization::AnalysisState &state) { + return {{getOperation()->getOpResult(0), + bufferization::BufferRelation::Equivalent}}; + } + LogicalResult bufferize(RewriterBase &rewriter, + const bufferization::BufferizationOptions &options); +}; +} // namespace xla_cpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::xla_cpu::InfeedOp) + +namespace mlir { +namespace xla_cpu { + +//===----------------------------------------------------------------------===// +// ::mlir::xla_cpu::MemRefElementCastOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MemRefElementCastOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MemRefElementCastOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MemRefElementCastOpGenericAdaptorBase(MemRefElementCastOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MemRefElementCastOpGenericAdaptor : public detail::MemRefElementCastOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MemRefElementCastOpGenericAdaptorBase; +public: + MemRefElementCastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MemRefElementCastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MemRefElementCastOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MemRefElementCastOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getSrc() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MemRefElementCastOpAdaptor : public MemRefElementCastOpGenericAdaptor<::mlir::ValueRange> { +public: + using MemRefElementCastOpGenericAdaptor::MemRefElementCastOpGenericAdaptor; + MemRefElementCastOpAdaptor(MemRefElementCastOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MemRefElementCastOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::SameOperandsAndResultShape> { +public: + using Op::Op; + using Op::print; + using Adaptor = MemRefElementCastOpAdaptor; + template + using GenericAdaptor = MemRefElementCastOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("xla_cpu.memref_element_cast"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getSrc(); + ::mlir::OpOperand &getSrcMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getDst(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type dst, ::mlir::Value src); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value src); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace xla_cpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::xla_cpu::MemRefElementCastOp) + +namespace mlir { +namespace xla_cpu { + +//===----------------------------------------------------------------------===// +// ::mlir::xla_cpu::OutfeedOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class OutfeedOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + OutfeedOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + OutfeedOpGenericAdaptorBase(OutfeedOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + ::mlir::ArrayAttr getResultTypeAttr(); + ::mlir::ArrayAttr getResultType(); +}; +} // namespace detail +template +class OutfeedOpGenericAdaptor : public detail::OutfeedOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::OutfeedOpGenericAdaptorBase; +public: + OutfeedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + OutfeedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : OutfeedOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + OutfeedOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperand() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class OutfeedOpAdaptor : public OutfeedOpGenericAdaptor<::mlir::ValueRange> { +public: + using OutfeedOpGenericAdaptor::OutfeedOpGenericAdaptor; + OutfeedOpAdaptor(OutfeedOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class OutfeedOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = OutfeedOpAdaptor; + template + using GenericAdaptor = OutfeedOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config"), ::llvm::StringRef("result_type")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getResultTypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getResultTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("xla_cpu.outfeed"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getOperand(); + ::mlir::MutableOperandRange getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + ::mlir::ArrayAttr getResultTypeAttr(); + ::mlir::ArrayAttr getResultType(); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::llvm::StringRef attrValue); + void setResultTypeAttr(::mlir::ArrayAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operand, ::mlir::StringAttr config, ::mlir::ArrayAttr result_type); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operand, ::mlir::StringAttr config, ::mlir::ArrayAttr result_type); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operand, ::llvm::StringRef config, ::mlir::ArrayAttr result_type); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operand, ::llvm::StringRef config, ::mlir::ArrayAttr result_type); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultAttrs(const ::mlir::OperationName &opName, ::mlir::NamedAttrList &attributes); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Declarations for BufferizableOpInterface: + bool bufferizesToMemoryRead(OpOperand &opOperand, + const bufferization::AnalysisState &state) { + return true; + } + bool bufferizesToMemoryWrite(OpOperand &opOperand, + const bufferization::AnalysisState &state) { + return false; + } + bufferization::AliasingValueList getAliasingValues( + OpOperand &opOperand, const bufferization::AnalysisState &state) { + return {}; + } + LogicalResult bufferize(RewriterBase &rewriter, + const bufferization::BufferizationOptions &options); +}; +} // namespace xla_cpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::xla_cpu::OutfeedOp) + +namespace mlir { +namespace xla_cpu { + +//===----------------------------------------------------------------------===// +// ::mlir::xla_cpu::PartitionIdOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PartitionIdOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + PartitionIdOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + PartitionIdOpGenericAdaptorBase(PartitionIdOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class PartitionIdOpGenericAdaptor : public detail::PartitionIdOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PartitionIdOpGenericAdaptorBase; +public: + PartitionIdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PartitionIdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PartitionIdOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + PartitionIdOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PartitionIdOpAdaptor : public PartitionIdOpGenericAdaptor<::mlir::ValueRange> { +public: + using PartitionIdOpGenericAdaptor::PartitionIdOpGenericAdaptor; + PartitionIdOpAdaptor(PartitionIdOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PartitionIdOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = PartitionIdOpAdaptor; + template + using GenericAdaptor = PartitionIdOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("xla_cpu.partition_id"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); +public: +}; +} // namespace xla_cpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::xla_cpu::PartitionIdOp) + +namespace mlir { +namespace xla_cpu { + +//===----------------------------------------------------------------------===// +// ::mlir::xla_cpu::ReplicaIdOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReplicaIdOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ReplicaIdOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ReplicaIdOpGenericAdaptorBase(ReplicaIdOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ReplicaIdOpGenericAdaptor : public detail::ReplicaIdOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReplicaIdOpGenericAdaptorBase; +public: + ReplicaIdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReplicaIdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReplicaIdOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ReplicaIdOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ReplicaIdOpAdaptor : public ReplicaIdOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReplicaIdOpGenericAdaptor::ReplicaIdOpGenericAdaptor; + ReplicaIdOpAdaptor(ReplicaIdOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReplicaIdOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ReplicaIdOpAdaptor; + template + using GenericAdaptor = ReplicaIdOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("xla_cpu.replica_id"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); +public: +}; +} // namespace xla_cpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::xla_cpu::ReplicaIdOp) + +namespace mlir { +namespace xla_cpu { + +//===----------------------------------------------------------------------===// +// ::mlir::xla_cpu::RngBitGeneratorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RngBitGeneratorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RngBitGeneratorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RngBitGeneratorOpGenericAdaptorBase(RngBitGeneratorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Attribute getRngAlgorithmAttr(); + ::mlir::Attribute getRngAlgorithm(); +}; +} // namespace detail +template +class RngBitGeneratorOpGenericAdaptor : public detail::RngBitGeneratorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RngBitGeneratorOpGenericAdaptorBase; +public: + RngBitGeneratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RngBitGeneratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RngBitGeneratorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RngBitGeneratorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getState() { + return (*getODSOperands(0).begin()); + } + + ValueT getDstState() { + return (*getODSOperands(1).begin()); + } + + ValueT getDst() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RngBitGeneratorOpAdaptor : public RngBitGeneratorOpGenericAdaptor<::mlir::ValueRange> { +public: + using RngBitGeneratorOpGenericAdaptor::RngBitGeneratorOpGenericAdaptor; + RngBitGeneratorOpAdaptor(RngBitGeneratorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RngBitGeneratorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::bufferization::BufferizableOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RngBitGeneratorOpAdaptor; + template + using GenericAdaptor = RngBitGeneratorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("rng_algorithm")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getRngAlgorithmAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getRngAlgorithmAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("xla_cpu.rng_bit_generator"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::ShapedType> getState(); + ::mlir::TypedValue<::mlir::ShapedType> getDstState(); + ::mlir::TypedValue<::mlir::ShapedType> getDst(); + ::mlir::OpOperand &getStateMutable(); + ::mlir::OpOperand &getDstStateMutable(); + ::mlir::OpOperand &getDstMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Attribute getRngAlgorithmAttr(); + ::mlir::Attribute getRngAlgorithm(); + void setRngAlgorithmAttr(::mlir::Attribute attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::mlir::Value state, ::mlir::Value dst_state, ::mlir::Value dst, ::mlir::Attribute rng_algorithm); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Declarations for BufferizableOpInterface: + bool bufferizesToMemoryRead(OpOperand &opOperand, + const bufferization::AnalysisState &state) { + return opOperand.getOperandNumber() == 0; + } + bool bufferizesToMemoryWrite(OpOperand &opOperand, + const bufferization::AnalysisState &state) { + return opOperand.getOperandNumber() != 0; + } + bufferization::AliasingValueList getAliasingValues( + OpOperand &opOperand, const bufferization::AnalysisState &state) { + if (opOperand.getOperandNumber() == 0) return {}; + return {{getOperation()->getOpResult(opOperand.getOperandNumber()-1), + bufferization::BufferRelation::Equivalent}}; + } + LogicalResult bufferize(RewriterBase &rewriter, + const bufferization::BufferizationOptions &options); +}; +} // namespace xla_cpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::xla_cpu::RngBitGeneratorOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/xla_cpu/ir/xla_cpu_attrdefs.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/xla_cpu/ir/xla_cpu_attrdefs.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..79746d9a766d3bff0399c5eb3eee2e6aec9ce27d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/xla_cpu/ir/xla_cpu_attrdefs.h.inc @@ -0,0 +1,40 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* AttrDef Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_ATTRDEF_CLASSES +#undef GET_ATTRDEF_CLASSES + + +namespace mlir { +class AsmParser; +class AsmPrinter; +} // namespace mlir +namespace mlir { +namespace xla_cpu { +class ReductionKindAttr; +namespace detail { +struct ReductionKindAttrStorage; +} // namespace detail +class ReductionKindAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static ReductionKindAttr get(::mlir::MLIRContext *context, ::mlir::xla_cpu::ReductionKind value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"reduction_kind"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::xla_cpu::ReductionKind getValue() const; +}; +} // namespace xla_cpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::xla_cpu::ReductionKindAttr) + +#endif // GET_ATTRDEF_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/xla_cpu/ir/xla_cpu_dialect.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/xla_cpu/ir/xla_cpu_dialect.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..c2f82f26e914b8f98046a4b77ee437b387710705 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/xla_cpu/ir/xla_cpu_dialect.h.inc @@ -0,0 +1,26 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: xla_cpu_dialect.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace xla_cpu { + +class XlaCpuDialect : public ::mlir::Dialect { + explicit XlaCpuDialect(::mlir::MLIRContext *context); + + void initialize(); + friend class ::mlir::MLIRContext; +public: + ~XlaCpuDialect() override; + static constexpr ::llvm::StringLiteral getDialectNamespace() { + return ::llvm::StringLiteral("xla_cpu"); + } +}; +} // namespace xla_cpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::xla_cpu::XlaCpuDialect) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/xla_cpu/ir/xla_cpu_enums.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/xla_cpu/ir/xla_cpu_enums.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..ec0b11bb12a5eae440febc06fe2c2c3bf1c553ff --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir/xla_cpu/ir/xla_cpu_enums.h.inc @@ -0,0 +1,92 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Enum Utility Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: xla_cpu_enums.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace xla_cpu { +// Type of reduction to apply. +enum class ReductionKind : uint32_t { + ALL_REDUCE_SUM = 0, + ALL_REDUCE_PRODUCT = 1, + ALL_REDUCE_MIN = 2, + ALL_REDUCE_MAX = 3, +}; + +::std::optional symbolizeReductionKind(uint32_t); +::llvm::StringRef stringifyReductionKind(ReductionKind); +::std::optional symbolizeReductionKind(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForReductionKind() { + return 3; +} + + +inline ::llvm::StringRef stringifyEnum(ReductionKind enumValue) { + return stringifyReductionKind(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeReductionKind(str); +} +} // namespace xla_cpu +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::xla_cpu::ReductionKind, ::mlir::xla_cpu::ReductionKind> { + template + static FailureOr<::mlir::xla_cpu::ReductionKind> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for Type of reduction to apply."); + + // Symbolize the keyword. + if (::std::optional<::mlir::xla_cpu::ReductionKind> attr = ::mlir::xla_cpu::symbolizeEnum<::mlir::xla_cpu::ReductionKind>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid Type of reduction to apply. specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::xla_cpu::ReductionKind value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::xla_cpu::ReductionKind> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::xla_cpu::ReductionKind getEmptyKey() { + return static_cast<::mlir::xla_cpu::ReductionKind>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::xla_cpu::ReductionKind getTombstoneKey() { + return static_cast<::mlir::xla_cpu::ReductionKind>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::xla_cpu::ReductionKind &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::xla_cpu::ReductionKind &lhs, const ::mlir::xla_cpu::ReductionKind &rhs) { + return lhs == rhs; + } +}; +} + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/all_passes/deallocation/transforms/passes.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/all_passes/deallocation/transforms/passes.h new file mode 100644 index 0000000000000000000000000000000000000000..183082fc54e04d4beb3eeaa40a1b3852e466a4ac --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/all_passes/deallocation/transforms/passes.h @@ -0,0 +1,71 @@ +/* Copyright 2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef MLIR_HLO_DEALLOCATION_TRANSFORMS_PASSES_H +#define MLIR_HLO_DEALLOCATION_TRANSFORMS_PASSES_H + +#include + +#include "mlir/Conversion/LLVMCommon/TypeConverter.h" +#include "mlir/Dialect/Func/IR/FuncOps.h" +#include "mlir/IR/PatternMatch.h" +#include "mlir/Pass/Pass.h" + +namespace mlir { +namespace deallocation { + +// Pass to split bufferization.alloc_tensor ops to optimize buffer reuse. +std::unique_ptr> +createSplitAllocTensorsPass(); + +// Pass to insert deallocations (in the form of `deallocation.retain`) ops. Most +// deallocations are typically converted to `memref.dealloc` by +// canonicalization. +std::unique_ptr> createDeallocatePass(); + +// Pass to annotate ops with debug information. +std::unique_ptr> +createDeallocationAnnotationPass(); + +// Pass to annotate buffer arguments with aliasing information. +std::unique_ptr> +createXlaBufferArgRewritePass(); + +// Pass to reuse buffers (hoisting, double buffering, dealloc/alloc +// coalescing). +std::unique_ptr> +createBufferReusePass(); + +// Lowers retain to SCF. +std::unique_ptr> +createDeallocationToScfPass(); + +// Convert `deallocation` ops to LLVM. +std::unique_ptr> +createConvertDeallocationOpsToLLVM(); + +std::unique_ptr> +createDeallocationSimplificationPass(); + +void populateDeallocationToLLVMConversionPatterns(LLVMTypeConverter& converter, + RewritePatternSet& patterns); + +#define GEN_PASS_REGISTRATION +#include "deallocation/transforms/passes.h.inc" + +} // namespace deallocation +} // namespace mlir + +#endif // MLIR_HLO_DEALLOCATION_TRANSFORMS_PASSES_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/all_passes/gml_st/transforms/passes.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/all_passes/gml_st/transforms/passes.h new file mode 100644 index 0000000000000000000000000000000000000000..12b02debc705faf60b097b80bf9f522ccf10cf8c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/all_passes/gml_st/transforms/passes.h @@ -0,0 +1,251 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef MLIR_HLO_GML_ST_TRANSFORMS_PASSES_H +#define MLIR_HLO_GML_ST_TRANSFORMS_PASSES_H + +#include +#include +#include +#include + +#include "mlir/Dialect/Func/IR/FuncOps.h" +#include "mlir/Dialect/LLVMIR/LLVMDialect.h" // IWYU pragma: keep +#include "mlir/IR/BuiltinOps.h" +#include "mlir/Pass/Pass.h" + +namespace mlir::gml_st { + +#define GEN_PASS_DECL +#include "gml_st/transforms/passes.h.inc" + +/// Pass to fuse producers into a tiled consumer. +std::unique_ptr> createFusionPass( + StringRef producer = "", StringRef consumer = ""); + +/// Pass to match, tile, and fuse softmax implementations. +std::unique_ptr> createTilingSoftmaxPass( + ArrayRef tileSizes); +std::unique_ptr> createTilingSoftmaxPass(); + +/// Pass to tile the root operation and to greedily fuse producers into it. +std::unique_ptr> createGreedyFusionPass( + ArrayRef tileSizes); +std::unique_ptr> createGreedyFusionPass(); + +// Pass to collapse dimensions of bcasts, reductions, and cwise ops. +std::unique_ptr> createCollapseShapePass(); +std::unique_ptr> createCollapseShapePass( + const CollapseShapePassOptions &options); + +// Pass to tile all tileable ops to size 1. +std::unique_ptr> createTileByOnePass(); + +/// Pass to compose tensor.extract_slice/insert_slice ops. +std::unique_ptr> +createComposeExtractInsertSlicePass(); + +/// Pass to vectorize compute ops and scf.for loops that are tiled perfectly. +std::unique_ptr> createVectorizeForCPUPass( + int64_t numElementsThreshold = 1024); + +/// Pass to vectorize `memref.copy`. +std::unique_ptr> createVectorizeCopyPass( + int64_t numElementsThreshold = 8); + +/// Pass to remove redundant `memref.copy` ops. +std::unique_ptr> createNaiveCopyRemovalPass(); + +/// Pass to gradually lower vector ops to SCF. +std::unique_ptr> createLowerVectorsPass( + bool enableAVX2 = true, bool flatten = false); + +/// Pass to pack linalg.matmul as linalg.mmt4d. +std::unique_ptr> createPackMatmulPass(); + +/// Pass to transform a thlo.scatter op for CPU backend. +std::unique_ptr> createTransformScatterForCpuPass(); + +/// Pass to transform a dot operation for CPU backend. +std::unique_ptr> createTransformDotForCpuPass( + ArrayRef tileSizes = {}, StringRef cpuName = ""); + +/// Pass to transform tensor.pack/unpack ops for CPU backend. +std::unique_ptr> createTransformPackForCpuPass(); + +/// Pass to transform a linalg.mmt4d op for CPU backend. +std::unique_ptr> createTransformMmt4DForCpuPass(); + +/// Pass to fuse linalg on tensor operations. +std::unique_ptr> createFusionOfTensorOpsPass(); + +/// Pass to convert ops on tensors with 1 element to scalar ops. +std::unique_ptr> createScalarizationPass( + bool scalarizeAllThlo = true); + +/// Pass to transform elementwise ops for CPU backend. +std::unique_ptr> +createTransformElementwiseForCpuPass(int64_t vectorSize = 8, + bool fuseDegenerateReshapes = false); + +/// Pass to transform a linalg.reduce op for CPU backend. +std::unique_ptr createTransformReduceForCpuPass( + const TransformReduceForCpuPassOptions &option = {}); + +/// Pass to create fusion clusters. +std::unique_ptr> +createFusionPlanningForCpuPass(int64_t vectorSize = 8); + +/// Pass to outline fusion regions into functions. +std::unique_ptr> createFusionOutliningPass(); + +/// Pass to inline fusion clusters. +std::unique_ptr> +createInlineFusionClustersPass(); + +/// Pass with canonicalization patterns for linalg ops. +std::unique_ptr> +createOptimizeLinalgOpsPass(); + +/// Pass to rewrite tensor.from_elements into tensor.insert. +std::unique_ptr> +createRewriteFromElementsOpPass(); + +/// Pass to rewrite scf.forall to scf.for. +std::unique_ptr> +createRewriteForallOpPass(); + +/// Pass to add debug info to be propagated into LLVM backend. +std::unique_ptr> createAddDebugInfoPass(); + +/// Pass to print stats about tileable ops. +std::unique_ptr> createCollectStatsPass( + int64_t level = 0); + +/// Pass to remove all transformed labels from tiled ops. +std::unique_ptr> +createRemoveLabelPass(); + +/// Populate pattern to remove single/zero iteration scf.forall dimensions. +void populateCollapseForallOpDimensionsPattern(RewritePatternSet &patterns); + +struct GmlStCPUTilingOptions + : public mlir::PassPipelineOptions { + GmlStCPUTilingOptions() = default; + GmlStCPUTilingOptions(const GmlStCPUTilingOptions &opts) { + this->lowerToMmt4d = opts.lowerToMmt4d; + this->matmulTileSizes = opts.matmulTileSizes; + this->reduction1DTileSize = opts.reduction1DTileSize; + this->reduction1DSplitRatio = opts.reduction1DSplitRatio; + this->reduction2DParallelDimTileSize = opts.reduction2DParallelDimTileSize; + this->reduction2DReductionDimTileSize = + opts.reduction2DReductionDimTileSize; + this->vectorSize = opts.vectorSize; + this->statsDetailLevel = opts.statsDetailLevel; + this->cpuName = opts.cpuName; + this->inlineFusionClusters = opts.inlineFusionClusters; + } + + Option vectorSize{*this, "vector-size", + llvm::cl::desc("Vector size for a 1D reduction."), + llvm::cl::init(8)}; + + Option reductionEnableHeuristic{ + *this, "reduction-enable-heuristic", + llvm::cl::desc("Enable tiling parameters heuristic for reductions."), + llvm::cl::init(false)}; + + Option reduction1DTileSize{ + *this, "reduction-1d-tile-size", + llvm::cl::desc("Tile size for a 1D reduction."), llvm::cl::init(32)}; + + Option reduction1DSplitRatio{ + *this, "reduction-1d-split-ratio", + llvm::cl::desc("Ratio used to split the reduction dimension"), + llvm::cl::init(8)}; + + Option reduction2DParallelDimTileSize{ + *this, "reduction-2d-parallel-dim-tile-size", + llvm::cl::desc("Tile size for the parallel dimension of a 2D reduction."), + llvm::cl::init(4)}; + + Option reduction2DReductionDimTileSize{ + *this, "reduction-2d-reduction-dim-tile-size", + llvm::cl::desc( + "Tile size for the reduction dimension of a 2D reduction."), + llvm::cl::init(4)}; + + ListOption matmulTileSizes{ + *this, "matmul-tile-sizes", + llvm::cl::desc("Tile sizes for `linalg.matmul`. Leave empty to determine " + "sizes automatically."), + llvm::cl::list_init({}), llvm::cl::ZeroOrMore}; + + Option vectorizationSizeThreshold{ + *this, "vectorization-size-threshold", + llvm::cl::desc("Threshold size for vectorization."), llvm::cl::init(128)}; + + Option vectorizationTiledSizeThreshold{ + *this, "vectorization-tiled-size-threshold", + llvm::cl::desc("Threshold size for vectorization after tiling."), + llvm::cl::init(1024)}; + + Option lowerToMmt4d{ + *this, "lower-to-mmt4d", + llvm::cl::desc("Enable the specific code generation (packing) for matmul " + "operations."), + llvm::cl::init(false)}; + + Option cpuName{ + *this, "cpu", + llvm::cl::desc("CPU name, similar to llc's -mcpu flag. e.g. 'znver2', " + "'skylake-avx512'."), + llvm::cl::init("")}; + + Option statsDetailLevel{ + *this, "stats-detail-level", + llvm::cl::desc("Detail level for collecting IR statistics."), + llvm::cl::init(0)}; + + Option fuseDegenerateReshapes{ + *this, "fuse-degenerate-reshapes", + llvm::cl::desc("Fuse through tensor.expand/collapse_shape"), + llvm::cl::init(false)}; + + Option inlineFusionClusters{ + *this, "inline-fusion-clusters", + llvm::cl::desc("Inline fusion clusters at the end of the pipeline."), + llvm::cl::init(true)}; +}; + +// Returns default "optimized" tiling parameters. +GmlStCPUTilingOptions getDefaultCPUPipelineOptions( + StringRef cpuName, int64_t statsDetailLevel = 0); + +// Adds tiling-fusion-vectorization passes for tHLO/Linalg ops mix. +void addCPUTilingPipeline(OpPassManager &pm, + const GmlStCPUTilingOptions &options); + +// Adds tiling-fusion-vectorization passes for tHLO/Linalg ops mix with the +// "optimized" tiling parameters. +void addDefaultCPUTilingPipeline(OpPassManager &pm, StringRef cpuName, + int64_t statsDetailLevel = 0); + +#define GEN_PASS_REGISTRATION +#include "gml_st/transforms/passes.h.inc" + +} // namespace mlir::gml_st + +#endif // MLIR_HLO_GML_ST_TRANSFORMS_PASSES_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/all_passes/lhlo/transforms/passes.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/all_passes/lhlo/transforms/passes.h new file mode 100644 index 0000000000000000000000000000000000000000..8225dfa238ccf23fd62df4da5e2c812033a29a3c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/all_passes/lhlo/transforms/passes.h @@ -0,0 +1,65 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef MLIR_HLO_LHLO_TRANSFORMS_PASSES_H +#define MLIR_HLO_LHLO_TRANSFORMS_PASSES_H + +#include + +#include "llvm/ADT/ArrayRef.h" +#include "mlir/Pass/Pass.h" + +namespace mlir { + +class ModuleOp; +class Operation; +template +class OperationPass; +class Pass; +namespace func { +class FuncOp; +} // namespace func +namespace lmhlo { +class FusionOp; +} // namespace lmhlo + +namespace lmhlo { + +#define GEN_PASS_DECL +#include "lhlo/transforms/lmhlo_passes.h.inc" + +// Lowers from LHLO dialect to Affine dialect. +std::unique_ptr> createLhloLegalizeToAffinePass(); + +// Lowers from LHLO dialect to GPU dialect. +std::unique_ptr> createLegalizeToGpuPass(); + +// Lowers from LHLO dialect to parallel loops. +std::unique_ptr> +createLegalizeLhloToParallelLoopsPass(); + +// Legalizes tensor load ops that are inserted during mhlo to lmhlo conversion. +std::unique_ptr> createLegalizeToTensorOpPass(); + +// Input inline fusion pass for fusion codegen +std::unique_ptr> createInputInlineFusionPass(); + +#define GEN_PASS_REGISTRATION +#include "lhlo/transforms/lmhlo_passes.h.inc" + +} // namespace lmhlo +} // namespace mlir + +#endif // MLIR_HLO_LHLO_TRANSFORMS_PASSES_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/all_passes/mhlo/transforms/passes.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/all_passes/mhlo/transforms/passes.h new file mode 100644 index 0000000000000000000000000000000000000000..946c56ae18ab1bad1ac6995caa83cc7b6f8ba935 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/all_passes/mhlo/transforms/passes.h @@ -0,0 +1,212 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef MLIR_HLO_MHLO_TRANSFORMS_PASSES_H +#define MLIR_HLO_MHLO_TRANSFORMS_PASSES_H + +#include +#include + +#include "mlir/Pass/Pass.h" + +namespace mlir { + +class ModuleOp; +class Operation; +template +class OperationPass; +class Pass; +namespace func { +class FuncOp; +} // namespace func +namespace lmhlo { +class FusionOp; +} // namespace lmhlo + +namespace mhlo { + +#define GEN_PASS_DECL +#include "mhlo/transforms/mhlo_passes.h.inc" + +/// Lowers HLO control flow ops to SCF. +std::unique_ptr> createLegalizeControlFlowPass(); + +/// Lowers sort to SCF & arith. +std::unique_ptr> createLegalizeSortPass(); + +/// Lowers from HLO dialect to Standard dialect. +std::unique_ptr> createLegalizeToStdPass(); + +/// Lowers from the CHLO dialect to the HLO dialect. +std::unique_ptr> createChloLegalizeToHloPass( + bool legalizeBroadcasts = true, bool expandCompositions = true); + +// Lowers from sparse ops in CHLO dialect to Linalg dialect. +std::unique_ptr> createLegalizeSparseOperationsPass( + bool legalizeToCustomCalls = true); + +// Canonicalize reduction ops to be suitable for codegen. +std::unique_ptr> +createHloCanonicalizeReductionPass(); + +// Expand feature rich mhlo ops to simpler mhlo ops. +std::unique_ptr> +createMhloExpandOpsSimplifierPass(); + +// Rewrites scatter into transposes, reshapes and a simpler scatter. +std::unique_ptr> createHloCanonicalizeScatterPass(); + +// Rewrites gather into transposes, reshapes and a simpler gather. +std::unique_ptr> createHloCanonicalizeGatherPass(); + +// Rewrites dot operands that contain unit dimension. +std::unique_ptr> createHloCanonicalizeDotPass(); + +/// Lowers from HLO dialect to LHLO dialect allocating/deallocating temporary +/// buffers if necessary. +std::unique_ptr> createLegalizeToLhloPass(); + +/// Lowers from HLO dialect to Memref dialect allocating/deallocating temporary +/// buffers if necessary. +std::unique_ptr> createLegalizeToMemrefPass(); + +/// Lowers from HLO dialect to Arithmetic dialect. +std::unique_ptr> createLegalizeToArithmeticPass(); + +// Lowers shape operations from HLO dialect to Standard dialect. +std::unique_ptr> +createLegalizeHloShapeOpsToStandardPass(); + +/// Lowers from MHLO dialect to THLO dialect. +std::unique_ptr> createLegalizeMHLOToTHLOPass( + bool enableExperimentalOps = false); + +/// Lowers from HLO dialect to Linalg dialect. +std::unique_ptr> createLegalizeHloToLinalgPass( + bool enablePrimitiveOps = false); + +/// Lowers from HLO dialects dim operations. +std::unique_ptr> +createLegalizeShapeComputationsPass(); + +// Sinks constants implicitly captured in control flow regions. This is +// necessary to export to XLA. +std::unique_ptr> +createSinkConstantsToControlFlowPass(); + +/// Lowers trigonometric operations from the standard dialect to approximations +/// that do not use intrinsics. +std::unique_ptr> +createLegalizeTrigonometricToApproximationPass(); + +// Move dynamic broadcasts up over element-wise operations and broadcast the +// operands rather than the result. This will eventually allow for larger +// fusions. +std::unique_ptr> createBroadcastPropagationPass(); + +// Transformations that helps in restricting maximum rank among tensors in the +// pass. +std::unique_ptr> createRestrictMaxRankPass(); + +// Prepare moving dynamic broadcasts up over element-wise operations and +// broadcast the operands rather than the result. This will eventually allow for +// larger fusions. +std::unique_ptr> createMergeAssumingOpsPass(); + +// Iteratively reifies all shape computations in the function. +std::unique_ptr> createShapeReificationPass(); + +/// Creates a pass to analyze shapes and to use that information for +/// shape-related optimizations. +std::unique_ptr> +createSymbolicShapeOptimizationPass(); + +// Pass to simplify shape ops. +std::unique_ptr> createShapeSimplification(); + +// Fuse shape constraints and merge all assuming regions. +std::unique_ptr> createConstraintFusionPass(); + +// Group reduction and parallel dimensions of reduction operations and realize +// them through equivalent 1D or 2D reductions. +std::unique_ptr> createGroupReductionDimensionsPass( + bool preferColumnsReductions = true); + +/// Rank specialization passes: +/// - Find compatible operations and group them together in one rank +/// specialization cluster. +/// - Lower rank specialization clusters to SCF and ranked operations. +std::unique_ptr> +createRankSpecializationClusterPass(); +std::unique_ptr> createRankSpecializationToSCFPass( + int64_t maxTargetRank = 5); + +std::unique_ptr> createOptimizeMhloPass(); +std::unique_ptr> createLowerComplexPass(); + +std::unique_ptr> +createLegalizeBroadcastToBroadcastInDimPass(); +std::unique_ptr<::mlir::Pass> createLegalizeGeneralDotPass(); +std::unique_ptr> +createLegalizeCreateTokenToAfterAllPass(); +std::unique_ptr> +createLegalizeCrossReplicaSumToAllReducePass(); +std::unique_ptr> +createLegalizeDotGeneralToDotPass(); +std::unique_ptr> +createLegalizeDotToDotGeneralPass(); +std::unique_ptr> +createLegalizeEinsumToDotGeneralPass(); +std::unique_ptr> +createLegalizeGatherToTorchIndexSelectPass(); +std::unique_ptr> +createLegalizeTorchIndexSelectToGatherPass(); +std::unique_ptr> createFlattenTuplePass(); + +// Creates a pass for expanding mhlo.tuple ops. +std::unique_ptr> createExpandHloTuplesPass( + const std::string& entryFunctionName = "main"); + +// Creates a pass for collapsing the mhlo.map if the map only has elementwise +// op. +std::unique_ptr> createCollapseElementwiseMapPass(); + +// Pass to replace unsigned types with signless integers. +std::unique_ptr> createConvertToSignlessPass(); + +/// Creates pass for rewriting sparse mhlo ops. +std::unique_ptr> createSparseRewritingPass(); + +// Legalizes from the MHLO dialect to the StableHLO dialect. +std::unique_ptr> createHloLegalizeToStablehloPass(); + +// Legalizes from the StableHLO dialect to the MHLO dialect. +std::unique_ptr> createStablehloLegalizeToHloPass(); + +// Legalizes from the Shape dialect to the MHLO dialect. +std::unique_ptr> createShapeLegalizeToHloPass(); + +// Test passes. +std::unique_ptr createTestInferShapedTypeMethodsPass(); +std::unique_ptr createTestMaterializeBroadcastsPass(); +std::unique_ptr createTestUnfuseBatchNormPass(); + +#define GEN_PASS_REGISTRATION +#include "mhlo/transforms/mhlo_passes.h.inc" + +} // namespace mhlo +} // namespace mlir + +#endif // MLIR_HLO_MHLO_TRANSFORMS_PASSES_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/all_passes/thlo/transforms/passes.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/all_passes/thlo/transforms/passes.h new file mode 100644 index 0000000000000000000000000000000000000000..7ac8499f71474289d54fa8dc1d03bd610647edf9 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/all_passes/thlo/transforms/passes.h @@ -0,0 +1,46 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef MLIR_HLO_THLO_TRANSFORMS_PASSES_H +#define MLIR_HLO_THLO_TRANSFORMS_PASSES_H + +#include + +#include "mlir/Pass/Pass.h" + +namespace mlir { + +template +class OperationPass; + +namespace func { +class FuncOp; +} // namespace func + +namespace thlo { + +#define GEN_PASS_DECL_THLOLEGALIZESORTPASS +#include "thlo/transforms/thlo_passes.h.inc" + +/// Lowers sort to Arith, MemRef, and SCF +std::unique_ptr> createLegalizeSortPass(); + +#define GEN_PASS_REGISTRATION +#include "thlo/transforms/thlo_passes.h.inc" + +} // namespace thlo +} // namespace mlir + +#endif // MLIR_HLO_THLO_TRANSFORMS_PASSES_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/all_passes/transforms/passes.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/all_passes/transforms/passes.h new file mode 100644 index 0000000000000000000000000000000000000000..d18c60320525faec6d36fbf74c699925cbbf8367 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/all_passes/transforms/passes.h @@ -0,0 +1,126 @@ +/* Copyright 2021 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef MLIR_HLO_TRANSFORMS_PASSES_H +#define MLIR_HLO_TRANSFORMS_PASSES_H + +#include +#include + +#include "mlir/Pass/Pass.h" + +namespace mlir { +class ModuleOp; +class MLIRContext; +class ConversionTarget; +class DialectRegistry; +class PassManager; + +namespace func { +class FuncOp; +} // namespace func +namespace bufferization { +class BufferizeTypeConverter; +} // namespace bufferization + +using BufferizeDialectsCallback = std::function; +using BufferizePatternsCallback = std::function; + +//===----------------------------------------------------------------------===// +// Passes +//===----------------------------------------------------------------------===// + +#define GEN_PASS_DECL_BUFFERPACKING +#define GEN_PASS_DECL_FINALBUFFERIZEPASS +#define GEN_PASS_DECL_PROPAGATESTATICSHAPESTOKERNELPASS +#define GEN_PASS_DECL_TILELOOPSPASS +#define GEN_PASS_DECL_GENERICHOSTTOLLVMPASS +#include "transforms/passes.h.inc" + +/// Creates a pass that merges smaller buffer into bigger buffer to optimize +/// memory consumption. +std::unique_ptr> createBufferPackingPass( + unsigned windowSize = 5); + +/// Creates a pass that tests the useranges of the UserangeAnalysis. +std::unique_ptr> createTestUserangePass(); + +/// Creates a pass that prints the analysis results of ShapeComponentsAnalysis. +std::unique_ptr> +createTestShapeComponentAnalysisPass(); + +/// Creates a pass that computes the allocated memory. +std::unique_ptr> createMemoryCountPass(); + +// Pass to lower index cast on tensors to tensor dialect. +std::unique_ptr> createLowerIndexCastPass(); + +// Pass to tranform compute computations (hlo and linalg) on values to their +// corresponding counterparts on buffers. Also bufferizes function signatures. +std::unique_ptr> createComputeOpAndFuncBufferizePass(); + +// Pass to tranform computations on values to their corresponding parts on +// buffers. +std::unique_ptr> createFinalBufferizePass(); + +std::unique_ptr> createFinalBufferizePass( + uint64_t alignment, BufferizeDialectsCallback dc = {}, + BufferizePatternsCallback pc = {}); + +// Pass to propagate static shapes to kernel, reducing the kernel arguments +// from a flattened memref to a single pointer. The pointer is converted to +// `pointer_type`, if provided. +std::unique_ptr> +createPropagateStaticShapesToKernelPass(Type pointerType = {}); + +// Creates a pass for collapsing multidimensional parallel loops into 1D loops. +std::unique_ptr> createCollapseParallelLoopsTo1DPass(); + +// Creates a TileLoopsPass with tiles sizes provided through `tile_sizes` +// and unroll factors provided through `unroll_factors`. +std::unique_ptr> createTileLoopsPass( + ArrayRef tileSizes = {}, ArrayRef unrollFactors = {}); + +// Detensorizes loop-carried variables and block arguments of scf.while, scf.for +// and scf.if. +std::unique_ptr> createDetensorizeScfOpsPass(); + +/// Registers the test pass for erasing transform dialect ops. +void registerTestHloTransformDialectEraseSchedulePass(); + +/// Registers the test pass for applying transform dialect ops. +void registerTestHloTransformDialectInterpreterPass(); + +namespace hlo { +std::unique_ptr> createOneShotBufferizePass(); + +std::unique_ptr> createGenericHostToLLVMPass( + const GenericHostToLLVMPassOptions& options = {}); + +std::unique_ptr> createUnbufferizePass(); +std::unique_ptr> createAllocToArgPass(); + +// Unrolls scf.for loops with static iteration count no larger than 8. +std::unique_ptr createUnrollLoopsPass(); + +#define GEN_PASS_REGISTRATION +#include "transforms/passes.h.inc" + +} // namespace hlo +} // namespace mlir + +#endif // MLIR_HLO_TRANSFORMS_PASSES_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/chlo_legalize_to_hlo/mhlo/transforms/rewriters.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/chlo_legalize_to_hlo/mhlo/transforms/rewriters.h new file mode 100644 index 0000000000000000000000000000000000000000..2d5bbfa8887653582238e8e4985f31aa16393ee9 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/chlo_legalize_to_hlo/mhlo/transforms/rewriters.h @@ -0,0 +1,231 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef MLIR_HLO_MHLO_TRANSFORMS_REWRITERS_H +#define MLIR_HLO_MHLO_TRANSFORMS_REWRITERS_H + +#include +#include + +#include "mlir/IR/MLIRContext.h" +#include "mlir/IR/PatternMatch.h" +#include "mlir/Transforms/DialectConversion.h" + +namespace mlir { +namespace bufferization { +class BufferizeTypeConverter; +} // namespace bufferization +namespace mhlo { + +// Rewrite patterns for broadcast to equivalent broadcast_in_dim legalization. +void populateBroadcastToBroadcastInDimPatterns(MLIRContext *context, + RewritePatternSet *patterns); + +// Collection of rewrite patterns for lowering a general dot product. +void populateGeneralDotOpLoweringPatterns(RewritePatternSet *patterns, + MLIRContext *ctx); + +// Collection of rewrite patterns for lowering complex operations to equivalent +// float operations. +void populateComplexLoweringPatterns(MLIRContext *context, + RewritePatternSet *patterns); + +void populateOptimizeMhloPatterns(MLIRContext *context, + RewritePatternSet *patterns); + +// Rewrite patterns for create_token to equivalent after_all legalization. +void populateCreateTokenToAfterAllPatterns(mlir::MLIRContext *context, + RewritePatternSet *patterns); + +// Rewrite patterns for cross-replica-sum to equivalent all_reduce legalization. +void populateCrossReplicaSumToAllReducePatterns(mlir::MLIRContext *context, + RewritePatternSet *patterns); + +// Rewrite patterns for dot to equivalent dot_general legalization. +void populateDotToDotGeneralPatterns(mlir::MLIRContext *context, + RewritePatternSet *patterns); + +// Rewrite patterns for einsum to equivalent dot_general legalization. +void populateEinsumToDotGeneralPatterns(mlir::MLIRContext *context, + RewritePatternSet *patterns); + +// Rewrite patterns for gather to equivalent torch index select legalization. +void populateGatherToTorchIndexSelectPatterns(mlir::MLIRContext *context, + RewritePatternSet *patterns); + +// Rewrite patterns for torch index select to equivalent gather legalization. +void populateTorchIndexSelectToGatherPatterns(mlir::MLIRContext *context, + RewritePatternSet *patterns); + +void populateMhloToStdPatterns(RewritePatternSet *patterns, MLIRContext *ctx); + +// Collection of rewrite patterns for lowering all mhlo ops to their +// lmhlo counterparts. +void populateDynamicHloToLhloConversionPattern( + MLIRContext *context, bufferization::BufferizeTypeConverter *converter, + RewritePatternSet *patterns); + +// Collection of rewrite patterns for lowering of HLO to LHLO dialect. +void populateHloToLhloConversionPattern( + MLIRContext *context, bufferization::BufferizeTypeConverter *converter, + RewritePatternSet *patterns); + +// Collection of rewrite patterns for lowering of HLO to arithmetic dialect. +void populateHloToArithmeticConversionPatterns(RewritePatternSet *patterns); + +// Collection of rewrite patterns for lowering pointwise HLO ops with scalar +// arguments to arithmetic dialect. +void populateScalarHloToArithmeticConversionPatterns( + MLIRContext *context, TypeConverter &typeConverter, + RewritePatternSet *patterns, + llvm::function_ref filterFn = nullptr); + +// Collection of rewrite patterns for lowering of shape operations from the HLO +// dialect to the standard dialect. +void populateHloShapeOpsToStandardConversionPattern( + MLIRContext *context, TypeConverter &typeConverter, + RewritePatternSet *patterns); + +// Collection of rewrite patterns for lowering of HLO to Linalg dialect. +void populateHloToLinalgConversionPattern(MLIRContext *context, + TypeConverter &typeConverter, + RewritePatternSet *patterns, + bool enablePrimitiveOps = false); + +// Collection of rewrite patterns for lowering of HLO dim operations. +void populateShapeComputationPatterns(MLIRContext *context, + RewritePatternSet *patterns); + +// Converter to signless intergers to be used with linalg conversion patterns. +std::unique_ptr createHloToLinalgTypeConverter(); + +// Sets up legality definitions for materializing broadcasts. +void setupMaterializeBroadcastsLegality(MLIRContext *context, + ConversionTarget *conversionTarget); + +// Populates a collection of rewrite patterns for materializing broadcast +// attributes to equivalent sequences of ops. +void populateMaterializeBroadcastsPatterns(MLIRContext *context, + RewritePatternSet *patterns); + +// Populates a collection of rewrite patterns to realize element-wise operations +// on ranked tensors where possible. +void populateTransformUnrankedHloPatterns(MLIRContext *context, + RewritePatternSet *patterns); + +void populateDynamicShapeFusionPatterns(MLIRContext *context, + RewritePatternSet *patterns); + +// Populate a collection of conversion patterns for un-fusing +// batch_norm_inference into constituent HLO ops. +void populateUnfuseBatchNormInferencePattern(MLIRContext *context, + RewritePatternSet *patterns); + +// Populate a collection of conversion patterns for un-fusing +// batch_norm_training into constituent HLO ops. +void populateUnfuseBatchNormTrainingPattern(MLIRContext *context, + RewritePatternSet *patterns); + +// Populate a collection of conversion patterns for un-fusing +// // batch_norm_inference and batch_norm_training into constituent HLO ops. +inline void populateUnfuseBatchNormPatterns(MLIRContext *context, + RewritePatternSet *patterns) { + populateUnfuseBatchNormInferencePattern(context, patterns); + populateUnfuseBatchNormTrainingPattern(context, patterns); +} + +// Populates patterns that translate the trigonometric operations from the +// standard dialect to approximations that do not use intrinsics. +void populateTrigonometricToApproximationPatterns(MLIRContext *context, + RewritePatternSet *patterns); + +// Populate patterns to prepare moving dynamic broadcasts up over element-wise +// operations and broadcast the operands rather than the result. This will +// eventually allow for larger fusions. +void populateMergeAssumingOpsPatterns(MLIRContext *context, + RewritePatternSet *patterns); + +// Populate patterns for iterative shape reification. +void populateShapeReificationPatterns(MLIRContext *, RewritePatternSet *); + +// Populate patterns to group reduction and parallel dimensions of reduction +// operations and realize them through equivalent 1D or 2D reductions. +void populateGroupReductionDimensionsPatterns(MLIRContext *context, + RewritePatternSet *patterns, + bool preferColumnsReductions); + +/// Populate rank specialization clustering and lowering patterns. +void populateRankSpecializationClusterPatterns(MLIRContext *context, + RewritePatternSet *patterns); +void populateRankSpecializationToSCFPatterns(MLIRContext *context, + RewritePatternSet *patterns, + int64_t maxTargetRank); + +/// Populate sparse tensor specific rewriting patterns. +void populateSparseRewritingPatterns(RewritePatternSet *patterns, + MLIRContext *ctx); + +/// Populates sparse ops in CHLO to linalg rewriting patterns. +void populateLegalizeSparseCHLOPatterns(MLIRContext *context, + TypeConverter &typeConverter, + RewritePatternSet *patterns); + +/// Populate sparse ops to mhlo.CustomCall patterns. +void populateLegalizeSparseOpsToCustomCallPatterns(MLIRContext *context, + TypeConverter &typeConverter, + RewritePatternSet *patterns); + +} // namespace mhlo + +namespace chlo { + +// Populates a collection of conversion patterns for legalizing broadcasting +// client-HLO to their non-broadcasting counterparts. +void populateChloBroadcastingPatterns(MLIRContext *context, + RewritePatternSet *patterns); + +// Populates a collection of conversion patterns for legalizing client-HLO to +// HLO by decomposing client-operations to corresponding sequences of more +// primitive operations. This does not include the +// PopulateChloBroadcastingPatterns above. +void populateDecomposeChloPatterns(MLIRContext *context, + RewritePatternSet *patterns); + +} // namespace chlo + +namespace stablehlo { + +// Populates MHLO ops to StableHLO ops rewriting patterns. +// Also see `stablehlo::registerFuncOpsForTypeConversion` for helper patterns +// which make sure `func.func`, `func.call` and `func.return` which involve +// illegal types also get converted. +void populateHloToStablehloPatterns(RewritePatternSet *patterns, + TypeConverter *converter, + MLIRContext *context, + bool allowExperimentalFeatures); + +// Populates StableHLO ops to MHLO ops rewriting patterns. +// Also see `stablehlo::registerFuncOpsForTypeConversion` for helper patterns +// which make sure `func.func`, `func.call` and `func.return` which involve +// illegal types also get converted. +void populateStablehloToHloPatterns(RewritePatternSet *patterns, + TypeConverter *converter, + MLIRContext *context); + +} // namespace stablehlo + +} // namespace mlir + +#endif // MLIR_HLO_MHLO_TRANSFORMS_REWRITERS_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/convert_op_folder/utils/convert_op_folder.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/convert_op_folder/utils/convert_op_folder.h new file mode 100644 index 0000000000000000000000000000000000000000..1186a3014c12577c26acd6ca64bfb2cdf1e45d10 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/convert_op_folder/utils/convert_op_folder.h @@ -0,0 +1,33 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef MLIR_HLO_UTILS_CONVERT_OP_FOLDER_H +#define MLIR_HLO_UTILS_CONVERT_OP_FOLDER_H + +#include "mlir/IR/BuiltinAttributes.h" +#include "mlir/IR/BuiltinTypes.h" + +namespace mlir { +namespace hlo { + +// Converts the given elements attr to the specified elements type. +// Requires type of the elements and new_type to be either integer or float +// type. +mlir::ElementsAttr convertElementsAttr(const mlir::ElementsAttr& elements, + mlir::Type newType); +} // namespace hlo +} // namespace mlir + +#endif // MLIR_HLO_UTILS_CONVERT_OP_FOLDER_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/deallocation/deallocation/IR/deallocation_ops.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/deallocation/deallocation/IR/deallocation_ops.h new file mode 100644 index 0000000000000000000000000000000000000000..74dec9c2e8ee43889160d977293590655d7d7b30 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/deallocation/deallocation/IR/deallocation_ops.h @@ -0,0 +1,37 @@ +/* Copyright 2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef MLIR_HLO_DEALLOACTION_DEALLOCATION_OPS_H +#define MLIR_HLO_DEALLOACTION_DEALLOCATION_OPS_H + +#include "mlir/Bytecode/BytecodeOpInterface.h" +#include "mlir/IR/Attributes.h" +#include "mlir/IR/BuiltinTypes.h" +#include "mlir/IR/Dialect.h" +#include "mlir/IR/MLIRContext.h" +#include "mlir/IR/OpDefinition.h" +#include "mlir/IR/OpImplementation.h" +#include "mlir/Interfaces/SideEffectInterfaces.h" + +#define GET_TYPEDEF_CLASSES +#include "deallocation/IR/deallocation_typedefs.h.inc" +#undef GET_TYPEDEF_CLASSES + +#define GET_OP_CLASSES +#include "deallocation/IR/deallocation_dialect.h.inc" +#include "deallocation/IR/deallocation_ops.h.inc" +#undef GET_OP_CLASSES + +#endif // MLIR_HLO_DEALLOACTION_DEALLOCATION_OPS_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/deallocation_ops_inc_gen/deallocation/IR/deallocation_dialect.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/deallocation_ops_inc_gen/deallocation/IR/deallocation_dialect.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..9f448a9f30aa6ddba72c87ee83a2a8168ea7698f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/deallocation_ops_inc_gen/deallocation/IR/deallocation_dialect.h.inc @@ -0,0 +1,33 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: deallocation_ops.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace deallocation { + +class DeallocationDialect : public ::mlir::Dialect { + explicit DeallocationDialect(::mlir::MLIRContext *context); + + void initialize(); + friend class ::mlir::MLIRContext; +public: + ~DeallocationDialect() override; + static constexpr ::llvm::StringLiteral getDialectNamespace() { + return ::llvm::StringLiteral("deallocation"); + } + + /// Parse a type registered to this dialect. + ::mlir::Type parseType(::mlir::DialectAsmParser &parser) const override; + + /// Print a type registered to this dialect. + void printType(::mlir::Type type, + ::mlir::DialectAsmPrinter &os) const override; +}; +} // namespace deallocation +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::deallocation::DeallocationDialect) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/deallocation_ops_inc_gen/deallocation/IR/deallocation_ops.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/deallocation_ops_inc_gen/deallocation/IR/deallocation_ops.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..fa935dae952a569a500bab6e0ec7e0fcdf56a4d7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/deallocation_ops_inc_gen/deallocation/IR/deallocation_ops.h.inc @@ -0,0 +1,567 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: deallocation_ops.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#if defined(GET_OP_CLASSES) || defined(GET_OP_FWD_DEFINES) +#undef GET_OP_FWD_DEFINES +namespace mlir { +namespace deallocation { +class FreeOp; +} // namespace deallocation +} // namespace mlir +namespace mlir { +namespace deallocation { +class GetBufferOp; +} // namespace deallocation +} // namespace mlir +namespace mlir { +namespace deallocation { +class NullOp; +} // namespace deallocation +} // namespace mlir +namespace mlir { +namespace deallocation { +class OwnOp; +} // namespace deallocation +} // namespace mlir +namespace mlir { +namespace deallocation { +class RetainOp; +} // namespace deallocation +} // namespace mlir +#endif + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace deallocation { + +//===----------------------------------------------------------------------===// +// ::mlir::deallocation::FreeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FreeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FreeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FreeOpGenericAdaptorBase(FreeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class FreeOpGenericAdaptor : public detail::FreeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FreeOpGenericAdaptorBase; +public: + FreeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FreeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FreeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FreeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getAlloc() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FreeOpAdaptor : public FreeOpGenericAdaptor<::mlir::ValueRange> { +public: + using FreeOpGenericAdaptor::FreeOpGenericAdaptor; + FreeOpAdaptor(FreeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FreeOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = FreeOpAdaptor; + template + using GenericAdaptor = FreeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("deallocation.free"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::deallocation::OwnershipIndicatorType> getAlloc(); + ::mlir::OpOperand &getAllocMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value alloc); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value alloc); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: +}; +} // namespace deallocation +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::deallocation::FreeOp) + +namespace mlir { +namespace deallocation { + +//===----------------------------------------------------------------------===// +// ::mlir::deallocation::GetBufferOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GetBufferOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + GetBufferOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + GetBufferOpGenericAdaptorBase(GetBufferOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class GetBufferOpGenericAdaptor : public detail::GetBufferOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GetBufferOpGenericAdaptorBase; +public: + GetBufferOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GetBufferOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GetBufferOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + GetBufferOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getAlloc() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GetBufferOpAdaptor : public GetBufferOpGenericAdaptor<::mlir::ValueRange> { +public: + using GetBufferOpGenericAdaptor::GetBufferOpGenericAdaptor; + GetBufferOpAdaptor(GetBufferOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GetBufferOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = GetBufferOpAdaptor; + template + using GenericAdaptor = GetBufferOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("deallocation.get_buffer"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getAlloc(); + ::mlir::OpOperand &getAllocMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value alloc); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value alloc); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace deallocation +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::deallocation::GetBufferOp) + +namespace mlir { +namespace deallocation { + +//===----------------------------------------------------------------------===// +// ::mlir::deallocation::NullOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class NullOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + NullOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + NullOpGenericAdaptorBase(NullOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class NullOpGenericAdaptor : public detail::NullOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::NullOpGenericAdaptorBase; +public: + NullOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + NullOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : NullOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + NullOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class NullOpAdaptor : public NullOpGenericAdaptor<::mlir::ValueRange> { +public: + using NullOpGenericAdaptor::NullOpGenericAdaptor; + NullOpAdaptor(NullOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class NullOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = NullOpAdaptor; + template + using GenericAdaptor = NullOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("deallocation.null"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::deallocation::OwnershipIndicatorType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace deallocation +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::deallocation::NullOp) + +namespace mlir { +namespace deallocation { + +//===----------------------------------------------------------------------===// +// ::mlir::deallocation::OwnOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class OwnOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + OwnOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + OwnOpGenericAdaptorBase(OwnOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class OwnOpGenericAdaptor : public detail::OwnOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::OwnOpGenericAdaptorBase; +public: + OwnOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + OwnOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : OwnOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + OwnOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getMemref() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class OwnOpAdaptor : public OwnOpGenericAdaptor<::mlir::ValueRange> { +public: + using OwnOpGenericAdaptor::OwnOpGenericAdaptor; + OwnOpAdaptor(OwnOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class OwnOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = OwnOpAdaptor; + template + using GenericAdaptor = OwnOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("deallocation.own"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::BaseMemRefType> getMemref(); + ::mlir::OpOperand &getMemrefMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::deallocation::OwnershipIndicatorType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value memref); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value memref); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value memref); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace deallocation +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::deallocation::OwnOp) + +namespace mlir { +namespace deallocation { + +//===----------------------------------------------------------------------===// +// ::mlir::deallocation::RetainOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RetainOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RetainOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RetainOpGenericAdaptorBase(RetainOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RetainOpGenericAdaptor : public detail::RetainOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RetainOpGenericAdaptorBase; +public: + RetainOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RetainOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RetainOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RetainOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getRetained() { + return getODSOperands(0); + } + + RangeT getAllocs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RetainOpAdaptor : public RetainOpGenericAdaptor<::mlir::ValueRange> { +public: + using RetainOpGenericAdaptor::RetainOpGenericAdaptor; + RetainOpAdaptor(RetainOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RetainOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = RetainOpAdaptor; + template + using GenericAdaptor = RetainOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("deallocation.retain"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getRetained(); + ::mlir::Operation::operand_range getAllocs(); + ::mlir::MutableOperandRange getRetainedMutable(); + ::mlir::MutableOperandRange getAllocsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResultAllocs(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange result_allocs, ::mlir::ValueRange retained, ::mlir::ValueRange allocs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace deallocation +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::deallocation::RetainOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/deallocation_ops_inc_gen/deallocation/IR/deallocation_typedefs.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/deallocation_ops_inc_gen/deallocation/IR/deallocation_typedefs.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..0202436a6b483d4e71d2850143aa982a4ac15122 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/deallocation_ops_inc_gen/deallocation/IR/deallocation_typedefs.h.inc @@ -0,0 +1,33 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* TypeDef Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_TYPEDEF_CLASSES +#undef GET_TYPEDEF_CLASSES + + +namespace mlir { +class AsmParser; +class AsmPrinter; +} // namespace mlir +namespace mlir { +namespace deallocation { +class OwnershipIndicatorType; +class OwnershipIndicatorType : public ::mlir::Type::TypeBase { +public: + using Base::Base; + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"ownership"}; + } + +}; +} // namespace deallocation +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::deallocation::OwnershipIndicatorType) + +#endif // GET_TYPEDEF_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/deallocation_passes/deallocation/transforms/analysis.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/deallocation_passes/deallocation/transforms/analysis.h new file mode 100644 index 0000000000000000000000000000000000000000..aefb8ff03ce03d5e9a24e0f6d3bb5db051567534 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/deallocation_passes/deallocation/transforms/analysis.h @@ -0,0 +1,58 @@ +/* Copyright 2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ +#ifndef MLIR_HLO_DEALLOCATION_TRANSFORMS_ANALYSIS_H +#define MLIR_HLO_DEALLOCATION_TRANSFORMS_ANALYSIS_H + +#include "deallocation/utils/util.h" +#include "mlir/IR/Value.h" + +namespace mlir { +namespace deallocation { + +class DeallocationAnalysis { + public: + // Returns the set of all possible values that may back the given value. A + // value `A` is considered to back another value `B` if + // a) `A` is an alloc or a bbarg + // b) `B` depends on `A` (possibly indirectly) + // + // For example, in this IR: + // + // func.func @foo(%arg0: memref) -> memref { + // %c0 = arith.constant 0 : index + // %c4 = arith.constant 4 : index + // %c1 = arith.constant 1 : index + // %ret = scf.for %i = %c0 to %c4 step %c1 iter_args(%x = %arg0) + // -> memref { + // %y = some.op(%x) : memref -> memref + // scf.yield %y : memref + // } + // func.return %ret : memref + // } + // + // `getBackingMemory(%ret)` is {`%arg0`, `%x`, `%y`}. + const breaks_if_you_move_ops::ValueSet& getBackingMemory(Value source); + + private: + void collectBackingMemory(Value source, DenseSet& visited, + breaks_if_you_move_ops::ValueSet& results); + + DenseMap backingMemory; +}; + +} // namespace deallocation +} // namespace mlir + +#endif // MLIR_HLO_DEALLOCATION_TRANSFORMS_ANALYSIS_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/deallocation_passes/deallocation/transforms/passes.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/deallocation_passes/deallocation/transforms/passes.h new file mode 100644 index 0000000000000000000000000000000000000000..183082fc54e04d4beb3eeaa40a1b3852e466a4ac --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/deallocation_passes/deallocation/transforms/passes.h @@ -0,0 +1,71 @@ +/* Copyright 2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef MLIR_HLO_DEALLOCATION_TRANSFORMS_PASSES_H +#define MLIR_HLO_DEALLOCATION_TRANSFORMS_PASSES_H + +#include + +#include "mlir/Conversion/LLVMCommon/TypeConverter.h" +#include "mlir/Dialect/Func/IR/FuncOps.h" +#include "mlir/IR/PatternMatch.h" +#include "mlir/Pass/Pass.h" + +namespace mlir { +namespace deallocation { + +// Pass to split bufferization.alloc_tensor ops to optimize buffer reuse. +std::unique_ptr> +createSplitAllocTensorsPass(); + +// Pass to insert deallocations (in the form of `deallocation.retain`) ops. Most +// deallocations are typically converted to `memref.dealloc` by +// canonicalization. +std::unique_ptr> createDeallocatePass(); + +// Pass to annotate ops with debug information. +std::unique_ptr> +createDeallocationAnnotationPass(); + +// Pass to annotate buffer arguments with aliasing information. +std::unique_ptr> +createXlaBufferArgRewritePass(); + +// Pass to reuse buffers (hoisting, double buffering, dealloc/alloc +// coalescing). +std::unique_ptr> +createBufferReusePass(); + +// Lowers retain to SCF. +std::unique_ptr> +createDeallocationToScfPass(); + +// Convert `deallocation` ops to LLVM. +std::unique_ptr> +createConvertDeallocationOpsToLLVM(); + +std::unique_ptr> +createDeallocationSimplificationPass(); + +void populateDeallocationToLLVMConversionPatterns(LLVMTypeConverter& converter, + RewritePatternSet& patterns); + +#define GEN_PASS_REGISTRATION +#include "deallocation/transforms/passes.h.inc" + +} // namespace deallocation +} // namespace mlir + +#endif // MLIR_HLO_DEALLOCATION_TRANSFORMS_PASSES_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/deallocation_passes_inc_gen/deallocation/transforms/passes.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/deallocation_passes_inc_gen/deallocation/transforms/passes.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..ca44cf2a305117dc3ebad64ad3f8ce1fb9016f9a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/deallocation_passes_inc_gen/deallocation/transforms/passes.h.inc @@ -0,0 +1,1032 @@ +/* Autogenerated by mlir-tblgen; don't manually edit */ + +#ifdef GEN_PASS_DECL +// Generate declarations for all passes. +#define GEN_PASS_DECL_ANNOTATEDEALLOCATIONPASS +#define GEN_PASS_DECL_BUFFERREUSEPASS +#define GEN_PASS_DECL_CONVERTDEALLOCATIONOPSTOLLVMPASS +#define GEN_PASS_DECL_DEALLOCATEPASS +#define GEN_PASS_DECL_DEALLOCATIONSIMPLIFICATIONPASS +#define GEN_PASS_DECL_DEALLOCATIONTOSCFPASS +#define GEN_PASS_DECL_SPLITALLOCTENSORSPASS +#define GEN_PASS_DECL_XLABUFFERARGREWRITEPASS +#undef GEN_PASS_DECL +#endif // GEN_PASS_DECL + +//===----------------------------------------------------------------------===// +// AnnotateDeallocationPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_ANNOTATEDEALLOCATIONPASS +#undef GEN_PASS_DECL_ANNOTATEDEALLOCATIONPASS +#endif // GEN_PASS_DECL_ANNOTATEDEALLOCATIONPASS +#ifdef GEN_PASS_DEF_ANNOTATEDEALLOCATIONPASS +namespace impl { + +template +class AnnotateDeallocationPassBase : public ::mlir::OperationPass { +public: + using Base = AnnotateDeallocationPassBase; + + AnnotateDeallocationPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + AnnotateDeallocationPassBase(const AnnotateDeallocationPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("hlo-deallocation-annotation"); + } + ::llvm::StringRef getArgument() const override { return "hlo-deallocation-annotation"; } + + ::llvm::StringRef getDescription() const override { return "Annotate ops with deallocation debug information."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("AnnotateDeallocationPass"); + } + ::llvm::StringRef getName() const override { return "AnnotateDeallocationPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(AnnotateDeallocationPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_ANNOTATEDEALLOCATIONPASS +#endif // GEN_PASS_DEF_ANNOTATEDEALLOCATIONPASS + +//===----------------------------------------------------------------------===// +// BufferReusePass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_BUFFERREUSEPASS +#undef GEN_PASS_DECL_BUFFERREUSEPASS +#endif // GEN_PASS_DECL_BUFFERREUSEPASS +#ifdef GEN_PASS_DEF_BUFFERREUSEPASS +namespace impl { + +template +class BufferReusePassBase : public ::mlir::OperationPass { +public: + using Base = BufferReusePassBase; + + BufferReusePassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + BufferReusePassBase(const BufferReusePassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("hlo-buffer-reuse"); + } + ::llvm::StringRef getArgument() const override { return "hlo-buffer-reuse"; } + + ::llvm::StringRef getDescription() const override { return "Reuse buffers."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("BufferReusePass"); + } + ::llvm::StringRef getName() const override { return "BufferReusePass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert<::mlir::memref::MemRefDialect>(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(BufferReusePassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_BUFFERREUSEPASS +#endif // GEN_PASS_DEF_BUFFERREUSEPASS + +//===----------------------------------------------------------------------===// +// ConvertDeallocationOpsToLLVMPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_CONVERTDEALLOCATIONOPSTOLLVMPASS +#undef GEN_PASS_DECL_CONVERTDEALLOCATIONOPSTOLLVMPASS +#endif // GEN_PASS_DECL_CONVERTDEALLOCATIONOPSTOLLVMPASS +#ifdef GEN_PASS_DEF_CONVERTDEALLOCATIONOPSTOLLVMPASS +namespace impl { + +template +class ConvertDeallocationOpsToLLVMPassBase : public ::mlir::OperationPass { +public: + using Base = ConvertDeallocationOpsToLLVMPassBase; + + ConvertDeallocationOpsToLLVMPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertDeallocationOpsToLLVMPassBase(const ConvertDeallocationOpsToLLVMPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("hlo-convert-deallocation-ops-to-llvm"); + } + ::llvm::StringRef getArgument() const override { return "hlo-convert-deallocation-ops-to-llvm"; } + + ::llvm::StringRef getDescription() const override { return "Convert `deallocation` ops to LLVM"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertDeallocationOpsToLLVMPass"); + } + ::llvm::StringRef getName() const override { return "ConvertDeallocationOpsToLLVMPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert<::mlir::LLVM::LLVMDialect>(); + + registry.insert<::mlir::memref::MemRefDialect>(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertDeallocationOpsToLLVMPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_CONVERTDEALLOCATIONOPSTOLLVMPASS +#endif // GEN_PASS_DEF_CONVERTDEALLOCATIONOPSTOLLVMPASS + +//===----------------------------------------------------------------------===// +// DeallocatePass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_DEALLOCATEPASS +#undef GEN_PASS_DECL_DEALLOCATEPASS +#endif // GEN_PASS_DECL_DEALLOCATEPASS +#ifdef GEN_PASS_DEF_DEALLOCATEPASS +namespace impl { + +template +class DeallocatePassBase : public ::mlir::OperationPass { +public: + using Base = DeallocatePassBase; + + DeallocatePassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + DeallocatePassBase(const DeallocatePassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("hlo-deallocate"); + } + ::llvm::StringRef getArgument() const override { return "hlo-deallocate"; } + + ::llvm::StringRef getDescription() const override { return "Deallocate buffers by inserting `deallocation.retain` ops."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("DeallocatePass"); + } + ::llvm::StringRef getName() const override { return "DeallocatePass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert<::mlir::deallocation::DeallocationDialect>(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(DeallocatePassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_DEALLOCATEPASS +#endif // GEN_PASS_DEF_DEALLOCATEPASS + +//===----------------------------------------------------------------------===// +// DeallocationSimplificationPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_DEALLOCATIONSIMPLIFICATIONPASS +#undef GEN_PASS_DECL_DEALLOCATIONSIMPLIFICATIONPASS +#endif // GEN_PASS_DECL_DEALLOCATIONSIMPLIFICATIONPASS +#ifdef GEN_PASS_DEF_DEALLOCATIONSIMPLIFICATIONPASS +namespace impl { + +template +class DeallocationSimplificationPassBase : public ::mlir::OperationPass { +public: + using Base = DeallocationSimplificationPassBase; + + DeallocationSimplificationPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + DeallocationSimplificationPassBase(const DeallocationSimplificationPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("hlo-deallocation-simplification"); + } + ::llvm::StringRef getArgument() const override { return "hlo-deallocation-simplification"; } + + ::llvm::StringRef getDescription() const override { return "Simplifies deallocation.retain ops."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("DeallocationSimplificationPass"); + } + ::llvm::StringRef getName() const override { return "DeallocationSimplificationPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert<::mlir::deallocation::DeallocationDialect>(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(DeallocationSimplificationPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_DEALLOCATIONSIMPLIFICATIONPASS +#endif // GEN_PASS_DEF_DEALLOCATIONSIMPLIFICATIONPASS + +//===----------------------------------------------------------------------===// +// DeallocationToScfPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_DEALLOCATIONTOSCFPASS +#undef GEN_PASS_DECL_DEALLOCATIONTOSCFPASS +#endif // GEN_PASS_DECL_DEALLOCATIONTOSCFPASS +#ifdef GEN_PASS_DEF_DEALLOCATIONTOSCFPASS +namespace impl { + +template +class DeallocationToScfPassBase : public ::mlir::OperationPass { +public: + using Base = DeallocationToScfPassBase; + + DeallocationToScfPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + DeallocationToScfPassBase(const DeallocationToScfPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("hlo-deallocation-to-scf"); + } + ::llvm::StringRef getArgument() const override { return "hlo-deallocation-to-scf"; } + + ::llvm::StringRef getDescription() const override { return "Lowers retain to scf."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("DeallocationToScfPass"); + } + ::llvm::StringRef getName() const override { return "DeallocationToScfPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert<::mlir::arith::ArithDialect>(); + + registry.insert<::mlir::scf::SCFDialect>(); + + registry.insert<::mlir::memref::MemRefDialect>(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(DeallocationToScfPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_DEALLOCATIONTOSCFPASS +#endif // GEN_PASS_DEF_DEALLOCATIONTOSCFPASS + +//===----------------------------------------------------------------------===// +// SplitAllocTensorsPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_SPLITALLOCTENSORSPASS +#undef GEN_PASS_DECL_SPLITALLOCTENSORSPASS +#endif // GEN_PASS_DECL_SPLITALLOCTENSORSPASS +#ifdef GEN_PASS_DEF_SPLITALLOCTENSORSPASS +namespace impl { + +template +class SplitAllocTensorsPassBase : public ::mlir::OperationPass { +public: + using Base = SplitAllocTensorsPassBase; + + SplitAllocTensorsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + SplitAllocTensorsPassBase(const SplitAllocTensorsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("hlo-split-alloc-tensors"); + } + ::llvm::StringRef getArgument() const override { return "hlo-split-alloc-tensors"; } + + ::llvm::StringRef getDescription() const override { return "Split bufferization.alloc_tensor ops."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("SplitAllocTensorsPass"); + } + ::llvm::StringRef getName() const override { return "SplitAllocTensorsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert<::mlir::bufferization::BufferizationDialect>(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(SplitAllocTensorsPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_SPLITALLOCTENSORSPASS +#endif // GEN_PASS_DEF_SPLITALLOCTENSORSPASS + +//===----------------------------------------------------------------------===// +// XlaBufferArgRewritePass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_XLABUFFERARGREWRITEPASS +#undef GEN_PASS_DECL_XLABUFFERARGREWRITEPASS +#endif // GEN_PASS_DECL_XLABUFFERARGREWRITEPASS +#ifdef GEN_PASS_DEF_XLABUFFERARGREWRITEPASS +namespace impl { + +template +class XlaBufferArgRewritePassBase : public ::mlir::OperationPass { +public: + using Base = XlaBufferArgRewritePassBase; + + XlaBufferArgRewritePassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + XlaBufferArgRewritePassBase(const XlaBufferArgRewritePassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("hlo-xla-buffer-arg-rewrite"); + } + ::llvm::StringRef getArgument() const override { return "hlo-xla-buffer-arg-rewrite"; } + + ::llvm::StringRef getDescription() const override { return "Rewrites XLA framework buffer arguments with alias information"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("XlaBufferArgRewritePass"); + } + ::llvm::StringRef getName() const override { return "XlaBufferArgRewritePass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(XlaBufferArgRewritePassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_XLABUFFERARGREWRITEPASS +#endif // GEN_PASS_DEF_XLABUFFERARGREWRITEPASS +#ifdef GEN_PASS_REGISTRATION + +//===----------------------------------------------------------------------===// +// AnnotateDeallocationPass Registration +//===----------------------------------------------------------------------===// + +inline void registerAnnotateDeallocationPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::deallocation::createDeallocationAnnotationPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerAnnotateDeallocationPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::deallocation::createDeallocationAnnotationPass(); + }); +} + +//===----------------------------------------------------------------------===// +// BufferReusePass Registration +//===----------------------------------------------------------------------===// + +inline void registerBufferReusePass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::deallocation::createBufferReusePass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerBufferReusePassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::deallocation::createBufferReusePass(); + }); +} + +//===----------------------------------------------------------------------===// +// ConvertDeallocationOpsToLLVMPass Registration +//===----------------------------------------------------------------------===// + +inline void registerConvertDeallocationOpsToLLVMPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::deallocation::createConvertDeallocationOpsToLLVM(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerConvertDeallocationOpsToLLVMPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::deallocation::createConvertDeallocationOpsToLLVM(); + }); +} + +//===----------------------------------------------------------------------===// +// DeallocatePass Registration +//===----------------------------------------------------------------------===// + +inline void registerDeallocatePass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::deallocation::createDeallocatePass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerDeallocatePassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::deallocation::createDeallocatePass(); + }); +} + +//===----------------------------------------------------------------------===// +// DeallocationSimplificationPass Registration +//===----------------------------------------------------------------------===// + +inline void registerDeallocationSimplificationPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::deallocation::createDeallocationSimplificationPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerDeallocationSimplificationPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::deallocation::createDeallocationSimplificationPass(); + }); +} + +//===----------------------------------------------------------------------===// +// DeallocationToScfPass Registration +//===----------------------------------------------------------------------===// + +inline void registerDeallocationToScfPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::deallocation::createDeallocationToScfPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerDeallocationToScfPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::deallocation::createDeallocationToScfPass(); + }); +} + +//===----------------------------------------------------------------------===// +// SplitAllocTensorsPass Registration +//===----------------------------------------------------------------------===// + +inline void registerSplitAllocTensorsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::deallocation::createSplitAllocTensorsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerSplitAllocTensorsPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::deallocation::createSplitAllocTensorsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// XlaBufferArgRewritePass Registration +//===----------------------------------------------------------------------===// + +inline void registerXlaBufferArgRewritePass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::deallocation::createXlaBufferArgRewritePass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerXlaBufferArgRewritePassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::deallocation::createXlaBufferArgRewritePass(); + }); +} + +//===----------------------------------------------------------------------===// +// Deallocation Registration +//===----------------------------------------------------------------------===// + +inline void registerDeallocationPasses() { + registerAnnotateDeallocationPass(); + registerBufferReusePass(); + registerConvertDeallocationOpsToLLVMPass(); + registerDeallocatePass(); + registerDeallocationSimplificationPass(); + registerDeallocationToScfPass(); + registerSplitAllocTensorsPass(); + registerXlaBufferArgRewritePass(); +} +#undef GEN_PASS_REGISTRATION +#endif // GEN_PASS_REGISTRATION +// Deprecated. Please use the new per-pass macros. +#ifdef GEN_PASS_CLASSES + +template +class AnnotateDeallocationPassBase : public ::mlir::OperationPass { +public: + using Base = AnnotateDeallocationPassBase; + + AnnotateDeallocationPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + AnnotateDeallocationPassBase(const AnnotateDeallocationPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("hlo-deallocation-annotation"); + } + ::llvm::StringRef getArgument() const override { return "hlo-deallocation-annotation"; } + + ::llvm::StringRef getDescription() const override { return "Annotate ops with deallocation debug information."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("AnnotateDeallocationPass"); + } + ::llvm::StringRef getName() const override { return "AnnotateDeallocationPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(AnnotateDeallocationPassBase) + +protected: +}; + +template +class BufferReusePassBase : public ::mlir::OperationPass { +public: + using Base = BufferReusePassBase; + + BufferReusePassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + BufferReusePassBase(const BufferReusePassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("hlo-buffer-reuse"); + } + ::llvm::StringRef getArgument() const override { return "hlo-buffer-reuse"; } + + ::llvm::StringRef getDescription() const override { return "Reuse buffers."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("BufferReusePass"); + } + ::llvm::StringRef getName() const override { return "BufferReusePass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert<::mlir::memref::MemRefDialect>(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(BufferReusePassBase) + +protected: +}; + +template +class ConvertDeallocationOpsToLLVMPassBase : public ::mlir::OperationPass { +public: + using Base = ConvertDeallocationOpsToLLVMPassBase; + + ConvertDeallocationOpsToLLVMPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ConvertDeallocationOpsToLLVMPassBase(const ConvertDeallocationOpsToLLVMPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("hlo-convert-deallocation-ops-to-llvm"); + } + ::llvm::StringRef getArgument() const override { return "hlo-convert-deallocation-ops-to-llvm"; } + + ::llvm::StringRef getDescription() const override { return "Convert `deallocation` ops to LLVM"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ConvertDeallocationOpsToLLVMPass"); + } + ::llvm::StringRef getName() const override { return "ConvertDeallocationOpsToLLVMPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert<::mlir::LLVM::LLVMDialect>(); + + registry.insert<::mlir::memref::MemRefDialect>(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ConvertDeallocationOpsToLLVMPassBase) + +protected: +}; + +template +class DeallocatePassBase : public ::mlir::OperationPass { +public: + using Base = DeallocatePassBase; + + DeallocatePassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + DeallocatePassBase(const DeallocatePassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("hlo-deallocate"); + } + ::llvm::StringRef getArgument() const override { return "hlo-deallocate"; } + + ::llvm::StringRef getDescription() const override { return "Deallocate buffers by inserting `deallocation.retain` ops."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("DeallocatePass"); + } + ::llvm::StringRef getName() const override { return "DeallocatePass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert<::mlir::deallocation::DeallocationDialect>(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(DeallocatePassBase) + +protected: +}; + +template +class DeallocationSimplificationPassBase : public ::mlir::OperationPass { +public: + using Base = DeallocationSimplificationPassBase; + + DeallocationSimplificationPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + DeallocationSimplificationPassBase(const DeallocationSimplificationPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("hlo-deallocation-simplification"); + } + ::llvm::StringRef getArgument() const override { return "hlo-deallocation-simplification"; } + + ::llvm::StringRef getDescription() const override { return "Simplifies deallocation.retain ops."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("DeallocationSimplificationPass"); + } + ::llvm::StringRef getName() const override { return "DeallocationSimplificationPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert<::mlir::deallocation::DeallocationDialect>(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(DeallocationSimplificationPassBase) + +protected: +}; + +template +class DeallocationToScfPassBase : public ::mlir::OperationPass { +public: + using Base = DeallocationToScfPassBase; + + DeallocationToScfPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + DeallocationToScfPassBase(const DeallocationToScfPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("hlo-deallocation-to-scf"); + } + ::llvm::StringRef getArgument() const override { return "hlo-deallocation-to-scf"; } + + ::llvm::StringRef getDescription() const override { return "Lowers retain to scf."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("DeallocationToScfPass"); + } + ::llvm::StringRef getName() const override { return "DeallocationToScfPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert<::mlir::arith::ArithDialect>(); + + registry.insert<::mlir::scf::SCFDialect>(); + + registry.insert<::mlir::memref::MemRefDialect>(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(DeallocationToScfPassBase) + +protected: +}; + +template +class SplitAllocTensorsPassBase : public ::mlir::OperationPass { +public: + using Base = SplitAllocTensorsPassBase; + + SplitAllocTensorsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + SplitAllocTensorsPassBase(const SplitAllocTensorsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("hlo-split-alloc-tensors"); + } + ::llvm::StringRef getArgument() const override { return "hlo-split-alloc-tensors"; } + + ::llvm::StringRef getDescription() const override { return "Split bufferization.alloc_tensor ops."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("SplitAllocTensorsPass"); + } + ::llvm::StringRef getName() const override { return "SplitAllocTensorsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert<::mlir::bufferization::BufferizationDialect>(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(SplitAllocTensorsPassBase) + +protected: +}; + +template +class XlaBufferArgRewritePassBase : public ::mlir::OperationPass { +public: + using Base = XlaBufferArgRewritePassBase; + + XlaBufferArgRewritePassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + XlaBufferArgRewritePassBase(const XlaBufferArgRewritePassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("hlo-xla-buffer-arg-rewrite"); + } + ::llvm::StringRef getArgument() const override { return "hlo-xla-buffer-arg-rewrite"; } + + ::llvm::StringRef getDescription() const override { return "Rewrites XLA framework buffer arguments with alias information"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("XlaBufferArgRewritePass"); + } + ::llvm::StringRef getName() const override { return "XlaBufferArgRewritePass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(XlaBufferArgRewritePassBase) + +protected: +}; +#undef GEN_PASS_CLASSES +#endif // GEN_PASS_CLASSES diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/deallocation_utils/deallocation/utils/util.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/deallocation_utils/deallocation/utils/util.h new file mode 100644 index 0000000000000000000000000000000000000000..14ff8ec0798a859c8eea38bc8ab2603311e619f6 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/deallocation_utils/deallocation/utils/util.h @@ -0,0 +1,150 @@ +/* Copyright 2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef MLIR_HLO_DEALLOCATION_UTILS_UTIL_H_ +#define MLIR_HLO_DEALLOCATION_UTILS_UTIL_H_ + +#include +#include + +#include "llvm/ADT/EquivalenceClasses.h" +#include "mlir/Interfaces/ControlFlowInterfaces.h" + +namespace mlir { +namespace deallocation { + +struct RegionEdge { + // The op in the predecessor that holds the values that are passed. This is + // either the parent op or a terminator in the predecessor region. + Operation* predecessorOp; + // The index in `opWithOperands`' operands where `operands` start. + int64_t predecessorOperandIndex; + // The op or region where the values are passed. If the successor is the + // parent region, this is the parent op. + llvm::PointerUnion successorOpOrRegion; + // The index in the successor's arguments or op results where `operands` + // start. + int64_t successorValueIndex; + RegionBranchPoint predecessorRegionPoint = RegionBranchPoint::parent(); + RegionBranchPoint successorRegionPoint = RegionBranchPoint::parent(); + + ValueRange getPredecessorOperands() const { + return predecessorOp->getOperands().drop_front(predecessorOperandIndex); + } + + Value getPredecessorOperand(unsigned successorIndex) const { + return getPredecessorOperands()[successorIndex - successorValueIndex]; + } + + ValueRange getSuccessorValues() const { + if (successorOpOrRegion.is()) { + return successorOpOrRegion.get()->getResults().drop_front( + successorValueIndex); + } + return successorOpOrRegion.get()->getArguments().drop_front( + successorValueIndex); + } + + Value getSuccessorValue(unsigned predecessorIndex) const { + return getSuccessorValues()[predecessorIndex - predecessorOperandIndex]; + } +}; + +// Returns predecessors of the given region. +SmallVector getPredecessorRegions(RegionBranchOpInterface op, + RegionBranchPoint index); + +SmallVector getSuccessorRegions(RegionBranchOpInterface op, + RegionBranchPoint index); + +// Replaces the op with a new op with proper return types. The old op is not +// removed and it still has uses. +RegionBranchOpInterface moveRegionsToNewOpButKeepOldOp( + RegionBranchOpInterface op); + +namespace detail { +// An arbitrary deterministic Value order. +struct ValueComparator { + bool operator()(const Value& lhs, const Value& rhs) const { + if (lhs == rhs) return false; + + // Block arguments are less than results. + bool lhsIsBBArg = lhs.isa(); + if (lhsIsBBArg != rhs.isa()) { + return lhsIsBBArg; + } + + Region* lhsRegion; + Region* rhsRegion; + if (lhsIsBBArg) { + auto lhsBBArg = llvm::cast(lhs); + auto rhsBBArg = llvm::cast(rhs); + if (lhsBBArg.getArgNumber() != rhsBBArg.getArgNumber()) { + return lhsBBArg.getArgNumber() < rhsBBArg.getArgNumber(); + } + lhsRegion = lhsBBArg.getParentRegion(); + rhsRegion = rhsBBArg.getParentRegion(); + assert(lhsRegion != rhsRegion && + "lhsRegion == rhsRegion implies lhs == rhs"); + } else if (lhs.getDefiningOp() == rhs.getDefiningOp()) { + return llvm::cast(lhs).getResultNumber() < + llvm::cast(rhs).getResultNumber(); + } else { + lhsRegion = lhs.getDefiningOp()->getParentRegion(); + rhsRegion = rhs.getDefiningOp()->getParentRegion(); + if (lhsRegion == rhsRegion) { + return lhs.getDefiningOp()->isBeforeInBlock(rhs.getDefiningOp()); + } + } + + // lhsRegion != rhsRegion, so if we look at their ancestor chain, they + // - have different heights + // - or there's a spot where their region numbers differ + // - or their parent regions are the same and their parent ops are + // different. + while (lhsRegion && rhsRegion) { + if (lhsRegion->getRegionNumber() != rhsRegion->getRegionNumber()) { + return lhsRegion->getRegionNumber() < rhsRegion->getRegionNumber(); + } + if (lhsRegion->getParentRegion() == rhsRegion->getParentRegion()) { + return lhsRegion->getParentOp()->isBeforeInBlock( + rhsRegion->getParentOp()); + } + lhsRegion = lhsRegion->getParentRegion(); + rhsRegion = rhsRegion->getParentRegion(); + } + if (rhsRegion) return true; + assert(lhsRegion && "this should only happen if lhs == rhs"); + return false; + } +}; +} // namespace detail + +namespace breaks_if_you_move_ops { + +// The comparator depends on the location of ops, so if you insert an op into +// a set and then move it, it may end up in the wrong location. +using ValueEquivalenceClasses = + llvm::EquivalenceClasses; +using ValueSet = std::set; +template +using ValueMap = std::map; + +} // namespace breaks_if_you_move_ops + +} // namespace deallocation +} // namespace mlir + +#endif // MLIR_HLO_DEALLOCATION_UTILS_UTIL_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/gml_st/gml_st/IR/gml_st_ops.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/gml_st/gml_st/IR/gml_st_ops.h new file mode 100644 index 0000000000000000000000000000000000000000..55ade3e4c4a76a6db2d20d88f78f39c36e9d0377 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/gml_st/gml_st/IR/gml_st_ops.h @@ -0,0 +1,36 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +// This file defines the operations used in the GML ST dialect. + +#ifndef MLIR_HLO_GML_ST_IR_GML_ST_OPS_H +#define MLIR_HLO_GML_ST_IR_GML_ST_OPS_H + +#include "mlir/Bytecode/BytecodeOpInterface.h" +#include "mlir/IR/Dialect.h" +#include "mlir/IR/MLIRContext.h" +#include "mlir/IR/OpDefinition.h" +#include "mlir/Interfaces/ControlFlowInterfaces.h" +#include "mlir/Interfaces/DestinationStyleOpInterface.h" +#include "mlir/Interfaces/SideEffectInterfaces.h" + +// Generated dialect declarations. +#include "gml_st/IR/gml_st_dialect.h.inc" + +// Generated operation classes. +#define GET_OP_CLASSES +#include "gml_st/IR/gml_st_ops.h.inc" + +#endif // MLIR_HLO_GML_ST_IR_GML_ST_OPS_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/gml_st_bufferizable_op_interface/gml_st/interfaces/bufferizable_op_interface_impl.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/gml_st_bufferizable_op_interface/gml_st/interfaces/bufferizable_op_interface_impl.h new file mode 100644 index 0000000000000000000000000000000000000000..54739c5b3acc768c32110427a8168402cf13e195 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/gml_st_bufferizable_op_interface/gml_st/interfaces/bufferizable_op_interface_impl.h @@ -0,0 +1,29 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef MLIR_HLO_GML_ST_INTERFACES_BUFFERIZABLE_OP_INTERFACE_IMPL_H +#define MLIR_HLO_GML_ST_INTERFACES_BUFFERIZABLE_OP_INTERFACE_IMPL_H + +namespace mlir { +class DialectRegistry; + +namespace gml_st { + +void registerBufferizableOpInterfaceExternalModels(DialectRegistry ®istry); + +} // namespace gml_st +} // namespace mlir + +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/gml_st_ops_inc_gen/gml_st/IR/gml_st_dialect.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/gml_st_ops_inc_gen/gml_st/IR/gml_st_dialect.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..9fecd03349f09e7085088bd316a9568f83dacd80 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/gml_st_ops_inc_gen/gml_st/IR/gml_st_dialect.h.inc @@ -0,0 +1,26 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: gml_st_ops.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace gml_st { + +class GmlStDialect : public ::mlir::Dialect { + explicit GmlStDialect(::mlir::MLIRContext *context); + + void initialize(); + friend class ::mlir::MLIRContext; +public: + ~GmlStDialect() override; + static constexpr ::llvm::StringLiteral getDialectNamespace() { + return ::llvm::StringLiteral("gml_st"); + } +}; +} // namespace gml_st +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gml_st::GmlStDialect) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/gml_st_ops_inc_gen/gml_st/IR/gml_st_ops.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/gml_st_ops_inc_gen/gml_st/IR/gml_st_ops.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..78d354f426ea5c14ba34868d1f6ea5957c4f495c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/gml_st_ops_inc_gen/gml_st/IR/gml_st_ops.h.inc @@ -0,0 +1,298 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: gml_st_ops.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#if defined(GET_OP_CLASSES) || defined(GET_OP_FWD_DEFINES) +#undef GET_OP_FWD_DEFINES +namespace mlir { +namespace gml_st { +class FusionOp; +} // namespace gml_st +} // namespace mlir +namespace mlir { +namespace gml_st { +class YieldOp; +} // namespace gml_st +} // namespace mlir +#endif + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace gml_st { + +//===----------------------------------------------------------------------===// +// ::mlir::gml_st::FusionOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FusionOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FusionOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FusionOpGenericAdaptorBase(FusionOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseI64ArrayAttr getParallelTileSizesAttr(); + ::std::optional<::llvm::ArrayRef> getParallelTileSizes(); + ::mlir::DenseI64ArrayAttr getReductionTileSizesAttr(); + ::std::optional<::llvm::ArrayRef> getReductionTileSizes(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class FusionOpGenericAdaptor : public detail::FusionOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FusionOpGenericAdaptorBase; +public: + FusionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FusionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FusionOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FusionOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getInits() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FusionOpAdaptor : public FusionOpGenericAdaptor<::mlir::ValueRange> { +public: + using FusionOpGenericAdaptor::FusionOpGenericAdaptor; + FusionOpAdaptor(FusionOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FusionOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::DestinationStyleOpInterface::Trait, ::mlir::OpTrait::IsIsolatedFromAbove> { +public: + using Op::Op; + using Op::print; + using Adaptor = FusionOpAdaptor; + template + using GenericAdaptor = FusionOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("operandSegmentSizes"), ::llvm::StringRef("parallel_tile_sizes"), ::llvm::StringRef("reduction_tile_sizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getParallelTileSizesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getParallelTileSizesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getReductionTileSizesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getReductionTileSizesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("gml_st.fusion"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getInits(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getInitsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResults(); + ::mlir::Region &getRegion(); + ::mlir::DenseI64ArrayAttr getParallelTileSizesAttr(); + ::std::optional<::llvm::ArrayRef> getParallelTileSizes(); + ::mlir::DenseI64ArrayAttr getReductionTileSizesAttr(); + ::std::optional<::llvm::ArrayRef> getReductionTileSizes(); + void setParallelTileSizesAttr(::mlir::DenseI64ArrayAttr attr); + void setParallelTileSizes(::std::optional<::llvm::ArrayRef> attrValue); + void setReductionTileSizesAttr(::mlir::DenseI64ArrayAttr attr); + void setReductionTileSizes(::std::optional<::llvm::ArrayRef> attrValue); + ::mlir::Attribute removeParallelTileSizesAttr(); + ::mlir::Attribute removeReductionTileSizesAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange results, ::mlir::ValueRange inputs, ::mlir::ValueRange inits, /*optional*/::mlir::DenseI64ArrayAttr parallel_tile_sizes, /*optional*/::mlir::DenseI64ArrayAttr reduction_tile_sizes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + /// Return terminator of the region body. + YieldOp getTerminator(); + + // Implement method necessary for DestinationStyleOpInterface. + mlir::MutableOperandRange getDpsInitsMutable() { + return getInitsMutable(); + } +}; +} // namespace gml_st +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gml_st::FusionOp) + +namespace mlir { +namespace gml_st { + +//===----------------------------------------------------------------------===// +// ::mlir::gml_st::YieldOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class YieldOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + YieldOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + YieldOpGenericAdaptorBase(YieldOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class YieldOpGenericAdaptor : public detail::YieldOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::YieldOpGenericAdaptorBase; +public: + YieldOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + YieldOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : YieldOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + YieldOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getValues() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class YieldOpAdaptor : public YieldOpGenericAdaptor<::mlir::ValueRange> { +public: + using YieldOpGenericAdaptor::YieldOpGenericAdaptor; + YieldOpAdaptor(YieldOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class YieldOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::RegionBranchTerminatorOpInterface::Trait, ::mlir::OpTrait::ReturnLike, ::mlir::OpTrait::IsTerminator> { +public: + using Op::Op; + using Op::print; + using Adaptor = YieldOpAdaptor; + template + using GenericAdaptor = YieldOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("gml_st.yield"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getValues(); + ::mlir::MutableOperandRange getValuesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange values); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::MutableOperandRange getMutableSuccessorOperands(::mlir::RegionBranchPoint point); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace gml_st +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::gml_st::YieldOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/gml_st_passes/gml_st/transforms/fusion/fusion.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/gml_st_passes/gml_st/transforms/fusion/fusion.h new file mode 100644 index 0000000000000000000000000000000000000000..b1b9181108e0e8354652bfb31515efb09132c248 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/gml_st_passes/gml_st/transforms/fusion/fusion.h @@ -0,0 +1,83 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef MLIR_HLO_GML_ST_TRANSFORMS_FUSION_FUSION_H +#define MLIR_HLO_GML_ST_TRANSFORMS_FUSION_FUSION_H + +#include + +#include "gml_st/transforms/peeling/peeling.h" +#include "gml_st/transforms/tiling/tiling.h" +#include "mlir/Dialect/SCF/Transforms/TileUsingInterface.h" +#include "mlir/Dialect/Tensor/IR/Tensor.h" +#include "mlir/IR/PatternMatch.h" + +namespace mlir::gml_st { + +struct FusionCluster { + SetVector operations; + Operation *root; + // Map from Value of the fusion cluster argument to the root dimensions. + llvm::SmallVector>> argDimsMapping; +}; +// Cluster producers and consumers around the root op. +FusionCluster getFusionCluster( + Operation *op, llvm::function_ref producerFilterFn, + llvm::function_ref consumerFilterFn); + +// Creates gml_st.fusion op with a region with ops from the fusion cluster. +// Operands of the ops in the region are replaced with region arguments to +// isolate the fusion cluster form above. Usages of the ops are replaces with +// the fusion op results. +FailureOr wrapFusionCluster( + PatternRewriter &rewriter, const FusionCluster &fusionCluster); + +// Replaces gml_st.fusion op with ops from the region. +LogicalResult inlineFusionCluster(FusionOp fusionOp, PatternRewriter &rewriter); + +// Adds patterns to duplicate linalg.fill and tensor.empty that used as init +// parameters. +void populateDuplicateInitOpsPatterns(RewritePatternSet &patterns); + +// Fuses an op into `tensor.extract_slice` and performs the necessary updates to +// the surrounding loop if any. +FailureOr fuse(PatternRewriter &rewriter, + tensor::ExtractSliceOp materializeOp); + +// Finds `tensor.extract_slice` ops in the block and fuses ops into them. +// Verifies that fusion candidate doesn't have any uses except the one +// `tensor.extract_slice` in the block to avoid exponential code growth. +void fuseGreedily(PatternRewriter &rewriter, ArrayRef blocks, + llvm::function_ref filterFn = nullptr); + +// Tiles the op to gml_st.parallel and fuses greedily according to the filter. +FailureOr tileUsingSCFForallOpAndFuseGreedily( + PatternRewriter &rewriter, Operation *op, const scf::SCFTilingOptions &opts, + llvm::function_ref fuseFilterFn = nullptr); + +// Tiles the op to scf.for and fuses greedily according to the filter. +FailureOr tileUsingSCFForOpAndFuseGreedily( + PatternRewriter &rewriter, Operation *op, const scf::SCFTilingOptions &opts, + llvm::function_ref fuseFilterFn = nullptr); + +// Tiles the op to 1 for all dimensions and fuses greedily according to the +// filter function. +LogicalResult tilePeeledOpsToScalars( + PatternRewriter &rewriter, const GmlStPeelingResult &peelingResult, + llvm::function_ref fuseFilterFn = nullptr); + +} // namespace mlir::gml_st + +#endif // MLIR_HLO_GML_ST_TRANSFORMS_FUSION_FUSION_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/gml_st_passes/gml_st/transforms/passes.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/gml_st_passes/gml_st/transforms/passes.h new file mode 100644 index 0000000000000000000000000000000000000000..12b02debc705faf60b097b80bf9f522ccf10cf8c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/gml_st_passes/gml_st/transforms/passes.h @@ -0,0 +1,251 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef MLIR_HLO_GML_ST_TRANSFORMS_PASSES_H +#define MLIR_HLO_GML_ST_TRANSFORMS_PASSES_H + +#include +#include +#include +#include + +#include "mlir/Dialect/Func/IR/FuncOps.h" +#include "mlir/Dialect/LLVMIR/LLVMDialect.h" // IWYU pragma: keep +#include "mlir/IR/BuiltinOps.h" +#include "mlir/Pass/Pass.h" + +namespace mlir::gml_st { + +#define GEN_PASS_DECL +#include "gml_st/transforms/passes.h.inc" + +/// Pass to fuse producers into a tiled consumer. +std::unique_ptr> createFusionPass( + StringRef producer = "", StringRef consumer = ""); + +/// Pass to match, tile, and fuse softmax implementations. +std::unique_ptr> createTilingSoftmaxPass( + ArrayRef tileSizes); +std::unique_ptr> createTilingSoftmaxPass(); + +/// Pass to tile the root operation and to greedily fuse producers into it. +std::unique_ptr> createGreedyFusionPass( + ArrayRef tileSizes); +std::unique_ptr> createGreedyFusionPass(); + +// Pass to collapse dimensions of bcasts, reductions, and cwise ops. +std::unique_ptr> createCollapseShapePass(); +std::unique_ptr> createCollapseShapePass( + const CollapseShapePassOptions &options); + +// Pass to tile all tileable ops to size 1. +std::unique_ptr> createTileByOnePass(); + +/// Pass to compose tensor.extract_slice/insert_slice ops. +std::unique_ptr> +createComposeExtractInsertSlicePass(); + +/// Pass to vectorize compute ops and scf.for loops that are tiled perfectly. +std::unique_ptr> createVectorizeForCPUPass( + int64_t numElementsThreshold = 1024); + +/// Pass to vectorize `memref.copy`. +std::unique_ptr> createVectorizeCopyPass( + int64_t numElementsThreshold = 8); + +/// Pass to remove redundant `memref.copy` ops. +std::unique_ptr> createNaiveCopyRemovalPass(); + +/// Pass to gradually lower vector ops to SCF. +std::unique_ptr> createLowerVectorsPass( + bool enableAVX2 = true, bool flatten = false); + +/// Pass to pack linalg.matmul as linalg.mmt4d. +std::unique_ptr> createPackMatmulPass(); + +/// Pass to transform a thlo.scatter op for CPU backend. +std::unique_ptr> createTransformScatterForCpuPass(); + +/// Pass to transform a dot operation for CPU backend. +std::unique_ptr> createTransformDotForCpuPass( + ArrayRef tileSizes = {}, StringRef cpuName = ""); + +/// Pass to transform tensor.pack/unpack ops for CPU backend. +std::unique_ptr> createTransformPackForCpuPass(); + +/// Pass to transform a linalg.mmt4d op for CPU backend. +std::unique_ptr> createTransformMmt4DForCpuPass(); + +/// Pass to fuse linalg on tensor operations. +std::unique_ptr> createFusionOfTensorOpsPass(); + +/// Pass to convert ops on tensors with 1 element to scalar ops. +std::unique_ptr> createScalarizationPass( + bool scalarizeAllThlo = true); + +/// Pass to transform elementwise ops for CPU backend. +std::unique_ptr> +createTransformElementwiseForCpuPass(int64_t vectorSize = 8, + bool fuseDegenerateReshapes = false); + +/// Pass to transform a linalg.reduce op for CPU backend. +std::unique_ptr createTransformReduceForCpuPass( + const TransformReduceForCpuPassOptions &option = {}); + +/// Pass to create fusion clusters. +std::unique_ptr> +createFusionPlanningForCpuPass(int64_t vectorSize = 8); + +/// Pass to outline fusion regions into functions. +std::unique_ptr> createFusionOutliningPass(); + +/// Pass to inline fusion clusters. +std::unique_ptr> +createInlineFusionClustersPass(); + +/// Pass with canonicalization patterns for linalg ops. +std::unique_ptr> +createOptimizeLinalgOpsPass(); + +/// Pass to rewrite tensor.from_elements into tensor.insert. +std::unique_ptr> +createRewriteFromElementsOpPass(); + +/// Pass to rewrite scf.forall to scf.for. +std::unique_ptr> +createRewriteForallOpPass(); + +/// Pass to add debug info to be propagated into LLVM backend. +std::unique_ptr> createAddDebugInfoPass(); + +/// Pass to print stats about tileable ops. +std::unique_ptr> createCollectStatsPass( + int64_t level = 0); + +/// Pass to remove all transformed labels from tiled ops. +std::unique_ptr> +createRemoveLabelPass(); + +/// Populate pattern to remove single/zero iteration scf.forall dimensions. +void populateCollapseForallOpDimensionsPattern(RewritePatternSet &patterns); + +struct GmlStCPUTilingOptions + : public mlir::PassPipelineOptions { + GmlStCPUTilingOptions() = default; + GmlStCPUTilingOptions(const GmlStCPUTilingOptions &opts) { + this->lowerToMmt4d = opts.lowerToMmt4d; + this->matmulTileSizes = opts.matmulTileSizes; + this->reduction1DTileSize = opts.reduction1DTileSize; + this->reduction1DSplitRatio = opts.reduction1DSplitRatio; + this->reduction2DParallelDimTileSize = opts.reduction2DParallelDimTileSize; + this->reduction2DReductionDimTileSize = + opts.reduction2DReductionDimTileSize; + this->vectorSize = opts.vectorSize; + this->statsDetailLevel = opts.statsDetailLevel; + this->cpuName = opts.cpuName; + this->inlineFusionClusters = opts.inlineFusionClusters; + } + + Option vectorSize{*this, "vector-size", + llvm::cl::desc("Vector size for a 1D reduction."), + llvm::cl::init(8)}; + + Option reductionEnableHeuristic{ + *this, "reduction-enable-heuristic", + llvm::cl::desc("Enable tiling parameters heuristic for reductions."), + llvm::cl::init(false)}; + + Option reduction1DTileSize{ + *this, "reduction-1d-tile-size", + llvm::cl::desc("Tile size for a 1D reduction."), llvm::cl::init(32)}; + + Option reduction1DSplitRatio{ + *this, "reduction-1d-split-ratio", + llvm::cl::desc("Ratio used to split the reduction dimension"), + llvm::cl::init(8)}; + + Option reduction2DParallelDimTileSize{ + *this, "reduction-2d-parallel-dim-tile-size", + llvm::cl::desc("Tile size for the parallel dimension of a 2D reduction."), + llvm::cl::init(4)}; + + Option reduction2DReductionDimTileSize{ + *this, "reduction-2d-reduction-dim-tile-size", + llvm::cl::desc( + "Tile size for the reduction dimension of a 2D reduction."), + llvm::cl::init(4)}; + + ListOption matmulTileSizes{ + *this, "matmul-tile-sizes", + llvm::cl::desc("Tile sizes for `linalg.matmul`. Leave empty to determine " + "sizes automatically."), + llvm::cl::list_init({}), llvm::cl::ZeroOrMore}; + + Option vectorizationSizeThreshold{ + *this, "vectorization-size-threshold", + llvm::cl::desc("Threshold size for vectorization."), llvm::cl::init(128)}; + + Option vectorizationTiledSizeThreshold{ + *this, "vectorization-tiled-size-threshold", + llvm::cl::desc("Threshold size for vectorization after tiling."), + llvm::cl::init(1024)}; + + Option lowerToMmt4d{ + *this, "lower-to-mmt4d", + llvm::cl::desc("Enable the specific code generation (packing) for matmul " + "operations."), + llvm::cl::init(false)}; + + Option cpuName{ + *this, "cpu", + llvm::cl::desc("CPU name, similar to llc's -mcpu flag. e.g. 'znver2', " + "'skylake-avx512'."), + llvm::cl::init("")}; + + Option statsDetailLevel{ + *this, "stats-detail-level", + llvm::cl::desc("Detail level for collecting IR statistics."), + llvm::cl::init(0)}; + + Option fuseDegenerateReshapes{ + *this, "fuse-degenerate-reshapes", + llvm::cl::desc("Fuse through tensor.expand/collapse_shape"), + llvm::cl::init(false)}; + + Option inlineFusionClusters{ + *this, "inline-fusion-clusters", + llvm::cl::desc("Inline fusion clusters at the end of the pipeline."), + llvm::cl::init(true)}; +}; + +// Returns default "optimized" tiling parameters. +GmlStCPUTilingOptions getDefaultCPUPipelineOptions( + StringRef cpuName, int64_t statsDetailLevel = 0); + +// Adds tiling-fusion-vectorization passes for tHLO/Linalg ops mix. +void addCPUTilingPipeline(OpPassManager &pm, + const GmlStCPUTilingOptions &options); + +// Adds tiling-fusion-vectorization passes for tHLO/Linalg ops mix with the +// "optimized" tiling parameters. +void addDefaultCPUTilingPipeline(OpPassManager &pm, StringRef cpuName, + int64_t statsDetailLevel = 0); + +#define GEN_PASS_REGISTRATION +#include "gml_st/transforms/passes.h.inc" + +} // namespace mlir::gml_st + +#endif // MLIR_HLO_GML_ST_TRANSFORMS_PASSES_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/gml_st_passes/gml_st/transforms/peeling/peeling.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/gml_st_passes/gml_st/transforms/peeling/peeling.h new file mode 100644 index 0000000000000000000000000000000000000000..da3412b8b9901f0ad9e01fa23a2b97ba636aadb5 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/gml_st_passes/gml_st/transforms/peeling/peeling.h @@ -0,0 +1,51 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef MLIR_HLO_GML_ST_TRANSFORMS_PEELING_PEELING_H +#define MLIR_HLO_GML_ST_TRANSFORMS_PEELING_PEELING_H + +#include "gml_st/IR/gml_st_ops.h" +#include "mlir/Dialect/SCF/IR/SCF.h" +#include "mlir/IR/PatternMatch.h" + +namespace mlir { +namespace gml_st { + +struct GmlStPeelingResult { + scf::ForallOp mainLoop = nullptr; + SmallVector tailLoops = {}; +}; + +/// Rewrite a scf::ForallOp with bounds/step that potentially do not divide +/// evenly into a scf::ForallOp where the step divides the iteration space +/// evenly, followed by another scf::ForallOp for the last (partial) +/// iteration (if any). This transformation is called "loop peeling". +/// +/// These functions peel all loops in the loop nest by calling +/// peelAndCanonicalizeGmlStLoop. Additionally, they mark all loops (main and +/// remainder loops) as peeled, so the same loop is not rewritten a second time. +GmlStPeelingResult peelAllLoops(scf::ForallOp loop, + mlir::PatternRewriter &rewriter); + +struct SCFForPeelingResult { + scf::ForOp mainLoop = nullptr; + scf::ForOp tailLoop = nullptr; +}; +SCFForPeelingResult peelSCFForOp(RewriterBase &rewriter, scf::ForOp); + +} // namespace gml_st +} // namespace mlir + +#endif // MLIR_HLO_GML_ST_TRANSFORMS_PEELING_PEELING_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/gml_st_passes/gml_st/transforms/scalarization/scalarization.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/gml_st_passes/gml_st/transforms/scalarization/scalarization.h new file mode 100644 index 0000000000000000000000000000000000000000..9455aa1c95eb18ff9518ded5c611717c2290d230 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/gml_st_passes/gml_st/transforms/scalarization/scalarization.h @@ -0,0 +1,58 @@ +/* Copyright 2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef MLIR_HLO_GML_ST_TRANSFORMS_SCALARIZATION_SCALARIZATION_H +#define MLIR_HLO_GML_ST_TRANSFORMS_SCALARIZATION_SCALARIZATION_H + +#include "mlir/Dialect/Linalg/IR/Linalg.h" +#include "mlir/Dialect/SCF/IR/SCF.h" +#include "mlir/IR/PatternMatch.h" +#include "thlo/IR/thlo_ops.h" + +namespace mlir { +namespace gml_st { + +/// Rewrites thlo.concatenate, returns `failure` if IR was not changed. +LogicalResult scalarizeConcatenateOp(thlo::ConcatenateOp concatenateOp, + PatternRewriter &rewriter); + +/// Rewrites thlo.dynamic_broadcast_in_dim, returns `failure` if IR was not +/// changed. +LogicalResult scalarizeDynamicBroadcastInDimOp( + thlo::DynamicBroadcastInDimOp broadcastOp, PatternRewriter &rewriter); + +/// Rewrites thlo.gather, returns `failure` if IR was not changed. +LogicalResult scalarizeGatherOp(thlo::GatherOp gatherOp, + PatternRewriter &rewriter); + +/// Rewrites LinalgOp interface ops, returns `failure` if IR was not changed. +LogicalResult scalarizeLinalgOp(linalg::LinalgOp linalgOp, + PatternRewriter &rewriter); + +/// Rewrites thlo.reverse, returns `failure` if IR was not changed. +LogicalResult scalarizeReverseOp(thlo::ReverseOp reverseOp, + PatternRewriter &rewriter); + +/// Rewrites thlo.scatter, returns `failure` if IR was not changed. +LogicalResult scalarizeScatterOp(thlo::ScatterOp scatterOp, + PatternRewriter &rewriter); + +FailureOr rewriteScatterOpAsIfOp(thlo::ScatterOp scatterOp, + PatternRewriter &rewriter); + +} // namespace gml_st +} // namespace mlir + +#endif // MLIR_HLO_GML_ST_TRANSFORMS_SCALARIZATION_SCALARIZATION_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/gml_st_passes/gml_st/transforms/tiling/tiling.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/gml_st_passes/gml_st/transforms/tiling/tiling.h new file mode 100644 index 0000000000000000000000000000000000000000..47d852dcdf1aac3f3435f66ce9b871c403b3dc4f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/gml_st_passes/gml_st/transforms/tiling/tiling.h @@ -0,0 +1,50 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef MLIR_HLO_GML_ST_TRANSFORMS_TILING_TILING_H +#define MLIR_HLO_GML_ST_TRANSFORMS_TILING_TILING_H + +#include + +#include "mlir/Dialect/SCF/IR/SCF.h" +#include "mlir/Dialect/SCF/Transforms/TileUsingInterface.h" +#include "mlir/IR/PatternMatch.h" +#include "mlir/Interfaces/TilingInterface.h" + +namespace mlir::gml_st { + +// Creates SCFTilingOptions from the list of tile sizes. +scf::SCFTilingOptions getSCFTilingOptions(MLIRContext *context, + ArrayRef tileSizes); + +/// Returns `failure`, when there occurs a problem during tiling. If the tile +/// sizes are smaller then the iteration domain of the op, it will still create +/// an `scf.forall` op. This is matches the behavior of tiling to `scf.for` +/// upstream. +struct GMLSTTilingResult { + SmallVector tiledOps; + scf::ForallOp loop = nullptr; +}; +FailureOr tileUsingSCFForallOp( + PatternRewriter &rewriter, TilingInterface op, + const scf::SCFTilingOptions &options); + +/// Extracts all yielded values from scf.in_parallel terminator. It should be +/// upstreamed. +SmallVector getYieldedValues(scf::InParallelOp inParallelOp); + +} // namespace mlir::gml_st + +#endif // MLIR_HLO_GML_ST_TRANSFORMS_TILING_TILING_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/gml_st_passes/gml_st/transforms/vectorization/vectorization.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/gml_st_passes/gml_st/transforms/vectorization/vectorization.h new file mode 100644 index 0000000000000000000000000000000000000000..ede8e9320ff11d7d4c9dd5d3c31ff63a195da9dc --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/gml_st_passes/gml_st/transforms/vectorization/vectorization.h @@ -0,0 +1,53 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef MLIR_HLO_GML_ST_TRANSFORMS_VECTORIZATION_VECTORIZATION_H +#define MLIR_HLO_GML_ST_TRANSFORMS_VECTORIZATION_VECTORIZATION_H + +#include "mlir/Dialect/Linalg/Transforms/Transforms.h" +#include "mlir/IR/MLIRContext.h" +#include "mlir/IR/PatternMatch.h" +#include "mlir/Support/LogicalResult.h" + +namespace mlir { +namespace gml_st { + +// TODO(manany): This should be parameterized later on depending on hardware. +static constexpr int64_t kNumElementsVectorization = 8; + +template +struct VectorizationPattern : public mlir::OpRewritePattern { + VectorizationPattern(MLIRContext *context, + llvm::function_ref matchFn, + mlir::PatternBenefit benefit = 1) + : mlir::OpRewritePattern(context, benefit), filterFn(matchFn) {} + + LogicalResult matchAndRewrite(OpTy op, + PatternRewriter &rewriter) const override { + if (!filterFn(op)) + return rewriter.notifyMatchFailure(op, "did not match filter"); + return mlir::linalg::vectorize(rewriter, op); + } + + private: + llvm::function_ref filterFn; +}; + +RewritePatternSet getDefaultVectorizationPatterns(MLIRContext *ctx); + +} // namespace gml_st +} // namespace mlir + +#endif // MLIR_HLO_GML_ST_TRANSFORMS_VECTORIZATION_VECTORIZATION_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/gml_st_passes/gml_st/utils/linalg_utils.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/gml_st_passes/gml_st/utils/linalg_utils.h new file mode 100644 index 0000000000000000000000000000000000000000..aef0a7603ad3f73b393b7403a1add6c9e03f3115 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/gml_st_passes/gml_st/utils/linalg_utils.h @@ -0,0 +1,77 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef MLIR_HLO_GML_ST_UTILS_LINALG_UTILS_H +#define MLIR_HLO_GML_ST_UTILS_LINALG_UTILS_H + +#include "mlir/Dialect/Linalg/IR/Linalg.h" + +namespace mlir::gml_st { + +// Helper functions to match Linalg ops that implement simple reductions, +// bcasts, and cwise ops. + +struct SimpleBcastReduction { + Operation *bcast; + Operation *reduction; + Value operand; +}; + +bool isSimpleBcastReduction(Operation *op, int64_t *dimension = nullptr, + SimpleBcastReduction *chain = nullptr); + +// The Conv2D is transformable into a matmul, if it has the following shape +// +// linalg.conv_2d_nhwc_hwcf +// {dilations = dense<1> : tensor<2xi64>, strides = dense<1> : tensor<2xi64>} +// ins(%input, %kernel : tensor<1x(N+L-1)xKx1xf32>, tensor) +// outs(%fill : tensor<1xNx1xM>) -> tensor<1xNx1xMxf32> +// +// in that case we can tile w.r.t. L to bring it to the following form +// +// linalg.conv_2d_nhwc_hwcf +// {dilations = dense<1> : tensor<2xi64>, strides = dense<1> : tensor<2xi64>} +// ins(%input, %kernel : tensor<1xNxKx1xf32>, tensor<1xKx1xMxf32>) +// outs(%fill : tensor<1xNx1xM>) -> tensor<1xNx1xMxf32> +bool isTransformableIntoMatmul(linalg::Conv2DNhwcHwcfOp convOp); + +// linalg.conv_2d_nhwc_hwcf +// {dilations = dense<1> : tensor<2xi64>, strides = dense<1> : tensor<2xi64>} +// ins(%input, %kernel : tensor<1xNxKx1xf32>, tensor<1xKx1xMxf32>) +// outs(%fill : tensor<1xNx1xM>) -> tensor<1xNx1xMxf32> +// +// into +// +// linalg.matmul +// ins(%lhs, %rhs : tensor, tensor) +// outs(%fill : tensor) -> tensor<1xNx1xMxf32> +FailureOr convertConvToMatmul(linalg::Conv2DNhwcHwcfOp convOp, + PatternRewriter &rewriter); + +// Converts linalg.batch_matmul into linalg.matmul. +FailureOr convertBatchMatmulToMatmul( + linalg::BatchMatmulOp batchMatmulOp, PatternRewriter &rewriter); + +// Converts linalg.matvec into linalg.dot. +FailureOr convertMatvecToDotOp(PatternRewriter &rewriter, + linalg::MatvecOp matvecOp); + +// Converts linalg.dot into linalg.reduce(linalg.map). +FailureOr convertDotOpToReduce(linalg::DotOp dotOp, + PatternRewriter &rewriter); + +} // namespace mlir::gml_st + +#endif // MLIR_HLO_GML_ST_UTILS_LINALG_UTILS_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/gml_st_passes/gml_st/utils/tensor_utils.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/gml_st_passes/gml_st/utils/tensor_utils.h new file mode 100644 index 0000000000000000000000000000000000000000..0d0de996984ef0eff2f60f2315b1b1385321b771 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/gml_st_passes/gml_st/utils/tensor_utils.h @@ -0,0 +1,57 @@ +/* Copyright 2023 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef MLIR_HLO_GML_ST_UTILS_TENSOR_UTILS_H +#define MLIR_HLO_GML_ST_UTILS_TENSOR_UTILS_H + +#include "mlir/Dialect/Tensor/IR/Tensor.h" +#include "mlir/Dialect/Utils/ReshapeOpsUtils.h" + +namespace mlir { +namespace gml_st { + +// TODO(vuson): maybe overload this function instead of templating it. +// Check if the reshape operation is only expanding into/collapsing of +// unit-dimension. +template +bool isDegenerateReshapeOp(TensorReshapeOp reshapeOp) { + constexpr bool isExpanding = + std::is_same::value; + llvm::ArrayRef expandedShape = + (isExpanding ? reshapeOp.getResultType().getShape() + : reshapeOp.getSrcType().getShape()); + for (auto& indices : reshapeOp.getReassociationIndices()) { + // For each reassociation indices, a degenerate reshape op only has at most + // 1 non-unit-dimension, i.e. number of unit-dimensions is greater or equal + // to the indices size - 1. + if (static_cast( + llvm::count_if(indices, [&expandedShape](int64_t idx) { + return expandedShape[idx] == 1; + })) < indices.size() - 1) + return false; + } + return true; +} + +// Returns ids of size-1 dims that were expanded or collapsed by +// tensor.expand_shape/tensor.collapse_shape. +SmallVector getPreservedDimensions( + ArrayRef shape, + ArrayRef reassociationIndices); + +} // namespace gml_st +} // namespace mlir + +#endif // MLIR_HLO_GML_ST_UTILS_TENSOR_UTILS_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/gml_st_passes_inc_gen/gml_st/transforms/passes.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/gml_st_passes_inc_gen/gml_st/transforms/passes.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..9639d899e3c49e3f19c1354eef2c655312775233 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/gml_st_passes_inc_gen/gml_st/transforms/passes.h.inc @@ -0,0 +1,3250 @@ +/* Autogenerated by mlir-tblgen; don't manually edit */ + +#ifdef GEN_PASS_DECL +// Generate declarations for all passes. +#define GEN_PASS_DECL_ADDDEBUGINFOPASS +#define GEN_PASS_DECL_COLLAPSESHAPEPASS +#define GEN_PASS_DECL_COLLECTSTATSPASS +#define GEN_PASS_DECL_COMPOSEEXTRACTINSERTSLICEPASS +#define GEN_PASS_DECL_FUSIONOUTLININGPASS +#define GEN_PASS_DECL_FUSIONPLANNINGFORCPUPASS +#define GEN_PASS_DECL_INLINEFUSIONCLUSTERSPASS +#define GEN_PASS_DECL_LOWERVECTORSPASS +#define GEN_PASS_DECL_NAIVECOPYREMOVALPASS +#define GEN_PASS_DECL_OPTIMIZELINALGOPSPASS +#define GEN_PASS_DECL_PACKMATMULPASS +#define GEN_PASS_DECL_REMOVELABELPASS +#define GEN_PASS_DECL_REWRITEFORALLOPPASS +#define GEN_PASS_DECL_REWRITEFROMELEMENTSOPPASS +#define GEN_PASS_DECL_SCALARIZATIONPASS +#define GEN_PASS_DECL_TILEBYONEPASS +#define GEN_PASS_DECL_TILINGSOFTMAXPASS +#define GEN_PASS_DECL_TRANSFORMDOTFORCPUPASS +#define GEN_PASS_DECL_TRANSFORMELEMENTWISEFORCPUPASS +#define GEN_PASS_DECL_TRANSFORMMMT4DFORCPUPASS +#define GEN_PASS_DECL_TRANSFORMPACKFORCPUPASS +#define GEN_PASS_DECL_TRANSFORMREDUCEFORCPUPASS +#define GEN_PASS_DECL_TRANSFORMSCATTERFORCPUPASS +#define GEN_PASS_DECL_VECTORIZECOPYPASS +#define GEN_PASS_DECL_VECTORIZEFORCPUPASS +#undef GEN_PASS_DECL +#endif // GEN_PASS_DECL + +//===----------------------------------------------------------------------===// +// AddDebugInfoPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_ADDDEBUGINFOPASS +#undef GEN_PASS_DECL_ADDDEBUGINFOPASS +#endif // GEN_PASS_DECL_ADDDEBUGINFOPASS +#ifdef GEN_PASS_DEF_ADDDEBUGINFOPASS +namespace impl { + +template +class AddDebugInfoPassBase : public ::mlir::OperationPass { +public: + using Base = AddDebugInfoPassBase; + + AddDebugInfoPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + AddDebugInfoPassBase(const AddDebugInfoPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("add-debug-info"); + } + ::llvm::StringRef getArgument() const override { return "add-debug-info"; } + + ::llvm::StringRef getDescription() const override { return "Add debug info for the whole module"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("AddDebugInfoPass"); + } + ::llvm::StringRef getName() const override { return "AddDebugInfoPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert<::mlir::LLVM::LLVMDialect>(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(AddDebugInfoPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_ADDDEBUGINFOPASS +#endif // GEN_PASS_DEF_ADDDEBUGINFOPASS + +//===----------------------------------------------------------------------===// +// CollapseShapePass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_COLLAPSESHAPEPASS +struct CollapseShapePassOptions { + int64_t retainTrailingDims = 0; +}; +#undef GEN_PASS_DECL_COLLAPSESHAPEPASS +#endif // GEN_PASS_DECL_COLLAPSESHAPEPASS +#ifdef GEN_PASS_DEF_COLLAPSESHAPEPASS +namespace impl { + +template +class CollapseShapePassBase : public ::mlir::OperationPass { +public: + using Base = CollapseShapePassBase; + + CollapseShapePassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + CollapseShapePassBase(const CollapseShapePassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("gml-collapse-shape"); + } + ::llvm::StringRef getArgument() const override { return "gml-collapse-shape"; } + + ::llvm::StringRef getDescription() const override { return "Collapse dimensions of bcasts, reductions, and cwise ops"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("CollapseShapePass"); + } + ::llvm::StringRef getName() const override { return "CollapseShapePass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert<::mlir::tensor::TensorDialect>(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(CollapseShapePassBase) + + CollapseShapePassBase(const CollapseShapePassOptions &options) : CollapseShapePassBase() { + retainTrailingDims = options.retainTrailingDims; + } +protected: + ::mlir::Pass::Option retainTrailingDims{*this, "retain-trailing-dims", ::llvm::cl::desc("Number of trailing dimensions that will not be collapsed."), ::llvm::cl::init(0)}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_COLLAPSESHAPEPASS +#endif // GEN_PASS_DEF_COLLAPSESHAPEPASS + +//===----------------------------------------------------------------------===// +// CollectStatsPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_COLLECTSTATSPASS +#undef GEN_PASS_DECL_COLLECTSTATSPASS +#endif // GEN_PASS_DECL_COLLECTSTATSPASS +#ifdef GEN_PASS_DEF_COLLECTSTATSPASS +namespace impl { + +template +class CollectStatsPassBase : public ::mlir::OperationPass { +public: + using Base = CollectStatsPassBase; + + CollectStatsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + CollectStatsPassBase(const CollectStatsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("collect-stats"); + } + ::llvm::StringRef getArgument() const override { return "collect-stats"; } + + ::llvm::StringRef getDescription() const override { return "Print stats about tileable ops"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("CollectStatsPass"); + } + ::llvm::StringRef getName() const override { return "CollectStatsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(CollectStatsPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_COLLECTSTATSPASS +#endif // GEN_PASS_DEF_COLLECTSTATSPASS + +//===----------------------------------------------------------------------===// +// ComposeExtractInsertSlicePass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_COMPOSEEXTRACTINSERTSLICEPASS +#undef GEN_PASS_DECL_COMPOSEEXTRACTINSERTSLICEPASS +#endif // GEN_PASS_DECL_COMPOSEEXTRACTINSERTSLICEPASS +#ifdef GEN_PASS_DEF_COMPOSEEXTRACTINSERTSLICEPASS +namespace impl { + +template +class ComposeExtractInsertSlicePassBase : public ::mlir::OperationPass { +public: + using Base = ComposeExtractInsertSlicePassBase; + + ComposeExtractInsertSlicePassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ComposeExtractInsertSlicePassBase(const ComposeExtractInsertSlicePassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("gml-compose-extract-insert-slice"); + } + ::llvm::StringRef getArgument() const override { return "gml-compose-extract-insert-slice"; } + + ::llvm::StringRef getDescription() const override { return "Compose tensor.extract_slice/insert_slice ops."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ComposeExtractInsertSlicePass"); + } + ::llvm::StringRef getName() const override { return "ComposeExtractInsertSlicePass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ComposeExtractInsertSlicePassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_COMPOSEEXTRACTINSERTSLICEPASS +#endif // GEN_PASS_DEF_COMPOSEEXTRACTINSERTSLICEPASS + +//===----------------------------------------------------------------------===// +// FusionOutliningPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_FUSIONOUTLININGPASS +#undef GEN_PASS_DECL_FUSIONOUTLININGPASS +#endif // GEN_PASS_DECL_FUSIONOUTLININGPASS +#ifdef GEN_PASS_DEF_FUSIONOUTLININGPASS +namespace impl { + +template +class FusionOutliningPassBase : public ::mlir::OperationPass { +public: + using Base = FusionOutliningPassBase; + + FusionOutliningPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + FusionOutliningPassBase(const FusionOutliningPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("gml-fusion-outlining"); + } + ::llvm::StringRef getArgument() const override { return "gml-fusion-outlining"; } + + ::llvm::StringRef getDescription() const override { return "Pass to outline fusion regions into functions."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("FusionOutliningPass"); + } + ::llvm::StringRef getName() const override { return "FusionOutliningPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(FusionOutliningPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_FUSIONOUTLININGPASS +#endif // GEN_PASS_DEF_FUSIONOUTLININGPASS + +//===----------------------------------------------------------------------===// +// FusionPlanningForCpuPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_FUSIONPLANNINGFORCPUPASS +struct FusionPlanningForCpuPassOptions { + int64_t vectorSize = 8; +}; +#undef GEN_PASS_DECL_FUSIONPLANNINGFORCPUPASS +#endif // GEN_PASS_DECL_FUSIONPLANNINGFORCPUPASS +#ifdef GEN_PASS_DEF_FUSIONPLANNINGFORCPUPASS +namespace impl { + +template +class FusionPlanningForCpuPassBase : public ::mlir::OperationPass { +public: + using Base = FusionPlanningForCpuPassBase; + + FusionPlanningForCpuPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + FusionPlanningForCpuPassBase(const FusionPlanningForCpuPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("gml-st-cpu-fusion-planning"); + } + ::llvm::StringRef getArgument() const override { return "gml-st-cpu-fusion-planning"; } + + ::llvm::StringRef getDescription() const override { return "Create fusion clusters."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("FusionPlanningForCpuPass"); + } + ::llvm::StringRef getName() const override { return "FusionPlanningForCpuPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert<::mlir::arith::ArithDialect>(); + + registry.insert<::mlir::gml_st::GmlStDialect>(); + + registry.insert<::mlir::linalg::LinalgDialect>(); + + registry.insert<::mlir::tensor::TensorDialect>(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(FusionPlanningForCpuPassBase) + + FusionPlanningForCpuPassBase(const FusionPlanningForCpuPassOptions &options) : FusionPlanningForCpuPassBase() { + vectorSize = options.vectorSize; + } +protected: + ::mlir::Pass::Option vectorSize{*this, "vector-size", ::llvm::cl::desc("Tile size for the innermost dimension of `linalg.map`"), ::llvm::cl::init(8)}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_FUSIONPLANNINGFORCPUPASS +#endif // GEN_PASS_DEF_FUSIONPLANNINGFORCPUPASS + +//===----------------------------------------------------------------------===// +// InlineFusionClustersPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_INLINEFUSIONCLUSTERSPASS +#undef GEN_PASS_DECL_INLINEFUSIONCLUSTERSPASS +#endif // GEN_PASS_DECL_INLINEFUSIONCLUSTERSPASS +#ifdef GEN_PASS_DEF_INLINEFUSIONCLUSTERSPASS +namespace impl { + +template +class InlineFusionClustersPassBase : public ::mlir::OperationPass { +public: + using Base = InlineFusionClustersPassBase; + + InlineFusionClustersPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + InlineFusionClustersPassBase(const InlineFusionClustersPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("gml-st-inline-fusion-clusters"); + } + ::llvm::StringRef getArgument() const override { return "gml-st-inline-fusion-clusters"; } + + ::llvm::StringRef getDescription() const override { return "Replaces all gml_st.fusion op with ops from the region."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("InlineFusionClustersPass"); + } + ::llvm::StringRef getName() const override { return "InlineFusionClustersPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert<::mlir::gml_st::GmlStDialect>(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(InlineFusionClustersPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_INLINEFUSIONCLUSTERSPASS +#endif // GEN_PASS_DEF_INLINEFUSIONCLUSTERSPASS + +//===----------------------------------------------------------------------===// +// LowerVectorsPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_LOWERVECTORSPASS +struct LowerVectorsPassOptions { + bool enableAVX2 = true; + bool flatten = false; +}; +#undef GEN_PASS_DECL_LOWERVECTORSPASS +#endif // GEN_PASS_DECL_LOWERVECTORSPASS +#ifdef GEN_PASS_DEF_LOWERVECTORSPASS +namespace impl { + +template +class LowerVectorsPassBase : public ::mlir::OperationPass { +public: + using Base = LowerVectorsPassBase; + + LowerVectorsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + LowerVectorsPassBase(const LowerVectorsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("lower-vectors"); + } + ::llvm::StringRef getArgument() const override { return "lower-vectors"; } + + ::llvm::StringRef getDescription() const override { return "Pass to lower vector operations progressively."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LowerVectorsPass"); + } + ::llvm::StringRef getName() const override { return "LowerVectorsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert<::mlir::LLVM::LLVMDialect>(); + + registry.insert<::mlir::vector::VectorDialect>(); + + registry.insert<::mlir::affine::AffineDialect>(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LowerVectorsPassBase) + + LowerVectorsPassBase(const LowerVectorsPassOptions &options) : LowerVectorsPassBase() { + enableAVX2 = options.enableAVX2; + flatten = options.flatten; + } +protected: + ::mlir::Pass::Option enableAVX2{*this, "enable-avx2", ::llvm::cl::desc("Enable specialized lowerings for AVX2."), ::llvm::cl::init(true)}; + ::mlir::Pass::Option flatten{*this, "flatten", ::llvm::cl::desc("Flatten multiple small n-D vector transfers into a large 1-D transfer."), ::llvm::cl::init(false)}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_LOWERVECTORSPASS +#endif // GEN_PASS_DEF_LOWERVECTORSPASS + +//===----------------------------------------------------------------------===// +// NaiveCopyRemovalPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_NAIVECOPYREMOVALPASS +#undef GEN_PASS_DECL_NAIVECOPYREMOVALPASS +#endif // GEN_PASS_DECL_NAIVECOPYREMOVALPASS +#ifdef GEN_PASS_DEF_NAIVECOPYREMOVALPASS +namespace impl { + +template +class NaiveCopyRemovalPassBase : public ::mlir::OperationPass { +public: + using Base = NaiveCopyRemovalPassBase; + + NaiveCopyRemovalPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + NaiveCopyRemovalPassBase(const NaiveCopyRemovalPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("naive-copy-removal"); + } + ::llvm::StringRef getArgument() const override { return "naive-copy-removal"; } + + ::llvm::StringRef getDescription() const override { return "Pass to remove redundant `memref.copy` ops."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("NaiveCopyRemovalPass"); + } + ::llvm::StringRef getName() const override { return "NaiveCopyRemovalPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert<::mlir::memref::MemRefDialect>(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(NaiveCopyRemovalPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_NAIVECOPYREMOVALPASS +#endif // GEN_PASS_DEF_NAIVECOPYREMOVALPASS + +//===----------------------------------------------------------------------===// +// OptimizeLinalgOpsPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_OPTIMIZELINALGOPSPASS +#undef GEN_PASS_DECL_OPTIMIZELINALGOPSPASS +#endif // GEN_PASS_DECL_OPTIMIZELINALGOPSPASS +#ifdef GEN_PASS_DEF_OPTIMIZELINALGOPSPASS +namespace impl { + +template +class OptimizeLinalgOpsPassBase : public ::mlir::OperationPass { +public: + using Base = OptimizeLinalgOpsPassBase; + + OptimizeLinalgOpsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + OptimizeLinalgOpsPassBase(const OptimizeLinalgOpsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("gml-st-optimize-linalg-ops-pass"); + } + ::llvm::StringRef getArgument() const override { return "gml-st-optimize-linalg-ops-pass"; } + + ::llvm::StringRef getDescription() const override { return "Canonicalization patterns for linalg ops."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("OptimizeLinalgOpsPass"); + } + ::llvm::StringRef getName() const override { return "OptimizeLinalgOpsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert<::mlir::arith::ArithDialect>(); + + registry.insert<::mlir::linalg::LinalgDialect>(); + + registry.insert<::mlir::tensor::TensorDialect>(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(OptimizeLinalgOpsPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_OPTIMIZELINALGOPSPASS +#endif // GEN_PASS_DEF_OPTIMIZELINALGOPSPASS + +//===----------------------------------------------------------------------===// +// PackMatmulPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_PACKMATMULPASS +#undef GEN_PASS_DECL_PACKMATMULPASS +#endif // GEN_PASS_DECL_PACKMATMULPASS +#ifdef GEN_PASS_DEF_PACKMATMULPASS +namespace impl { + +template +class PackMatmulPassBase : public ::mlir::OperationPass { +public: + using Base = PackMatmulPassBase; + + PackMatmulPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + PackMatmulPassBase(const PackMatmulPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-cpu-pack-matmul"); + } + ::llvm::StringRef getArgument() const override { return "xla-cpu-pack-matmul"; } + + ::llvm::StringRef getDescription() const override { return "Pack linalg.matmul as linalg.mmt4d"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("PackMatmulPass"); + } + ::llvm::StringRef getName() const override { return "PackMatmulPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(PackMatmulPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_PACKMATMULPASS +#endif // GEN_PASS_DEF_PACKMATMULPASS + +//===----------------------------------------------------------------------===// +// RemoveLabelPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_REMOVELABELPASS +#undef GEN_PASS_DECL_REMOVELABELPASS +#endif // GEN_PASS_DECL_REMOVELABELPASS +#ifdef GEN_PASS_DEF_REMOVELABELPASS +namespace impl { + +template +class RemoveLabelPassBase : public ::mlir::OperationPass { +public: + using Base = RemoveLabelPassBase; + + RemoveLabelPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + RemoveLabelPassBase(const RemoveLabelPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("remove-label"); + } + ::llvm::StringRef getArgument() const override { return "remove-label"; } + + ::llvm::StringRef getDescription() const override { return "Remove transformed labels from tiled ops"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("RemoveLabelPass"); + } + ::llvm::StringRef getName() const override { return "RemoveLabelPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(RemoveLabelPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_REMOVELABELPASS +#endif // GEN_PASS_DEF_REMOVELABELPASS + +//===----------------------------------------------------------------------===// +// RewriteForallOpPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_REWRITEFORALLOPPASS +#undef GEN_PASS_DECL_REWRITEFORALLOPPASS +#endif // GEN_PASS_DECL_REWRITEFORALLOPPASS +#ifdef GEN_PASS_DEF_REWRITEFORALLOPPASS +namespace impl { + +template +class RewriteForallOpPassBase : public ::mlir::OperationPass { +public: + using Base = RewriteForallOpPassBase; + + RewriteForallOpPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + RewriteForallOpPassBase(const RewriteForallOpPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("gml-st-rewrite-forall-ops"); + } + ::llvm::StringRef getArgument() const override { return "gml-st-rewrite-forall-ops"; } + + ::llvm::StringRef getDescription() const override { return "Pass to rewrite scf.forall to scf.for."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("RewriteForallOpPass"); + } + ::llvm::StringRef getName() const override { return "RewriteForallOpPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(RewriteForallOpPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_REWRITEFORALLOPPASS +#endif // GEN_PASS_DEF_REWRITEFORALLOPPASS + +//===----------------------------------------------------------------------===// +// RewriteFromElementsOpPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_REWRITEFROMELEMENTSOPPASS +#undef GEN_PASS_DECL_REWRITEFROMELEMENTSOPPASS +#endif // GEN_PASS_DECL_REWRITEFROMELEMENTSOPPASS +#ifdef GEN_PASS_DEF_REWRITEFROMELEMENTSOPPASS +namespace impl { + +template +class RewriteFromElementsOpPassBase : public ::mlir::OperationPass { +public: + using Base = RewriteFromElementsOpPassBase; + + RewriteFromElementsOpPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + RewriteFromElementsOpPassBase(const RewriteFromElementsOpPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("gml-st-rewrite-from-elements-ops"); + } + ::llvm::StringRef getArgument() const override { return "gml-st-rewrite-from-elements-ops"; } + + ::llvm::StringRef getDescription() const override { return "Pass to rewrite tensor.from_elements into tensor.insert."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("RewriteFromElementsOpPass"); + } + ::llvm::StringRef getName() const override { return "RewriteFromElementsOpPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(RewriteFromElementsOpPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_REWRITEFROMELEMENTSOPPASS +#endif // GEN_PASS_DEF_REWRITEFROMELEMENTSOPPASS + +//===----------------------------------------------------------------------===// +// ScalarizationPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_SCALARIZATIONPASS +struct ScalarizationPassOptions { + bool scalarizeAllThlo = true; +}; +#undef GEN_PASS_DECL_SCALARIZATIONPASS +#endif // GEN_PASS_DECL_SCALARIZATIONPASS +#ifdef GEN_PASS_DEF_SCALARIZATIONPASS +namespace impl { + +template +class ScalarizationPassBase : public ::mlir::OperationPass { +public: + using Base = ScalarizationPassBase; + + ScalarizationPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ScalarizationPassBase(const ScalarizationPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("scalarize"); + } + ::llvm::StringRef getArgument() const override { return "scalarize"; } + + ::llvm::StringRef getDescription() const override { return "Converts ops on tensors with 1 element to scalar ops."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ScalarizationPass"); + } + ::llvm::StringRef getName() const override { return "ScalarizationPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ScalarizationPassBase) + + ScalarizationPassBase(const ScalarizationPassOptions &options) : ScalarizationPassBase() { + scalarizeAllThlo = options.scalarizeAllThlo; + } +protected: + ::mlir::Pass::Option scalarizeAllThlo{*this, "scalarize-all-thlo", ::llvm::cl::desc("Enable scalarization of thlo.concatenate/gather/scatter."), ::llvm::cl::init(true)}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_SCALARIZATIONPASS +#endif // GEN_PASS_DEF_SCALARIZATIONPASS + +//===----------------------------------------------------------------------===// +// TileByOnePass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_TILEBYONEPASS +#undef GEN_PASS_DECL_TILEBYONEPASS +#endif // GEN_PASS_DECL_TILEBYONEPASS +#ifdef GEN_PASS_DEF_TILEBYONEPASS +namespace impl { + +template +class TileByOnePassBase : public ::mlir::OperationPass { +public: + using Base = TileByOnePassBase; + + TileByOnePassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TileByOnePassBase(const TileByOnePassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("gml-tile-by-one"); + } + ::llvm::StringRef getArgument() const override { return "gml-tile-by-one"; } + + ::llvm::StringRef getDescription() const override { return "Tile all tileable ops by size 1"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TileByOnePass"); + } + ::llvm::StringRef getName() const override { return "TileByOnePass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TileByOnePassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_TILEBYONEPASS +#endif // GEN_PASS_DEF_TILEBYONEPASS + +//===----------------------------------------------------------------------===// +// TilingSoftmaxPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_TILINGSOFTMAXPASS +struct TilingSoftmaxPassOptions { + ::llvm::ArrayRef tileSizes; +}; +#undef GEN_PASS_DECL_TILINGSOFTMAXPASS +#endif // GEN_PASS_DECL_TILINGSOFTMAXPASS +#ifdef GEN_PASS_DEF_TILINGSOFTMAXPASS +namespace impl { + +template +class TilingSoftmaxPassBase : public ::mlir::OperationPass { +public: + using Base = TilingSoftmaxPassBase; + + TilingSoftmaxPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TilingSoftmaxPassBase(const TilingSoftmaxPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("gml-tiling-softmax"); + } + ::llvm::StringRef getArgument() const override { return "gml-tiling-softmax"; } + + ::llvm::StringRef getDescription() const override { return "Match, tile, and fuse softmax implementations"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TilingSoftmaxPass"); + } + ::llvm::StringRef getName() const override { return "TilingSoftmaxPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TilingSoftmaxPassBase) + + TilingSoftmaxPassBase(const TilingSoftmaxPassOptions &options) : TilingSoftmaxPassBase() { + tileSizes = options.tileSizes; + } +protected: + ::mlir::Pass::ListOption tileSizes{*this, "tile-sizes", ::llvm::cl::desc("Right-aligned tile sizes. Do not tile possible remaining dimensions"), llvm::cl::ZeroOrMore}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_TILINGSOFTMAXPASS +#endif // GEN_PASS_DEF_TILINGSOFTMAXPASS + +//===----------------------------------------------------------------------===// +// TransformDotForCpuPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_TRANSFORMDOTFORCPUPASS +#undef GEN_PASS_DECL_TRANSFORMDOTFORCPUPASS +#endif // GEN_PASS_DECL_TRANSFORMDOTFORCPUPASS +#ifdef GEN_PASS_DEF_TRANSFORMDOTFORCPUPASS +namespace impl { + +template +class TransformDotForCpuPassBase : public ::mlir::OperationPass { +public: + using Base = TransformDotForCpuPassBase; + + TransformDotForCpuPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TransformDotForCpuPassBase(const TransformDotForCpuPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-cpu-transform-dot"); + } + ::llvm::StringRef getArgument() const override { return "xla-cpu-transform-dot"; } + + ::llvm::StringRef getDescription() const override { return "Transform dot ops for running on CPU"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TransformDotForCpuPass"); + } + ::llvm::StringRef getName() const override { return "TransformDotForCpuPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TransformDotForCpuPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_TRANSFORMDOTFORCPUPASS +#endif // GEN_PASS_DEF_TRANSFORMDOTFORCPUPASS + +//===----------------------------------------------------------------------===// +// TransformElementwiseForCpuPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_TRANSFORMELEMENTWISEFORCPUPASS +struct TransformElementwiseForCpuPassOptions { + int64_t vectorSize = 8; + bool fuseDegenerateReshapes = false; +}; +#undef GEN_PASS_DECL_TRANSFORMELEMENTWISEFORCPUPASS +#endif // GEN_PASS_DECL_TRANSFORMELEMENTWISEFORCPUPASS +#ifdef GEN_PASS_DEF_TRANSFORMELEMENTWISEFORCPUPASS +namespace impl { + +template +class TransformElementwiseForCpuPassBase : public ::mlir::OperationPass { +public: + using Base = TransformElementwiseForCpuPassBase; + + TransformElementwiseForCpuPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TransformElementwiseForCpuPassBase(const TransformElementwiseForCpuPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-cpu-transform-elementwise"); + } + ::llvm::StringRef getArgument() const override { return "xla-cpu-transform-elementwise"; } + + ::llvm::StringRef getDescription() const override { return "Transform elementwise ops for running on CPU"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TransformElementwiseForCpuPass"); + } + ::llvm::StringRef getName() const override { return "TransformElementwiseForCpuPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TransformElementwiseForCpuPassBase) + + TransformElementwiseForCpuPassBase(const TransformElementwiseForCpuPassOptions &options) : TransformElementwiseForCpuPassBase() { + vectorSize = options.vectorSize; + fuseDegenerateReshapes = options.fuseDegenerateReshapes; + } +protected: + ::mlir::Pass::Option vectorSize{*this, "vector-size", ::llvm::cl::desc("Vector size."), ::llvm::cl::init(8)}; + ::mlir::Pass::Option fuseDegenerateReshapes{*this, "fuse-degenerate-reshapes", ::llvm::cl::desc("Fuse through degenerate tensor.expand/collapse_shape"), ::llvm::cl::init(false)}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_TRANSFORMELEMENTWISEFORCPUPASS +#endif // GEN_PASS_DEF_TRANSFORMELEMENTWISEFORCPUPASS + +//===----------------------------------------------------------------------===// +// TransformMmt4DForCpuPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_TRANSFORMMMT4DFORCPUPASS +#undef GEN_PASS_DECL_TRANSFORMMMT4DFORCPUPASS +#endif // GEN_PASS_DECL_TRANSFORMMMT4DFORCPUPASS +#ifdef GEN_PASS_DEF_TRANSFORMMMT4DFORCPUPASS +namespace impl { + +template +class TransformMmt4DForCpuPassBase : public ::mlir::OperationPass { +public: + using Base = TransformMmt4DForCpuPassBase; + + TransformMmt4DForCpuPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TransformMmt4DForCpuPassBase(const TransformMmt4DForCpuPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-cpu-transform-mmt4d"); + } + ::llvm::StringRef getArgument() const override { return "xla-cpu-transform-mmt4d"; } + + ::llvm::StringRef getDescription() const override { return "Transform linalg.mmt4d ops for running on CPU"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TransformMmt4DForCpuPass"); + } + ::llvm::StringRef getName() const override { return "TransformMmt4DForCpuPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TransformMmt4DForCpuPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_TRANSFORMMMT4DFORCPUPASS +#endif // GEN_PASS_DEF_TRANSFORMMMT4DFORCPUPASS + +//===----------------------------------------------------------------------===// +// TransformPackForCpuPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_TRANSFORMPACKFORCPUPASS +#undef GEN_PASS_DECL_TRANSFORMPACKFORCPUPASS +#endif // GEN_PASS_DECL_TRANSFORMPACKFORCPUPASS +#ifdef GEN_PASS_DEF_TRANSFORMPACKFORCPUPASS +namespace impl { + +template +class TransformPackForCpuPassBase : public ::mlir::OperationPass { +public: + using Base = TransformPackForCpuPassBase; + + TransformPackForCpuPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TransformPackForCpuPassBase(const TransformPackForCpuPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-cpu-transform-pack"); + } + ::llvm::StringRef getArgument() const override { return "xla-cpu-transform-pack"; } + + ::llvm::StringRef getDescription() const override { return "Transform tensor.pack/unpack ops for running on CPU"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TransformPackForCpuPass"); + } + ::llvm::StringRef getName() const override { return "TransformPackForCpuPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TransformPackForCpuPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_TRANSFORMPACKFORCPUPASS +#endif // GEN_PASS_DEF_TRANSFORMPACKFORCPUPASS + +//===----------------------------------------------------------------------===// +// TransformReduceForCpuPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_TRANSFORMREDUCEFORCPUPASS +struct TransformReduceForCpuPassOptions { + bool enableHeuristic = false; + int64_t tileSize1D = 32; + int64_t splitRatio1D = 8; + int64_t parallelDimTileSize2D = 4; + int64_t reductionDimTileSize2D = 4; +}; +#undef GEN_PASS_DECL_TRANSFORMREDUCEFORCPUPASS +#endif // GEN_PASS_DECL_TRANSFORMREDUCEFORCPUPASS +#ifdef GEN_PASS_DEF_TRANSFORMREDUCEFORCPUPASS +namespace impl { + +template +class TransformReduceForCpuPassBase : public ::mlir::OperationPass { +public: + using Base = TransformReduceForCpuPassBase; + + TransformReduceForCpuPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TransformReduceForCpuPassBase(const TransformReduceForCpuPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-cpu-transform-reduce"); + } + ::llvm::StringRef getArgument() const override { return "xla-cpu-transform-reduce"; } + + ::llvm::StringRef getDescription() const override { return "Transform reduce ops for running on CPU"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TransformReduceForCpuPass"); + } + ::llvm::StringRef getName() const override { return "TransformReduceForCpuPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TransformReduceForCpuPassBase) + + TransformReduceForCpuPassBase(const TransformReduceForCpuPassOptions &options) : TransformReduceForCpuPassBase() { + enableHeuristic = options.enableHeuristic; + tileSize1D = options.tileSize1D; + splitRatio1D = options.splitRatio1D; + parallelDimTileSize2D = options.parallelDimTileSize2D; + reductionDimTileSize2D = options.reductionDimTileSize2D; + } +protected: + ::mlir::Pass::Option enableHeuristic{*this, "enable_heuristic", ::llvm::cl::desc("Enable heuristic for tiling sizes. Currently only for 1D."), ::llvm::cl::init(false)}; + ::mlir::Pass::Option tileSize1D{*this, "reduction-1d-tile-size", ::llvm::cl::desc("Tile size for a 1D reduction."), ::llvm::cl::init(32)}; + ::mlir::Pass::Option splitRatio1D{*this, "reduction-1d-split-ratio", ::llvm::cl::desc("Ratio used to split the reduction dimension, i.e. tiled reduce op `reduce(tensor)` will be split into a composition of a column reduction `reduce(tensor)` and a row 1D reductionreduce(tensor)`."), ::llvm::cl::init(8)}; + ::mlir::Pass::Option parallelDimTileSize2D{*this, "reduction-2d-parallel-dim-tile-size", ::llvm::cl::desc("Tile size for the parallel dimension of a 2D reduction."), ::llvm::cl::init(4)}; + ::mlir::Pass::Option reductionDimTileSize2D{*this, "reduction-2d-reduction-dim-tile-size", ::llvm::cl::desc("Tile size for the reduction dimension of a 2D reduction."), ::llvm::cl::init(4)}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_TRANSFORMREDUCEFORCPUPASS +#endif // GEN_PASS_DEF_TRANSFORMREDUCEFORCPUPASS + +//===----------------------------------------------------------------------===// +// TransformScatterForCpuPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_TRANSFORMSCATTERFORCPUPASS +#undef GEN_PASS_DECL_TRANSFORMSCATTERFORCPUPASS +#endif // GEN_PASS_DECL_TRANSFORMSCATTERFORCPUPASS +#ifdef GEN_PASS_DEF_TRANSFORMSCATTERFORCPUPASS +namespace impl { + +template +class TransformScatterForCpuPassBase : public ::mlir::OperationPass { +public: + using Base = TransformScatterForCpuPassBase; + + TransformScatterForCpuPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TransformScatterForCpuPassBase(const TransformScatterForCpuPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-cpu-transform-scatter"); + } + ::llvm::StringRef getArgument() const override { return "xla-cpu-transform-scatter"; } + + ::llvm::StringRef getDescription() const override { return "Transform scatter ops for running on CPU"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TransformScatterForCpuPass"); + } + ::llvm::StringRef getName() const override { return "TransformScatterForCpuPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TransformScatterForCpuPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_TRANSFORMSCATTERFORCPUPASS +#endif // GEN_PASS_DEF_TRANSFORMSCATTERFORCPUPASS + +//===----------------------------------------------------------------------===// +// VectorizeCopyPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_VECTORIZECOPYPASS +struct VectorizeCopyPassOptions { + int64_t numElementsThreshold = 8; +}; +#undef GEN_PASS_DECL_VECTORIZECOPYPASS +#endif // GEN_PASS_DECL_VECTORIZECOPYPASS +#ifdef GEN_PASS_DEF_VECTORIZECOPYPASS +namespace impl { + +template +class VectorizeCopyPassBase : public ::mlir::OperationPass { +public: + using Base = VectorizeCopyPassBase; + + VectorizeCopyPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + VectorizeCopyPassBase(const VectorizeCopyPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("vectorize-copy"); + } + ::llvm::StringRef getArgument() const override { return "vectorize-copy"; } + + ::llvm::StringRef getDescription() const override { return "Pass to vectorize `memref.copy`."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("VectorizeCopyPass"); + } + ::llvm::StringRef getName() const override { return "VectorizeCopyPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(VectorizeCopyPassBase) + + VectorizeCopyPassBase(const VectorizeCopyPassOptions &options) : VectorizeCopyPassBase() { + numElementsThreshold = options.numElementsThreshold; + } +protected: + ::mlir::Pass::Option numElementsThreshold{*this, "num-elements-threshold", ::llvm::cl::desc("Max number of elements in src and dst memref for a copy to be vectorized."), ::llvm::cl::init(8)}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_VECTORIZECOPYPASS +#endif // GEN_PASS_DEF_VECTORIZECOPYPASS + +//===----------------------------------------------------------------------===// +// VectorizeForCPUPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_VECTORIZEFORCPUPASS +struct VectorizeForCPUPassOptions { + int64_t numElementsThreshold = 128; +}; +#undef GEN_PASS_DECL_VECTORIZEFORCPUPASS +#endif // GEN_PASS_DECL_VECTORIZEFORCPUPASS +#ifdef GEN_PASS_DEF_VECTORIZEFORCPUPASS +namespace impl { + +template +class VectorizeForCPUPassBase : public ::mlir::OperationPass { +public: + using Base = VectorizeForCPUPassBase; + + VectorizeForCPUPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + VectorizeForCPUPassBase(const VectorizeForCPUPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("vectorize-for-cpu"); + } + ::llvm::StringRef getArgument() const override { return "vectorize-for-cpu"; } + + ::llvm::StringRef getDescription() const override { return "Pass to vectorize gml_st.for loops that are tiled perfectly."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("VectorizeForCPUPass"); + } + ::llvm::StringRef getName() const override { return "VectorizeForCPUPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert<::mlir::vector::VectorDialect>(); + + registry.insert<::mlir::tensor::TensorDialect>(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(VectorizeForCPUPassBase) + + VectorizeForCPUPassBase(const VectorizeForCPUPassOptions &options) : VectorizeForCPUPassBase() { + numElementsThreshold = options.numElementsThreshold; + } +protected: + ::mlir::Pass::Option numElementsThreshold{*this, "num-elements-threshold", ::llvm::cl::desc("Number of elements max of the tensor operands in order for the op to be vectorized."), ::llvm::cl::init(128)}; +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_VECTORIZEFORCPUPASS +#endif // GEN_PASS_DEF_VECTORIZEFORCPUPASS +#ifdef GEN_PASS_REGISTRATION + +//===----------------------------------------------------------------------===// +// AddDebugInfoPass Registration +//===----------------------------------------------------------------------===// + +inline void registerAddDebugInfoPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::gml_st::createAddDebugInfoPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerAddDebugInfoPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::gml_st::createAddDebugInfoPass(); + }); +} + +//===----------------------------------------------------------------------===// +// CollapseShapePass Registration +//===----------------------------------------------------------------------===// + +inline void registerCollapseShapePass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::gml_st::createCollapseShapePass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerCollapseShapePassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::gml_st::createCollapseShapePass(); + }); +} + +//===----------------------------------------------------------------------===// +// CollectStatsPass Registration +//===----------------------------------------------------------------------===// + +inline void registerCollectStatsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::gml_st::createCollectStatsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerCollectStatsPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::gml_st::createCollectStatsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ComposeExtractInsertSlicePass Registration +//===----------------------------------------------------------------------===// + +inline void registerComposeExtractInsertSlicePass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::gml_st::createComposeExtractInsertSlicePass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerComposeExtractInsertSlicePassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::gml_st::createComposeExtractInsertSlicePass(); + }); +} + +//===----------------------------------------------------------------------===// +// FusionOutliningPass Registration +//===----------------------------------------------------------------------===// + +inline void registerFusionOutliningPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createFusionOutliningPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerFusionOutliningPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createFusionOutliningPass(); + }); +} + +//===----------------------------------------------------------------------===// +// FusionPlanningForCpuPass Registration +//===----------------------------------------------------------------------===// + +inline void registerFusionPlanningForCpuPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createFusionPlanningForCpuPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerFusionPlanningForCpuPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createFusionPlanningForCpuPass(); + }); +} + +//===----------------------------------------------------------------------===// +// InlineFusionClustersPass Registration +//===----------------------------------------------------------------------===// + +inline void registerInlineFusionClustersPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createInlineFusionClustersPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerInlineFusionClustersPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createInlineFusionClustersPass(); + }); +} + +//===----------------------------------------------------------------------===// +// LowerVectorsPass Registration +//===----------------------------------------------------------------------===// + +inline void registerLowerVectorsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::gml_st::createLowerVectorsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerLowerVectorsPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::gml_st::createLowerVectorsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// NaiveCopyRemovalPass Registration +//===----------------------------------------------------------------------===// + +inline void registerNaiveCopyRemovalPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::gml_st::createNaiveCopyRemovalPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerNaiveCopyRemovalPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::gml_st::createNaiveCopyRemovalPass(); + }); +} + +//===----------------------------------------------------------------------===// +// OptimizeLinalgOpsPass Registration +//===----------------------------------------------------------------------===// + +inline void registerOptimizeLinalgOpsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createOptimizeLinalgOpsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerOptimizeLinalgOpsPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createOptimizeLinalgOpsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// PackMatmulPass Registration +//===----------------------------------------------------------------------===// + +inline void registerPackMatmulPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createPackMatmulPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerPackMatmulPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createPackMatmulPass(); + }); +} + +//===----------------------------------------------------------------------===// +// RemoveLabelPass Registration +//===----------------------------------------------------------------------===// + +inline void registerRemoveLabelPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::gml_st::createRemoveLabelPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerRemoveLabelPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::gml_st::createRemoveLabelPass(); + }); +} + +//===----------------------------------------------------------------------===// +// RewriteForallOpPass Registration +//===----------------------------------------------------------------------===// + +inline void registerRewriteForallOpPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createRewriteForallOpPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerRewriteForallOpPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createRewriteForallOpPass(); + }); +} + +//===----------------------------------------------------------------------===// +// RewriteFromElementsOpPass Registration +//===----------------------------------------------------------------------===// + +inline void registerRewriteFromElementsOpPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createRewriteFromElementsOpPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerRewriteFromElementsOpPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createRewriteFromElementsOpPass(); + }); +} + +//===----------------------------------------------------------------------===// +// ScalarizationPass Registration +//===----------------------------------------------------------------------===// + +inline void registerScalarizationPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createScalarizationPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerScalarizationPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createScalarizationPass(); + }); +} + +//===----------------------------------------------------------------------===// +// TileByOnePass Registration +//===----------------------------------------------------------------------===// + +inline void registerTileByOnePass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::gml_st::createTileByOnePass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerTileByOnePassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::gml_st::createTileByOnePass(); + }); +} + +//===----------------------------------------------------------------------===// +// TilingSoftmaxPass Registration +//===----------------------------------------------------------------------===// + +inline void registerTilingSoftmaxPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::gml_st::createTilingSoftmaxPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerTilingSoftmaxPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::gml_st::createTilingSoftmaxPass(); + }); +} + +//===----------------------------------------------------------------------===// +// TransformDotForCpuPass Registration +//===----------------------------------------------------------------------===// + +inline void registerTransformDotForCpuPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createTransformDotForCpuPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerTransformDotForCpuPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createTransformDotForCpuPass(); + }); +} + +//===----------------------------------------------------------------------===// +// TransformElementwiseForCpuPass Registration +//===----------------------------------------------------------------------===// + +inline void registerTransformElementwiseForCpuPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::gml_st::createTransformElementwiseForCpuPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerTransformElementwiseForCpuPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::gml_st::createTransformElementwiseForCpuPass(); + }); +} + +//===----------------------------------------------------------------------===// +// TransformMmt4DForCpuPass Registration +//===----------------------------------------------------------------------===// + +inline void registerTransformMmt4DForCpuPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createTransformMmt4DForCpuPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerTransformMmt4DForCpuPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createTransformMmt4DForCpuPass(); + }); +} + +//===----------------------------------------------------------------------===// +// TransformPackForCpuPass Registration +//===----------------------------------------------------------------------===// + +inline void registerTransformPackForCpuPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createTransformPackForCpuPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerTransformPackForCpuPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createTransformPackForCpuPass(); + }); +} + +//===----------------------------------------------------------------------===// +// TransformReduceForCpuPass Registration +//===----------------------------------------------------------------------===// + +inline void registerTransformReduceForCpuPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::gml_st::createTransformReduceForCpuPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerTransformReduceForCpuPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::gml_st::createTransformReduceForCpuPass(); + }); +} + +//===----------------------------------------------------------------------===// +// TransformScatterForCpuPass Registration +//===----------------------------------------------------------------------===// + +inline void registerTransformScatterForCpuPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createTransformScatterForCpuPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerTransformScatterForCpuPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createTransformScatterForCpuPass(); + }); +} + +//===----------------------------------------------------------------------===// +// VectorizeCopyPass Registration +//===----------------------------------------------------------------------===// + +inline void registerVectorizeCopyPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::gml_st::createVectorizeCopyPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerVectorizeCopyPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::gml_st::createVectorizeCopyPass(); + }); +} + +//===----------------------------------------------------------------------===// +// VectorizeForCPUPass Registration +//===----------------------------------------------------------------------===// + +inline void registerVectorizeForCPUPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::gml_st::createVectorizeForCPUPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerVectorizeForCPUPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return ::mlir::gml_st::createVectorizeForCPUPass(); + }); +} + +//===----------------------------------------------------------------------===// +// GmlSt Registration +//===----------------------------------------------------------------------===// + +inline void registerGmlStPasses() { + registerAddDebugInfoPass(); + registerCollapseShapePass(); + registerCollectStatsPass(); + registerComposeExtractInsertSlicePass(); + registerFusionOutliningPass(); + registerFusionPlanningForCpuPass(); + registerInlineFusionClustersPass(); + registerLowerVectorsPass(); + registerNaiveCopyRemovalPass(); + registerOptimizeLinalgOpsPass(); + registerPackMatmulPass(); + registerRemoveLabelPass(); + registerRewriteForallOpPass(); + registerRewriteFromElementsOpPass(); + registerScalarizationPass(); + registerTileByOnePass(); + registerTilingSoftmaxPass(); + registerTransformDotForCpuPass(); + registerTransformElementwiseForCpuPass(); + registerTransformMmt4DForCpuPass(); + registerTransformPackForCpuPass(); + registerTransformReduceForCpuPass(); + registerTransformScatterForCpuPass(); + registerVectorizeCopyPass(); + registerVectorizeForCPUPass(); +} +#undef GEN_PASS_REGISTRATION +#endif // GEN_PASS_REGISTRATION +// Deprecated. Please use the new per-pass macros. +#ifdef GEN_PASS_CLASSES + +template +class AddDebugInfoPassBase : public ::mlir::OperationPass { +public: + using Base = AddDebugInfoPassBase; + + AddDebugInfoPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + AddDebugInfoPassBase(const AddDebugInfoPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("add-debug-info"); + } + ::llvm::StringRef getArgument() const override { return "add-debug-info"; } + + ::llvm::StringRef getDescription() const override { return "Add debug info for the whole module"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("AddDebugInfoPass"); + } + ::llvm::StringRef getName() const override { return "AddDebugInfoPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert<::mlir::LLVM::LLVMDialect>(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(AddDebugInfoPassBase) + +protected: +}; + +template +class CollapseShapePassBase : public ::mlir::OperationPass { +public: + using Base = CollapseShapePassBase; + + CollapseShapePassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + CollapseShapePassBase(const CollapseShapePassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("gml-collapse-shape"); + } + ::llvm::StringRef getArgument() const override { return "gml-collapse-shape"; } + + ::llvm::StringRef getDescription() const override { return "Collapse dimensions of bcasts, reductions, and cwise ops"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("CollapseShapePass"); + } + ::llvm::StringRef getName() const override { return "CollapseShapePass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert<::mlir::tensor::TensorDialect>(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(CollapseShapePassBase) + +protected: + ::mlir::Pass::Option retainTrailingDims{*this, "retain-trailing-dims", ::llvm::cl::desc("Number of trailing dimensions that will not be collapsed."), ::llvm::cl::init(0)}; +}; + +template +class CollectStatsPassBase : public ::mlir::OperationPass { +public: + using Base = CollectStatsPassBase; + + CollectStatsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + CollectStatsPassBase(const CollectStatsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("collect-stats"); + } + ::llvm::StringRef getArgument() const override { return "collect-stats"; } + + ::llvm::StringRef getDescription() const override { return "Print stats about tileable ops"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("CollectStatsPass"); + } + ::llvm::StringRef getName() const override { return "CollectStatsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(CollectStatsPassBase) + +protected: +}; + +template +class ComposeExtractInsertSlicePassBase : public ::mlir::OperationPass { +public: + using Base = ComposeExtractInsertSlicePassBase; + + ComposeExtractInsertSlicePassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ComposeExtractInsertSlicePassBase(const ComposeExtractInsertSlicePassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("gml-compose-extract-insert-slice"); + } + ::llvm::StringRef getArgument() const override { return "gml-compose-extract-insert-slice"; } + + ::llvm::StringRef getDescription() const override { return "Compose tensor.extract_slice/insert_slice ops."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ComposeExtractInsertSlicePass"); + } + ::llvm::StringRef getName() const override { return "ComposeExtractInsertSlicePass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ComposeExtractInsertSlicePassBase) + +protected: +}; + +template +class FusionOutliningPassBase : public ::mlir::OperationPass { +public: + using Base = FusionOutliningPassBase; + + FusionOutliningPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + FusionOutliningPassBase(const FusionOutliningPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("gml-fusion-outlining"); + } + ::llvm::StringRef getArgument() const override { return "gml-fusion-outlining"; } + + ::llvm::StringRef getDescription() const override { return "Pass to outline fusion regions into functions."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("FusionOutliningPass"); + } + ::llvm::StringRef getName() const override { return "FusionOutliningPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(FusionOutliningPassBase) + +protected: +}; + +template +class FusionPlanningForCpuPassBase : public ::mlir::OperationPass { +public: + using Base = FusionPlanningForCpuPassBase; + + FusionPlanningForCpuPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + FusionPlanningForCpuPassBase(const FusionPlanningForCpuPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("gml-st-cpu-fusion-planning"); + } + ::llvm::StringRef getArgument() const override { return "gml-st-cpu-fusion-planning"; } + + ::llvm::StringRef getDescription() const override { return "Create fusion clusters."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("FusionPlanningForCpuPass"); + } + ::llvm::StringRef getName() const override { return "FusionPlanningForCpuPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert<::mlir::arith::ArithDialect>(); + + registry.insert<::mlir::gml_st::GmlStDialect>(); + + registry.insert<::mlir::linalg::LinalgDialect>(); + + registry.insert<::mlir::tensor::TensorDialect>(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(FusionPlanningForCpuPassBase) + +protected: + ::mlir::Pass::Option vectorSize{*this, "vector-size", ::llvm::cl::desc("Tile size for the innermost dimension of `linalg.map`"), ::llvm::cl::init(8)}; +}; + +template +class InlineFusionClustersPassBase : public ::mlir::OperationPass { +public: + using Base = InlineFusionClustersPassBase; + + InlineFusionClustersPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + InlineFusionClustersPassBase(const InlineFusionClustersPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("gml-st-inline-fusion-clusters"); + } + ::llvm::StringRef getArgument() const override { return "gml-st-inline-fusion-clusters"; } + + ::llvm::StringRef getDescription() const override { return "Replaces all gml_st.fusion op with ops from the region."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("InlineFusionClustersPass"); + } + ::llvm::StringRef getName() const override { return "InlineFusionClustersPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert<::mlir::gml_st::GmlStDialect>(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(InlineFusionClustersPassBase) + +protected: +}; + +template +class LowerVectorsPassBase : public ::mlir::OperationPass { +public: + using Base = LowerVectorsPassBase; + + LowerVectorsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + LowerVectorsPassBase(const LowerVectorsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("lower-vectors"); + } + ::llvm::StringRef getArgument() const override { return "lower-vectors"; } + + ::llvm::StringRef getDescription() const override { return "Pass to lower vector operations progressively."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LowerVectorsPass"); + } + ::llvm::StringRef getName() const override { return "LowerVectorsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert<::mlir::LLVM::LLVMDialect>(); + + registry.insert<::mlir::vector::VectorDialect>(); + + registry.insert<::mlir::affine::AffineDialect>(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LowerVectorsPassBase) + +protected: + ::mlir::Pass::Option enableAVX2{*this, "enable-avx2", ::llvm::cl::desc("Enable specialized lowerings for AVX2."), ::llvm::cl::init(true)}; + ::mlir::Pass::Option flatten{*this, "flatten", ::llvm::cl::desc("Flatten multiple small n-D vector transfers into a large 1-D transfer."), ::llvm::cl::init(false)}; +}; + +template +class NaiveCopyRemovalPassBase : public ::mlir::OperationPass { +public: + using Base = NaiveCopyRemovalPassBase; + + NaiveCopyRemovalPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + NaiveCopyRemovalPassBase(const NaiveCopyRemovalPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("naive-copy-removal"); + } + ::llvm::StringRef getArgument() const override { return "naive-copy-removal"; } + + ::llvm::StringRef getDescription() const override { return "Pass to remove redundant `memref.copy` ops."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("NaiveCopyRemovalPass"); + } + ::llvm::StringRef getName() const override { return "NaiveCopyRemovalPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert<::mlir::memref::MemRefDialect>(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(NaiveCopyRemovalPassBase) + +protected: +}; + +template +class OptimizeLinalgOpsPassBase : public ::mlir::OperationPass { +public: + using Base = OptimizeLinalgOpsPassBase; + + OptimizeLinalgOpsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + OptimizeLinalgOpsPassBase(const OptimizeLinalgOpsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("gml-st-optimize-linalg-ops-pass"); + } + ::llvm::StringRef getArgument() const override { return "gml-st-optimize-linalg-ops-pass"; } + + ::llvm::StringRef getDescription() const override { return "Canonicalization patterns for linalg ops."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("OptimizeLinalgOpsPass"); + } + ::llvm::StringRef getName() const override { return "OptimizeLinalgOpsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert<::mlir::arith::ArithDialect>(); + + registry.insert<::mlir::linalg::LinalgDialect>(); + + registry.insert<::mlir::tensor::TensorDialect>(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(OptimizeLinalgOpsPassBase) + +protected: +}; + +template +class PackMatmulPassBase : public ::mlir::OperationPass { +public: + using Base = PackMatmulPassBase; + + PackMatmulPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + PackMatmulPassBase(const PackMatmulPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-cpu-pack-matmul"); + } + ::llvm::StringRef getArgument() const override { return "xla-cpu-pack-matmul"; } + + ::llvm::StringRef getDescription() const override { return "Pack linalg.matmul as linalg.mmt4d"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("PackMatmulPass"); + } + ::llvm::StringRef getName() const override { return "PackMatmulPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(PackMatmulPassBase) + +protected: +}; + +template +class RemoveLabelPassBase : public ::mlir::OperationPass { +public: + using Base = RemoveLabelPassBase; + + RemoveLabelPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + RemoveLabelPassBase(const RemoveLabelPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("remove-label"); + } + ::llvm::StringRef getArgument() const override { return "remove-label"; } + + ::llvm::StringRef getDescription() const override { return "Remove transformed labels from tiled ops"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("RemoveLabelPass"); + } + ::llvm::StringRef getName() const override { return "RemoveLabelPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(RemoveLabelPassBase) + +protected: +}; + +template +class RewriteForallOpPassBase : public ::mlir::OperationPass { +public: + using Base = RewriteForallOpPassBase; + + RewriteForallOpPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + RewriteForallOpPassBase(const RewriteForallOpPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("gml-st-rewrite-forall-ops"); + } + ::llvm::StringRef getArgument() const override { return "gml-st-rewrite-forall-ops"; } + + ::llvm::StringRef getDescription() const override { return "Pass to rewrite scf.forall to scf.for."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("RewriteForallOpPass"); + } + ::llvm::StringRef getName() const override { return "RewriteForallOpPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(RewriteForallOpPassBase) + +protected: +}; + +template +class RewriteFromElementsOpPassBase : public ::mlir::OperationPass { +public: + using Base = RewriteFromElementsOpPassBase; + + RewriteFromElementsOpPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + RewriteFromElementsOpPassBase(const RewriteFromElementsOpPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("gml-st-rewrite-from-elements-ops"); + } + ::llvm::StringRef getArgument() const override { return "gml-st-rewrite-from-elements-ops"; } + + ::llvm::StringRef getDescription() const override { return "Pass to rewrite tensor.from_elements into tensor.insert."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("RewriteFromElementsOpPass"); + } + ::llvm::StringRef getName() const override { return "RewriteFromElementsOpPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(RewriteFromElementsOpPassBase) + +protected: +}; + +template +class ScalarizationPassBase : public ::mlir::OperationPass { +public: + using Base = ScalarizationPassBase; + + ScalarizationPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + ScalarizationPassBase(const ScalarizationPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("scalarize"); + } + ::llvm::StringRef getArgument() const override { return "scalarize"; } + + ::llvm::StringRef getDescription() const override { return "Converts ops on tensors with 1 element to scalar ops."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("ScalarizationPass"); + } + ::llvm::StringRef getName() const override { return "ScalarizationPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(ScalarizationPassBase) + +protected: + ::mlir::Pass::Option scalarizeAllThlo{*this, "scalarize-all-thlo", ::llvm::cl::desc("Enable scalarization of thlo.concatenate/gather/scatter."), ::llvm::cl::init(true)}; +}; + +template +class TileByOnePassBase : public ::mlir::OperationPass { +public: + using Base = TileByOnePassBase; + + TileByOnePassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TileByOnePassBase(const TileByOnePassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("gml-tile-by-one"); + } + ::llvm::StringRef getArgument() const override { return "gml-tile-by-one"; } + + ::llvm::StringRef getDescription() const override { return "Tile all tileable ops by size 1"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TileByOnePass"); + } + ::llvm::StringRef getName() const override { return "TileByOnePass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TileByOnePassBase) + +protected: +}; + +template +class TilingSoftmaxPassBase : public ::mlir::OperationPass { +public: + using Base = TilingSoftmaxPassBase; + + TilingSoftmaxPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TilingSoftmaxPassBase(const TilingSoftmaxPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("gml-tiling-softmax"); + } + ::llvm::StringRef getArgument() const override { return "gml-tiling-softmax"; } + + ::llvm::StringRef getDescription() const override { return "Match, tile, and fuse softmax implementations"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TilingSoftmaxPass"); + } + ::llvm::StringRef getName() const override { return "TilingSoftmaxPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TilingSoftmaxPassBase) + +protected: + ::mlir::Pass::ListOption tileSizes{*this, "tile-sizes", ::llvm::cl::desc("Right-aligned tile sizes. Do not tile possible remaining dimensions"), llvm::cl::ZeroOrMore}; +}; + +template +class TransformDotForCpuPassBase : public ::mlir::OperationPass { +public: + using Base = TransformDotForCpuPassBase; + + TransformDotForCpuPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TransformDotForCpuPassBase(const TransformDotForCpuPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-cpu-transform-dot"); + } + ::llvm::StringRef getArgument() const override { return "xla-cpu-transform-dot"; } + + ::llvm::StringRef getDescription() const override { return "Transform dot ops for running on CPU"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TransformDotForCpuPass"); + } + ::llvm::StringRef getName() const override { return "TransformDotForCpuPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TransformDotForCpuPassBase) + +protected: +}; + +template +class TransformElementwiseForCpuPassBase : public ::mlir::OperationPass { +public: + using Base = TransformElementwiseForCpuPassBase; + + TransformElementwiseForCpuPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TransformElementwiseForCpuPassBase(const TransformElementwiseForCpuPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-cpu-transform-elementwise"); + } + ::llvm::StringRef getArgument() const override { return "xla-cpu-transform-elementwise"; } + + ::llvm::StringRef getDescription() const override { return "Transform elementwise ops for running on CPU"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TransformElementwiseForCpuPass"); + } + ::llvm::StringRef getName() const override { return "TransformElementwiseForCpuPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TransformElementwiseForCpuPassBase) + +protected: + ::mlir::Pass::Option vectorSize{*this, "vector-size", ::llvm::cl::desc("Vector size."), ::llvm::cl::init(8)}; + ::mlir::Pass::Option fuseDegenerateReshapes{*this, "fuse-degenerate-reshapes", ::llvm::cl::desc("Fuse through degenerate tensor.expand/collapse_shape"), ::llvm::cl::init(false)}; +}; + +template +class TransformMmt4DForCpuPassBase : public ::mlir::OperationPass { +public: + using Base = TransformMmt4DForCpuPassBase; + + TransformMmt4DForCpuPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TransformMmt4DForCpuPassBase(const TransformMmt4DForCpuPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-cpu-transform-mmt4d"); + } + ::llvm::StringRef getArgument() const override { return "xla-cpu-transform-mmt4d"; } + + ::llvm::StringRef getDescription() const override { return "Transform linalg.mmt4d ops for running on CPU"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TransformMmt4DForCpuPass"); + } + ::llvm::StringRef getName() const override { return "TransformMmt4DForCpuPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TransformMmt4DForCpuPassBase) + +protected: +}; + +template +class TransformPackForCpuPassBase : public ::mlir::OperationPass { +public: + using Base = TransformPackForCpuPassBase; + + TransformPackForCpuPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TransformPackForCpuPassBase(const TransformPackForCpuPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-cpu-transform-pack"); + } + ::llvm::StringRef getArgument() const override { return "xla-cpu-transform-pack"; } + + ::llvm::StringRef getDescription() const override { return "Transform tensor.pack/unpack ops for running on CPU"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TransformPackForCpuPass"); + } + ::llvm::StringRef getName() const override { return "TransformPackForCpuPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TransformPackForCpuPassBase) + +protected: +}; + +template +class TransformReduceForCpuPassBase : public ::mlir::OperationPass { +public: + using Base = TransformReduceForCpuPassBase; + + TransformReduceForCpuPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TransformReduceForCpuPassBase(const TransformReduceForCpuPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-cpu-transform-reduce"); + } + ::llvm::StringRef getArgument() const override { return "xla-cpu-transform-reduce"; } + + ::llvm::StringRef getDescription() const override { return "Transform reduce ops for running on CPU"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TransformReduceForCpuPass"); + } + ::llvm::StringRef getName() const override { return "TransformReduceForCpuPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TransformReduceForCpuPassBase) + +protected: + ::mlir::Pass::Option enableHeuristic{*this, "enable_heuristic", ::llvm::cl::desc("Enable heuristic for tiling sizes. Currently only for 1D."), ::llvm::cl::init(false)}; + ::mlir::Pass::Option tileSize1D{*this, "reduction-1d-tile-size", ::llvm::cl::desc("Tile size for a 1D reduction."), ::llvm::cl::init(32)}; + ::mlir::Pass::Option splitRatio1D{*this, "reduction-1d-split-ratio", ::llvm::cl::desc("Ratio used to split the reduction dimension, i.e. tiled reduce op `reduce(tensor)` will be split into a composition of a column reduction `reduce(tensor)` and a row 1D reductionreduce(tensor)`."), ::llvm::cl::init(8)}; + ::mlir::Pass::Option parallelDimTileSize2D{*this, "reduction-2d-parallel-dim-tile-size", ::llvm::cl::desc("Tile size for the parallel dimension of a 2D reduction."), ::llvm::cl::init(4)}; + ::mlir::Pass::Option reductionDimTileSize2D{*this, "reduction-2d-reduction-dim-tile-size", ::llvm::cl::desc("Tile size for the reduction dimension of a 2D reduction."), ::llvm::cl::init(4)}; +}; + +template +class TransformScatterForCpuPassBase : public ::mlir::OperationPass { +public: + using Base = TransformScatterForCpuPassBase; + + TransformScatterForCpuPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + TransformScatterForCpuPassBase(const TransformScatterForCpuPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("xla-cpu-transform-scatter"); + } + ::llvm::StringRef getArgument() const override { return "xla-cpu-transform-scatter"; } + + ::llvm::StringRef getDescription() const override { return "Transform scatter ops for running on CPU"; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("TransformScatterForCpuPass"); + } + ::llvm::StringRef getName() const override { return "TransformScatterForCpuPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(TransformScatterForCpuPassBase) + +protected: +}; + +template +class VectorizeCopyPassBase : public ::mlir::OperationPass { +public: + using Base = VectorizeCopyPassBase; + + VectorizeCopyPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + VectorizeCopyPassBase(const VectorizeCopyPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("vectorize-copy"); + } + ::llvm::StringRef getArgument() const override { return "vectorize-copy"; } + + ::llvm::StringRef getDescription() const override { return "Pass to vectorize `memref.copy`."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("VectorizeCopyPass"); + } + ::llvm::StringRef getName() const override { return "VectorizeCopyPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(VectorizeCopyPassBase) + +protected: + ::mlir::Pass::Option numElementsThreshold{*this, "num-elements-threshold", ::llvm::cl::desc("Max number of elements in src and dst memref for a copy to be vectorized."), ::llvm::cl::init(8)}; +}; + +template +class VectorizeForCPUPassBase : public ::mlir::OperationPass { +public: + using Base = VectorizeForCPUPassBase; + + VectorizeForCPUPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + VectorizeForCPUPassBase(const VectorizeForCPUPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("vectorize-for-cpu"); + } + ::llvm::StringRef getArgument() const override { return "vectorize-for-cpu"; } + + ::llvm::StringRef getDescription() const override { return "Pass to vectorize gml_st.for loops that are tiled perfectly."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("VectorizeForCPUPass"); + } + ::llvm::StringRef getName() const override { return "VectorizeForCPUPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert<::mlir::vector::VectorDialect>(); + + registry.insert<::mlir::tensor::TensorDialect>(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(VectorizeForCPUPassBase) + +protected: + ::mlir::Pass::Option numElementsThreshold{*this, "num-elements-threshold", ::llvm::cl::desc("Number of elements max of the tensor operands in order for the op to be vectorized."), ::llvm::cl::init(128)}; +}; +#undef GEN_PASS_CLASSES +#endif // GEN_PASS_CLASSES diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/gml_st_transforms/gml_st/transforms/transforms.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/gml_st_transforms/gml_st/transforms/transforms.h new file mode 100644 index 0000000000000000000000000000000000000000..97d0ef0cf750a3ded9c56a571198dc1f4a23614f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/gml_st_transforms/gml_st/transforms/transforms.h @@ -0,0 +1,47 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef MLIR_HLO_GML_ST_TRANSFORMS_TRANSFORMS_H +#define MLIR_HLO_GML_ST_TRANSFORMS_TRANSFORMS_H + +#include "mlir/IR/Operation.h" + +namespace mlir { +namespace gml_st { + +constexpr llvm::StringRef kPerfectlyTiledLoopLabel = + "__perfectly_tiled_loop_label__"; + +static constexpr llvm::StringRef kTransformedLabel = "__transformed_label__"; + +template +bool hasSingleElement(ShapedTy type) { + return type.hasStaticShape() && type.getNumElements() == 1; +} +bool hasSingleElementOperandsAndResults(Operation *op); + +// Sets the attribute to the `op` that indicates that the op was transformed. +void setLabel(Operation *op, StringRef name); + +// Removes the attribute that indicates that it was transformed. +void removeLabel(Operation *op, StringRef name); + +// Checks if `op` has the attribute that indicates that it was transformed. +bool hasLabel(Operation *op, StringRef name); + +} // namespace gml_st +} // namespace mlir + +#endif // MLIR_HLO_GML_ST_TRANSFORMS_TRANSFORMS_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/gpu_transforms_passes_inc_gen/transforms/gpu_passes.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/gpu_transforms_passes_inc_gen/transforms/gpu_passes.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..c82815463038ca519a4a3ffba5644b31df9d92bd --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/gpu_transforms_passes_inc_gen/transforms/gpu_passes.h.inc @@ -0,0 +1,280 @@ +/* Autogenerated by mlir-tblgen; don't manually edit */ + +#ifdef GEN_PASS_DECL +// Generate declarations for all passes. +#define GEN_PASS_DECL_GPUKERNELTONVVMPASS +#define GEN_PASS_DECL_GPUKERNELTOROCDLPASS +#undef GEN_PASS_DECL +#endif // GEN_PASS_DECL + +//===----------------------------------------------------------------------===// +// GpuKernelToNVVMPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_GPUKERNELTONVVMPASS +#undef GEN_PASS_DECL_GPUKERNELTONVVMPASS +#endif // GEN_PASS_DECL_GPUKERNELTONVVMPASS +#ifdef GEN_PASS_DEF_GPUKERNELTONVVMPASS +namespace impl { + +template +class GpuKernelToNVVMPassBase : public ::mlir::OperationPass { +public: + using Base = GpuKernelToNVVMPassBase; + + GpuKernelToNVVMPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + GpuKernelToNVVMPassBase(const GpuKernelToNVVMPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("gpu-kernel-to-nvvm"); + } + ::llvm::StringRef getArgument() const override { return "gpu-kernel-to-nvvm"; } + + ::llvm::StringRef getDescription() const override { return "Pass to transform a gpu module to nvvm."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("GpuKernelToNVVMPass"); + } + ::llvm::StringRef getName() const override { return "GpuKernelToNVVMPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(GpuKernelToNVVMPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_GPUKERNELTONVVMPASS +#endif // GEN_PASS_DEF_GPUKERNELTONVVMPASS + +//===----------------------------------------------------------------------===// +// GpuKernelToROCDLPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_GPUKERNELTOROCDLPASS +#undef GEN_PASS_DECL_GPUKERNELTOROCDLPASS +#endif // GEN_PASS_DECL_GPUKERNELTOROCDLPASS +#ifdef GEN_PASS_DEF_GPUKERNELTOROCDLPASS +namespace impl { + +template +class GpuKernelToROCDLPassBase : public ::mlir::OperationPass { +public: + using Base = GpuKernelToROCDLPassBase; + + GpuKernelToROCDLPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + GpuKernelToROCDLPassBase(const GpuKernelToROCDLPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("gpu-kernel-to-rocdl"); + } + ::llvm::StringRef getArgument() const override { return "gpu-kernel-to-rocdl"; } + + ::llvm::StringRef getDescription() const override { return "Pass to transform a gpu module to rocdl."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("GpuKernelToROCDLPass"); + } + ::llvm::StringRef getName() const override { return "GpuKernelToROCDLPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(GpuKernelToROCDLPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_GPUKERNELTOROCDLPASS +#endif // GEN_PASS_DEF_GPUKERNELTOROCDLPASS +#ifdef GEN_PASS_REGISTRATION + +//===----------------------------------------------------------------------===// +// GpuKernelToNVVMPass Registration +//===----------------------------------------------------------------------===// + +inline void registerGpuKernelToNVVMPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createGpuKernelToNvvmPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerGpuKernelToNVVMPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createGpuKernelToNvvmPass(); + }); +} + +//===----------------------------------------------------------------------===// +// GpuKernelToROCDLPass Registration +//===----------------------------------------------------------------------===// + +inline void registerGpuKernelToROCDLPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createGpuKernelToRocdlPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerGpuKernelToROCDLPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createGpuKernelToRocdlPass(); + }); +} + +//===----------------------------------------------------------------------===// +// LMHLOGPUTransforms Registration +//===----------------------------------------------------------------------===// + +inline void registerLMHLOGPUTransformsPasses() { + registerGpuKernelToNVVMPass(); + registerGpuKernelToROCDLPass(); +} +#undef GEN_PASS_REGISTRATION +#endif // GEN_PASS_REGISTRATION +// Deprecated. Please use the new per-pass macros. +#ifdef GEN_PASS_CLASSES + +template +class GpuKernelToNVVMPassBase : public ::mlir::OperationPass { +public: + using Base = GpuKernelToNVVMPassBase; + + GpuKernelToNVVMPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + GpuKernelToNVVMPassBase(const GpuKernelToNVVMPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("gpu-kernel-to-nvvm"); + } + ::llvm::StringRef getArgument() const override { return "gpu-kernel-to-nvvm"; } + + ::llvm::StringRef getDescription() const override { return "Pass to transform a gpu module to nvvm."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("GpuKernelToNVVMPass"); + } + ::llvm::StringRef getName() const override { return "GpuKernelToNVVMPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(GpuKernelToNVVMPassBase) + +protected: +}; + +template +class GpuKernelToROCDLPassBase : public ::mlir::OperationPass { +public: + using Base = GpuKernelToROCDLPassBase; + + GpuKernelToROCDLPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + GpuKernelToROCDLPassBase(const GpuKernelToROCDLPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("gpu-kernel-to-rocdl"); + } + ::llvm::StringRef getArgument() const override { return "gpu-kernel-to-rocdl"; } + + ::llvm::StringRef getDescription() const override { return "Pass to transform a gpu module to rocdl."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("GpuKernelToROCDLPass"); + } + ::llvm::StringRef getName() const override { return "GpuKernelToROCDLPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + registry.insert(); + + registry.insert(); + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(GpuKernelToROCDLPassBase) + +protected: +}; +#undef GEN_PASS_CLASSES +#endif // GEN_PASS_CLASSES diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/hlo_dialect_registration/mhlo/IR/register.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/hlo_dialect_registration/mhlo/IR/register.h new file mode 100644 index 0000000000000000000000000000000000000000..47a89a707115a15f161977c4ad089f37e2d0a6a3 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/hlo_dialect_registration/mhlo/IR/register.h @@ -0,0 +1,28 @@ +/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef MLIR_HLO_DIALECT_MHLO_IR_REGISTER_H_ +#define MLIR_HLO_DIALECT_MHLO_IR_REGISTER_H_ + +namespace mlir { +class DialectRegistry; +namespace mhlo { + +// Add chlo and mhlo dialects to the provided registry. +void registerAllMhloDialects(DialectRegistry ®istry); +} // namespace mhlo +} // namespace mlir + +#endif // MLIR_HLO_DIALECT_MHLO_IR_REGISTER_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/hlo_legalize_to_stablehlo/mhlo/transforms/rewriters.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/hlo_legalize_to_stablehlo/mhlo/transforms/rewriters.h new file mode 100644 index 0000000000000000000000000000000000000000..2d5bbfa8887653582238e8e4985f31aa16393ee9 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/hlo_legalize_to_stablehlo/mhlo/transforms/rewriters.h @@ -0,0 +1,231 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef MLIR_HLO_MHLO_TRANSFORMS_REWRITERS_H +#define MLIR_HLO_MHLO_TRANSFORMS_REWRITERS_H + +#include +#include + +#include "mlir/IR/MLIRContext.h" +#include "mlir/IR/PatternMatch.h" +#include "mlir/Transforms/DialectConversion.h" + +namespace mlir { +namespace bufferization { +class BufferizeTypeConverter; +} // namespace bufferization +namespace mhlo { + +// Rewrite patterns for broadcast to equivalent broadcast_in_dim legalization. +void populateBroadcastToBroadcastInDimPatterns(MLIRContext *context, + RewritePatternSet *patterns); + +// Collection of rewrite patterns for lowering a general dot product. +void populateGeneralDotOpLoweringPatterns(RewritePatternSet *patterns, + MLIRContext *ctx); + +// Collection of rewrite patterns for lowering complex operations to equivalent +// float operations. +void populateComplexLoweringPatterns(MLIRContext *context, + RewritePatternSet *patterns); + +void populateOptimizeMhloPatterns(MLIRContext *context, + RewritePatternSet *patterns); + +// Rewrite patterns for create_token to equivalent after_all legalization. +void populateCreateTokenToAfterAllPatterns(mlir::MLIRContext *context, + RewritePatternSet *patterns); + +// Rewrite patterns for cross-replica-sum to equivalent all_reduce legalization. +void populateCrossReplicaSumToAllReducePatterns(mlir::MLIRContext *context, + RewritePatternSet *patterns); + +// Rewrite patterns for dot to equivalent dot_general legalization. +void populateDotToDotGeneralPatterns(mlir::MLIRContext *context, + RewritePatternSet *patterns); + +// Rewrite patterns for einsum to equivalent dot_general legalization. +void populateEinsumToDotGeneralPatterns(mlir::MLIRContext *context, + RewritePatternSet *patterns); + +// Rewrite patterns for gather to equivalent torch index select legalization. +void populateGatherToTorchIndexSelectPatterns(mlir::MLIRContext *context, + RewritePatternSet *patterns); + +// Rewrite patterns for torch index select to equivalent gather legalization. +void populateTorchIndexSelectToGatherPatterns(mlir::MLIRContext *context, + RewritePatternSet *patterns); + +void populateMhloToStdPatterns(RewritePatternSet *patterns, MLIRContext *ctx); + +// Collection of rewrite patterns for lowering all mhlo ops to their +// lmhlo counterparts. +void populateDynamicHloToLhloConversionPattern( + MLIRContext *context, bufferization::BufferizeTypeConverter *converter, + RewritePatternSet *patterns); + +// Collection of rewrite patterns for lowering of HLO to LHLO dialect. +void populateHloToLhloConversionPattern( + MLIRContext *context, bufferization::BufferizeTypeConverter *converter, + RewritePatternSet *patterns); + +// Collection of rewrite patterns for lowering of HLO to arithmetic dialect. +void populateHloToArithmeticConversionPatterns(RewritePatternSet *patterns); + +// Collection of rewrite patterns for lowering pointwise HLO ops with scalar +// arguments to arithmetic dialect. +void populateScalarHloToArithmeticConversionPatterns( + MLIRContext *context, TypeConverter &typeConverter, + RewritePatternSet *patterns, + llvm::function_ref filterFn = nullptr); + +// Collection of rewrite patterns for lowering of shape operations from the HLO +// dialect to the standard dialect. +void populateHloShapeOpsToStandardConversionPattern( + MLIRContext *context, TypeConverter &typeConverter, + RewritePatternSet *patterns); + +// Collection of rewrite patterns for lowering of HLO to Linalg dialect. +void populateHloToLinalgConversionPattern(MLIRContext *context, + TypeConverter &typeConverter, + RewritePatternSet *patterns, + bool enablePrimitiveOps = false); + +// Collection of rewrite patterns for lowering of HLO dim operations. +void populateShapeComputationPatterns(MLIRContext *context, + RewritePatternSet *patterns); + +// Converter to signless intergers to be used with linalg conversion patterns. +std::unique_ptr createHloToLinalgTypeConverter(); + +// Sets up legality definitions for materializing broadcasts. +void setupMaterializeBroadcastsLegality(MLIRContext *context, + ConversionTarget *conversionTarget); + +// Populates a collection of rewrite patterns for materializing broadcast +// attributes to equivalent sequences of ops. +void populateMaterializeBroadcastsPatterns(MLIRContext *context, + RewritePatternSet *patterns); + +// Populates a collection of rewrite patterns to realize element-wise operations +// on ranked tensors where possible. +void populateTransformUnrankedHloPatterns(MLIRContext *context, + RewritePatternSet *patterns); + +void populateDynamicShapeFusionPatterns(MLIRContext *context, + RewritePatternSet *patterns); + +// Populate a collection of conversion patterns for un-fusing +// batch_norm_inference into constituent HLO ops. +void populateUnfuseBatchNormInferencePattern(MLIRContext *context, + RewritePatternSet *patterns); + +// Populate a collection of conversion patterns for un-fusing +// batch_norm_training into constituent HLO ops. +void populateUnfuseBatchNormTrainingPattern(MLIRContext *context, + RewritePatternSet *patterns); + +// Populate a collection of conversion patterns for un-fusing +// // batch_norm_inference and batch_norm_training into constituent HLO ops. +inline void populateUnfuseBatchNormPatterns(MLIRContext *context, + RewritePatternSet *patterns) { + populateUnfuseBatchNormInferencePattern(context, patterns); + populateUnfuseBatchNormTrainingPattern(context, patterns); +} + +// Populates patterns that translate the trigonometric operations from the +// standard dialect to approximations that do not use intrinsics. +void populateTrigonometricToApproximationPatterns(MLIRContext *context, + RewritePatternSet *patterns); + +// Populate patterns to prepare moving dynamic broadcasts up over element-wise +// operations and broadcast the operands rather than the result. This will +// eventually allow for larger fusions. +void populateMergeAssumingOpsPatterns(MLIRContext *context, + RewritePatternSet *patterns); + +// Populate patterns for iterative shape reification. +void populateShapeReificationPatterns(MLIRContext *, RewritePatternSet *); + +// Populate patterns to group reduction and parallel dimensions of reduction +// operations and realize them through equivalent 1D or 2D reductions. +void populateGroupReductionDimensionsPatterns(MLIRContext *context, + RewritePatternSet *patterns, + bool preferColumnsReductions); + +/// Populate rank specialization clustering and lowering patterns. +void populateRankSpecializationClusterPatterns(MLIRContext *context, + RewritePatternSet *patterns); +void populateRankSpecializationToSCFPatterns(MLIRContext *context, + RewritePatternSet *patterns, + int64_t maxTargetRank); + +/// Populate sparse tensor specific rewriting patterns. +void populateSparseRewritingPatterns(RewritePatternSet *patterns, + MLIRContext *ctx); + +/// Populates sparse ops in CHLO to linalg rewriting patterns. +void populateLegalizeSparseCHLOPatterns(MLIRContext *context, + TypeConverter &typeConverter, + RewritePatternSet *patterns); + +/// Populate sparse ops to mhlo.CustomCall patterns. +void populateLegalizeSparseOpsToCustomCallPatterns(MLIRContext *context, + TypeConverter &typeConverter, + RewritePatternSet *patterns); + +} // namespace mhlo + +namespace chlo { + +// Populates a collection of conversion patterns for legalizing broadcasting +// client-HLO to their non-broadcasting counterparts. +void populateChloBroadcastingPatterns(MLIRContext *context, + RewritePatternSet *patterns); + +// Populates a collection of conversion patterns for legalizing client-HLO to +// HLO by decomposing client-operations to corresponding sequences of more +// primitive operations. This does not include the +// PopulateChloBroadcastingPatterns above. +void populateDecomposeChloPatterns(MLIRContext *context, + RewritePatternSet *patterns); + +} // namespace chlo + +namespace stablehlo { + +// Populates MHLO ops to StableHLO ops rewriting patterns. +// Also see `stablehlo::registerFuncOpsForTypeConversion` for helper patterns +// which make sure `func.func`, `func.call` and `func.return` which involve +// illegal types also get converted. +void populateHloToStablehloPatterns(RewritePatternSet *patterns, + TypeConverter *converter, + MLIRContext *context, + bool allowExperimentalFeatures); + +// Populates StableHLO ops to MHLO ops rewriting patterns. +// Also see `stablehlo::registerFuncOpsForTypeConversion` for helper patterns +// which make sure `func.func`, `func.call` and `func.return` which involve +// illegal types also get converted. +void populateStablehloToHloPatterns(RewritePatternSet *patterns, + TypeConverter *converter, + MLIRContext *context); + +} // namespace stablehlo + +} // namespace mlir + +#endif // MLIR_HLO_MHLO_TRANSFORMS_REWRITERS_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/hlo_ops_attrs_inc_gen/mhlo/IR/hlo_ops_attrs.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/hlo_ops_attrs_inc_gen/mhlo/IR/hlo_ops_attrs.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..588fbcdb58bb30fc34a3c2c6221e0128ad1ee325 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/hlo_ops_attrs_inc_gen/mhlo/IR/hlo_ops_attrs.h.inc @@ -0,0 +1,389 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* AttrDef Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_ATTRDEF_CLASSES +#undef GET_ATTRDEF_CLASSES + + +namespace mlir { +class AsmParser; +class AsmPrinter; +} // namespace mlir +namespace mlir { +namespace mhlo { +class ArgResultAliasAttr; +class ChannelHandleAttr; +class ComparisonDirectionAttr; +class ComparisonTypeAttr; +class ConvDimensionNumbersAttr; +class CrossProgramPrefetchAttr; +class CustomCallScheduleAttr; +class DequantizeModeAttr; +class DomainKindAttr; +class DotDimensionNumbersAttr; +class FftTypeAttr; +class FusionKindAttr; +class GatherDimensionNumbersAttr; +class OutputOperandAliasAttr; +class PrecisionAttr; +class RngAlgorithmAttr; +class RngDistributionAttr; +class ScatterDimensionNumbersAttr; +class TransposeAttr; +class TypeExtensionsAttr; +namespace detail { +struct ArgResultAliasAttrStorage; +} // namespace detail +class ArgResultAliasAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static ArgResultAliasAttr get(::mlir::MLIRContext *context, ::llvm::ArrayRef argTupleIndices, int64_t resultIndex, ::llvm::ArrayRef resultTupleIndices, bool isMustAlias); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"result_alias"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::llvm::ArrayRef getArgTupleIndices() const; + int64_t getResultIndex() const; + ::llvm::ArrayRef getResultTupleIndices() const; + bool getIsMustAlias() const; +}; +namespace detail { +struct ChannelHandleAttrStorage; +} // namespace detail +class ChannelHandleAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static ChannelHandleAttr get(::mlir::MLIRContext *context, int64_t handle, int64_t type); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"channel_handle"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + int64_t getHandle() const; + int64_t getType() const; +}; +namespace detail { +struct ComparisonDirectionAttrStorage; +} // namespace detail +class ComparisonDirectionAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static ComparisonDirectionAttr get(::mlir::MLIRContext *context, ::mlir::mhlo::ComparisonDirection value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"comparison_direction"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::mhlo::ComparisonDirection getValue() const; +}; +namespace detail { +struct ComparisonTypeAttrStorage; +} // namespace detail +class ComparisonTypeAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static ComparisonTypeAttr get(::mlir::MLIRContext *context, ::mlir::mhlo::ComparisonType value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"comparison_type"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::mhlo::ComparisonType getValue() const; +}; +namespace detail { +struct ConvDimensionNumbersAttrStorage; +} // namespace detail +class ConvDimensionNumbersAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static ConvDimensionNumbersAttr get(::mlir::MLIRContext *context, int64_t inputBatchDimension, int64_t inputFeatureDimension, ::llvm::ArrayRef inputSpatialDimensions, int64_t kernelInputFeatureDimension, int64_t kernelOutputFeatureDimension, ::llvm::ArrayRef kernelSpatialDimensions, int64_t outputBatchDimension, int64_t outputFeatureDimension, ::llvm::ArrayRef outputSpatialDimensions); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"conv"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + int64_t getInputBatchDimension() const; + int64_t getInputFeatureDimension() const; + ::llvm::ArrayRef getInputSpatialDimensions() const; + int64_t getKernelInputFeatureDimension() const; + int64_t getKernelOutputFeatureDimension() const; + ::llvm::ArrayRef getKernelSpatialDimensions() const; + int64_t getOutputBatchDimension() const; + int64_t getOutputFeatureDimension() const; + ::llvm::ArrayRef getOutputSpatialDimensions() const; +}; +namespace detail { +struct CrossProgramPrefetchAttrStorage; +} // namespace detail +class CrossProgramPrefetchAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static CrossProgramPrefetchAttr get(::mlir::MLIRContext *context, int64_t parameter, ::llvm::ArrayRef indices, std::optional offset); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"cross_program_prefetch"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + int64_t getParameter() const; + ::llvm::ArrayRef getIndices() const; + std::optional getOffset() const; +}; +namespace detail { +struct CustomCallScheduleAttrStorage; +} // namespace detail +class CustomCallScheduleAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static CustomCallScheduleAttr get(::mlir::MLIRContext *context, ::mlir::mhlo::CustomCallSchedule value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"custom_call_schedule"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::mhlo::CustomCallSchedule getValue() const; +}; +namespace detail { +struct DequantizeModeAttrStorage; +} // namespace detail +class DequantizeModeAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static DequantizeModeAttr get(::mlir::MLIRContext *context, ::mlir::mhlo::DequantizeMode value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"dequantize_mode"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::mhlo::DequantizeMode getValue() const; +}; +namespace detail { +struct DomainKindAttrStorage; +} // namespace detail +class DomainKindAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static DomainKindAttr get(::mlir::MLIRContext *context, ::mlir::mhlo::DomainKind value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"kind"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::mhlo::DomainKind getValue() const; +}; +namespace detail { +struct DotDimensionNumbersAttrStorage; +} // namespace detail +class DotDimensionNumbersAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static DotDimensionNumbersAttr get(::mlir::MLIRContext *context, ::llvm::ArrayRef lhsBatchingDimensions, ::llvm::ArrayRef rhsBatchingDimensions, ::llvm::ArrayRef lhsContractingDimensions, ::llvm::ArrayRef rhsContractingDimensions); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"dot"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::llvm::ArrayRef getLhsBatchingDimensions() const; + ::llvm::ArrayRef getRhsBatchingDimensions() const; + ::llvm::ArrayRef getLhsContractingDimensions() const; + ::llvm::ArrayRef getRhsContractingDimensions() const; +}; +namespace detail { +struct FftTypeAttrStorage; +} // namespace detail +class FftTypeAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static FftTypeAttr get(::mlir::MLIRContext *context, ::mlir::mhlo::FftType value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"fft_type"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::mhlo::FftType getValue() const; +}; +namespace detail { +struct FusionKindAttrStorage; +} // namespace detail +class FusionKindAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static FusionKindAttr get(::mlir::MLIRContext *context, ::mlir::mhlo::FusionKind value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"fusion_kind"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::mhlo::FusionKind getValue() const; +}; +namespace detail { +struct GatherDimensionNumbersAttrStorage; +} // namespace detail +class GatherDimensionNumbersAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static GatherDimensionNumbersAttr get(::mlir::MLIRContext *context, ::llvm::ArrayRef offsetDims, ::llvm::ArrayRef collapsedSliceDims, ::llvm::ArrayRef startIndexMap, int64_t indexVectorDim); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"gather"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::llvm::ArrayRef getOffsetDims() const; + ::llvm::ArrayRef getCollapsedSliceDims() const; + ::llvm::ArrayRef getStartIndexMap() const; + int64_t getIndexVectorDim() const; +}; +namespace detail { +struct OutputOperandAliasAttrStorage; +} // namespace detail +class OutputOperandAliasAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static OutputOperandAliasAttr get(::mlir::MLIRContext *context, ::llvm::ArrayRef outputTupleIndices, int64_t operandIndex, ::llvm::ArrayRef operandTupleIndices); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"output_operand_alias"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::llvm::ArrayRef getOutputTupleIndices() const; + int64_t getOperandIndex() const; + ::llvm::ArrayRef getOperandTupleIndices() const; +}; +namespace detail { +struct PrecisionAttrStorage; +} // namespace detail +class PrecisionAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static PrecisionAttr get(::mlir::MLIRContext *context, ::mlir::mhlo::Precision value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"precision"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::mhlo::Precision getValue() const; +}; +namespace detail { +struct RngAlgorithmAttrStorage; +} // namespace detail +class RngAlgorithmAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static RngAlgorithmAttr get(::mlir::MLIRContext *context, ::mlir::mhlo::RngAlgorithm value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"rng_algorithm"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::mhlo::RngAlgorithm getValue() const; +}; +namespace detail { +struct RngDistributionAttrStorage; +} // namespace detail +class RngDistributionAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static RngDistributionAttr get(::mlir::MLIRContext *context, ::mlir::mhlo::RngDistribution value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"rng_distribution"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::mhlo::RngDistribution getValue() const; +}; +namespace detail { +struct ScatterDimensionNumbersAttrStorage; +} // namespace detail +class ScatterDimensionNumbersAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static ScatterDimensionNumbersAttr get(::mlir::MLIRContext *context, ::llvm::ArrayRef updateWindowDims, ::llvm::ArrayRef insertedWindowDims, ::llvm::ArrayRef scatterDimsToOperandDims, int64_t indexVectorDim); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"scatter"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::llvm::ArrayRef getUpdateWindowDims() const; + ::llvm::ArrayRef getInsertedWindowDims() const; + ::llvm::ArrayRef getScatterDimsToOperandDims() const; + int64_t getIndexVectorDim() const; +}; +namespace detail { +struct TransposeAttrStorage; +} // namespace detail +class TransposeAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static TransposeAttr get(::mlir::MLIRContext *context, ::mlir::mhlo::Transpose value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"transpose"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::mhlo::Transpose getValue() const; +}; +namespace detail { +struct TypeExtensionsAttrStorage; +} // namespace detail +class TypeExtensionsAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static TypeExtensionsAttr get(::mlir::MLIRContext *context, ::llvm::ArrayRef bounds); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"type_extensions"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::llvm::ArrayRef getBounds() const; + ::mlir::LogicalResult verifyEncoding(ArrayRef shape, Type elementType, ::llvm::function_ref<::mlir::InFlightDiagnostic()> emitError) const; +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::ArgResultAliasAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::ChannelHandleAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::ComparisonDirectionAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::ComparisonTypeAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::ConvDimensionNumbersAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::CrossProgramPrefetchAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::CustomCallScheduleAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::DequantizeModeAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::DomainKindAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::DotDimensionNumbersAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::FftTypeAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::FusionKindAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::GatherDimensionNumbersAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::OutputOperandAliasAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::PrecisionAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::RngAlgorithmAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::RngDistributionAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::ScatterDimensionNumbersAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::TransposeAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::TypeExtensionsAttr) + +#endif // GET_ATTRDEF_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/hlo_ops_common/mhlo/IR/hlo_ops_common.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/hlo_ops_common/mhlo/IR/hlo_ops_common.h new file mode 100644 index 0000000000000000000000000000000000000000..db6898ae9850f54c03bc16f9d39dc57afc7168f1 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/hlo_ops_common/mhlo/IR/hlo_ops_common.h @@ -0,0 +1,58 @@ +/* Copyright 2021 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef MLIR_HLO_MHLO_IR_HLO_OPS_COMMON_H +#define MLIR_HLO_MHLO_IR_HLO_OPS_COMMON_H + +// This file defines functionality shared between chlo/mhlo/lhlo dialects. + +#include +#include + +#include "mlir/IR/BuiltinAttributes.h" +#include "mlir/IR/OpDefinition.h" +#include "mlir/IR/OpImplementation.h" +#include "mlir/IR/Operation.h" + +namespace mlir { +namespace hlo { + +// Verifies the source target pairs attached to collective permute. +LogicalResult verifyCollectivePermuteSourceTargetPairs( + Operation* op, DenseIntElementsAttr attr); + +LogicalResult verifyReduceScatter(Operation* op, TypeRange operandTypes, + TypeRange resultTypes, + uint64_t scatterDimension); + +// Custom formatting for convolution window attributes. +void printWindowAttributes(OpAsmPrinter& p, Operation* op, + std::optional windowStrides, + std::optional padding, + std::optional lhsDilation, + std::optional rhsDilation, + std::optional windowReversal); + +ParseResult parseWindowAttributes(OpAsmParser& parser, + DenseIntElementsAttr& windowStrides, + DenseIntElementsAttr& padding, + DenseIntElementsAttr& lhsDilation, + DenseIntElementsAttr& rhsDilation, + DenseElementsAttr& windowReversal); + +} // namespace hlo +} // namespace mlir + +#endif // MLIR_HLO_MHLO_IR_HLO_OPS_COMMON_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/hlo_ops_enums_inc_gen/mhlo/IR/hlo_ops_enums.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/hlo_ops_enums_inc_gen/mhlo/IR/hlo_ops_enums.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..38b5eb38d069ad1be361a7cc58d86328798e4266 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/hlo_ops_enums_inc_gen/mhlo/IR/hlo_ops_enums.h.inc @@ -0,0 +1,1008 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Enum Utility Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: hlo_ops.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace mhlo { +// Which comparison operation to perform. +enum class ComparisonDirection : uint32_t { + EQ = 0, + NE = 1, + GE = 2, + GT = 3, + LE = 4, + LT = 5, +}; + +::std::optional symbolizeComparisonDirection(uint32_t); +::llvm::StringRef stringifyComparisonDirection(ComparisonDirection); +::std::optional symbolizeComparisonDirection(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForComparisonDirection() { + return 5; +} + + +inline ::llvm::StringRef stringifyEnum(ComparisonDirection enumValue) { + return stringifyComparisonDirection(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeComparisonDirection(str); +} +} // namespace mhlo +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::mhlo::ComparisonDirection, ::mlir::mhlo::ComparisonDirection> { + template + static FailureOr<::mlir::mhlo::ComparisonDirection> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for Which comparison operation to perform."); + + // Symbolize the keyword. + if (::std::optional<::mlir::mhlo::ComparisonDirection> attr = ::mlir::mhlo::symbolizeEnum<::mlir::mhlo::ComparisonDirection>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid Which comparison operation to perform. specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::mhlo::ComparisonDirection value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::mhlo::ComparisonDirection> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::mhlo::ComparisonDirection getEmptyKey() { + return static_cast<::mlir::mhlo::ComparisonDirection>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::mhlo::ComparisonDirection getTombstoneKey() { + return static_cast<::mlir::mhlo::ComparisonDirection>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::mhlo::ComparisonDirection &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::mhlo::ComparisonDirection &lhs, const ::mlir::mhlo::ComparisonDirection &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace mhlo { +// Which comparison type to use. +enum class ComparisonType : uint32_t { + NOTYPE = 0, + FLOAT = 1, + TOTALORDER = 2, + SIGNED = 3, + UNSIGNED = 4, +}; + +::std::optional symbolizeComparisonType(uint32_t); +::llvm::StringRef stringifyComparisonType(ComparisonType); +::std::optional symbolizeComparisonType(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForComparisonType() { + return 4; +} + + +inline ::llvm::StringRef stringifyEnum(ComparisonType enumValue) { + return stringifyComparisonType(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeComparisonType(str); +} +} // namespace mhlo +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::mhlo::ComparisonType, ::mlir::mhlo::ComparisonType> { + template + static FailureOr<::mlir::mhlo::ComparisonType> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for Which comparison type to use."); + + // Symbolize the keyword. + if (::std::optional<::mlir::mhlo::ComparisonType> attr = ::mlir::mhlo::symbolizeEnum<::mlir::mhlo::ComparisonType>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid Which comparison type to use. specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::mhlo::ComparisonType value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::mhlo::ComparisonType> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::mhlo::ComparisonType getEmptyKey() { + return static_cast<::mlir::mhlo::ComparisonType>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::mhlo::ComparisonType getTombstoneKey() { + return static_cast<::mlir::mhlo::ComparisonType>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::mhlo::ComparisonType &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::mhlo::ComparisonType &lhs, const ::mlir::mhlo::ComparisonType &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace mhlo { +// Custom call API version +enum class CustomCallApiVersion : uint32_t { + API_VERSION_UNSPECIFIED = 0, + API_VERSION_ORIGINAL = 1, + API_VERSION_STATUS_RETURNING = 2, + API_VERSION_STATUS_RETURNING_UNIFIED = 3, + API_VERSION_TYPED_FFI = 4, +}; + +::std::optional symbolizeCustomCallApiVersion(uint32_t); +::llvm::StringRef stringifyCustomCallApiVersion(CustomCallApiVersion); +::std::optional symbolizeCustomCallApiVersion(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForCustomCallApiVersion() { + return 4; +} + + +inline ::llvm::StringRef stringifyEnum(CustomCallApiVersion enumValue) { + return stringifyCustomCallApiVersion(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeCustomCallApiVersion(str); +} + +class CustomCallApiVersionAttr : public ::mlir::IntegerAttr { +public: + using ValueType = CustomCallApiVersion; + using ::mlir::IntegerAttr::IntegerAttr; + static bool classof(::mlir::Attribute attr); + static CustomCallApiVersionAttr get(::mlir::MLIRContext *context, CustomCallApiVersion val); + CustomCallApiVersion getValue() const; +}; +} // namespace mhlo +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::mhlo::CustomCallApiVersion, ::mlir::mhlo::CustomCallApiVersion> { + template + static FailureOr<::mlir::mhlo::CustomCallApiVersion> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for Custom call API version"); + + // Symbolize the keyword. + if (::std::optional<::mlir::mhlo::CustomCallApiVersion> attr = ::mlir::mhlo::symbolizeEnum<::mlir::mhlo::CustomCallApiVersion>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid Custom call API version specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::mhlo::CustomCallApiVersion value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::mhlo::CustomCallApiVersion> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::mhlo::CustomCallApiVersion getEmptyKey() { + return static_cast<::mlir::mhlo::CustomCallApiVersion>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::mhlo::CustomCallApiVersion getTombstoneKey() { + return static_cast<::mlir::mhlo::CustomCallApiVersion>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::mhlo::CustomCallApiVersion &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::mhlo::CustomCallApiVersion &lhs, const ::mlir::mhlo::CustomCallApiVersion &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace mhlo { +// Specifies the desired schedule for the custom-call. +enum class CustomCallSchedule : uint32_t { + NONE = 0, + LATEST = 1, + EARLIEST = 2, +}; + +::std::optional symbolizeCustomCallSchedule(uint32_t); +::llvm::StringRef stringifyCustomCallSchedule(CustomCallSchedule); +::std::optional symbolizeCustomCallSchedule(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForCustomCallSchedule() { + return 2; +} + + +inline ::llvm::StringRef stringifyEnum(CustomCallSchedule enumValue) { + return stringifyCustomCallSchedule(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeCustomCallSchedule(str); +} +} // namespace mhlo +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::mhlo::CustomCallSchedule, ::mlir::mhlo::CustomCallSchedule> { + template + static FailureOr<::mlir::mhlo::CustomCallSchedule> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for Specifies the desired schedule for the custom-call."); + + // Symbolize the keyword. + if (::std::optional<::mlir::mhlo::CustomCallSchedule> attr = ::mlir::mhlo::symbolizeEnum<::mlir::mhlo::CustomCallSchedule>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid Specifies the desired schedule for the custom-call. specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::mhlo::CustomCallSchedule value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::mhlo::CustomCallSchedule> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::mhlo::CustomCallSchedule getEmptyKey() { + return static_cast<::mlir::mhlo::CustomCallSchedule>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::mhlo::CustomCallSchedule getTombstoneKey() { + return static_cast<::mlir::mhlo::CustomCallSchedule>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::mhlo::CustomCallSchedule &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::mhlo::CustomCallSchedule &lhs, const ::mlir::mhlo::CustomCallSchedule &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace mhlo { +// Dequantization mode. Only MIN_COMBINED is supported. +enum class DequantizeMode : uint32_t { + MIN_COMBINED = 0, +}; + +::std::optional symbolizeDequantizeMode(uint32_t); +::llvm::StringRef stringifyDequantizeMode(DequantizeMode); +::std::optional symbolizeDequantizeMode(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForDequantizeMode() { + return 0; +} + + +inline ::llvm::StringRef stringifyEnum(DequantizeMode enumValue) { + return stringifyDequantizeMode(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeDequantizeMode(str); +} +} // namespace mhlo +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::mhlo::DequantizeMode, ::mlir::mhlo::DequantizeMode> { + template + static FailureOr<::mlir::mhlo::DequantizeMode> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for Dequantization mode. Only MIN_COMBINED is supported."); + + // Symbolize the keyword. + if (::std::optional<::mlir::mhlo::DequantizeMode> attr = ::mlir::mhlo::symbolizeEnum<::mlir::mhlo::DequantizeMode>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid Dequantization mode. Only MIN_COMBINED is supported. specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::mhlo::DequantizeMode value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::mhlo::DequantizeMode> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::mhlo::DequantizeMode getEmptyKey() { + return static_cast<::mlir::mhlo::DequantizeMode>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::mhlo::DequantizeMode getTombstoneKey() { + return static_cast<::mlir::mhlo::DequantizeMode>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::mhlo::DequantizeMode &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::mhlo::DequantizeMode &lhs, const ::mlir::mhlo::DequantizeMode &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace mhlo { +// Kind of domain metatdata attached to an HLO domain. +enum class DomainKind : uint32_t { + sharding = 0, +}; + +::std::optional symbolizeDomainKind(uint32_t); +::llvm::StringRef stringifyDomainKind(DomainKind); +::std::optional symbolizeDomainKind(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForDomainKind() { + return 0; +} + + +inline ::llvm::StringRef stringifyEnum(DomainKind enumValue) { + return stringifyDomainKind(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeDomainKind(str); +} +} // namespace mhlo +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::mhlo::DomainKind, ::mlir::mhlo::DomainKind> { + template + static FailureOr<::mlir::mhlo::DomainKind> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for Kind of domain metatdata attached to an HLO domain."); + + // Symbolize the keyword. + if (::std::optional<::mlir::mhlo::DomainKind> attr = ::mlir::mhlo::symbolizeEnum<::mlir::mhlo::DomainKind>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid Kind of domain metatdata attached to an HLO domain. specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::mhlo::DomainKind value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::mhlo::DomainKind> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::mhlo::DomainKind getEmptyKey() { + return static_cast<::mlir::mhlo::DomainKind>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::mhlo::DomainKind getTombstoneKey() { + return static_cast<::mlir::mhlo::DomainKind>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::mhlo::DomainKind &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::mhlo::DomainKind &lhs, const ::mlir::mhlo::DomainKind &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace mhlo { +// XLA fast fourier transform type. +enum class FftType : uint32_t { + FFT = 0, + IFFT = 1, + RFFT = 2, + IRFFT = 3, +}; + +::std::optional symbolizeFftType(uint32_t); +::llvm::StringRef stringifyFftType(FftType); +::std::optional symbolizeFftType(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForFftType() { + return 3; +} + + +inline ::llvm::StringRef stringifyEnum(FftType enumValue) { + return stringifyFftType(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeFftType(str); +} +} // namespace mhlo +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::mhlo::FftType, ::mlir::mhlo::FftType> { + template + static FailureOr<::mlir::mhlo::FftType> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for XLA fast fourier transform type."); + + // Symbolize the keyword. + if (::std::optional<::mlir::mhlo::FftType> attr = ::mlir::mhlo::symbolizeEnum<::mlir::mhlo::FftType>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid XLA fast fourier transform type. specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::mhlo::FftType value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::mhlo::FftType> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::mhlo::FftType getEmptyKey() { + return static_cast<::mlir::mhlo::FftType>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::mhlo::FftType getTombstoneKey() { + return static_cast<::mlir::mhlo::FftType>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::mhlo::FftType &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::mhlo::FftType &lhs, const ::mlir::mhlo::FftType &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace mhlo { +// fusion kind +enum class FusionKind : uint32_t { + kLoop = 0, + kInput = 1, + kOutput = 2, + kCustom = 3, +}; + +::std::optional symbolizeFusionKind(uint32_t); +::llvm::StringRef stringifyFusionKind(FusionKind); +::std::optional symbolizeFusionKind(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForFusionKind() { + return 3; +} + + +inline ::llvm::StringRef stringifyEnum(FusionKind enumValue) { + return stringifyFusionKind(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeFusionKind(str); +} +} // namespace mhlo +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::mhlo::FusionKind, ::mlir::mhlo::FusionKind> { + template + static FailureOr<::mlir::mhlo::FusionKind> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for fusion kind"); + + // Symbolize the keyword. + if (::std::optional<::mlir::mhlo::FusionKind> attr = ::mlir::mhlo::symbolizeEnum<::mlir::mhlo::FusionKind>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid fusion kind specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::mhlo::FusionKind value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::mhlo::FusionKind> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::mhlo::FusionKind getEmptyKey() { + return static_cast<::mlir::mhlo::FusionKind>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::mhlo::FusionKind getTombstoneKey() { + return static_cast<::mlir::mhlo::FusionKind>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::mhlo::FusionKind &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::mhlo::FusionKind &lhs, const ::mlir::mhlo::FusionKind &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace mhlo { +// XLA precision for an operand. Has backend specific meaning. +enum class Precision : uint32_t { + DEFAULT = 0, + HIGH = 1, + HIGHEST = 2, + PACKED_NIBBLE = 3, +}; + +::std::optional symbolizePrecision(uint32_t); +::llvm::StringRef stringifyPrecision(Precision); +::std::optional symbolizePrecision(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForPrecision() { + return 3; +} + + +inline ::llvm::StringRef stringifyEnum(Precision enumValue) { + return stringifyPrecision(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizePrecision(str); +} +} // namespace mhlo +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::mhlo::Precision, ::mlir::mhlo::Precision> { + template + static FailureOr<::mlir::mhlo::Precision> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for XLA precision for an operand. Has backend specific meaning."); + + // Symbolize the keyword. + if (::std::optional<::mlir::mhlo::Precision> attr = ::mlir::mhlo::symbolizeEnum<::mlir::mhlo::Precision>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid XLA precision for an operand. Has backend specific meaning. specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::mhlo::Precision value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::mhlo::Precision> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::mhlo::Precision getEmptyKey() { + return static_cast<::mlir::mhlo::Precision>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::mhlo::Precision getTombstoneKey() { + return static_cast<::mlir::mhlo::Precision>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::mhlo::Precision &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::mhlo::Precision &lhs, const ::mlir::mhlo::Precision &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace mhlo { +// XLA PRNG algorithm to be used. +enum class RngAlgorithm : uint32_t { + DEFAULT = 0, + THREE_FRY = 1, + PHILOX = 2, +}; + +::std::optional symbolizeRngAlgorithm(uint32_t); +::llvm::StringRef stringifyRngAlgorithm(RngAlgorithm); +::std::optional symbolizeRngAlgorithm(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForRngAlgorithm() { + return 2; +} + + +inline ::llvm::StringRef stringifyEnum(RngAlgorithm enumValue) { + return stringifyRngAlgorithm(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeRngAlgorithm(str); +} +} // namespace mhlo +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::mhlo::RngAlgorithm, ::mlir::mhlo::RngAlgorithm> { + template + static FailureOr<::mlir::mhlo::RngAlgorithm> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for XLA PRNG algorithm to be used."); + + // Symbolize the keyword. + if (::std::optional<::mlir::mhlo::RngAlgorithm> attr = ::mlir::mhlo::symbolizeEnum<::mlir::mhlo::RngAlgorithm>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid XLA PRNG algorithm to be used. specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::mhlo::RngAlgorithm value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::mhlo::RngAlgorithm> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::mhlo::RngAlgorithm getEmptyKey() { + return static_cast<::mlir::mhlo::RngAlgorithm>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::mhlo::RngAlgorithm getTombstoneKey() { + return static_cast<::mlir::mhlo::RngAlgorithm>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::mhlo::RngAlgorithm &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::mhlo::RngAlgorithm &lhs, const ::mlir::mhlo::RngAlgorithm &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace mhlo { +// XLA PRNG distribution to be used. +enum class RngDistribution : uint32_t { + UNIFORM = 1, + NORMAL = 2, +}; + +::std::optional symbolizeRngDistribution(uint32_t); +::llvm::StringRef stringifyRngDistribution(RngDistribution); +::std::optional symbolizeRngDistribution(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForRngDistribution() { + return 2; +} + + +inline ::llvm::StringRef stringifyEnum(RngDistribution enumValue) { + return stringifyRngDistribution(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeRngDistribution(str); +} +} // namespace mhlo +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::mhlo::RngDistribution, ::mlir::mhlo::RngDistribution> { + template + static FailureOr<::mlir::mhlo::RngDistribution> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for XLA PRNG distribution to be used."); + + // Symbolize the keyword. + if (::std::optional<::mlir::mhlo::RngDistribution> attr = ::mlir::mhlo::symbolizeEnum<::mlir::mhlo::RngDistribution>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid XLA PRNG distribution to be used. specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::mhlo::RngDistribution value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::mhlo::RngDistribution> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::mhlo::RngDistribution getEmptyKey() { + return static_cast<::mlir::mhlo::RngDistribution>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::mhlo::RngDistribution getTombstoneKey() { + return static_cast<::mlir::mhlo::RngDistribution>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::mhlo::RngDistribution &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::mhlo::RngDistribution &lhs, const ::mlir::mhlo::RngDistribution &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace mhlo { +// Transpose options +enum class Transpose : uint32_t { + TRANSPOSE_INVALID = 0, + NO_TRANSPOSE = 1, + TRANSPOSE = 2, + ADJOINT = 3, +}; + +::std::optional symbolizeTranspose(uint32_t); +::llvm::StringRef stringifyTranspose(Transpose); +::std::optional symbolizeTranspose(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForTranspose() { + return 3; +} + + +inline ::llvm::StringRef stringifyEnum(Transpose enumValue) { + return stringifyTranspose(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeTranspose(str); +} +} // namespace mhlo +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::mhlo::Transpose, ::mlir::mhlo::Transpose> { + template + static FailureOr<::mlir::mhlo::Transpose> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for Transpose options"); + + // Symbolize the keyword. + if (::std::optional<::mlir::mhlo::Transpose> attr = ::mlir::mhlo::symbolizeEnum<::mlir::mhlo::Transpose>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid Transpose options specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::mhlo::Transpose value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::mhlo::Transpose> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::mhlo::Transpose getEmptyKey() { + return static_cast<::mlir::mhlo::Transpose>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::mhlo::Transpose getTombstoneKey() { + return static_cast<::mlir::mhlo::Transpose>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::mhlo::Transpose &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::mhlo::Transpose &lhs, const ::mlir::mhlo::Transpose &rhs) { + return lhs == rhs; + } +}; +} + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/hlo_ops_inc_gen/mhlo/IR/hlo_ops.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/hlo_ops_inc_gen/mhlo/IR/hlo_ops.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..8ac9e1da525402b2bd2d08a43fba8873349425f5 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/hlo_ops_inc_gen/mhlo/IR/hlo_ops.h.inc @@ -0,0 +1,17622 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: hlo_ops.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#if defined(GET_OP_CLASSES) || defined(GET_OP_FWD_DEFINES) +#undef GET_OP_FWD_DEFINES +namespace mlir { +namespace mhlo { +class AbsOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class AddDependencyOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class AddOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class AfterAllOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class AllGatherOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class AllReduceOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class AllToAllOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class AndOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class AsyncDoneOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class AsyncStartOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class AsyncUpdateOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class Atan2Op; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class BatchNormGradOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class BatchNormInferenceOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class BatchNormTrainingOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class BitcastConvertOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class BitcastOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class BroadcastInDimOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class BroadcastOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class CaseOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class CbrtOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class CeilOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class CholeskyOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class ClampOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class ClzOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class CollectivePermuteOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class CompareOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class ComplexOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class ComputeReshapeShapeOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class ConcatenateOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class ConstantOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class ConvertOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class ConvolutionOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class CopyOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class CosineOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class CreateTokenOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class CrossReplicaSumOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class CstrReshapableOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class CustomCallOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class DivOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class DomainOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class DotGeneralOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class DotOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class DynamicBroadcastInDimOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class DynamicConvOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class DynamicGatherOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class DynamicIotaOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class DynamicPadOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class DynamicReshapeOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class DynamicSliceOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class DynamicUpdateSliceOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class EinsumOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class ExpOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class Expm1Op; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class FftOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class FloorOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class FusionOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class GatherOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class GetDimensionSizeOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class GetTupleElementOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class IfOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class ImagOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class InfeedOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class IotaOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class IsFiniteOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class Log1pOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class LogOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class LogisticOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class MapOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class MaxOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class MinOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class MulOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class NegOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class NotOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class OptimizationBarrierOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class OrOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class OutfeedOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class PadOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class PartitionIdOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class PopulationCountOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class PowOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class RealDynamicSliceOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class RealOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class RecvOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class ReduceOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class ReducePrecisionOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class ReduceScatterOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class ReduceWindowOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class RemOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class ReplicaIdOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class ReshapeOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class ReturnOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class ReverseOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class RngBitGeneratorOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class RngOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class RoundNearestEvenOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class RoundOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class RsqrtOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class ScatterOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class SelectAndScatterOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class SelectOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class SendOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class SetDimensionSizeOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class ShiftLeftOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class ShiftRightArithmeticOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class ShiftRightLogicalOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class SignOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class SineOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class SliceOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class SortOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class SqrtOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class StochasticConvertOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class SubtractOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class TanOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class TanhOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class TopKOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class TorchIndexSelectOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class TraceOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class TransposeOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class TriangularSolveOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class TupleOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class UnaryEinsumOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class UniformDequantizeOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class UniformQuantizeOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class WhileOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class XlaRngGetAndUpdateStateOp; +} // namespace mhlo +} // namespace mlir +namespace mlir { +namespace mhlo { +class XorOp; +} // namespace mhlo +} // namespace mlir +#endif + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::AbsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AbsOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AbsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AbsOpGenericAdaptorBase(AbsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AbsOpGenericAdaptor : public detail::AbsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AbsOpGenericAdaptorBase; +public: + AbsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AbsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AbsOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AbsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AbsOpAdaptor : public AbsOpGenericAdaptor<::mlir::ValueRange> { +public: + using AbsOpGenericAdaptor::AbsOpGenericAdaptor; + AbsOpAdaptor(AbsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AbsOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape> { +public: + using Op::Op; + using Op::print; + using Adaptor = AbsOpAdaptor; + template + using GenericAdaptor = AbsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.abs"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + LogicalResult reifyReturnTypeShapes( + OpBuilder& builder, ValueRange operands, + SmallVectorImpl& reifiedReturnShapes) { + return ::mlir::hlo::deriveShapeFromOperand(&builder, getOperation(), + operands.front(), + &reifiedReturnShapes); + } + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::AbsOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::AddDependencyOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AddDependencyOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AddDependencyOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AddDependencyOpGenericAdaptorBase(AddDependencyOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AddDependencyOpGenericAdaptor : public detail::AddDependencyOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AddDependencyOpGenericAdaptorBase; +public: + AddDependencyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AddDependencyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AddDependencyOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AddDependencyOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + ValueT getToken() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AddDependencyOpAdaptor : public AddDependencyOpGenericAdaptor<::mlir::ValueRange> { +public: + using AddDependencyOpGenericAdaptor::AddDependencyOpGenericAdaptor; + AddDependencyOpAdaptor(AddDependencyOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AddDependencyOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AddDependencyOpAdaptor; + template + using GenericAdaptor = AddDependencyOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.add_dependency"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getOperand(); + ::mlir::Value getToken(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::OpOperand &getTokenMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getOutput(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value operand, ::mlir::Value token); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::Value token); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value token); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::AddDependencyOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::AddOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AddOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AddOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AddOpGenericAdaptorBase(AddOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AddOpGenericAdaptor : public detail::AddOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AddOpGenericAdaptorBase; +public: + AddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AddOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AddOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AddOpAdaptor : public AddOpGenericAdaptor<::mlir::ValueRange> { +public: + using AddOpGenericAdaptor::AddOpGenericAdaptor; + AddOpAdaptor(AddOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AddOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsCommutative, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::hlo::OpTrait::CompatibleOperandsAndResultType, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::OpTrait::Elementwise> { +public: + using Op::Op; + using Op::print; + using Adaptor = AddOpAdaptor; + template + using GenericAdaptor = AddOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.add"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLhs(); + ::mlir::TypedValue<::mlir::TensorType> getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + LogicalResult reifyReturnTypeShapes( + OpBuilder& builder, ValueRange operands, + SmallVectorImpl& reifiedReturnShapes) { + return ::mlir::hlo::deriveShapeFromOperand(&builder, getOperation(), + operands.front(), + &reifiedReturnShapes); + } + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::AddOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::AfterAllOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AfterAllOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AfterAllOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AfterAllOpGenericAdaptorBase(AfterAllOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AfterAllOpGenericAdaptor : public detail::AfterAllOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AfterAllOpGenericAdaptorBase; +public: + AfterAllOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AfterAllOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AfterAllOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AfterAllOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AfterAllOpAdaptor : public AfterAllOpGenericAdaptor<::mlir::ValueRange> { +public: + using AfterAllOpGenericAdaptor::AfterAllOpGenericAdaptor; + AfterAllOpAdaptor(AfterAllOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AfterAllOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AfterAllOpAdaptor; + template + using GenericAdaptor = AfterAllOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.after_all"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::MutableOperandRange getInputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::ValueRange inputs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::AfterAllOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::AllGatherOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AllGatherOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AllGatherOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AllGatherOpGenericAdaptorBase(AllGatherOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getAllGatherDimAttr(); + uint64_t getAllGatherDim(); + ::mlir::DenseIntElementsAttr getReplicaGroupsAttr(); + ::mlir::DenseIntElementsAttr getReplicaGroups(); + ::mlir::mhlo::ChannelHandleAttr getChannelHandleAttr(); + ::std::optional<::mlir::mhlo::ChannelHandleAttr> getChannelHandle(); + ::mlir::UnitAttr getUseGlobalDeviceIdsAttr(); + bool getUseGlobalDeviceIds(); +}; +} // namespace detail +template +class AllGatherOpGenericAdaptor : public detail::AllGatherOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AllGatherOpGenericAdaptorBase; +public: + AllGatherOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AllGatherOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AllGatherOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AllGatherOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AllGatherOpAdaptor : public AllGatherOpGenericAdaptor<::mlir::ValueRange> { +public: + using AllGatherOpGenericAdaptor::AllGatherOpGenericAdaptor; + AllGatherOpAdaptor(AllGatherOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AllGatherOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::SameOperandsAndResultElementType> { +public: + using Op::Op; + using Op::print; + using Adaptor = AllGatherOpAdaptor; + template + using GenericAdaptor = AllGatherOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("all_gather_dim"), ::llvm::StringRef("channel_handle"), ::llvm::StringRef("replica_groups"), ::llvm::StringRef("use_global_device_ids")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAllGatherDimAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAllGatherDimAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getChannelHandleAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getChannelHandleAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getReplicaGroupsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getReplicaGroupsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getUseGlobalDeviceIdsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getUseGlobalDeviceIdsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.all_gather"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getAllGatherDimAttr(); + uint64_t getAllGatherDim(); + ::mlir::DenseIntElementsAttr getReplicaGroupsAttr(); + ::mlir::DenseIntElementsAttr getReplicaGroups(); + ::mlir::mhlo::ChannelHandleAttr getChannelHandleAttr(); + ::std::optional<::mlir::mhlo::ChannelHandleAttr> getChannelHandle(); + ::mlir::UnitAttr getUseGlobalDeviceIdsAttr(); + bool getUseGlobalDeviceIds(); + void setAllGatherDimAttr(::mlir::IntegerAttr attr); + void setAllGatherDim(uint64_t attrValue); + void setReplicaGroupsAttr(::mlir::DenseIntElementsAttr attr); + void setChannelHandleAttr(::mlir::mhlo::ChannelHandleAttr attr); + void setUseGlobalDeviceIdsAttr(::mlir::UnitAttr attr); + void setUseGlobalDeviceIds(bool attrValue); + ::mlir::Attribute removeChannelHandleAttr(); + ::mlir::Attribute removeUseGlobalDeviceIdsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result_type, ::mlir::Value operand, ::mlir::IntegerAttr all_gather_dim, ::mlir::DenseIntElementsAttr replica_groups, ::mlir::mhlo::ChannelHandleAttr channel_handle); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value operand, ::mlir::IntegerAttr all_gather_dim, ::mlir::DenseIntElementsAttr replica_groups, /*optional*/::mlir::mhlo::ChannelHandleAttr channel_handle, /*optional*/::mlir::UnitAttr use_global_device_ids); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::IntegerAttr all_gather_dim, ::mlir::DenseIntElementsAttr replica_groups, /*optional*/::mlir::mhlo::ChannelHandleAttr channel_handle, /*optional*/::mlir::UnitAttr use_global_device_ids); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value operand, uint64_t all_gather_dim, ::mlir::DenseIntElementsAttr replica_groups, /*optional*/::mlir::mhlo::ChannelHandleAttr channel_handle, /*optional*/bool use_global_device_ids = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, uint64_t all_gather_dim, ::mlir::DenseIntElementsAttr replica_groups, /*optional*/::mlir::mhlo::ChannelHandleAttr channel_handle, /*optional*/bool use_global_device_ids = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::AllGatherOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::AllReduceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AllReduceOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AllReduceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AllReduceOpGenericAdaptorBase(AllReduceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getReplicaGroupsAttr(); + ::mlir::DenseIntElementsAttr getReplicaGroups(); + ::mlir::mhlo::ChannelHandleAttr getChannelHandleAttr(); + ::std::optional<::mlir::mhlo::ChannelHandleAttr> getChannelHandle(); + ::mlir::UnitAttr getUseGlobalDeviceIdsAttr(); + bool getUseGlobalDeviceIds(); + ::mlir::Region &getComputation(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class AllReduceOpGenericAdaptor : public detail::AllReduceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AllReduceOpGenericAdaptorBase; +public: + AllReduceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AllReduceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AllReduceOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AllReduceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return getODSOperands(0); + } + +private: + RangeT odsOperands; +}; +class AllReduceOpAdaptor : public AllReduceOpGenericAdaptor<::mlir::ValueRange> { +public: + using AllReduceOpGenericAdaptor::AllReduceOpGenericAdaptor; + AllReduceOpAdaptor(AllReduceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AllReduceOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::SameOperandsAndResultElementType, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType> { +public: + using Op::Op; + using Op::print; + using Adaptor = AllReduceOpAdaptor; + template + using GenericAdaptor = AllReduceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("channel_handle"), ::llvm::StringRef("replica_groups"), ::llvm::StringRef("use_global_device_ids")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getChannelHandleAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getChannelHandleAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getReplicaGroupsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getReplicaGroupsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getUseGlobalDeviceIdsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getUseGlobalDeviceIdsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.all_reduce"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getOperands(); + ::mlir::MutableOperandRange getOperandsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getComputation(); + ::mlir::DenseIntElementsAttr getReplicaGroupsAttr(); + ::mlir::DenseIntElementsAttr getReplicaGroups(); + ::mlir::mhlo::ChannelHandleAttr getChannelHandleAttr(); + ::std::optional<::mlir::mhlo::ChannelHandleAttr> getChannelHandle(); + ::mlir::UnitAttr getUseGlobalDeviceIdsAttr(); + bool getUseGlobalDeviceIds(); + void setReplicaGroupsAttr(::mlir::DenseIntElementsAttr attr); + void setChannelHandleAttr(::mlir::mhlo::ChannelHandleAttr attr); + void setUseGlobalDeviceIdsAttr(::mlir::UnitAttr attr); + void setUseGlobalDeviceIds(bool attrValue); + ::mlir::Attribute removeChannelHandleAttr(); + ::mlir::Attribute removeUseGlobalDeviceIdsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result_type, ::mlir::Value operand, ::mlir::DenseIntElementsAttr replica_groups, ::mlir::mhlo::ChannelHandleAttr channel_handle, bool use_global_device_ids = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::DenseIntElementsAttr replica_groups, ::mlir::mhlo::ChannelHandleAttr channel_handle, bool use_global_device_ids = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::mlir::ValueRange operands, ::mlir::DenseIntElementsAttr replica_groups, /*optional*/::mlir::mhlo::ChannelHandleAttr channel_handle, /*optional*/::mlir::UnitAttr use_global_device_ids); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::mlir::DenseIntElementsAttr replica_groups, /*optional*/::mlir::mhlo::ChannelHandleAttr channel_handle, /*optional*/::mlir::UnitAttr use_global_device_ids); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::mlir::ValueRange operands, ::mlir::DenseIntElementsAttr replica_groups, /*optional*/::mlir::mhlo::ChannelHandleAttr channel_handle, /*optional*/bool use_global_device_ids = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::mlir::DenseIntElementsAttr replica_groups, /*optional*/::mlir::mhlo::ChannelHandleAttr channel_handle, /*optional*/bool use_global_device_ids = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::AllReduceOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::AllToAllOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AllToAllOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AllToAllOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AllToAllOpGenericAdaptorBase(AllToAllOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getSplitDimensionAttr(); + ::std::optional getSplitDimension(); + ::mlir::IntegerAttr getConcatDimensionAttr(); + ::std::optional getConcatDimension(); + ::mlir::IntegerAttr getSplitCountAttr(); + ::std::optional getSplitCount(); + ::mlir::DenseIntElementsAttr getReplicaGroupsAttr(); + ::mlir::DenseIntElementsAttr getReplicaGroups(); + ::mlir::mhlo::ChannelHandleAttr getChannelHandleAttr(); + ::std::optional<::mlir::mhlo::ChannelHandleAttr> getChannelHandle(); +}; +} // namespace detail +template +class AllToAllOpGenericAdaptor : public detail::AllToAllOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AllToAllOpGenericAdaptorBase; +public: + AllToAllOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AllToAllOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AllToAllOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AllToAllOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperand() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AllToAllOpAdaptor : public AllToAllOpGenericAdaptor<::mlir::ValueRange> { +public: + using AllToAllOpGenericAdaptor::AllToAllOpGenericAdaptor; + AllToAllOpAdaptor(AllToAllOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AllToAllOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = AllToAllOpAdaptor; + template + using GenericAdaptor = AllToAllOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("channel_handle"), ::llvm::StringRef("concat_dimension"), ::llvm::StringRef("replica_groups"), ::llvm::StringRef("split_count"), ::llvm::StringRef("split_dimension")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getChannelHandleAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getChannelHandleAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getConcatDimensionAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getConcatDimensionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getReplicaGroupsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getReplicaGroupsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getSplitCountAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getSplitCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getSplitDimensionAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getSplitDimensionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.all_to_all"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getOperand(); + ::mlir::MutableOperandRange getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getSplitDimensionAttr(); + ::std::optional getSplitDimension(); + ::mlir::IntegerAttr getConcatDimensionAttr(); + ::std::optional getConcatDimension(); + ::mlir::IntegerAttr getSplitCountAttr(); + ::std::optional getSplitCount(); + ::mlir::DenseIntElementsAttr getReplicaGroupsAttr(); + ::mlir::DenseIntElementsAttr getReplicaGroups(); + ::mlir::mhlo::ChannelHandleAttr getChannelHandleAttr(); + ::std::optional<::mlir::mhlo::ChannelHandleAttr> getChannelHandle(); + void setSplitDimensionAttr(::mlir::IntegerAttr attr); + void setSplitDimension(::std::optional attrValue); + void setConcatDimensionAttr(::mlir::IntegerAttr attr); + void setConcatDimension(::std::optional attrValue); + void setSplitCountAttr(::mlir::IntegerAttr attr); + void setSplitCount(::std::optional attrValue); + void setReplicaGroupsAttr(::mlir::DenseIntElementsAttr attr); + void setChannelHandleAttr(::mlir::mhlo::ChannelHandleAttr attr); + ::mlir::Attribute removeSplitDimensionAttr(); + ::mlir::Attribute removeConcatDimensionAttr(); + ::mlir::Attribute removeSplitCountAttr(); + ::mlir::Attribute removeChannelHandleAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result_type, ::mlir::Value operand, ::mlir::IntegerAttr split_dimension, ::mlir::IntegerAttr concat_dimension, ::mlir::IntegerAttr split_count, ::mlir::DenseIntElementsAttr replica_groups); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange result_type, ::mlir::ValueRange operand, ::mlir::IntegerAttr split_dimension, ::mlir::IntegerAttr concat_dimension, ::mlir::IntegerAttr split_count, ::mlir::DenseIntElementsAttr replica_groups); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::mlir::ValueRange operand, /*optional*/::mlir::IntegerAttr split_dimension, /*optional*/::mlir::IntegerAttr concat_dimension, /*optional*/::mlir::IntegerAttr split_count, ::mlir::DenseIntElementsAttr replica_groups, /*optional*/::mlir::mhlo::ChannelHandleAttr channel_handle); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operand, /*optional*/::mlir::IntegerAttr split_dimension, /*optional*/::mlir::IntegerAttr concat_dimension, /*optional*/::mlir::IntegerAttr split_count, ::mlir::DenseIntElementsAttr replica_groups, /*optional*/::mlir::mhlo::ChannelHandleAttr channel_handle); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::AllToAllOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::AndOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AndOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AndOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AndOpGenericAdaptorBase(AndOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AndOpGenericAdaptor : public detail::AndOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AndOpGenericAdaptorBase; +public: + AndOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AndOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AndOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AndOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AndOpAdaptor : public AndOpGenericAdaptor<::mlir::ValueRange> { +public: + using AndOpGenericAdaptor::AndOpGenericAdaptor; + AndOpAdaptor(AndOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AndOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsCommutative, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::hlo::OpTrait::CompatibleOperandsAndResultType, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::OpTrait::Elementwise> { +public: + using Op::Op; + using Op::print; + using Adaptor = AndOpAdaptor; + template + using GenericAdaptor = AndOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.and"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLhs(); + ::mlir::TypedValue<::mlir::TensorType> getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + LogicalResult reifyReturnTypeShapes( + OpBuilder& builder, ValueRange operands, + SmallVectorImpl& reifiedReturnShapes) { + return ::mlir::hlo::deriveShapeFromOperand(&builder, getOperation(), + operands.front(), + &reifiedReturnShapes); + } + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::AndOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::AsyncDoneOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AsyncDoneOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AsyncDoneOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AsyncDoneOpGenericAdaptorBase(AsyncDoneOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::FlatSymbolRefAttr getCalledComputationAttr(); + ::llvm::StringRef getCalledComputation(); + ::mlir::StringAttr getExecutionThreadAttr(); + ::llvm::StringRef getExecutionThread(); + ::mlir::IntegerAttr getGroupIdAttr(); + ::std::optional getGroupId(); +}; +} // namespace detail +template +class AsyncDoneOpGenericAdaptor : public detail::AsyncDoneOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AsyncDoneOpGenericAdaptorBase; +public: + AsyncDoneOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AsyncDoneOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AsyncDoneOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AsyncDoneOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getBundle() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AsyncDoneOpAdaptor : public AsyncDoneOpGenericAdaptor<::mlir::ValueRange> { +public: + using AsyncDoneOpGenericAdaptor::AsyncDoneOpGenericAdaptor; + AsyncDoneOpAdaptor(AsyncDoneOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AsyncDoneOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = AsyncDoneOpAdaptor; + template + using GenericAdaptor = AsyncDoneOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("called_computation"), ::llvm::StringRef("execution_thread"), ::llvm::StringRef("group_id")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getCalledComputationAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getCalledComputationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getExecutionThreadAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getExecutionThreadAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getGroupIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getGroupIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.async_done"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getBundle(); + ::mlir::OpOperand &getBundleMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::FlatSymbolRefAttr getCalledComputationAttr(); + ::llvm::StringRef getCalledComputation(); + ::mlir::StringAttr getExecutionThreadAttr(); + ::llvm::StringRef getExecutionThread(); + ::mlir::IntegerAttr getGroupIdAttr(); + ::std::optional getGroupId(); + void setCalledComputationAttr(::mlir::FlatSymbolRefAttr attr); + void setCalledComputation(::llvm::StringRef attrValue); + void setExecutionThreadAttr(::mlir::StringAttr attr); + void setExecutionThread(::llvm::StringRef attrValue); + void setGroupIdAttr(::mlir::IntegerAttr attr); + void setGroupId(::std::optional attrValue); + ::mlir::Attribute removeGroupIdAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::mlir::Value bundle, ::mlir::FlatSymbolRefAttr called_computation, ::mlir::StringAttr execution_thread, /*optional*/::mlir::IntegerAttr group_id); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value bundle, ::mlir::FlatSymbolRefAttr called_computation, ::mlir::StringAttr execution_thread, /*optional*/::mlir::IntegerAttr group_id); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::mlir::Value bundle, ::llvm::StringRef called_computation, ::llvm::StringRef execution_thread, /*optional*/::mlir::IntegerAttr group_id); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value bundle, ::llvm::StringRef called_computation, ::llvm::StringRef execution_thread, /*optional*/::mlir::IntegerAttr group_id); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::AsyncDoneOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::AsyncStartOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AsyncStartOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AsyncStartOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AsyncStartOpGenericAdaptorBase(AsyncStartOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::FlatSymbolRefAttr getCalledComputationAttr(); + ::llvm::StringRef getCalledComputation(); + ::mlir::StringAttr getExecutionThreadAttr(); + ::llvm::StringRef getExecutionThread(); + ::mlir::IntegerAttr getGroupIdAttr(); + ::std::optional getGroupId(); +}; +} // namespace detail +template +class AsyncStartOpGenericAdaptor : public detail::AsyncStartOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AsyncStartOpGenericAdaptorBase; +public: + AsyncStartOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AsyncStartOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AsyncStartOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AsyncStartOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AsyncStartOpAdaptor : public AsyncStartOpGenericAdaptor<::mlir::ValueRange> { +public: + using AsyncStartOpGenericAdaptor::AsyncStartOpGenericAdaptor; + AsyncStartOpAdaptor(AsyncStartOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AsyncStartOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants> { +public: + using Op::Op; + using Op::print; + using Adaptor = AsyncStartOpAdaptor; + template + using GenericAdaptor = AsyncStartOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("called_computation"), ::llvm::StringRef("execution_thread"), ::llvm::StringRef("group_id")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getCalledComputationAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getCalledComputationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getExecutionThreadAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getExecutionThreadAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getGroupIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getGroupIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.async_start"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::MutableOperandRange getInputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::FlatSymbolRefAttr getCalledComputationAttr(); + ::llvm::StringRef getCalledComputation(); + ::mlir::StringAttr getExecutionThreadAttr(); + ::llvm::StringRef getExecutionThread(); + ::mlir::IntegerAttr getGroupIdAttr(); + ::std::optional getGroupId(); + void setCalledComputationAttr(::mlir::FlatSymbolRefAttr attr); + void setCalledComputation(::llvm::StringRef attrValue); + void setExecutionThreadAttr(::mlir::StringAttr attr); + void setExecutionThread(::llvm::StringRef attrValue); + void setGroupIdAttr(::mlir::IntegerAttr attr); + void setGroupId(::std::optional attrValue); + ::mlir::Attribute removeGroupIdAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::ValueRange inputs, ::mlir::FlatSymbolRefAttr called_computation, ::mlir::StringAttr execution_thread, /*optional*/::mlir::IntegerAttr group_id); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::mlir::FlatSymbolRefAttr called_computation, ::mlir::StringAttr execution_thread, /*optional*/::mlir::IntegerAttr group_id); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::ValueRange inputs, ::llvm::StringRef called_computation, ::llvm::StringRef execution_thread, /*optional*/::mlir::IntegerAttr group_id); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::llvm::StringRef called_computation, ::llvm::StringRef execution_thread, /*optional*/::mlir::IntegerAttr group_id); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::AsyncStartOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::AsyncUpdateOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AsyncUpdateOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AsyncUpdateOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AsyncUpdateOpGenericAdaptorBase(AsyncUpdateOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::FlatSymbolRefAttr getCalledComputationAttr(); + ::llvm::StringRef getCalledComputation(); + ::mlir::StringAttr getExecutionThreadAttr(); + ::llvm::StringRef getExecutionThread(); + ::mlir::IntegerAttr getGroupIdAttr(); + ::std::optional getGroupId(); +}; +} // namespace detail +template +class AsyncUpdateOpGenericAdaptor : public detail::AsyncUpdateOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AsyncUpdateOpGenericAdaptorBase; +public: + AsyncUpdateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AsyncUpdateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AsyncUpdateOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AsyncUpdateOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getBundle() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AsyncUpdateOpAdaptor : public AsyncUpdateOpGenericAdaptor<::mlir::ValueRange> { +public: + using AsyncUpdateOpGenericAdaptor::AsyncUpdateOpGenericAdaptor; + AsyncUpdateOpAdaptor(AsyncUpdateOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AsyncUpdateOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AsyncUpdateOpAdaptor; + template + using GenericAdaptor = AsyncUpdateOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("called_computation"), ::llvm::StringRef("execution_thread"), ::llvm::StringRef("group_id")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getCalledComputationAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getCalledComputationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getExecutionThreadAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getExecutionThreadAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getGroupIdAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getGroupIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.async_update"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getBundle(); + ::mlir::OpOperand &getBundleMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::FlatSymbolRefAttr getCalledComputationAttr(); + ::llvm::StringRef getCalledComputation(); + ::mlir::StringAttr getExecutionThreadAttr(); + ::llvm::StringRef getExecutionThread(); + ::mlir::IntegerAttr getGroupIdAttr(); + ::std::optional getGroupId(); + void setCalledComputationAttr(::mlir::FlatSymbolRefAttr attr); + void setCalledComputation(::llvm::StringRef attrValue); + void setExecutionThreadAttr(::mlir::StringAttr attr); + void setExecutionThread(::llvm::StringRef attrValue); + void setGroupIdAttr(::mlir::IntegerAttr attr); + void setGroupId(::std::optional attrValue); + ::mlir::Attribute removeGroupIdAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value bundle, ::mlir::FlatSymbolRefAttr called_computation, ::mlir::StringAttr execution_thread, /*optional*/::mlir::IntegerAttr group_id); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value bundle, ::mlir::FlatSymbolRefAttr called_computation, ::mlir::StringAttr execution_thread, /*optional*/::mlir::IntegerAttr group_id); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value bundle, ::mlir::FlatSymbolRefAttr called_computation, ::mlir::StringAttr execution_thread, /*optional*/::mlir::IntegerAttr group_id); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value bundle, ::llvm::StringRef called_computation, ::llvm::StringRef execution_thread, /*optional*/::mlir::IntegerAttr group_id); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value bundle, ::llvm::StringRef called_computation, ::llvm::StringRef execution_thread, /*optional*/::mlir::IntegerAttr group_id); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value bundle, ::llvm::StringRef called_computation, ::llvm::StringRef execution_thread, /*optional*/::mlir::IntegerAttr group_id); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::AsyncUpdateOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::Atan2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Atan2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + Atan2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + Atan2OpGenericAdaptorBase(Atan2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class Atan2OpGenericAdaptor : public detail::Atan2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Atan2OpGenericAdaptorBase; +public: + Atan2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Atan2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Atan2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + Atan2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Atan2OpAdaptor : public Atan2OpGenericAdaptor<::mlir::ValueRange> { +public: + using Atan2OpGenericAdaptor::Atan2OpGenericAdaptor; + Atan2OpAdaptor(Atan2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Atan2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::hlo::OpTrait::CompatibleOperandsAndResultType, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::OpTrait::Elementwise> { +public: + using Op::Op; + using Op::print; + using Adaptor = Atan2OpAdaptor; + template + using GenericAdaptor = Atan2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.atan2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLhs(); + ::mlir::TypedValue<::mlir::TensorType> getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + LogicalResult reifyReturnTypeShapes( + OpBuilder& builder, ValueRange operands, + SmallVectorImpl& reifiedReturnShapes) { + return ::mlir::hlo::deriveShapeFromOperand(&builder, getOperation(), + operands.front(), + &reifiedReturnShapes); + } + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::Atan2Op) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::BatchNormGradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BatchNormGradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BatchNormGradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BatchNormGradOpGenericAdaptorBase(BatchNormGradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::IntegerAttr getFeatureIndexAttr(); + uint64_t getFeatureIndex(); +}; +} // namespace detail +template +class BatchNormGradOpGenericAdaptor : public detail::BatchNormGradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BatchNormGradOpGenericAdaptorBase; +public: + BatchNormGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BatchNormGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BatchNormGradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BatchNormGradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + ValueT getScale() { + return (*getODSOperands(1).begin()); + } + + ValueT getMean() { + return (*getODSOperands(2).begin()); + } + + ValueT getVariance() { + return (*getODSOperands(3).begin()); + } + + ValueT getGradOutput() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BatchNormGradOpAdaptor : public BatchNormGradOpGenericAdaptor<::mlir::ValueRange> { +public: + using BatchNormGradOpGenericAdaptor::BatchNormGradOpGenericAdaptor; + BatchNormGradOpAdaptor(BatchNormGradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BatchNormGradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<5>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BatchNormGradOpAdaptor; + template + using GenericAdaptor = BatchNormGradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("epsilon"), ::llvm::StringRef("feature_index")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getEpsilonAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getEpsilonAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getFeatureIndexAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getFeatureIndexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.batch_norm_grad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::RankedTensorType> getOperand(); + ::mlir::TypedValue<::mlir::RankedTensorType> getScale(); + ::mlir::TypedValue<::mlir::RankedTensorType> getMean(); + ::mlir::TypedValue<::mlir::RankedTensorType> getVariance(); + ::mlir::TypedValue<::mlir::RankedTensorType> getGradOutput(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::OpOperand &getScaleMutable(); + ::mlir::OpOperand &getMeanMutable(); + ::mlir::OpOperand &getVarianceMutable(); + ::mlir::OpOperand &getGradOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::RankedTensorType> getGradOperand(); + ::mlir::TypedValue<::mlir::RankedTensorType> getGradScale(); + ::mlir::TypedValue<::mlir::RankedTensorType> getGradOffset(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::IntegerAttr getFeatureIndexAttr(); + uint64_t getFeatureIndex(); + void setEpsilonAttr(::mlir::FloatAttr attr); + void setEpsilon(::llvm::APFloat attrValue); + void setFeatureIndexAttr(::mlir::IntegerAttr attr); + void setFeatureIndex(uint64_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type grad_operand, ::mlir::Type grad_scale, ::mlir::Type grad_offset, ::mlir::Value operand, ::mlir::Value scale, ::mlir::Value mean, ::mlir::Value variance, ::mlir::Value grad_output, ::mlir::FloatAttr epsilon, ::mlir::IntegerAttr feature_index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::Value scale, ::mlir::Value mean, ::mlir::Value variance, ::mlir::Value grad_output, ::mlir::FloatAttr epsilon, ::mlir::IntegerAttr feature_index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value scale, ::mlir::Value mean, ::mlir::Value variance, ::mlir::Value grad_output, ::mlir::FloatAttr epsilon, ::mlir::IntegerAttr feature_index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type grad_operand, ::mlir::Type grad_scale, ::mlir::Type grad_offset, ::mlir::Value operand, ::mlir::Value scale, ::mlir::Value mean, ::mlir::Value variance, ::mlir::Value grad_output, ::llvm::APFloat epsilon, uint64_t feature_index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::Value scale, ::mlir::Value mean, ::mlir::Value variance, ::mlir::Value grad_output, ::llvm::APFloat epsilon, uint64_t feature_index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value scale, ::mlir::Value mean, ::mlir::Value variance, ::mlir::Value grad_output, ::llvm::APFloat epsilon, uint64_t feature_index); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::BatchNormGradOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::BatchNormInferenceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BatchNormInferenceOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BatchNormInferenceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BatchNormInferenceOpGenericAdaptorBase(BatchNormInferenceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::IntegerAttr getFeatureIndexAttr(); + uint64_t getFeatureIndex(); +}; +} // namespace detail +template +class BatchNormInferenceOpGenericAdaptor : public detail::BatchNormInferenceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BatchNormInferenceOpGenericAdaptorBase; +public: + BatchNormInferenceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BatchNormInferenceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BatchNormInferenceOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BatchNormInferenceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + ValueT getScale() { + return (*getODSOperands(1).begin()); + } + + ValueT getOffset() { + return (*getODSOperands(2).begin()); + } + + ValueT getMean() { + return (*getODSOperands(3).begin()); + } + + ValueT getVariance() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BatchNormInferenceOpAdaptor : public BatchNormInferenceOpGenericAdaptor<::mlir::ValueRange> { +public: + using BatchNormInferenceOpGenericAdaptor::BatchNormInferenceOpGenericAdaptor; + BatchNormInferenceOpAdaptor(BatchNormInferenceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BatchNormInferenceOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<5>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType> { +public: + using Op::Op; + using Op::print; + using Adaptor = BatchNormInferenceOpAdaptor; + template + using GenericAdaptor = BatchNormInferenceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("epsilon"), ::llvm::StringRef("feature_index")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getEpsilonAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getEpsilonAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getFeatureIndexAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getFeatureIndexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.batch_norm_inference"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::RankedTensorType> getOperand(); + ::mlir::TypedValue<::mlir::RankedTensorType> getScale(); + ::mlir::TypedValue<::mlir::RankedTensorType> getOffset(); + ::mlir::TypedValue<::mlir::RankedTensorType> getMean(); + ::mlir::TypedValue<::mlir::RankedTensorType> getVariance(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::OpOperand &getScaleMutable(); + ::mlir::OpOperand &getOffsetMutable(); + ::mlir::OpOperand &getMeanMutable(); + ::mlir::OpOperand &getVarianceMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::RankedTensorType> getResult(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::IntegerAttr getFeatureIndexAttr(); + uint64_t getFeatureIndex(); + void setEpsilonAttr(::mlir::FloatAttr attr); + void setEpsilon(::llvm::APFloat attrValue); + void setFeatureIndexAttr(::mlir::IntegerAttr attr); + void setFeatureIndex(uint64_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value mean, ::mlir::Value variance, ::mlir::FloatAttr epsilon, ::mlir::IntegerAttr feature_index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value mean, ::mlir::Value variance, ::mlir::FloatAttr epsilon, ::mlir::IntegerAttr feature_index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value mean, ::mlir::Value variance, ::mlir::FloatAttr epsilon, ::mlir::IntegerAttr feature_index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value mean, ::mlir::Value variance, ::llvm::APFloat epsilon, uint64_t feature_index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value mean, ::mlir::Value variance, ::llvm::APFloat epsilon, uint64_t feature_index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value mean, ::mlir::Value variance, ::llvm::APFloat epsilon, uint64_t feature_index); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::BatchNormInferenceOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::BatchNormTrainingOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BatchNormTrainingOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BatchNormTrainingOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BatchNormTrainingOpGenericAdaptorBase(BatchNormTrainingOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::IntegerAttr getFeatureIndexAttr(); + uint64_t getFeatureIndex(); +}; +} // namespace detail +template +class BatchNormTrainingOpGenericAdaptor : public detail::BatchNormTrainingOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BatchNormTrainingOpGenericAdaptorBase; +public: + BatchNormTrainingOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BatchNormTrainingOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BatchNormTrainingOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BatchNormTrainingOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + ValueT getScale() { + return (*getODSOperands(1).begin()); + } + + ValueT getOffset() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BatchNormTrainingOpAdaptor : public BatchNormTrainingOpGenericAdaptor<::mlir::ValueRange> { +public: + using BatchNormTrainingOpGenericAdaptor::BatchNormTrainingOpGenericAdaptor; + BatchNormTrainingOpAdaptor(BatchNormTrainingOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BatchNormTrainingOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BatchNormTrainingOpAdaptor; + template + using GenericAdaptor = BatchNormTrainingOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("epsilon"), ::llvm::StringRef("feature_index")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getEpsilonAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getEpsilonAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getFeatureIndexAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getFeatureIndexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.batch_norm_training"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::RankedTensorType> getOperand(); + ::mlir::TypedValue<::mlir::RankedTensorType> getScale(); + ::mlir::TypedValue<::mlir::RankedTensorType> getOffset(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::OpOperand &getScaleMutable(); + ::mlir::OpOperand &getOffsetMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::RankedTensorType> getOutput(); + ::mlir::TypedValue<::mlir::RankedTensorType> getBatchMean(); + ::mlir::TypedValue<::mlir::RankedTensorType> getBatchVar(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::IntegerAttr getFeatureIndexAttr(); + uint64_t getFeatureIndex(); + void setEpsilonAttr(::mlir::FloatAttr attr); + void setEpsilon(::llvm::APFloat attrValue); + void setFeatureIndexAttr(::mlir::IntegerAttr attr); + void setFeatureIndex(uint64_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Type batch_mean, ::mlir::Type batch_var, ::mlir::Value operand, ::mlir::Value scale, ::mlir::Value offset, ::mlir::FloatAttr epsilon, ::mlir::IntegerAttr feature_index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::Value scale, ::mlir::Value offset, ::mlir::FloatAttr epsilon, ::mlir::IntegerAttr feature_index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value scale, ::mlir::Value offset, ::mlir::FloatAttr epsilon, ::mlir::IntegerAttr feature_index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Type batch_mean, ::mlir::Type batch_var, ::mlir::Value operand, ::mlir::Value scale, ::mlir::Value offset, ::llvm::APFloat epsilon, uint64_t feature_index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::Value scale, ::mlir::Value offset, ::llvm::APFloat epsilon, uint64_t feature_index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value scale, ::mlir::Value offset, ::llvm::APFloat epsilon, uint64_t feature_index); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::BatchNormTrainingOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::BitcastConvertOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BitcastConvertOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BitcastConvertOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BitcastConvertOpGenericAdaptorBase(BitcastConvertOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class BitcastConvertOpGenericAdaptor : public detail::BitcastConvertOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BitcastConvertOpGenericAdaptorBase; +public: + BitcastConvertOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BitcastConvertOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BitcastConvertOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BitcastConvertOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BitcastConvertOpAdaptor : public BitcastConvertOpGenericAdaptor<::mlir::ValueRange> { +public: + using BitcastConvertOpGenericAdaptor::BitcastConvertOpGenericAdaptor; + BitcastConvertOpAdaptor(BitcastConvertOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BitcastConvertOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BitcastConvertOpAdaptor; + template + using GenericAdaptor = BitcastConvertOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.bitcast_convert"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::LogicalResult reifyReturnTypeShapes(::mlir::OpBuilder&builder, ::mlir::ValueRange operands, ::llvm::SmallVectorImpl<::mlir::Value> &reifiedReturnShapes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::BitcastConvertOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::BitcastOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BitcastOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BitcastOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BitcastOpGenericAdaptorBase(BitcastOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class BitcastOpGenericAdaptor : public detail::BitcastOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BitcastOpGenericAdaptorBase; +public: + BitcastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BitcastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BitcastOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BitcastOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BitcastOpAdaptor : public BitcastOpGenericAdaptor<::mlir::ValueRange> { +public: + using BitcastOpGenericAdaptor::BitcastOpGenericAdaptor; + BitcastOpAdaptor(BitcastOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BitcastOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BitcastOpAdaptor; + template + using GenericAdaptor = BitcastOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.bitcast"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::BitcastOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::BroadcastInDimOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BroadcastInDimOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BroadcastInDimOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BroadcastInDimOpGenericAdaptorBase(BroadcastInDimOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getBroadcastDimensionsAttr(); + ::mlir::DenseIntElementsAttr getBroadcastDimensions(); +}; +} // namespace detail +template +class BroadcastInDimOpGenericAdaptor : public detail::BroadcastInDimOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BroadcastInDimOpGenericAdaptorBase; +public: + BroadcastInDimOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BroadcastInDimOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BroadcastInDimOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BroadcastInDimOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BroadcastInDimOpAdaptor : public BroadcastInDimOpGenericAdaptor<::mlir::ValueRange> { +public: + using BroadcastInDimOpGenericAdaptor::BroadcastInDimOpGenericAdaptor; + BroadcastInDimOpAdaptor(BroadcastInDimOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BroadcastInDimOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::hlo::OpTrait::CompatibleOperandsAndResultElementType> { +public: + using Op::Op; + using Op::print; + using Adaptor = BroadcastInDimOpAdaptor; + template + using GenericAdaptor = BroadcastInDimOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("broadcast_dimensions")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBroadcastDimensionsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBroadcastDimensionsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.broadcast_in_dim"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::DenseIntElementsAttr getBroadcastDimensionsAttr(); + ::mlir::DenseIntElementsAttr getBroadcastDimensions(); + void setBroadcastDimensionsAttr(::mlir::DenseIntElementsAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value operand, ::mlir::DenseIntElementsAttr broadcast_dimensions); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::DenseIntElementsAttr broadcast_dimensions); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::BroadcastInDimOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::BroadcastOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BroadcastOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BroadcastOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BroadcastOpGenericAdaptorBase(BroadcastOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getBroadcastSizesAttr(); + ::mlir::DenseIntElementsAttr getBroadcastSizes(); +}; +} // namespace detail +template +class BroadcastOpGenericAdaptor : public detail::BroadcastOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BroadcastOpGenericAdaptorBase; +public: + BroadcastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BroadcastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BroadcastOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BroadcastOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BroadcastOpAdaptor : public BroadcastOpGenericAdaptor<::mlir::ValueRange> { +public: + using BroadcastOpGenericAdaptor::BroadcastOpGenericAdaptor; + BroadcastOpAdaptor(BroadcastOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BroadcastOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultElementType, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType> { +public: + using Op::Op; + using Op::print; + using Adaptor = BroadcastOpAdaptor; + template + using GenericAdaptor = BroadcastOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("broadcast_sizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBroadcastSizesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBroadcastSizesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.broadcast"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::DenseIntElementsAttr getBroadcastSizesAttr(); + ::mlir::DenseIntElementsAttr getBroadcastSizes(); + void setBroadcastSizesAttr(::mlir::DenseIntElementsAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value operand, ::mlir::DenseIntElementsAttr broadcast_sizes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::DenseIntElementsAttr broadcast_sizes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::DenseIntElementsAttr broadcast_sizes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + ::mlir::LogicalResult reifyReturnTypeShapes(::mlir::OpBuilder&builder, ::mlir::ValueRange operands, ::llvm::SmallVectorImpl<::mlir::Value> &reifiedReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::BroadcastOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::CaseOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CaseOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CaseOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CaseOpGenericAdaptorBase(CaseOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::RegionRange getBranches(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class CaseOpGenericAdaptor : public detail::CaseOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CaseOpGenericAdaptorBase; +public: + CaseOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CaseOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CaseOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CaseOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIndex() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CaseOpAdaptor : public CaseOpGenericAdaptor<::mlir::ValueRange> { +public: + using CaseOpGenericAdaptor::CaseOpGenericAdaptor; + CaseOpAdaptor(CaseOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CaseOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CaseOpAdaptor; + template + using GenericAdaptor = CaseOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.case"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getIndex(); + ::mlir::OpOperand &getIndexMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::MutableArrayRef<::mlir::Region> getBranches(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::mlir::Value index, unsigned branchesCount); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value index, unsigned branchesCount); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes, unsigned numRegions); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes, unsigned numRegions); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::CaseOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::CbrtOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CbrtOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CbrtOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CbrtOpGenericAdaptorBase(CbrtOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CbrtOpGenericAdaptor : public detail::CbrtOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CbrtOpGenericAdaptorBase; +public: + CbrtOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CbrtOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CbrtOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CbrtOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CbrtOpAdaptor : public CbrtOpGenericAdaptor<::mlir::ValueRange> { +public: + using CbrtOpGenericAdaptor::CbrtOpGenericAdaptor; + CbrtOpAdaptor(CbrtOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CbrtOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::hlo::OpTrait::CompatibleOperandsAndResultType, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::SameOperandsAndResultShape> { +public: + using Op::Op; + using Op::print; + using Adaptor = CbrtOpAdaptor; + template + using GenericAdaptor = CbrtOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.cbrt"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + LogicalResult reifyReturnTypeShapes( + OpBuilder& builder, ValueRange operands, + SmallVectorImpl& reifiedReturnShapes) { + return ::mlir::hlo::deriveShapeFromOperand(&builder, getOperation(), + operands.front(), + &reifiedReturnShapes); + } + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::CbrtOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::CeilOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CeilOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CeilOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CeilOpGenericAdaptorBase(CeilOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CeilOpGenericAdaptor : public detail::CeilOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CeilOpGenericAdaptorBase; +public: + CeilOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CeilOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CeilOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CeilOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CeilOpAdaptor : public CeilOpGenericAdaptor<::mlir::ValueRange> { +public: + using CeilOpGenericAdaptor::CeilOpGenericAdaptor; + CeilOpAdaptor(CeilOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CeilOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::hlo::OpTrait::CompatibleOperandsAndResultType, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::SameOperandsAndResultShape> { +public: + using Op::Op; + using Op::print; + using Adaptor = CeilOpAdaptor; + template + using GenericAdaptor = CeilOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.ceil"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + LogicalResult reifyReturnTypeShapes( + OpBuilder& builder, ValueRange operands, + SmallVectorImpl& reifiedReturnShapes) { + return ::mlir::hlo::deriveShapeFromOperand(&builder, getOperation(), + operands.front(), + &reifiedReturnShapes); + } + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::CeilOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::CholeskyOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CholeskyOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CholeskyOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CholeskyOpGenericAdaptorBase(CholeskyOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getLowerAttr(); + bool getLower(); +}; +} // namespace detail +template +class CholeskyOpGenericAdaptor : public detail::CholeskyOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CholeskyOpGenericAdaptorBase; +public: + CholeskyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CholeskyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CholeskyOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CholeskyOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CholeskyOpAdaptor : public CholeskyOpGenericAdaptor<::mlir::ValueRange> { +public: + using CholeskyOpGenericAdaptor::CholeskyOpGenericAdaptor; + CholeskyOpAdaptor(CholeskyOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CholeskyOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultElementType, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType> { +public: + using Op::Op; + using Op::print; + using Adaptor = CholeskyOpAdaptor; + template + using GenericAdaptor = CholeskyOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("lower")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getLowerAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getLowerAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.cholesky"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getA(); + ::mlir::OpOperand &getAMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::BoolAttr getLowerAttr(); + bool getLower(); + void setLowerAttr(::mlir::BoolAttr attr); + void setLower(::std::optional attrValue); + ::mlir::Attribute removeLowerAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value a, /*optional*/::mlir::BoolAttr lower); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, /*optional*/::mlir::BoolAttr lower); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, /*optional*/::mlir::BoolAttr lower); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value a, /*optional*/bool lower = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, /*optional*/bool lower = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, /*optional*/bool lower = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::CholeskyOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::ClampOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ClampOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ClampOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ClampOpGenericAdaptorBase(ClampOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ClampOpGenericAdaptor : public detail::ClampOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ClampOpGenericAdaptorBase; +public: + ClampOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ClampOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ClampOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ClampOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getMin() { + return (*getODSOperands(0).begin()); + } + + ValueT getOperand() { + return (*getODSOperands(1).begin()); + } + + ValueT getMax() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ClampOpAdaptor : public ClampOpGenericAdaptor<::mlir::ValueRange> { +public: + using ClampOpGenericAdaptor::ClampOpGenericAdaptor; + ClampOpAdaptor(ClampOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ClampOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultElementType, ::mlir::hlo::OpTrait::BroadcastingElementwise, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType> { +public: + using Op::Op; + using Op::print; + using Adaptor = ClampOpAdaptor; + template + using GenericAdaptor = ClampOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.clamp"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getMin(); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::TypedValue<::mlir::TensorType> getMax(); + ::mlir::OpOperand &getMinMutable(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::OpOperand &getMaxMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value min, ::mlir::Value operand, ::mlir::Value max); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value min, ::mlir::Value operand, ::mlir::Value max); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value min, ::mlir::Value operand, ::mlir::Value max); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + ::mlir::LogicalResult reifyReturnTypeShapes(::mlir::OpBuilder&builder, ::mlir::ValueRange operands, ::llvm::SmallVectorImpl<::mlir::Value> &reifiedReturnShapes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::ClampOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::ClzOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ClzOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ClzOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ClzOpGenericAdaptorBase(ClzOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ClzOpGenericAdaptor : public detail::ClzOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ClzOpGenericAdaptorBase; +public: + ClzOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ClzOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ClzOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ClzOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ClzOpAdaptor : public ClzOpGenericAdaptor<::mlir::ValueRange> { +public: + using ClzOpGenericAdaptor::ClzOpGenericAdaptor; + ClzOpAdaptor(ClzOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ClzOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::hlo::OpTrait::CompatibleOperandsAndResultType, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::SameOperandsAndResultShape> { +public: + using Op::Op; + using Op::print; + using Adaptor = ClzOpAdaptor; + template + using GenericAdaptor = ClzOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.count_leading_zeros"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + LogicalResult reifyReturnTypeShapes( + OpBuilder& builder, ValueRange operands, + SmallVectorImpl& reifiedReturnShapes) { + return ::mlir::hlo::deriveShapeFromOperand(&builder, getOperation(), + operands.front(), + &reifiedReturnShapes); + } + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::ClzOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::CollectivePermuteOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CollectivePermuteOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CollectivePermuteOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CollectivePermuteOpGenericAdaptorBase(CollectivePermuteOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getSourceTargetPairsAttr(); + ::mlir::DenseIntElementsAttr getSourceTargetPairs(); + ::mlir::mhlo::ChannelHandleAttr getChannelHandleAttr(); + ::std::optional<::mlir::mhlo::ChannelHandleAttr> getChannelHandle(); +}; +} // namespace detail +template +class CollectivePermuteOpGenericAdaptor : public detail::CollectivePermuteOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CollectivePermuteOpGenericAdaptorBase; +public: + CollectivePermuteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CollectivePermuteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CollectivePermuteOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CollectivePermuteOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CollectivePermuteOpAdaptor : public CollectivePermuteOpGenericAdaptor<::mlir::ValueRange> { +public: + using CollectivePermuteOpGenericAdaptor::CollectivePermuteOpGenericAdaptor; + CollectivePermuteOpAdaptor(CollectivePermuteOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CollectivePermuteOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::hlo::OpTrait::CompatibleOperandsAndResultType> { +public: + using Op::Op; + using Op::print; + using Adaptor = CollectivePermuteOpAdaptor; + template + using GenericAdaptor = CollectivePermuteOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("channel_handle"), ::llvm::StringRef("source_target_pairs")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getChannelHandleAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getChannelHandleAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getSourceTargetPairsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getSourceTargetPairsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.collective_permute"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::DenseIntElementsAttr getSourceTargetPairsAttr(); + ::mlir::DenseIntElementsAttr getSourceTargetPairs(); + ::mlir::mhlo::ChannelHandleAttr getChannelHandleAttr(); + ::std::optional<::mlir::mhlo::ChannelHandleAttr> getChannelHandle(); + void setSourceTargetPairsAttr(::mlir::DenseIntElementsAttr attr); + void setChannelHandleAttr(::mlir::mhlo::ChannelHandleAttr attr); + ::mlir::Attribute removeChannelHandleAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result_type, ::mlir::Value operand, ::mlir::DenseIntElementsAttr source_target_pairs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value operand, ::mlir::DenseIntElementsAttr source_target_pairs, /*optional*/::mlir::mhlo::ChannelHandleAttr channel_handle); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::DenseIntElementsAttr source_target_pairs, /*optional*/::mlir::mhlo::ChannelHandleAttr channel_handle); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::DenseIntElementsAttr source_target_pairs, /*optional*/::mlir::mhlo::ChannelHandleAttr channel_handle); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::CollectivePermuteOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::CompareOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CompareOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CompareOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CompareOpGenericAdaptorBase(CompareOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::mhlo::ComparisonDirectionAttr getComparisonDirectionAttr(); + ::mlir::mhlo::ComparisonDirection getComparisonDirection(); + ::mlir::mhlo::ComparisonTypeAttr getCompareTypeAttr(); + ::std::optional<::mlir::mhlo::ComparisonType> getCompareType(); +}; +} // namespace detail +template +class CompareOpGenericAdaptor : public detail::CompareOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CompareOpGenericAdaptorBase; +public: + CompareOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CompareOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CompareOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CompareOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CompareOpAdaptor : public CompareOpGenericAdaptor<::mlir::ValueRange> { +public: + using CompareOpGenericAdaptor::CompareOpGenericAdaptor; + CompareOpAdaptor(CompareOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CompareOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsElementType, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::OpTrait::Elementwise, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType> { +public: + using Op::Op; + using Op::print; + using Adaptor = CompareOpAdaptor; + template + using GenericAdaptor = CompareOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("compare_type"), ::llvm::StringRef("comparison_direction")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getCompareTypeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getCompareTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getComparisonDirectionAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getComparisonDirectionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.compare"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLhs(); + ::mlir::TypedValue<::mlir::TensorType> getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::mhlo::ComparisonDirectionAttr getComparisonDirectionAttr(); + ::mlir::mhlo::ComparisonDirection getComparisonDirection(); + ::mlir::mhlo::ComparisonTypeAttr getCompareTypeAttr(); + ::std::optional<::mlir::mhlo::ComparisonType> getCompareType(); + void setComparisonDirectionAttr(::mlir::mhlo::ComparisonDirectionAttr attr); + void setComparisonDirection(::mlir::mhlo::ComparisonDirection attrValue); + void setCompareTypeAttr(::mlir::mhlo::ComparisonTypeAttr attr); + void setCompareType(::std::optional<::mlir::mhlo::ComparisonType> attrValue); + ::mlir::Attribute removeCompareTypeAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value lhs, Value rhs, ::mlir::mhlo::ComparisonDirection comparison_direction, ::mlir::mhlo::ComparisonType compare_type = ::mlir::mhlo::ComparisonType::NOTYPE); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::mhlo::ComparisonDirectionAttr comparison_direction, /*optional*/::mlir::mhlo::ComparisonTypeAttr compare_type); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::mhlo::ComparisonDirectionAttr comparison_direction, /*optional*/::mlir::mhlo::ComparisonTypeAttr compare_type); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::mhlo::ComparisonDirectionAttr comparison_direction, /*optional*/::mlir::mhlo::ComparisonTypeAttr compare_type); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::mhlo::ComparisonDirection comparison_direction, /*optional*/::mlir::mhlo::ComparisonTypeAttr compare_type); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::mhlo::ComparisonDirection comparison_direction, /*optional*/::mlir::mhlo::ComparisonTypeAttr compare_type); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::mhlo::ComparisonDirection comparison_direction, /*optional*/::mlir::mhlo::ComparisonTypeAttr compare_type); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + ::mlir::LogicalResult reifyReturnTypeShapes(::mlir::OpBuilder&builder, ::mlir::ValueRange operands, ::llvm::SmallVectorImpl<::mlir::Value> &reifiedReturnShapes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::CompareOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::ComplexOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ComplexOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ComplexOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ComplexOpGenericAdaptorBase(ComplexOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ComplexOpGenericAdaptor : public detail::ComplexOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ComplexOpGenericAdaptorBase; +public: + ComplexOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ComplexOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ComplexOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ComplexOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ComplexOpAdaptor : public ComplexOpGenericAdaptor<::mlir::ValueRange> { +public: + using ComplexOpGenericAdaptor::ComplexOpGenericAdaptor; + ComplexOpAdaptor(ComplexOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ComplexOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsElementType, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::Elementwise> { +public: + using Op::Op; + using Op::print; + using Adaptor = ComplexOpAdaptor; + template + using GenericAdaptor = ComplexOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.complex"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLhs(); + ::mlir::TypedValue<::mlir::TensorType> getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + LogicalResult reifyReturnTypeShapes( + OpBuilder& builder, ValueRange operands, + SmallVectorImpl& reifiedReturnShapes) { + return ::mlir::hlo::deriveShapeFromOperand(&builder, getOperation(), + operands.front(), + &reifiedReturnShapes); + } + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::ComplexOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::ComputeReshapeShapeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ComputeReshapeShapeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ComputeReshapeShapeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ComputeReshapeShapeOpGenericAdaptorBase(ComputeReshapeShapeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ComputeReshapeShapeOpGenericAdaptor : public detail::ComputeReshapeShapeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ComputeReshapeShapeOpGenericAdaptorBase; +public: + ComputeReshapeShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ComputeReshapeShapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ComputeReshapeShapeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ComputeReshapeShapeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getNumElements() { + return (*getODSOperands(0).begin()); + } + + ValueT getDynamicShape() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ComputeReshapeShapeOpAdaptor : public ComputeReshapeShapeOpGenericAdaptor<::mlir::ValueRange> { +public: + using ComputeReshapeShapeOpGenericAdaptor::ComputeReshapeShapeOpGenericAdaptor; + ComputeReshapeShapeOpAdaptor(ComputeReshapeShapeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ComputeReshapeShapeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ComputeReshapeShapeOpAdaptor; + template + using GenericAdaptor = ComputeReshapeShapeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.compute_reshape_shape"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getNumElements(); + ::mlir::TypedValue<::mlir::RankedTensorType> getDynamicShape(); + ::mlir::OpOperand &getNumElementsMutable(); + ::mlir::OpOperand &getDynamicShapeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::RankedTensorType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value num_elements, ::mlir::Value dynamic_shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value num_elements, ::mlir::Value dynamic_shape); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::ComputeReshapeShapeOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::ConcatenateOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConcatenateOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ConcatenateOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ConcatenateOpGenericAdaptorBase(ConcatenateOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getDimensionAttr(); + uint64_t getDimension(); +}; +} // namespace detail +template +class ConcatenateOpGenericAdaptor : public detail::ConcatenateOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConcatenateOpGenericAdaptorBase; +public: + ConcatenateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConcatenateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConcatenateOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ConcatenateOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getVal() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConcatenateOpAdaptor : public ConcatenateOpGenericAdaptor<::mlir::ValueRange> { +public: + using ConcatenateOpGenericAdaptor::ConcatenateOpGenericAdaptor; + ConcatenateOpAdaptor(ConcatenateOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConcatenateOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultElementType, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ConcatenateOpAdaptor; + template + using GenericAdaptor = ConcatenateOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dimension")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDimensionAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDimensionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.concatenate"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getVal(); + ::mlir::MutableOperandRange getValMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getDimensionAttr(); + uint64_t getDimension(); + void setDimensionAttr(::mlir::IntegerAttr attr); + void setDimension(uint64_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::ValueRange val, ::mlir::IntegerAttr dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange val, ::mlir::IntegerAttr dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange val, ::mlir::IntegerAttr dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::ValueRange val, uint64_t dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange val, uint64_t dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange val, uint64_t dimension); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + ::mlir::LogicalResult reifyReturnTypeShapes(::mlir::OpBuilder&builder, ::mlir::ValueRange operands, ::llvm::SmallVectorImpl<::mlir::Value> &reifiedReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::ConcatenateOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::ConstantOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConstantOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ConstantOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ConstantOpGenericAdaptorBase(ConstantOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ElementsAttr getValueAttr(); + ::mlir::ElementsAttr getValue(); +}; +} // namespace detail +template +class ConstantOpGenericAdaptor : public detail::ConstantOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConstantOpGenericAdaptorBase; +public: + ConstantOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConstantOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConstantOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ConstantOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConstantOpAdaptor : public ConstantOpGenericAdaptor<::mlir::ValueRange> { +public: + using ConstantOpGenericAdaptor::ConstantOpGenericAdaptor; + ConstantOpAdaptor(ConstantOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConstantOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::ConstantLike, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ConstantOpAdaptor; + template + using GenericAdaptor = ConstantOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("value")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getValueAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getValueAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.constant"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::RankedTensorType> getOutput(); + ::mlir::ElementsAttr getValueAttr(); + ::mlir::ElementsAttr getValue(); + void setValueAttr(::mlir::ElementsAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Attribute value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::ElementsAttr value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ElementsAttr value); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ElementsAttr value); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r); +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::ConstantOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::ConvertOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConvertOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ConvertOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ConvertOpGenericAdaptorBase(ConvertOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ConvertOpGenericAdaptor : public detail::ConvertOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConvertOpGenericAdaptorBase; +public: + ConvertOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConvertOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConvertOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ConvertOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConvertOpAdaptor : public ConvertOpGenericAdaptor<::mlir::ValueRange> { +public: + using ConvertOpGenericAdaptor::ConvertOpGenericAdaptor; + ConvertOpAdaptor(ConvertOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConvertOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::OpTrait::Elementwise, ::mlir::InferShapedTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ConvertOpAdaptor; + template + using GenericAdaptor = ConvertOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.convert"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Value operand, Type result_element_ty); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + LogicalResult reifyReturnTypeShapes( + OpBuilder& builder, ValueRange operands, + SmallVectorImpl& reifiedReturnShapes) { + return ::mlir::hlo::deriveShapeFromOperand(&builder, getOperation(), + operands.front(), + &reifiedReturnShapes); + } + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::ConvertOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::ConvolutionOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConvolutionOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ConvolutionOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ConvolutionOpGenericAdaptorBase(ConvolutionOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getWindowStridesAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getWindowStrides(); + ::mlir::DenseIntElementsAttr getPaddingAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getPadding(); + ::mlir::DenseIntElementsAttr getLhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getLhsDilation(); + ::mlir::DenseIntElementsAttr getRhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getRhsDilation(); + ::mlir::DenseElementsAttr getWindowReversalAttr(); + ::std::optional< ::mlir::DenseElementsAttr > getWindowReversal(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbersAttr(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbers(); + ::mlir::IntegerAttr getFeatureGroupCountAttr(); + uint64_t getFeatureGroupCount(); + ::mlir::IntegerAttr getBatchGroupCountAttr(); + uint64_t getBatchGroupCount(); + ::mlir::ArrayAttr getPrecisionConfigAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrecisionConfig(); +}; +} // namespace detail +template +class ConvolutionOpGenericAdaptor : public detail::ConvolutionOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConvolutionOpGenericAdaptorBase; +public: + ConvolutionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConvolutionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConvolutionOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ConvolutionOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConvolutionOpAdaptor : public ConvolutionOpGenericAdaptor<::mlir::ValueRange> { +public: + using ConvolutionOpGenericAdaptor::ConvolutionOpGenericAdaptor; + ConvolutionOpAdaptor(ConvolutionOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConvolutionOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ConvolutionOpAdaptor; + template + using GenericAdaptor = ConvolutionOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("batch_group_count"), ::llvm::StringRef("dimension_numbers"), ::llvm::StringRef("feature_group_count"), ::llvm::StringRef("lhs_dilation"), ::llvm::StringRef("padding"), ::llvm::StringRef("precision_config"), ::llvm::StringRef("rhs_dilation"), ::llvm::StringRef("window_reversal"), ::llvm::StringRef("window_strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBatchGroupCountAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBatchGroupCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDimensionNumbersAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDimensionNumbersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getFeatureGroupCountAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getFeatureGroupCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getLhsDilationAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getLhsDilationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getPrecisionConfigAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getPrecisionConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getRhsDilationAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getRhsDilationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getWindowReversalAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getWindowReversalAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getWindowStridesAttrName() { + return getAttributeNameForIndex(8); + } + + static ::mlir::StringAttr getWindowStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 8); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.convolution"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLhs(); + ::mlir::TypedValue<::mlir::TensorType> getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::DenseIntElementsAttr getWindowStridesAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getWindowStrides(); + ::mlir::DenseIntElementsAttr getPaddingAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getPadding(); + ::mlir::DenseIntElementsAttr getLhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getLhsDilation(); + ::mlir::DenseIntElementsAttr getRhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getRhsDilation(); + ::mlir::DenseElementsAttr getWindowReversalAttr(); + ::std::optional< ::mlir::DenseElementsAttr > getWindowReversal(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbersAttr(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbers(); + ::mlir::IntegerAttr getFeatureGroupCountAttr(); + uint64_t getFeatureGroupCount(); + ::mlir::IntegerAttr getBatchGroupCountAttr(); + uint64_t getBatchGroupCount(); + ::mlir::ArrayAttr getPrecisionConfigAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrecisionConfig(); + void setWindowStridesAttr(::mlir::DenseIntElementsAttr attr); + void setPaddingAttr(::mlir::DenseIntElementsAttr attr); + void setLhsDilationAttr(::mlir::DenseIntElementsAttr attr); + void setRhsDilationAttr(::mlir::DenseIntElementsAttr attr); + void setWindowReversalAttr(::mlir::DenseElementsAttr attr); + void setDimensionNumbersAttr(::mlir::mhlo::ConvDimensionNumbersAttr attr); + void setFeatureGroupCountAttr(::mlir::IntegerAttr attr); + void setFeatureGroupCount(uint64_t attrValue); + void setBatchGroupCountAttr(::mlir::IntegerAttr attr); + void setBatchGroupCount(uint64_t attrValue); + void setPrecisionConfigAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeWindowStridesAttr(); + ::mlir::Attribute removePaddingAttr(); + ::mlir::Attribute removeLhsDilationAttr(); + ::mlir::Attribute removeRhsDilationAttr(); + ::mlir::Attribute removeWindowReversalAttr(); + ::mlir::Attribute removePrecisionConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, ::mlir::IntegerAttr feature_group_count, ::mlir::IntegerAttr batch_group_count, /*optional*/::mlir::ArrayAttr precision_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, ::mlir::IntegerAttr feature_group_count, ::mlir::IntegerAttr batch_group_count, /*optional*/::mlir::ArrayAttr precision_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, uint64_t feature_group_count, uint64_t batch_group_count, /*optional*/::mlir::ArrayAttr precision_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, uint64_t feature_group_count, uint64_t batch_group_count, /*optional*/::mlir::ArrayAttr precision_config); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 9 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + bool hasWindowReversal() { + auto reversal = getWindowReversalAttr(); + return reversal && llvm::any_of(reversal.getValues(), + [](bool v) { return v; }); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::ConvolutionOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::CopyOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CopyOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CopyOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CopyOpGenericAdaptorBase(CopyOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getCrossProgramPrefetchIndexAttr(); + ::std::optional getCrossProgramPrefetchIndex(); +}; +} // namespace detail +template +class CopyOpGenericAdaptor : public detail::CopyOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CopyOpGenericAdaptorBase; +public: + CopyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CopyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CopyOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CopyOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CopyOpAdaptor : public CopyOpGenericAdaptor<::mlir::ValueRange> { +public: + using CopyOpGenericAdaptor::CopyOpGenericAdaptor; + CopyOpAdaptor(CopyOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CopyOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::hlo::OpTrait::CompatibleOperandsAndResultType> { +public: + using Op::Op; + using Op::print; + using Adaptor = CopyOpAdaptor; + template + using GenericAdaptor = CopyOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("cross_program_prefetch_index")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getCrossProgramPrefetchIndexAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getCrossProgramPrefetchIndexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.copy"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + ::mlir::IntegerAttr getCrossProgramPrefetchIndexAttr(); + ::std::optional getCrossProgramPrefetchIndex(); + void setCrossProgramPrefetchIndexAttr(::mlir::IntegerAttr attr); + void setCrossProgramPrefetchIndex(::std::optional attrValue); + ::mlir::Attribute removeCrossProgramPrefetchIndexAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, /*optional*/::mlir::IntegerAttr cross_program_prefetch_index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, /*optional*/::mlir::IntegerAttr cross_program_prefetch_index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, /*optional*/::mlir::IntegerAttr cross_program_prefetch_index); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::CopyOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::CosineOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CosineOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CosineOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CosineOpGenericAdaptorBase(CosineOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CosineOpGenericAdaptor : public detail::CosineOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CosineOpGenericAdaptorBase; +public: + CosineOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CosineOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CosineOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CosineOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CosineOpAdaptor : public CosineOpGenericAdaptor<::mlir::ValueRange> { +public: + using CosineOpGenericAdaptor::CosineOpGenericAdaptor; + CosineOpAdaptor(CosineOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CosineOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::hlo::OpTrait::CompatibleOperandsAndResultType, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::SameOperandsAndResultShape> { +public: + using Op::Op; + using Op::print; + using Adaptor = CosineOpAdaptor; + template + using GenericAdaptor = CosineOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.cosine"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + LogicalResult reifyReturnTypeShapes( + OpBuilder& builder, ValueRange operands, + SmallVectorImpl& reifiedReturnShapes) { + return ::mlir::hlo::deriveShapeFromOperand(&builder, getOperation(), + operands.front(), + &reifiedReturnShapes); + } + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::CosineOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::CreateTokenOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CreateTokenOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CreateTokenOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CreateTokenOpGenericAdaptorBase(CreateTokenOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CreateTokenOpGenericAdaptor : public detail::CreateTokenOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CreateTokenOpGenericAdaptorBase; +public: + CreateTokenOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CreateTokenOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CreateTokenOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CreateTokenOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CreateTokenOpAdaptor : public CreateTokenOpGenericAdaptor<::mlir::ValueRange> { +public: + using CreateTokenOpGenericAdaptor::CreateTokenOpGenericAdaptor; + CreateTokenOpAdaptor(CreateTokenOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CreateTokenOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CreateTokenOpAdaptor; + template + using GenericAdaptor = CreateTokenOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.create_token"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getOutput(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::CreateTokenOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::CrossReplicaSumOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CrossReplicaSumOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CrossReplicaSumOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CrossReplicaSumOpGenericAdaptorBase(CrossReplicaSumOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getReplicaGroupsAttr(); + ::mlir::DenseIntElementsAttr getReplicaGroups(); +}; +} // namespace detail +template +class CrossReplicaSumOpGenericAdaptor : public detail::CrossReplicaSumOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CrossReplicaSumOpGenericAdaptorBase; +public: + CrossReplicaSumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CrossReplicaSumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CrossReplicaSumOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CrossReplicaSumOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CrossReplicaSumOpAdaptor : public CrossReplicaSumOpGenericAdaptor<::mlir::ValueRange> { +public: + using CrossReplicaSumOpGenericAdaptor::CrossReplicaSumOpGenericAdaptor; + CrossReplicaSumOpAdaptor(CrossReplicaSumOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CrossReplicaSumOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::hlo::OpTrait::CompatibleOperandsAndResultType> { +public: + using Op::Op; + using Op::print; + using Adaptor = CrossReplicaSumOpAdaptor; + template + using GenericAdaptor = CrossReplicaSumOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("replica_groups")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getReplicaGroupsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getReplicaGroupsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.cross-replica-sum"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::DenseIntElementsAttr getReplicaGroupsAttr(); + ::mlir::DenseIntElementsAttr getReplicaGroups(); + void setReplicaGroupsAttr(::mlir::DenseIntElementsAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value operand, ::mlir::DenseIntElementsAttr replica_groups); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::DenseIntElementsAttr replica_groups); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::DenseIntElementsAttr replica_groups); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::CrossReplicaSumOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::CstrReshapableOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CstrReshapableOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CstrReshapableOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CstrReshapableOpGenericAdaptorBase(CstrReshapableOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CstrReshapableOpGenericAdaptor : public detail::CstrReshapableOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CstrReshapableOpGenericAdaptorBase; +public: + CstrReshapableOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CstrReshapableOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CstrReshapableOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CstrReshapableOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getNumElements() { + return (*getODSOperands(0).begin()); + } + + ValueT getDynamicShape() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CstrReshapableOpAdaptor : public CstrReshapableOpGenericAdaptor<::mlir::ValueRange> { +public: + using CstrReshapableOpGenericAdaptor::CstrReshapableOpGenericAdaptor; + CstrReshapableOpAdaptor(CstrReshapableOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CstrReshapableOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CstrReshapableOpAdaptor; + template + using GenericAdaptor = CstrReshapableOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.cstr_reshapable"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::IndexType> getNumElements(); + ::mlir::TypedValue<::mlir::RankedTensorType> getDynamicShape(); + ::mlir::OpOperand &getNumElementsMutable(); + ::mlir::OpOperand &getDynamicShapeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::shape::WitnessType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value num_elements, ::mlir::Value dynamic_shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value num_elements, ::mlir::Value dynamic_shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value num_elements, ::mlir::Value dynamic_shape); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::CstrReshapableOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::CustomCallOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CustomCallOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CustomCallOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CustomCallOpGenericAdaptorBase(CustomCallOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getCallTargetNameAttr(); + ::llvm::StringRef getCallTargetName(); + ::mlir::BoolAttr getHasSideEffectAttr(); + bool getHasSideEffect(); + ::mlir::Attribute getBackendConfigAttr(); + ::std::optional<::mlir::Attribute> getBackendConfig(); + ::mlir::mhlo::CustomCallApiVersionAttr getApiVersionAttr(); + ::mlir::mhlo::CustomCallApiVersion getApiVersion(); + ::mlir::ArrayAttr getCalledComputationsAttr(); + ::mlir::ArrayAttr getCalledComputations(); + ::mlir::mhlo::CustomCallScheduleAttr getCustomCallScheduleAttr(); + ::mlir::mhlo::CustomCallSchedule getCustomCallSchedule(); + ::mlir::ArrayAttr getOperandLayoutsAttr(); + ::std::optional< ::mlir::ArrayAttr > getOperandLayouts(); + ::mlir::ArrayAttr getResultLayoutsAttr(); + ::std::optional< ::mlir::ArrayAttr > getResultLayouts(); + ::mlir::ArrayAttr getOutputOperandAliasesAttr(); + ::mlir::ArrayAttr getOutputOperandAliases(); +}; +} // namespace detail +template +class CustomCallOpGenericAdaptor : public detail::CustomCallOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CustomCallOpGenericAdaptorBase; +public: + CustomCallOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CustomCallOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CustomCallOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CustomCallOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CustomCallOpAdaptor : public CustomCallOpGenericAdaptor<::mlir::ValueRange> { +public: + using CustomCallOpGenericAdaptor::CustomCallOpGenericAdaptor; + CustomCallOpAdaptor(CustomCallOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CustomCallOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = CustomCallOpAdaptor; + template + using GenericAdaptor = CustomCallOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("api_version"), ::llvm::StringRef("backend_config"), ::llvm::StringRef("call_target_name"), ::llvm::StringRef("called_computations"), ::llvm::StringRef("custom_call_schedule"), ::llvm::StringRef("has_side_effect"), ::llvm::StringRef("operand_layouts"), ::llvm::StringRef("output_operand_aliases"), ::llvm::StringRef("result_layouts")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getApiVersionAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getApiVersionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getBackendConfigAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getBackendConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getCallTargetNameAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getCallTargetNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getCalledComputationsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getCalledComputationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getCustomCallScheduleAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getCustomCallScheduleAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getHasSideEffectAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getHasSideEffectAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getOperandLayoutsAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getOperandLayoutsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getOutputOperandAliasesAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getOutputOperandAliasesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getResultLayoutsAttrName() { + return getAttributeNameForIndex(8); + } + + static ::mlir::StringAttr getResultLayoutsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 8); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.custom_call"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::MutableOperandRange getInputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::StringAttr getCallTargetNameAttr(); + ::llvm::StringRef getCallTargetName(); + ::mlir::BoolAttr getHasSideEffectAttr(); + bool getHasSideEffect(); + ::mlir::Attribute getBackendConfigAttr(); + ::std::optional<::mlir::Attribute> getBackendConfig(); + ::mlir::mhlo::CustomCallApiVersionAttr getApiVersionAttr(); + ::mlir::mhlo::CustomCallApiVersion getApiVersion(); + ::mlir::ArrayAttr getCalledComputationsAttr(); + ::mlir::ArrayAttr getCalledComputations(); + ::mlir::mhlo::CustomCallScheduleAttr getCustomCallScheduleAttr(); + ::mlir::mhlo::CustomCallSchedule getCustomCallSchedule(); + ::mlir::ArrayAttr getOperandLayoutsAttr(); + ::std::optional< ::mlir::ArrayAttr > getOperandLayouts(); + ::mlir::ArrayAttr getResultLayoutsAttr(); + ::std::optional< ::mlir::ArrayAttr > getResultLayouts(); + ::mlir::ArrayAttr getOutputOperandAliasesAttr(); + ::mlir::ArrayAttr getOutputOperandAliases(); + void setCallTargetNameAttr(::mlir::StringAttr attr); + void setCallTargetName(::llvm::StringRef attrValue); + void setHasSideEffectAttr(::mlir::BoolAttr attr); + void setHasSideEffect(::std::optional attrValue); + void setBackendConfigAttr(::mlir::Attribute attr); + void setApiVersionAttr(::mlir::mhlo::CustomCallApiVersionAttr attr); + void setApiVersion(::std::optional<::mlir::mhlo::CustomCallApiVersion> attrValue); + void setCalledComputationsAttr(::mlir::ArrayAttr attr); + void setCustomCallScheduleAttr(::mlir::mhlo::CustomCallScheduleAttr attr); + void setCustomCallSchedule(::std::optional<::mlir::mhlo::CustomCallSchedule> attrValue); + void setOperandLayoutsAttr(::mlir::ArrayAttr attr); + void setResultLayoutsAttr(::mlir::ArrayAttr attr); + void setOutputOperandAliasesAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeHasSideEffectAttr(); + ::mlir::Attribute removeBackendConfigAttr(); + ::mlir::Attribute removeApiVersionAttr(); + ::mlir::Attribute removeCalledComputationsAttr(); + ::mlir::Attribute removeCustomCallScheduleAttr(); + ::mlir::Attribute removeOperandLayoutsAttr(); + ::mlir::Attribute removeResultLayoutsAttr(); + ::mlir::Attribute removeOutputOperandAliasesAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange result_type, ::mlir::ValueRange inputs, ::mlir::StringAttr call_target_name, ::mlir::BoolAttr has_side_effect, ::mlir::StringAttr backend_config, ::mlir::mhlo::CustomCallApiVersionAttr api_version, ::mlir::ArrayAttr called_computations, ::mlir::ArrayAttr operand_layouts, ::mlir::ArrayAttr result_layouts); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::mlir::ValueRange inputs, ::mlir::StringAttr call_target_name, /*optional*/::mlir::BoolAttr has_side_effect, /*optional*/::mlir::Attribute backend_config, /*optional*/::mlir::mhlo::CustomCallApiVersionAttr api_version, /*optional*/::mlir::ArrayAttr called_computations, /*optional*/::mlir::mhlo::CustomCallScheduleAttr custom_call_schedule, /*optional*/::mlir::ArrayAttr operand_layouts, /*optional*/::mlir::ArrayAttr result_layouts, /*optional*/::mlir::ArrayAttr output_operand_aliases); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::mlir::ValueRange inputs, ::llvm::StringRef call_target_name, /*optional*/bool has_side_effect, /*optional*/::mlir::Attribute backend_config, /*optional*/::mlir::mhlo::CustomCallApiVersion api_version, /*optional*/::mlir::ArrayAttr called_computations, /*optional*/::mlir::mhlo::CustomCallSchedule custom_call_schedule, /*optional*/::mlir::ArrayAttr operand_layouts, /*optional*/::mlir::ArrayAttr result_layouts, /*optional*/::mlir::ArrayAttr output_operand_aliases); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 9 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::CustomCallOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::DivOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DivOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DivOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DivOpGenericAdaptorBase(DivOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DivOpGenericAdaptor : public detail::DivOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DivOpGenericAdaptorBase; +public: + DivOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DivOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DivOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DivOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DivOpAdaptor : public DivOpGenericAdaptor<::mlir::ValueRange> { +public: + using DivOpGenericAdaptor::DivOpGenericAdaptor; + DivOpAdaptor(DivOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DivOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::hlo::OpTrait::CompatibleOperandsAndResultType, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::OpTrait::Elementwise> { +public: + using Op::Op; + using Op::print; + using Adaptor = DivOpAdaptor; + template + using GenericAdaptor = DivOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.divide"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLhs(); + ::mlir::TypedValue<::mlir::TensorType> getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + LogicalResult reifyReturnTypeShapes( + OpBuilder& builder, ValueRange operands, + SmallVectorImpl& reifiedReturnShapes) { + return ::mlir::hlo::deriveShapeFromOperand(&builder, getOperation(), + operands.front(), + &reifiedReturnShapes); + } + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::DivOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::DomainOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DomainOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DomainOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DomainOpGenericAdaptorBase(DomainOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::mhlo::DomainKindAttr getKindAttr(); + ::mlir::mhlo::DomainKind getKind(); + ::mlir::StringAttr getEntryMetadataAttr(); + ::llvm::StringRef getEntryMetadata(); + ::mlir::StringAttr getExitMetadataAttr(); + ::llvm::StringRef getExitMetadata(); +}; +} // namespace detail +template +class DomainOpGenericAdaptor : public detail::DomainOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DomainOpGenericAdaptorBase; +public: + DomainOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DomainOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DomainOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DomainOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DomainOpAdaptor : public DomainOpGenericAdaptor<::mlir::ValueRange> { +public: + using DomainOpGenericAdaptor::DomainOpGenericAdaptor; + DomainOpAdaptor(DomainOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DomainOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::hlo::OpTrait::CompatibleOperandsAndResultType, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DomainOpAdaptor; + template + using GenericAdaptor = DomainOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("entry_metadata"), ::llvm::StringRef("exit_metadata"), ::llvm::StringRef("kind")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getEntryMetadataAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getEntryMetadataAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getExitMetadataAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getExitMetadataAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getKindAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getKindAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.domain"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + ::mlir::mhlo::DomainKindAttr getKindAttr(); + ::mlir::mhlo::DomainKind getKind(); + ::mlir::StringAttr getEntryMetadataAttr(); + ::llvm::StringRef getEntryMetadata(); + ::mlir::StringAttr getExitMetadataAttr(); + ::llvm::StringRef getExitMetadata(); + void setKindAttr(::mlir::mhlo::DomainKindAttr attr); + void setKind(::mlir::mhlo::DomainKind attrValue); + void setEntryMetadataAttr(::mlir::StringAttr attr); + void setEntryMetadata(::llvm::StringRef attrValue); + void setExitMetadataAttr(::mlir::StringAttr attr); + void setExitMetadata(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::mhlo::DomainKindAttr kind, ::mlir::StringAttr entry_metadata, ::mlir::StringAttr exit_metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::mhlo::DomainKindAttr kind, ::mlir::StringAttr entry_metadata, ::mlir::StringAttr exit_metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::mhlo::DomainKindAttr kind, ::mlir::StringAttr entry_metadata, ::mlir::StringAttr exit_metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::mhlo::DomainKind kind, ::llvm::StringRef entry_metadata, ::llvm::StringRef exit_metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::mhlo::DomainKind kind, ::llvm::StringRef entry_metadata, ::llvm::StringRef exit_metadata); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::mhlo::DomainKind kind, ::llvm::StringRef entry_metadata, ::llvm::StringRef exit_metadata); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::DomainOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::DotGeneralOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DotGeneralOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DotGeneralOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DotGeneralOpGenericAdaptorBase(DotGeneralOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::mhlo::DotDimensionNumbersAttr getDotDimensionNumbersAttr(); + ::mlir::mhlo::DotDimensionNumbersAttr getDotDimensionNumbers(); + ::mlir::ArrayAttr getPrecisionConfigAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrecisionConfig(); +}; +} // namespace detail +template +class DotGeneralOpGenericAdaptor : public detail::DotGeneralOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DotGeneralOpGenericAdaptorBase; +public: + DotGeneralOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DotGeneralOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DotGeneralOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DotGeneralOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DotGeneralOpAdaptor : public DotGeneralOpGenericAdaptor<::mlir::ValueRange> { +public: + using DotGeneralOpGenericAdaptor::DotGeneralOpGenericAdaptor; + DotGeneralOpAdaptor(DotGeneralOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DotGeneralOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DotGeneralOpAdaptor; + template + using GenericAdaptor = DotGeneralOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dot_dimension_numbers"), ::llvm::StringRef("precision_config")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDotDimensionNumbersAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDotDimensionNumbersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getPrecisionConfigAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getPrecisionConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.dot_general"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLhs(); + ::mlir::TypedValue<::mlir::TensorType> getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::mhlo::DotDimensionNumbersAttr getDotDimensionNumbersAttr(); + ::mlir::mhlo::DotDimensionNumbersAttr getDotDimensionNumbers(); + ::mlir::ArrayAttr getPrecisionConfigAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrecisionConfig(); + void setDotDimensionNumbersAttr(::mlir::mhlo::DotDimensionNumbersAttr attr); + void setPrecisionConfigAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removePrecisionConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::mhlo::DotDimensionNumbersAttr dot_dimension_numbers, /*optional*/::mlir::ArrayAttr precision_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::mhlo::DotDimensionNumbersAttr dot_dimension_numbers, /*optional*/::mlir::ArrayAttr precision_config); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::LogicalResult reifyReturnTypeShapes(::mlir::OpBuilder&builder, ::mlir::ValueRange operands, ::llvm::SmallVectorImpl<::mlir::Value> &reifiedReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::DotGeneralOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::DotOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DotOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DotOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DotOpGenericAdaptorBase(DotOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ArrayAttr getPrecisionConfigAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrecisionConfig(); +}; +} // namespace detail +template +class DotOpGenericAdaptor : public detail::DotOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DotOpGenericAdaptorBase; +public: + DotOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DotOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DotOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DotOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DotOpAdaptor : public DotOpGenericAdaptor<::mlir::ValueRange> { +public: + using DotOpGenericAdaptor::DotOpGenericAdaptor; + DotOpAdaptor(DotOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DotOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DotOpAdaptor; + template + using GenericAdaptor = DotOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("precision_config")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getPrecisionConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getPrecisionConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.dot"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLhs(); + ::mlir::TypedValue<::mlir::TensorType> getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::ArrayAttr getPrecisionConfigAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrecisionConfig(); + void setPrecisionConfigAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removePrecisionConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::ArrayAttr precision_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, /*optional*/::mlir::ArrayAttr precision_config); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::DotOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::DynamicBroadcastInDimOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DynamicBroadcastInDimOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DynamicBroadcastInDimOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DynamicBroadcastInDimOpGenericAdaptorBase(DynamicBroadcastInDimOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getBroadcastDimensionsAttr(); + ::mlir::DenseIntElementsAttr getBroadcastDimensions(); + ::mlir::DenseIntElementsAttr getKnownExpandingDimensionsAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getKnownExpandingDimensions(); + ::mlir::DenseIntElementsAttr getKnownNonexpandingDimensionsAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getKnownNonexpandingDimensions(); +}; +} // namespace detail +template +class DynamicBroadcastInDimOpGenericAdaptor : public detail::DynamicBroadcastInDimOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DynamicBroadcastInDimOpGenericAdaptorBase; +public: + DynamicBroadcastInDimOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DynamicBroadcastInDimOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DynamicBroadcastInDimOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DynamicBroadcastInDimOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + ValueT getOutputDimensions() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DynamicBroadcastInDimOpAdaptor : public DynamicBroadcastInDimOpGenericAdaptor<::mlir::ValueRange> { +public: + using DynamicBroadcastInDimOpGenericAdaptor::DynamicBroadcastInDimOpGenericAdaptor; + DynamicBroadcastInDimOpAdaptor(DynamicBroadcastInDimOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DynamicBroadcastInDimOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DynamicBroadcastInDimOpAdaptor; + template + using GenericAdaptor = DynamicBroadcastInDimOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("broadcast_dimensions"), ::llvm::StringRef("known_expanding_dimensions"), ::llvm::StringRef("known_nonexpanding_dimensions")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBroadcastDimensionsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBroadcastDimensionsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getKnownExpandingDimensionsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getKnownExpandingDimensionsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getKnownNonexpandingDimensionsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getKnownNonexpandingDimensionsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.dynamic_broadcast_in_dim"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::TypedValue<::mlir::RankedTensorType> getOutputDimensions(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::OpOperand &getOutputDimensionsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::DenseIntElementsAttr getBroadcastDimensionsAttr(); + ::mlir::DenseIntElementsAttr getBroadcastDimensions(); + ::mlir::DenseIntElementsAttr getKnownExpandingDimensionsAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getKnownExpandingDimensions(); + ::mlir::DenseIntElementsAttr getKnownNonexpandingDimensionsAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getKnownNonexpandingDimensions(); + void setBroadcastDimensionsAttr(::mlir::DenseIntElementsAttr attr); + void setKnownExpandingDimensionsAttr(::mlir::DenseIntElementsAttr attr); + void setKnownNonexpandingDimensionsAttr(::mlir::DenseIntElementsAttr attr); + ::mlir::Attribute removeKnownExpandingDimensionsAttr(); + ::mlir::Attribute removeKnownNonexpandingDimensionsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type result_type, Value operand, Value output_dimensions, DenseIntElementsAttr broadcast_dimensions); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value operand, ::mlir::Value output_dimensions, ::mlir::DenseIntElementsAttr broadcast_dimensions, /*optional*/::mlir::DenseIntElementsAttr known_expanding_dimensions, /*optional*/::mlir::DenseIntElementsAttr known_nonexpanding_dimensions); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value output_dimensions, ::mlir::DenseIntElementsAttr broadcast_dimensions, /*optional*/::mlir::DenseIntElementsAttr known_expanding_dimensions, /*optional*/::mlir::DenseIntElementsAttr known_nonexpanding_dimensions); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::LogicalResult reifyReturnTypeShapes(::mlir::OpBuilder&builder, ::mlir::ValueRange operands, ::llvm::SmallVectorImpl<::mlir::Value> &reifiedReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::DynamicBroadcastInDimOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::DynamicConvOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DynamicConvOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DynamicConvOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DynamicConvOpGenericAdaptorBase(DynamicConvOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getWindowStridesAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getWindowStrides(); + ::mlir::DenseIntElementsAttr getPaddingAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getPadding(); + ::mlir::DenseIntElementsAttr getLhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getLhsDilation(); + ::mlir::DenseIntElementsAttr getRhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getRhsDilation(); + ::mlir::DenseElementsAttr getWindowReversalAttr(); + ::std::optional< ::mlir::DenseElementsAttr > getWindowReversal(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbersAttr(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbers(); + ::mlir::IntegerAttr getFeatureGroupCountAttr(); + uint64_t getFeatureGroupCount(); + ::mlir::IntegerAttr getBatchGroupCountAttr(); + uint64_t getBatchGroupCount(); + ::mlir::ArrayAttr getPrecisionConfigAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrecisionConfig(); +}; +} // namespace detail +template +class DynamicConvOpGenericAdaptor : public detail::DynamicConvOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DynamicConvOpGenericAdaptorBase; +public: + DynamicConvOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DynamicConvOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DynamicConvOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DynamicConvOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + ValueT getDPadding() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DynamicConvOpAdaptor : public DynamicConvOpGenericAdaptor<::mlir::ValueRange> { +public: + using DynamicConvOpGenericAdaptor::DynamicConvOpGenericAdaptor; + DynamicConvOpAdaptor(DynamicConvOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DynamicConvOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DynamicConvOpAdaptor; + template + using GenericAdaptor = DynamicConvOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("batch_group_count"), ::llvm::StringRef("dimension_numbers"), ::llvm::StringRef("feature_group_count"), ::llvm::StringRef("lhs_dilation"), ::llvm::StringRef("padding"), ::llvm::StringRef("precision_config"), ::llvm::StringRef("rhs_dilation"), ::llvm::StringRef("window_reversal"), ::llvm::StringRef("window_strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBatchGroupCountAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBatchGroupCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDimensionNumbersAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDimensionNumbersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getFeatureGroupCountAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getFeatureGroupCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getLhsDilationAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getLhsDilationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getPrecisionConfigAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getPrecisionConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getRhsDilationAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getRhsDilationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getWindowReversalAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getWindowReversalAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getWindowStridesAttrName() { + return getAttributeNameForIndex(8); + } + + static ::mlir::StringAttr getWindowStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 8); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.dynamic_conv"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLhs(); + ::mlir::TypedValue<::mlir::TensorType> getRhs(); + ::mlir::TypedValue<::mlir::TensorType> getDPadding(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + ::mlir::OpOperand &getDPaddingMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::DenseIntElementsAttr getWindowStridesAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getWindowStrides(); + ::mlir::DenseIntElementsAttr getPaddingAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getPadding(); + ::mlir::DenseIntElementsAttr getLhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getLhsDilation(); + ::mlir::DenseIntElementsAttr getRhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getRhsDilation(); + ::mlir::DenseElementsAttr getWindowReversalAttr(); + ::std::optional< ::mlir::DenseElementsAttr > getWindowReversal(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbersAttr(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbers(); + ::mlir::IntegerAttr getFeatureGroupCountAttr(); + uint64_t getFeatureGroupCount(); + ::mlir::IntegerAttr getBatchGroupCountAttr(); + uint64_t getBatchGroupCount(); + ::mlir::ArrayAttr getPrecisionConfigAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrecisionConfig(); + void setWindowStridesAttr(::mlir::DenseIntElementsAttr attr); + void setPaddingAttr(::mlir::DenseIntElementsAttr attr); + void setLhsDilationAttr(::mlir::DenseIntElementsAttr attr); + void setRhsDilationAttr(::mlir::DenseIntElementsAttr attr); + void setWindowReversalAttr(::mlir::DenseElementsAttr attr); + void setDimensionNumbersAttr(::mlir::mhlo::ConvDimensionNumbersAttr attr); + void setFeatureGroupCountAttr(::mlir::IntegerAttr attr); + void setFeatureGroupCount(uint64_t attrValue); + void setBatchGroupCountAttr(::mlir::IntegerAttr attr); + void setBatchGroupCount(uint64_t attrValue); + void setPrecisionConfigAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeWindowStridesAttr(); + ::mlir::Attribute removePaddingAttr(); + ::mlir::Attribute removeLhsDilationAttr(); + ::mlir::Attribute removeRhsDilationAttr(); + ::mlir::Attribute removeWindowReversalAttr(); + ::mlir::Attribute removePrecisionConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value d_padding, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, ::mlir::IntegerAttr feature_group_count, ::mlir::IntegerAttr batch_group_count, /*optional*/::mlir::ArrayAttr precision_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value d_padding, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, ::mlir::IntegerAttr feature_group_count, ::mlir::IntegerAttr batch_group_count, /*optional*/::mlir::ArrayAttr precision_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value d_padding, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, uint64_t feature_group_count, uint64_t batch_group_count, /*optional*/::mlir::ArrayAttr precision_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value d_padding, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, uint64_t feature_group_count, uint64_t batch_group_count, /*optional*/::mlir::ArrayAttr precision_config); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 9 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::DynamicConvOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::DynamicGatherOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DynamicGatherOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DynamicGatherOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DynamicGatherOpGenericAdaptorBase(DynamicGatherOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::mhlo::GatherDimensionNumbersAttr getDimensionNumbersAttr(); + ::mlir::mhlo::GatherDimensionNumbersAttr getDimensionNumbers(); + ::mlir::BoolAttr getIndicesAreSortedAttr(); + bool getIndicesAreSorted(); +}; +} // namespace detail +template +class DynamicGatherOpGenericAdaptor : public detail::DynamicGatherOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DynamicGatherOpGenericAdaptorBase; +public: + DynamicGatherOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DynamicGatherOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DynamicGatherOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DynamicGatherOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + ValueT getStartIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getSliceSizes() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DynamicGatherOpAdaptor : public DynamicGatherOpGenericAdaptor<::mlir::ValueRange> { +public: + using DynamicGatherOpGenericAdaptor::DynamicGatherOpGenericAdaptor; + DynamicGatherOpAdaptor(DynamicGatherOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DynamicGatherOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DynamicGatherOpAdaptor; + template + using GenericAdaptor = DynamicGatherOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dimension_numbers"), ::llvm::StringRef("indices_are_sorted")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDimensionNumbersAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDimensionNumbersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getIndicesAreSortedAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getIndicesAreSortedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.dynamic_gather"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::TypedValue<::mlir::TensorType> getStartIndices(); + ::mlir::TypedValue<::mlir::TensorType> getSliceSizes(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::OpOperand &getStartIndicesMutable(); + ::mlir::OpOperand &getSliceSizesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::mhlo::GatherDimensionNumbersAttr getDimensionNumbersAttr(); + ::mlir::mhlo::GatherDimensionNumbersAttr getDimensionNumbers(); + ::mlir::BoolAttr getIndicesAreSortedAttr(); + bool getIndicesAreSorted(); + void setDimensionNumbersAttr(::mlir::mhlo::GatherDimensionNumbersAttr attr); + void setIndicesAreSortedAttr(::mlir::BoolAttr attr); + void setIndicesAreSorted(::std::optional attrValue); + ::mlir::Attribute removeIndicesAreSortedAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value operand, ::mlir::Value start_indices, ::mlir::Value slice_sizes, ::mlir::mhlo::GatherDimensionNumbersAttr dimension_numbers, /*optional*/::mlir::BoolAttr indices_are_sorted); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::Value start_indices, ::mlir::Value slice_sizes, ::mlir::mhlo::GatherDimensionNumbersAttr dimension_numbers, /*optional*/::mlir::BoolAttr indices_are_sorted); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value start_indices, ::mlir::Value slice_sizes, ::mlir::mhlo::GatherDimensionNumbersAttr dimension_numbers, /*optional*/::mlir::BoolAttr indices_are_sorted); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value operand, ::mlir::Value start_indices, ::mlir::Value slice_sizes, ::mlir::mhlo::GatherDimensionNumbersAttr dimension_numbers, /*optional*/bool indices_are_sorted = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::Value start_indices, ::mlir::Value slice_sizes, ::mlir::mhlo::GatherDimensionNumbersAttr dimension_numbers, /*optional*/bool indices_are_sorted = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value start_indices, ::mlir::Value slice_sizes, ::mlir::mhlo::GatherDimensionNumbersAttr dimension_numbers, /*optional*/bool indices_are_sorted = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + ::mlir::LogicalResult reifyReturnTypeShapes(::mlir::OpBuilder&builder, ::mlir::ValueRange operands, ::llvm::SmallVectorImpl<::mlir::Value> &reifiedReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::DynamicGatherOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::DynamicIotaOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DynamicIotaOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DynamicIotaOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DynamicIotaOpGenericAdaptorBase(DynamicIotaOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getIotaDimensionAttr(); + uint64_t getIotaDimension(); +}; +} // namespace detail +template +class DynamicIotaOpGenericAdaptor : public detail::DynamicIotaOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DynamicIotaOpGenericAdaptorBase; +public: + DynamicIotaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DynamicIotaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DynamicIotaOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DynamicIotaOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOutputShape() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DynamicIotaOpAdaptor : public DynamicIotaOpGenericAdaptor<::mlir::ValueRange> { +public: + using DynamicIotaOpGenericAdaptor::DynamicIotaOpGenericAdaptor; + DynamicIotaOpAdaptor(DynamicIotaOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DynamicIotaOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DynamicIotaOpAdaptor; + template + using GenericAdaptor = DynamicIotaOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("iota_dimension")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getIotaDimensionAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getIotaDimensionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.dynamic_iota"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::RankedTensorType> getOutputShape(); + ::mlir::OpOperand &getOutputShapeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResult(); + ::mlir::IntegerAttr getIotaDimensionAttr(); + uint64_t getIotaDimension(); + void setIotaDimensionAttr(::mlir::IntegerAttr attr); + void setIotaDimension(uint64_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value output_shape, ::mlir::IntegerAttr iota_dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value output_shape, ::mlir::IntegerAttr iota_dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value output_shape, uint64_t iota_dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value output_shape, uint64_t iota_dimension); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::LogicalResult reifyReturnTypeShapes(::mlir::OpBuilder&builder, ::mlir::ValueRange operands, ::llvm::SmallVectorImpl<::mlir::Value> &reifiedReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::DynamicIotaOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::DynamicPadOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DynamicPadOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DynamicPadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DynamicPadOpGenericAdaptorBase(DynamicPadOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DynamicPadOpGenericAdaptor : public detail::DynamicPadOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DynamicPadOpGenericAdaptorBase; +public: + DynamicPadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DynamicPadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DynamicPadOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DynamicPadOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + ValueT getPaddingValue() { + return (*getODSOperands(1).begin()); + } + + ValueT getEdgePaddingLow() { + return (*getODSOperands(2).begin()); + } + + ValueT getEdgePaddingHigh() { + return (*getODSOperands(3).begin()); + } + + ValueT getInteriorPadding() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DynamicPadOpAdaptor : public DynamicPadOpGenericAdaptor<::mlir::ValueRange> { +public: + using DynamicPadOpGenericAdaptor::DynamicPadOpGenericAdaptor; + DynamicPadOpAdaptor(DynamicPadOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DynamicPadOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<5>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DynamicPadOpAdaptor; + template + using GenericAdaptor = DynamicPadOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.dynamic_pad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::TypedValue<::mlir::TensorType> getPaddingValue(); + ::mlir::TypedValue<::mlir::RankedTensorType> getEdgePaddingLow(); + ::mlir::TypedValue<::mlir::RankedTensorType> getEdgePaddingHigh(); + ::mlir::TypedValue<::mlir::RankedTensorType> getInteriorPadding(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::OpOperand &getPaddingValueMutable(); + ::mlir::OpOperand &getEdgePaddingLowMutable(); + ::mlir::OpOperand &getEdgePaddingHighMutable(); + ::mlir::OpOperand &getInteriorPaddingMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::Value padding_value, ::mlir::Value edge_padding_low, ::mlir::Value edge_padding_high, ::mlir::Value interior_padding); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value padding_value, ::mlir::Value edge_padding_low, ::mlir::Value edge_padding_high, ::mlir::Value interior_padding); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::LogicalResult reifyReturnTypeShapes(::mlir::OpBuilder&builder, ::mlir::ValueRange operands, ::llvm::SmallVectorImpl<::mlir::Value> &reifiedReturnShapes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::DynamicPadOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::DynamicReshapeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DynamicReshapeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DynamicReshapeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DynamicReshapeOpGenericAdaptorBase(DynamicReshapeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DynamicReshapeOpGenericAdaptor : public detail::DynamicReshapeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DynamicReshapeOpGenericAdaptorBase; +public: + DynamicReshapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DynamicReshapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DynamicReshapeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DynamicReshapeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + ValueT getOutputShape() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DynamicReshapeOpAdaptor : public DynamicReshapeOpGenericAdaptor<::mlir::ValueRange> { +public: + using DynamicReshapeOpGenericAdaptor::DynamicReshapeOpGenericAdaptor; + DynamicReshapeOpAdaptor(DynamicReshapeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DynamicReshapeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DynamicReshapeOpAdaptor; + template + using GenericAdaptor = DynamicReshapeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.dynamic_reshape"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::TypedValue<::mlir::RankedTensorType> getOutputShape(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::OpOperand &getOutputShapeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::Value output_shape); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value output_shape); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::LogicalResult reifyReturnTypeShapes(::mlir::OpBuilder&builder, ::mlir::ValueRange operands, ::llvm::SmallVectorImpl<::mlir::Value> &reifiedReturnShapes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::DynamicReshapeOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::DynamicSliceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DynamicSliceOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DynamicSliceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DynamicSliceOpGenericAdaptorBase(DynamicSliceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getSliceSizesAttr(); + ::mlir::DenseIntElementsAttr getSliceSizes(); +}; +} // namespace detail +template +class DynamicSliceOpGenericAdaptor : public detail::DynamicSliceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DynamicSliceOpGenericAdaptorBase; +public: + DynamicSliceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DynamicSliceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DynamicSliceOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DynamicSliceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getStartIndices() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DynamicSliceOpAdaptor : public DynamicSliceOpGenericAdaptor<::mlir::ValueRange> { +public: + using DynamicSliceOpGenericAdaptor::DynamicSliceOpGenericAdaptor; + DynamicSliceOpAdaptor(DynamicSliceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DynamicSliceOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType> { +public: + using Op::Op; + using Op::print; + using Adaptor = DynamicSliceOpAdaptor; + template + using GenericAdaptor = DynamicSliceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("slice_sizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getSliceSizesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getSliceSizesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.dynamic_slice"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::Operation::operand_range getStartIndices(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::MutableOperandRange getStartIndicesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResult(); + ::mlir::DenseIntElementsAttr getSliceSizesAttr(); + ::mlir::DenseIntElementsAttr getSliceSizes(); + void setSliceSizesAttr(::mlir::DenseIntElementsAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::ValueRange start_indices, ::mlir::DenseIntElementsAttr slice_sizes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::ValueRange start_indices, ::mlir::DenseIntElementsAttr slice_sizes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::ValueRange start_indices, ::mlir::DenseIntElementsAttr slice_sizes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::DynamicSliceOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::DynamicUpdateSliceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DynamicUpdateSliceOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DynamicUpdateSliceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DynamicUpdateSliceOpGenericAdaptorBase(DynamicUpdateSliceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DynamicUpdateSliceOpGenericAdaptor : public detail::DynamicUpdateSliceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DynamicUpdateSliceOpGenericAdaptorBase; +public: + DynamicUpdateSliceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DynamicUpdateSliceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DynamicUpdateSliceOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DynamicUpdateSliceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + ValueT getUpdate() { + return (*getODSOperands(1).begin()); + } + + RangeT getStartIndices() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DynamicUpdateSliceOpAdaptor : public DynamicUpdateSliceOpGenericAdaptor<::mlir::ValueRange> { +public: + using DynamicUpdateSliceOpGenericAdaptor::DynamicUpdateSliceOpGenericAdaptor; + DynamicUpdateSliceOpAdaptor(DynamicUpdateSliceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DynamicUpdateSliceOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType> { +public: + using Op::Op; + using Op::print; + using Adaptor = DynamicUpdateSliceOpAdaptor; + template + using GenericAdaptor = DynamicUpdateSliceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.dynamic_update_slice"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::TypedValue<::mlir::TensorType> getUpdate(); + ::mlir::Operation::operand_range getStartIndices(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::OpOperand &getUpdateMutable(); + ::mlir::MutableOperandRange getStartIndicesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::Value update, ::mlir::ValueRange start_indices); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::Value update, ::mlir::ValueRange start_indices); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value update, ::mlir::ValueRange start_indices); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::DynamicUpdateSliceOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::EinsumOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class EinsumOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + EinsumOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + EinsumOpGenericAdaptorBase(EinsumOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getEinsumConfigAttr(); + ::llvm::StringRef getEinsumConfig(); +}; +} // namespace detail +template +class EinsumOpGenericAdaptor : public detail::EinsumOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::EinsumOpGenericAdaptorBase; +public: + EinsumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + EinsumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : EinsumOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + EinsumOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class EinsumOpAdaptor : public EinsumOpGenericAdaptor<::mlir::ValueRange> { +public: + using EinsumOpGenericAdaptor::EinsumOpGenericAdaptor; + EinsumOpAdaptor(EinsumOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class EinsumOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = EinsumOpAdaptor; + template + using GenericAdaptor = EinsumOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("einsum_config")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getEinsumConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getEinsumConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.einsum"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLhs(); + ::mlir::TypedValue<::mlir::TensorType> getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::StringAttr getEinsumConfigAttr(); + ::llvm::StringRef getEinsumConfig(); + void setEinsumConfigAttr(::mlir::StringAttr attr); + void setEinsumConfig(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::StringAttr einsum_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::StringAttr einsum_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value lhs, ::mlir::Value rhs, ::llvm::StringRef einsum_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::llvm::StringRef einsum_config); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::EinsumOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::ExpOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ExpOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ExpOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ExpOpGenericAdaptorBase(ExpOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ExpOpGenericAdaptor : public detail::ExpOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ExpOpGenericAdaptorBase; +public: + ExpOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ExpOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ExpOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ExpOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ExpOpAdaptor : public ExpOpGenericAdaptor<::mlir::ValueRange> { +public: + using ExpOpGenericAdaptor::ExpOpGenericAdaptor; + ExpOpAdaptor(ExpOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ExpOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::hlo::OpTrait::CompatibleOperandsAndResultType, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::SameOperandsAndResultShape> { +public: + using Op::Op; + using Op::print; + using Adaptor = ExpOpAdaptor; + template + using GenericAdaptor = ExpOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.exponential"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + LogicalResult reifyReturnTypeShapes( + OpBuilder& builder, ValueRange operands, + SmallVectorImpl& reifiedReturnShapes) { + return ::mlir::hlo::deriveShapeFromOperand(&builder, getOperation(), + operands.front(), + &reifiedReturnShapes); + } + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::ExpOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::Expm1Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Expm1OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + Expm1OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + Expm1OpGenericAdaptorBase(Expm1Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class Expm1OpGenericAdaptor : public detail::Expm1OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Expm1OpGenericAdaptorBase; +public: + Expm1OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Expm1OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Expm1OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + Expm1OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Expm1OpAdaptor : public Expm1OpGenericAdaptor<::mlir::ValueRange> { +public: + using Expm1OpGenericAdaptor::Expm1OpGenericAdaptor; + Expm1OpAdaptor(Expm1Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Expm1Op : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::hlo::OpTrait::CompatibleOperandsAndResultType, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::SameOperandsAndResultShape> { +public: + using Op::Op; + using Op::print; + using Adaptor = Expm1OpAdaptor; + template + using GenericAdaptor = Expm1OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.exponential_minus_one"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + LogicalResult reifyReturnTypeShapes( + OpBuilder& builder, ValueRange operands, + SmallVectorImpl& reifiedReturnShapes) { + return ::mlir::hlo::deriveShapeFromOperand(&builder, getOperation(), + operands.front(), + &reifiedReturnShapes); + } + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::Expm1Op) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::FftOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FftOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FftOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FftOpGenericAdaptorBase(FftOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::mhlo::FftTypeAttr getFftTypeAttr(); + ::mlir::mhlo::FftType getFftType(); + ::mlir::DenseIntElementsAttr getFftLengthAttr(); + ::mlir::DenseIntElementsAttr getFftLength(); +}; +} // namespace detail +template +class FftOpGenericAdaptor : public detail::FftOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FftOpGenericAdaptorBase; +public: + FftOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FftOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FftOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FftOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FftOpAdaptor : public FftOpGenericAdaptor<::mlir::ValueRange> { +public: + using FftOpGenericAdaptor::FftOpGenericAdaptor; + FftOpAdaptor(FftOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FftOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FftOpAdaptor; + template + using GenericAdaptor = FftOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fft_length"), ::llvm::StringRef("fft_type")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFftLengthAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFftLengthAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getFftTypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getFftTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.fft"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::mhlo::FftTypeAttr getFftTypeAttr(); + ::mlir::mhlo::FftType getFftType(); + ::mlir::DenseIntElementsAttr getFftLengthAttr(); + ::mlir::DenseIntElementsAttr getFftLength(); + void setFftTypeAttr(::mlir::mhlo::FftTypeAttr attr); + void setFftType(::mlir::mhlo::FftType attrValue); + void setFftLengthAttr(::mlir::DenseIntElementsAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value operand, ::mlir::mhlo::FftTypeAttr fft_type, ::mlir::DenseIntElementsAttr fft_length); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::mhlo::FftTypeAttr fft_type, ::mlir::DenseIntElementsAttr fft_length); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::mhlo::FftTypeAttr fft_type, ::mlir::DenseIntElementsAttr fft_length); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value operand, ::mlir::mhlo::FftType fft_type, ::mlir::DenseIntElementsAttr fft_length); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::mhlo::FftType fft_type, ::mlir::DenseIntElementsAttr fft_length); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::mhlo::FftType fft_type, ::mlir::DenseIntElementsAttr fft_length); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::FftOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::FloorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FloorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FloorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FloorOpGenericAdaptorBase(FloorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class FloorOpGenericAdaptor : public detail::FloorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FloorOpGenericAdaptorBase; +public: + FloorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FloorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FloorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FloorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FloorOpAdaptor : public FloorOpGenericAdaptor<::mlir::ValueRange> { +public: + using FloorOpGenericAdaptor::FloorOpGenericAdaptor; + FloorOpAdaptor(FloorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FloorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::hlo::OpTrait::CompatibleOperandsAndResultType, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::SameOperandsAndResultShape> { +public: + using Op::Op; + using Op::print; + using Adaptor = FloorOpAdaptor; + template + using GenericAdaptor = FloorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.floor"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + LogicalResult reifyReturnTypeShapes( + OpBuilder& builder, ValueRange operands, + SmallVectorImpl& reifiedReturnShapes) { + return ::mlir::hlo::deriveShapeFromOperand(&builder, getOperation(), + operands.front(), + &reifiedReturnShapes); + } + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::FloorOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::FusionOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FusionOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FusionOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FusionOpGenericAdaptorBase(FusionOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::mhlo::FusionKindAttr getFusionKindAttr(); + ::std::optional<::mlir::mhlo::FusionKind> getFusionKind(); + ::mlir::ArrayAttr getOutputOperandAliasesAttr(); + ::mlir::ArrayAttr getOutputOperandAliases(); + ::mlir::Region &getFusedComputation(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class FusionOpGenericAdaptor : public detail::FusionOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FusionOpGenericAdaptorBase; +public: + FusionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FusionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FusionOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FusionOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FusionOpAdaptor : public FusionOpGenericAdaptor<::mlir::ValueRange> { +public: + using FusionOpGenericAdaptor::FusionOpGenericAdaptor; + FusionOpAdaptor(FusionOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FusionOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = FusionOpAdaptor; + template + using GenericAdaptor = FusionOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fusion_kind"), ::llvm::StringRef("output_operand_aliases")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFusionKindAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFusionKindAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getOutputOperandAliasesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getOutputOperandAliasesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.fusion"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::MutableOperandRange getInputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResults(); + ::mlir::Region &getFusedComputation(); + ::mlir::mhlo::FusionKindAttr getFusionKindAttr(); + ::std::optional<::mlir::mhlo::FusionKind> getFusionKind(); + ::mlir::ArrayAttr getOutputOperandAliasesAttr(); + ::mlir::ArrayAttr getOutputOperandAliases(); + void setFusionKindAttr(::mlir::mhlo::FusionKindAttr attr); + void setFusionKind(::std::optional<::mlir::mhlo::FusionKind> attrValue); + void setOutputOperandAliasesAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeFusionKindAttr(); + ::mlir::Attribute removeOutputOperandAliasesAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange results, ::mlir::ValueRange inputs, /*optional*/::mlir::mhlo::FusionKindAttr fusion_kind, /*optional*/::mlir::ArrayAttr output_operand_aliases); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::FusionOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::GatherOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GatherOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + GatherOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + GatherOpGenericAdaptorBase(GatherOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::mhlo::GatherDimensionNumbersAttr getDimensionNumbersAttr(); + ::mlir::mhlo::GatherDimensionNumbersAttr getDimensionNumbers(); + ::mlir::DenseIntElementsAttr getSliceSizesAttr(); + ::mlir::DenseIntElementsAttr getSliceSizes(); + ::mlir::BoolAttr getIndicesAreSortedAttr(); + bool getIndicesAreSorted(); +}; +} // namespace detail +template +class GatherOpGenericAdaptor : public detail::GatherOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GatherOpGenericAdaptorBase; +public: + GatherOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GatherOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GatherOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + GatherOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + ValueT getStartIndices() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GatherOpAdaptor : public GatherOpGenericAdaptor<::mlir::ValueRange> { +public: + using GatherOpGenericAdaptor::GatherOpGenericAdaptor; + GatherOpAdaptor(GatherOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GatherOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = GatherOpAdaptor; + template + using GenericAdaptor = GatherOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dimension_numbers"), ::llvm::StringRef("indices_are_sorted"), ::llvm::StringRef("slice_sizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDimensionNumbersAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDimensionNumbersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getIndicesAreSortedAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getIndicesAreSortedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getSliceSizesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getSliceSizesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.gather"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::TypedValue<::mlir::TensorType> getStartIndices(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::OpOperand &getStartIndicesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::mhlo::GatherDimensionNumbersAttr getDimensionNumbersAttr(); + ::mlir::mhlo::GatherDimensionNumbersAttr getDimensionNumbers(); + ::mlir::DenseIntElementsAttr getSliceSizesAttr(); + ::mlir::DenseIntElementsAttr getSliceSizes(); + ::mlir::BoolAttr getIndicesAreSortedAttr(); + bool getIndicesAreSorted(); + void setDimensionNumbersAttr(::mlir::mhlo::GatherDimensionNumbersAttr attr); + void setSliceSizesAttr(::mlir::DenseIntElementsAttr attr); + void setIndicesAreSortedAttr(::mlir::BoolAttr attr); + void setIndicesAreSorted(::std::optional attrValue); + ::mlir::Attribute removeIndicesAreSortedAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value operand, ::mlir::Value start_indices, ::mlir::mhlo::GatherDimensionNumbersAttr dimension_numbers, ::mlir::DenseIntElementsAttr slice_sizes, /*optional*/::mlir::BoolAttr indices_are_sorted); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::Value start_indices, ::mlir::mhlo::GatherDimensionNumbersAttr dimension_numbers, ::mlir::DenseIntElementsAttr slice_sizes, /*optional*/::mlir::BoolAttr indices_are_sorted); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value start_indices, ::mlir::mhlo::GatherDimensionNumbersAttr dimension_numbers, ::mlir::DenseIntElementsAttr slice_sizes, /*optional*/::mlir::BoolAttr indices_are_sorted); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value operand, ::mlir::Value start_indices, ::mlir::mhlo::GatherDimensionNumbersAttr dimension_numbers, ::mlir::DenseIntElementsAttr slice_sizes, /*optional*/bool indices_are_sorted = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::Value start_indices, ::mlir::mhlo::GatherDimensionNumbersAttr dimension_numbers, ::mlir::DenseIntElementsAttr slice_sizes, /*optional*/bool indices_are_sorted = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value start_indices, ::mlir::mhlo::GatherDimensionNumbersAttr dimension_numbers, ::mlir::DenseIntElementsAttr slice_sizes, /*optional*/bool indices_are_sorted = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + ::mlir::LogicalResult reifyReturnTypeShapes(::mlir::OpBuilder&builder, ::mlir::ValueRange operands, ::llvm::SmallVectorImpl<::mlir::Value> &reifiedReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::GatherOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::GetDimensionSizeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GetDimensionSizeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + GetDimensionSizeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + GetDimensionSizeOpGenericAdaptorBase(GetDimensionSizeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getDimensionAttr(); + uint64_t getDimension(); +}; +} // namespace detail +template +class GetDimensionSizeOpGenericAdaptor : public detail::GetDimensionSizeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GetDimensionSizeOpGenericAdaptorBase; +public: + GetDimensionSizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GetDimensionSizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GetDimensionSizeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + GetDimensionSizeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GetDimensionSizeOpAdaptor : public GetDimensionSizeOpGenericAdaptor<::mlir::ValueRange> { +public: + using GetDimensionSizeOpGenericAdaptor::GetDimensionSizeOpGenericAdaptor; + GetDimensionSizeOpAdaptor(GetDimensionSizeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GetDimensionSizeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType> { +public: + using Op::Op; + using Op::print; + using Adaptor = GetDimensionSizeOpAdaptor; + template + using GenericAdaptor = GetDimensionSizeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dimension")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDimensionAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDimensionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.get_dimension_size"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getDimensionAttr(); + uint64_t getDimension(); + void setDimensionAttr(::mlir::IntegerAttr attr); + void setDimension(uint64_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value operand, ::mlir::IntegerAttr dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::IntegerAttr dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::IntegerAttr dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value operand, uint64_t dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, uint64_t dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, uint64_t dimension); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::GetDimensionSizeOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::GetTupleElementOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GetTupleElementOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + GetTupleElementOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + GetTupleElementOpGenericAdaptorBase(GetTupleElementOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getIndexAttr(); + uint32_t getIndex(); +}; +} // namespace detail +template +class GetTupleElementOpGenericAdaptor : public detail::GetTupleElementOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GetTupleElementOpGenericAdaptorBase; +public: + GetTupleElementOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GetTupleElementOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GetTupleElementOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + GetTupleElementOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GetTupleElementOpAdaptor : public GetTupleElementOpGenericAdaptor<::mlir::ValueRange> { +public: + using GetTupleElementOpGenericAdaptor::GetTupleElementOpGenericAdaptor; + GetTupleElementOpAdaptor(GetTupleElementOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GetTupleElementOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = GetTupleElementOpAdaptor; + template + using GenericAdaptor = GetTupleElementOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("index")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getIndexAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getIndexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.get_tuple_element"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getIndexAttr(); + uint32_t getIndex(); + void setIndexAttr(::mlir::IntegerAttr attr); + void setIndex(uint32_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value operand, ::mlir::IntegerAttr index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::IntegerAttr index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::IntegerAttr index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value operand, uint32_t index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, uint32_t index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, uint32_t index); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::GetTupleElementOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::IfOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IfOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IfOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IfOpGenericAdaptorBase(IfOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Region &getTrueBranch(); + ::mlir::Region &getFalseBranch(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class IfOpGenericAdaptor : public detail::IfOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IfOpGenericAdaptorBase; +public: + IfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IfOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IfOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IfOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getPred() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IfOpAdaptor : public IfOpGenericAdaptor<::mlir::ValueRange> { +public: + using IfOpGenericAdaptor::IfOpGenericAdaptor; + IfOpAdaptor(IfOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IfOp : public ::mlir::Op::Impl, ::mlir::OpTrait::VariadicResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::SingleBlock, ::mlir::OpTrait::SingleBlockImplicitTerminator::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = IfOpAdaptor; + template + using GenericAdaptor = IfOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.if"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getPred(); + ::mlir::OpOperand &getPredMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getTrueBranch(); + ::mlir::Region &getFalseBranch(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::mlir::Value pred); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value pred); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::IfOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::ImagOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ImagOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ImagOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ImagOpGenericAdaptorBase(ImagOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ImagOpGenericAdaptor : public detail::ImagOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ImagOpGenericAdaptorBase; +public: + ImagOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ImagOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ImagOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ImagOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ImagOpAdaptor : public ImagOpGenericAdaptor<::mlir::ValueRange> { +public: + using ImagOpGenericAdaptor::ImagOpGenericAdaptor; + ImagOpAdaptor(ImagOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ImagOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape> { +public: + using Op::Op; + using Op::print; + using Adaptor = ImagOpAdaptor; + template + using GenericAdaptor = ImagOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.imag"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + LogicalResult reifyReturnTypeShapes( + OpBuilder& builder, ValueRange operands, + SmallVectorImpl& reifiedReturnShapes) { + return ::mlir::hlo::deriveShapeFromOperand(&builder, getOperation(), + operands.front(), + &reifiedReturnShapes); + } + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::ImagOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::InfeedOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class InfeedOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + InfeedOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + InfeedOpGenericAdaptorBase(InfeedOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getInfeedConfigAttr(); + ::llvm::StringRef getInfeedConfig(); + ::mlir::ArrayAttr getLayoutAttr(); + ::std::optional< ::mlir::ArrayAttr > getLayout(); +}; +} // namespace detail +template +class InfeedOpGenericAdaptor : public detail::InfeedOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::InfeedOpGenericAdaptorBase; +public: + InfeedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + InfeedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : InfeedOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + InfeedOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getToken() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class InfeedOpAdaptor : public InfeedOpGenericAdaptor<::mlir::ValueRange> { +public: + using InfeedOpGenericAdaptor::InfeedOpGenericAdaptor; + InfeedOpAdaptor(InfeedOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class InfeedOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = InfeedOpAdaptor; + template + using GenericAdaptor = InfeedOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("infeed_config"), ::llvm::StringRef("layout")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getInfeedConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getInfeedConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getLayoutAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getLayoutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.infeed"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getToken(); + ::mlir::OpOperand &getTokenMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::StringAttr getInfeedConfigAttr(); + ::llvm::StringRef getInfeedConfig(); + ::mlir::ArrayAttr getLayoutAttr(); + ::std::optional< ::mlir::ArrayAttr > getLayout(); + void setInfeedConfigAttr(::mlir::StringAttr attr); + void setInfeedConfig(::llvm::StringRef attrValue); + void setLayoutAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeLayoutAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::mlir::Value token, ::mlir::StringAttr infeed_config, /*optional*/::mlir::ArrayAttr layout); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::mlir::Value token, ::llvm::StringRef infeed_config, /*optional*/::mlir::ArrayAttr layout); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultAttrs(const ::mlir::OperationName &opName, ::mlir::NamedAttrList &attributes); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::InfeedOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::IotaOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IotaOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IotaOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IotaOpGenericAdaptorBase(IotaOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getIotaDimensionAttr(); + uint64_t getIotaDimension(); +}; +} // namespace detail +template +class IotaOpGenericAdaptor : public detail::IotaOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IotaOpGenericAdaptorBase; +public: + IotaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IotaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IotaOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IotaOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IotaOpAdaptor : public IotaOpGenericAdaptor<::mlir::ValueRange> { +public: + using IotaOpGenericAdaptor::IotaOpGenericAdaptor; + IotaOpAdaptor(IotaOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IotaOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = IotaOpAdaptor; + template + using GenericAdaptor = IotaOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("iota_dimension")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getIotaDimensionAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getIotaDimensionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.iota"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::RankedTensorType> getOutput(); + ::mlir::IntegerAttr getIotaDimensionAttr(); + uint64_t getIotaDimension(); + void setIotaDimensionAttr(::mlir::IntegerAttr attr); + void setIotaDimension(uint64_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::IntegerAttr iota_dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr iota_dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, uint64_t iota_dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, uint64_t iota_dimension); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::IotaOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::IsFiniteOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IsFiniteOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IsFiniteOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IsFiniteOpGenericAdaptorBase(IsFiniteOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class IsFiniteOpGenericAdaptor : public detail::IsFiniteOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IsFiniteOpGenericAdaptorBase; +public: + IsFiniteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IsFiniteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IsFiniteOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IsFiniteOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getX() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IsFiniteOpAdaptor : public IsFiniteOpGenericAdaptor<::mlir::ValueRange> { +public: + using IsFiniteOpGenericAdaptor::IsFiniteOpGenericAdaptor; + IsFiniteOpAdaptor(IsFiniteOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IsFiniteOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape> { +public: + using Op::Op; + using Op::print; + using Adaptor = IsFiniteOpAdaptor; + template + using GenericAdaptor = IsFiniteOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.is_finite"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getX(); + ::mlir::OpOperand &getXMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getY(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type y, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value x); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value x); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + LogicalResult reifyReturnTypeShapes( + OpBuilder& builder, ValueRange operands, + SmallVectorImpl& reifiedReturnShapes) { + return ::mlir::hlo::deriveShapeFromOperand(&builder, getOperation(), + operands.front(), + &reifiedReturnShapes); + } + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::IsFiniteOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::Log1pOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Log1pOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + Log1pOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + Log1pOpGenericAdaptorBase(Log1pOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class Log1pOpGenericAdaptor : public detail::Log1pOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Log1pOpGenericAdaptorBase; +public: + Log1pOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Log1pOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Log1pOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + Log1pOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Log1pOpAdaptor : public Log1pOpGenericAdaptor<::mlir::ValueRange> { +public: + using Log1pOpGenericAdaptor::Log1pOpGenericAdaptor; + Log1pOpAdaptor(Log1pOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Log1pOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::hlo::OpTrait::CompatibleOperandsAndResultType, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::SameOperandsAndResultShape> { +public: + using Op::Op; + using Op::print; + using Adaptor = Log1pOpAdaptor; + template + using GenericAdaptor = Log1pOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.log_plus_one"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + LogicalResult reifyReturnTypeShapes( + OpBuilder& builder, ValueRange operands, + SmallVectorImpl& reifiedReturnShapes) { + return ::mlir::hlo::deriveShapeFromOperand(&builder, getOperation(), + operands.front(), + &reifiedReturnShapes); + } + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::Log1pOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::LogOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LogOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LogOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LogOpGenericAdaptorBase(LogOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class LogOpGenericAdaptor : public detail::LogOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LogOpGenericAdaptorBase; +public: + LogOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LogOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LogOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LogOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LogOpAdaptor : public LogOpGenericAdaptor<::mlir::ValueRange> { +public: + using LogOpGenericAdaptor::LogOpGenericAdaptor; + LogOpAdaptor(LogOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LogOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::hlo::OpTrait::CompatibleOperandsAndResultType, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::SameOperandsAndResultShape> { +public: + using Op::Op; + using Op::print; + using Adaptor = LogOpAdaptor; + template + using GenericAdaptor = LogOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.log"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + LogicalResult reifyReturnTypeShapes( + OpBuilder& builder, ValueRange operands, + SmallVectorImpl& reifiedReturnShapes) { + return ::mlir::hlo::deriveShapeFromOperand(&builder, getOperation(), + operands.front(), + &reifiedReturnShapes); + } + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::LogOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::LogisticOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LogisticOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LogisticOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LogisticOpGenericAdaptorBase(LogisticOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class LogisticOpGenericAdaptor : public detail::LogisticOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LogisticOpGenericAdaptorBase; +public: + LogisticOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LogisticOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LogisticOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LogisticOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LogisticOpAdaptor : public LogisticOpGenericAdaptor<::mlir::ValueRange> { +public: + using LogisticOpGenericAdaptor::LogisticOpGenericAdaptor; + LogisticOpAdaptor(LogisticOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LogisticOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::hlo::OpTrait::CompatibleOperandsAndResultType, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::SameOperandsAndResultShape> { +public: + using Op::Op; + using Op::print; + using Adaptor = LogisticOpAdaptor; + template + using GenericAdaptor = LogisticOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.logistic"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + LogicalResult reifyReturnTypeShapes( + OpBuilder& builder, ValueRange operands, + SmallVectorImpl& reifiedReturnShapes) { + return ::mlir::hlo::deriveShapeFromOperand(&builder, getOperation(), + operands.front(), + &reifiedReturnShapes); + } + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::LogisticOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::MapOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MapOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MapOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MapOpGenericAdaptorBase(MapOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getDimensionsAttr(); + ::mlir::DenseIntElementsAttr getDimensions(); + ::mlir::Region &getComputation(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class MapOpGenericAdaptor : public detail::MapOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MapOpGenericAdaptorBase; +public: + MapOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MapOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MapOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MapOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MapOpAdaptor : public MapOpGenericAdaptor<::mlir::ValueRange> { +public: + using MapOpGenericAdaptor::MapOpGenericAdaptor; + MapOpAdaptor(MapOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MapOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::SingleBlock, ::mlir::OpTrait::SingleBlockImplicitTerminator::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType> { +public: + using Op::Op; + using Op::print; + using Adaptor = MapOpAdaptor; + template + using GenericAdaptor = MapOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dimensions")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDimensionsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDimensionsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.map"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::MutableOperandRange getInputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getComputation(); + ::mlir::DenseIntElementsAttr getDimensionsAttr(); + ::mlir::DenseIntElementsAttr getDimensions(); + void setDimensionsAttr(::mlir::DenseIntElementsAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::ValueRange inputs, ::mlir::DenseIntElementsAttr dimensions); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange inputs, ::mlir::DenseIntElementsAttr dimensions); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::mlir::DenseIntElementsAttr dimensions); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + ::mlir::LogicalResult reifyReturnTypeShapes(::mlir::OpBuilder&builder, ::mlir::ValueRange operands, ::llvm::SmallVectorImpl<::mlir::Value> &reifiedReturnShapes); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::MapOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::MaxOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MaxOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MaxOpGenericAdaptorBase(MaxOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MaxOpGenericAdaptor : public detail::MaxOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MaxOpGenericAdaptorBase; +public: + MaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MaxOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MaxOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MaxOpAdaptor : public MaxOpGenericAdaptor<::mlir::ValueRange> { +public: + using MaxOpGenericAdaptor::MaxOpGenericAdaptor; + MaxOpAdaptor(MaxOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MaxOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsCommutative, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::hlo::OpTrait::CompatibleOperandsAndResultType, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::OpTrait::Elementwise> { +public: + using Op::Op; + using Op::print; + using Adaptor = MaxOpAdaptor; + template + using GenericAdaptor = MaxOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.maximum"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLhs(); + ::mlir::TypedValue<::mlir::TensorType> getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + LogicalResult reifyReturnTypeShapes( + OpBuilder& builder, ValueRange operands, + SmallVectorImpl& reifiedReturnShapes) { + return ::mlir::hlo::deriveShapeFromOperand(&builder, getOperation(), + operands.front(), + &reifiedReturnShapes); + } + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::MaxOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::MinOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MinOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MinOpGenericAdaptorBase(MinOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MinOpGenericAdaptor : public detail::MinOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MinOpGenericAdaptorBase; +public: + MinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MinOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MinOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MinOpAdaptor : public MinOpGenericAdaptor<::mlir::ValueRange> { +public: + using MinOpGenericAdaptor::MinOpGenericAdaptor; + MinOpAdaptor(MinOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MinOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsCommutative, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::hlo::OpTrait::CompatibleOperandsAndResultType, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::OpTrait::Elementwise> { +public: + using Op::Op; + using Op::print; + using Adaptor = MinOpAdaptor; + template + using GenericAdaptor = MinOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.minimum"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLhs(); + ::mlir::TypedValue<::mlir::TensorType> getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + LogicalResult reifyReturnTypeShapes( + OpBuilder& builder, ValueRange operands, + SmallVectorImpl& reifiedReturnShapes) { + return ::mlir::hlo::deriveShapeFromOperand(&builder, getOperation(), + operands.front(), + &reifiedReturnShapes); + } + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::MinOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::MulOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MulOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MulOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MulOpGenericAdaptorBase(MulOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class MulOpGenericAdaptor : public detail::MulOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MulOpGenericAdaptorBase; +public: + MulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MulOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MulOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MulOpAdaptor : public MulOpGenericAdaptor<::mlir::ValueRange> { +public: + using MulOpGenericAdaptor::MulOpGenericAdaptor; + MulOpAdaptor(MulOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MulOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsCommutative, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::hlo::OpTrait::CompatibleOperandsAndResultType, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::OpTrait::Elementwise> { +public: + using Op::Op; + using Op::print; + using Adaptor = MulOpAdaptor; + template + using GenericAdaptor = MulOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.multiply"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLhs(); + ::mlir::TypedValue<::mlir::TensorType> getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + LogicalResult reifyReturnTypeShapes( + OpBuilder& builder, ValueRange operands, + SmallVectorImpl& reifiedReturnShapes) { + return ::mlir::hlo::deriveShapeFromOperand(&builder, getOperation(), + operands.front(), + &reifiedReturnShapes); + } + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::MulOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::NegOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class NegOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + NegOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + NegOpGenericAdaptorBase(NegOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class NegOpGenericAdaptor : public detail::NegOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::NegOpGenericAdaptorBase; +public: + NegOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + NegOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : NegOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + NegOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class NegOpAdaptor : public NegOpGenericAdaptor<::mlir::ValueRange> { +public: + using NegOpGenericAdaptor::NegOpGenericAdaptor; + NegOpAdaptor(NegOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class NegOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::hlo::OpTrait::CompatibleOperandsAndResultType, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::SameOperandsAndResultShape> { +public: + using Op::Op; + using Op::print; + using Adaptor = NegOpAdaptor; + template + using GenericAdaptor = NegOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.negate"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + LogicalResult reifyReturnTypeShapes( + OpBuilder& builder, ValueRange operands, + SmallVectorImpl& reifiedReturnShapes) { + return ::mlir::hlo::deriveShapeFromOperand(&builder, getOperation(), + operands.front(), + &reifiedReturnShapes); + } + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::NegOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::NotOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class NotOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + NotOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + NotOpGenericAdaptorBase(NotOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class NotOpGenericAdaptor : public detail::NotOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::NotOpGenericAdaptorBase; +public: + NotOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + NotOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : NotOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + NotOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class NotOpAdaptor : public NotOpGenericAdaptor<::mlir::ValueRange> { +public: + using NotOpGenericAdaptor::NotOpGenericAdaptor; + NotOpAdaptor(NotOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class NotOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::hlo::OpTrait::CompatibleOperandsAndResultType, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::SameOperandsAndResultShape> { +public: + using Op::Op; + using Op::print; + using Adaptor = NotOpAdaptor; + template + using GenericAdaptor = NotOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.not"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + LogicalResult reifyReturnTypeShapes( + OpBuilder& builder, ValueRange operands, + SmallVectorImpl& reifiedReturnShapes) { + return ::mlir::hlo::deriveShapeFromOperand(&builder, getOperation(), + operands.front(), + &reifiedReturnShapes); + } + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::NotOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::OptimizationBarrierOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class OptimizationBarrierOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + OptimizationBarrierOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + OptimizationBarrierOpGenericAdaptorBase(OptimizationBarrierOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class OptimizationBarrierOpGenericAdaptor : public detail::OptimizationBarrierOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::OptimizationBarrierOpGenericAdaptorBase; +public: + OptimizationBarrierOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + OptimizationBarrierOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : OptimizationBarrierOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + OptimizationBarrierOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperand() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class OptimizationBarrierOpAdaptor : public OptimizationBarrierOpGenericAdaptor<::mlir::ValueRange> { +public: + using OptimizationBarrierOpGenericAdaptor::OptimizationBarrierOpGenericAdaptor; + OptimizationBarrierOpAdaptor(OptimizationBarrierOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class OptimizationBarrierOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = OptimizationBarrierOpAdaptor; + template + using GenericAdaptor = OptimizationBarrierOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.optimization_barrier"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getOperand(); + ::mlir::MutableOperandRange getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Operation::result_range getResult(); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::OptimizationBarrierOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::OrOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class OrOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + OrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + OrOpGenericAdaptorBase(OrOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class OrOpGenericAdaptor : public detail::OrOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::OrOpGenericAdaptorBase; +public: + OrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + OrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : OrOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + OrOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class OrOpAdaptor : public OrOpGenericAdaptor<::mlir::ValueRange> { +public: + using OrOpGenericAdaptor::OrOpGenericAdaptor; + OrOpAdaptor(OrOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class OrOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsCommutative, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::hlo::OpTrait::CompatibleOperandsAndResultType, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::OpTrait::Elementwise> { +public: + using Op::Op; + using Op::print; + using Adaptor = OrOpAdaptor; + template + using GenericAdaptor = OrOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.or"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLhs(); + ::mlir::TypedValue<::mlir::TensorType> getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + LogicalResult reifyReturnTypeShapes( + OpBuilder& builder, ValueRange operands, + SmallVectorImpl& reifiedReturnShapes) { + return ::mlir::hlo::deriveShapeFromOperand(&builder, getOperation(), + operands.front(), + &reifiedReturnShapes); + } + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::OrOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::OutfeedOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class OutfeedOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + OutfeedOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + OutfeedOpGenericAdaptorBase(OutfeedOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getOutfeedConfigAttr(); + ::llvm::StringRef getOutfeedConfig(); +}; +} // namespace detail +template +class OutfeedOpGenericAdaptor : public detail::OutfeedOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::OutfeedOpGenericAdaptorBase; +public: + OutfeedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + OutfeedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : OutfeedOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + OutfeedOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + ValueT getToken() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class OutfeedOpAdaptor : public OutfeedOpGenericAdaptor<::mlir::ValueRange> { +public: + using OutfeedOpGenericAdaptor::OutfeedOpGenericAdaptor; + OutfeedOpAdaptor(OutfeedOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class OutfeedOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = OutfeedOpAdaptor; + template + using GenericAdaptor = OutfeedOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("outfeed_config")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getOutfeedConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getOutfeedConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.outfeed"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Value getToken(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::OpOperand &getTokenMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::StringAttr getOutfeedConfigAttr(); + ::llvm::StringRef getOutfeedConfig(); + void setOutfeedConfigAttr(::mlir::StringAttr attr); + void setOutfeedConfig(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::ValueRange inputs, ::mlir::Value token, ::mlir::StringAttr outfeed_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange inputs, ::mlir::Value token, ::mlir::StringAttr outfeed_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::mlir::Value token, ::mlir::StringAttr outfeed_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::ValueRange inputs, ::mlir::Value token, ::llvm::StringRef outfeed_config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange inputs, ::mlir::Value token, ::llvm::StringRef outfeed_config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::mlir::Value token, ::llvm::StringRef outfeed_config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultAttrs(const ::mlir::OperationName &opName, ::mlir::NamedAttrList &attributes); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::OutfeedOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::PadOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PadOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + PadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + PadOpGenericAdaptorBase(PadOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getEdgePaddingLowAttr(); + ::mlir::DenseIntElementsAttr getEdgePaddingLow(); + ::mlir::DenseIntElementsAttr getEdgePaddingHighAttr(); + ::mlir::DenseIntElementsAttr getEdgePaddingHigh(); + ::mlir::DenseIntElementsAttr getInteriorPaddingAttr(); + ::mlir::DenseIntElementsAttr getInteriorPadding(); +}; +} // namespace detail +template +class PadOpGenericAdaptor : public detail::PadOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PadOpGenericAdaptorBase; +public: + PadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PadOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + PadOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + ValueT getPaddingValue() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PadOpAdaptor : public PadOpGenericAdaptor<::mlir::ValueRange> { +public: + using PadOpGenericAdaptor::PadOpGenericAdaptor; + PadOpAdaptor(PadOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PadOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultElementType, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = PadOpAdaptor; + template + using GenericAdaptor = PadOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("edge_padding_high"), ::llvm::StringRef("edge_padding_low"), ::llvm::StringRef("interior_padding")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getEdgePaddingHighAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getEdgePaddingHighAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getEdgePaddingLowAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getEdgePaddingLowAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getInteriorPaddingAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getInteriorPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.pad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::TypedValue<::mlir::TensorType> getPaddingValue(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::OpOperand &getPaddingValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::DenseIntElementsAttr getEdgePaddingLowAttr(); + ::mlir::DenseIntElementsAttr getEdgePaddingLow(); + ::mlir::DenseIntElementsAttr getEdgePaddingHighAttr(); + ::mlir::DenseIntElementsAttr getEdgePaddingHigh(); + ::mlir::DenseIntElementsAttr getInteriorPaddingAttr(); + ::mlir::DenseIntElementsAttr getInteriorPadding(); + void setEdgePaddingLowAttr(::mlir::DenseIntElementsAttr attr); + void setEdgePaddingHighAttr(::mlir::DenseIntElementsAttr attr); + void setInteriorPaddingAttr(::mlir::DenseIntElementsAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value operand, ::mlir::Value padding_value, ::mlir::DenseIntElementsAttr edge_padding_low, ::mlir::DenseIntElementsAttr edge_padding_high, ::mlir::DenseIntElementsAttr interior_padding); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::Value padding_value, ::mlir::DenseIntElementsAttr edge_padding_low, ::mlir::DenseIntElementsAttr edge_padding_high, ::mlir::DenseIntElementsAttr interior_padding); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value padding_value, ::mlir::DenseIntElementsAttr edge_padding_low, ::mlir::DenseIntElementsAttr edge_padding_high, ::mlir::DenseIntElementsAttr interior_padding); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + ::mlir::LogicalResult reifyReturnTypeShapes(::mlir::OpBuilder&builder, ::mlir::ValueRange operands, ::llvm::SmallVectorImpl<::mlir::Value> &reifiedReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::PadOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::PartitionIdOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PartitionIdOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + PartitionIdOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + PartitionIdOpGenericAdaptorBase(PartitionIdOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class PartitionIdOpGenericAdaptor : public detail::PartitionIdOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PartitionIdOpGenericAdaptorBase; +public: + PartitionIdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PartitionIdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PartitionIdOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + PartitionIdOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PartitionIdOpAdaptor : public PartitionIdOpGenericAdaptor<::mlir::ValueRange> { +public: + using PartitionIdOpGenericAdaptor::PartitionIdOpGenericAdaptor; + PartitionIdOpAdaptor(PartitionIdOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PartitionIdOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = PartitionIdOpAdaptor; + template + using GenericAdaptor = PartitionIdOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.partition_id"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::PartitionIdOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::PopulationCountOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PopulationCountOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + PopulationCountOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + PopulationCountOpGenericAdaptorBase(PopulationCountOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class PopulationCountOpGenericAdaptor : public detail::PopulationCountOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PopulationCountOpGenericAdaptorBase; +public: + PopulationCountOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PopulationCountOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PopulationCountOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + PopulationCountOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PopulationCountOpAdaptor : public PopulationCountOpGenericAdaptor<::mlir::ValueRange> { +public: + using PopulationCountOpGenericAdaptor::PopulationCountOpGenericAdaptor; + PopulationCountOpAdaptor(PopulationCountOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PopulationCountOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::hlo::OpTrait::CompatibleOperandsAndResultType, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::SameOperandsAndResultShape> { +public: + using Op::Op; + using Op::print; + using Adaptor = PopulationCountOpAdaptor; + template + using GenericAdaptor = PopulationCountOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.popcnt"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + LogicalResult reifyReturnTypeShapes( + OpBuilder& builder, ValueRange operands, + SmallVectorImpl& reifiedReturnShapes) { + return ::mlir::hlo::deriveShapeFromOperand(&builder, getOperation(), + operands.front(), + &reifiedReturnShapes); + } + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::PopulationCountOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::PowOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PowOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + PowOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + PowOpGenericAdaptorBase(PowOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class PowOpGenericAdaptor : public detail::PowOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PowOpGenericAdaptorBase; +public: + PowOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PowOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PowOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + PowOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PowOpAdaptor : public PowOpGenericAdaptor<::mlir::ValueRange> { +public: + using PowOpGenericAdaptor::PowOpGenericAdaptor; + PowOpAdaptor(PowOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PowOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::hlo::OpTrait::CompatibleOperandsAndResultType, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::OpTrait::Elementwise> { +public: + using Op::Op; + using Op::print; + using Adaptor = PowOpAdaptor; + template + using GenericAdaptor = PowOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.power"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLhs(); + ::mlir::TypedValue<::mlir::TensorType> getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + LogicalResult reifyReturnTypeShapes( + OpBuilder& builder, ValueRange operands, + SmallVectorImpl& reifiedReturnShapes) { + return ::mlir::hlo::deriveShapeFromOperand(&builder, getOperation(), + operands.front(), + &reifiedReturnShapes); + } + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::PowOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::RealDynamicSliceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RealDynamicSliceOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RealDynamicSliceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RealDynamicSliceOpGenericAdaptorBase(RealDynamicSliceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RealDynamicSliceOpGenericAdaptor : public detail::RealDynamicSliceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RealDynamicSliceOpGenericAdaptorBase; +public: + RealDynamicSliceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RealDynamicSliceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RealDynamicSliceOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RealDynamicSliceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + ValueT getStartIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getLimitIndices() { + return (*getODSOperands(2).begin()); + } + + ValueT getStrides() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RealDynamicSliceOpAdaptor : public RealDynamicSliceOpGenericAdaptor<::mlir::ValueRange> { +public: + using RealDynamicSliceOpGenericAdaptor::RealDynamicSliceOpGenericAdaptor; + RealDynamicSliceOpAdaptor(RealDynamicSliceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RealDynamicSliceOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RealDynamicSliceOpAdaptor; + template + using GenericAdaptor = RealDynamicSliceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.real_dynamic_slice"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::TypedValue<::mlir::RankedTensorType> getStartIndices(); + ::mlir::TypedValue<::mlir::RankedTensorType> getLimitIndices(); + ::mlir::TypedValue<::mlir::RankedTensorType> getStrides(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::OpOperand &getStartIndicesMutable(); + ::mlir::OpOperand &getLimitIndicesMutable(); + ::mlir::OpOperand &getStridesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::Value start_indices, ::mlir::Value limit_indices, ::mlir::Value strides); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value start_indices, ::mlir::Value limit_indices, ::mlir::Value strides); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::LogicalResult reifyReturnTypeShapes(::mlir::OpBuilder&builder, ::mlir::ValueRange operands, ::llvm::SmallVectorImpl<::mlir::Value> &reifiedReturnShapes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::RealDynamicSliceOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::RealOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RealOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RealOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RealOpGenericAdaptorBase(RealOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RealOpGenericAdaptor : public detail::RealOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RealOpGenericAdaptorBase; +public: + RealOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RealOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RealOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RealOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RealOpAdaptor : public RealOpGenericAdaptor<::mlir::ValueRange> { +public: + using RealOpGenericAdaptor::RealOpGenericAdaptor; + RealOpAdaptor(RealOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RealOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape> { +public: + using Op::Op; + using Op::print; + using Adaptor = RealOpAdaptor; + template + using GenericAdaptor = RealOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.real"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + LogicalResult reifyReturnTypeShapes( + OpBuilder& builder, ValueRange operands, + SmallVectorImpl& reifiedReturnShapes) { + return ::mlir::hlo::deriveShapeFromOperand(&builder, getOperation(), + operands.front(), + &reifiedReturnShapes); + } + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::RealOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::RecvOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RecvOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RecvOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RecvOpGenericAdaptorBase(RecvOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::mhlo::ChannelHandleAttr getChannelHandleAttr(); + ::mlir::mhlo::ChannelHandleAttr getChannelHandle(); + ::mlir::BoolAttr getIsHostTransferAttr(); + bool getIsHostTransfer(); +}; +} // namespace detail +template +class RecvOpGenericAdaptor : public detail::RecvOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RecvOpGenericAdaptorBase; +public: + RecvOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RecvOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RecvOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RecvOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getToken() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RecvOpAdaptor : public RecvOpGenericAdaptor<::mlir::ValueRange> { +public: + using RecvOpGenericAdaptor::RecvOpGenericAdaptor; + RecvOpAdaptor(RecvOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RecvOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = RecvOpAdaptor; + template + using GenericAdaptor = RecvOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("channel_handle"), ::llvm::StringRef("is_host_transfer")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getChannelHandleAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getChannelHandleAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getIsHostTransferAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getIsHostTransferAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.recv"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getToken(); + ::mlir::OpOperand &getTokenMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::mhlo::ChannelHandleAttr getChannelHandleAttr(); + ::mlir::mhlo::ChannelHandleAttr getChannelHandle(); + ::mlir::BoolAttr getIsHostTransferAttr(); + bool getIsHostTransfer(); + void setChannelHandleAttr(::mlir::mhlo::ChannelHandleAttr attr); + void setIsHostTransferAttr(::mlir::BoolAttr attr); + void setIsHostTransfer(::std::optional attrValue); + ::mlir::Attribute removeIsHostTransferAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::mlir::Value token, ::mlir::mhlo::ChannelHandleAttr channel_handle, /*optional*/::mlir::BoolAttr is_host_transfer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::mlir::Value token, ::mlir::mhlo::ChannelHandleAttr channel_handle, /*optional*/bool is_host_transfer = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::RecvOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::ReduceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReduceOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ReduceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ReduceOpGenericAdaptorBase(ReduceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getDimensionsAttr(); + ::mlir::DenseIntElementsAttr getDimensions(); + ::mlir::Region &getBody(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class ReduceOpGenericAdaptor : public detail::ReduceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReduceOpGenericAdaptorBase; +public: + ReduceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReduceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReduceOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ReduceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getInitValues() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ReduceOpAdaptor : public ReduceOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReduceOpGenericAdaptor::ReduceOpGenericAdaptor; + ReduceOpAdaptor(ReduceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReduceOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType> { +public: + using Op::Op; + using Op::print; + using Adaptor = ReduceOpAdaptor; + template + using GenericAdaptor = ReduceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dimensions")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDimensionsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDimensionsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.reduce"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getInitValues(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getInitValuesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getBody(); + ::mlir::DenseIntElementsAttr getDimensionsAttr(); + ::mlir::DenseIntElementsAttr getDimensions(); + void setDimensionsAttr(::mlir::DenseIntElementsAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::mlir::ValueRange inputs, ::mlir::ValueRange init_values, ::mlir::DenseIntElementsAttr dimensions); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange inputs, ::mlir::ValueRange init_values, ::mlir::DenseIntElementsAttr dimensions); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + ::mlir::LogicalResult reifyReturnTypeShapes(::mlir::OpBuilder&builder, ::mlir::ValueRange operands, ::llvm::SmallVectorImpl<::mlir::Value> &reifiedReturnShapes); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::ReduceOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::ReducePrecisionOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReducePrecisionOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ReducePrecisionOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ReducePrecisionOpGenericAdaptorBase(ReducePrecisionOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getExponentBitsAttr(); + uint32_t getExponentBits(); + ::mlir::IntegerAttr getMantissaBitsAttr(); + uint32_t getMantissaBits(); +}; +} // namespace detail +template +class ReducePrecisionOpGenericAdaptor : public detail::ReducePrecisionOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReducePrecisionOpGenericAdaptorBase; +public: + ReducePrecisionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReducePrecisionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReducePrecisionOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ReducePrecisionOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ReducePrecisionOpAdaptor : public ReducePrecisionOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReducePrecisionOpGenericAdaptor::ReducePrecisionOpGenericAdaptor; + ReducePrecisionOpAdaptor(ReducePrecisionOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReducePrecisionOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::hlo::OpTrait::CompatibleOperandsAndResultType, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ReducePrecisionOpAdaptor; + template + using GenericAdaptor = ReducePrecisionOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("exponent_bits"), ::llvm::StringRef("mantissa_bits")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getExponentBitsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getExponentBitsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getMantissaBitsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getMantissaBitsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.reduce_precision"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutput(); + ::mlir::IntegerAttr getExponentBitsAttr(); + uint32_t getExponentBits(); + ::mlir::IntegerAttr getMantissaBitsAttr(); + uint32_t getMantissaBits(); + void setExponentBitsAttr(::mlir::IntegerAttr attr); + void setExponentBits(uint32_t attrValue); + void setMantissaBitsAttr(::mlir::IntegerAttr attr); + void setMantissaBits(uint32_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value operand, ::mlir::IntegerAttr exponent_bits, ::mlir::IntegerAttr mantissa_bits); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::IntegerAttr exponent_bits, ::mlir::IntegerAttr mantissa_bits); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::IntegerAttr exponent_bits, ::mlir::IntegerAttr mantissa_bits); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output, ::mlir::Value operand, uint32_t exponent_bits, uint32_t mantissa_bits); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, uint32_t exponent_bits, uint32_t mantissa_bits); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, uint32_t exponent_bits, uint32_t mantissa_bits); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::ReducePrecisionOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::ReduceScatterOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReduceScatterOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ReduceScatterOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ReduceScatterOpGenericAdaptorBase(ReduceScatterOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getScatterDimensionAttr(); + uint64_t getScatterDimension(); + ::mlir::DenseIntElementsAttr getReplicaGroupsAttr(); + ::mlir::DenseIntElementsAttr getReplicaGroups(); + ::mlir::mhlo::ChannelHandleAttr getChannelHandleAttr(); + ::std::optional<::mlir::mhlo::ChannelHandleAttr> getChannelHandle(); + ::mlir::UnitAttr getUseGlobalDeviceIdsAttr(); + bool getUseGlobalDeviceIds(); + ::mlir::Region &getComputation(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class ReduceScatterOpGenericAdaptor : public detail::ReduceScatterOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReduceScatterOpGenericAdaptorBase; +public: + ReduceScatterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReduceScatterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReduceScatterOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ReduceScatterOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ReduceScatterOpAdaptor : public ReduceScatterOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReduceScatterOpGenericAdaptor::ReduceScatterOpGenericAdaptor; + ReduceScatterOpAdaptor(ReduceScatterOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReduceScatterOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::SameOperandsAndResultElementType> { +public: + using Op::Op; + using Op::print; + using Adaptor = ReduceScatterOpAdaptor; + template + using GenericAdaptor = ReduceScatterOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("channel_handle"), ::llvm::StringRef("replica_groups"), ::llvm::StringRef("scatter_dimension"), ::llvm::StringRef("use_global_device_ids")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getChannelHandleAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getChannelHandleAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getReplicaGroupsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getReplicaGroupsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getScatterDimensionAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getScatterDimensionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getUseGlobalDeviceIdsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getUseGlobalDeviceIdsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.reduce_scatter"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getComputation(); + ::mlir::IntegerAttr getScatterDimensionAttr(); + uint64_t getScatterDimension(); + ::mlir::DenseIntElementsAttr getReplicaGroupsAttr(); + ::mlir::DenseIntElementsAttr getReplicaGroups(); + ::mlir::mhlo::ChannelHandleAttr getChannelHandleAttr(); + ::std::optional<::mlir::mhlo::ChannelHandleAttr> getChannelHandle(); + ::mlir::UnitAttr getUseGlobalDeviceIdsAttr(); + bool getUseGlobalDeviceIds(); + void setScatterDimensionAttr(::mlir::IntegerAttr attr); + void setScatterDimension(uint64_t attrValue); + void setReplicaGroupsAttr(::mlir::DenseIntElementsAttr attr); + void setChannelHandleAttr(::mlir::mhlo::ChannelHandleAttr attr); + void setUseGlobalDeviceIdsAttr(::mlir::UnitAttr attr); + void setUseGlobalDeviceIds(bool attrValue); + ::mlir::Attribute removeChannelHandleAttr(); + ::mlir::Attribute removeUseGlobalDeviceIdsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result_type, ::mlir::Value operand, ::mlir::IntegerAttr scatter_dimension, ::mlir::DenseIntElementsAttr replica_groups, ::mlir::mhlo::ChannelHandleAttr channel_handle); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value operand, ::mlir::IntegerAttr scatter_dimension, ::mlir::DenseIntElementsAttr replica_groups, /*optional*/::mlir::mhlo::ChannelHandleAttr channel_handle, /*optional*/::mlir::UnitAttr use_global_device_ids); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::IntegerAttr scatter_dimension, ::mlir::DenseIntElementsAttr replica_groups, /*optional*/::mlir::mhlo::ChannelHandleAttr channel_handle, /*optional*/::mlir::UnitAttr use_global_device_ids); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value operand, uint64_t scatter_dimension, ::mlir::DenseIntElementsAttr replica_groups, /*optional*/::mlir::mhlo::ChannelHandleAttr channel_handle, /*optional*/bool use_global_device_ids = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, uint64_t scatter_dimension, ::mlir::DenseIntElementsAttr replica_groups, /*optional*/::mlir::mhlo::ChannelHandleAttr channel_handle, /*optional*/bool use_global_device_ids = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::ReduceScatterOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::ReduceWindowOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReduceWindowOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ReduceWindowOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ReduceWindowOpGenericAdaptorBase(ReduceWindowOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getWindowDimensionsAttr(); + ::mlir::DenseIntElementsAttr getWindowDimensions(); + ::mlir::DenseIntElementsAttr getWindowStridesAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getWindowStrides(); + ::mlir::DenseIntElementsAttr getBaseDilationsAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getBaseDilations(); + ::mlir::DenseIntElementsAttr getWindowDilationsAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getWindowDilations(); + ::mlir::DenseIntElementsAttr getPaddingAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getPadding(); + ::mlir::Region &getBody(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class ReduceWindowOpGenericAdaptor : public detail::ReduceWindowOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReduceWindowOpGenericAdaptorBase; +public: + ReduceWindowOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReduceWindowOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReduceWindowOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ReduceWindowOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getInitValues() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ReduceWindowOpAdaptor : public ReduceWindowOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReduceWindowOpGenericAdaptor::ReduceWindowOpGenericAdaptor; + ReduceWindowOpAdaptor(ReduceWindowOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReduceWindowOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType> { +public: + using Op::Op; + using Op::print; + using Adaptor = ReduceWindowOpAdaptor; + template + using GenericAdaptor = ReduceWindowOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("base_dilations"), ::llvm::StringRef("padding"), ::llvm::StringRef("window_dilations"), ::llvm::StringRef("window_dimensions"), ::llvm::StringRef("window_strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBaseDilationsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBaseDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getWindowDilationsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getWindowDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getWindowDimensionsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getWindowDimensionsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getWindowStridesAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getWindowStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.reduce_window"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getInitValues(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getInitValuesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getBody(); + ::mlir::DenseIntElementsAttr getWindowDimensionsAttr(); + ::mlir::DenseIntElementsAttr getWindowDimensions(); + ::mlir::DenseIntElementsAttr getWindowStridesAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getWindowStrides(); + ::mlir::DenseIntElementsAttr getBaseDilationsAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getBaseDilations(); + ::mlir::DenseIntElementsAttr getWindowDilationsAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getWindowDilations(); + ::mlir::DenseIntElementsAttr getPaddingAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getPadding(); + void setWindowDimensionsAttr(::mlir::DenseIntElementsAttr attr); + void setWindowStridesAttr(::mlir::DenseIntElementsAttr attr); + void setBaseDilationsAttr(::mlir::DenseIntElementsAttr attr); + void setWindowDilationsAttr(::mlir::DenseIntElementsAttr attr); + void setPaddingAttr(::mlir::DenseIntElementsAttr attr); + ::mlir::Attribute removeWindowStridesAttr(); + ::mlir::Attribute removeBaseDilationsAttr(); + ::mlir::Attribute removeWindowDilationsAttr(); + ::mlir::Attribute removePaddingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, Type result_type, Value operand, Value init_value, DenseIntElementsAttr window_dimensions, DenseIntElementsAttr window_strides, DenseIntElementsAttr base_dilations, DenseIntElementsAttr window_dilations, DenseIntElementsAttr padding); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange operands, ValueRange init_values, DenseIntElementsAttr window_dimensions, DenseIntElementsAttr window_strides, DenseIntElementsAttr base_dilations, DenseIntElementsAttr window_dilations, DenseIntElementsAttr padding, function_ref bodyBuilder); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::mlir::ValueRange inputs, ::mlir::ValueRange init_values, ::mlir::DenseIntElementsAttr window_dimensions, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr base_dilations, /*optional*/::mlir::DenseIntElementsAttr window_dilations, /*optional*/::mlir::DenseIntElementsAttr padding); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange inputs, ::mlir::ValueRange init_values, ::mlir::DenseIntElementsAttr window_dimensions, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr base_dilations, /*optional*/::mlir::DenseIntElementsAttr window_dilations, /*optional*/::mlir::DenseIntElementsAttr padding); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Get the operation used for reduction applied to `result_index`th result. + Operation *getReductionOp(int result_index); + + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::ReduceWindowOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::RemOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RemOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RemOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RemOpGenericAdaptorBase(RemOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RemOpGenericAdaptor : public detail::RemOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RemOpGenericAdaptorBase; +public: + RemOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RemOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RemOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RemOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RemOpAdaptor : public RemOpGenericAdaptor<::mlir::ValueRange> { +public: + using RemOpGenericAdaptor::RemOpGenericAdaptor; + RemOpAdaptor(RemOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RemOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::hlo::OpTrait::CompatibleOperandsAndResultType, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::OpTrait::Elementwise> { +public: + using Op::Op; + using Op::print; + using Adaptor = RemOpAdaptor; + template + using GenericAdaptor = RemOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.remainder"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLhs(); + ::mlir::TypedValue<::mlir::TensorType> getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + LogicalResult reifyReturnTypeShapes( + OpBuilder& builder, ValueRange operands, + SmallVectorImpl& reifiedReturnShapes) { + return ::mlir::hlo::deriveShapeFromOperand(&builder, getOperation(), + operands.front(), + &reifiedReturnShapes); + } + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::RemOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::ReplicaIdOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReplicaIdOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ReplicaIdOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ReplicaIdOpGenericAdaptorBase(ReplicaIdOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ReplicaIdOpGenericAdaptor : public detail::ReplicaIdOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReplicaIdOpGenericAdaptorBase; +public: + ReplicaIdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReplicaIdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReplicaIdOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ReplicaIdOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ReplicaIdOpAdaptor : public ReplicaIdOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReplicaIdOpGenericAdaptor::ReplicaIdOpGenericAdaptor; + ReplicaIdOpAdaptor(ReplicaIdOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReplicaIdOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ReplicaIdOpAdaptor; + template + using GenericAdaptor = ReplicaIdOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.replica_id"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::ReplicaIdOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::ReshapeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReshapeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ReshapeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ReshapeOpGenericAdaptorBase(ReshapeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ReshapeOpGenericAdaptor : public detail::ReshapeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReshapeOpGenericAdaptorBase; +public: + ReshapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReshapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReshapeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ReshapeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ReshapeOpAdaptor : public ReshapeOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReshapeOpGenericAdaptor::ReshapeOpGenericAdaptor; + ReshapeOpAdaptor(ReshapeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReshapeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::hlo::OpTrait::CompatibleOperandsAndResultElementType> { +public: + using Op::Op; + using Op::print; + using Adaptor = ReshapeOpAdaptor; + template + using GenericAdaptor = ReshapeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.reshape"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::ReshapeOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::ReturnOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReturnOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ReturnOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ReturnOpGenericAdaptorBase(ReturnOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ReturnOpGenericAdaptor : public detail::ReturnOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReturnOpGenericAdaptorBase; +public: + ReturnOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReturnOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReturnOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ReturnOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getResults() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ReturnOpAdaptor : public ReturnOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReturnOpGenericAdaptor::ReturnOpGenericAdaptor; + ReturnOpAdaptor(ReturnOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReturnOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = ReturnOpAdaptor; + template + using GenericAdaptor = ReturnOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.return"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getResults(); + ::mlir::MutableOperandRange getResultsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange results); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::ReturnOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::ReverseOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReverseOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ReverseOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ReverseOpGenericAdaptorBase(ReverseOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getDimensionsAttr(); + ::mlir::DenseIntElementsAttr getDimensions(); +}; +} // namespace detail +template +class ReverseOpGenericAdaptor : public detail::ReverseOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReverseOpGenericAdaptorBase; +public: + ReverseOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReverseOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReverseOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ReverseOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ReverseOpAdaptor : public ReverseOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReverseOpGenericAdaptor::ReverseOpGenericAdaptor; + ReverseOpAdaptor(ReverseOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReverseOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::hlo::OpTrait::CompatibleOperandsAndResultType> { +public: + using Op::Op; + using Op::print; + using Adaptor = ReverseOpAdaptor; + template + using GenericAdaptor = ReverseOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dimensions")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDimensionsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDimensionsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.reverse"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::DenseIntElementsAttr getDimensionsAttr(); + ::mlir::DenseIntElementsAttr getDimensions(); + void setDimensionsAttr(::mlir::DenseIntElementsAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value operand, ::mlir::DenseIntElementsAttr dimensions); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::DenseIntElementsAttr dimensions); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::DenseIntElementsAttr dimensions); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::ReverseOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::RngBitGeneratorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RngBitGeneratorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RngBitGeneratorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RngBitGeneratorOpGenericAdaptorBase(RngBitGeneratorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::mhlo::RngAlgorithmAttr getRngAlgorithmAttr(); + ::mlir::mhlo::RngAlgorithm getRngAlgorithm(); +}; +} // namespace detail +template +class RngBitGeneratorOpGenericAdaptor : public detail::RngBitGeneratorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RngBitGeneratorOpGenericAdaptorBase; +public: + RngBitGeneratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RngBitGeneratorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RngBitGeneratorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RngBitGeneratorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInitialState() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RngBitGeneratorOpAdaptor : public RngBitGeneratorOpGenericAdaptor<::mlir::ValueRange> { +public: + using RngBitGeneratorOpGenericAdaptor::RngBitGeneratorOpGenericAdaptor; + RngBitGeneratorOpAdaptor(RngBitGeneratorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RngBitGeneratorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RngBitGeneratorOpAdaptor; + template + using GenericAdaptor = RngBitGeneratorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("rng_algorithm")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getRngAlgorithmAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getRngAlgorithmAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.rng_bit_generator"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getInitialState(); + ::mlir::OpOperand &getInitialStateMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOutputState(); + ::mlir::TypedValue<::mlir::RankedTensorType> getOutput(); + ::mlir::mhlo::RngAlgorithmAttr getRngAlgorithmAttr(); + ::mlir::mhlo::RngAlgorithm getRngAlgorithm(); + void setRngAlgorithmAttr(::mlir::mhlo::RngAlgorithmAttr attr); + void setRngAlgorithm(::mlir::mhlo::RngAlgorithm attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output_state, ::mlir::Type output, ::mlir::mhlo::RngAlgorithmAttr rng_algorithm, ::mlir::Value initial_state); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::mhlo::RngAlgorithmAttr rng_algorithm, ::mlir::Value initial_state); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type output_state, ::mlir::Type output, ::mlir::mhlo::RngAlgorithm rng_algorithm, ::mlir::Value initial_state); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::mhlo::RngAlgorithm rng_algorithm, ::mlir::Value initial_state); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::RngBitGeneratorOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::RngOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RngOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RngOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RngOpGenericAdaptorBase(RngOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::mhlo::RngDistributionAttr getRngDistributionAttr(); + ::mlir::mhlo::RngDistribution getRngDistribution(); +}; +} // namespace detail +template +class RngOpGenericAdaptor : public detail::RngOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RngOpGenericAdaptorBase; +public: + RngOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RngOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RngOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RngOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + ValueT getB() { + return (*getODSOperands(1).begin()); + } + + ValueT getShape() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RngOpAdaptor : public RngOpGenericAdaptor<::mlir::ValueRange> { +public: + using RngOpGenericAdaptor::RngOpGenericAdaptor; + RngOpAdaptor(RngOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RngOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType> { +public: + using Op::Op; + using Op::print; + using Adaptor = RngOpAdaptor; + template + using GenericAdaptor = RngOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("rng_distribution")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getRngDistributionAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getRngDistributionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.rng"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::RankedTensorType> getA(); + ::mlir::TypedValue<::mlir::RankedTensorType> getB(); + ::mlir::TypedValue<::mlir::RankedTensorType> getShape(); + ::mlir::OpOperand &getAMutable(); + ::mlir::OpOperand &getBMutable(); + ::mlir::OpOperand &getShapeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResult(); + ::mlir::mhlo::RngDistributionAttr getRngDistributionAttr(); + ::mlir::mhlo::RngDistribution getRngDistribution(); + void setRngDistributionAttr(::mlir::mhlo::RngDistributionAttr attr); + void setRngDistribution(::mlir::mhlo::RngDistribution attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value a, ::mlir::Value b, ::mlir::Value shape, ::mlir::mhlo::RngDistributionAttr rng_distribution); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, ::mlir::Value shape, ::mlir::mhlo::RngDistributionAttr rng_distribution); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::Value shape, ::mlir::mhlo::RngDistributionAttr rng_distribution); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value a, ::mlir::Value b, ::mlir::Value shape, ::mlir::mhlo::RngDistribution rng_distribution); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, ::mlir::Value shape, ::mlir::mhlo::RngDistribution rng_distribution); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::Value shape, ::mlir::mhlo::RngDistribution rng_distribution); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + ::mlir::LogicalResult reifyReturnTypeShapes(::mlir::OpBuilder&builder, ::mlir::ValueRange operands, ::llvm::SmallVectorImpl<::mlir::Value> &reifiedReturnShapes); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::RngOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::RoundNearestEvenOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RoundNearestEvenOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RoundNearestEvenOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RoundNearestEvenOpGenericAdaptorBase(RoundNearestEvenOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RoundNearestEvenOpGenericAdaptor : public detail::RoundNearestEvenOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RoundNearestEvenOpGenericAdaptorBase; +public: + RoundNearestEvenOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RoundNearestEvenOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RoundNearestEvenOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RoundNearestEvenOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RoundNearestEvenOpAdaptor : public RoundNearestEvenOpGenericAdaptor<::mlir::ValueRange> { +public: + using RoundNearestEvenOpGenericAdaptor::RoundNearestEvenOpGenericAdaptor; + RoundNearestEvenOpAdaptor(RoundNearestEvenOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RoundNearestEvenOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::hlo::OpTrait::CompatibleOperandsAndResultType, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::SameOperandsAndResultShape> { +public: + using Op::Op; + using Op::print; + using Adaptor = RoundNearestEvenOpAdaptor; + template + using GenericAdaptor = RoundNearestEvenOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.round_nearest_even"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + LogicalResult reifyReturnTypeShapes( + OpBuilder& builder, ValueRange operands, + SmallVectorImpl& reifiedReturnShapes) { + return ::mlir::hlo::deriveShapeFromOperand(&builder, getOperation(), + operands.front(), + &reifiedReturnShapes); + } + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::RoundNearestEvenOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::RoundOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RoundOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RoundOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RoundOpGenericAdaptorBase(RoundOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RoundOpGenericAdaptor : public detail::RoundOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RoundOpGenericAdaptorBase; +public: + RoundOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RoundOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RoundOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RoundOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RoundOpAdaptor : public RoundOpGenericAdaptor<::mlir::ValueRange> { +public: + using RoundOpGenericAdaptor::RoundOpGenericAdaptor; + RoundOpAdaptor(RoundOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RoundOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::hlo::OpTrait::CompatibleOperandsAndResultType, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::SameOperandsAndResultShape> { +public: + using Op::Op; + using Op::print; + using Adaptor = RoundOpAdaptor; + template + using GenericAdaptor = RoundOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.round_nearest_afz"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + LogicalResult reifyReturnTypeShapes( + OpBuilder& builder, ValueRange operands, + SmallVectorImpl& reifiedReturnShapes) { + return ::mlir::hlo::deriveShapeFromOperand(&builder, getOperation(), + operands.front(), + &reifiedReturnShapes); + } + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::RoundOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::RsqrtOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RsqrtOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RsqrtOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RsqrtOpGenericAdaptorBase(RsqrtOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RsqrtOpGenericAdaptor : public detail::RsqrtOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RsqrtOpGenericAdaptorBase; +public: + RsqrtOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RsqrtOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RsqrtOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RsqrtOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RsqrtOpAdaptor : public RsqrtOpGenericAdaptor<::mlir::ValueRange> { +public: + using RsqrtOpGenericAdaptor::RsqrtOpGenericAdaptor; + RsqrtOpAdaptor(RsqrtOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RsqrtOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::hlo::OpTrait::CompatibleOperandsAndResultType, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::SameOperandsAndResultShape> { +public: + using Op::Op; + using Op::print; + using Adaptor = RsqrtOpAdaptor; + template + using GenericAdaptor = RsqrtOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.rsqrt"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + LogicalResult reifyReturnTypeShapes( + OpBuilder& builder, ValueRange operands, + SmallVectorImpl& reifiedReturnShapes) { + return ::mlir::hlo::deriveShapeFromOperand(&builder, getOperation(), + operands.front(), + &reifiedReturnShapes); + } + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::RsqrtOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::ScatterOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ScatterOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ScatterOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ScatterOpGenericAdaptorBase(ScatterOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::mhlo::ScatterDimensionNumbersAttr getScatterDimensionNumbersAttr(); + ::mlir::mhlo::ScatterDimensionNumbersAttr getScatterDimensionNumbers(); + ::mlir::BoolAttr getIndicesAreSortedAttr(); + bool getIndicesAreSorted(); + ::mlir::BoolAttr getUniqueIndicesAttr(); + bool getUniqueIndices(); + ::mlir::Region &getUpdateComputation(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class ScatterOpGenericAdaptor : public detail::ScatterOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ScatterOpGenericAdaptorBase; +public: + ScatterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ScatterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ScatterOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ScatterOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + ValueT getScatterIndices() { + return (*getODSOperands(1).begin()); + } + + RangeT getUpdates() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ScatterOpAdaptor : public ScatterOpGenericAdaptor<::mlir::ValueRange> { +public: + using ScatterOpGenericAdaptor::ScatterOpGenericAdaptor; + ScatterOpAdaptor(ScatterOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ScatterOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ScatterOpAdaptor; + template + using GenericAdaptor = ScatterOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("indices_are_sorted"), ::llvm::StringRef("scatter_dimension_numbers"), ::llvm::StringRef("unique_indices")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getIndicesAreSortedAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getIndicesAreSortedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getScatterDimensionNumbersAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getScatterDimensionNumbersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getUniqueIndicesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getUniqueIndicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.scatter"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::TypedValue<::mlir::TensorType> getScatterIndices(); + ::mlir::Operation::operand_range getUpdates(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::OpOperand &getScatterIndicesMutable(); + ::mlir::MutableOperandRange getUpdatesMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getUpdateComputation(); + ::mlir::mhlo::ScatterDimensionNumbersAttr getScatterDimensionNumbersAttr(); + ::mlir::mhlo::ScatterDimensionNumbersAttr getScatterDimensionNumbers(); + ::mlir::BoolAttr getIndicesAreSortedAttr(); + bool getIndicesAreSorted(); + ::mlir::BoolAttr getUniqueIndicesAttr(); + bool getUniqueIndices(); + void setScatterDimensionNumbersAttr(::mlir::mhlo::ScatterDimensionNumbersAttr attr); + void setIndicesAreSortedAttr(::mlir::BoolAttr attr); + void setIndicesAreSorted(::std::optional attrValue); + void setUniqueIndicesAttr(::mlir::BoolAttr attr); + void setUniqueIndices(::std::optional attrValue); + ::mlir::Attribute removeIndicesAreSortedAttr(); + ::mlir::Attribute removeUniqueIndicesAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::mlir::ValueRange inputs, ::mlir::Value scatter_indices, ::mlir::ValueRange updates, ::mlir::mhlo::ScatterDimensionNumbersAttr scatter_dimension_numbers, /*optional*/::mlir::BoolAttr indices_are_sorted, /*optional*/::mlir::BoolAttr unique_indices); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange inputs, ::mlir::Value scatter_indices, ::mlir::ValueRange updates, ::mlir::mhlo::ScatterDimensionNumbersAttr scatter_dimension_numbers, /*optional*/::mlir::BoolAttr indices_are_sorted, /*optional*/::mlir::BoolAttr unique_indices); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::mlir::ValueRange inputs, ::mlir::Value scatter_indices, ::mlir::ValueRange updates, ::mlir::mhlo::ScatterDimensionNumbersAttr scatter_dimension_numbers, /*optional*/bool indices_are_sorted = false, /*optional*/bool unique_indices = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange inputs, ::mlir::Value scatter_indices, ::mlir::ValueRange updates, ::mlir::mhlo::ScatterDimensionNumbersAttr scatter_dimension_numbers, /*optional*/bool indices_are_sorted = false, /*optional*/bool unique_indices = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::ScatterOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::SelectAndScatterOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SelectAndScatterOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SelectAndScatterOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SelectAndScatterOpGenericAdaptorBase(SelectAndScatterOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getWindowDimensionsAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getWindowDimensions(); + ::mlir::DenseIntElementsAttr getWindowStridesAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getWindowStrides(); + ::mlir::DenseIntElementsAttr getPaddingAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getPadding(); + ::mlir::Region &getSelect(); + ::mlir::Region &getScatter(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class SelectAndScatterOpGenericAdaptor : public detail::SelectAndScatterOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SelectAndScatterOpGenericAdaptorBase; +public: + SelectAndScatterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SelectAndScatterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SelectAndScatterOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SelectAndScatterOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + ValueT getSource() { + return (*getODSOperands(1).begin()); + } + + ValueT getInitValue() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SelectAndScatterOpAdaptor : public SelectAndScatterOpGenericAdaptor<::mlir::ValueRange> { +public: + using SelectAndScatterOpGenericAdaptor::SelectAndScatterOpGenericAdaptor; + SelectAndScatterOpAdaptor(SelectAndScatterOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SelectAndScatterOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OneResult, ::mlir::OpTrait::OneTypedResult<::mlir::TensorType>::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SelectAndScatterOpAdaptor; + template + using GenericAdaptor = SelectAndScatterOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("padding"), ::llvm::StringRef("window_dimensions"), ::llvm::StringRef("window_strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getWindowDimensionsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getWindowDimensionsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getWindowStridesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getWindowStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.select_and_scatter"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::TypedValue<::mlir::TensorType> getSource(); + ::mlir::TypedValue<::mlir::TensorType> getInitValue(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::OpOperand &getSourceMutable(); + ::mlir::OpOperand &getInitValueMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getSelect(); + ::mlir::Region &getScatter(); + ::mlir::DenseIntElementsAttr getWindowDimensionsAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getWindowDimensions(); + ::mlir::DenseIntElementsAttr getWindowStridesAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getWindowStrides(); + ::mlir::DenseIntElementsAttr getPaddingAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getPadding(); + void setWindowDimensionsAttr(::mlir::DenseIntElementsAttr attr); + void setWindowStridesAttr(::mlir::DenseIntElementsAttr attr); + void setPaddingAttr(::mlir::DenseIntElementsAttr attr); + ::mlir::Attribute removeWindowDimensionsAttr(); + ::mlir::Attribute removeWindowStridesAttr(); + ::mlir::Attribute removePaddingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value operand, ::mlir::Value source, ::mlir::Value init_value, /*optional*/::mlir::DenseIntElementsAttr window_dimensions, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::Value source, ::mlir::Value init_value, /*optional*/::mlir::DenseIntElementsAttr window_dimensions, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value source, ::mlir::Value init_value, /*optional*/::mlir::DenseIntElementsAttr window_dimensions, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::SelectAndScatterOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::SelectOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SelectOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SelectOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SelectOpGenericAdaptorBase(SelectOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SelectOpGenericAdaptor : public detail::SelectOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SelectOpGenericAdaptorBase; +public: + SelectOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SelectOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SelectOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SelectOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getPred() { + return (*getODSOperands(0).begin()); + } + + ValueT getOnTrue() { + return (*getODSOperands(1).begin()); + } + + ValueT getOnFalse() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SelectOpAdaptor : public SelectOpGenericAdaptor<::mlir::ValueRange> { +public: + using SelectOpGenericAdaptor::SelectOpGenericAdaptor; + SelectOpAdaptor(SelectOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SelectOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<3>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::hlo::OpTrait::BroadcastingElementwise, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType> { +public: + using Op::Op; + using Op::print; + using Adaptor = SelectOpAdaptor; + template + using GenericAdaptor = SelectOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.select"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getPred(); + ::mlir::TypedValue<::mlir::TensorType> getOnTrue(); + ::mlir::TypedValue<::mlir::TensorType> getOnFalse(); + ::mlir::OpOperand &getPredMutable(); + ::mlir::OpOperand &getOnTrueMutable(); + ::mlir::OpOperand &getOnFalseMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value pred, ::mlir::Value on_true, ::mlir::Value on_false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value pred, ::mlir::Value on_true, ::mlir::Value on_false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value pred, ::mlir::Value on_true, ::mlir::Value on_false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + ::mlir::LogicalResult reifyReturnTypeShapes(::mlir::OpBuilder&builder, ::mlir::ValueRange operands, ::llvm::SmallVectorImpl<::mlir::Value> &reifiedReturnShapes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::SelectOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::SendOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SendOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SendOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SendOpGenericAdaptorBase(SendOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::mhlo::ChannelHandleAttr getChannelHandleAttr(); + ::mlir::mhlo::ChannelHandleAttr getChannelHandle(); + ::mlir::BoolAttr getIsHostTransferAttr(); + bool getIsHostTransfer(); +}; +} // namespace detail +template +class SendOpGenericAdaptor : public detail::SendOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SendOpGenericAdaptorBase; +public: + SendOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SendOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SendOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SendOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + ValueT getToken() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SendOpAdaptor : public SendOpGenericAdaptor<::mlir::ValueRange> { +public: + using SendOpGenericAdaptor::SendOpGenericAdaptor; + SendOpAdaptor(SendOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SendOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::AtLeastNOperands<1>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SendOpAdaptor; + template + using GenericAdaptor = SendOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("channel_handle"), ::llvm::StringRef("is_host_transfer")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getChannelHandleAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getChannelHandleAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getIsHostTransferAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getIsHostTransferAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.send"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Value getToken(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::OpOperand &getTokenMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::mhlo::ChannelHandleAttr getChannelHandleAttr(); + ::mlir::mhlo::ChannelHandleAttr getChannelHandle(); + ::mlir::BoolAttr getIsHostTransferAttr(); + bool getIsHostTransfer(); + void setChannelHandleAttr(::mlir::mhlo::ChannelHandleAttr attr); + void setIsHostTransferAttr(::mlir::BoolAttr attr); + void setIsHostTransfer(::std::optional attrValue); + ::mlir::Attribute removeIsHostTransferAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::ValueRange inputs, ::mlir::Value token, ::mlir::mhlo::ChannelHandleAttr channel_handle, /*optional*/::mlir::BoolAttr is_host_transfer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange inputs, ::mlir::Value token, ::mlir::mhlo::ChannelHandleAttr channel_handle, /*optional*/::mlir::BoolAttr is_host_transfer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::mlir::Value token, ::mlir::mhlo::ChannelHandleAttr channel_handle, /*optional*/::mlir::BoolAttr is_host_transfer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::ValueRange inputs, ::mlir::Value token, ::mlir::mhlo::ChannelHandleAttr channel_handle, /*optional*/bool is_host_transfer = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange inputs, ::mlir::Value token, ::mlir::mhlo::ChannelHandleAttr channel_handle, /*optional*/bool is_host_transfer = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::mlir::Value token, ::mlir::mhlo::ChannelHandleAttr channel_handle, /*optional*/bool is_host_transfer = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::SendOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::SetDimensionSizeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SetDimensionSizeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SetDimensionSizeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SetDimensionSizeOpGenericAdaptorBase(SetDimensionSizeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getDimensionAttr(); + uint64_t getDimension(); +}; +} // namespace detail +template +class SetDimensionSizeOpGenericAdaptor : public detail::SetDimensionSizeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SetDimensionSizeOpGenericAdaptorBase; +public: + SetDimensionSizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SetDimensionSizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SetDimensionSizeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SetDimensionSizeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + ValueT getSize() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SetDimensionSizeOpAdaptor : public SetDimensionSizeOpGenericAdaptor<::mlir::ValueRange> { +public: + using SetDimensionSizeOpGenericAdaptor::SetDimensionSizeOpGenericAdaptor; + SetDimensionSizeOpAdaptor(SetDimensionSizeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SetDimensionSizeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType> { +public: + using Op::Op; + using Op::print; + using Adaptor = SetDimensionSizeOpAdaptor; + template + using GenericAdaptor = SetDimensionSizeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dimension")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDimensionAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDimensionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.set_dimension_size"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::TypedValue<::mlir::TensorType> getSize(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::OpOperand &getSizeMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getDimensionAttr(); + uint64_t getDimension(); + void setDimensionAttr(::mlir::IntegerAttr attr); + void setDimension(uint64_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value operand, ::mlir::Value size, ::mlir::IntegerAttr dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::Value size, ::mlir::IntegerAttr dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value size, ::mlir::IntegerAttr dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value operand, ::mlir::Value size, uint64_t dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::Value size, uint64_t dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value size, uint64_t dimension); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::SetDimensionSizeOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::ShiftLeftOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ShiftLeftOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ShiftLeftOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ShiftLeftOpGenericAdaptorBase(ShiftLeftOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ShiftLeftOpGenericAdaptor : public detail::ShiftLeftOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ShiftLeftOpGenericAdaptorBase; +public: + ShiftLeftOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ShiftLeftOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ShiftLeftOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ShiftLeftOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ShiftLeftOpAdaptor : public ShiftLeftOpGenericAdaptor<::mlir::ValueRange> { +public: + using ShiftLeftOpGenericAdaptor::ShiftLeftOpGenericAdaptor; + ShiftLeftOpAdaptor(ShiftLeftOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ShiftLeftOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::hlo::OpTrait::CompatibleOperandsAndResultType, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::OpTrait::Elementwise> { +public: + using Op::Op; + using Op::print; + using Adaptor = ShiftLeftOpAdaptor; + template + using GenericAdaptor = ShiftLeftOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.shift_left"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLhs(); + ::mlir::TypedValue<::mlir::TensorType> getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + LogicalResult reifyReturnTypeShapes( + OpBuilder& builder, ValueRange operands, + SmallVectorImpl& reifiedReturnShapes) { + return ::mlir::hlo::deriveShapeFromOperand(&builder, getOperation(), + operands.front(), + &reifiedReturnShapes); + } + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::ShiftLeftOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::ShiftRightArithmeticOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ShiftRightArithmeticOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ShiftRightArithmeticOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ShiftRightArithmeticOpGenericAdaptorBase(ShiftRightArithmeticOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ShiftRightArithmeticOpGenericAdaptor : public detail::ShiftRightArithmeticOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ShiftRightArithmeticOpGenericAdaptorBase; +public: + ShiftRightArithmeticOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ShiftRightArithmeticOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ShiftRightArithmeticOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ShiftRightArithmeticOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ShiftRightArithmeticOpAdaptor : public ShiftRightArithmeticOpGenericAdaptor<::mlir::ValueRange> { +public: + using ShiftRightArithmeticOpGenericAdaptor::ShiftRightArithmeticOpGenericAdaptor; + ShiftRightArithmeticOpAdaptor(ShiftRightArithmeticOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ShiftRightArithmeticOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::hlo::OpTrait::CompatibleOperandsAndResultType, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::OpTrait::Elementwise> { +public: + using Op::Op; + using Op::print; + using Adaptor = ShiftRightArithmeticOpAdaptor; + template + using GenericAdaptor = ShiftRightArithmeticOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.shift_right_arithmetic"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLhs(); + ::mlir::TypedValue<::mlir::TensorType> getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + LogicalResult reifyReturnTypeShapes( + OpBuilder& builder, ValueRange operands, + SmallVectorImpl& reifiedReturnShapes) { + return ::mlir::hlo::deriveShapeFromOperand(&builder, getOperation(), + operands.front(), + &reifiedReturnShapes); + } + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::ShiftRightArithmeticOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::ShiftRightLogicalOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ShiftRightLogicalOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ShiftRightLogicalOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ShiftRightLogicalOpGenericAdaptorBase(ShiftRightLogicalOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ShiftRightLogicalOpGenericAdaptor : public detail::ShiftRightLogicalOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ShiftRightLogicalOpGenericAdaptorBase; +public: + ShiftRightLogicalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ShiftRightLogicalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ShiftRightLogicalOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ShiftRightLogicalOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ShiftRightLogicalOpAdaptor : public ShiftRightLogicalOpGenericAdaptor<::mlir::ValueRange> { +public: + using ShiftRightLogicalOpGenericAdaptor::ShiftRightLogicalOpGenericAdaptor; + ShiftRightLogicalOpAdaptor(ShiftRightLogicalOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ShiftRightLogicalOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::hlo::OpTrait::CompatibleOperandsAndResultType, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::OpTrait::Elementwise> { +public: + using Op::Op; + using Op::print; + using Adaptor = ShiftRightLogicalOpAdaptor; + template + using GenericAdaptor = ShiftRightLogicalOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.shift_right_logical"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLhs(); + ::mlir::TypedValue<::mlir::TensorType> getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + LogicalResult reifyReturnTypeShapes( + OpBuilder& builder, ValueRange operands, + SmallVectorImpl& reifiedReturnShapes) { + return ::mlir::hlo::deriveShapeFromOperand(&builder, getOperation(), + operands.front(), + &reifiedReturnShapes); + } + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::ShiftRightLogicalOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::SignOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SignOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SignOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SignOpGenericAdaptorBase(SignOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SignOpGenericAdaptor : public detail::SignOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SignOpGenericAdaptorBase; +public: + SignOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SignOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SignOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SignOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SignOpAdaptor : public SignOpGenericAdaptor<::mlir::ValueRange> { +public: + using SignOpGenericAdaptor::SignOpGenericAdaptor; + SignOpAdaptor(SignOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SignOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::hlo::OpTrait::CompatibleOperandsAndResultType, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::SameOperandsAndResultShape> { +public: + using Op::Op; + using Op::print; + using Adaptor = SignOpAdaptor; + template + using GenericAdaptor = SignOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.sign"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + LogicalResult reifyReturnTypeShapes( + OpBuilder& builder, ValueRange operands, + SmallVectorImpl& reifiedReturnShapes) { + return ::mlir::hlo::deriveShapeFromOperand(&builder, getOperation(), + operands.front(), + &reifiedReturnShapes); + } + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::SignOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::SineOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SineOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SineOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SineOpGenericAdaptorBase(SineOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SineOpGenericAdaptor : public detail::SineOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SineOpGenericAdaptorBase; +public: + SineOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SineOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SineOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SineOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SineOpAdaptor : public SineOpGenericAdaptor<::mlir::ValueRange> { +public: + using SineOpGenericAdaptor::SineOpGenericAdaptor; + SineOpAdaptor(SineOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SineOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::hlo::OpTrait::CompatibleOperandsAndResultType, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::SameOperandsAndResultShape> { +public: + using Op::Op; + using Op::print; + using Adaptor = SineOpAdaptor; + template + using GenericAdaptor = SineOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.sine"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + LogicalResult reifyReturnTypeShapes( + OpBuilder& builder, ValueRange operands, + SmallVectorImpl& reifiedReturnShapes) { + return ::mlir::hlo::deriveShapeFromOperand(&builder, getOperation(), + operands.front(), + &reifiedReturnShapes); + } + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::SineOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::SliceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SliceOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SliceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SliceOpGenericAdaptorBase(SliceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getStartIndicesAttr(); + ::mlir::DenseIntElementsAttr getStartIndices(); + ::mlir::DenseIntElementsAttr getLimitIndicesAttr(); + ::mlir::DenseIntElementsAttr getLimitIndices(); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); +}; +} // namespace detail +template +class SliceOpGenericAdaptor : public detail::SliceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SliceOpGenericAdaptorBase; +public: + SliceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SliceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SliceOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SliceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SliceOpAdaptor : public SliceOpGenericAdaptor<::mlir::ValueRange> { +public: + using SliceOpGenericAdaptor::SliceOpGenericAdaptor; + SliceOpAdaptor(SliceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SliceOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultElementType, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SliceOpAdaptor; + template + using GenericAdaptor = SliceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("limit_indices"), ::llvm::StringRef("start_indices"), ::llvm::StringRef("strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getLimitIndicesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getLimitIndicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getStartIndicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getStartIndicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.slice"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::DenseIntElementsAttr getStartIndicesAttr(); + ::mlir::DenseIntElementsAttr getStartIndices(); + ::mlir::DenseIntElementsAttr getLimitIndicesAttr(); + ::mlir::DenseIntElementsAttr getLimitIndices(); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + void setStartIndicesAttr(::mlir::DenseIntElementsAttr attr); + void setLimitIndicesAttr(::mlir::DenseIntElementsAttr attr); + void setStridesAttr(::mlir::DenseIntElementsAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value operand, ::mlir::DenseIntElementsAttr start_indices, ::mlir::DenseIntElementsAttr limit_indices, ::mlir::DenseIntElementsAttr strides); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::DenseIntElementsAttr start_indices, ::mlir::DenseIntElementsAttr limit_indices, ::mlir::DenseIntElementsAttr strides); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::DenseIntElementsAttr start_indices, ::mlir::DenseIntElementsAttr limit_indices, ::mlir::DenseIntElementsAttr strides); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::SliceOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::SortOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SortOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SortOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SortOpGenericAdaptorBase(SortOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getDimensionAttr(); + uint64_t getDimension(); + ::mlir::BoolAttr getIsStableAttr(); + bool getIsStable(); + ::mlir::Region &getComparator(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class SortOpGenericAdaptor : public detail::SortOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SortOpGenericAdaptorBase; +public: + SortOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SortOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SortOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SortOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SortOpAdaptor : public SortOpGenericAdaptor<::mlir::ValueRange> { +public: + using SortOpGenericAdaptor::SortOpGenericAdaptor; + SortOpAdaptor(SortOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SortOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = SortOpAdaptor; + template + using GenericAdaptor = SortOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dimension"), ::llvm::StringRef("is_stable")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDimensionAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDimensionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getIsStableAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getIsStableAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.sort"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::MutableOperandRange getInputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getComparator(); + ::mlir::IntegerAttr getDimensionAttr(); + uint64_t getDimension(); + ::mlir::BoolAttr getIsStableAttr(); + bool getIsStable(); + void setDimensionAttr(::mlir::IntegerAttr attr); + void setDimension(::std::optional attrValue); + void setIsStableAttr(::mlir::BoolAttr attr); + void setIsStable(::std::optional attrValue); + ::mlir::Attribute removeDimensionAttr(); + ::mlir::Attribute removeIsStableAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange inputs, int64_t dimension = -1, bool is_stable = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::mlir::ValueRange inputs, /*optional*/::mlir::IntegerAttr dimension, /*optional*/::mlir::BoolAttr is_stable); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange inputs, /*optional*/::mlir::IntegerAttr dimension, /*optional*/::mlir::BoolAttr is_stable); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultType0, ::mlir::ValueRange inputs, /*optional*/uint64_t dimension = -1, /*optional*/bool is_stable = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange inputs, /*optional*/uint64_t dimension = -1, /*optional*/bool is_stable = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::SortOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::SqrtOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SqrtOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SqrtOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SqrtOpGenericAdaptorBase(SqrtOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SqrtOpGenericAdaptor : public detail::SqrtOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SqrtOpGenericAdaptorBase; +public: + SqrtOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SqrtOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SqrtOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SqrtOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SqrtOpAdaptor : public SqrtOpGenericAdaptor<::mlir::ValueRange> { +public: + using SqrtOpGenericAdaptor::SqrtOpGenericAdaptor; + SqrtOpAdaptor(SqrtOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SqrtOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::hlo::OpTrait::CompatibleOperandsAndResultType, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::SameOperandsAndResultShape> { +public: + using Op::Op; + using Op::print; + using Adaptor = SqrtOpAdaptor; + template + using GenericAdaptor = SqrtOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.sqrt"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + LogicalResult reifyReturnTypeShapes( + OpBuilder& builder, ValueRange operands, + SmallVectorImpl& reifiedReturnShapes) { + return ::mlir::hlo::deriveShapeFromOperand(&builder, getOperation(), + operands.front(), + &reifiedReturnShapes); + } + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::SqrtOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::StochasticConvertOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class StochasticConvertOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + StochasticConvertOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + StochasticConvertOpGenericAdaptorBase(StochasticConvertOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class StochasticConvertOpGenericAdaptor : public detail::StochasticConvertOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::StochasticConvertOpGenericAdaptorBase; +public: + StochasticConvertOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + StochasticConvertOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : StochasticConvertOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + StochasticConvertOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + ValueT getRandom() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class StochasticConvertOpAdaptor : public StochasticConvertOpGenericAdaptor<::mlir::ValueRange> { +public: + using StochasticConvertOpGenericAdaptor::StochasticConvertOpGenericAdaptor; + StochasticConvertOpAdaptor(StochasticConvertOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class StochasticConvertOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = StochasticConvertOpAdaptor; + template + using GenericAdaptor = StochasticConvertOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.stochastic_convert"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::TypedValue<::mlir::TensorType> getRandom(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::OpOperand &getRandomMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand, ::mlir::Value random); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value random); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::StochasticConvertOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::SubtractOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SubtractOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SubtractOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SubtractOpGenericAdaptorBase(SubtractOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SubtractOpGenericAdaptor : public detail::SubtractOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SubtractOpGenericAdaptorBase; +public: + SubtractOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SubtractOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SubtractOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SubtractOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SubtractOpAdaptor : public SubtractOpGenericAdaptor<::mlir::ValueRange> { +public: + using SubtractOpGenericAdaptor::SubtractOpGenericAdaptor; + SubtractOpAdaptor(SubtractOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SubtractOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::hlo::OpTrait::CompatibleOperandsAndResultType, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::OpTrait::Elementwise> { +public: + using Op::Op; + using Op::print; + using Adaptor = SubtractOpAdaptor; + template + using GenericAdaptor = SubtractOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.subtract"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLhs(); + ::mlir::TypedValue<::mlir::TensorType> getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + LogicalResult reifyReturnTypeShapes( + OpBuilder& builder, ValueRange operands, + SmallVectorImpl& reifiedReturnShapes) { + return ::mlir::hlo::deriveShapeFromOperand(&builder, getOperation(), + operands.front(), + &reifiedReturnShapes); + } + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::SubtractOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::TanOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TanOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TanOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TanOpGenericAdaptorBase(TanOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TanOpGenericAdaptor : public detail::TanOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TanOpGenericAdaptorBase; +public: + TanOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TanOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TanOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TanOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TanOpAdaptor : public TanOpGenericAdaptor<::mlir::ValueRange> { +public: + using TanOpGenericAdaptor::TanOpGenericAdaptor; + TanOpAdaptor(TanOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TanOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::hlo::OpTrait::CompatibleOperandsAndResultType, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::SameOperandsAndResultShape> { +public: + using Op::Op; + using Op::print; + using Adaptor = TanOpAdaptor; + template + using GenericAdaptor = TanOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.tan"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + LogicalResult reifyReturnTypeShapes( + OpBuilder& builder, ValueRange operands, + SmallVectorImpl& reifiedReturnShapes) { + return ::mlir::hlo::deriveShapeFromOperand(&builder, getOperation(), + operands.front(), + &reifiedReturnShapes); + } + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::TanOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::TanhOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TanhOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TanhOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TanhOpGenericAdaptorBase(TanhOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TanhOpGenericAdaptor : public detail::TanhOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TanhOpGenericAdaptorBase; +public: + TanhOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TanhOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TanhOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TanhOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TanhOpAdaptor : public TanhOpGenericAdaptor<::mlir::ValueRange> { +public: + using TanhOpGenericAdaptor::TanhOpGenericAdaptor; + TanhOpAdaptor(TanhOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TanhOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::hlo::OpTrait::CompatibleOperandsAndResultType, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::SameOperandsAndResultShape> { +public: + using Op::Op; + using Op::print; + using Adaptor = TanhOpAdaptor; + template + using GenericAdaptor = TanhOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.tanh"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + LogicalResult reifyReturnTypeShapes( + OpBuilder& builder, ValueRange operands, + SmallVectorImpl& reifiedReturnShapes) { + return ::mlir::hlo::deriveShapeFromOperand(&builder, getOperation(), + operands.front(), + &reifiedReturnShapes); + } + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::TanhOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::TopKOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TopKOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TopKOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TopKOpGenericAdaptorBase(TopKOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getKAttr(); + uint64_t getK(); + ::mlir::Region &getBody(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class TopKOpGenericAdaptor : public detail::TopKOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TopKOpGenericAdaptorBase; +public: + TopKOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TopKOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TopKOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TopKOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TopKOpAdaptor : public TopKOpGenericAdaptor<::mlir::ValueRange> { +public: + using TopKOpGenericAdaptor::TopKOpGenericAdaptor; + TopKOpAdaptor(TopKOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TopKOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TopKOpAdaptor; + template + using GenericAdaptor = TopKOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("k")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getKAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getKAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + void getAsmResultNames(::mlir::OpAsmSetValueNameFn setNameFn); + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.topk"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getValues(); + ::mlir::TypedValue<::mlir::TensorType> getIndices(); + ::mlir::Region &getBody(); + ::mlir::IntegerAttr getKAttr(); + uint64_t getK(); + void setKAttr(::mlir::IntegerAttr attr); + void setK(uint64_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type values, ::mlir::Type indices, ::mlir::Value operand, ::mlir::IntegerAttr k); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::IntegerAttr k); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::IntegerAttr k); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type values, ::mlir::Type indices, ::mlir::Value operand, uint64_t k); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, uint64_t k); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, uint64_t k); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::TopKOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::TorchIndexSelectOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TorchIndexSelectOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TorchIndexSelectOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TorchIndexSelectOpGenericAdaptorBase(TorchIndexSelectOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getDimAttr(); + uint64_t getDim(); + ::mlir::IntegerAttr getBatchDimsAttr(); + uint64_t getBatchDims(); +}; +} // namespace detail +template +class TorchIndexSelectOpGenericAdaptor : public detail::TorchIndexSelectOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TorchIndexSelectOpGenericAdaptorBase; +public: + TorchIndexSelectOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TorchIndexSelectOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TorchIndexSelectOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TorchIndexSelectOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + ValueT getIndex() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TorchIndexSelectOpAdaptor : public TorchIndexSelectOpGenericAdaptor<::mlir::ValueRange> { +public: + using TorchIndexSelectOpGenericAdaptor::TorchIndexSelectOpGenericAdaptor; + TorchIndexSelectOpAdaptor(TorchIndexSelectOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TorchIndexSelectOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TorchIndexSelectOpAdaptor; + template + using GenericAdaptor = TorchIndexSelectOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("batch_dims"), ::llvm::StringRef("dim")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBatchDimsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBatchDimsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDimAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDimAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.torch_index_select"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::TypedValue<::mlir::TensorType> getIndex(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::OpOperand &getIndexMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getDimAttr(); + uint64_t getDim(); + ::mlir::IntegerAttr getBatchDimsAttr(); + uint64_t getBatchDims(); + void setDimAttr(::mlir::IntegerAttr attr); + void setDim(uint64_t attrValue); + void setBatchDimsAttr(::mlir::IntegerAttr attr); + void setBatchDims(uint64_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value operand, ::mlir::Value index, ::mlir::IntegerAttr dim, ::mlir::IntegerAttr batch_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value index, ::mlir::IntegerAttr dim, ::mlir::IntegerAttr batch_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value operand, ::mlir::Value index, uint64_t dim, uint64_t batch_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value index, uint64_t dim, uint64_t batch_dims); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::TorchIndexSelectOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::TraceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TraceOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TraceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TraceOpGenericAdaptorBase(TraceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getTagAttr(); + ::llvm::StringRef getTag(); +}; +} // namespace detail +template +class TraceOpGenericAdaptor : public detail::TraceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TraceOpGenericAdaptorBase; +public: + TraceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TraceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TraceOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TraceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TraceOpAdaptor : public TraceOpGenericAdaptor<::mlir::ValueRange> { +public: + using TraceOpGenericAdaptor::TraceOpGenericAdaptor; + TraceOpAdaptor(TraceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TraceOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = TraceOpAdaptor; + template + using GenericAdaptor = TraceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("tag")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTagAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTagAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.trace"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::StringAttr getTagAttr(); + ::llvm::StringRef getTag(); + void setTagAttr(::mlir::StringAttr attr); + void setTag(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::StringAttr tag); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::StringAttr tag); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::llvm::StringRef tag); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::llvm::StringRef tag); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::TraceOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::TransposeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TransposeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TransposeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TransposeOpGenericAdaptorBase(TransposeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getPermutationAttr(); + ::mlir::DenseIntElementsAttr getPermutation(); +}; +} // namespace detail +template +class TransposeOpGenericAdaptor : public detail::TransposeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TransposeOpGenericAdaptorBase; +public: + TransposeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TransposeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TransposeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TransposeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TransposeOpAdaptor : public TransposeOpGenericAdaptor<::mlir::ValueRange> { +public: + using TransposeOpGenericAdaptor::TransposeOpGenericAdaptor; + TransposeOpAdaptor(TransposeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TransposeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::hlo::OpTrait::CompatibleOperandsAndResultElementType, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TransposeOpAdaptor; + template + using GenericAdaptor = TransposeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("permutation")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getPermutationAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getPermutationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.transpose"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::DenseIntElementsAttr getPermutationAttr(); + ::mlir::DenseIntElementsAttr getPermutation(); + void setPermutationAttr(::mlir::DenseIntElementsAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value operand, ::mlir::DenseIntElementsAttr permutation); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::DenseIntElementsAttr permutation); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::DenseIntElementsAttr permutation); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + ::mlir::LogicalResult reifyReturnTypeShapes(::mlir::OpBuilder&builder, ::mlir::ValueRange operands, ::llvm::SmallVectorImpl<::mlir::Value> &reifiedReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::TransposeOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::TriangularSolveOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TriangularSolveOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TriangularSolveOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TriangularSolveOpGenericAdaptorBase(TriangularSolveOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getLeftSideAttr(); + bool getLeftSide(); + ::mlir::BoolAttr getLowerAttr(); + bool getLower(); + ::mlir::BoolAttr getUnitDiagonalAttr(); + bool getUnitDiagonal(); + ::mlir::mhlo::TransposeAttr getTransposeAAttr(); + ::mlir::mhlo::Transpose getTransposeA(); +}; +} // namespace detail +template +class TriangularSolveOpGenericAdaptor : public detail::TriangularSolveOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TriangularSolveOpGenericAdaptorBase; +public: + TriangularSolveOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TriangularSolveOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TriangularSolveOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TriangularSolveOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + ValueT getB() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TriangularSolveOpAdaptor : public TriangularSolveOpGenericAdaptor<::mlir::ValueRange> { +public: + using TriangularSolveOpGenericAdaptor::TriangularSolveOpGenericAdaptor; + TriangularSolveOpAdaptor(TriangularSolveOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TriangularSolveOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultElementType, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType> { +public: + using Op::Op; + using Op::print; + using Adaptor = TriangularSolveOpAdaptor; + template + using GenericAdaptor = TriangularSolveOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("left_side"), ::llvm::StringRef("lower"), ::llvm::StringRef("transpose_a"), ::llvm::StringRef("unit_diagonal")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getLeftSideAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getLeftSideAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getLowerAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getLowerAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getTransposeAAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getTransposeAAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getUnitDiagonalAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getUnitDiagonalAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.triangular_solve"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getA(); + ::mlir::TypedValue<::mlir::TensorType> getB(); + ::mlir::OpOperand &getAMutable(); + ::mlir::OpOperand &getBMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::BoolAttr getLeftSideAttr(); + bool getLeftSide(); + ::mlir::BoolAttr getLowerAttr(); + bool getLower(); + ::mlir::BoolAttr getUnitDiagonalAttr(); + bool getUnitDiagonal(); + ::mlir::mhlo::TransposeAttr getTransposeAAttr(); + ::mlir::mhlo::Transpose getTransposeA(); + void setLeftSideAttr(::mlir::BoolAttr attr); + void setLeftSide(bool attrValue); + void setLowerAttr(::mlir::BoolAttr attr); + void setLower(bool attrValue); + void setUnitDiagonalAttr(::mlir::BoolAttr attr); + void setUnitDiagonal(bool attrValue); + void setTransposeAAttr(::mlir::mhlo::TransposeAttr attr); + void setTransposeA(::mlir::mhlo::Transpose attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value a, ::mlir::Value b, ::mlir::BoolAttr left_side, ::mlir::BoolAttr lower, ::mlir::BoolAttr unit_diagonal, ::mlir::mhlo::TransposeAttr transpose_a); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, ::mlir::BoolAttr left_side, ::mlir::BoolAttr lower, ::mlir::BoolAttr unit_diagonal, ::mlir::mhlo::TransposeAttr transpose_a); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::BoolAttr left_side, ::mlir::BoolAttr lower, ::mlir::BoolAttr unit_diagonal, ::mlir::mhlo::TransposeAttr transpose_a); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value a, ::mlir::Value b, bool left_side, bool lower, bool unit_diagonal, ::mlir::mhlo::Transpose transpose_a); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, bool left_side, bool lower, bool unit_diagonal, ::mlir::mhlo::Transpose transpose_a); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, bool left_side, bool lower, bool unit_diagonal, ::mlir::mhlo::Transpose transpose_a); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 4 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::TriangularSolveOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::TupleOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TupleOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TupleOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TupleOpGenericAdaptorBase(TupleOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TupleOpGenericAdaptor : public detail::TupleOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TupleOpGenericAdaptorBase; +public: + TupleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TupleOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TupleOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TupleOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getVal() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TupleOpAdaptor : public TupleOpGenericAdaptor<::mlir::ValueRange> { +public: + using TupleOpGenericAdaptor::TupleOpGenericAdaptor; + TupleOpAdaptor(TupleOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TupleOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TupleOpAdaptor; + template + using GenericAdaptor = TupleOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.tuple"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getVal(); + ::mlir::MutableOperandRange getValMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::ValueRange val); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::TupleOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::UnaryEinsumOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class UnaryEinsumOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + UnaryEinsumOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + UnaryEinsumOpGenericAdaptorBase(UnaryEinsumOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getEinsumConfigAttr(); + ::llvm::StringRef getEinsumConfig(); +}; +} // namespace detail +template +class UnaryEinsumOpGenericAdaptor : public detail::UnaryEinsumOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::UnaryEinsumOpGenericAdaptorBase; +public: + UnaryEinsumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + UnaryEinsumOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : UnaryEinsumOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + UnaryEinsumOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class UnaryEinsumOpAdaptor : public UnaryEinsumOpGenericAdaptor<::mlir::ValueRange> { +public: + using UnaryEinsumOpGenericAdaptor::UnaryEinsumOpGenericAdaptor; + UnaryEinsumOpAdaptor(UnaryEinsumOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class UnaryEinsumOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = UnaryEinsumOpAdaptor; + template + using GenericAdaptor = UnaryEinsumOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("einsum_config")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getEinsumConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getEinsumConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.unary_einsum"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::StringAttr getEinsumConfigAttr(); + ::llvm::StringRef getEinsumConfig(); + void setEinsumConfigAttr(::mlir::StringAttr attr); + void setEinsumConfig(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value operand, ::mlir::StringAttr einsum_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::StringAttr einsum_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::Value operand, ::llvm::StringRef einsum_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::llvm::StringRef einsum_config); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::UnaryEinsumOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::UniformDequantizeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class UniformDequantizeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + UniformDequantizeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + UniformDequantizeOpGenericAdaptorBase(UniformDequantizeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class UniformDequantizeOpGenericAdaptor : public detail::UniformDequantizeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::UniformDequantizeOpGenericAdaptorBase; +public: + UniformDequantizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + UniformDequantizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : UniformDequantizeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + UniformDequantizeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class UniformDequantizeOpAdaptor : public UniformDequantizeOpGenericAdaptor<::mlir::ValueRange> { +public: + using UniformDequantizeOpGenericAdaptor::UniformDequantizeOpGenericAdaptor; + UniformDequantizeOpAdaptor(UniformDequantizeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class UniformDequantizeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::InferTensorType, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::OpTrait::SameOperandsAndResultShape> { +public: + using Op::Op; + using Op::print; + using Adaptor = UniformDequantizeOpAdaptor; + template + using GenericAdaptor = UniformDequantizeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.uniform_dequantize"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + LogicalResult reifyReturnTypeShapes( + OpBuilder& builder, ValueRange operands, + SmallVectorImpl& reifiedReturnShapes) { + return ::mlir::hlo::deriveShapeFromOperand(&builder, getOperation(), + operands.front(), + &reifiedReturnShapes); + } + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::UniformDequantizeOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::UniformQuantizeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class UniformQuantizeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + UniformQuantizeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + UniformQuantizeOpGenericAdaptorBase(UniformQuantizeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class UniformQuantizeOpGenericAdaptor : public detail::UniformQuantizeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::UniformQuantizeOpGenericAdaptorBase; +public: + UniformQuantizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + UniformQuantizeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : UniformQuantizeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + UniformQuantizeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class UniformQuantizeOpAdaptor : public UniformQuantizeOpGenericAdaptor<::mlir::ValueRange> { +public: + using UniformQuantizeOpGenericAdaptor::UniformQuantizeOpGenericAdaptor; + UniformQuantizeOpAdaptor(UniformQuantizeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class UniformQuantizeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::OneOperand, ::mlir::OpTrait::OpInvariants, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::Elementwise, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::OpTrait::SameOperandsAndResultShape> { +public: + using Op::Op; + using Op::print; + using Adaptor = UniformQuantizeOpAdaptor; + template + using GenericAdaptor = UniformQuantizeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.uniform_quantize"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getOperand(); + ::mlir::OpOperand &getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value operand); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + LogicalResult reifyReturnTypeShapes( + OpBuilder& builder, ValueRange operands, + SmallVectorImpl& reifiedReturnShapes) { + return ::mlir::hlo::deriveShapeFromOperand(&builder, getOperation(), + operands.front(), + &reifiedReturnShapes); + } + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::UniformQuantizeOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::WhileOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class WhileOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + WhileOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + WhileOpGenericAdaptorBase(WhileOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Region &getCond(); + ::mlir::Region &getBody(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class WhileOpGenericAdaptor : public detail::WhileOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::WhileOpGenericAdaptorBase; +public: + WhileOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + WhileOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : WhileOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + WhileOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperand() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class WhileOpAdaptor : public WhileOpGenericAdaptor<::mlir::ValueRange> { +public: + using WhileOpGenericAdaptor::WhileOpGenericAdaptor; + WhileOpAdaptor(WhileOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class WhileOp : public ::mlir::Op::Impl, ::mlir::OpTrait::VariadicResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::SingleBlock, ::mlir::OpTrait::SingleBlockImplicitTerminator::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::HasRecursiveMemoryEffects, ::mlir::InferTypeOpInterface::Trait, ::mlir::OpAsmOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = WhileOpAdaptor; + template + using GenericAdaptor = WhileOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.while"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getOperand(); + ::mlir::MutableOperandRange getOperandMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getCond(); + ::mlir::Region &getBody(); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &p); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + ::mlir::LogicalResult fold(FoldAdaptor adaptor, ::llvm::SmallVectorImpl<::mlir::OpFoldResult> &results); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); +public: + // Method of OpAsmOpInterface used during custom printing to name the block + // arguments in the nested regions. We name both the condition and the body + // regions entry arguments the same way, with a `iterArg` prefix. Since the + // two regions are side-by-side they will have the same name, which allows + // us to print them once and share it for the two regions, and still be able + // to parse them back. + void getAsmBlockArgumentNames(Region ®ion, OpAsmSetValueNameFn setNameFn) { + for (BlockArgument arg : region.getArguments()) + setNameFn(arg, "iterArg"); + } + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::WhileOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::XlaRngGetAndUpdateStateOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XlaRngGetAndUpdateStateOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XlaRngGetAndUpdateStateOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XlaRngGetAndUpdateStateOpGenericAdaptorBase(XlaRngGetAndUpdateStateOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getDeltaAttr(); + uint64_t getDelta(); +}; +} // namespace detail +template +class XlaRngGetAndUpdateStateOpGenericAdaptor : public detail::XlaRngGetAndUpdateStateOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XlaRngGetAndUpdateStateOpGenericAdaptorBase; +public: + XlaRngGetAndUpdateStateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XlaRngGetAndUpdateStateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XlaRngGetAndUpdateStateOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XlaRngGetAndUpdateStateOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XlaRngGetAndUpdateStateOpAdaptor : public XlaRngGetAndUpdateStateOpGenericAdaptor<::mlir::ValueRange> { +public: + using XlaRngGetAndUpdateStateOpGenericAdaptor::XlaRngGetAndUpdateStateOpGenericAdaptor; + XlaRngGetAndUpdateStateOpAdaptor(XlaRngGetAndUpdateStateOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XlaRngGetAndUpdateStateOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::ZeroOperands, ::mlir::OpTrait::OpInvariants, ::mlir::InferTypeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = XlaRngGetAndUpdateStateOpAdaptor; + template + using GenericAdaptor = XlaRngGetAndUpdateStateOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("delta")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDeltaAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDeltaAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.xla.rng_get_and_update_state"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getDeltaAttr(); + uint64_t getDelta(); + void setDeltaAttr(::mlir::IntegerAttr attr); + void setDelta(uint64_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, ::mlir::IntegerAttr delta); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::IntegerAttr delta); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr delta); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type resultType0, uint64_t delta); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, uint64_t delta); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, uint64_t delta); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + static ::mlir::LogicalResult inferReturnTypes(::mlir::MLIRContext *context, ::std::optional<::mlir::Location> location, ::mlir::ValueRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::Type>&inferredReturnTypes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + // Relax the strict default implementation with one that allows + // for StableHLO-specific differences. + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::XlaRngGetAndUpdateStateOp) + +namespace mlir { +namespace mhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::mhlo::XorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XorOpGenericAdaptorBase(XorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class XorOpGenericAdaptor : public detail::XorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XorOpGenericAdaptorBase; +public: + XorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XorOpAdaptor : public XorOpGenericAdaptor<::mlir::ValueRange> { +public: + using XorOpGenericAdaptor::XorOpGenericAdaptor; + XorOpAdaptor(XorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::OpTrait::IsCommutative, ::mlir::ConditionallySpeculatable::Trait, ::mlir::OpTrait::AlwaysSpeculatableImplTrait, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::InferTypeOpInterface::Trait, ::mlir::InferShapedTypeOpInterface::Trait, ::mlir::hlo::OpTrait::CompatibleOperandsAndResultType, ::mlir::OpTrait::SameOperandsAndResultShape, ::mlir::OpTrait::Elementwise> { +public: + using Op::Op; + using Op::print; + using Adaptor = XorOpAdaptor; + template + using GenericAdaptor = XorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("mhlo.xor"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getLhs(); + ::mlir::TypedValue<::mlir::TensorType> getRhs(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::TypedValue<::mlir::TensorType> getResult(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type result, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::OpFoldResult fold(FoldAdaptor adaptor); + static ::mlir::LogicalResult inferReturnTypeComponents(::mlir::MLIRContext*context, ::std::optional<::mlir::Location> location, ::mlir::ValueShapeRange operands, ::mlir::DictionaryAttr attributes, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions, ::llvm::SmallVectorImpl<::mlir::ShapedTypeComponents>&inferredReturnShapes); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + LogicalResult reifyReturnTypeShapes( + OpBuilder& builder, ValueRange operands, + SmallVectorImpl& reifiedReturnShapes) { + return ::mlir::hlo::deriveShapeFromOperand(&builder, getOperation(), + operands.front(), + &reifiedReturnShapes); + } + static bool isCompatibleReturnTypes(TypeRange l, TypeRange r) { + return mlir::hlo::isCompatibleForHloTypeInference(l, r); + } +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::XorOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/hlo_ops_typedefs_inc_gen/mhlo/IR/hlo_ops_typedefs.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/hlo_ops_typedefs_inc_gen/mhlo/IR/hlo_ops_typedefs.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..ea820363296ca46eff7a03a83c663c9731bcd256 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/hlo_ops_typedefs_inc_gen/mhlo/IR/hlo_ops_typedefs.h.inc @@ -0,0 +1,59 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* TypeDef Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_TYPEDEF_CLASSES +#undef GET_TYPEDEF_CLASSES + + +namespace mlir { +class AsmParser; +class AsmPrinter; +} // namespace mlir +namespace mlir { +namespace mhlo { +class AsyncBundleType; +class AsyncBundleType : public ::mlir::Type::TypeBase { +public: + using Base::Base; + // Return the number of held types. + size_t size() const; + + // Iterate over the held elements. + using iterator = ArrayRef::iterator; + iterator begin() const { return getTypes().begin(); } + iterator end() const { return getTypes().end(); } + + // Return the element type at index 'index'. + Type getType(size_t index) const { + assert(index < size() && "invalid index for tuple type"); + return getTypes()[index]; + } + + // Puts a flattened list of types in this bundle into `types` + void getFlattenedTypes(SmallVectorImpl &types); + static SmallVector getFlattenedTypes(AsyncBundleType t) { + SmallVector fTypes; + t.getFlattenedTypes(fTypes); + return fTypes; + } + + static AsyncBundleType get(::mlir::MLIRContext *context, ::llvm::ArrayRef types); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"async_bundle"}; + } + + static ::mlir::Type parse(::mlir::AsmParser &odsParser); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::llvm::ArrayRef getTypes() const; +}; +} // namespace mhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::mhlo::AsyncBundleType) + +#endif // GET_TYPEDEF_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/legalize_to_linalg_utils/mhlo/utils/legalize_to_linalg_utils.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/legalize_to_linalg_utils/mhlo/utils/legalize_to_linalg_utils.h new file mode 100644 index 0000000000000000000000000000000000000000..218d3c084869d2dad9e624e69389f3428b20c019 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/legalize_to_linalg_utils/mhlo/utils/legalize_to_linalg_utils.h @@ -0,0 +1,189 @@ +/* Copyright 2022 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +// This file supports the lowering of CHLO/HLO/LHLO dialect to Linalg dialect. + +#ifndef MLIR_HLO_DIALECT_MHLO_TRANSFORMS_LEGALIZE_TO_LINALG_UTILS_H_ +#define MLIR_HLO_DIALECT_MHLO_TRANSFORMS_LEGALIZE_TO_LINALG_UTILS_H_ + +#include +#include +#include +#include +#include + +#include "llvm/ADT/STLExtras.h" +#include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/StringSet.h" +#include "mhlo/transforms/map_mhlo_to_scalar_op.h" +#include "mlir/Dialect/Linalg/IR/Linalg.h" +#include "mlir/Dialect/Linalg/Utils/Utils.h" +#include "mlir/Dialect/Tensor/IR/Tensor.h" +#include "mlir/IR/AffineExpr.h" +#include "mlir/IR/Attributes.h" +#include "mlir/IR/Builders.h" +#include "mlir/IR/BuiltinAttributes.h" +#include "mlir/IR/BuiltinTypes.h" +#include "mlir/IR/Location.h" +#include "mlir/IR/MLIRContext.h" +#include "mlir/IR/Operation.h" +#include "mlir/IR/OperationSupport.h" +#include "mlir/IR/TypeUtilities.h" +#include "mlir/Support/LLVM.h" +#include "mlir/Support/LogicalResult.h" +#include "mlir/Transforms/DialectConversion.h" + +namespace mlir { +namespace mhlo { + +/// Returns an ArrayAttr that contains `nLoops` attributes. All the attributes +/// are "parallel" except the last `nReduction` elements, where are "reduction" +/// attributes. +SmallVector getParallelAndReductionIterators( + unsigned nLoops, unsigned nReduction); + +/// Returns an ArrayAttr that contains `nParallelLoops` "parallel" attributes. +SmallVector getNParallelLoopsAttrs( + unsigned nParallelLoops); + +/// Generates an init sparse tensor. +Value getEmptySparseTensor(OpBuilder& b, Location loc, ShapedType type, + ArrayRef dynSizes); + +/// Generates a tensor.empty op. +Value getEmptyTensor(OpBuilder& b, Location loc, ShapedType type, + ArrayRef dynSizes); + +/// Generates an empty tensor for the result of the operation, which could be a +/// dense tensor or a sparse tensor. +Value getEmptyTensorFor(OpBuilder& b, Location loc, ShapedType resultType, + Operation* op, ValueRange operands); + +/// Sparsifies a (block of) operation(s) that cannot be handled directly +/// by the sparse compiler but has well-known semi-ring semantics. +/// +/// This yields something of the following form: +/// +/// %result = sparse_tensor.unary %values[0] +/// present={ +/// ^bb1(%val): +/// ... codegen proceeds here using %val .... +/// sparse_tensor.yield +/// } +/// absent={} +/// linalg.yield %result +Value preSparsify(Operation* op, llvm::SmallVector& values, Type rtp, + OpBuilder* b); + +/// Finalizes sparse semi-ring construction. +Value postSparsify(Operation* op, Value semiring, Value result, OpBuilder* b); + +/// Returns true if all operands are tensors with rank 0. +bool allOperandsAreScalarTensors(Operation* op); + +/// Returns true if parent op is linalg. +bool isInBodyOfLinalgOps(Operation* op); + +/// Converts a HLO operation to a linalg.generic op that contains the +/// corresponding scalar operations. +template +class PointwiseToLinalgConverter : public OpConversionPattern { + public: + using OpConversionPattern::OpConversionPattern; + + LogicalResult matchAndRewrite( + OpTy op, typename OpTy::Adaptor adaptor, + ConversionPatternRewriter& rewriter) const final { + auto loc = op.getLoc(); + // Find maximum rank / number of loops. + auto getRank = [](Value v) { + return v.getType().cast().getRank(); + }; + auto isScalar = [&](Value v) { return getRank(v) == 0; }; + auto it = llvm::find_if_not(adaptor.getOperands(), isScalar); + Value maxRankArg = + it != adaptor.getOperands().end() ? *it : adaptor.getOperands().front(); + int64_t nloops = getRank(maxRankArg); + + // Apply only if all operands are scalar or have the same rank. Some ops, + // like `mhlo.select`, support implicit broadcasting of scalars. + if (!llvm::all_of(adaptor.getOperands(), [&](Value v) { + int64_t r = getRank(v); + return r == 0 || r == nloops; + })) { + return rewriter.notifyMatchFailure( + op, "Operands must be os same rank or scalar."); + } + + // Find result type, if on tensors. + std::optional resultTy; + resultTy = this->typeConverter->convertType(op->getResultTypes().front()) + .template dyn_cast(); + + // Check result type compatibility. + if (!resultTy || !resultTy->hasRank() || resultTy->getRank() != nloops || + !(resultTy->getElementType().isSignlessIntOrFloat() || + resultTy->getElementType().isa())) { + return rewriter.notifyMatchFailure( + op, "mismatched operand/result types or iterator count"); + } + + if (allOperandsAreScalarTensors(op) && isInBodyOfLinalgOps(op)) + return failure(); + + // Find input/output values and types. + ValueRange inputs = adaptor.getOperands(); + Value output = + getEmptyTensorFor(rewriter, loc, *resultTy, op, adaptor.getOperands()); + + // Create indexing maps. + AffineMap scalarMap = AffineMap::get(nloops, 0, rewriter.getContext()); + AffineMap idMap = rewriter.getMultiDimIdentityMap(nloops); + SmallVector maps; + for (Value v : inputs) maps.push_back(isScalar(v) ? scalarMap : idMap); + maps.push_back(idMap); + + // Build `linalg.generic` op. + bool failed = false; + auto linalgOp = rewriter.create( + loc, resultTy ? *resultTy : TypeRange{}, inputs, output, maps, + getNParallelLoopsAttrs(nloops), + [&](OpBuilder& nestedBuilder, Location /*nested_loc*/, + ValueRange args) { + Type innerResultTy = getElementTypeOrSelf(output); + auto argvec = llvm::to_vector<2>(args.take_front(inputs.size())); + auto semiring = preSparsify(op, argvec, innerResultTy, &rewriter); + Value innerResult = mhlo::MhloOpToStdScalarOp::mapOp( + op, innerResultTy, argvec, &rewriter); + if (innerResult == nullptr) { + failed = true; + } else { + innerResult = postSparsify(op, semiring, innerResult, &rewriter); + nestedBuilder.create(loc, innerResult); + } + }, + linalg::getPrunedAttributeList(op)); + if (failed) return failure(); + + rewriter.replaceOp(op, linalgOp->getResults()); + return success(); + } +}; + +} // namespace mhlo + +} // namespace mlir + +#endif // MLIR_HLO_DIALECT_MHLO_TRANSFORMS_LEGALIZE_TO_LINALG_UTILS_H_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/lhlo/lhlo/IR/lhlo_ops.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/lhlo/lhlo/IR/lhlo_ops.h new file mode 100644 index 0000000000000000000000000000000000000000..f5a1f7c013cfa6e3a8312baefe86565dcd8df1a0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/lhlo/lhlo/IR/lhlo_ops.h @@ -0,0 +1,64 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +// This file defines the operations used in the LHLO dialect. + +#ifndef MLIR_HLO_LHLO_IR_LHLO_OPS_H +#define MLIR_HLO_LHLO_IR_LHLO_OPS_H + +#include "lhlo/IR/lhlo_ops_structs.h" +#include "lhlo/IR/lhlo_structured_interface.h" +#include "llvm/ADT/StringRef.h" +#include "mhlo/IR/hlo_ops.h" +#include "mlir/Dialect/Bufferization/IR/Bufferization.h" +#include "mlir/Dialect/Func/IR/FuncOps.h" +#include "mlir/Dialect/MemRef/IR/MemRef.h" +#include "mlir/IR/Attributes.h" +#include "mlir/IR/BuiltinTypes.h" +#include "mlir/IR/Dialect.h" +#include "mlir/IR/Location.h" +#include "mlir/IR/MLIRContext.h" +#include "mlir/IR/OpDefinition.h" +#include "mlir/IR/Operation.h" +#include "mlir/IR/Types.h" +#include "mlir/Interfaces/ControlFlowInterfaces.h" +#include "mlir/Interfaces/CopyOpInterface.h" +#include "mlir/Interfaces/LoopLikeInterface.h" +#include "mlir/Interfaces/SideEffectInterfaces.h" +#include "mlir/Interfaces/ViewLikeInterface.h" + +namespace mlir { +class OpBuilder; +namespace lmhlo { + +class LmhloDialect : public Dialect { + public: + explicit LmhloDialect(MLIRContext *context); + static StringRef getDialectNamespace() { return "lmhlo"; } + + // Parses an attribute registered to this dialect. + Attribute parseAttribute(DialectAsmParser &parser, Type type) const override; + + // Prints an attribute registered to this dialect. + void printAttribute(Attribute attr, DialectAsmPrinter &os) const override; +}; + +} // namespace lmhlo +} // end namespace mlir + +#define GET_OP_CLASSES +#include "lhlo/IR/lhlo_ops.h.inc" + +#endif // MLIR_HLO_LHLO_IR_LHLO_OPS_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/lhlo/lhlo/IR/lhlo_ops_structs.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/lhlo/lhlo/IR/lhlo_ops_structs.h new file mode 100644 index 0000000000000000000000000000000000000000..593249a71eb060bf8d10caabfd29c09f4912e5f2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/lhlo/lhlo/IR/lhlo_ops_structs.h @@ -0,0 +1,30 @@ +/* Copyright 2021 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +// This file defines structures used in LMHLO dialect. + +#ifndef MLIR_HLO_LHLO_IR_LHLO_OPS_STRUCTS_H +#define MLIR_HLO_LHLO_IR_LHLO_OPS_STRUCTS_H + +#include "mlir/IR/BuiltinAttributes.h" +#include "mlir/IR/BuiltinTypes.h" +#include "mlir/IR/Types.h" + +// Order matters, this .inc header is not self-contained, and relies on the +// #includes above. +#define GET_ATTRDEF_CLASSES +#include "lhlo/IR/lhlo_ops_structs.h.inc" + +#endif // MLIR_HLO_LHLO_IR_LHLO_OPS_STRUCTS_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/lhlo/lhlo/utils/lhlo_utils.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/lhlo/lhlo/utils/lhlo_utils.h new file mode 100644 index 0000000000000000000000000000000000000000..007e9ddc7ea19ddc700c7dbbd0a90ed14b80d3c4 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/lhlo/lhlo/utils/lhlo_utils.h @@ -0,0 +1,78 @@ +/* Copyright 2021 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef MLIR_HLO_LHLO_UTILS_LHLO_UTILS_H +#define MLIR_HLO_LHLO_UTILS_LHLO_UTILS_H + +#include + +#include "mhlo/IR/hlo_ops_common.h" +#include "mlir/IR/BuiltinAttributes.h" +#include "mlir/IR/BuiltinTypes.h" +#include "mlir/IR/Types.h" +#include "stablehlo/dialect/TypeInference.h" + +namespace mlir { +namespace lmhlo { + +// TODO(b/236017415): remove when mhlo uses prefix accessor. +namespace accessor_dispatch { +template +auto getOutputs(OpT op, int) -> decltype(op.getOutputs(), ValueRange{}) { + return op.getOutputs(); +} +template +auto getOutputs(OpT op, char) -> decltype(op.results(), ValueRange{}) { + return op.results(); +} + +template +auto getInputs(OpT op, int) -> decltype(op.getInputs(), ValueRange{}) { + return op.getInputs(); +} +template +auto getInputs(OpT op, char) -> decltype(op.operands(), ValueRange{}) { + return op.operands(); +} +} // namespace accessor_dispatch + +template +static LogicalResult verifyAllReduce(OpT op) { + if (failed(hlo::verifyReplicaGroups(op.getLoc(), op.getReplicaGroups(), + /*allGroupsMustHaveSameSize=*/false, + op.getUseGlobalDeviceIds(), + /*expectedGroupSize=*/std::nullopt))) + return failure(); + + // AllReduce has variadic operands and results that have the same size. + // Each member of the operand should have the same type as the corresponding + // member of the result. + for (auto it : llvm::enumerate( + llvm::zip(accessor_dispatch::getInputs(op, 0).getTypes(), + accessor_dispatch::getOutputs(op, 0).getTypes()))) { + Type operandType = std::get<0>(it.value()); + Type resultType = std::get<1>(it.value()); + if (operandType != resultType) + return op.emitOpError("requires operand #") + << it.index() << " (type: " << operandType << ") and result #" + << it.index() << " (type: " << resultType << ") to have same type"; + } + return success(); +} + +} // namespace lmhlo +} // namespace mlir + +#endif // MLIR_HLO_LHLO_UTILS_LHLO_UTILS_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/lhlo_gpu/lhlo_gpu/IR/lhlo_gpu_ops.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/lhlo_gpu/lhlo_gpu/IR/lhlo_gpu_ops.h new file mode 100644 index 0000000000000000000000000000000000000000..75d5f338693d425b376f68f5f04160727b3d2deb --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/lhlo_gpu/lhlo_gpu/IR/lhlo_gpu_ops.h @@ -0,0 +1,45 @@ +/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +// This file defines the operations used in the LHLO dialect. + +#ifndef MLIR_HLO_LHLO_GPU_IR_LHLO_GPU_OPS_H +#define MLIR_HLO_LHLO_GPU_IR_LHLO_GPU_OPS_H + +#include "llvm/ADT/StringRef.h" +#include "mhlo/IR/hlo_ops.h" +#include "mlir/IR/Attributes.h" +#include "mlir/IR/BuiltinTypes.h" +#include "mlir/IR/Dialect.h" +#include "mlir/IR/Location.h" +#include "mlir/IR/MLIRContext.h" +#include "mlir/IR/OpDefinition.h" +#include "mlir/IR/Operation.h" +#include "mlir/IR/Types.h" +#include "mlir/Interfaces/SideEffectInterfaces.h" + +namespace mlir { +class OpBuilder; +} // namespace mlir + +// Include order below matters. +#include "lhlo_gpu/IR/lhlo_gpu_ops_dialect.h.inc" +#include "lhlo_gpu/IR/lhlo_gpu_ops_enums.h.inc" +#define GET_ATTRDEF_CLASSES +#include "lhlo_gpu/IR/lhlo_gpu_ops_attrdefs.h.inc" +#define GET_OP_CLASSES +#include "lhlo_gpu/IR/lhlo_gpu_ops.h.inc" + +#endif // MLIR_HLO_LHLO_GPU_IR_LHLO_GPU_OPS_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/lhlo_gpu_ops_attrdefs_inc_gen/lhlo_gpu/IR/lhlo_gpu_ops_attrdefs.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/lhlo_gpu_ops_attrdefs_inc_gen/lhlo_gpu/IR/lhlo_gpu_ops_attrdefs.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..3da68441223b428e5edc3389d2a3e2080e6ebdcc --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/lhlo_gpu_ops_attrdefs_inc_gen/lhlo_gpu/IR/lhlo_gpu_ops_attrdefs.h.inc @@ -0,0 +1,137 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* AttrDef Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_ATTRDEF_CLASSES +#undef GET_ATTRDEF_CLASSES + + +namespace mlir { +class AsmParser; +class AsmPrinter; +} // namespace mlir +namespace mlir { +namespace lmhlo_gpu { +class ActivationAttr; +class ConvolutionBackendConfigAttr; +class CublasLtMatmulEpilogueAttr; +class FusedMHAAlgorithmConfigAttr; +class FusedMhaBackwardDagSignatureAttr; +class FusedMhaDagSignatureAttr; +namespace detail { +struct ActivationAttrStorage; +} // namespace detail +class ActivationAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static ActivationAttr get(::mlir::MLIRContext *context, ::mlir::lmhlo_gpu::Activation value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"activation"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::lmhlo_gpu::Activation getValue() const; +}; +namespace detail { +struct ConvolutionBackendConfigAttrStorage; +} // namespace detail +class ConvolutionBackendConfigAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static ConvolutionBackendConfigAttr get(::mlir::MLIRContext *context, int64_t algorithm, bool tensor_ops_enabled, ::llvm::ArrayRef knob_ids, ::llvm::ArrayRef knob_values, bool is_cudnn_frontend, bool is_cudnn_reordered_int8, int64_t workspace_size, ::llvm::ArrayRef operand_0_layout, ::llvm::ArrayRef operand_1_layout, ::llvm::ArrayRef result_layout); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"convolution_backend_config"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + int64_t getAlgorithm() const; + bool getTensorOpsEnabled() const; + ::llvm::ArrayRef getKnobIds() const; + ::llvm::ArrayRef getKnobValues() const; + bool getIsCudnnFrontend() const; + bool getIsCudnnReorderedInt8() const; + int64_t getWorkspaceSize() const; + ::llvm::ArrayRef getOperand_0Layout() const; + ::llvm::ArrayRef getOperand_1Layout() const; + ::llvm::ArrayRef getResultLayout() const; +}; +namespace detail { +struct CublasLtMatmulEpilogueAttrStorage; +} // namespace detail +class CublasLtMatmulEpilogueAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static CublasLtMatmulEpilogueAttr get(::mlir::MLIRContext *context, ::mlir::lmhlo_gpu::CublasLtMatmulEpilogue value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"epilogue"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::lmhlo_gpu::CublasLtMatmulEpilogue getValue() const; +}; +namespace detail { +struct FusedMHAAlgorithmConfigAttrStorage; +} // namespace detail +class FusedMHAAlgorithmConfigAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static FusedMHAAlgorithmConfigAttr get(::mlir::MLIRContext *context, int64_t algorithm, ::llvm::ArrayRef knob_ids, ::llvm::ArrayRef knob_values, int64_t workspace_size); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"fHMA_algorithm_config"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + int64_t getAlgorithm() const; + ::llvm::ArrayRef getKnobIds() const; + ::llvm::ArrayRef getKnobValues() const; + int64_t getWorkspaceSize() const; +}; +namespace detail { +struct FusedMhaBackwardDagSignatureAttrStorage; +} // namespace detail +class FusedMhaBackwardDagSignatureAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static FusedMhaBackwardDagSignatureAttr get(::mlir::MLIRContext *context, ::mlir::lmhlo_gpu::FusedMhaBackwardDagSignature value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"fused_mha_backward_dag"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::lmhlo_gpu::FusedMhaBackwardDagSignature getValue() const; +}; +namespace detail { +struct FusedMhaDagSignatureAttrStorage; +} // namespace detail +class FusedMhaDagSignatureAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static FusedMhaDagSignatureAttr get(::mlir::MLIRContext *context, ::mlir::lmhlo_gpu::FusedMhaDagSignature value); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"fused_mha_dag"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + ::mlir::lmhlo_gpu::FusedMhaDagSignature getValue() const; +}; +} // namespace lmhlo_gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo_gpu::ActivationAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo_gpu::CublasLtMatmulEpilogueAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo_gpu::FusedMHAAlgorithmConfigAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo_gpu::FusedMhaBackwardDagSignatureAttr) +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo_gpu::FusedMhaDagSignatureAttr) + +#endif // GET_ATTRDEF_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/lhlo_gpu_ops_dialect_inc_gen/lhlo_gpu/IR/lhlo_gpu_ops_dialect.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/lhlo_gpu_ops_dialect_inc_gen/lhlo_gpu/IR/lhlo_gpu_ops_dialect.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..d6f68d09ec3c84137350c237d9020f5eeaf314cc --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/lhlo_gpu_ops_dialect_inc_gen/lhlo_gpu/IR/lhlo_gpu_ops_dialect.h.inc @@ -0,0 +1,34 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Dialect Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: lhlo_gpu_ops_enums.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace lmhlo_gpu { + +class LmhloGpuDialect : public ::mlir::Dialect { + explicit LmhloGpuDialect(::mlir::MLIRContext *context); + + void initialize(); + friend class ::mlir::MLIRContext; +public: + ~LmhloGpuDialect() override; + static constexpr ::llvm::StringLiteral getDialectNamespace() { + return ::llvm::StringLiteral("lmhlo_gpu"); + } + + /// Parse an attribute registered to this dialect. + ::mlir::Attribute parseAttribute(::mlir::DialectAsmParser &parser, + ::mlir::Type type) const override; + + /// Print an attribute registered to this dialect. + void printAttribute(::mlir::Attribute attr, + ::mlir::DialectAsmPrinter &os) const override; +}; +} // namespace lmhlo_gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo_gpu::LmhloGpuDialect) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/lhlo_gpu_ops_enums_inc_gen/lhlo_gpu/IR/lhlo_gpu_ops_enums.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/lhlo_gpu_ops_enums_inc_gen/lhlo_gpu/IR/lhlo_gpu_ops_enums.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..d7462b53c75db25a25eeb51c0a111ed4a44a4058 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/lhlo_gpu_ops_enums_inc_gen/lhlo_gpu/IR/lhlo_gpu_ops_enums.h.inc @@ -0,0 +1,355 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Enum Utility Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: lhlo_gpu_ops_enums.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace lmhlo_gpu { +// Activation applied with fused convolution +enum class Activation : uint32_t { + None = 0, + Sigmoid = 1, + Tanh = 2, + Relu = 3, + Relu6 = 4, + ReluX = 5, + BandPass = 6, + Elu = 7, + LeakyRelu = 8, +}; + +::std::optional symbolizeActivation(uint32_t); +::llvm::StringRef stringifyActivation(Activation); +::std::optional symbolizeActivation(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForActivation() { + return 8; +} + + +inline ::llvm::StringRef stringifyEnum(Activation enumValue) { + return stringifyActivation(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeActivation(str); +} +} // namespace lmhlo_gpu +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::lmhlo_gpu::Activation, ::mlir::lmhlo_gpu::Activation> { + template + static FailureOr<::mlir::lmhlo_gpu::Activation> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for Activation applied with fused convolution"); + + // Symbolize the keyword. + if (::std::optional<::mlir::lmhlo_gpu::Activation> attr = ::mlir::lmhlo_gpu::symbolizeEnum<::mlir::lmhlo_gpu::Activation>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid Activation applied with fused convolution specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::lmhlo_gpu::Activation value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::lmhlo_gpu::Activation> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::lmhlo_gpu::Activation getEmptyKey() { + return static_cast<::mlir::lmhlo_gpu::Activation>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::lmhlo_gpu::Activation getTombstoneKey() { + return static_cast<::mlir::lmhlo_gpu::Activation>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::lmhlo_gpu::Activation &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::lmhlo_gpu::Activation &lhs, const ::mlir::lmhlo_gpu::Activation &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace lmhlo_gpu { +// Epilogue for cublasLt matmul +enum class CublasLtMatmulEpilogue : uint32_t { + Default = 0, + Bias = 1, + Relu = 2, + BiasRelu = 3, + Gelu = 4, + BiasGelu = 5, + GeluAux = 6, + BiasGeluAux = 7, +}; + +::std::optional symbolizeCublasLtMatmulEpilogue(uint32_t); +::llvm::StringRef stringifyCublasLtMatmulEpilogue(CublasLtMatmulEpilogue); +::std::optional symbolizeCublasLtMatmulEpilogue(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForCublasLtMatmulEpilogue() { + return 7; +} + + +inline ::llvm::StringRef stringifyEnum(CublasLtMatmulEpilogue enumValue) { + return stringifyCublasLtMatmulEpilogue(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeCublasLtMatmulEpilogue(str); +} +} // namespace lmhlo_gpu +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::lmhlo_gpu::CublasLtMatmulEpilogue, ::mlir::lmhlo_gpu::CublasLtMatmulEpilogue> { + template + static FailureOr<::mlir::lmhlo_gpu::CublasLtMatmulEpilogue> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for Epilogue for cublasLt matmul"); + + // Symbolize the keyword. + if (::std::optional<::mlir::lmhlo_gpu::CublasLtMatmulEpilogue> attr = ::mlir::lmhlo_gpu::symbolizeEnum<::mlir::lmhlo_gpu::CublasLtMatmulEpilogue>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid Epilogue for cublasLt matmul specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::lmhlo_gpu::CublasLtMatmulEpilogue value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::lmhlo_gpu::CublasLtMatmulEpilogue> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::lmhlo_gpu::CublasLtMatmulEpilogue getEmptyKey() { + return static_cast<::mlir::lmhlo_gpu::CublasLtMatmulEpilogue>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::lmhlo_gpu::CublasLtMatmulEpilogue getTombstoneKey() { + return static_cast<::mlir::lmhlo_gpu::CublasLtMatmulEpilogue>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::lmhlo_gpu::CublasLtMatmulEpilogue &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::lmhlo_gpu::CublasLtMatmulEpilogue &lhs, const ::mlir::lmhlo_gpu::CublasLtMatmulEpilogue &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace lmhlo_gpu { +// DAG configuration for Fused Multi-Headed Attention Backward +enum class FusedMhaBackwardDagSignature : uint32_t { + BackwardScaleBiasSoftmaxDropout = 0, + BackwardScaleBiasSoftmax = 1, + BackwardScaleBiasMaskSoftmax = 2, + BackwardScaleBiasMaskSoftmaxDropout = 3, +}; + +::std::optional symbolizeFusedMhaBackwardDagSignature(uint32_t); +::llvm::StringRef stringifyFusedMhaBackwardDagSignature(FusedMhaBackwardDagSignature); +::std::optional symbolizeFusedMhaBackwardDagSignature(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForFusedMhaBackwardDagSignature() { + return 3; +} + + +inline ::llvm::StringRef stringifyEnum(FusedMhaBackwardDagSignature enumValue) { + return stringifyFusedMhaBackwardDagSignature(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeFusedMhaBackwardDagSignature(str); +} +} // namespace lmhlo_gpu +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::lmhlo_gpu::FusedMhaBackwardDagSignature, ::mlir::lmhlo_gpu::FusedMhaBackwardDagSignature> { + template + static FailureOr<::mlir::lmhlo_gpu::FusedMhaBackwardDagSignature> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for DAG configuration for Fused Multi-Headed Attention Backward"); + + // Symbolize the keyword. + if (::std::optional<::mlir::lmhlo_gpu::FusedMhaBackwardDagSignature> attr = ::mlir::lmhlo_gpu::symbolizeEnum<::mlir::lmhlo_gpu::FusedMhaBackwardDagSignature>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid DAG configuration for Fused Multi-Headed Attention Backward specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::lmhlo_gpu::FusedMhaBackwardDagSignature value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::lmhlo_gpu::FusedMhaBackwardDagSignature> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::lmhlo_gpu::FusedMhaBackwardDagSignature getEmptyKey() { + return static_cast<::mlir::lmhlo_gpu::FusedMhaBackwardDagSignature>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::lmhlo_gpu::FusedMhaBackwardDagSignature getTombstoneKey() { + return static_cast<::mlir::lmhlo_gpu::FusedMhaBackwardDagSignature>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::lmhlo_gpu::FusedMhaBackwardDagSignature &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::lmhlo_gpu::FusedMhaBackwardDagSignature &lhs, const ::mlir::lmhlo_gpu::FusedMhaBackwardDagSignature &rhs) { + return lhs == rhs; + } +}; +} + +namespace mlir { +namespace lmhlo_gpu { +// DAG configuration for Fused Multi-Headed Attention +enum class FusedMhaDagSignature : uint32_t { + Default = 0, + ScaleBiasMaskSoftmax = 1, + ScaleBiasMaskSoftmaxDropout = 2, + ScaleMaskSoftmax = 3, + ScaleMaskSoftmaxDropout = 4, + SoftmaxDropout = 5, + Softmax = 6, + ScaleBiasSoftmaxDropout = 7, + ScaleBiasSoftmax = 8, +}; + +::std::optional symbolizeFusedMhaDagSignature(uint32_t); +::llvm::StringRef stringifyFusedMhaDagSignature(FusedMhaDagSignature); +::std::optional symbolizeFusedMhaDagSignature(::llvm::StringRef); +inline constexpr unsigned getMaxEnumValForFusedMhaDagSignature() { + return 8; +} + + +inline ::llvm::StringRef stringifyEnum(FusedMhaDagSignature enumValue) { + return stringifyFusedMhaDagSignature(enumValue); +} + +template +::std::optional symbolizeEnum(::llvm::StringRef); + +template <> +inline ::std::optional symbolizeEnum(::llvm::StringRef str) { + return symbolizeFusedMhaDagSignature(str); +} +} // namespace lmhlo_gpu +} // namespace mlir + +namespace mlir { +template +struct FieldParser; + +template<> +struct FieldParser<::mlir::lmhlo_gpu::FusedMhaDagSignature, ::mlir::lmhlo_gpu::FusedMhaDagSignature> { + template + static FailureOr<::mlir::lmhlo_gpu::FusedMhaDagSignature> parse(ParserT &parser) { + // Parse the keyword/string containing the enum. + std::string enumKeyword; + auto loc = parser.getCurrentLocation(); + if (failed(parser.parseOptionalKeywordOrString(&enumKeyword))) + return parser.emitError(loc, "expected keyword for DAG configuration for Fused Multi-Headed Attention"); + + // Symbolize the keyword. + if (::std::optional<::mlir::lmhlo_gpu::FusedMhaDagSignature> attr = ::mlir::lmhlo_gpu::symbolizeEnum<::mlir::lmhlo_gpu::FusedMhaDagSignature>(enumKeyword)) + return *attr; + return parser.emitError(loc, "invalid DAG configuration for Fused Multi-Headed Attention specification: ") << enumKeyword; + } +}; +} // namespace mlir + +namespace llvm { +inline ::llvm::raw_ostream &operator<<(::llvm::raw_ostream &p, ::mlir::lmhlo_gpu::FusedMhaDagSignature value) { + auto valueStr = stringifyEnum(value); + return p << valueStr; +} +} // namespace llvm + +namespace llvm { +template<> struct DenseMapInfo<::mlir::lmhlo_gpu::FusedMhaDagSignature> { + using StorageInfo = ::llvm::DenseMapInfo; + + static inline ::mlir::lmhlo_gpu::FusedMhaDagSignature getEmptyKey() { + return static_cast<::mlir::lmhlo_gpu::FusedMhaDagSignature>(StorageInfo::getEmptyKey()); + } + + static inline ::mlir::lmhlo_gpu::FusedMhaDagSignature getTombstoneKey() { + return static_cast<::mlir::lmhlo_gpu::FusedMhaDagSignature>(StorageInfo::getTombstoneKey()); + } + + static unsigned getHashValue(const ::mlir::lmhlo_gpu::FusedMhaDagSignature &val) { + return StorageInfo::getHashValue(static_cast(val)); + } + + static bool isEqual(const ::mlir::lmhlo_gpu::FusedMhaDagSignature &lhs, const ::mlir::lmhlo_gpu::FusedMhaDagSignature &rhs) { + return lhs == rhs; + } +}; +} + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/lhlo_gpu_ops_inc_gen/lhlo_gpu/IR/lhlo_gpu_ops.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/lhlo_gpu_ops_inc_gen/lhlo_gpu/IR/lhlo_gpu_ops.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..d02e409e79394ed7b757244fd7a27b03b4da45d2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/lhlo_gpu_ops_inc_gen/lhlo_gpu/IR/lhlo_gpu_ops.h.inc @@ -0,0 +1,5153 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: lhlo_gpu_ops.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#if defined(GET_OP_CLASSES) || defined(GET_OP_FWD_DEFINES) +#undef GET_OP_FWD_DEFINES +namespace mlir { +namespace lmhlo_gpu { +class AllGatherDoneOp; +} // namespace lmhlo_gpu +} // namespace mlir +namespace mlir { +namespace lmhlo_gpu { +class AllGatherStartOp; +} // namespace lmhlo_gpu +} // namespace mlir +namespace mlir { +namespace lmhlo_gpu { +class AllReduceDoneOp; +} // namespace lmhlo_gpu +} // namespace mlir +namespace mlir { +namespace lmhlo_gpu { +class AllReduceStartOp; +} // namespace lmhlo_gpu +} // namespace mlir +namespace mlir { +namespace lmhlo_gpu { +class AllToAllDoneOp; +} // namespace lmhlo_gpu +} // namespace mlir +namespace mlir { +namespace lmhlo_gpu { +class AllToAllStartOp; +} // namespace lmhlo_gpu +} // namespace mlir +namespace mlir { +namespace lmhlo_gpu { +class CholeskyOp; +} // namespace lmhlo_gpu +} // namespace mlir +namespace mlir { +namespace lmhlo_gpu { +class CollectivePermuteDoneOp; +} // namespace lmhlo_gpu +} // namespace mlir +namespace mlir { +namespace lmhlo_gpu { +class CollectivePermuteStartOp; +} // namespace lmhlo_gpu +} // namespace mlir +namespace mlir { +namespace lmhlo_gpu { +class ConvBackwardFilterOp; +} // namespace lmhlo_gpu +} // namespace mlir +namespace mlir { +namespace lmhlo_gpu { +class ConvBackwardInputOp; +} // namespace lmhlo_gpu +} // namespace mlir +namespace mlir { +namespace lmhlo_gpu { +class ConvForwardFusedOp; +} // namespace lmhlo_gpu +} // namespace mlir +namespace mlir { +namespace lmhlo_gpu { +class ConvForwardFusedSideInputOp; +} // namespace lmhlo_gpu +} // namespace mlir +namespace mlir { +namespace lmhlo_gpu { +class ConvForwardGraphOp; +} // namespace lmhlo_gpu +} // namespace mlir +namespace mlir { +namespace lmhlo_gpu { +class ConvForwardOp; +} // namespace lmhlo_gpu +} // namespace mlir +namespace mlir { +namespace lmhlo_gpu { +class CublasLtMatmulF8Op; +} // namespace lmhlo_gpu +} // namespace mlir +namespace mlir { +namespace lmhlo_gpu { +class CublasLtMatmulOp; +} // namespace lmhlo_gpu +} // namespace mlir +namespace mlir { +namespace lmhlo_gpu { +class CudnnConvReorderFilterAndBiasOp; +} // namespace lmhlo_gpu +} // namespace mlir +namespace mlir { +namespace lmhlo_gpu { +class CudnnConvReorderFilterOp; +} // namespace lmhlo_gpu +} // namespace mlir +namespace mlir { +namespace lmhlo_gpu { +class GEMMOp; +} // namespace lmhlo_gpu +} // namespace mlir +namespace mlir { +namespace lmhlo_gpu { +class ReduceScatterDoneOp; +} // namespace lmhlo_gpu +} // namespace mlir +namespace mlir { +namespace lmhlo_gpu { +class ReduceScatterStartOp; +} // namespace lmhlo_gpu +} // namespace mlir +namespace mlir { +namespace lmhlo_gpu { +class fusedMHABackwardOp; +} // namespace lmhlo_gpu +} // namespace mlir +namespace mlir { +namespace lmhlo_gpu { +class fusedMHAOp; +} // namespace lmhlo_gpu +} // namespace mlir +#endif + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace lmhlo_gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo_gpu::AllGatherDoneOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AllGatherDoneOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AllGatherDoneOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AllGatherDoneOpGenericAdaptorBase(AllGatherDoneOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AllGatherDoneOpGenericAdaptor : public detail::AllGatherDoneOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AllGatherDoneOpGenericAdaptorBase; +public: + AllGatherDoneOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AllGatherDoneOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AllGatherDoneOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AllGatherDoneOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getToken() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AllGatherDoneOpAdaptor : public AllGatherDoneOpGenericAdaptor<::mlir::ValueRange> { +public: + using AllGatherDoneOpGenericAdaptor::AllGatherDoneOpGenericAdaptor; + AllGatherDoneOpAdaptor(AllGatherDoneOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AllGatherDoneOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = AllGatherDoneOpAdaptor; + template + using GenericAdaptor = AllGatherDoneOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo_gpu.all_gather_done"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getToken(); + ::mlir::OpOperand &getTokenMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value token); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value token); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace lmhlo_gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo_gpu::AllGatherDoneOp) + +namespace mlir { +namespace lmhlo_gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo_gpu::AllGatherStartOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AllGatherStartOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AllGatherStartOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AllGatherStartOpGenericAdaptorBase(AllGatherStartOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getReplicaGroupsAttr(); + ::mlir::DenseIntElementsAttr getReplicaGroups(); + ::mlir::BoolAttr getConstrainLayoutAttr(); + bool getConstrainLayout(); + ::mlir::mhlo::ChannelHandleAttr getChannelIdAttr(); + ::std::optional<::mlir::mhlo::ChannelHandleAttr> getChannelId(); + ::mlir::BoolAttr getUseGlobalDeviceIdsAttr(); + bool getUseGlobalDeviceIds(); + ::mlir::BoolAttr getIsSyncAttr(); + bool getIsSync(); + ::mlir::IntegerAttr getAllGatherDimensionAttr(); + uint64_t getAllGatherDimension(); +}; +} // namespace detail +template +class AllGatherStartOpGenericAdaptor : public detail::AllGatherStartOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AllGatherStartOpGenericAdaptorBase; +public: + AllGatherStartOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AllGatherStartOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AllGatherStartOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AllGatherStartOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AllGatherStartOpAdaptor : public AllGatherStartOpGenericAdaptor<::mlir::ValueRange> { +public: + using AllGatherStartOpGenericAdaptor::AllGatherStartOpGenericAdaptor; + AllGatherStartOpAdaptor(AllGatherStartOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AllGatherStartOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AllGatherStartOpAdaptor; + template + using GenericAdaptor = AllGatherStartOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("all_gather_dimension"), ::llvm::StringRef("channel_id"), ::llvm::StringRef("constrain_layout"), ::llvm::StringRef("is_sync"), ::llvm::StringRef("replica_groups"), ::llvm::StringRef("use_global_device_ids")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAllGatherDimensionAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAllGatherDimensionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getChannelIdAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getChannelIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getConstrainLayoutAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getConstrainLayoutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getIsSyncAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getIsSyncAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getReplicaGroupsAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getReplicaGroupsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getUseGlobalDeviceIdsAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getUseGlobalDeviceIdsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo_gpu.all_gather_start"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getToken(); + ::mlir::DenseIntElementsAttr getReplicaGroupsAttr(); + ::mlir::DenseIntElementsAttr getReplicaGroups(); + ::mlir::BoolAttr getConstrainLayoutAttr(); + bool getConstrainLayout(); + ::mlir::mhlo::ChannelHandleAttr getChannelIdAttr(); + ::std::optional<::mlir::mhlo::ChannelHandleAttr> getChannelId(); + ::mlir::BoolAttr getUseGlobalDeviceIdsAttr(); + bool getUseGlobalDeviceIds(); + ::mlir::BoolAttr getIsSyncAttr(); + bool getIsSync(); + ::mlir::IntegerAttr getAllGatherDimensionAttr(); + uint64_t getAllGatherDimension(); + void setReplicaGroupsAttr(::mlir::DenseIntElementsAttr attr); + void setConstrainLayoutAttr(::mlir::BoolAttr attr); + void setConstrainLayout(::std::optional attrValue); + void setChannelIdAttr(::mlir::mhlo::ChannelHandleAttr attr); + void setUseGlobalDeviceIdsAttr(::mlir::BoolAttr attr); + void setUseGlobalDeviceIds(::std::optional attrValue); + void setIsSyncAttr(::mlir::BoolAttr attr); + void setIsSync(bool attrValue); + void setAllGatherDimensionAttr(::mlir::IntegerAttr attr); + void setAllGatherDimension(uint64_t attrValue); + ::mlir::Attribute removeConstrainLayoutAttr(); + ::mlir::Attribute removeChannelIdAttr(); + ::mlir::Attribute removeUseGlobalDeviceIdsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type token, ::mlir::ValueRange inputs, ::mlir::ValueRange outputs, ::mlir::DenseIntElementsAttr replica_groups, /*optional*/::mlir::BoolAttr constrain_layout, /*optional*/::mlir::mhlo::ChannelHandleAttr channel_id, /*optional*/::mlir::BoolAttr use_global_device_ids, ::mlir::BoolAttr is_sync, ::mlir::IntegerAttr all_gather_dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::mlir::ValueRange outputs, ::mlir::DenseIntElementsAttr replica_groups, /*optional*/::mlir::BoolAttr constrain_layout, /*optional*/::mlir::mhlo::ChannelHandleAttr channel_id, /*optional*/::mlir::BoolAttr use_global_device_ids, ::mlir::BoolAttr is_sync, ::mlir::IntegerAttr all_gather_dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type token, ::mlir::ValueRange inputs, ::mlir::ValueRange outputs, ::mlir::DenseIntElementsAttr replica_groups, /*optional*/bool constrain_layout, /*optional*/::mlir::mhlo::ChannelHandleAttr channel_id, /*optional*/bool use_global_device_ids, bool is_sync, uint64_t all_gather_dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::mlir::ValueRange outputs, ::mlir::DenseIntElementsAttr replica_groups, /*optional*/bool constrain_layout, /*optional*/::mlir::mhlo::ChannelHandleAttr channel_id, /*optional*/bool use_global_device_ids, bool is_sync, uint64_t all_gather_dimension); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo_gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo_gpu::AllGatherStartOp) + +namespace mlir { +namespace lmhlo_gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo_gpu::AllReduceDoneOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AllReduceDoneOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AllReduceDoneOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AllReduceDoneOpGenericAdaptorBase(AllReduceDoneOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AllReduceDoneOpGenericAdaptor : public detail::AllReduceDoneOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AllReduceDoneOpGenericAdaptorBase; +public: + AllReduceDoneOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AllReduceDoneOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AllReduceDoneOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AllReduceDoneOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getToken() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AllReduceDoneOpAdaptor : public AllReduceDoneOpGenericAdaptor<::mlir::ValueRange> { +public: + using AllReduceDoneOpGenericAdaptor::AllReduceDoneOpGenericAdaptor; + AllReduceDoneOpAdaptor(AllReduceDoneOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AllReduceDoneOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = AllReduceDoneOpAdaptor; + template + using GenericAdaptor = AllReduceDoneOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo_gpu.all_reduce_done"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getToken(); + ::mlir::OpOperand &getTokenMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value token); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value token); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace lmhlo_gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo_gpu::AllReduceDoneOp) + +namespace mlir { +namespace lmhlo_gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo_gpu::AllReduceStartOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AllReduceStartOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AllReduceStartOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AllReduceStartOpGenericAdaptorBase(AllReduceStartOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getReplicaGroupsAttr(); + ::mlir::DenseIntElementsAttr getReplicaGroups(); + ::mlir::BoolAttr getConstrainLayoutAttr(); + bool getConstrainLayout(); + ::mlir::mhlo::ChannelHandleAttr getChannelIdAttr(); + ::std::optional<::mlir::mhlo::ChannelHandleAttr> getChannelId(); + ::mlir::BoolAttr getUseGlobalDeviceIdsAttr(); + bool getUseGlobalDeviceIds(); + ::mlir::BoolAttr getIsSyncAttr(); + bool getIsSync(); + ::mlir::Region &getComputation(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class AllReduceStartOpGenericAdaptor : public detail::AllReduceStartOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AllReduceStartOpGenericAdaptorBase; +public: + AllReduceStartOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AllReduceStartOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AllReduceStartOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AllReduceStartOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AllReduceStartOpAdaptor : public AllReduceStartOpGenericAdaptor<::mlir::ValueRange> { +public: + using AllReduceStartOpGenericAdaptor::AllReduceStartOpGenericAdaptor; + AllReduceStartOpAdaptor(AllReduceStartOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AllReduceStartOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsElementType> { +public: + using Op::Op; + using Op::print; + using Adaptor = AllReduceStartOpAdaptor; + template + using GenericAdaptor = AllReduceStartOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("channel_id"), ::llvm::StringRef("constrain_layout"), ::llvm::StringRef("is_sync"), ::llvm::StringRef("replica_groups"), ::llvm::StringRef("use_global_device_ids")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getChannelIdAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getChannelIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getConstrainLayoutAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getConstrainLayoutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getIsSyncAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getIsSyncAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getReplicaGroupsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getReplicaGroupsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getUseGlobalDeviceIdsAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getUseGlobalDeviceIdsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo_gpu.all_reduce_start"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getToken(); + ::mlir::Region &getComputation(); + ::mlir::DenseIntElementsAttr getReplicaGroupsAttr(); + ::mlir::DenseIntElementsAttr getReplicaGroups(); + ::mlir::BoolAttr getConstrainLayoutAttr(); + bool getConstrainLayout(); + ::mlir::mhlo::ChannelHandleAttr getChannelIdAttr(); + ::std::optional<::mlir::mhlo::ChannelHandleAttr> getChannelId(); + ::mlir::BoolAttr getUseGlobalDeviceIdsAttr(); + bool getUseGlobalDeviceIds(); + ::mlir::BoolAttr getIsSyncAttr(); + bool getIsSync(); + void setReplicaGroupsAttr(::mlir::DenseIntElementsAttr attr); + void setConstrainLayoutAttr(::mlir::BoolAttr attr); + void setConstrainLayout(::std::optional attrValue); + void setChannelIdAttr(::mlir::mhlo::ChannelHandleAttr attr); + void setUseGlobalDeviceIdsAttr(::mlir::BoolAttr attr); + void setUseGlobalDeviceIds(::std::optional attrValue); + void setIsSyncAttr(::mlir::BoolAttr attr); + void setIsSync(bool attrValue); + ::mlir::Attribute removeConstrainLayoutAttr(); + ::mlir::Attribute removeChannelIdAttr(); + ::mlir::Attribute removeUseGlobalDeviceIdsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type token, ::mlir::ValueRange inputs, ::mlir::ValueRange outputs, ::mlir::DenseIntElementsAttr replica_groups, /*optional*/::mlir::BoolAttr constrain_layout, /*optional*/::mlir::mhlo::ChannelHandleAttr channel_id, /*optional*/::mlir::BoolAttr use_global_device_ids, ::mlir::BoolAttr is_sync); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::mlir::ValueRange outputs, ::mlir::DenseIntElementsAttr replica_groups, /*optional*/::mlir::BoolAttr constrain_layout, /*optional*/::mlir::mhlo::ChannelHandleAttr channel_id, /*optional*/::mlir::BoolAttr use_global_device_ids, ::mlir::BoolAttr is_sync); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type token, ::mlir::ValueRange inputs, ::mlir::ValueRange outputs, ::mlir::DenseIntElementsAttr replica_groups, /*optional*/bool constrain_layout, /*optional*/::mlir::mhlo::ChannelHandleAttr channel_id, /*optional*/bool use_global_device_ids, bool is_sync); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::mlir::ValueRange outputs, ::mlir::DenseIntElementsAttr replica_groups, /*optional*/bool constrain_layout, /*optional*/::mlir::mhlo::ChannelHandleAttr channel_id, /*optional*/bool use_global_device_ids, bool is_sync); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo_gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo_gpu::AllReduceStartOp) + +namespace mlir { +namespace lmhlo_gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo_gpu::AllToAllDoneOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AllToAllDoneOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AllToAllDoneOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AllToAllDoneOpGenericAdaptorBase(AllToAllDoneOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AllToAllDoneOpGenericAdaptor : public detail::AllToAllDoneOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AllToAllDoneOpGenericAdaptorBase; +public: + AllToAllDoneOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AllToAllDoneOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AllToAllDoneOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AllToAllDoneOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getToken() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AllToAllDoneOpAdaptor : public AllToAllDoneOpGenericAdaptor<::mlir::ValueRange> { +public: + using AllToAllDoneOpGenericAdaptor::AllToAllDoneOpGenericAdaptor; + AllToAllDoneOpAdaptor(AllToAllDoneOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AllToAllDoneOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = AllToAllDoneOpAdaptor; + template + using GenericAdaptor = AllToAllDoneOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo_gpu.all_to_all_done"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getToken(); + ::mlir::OpOperand &getTokenMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value token); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value token); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace lmhlo_gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo_gpu::AllToAllDoneOp) + +namespace mlir { +namespace lmhlo_gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo_gpu::AllToAllStartOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AllToAllStartOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AllToAllStartOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AllToAllStartOpGenericAdaptorBase(AllToAllStartOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getReplicaGroupsAttr(); + ::mlir::DenseIntElementsAttr getReplicaGroups(); + ::mlir::BoolAttr getConstrainLayoutAttr(); + bool getConstrainLayout(); + ::mlir::mhlo::ChannelHandleAttr getChannelIdAttr(); + ::std::optional<::mlir::mhlo::ChannelHandleAttr> getChannelId(); + ::mlir::BoolAttr getUseGlobalDeviceIdsAttr(); + bool getUseGlobalDeviceIds(); + ::mlir::BoolAttr getIsSyncAttr(); + bool getIsSync(); + ::mlir::IntegerAttr getSplitDimensionAttr(); + ::std::optional getSplitDimension(); +}; +} // namespace detail +template +class AllToAllStartOpGenericAdaptor : public detail::AllToAllStartOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AllToAllStartOpGenericAdaptorBase; +public: + AllToAllStartOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AllToAllStartOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AllToAllStartOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AllToAllStartOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AllToAllStartOpAdaptor : public AllToAllStartOpGenericAdaptor<::mlir::ValueRange> { +public: + using AllToAllStartOpGenericAdaptor::AllToAllStartOpGenericAdaptor; + AllToAllStartOpAdaptor(AllToAllStartOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AllToAllStartOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsElementType> { +public: + using Op::Op; + using Op::print; + using Adaptor = AllToAllStartOpAdaptor; + template + using GenericAdaptor = AllToAllStartOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("channel_id"), ::llvm::StringRef("constrain_layout"), ::llvm::StringRef("is_sync"), ::llvm::StringRef("replica_groups"), ::llvm::StringRef("split_dimension"), ::llvm::StringRef("use_global_device_ids")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getChannelIdAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getChannelIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getConstrainLayoutAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getConstrainLayoutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getIsSyncAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getIsSyncAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getReplicaGroupsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getReplicaGroupsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getSplitDimensionAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getSplitDimensionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getUseGlobalDeviceIdsAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getUseGlobalDeviceIdsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo_gpu.all_to_all_start"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getToken(); + ::mlir::DenseIntElementsAttr getReplicaGroupsAttr(); + ::mlir::DenseIntElementsAttr getReplicaGroups(); + ::mlir::BoolAttr getConstrainLayoutAttr(); + bool getConstrainLayout(); + ::mlir::mhlo::ChannelHandleAttr getChannelIdAttr(); + ::std::optional<::mlir::mhlo::ChannelHandleAttr> getChannelId(); + ::mlir::BoolAttr getUseGlobalDeviceIdsAttr(); + bool getUseGlobalDeviceIds(); + ::mlir::BoolAttr getIsSyncAttr(); + bool getIsSync(); + ::mlir::IntegerAttr getSplitDimensionAttr(); + ::std::optional getSplitDimension(); + void setReplicaGroupsAttr(::mlir::DenseIntElementsAttr attr); + void setConstrainLayoutAttr(::mlir::BoolAttr attr); + void setConstrainLayout(::std::optional attrValue); + void setChannelIdAttr(::mlir::mhlo::ChannelHandleAttr attr); + void setUseGlobalDeviceIdsAttr(::mlir::BoolAttr attr); + void setUseGlobalDeviceIds(::std::optional attrValue); + void setIsSyncAttr(::mlir::BoolAttr attr); + void setIsSync(bool attrValue); + void setSplitDimensionAttr(::mlir::IntegerAttr attr); + void setSplitDimension(::std::optional attrValue); + ::mlir::Attribute removeConstrainLayoutAttr(); + ::mlir::Attribute removeChannelIdAttr(); + ::mlir::Attribute removeUseGlobalDeviceIdsAttr(); + ::mlir::Attribute removeSplitDimensionAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type token, ::mlir::ValueRange inputs, ::mlir::ValueRange outputs, ::mlir::DenseIntElementsAttr replica_groups, /*optional*/::mlir::BoolAttr constrain_layout, /*optional*/::mlir::mhlo::ChannelHandleAttr channel_id, /*optional*/::mlir::BoolAttr use_global_device_ids, ::mlir::BoolAttr is_sync, /*optional*/::mlir::IntegerAttr split_dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::mlir::ValueRange outputs, ::mlir::DenseIntElementsAttr replica_groups, /*optional*/::mlir::BoolAttr constrain_layout, /*optional*/::mlir::mhlo::ChannelHandleAttr channel_id, /*optional*/::mlir::BoolAttr use_global_device_ids, ::mlir::BoolAttr is_sync, /*optional*/::mlir::IntegerAttr split_dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type token, ::mlir::ValueRange inputs, ::mlir::ValueRange outputs, ::mlir::DenseIntElementsAttr replica_groups, /*optional*/bool constrain_layout, /*optional*/::mlir::mhlo::ChannelHandleAttr channel_id, /*optional*/bool use_global_device_ids, bool is_sync, /*optional*/::mlir::IntegerAttr split_dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::mlir::ValueRange outputs, ::mlir::DenseIntElementsAttr replica_groups, /*optional*/bool constrain_layout, /*optional*/::mlir::mhlo::ChannelHandleAttr channel_id, /*optional*/bool use_global_device_ids, bool is_sync, /*optional*/::mlir::IntegerAttr split_dimension); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo_gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo_gpu::AllToAllStartOp) + +namespace mlir { +namespace lmhlo_gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo_gpu::CholeskyOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CholeskyOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CholeskyOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CholeskyOpGenericAdaptorBase(CholeskyOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getIsLowerAttr(); + bool getIsLower(); +}; +} // namespace detail +template +class CholeskyOpGenericAdaptor : public detail::CholeskyOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CholeskyOpGenericAdaptorBase; +public: + CholeskyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CholeskyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CholeskyOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CholeskyOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(1).begin()); + } + + ValueT getScratch() { + return (*getODSOperands(2).begin()); + } + + ValueT getInfo() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CholeskyOpAdaptor : public CholeskyOpGenericAdaptor<::mlir::ValueRange> { +public: + using CholeskyOpGenericAdaptor::CholeskyOpGenericAdaptor; + CholeskyOpAdaptor(CholeskyOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CholeskyOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CholeskyOpAdaptor; + template + using GenericAdaptor = CholeskyOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("is_lower")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getIsLowerAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getIsLowerAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo_gpu.cholesky"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getInput(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::TypedValue<::mlir::MemRefType> getScratch(); + ::mlir::TypedValue<::mlir::MemRefType> getInfo(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getOutputMutable(); + ::mlir::OpOperand &getScratchMutable(); + ::mlir::OpOperand &getInfoMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::BoolAttr getIsLowerAttr(); + bool getIsLower(); + void setIsLowerAttr(::mlir::BoolAttr attr); + void setIsLower(bool attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value output, ::mlir::Value scratch, ::mlir::Value info, ::mlir::BoolAttr is_lower); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value output, ::mlir::Value scratch, ::mlir::Value info, ::mlir::BoolAttr is_lower); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value output, ::mlir::Value scratch, ::mlir::Value info, bool is_lower); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value output, ::mlir::Value scratch, ::mlir::Value info, bool is_lower); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo_gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo_gpu::CholeskyOp) + +namespace mlir { +namespace lmhlo_gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo_gpu::CollectivePermuteDoneOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CollectivePermuteDoneOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CollectivePermuteDoneOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CollectivePermuteDoneOpGenericAdaptorBase(CollectivePermuteDoneOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CollectivePermuteDoneOpGenericAdaptor : public detail::CollectivePermuteDoneOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CollectivePermuteDoneOpGenericAdaptorBase; +public: + CollectivePermuteDoneOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CollectivePermuteDoneOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CollectivePermuteDoneOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CollectivePermuteDoneOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getToken() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CollectivePermuteDoneOpAdaptor : public CollectivePermuteDoneOpGenericAdaptor<::mlir::ValueRange> { +public: + using CollectivePermuteDoneOpGenericAdaptor::CollectivePermuteDoneOpGenericAdaptor; + CollectivePermuteDoneOpAdaptor(CollectivePermuteDoneOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CollectivePermuteDoneOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = CollectivePermuteDoneOpAdaptor; + template + using GenericAdaptor = CollectivePermuteDoneOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo_gpu.collective_permute_done"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getToken(); + ::mlir::OpOperand &getTokenMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value token); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value token); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace lmhlo_gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo_gpu::CollectivePermuteDoneOp) + +namespace mlir { +namespace lmhlo_gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo_gpu::CollectivePermuteStartOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CollectivePermuteStartOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CollectivePermuteStartOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CollectivePermuteStartOpGenericAdaptorBase(CollectivePermuteStartOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getSourceTargetPairsAttr(); + ::mlir::DenseIntElementsAttr getSourceTargetPairs(); + ::mlir::mhlo::ChannelHandleAttr getChannelIdAttr(); + ::std::optional<::mlir::mhlo::ChannelHandleAttr> getChannelId(); + ::mlir::BoolAttr getIsSyncAttr(); + bool getIsSync(); +}; +} // namespace detail +template +class CollectivePermuteStartOpGenericAdaptor : public detail::CollectivePermuteStartOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CollectivePermuteStartOpGenericAdaptorBase; +public: + CollectivePermuteStartOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CollectivePermuteStartOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CollectivePermuteStartOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CollectivePermuteStartOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CollectivePermuteStartOpAdaptor : public CollectivePermuteStartOpGenericAdaptor<::mlir::ValueRange> { +public: + using CollectivePermuteStartOpGenericAdaptor::CollectivePermuteStartOpGenericAdaptor; + CollectivePermuteStartOpAdaptor(CollectivePermuteStartOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CollectivePermuteStartOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CollectivePermuteStartOpAdaptor; + template + using GenericAdaptor = CollectivePermuteStartOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("channel_id"), ::llvm::StringRef("is_sync"), ::llvm::StringRef("source_target_pairs")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getChannelIdAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getChannelIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getIsSyncAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getIsSyncAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getSourceTargetPairsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getSourceTargetPairsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo_gpu.collective_permute_start"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getOperand(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getToken(); + ::mlir::DenseIntElementsAttr getSourceTargetPairsAttr(); + ::mlir::DenseIntElementsAttr getSourceTargetPairs(); + ::mlir::mhlo::ChannelHandleAttr getChannelIdAttr(); + ::std::optional<::mlir::mhlo::ChannelHandleAttr> getChannelId(); + ::mlir::BoolAttr getIsSyncAttr(); + bool getIsSync(); + void setSourceTargetPairsAttr(::mlir::DenseIntElementsAttr attr); + void setChannelIdAttr(::mlir::mhlo::ChannelHandleAttr attr); + void setIsSyncAttr(::mlir::BoolAttr attr); + void setIsSync(bool attrValue); + ::mlir::Attribute removeChannelIdAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type token, ::mlir::Value operand, ::mlir::Value output, ::mlir::DenseIntElementsAttr source_target_pairs, /*optional*/::mlir::mhlo::ChannelHandleAttr channel_id, ::mlir::BoolAttr is_sync); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value output, ::mlir::DenseIntElementsAttr source_target_pairs, /*optional*/::mlir::mhlo::ChannelHandleAttr channel_id, ::mlir::BoolAttr is_sync); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type token, ::mlir::Value operand, ::mlir::Value output, ::mlir::DenseIntElementsAttr source_target_pairs, /*optional*/::mlir::mhlo::ChannelHandleAttr channel_id, bool is_sync); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value output, ::mlir::DenseIntElementsAttr source_target_pairs, /*optional*/::mlir::mhlo::ChannelHandleAttr channel_id, bool is_sync); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo_gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo_gpu::CollectivePermuteStartOp) + +namespace mlir { +namespace lmhlo_gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo_gpu::ConvBackwardFilterOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConvBackwardFilterOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ConvBackwardFilterOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ConvBackwardFilterOpGenericAdaptorBase(ConvBackwardFilterOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getWindowStridesAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getWindowStrides(); + ::mlir::DenseIntElementsAttr getPaddingAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getPadding(); + ::mlir::DenseIntElementsAttr getLhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getLhsDilation(); + ::mlir::DenseIntElementsAttr getRhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getRhsDilation(); + ::mlir::DenseElementsAttr getWindowReversalAttr(); + ::std::optional< ::mlir::DenseElementsAttr > getWindowReversal(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbersAttr(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbers(); + ::mlir::IntegerAttr getFeatureGroupCountAttr(); + uint64_t getFeatureGroupCount(); + ::mlir::IntegerAttr getBatchGroupCountAttr(); + uint64_t getBatchGroupCount(); + ::mlir::ArrayAttr getPrecisionConfigAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrecisionConfig(); + ::mlir::FloatAttr getResultScaleAttr(); + ::llvm::APFloat getResultScale(); + ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr getBackendConfigAttr(); + ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr getBackendConfig(); +}; +} // namespace detail +template +class ConvBackwardFilterOpGenericAdaptor : public detail::ConvBackwardFilterOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConvBackwardFilterOpGenericAdaptorBase; +public: + ConvBackwardFilterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConvBackwardFilterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConvBackwardFilterOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ConvBackwardFilterOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getDOutput() { + return (*getODSOperands(1).begin()); + } + + ValueT getDFilter() { + return (*getODSOperands(2).begin()); + } + + ValueT getScratch() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConvBackwardFilterOpAdaptor : public ConvBackwardFilterOpGenericAdaptor<::mlir::ValueRange> { +public: + using ConvBackwardFilterOpGenericAdaptor::ConvBackwardFilterOpGenericAdaptor; + ConvBackwardFilterOpAdaptor(ConvBackwardFilterOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConvBackwardFilterOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ConvBackwardFilterOpAdaptor; + template + using GenericAdaptor = ConvBackwardFilterOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("backend_config"), ::llvm::StringRef("batch_group_count"), ::llvm::StringRef("dimension_numbers"), ::llvm::StringRef("feature_group_count"), ::llvm::StringRef("lhs_dilation"), ::llvm::StringRef("padding"), ::llvm::StringRef("precision_config"), ::llvm::StringRef("result_scale"), ::llvm::StringRef("rhs_dilation"), ::llvm::StringRef("window_reversal"), ::llvm::StringRef("window_strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBackendConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBackendConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getBatchGroupCountAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getBatchGroupCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDimensionNumbersAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDimensionNumbersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getFeatureGroupCountAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getFeatureGroupCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getLhsDilationAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getLhsDilationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getPrecisionConfigAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getPrecisionConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getResultScaleAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getResultScaleAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getRhsDilationAttrName() { + return getAttributeNameForIndex(8); + } + + static ::mlir::StringAttr getRhsDilationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 8); + } + + ::mlir::StringAttr getWindowReversalAttrName() { + return getAttributeNameForIndex(9); + } + + static ::mlir::StringAttr getWindowReversalAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 9); + } + + ::mlir::StringAttr getWindowStridesAttrName() { + return getAttributeNameForIndex(10); + } + + static ::mlir::StringAttr getWindowStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 10); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo_gpu.conv_backwardfilter"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getInput(); + ::mlir::TypedValue<::mlir::MemRefType> getDOutput(); + ::mlir::TypedValue<::mlir::MemRefType> getDFilter(); + ::mlir::TypedValue<::mlir::MemRefType> getScratch(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getDOutputMutable(); + ::mlir::OpOperand &getDFilterMutable(); + ::mlir::OpOperand &getScratchMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::DenseIntElementsAttr getWindowStridesAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getWindowStrides(); + ::mlir::DenseIntElementsAttr getPaddingAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getPadding(); + ::mlir::DenseIntElementsAttr getLhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getLhsDilation(); + ::mlir::DenseIntElementsAttr getRhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getRhsDilation(); + ::mlir::DenseElementsAttr getWindowReversalAttr(); + ::std::optional< ::mlir::DenseElementsAttr > getWindowReversal(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbersAttr(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbers(); + ::mlir::IntegerAttr getFeatureGroupCountAttr(); + uint64_t getFeatureGroupCount(); + ::mlir::IntegerAttr getBatchGroupCountAttr(); + uint64_t getBatchGroupCount(); + ::mlir::ArrayAttr getPrecisionConfigAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrecisionConfig(); + ::mlir::FloatAttr getResultScaleAttr(); + ::llvm::APFloat getResultScale(); + ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr getBackendConfigAttr(); + ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr getBackendConfig(); + void setWindowStridesAttr(::mlir::DenseIntElementsAttr attr); + void setPaddingAttr(::mlir::DenseIntElementsAttr attr); + void setLhsDilationAttr(::mlir::DenseIntElementsAttr attr); + void setRhsDilationAttr(::mlir::DenseIntElementsAttr attr); + void setWindowReversalAttr(::mlir::DenseElementsAttr attr); + void setDimensionNumbersAttr(::mlir::mhlo::ConvDimensionNumbersAttr attr); + void setFeatureGroupCountAttr(::mlir::IntegerAttr attr); + void setFeatureGroupCount(uint64_t attrValue); + void setBatchGroupCountAttr(::mlir::IntegerAttr attr); + void setBatchGroupCount(uint64_t attrValue); + void setPrecisionConfigAttr(::mlir::ArrayAttr attr); + void setResultScaleAttr(::mlir::FloatAttr attr); + void setResultScale(::llvm::APFloat attrValue); + void setBackendConfigAttr(::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr attr); + ::mlir::Attribute removeWindowStridesAttr(); + ::mlir::Attribute removePaddingAttr(); + ::mlir::Attribute removeLhsDilationAttr(); + ::mlir::Attribute removeRhsDilationAttr(); + ::mlir::Attribute removeWindowReversalAttr(); + ::mlir::Attribute removePrecisionConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value d_output, ::mlir::Value d_filter, ::mlir::Value scratch, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, ::mlir::IntegerAttr feature_group_count, ::mlir::IntegerAttr batch_group_count, /*optional*/::mlir::ArrayAttr precision_config, ::mlir::FloatAttr result_scale, ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr backend_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value d_output, ::mlir::Value d_filter, ::mlir::Value scratch, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, ::mlir::IntegerAttr feature_group_count, ::mlir::IntegerAttr batch_group_count, /*optional*/::mlir::ArrayAttr precision_config, ::mlir::FloatAttr result_scale, ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr backend_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value d_output, ::mlir::Value d_filter, ::mlir::Value scratch, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, uint64_t feature_group_count, uint64_t batch_group_count, /*optional*/::mlir::ArrayAttr precision_config, ::llvm::APFloat result_scale, ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr backend_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value d_output, ::mlir::Value d_filter, ::mlir::Value scratch, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, uint64_t feature_group_count, uint64_t batch_group_count, /*optional*/::mlir::ArrayAttr precision_config, ::llvm::APFloat result_scale, ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr backend_config); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 11 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo_gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo_gpu::ConvBackwardFilterOp) + +namespace mlir { +namespace lmhlo_gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo_gpu::ConvBackwardInputOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConvBackwardInputOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ConvBackwardInputOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ConvBackwardInputOpGenericAdaptorBase(ConvBackwardInputOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getWindowStridesAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getWindowStrides(); + ::mlir::DenseIntElementsAttr getPaddingAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getPadding(); + ::mlir::DenseIntElementsAttr getLhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getLhsDilation(); + ::mlir::DenseIntElementsAttr getRhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getRhsDilation(); + ::mlir::DenseElementsAttr getWindowReversalAttr(); + ::std::optional< ::mlir::DenseElementsAttr > getWindowReversal(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbersAttr(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbers(); + ::mlir::IntegerAttr getFeatureGroupCountAttr(); + uint64_t getFeatureGroupCount(); + ::mlir::IntegerAttr getBatchGroupCountAttr(); + uint64_t getBatchGroupCount(); + ::mlir::ArrayAttr getPrecisionConfigAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrecisionConfig(); + ::mlir::FloatAttr getResultScaleAttr(); + ::llvm::APFloat getResultScale(); + ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr getBackendConfigAttr(); + ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr getBackendConfig(); +}; +} // namespace detail +template +class ConvBackwardInputOpGenericAdaptor : public detail::ConvBackwardInputOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConvBackwardInputOpGenericAdaptorBase; +public: + ConvBackwardInputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConvBackwardInputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConvBackwardInputOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ConvBackwardInputOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getDOutput() { + return (*getODSOperands(0).begin()); + } + + ValueT getFilter() { + return (*getODSOperands(1).begin()); + } + + ValueT getDInput() { + return (*getODSOperands(2).begin()); + } + + ValueT getScratch() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConvBackwardInputOpAdaptor : public ConvBackwardInputOpGenericAdaptor<::mlir::ValueRange> { +public: + using ConvBackwardInputOpGenericAdaptor::ConvBackwardInputOpGenericAdaptor; + ConvBackwardInputOpAdaptor(ConvBackwardInputOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConvBackwardInputOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ConvBackwardInputOpAdaptor; + template + using GenericAdaptor = ConvBackwardInputOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("backend_config"), ::llvm::StringRef("batch_group_count"), ::llvm::StringRef("dimension_numbers"), ::llvm::StringRef("feature_group_count"), ::llvm::StringRef("lhs_dilation"), ::llvm::StringRef("padding"), ::llvm::StringRef("precision_config"), ::llvm::StringRef("result_scale"), ::llvm::StringRef("rhs_dilation"), ::llvm::StringRef("window_reversal"), ::llvm::StringRef("window_strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBackendConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBackendConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getBatchGroupCountAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getBatchGroupCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDimensionNumbersAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDimensionNumbersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getFeatureGroupCountAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getFeatureGroupCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getLhsDilationAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getLhsDilationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getPrecisionConfigAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getPrecisionConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getResultScaleAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getResultScaleAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getRhsDilationAttrName() { + return getAttributeNameForIndex(8); + } + + static ::mlir::StringAttr getRhsDilationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 8); + } + + ::mlir::StringAttr getWindowReversalAttrName() { + return getAttributeNameForIndex(9); + } + + static ::mlir::StringAttr getWindowReversalAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 9); + } + + ::mlir::StringAttr getWindowStridesAttrName() { + return getAttributeNameForIndex(10); + } + + static ::mlir::StringAttr getWindowStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 10); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo_gpu.conv_backwardinput"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getDOutput(); + ::mlir::TypedValue<::mlir::MemRefType> getFilter(); + ::mlir::TypedValue<::mlir::MemRefType> getDInput(); + ::mlir::TypedValue<::mlir::MemRefType> getScratch(); + ::mlir::OpOperand &getDOutputMutable(); + ::mlir::OpOperand &getFilterMutable(); + ::mlir::OpOperand &getDInputMutable(); + ::mlir::OpOperand &getScratchMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::DenseIntElementsAttr getWindowStridesAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getWindowStrides(); + ::mlir::DenseIntElementsAttr getPaddingAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getPadding(); + ::mlir::DenseIntElementsAttr getLhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getLhsDilation(); + ::mlir::DenseIntElementsAttr getRhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getRhsDilation(); + ::mlir::DenseElementsAttr getWindowReversalAttr(); + ::std::optional< ::mlir::DenseElementsAttr > getWindowReversal(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbersAttr(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbers(); + ::mlir::IntegerAttr getFeatureGroupCountAttr(); + uint64_t getFeatureGroupCount(); + ::mlir::IntegerAttr getBatchGroupCountAttr(); + uint64_t getBatchGroupCount(); + ::mlir::ArrayAttr getPrecisionConfigAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrecisionConfig(); + ::mlir::FloatAttr getResultScaleAttr(); + ::llvm::APFloat getResultScale(); + ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr getBackendConfigAttr(); + ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr getBackendConfig(); + void setWindowStridesAttr(::mlir::DenseIntElementsAttr attr); + void setPaddingAttr(::mlir::DenseIntElementsAttr attr); + void setLhsDilationAttr(::mlir::DenseIntElementsAttr attr); + void setRhsDilationAttr(::mlir::DenseIntElementsAttr attr); + void setWindowReversalAttr(::mlir::DenseElementsAttr attr); + void setDimensionNumbersAttr(::mlir::mhlo::ConvDimensionNumbersAttr attr); + void setFeatureGroupCountAttr(::mlir::IntegerAttr attr); + void setFeatureGroupCount(uint64_t attrValue); + void setBatchGroupCountAttr(::mlir::IntegerAttr attr); + void setBatchGroupCount(uint64_t attrValue); + void setPrecisionConfigAttr(::mlir::ArrayAttr attr); + void setResultScaleAttr(::mlir::FloatAttr attr); + void setResultScale(::llvm::APFloat attrValue); + void setBackendConfigAttr(::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr attr); + ::mlir::Attribute removeWindowStridesAttr(); + ::mlir::Attribute removePaddingAttr(); + ::mlir::Attribute removeLhsDilationAttr(); + ::mlir::Attribute removeRhsDilationAttr(); + ::mlir::Attribute removeWindowReversalAttr(); + ::mlir::Attribute removePrecisionConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value d_output, ::mlir::Value filter, ::mlir::Value d_input, ::mlir::Value scratch, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, ::mlir::IntegerAttr feature_group_count, ::mlir::IntegerAttr batch_group_count, /*optional*/::mlir::ArrayAttr precision_config, ::mlir::FloatAttr result_scale, ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr backend_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value d_output, ::mlir::Value filter, ::mlir::Value d_input, ::mlir::Value scratch, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, ::mlir::IntegerAttr feature_group_count, ::mlir::IntegerAttr batch_group_count, /*optional*/::mlir::ArrayAttr precision_config, ::mlir::FloatAttr result_scale, ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr backend_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value d_output, ::mlir::Value filter, ::mlir::Value d_input, ::mlir::Value scratch, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, uint64_t feature_group_count, uint64_t batch_group_count, /*optional*/::mlir::ArrayAttr precision_config, ::llvm::APFloat result_scale, ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr backend_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value d_output, ::mlir::Value filter, ::mlir::Value d_input, ::mlir::Value scratch, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, uint64_t feature_group_count, uint64_t batch_group_count, /*optional*/::mlir::ArrayAttr precision_config, ::llvm::APFloat result_scale, ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr backend_config); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 11 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo_gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo_gpu::ConvBackwardInputOp) + +namespace mlir { +namespace lmhlo_gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo_gpu::ConvForwardFusedOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConvForwardFusedOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ConvForwardFusedOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ConvForwardFusedOpGenericAdaptorBase(ConvForwardFusedOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getWindowStridesAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getWindowStrides(); + ::mlir::DenseIntElementsAttr getPaddingAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getPadding(); + ::mlir::DenseIntElementsAttr getLhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getLhsDilation(); + ::mlir::DenseIntElementsAttr getRhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getRhsDilation(); + ::mlir::DenseElementsAttr getWindowReversalAttr(); + ::std::optional< ::mlir::DenseElementsAttr > getWindowReversal(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbersAttr(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbers(); + ::mlir::IntegerAttr getFeatureGroupCountAttr(); + uint64_t getFeatureGroupCount(); + ::mlir::IntegerAttr getBatchGroupCountAttr(); + uint64_t getBatchGroupCount(); + ::mlir::ArrayAttr getPrecisionConfigAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrecisionConfig(); + ::mlir::FloatAttr getResultScaleAttr(); + ::llvm::APFloat getResultScale(); + ::mlir::lmhlo_gpu::ActivationAttr getActivationModeAttr(); + ::mlir::lmhlo_gpu::Activation getActivationMode(); + ::mlir::FloatAttr getLeakyreluAlphaAttr(); + ::llvm::APFloat getLeakyreluAlpha(); + ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr getBackendConfigAttr(); + ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr getBackendConfig(); +}; +} // namespace detail +template +class ConvForwardFusedOpGenericAdaptor : public detail::ConvForwardFusedOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConvForwardFusedOpGenericAdaptorBase; +public: + ConvForwardFusedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConvForwardFusedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConvForwardFusedOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ConvForwardFusedOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getFilter() { + return (*getODSOperands(1).begin()); + } + + ValueT getBias() { + return (*getODSOperands(2).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(3).begin()); + } + + ValueT getScratch() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConvForwardFusedOpAdaptor : public ConvForwardFusedOpGenericAdaptor<::mlir::ValueRange> { +public: + using ConvForwardFusedOpGenericAdaptor::ConvForwardFusedOpGenericAdaptor; + ConvForwardFusedOpAdaptor(ConvForwardFusedOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConvForwardFusedOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ConvForwardFusedOpAdaptor; + template + using GenericAdaptor = ConvForwardFusedOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("activation_mode"), ::llvm::StringRef("backend_config"), ::llvm::StringRef("batch_group_count"), ::llvm::StringRef("dimension_numbers"), ::llvm::StringRef("feature_group_count"), ::llvm::StringRef("leakyrelu_alpha"), ::llvm::StringRef("lhs_dilation"), ::llvm::StringRef("padding"), ::llvm::StringRef("precision_config"), ::llvm::StringRef("result_scale"), ::llvm::StringRef("rhs_dilation"), ::llvm::StringRef("window_reversal"), ::llvm::StringRef("window_strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getActivationModeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getActivationModeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getBackendConfigAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getBackendConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getBatchGroupCountAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getBatchGroupCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getDimensionNumbersAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getDimensionNumbersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getFeatureGroupCountAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getFeatureGroupCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getLeakyreluAlphaAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getLeakyreluAlphaAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getLhsDilationAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getLhsDilationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getPrecisionConfigAttrName() { + return getAttributeNameForIndex(8); + } + + static ::mlir::StringAttr getPrecisionConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 8); + } + + ::mlir::StringAttr getResultScaleAttrName() { + return getAttributeNameForIndex(9); + } + + static ::mlir::StringAttr getResultScaleAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 9); + } + + ::mlir::StringAttr getRhsDilationAttrName() { + return getAttributeNameForIndex(10); + } + + static ::mlir::StringAttr getRhsDilationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 10); + } + + ::mlir::StringAttr getWindowReversalAttrName() { + return getAttributeNameForIndex(11); + } + + static ::mlir::StringAttr getWindowReversalAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 11); + } + + ::mlir::StringAttr getWindowStridesAttrName() { + return getAttributeNameForIndex(12); + } + + static ::mlir::StringAttr getWindowStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 12); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo_gpu.conv_forward_fused"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getInput(); + ::mlir::TypedValue<::mlir::MemRefType> getFilter(); + ::mlir::TypedValue<::mlir::MemRefType> getBias(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::TypedValue<::mlir::MemRefType> getScratch(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getFilterMutable(); + ::mlir::OpOperand &getBiasMutable(); + ::mlir::OpOperand &getOutputMutable(); + ::mlir::OpOperand &getScratchMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::DenseIntElementsAttr getWindowStridesAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getWindowStrides(); + ::mlir::DenseIntElementsAttr getPaddingAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getPadding(); + ::mlir::DenseIntElementsAttr getLhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getLhsDilation(); + ::mlir::DenseIntElementsAttr getRhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getRhsDilation(); + ::mlir::DenseElementsAttr getWindowReversalAttr(); + ::std::optional< ::mlir::DenseElementsAttr > getWindowReversal(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbersAttr(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbers(); + ::mlir::IntegerAttr getFeatureGroupCountAttr(); + uint64_t getFeatureGroupCount(); + ::mlir::IntegerAttr getBatchGroupCountAttr(); + uint64_t getBatchGroupCount(); + ::mlir::ArrayAttr getPrecisionConfigAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrecisionConfig(); + ::mlir::FloatAttr getResultScaleAttr(); + ::llvm::APFloat getResultScale(); + ::mlir::lmhlo_gpu::ActivationAttr getActivationModeAttr(); + ::mlir::lmhlo_gpu::Activation getActivationMode(); + ::mlir::FloatAttr getLeakyreluAlphaAttr(); + ::llvm::APFloat getLeakyreluAlpha(); + ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr getBackendConfigAttr(); + ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr getBackendConfig(); + void setWindowStridesAttr(::mlir::DenseIntElementsAttr attr); + void setPaddingAttr(::mlir::DenseIntElementsAttr attr); + void setLhsDilationAttr(::mlir::DenseIntElementsAttr attr); + void setRhsDilationAttr(::mlir::DenseIntElementsAttr attr); + void setWindowReversalAttr(::mlir::DenseElementsAttr attr); + void setDimensionNumbersAttr(::mlir::mhlo::ConvDimensionNumbersAttr attr); + void setFeatureGroupCountAttr(::mlir::IntegerAttr attr); + void setFeatureGroupCount(uint64_t attrValue); + void setBatchGroupCountAttr(::mlir::IntegerAttr attr); + void setBatchGroupCount(uint64_t attrValue); + void setPrecisionConfigAttr(::mlir::ArrayAttr attr); + void setResultScaleAttr(::mlir::FloatAttr attr); + void setResultScale(::llvm::APFloat attrValue); + void setActivationModeAttr(::mlir::lmhlo_gpu::ActivationAttr attr); + void setActivationMode(::mlir::lmhlo_gpu::Activation attrValue); + void setLeakyreluAlphaAttr(::mlir::FloatAttr attr); + void setLeakyreluAlpha(::llvm::APFloat attrValue); + void setBackendConfigAttr(::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr attr); + ::mlir::Attribute removeWindowStridesAttr(); + ::mlir::Attribute removePaddingAttr(); + ::mlir::Attribute removeLhsDilationAttr(); + ::mlir::Attribute removeRhsDilationAttr(); + ::mlir::Attribute removeWindowReversalAttr(); + ::mlir::Attribute removePrecisionConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value filter, ::mlir::Value bias, ::mlir::Value output, ::mlir::Value scratch, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, ::mlir::IntegerAttr feature_group_count, ::mlir::IntegerAttr batch_group_count, /*optional*/::mlir::ArrayAttr precision_config, ::mlir::FloatAttr result_scale, ::mlir::lmhlo_gpu::ActivationAttr activation_mode, ::mlir::FloatAttr leakyrelu_alpha, ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr backend_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter, ::mlir::Value bias, ::mlir::Value output, ::mlir::Value scratch, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, ::mlir::IntegerAttr feature_group_count, ::mlir::IntegerAttr batch_group_count, /*optional*/::mlir::ArrayAttr precision_config, ::mlir::FloatAttr result_scale, ::mlir::lmhlo_gpu::ActivationAttr activation_mode, ::mlir::FloatAttr leakyrelu_alpha, ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr backend_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value filter, ::mlir::Value bias, ::mlir::Value output, ::mlir::Value scratch, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, uint64_t feature_group_count, uint64_t batch_group_count, /*optional*/::mlir::ArrayAttr precision_config, ::llvm::APFloat result_scale, ::mlir::lmhlo_gpu::Activation activation_mode, ::llvm::APFloat leakyrelu_alpha, ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr backend_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter, ::mlir::Value bias, ::mlir::Value output, ::mlir::Value scratch, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, uint64_t feature_group_count, uint64_t batch_group_count, /*optional*/::mlir::ArrayAttr precision_config, ::llvm::APFloat result_scale, ::mlir::lmhlo_gpu::Activation activation_mode, ::llvm::APFloat leakyrelu_alpha, ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr backend_config); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 13 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo_gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo_gpu::ConvForwardFusedOp) + +namespace mlir { +namespace lmhlo_gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo_gpu::ConvForwardFusedSideInputOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConvForwardFusedSideInputOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ConvForwardFusedSideInputOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ConvForwardFusedSideInputOpGenericAdaptorBase(ConvForwardFusedSideInputOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getWindowStridesAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getWindowStrides(); + ::mlir::DenseIntElementsAttr getPaddingAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getPadding(); + ::mlir::DenseIntElementsAttr getLhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getLhsDilation(); + ::mlir::DenseIntElementsAttr getRhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getRhsDilation(); + ::mlir::DenseElementsAttr getWindowReversalAttr(); + ::std::optional< ::mlir::DenseElementsAttr > getWindowReversal(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbersAttr(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbers(); + ::mlir::IntegerAttr getFeatureGroupCountAttr(); + uint64_t getFeatureGroupCount(); + ::mlir::IntegerAttr getBatchGroupCountAttr(); + uint64_t getBatchGroupCount(); + ::mlir::ArrayAttr getPrecisionConfigAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrecisionConfig(); + ::mlir::FloatAttr getResultScaleAttr(); + ::llvm::APFloat getResultScale(); + ::mlir::lmhlo_gpu::ActivationAttr getActivationModeAttr(); + ::mlir::lmhlo_gpu::Activation getActivationMode(); + ::mlir::FloatAttr getSideInputScaleAttr(); + ::llvm::APFloat getSideInputScale(); + ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr getBackendConfigAttr(); + ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr getBackendConfig(); +}; +} // namespace detail +template +class ConvForwardFusedSideInputOpGenericAdaptor : public detail::ConvForwardFusedSideInputOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConvForwardFusedSideInputOpGenericAdaptorBase; +public: + ConvForwardFusedSideInputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConvForwardFusedSideInputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConvForwardFusedSideInputOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ConvForwardFusedSideInputOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getFilter() { + return (*getODSOperands(1).begin()); + } + + ValueT getBias() { + return (*getODSOperands(2).begin()); + } + + ValueT getSideInput() { + return (*getODSOperands(3).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(4).begin()); + } + + ValueT getScratch() { + return (*getODSOperands(5).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConvForwardFusedSideInputOpAdaptor : public ConvForwardFusedSideInputOpGenericAdaptor<::mlir::ValueRange> { +public: + using ConvForwardFusedSideInputOpGenericAdaptor::ConvForwardFusedSideInputOpGenericAdaptor; + ConvForwardFusedSideInputOpAdaptor(ConvForwardFusedSideInputOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConvForwardFusedSideInputOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ConvForwardFusedSideInputOpAdaptor; + template + using GenericAdaptor = ConvForwardFusedSideInputOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("activation_mode"), ::llvm::StringRef("backend_config"), ::llvm::StringRef("batch_group_count"), ::llvm::StringRef("dimension_numbers"), ::llvm::StringRef("feature_group_count"), ::llvm::StringRef("lhs_dilation"), ::llvm::StringRef("padding"), ::llvm::StringRef("precision_config"), ::llvm::StringRef("result_scale"), ::llvm::StringRef("rhs_dilation"), ::llvm::StringRef("side_input_scale"), ::llvm::StringRef("window_reversal"), ::llvm::StringRef("window_strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getActivationModeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getActivationModeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getBackendConfigAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getBackendConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getBatchGroupCountAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getBatchGroupCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getDimensionNumbersAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getDimensionNumbersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getFeatureGroupCountAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getFeatureGroupCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getLhsDilationAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getLhsDilationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getPrecisionConfigAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getPrecisionConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getResultScaleAttrName() { + return getAttributeNameForIndex(8); + } + + static ::mlir::StringAttr getResultScaleAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 8); + } + + ::mlir::StringAttr getRhsDilationAttrName() { + return getAttributeNameForIndex(9); + } + + static ::mlir::StringAttr getRhsDilationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 9); + } + + ::mlir::StringAttr getSideInputScaleAttrName() { + return getAttributeNameForIndex(10); + } + + static ::mlir::StringAttr getSideInputScaleAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 10); + } + + ::mlir::StringAttr getWindowReversalAttrName() { + return getAttributeNameForIndex(11); + } + + static ::mlir::StringAttr getWindowReversalAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 11); + } + + ::mlir::StringAttr getWindowStridesAttrName() { + return getAttributeNameForIndex(12); + } + + static ::mlir::StringAttr getWindowStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 12); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo_gpu.conv_forward_fused_with_side_input"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getInput(); + ::mlir::TypedValue<::mlir::MemRefType> getFilter(); + ::mlir::TypedValue<::mlir::MemRefType> getBias(); + ::mlir::TypedValue<::mlir::MemRefType> getSideInput(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::TypedValue<::mlir::MemRefType> getScratch(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getFilterMutable(); + ::mlir::OpOperand &getBiasMutable(); + ::mlir::OpOperand &getSideInputMutable(); + ::mlir::OpOperand &getOutputMutable(); + ::mlir::OpOperand &getScratchMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::DenseIntElementsAttr getWindowStridesAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getWindowStrides(); + ::mlir::DenseIntElementsAttr getPaddingAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getPadding(); + ::mlir::DenseIntElementsAttr getLhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getLhsDilation(); + ::mlir::DenseIntElementsAttr getRhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getRhsDilation(); + ::mlir::DenseElementsAttr getWindowReversalAttr(); + ::std::optional< ::mlir::DenseElementsAttr > getWindowReversal(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbersAttr(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbers(); + ::mlir::IntegerAttr getFeatureGroupCountAttr(); + uint64_t getFeatureGroupCount(); + ::mlir::IntegerAttr getBatchGroupCountAttr(); + uint64_t getBatchGroupCount(); + ::mlir::ArrayAttr getPrecisionConfigAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrecisionConfig(); + ::mlir::FloatAttr getResultScaleAttr(); + ::llvm::APFloat getResultScale(); + ::mlir::lmhlo_gpu::ActivationAttr getActivationModeAttr(); + ::mlir::lmhlo_gpu::Activation getActivationMode(); + ::mlir::FloatAttr getSideInputScaleAttr(); + ::llvm::APFloat getSideInputScale(); + ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr getBackendConfigAttr(); + ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr getBackendConfig(); + void setWindowStridesAttr(::mlir::DenseIntElementsAttr attr); + void setPaddingAttr(::mlir::DenseIntElementsAttr attr); + void setLhsDilationAttr(::mlir::DenseIntElementsAttr attr); + void setRhsDilationAttr(::mlir::DenseIntElementsAttr attr); + void setWindowReversalAttr(::mlir::DenseElementsAttr attr); + void setDimensionNumbersAttr(::mlir::mhlo::ConvDimensionNumbersAttr attr); + void setFeatureGroupCountAttr(::mlir::IntegerAttr attr); + void setFeatureGroupCount(uint64_t attrValue); + void setBatchGroupCountAttr(::mlir::IntegerAttr attr); + void setBatchGroupCount(uint64_t attrValue); + void setPrecisionConfigAttr(::mlir::ArrayAttr attr); + void setResultScaleAttr(::mlir::FloatAttr attr); + void setResultScale(::llvm::APFloat attrValue); + void setActivationModeAttr(::mlir::lmhlo_gpu::ActivationAttr attr); + void setActivationMode(::mlir::lmhlo_gpu::Activation attrValue); + void setSideInputScaleAttr(::mlir::FloatAttr attr); + void setSideInputScale(::llvm::APFloat attrValue); + void setBackendConfigAttr(::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr attr); + ::mlir::Attribute removeWindowStridesAttr(); + ::mlir::Attribute removePaddingAttr(); + ::mlir::Attribute removeLhsDilationAttr(); + ::mlir::Attribute removeRhsDilationAttr(); + ::mlir::Attribute removeWindowReversalAttr(); + ::mlir::Attribute removePrecisionConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value filter, ::mlir::Value bias, ::mlir::Value side_input, ::mlir::Value output, ::mlir::Value scratch, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, ::mlir::IntegerAttr feature_group_count, ::mlir::IntegerAttr batch_group_count, /*optional*/::mlir::ArrayAttr precision_config, ::mlir::FloatAttr result_scale, ::mlir::lmhlo_gpu::ActivationAttr activation_mode, ::mlir::FloatAttr side_input_scale, ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr backend_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter, ::mlir::Value bias, ::mlir::Value side_input, ::mlir::Value output, ::mlir::Value scratch, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, ::mlir::IntegerAttr feature_group_count, ::mlir::IntegerAttr batch_group_count, /*optional*/::mlir::ArrayAttr precision_config, ::mlir::FloatAttr result_scale, ::mlir::lmhlo_gpu::ActivationAttr activation_mode, ::mlir::FloatAttr side_input_scale, ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr backend_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value filter, ::mlir::Value bias, ::mlir::Value side_input, ::mlir::Value output, ::mlir::Value scratch, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, uint64_t feature_group_count, uint64_t batch_group_count, /*optional*/::mlir::ArrayAttr precision_config, ::llvm::APFloat result_scale, ::mlir::lmhlo_gpu::Activation activation_mode, ::llvm::APFloat side_input_scale, ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr backend_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter, ::mlir::Value bias, ::mlir::Value side_input, ::mlir::Value output, ::mlir::Value scratch, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, uint64_t feature_group_count, uint64_t batch_group_count, /*optional*/::mlir::ArrayAttr precision_config, ::llvm::APFloat result_scale, ::mlir::lmhlo_gpu::Activation activation_mode, ::llvm::APFloat side_input_scale, ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr backend_config); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 13 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo_gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo_gpu::ConvForwardFusedSideInputOp) + +namespace mlir { +namespace lmhlo_gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo_gpu::ConvForwardGraphOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConvForwardGraphOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ConvForwardGraphOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ConvForwardGraphOpGenericAdaptorBase(ConvForwardGraphOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getWindowStridesAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getWindowStrides(); + ::mlir::DenseIntElementsAttr getPaddingAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getPadding(); + ::mlir::DenseIntElementsAttr getLhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getLhsDilation(); + ::mlir::DenseIntElementsAttr getRhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getRhsDilation(); + ::mlir::DenseElementsAttr getWindowReversalAttr(); + ::std::optional< ::mlir::DenseElementsAttr > getWindowReversal(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbersAttr(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbers(); + ::mlir::IntegerAttr getFeatureGroupCountAttr(); + uint64_t getFeatureGroupCount(); + ::mlir::IntegerAttr getBatchGroupCountAttr(); + uint64_t getBatchGroupCount(); + ::mlir::ArrayAttr getPrecisionConfigAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrecisionConfig(); + ::mlir::FloatAttr getResultScaleAttr(); + ::llvm::APFloat getResultScale(); + ::mlir::IntegerAttr getNAuxOutputsAttr(); + uint32_t getNAuxOutputs(); + ::mlir::StringAttr getSerializedGraphAttr(); + ::llvm::StringRef getSerializedGraph(); + ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr getBackendConfigAttr(); + ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr getBackendConfig(); +}; +} // namespace detail +template +class ConvForwardGraphOpGenericAdaptor : public detail::ConvForwardGraphOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConvForwardGraphOpGenericAdaptorBase; +public: + ConvForwardGraphOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConvForwardGraphOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConvForwardGraphOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ConvForwardGraphOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getFilter() { + return (*getODSOperands(1).begin()); + } + + RangeT getBinaryOperands() { + return getODSOperands(2); + } + + ValueT getOutput() { + return (*getODSOperands(3).begin()); + } + + RangeT getAuxOutputs() { + return getODSOperands(4); + } + + ValueT getScratch() { + return (*getODSOperands(5).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConvForwardGraphOpAdaptor : public ConvForwardGraphOpGenericAdaptor<::mlir::ValueRange> { +public: + using ConvForwardGraphOpGenericAdaptor::ConvForwardGraphOpGenericAdaptor; + ConvForwardGraphOpAdaptor(ConvForwardGraphOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConvForwardGraphOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ConvForwardGraphOpAdaptor; + template + using GenericAdaptor = ConvForwardGraphOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("backend_config"), ::llvm::StringRef("batch_group_count"), ::llvm::StringRef("dimension_numbers"), ::llvm::StringRef("feature_group_count"), ::llvm::StringRef("lhs_dilation"), ::llvm::StringRef("n_aux_outputs"), ::llvm::StringRef("operandSegmentSizes"), ::llvm::StringRef("padding"), ::llvm::StringRef("precision_config"), ::llvm::StringRef("result_scale"), ::llvm::StringRef("rhs_dilation"), ::llvm::StringRef("serialized_graph"), ::llvm::StringRef("window_reversal"), ::llvm::StringRef("window_strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBackendConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBackendConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getBatchGroupCountAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getBatchGroupCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDimensionNumbersAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDimensionNumbersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getFeatureGroupCountAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getFeatureGroupCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getLhsDilationAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getLhsDilationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getNAuxOutputsAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getNAuxOutputsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getPrecisionConfigAttrName() { + return getAttributeNameForIndex(8); + } + + static ::mlir::StringAttr getPrecisionConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 8); + } + + ::mlir::StringAttr getResultScaleAttrName() { + return getAttributeNameForIndex(9); + } + + static ::mlir::StringAttr getResultScaleAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 9); + } + + ::mlir::StringAttr getRhsDilationAttrName() { + return getAttributeNameForIndex(10); + } + + static ::mlir::StringAttr getRhsDilationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 10); + } + + ::mlir::StringAttr getSerializedGraphAttrName() { + return getAttributeNameForIndex(11); + } + + static ::mlir::StringAttr getSerializedGraphAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 11); + } + + ::mlir::StringAttr getWindowReversalAttrName() { + return getAttributeNameForIndex(12); + } + + static ::mlir::StringAttr getWindowReversalAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 12); + } + + ::mlir::StringAttr getWindowStridesAttrName() { + return getAttributeNameForIndex(13); + } + + static ::mlir::StringAttr getWindowStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 13); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo_gpu.conv_forward_graph"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getInput(); + ::mlir::TypedValue<::mlir::MemRefType> getFilter(); + ::mlir::Operation::operand_range getBinaryOperands(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::Operation::operand_range getAuxOutputs(); + ::mlir::TypedValue<::mlir::MemRefType> getScratch(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getFilterMutable(); + ::mlir::MutableOperandRange getBinaryOperandsMutable(); + ::mlir::OpOperand &getOutputMutable(); + ::mlir::MutableOperandRange getAuxOutputsMutable(); + ::mlir::OpOperand &getScratchMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::DenseIntElementsAttr getWindowStridesAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getWindowStrides(); + ::mlir::DenseIntElementsAttr getPaddingAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getPadding(); + ::mlir::DenseIntElementsAttr getLhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getLhsDilation(); + ::mlir::DenseIntElementsAttr getRhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getRhsDilation(); + ::mlir::DenseElementsAttr getWindowReversalAttr(); + ::std::optional< ::mlir::DenseElementsAttr > getWindowReversal(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbersAttr(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbers(); + ::mlir::IntegerAttr getFeatureGroupCountAttr(); + uint64_t getFeatureGroupCount(); + ::mlir::IntegerAttr getBatchGroupCountAttr(); + uint64_t getBatchGroupCount(); + ::mlir::ArrayAttr getPrecisionConfigAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrecisionConfig(); + ::mlir::FloatAttr getResultScaleAttr(); + ::llvm::APFloat getResultScale(); + ::mlir::IntegerAttr getNAuxOutputsAttr(); + uint32_t getNAuxOutputs(); + ::mlir::StringAttr getSerializedGraphAttr(); + ::llvm::StringRef getSerializedGraph(); + ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr getBackendConfigAttr(); + ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr getBackendConfig(); + void setWindowStridesAttr(::mlir::DenseIntElementsAttr attr); + void setPaddingAttr(::mlir::DenseIntElementsAttr attr); + void setLhsDilationAttr(::mlir::DenseIntElementsAttr attr); + void setRhsDilationAttr(::mlir::DenseIntElementsAttr attr); + void setWindowReversalAttr(::mlir::DenseElementsAttr attr); + void setDimensionNumbersAttr(::mlir::mhlo::ConvDimensionNumbersAttr attr); + void setFeatureGroupCountAttr(::mlir::IntegerAttr attr); + void setFeatureGroupCount(uint64_t attrValue); + void setBatchGroupCountAttr(::mlir::IntegerAttr attr); + void setBatchGroupCount(uint64_t attrValue); + void setPrecisionConfigAttr(::mlir::ArrayAttr attr); + void setResultScaleAttr(::mlir::FloatAttr attr); + void setResultScale(::llvm::APFloat attrValue); + void setNAuxOutputsAttr(::mlir::IntegerAttr attr); + void setNAuxOutputs(uint32_t attrValue); + void setSerializedGraphAttr(::mlir::StringAttr attr); + void setSerializedGraph(::llvm::StringRef attrValue); + void setBackendConfigAttr(::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr attr); + ::mlir::Attribute removeWindowStridesAttr(); + ::mlir::Attribute removePaddingAttr(); + ::mlir::Attribute removeLhsDilationAttr(); + ::mlir::Attribute removeRhsDilationAttr(); + ::mlir::Attribute removeWindowReversalAttr(); + ::mlir::Attribute removePrecisionConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value filter, ::mlir::ValueRange binary_operands, ::mlir::Value output, ::mlir::ValueRange aux_outputs, ::mlir::Value scratch, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, ::mlir::IntegerAttr feature_group_count, ::mlir::IntegerAttr batch_group_count, /*optional*/::mlir::ArrayAttr precision_config, ::mlir::FloatAttr result_scale, ::mlir::IntegerAttr n_aux_outputs, ::mlir::StringAttr serialized_graph, ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr backend_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter, ::mlir::ValueRange binary_operands, ::mlir::Value output, ::mlir::ValueRange aux_outputs, ::mlir::Value scratch, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, ::mlir::IntegerAttr feature_group_count, ::mlir::IntegerAttr batch_group_count, /*optional*/::mlir::ArrayAttr precision_config, ::mlir::FloatAttr result_scale, ::mlir::IntegerAttr n_aux_outputs, ::mlir::StringAttr serialized_graph, ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr backend_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value filter, ::mlir::ValueRange binary_operands, ::mlir::Value output, ::mlir::ValueRange aux_outputs, ::mlir::Value scratch, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, uint64_t feature_group_count, uint64_t batch_group_count, /*optional*/::mlir::ArrayAttr precision_config, ::llvm::APFloat result_scale, uint32_t n_aux_outputs, ::llvm::StringRef serialized_graph, ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr backend_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter, ::mlir::ValueRange binary_operands, ::mlir::Value output, ::mlir::ValueRange aux_outputs, ::mlir::Value scratch, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, uint64_t feature_group_count, uint64_t batch_group_count, /*optional*/::mlir::ArrayAttr precision_config, ::llvm::APFloat result_scale, uint32_t n_aux_outputs, ::llvm::StringRef serialized_graph, ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr backend_config); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 14 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo_gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo_gpu::ConvForwardGraphOp) + +namespace mlir { +namespace lmhlo_gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo_gpu::ConvForwardOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConvForwardOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ConvForwardOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ConvForwardOpGenericAdaptorBase(ConvForwardOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getWindowStridesAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getWindowStrides(); + ::mlir::DenseIntElementsAttr getPaddingAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getPadding(); + ::mlir::DenseIntElementsAttr getLhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getLhsDilation(); + ::mlir::DenseIntElementsAttr getRhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getRhsDilation(); + ::mlir::DenseElementsAttr getWindowReversalAttr(); + ::std::optional< ::mlir::DenseElementsAttr > getWindowReversal(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbersAttr(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbers(); + ::mlir::IntegerAttr getFeatureGroupCountAttr(); + uint64_t getFeatureGroupCount(); + ::mlir::IntegerAttr getBatchGroupCountAttr(); + uint64_t getBatchGroupCount(); + ::mlir::ArrayAttr getPrecisionConfigAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrecisionConfig(); + ::mlir::FloatAttr getResultScaleAttr(); + ::llvm::APFloat getResultScale(); + ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr getBackendConfigAttr(); + ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr getBackendConfig(); +}; +} // namespace detail +template +class ConvForwardOpGenericAdaptor : public detail::ConvForwardOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConvForwardOpGenericAdaptorBase; +public: + ConvForwardOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConvForwardOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConvForwardOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ConvForwardOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getFilter() { + return (*getODSOperands(1).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(2).begin()); + } + + ValueT getScratch() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConvForwardOpAdaptor : public ConvForwardOpGenericAdaptor<::mlir::ValueRange> { +public: + using ConvForwardOpGenericAdaptor::ConvForwardOpGenericAdaptor; + ConvForwardOpAdaptor(ConvForwardOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConvForwardOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ConvForwardOpAdaptor; + template + using GenericAdaptor = ConvForwardOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("backend_config"), ::llvm::StringRef("batch_group_count"), ::llvm::StringRef("dimension_numbers"), ::llvm::StringRef("feature_group_count"), ::llvm::StringRef("lhs_dilation"), ::llvm::StringRef("padding"), ::llvm::StringRef("precision_config"), ::llvm::StringRef("result_scale"), ::llvm::StringRef("rhs_dilation"), ::llvm::StringRef("window_reversal"), ::llvm::StringRef("window_strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBackendConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBackendConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getBatchGroupCountAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getBatchGroupCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDimensionNumbersAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDimensionNumbersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getFeatureGroupCountAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getFeatureGroupCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getLhsDilationAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getLhsDilationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getPrecisionConfigAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getPrecisionConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getResultScaleAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getResultScaleAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getRhsDilationAttrName() { + return getAttributeNameForIndex(8); + } + + static ::mlir::StringAttr getRhsDilationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 8); + } + + ::mlir::StringAttr getWindowReversalAttrName() { + return getAttributeNameForIndex(9); + } + + static ::mlir::StringAttr getWindowReversalAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 9); + } + + ::mlir::StringAttr getWindowStridesAttrName() { + return getAttributeNameForIndex(10); + } + + static ::mlir::StringAttr getWindowStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 10); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo_gpu.conv_forward"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getInput(); + ::mlir::TypedValue<::mlir::MemRefType> getFilter(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::TypedValue<::mlir::MemRefType> getScratch(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getFilterMutable(); + ::mlir::OpOperand &getOutputMutable(); + ::mlir::OpOperand &getScratchMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::DenseIntElementsAttr getWindowStridesAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getWindowStrides(); + ::mlir::DenseIntElementsAttr getPaddingAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getPadding(); + ::mlir::DenseIntElementsAttr getLhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getLhsDilation(); + ::mlir::DenseIntElementsAttr getRhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getRhsDilation(); + ::mlir::DenseElementsAttr getWindowReversalAttr(); + ::std::optional< ::mlir::DenseElementsAttr > getWindowReversal(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbersAttr(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbers(); + ::mlir::IntegerAttr getFeatureGroupCountAttr(); + uint64_t getFeatureGroupCount(); + ::mlir::IntegerAttr getBatchGroupCountAttr(); + uint64_t getBatchGroupCount(); + ::mlir::ArrayAttr getPrecisionConfigAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrecisionConfig(); + ::mlir::FloatAttr getResultScaleAttr(); + ::llvm::APFloat getResultScale(); + ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr getBackendConfigAttr(); + ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr getBackendConfig(); + void setWindowStridesAttr(::mlir::DenseIntElementsAttr attr); + void setPaddingAttr(::mlir::DenseIntElementsAttr attr); + void setLhsDilationAttr(::mlir::DenseIntElementsAttr attr); + void setRhsDilationAttr(::mlir::DenseIntElementsAttr attr); + void setWindowReversalAttr(::mlir::DenseElementsAttr attr); + void setDimensionNumbersAttr(::mlir::mhlo::ConvDimensionNumbersAttr attr); + void setFeatureGroupCountAttr(::mlir::IntegerAttr attr); + void setFeatureGroupCount(uint64_t attrValue); + void setBatchGroupCountAttr(::mlir::IntegerAttr attr); + void setBatchGroupCount(uint64_t attrValue); + void setPrecisionConfigAttr(::mlir::ArrayAttr attr); + void setResultScaleAttr(::mlir::FloatAttr attr); + void setResultScale(::llvm::APFloat attrValue); + void setBackendConfigAttr(::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr attr); + ::mlir::Attribute removeWindowStridesAttr(); + ::mlir::Attribute removePaddingAttr(); + ::mlir::Attribute removeLhsDilationAttr(); + ::mlir::Attribute removeRhsDilationAttr(); + ::mlir::Attribute removeWindowReversalAttr(); + ::mlir::Attribute removePrecisionConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value filter, ::mlir::Value output, ::mlir::Value scratch, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, ::mlir::IntegerAttr feature_group_count, ::mlir::IntegerAttr batch_group_count, /*optional*/::mlir::ArrayAttr precision_config, ::mlir::FloatAttr result_scale, ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr backend_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter, ::mlir::Value output, ::mlir::Value scratch, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, ::mlir::IntegerAttr feature_group_count, ::mlir::IntegerAttr batch_group_count, /*optional*/::mlir::ArrayAttr precision_config, ::mlir::FloatAttr result_scale, ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr backend_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value filter, ::mlir::Value output, ::mlir::Value scratch, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, uint64_t feature_group_count, uint64_t batch_group_count, /*optional*/::mlir::ArrayAttr precision_config, ::llvm::APFloat result_scale, ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr backend_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter, ::mlir::Value output, ::mlir::Value scratch, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, uint64_t feature_group_count, uint64_t batch_group_count, /*optional*/::mlir::ArrayAttr precision_config, ::llvm::APFloat result_scale, ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr backend_config); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 11 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo_gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo_gpu::ConvForwardOp) + +namespace mlir { +namespace lmhlo_gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo_gpu::CublasLtMatmulF8Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CublasLtMatmulF8OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CublasLtMatmulF8OpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CublasLtMatmulF8OpGenericAdaptorBase(CublasLtMatmulF8Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::mhlo::DotDimensionNumbersAttr getDotDimensionNumbersAttr(); + ::mlir::mhlo::DotDimensionNumbersAttr getDotDimensionNumbers(); + ::mlir::ArrayAttr getPrecisionConfigAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrecisionConfig(); + ::mlir::FloatAttr getAlphaRealAttr(); + ::llvm::APFloat getAlphaReal(); + ::mlir::FloatAttr getAlphaImagAttr(); + ::llvm::APFloat getAlphaImag(); + ::mlir::FloatAttr getBetaAttr(); + ::llvm::APFloat getBeta(); + ::mlir::lmhlo_gpu::CublasLtMatmulEpilogueAttr getEpilogueAttr(); + ::mlir::lmhlo_gpu::CublasLtMatmulEpilogue getEpilogue(); + ::mlir::IntegerAttr getAlgorithmAttr(); + uint64_t getAlgorithm(); +}; +} // namespace detail +template +class CublasLtMatmulF8OpGenericAdaptor : public detail::CublasLtMatmulF8OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CublasLtMatmulF8OpGenericAdaptorBase; +public: + CublasLtMatmulF8OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CublasLtMatmulF8OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CublasLtMatmulF8OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CublasLtMatmulF8OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + ValueT getB() { + return (*getODSOperands(1).begin()); + } + + ValueT getC() { + return (*getODSOperands(2).begin()); + } + + ValueT getAScale() { + return (*getODSOperands(3).begin()); + } + + ValueT getBScale() { + return (*getODSOperands(4).begin()); + } + + ValueT getCScale() { + return (*getODSOperands(5).begin()); + } + + ValueT getDScale() { + return (*getODSOperands(6).begin()); + } + + ValueT getD() { + return (*getODSOperands(7).begin()); + } + + ValueT getBias() { + auto operands = getODSOperands(8); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + ValueT getDAmax() { + auto operands = getODSOperands(9); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CublasLtMatmulF8OpAdaptor : public CublasLtMatmulF8OpGenericAdaptor<::mlir::ValueRange> { +public: + using CublasLtMatmulF8OpGenericAdaptor::CublasLtMatmulF8OpGenericAdaptor; + CublasLtMatmulF8OpAdaptor(CublasLtMatmulF8Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CublasLtMatmulF8Op : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CublasLtMatmulF8OpAdaptor; + template + using GenericAdaptor = CublasLtMatmulF8OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("algorithm"), ::llvm::StringRef("alpha_imag"), ::llvm::StringRef("alpha_real"), ::llvm::StringRef("beta"), ::llvm::StringRef("dot_dimension_numbers"), ::llvm::StringRef("epilogue"), ::llvm::StringRef("operandSegmentSizes"), ::llvm::StringRef("precision_config")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAlgorithmAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAlgorithmAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAlphaImagAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAlphaImagAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getAlphaRealAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getAlphaRealAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getBetaAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getBetaAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getDotDimensionNumbersAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getDotDimensionNumbersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getEpilogueAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getEpilogueAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getPrecisionConfigAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getPrecisionConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo_gpu.cublas.lt.matmul.f8"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getA(); + ::mlir::TypedValue<::mlir::MemRefType> getB(); + ::mlir::TypedValue<::mlir::MemRefType> getC(); + ::mlir::TypedValue<::mlir::MemRefType> getAScale(); + ::mlir::TypedValue<::mlir::MemRefType> getBScale(); + ::mlir::TypedValue<::mlir::MemRefType> getCScale(); + ::mlir::TypedValue<::mlir::MemRefType> getDScale(); + ::mlir::TypedValue<::mlir::MemRefType> getD(); + ::mlir::TypedValue<::mlir::MemRefType> getBias(); + ::mlir::TypedValue<::mlir::MemRefType> getDAmax(); + ::mlir::OpOperand &getAMutable(); + ::mlir::OpOperand &getBMutable(); + ::mlir::OpOperand &getCMutable(); + ::mlir::OpOperand &getAScaleMutable(); + ::mlir::OpOperand &getBScaleMutable(); + ::mlir::OpOperand &getCScaleMutable(); + ::mlir::OpOperand &getDScaleMutable(); + ::mlir::OpOperand &getDMutable(); + ::mlir::MutableOperandRange getBiasMutable(); + ::mlir::MutableOperandRange getDAmaxMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::mhlo::DotDimensionNumbersAttr getDotDimensionNumbersAttr(); + ::mlir::mhlo::DotDimensionNumbersAttr getDotDimensionNumbers(); + ::mlir::ArrayAttr getPrecisionConfigAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrecisionConfig(); + ::mlir::FloatAttr getAlphaRealAttr(); + ::llvm::APFloat getAlphaReal(); + ::mlir::FloatAttr getAlphaImagAttr(); + ::llvm::APFloat getAlphaImag(); + ::mlir::FloatAttr getBetaAttr(); + ::llvm::APFloat getBeta(); + ::mlir::lmhlo_gpu::CublasLtMatmulEpilogueAttr getEpilogueAttr(); + ::mlir::lmhlo_gpu::CublasLtMatmulEpilogue getEpilogue(); + ::mlir::IntegerAttr getAlgorithmAttr(); + uint64_t getAlgorithm(); + void setDotDimensionNumbersAttr(::mlir::mhlo::DotDimensionNumbersAttr attr); + void setPrecisionConfigAttr(::mlir::ArrayAttr attr); + void setAlphaRealAttr(::mlir::FloatAttr attr); + void setAlphaReal(::llvm::APFloat attrValue); + void setAlphaImagAttr(::mlir::FloatAttr attr); + void setAlphaImag(::llvm::APFloat attrValue); + void setBetaAttr(::mlir::FloatAttr attr); + void setBeta(::llvm::APFloat attrValue); + void setEpilogueAttr(::mlir::lmhlo_gpu::CublasLtMatmulEpilogueAttr attr); + void setEpilogue(::mlir::lmhlo_gpu::CublasLtMatmulEpilogue attrValue); + void setAlgorithmAttr(::mlir::IntegerAttr attr); + void setAlgorithm(uint64_t attrValue); + ::mlir::Attribute removePrecisionConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, ::mlir::Value a_scale, ::mlir::Value b_scale, ::mlir::Value c_scale, ::mlir::Value d_scale, ::mlir::Value d, /*optional*/::mlir::Value bias, /*optional*/::mlir::Value d_amax, ::mlir::mhlo::DotDimensionNumbersAttr dot_dimension_numbers, /*optional*/::mlir::ArrayAttr precision_config, ::mlir::FloatAttr alpha_real, ::mlir::FloatAttr alpha_imag, ::mlir::FloatAttr beta, ::mlir::lmhlo_gpu::CublasLtMatmulEpilogueAttr epilogue, ::mlir::IntegerAttr algorithm); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, ::mlir::Value a_scale, ::mlir::Value b_scale, ::mlir::Value c_scale, ::mlir::Value d_scale, ::mlir::Value d, /*optional*/::mlir::Value bias, /*optional*/::mlir::Value d_amax, ::mlir::mhlo::DotDimensionNumbersAttr dot_dimension_numbers, /*optional*/::mlir::ArrayAttr precision_config, ::mlir::FloatAttr alpha_real, ::mlir::FloatAttr alpha_imag, ::mlir::FloatAttr beta, ::mlir::lmhlo_gpu::CublasLtMatmulEpilogueAttr epilogue, ::mlir::IntegerAttr algorithm); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, ::mlir::Value a_scale, ::mlir::Value b_scale, ::mlir::Value c_scale, ::mlir::Value d_scale, ::mlir::Value d, /*optional*/::mlir::Value bias, /*optional*/::mlir::Value d_amax, ::mlir::mhlo::DotDimensionNumbersAttr dot_dimension_numbers, /*optional*/::mlir::ArrayAttr precision_config, ::llvm::APFloat alpha_real, ::llvm::APFloat alpha_imag, ::llvm::APFloat beta, ::mlir::lmhlo_gpu::CublasLtMatmulEpilogue epilogue, uint64_t algorithm); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, ::mlir::Value a_scale, ::mlir::Value b_scale, ::mlir::Value c_scale, ::mlir::Value d_scale, ::mlir::Value d, /*optional*/::mlir::Value bias, /*optional*/::mlir::Value d_amax, ::mlir::mhlo::DotDimensionNumbersAttr dot_dimension_numbers, /*optional*/::mlir::ArrayAttr precision_config, ::llvm::APFloat alpha_real, ::llvm::APFloat alpha_imag, ::llvm::APFloat beta, ::mlir::lmhlo_gpu::CublasLtMatmulEpilogue epilogue, uint64_t algorithm); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 8 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo_gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo_gpu::CublasLtMatmulF8Op) + +namespace mlir { +namespace lmhlo_gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo_gpu::CublasLtMatmulOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CublasLtMatmulOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CublasLtMatmulOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CublasLtMatmulOpGenericAdaptorBase(CublasLtMatmulOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::mhlo::DotDimensionNumbersAttr getDotDimensionNumbersAttr(); + ::mlir::mhlo::DotDimensionNumbersAttr getDotDimensionNumbers(); + ::mlir::ArrayAttr getPrecisionConfigAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrecisionConfig(); + ::mlir::FloatAttr getAlphaRealAttr(); + ::llvm::APFloat getAlphaReal(); + ::mlir::FloatAttr getAlphaImagAttr(); + ::llvm::APFloat getAlphaImag(); + ::mlir::FloatAttr getBetaAttr(); + ::llvm::APFloat getBeta(); + ::mlir::lmhlo_gpu::CublasLtMatmulEpilogueAttr getEpilogueAttr(); + ::mlir::lmhlo_gpu::CublasLtMatmulEpilogue getEpilogue(); + ::mlir::IntegerAttr getAlgorithmAttr(); + uint64_t getAlgorithm(); +}; +} // namespace detail +template +class CublasLtMatmulOpGenericAdaptor : public detail::CublasLtMatmulOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CublasLtMatmulOpGenericAdaptorBase; +public: + CublasLtMatmulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CublasLtMatmulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CublasLtMatmulOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CublasLtMatmulOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + ValueT getB() { + return (*getODSOperands(1).begin()); + } + + ValueT getC() { + return (*getODSOperands(2).begin()); + } + + ValueT getD() { + return (*getODSOperands(3).begin()); + } + + ValueT getBias() { + auto operands = getODSOperands(4); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + ValueT getAux() { + auto operands = getODSOperands(5); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CublasLtMatmulOpAdaptor : public CublasLtMatmulOpGenericAdaptor<::mlir::ValueRange> { +public: + using CublasLtMatmulOpGenericAdaptor::CublasLtMatmulOpGenericAdaptor; + CublasLtMatmulOpAdaptor(CublasLtMatmulOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CublasLtMatmulOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CublasLtMatmulOpAdaptor; + template + using GenericAdaptor = CublasLtMatmulOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("algorithm"), ::llvm::StringRef("alpha_imag"), ::llvm::StringRef("alpha_real"), ::llvm::StringRef("beta"), ::llvm::StringRef("dot_dimension_numbers"), ::llvm::StringRef("epilogue"), ::llvm::StringRef("operandSegmentSizes"), ::llvm::StringRef("precision_config")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAlgorithmAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAlgorithmAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAlphaImagAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAlphaImagAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getAlphaRealAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getAlphaRealAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getBetaAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getBetaAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getDotDimensionNumbersAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getDotDimensionNumbersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getEpilogueAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getEpilogueAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getPrecisionConfigAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getPrecisionConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo_gpu.cublas.lt.matmul"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getA(); + ::mlir::TypedValue<::mlir::MemRefType> getB(); + ::mlir::TypedValue<::mlir::MemRefType> getC(); + ::mlir::TypedValue<::mlir::MemRefType> getD(); + ::mlir::TypedValue<::mlir::MemRefType> getBias(); + ::mlir::TypedValue<::mlir::MemRefType> getAux(); + ::mlir::OpOperand &getAMutable(); + ::mlir::OpOperand &getBMutable(); + ::mlir::OpOperand &getCMutable(); + ::mlir::OpOperand &getDMutable(); + ::mlir::MutableOperandRange getBiasMutable(); + ::mlir::MutableOperandRange getAuxMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::mhlo::DotDimensionNumbersAttr getDotDimensionNumbersAttr(); + ::mlir::mhlo::DotDimensionNumbersAttr getDotDimensionNumbers(); + ::mlir::ArrayAttr getPrecisionConfigAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrecisionConfig(); + ::mlir::FloatAttr getAlphaRealAttr(); + ::llvm::APFloat getAlphaReal(); + ::mlir::FloatAttr getAlphaImagAttr(); + ::llvm::APFloat getAlphaImag(); + ::mlir::FloatAttr getBetaAttr(); + ::llvm::APFloat getBeta(); + ::mlir::lmhlo_gpu::CublasLtMatmulEpilogueAttr getEpilogueAttr(); + ::mlir::lmhlo_gpu::CublasLtMatmulEpilogue getEpilogue(); + ::mlir::IntegerAttr getAlgorithmAttr(); + uint64_t getAlgorithm(); + void setDotDimensionNumbersAttr(::mlir::mhlo::DotDimensionNumbersAttr attr); + void setPrecisionConfigAttr(::mlir::ArrayAttr attr); + void setAlphaRealAttr(::mlir::FloatAttr attr); + void setAlphaReal(::llvm::APFloat attrValue); + void setAlphaImagAttr(::mlir::FloatAttr attr); + void setAlphaImag(::llvm::APFloat attrValue); + void setBetaAttr(::mlir::FloatAttr attr); + void setBeta(::llvm::APFloat attrValue); + void setEpilogueAttr(::mlir::lmhlo_gpu::CublasLtMatmulEpilogueAttr attr); + void setEpilogue(::mlir::lmhlo_gpu::CublasLtMatmulEpilogue attrValue); + void setAlgorithmAttr(::mlir::IntegerAttr attr); + void setAlgorithm(uint64_t attrValue); + ::mlir::Attribute removePrecisionConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, ::mlir::Value d, /*optional*/::mlir::Value bias, /*optional*/::mlir::Value aux, ::mlir::mhlo::DotDimensionNumbersAttr dot_dimension_numbers, /*optional*/::mlir::ArrayAttr precision_config, ::mlir::FloatAttr alpha_real, ::mlir::FloatAttr alpha_imag, ::mlir::FloatAttr beta, ::mlir::lmhlo_gpu::CublasLtMatmulEpilogueAttr epilogue, ::mlir::IntegerAttr algorithm); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, ::mlir::Value d, /*optional*/::mlir::Value bias, /*optional*/::mlir::Value aux, ::mlir::mhlo::DotDimensionNumbersAttr dot_dimension_numbers, /*optional*/::mlir::ArrayAttr precision_config, ::mlir::FloatAttr alpha_real, ::mlir::FloatAttr alpha_imag, ::mlir::FloatAttr beta, ::mlir::lmhlo_gpu::CublasLtMatmulEpilogueAttr epilogue, ::mlir::IntegerAttr algorithm); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, ::mlir::Value d, /*optional*/::mlir::Value bias, /*optional*/::mlir::Value aux, ::mlir::mhlo::DotDimensionNumbersAttr dot_dimension_numbers, /*optional*/::mlir::ArrayAttr precision_config, ::llvm::APFloat alpha_real, ::llvm::APFloat alpha_imag, ::llvm::APFloat beta, ::mlir::lmhlo_gpu::CublasLtMatmulEpilogue epilogue, uint64_t algorithm); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, ::mlir::Value d, /*optional*/::mlir::Value bias, /*optional*/::mlir::Value aux, ::mlir::mhlo::DotDimensionNumbersAttr dot_dimension_numbers, /*optional*/::mlir::ArrayAttr precision_config, ::llvm::APFloat alpha_real, ::llvm::APFloat alpha_imag, ::llvm::APFloat beta, ::mlir::lmhlo_gpu::CublasLtMatmulEpilogue epilogue, uint64_t algorithm); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 8 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo_gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo_gpu::CublasLtMatmulOp) + +namespace mlir { +namespace lmhlo_gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo_gpu::CudnnConvReorderFilterAndBiasOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CudnnConvReorderFilterAndBiasOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CudnnConvReorderFilterAndBiasOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CudnnConvReorderFilterAndBiasOpGenericAdaptorBase(CudnnConvReorderFilterAndBiasOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getFilterDimsAttr(); + ::mlir::DenseIntElementsAttr getFilterDims(); +}; +} // namespace detail +template +class CudnnConvReorderFilterAndBiasOpGenericAdaptor : public detail::CudnnConvReorderFilterAndBiasOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CudnnConvReorderFilterAndBiasOpGenericAdaptorBase; +public: + CudnnConvReorderFilterAndBiasOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CudnnConvReorderFilterAndBiasOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CudnnConvReorderFilterAndBiasOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CudnnConvReorderFilterAndBiasOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getFilterInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getBiasInput() { + return (*getODSOperands(1).begin()); + } + + ValueT getFilterOutput() { + return (*getODSOperands(2).begin()); + } + + ValueT getBiasOutput() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CudnnConvReorderFilterAndBiasOpAdaptor : public CudnnConvReorderFilterAndBiasOpGenericAdaptor<::mlir::ValueRange> { +public: + using CudnnConvReorderFilterAndBiasOpGenericAdaptor::CudnnConvReorderFilterAndBiasOpGenericAdaptor; + CudnnConvReorderFilterAndBiasOpAdaptor(CudnnConvReorderFilterAndBiasOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CudnnConvReorderFilterAndBiasOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CudnnConvReorderFilterAndBiasOpAdaptor; + template + using GenericAdaptor = CudnnConvReorderFilterAndBiasOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("filter_dims")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFilterDimsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFilterDimsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo_gpu.cudnn_conv_reorder_filter_and_bias"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getFilterInput(); + ::mlir::TypedValue<::mlir::MemRefType> getBiasInput(); + ::mlir::TypedValue<::mlir::MemRefType> getFilterOutput(); + ::mlir::TypedValue<::mlir::MemRefType> getBiasOutput(); + ::mlir::OpOperand &getFilterInputMutable(); + ::mlir::OpOperand &getBiasInputMutable(); + ::mlir::OpOperand &getFilterOutputMutable(); + ::mlir::OpOperand &getBiasOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::DenseIntElementsAttr getFilterDimsAttr(); + ::mlir::DenseIntElementsAttr getFilterDims(); + void setFilterDimsAttr(::mlir::DenseIntElementsAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value filter_input, ::mlir::Value bias_input, ::mlir::Value filter_output, ::mlir::Value bias_output, ::mlir::DenseIntElementsAttr filter_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value filter_input, ::mlir::Value bias_input, ::mlir::Value filter_output, ::mlir::Value bias_output, ::mlir::DenseIntElementsAttr filter_dims); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo_gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo_gpu::CudnnConvReorderFilterAndBiasOp) + +namespace mlir { +namespace lmhlo_gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo_gpu::CudnnConvReorderFilterOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CudnnConvReorderFilterOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CudnnConvReorderFilterOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CudnnConvReorderFilterOpGenericAdaptorBase(CudnnConvReorderFilterOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getFilterDimsAttr(); + ::mlir::DenseIntElementsAttr getFilterDims(); +}; +} // namespace detail +template +class CudnnConvReorderFilterOpGenericAdaptor : public detail::CudnnConvReorderFilterOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CudnnConvReorderFilterOpGenericAdaptorBase; +public: + CudnnConvReorderFilterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CudnnConvReorderFilterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CudnnConvReorderFilterOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CudnnConvReorderFilterOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getFilterInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getFilterOutput() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CudnnConvReorderFilterOpAdaptor : public CudnnConvReorderFilterOpGenericAdaptor<::mlir::ValueRange> { +public: + using CudnnConvReorderFilterOpGenericAdaptor::CudnnConvReorderFilterOpGenericAdaptor; + CudnnConvReorderFilterOpAdaptor(CudnnConvReorderFilterOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CudnnConvReorderFilterOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CudnnConvReorderFilterOpAdaptor; + template + using GenericAdaptor = CudnnConvReorderFilterOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("filter_dims")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFilterDimsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFilterDimsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo_gpu.cudnn_conv_reorder_filter"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getFilterInput(); + ::mlir::TypedValue<::mlir::MemRefType> getFilterOutput(); + ::mlir::OpOperand &getFilterInputMutable(); + ::mlir::OpOperand &getFilterOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::DenseIntElementsAttr getFilterDimsAttr(); + ::mlir::DenseIntElementsAttr getFilterDims(); + void setFilterDimsAttr(::mlir::DenseIntElementsAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value filter_input, ::mlir::Value filter_output, ::mlir::DenseIntElementsAttr filter_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value filter_input, ::mlir::Value filter_output, ::mlir::DenseIntElementsAttr filter_dims); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo_gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo_gpu::CudnnConvReorderFilterOp) + +namespace mlir { +namespace lmhlo_gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo_gpu::GEMMOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GEMMOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + GEMMOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + GEMMOpGenericAdaptorBase(GEMMOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::mhlo::DotDimensionNumbersAttr getDotDimensionNumbersAttr(); + ::mlir::mhlo::DotDimensionNumbersAttr getDotDimensionNumbers(); + ::mlir::ArrayAttr getPrecisionConfigAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrecisionConfig(); + ::mlir::FloatAttr getAlphaRealAttr(); + ::llvm::APFloat getAlphaReal(); + ::mlir::FloatAttr getAlphaImagAttr(); + ::llvm::APFloat getAlphaImag(); + ::mlir::FloatAttr getBetaAttr(); + ::llvm::APFloat getBeta(); + ::mlir::IntegerAttr getAlgorithmAttr(); + ::std::optional getAlgorithm(); +}; +} // namespace detail +template +class GEMMOpGenericAdaptor : public detail::GEMMOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GEMMOpGenericAdaptorBase; +public: + GEMMOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GEMMOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GEMMOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + GEMMOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + ValueT getB() { + return (*getODSOperands(1).begin()); + } + + ValueT getC() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GEMMOpAdaptor : public GEMMOpGenericAdaptor<::mlir::ValueRange> { +public: + using GEMMOpGenericAdaptor::GEMMOpGenericAdaptor; + GEMMOpAdaptor(GEMMOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GEMMOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = GEMMOpAdaptor; + template + using GenericAdaptor = GEMMOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("algorithm"), ::llvm::StringRef("alpha_imag"), ::llvm::StringRef("alpha_real"), ::llvm::StringRef("beta"), ::llvm::StringRef("dot_dimension_numbers"), ::llvm::StringRef("precision_config")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAlgorithmAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAlgorithmAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAlphaImagAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAlphaImagAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getAlphaRealAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getAlphaRealAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getBetaAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getBetaAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getDotDimensionNumbersAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getDotDimensionNumbersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getPrecisionConfigAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getPrecisionConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo_gpu.gemm"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getA(); + ::mlir::TypedValue<::mlir::MemRefType> getB(); + ::mlir::TypedValue<::mlir::MemRefType> getC(); + ::mlir::OpOperand &getAMutable(); + ::mlir::OpOperand &getBMutable(); + ::mlir::OpOperand &getCMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::mhlo::DotDimensionNumbersAttr getDotDimensionNumbersAttr(); + ::mlir::mhlo::DotDimensionNumbersAttr getDotDimensionNumbers(); + ::mlir::ArrayAttr getPrecisionConfigAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrecisionConfig(); + ::mlir::FloatAttr getAlphaRealAttr(); + ::llvm::APFloat getAlphaReal(); + ::mlir::FloatAttr getAlphaImagAttr(); + ::llvm::APFloat getAlphaImag(); + ::mlir::FloatAttr getBetaAttr(); + ::llvm::APFloat getBeta(); + ::mlir::IntegerAttr getAlgorithmAttr(); + ::std::optional getAlgorithm(); + void setDotDimensionNumbersAttr(::mlir::mhlo::DotDimensionNumbersAttr attr); + void setPrecisionConfigAttr(::mlir::ArrayAttr attr); + void setAlphaRealAttr(::mlir::FloatAttr attr); + void setAlphaReal(::llvm::APFloat attrValue); + void setAlphaImagAttr(::mlir::FloatAttr attr); + void setAlphaImag(::llvm::APFloat attrValue); + void setBetaAttr(::mlir::FloatAttr attr); + void setBeta(::llvm::APFloat attrValue); + void setAlgorithmAttr(::mlir::IntegerAttr attr); + void setAlgorithm(::std::optional attrValue); + ::mlir::Attribute removePrecisionConfigAttr(); + ::mlir::Attribute removeAlgorithmAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, ::mlir::mhlo::DotDimensionNumbersAttr dot_dimension_numbers, /*optional*/::mlir::ArrayAttr precision_config, ::mlir::FloatAttr alpha_real, ::mlir::FloatAttr alpha_imag, ::mlir::FloatAttr beta, /*optional*/::mlir::IntegerAttr algorithm); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, ::mlir::mhlo::DotDimensionNumbersAttr dot_dimension_numbers, /*optional*/::mlir::ArrayAttr precision_config, ::mlir::FloatAttr alpha_real, ::mlir::FloatAttr alpha_imag, ::mlir::FloatAttr beta, /*optional*/::mlir::IntegerAttr algorithm); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, ::mlir::mhlo::DotDimensionNumbersAttr dot_dimension_numbers, /*optional*/::mlir::ArrayAttr precision_config, ::llvm::APFloat alpha_real, ::llvm::APFloat alpha_imag, ::llvm::APFloat beta, /*optional*/::mlir::IntegerAttr algorithm); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, ::mlir::mhlo::DotDimensionNumbersAttr dot_dimension_numbers, /*optional*/::mlir::ArrayAttr precision_config, ::llvm::APFloat alpha_real, ::llvm::APFloat alpha_imag, ::llvm::APFloat beta, /*optional*/::mlir::IntegerAttr algorithm); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo_gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo_gpu::GEMMOp) + +namespace mlir { +namespace lmhlo_gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo_gpu::ReduceScatterDoneOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReduceScatterDoneOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ReduceScatterDoneOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ReduceScatterDoneOpGenericAdaptorBase(ReduceScatterDoneOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ReduceScatterDoneOpGenericAdaptor : public detail::ReduceScatterDoneOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReduceScatterDoneOpGenericAdaptorBase; +public: + ReduceScatterDoneOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReduceScatterDoneOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReduceScatterDoneOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ReduceScatterDoneOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getToken() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ReduceScatterDoneOpAdaptor : public ReduceScatterDoneOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReduceScatterDoneOpGenericAdaptor::ReduceScatterDoneOpGenericAdaptor; + ReduceScatterDoneOpAdaptor(ReduceScatterDoneOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReduceScatterDoneOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = ReduceScatterDoneOpAdaptor; + template + using GenericAdaptor = ReduceScatterDoneOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo_gpu.reduce_scatter_done"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getToken(); + ::mlir::OpOperand &getTokenMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value token); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value token); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace lmhlo_gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo_gpu::ReduceScatterDoneOp) + +namespace mlir { +namespace lmhlo_gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo_gpu::ReduceScatterStartOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReduceScatterStartOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ReduceScatterStartOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ReduceScatterStartOpGenericAdaptorBase(ReduceScatterStartOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getReplicaGroupsAttr(); + ::mlir::DenseIntElementsAttr getReplicaGroups(); + ::mlir::BoolAttr getConstrainLayoutAttr(); + bool getConstrainLayout(); + ::mlir::mhlo::ChannelHandleAttr getChannelIdAttr(); + ::std::optional<::mlir::mhlo::ChannelHandleAttr> getChannelId(); + ::mlir::BoolAttr getUseGlobalDeviceIdsAttr(); + bool getUseGlobalDeviceIds(); + ::mlir::BoolAttr getIsSyncAttr(); + bool getIsSync(); + ::mlir::IntegerAttr getScatterDimensionAttr(); + uint64_t getScatterDimension(); + ::mlir::Region &getComputation(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class ReduceScatterStartOpGenericAdaptor : public detail::ReduceScatterStartOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReduceScatterStartOpGenericAdaptorBase; +public: + ReduceScatterStartOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReduceScatterStartOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReduceScatterStartOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ReduceScatterStartOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ReduceScatterStartOpAdaptor : public ReduceScatterStartOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReduceScatterStartOpGenericAdaptor::ReduceScatterStartOpGenericAdaptor; + ReduceScatterStartOpAdaptor(ReduceScatterStartOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReduceScatterStartOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsElementType> { +public: + using Op::Op; + using Op::print; + using Adaptor = ReduceScatterStartOpAdaptor; + template + using GenericAdaptor = ReduceScatterStartOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("channel_id"), ::llvm::StringRef("constrain_layout"), ::llvm::StringRef("is_sync"), ::llvm::StringRef("replica_groups"), ::llvm::StringRef("scatter_dimension"), ::llvm::StringRef("use_global_device_ids")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getChannelIdAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getChannelIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getConstrainLayoutAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getConstrainLayoutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getIsSyncAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getIsSyncAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getReplicaGroupsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getReplicaGroupsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getScatterDimensionAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getScatterDimensionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getUseGlobalDeviceIdsAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getUseGlobalDeviceIdsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo_gpu.reduce_scatter_start"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getToken(); + ::mlir::Region &getComputation(); + ::mlir::DenseIntElementsAttr getReplicaGroupsAttr(); + ::mlir::DenseIntElementsAttr getReplicaGroups(); + ::mlir::BoolAttr getConstrainLayoutAttr(); + bool getConstrainLayout(); + ::mlir::mhlo::ChannelHandleAttr getChannelIdAttr(); + ::std::optional<::mlir::mhlo::ChannelHandleAttr> getChannelId(); + ::mlir::BoolAttr getUseGlobalDeviceIdsAttr(); + bool getUseGlobalDeviceIds(); + ::mlir::BoolAttr getIsSyncAttr(); + bool getIsSync(); + ::mlir::IntegerAttr getScatterDimensionAttr(); + uint64_t getScatterDimension(); + void setReplicaGroupsAttr(::mlir::DenseIntElementsAttr attr); + void setConstrainLayoutAttr(::mlir::BoolAttr attr); + void setConstrainLayout(::std::optional attrValue); + void setChannelIdAttr(::mlir::mhlo::ChannelHandleAttr attr); + void setUseGlobalDeviceIdsAttr(::mlir::BoolAttr attr); + void setUseGlobalDeviceIds(::std::optional attrValue); + void setIsSyncAttr(::mlir::BoolAttr attr); + void setIsSync(bool attrValue); + void setScatterDimensionAttr(::mlir::IntegerAttr attr); + void setScatterDimension(uint64_t attrValue); + ::mlir::Attribute removeConstrainLayoutAttr(); + ::mlir::Attribute removeChannelIdAttr(); + ::mlir::Attribute removeUseGlobalDeviceIdsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type token, ::mlir::ValueRange inputs, ::mlir::ValueRange outputs, ::mlir::DenseIntElementsAttr replica_groups, /*optional*/::mlir::BoolAttr constrain_layout, /*optional*/::mlir::mhlo::ChannelHandleAttr channel_id, /*optional*/::mlir::BoolAttr use_global_device_ids, ::mlir::BoolAttr is_sync, ::mlir::IntegerAttr scatter_dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::mlir::ValueRange outputs, ::mlir::DenseIntElementsAttr replica_groups, /*optional*/::mlir::BoolAttr constrain_layout, /*optional*/::mlir::mhlo::ChannelHandleAttr channel_id, /*optional*/::mlir::BoolAttr use_global_device_ids, ::mlir::BoolAttr is_sync, ::mlir::IntegerAttr scatter_dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type token, ::mlir::ValueRange inputs, ::mlir::ValueRange outputs, ::mlir::DenseIntElementsAttr replica_groups, /*optional*/bool constrain_layout, /*optional*/::mlir::mhlo::ChannelHandleAttr channel_id, /*optional*/bool use_global_device_ids, bool is_sync, uint64_t scatter_dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::mlir::ValueRange outputs, ::mlir::DenseIntElementsAttr replica_groups, /*optional*/bool constrain_layout, /*optional*/::mlir::mhlo::ChannelHandleAttr channel_id, /*optional*/bool use_global_device_ids, bool is_sync, uint64_t scatter_dimension); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo_gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo_gpu::ReduceScatterStartOp) + +namespace mlir { +namespace lmhlo_gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo_gpu::fusedMHABackwardOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class fusedMHABackwardOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + fusedMHABackwardOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + fusedMHABackwardOpGenericAdaptorBase(fusedMHABackwardOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::mhlo::DotDimensionNumbersAttr getBmm1GradGemm1DotDimensionNumbersAttr(); + ::mlir::mhlo::DotDimensionNumbersAttr getBmm1GradGemm1DotDimensionNumbers(); + ::mlir::mhlo::DotDimensionNumbersAttr getBmm1GradGemm2DotDimensionNumbersAttr(); + ::mlir::mhlo::DotDimensionNumbersAttr getBmm1GradGemm2DotDimensionNumbers(); + ::mlir::mhlo::DotDimensionNumbersAttr getBmm2GradGemm1DotDimensionNumbersAttr(); + ::mlir::mhlo::DotDimensionNumbersAttr getBmm2GradGemm1DotDimensionNumbers(); + ::mlir::mhlo::DotDimensionNumbersAttr getBmm2GradGemm2DotDimensionNumbersAttr(); + ::mlir::mhlo::DotDimensionNumbersAttr getBmm2GradGemm2DotDimensionNumbers(); + ::mlir::FloatAttr getFmhaScaleAttr(); + ::llvm::APFloat getFmhaScale(); + ::mlir::lmhlo_gpu::FusedMhaBackwardDagSignatureAttr getFusedMhaDagAttr(); + ::mlir::lmhlo_gpu::FusedMhaBackwardDagSignature getFusedMhaDag(); + ::mlir::lmhlo_gpu::FusedMHAAlgorithmConfigAttr getAlgorithmConfigAttr(); + ::mlir::lmhlo_gpu::FusedMHAAlgorithmConfigAttr getAlgorithmConfig(); + ::mlir::FloatAttr getDropoutRateAttr(); + ::std::optional< ::llvm::APFloat > getDropoutRate(); + ::mlir::IntegerAttr getSeedAttr(); + ::std::optional getSeed(); +}; +} // namespace detail +template +class fusedMHABackwardOpGenericAdaptor : public detail::fusedMHABackwardOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::fusedMHABackwardOpGenericAdaptorBase; +public: + fusedMHABackwardOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + fusedMHABackwardOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : fusedMHABackwardOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + fusedMHABackwardOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getBmm1GradGemm1Rhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getBmm1GradGemm2Rhs() { + return (*getODSOperands(1).begin()); + } + + ValueT getBmm2GradGemm2Rhs() { + return (*getODSOperands(2).begin()); + } + + ValueT getBmm2GradGemm1Lhs() { + return (*getODSOperands(3).begin()); + } + + ValueT getDOutput() { + return (*getODSOperands(4).begin()); + } + + ValueT getMask() { + auto operands = getODSOperands(5); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + ValueT getDBmm1Lhs() { + return (*getODSOperands(6).begin()); + } + + ValueT getDBmm1Rhs() { + return (*getODSOperands(7).begin()); + } + + ValueT getDBmm2Rhs() { + return (*getODSOperands(8).begin()); + } + + ValueT getD_S() { + return (*getODSOperands(9).begin()); + } + + ValueT getScratch() { + return (*getODSOperands(10).begin()); + } + + ValueT getDBias() { + auto operands = getODSOperands(11); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class fusedMHABackwardOpAdaptor : public fusedMHABackwardOpGenericAdaptor<::mlir::ValueRange> { +public: + using fusedMHABackwardOpGenericAdaptor::fusedMHABackwardOpGenericAdaptor; + fusedMHABackwardOpAdaptor(fusedMHABackwardOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class fusedMHABackwardOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = fusedMHABackwardOpAdaptor; + template + using GenericAdaptor = fusedMHABackwardOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("algorithm_config"), ::llvm::StringRef("bmm1_grad_gemm1_dot_dimension_numbers"), ::llvm::StringRef("bmm1_grad_gemm2_dot_dimension_numbers"), ::llvm::StringRef("bmm2_grad_gemm1_dot_dimension_numbers"), ::llvm::StringRef("bmm2_grad_gemm2_dot_dimension_numbers"), ::llvm::StringRef("dropout_rate"), ::llvm::StringRef("fmha_scale"), ::llvm::StringRef("fused_mha_dag"), ::llvm::StringRef("operandSegmentSizes"), ::llvm::StringRef("seed")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAlgorithmConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAlgorithmConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getBmm1GradGemm1DotDimensionNumbersAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getBmm1GradGemm1DotDimensionNumbersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getBmm1GradGemm2DotDimensionNumbersAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getBmm1GradGemm2DotDimensionNumbersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getBmm2GradGemm1DotDimensionNumbersAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getBmm2GradGemm1DotDimensionNumbersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getBmm2GradGemm2DotDimensionNumbersAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getBmm2GradGemm2DotDimensionNumbersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getDropoutRateAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getDropoutRateAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getFmhaScaleAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getFmhaScaleAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getFusedMhaDagAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getFusedMhaDagAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return getAttributeNameForIndex(8); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 8); + } + + ::mlir::StringAttr getSeedAttrName() { + return getAttributeNameForIndex(9); + } + + static ::mlir::StringAttr getSeedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 9); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo_gpu.fMHABackward"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getBmm1GradGemm1Rhs(); + ::mlir::TypedValue<::mlir::MemRefType> getBmm1GradGemm2Rhs(); + ::mlir::TypedValue<::mlir::MemRefType> getBmm2GradGemm2Rhs(); + ::mlir::TypedValue<::mlir::MemRefType> getBmm2GradGemm1Lhs(); + ::mlir::TypedValue<::mlir::MemRefType> getDOutput(); + ::mlir::TypedValue<::mlir::MemRefType> getMask(); + ::mlir::TypedValue<::mlir::MemRefType> getDBmm1Lhs(); + ::mlir::TypedValue<::mlir::MemRefType> getDBmm1Rhs(); + ::mlir::TypedValue<::mlir::MemRefType> getDBmm2Rhs(); + ::mlir::TypedValue<::mlir::MemRefType> getD_S(); + ::mlir::TypedValue<::mlir::MemRefType> getScratch(); + ::mlir::TypedValue<::mlir::MemRefType> getDBias(); + ::mlir::OpOperand &getBmm1GradGemm1RhsMutable(); + ::mlir::OpOperand &getBmm1GradGemm2RhsMutable(); + ::mlir::OpOperand &getBmm2GradGemm2RhsMutable(); + ::mlir::OpOperand &getBmm2GradGemm1LhsMutable(); + ::mlir::OpOperand &getDOutputMutable(); + ::mlir::MutableOperandRange getMaskMutable(); + ::mlir::OpOperand &getDBmm1LhsMutable(); + ::mlir::OpOperand &getDBmm1RhsMutable(); + ::mlir::OpOperand &getDBmm2RhsMutable(); + ::mlir::OpOperand &getD_SMutable(); + ::mlir::OpOperand &getScratchMutable(); + ::mlir::MutableOperandRange getDBiasMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::mhlo::DotDimensionNumbersAttr getBmm1GradGemm1DotDimensionNumbersAttr(); + ::mlir::mhlo::DotDimensionNumbersAttr getBmm1GradGemm1DotDimensionNumbers(); + ::mlir::mhlo::DotDimensionNumbersAttr getBmm1GradGemm2DotDimensionNumbersAttr(); + ::mlir::mhlo::DotDimensionNumbersAttr getBmm1GradGemm2DotDimensionNumbers(); + ::mlir::mhlo::DotDimensionNumbersAttr getBmm2GradGemm1DotDimensionNumbersAttr(); + ::mlir::mhlo::DotDimensionNumbersAttr getBmm2GradGemm1DotDimensionNumbers(); + ::mlir::mhlo::DotDimensionNumbersAttr getBmm2GradGemm2DotDimensionNumbersAttr(); + ::mlir::mhlo::DotDimensionNumbersAttr getBmm2GradGemm2DotDimensionNumbers(); + ::mlir::FloatAttr getFmhaScaleAttr(); + ::llvm::APFloat getFmhaScale(); + ::mlir::lmhlo_gpu::FusedMhaBackwardDagSignatureAttr getFusedMhaDagAttr(); + ::mlir::lmhlo_gpu::FusedMhaBackwardDagSignature getFusedMhaDag(); + ::mlir::lmhlo_gpu::FusedMHAAlgorithmConfigAttr getAlgorithmConfigAttr(); + ::mlir::lmhlo_gpu::FusedMHAAlgorithmConfigAttr getAlgorithmConfig(); + ::mlir::FloatAttr getDropoutRateAttr(); + ::std::optional< ::llvm::APFloat > getDropoutRate(); + ::mlir::IntegerAttr getSeedAttr(); + ::std::optional getSeed(); + void setBmm1GradGemm1DotDimensionNumbersAttr(::mlir::mhlo::DotDimensionNumbersAttr attr); + void setBmm1GradGemm2DotDimensionNumbersAttr(::mlir::mhlo::DotDimensionNumbersAttr attr); + void setBmm2GradGemm1DotDimensionNumbersAttr(::mlir::mhlo::DotDimensionNumbersAttr attr); + void setBmm2GradGemm2DotDimensionNumbersAttr(::mlir::mhlo::DotDimensionNumbersAttr attr); + void setFmhaScaleAttr(::mlir::FloatAttr attr); + void setFmhaScale(::llvm::APFloat attrValue); + void setFusedMhaDagAttr(::mlir::lmhlo_gpu::FusedMhaBackwardDagSignatureAttr attr); + void setFusedMhaDag(::mlir::lmhlo_gpu::FusedMhaBackwardDagSignature attrValue); + void setAlgorithmConfigAttr(::mlir::lmhlo_gpu::FusedMHAAlgorithmConfigAttr attr); + void setDropoutRateAttr(::mlir::FloatAttr attr); + void setDropoutRate(::std::optional<::llvm::APFloat> attrValue); + void setSeedAttr(::mlir::IntegerAttr attr); + void setSeed(::std::optional attrValue); + ::mlir::Attribute removeDropoutRateAttr(); + ::mlir::Attribute removeSeedAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value bmm1_grad_gemm1_rhs, ::mlir::Value bmm1_grad_gemm2_rhs, ::mlir::Value bmm2_grad_gemm2_rhs, ::mlir::Value bmm2_grad_gemm1_lhs, ::mlir::Value d_output, /*optional*/::mlir::Value mask, ::mlir::Value d_bmm1_lhs, ::mlir::Value d_bmm1_rhs, ::mlir::Value d_bmm2_rhs, ::mlir::Value d_S, ::mlir::Value scratch, /*optional*/::mlir::Value d_bias, ::mlir::mhlo::DotDimensionNumbersAttr bmm1_grad_gemm1_dot_dimension_numbers, ::mlir::mhlo::DotDimensionNumbersAttr bmm1_grad_gemm2_dot_dimension_numbers, ::mlir::mhlo::DotDimensionNumbersAttr bmm2_grad_gemm1_dot_dimension_numbers, ::mlir::mhlo::DotDimensionNumbersAttr bmm2_grad_gemm2_dot_dimension_numbers, ::mlir::FloatAttr fmha_scale, ::mlir::lmhlo_gpu::FusedMhaBackwardDagSignatureAttr fused_mha_dag, ::mlir::lmhlo_gpu::FusedMHAAlgorithmConfigAttr algorithm_config, /*optional*/::mlir::FloatAttr dropout_rate, /*optional*/::mlir::IntegerAttr seed); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value bmm1_grad_gemm1_rhs, ::mlir::Value bmm1_grad_gemm2_rhs, ::mlir::Value bmm2_grad_gemm2_rhs, ::mlir::Value bmm2_grad_gemm1_lhs, ::mlir::Value d_output, /*optional*/::mlir::Value mask, ::mlir::Value d_bmm1_lhs, ::mlir::Value d_bmm1_rhs, ::mlir::Value d_bmm2_rhs, ::mlir::Value d_S, ::mlir::Value scratch, /*optional*/::mlir::Value d_bias, ::mlir::mhlo::DotDimensionNumbersAttr bmm1_grad_gemm1_dot_dimension_numbers, ::mlir::mhlo::DotDimensionNumbersAttr bmm1_grad_gemm2_dot_dimension_numbers, ::mlir::mhlo::DotDimensionNumbersAttr bmm2_grad_gemm1_dot_dimension_numbers, ::mlir::mhlo::DotDimensionNumbersAttr bmm2_grad_gemm2_dot_dimension_numbers, ::mlir::FloatAttr fmha_scale, ::mlir::lmhlo_gpu::FusedMhaBackwardDagSignatureAttr fused_mha_dag, ::mlir::lmhlo_gpu::FusedMHAAlgorithmConfigAttr algorithm_config, /*optional*/::mlir::FloatAttr dropout_rate, /*optional*/::mlir::IntegerAttr seed); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value bmm1_grad_gemm1_rhs, ::mlir::Value bmm1_grad_gemm2_rhs, ::mlir::Value bmm2_grad_gemm2_rhs, ::mlir::Value bmm2_grad_gemm1_lhs, ::mlir::Value d_output, /*optional*/::mlir::Value mask, ::mlir::Value d_bmm1_lhs, ::mlir::Value d_bmm1_rhs, ::mlir::Value d_bmm2_rhs, ::mlir::Value d_S, ::mlir::Value scratch, /*optional*/::mlir::Value d_bias, ::mlir::mhlo::DotDimensionNumbersAttr bmm1_grad_gemm1_dot_dimension_numbers, ::mlir::mhlo::DotDimensionNumbersAttr bmm1_grad_gemm2_dot_dimension_numbers, ::mlir::mhlo::DotDimensionNumbersAttr bmm2_grad_gemm1_dot_dimension_numbers, ::mlir::mhlo::DotDimensionNumbersAttr bmm2_grad_gemm2_dot_dimension_numbers, ::llvm::APFloat fmha_scale, ::mlir::lmhlo_gpu::FusedMhaBackwardDagSignature fused_mha_dag, ::mlir::lmhlo_gpu::FusedMHAAlgorithmConfigAttr algorithm_config, /*optional*/::mlir::FloatAttr dropout_rate, /*optional*/::mlir::IntegerAttr seed); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value bmm1_grad_gemm1_rhs, ::mlir::Value bmm1_grad_gemm2_rhs, ::mlir::Value bmm2_grad_gemm2_rhs, ::mlir::Value bmm2_grad_gemm1_lhs, ::mlir::Value d_output, /*optional*/::mlir::Value mask, ::mlir::Value d_bmm1_lhs, ::mlir::Value d_bmm1_rhs, ::mlir::Value d_bmm2_rhs, ::mlir::Value d_S, ::mlir::Value scratch, /*optional*/::mlir::Value d_bias, ::mlir::mhlo::DotDimensionNumbersAttr bmm1_grad_gemm1_dot_dimension_numbers, ::mlir::mhlo::DotDimensionNumbersAttr bmm1_grad_gemm2_dot_dimension_numbers, ::mlir::mhlo::DotDimensionNumbersAttr bmm2_grad_gemm1_dot_dimension_numbers, ::mlir::mhlo::DotDimensionNumbersAttr bmm2_grad_gemm2_dot_dimension_numbers, ::llvm::APFloat fmha_scale, ::mlir::lmhlo_gpu::FusedMhaBackwardDagSignature fused_mha_dag, ::mlir::lmhlo_gpu::FusedMHAAlgorithmConfigAttr algorithm_config, /*optional*/::mlir::FloatAttr dropout_rate, /*optional*/::mlir::IntegerAttr seed); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 10 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo_gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo_gpu::fusedMHABackwardOp) + +namespace mlir { +namespace lmhlo_gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo_gpu::fusedMHAOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class fusedMHAOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + fusedMHAOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + fusedMHAOpGenericAdaptorBase(fusedMHAOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::mhlo::DotDimensionNumbersAttr getBmm1DotDimensionNumbersAttr(); + ::mlir::mhlo::DotDimensionNumbersAttr getBmm1DotDimensionNumbers(); + ::mlir::mhlo::DotDimensionNumbersAttr getBmm2DotDimensionNumbersAttr(); + ::mlir::mhlo::DotDimensionNumbersAttr getBmm2DotDimensionNumbers(); + ::mlir::ArrayAttr getIntermediateTensorDimensionsAttr(); + ::mlir::ArrayAttr getIntermediateTensorDimensions(); + ::mlir::ArrayAttr getIntermediateTensorLayoutAttr(); + ::mlir::ArrayAttr getIntermediateTensorLayout(); + ::mlir::FloatAttr getFmhaScaleAttr(); + ::llvm::APFloat getFmhaScale(); + ::mlir::lmhlo_gpu::FusedMhaDagSignatureAttr getFusedMhaDagAttr(); + ::mlir::lmhlo_gpu::FusedMhaDagSignature getFusedMhaDag(); + ::mlir::lmhlo_gpu::FusedMHAAlgorithmConfigAttr getAlgorithmConfigAttr(); + ::mlir::lmhlo_gpu::FusedMHAAlgorithmConfigAttr getAlgorithmConfig(); + ::mlir::FloatAttr getDropoutRateAttr(); + ::std::optional< ::llvm::APFloat > getDropoutRate(); + ::mlir::IntegerAttr getSeedAttr(); + ::std::optional getSeed(); +}; +} // namespace detail +template +class fusedMHAOpGenericAdaptor : public detail::fusedMHAOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::fusedMHAOpGenericAdaptorBase; +public: + fusedMHAOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + fusedMHAOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : fusedMHAOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + fusedMHAOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhsBmm1() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhsBmm1() { + return (*getODSOperands(1).begin()); + } + + ValueT getRhsBmm2() { + return (*getODSOperands(2).begin()); + } + + ValueT getMask() { + auto operands = getODSOperands(3); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + ValueT getBias() { + auto operands = getODSOperands(4); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + ValueT getOutput() { + return (*getODSOperands(5).begin()); + } + + ValueT getScratch() { + return (*getODSOperands(6).begin()); + } + + ValueT getActivation() { + auto operands = getODSOperands(7); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class fusedMHAOpAdaptor : public fusedMHAOpGenericAdaptor<::mlir::ValueRange> { +public: + using fusedMHAOpGenericAdaptor::fusedMHAOpGenericAdaptor; + fusedMHAOpAdaptor(fusedMHAOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class fusedMHAOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = fusedMHAOpAdaptor; + template + using GenericAdaptor = fusedMHAOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("algorithm_config"), ::llvm::StringRef("bmm1_dot_dimension_numbers"), ::llvm::StringRef("bmm2_dot_dimension_numbers"), ::llvm::StringRef("dropout_rate"), ::llvm::StringRef("fmha_scale"), ::llvm::StringRef("fused_mha_dag"), ::llvm::StringRef("intermediate_tensor_dimensions"), ::llvm::StringRef("intermediate_tensor_layout"), ::llvm::StringRef("operandSegmentSizes"), ::llvm::StringRef("seed")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAlgorithmConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAlgorithmConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getBmm1DotDimensionNumbersAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getBmm1DotDimensionNumbersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getBmm2DotDimensionNumbersAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getBmm2DotDimensionNumbersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getDropoutRateAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getDropoutRateAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getFmhaScaleAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getFmhaScaleAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getFusedMhaDagAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getFusedMhaDagAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getIntermediateTensorDimensionsAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getIntermediateTensorDimensionsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getIntermediateTensorLayoutAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getIntermediateTensorLayoutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return getAttributeNameForIndex(8); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 8); + } + + ::mlir::StringAttr getSeedAttrName() { + return getAttributeNameForIndex(9); + } + + static ::mlir::StringAttr getSeedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 9); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo_gpu.fMHA"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getLhsBmm1(); + ::mlir::TypedValue<::mlir::MemRefType> getRhsBmm1(); + ::mlir::TypedValue<::mlir::MemRefType> getRhsBmm2(); + ::mlir::TypedValue<::mlir::MemRefType> getMask(); + ::mlir::TypedValue<::mlir::MemRefType> getBias(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::TypedValue<::mlir::MemRefType> getScratch(); + ::mlir::TypedValue<::mlir::MemRefType> getActivation(); + ::mlir::OpOperand &getLhsBmm1Mutable(); + ::mlir::OpOperand &getRhsBmm1Mutable(); + ::mlir::OpOperand &getRhsBmm2Mutable(); + ::mlir::MutableOperandRange getMaskMutable(); + ::mlir::MutableOperandRange getBiasMutable(); + ::mlir::OpOperand &getOutputMutable(); + ::mlir::OpOperand &getScratchMutable(); + ::mlir::MutableOperandRange getActivationMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::mhlo::DotDimensionNumbersAttr getBmm1DotDimensionNumbersAttr(); + ::mlir::mhlo::DotDimensionNumbersAttr getBmm1DotDimensionNumbers(); + ::mlir::mhlo::DotDimensionNumbersAttr getBmm2DotDimensionNumbersAttr(); + ::mlir::mhlo::DotDimensionNumbersAttr getBmm2DotDimensionNumbers(); + ::mlir::ArrayAttr getIntermediateTensorDimensionsAttr(); + ::mlir::ArrayAttr getIntermediateTensorDimensions(); + ::mlir::ArrayAttr getIntermediateTensorLayoutAttr(); + ::mlir::ArrayAttr getIntermediateTensorLayout(); + ::mlir::FloatAttr getFmhaScaleAttr(); + ::llvm::APFloat getFmhaScale(); + ::mlir::lmhlo_gpu::FusedMhaDagSignatureAttr getFusedMhaDagAttr(); + ::mlir::lmhlo_gpu::FusedMhaDagSignature getFusedMhaDag(); + ::mlir::lmhlo_gpu::FusedMHAAlgorithmConfigAttr getAlgorithmConfigAttr(); + ::mlir::lmhlo_gpu::FusedMHAAlgorithmConfigAttr getAlgorithmConfig(); + ::mlir::FloatAttr getDropoutRateAttr(); + ::std::optional< ::llvm::APFloat > getDropoutRate(); + ::mlir::IntegerAttr getSeedAttr(); + ::std::optional getSeed(); + void setBmm1DotDimensionNumbersAttr(::mlir::mhlo::DotDimensionNumbersAttr attr); + void setBmm2DotDimensionNumbersAttr(::mlir::mhlo::DotDimensionNumbersAttr attr); + void setIntermediateTensorDimensionsAttr(::mlir::ArrayAttr attr); + void setIntermediateTensorLayoutAttr(::mlir::ArrayAttr attr); + void setFmhaScaleAttr(::mlir::FloatAttr attr); + void setFmhaScale(::llvm::APFloat attrValue); + void setFusedMhaDagAttr(::mlir::lmhlo_gpu::FusedMhaDagSignatureAttr attr); + void setFusedMhaDag(::mlir::lmhlo_gpu::FusedMhaDagSignature attrValue); + void setAlgorithmConfigAttr(::mlir::lmhlo_gpu::FusedMHAAlgorithmConfigAttr attr); + void setDropoutRateAttr(::mlir::FloatAttr attr); + void setDropoutRate(::std::optional<::llvm::APFloat> attrValue); + void setSeedAttr(::mlir::IntegerAttr attr); + void setSeed(::std::optional attrValue); + ::mlir::Attribute removeDropoutRateAttr(); + ::mlir::Attribute removeSeedAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs_bmm1, ::mlir::Value rhs_bmm1, ::mlir::Value rhs_bmm2, /*optional*/::mlir::Value mask, /*optional*/::mlir::Value bias, ::mlir::Value output, ::mlir::Value scratch, /*optional*/::mlir::Value activation, ::mlir::mhlo::DotDimensionNumbersAttr bmm1_dot_dimension_numbers, ::mlir::mhlo::DotDimensionNumbersAttr bmm2_dot_dimension_numbers, ::mlir::ArrayAttr intermediate_tensor_dimensions, ::mlir::ArrayAttr intermediate_tensor_layout, ::mlir::FloatAttr fmha_scale, ::mlir::lmhlo_gpu::FusedMhaDagSignatureAttr fused_mha_dag, ::mlir::lmhlo_gpu::FusedMHAAlgorithmConfigAttr algorithm_config, /*optional*/::mlir::FloatAttr dropout_rate, /*optional*/::mlir::IntegerAttr seed); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs_bmm1, ::mlir::Value rhs_bmm1, ::mlir::Value rhs_bmm2, /*optional*/::mlir::Value mask, /*optional*/::mlir::Value bias, ::mlir::Value output, ::mlir::Value scratch, /*optional*/::mlir::Value activation, ::mlir::mhlo::DotDimensionNumbersAttr bmm1_dot_dimension_numbers, ::mlir::mhlo::DotDimensionNumbersAttr bmm2_dot_dimension_numbers, ::mlir::ArrayAttr intermediate_tensor_dimensions, ::mlir::ArrayAttr intermediate_tensor_layout, ::mlir::FloatAttr fmha_scale, ::mlir::lmhlo_gpu::FusedMhaDagSignatureAttr fused_mha_dag, ::mlir::lmhlo_gpu::FusedMHAAlgorithmConfigAttr algorithm_config, /*optional*/::mlir::FloatAttr dropout_rate, /*optional*/::mlir::IntegerAttr seed); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs_bmm1, ::mlir::Value rhs_bmm1, ::mlir::Value rhs_bmm2, /*optional*/::mlir::Value mask, /*optional*/::mlir::Value bias, ::mlir::Value output, ::mlir::Value scratch, /*optional*/::mlir::Value activation, ::mlir::mhlo::DotDimensionNumbersAttr bmm1_dot_dimension_numbers, ::mlir::mhlo::DotDimensionNumbersAttr bmm2_dot_dimension_numbers, ::mlir::ArrayAttr intermediate_tensor_dimensions, ::mlir::ArrayAttr intermediate_tensor_layout, ::llvm::APFloat fmha_scale, ::mlir::lmhlo_gpu::FusedMhaDagSignature fused_mha_dag, ::mlir::lmhlo_gpu::FusedMHAAlgorithmConfigAttr algorithm_config, /*optional*/::mlir::FloatAttr dropout_rate, /*optional*/::mlir::IntegerAttr seed); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs_bmm1, ::mlir::Value rhs_bmm1, ::mlir::Value rhs_bmm2, /*optional*/::mlir::Value mask, /*optional*/::mlir::Value bias, ::mlir::Value output, ::mlir::Value scratch, /*optional*/::mlir::Value activation, ::mlir::mhlo::DotDimensionNumbersAttr bmm1_dot_dimension_numbers, ::mlir::mhlo::DotDimensionNumbersAttr bmm2_dot_dimension_numbers, ::mlir::ArrayAttr intermediate_tensor_dimensions, ::mlir::ArrayAttr intermediate_tensor_layout, ::llvm::APFloat fmha_scale, ::mlir::lmhlo_gpu::FusedMhaDagSignature fused_mha_dag, ::mlir::lmhlo_gpu::FusedMHAAlgorithmConfigAttr algorithm_config, /*optional*/::mlir::FloatAttr dropout_rate, /*optional*/::mlir::IntegerAttr seed); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 10 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo_gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo_gpu::fusedMHAOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/lhlo_gpu_ops_ops/lhlo_gpu/IR/lhlo_gpu_ops.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/lhlo_gpu_ops_ops/lhlo_gpu/IR/lhlo_gpu_ops.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..d02e409e79394ed7b757244fd7a27b03b4da45d2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/lhlo_gpu_ops_ops/lhlo_gpu/IR/lhlo_gpu_ops.h.inc @@ -0,0 +1,5153 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: lhlo_gpu_ops.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#if defined(GET_OP_CLASSES) || defined(GET_OP_FWD_DEFINES) +#undef GET_OP_FWD_DEFINES +namespace mlir { +namespace lmhlo_gpu { +class AllGatherDoneOp; +} // namespace lmhlo_gpu +} // namespace mlir +namespace mlir { +namespace lmhlo_gpu { +class AllGatherStartOp; +} // namespace lmhlo_gpu +} // namespace mlir +namespace mlir { +namespace lmhlo_gpu { +class AllReduceDoneOp; +} // namespace lmhlo_gpu +} // namespace mlir +namespace mlir { +namespace lmhlo_gpu { +class AllReduceStartOp; +} // namespace lmhlo_gpu +} // namespace mlir +namespace mlir { +namespace lmhlo_gpu { +class AllToAllDoneOp; +} // namespace lmhlo_gpu +} // namespace mlir +namespace mlir { +namespace lmhlo_gpu { +class AllToAllStartOp; +} // namespace lmhlo_gpu +} // namespace mlir +namespace mlir { +namespace lmhlo_gpu { +class CholeskyOp; +} // namespace lmhlo_gpu +} // namespace mlir +namespace mlir { +namespace lmhlo_gpu { +class CollectivePermuteDoneOp; +} // namespace lmhlo_gpu +} // namespace mlir +namespace mlir { +namespace lmhlo_gpu { +class CollectivePermuteStartOp; +} // namespace lmhlo_gpu +} // namespace mlir +namespace mlir { +namespace lmhlo_gpu { +class ConvBackwardFilterOp; +} // namespace lmhlo_gpu +} // namespace mlir +namespace mlir { +namespace lmhlo_gpu { +class ConvBackwardInputOp; +} // namespace lmhlo_gpu +} // namespace mlir +namespace mlir { +namespace lmhlo_gpu { +class ConvForwardFusedOp; +} // namespace lmhlo_gpu +} // namespace mlir +namespace mlir { +namespace lmhlo_gpu { +class ConvForwardFusedSideInputOp; +} // namespace lmhlo_gpu +} // namespace mlir +namespace mlir { +namespace lmhlo_gpu { +class ConvForwardGraphOp; +} // namespace lmhlo_gpu +} // namespace mlir +namespace mlir { +namespace lmhlo_gpu { +class ConvForwardOp; +} // namespace lmhlo_gpu +} // namespace mlir +namespace mlir { +namespace lmhlo_gpu { +class CublasLtMatmulF8Op; +} // namespace lmhlo_gpu +} // namespace mlir +namespace mlir { +namespace lmhlo_gpu { +class CublasLtMatmulOp; +} // namespace lmhlo_gpu +} // namespace mlir +namespace mlir { +namespace lmhlo_gpu { +class CudnnConvReorderFilterAndBiasOp; +} // namespace lmhlo_gpu +} // namespace mlir +namespace mlir { +namespace lmhlo_gpu { +class CudnnConvReorderFilterOp; +} // namespace lmhlo_gpu +} // namespace mlir +namespace mlir { +namespace lmhlo_gpu { +class GEMMOp; +} // namespace lmhlo_gpu +} // namespace mlir +namespace mlir { +namespace lmhlo_gpu { +class ReduceScatterDoneOp; +} // namespace lmhlo_gpu +} // namespace mlir +namespace mlir { +namespace lmhlo_gpu { +class ReduceScatterStartOp; +} // namespace lmhlo_gpu +} // namespace mlir +namespace mlir { +namespace lmhlo_gpu { +class fusedMHABackwardOp; +} // namespace lmhlo_gpu +} // namespace mlir +namespace mlir { +namespace lmhlo_gpu { +class fusedMHAOp; +} // namespace lmhlo_gpu +} // namespace mlir +#endif + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace lmhlo_gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo_gpu::AllGatherDoneOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AllGatherDoneOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AllGatherDoneOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AllGatherDoneOpGenericAdaptorBase(AllGatherDoneOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AllGatherDoneOpGenericAdaptor : public detail::AllGatherDoneOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AllGatherDoneOpGenericAdaptorBase; +public: + AllGatherDoneOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AllGatherDoneOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AllGatherDoneOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AllGatherDoneOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getToken() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AllGatherDoneOpAdaptor : public AllGatherDoneOpGenericAdaptor<::mlir::ValueRange> { +public: + using AllGatherDoneOpGenericAdaptor::AllGatherDoneOpGenericAdaptor; + AllGatherDoneOpAdaptor(AllGatherDoneOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AllGatherDoneOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = AllGatherDoneOpAdaptor; + template + using GenericAdaptor = AllGatherDoneOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo_gpu.all_gather_done"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getToken(); + ::mlir::OpOperand &getTokenMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value token); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value token); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace lmhlo_gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo_gpu::AllGatherDoneOp) + +namespace mlir { +namespace lmhlo_gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo_gpu::AllGatherStartOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AllGatherStartOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AllGatherStartOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AllGatherStartOpGenericAdaptorBase(AllGatherStartOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getReplicaGroupsAttr(); + ::mlir::DenseIntElementsAttr getReplicaGroups(); + ::mlir::BoolAttr getConstrainLayoutAttr(); + bool getConstrainLayout(); + ::mlir::mhlo::ChannelHandleAttr getChannelIdAttr(); + ::std::optional<::mlir::mhlo::ChannelHandleAttr> getChannelId(); + ::mlir::BoolAttr getUseGlobalDeviceIdsAttr(); + bool getUseGlobalDeviceIds(); + ::mlir::BoolAttr getIsSyncAttr(); + bool getIsSync(); + ::mlir::IntegerAttr getAllGatherDimensionAttr(); + uint64_t getAllGatherDimension(); +}; +} // namespace detail +template +class AllGatherStartOpGenericAdaptor : public detail::AllGatherStartOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AllGatherStartOpGenericAdaptorBase; +public: + AllGatherStartOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AllGatherStartOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AllGatherStartOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AllGatherStartOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AllGatherStartOpAdaptor : public AllGatherStartOpGenericAdaptor<::mlir::ValueRange> { +public: + using AllGatherStartOpGenericAdaptor::AllGatherStartOpGenericAdaptor; + AllGatherStartOpAdaptor(AllGatherStartOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AllGatherStartOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = AllGatherStartOpAdaptor; + template + using GenericAdaptor = AllGatherStartOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("all_gather_dimension"), ::llvm::StringRef("channel_id"), ::llvm::StringRef("constrain_layout"), ::llvm::StringRef("is_sync"), ::llvm::StringRef("replica_groups"), ::llvm::StringRef("use_global_device_ids")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAllGatherDimensionAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAllGatherDimensionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getChannelIdAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getChannelIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getConstrainLayoutAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getConstrainLayoutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getIsSyncAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getIsSyncAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getReplicaGroupsAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getReplicaGroupsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getUseGlobalDeviceIdsAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getUseGlobalDeviceIdsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo_gpu.all_gather_start"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getToken(); + ::mlir::DenseIntElementsAttr getReplicaGroupsAttr(); + ::mlir::DenseIntElementsAttr getReplicaGroups(); + ::mlir::BoolAttr getConstrainLayoutAttr(); + bool getConstrainLayout(); + ::mlir::mhlo::ChannelHandleAttr getChannelIdAttr(); + ::std::optional<::mlir::mhlo::ChannelHandleAttr> getChannelId(); + ::mlir::BoolAttr getUseGlobalDeviceIdsAttr(); + bool getUseGlobalDeviceIds(); + ::mlir::BoolAttr getIsSyncAttr(); + bool getIsSync(); + ::mlir::IntegerAttr getAllGatherDimensionAttr(); + uint64_t getAllGatherDimension(); + void setReplicaGroupsAttr(::mlir::DenseIntElementsAttr attr); + void setConstrainLayoutAttr(::mlir::BoolAttr attr); + void setConstrainLayout(::std::optional attrValue); + void setChannelIdAttr(::mlir::mhlo::ChannelHandleAttr attr); + void setUseGlobalDeviceIdsAttr(::mlir::BoolAttr attr); + void setUseGlobalDeviceIds(::std::optional attrValue); + void setIsSyncAttr(::mlir::BoolAttr attr); + void setIsSync(bool attrValue); + void setAllGatherDimensionAttr(::mlir::IntegerAttr attr); + void setAllGatherDimension(uint64_t attrValue); + ::mlir::Attribute removeConstrainLayoutAttr(); + ::mlir::Attribute removeChannelIdAttr(); + ::mlir::Attribute removeUseGlobalDeviceIdsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type token, ::mlir::ValueRange inputs, ::mlir::ValueRange outputs, ::mlir::DenseIntElementsAttr replica_groups, /*optional*/::mlir::BoolAttr constrain_layout, /*optional*/::mlir::mhlo::ChannelHandleAttr channel_id, /*optional*/::mlir::BoolAttr use_global_device_ids, ::mlir::BoolAttr is_sync, ::mlir::IntegerAttr all_gather_dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::mlir::ValueRange outputs, ::mlir::DenseIntElementsAttr replica_groups, /*optional*/::mlir::BoolAttr constrain_layout, /*optional*/::mlir::mhlo::ChannelHandleAttr channel_id, /*optional*/::mlir::BoolAttr use_global_device_ids, ::mlir::BoolAttr is_sync, ::mlir::IntegerAttr all_gather_dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type token, ::mlir::ValueRange inputs, ::mlir::ValueRange outputs, ::mlir::DenseIntElementsAttr replica_groups, /*optional*/bool constrain_layout, /*optional*/::mlir::mhlo::ChannelHandleAttr channel_id, /*optional*/bool use_global_device_ids, bool is_sync, uint64_t all_gather_dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::mlir::ValueRange outputs, ::mlir::DenseIntElementsAttr replica_groups, /*optional*/bool constrain_layout, /*optional*/::mlir::mhlo::ChannelHandleAttr channel_id, /*optional*/bool use_global_device_ids, bool is_sync, uint64_t all_gather_dimension); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo_gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo_gpu::AllGatherStartOp) + +namespace mlir { +namespace lmhlo_gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo_gpu::AllReduceDoneOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AllReduceDoneOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AllReduceDoneOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AllReduceDoneOpGenericAdaptorBase(AllReduceDoneOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AllReduceDoneOpGenericAdaptor : public detail::AllReduceDoneOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AllReduceDoneOpGenericAdaptorBase; +public: + AllReduceDoneOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AllReduceDoneOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AllReduceDoneOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AllReduceDoneOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getToken() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AllReduceDoneOpAdaptor : public AllReduceDoneOpGenericAdaptor<::mlir::ValueRange> { +public: + using AllReduceDoneOpGenericAdaptor::AllReduceDoneOpGenericAdaptor; + AllReduceDoneOpAdaptor(AllReduceDoneOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AllReduceDoneOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = AllReduceDoneOpAdaptor; + template + using GenericAdaptor = AllReduceDoneOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo_gpu.all_reduce_done"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getToken(); + ::mlir::OpOperand &getTokenMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value token); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value token); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace lmhlo_gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo_gpu::AllReduceDoneOp) + +namespace mlir { +namespace lmhlo_gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo_gpu::AllReduceStartOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AllReduceStartOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AllReduceStartOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AllReduceStartOpGenericAdaptorBase(AllReduceStartOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getReplicaGroupsAttr(); + ::mlir::DenseIntElementsAttr getReplicaGroups(); + ::mlir::BoolAttr getConstrainLayoutAttr(); + bool getConstrainLayout(); + ::mlir::mhlo::ChannelHandleAttr getChannelIdAttr(); + ::std::optional<::mlir::mhlo::ChannelHandleAttr> getChannelId(); + ::mlir::BoolAttr getUseGlobalDeviceIdsAttr(); + bool getUseGlobalDeviceIds(); + ::mlir::BoolAttr getIsSyncAttr(); + bool getIsSync(); + ::mlir::Region &getComputation(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class AllReduceStartOpGenericAdaptor : public detail::AllReduceStartOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AllReduceStartOpGenericAdaptorBase; +public: + AllReduceStartOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AllReduceStartOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AllReduceStartOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AllReduceStartOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AllReduceStartOpAdaptor : public AllReduceStartOpGenericAdaptor<::mlir::ValueRange> { +public: + using AllReduceStartOpGenericAdaptor::AllReduceStartOpGenericAdaptor; + AllReduceStartOpAdaptor(AllReduceStartOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AllReduceStartOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsElementType> { +public: + using Op::Op; + using Op::print; + using Adaptor = AllReduceStartOpAdaptor; + template + using GenericAdaptor = AllReduceStartOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("channel_id"), ::llvm::StringRef("constrain_layout"), ::llvm::StringRef("is_sync"), ::llvm::StringRef("replica_groups"), ::llvm::StringRef("use_global_device_ids")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getChannelIdAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getChannelIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getConstrainLayoutAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getConstrainLayoutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getIsSyncAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getIsSyncAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getReplicaGroupsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getReplicaGroupsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getUseGlobalDeviceIdsAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getUseGlobalDeviceIdsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo_gpu.all_reduce_start"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getToken(); + ::mlir::Region &getComputation(); + ::mlir::DenseIntElementsAttr getReplicaGroupsAttr(); + ::mlir::DenseIntElementsAttr getReplicaGroups(); + ::mlir::BoolAttr getConstrainLayoutAttr(); + bool getConstrainLayout(); + ::mlir::mhlo::ChannelHandleAttr getChannelIdAttr(); + ::std::optional<::mlir::mhlo::ChannelHandleAttr> getChannelId(); + ::mlir::BoolAttr getUseGlobalDeviceIdsAttr(); + bool getUseGlobalDeviceIds(); + ::mlir::BoolAttr getIsSyncAttr(); + bool getIsSync(); + void setReplicaGroupsAttr(::mlir::DenseIntElementsAttr attr); + void setConstrainLayoutAttr(::mlir::BoolAttr attr); + void setConstrainLayout(::std::optional attrValue); + void setChannelIdAttr(::mlir::mhlo::ChannelHandleAttr attr); + void setUseGlobalDeviceIdsAttr(::mlir::BoolAttr attr); + void setUseGlobalDeviceIds(::std::optional attrValue); + void setIsSyncAttr(::mlir::BoolAttr attr); + void setIsSync(bool attrValue); + ::mlir::Attribute removeConstrainLayoutAttr(); + ::mlir::Attribute removeChannelIdAttr(); + ::mlir::Attribute removeUseGlobalDeviceIdsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type token, ::mlir::ValueRange inputs, ::mlir::ValueRange outputs, ::mlir::DenseIntElementsAttr replica_groups, /*optional*/::mlir::BoolAttr constrain_layout, /*optional*/::mlir::mhlo::ChannelHandleAttr channel_id, /*optional*/::mlir::BoolAttr use_global_device_ids, ::mlir::BoolAttr is_sync); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::mlir::ValueRange outputs, ::mlir::DenseIntElementsAttr replica_groups, /*optional*/::mlir::BoolAttr constrain_layout, /*optional*/::mlir::mhlo::ChannelHandleAttr channel_id, /*optional*/::mlir::BoolAttr use_global_device_ids, ::mlir::BoolAttr is_sync); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type token, ::mlir::ValueRange inputs, ::mlir::ValueRange outputs, ::mlir::DenseIntElementsAttr replica_groups, /*optional*/bool constrain_layout, /*optional*/::mlir::mhlo::ChannelHandleAttr channel_id, /*optional*/bool use_global_device_ids, bool is_sync); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::mlir::ValueRange outputs, ::mlir::DenseIntElementsAttr replica_groups, /*optional*/bool constrain_layout, /*optional*/::mlir::mhlo::ChannelHandleAttr channel_id, /*optional*/bool use_global_device_ids, bool is_sync); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo_gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo_gpu::AllReduceStartOp) + +namespace mlir { +namespace lmhlo_gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo_gpu::AllToAllDoneOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AllToAllDoneOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AllToAllDoneOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AllToAllDoneOpGenericAdaptorBase(AllToAllDoneOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AllToAllDoneOpGenericAdaptor : public detail::AllToAllDoneOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AllToAllDoneOpGenericAdaptorBase; +public: + AllToAllDoneOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AllToAllDoneOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AllToAllDoneOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AllToAllDoneOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getToken() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AllToAllDoneOpAdaptor : public AllToAllDoneOpGenericAdaptor<::mlir::ValueRange> { +public: + using AllToAllDoneOpGenericAdaptor::AllToAllDoneOpGenericAdaptor; + AllToAllDoneOpAdaptor(AllToAllDoneOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AllToAllDoneOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = AllToAllDoneOpAdaptor; + template + using GenericAdaptor = AllToAllDoneOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo_gpu.all_to_all_done"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getToken(); + ::mlir::OpOperand &getTokenMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value token); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value token); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace lmhlo_gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo_gpu::AllToAllDoneOp) + +namespace mlir { +namespace lmhlo_gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo_gpu::AllToAllStartOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AllToAllStartOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AllToAllStartOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AllToAllStartOpGenericAdaptorBase(AllToAllStartOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getReplicaGroupsAttr(); + ::mlir::DenseIntElementsAttr getReplicaGroups(); + ::mlir::BoolAttr getConstrainLayoutAttr(); + bool getConstrainLayout(); + ::mlir::mhlo::ChannelHandleAttr getChannelIdAttr(); + ::std::optional<::mlir::mhlo::ChannelHandleAttr> getChannelId(); + ::mlir::BoolAttr getUseGlobalDeviceIdsAttr(); + bool getUseGlobalDeviceIds(); + ::mlir::BoolAttr getIsSyncAttr(); + bool getIsSync(); + ::mlir::IntegerAttr getSplitDimensionAttr(); + ::std::optional getSplitDimension(); +}; +} // namespace detail +template +class AllToAllStartOpGenericAdaptor : public detail::AllToAllStartOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AllToAllStartOpGenericAdaptorBase; +public: + AllToAllStartOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AllToAllStartOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AllToAllStartOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AllToAllStartOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AllToAllStartOpAdaptor : public AllToAllStartOpGenericAdaptor<::mlir::ValueRange> { +public: + using AllToAllStartOpGenericAdaptor::AllToAllStartOpGenericAdaptor; + AllToAllStartOpAdaptor(AllToAllStartOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AllToAllStartOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsElementType> { +public: + using Op::Op; + using Op::print; + using Adaptor = AllToAllStartOpAdaptor; + template + using GenericAdaptor = AllToAllStartOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("channel_id"), ::llvm::StringRef("constrain_layout"), ::llvm::StringRef("is_sync"), ::llvm::StringRef("replica_groups"), ::llvm::StringRef("split_dimension"), ::llvm::StringRef("use_global_device_ids")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getChannelIdAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getChannelIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getConstrainLayoutAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getConstrainLayoutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getIsSyncAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getIsSyncAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getReplicaGroupsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getReplicaGroupsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getSplitDimensionAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getSplitDimensionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getUseGlobalDeviceIdsAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getUseGlobalDeviceIdsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo_gpu.all_to_all_start"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getToken(); + ::mlir::DenseIntElementsAttr getReplicaGroupsAttr(); + ::mlir::DenseIntElementsAttr getReplicaGroups(); + ::mlir::BoolAttr getConstrainLayoutAttr(); + bool getConstrainLayout(); + ::mlir::mhlo::ChannelHandleAttr getChannelIdAttr(); + ::std::optional<::mlir::mhlo::ChannelHandleAttr> getChannelId(); + ::mlir::BoolAttr getUseGlobalDeviceIdsAttr(); + bool getUseGlobalDeviceIds(); + ::mlir::BoolAttr getIsSyncAttr(); + bool getIsSync(); + ::mlir::IntegerAttr getSplitDimensionAttr(); + ::std::optional getSplitDimension(); + void setReplicaGroupsAttr(::mlir::DenseIntElementsAttr attr); + void setConstrainLayoutAttr(::mlir::BoolAttr attr); + void setConstrainLayout(::std::optional attrValue); + void setChannelIdAttr(::mlir::mhlo::ChannelHandleAttr attr); + void setUseGlobalDeviceIdsAttr(::mlir::BoolAttr attr); + void setUseGlobalDeviceIds(::std::optional attrValue); + void setIsSyncAttr(::mlir::BoolAttr attr); + void setIsSync(bool attrValue); + void setSplitDimensionAttr(::mlir::IntegerAttr attr); + void setSplitDimension(::std::optional attrValue); + ::mlir::Attribute removeConstrainLayoutAttr(); + ::mlir::Attribute removeChannelIdAttr(); + ::mlir::Attribute removeUseGlobalDeviceIdsAttr(); + ::mlir::Attribute removeSplitDimensionAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type token, ::mlir::ValueRange inputs, ::mlir::ValueRange outputs, ::mlir::DenseIntElementsAttr replica_groups, /*optional*/::mlir::BoolAttr constrain_layout, /*optional*/::mlir::mhlo::ChannelHandleAttr channel_id, /*optional*/::mlir::BoolAttr use_global_device_ids, ::mlir::BoolAttr is_sync, /*optional*/::mlir::IntegerAttr split_dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::mlir::ValueRange outputs, ::mlir::DenseIntElementsAttr replica_groups, /*optional*/::mlir::BoolAttr constrain_layout, /*optional*/::mlir::mhlo::ChannelHandleAttr channel_id, /*optional*/::mlir::BoolAttr use_global_device_ids, ::mlir::BoolAttr is_sync, /*optional*/::mlir::IntegerAttr split_dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type token, ::mlir::ValueRange inputs, ::mlir::ValueRange outputs, ::mlir::DenseIntElementsAttr replica_groups, /*optional*/bool constrain_layout, /*optional*/::mlir::mhlo::ChannelHandleAttr channel_id, /*optional*/bool use_global_device_ids, bool is_sync, /*optional*/::mlir::IntegerAttr split_dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::mlir::ValueRange outputs, ::mlir::DenseIntElementsAttr replica_groups, /*optional*/bool constrain_layout, /*optional*/::mlir::mhlo::ChannelHandleAttr channel_id, /*optional*/bool use_global_device_ids, bool is_sync, /*optional*/::mlir::IntegerAttr split_dimension); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo_gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo_gpu::AllToAllStartOp) + +namespace mlir { +namespace lmhlo_gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo_gpu::CholeskyOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CholeskyOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CholeskyOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CholeskyOpGenericAdaptorBase(CholeskyOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getIsLowerAttr(); + bool getIsLower(); +}; +} // namespace detail +template +class CholeskyOpGenericAdaptor : public detail::CholeskyOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CholeskyOpGenericAdaptorBase; +public: + CholeskyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CholeskyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CholeskyOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CholeskyOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(1).begin()); + } + + ValueT getScratch() { + return (*getODSOperands(2).begin()); + } + + ValueT getInfo() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CholeskyOpAdaptor : public CholeskyOpGenericAdaptor<::mlir::ValueRange> { +public: + using CholeskyOpGenericAdaptor::CholeskyOpGenericAdaptor; + CholeskyOpAdaptor(CholeskyOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CholeskyOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CholeskyOpAdaptor; + template + using GenericAdaptor = CholeskyOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("is_lower")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getIsLowerAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getIsLowerAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo_gpu.cholesky"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getInput(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::TypedValue<::mlir::MemRefType> getScratch(); + ::mlir::TypedValue<::mlir::MemRefType> getInfo(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getOutputMutable(); + ::mlir::OpOperand &getScratchMutable(); + ::mlir::OpOperand &getInfoMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::BoolAttr getIsLowerAttr(); + bool getIsLower(); + void setIsLowerAttr(::mlir::BoolAttr attr); + void setIsLower(bool attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value output, ::mlir::Value scratch, ::mlir::Value info, ::mlir::BoolAttr is_lower); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value output, ::mlir::Value scratch, ::mlir::Value info, ::mlir::BoolAttr is_lower); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value output, ::mlir::Value scratch, ::mlir::Value info, bool is_lower); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value output, ::mlir::Value scratch, ::mlir::Value info, bool is_lower); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo_gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo_gpu::CholeskyOp) + +namespace mlir { +namespace lmhlo_gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo_gpu::CollectivePermuteDoneOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CollectivePermuteDoneOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CollectivePermuteDoneOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CollectivePermuteDoneOpGenericAdaptorBase(CollectivePermuteDoneOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CollectivePermuteDoneOpGenericAdaptor : public detail::CollectivePermuteDoneOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CollectivePermuteDoneOpGenericAdaptorBase; +public: + CollectivePermuteDoneOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CollectivePermuteDoneOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CollectivePermuteDoneOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CollectivePermuteDoneOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getToken() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CollectivePermuteDoneOpAdaptor : public CollectivePermuteDoneOpGenericAdaptor<::mlir::ValueRange> { +public: + using CollectivePermuteDoneOpGenericAdaptor::CollectivePermuteDoneOpGenericAdaptor; + CollectivePermuteDoneOpAdaptor(CollectivePermuteDoneOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CollectivePermuteDoneOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = CollectivePermuteDoneOpAdaptor; + template + using GenericAdaptor = CollectivePermuteDoneOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo_gpu.collective_permute_done"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getToken(); + ::mlir::OpOperand &getTokenMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value token); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value token); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace lmhlo_gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo_gpu::CollectivePermuteDoneOp) + +namespace mlir { +namespace lmhlo_gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo_gpu::CollectivePermuteStartOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CollectivePermuteStartOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CollectivePermuteStartOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CollectivePermuteStartOpGenericAdaptorBase(CollectivePermuteStartOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getSourceTargetPairsAttr(); + ::mlir::DenseIntElementsAttr getSourceTargetPairs(); + ::mlir::mhlo::ChannelHandleAttr getChannelIdAttr(); + ::std::optional<::mlir::mhlo::ChannelHandleAttr> getChannelId(); + ::mlir::BoolAttr getIsSyncAttr(); + bool getIsSync(); +}; +} // namespace detail +template +class CollectivePermuteStartOpGenericAdaptor : public detail::CollectivePermuteStartOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CollectivePermuteStartOpGenericAdaptorBase; +public: + CollectivePermuteStartOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CollectivePermuteStartOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CollectivePermuteStartOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CollectivePermuteStartOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CollectivePermuteStartOpAdaptor : public CollectivePermuteStartOpGenericAdaptor<::mlir::ValueRange> { +public: + using CollectivePermuteStartOpGenericAdaptor::CollectivePermuteStartOpGenericAdaptor; + CollectivePermuteStartOpAdaptor(CollectivePermuteStartOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CollectivePermuteStartOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<2>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CollectivePermuteStartOpAdaptor; + template + using GenericAdaptor = CollectivePermuteStartOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("channel_id"), ::llvm::StringRef("is_sync"), ::llvm::StringRef("source_target_pairs")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getChannelIdAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getChannelIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getIsSyncAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getIsSyncAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getSourceTargetPairsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getSourceTargetPairsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo_gpu.collective_permute_start"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getOperand(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getToken(); + ::mlir::DenseIntElementsAttr getSourceTargetPairsAttr(); + ::mlir::DenseIntElementsAttr getSourceTargetPairs(); + ::mlir::mhlo::ChannelHandleAttr getChannelIdAttr(); + ::std::optional<::mlir::mhlo::ChannelHandleAttr> getChannelId(); + ::mlir::BoolAttr getIsSyncAttr(); + bool getIsSync(); + void setSourceTargetPairsAttr(::mlir::DenseIntElementsAttr attr); + void setChannelIdAttr(::mlir::mhlo::ChannelHandleAttr attr); + void setIsSyncAttr(::mlir::BoolAttr attr); + void setIsSync(bool attrValue); + ::mlir::Attribute removeChannelIdAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type token, ::mlir::Value operand, ::mlir::Value output, ::mlir::DenseIntElementsAttr source_target_pairs, /*optional*/::mlir::mhlo::ChannelHandleAttr channel_id, ::mlir::BoolAttr is_sync); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value output, ::mlir::DenseIntElementsAttr source_target_pairs, /*optional*/::mlir::mhlo::ChannelHandleAttr channel_id, ::mlir::BoolAttr is_sync); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type token, ::mlir::Value operand, ::mlir::Value output, ::mlir::DenseIntElementsAttr source_target_pairs, /*optional*/::mlir::mhlo::ChannelHandleAttr channel_id, bool is_sync); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value output, ::mlir::DenseIntElementsAttr source_target_pairs, /*optional*/::mlir::mhlo::ChannelHandleAttr channel_id, bool is_sync); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo_gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo_gpu::CollectivePermuteStartOp) + +namespace mlir { +namespace lmhlo_gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo_gpu::ConvBackwardFilterOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConvBackwardFilterOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ConvBackwardFilterOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ConvBackwardFilterOpGenericAdaptorBase(ConvBackwardFilterOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getWindowStridesAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getWindowStrides(); + ::mlir::DenseIntElementsAttr getPaddingAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getPadding(); + ::mlir::DenseIntElementsAttr getLhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getLhsDilation(); + ::mlir::DenseIntElementsAttr getRhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getRhsDilation(); + ::mlir::DenseElementsAttr getWindowReversalAttr(); + ::std::optional< ::mlir::DenseElementsAttr > getWindowReversal(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbersAttr(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbers(); + ::mlir::IntegerAttr getFeatureGroupCountAttr(); + uint64_t getFeatureGroupCount(); + ::mlir::IntegerAttr getBatchGroupCountAttr(); + uint64_t getBatchGroupCount(); + ::mlir::ArrayAttr getPrecisionConfigAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrecisionConfig(); + ::mlir::FloatAttr getResultScaleAttr(); + ::llvm::APFloat getResultScale(); + ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr getBackendConfigAttr(); + ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr getBackendConfig(); +}; +} // namespace detail +template +class ConvBackwardFilterOpGenericAdaptor : public detail::ConvBackwardFilterOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConvBackwardFilterOpGenericAdaptorBase; +public: + ConvBackwardFilterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConvBackwardFilterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConvBackwardFilterOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ConvBackwardFilterOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getDOutput() { + return (*getODSOperands(1).begin()); + } + + ValueT getDFilter() { + return (*getODSOperands(2).begin()); + } + + ValueT getScratch() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConvBackwardFilterOpAdaptor : public ConvBackwardFilterOpGenericAdaptor<::mlir::ValueRange> { +public: + using ConvBackwardFilterOpGenericAdaptor::ConvBackwardFilterOpGenericAdaptor; + ConvBackwardFilterOpAdaptor(ConvBackwardFilterOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConvBackwardFilterOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ConvBackwardFilterOpAdaptor; + template + using GenericAdaptor = ConvBackwardFilterOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("backend_config"), ::llvm::StringRef("batch_group_count"), ::llvm::StringRef("dimension_numbers"), ::llvm::StringRef("feature_group_count"), ::llvm::StringRef("lhs_dilation"), ::llvm::StringRef("padding"), ::llvm::StringRef("precision_config"), ::llvm::StringRef("result_scale"), ::llvm::StringRef("rhs_dilation"), ::llvm::StringRef("window_reversal"), ::llvm::StringRef("window_strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBackendConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBackendConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getBatchGroupCountAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getBatchGroupCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDimensionNumbersAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDimensionNumbersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getFeatureGroupCountAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getFeatureGroupCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getLhsDilationAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getLhsDilationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getPrecisionConfigAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getPrecisionConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getResultScaleAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getResultScaleAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getRhsDilationAttrName() { + return getAttributeNameForIndex(8); + } + + static ::mlir::StringAttr getRhsDilationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 8); + } + + ::mlir::StringAttr getWindowReversalAttrName() { + return getAttributeNameForIndex(9); + } + + static ::mlir::StringAttr getWindowReversalAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 9); + } + + ::mlir::StringAttr getWindowStridesAttrName() { + return getAttributeNameForIndex(10); + } + + static ::mlir::StringAttr getWindowStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 10); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo_gpu.conv_backwardfilter"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getInput(); + ::mlir::TypedValue<::mlir::MemRefType> getDOutput(); + ::mlir::TypedValue<::mlir::MemRefType> getDFilter(); + ::mlir::TypedValue<::mlir::MemRefType> getScratch(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getDOutputMutable(); + ::mlir::OpOperand &getDFilterMutable(); + ::mlir::OpOperand &getScratchMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::DenseIntElementsAttr getWindowStridesAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getWindowStrides(); + ::mlir::DenseIntElementsAttr getPaddingAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getPadding(); + ::mlir::DenseIntElementsAttr getLhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getLhsDilation(); + ::mlir::DenseIntElementsAttr getRhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getRhsDilation(); + ::mlir::DenseElementsAttr getWindowReversalAttr(); + ::std::optional< ::mlir::DenseElementsAttr > getWindowReversal(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbersAttr(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbers(); + ::mlir::IntegerAttr getFeatureGroupCountAttr(); + uint64_t getFeatureGroupCount(); + ::mlir::IntegerAttr getBatchGroupCountAttr(); + uint64_t getBatchGroupCount(); + ::mlir::ArrayAttr getPrecisionConfigAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrecisionConfig(); + ::mlir::FloatAttr getResultScaleAttr(); + ::llvm::APFloat getResultScale(); + ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr getBackendConfigAttr(); + ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr getBackendConfig(); + void setWindowStridesAttr(::mlir::DenseIntElementsAttr attr); + void setPaddingAttr(::mlir::DenseIntElementsAttr attr); + void setLhsDilationAttr(::mlir::DenseIntElementsAttr attr); + void setRhsDilationAttr(::mlir::DenseIntElementsAttr attr); + void setWindowReversalAttr(::mlir::DenseElementsAttr attr); + void setDimensionNumbersAttr(::mlir::mhlo::ConvDimensionNumbersAttr attr); + void setFeatureGroupCountAttr(::mlir::IntegerAttr attr); + void setFeatureGroupCount(uint64_t attrValue); + void setBatchGroupCountAttr(::mlir::IntegerAttr attr); + void setBatchGroupCount(uint64_t attrValue); + void setPrecisionConfigAttr(::mlir::ArrayAttr attr); + void setResultScaleAttr(::mlir::FloatAttr attr); + void setResultScale(::llvm::APFloat attrValue); + void setBackendConfigAttr(::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr attr); + ::mlir::Attribute removeWindowStridesAttr(); + ::mlir::Attribute removePaddingAttr(); + ::mlir::Attribute removeLhsDilationAttr(); + ::mlir::Attribute removeRhsDilationAttr(); + ::mlir::Attribute removeWindowReversalAttr(); + ::mlir::Attribute removePrecisionConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value d_output, ::mlir::Value d_filter, ::mlir::Value scratch, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, ::mlir::IntegerAttr feature_group_count, ::mlir::IntegerAttr batch_group_count, /*optional*/::mlir::ArrayAttr precision_config, ::mlir::FloatAttr result_scale, ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr backend_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value d_output, ::mlir::Value d_filter, ::mlir::Value scratch, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, ::mlir::IntegerAttr feature_group_count, ::mlir::IntegerAttr batch_group_count, /*optional*/::mlir::ArrayAttr precision_config, ::mlir::FloatAttr result_scale, ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr backend_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value d_output, ::mlir::Value d_filter, ::mlir::Value scratch, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, uint64_t feature_group_count, uint64_t batch_group_count, /*optional*/::mlir::ArrayAttr precision_config, ::llvm::APFloat result_scale, ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr backend_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value d_output, ::mlir::Value d_filter, ::mlir::Value scratch, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, uint64_t feature_group_count, uint64_t batch_group_count, /*optional*/::mlir::ArrayAttr precision_config, ::llvm::APFloat result_scale, ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr backend_config); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 11 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo_gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo_gpu::ConvBackwardFilterOp) + +namespace mlir { +namespace lmhlo_gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo_gpu::ConvBackwardInputOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConvBackwardInputOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ConvBackwardInputOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ConvBackwardInputOpGenericAdaptorBase(ConvBackwardInputOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getWindowStridesAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getWindowStrides(); + ::mlir::DenseIntElementsAttr getPaddingAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getPadding(); + ::mlir::DenseIntElementsAttr getLhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getLhsDilation(); + ::mlir::DenseIntElementsAttr getRhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getRhsDilation(); + ::mlir::DenseElementsAttr getWindowReversalAttr(); + ::std::optional< ::mlir::DenseElementsAttr > getWindowReversal(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbersAttr(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbers(); + ::mlir::IntegerAttr getFeatureGroupCountAttr(); + uint64_t getFeatureGroupCount(); + ::mlir::IntegerAttr getBatchGroupCountAttr(); + uint64_t getBatchGroupCount(); + ::mlir::ArrayAttr getPrecisionConfigAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrecisionConfig(); + ::mlir::FloatAttr getResultScaleAttr(); + ::llvm::APFloat getResultScale(); + ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr getBackendConfigAttr(); + ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr getBackendConfig(); +}; +} // namespace detail +template +class ConvBackwardInputOpGenericAdaptor : public detail::ConvBackwardInputOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConvBackwardInputOpGenericAdaptorBase; +public: + ConvBackwardInputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConvBackwardInputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConvBackwardInputOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ConvBackwardInputOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getDOutput() { + return (*getODSOperands(0).begin()); + } + + ValueT getFilter() { + return (*getODSOperands(1).begin()); + } + + ValueT getDInput() { + return (*getODSOperands(2).begin()); + } + + ValueT getScratch() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConvBackwardInputOpAdaptor : public ConvBackwardInputOpGenericAdaptor<::mlir::ValueRange> { +public: + using ConvBackwardInputOpGenericAdaptor::ConvBackwardInputOpGenericAdaptor; + ConvBackwardInputOpAdaptor(ConvBackwardInputOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConvBackwardInputOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ConvBackwardInputOpAdaptor; + template + using GenericAdaptor = ConvBackwardInputOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("backend_config"), ::llvm::StringRef("batch_group_count"), ::llvm::StringRef("dimension_numbers"), ::llvm::StringRef("feature_group_count"), ::llvm::StringRef("lhs_dilation"), ::llvm::StringRef("padding"), ::llvm::StringRef("precision_config"), ::llvm::StringRef("result_scale"), ::llvm::StringRef("rhs_dilation"), ::llvm::StringRef("window_reversal"), ::llvm::StringRef("window_strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBackendConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBackendConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getBatchGroupCountAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getBatchGroupCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDimensionNumbersAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDimensionNumbersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getFeatureGroupCountAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getFeatureGroupCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getLhsDilationAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getLhsDilationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getPrecisionConfigAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getPrecisionConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getResultScaleAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getResultScaleAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getRhsDilationAttrName() { + return getAttributeNameForIndex(8); + } + + static ::mlir::StringAttr getRhsDilationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 8); + } + + ::mlir::StringAttr getWindowReversalAttrName() { + return getAttributeNameForIndex(9); + } + + static ::mlir::StringAttr getWindowReversalAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 9); + } + + ::mlir::StringAttr getWindowStridesAttrName() { + return getAttributeNameForIndex(10); + } + + static ::mlir::StringAttr getWindowStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 10); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo_gpu.conv_backwardinput"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getDOutput(); + ::mlir::TypedValue<::mlir::MemRefType> getFilter(); + ::mlir::TypedValue<::mlir::MemRefType> getDInput(); + ::mlir::TypedValue<::mlir::MemRefType> getScratch(); + ::mlir::OpOperand &getDOutputMutable(); + ::mlir::OpOperand &getFilterMutable(); + ::mlir::OpOperand &getDInputMutable(); + ::mlir::OpOperand &getScratchMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::DenseIntElementsAttr getWindowStridesAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getWindowStrides(); + ::mlir::DenseIntElementsAttr getPaddingAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getPadding(); + ::mlir::DenseIntElementsAttr getLhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getLhsDilation(); + ::mlir::DenseIntElementsAttr getRhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getRhsDilation(); + ::mlir::DenseElementsAttr getWindowReversalAttr(); + ::std::optional< ::mlir::DenseElementsAttr > getWindowReversal(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbersAttr(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbers(); + ::mlir::IntegerAttr getFeatureGroupCountAttr(); + uint64_t getFeatureGroupCount(); + ::mlir::IntegerAttr getBatchGroupCountAttr(); + uint64_t getBatchGroupCount(); + ::mlir::ArrayAttr getPrecisionConfigAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrecisionConfig(); + ::mlir::FloatAttr getResultScaleAttr(); + ::llvm::APFloat getResultScale(); + ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr getBackendConfigAttr(); + ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr getBackendConfig(); + void setWindowStridesAttr(::mlir::DenseIntElementsAttr attr); + void setPaddingAttr(::mlir::DenseIntElementsAttr attr); + void setLhsDilationAttr(::mlir::DenseIntElementsAttr attr); + void setRhsDilationAttr(::mlir::DenseIntElementsAttr attr); + void setWindowReversalAttr(::mlir::DenseElementsAttr attr); + void setDimensionNumbersAttr(::mlir::mhlo::ConvDimensionNumbersAttr attr); + void setFeatureGroupCountAttr(::mlir::IntegerAttr attr); + void setFeatureGroupCount(uint64_t attrValue); + void setBatchGroupCountAttr(::mlir::IntegerAttr attr); + void setBatchGroupCount(uint64_t attrValue); + void setPrecisionConfigAttr(::mlir::ArrayAttr attr); + void setResultScaleAttr(::mlir::FloatAttr attr); + void setResultScale(::llvm::APFloat attrValue); + void setBackendConfigAttr(::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr attr); + ::mlir::Attribute removeWindowStridesAttr(); + ::mlir::Attribute removePaddingAttr(); + ::mlir::Attribute removeLhsDilationAttr(); + ::mlir::Attribute removeRhsDilationAttr(); + ::mlir::Attribute removeWindowReversalAttr(); + ::mlir::Attribute removePrecisionConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value d_output, ::mlir::Value filter, ::mlir::Value d_input, ::mlir::Value scratch, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, ::mlir::IntegerAttr feature_group_count, ::mlir::IntegerAttr batch_group_count, /*optional*/::mlir::ArrayAttr precision_config, ::mlir::FloatAttr result_scale, ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr backend_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value d_output, ::mlir::Value filter, ::mlir::Value d_input, ::mlir::Value scratch, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, ::mlir::IntegerAttr feature_group_count, ::mlir::IntegerAttr batch_group_count, /*optional*/::mlir::ArrayAttr precision_config, ::mlir::FloatAttr result_scale, ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr backend_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value d_output, ::mlir::Value filter, ::mlir::Value d_input, ::mlir::Value scratch, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, uint64_t feature_group_count, uint64_t batch_group_count, /*optional*/::mlir::ArrayAttr precision_config, ::llvm::APFloat result_scale, ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr backend_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value d_output, ::mlir::Value filter, ::mlir::Value d_input, ::mlir::Value scratch, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, uint64_t feature_group_count, uint64_t batch_group_count, /*optional*/::mlir::ArrayAttr precision_config, ::llvm::APFloat result_scale, ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr backend_config); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 11 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo_gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo_gpu::ConvBackwardInputOp) + +namespace mlir { +namespace lmhlo_gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo_gpu::ConvForwardFusedOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConvForwardFusedOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ConvForwardFusedOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ConvForwardFusedOpGenericAdaptorBase(ConvForwardFusedOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getWindowStridesAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getWindowStrides(); + ::mlir::DenseIntElementsAttr getPaddingAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getPadding(); + ::mlir::DenseIntElementsAttr getLhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getLhsDilation(); + ::mlir::DenseIntElementsAttr getRhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getRhsDilation(); + ::mlir::DenseElementsAttr getWindowReversalAttr(); + ::std::optional< ::mlir::DenseElementsAttr > getWindowReversal(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbersAttr(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbers(); + ::mlir::IntegerAttr getFeatureGroupCountAttr(); + uint64_t getFeatureGroupCount(); + ::mlir::IntegerAttr getBatchGroupCountAttr(); + uint64_t getBatchGroupCount(); + ::mlir::ArrayAttr getPrecisionConfigAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrecisionConfig(); + ::mlir::FloatAttr getResultScaleAttr(); + ::llvm::APFloat getResultScale(); + ::mlir::lmhlo_gpu::ActivationAttr getActivationModeAttr(); + ::mlir::lmhlo_gpu::Activation getActivationMode(); + ::mlir::FloatAttr getLeakyreluAlphaAttr(); + ::llvm::APFloat getLeakyreluAlpha(); + ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr getBackendConfigAttr(); + ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr getBackendConfig(); +}; +} // namespace detail +template +class ConvForwardFusedOpGenericAdaptor : public detail::ConvForwardFusedOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConvForwardFusedOpGenericAdaptorBase; +public: + ConvForwardFusedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConvForwardFusedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConvForwardFusedOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ConvForwardFusedOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getFilter() { + return (*getODSOperands(1).begin()); + } + + ValueT getBias() { + return (*getODSOperands(2).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(3).begin()); + } + + ValueT getScratch() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConvForwardFusedOpAdaptor : public ConvForwardFusedOpGenericAdaptor<::mlir::ValueRange> { +public: + using ConvForwardFusedOpGenericAdaptor::ConvForwardFusedOpGenericAdaptor; + ConvForwardFusedOpAdaptor(ConvForwardFusedOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConvForwardFusedOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ConvForwardFusedOpAdaptor; + template + using GenericAdaptor = ConvForwardFusedOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("activation_mode"), ::llvm::StringRef("backend_config"), ::llvm::StringRef("batch_group_count"), ::llvm::StringRef("dimension_numbers"), ::llvm::StringRef("feature_group_count"), ::llvm::StringRef("leakyrelu_alpha"), ::llvm::StringRef("lhs_dilation"), ::llvm::StringRef("padding"), ::llvm::StringRef("precision_config"), ::llvm::StringRef("result_scale"), ::llvm::StringRef("rhs_dilation"), ::llvm::StringRef("window_reversal"), ::llvm::StringRef("window_strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getActivationModeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getActivationModeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getBackendConfigAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getBackendConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getBatchGroupCountAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getBatchGroupCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getDimensionNumbersAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getDimensionNumbersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getFeatureGroupCountAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getFeatureGroupCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getLeakyreluAlphaAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getLeakyreluAlphaAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getLhsDilationAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getLhsDilationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getPrecisionConfigAttrName() { + return getAttributeNameForIndex(8); + } + + static ::mlir::StringAttr getPrecisionConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 8); + } + + ::mlir::StringAttr getResultScaleAttrName() { + return getAttributeNameForIndex(9); + } + + static ::mlir::StringAttr getResultScaleAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 9); + } + + ::mlir::StringAttr getRhsDilationAttrName() { + return getAttributeNameForIndex(10); + } + + static ::mlir::StringAttr getRhsDilationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 10); + } + + ::mlir::StringAttr getWindowReversalAttrName() { + return getAttributeNameForIndex(11); + } + + static ::mlir::StringAttr getWindowReversalAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 11); + } + + ::mlir::StringAttr getWindowStridesAttrName() { + return getAttributeNameForIndex(12); + } + + static ::mlir::StringAttr getWindowStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 12); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo_gpu.conv_forward_fused"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getInput(); + ::mlir::TypedValue<::mlir::MemRefType> getFilter(); + ::mlir::TypedValue<::mlir::MemRefType> getBias(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::TypedValue<::mlir::MemRefType> getScratch(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getFilterMutable(); + ::mlir::OpOperand &getBiasMutable(); + ::mlir::OpOperand &getOutputMutable(); + ::mlir::OpOperand &getScratchMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::DenseIntElementsAttr getWindowStridesAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getWindowStrides(); + ::mlir::DenseIntElementsAttr getPaddingAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getPadding(); + ::mlir::DenseIntElementsAttr getLhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getLhsDilation(); + ::mlir::DenseIntElementsAttr getRhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getRhsDilation(); + ::mlir::DenseElementsAttr getWindowReversalAttr(); + ::std::optional< ::mlir::DenseElementsAttr > getWindowReversal(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbersAttr(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbers(); + ::mlir::IntegerAttr getFeatureGroupCountAttr(); + uint64_t getFeatureGroupCount(); + ::mlir::IntegerAttr getBatchGroupCountAttr(); + uint64_t getBatchGroupCount(); + ::mlir::ArrayAttr getPrecisionConfigAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrecisionConfig(); + ::mlir::FloatAttr getResultScaleAttr(); + ::llvm::APFloat getResultScale(); + ::mlir::lmhlo_gpu::ActivationAttr getActivationModeAttr(); + ::mlir::lmhlo_gpu::Activation getActivationMode(); + ::mlir::FloatAttr getLeakyreluAlphaAttr(); + ::llvm::APFloat getLeakyreluAlpha(); + ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr getBackendConfigAttr(); + ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr getBackendConfig(); + void setWindowStridesAttr(::mlir::DenseIntElementsAttr attr); + void setPaddingAttr(::mlir::DenseIntElementsAttr attr); + void setLhsDilationAttr(::mlir::DenseIntElementsAttr attr); + void setRhsDilationAttr(::mlir::DenseIntElementsAttr attr); + void setWindowReversalAttr(::mlir::DenseElementsAttr attr); + void setDimensionNumbersAttr(::mlir::mhlo::ConvDimensionNumbersAttr attr); + void setFeatureGroupCountAttr(::mlir::IntegerAttr attr); + void setFeatureGroupCount(uint64_t attrValue); + void setBatchGroupCountAttr(::mlir::IntegerAttr attr); + void setBatchGroupCount(uint64_t attrValue); + void setPrecisionConfigAttr(::mlir::ArrayAttr attr); + void setResultScaleAttr(::mlir::FloatAttr attr); + void setResultScale(::llvm::APFloat attrValue); + void setActivationModeAttr(::mlir::lmhlo_gpu::ActivationAttr attr); + void setActivationMode(::mlir::lmhlo_gpu::Activation attrValue); + void setLeakyreluAlphaAttr(::mlir::FloatAttr attr); + void setLeakyreluAlpha(::llvm::APFloat attrValue); + void setBackendConfigAttr(::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr attr); + ::mlir::Attribute removeWindowStridesAttr(); + ::mlir::Attribute removePaddingAttr(); + ::mlir::Attribute removeLhsDilationAttr(); + ::mlir::Attribute removeRhsDilationAttr(); + ::mlir::Attribute removeWindowReversalAttr(); + ::mlir::Attribute removePrecisionConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value filter, ::mlir::Value bias, ::mlir::Value output, ::mlir::Value scratch, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, ::mlir::IntegerAttr feature_group_count, ::mlir::IntegerAttr batch_group_count, /*optional*/::mlir::ArrayAttr precision_config, ::mlir::FloatAttr result_scale, ::mlir::lmhlo_gpu::ActivationAttr activation_mode, ::mlir::FloatAttr leakyrelu_alpha, ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr backend_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter, ::mlir::Value bias, ::mlir::Value output, ::mlir::Value scratch, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, ::mlir::IntegerAttr feature_group_count, ::mlir::IntegerAttr batch_group_count, /*optional*/::mlir::ArrayAttr precision_config, ::mlir::FloatAttr result_scale, ::mlir::lmhlo_gpu::ActivationAttr activation_mode, ::mlir::FloatAttr leakyrelu_alpha, ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr backend_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value filter, ::mlir::Value bias, ::mlir::Value output, ::mlir::Value scratch, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, uint64_t feature_group_count, uint64_t batch_group_count, /*optional*/::mlir::ArrayAttr precision_config, ::llvm::APFloat result_scale, ::mlir::lmhlo_gpu::Activation activation_mode, ::llvm::APFloat leakyrelu_alpha, ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr backend_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter, ::mlir::Value bias, ::mlir::Value output, ::mlir::Value scratch, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, uint64_t feature_group_count, uint64_t batch_group_count, /*optional*/::mlir::ArrayAttr precision_config, ::llvm::APFloat result_scale, ::mlir::lmhlo_gpu::Activation activation_mode, ::llvm::APFloat leakyrelu_alpha, ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr backend_config); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 13 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo_gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo_gpu::ConvForwardFusedOp) + +namespace mlir { +namespace lmhlo_gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo_gpu::ConvForwardFusedSideInputOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConvForwardFusedSideInputOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ConvForwardFusedSideInputOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ConvForwardFusedSideInputOpGenericAdaptorBase(ConvForwardFusedSideInputOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getWindowStridesAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getWindowStrides(); + ::mlir::DenseIntElementsAttr getPaddingAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getPadding(); + ::mlir::DenseIntElementsAttr getLhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getLhsDilation(); + ::mlir::DenseIntElementsAttr getRhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getRhsDilation(); + ::mlir::DenseElementsAttr getWindowReversalAttr(); + ::std::optional< ::mlir::DenseElementsAttr > getWindowReversal(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbersAttr(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbers(); + ::mlir::IntegerAttr getFeatureGroupCountAttr(); + uint64_t getFeatureGroupCount(); + ::mlir::IntegerAttr getBatchGroupCountAttr(); + uint64_t getBatchGroupCount(); + ::mlir::ArrayAttr getPrecisionConfigAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrecisionConfig(); + ::mlir::FloatAttr getResultScaleAttr(); + ::llvm::APFloat getResultScale(); + ::mlir::lmhlo_gpu::ActivationAttr getActivationModeAttr(); + ::mlir::lmhlo_gpu::Activation getActivationMode(); + ::mlir::FloatAttr getSideInputScaleAttr(); + ::llvm::APFloat getSideInputScale(); + ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr getBackendConfigAttr(); + ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr getBackendConfig(); +}; +} // namespace detail +template +class ConvForwardFusedSideInputOpGenericAdaptor : public detail::ConvForwardFusedSideInputOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConvForwardFusedSideInputOpGenericAdaptorBase; +public: + ConvForwardFusedSideInputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConvForwardFusedSideInputOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConvForwardFusedSideInputOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ConvForwardFusedSideInputOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getFilter() { + return (*getODSOperands(1).begin()); + } + + ValueT getBias() { + return (*getODSOperands(2).begin()); + } + + ValueT getSideInput() { + return (*getODSOperands(3).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(4).begin()); + } + + ValueT getScratch() { + return (*getODSOperands(5).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConvForwardFusedSideInputOpAdaptor : public ConvForwardFusedSideInputOpGenericAdaptor<::mlir::ValueRange> { +public: + using ConvForwardFusedSideInputOpGenericAdaptor::ConvForwardFusedSideInputOpGenericAdaptor; + ConvForwardFusedSideInputOpAdaptor(ConvForwardFusedSideInputOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConvForwardFusedSideInputOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ConvForwardFusedSideInputOpAdaptor; + template + using GenericAdaptor = ConvForwardFusedSideInputOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("activation_mode"), ::llvm::StringRef("backend_config"), ::llvm::StringRef("batch_group_count"), ::llvm::StringRef("dimension_numbers"), ::llvm::StringRef("feature_group_count"), ::llvm::StringRef("lhs_dilation"), ::llvm::StringRef("padding"), ::llvm::StringRef("precision_config"), ::llvm::StringRef("result_scale"), ::llvm::StringRef("rhs_dilation"), ::llvm::StringRef("side_input_scale"), ::llvm::StringRef("window_reversal"), ::llvm::StringRef("window_strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getActivationModeAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getActivationModeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getBackendConfigAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getBackendConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getBatchGroupCountAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getBatchGroupCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getDimensionNumbersAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getDimensionNumbersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getFeatureGroupCountAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getFeatureGroupCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getLhsDilationAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getLhsDilationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getPrecisionConfigAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getPrecisionConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getResultScaleAttrName() { + return getAttributeNameForIndex(8); + } + + static ::mlir::StringAttr getResultScaleAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 8); + } + + ::mlir::StringAttr getRhsDilationAttrName() { + return getAttributeNameForIndex(9); + } + + static ::mlir::StringAttr getRhsDilationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 9); + } + + ::mlir::StringAttr getSideInputScaleAttrName() { + return getAttributeNameForIndex(10); + } + + static ::mlir::StringAttr getSideInputScaleAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 10); + } + + ::mlir::StringAttr getWindowReversalAttrName() { + return getAttributeNameForIndex(11); + } + + static ::mlir::StringAttr getWindowReversalAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 11); + } + + ::mlir::StringAttr getWindowStridesAttrName() { + return getAttributeNameForIndex(12); + } + + static ::mlir::StringAttr getWindowStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 12); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo_gpu.conv_forward_fused_with_side_input"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getInput(); + ::mlir::TypedValue<::mlir::MemRefType> getFilter(); + ::mlir::TypedValue<::mlir::MemRefType> getBias(); + ::mlir::TypedValue<::mlir::MemRefType> getSideInput(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::TypedValue<::mlir::MemRefType> getScratch(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getFilterMutable(); + ::mlir::OpOperand &getBiasMutable(); + ::mlir::OpOperand &getSideInputMutable(); + ::mlir::OpOperand &getOutputMutable(); + ::mlir::OpOperand &getScratchMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::DenseIntElementsAttr getWindowStridesAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getWindowStrides(); + ::mlir::DenseIntElementsAttr getPaddingAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getPadding(); + ::mlir::DenseIntElementsAttr getLhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getLhsDilation(); + ::mlir::DenseIntElementsAttr getRhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getRhsDilation(); + ::mlir::DenseElementsAttr getWindowReversalAttr(); + ::std::optional< ::mlir::DenseElementsAttr > getWindowReversal(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbersAttr(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbers(); + ::mlir::IntegerAttr getFeatureGroupCountAttr(); + uint64_t getFeatureGroupCount(); + ::mlir::IntegerAttr getBatchGroupCountAttr(); + uint64_t getBatchGroupCount(); + ::mlir::ArrayAttr getPrecisionConfigAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrecisionConfig(); + ::mlir::FloatAttr getResultScaleAttr(); + ::llvm::APFloat getResultScale(); + ::mlir::lmhlo_gpu::ActivationAttr getActivationModeAttr(); + ::mlir::lmhlo_gpu::Activation getActivationMode(); + ::mlir::FloatAttr getSideInputScaleAttr(); + ::llvm::APFloat getSideInputScale(); + ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr getBackendConfigAttr(); + ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr getBackendConfig(); + void setWindowStridesAttr(::mlir::DenseIntElementsAttr attr); + void setPaddingAttr(::mlir::DenseIntElementsAttr attr); + void setLhsDilationAttr(::mlir::DenseIntElementsAttr attr); + void setRhsDilationAttr(::mlir::DenseIntElementsAttr attr); + void setWindowReversalAttr(::mlir::DenseElementsAttr attr); + void setDimensionNumbersAttr(::mlir::mhlo::ConvDimensionNumbersAttr attr); + void setFeatureGroupCountAttr(::mlir::IntegerAttr attr); + void setFeatureGroupCount(uint64_t attrValue); + void setBatchGroupCountAttr(::mlir::IntegerAttr attr); + void setBatchGroupCount(uint64_t attrValue); + void setPrecisionConfigAttr(::mlir::ArrayAttr attr); + void setResultScaleAttr(::mlir::FloatAttr attr); + void setResultScale(::llvm::APFloat attrValue); + void setActivationModeAttr(::mlir::lmhlo_gpu::ActivationAttr attr); + void setActivationMode(::mlir::lmhlo_gpu::Activation attrValue); + void setSideInputScaleAttr(::mlir::FloatAttr attr); + void setSideInputScale(::llvm::APFloat attrValue); + void setBackendConfigAttr(::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr attr); + ::mlir::Attribute removeWindowStridesAttr(); + ::mlir::Attribute removePaddingAttr(); + ::mlir::Attribute removeLhsDilationAttr(); + ::mlir::Attribute removeRhsDilationAttr(); + ::mlir::Attribute removeWindowReversalAttr(); + ::mlir::Attribute removePrecisionConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value filter, ::mlir::Value bias, ::mlir::Value side_input, ::mlir::Value output, ::mlir::Value scratch, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, ::mlir::IntegerAttr feature_group_count, ::mlir::IntegerAttr batch_group_count, /*optional*/::mlir::ArrayAttr precision_config, ::mlir::FloatAttr result_scale, ::mlir::lmhlo_gpu::ActivationAttr activation_mode, ::mlir::FloatAttr side_input_scale, ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr backend_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter, ::mlir::Value bias, ::mlir::Value side_input, ::mlir::Value output, ::mlir::Value scratch, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, ::mlir::IntegerAttr feature_group_count, ::mlir::IntegerAttr batch_group_count, /*optional*/::mlir::ArrayAttr precision_config, ::mlir::FloatAttr result_scale, ::mlir::lmhlo_gpu::ActivationAttr activation_mode, ::mlir::FloatAttr side_input_scale, ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr backend_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value filter, ::mlir::Value bias, ::mlir::Value side_input, ::mlir::Value output, ::mlir::Value scratch, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, uint64_t feature_group_count, uint64_t batch_group_count, /*optional*/::mlir::ArrayAttr precision_config, ::llvm::APFloat result_scale, ::mlir::lmhlo_gpu::Activation activation_mode, ::llvm::APFloat side_input_scale, ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr backend_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter, ::mlir::Value bias, ::mlir::Value side_input, ::mlir::Value output, ::mlir::Value scratch, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, uint64_t feature_group_count, uint64_t batch_group_count, /*optional*/::mlir::ArrayAttr precision_config, ::llvm::APFloat result_scale, ::mlir::lmhlo_gpu::Activation activation_mode, ::llvm::APFloat side_input_scale, ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr backend_config); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 13 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo_gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo_gpu::ConvForwardFusedSideInputOp) + +namespace mlir { +namespace lmhlo_gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo_gpu::ConvForwardGraphOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConvForwardGraphOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ConvForwardGraphOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ConvForwardGraphOpGenericAdaptorBase(ConvForwardGraphOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getWindowStridesAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getWindowStrides(); + ::mlir::DenseIntElementsAttr getPaddingAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getPadding(); + ::mlir::DenseIntElementsAttr getLhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getLhsDilation(); + ::mlir::DenseIntElementsAttr getRhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getRhsDilation(); + ::mlir::DenseElementsAttr getWindowReversalAttr(); + ::std::optional< ::mlir::DenseElementsAttr > getWindowReversal(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbersAttr(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbers(); + ::mlir::IntegerAttr getFeatureGroupCountAttr(); + uint64_t getFeatureGroupCount(); + ::mlir::IntegerAttr getBatchGroupCountAttr(); + uint64_t getBatchGroupCount(); + ::mlir::ArrayAttr getPrecisionConfigAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrecisionConfig(); + ::mlir::FloatAttr getResultScaleAttr(); + ::llvm::APFloat getResultScale(); + ::mlir::IntegerAttr getNAuxOutputsAttr(); + uint32_t getNAuxOutputs(); + ::mlir::StringAttr getSerializedGraphAttr(); + ::llvm::StringRef getSerializedGraph(); + ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr getBackendConfigAttr(); + ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr getBackendConfig(); +}; +} // namespace detail +template +class ConvForwardGraphOpGenericAdaptor : public detail::ConvForwardGraphOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConvForwardGraphOpGenericAdaptorBase; +public: + ConvForwardGraphOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConvForwardGraphOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConvForwardGraphOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ConvForwardGraphOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getFilter() { + return (*getODSOperands(1).begin()); + } + + RangeT getBinaryOperands() { + return getODSOperands(2); + } + + ValueT getOutput() { + return (*getODSOperands(3).begin()); + } + + RangeT getAuxOutputs() { + return getODSOperands(4); + } + + ValueT getScratch() { + return (*getODSOperands(5).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConvForwardGraphOpAdaptor : public ConvForwardGraphOpGenericAdaptor<::mlir::ValueRange> { +public: + using ConvForwardGraphOpGenericAdaptor::ConvForwardGraphOpGenericAdaptor; + ConvForwardGraphOpAdaptor(ConvForwardGraphOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConvForwardGraphOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ConvForwardGraphOpAdaptor; + template + using GenericAdaptor = ConvForwardGraphOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("backend_config"), ::llvm::StringRef("batch_group_count"), ::llvm::StringRef("dimension_numbers"), ::llvm::StringRef("feature_group_count"), ::llvm::StringRef("lhs_dilation"), ::llvm::StringRef("n_aux_outputs"), ::llvm::StringRef("operandSegmentSizes"), ::llvm::StringRef("padding"), ::llvm::StringRef("precision_config"), ::llvm::StringRef("result_scale"), ::llvm::StringRef("rhs_dilation"), ::llvm::StringRef("serialized_graph"), ::llvm::StringRef("window_reversal"), ::llvm::StringRef("window_strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBackendConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBackendConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getBatchGroupCountAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getBatchGroupCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDimensionNumbersAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDimensionNumbersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getFeatureGroupCountAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getFeatureGroupCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getLhsDilationAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getLhsDilationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getNAuxOutputsAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getNAuxOutputsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getPrecisionConfigAttrName() { + return getAttributeNameForIndex(8); + } + + static ::mlir::StringAttr getPrecisionConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 8); + } + + ::mlir::StringAttr getResultScaleAttrName() { + return getAttributeNameForIndex(9); + } + + static ::mlir::StringAttr getResultScaleAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 9); + } + + ::mlir::StringAttr getRhsDilationAttrName() { + return getAttributeNameForIndex(10); + } + + static ::mlir::StringAttr getRhsDilationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 10); + } + + ::mlir::StringAttr getSerializedGraphAttrName() { + return getAttributeNameForIndex(11); + } + + static ::mlir::StringAttr getSerializedGraphAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 11); + } + + ::mlir::StringAttr getWindowReversalAttrName() { + return getAttributeNameForIndex(12); + } + + static ::mlir::StringAttr getWindowReversalAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 12); + } + + ::mlir::StringAttr getWindowStridesAttrName() { + return getAttributeNameForIndex(13); + } + + static ::mlir::StringAttr getWindowStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 13); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo_gpu.conv_forward_graph"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getInput(); + ::mlir::TypedValue<::mlir::MemRefType> getFilter(); + ::mlir::Operation::operand_range getBinaryOperands(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::Operation::operand_range getAuxOutputs(); + ::mlir::TypedValue<::mlir::MemRefType> getScratch(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getFilterMutable(); + ::mlir::MutableOperandRange getBinaryOperandsMutable(); + ::mlir::OpOperand &getOutputMutable(); + ::mlir::MutableOperandRange getAuxOutputsMutable(); + ::mlir::OpOperand &getScratchMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::DenseIntElementsAttr getWindowStridesAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getWindowStrides(); + ::mlir::DenseIntElementsAttr getPaddingAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getPadding(); + ::mlir::DenseIntElementsAttr getLhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getLhsDilation(); + ::mlir::DenseIntElementsAttr getRhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getRhsDilation(); + ::mlir::DenseElementsAttr getWindowReversalAttr(); + ::std::optional< ::mlir::DenseElementsAttr > getWindowReversal(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbersAttr(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbers(); + ::mlir::IntegerAttr getFeatureGroupCountAttr(); + uint64_t getFeatureGroupCount(); + ::mlir::IntegerAttr getBatchGroupCountAttr(); + uint64_t getBatchGroupCount(); + ::mlir::ArrayAttr getPrecisionConfigAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrecisionConfig(); + ::mlir::FloatAttr getResultScaleAttr(); + ::llvm::APFloat getResultScale(); + ::mlir::IntegerAttr getNAuxOutputsAttr(); + uint32_t getNAuxOutputs(); + ::mlir::StringAttr getSerializedGraphAttr(); + ::llvm::StringRef getSerializedGraph(); + ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr getBackendConfigAttr(); + ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr getBackendConfig(); + void setWindowStridesAttr(::mlir::DenseIntElementsAttr attr); + void setPaddingAttr(::mlir::DenseIntElementsAttr attr); + void setLhsDilationAttr(::mlir::DenseIntElementsAttr attr); + void setRhsDilationAttr(::mlir::DenseIntElementsAttr attr); + void setWindowReversalAttr(::mlir::DenseElementsAttr attr); + void setDimensionNumbersAttr(::mlir::mhlo::ConvDimensionNumbersAttr attr); + void setFeatureGroupCountAttr(::mlir::IntegerAttr attr); + void setFeatureGroupCount(uint64_t attrValue); + void setBatchGroupCountAttr(::mlir::IntegerAttr attr); + void setBatchGroupCount(uint64_t attrValue); + void setPrecisionConfigAttr(::mlir::ArrayAttr attr); + void setResultScaleAttr(::mlir::FloatAttr attr); + void setResultScale(::llvm::APFloat attrValue); + void setNAuxOutputsAttr(::mlir::IntegerAttr attr); + void setNAuxOutputs(uint32_t attrValue); + void setSerializedGraphAttr(::mlir::StringAttr attr); + void setSerializedGraph(::llvm::StringRef attrValue); + void setBackendConfigAttr(::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr attr); + ::mlir::Attribute removeWindowStridesAttr(); + ::mlir::Attribute removePaddingAttr(); + ::mlir::Attribute removeLhsDilationAttr(); + ::mlir::Attribute removeRhsDilationAttr(); + ::mlir::Attribute removeWindowReversalAttr(); + ::mlir::Attribute removePrecisionConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value filter, ::mlir::ValueRange binary_operands, ::mlir::Value output, ::mlir::ValueRange aux_outputs, ::mlir::Value scratch, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, ::mlir::IntegerAttr feature_group_count, ::mlir::IntegerAttr batch_group_count, /*optional*/::mlir::ArrayAttr precision_config, ::mlir::FloatAttr result_scale, ::mlir::IntegerAttr n_aux_outputs, ::mlir::StringAttr serialized_graph, ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr backend_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter, ::mlir::ValueRange binary_operands, ::mlir::Value output, ::mlir::ValueRange aux_outputs, ::mlir::Value scratch, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, ::mlir::IntegerAttr feature_group_count, ::mlir::IntegerAttr batch_group_count, /*optional*/::mlir::ArrayAttr precision_config, ::mlir::FloatAttr result_scale, ::mlir::IntegerAttr n_aux_outputs, ::mlir::StringAttr serialized_graph, ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr backend_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value filter, ::mlir::ValueRange binary_operands, ::mlir::Value output, ::mlir::ValueRange aux_outputs, ::mlir::Value scratch, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, uint64_t feature_group_count, uint64_t batch_group_count, /*optional*/::mlir::ArrayAttr precision_config, ::llvm::APFloat result_scale, uint32_t n_aux_outputs, ::llvm::StringRef serialized_graph, ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr backend_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter, ::mlir::ValueRange binary_operands, ::mlir::Value output, ::mlir::ValueRange aux_outputs, ::mlir::Value scratch, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, uint64_t feature_group_count, uint64_t batch_group_count, /*optional*/::mlir::ArrayAttr precision_config, ::llvm::APFloat result_scale, uint32_t n_aux_outputs, ::llvm::StringRef serialized_graph, ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr backend_config); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 14 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo_gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo_gpu::ConvForwardGraphOp) + +namespace mlir { +namespace lmhlo_gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo_gpu::ConvForwardOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConvForwardOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ConvForwardOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ConvForwardOpGenericAdaptorBase(ConvForwardOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getWindowStridesAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getWindowStrides(); + ::mlir::DenseIntElementsAttr getPaddingAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getPadding(); + ::mlir::DenseIntElementsAttr getLhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getLhsDilation(); + ::mlir::DenseIntElementsAttr getRhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getRhsDilation(); + ::mlir::DenseElementsAttr getWindowReversalAttr(); + ::std::optional< ::mlir::DenseElementsAttr > getWindowReversal(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbersAttr(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbers(); + ::mlir::IntegerAttr getFeatureGroupCountAttr(); + uint64_t getFeatureGroupCount(); + ::mlir::IntegerAttr getBatchGroupCountAttr(); + uint64_t getBatchGroupCount(); + ::mlir::ArrayAttr getPrecisionConfigAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrecisionConfig(); + ::mlir::FloatAttr getResultScaleAttr(); + ::llvm::APFloat getResultScale(); + ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr getBackendConfigAttr(); + ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr getBackendConfig(); +}; +} // namespace detail +template +class ConvForwardOpGenericAdaptor : public detail::ConvForwardOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConvForwardOpGenericAdaptorBase; +public: + ConvForwardOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConvForwardOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConvForwardOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ConvForwardOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getFilter() { + return (*getODSOperands(1).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(2).begin()); + } + + ValueT getScratch() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConvForwardOpAdaptor : public ConvForwardOpGenericAdaptor<::mlir::ValueRange> { +public: + using ConvForwardOpGenericAdaptor::ConvForwardOpGenericAdaptor; + ConvForwardOpAdaptor(ConvForwardOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConvForwardOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ConvForwardOpAdaptor; + template + using GenericAdaptor = ConvForwardOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("backend_config"), ::llvm::StringRef("batch_group_count"), ::llvm::StringRef("dimension_numbers"), ::llvm::StringRef("feature_group_count"), ::llvm::StringRef("lhs_dilation"), ::llvm::StringRef("padding"), ::llvm::StringRef("precision_config"), ::llvm::StringRef("result_scale"), ::llvm::StringRef("rhs_dilation"), ::llvm::StringRef("window_reversal"), ::llvm::StringRef("window_strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBackendConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBackendConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getBatchGroupCountAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getBatchGroupCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getDimensionNumbersAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getDimensionNumbersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getFeatureGroupCountAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getFeatureGroupCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getLhsDilationAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getLhsDilationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getPrecisionConfigAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getPrecisionConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getResultScaleAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getResultScaleAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getRhsDilationAttrName() { + return getAttributeNameForIndex(8); + } + + static ::mlir::StringAttr getRhsDilationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 8); + } + + ::mlir::StringAttr getWindowReversalAttrName() { + return getAttributeNameForIndex(9); + } + + static ::mlir::StringAttr getWindowReversalAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 9); + } + + ::mlir::StringAttr getWindowStridesAttrName() { + return getAttributeNameForIndex(10); + } + + static ::mlir::StringAttr getWindowStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 10); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo_gpu.conv_forward"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getInput(); + ::mlir::TypedValue<::mlir::MemRefType> getFilter(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::TypedValue<::mlir::MemRefType> getScratch(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getFilterMutable(); + ::mlir::OpOperand &getOutputMutable(); + ::mlir::OpOperand &getScratchMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::DenseIntElementsAttr getWindowStridesAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getWindowStrides(); + ::mlir::DenseIntElementsAttr getPaddingAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getPadding(); + ::mlir::DenseIntElementsAttr getLhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getLhsDilation(); + ::mlir::DenseIntElementsAttr getRhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getRhsDilation(); + ::mlir::DenseElementsAttr getWindowReversalAttr(); + ::std::optional< ::mlir::DenseElementsAttr > getWindowReversal(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbersAttr(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbers(); + ::mlir::IntegerAttr getFeatureGroupCountAttr(); + uint64_t getFeatureGroupCount(); + ::mlir::IntegerAttr getBatchGroupCountAttr(); + uint64_t getBatchGroupCount(); + ::mlir::ArrayAttr getPrecisionConfigAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrecisionConfig(); + ::mlir::FloatAttr getResultScaleAttr(); + ::llvm::APFloat getResultScale(); + ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr getBackendConfigAttr(); + ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr getBackendConfig(); + void setWindowStridesAttr(::mlir::DenseIntElementsAttr attr); + void setPaddingAttr(::mlir::DenseIntElementsAttr attr); + void setLhsDilationAttr(::mlir::DenseIntElementsAttr attr); + void setRhsDilationAttr(::mlir::DenseIntElementsAttr attr); + void setWindowReversalAttr(::mlir::DenseElementsAttr attr); + void setDimensionNumbersAttr(::mlir::mhlo::ConvDimensionNumbersAttr attr); + void setFeatureGroupCountAttr(::mlir::IntegerAttr attr); + void setFeatureGroupCount(uint64_t attrValue); + void setBatchGroupCountAttr(::mlir::IntegerAttr attr); + void setBatchGroupCount(uint64_t attrValue); + void setPrecisionConfigAttr(::mlir::ArrayAttr attr); + void setResultScaleAttr(::mlir::FloatAttr attr); + void setResultScale(::llvm::APFloat attrValue); + void setBackendConfigAttr(::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr attr); + ::mlir::Attribute removeWindowStridesAttr(); + ::mlir::Attribute removePaddingAttr(); + ::mlir::Attribute removeLhsDilationAttr(); + ::mlir::Attribute removeRhsDilationAttr(); + ::mlir::Attribute removeWindowReversalAttr(); + ::mlir::Attribute removePrecisionConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value filter, ::mlir::Value output, ::mlir::Value scratch, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, ::mlir::IntegerAttr feature_group_count, ::mlir::IntegerAttr batch_group_count, /*optional*/::mlir::ArrayAttr precision_config, ::mlir::FloatAttr result_scale, ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr backend_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter, ::mlir::Value output, ::mlir::Value scratch, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, ::mlir::IntegerAttr feature_group_count, ::mlir::IntegerAttr batch_group_count, /*optional*/::mlir::ArrayAttr precision_config, ::mlir::FloatAttr result_scale, ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr backend_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value filter, ::mlir::Value output, ::mlir::Value scratch, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, uint64_t feature_group_count, uint64_t batch_group_count, /*optional*/::mlir::ArrayAttr precision_config, ::llvm::APFloat result_scale, ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr backend_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value filter, ::mlir::Value output, ::mlir::Value scratch, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, uint64_t feature_group_count, uint64_t batch_group_count, /*optional*/::mlir::ArrayAttr precision_config, ::llvm::APFloat result_scale, ::mlir::lmhlo_gpu::ConvolutionBackendConfigAttr backend_config); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 11 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo_gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo_gpu::ConvForwardOp) + +namespace mlir { +namespace lmhlo_gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo_gpu::CublasLtMatmulF8Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CublasLtMatmulF8OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CublasLtMatmulF8OpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CublasLtMatmulF8OpGenericAdaptorBase(CublasLtMatmulF8Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::mhlo::DotDimensionNumbersAttr getDotDimensionNumbersAttr(); + ::mlir::mhlo::DotDimensionNumbersAttr getDotDimensionNumbers(); + ::mlir::ArrayAttr getPrecisionConfigAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrecisionConfig(); + ::mlir::FloatAttr getAlphaRealAttr(); + ::llvm::APFloat getAlphaReal(); + ::mlir::FloatAttr getAlphaImagAttr(); + ::llvm::APFloat getAlphaImag(); + ::mlir::FloatAttr getBetaAttr(); + ::llvm::APFloat getBeta(); + ::mlir::lmhlo_gpu::CublasLtMatmulEpilogueAttr getEpilogueAttr(); + ::mlir::lmhlo_gpu::CublasLtMatmulEpilogue getEpilogue(); + ::mlir::IntegerAttr getAlgorithmAttr(); + uint64_t getAlgorithm(); +}; +} // namespace detail +template +class CublasLtMatmulF8OpGenericAdaptor : public detail::CublasLtMatmulF8OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CublasLtMatmulF8OpGenericAdaptorBase; +public: + CublasLtMatmulF8OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CublasLtMatmulF8OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CublasLtMatmulF8OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CublasLtMatmulF8OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + ValueT getB() { + return (*getODSOperands(1).begin()); + } + + ValueT getC() { + return (*getODSOperands(2).begin()); + } + + ValueT getAScale() { + return (*getODSOperands(3).begin()); + } + + ValueT getBScale() { + return (*getODSOperands(4).begin()); + } + + ValueT getCScale() { + return (*getODSOperands(5).begin()); + } + + ValueT getDScale() { + return (*getODSOperands(6).begin()); + } + + ValueT getD() { + return (*getODSOperands(7).begin()); + } + + ValueT getBias() { + auto operands = getODSOperands(8); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + ValueT getDAmax() { + auto operands = getODSOperands(9); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CublasLtMatmulF8OpAdaptor : public CublasLtMatmulF8OpGenericAdaptor<::mlir::ValueRange> { +public: + using CublasLtMatmulF8OpGenericAdaptor::CublasLtMatmulF8OpGenericAdaptor; + CublasLtMatmulF8OpAdaptor(CublasLtMatmulF8Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CublasLtMatmulF8Op : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CublasLtMatmulF8OpAdaptor; + template + using GenericAdaptor = CublasLtMatmulF8OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("algorithm"), ::llvm::StringRef("alpha_imag"), ::llvm::StringRef("alpha_real"), ::llvm::StringRef("beta"), ::llvm::StringRef("dot_dimension_numbers"), ::llvm::StringRef("epilogue"), ::llvm::StringRef("operandSegmentSizes"), ::llvm::StringRef("precision_config")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAlgorithmAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAlgorithmAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAlphaImagAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAlphaImagAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getAlphaRealAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getAlphaRealAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getBetaAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getBetaAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getDotDimensionNumbersAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getDotDimensionNumbersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getEpilogueAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getEpilogueAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getPrecisionConfigAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getPrecisionConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo_gpu.cublas.lt.matmul.f8"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getA(); + ::mlir::TypedValue<::mlir::MemRefType> getB(); + ::mlir::TypedValue<::mlir::MemRefType> getC(); + ::mlir::TypedValue<::mlir::MemRefType> getAScale(); + ::mlir::TypedValue<::mlir::MemRefType> getBScale(); + ::mlir::TypedValue<::mlir::MemRefType> getCScale(); + ::mlir::TypedValue<::mlir::MemRefType> getDScale(); + ::mlir::TypedValue<::mlir::MemRefType> getD(); + ::mlir::TypedValue<::mlir::MemRefType> getBias(); + ::mlir::TypedValue<::mlir::MemRefType> getDAmax(); + ::mlir::OpOperand &getAMutable(); + ::mlir::OpOperand &getBMutable(); + ::mlir::OpOperand &getCMutable(); + ::mlir::OpOperand &getAScaleMutable(); + ::mlir::OpOperand &getBScaleMutable(); + ::mlir::OpOperand &getCScaleMutable(); + ::mlir::OpOperand &getDScaleMutable(); + ::mlir::OpOperand &getDMutable(); + ::mlir::MutableOperandRange getBiasMutable(); + ::mlir::MutableOperandRange getDAmaxMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::mhlo::DotDimensionNumbersAttr getDotDimensionNumbersAttr(); + ::mlir::mhlo::DotDimensionNumbersAttr getDotDimensionNumbers(); + ::mlir::ArrayAttr getPrecisionConfigAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrecisionConfig(); + ::mlir::FloatAttr getAlphaRealAttr(); + ::llvm::APFloat getAlphaReal(); + ::mlir::FloatAttr getAlphaImagAttr(); + ::llvm::APFloat getAlphaImag(); + ::mlir::FloatAttr getBetaAttr(); + ::llvm::APFloat getBeta(); + ::mlir::lmhlo_gpu::CublasLtMatmulEpilogueAttr getEpilogueAttr(); + ::mlir::lmhlo_gpu::CublasLtMatmulEpilogue getEpilogue(); + ::mlir::IntegerAttr getAlgorithmAttr(); + uint64_t getAlgorithm(); + void setDotDimensionNumbersAttr(::mlir::mhlo::DotDimensionNumbersAttr attr); + void setPrecisionConfigAttr(::mlir::ArrayAttr attr); + void setAlphaRealAttr(::mlir::FloatAttr attr); + void setAlphaReal(::llvm::APFloat attrValue); + void setAlphaImagAttr(::mlir::FloatAttr attr); + void setAlphaImag(::llvm::APFloat attrValue); + void setBetaAttr(::mlir::FloatAttr attr); + void setBeta(::llvm::APFloat attrValue); + void setEpilogueAttr(::mlir::lmhlo_gpu::CublasLtMatmulEpilogueAttr attr); + void setEpilogue(::mlir::lmhlo_gpu::CublasLtMatmulEpilogue attrValue); + void setAlgorithmAttr(::mlir::IntegerAttr attr); + void setAlgorithm(uint64_t attrValue); + ::mlir::Attribute removePrecisionConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, ::mlir::Value a_scale, ::mlir::Value b_scale, ::mlir::Value c_scale, ::mlir::Value d_scale, ::mlir::Value d, /*optional*/::mlir::Value bias, /*optional*/::mlir::Value d_amax, ::mlir::mhlo::DotDimensionNumbersAttr dot_dimension_numbers, /*optional*/::mlir::ArrayAttr precision_config, ::mlir::FloatAttr alpha_real, ::mlir::FloatAttr alpha_imag, ::mlir::FloatAttr beta, ::mlir::lmhlo_gpu::CublasLtMatmulEpilogueAttr epilogue, ::mlir::IntegerAttr algorithm); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, ::mlir::Value a_scale, ::mlir::Value b_scale, ::mlir::Value c_scale, ::mlir::Value d_scale, ::mlir::Value d, /*optional*/::mlir::Value bias, /*optional*/::mlir::Value d_amax, ::mlir::mhlo::DotDimensionNumbersAttr dot_dimension_numbers, /*optional*/::mlir::ArrayAttr precision_config, ::mlir::FloatAttr alpha_real, ::mlir::FloatAttr alpha_imag, ::mlir::FloatAttr beta, ::mlir::lmhlo_gpu::CublasLtMatmulEpilogueAttr epilogue, ::mlir::IntegerAttr algorithm); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, ::mlir::Value a_scale, ::mlir::Value b_scale, ::mlir::Value c_scale, ::mlir::Value d_scale, ::mlir::Value d, /*optional*/::mlir::Value bias, /*optional*/::mlir::Value d_amax, ::mlir::mhlo::DotDimensionNumbersAttr dot_dimension_numbers, /*optional*/::mlir::ArrayAttr precision_config, ::llvm::APFloat alpha_real, ::llvm::APFloat alpha_imag, ::llvm::APFloat beta, ::mlir::lmhlo_gpu::CublasLtMatmulEpilogue epilogue, uint64_t algorithm); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, ::mlir::Value a_scale, ::mlir::Value b_scale, ::mlir::Value c_scale, ::mlir::Value d_scale, ::mlir::Value d, /*optional*/::mlir::Value bias, /*optional*/::mlir::Value d_amax, ::mlir::mhlo::DotDimensionNumbersAttr dot_dimension_numbers, /*optional*/::mlir::ArrayAttr precision_config, ::llvm::APFloat alpha_real, ::llvm::APFloat alpha_imag, ::llvm::APFloat beta, ::mlir::lmhlo_gpu::CublasLtMatmulEpilogue epilogue, uint64_t algorithm); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 8 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo_gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo_gpu::CublasLtMatmulF8Op) + +namespace mlir { +namespace lmhlo_gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo_gpu::CublasLtMatmulOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CublasLtMatmulOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CublasLtMatmulOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CublasLtMatmulOpGenericAdaptorBase(CublasLtMatmulOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::mhlo::DotDimensionNumbersAttr getDotDimensionNumbersAttr(); + ::mlir::mhlo::DotDimensionNumbersAttr getDotDimensionNumbers(); + ::mlir::ArrayAttr getPrecisionConfigAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrecisionConfig(); + ::mlir::FloatAttr getAlphaRealAttr(); + ::llvm::APFloat getAlphaReal(); + ::mlir::FloatAttr getAlphaImagAttr(); + ::llvm::APFloat getAlphaImag(); + ::mlir::FloatAttr getBetaAttr(); + ::llvm::APFloat getBeta(); + ::mlir::lmhlo_gpu::CublasLtMatmulEpilogueAttr getEpilogueAttr(); + ::mlir::lmhlo_gpu::CublasLtMatmulEpilogue getEpilogue(); + ::mlir::IntegerAttr getAlgorithmAttr(); + uint64_t getAlgorithm(); +}; +} // namespace detail +template +class CublasLtMatmulOpGenericAdaptor : public detail::CublasLtMatmulOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CublasLtMatmulOpGenericAdaptorBase; +public: + CublasLtMatmulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CublasLtMatmulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CublasLtMatmulOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CublasLtMatmulOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + ValueT getB() { + return (*getODSOperands(1).begin()); + } + + ValueT getC() { + return (*getODSOperands(2).begin()); + } + + ValueT getD() { + return (*getODSOperands(3).begin()); + } + + ValueT getBias() { + auto operands = getODSOperands(4); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + ValueT getAux() { + auto operands = getODSOperands(5); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CublasLtMatmulOpAdaptor : public CublasLtMatmulOpGenericAdaptor<::mlir::ValueRange> { +public: + using CublasLtMatmulOpGenericAdaptor::CublasLtMatmulOpGenericAdaptor; + CublasLtMatmulOpAdaptor(CublasLtMatmulOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CublasLtMatmulOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CublasLtMatmulOpAdaptor; + template + using GenericAdaptor = CublasLtMatmulOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("algorithm"), ::llvm::StringRef("alpha_imag"), ::llvm::StringRef("alpha_real"), ::llvm::StringRef("beta"), ::llvm::StringRef("dot_dimension_numbers"), ::llvm::StringRef("epilogue"), ::llvm::StringRef("operandSegmentSizes"), ::llvm::StringRef("precision_config")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAlgorithmAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAlgorithmAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAlphaImagAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAlphaImagAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getAlphaRealAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getAlphaRealAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getBetaAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getBetaAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getDotDimensionNumbersAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getDotDimensionNumbersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getEpilogueAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getEpilogueAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getPrecisionConfigAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getPrecisionConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo_gpu.cublas.lt.matmul"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getA(); + ::mlir::TypedValue<::mlir::MemRefType> getB(); + ::mlir::TypedValue<::mlir::MemRefType> getC(); + ::mlir::TypedValue<::mlir::MemRefType> getD(); + ::mlir::TypedValue<::mlir::MemRefType> getBias(); + ::mlir::TypedValue<::mlir::MemRefType> getAux(); + ::mlir::OpOperand &getAMutable(); + ::mlir::OpOperand &getBMutable(); + ::mlir::OpOperand &getCMutable(); + ::mlir::OpOperand &getDMutable(); + ::mlir::MutableOperandRange getBiasMutable(); + ::mlir::MutableOperandRange getAuxMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::mhlo::DotDimensionNumbersAttr getDotDimensionNumbersAttr(); + ::mlir::mhlo::DotDimensionNumbersAttr getDotDimensionNumbers(); + ::mlir::ArrayAttr getPrecisionConfigAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrecisionConfig(); + ::mlir::FloatAttr getAlphaRealAttr(); + ::llvm::APFloat getAlphaReal(); + ::mlir::FloatAttr getAlphaImagAttr(); + ::llvm::APFloat getAlphaImag(); + ::mlir::FloatAttr getBetaAttr(); + ::llvm::APFloat getBeta(); + ::mlir::lmhlo_gpu::CublasLtMatmulEpilogueAttr getEpilogueAttr(); + ::mlir::lmhlo_gpu::CublasLtMatmulEpilogue getEpilogue(); + ::mlir::IntegerAttr getAlgorithmAttr(); + uint64_t getAlgorithm(); + void setDotDimensionNumbersAttr(::mlir::mhlo::DotDimensionNumbersAttr attr); + void setPrecisionConfigAttr(::mlir::ArrayAttr attr); + void setAlphaRealAttr(::mlir::FloatAttr attr); + void setAlphaReal(::llvm::APFloat attrValue); + void setAlphaImagAttr(::mlir::FloatAttr attr); + void setAlphaImag(::llvm::APFloat attrValue); + void setBetaAttr(::mlir::FloatAttr attr); + void setBeta(::llvm::APFloat attrValue); + void setEpilogueAttr(::mlir::lmhlo_gpu::CublasLtMatmulEpilogueAttr attr); + void setEpilogue(::mlir::lmhlo_gpu::CublasLtMatmulEpilogue attrValue); + void setAlgorithmAttr(::mlir::IntegerAttr attr); + void setAlgorithm(uint64_t attrValue); + ::mlir::Attribute removePrecisionConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, ::mlir::Value d, /*optional*/::mlir::Value bias, /*optional*/::mlir::Value aux, ::mlir::mhlo::DotDimensionNumbersAttr dot_dimension_numbers, /*optional*/::mlir::ArrayAttr precision_config, ::mlir::FloatAttr alpha_real, ::mlir::FloatAttr alpha_imag, ::mlir::FloatAttr beta, ::mlir::lmhlo_gpu::CublasLtMatmulEpilogueAttr epilogue, ::mlir::IntegerAttr algorithm); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, ::mlir::Value d, /*optional*/::mlir::Value bias, /*optional*/::mlir::Value aux, ::mlir::mhlo::DotDimensionNumbersAttr dot_dimension_numbers, /*optional*/::mlir::ArrayAttr precision_config, ::mlir::FloatAttr alpha_real, ::mlir::FloatAttr alpha_imag, ::mlir::FloatAttr beta, ::mlir::lmhlo_gpu::CublasLtMatmulEpilogueAttr epilogue, ::mlir::IntegerAttr algorithm); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, ::mlir::Value d, /*optional*/::mlir::Value bias, /*optional*/::mlir::Value aux, ::mlir::mhlo::DotDimensionNumbersAttr dot_dimension_numbers, /*optional*/::mlir::ArrayAttr precision_config, ::llvm::APFloat alpha_real, ::llvm::APFloat alpha_imag, ::llvm::APFloat beta, ::mlir::lmhlo_gpu::CublasLtMatmulEpilogue epilogue, uint64_t algorithm); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, ::mlir::Value d, /*optional*/::mlir::Value bias, /*optional*/::mlir::Value aux, ::mlir::mhlo::DotDimensionNumbersAttr dot_dimension_numbers, /*optional*/::mlir::ArrayAttr precision_config, ::llvm::APFloat alpha_real, ::llvm::APFloat alpha_imag, ::llvm::APFloat beta, ::mlir::lmhlo_gpu::CublasLtMatmulEpilogue epilogue, uint64_t algorithm); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 8 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo_gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo_gpu::CublasLtMatmulOp) + +namespace mlir { +namespace lmhlo_gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo_gpu::CudnnConvReorderFilterAndBiasOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CudnnConvReorderFilterAndBiasOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CudnnConvReorderFilterAndBiasOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CudnnConvReorderFilterAndBiasOpGenericAdaptorBase(CudnnConvReorderFilterAndBiasOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getFilterDimsAttr(); + ::mlir::DenseIntElementsAttr getFilterDims(); +}; +} // namespace detail +template +class CudnnConvReorderFilterAndBiasOpGenericAdaptor : public detail::CudnnConvReorderFilterAndBiasOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CudnnConvReorderFilterAndBiasOpGenericAdaptorBase; +public: + CudnnConvReorderFilterAndBiasOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CudnnConvReorderFilterAndBiasOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CudnnConvReorderFilterAndBiasOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CudnnConvReorderFilterAndBiasOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getFilterInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getBiasInput() { + return (*getODSOperands(1).begin()); + } + + ValueT getFilterOutput() { + return (*getODSOperands(2).begin()); + } + + ValueT getBiasOutput() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CudnnConvReorderFilterAndBiasOpAdaptor : public CudnnConvReorderFilterAndBiasOpGenericAdaptor<::mlir::ValueRange> { +public: + using CudnnConvReorderFilterAndBiasOpGenericAdaptor::CudnnConvReorderFilterAndBiasOpGenericAdaptor; + CudnnConvReorderFilterAndBiasOpAdaptor(CudnnConvReorderFilterAndBiasOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CudnnConvReorderFilterAndBiasOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CudnnConvReorderFilterAndBiasOpAdaptor; + template + using GenericAdaptor = CudnnConvReorderFilterAndBiasOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("filter_dims")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFilterDimsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFilterDimsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo_gpu.cudnn_conv_reorder_filter_and_bias"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getFilterInput(); + ::mlir::TypedValue<::mlir::MemRefType> getBiasInput(); + ::mlir::TypedValue<::mlir::MemRefType> getFilterOutput(); + ::mlir::TypedValue<::mlir::MemRefType> getBiasOutput(); + ::mlir::OpOperand &getFilterInputMutable(); + ::mlir::OpOperand &getBiasInputMutable(); + ::mlir::OpOperand &getFilterOutputMutable(); + ::mlir::OpOperand &getBiasOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::DenseIntElementsAttr getFilterDimsAttr(); + ::mlir::DenseIntElementsAttr getFilterDims(); + void setFilterDimsAttr(::mlir::DenseIntElementsAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value filter_input, ::mlir::Value bias_input, ::mlir::Value filter_output, ::mlir::Value bias_output, ::mlir::DenseIntElementsAttr filter_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value filter_input, ::mlir::Value bias_input, ::mlir::Value filter_output, ::mlir::Value bias_output, ::mlir::DenseIntElementsAttr filter_dims); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo_gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo_gpu::CudnnConvReorderFilterAndBiasOp) + +namespace mlir { +namespace lmhlo_gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo_gpu::CudnnConvReorderFilterOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CudnnConvReorderFilterOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CudnnConvReorderFilterOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CudnnConvReorderFilterOpGenericAdaptorBase(CudnnConvReorderFilterOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getFilterDimsAttr(); + ::mlir::DenseIntElementsAttr getFilterDims(); +}; +} // namespace detail +template +class CudnnConvReorderFilterOpGenericAdaptor : public detail::CudnnConvReorderFilterOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CudnnConvReorderFilterOpGenericAdaptorBase; +public: + CudnnConvReorderFilterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CudnnConvReorderFilterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CudnnConvReorderFilterOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CudnnConvReorderFilterOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getFilterInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getFilterOutput() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CudnnConvReorderFilterOpAdaptor : public CudnnConvReorderFilterOpGenericAdaptor<::mlir::ValueRange> { +public: + using CudnnConvReorderFilterOpGenericAdaptor::CudnnConvReorderFilterOpGenericAdaptor; + CudnnConvReorderFilterOpAdaptor(CudnnConvReorderFilterOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CudnnConvReorderFilterOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CudnnConvReorderFilterOpAdaptor; + template + using GenericAdaptor = CudnnConvReorderFilterOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("filter_dims")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFilterDimsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFilterDimsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo_gpu.cudnn_conv_reorder_filter"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getFilterInput(); + ::mlir::TypedValue<::mlir::MemRefType> getFilterOutput(); + ::mlir::OpOperand &getFilterInputMutable(); + ::mlir::OpOperand &getFilterOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::DenseIntElementsAttr getFilterDimsAttr(); + ::mlir::DenseIntElementsAttr getFilterDims(); + void setFilterDimsAttr(::mlir::DenseIntElementsAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value filter_input, ::mlir::Value filter_output, ::mlir::DenseIntElementsAttr filter_dims); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value filter_input, ::mlir::Value filter_output, ::mlir::DenseIntElementsAttr filter_dims); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo_gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo_gpu::CudnnConvReorderFilterOp) + +namespace mlir { +namespace lmhlo_gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo_gpu::GEMMOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GEMMOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + GEMMOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + GEMMOpGenericAdaptorBase(GEMMOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::mhlo::DotDimensionNumbersAttr getDotDimensionNumbersAttr(); + ::mlir::mhlo::DotDimensionNumbersAttr getDotDimensionNumbers(); + ::mlir::ArrayAttr getPrecisionConfigAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrecisionConfig(); + ::mlir::FloatAttr getAlphaRealAttr(); + ::llvm::APFloat getAlphaReal(); + ::mlir::FloatAttr getAlphaImagAttr(); + ::llvm::APFloat getAlphaImag(); + ::mlir::FloatAttr getBetaAttr(); + ::llvm::APFloat getBeta(); + ::mlir::IntegerAttr getAlgorithmAttr(); + ::std::optional getAlgorithm(); +}; +} // namespace detail +template +class GEMMOpGenericAdaptor : public detail::GEMMOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GEMMOpGenericAdaptorBase; +public: + GEMMOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GEMMOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GEMMOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + GEMMOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + ValueT getB() { + return (*getODSOperands(1).begin()); + } + + ValueT getC() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GEMMOpAdaptor : public GEMMOpGenericAdaptor<::mlir::ValueRange> { +public: + using GEMMOpGenericAdaptor::GEMMOpGenericAdaptor; + GEMMOpAdaptor(GEMMOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GEMMOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = GEMMOpAdaptor; + template + using GenericAdaptor = GEMMOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("algorithm"), ::llvm::StringRef("alpha_imag"), ::llvm::StringRef("alpha_real"), ::llvm::StringRef("beta"), ::llvm::StringRef("dot_dimension_numbers"), ::llvm::StringRef("precision_config")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAlgorithmAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAlgorithmAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getAlphaImagAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getAlphaImagAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getAlphaRealAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getAlphaRealAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getBetaAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getBetaAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getDotDimensionNumbersAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getDotDimensionNumbersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getPrecisionConfigAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getPrecisionConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo_gpu.gemm"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getA(); + ::mlir::TypedValue<::mlir::MemRefType> getB(); + ::mlir::TypedValue<::mlir::MemRefType> getC(); + ::mlir::OpOperand &getAMutable(); + ::mlir::OpOperand &getBMutable(); + ::mlir::OpOperand &getCMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::mhlo::DotDimensionNumbersAttr getDotDimensionNumbersAttr(); + ::mlir::mhlo::DotDimensionNumbersAttr getDotDimensionNumbers(); + ::mlir::ArrayAttr getPrecisionConfigAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrecisionConfig(); + ::mlir::FloatAttr getAlphaRealAttr(); + ::llvm::APFloat getAlphaReal(); + ::mlir::FloatAttr getAlphaImagAttr(); + ::llvm::APFloat getAlphaImag(); + ::mlir::FloatAttr getBetaAttr(); + ::llvm::APFloat getBeta(); + ::mlir::IntegerAttr getAlgorithmAttr(); + ::std::optional getAlgorithm(); + void setDotDimensionNumbersAttr(::mlir::mhlo::DotDimensionNumbersAttr attr); + void setPrecisionConfigAttr(::mlir::ArrayAttr attr); + void setAlphaRealAttr(::mlir::FloatAttr attr); + void setAlphaReal(::llvm::APFloat attrValue); + void setAlphaImagAttr(::mlir::FloatAttr attr); + void setAlphaImag(::llvm::APFloat attrValue); + void setBetaAttr(::mlir::FloatAttr attr); + void setBeta(::llvm::APFloat attrValue); + void setAlgorithmAttr(::mlir::IntegerAttr attr); + void setAlgorithm(::std::optional attrValue); + ::mlir::Attribute removePrecisionConfigAttr(); + ::mlir::Attribute removeAlgorithmAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, ::mlir::mhlo::DotDimensionNumbersAttr dot_dimension_numbers, /*optional*/::mlir::ArrayAttr precision_config, ::mlir::FloatAttr alpha_real, ::mlir::FloatAttr alpha_imag, ::mlir::FloatAttr beta, /*optional*/::mlir::IntegerAttr algorithm); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, ::mlir::mhlo::DotDimensionNumbersAttr dot_dimension_numbers, /*optional*/::mlir::ArrayAttr precision_config, ::mlir::FloatAttr alpha_real, ::mlir::FloatAttr alpha_imag, ::mlir::FloatAttr beta, /*optional*/::mlir::IntegerAttr algorithm); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, ::mlir::mhlo::DotDimensionNumbersAttr dot_dimension_numbers, /*optional*/::mlir::ArrayAttr precision_config, ::llvm::APFloat alpha_real, ::llvm::APFloat alpha_imag, ::llvm::APFloat beta, /*optional*/::mlir::IntegerAttr algorithm); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::Value c, ::mlir::mhlo::DotDimensionNumbersAttr dot_dimension_numbers, /*optional*/::mlir::ArrayAttr precision_config, ::llvm::APFloat alpha_real, ::llvm::APFloat alpha_imag, ::llvm::APFloat beta, /*optional*/::mlir::IntegerAttr algorithm); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo_gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo_gpu::GEMMOp) + +namespace mlir { +namespace lmhlo_gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo_gpu::ReduceScatterDoneOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReduceScatterDoneOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ReduceScatterDoneOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ReduceScatterDoneOpGenericAdaptorBase(ReduceScatterDoneOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ReduceScatterDoneOpGenericAdaptor : public detail::ReduceScatterDoneOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReduceScatterDoneOpGenericAdaptorBase; +public: + ReduceScatterDoneOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReduceScatterDoneOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReduceScatterDoneOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ReduceScatterDoneOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getToken() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ReduceScatterDoneOpAdaptor : public ReduceScatterDoneOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReduceScatterDoneOpGenericAdaptor::ReduceScatterDoneOpGenericAdaptor; + ReduceScatterDoneOpAdaptor(ReduceScatterDoneOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReduceScatterDoneOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = ReduceScatterDoneOpAdaptor; + template + using GenericAdaptor = ReduceScatterDoneOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo_gpu.reduce_scatter_done"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getToken(); + ::mlir::OpOperand &getTokenMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value token); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value token); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace lmhlo_gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo_gpu::ReduceScatterDoneOp) + +namespace mlir { +namespace lmhlo_gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo_gpu::ReduceScatterStartOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReduceScatterStartOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ReduceScatterStartOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ReduceScatterStartOpGenericAdaptorBase(ReduceScatterStartOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getReplicaGroupsAttr(); + ::mlir::DenseIntElementsAttr getReplicaGroups(); + ::mlir::BoolAttr getConstrainLayoutAttr(); + bool getConstrainLayout(); + ::mlir::mhlo::ChannelHandleAttr getChannelIdAttr(); + ::std::optional<::mlir::mhlo::ChannelHandleAttr> getChannelId(); + ::mlir::BoolAttr getUseGlobalDeviceIdsAttr(); + bool getUseGlobalDeviceIds(); + ::mlir::BoolAttr getIsSyncAttr(); + bool getIsSync(); + ::mlir::IntegerAttr getScatterDimensionAttr(); + uint64_t getScatterDimension(); + ::mlir::Region &getComputation(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class ReduceScatterStartOpGenericAdaptor : public detail::ReduceScatterStartOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReduceScatterStartOpGenericAdaptorBase; +public: + ReduceScatterStartOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReduceScatterStartOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReduceScatterStartOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ReduceScatterStartOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutputs() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ReduceScatterStartOpAdaptor : public ReduceScatterStartOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReduceScatterStartOpGenericAdaptor::ReduceScatterStartOpGenericAdaptor; + ReduceScatterStartOpAdaptor(ReduceScatterStartOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReduceScatterStartOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::OpTrait::SameOperandsElementType> { +public: + using Op::Op; + using Op::print; + using Adaptor = ReduceScatterStartOpAdaptor; + template + using GenericAdaptor = ReduceScatterStartOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("channel_id"), ::llvm::StringRef("constrain_layout"), ::llvm::StringRef("is_sync"), ::llvm::StringRef("replica_groups"), ::llvm::StringRef("scatter_dimension"), ::llvm::StringRef("use_global_device_ids")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getChannelIdAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getChannelIdAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getConstrainLayoutAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getConstrainLayoutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getIsSyncAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getIsSyncAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getReplicaGroupsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getReplicaGroupsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getScatterDimensionAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getScatterDimensionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getUseGlobalDeviceIdsAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getUseGlobalDeviceIdsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo_gpu.reduce_scatter_start"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getToken(); + ::mlir::Region &getComputation(); + ::mlir::DenseIntElementsAttr getReplicaGroupsAttr(); + ::mlir::DenseIntElementsAttr getReplicaGroups(); + ::mlir::BoolAttr getConstrainLayoutAttr(); + bool getConstrainLayout(); + ::mlir::mhlo::ChannelHandleAttr getChannelIdAttr(); + ::std::optional<::mlir::mhlo::ChannelHandleAttr> getChannelId(); + ::mlir::BoolAttr getUseGlobalDeviceIdsAttr(); + bool getUseGlobalDeviceIds(); + ::mlir::BoolAttr getIsSyncAttr(); + bool getIsSync(); + ::mlir::IntegerAttr getScatterDimensionAttr(); + uint64_t getScatterDimension(); + void setReplicaGroupsAttr(::mlir::DenseIntElementsAttr attr); + void setConstrainLayoutAttr(::mlir::BoolAttr attr); + void setConstrainLayout(::std::optional attrValue); + void setChannelIdAttr(::mlir::mhlo::ChannelHandleAttr attr); + void setUseGlobalDeviceIdsAttr(::mlir::BoolAttr attr); + void setUseGlobalDeviceIds(::std::optional attrValue); + void setIsSyncAttr(::mlir::BoolAttr attr); + void setIsSync(bool attrValue); + void setScatterDimensionAttr(::mlir::IntegerAttr attr); + void setScatterDimension(uint64_t attrValue); + ::mlir::Attribute removeConstrainLayoutAttr(); + ::mlir::Attribute removeChannelIdAttr(); + ::mlir::Attribute removeUseGlobalDeviceIdsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type token, ::mlir::ValueRange inputs, ::mlir::ValueRange outputs, ::mlir::DenseIntElementsAttr replica_groups, /*optional*/::mlir::BoolAttr constrain_layout, /*optional*/::mlir::mhlo::ChannelHandleAttr channel_id, /*optional*/::mlir::BoolAttr use_global_device_ids, ::mlir::BoolAttr is_sync, ::mlir::IntegerAttr scatter_dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::mlir::ValueRange outputs, ::mlir::DenseIntElementsAttr replica_groups, /*optional*/::mlir::BoolAttr constrain_layout, /*optional*/::mlir::mhlo::ChannelHandleAttr channel_id, /*optional*/::mlir::BoolAttr use_global_device_ids, ::mlir::BoolAttr is_sync, ::mlir::IntegerAttr scatter_dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type token, ::mlir::ValueRange inputs, ::mlir::ValueRange outputs, ::mlir::DenseIntElementsAttr replica_groups, /*optional*/bool constrain_layout, /*optional*/::mlir::mhlo::ChannelHandleAttr channel_id, /*optional*/bool use_global_device_ids, bool is_sync, uint64_t scatter_dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::mlir::ValueRange outputs, ::mlir::DenseIntElementsAttr replica_groups, /*optional*/bool constrain_layout, /*optional*/::mlir::mhlo::ChannelHandleAttr channel_id, /*optional*/bool use_global_device_ids, bool is_sync, uint64_t scatter_dimension); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo_gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo_gpu::ReduceScatterStartOp) + +namespace mlir { +namespace lmhlo_gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo_gpu::fusedMHABackwardOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class fusedMHABackwardOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + fusedMHABackwardOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + fusedMHABackwardOpGenericAdaptorBase(fusedMHABackwardOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::mhlo::DotDimensionNumbersAttr getBmm1GradGemm1DotDimensionNumbersAttr(); + ::mlir::mhlo::DotDimensionNumbersAttr getBmm1GradGemm1DotDimensionNumbers(); + ::mlir::mhlo::DotDimensionNumbersAttr getBmm1GradGemm2DotDimensionNumbersAttr(); + ::mlir::mhlo::DotDimensionNumbersAttr getBmm1GradGemm2DotDimensionNumbers(); + ::mlir::mhlo::DotDimensionNumbersAttr getBmm2GradGemm1DotDimensionNumbersAttr(); + ::mlir::mhlo::DotDimensionNumbersAttr getBmm2GradGemm1DotDimensionNumbers(); + ::mlir::mhlo::DotDimensionNumbersAttr getBmm2GradGemm2DotDimensionNumbersAttr(); + ::mlir::mhlo::DotDimensionNumbersAttr getBmm2GradGemm2DotDimensionNumbers(); + ::mlir::FloatAttr getFmhaScaleAttr(); + ::llvm::APFloat getFmhaScale(); + ::mlir::lmhlo_gpu::FusedMhaBackwardDagSignatureAttr getFusedMhaDagAttr(); + ::mlir::lmhlo_gpu::FusedMhaBackwardDagSignature getFusedMhaDag(); + ::mlir::lmhlo_gpu::FusedMHAAlgorithmConfigAttr getAlgorithmConfigAttr(); + ::mlir::lmhlo_gpu::FusedMHAAlgorithmConfigAttr getAlgorithmConfig(); + ::mlir::FloatAttr getDropoutRateAttr(); + ::std::optional< ::llvm::APFloat > getDropoutRate(); + ::mlir::IntegerAttr getSeedAttr(); + ::std::optional getSeed(); +}; +} // namespace detail +template +class fusedMHABackwardOpGenericAdaptor : public detail::fusedMHABackwardOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::fusedMHABackwardOpGenericAdaptorBase; +public: + fusedMHABackwardOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + fusedMHABackwardOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : fusedMHABackwardOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + fusedMHABackwardOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getBmm1GradGemm1Rhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getBmm1GradGemm2Rhs() { + return (*getODSOperands(1).begin()); + } + + ValueT getBmm2GradGemm2Rhs() { + return (*getODSOperands(2).begin()); + } + + ValueT getBmm2GradGemm1Lhs() { + return (*getODSOperands(3).begin()); + } + + ValueT getDOutput() { + return (*getODSOperands(4).begin()); + } + + ValueT getMask() { + auto operands = getODSOperands(5); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + ValueT getDBmm1Lhs() { + return (*getODSOperands(6).begin()); + } + + ValueT getDBmm1Rhs() { + return (*getODSOperands(7).begin()); + } + + ValueT getDBmm2Rhs() { + return (*getODSOperands(8).begin()); + } + + ValueT getD_S() { + return (*getODSOperands(9).begin()); + } + + ValueT getScratch() { + return (*getODSOperands(10).begin()); + } + + ValueT getDBias() { + auto operands = getODSOperands(11); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class fusedMHABackwardOpAdaptor : public fusedMHABackwardOpGenericAdaptor<::mlir::ValueRange> { +public: + using fusedMHABackwardOpGenericAdaptor::fusedMHABackwardOpGenericAdaptor; + fusedMHABackwardOpAdaptor(fusedMHABackwardOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class fusedMHABackwardOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = fusedMHABackwardOpAdaptor; + template + using GenericAdaptor = fusedMHABackwardOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("algorithm_config"), ::llvm::StringRef("bmm1_grad_gemm1_dot_dimension_numbers"), ::llvm::StringRef("bmm1_grad_gemm2_dot_dimension_numbers"), ::llvm::StringRef("bmm2_grad_gemm1_dot_dimension_numbers"), ::llvm::StringRef("bmm2_grad_gemm2_dot_dimension_numbers"), ::llvm::StringRef("dropout_rate"), ::llvm::StringRef("fmha_scale"), ::llvm::StringRef("fused_mha_dag"), ::llvm::StringRef("operandSegmentSizes"), ::llvm::StringRef("seed")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAlgorithmConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAlgorithmConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getBmm1GradGemm1DotDimensionNumbersAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getBmm1GradGemm1DotDimensionNumbersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getBmm1GradGemm2DotDimensionNumbersAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getBmm1GradGemm2DotDimensionNumbersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getBmm2GradGemm1DotDimensionNumbersAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getBmm2GradGemm1DotDimensionNumbersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getBmm2GradGemm2DotDimensionNumbersAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getBmm2GradGemm2DotDimensionNumbersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getDropoutRateAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getDropoutRateAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getFmhaScaleAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getFmhaScaleAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getFusedMhaDagAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getFusedMhaDagAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return getAttributeNameForIndex(8); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 8); + } + + ::mlir::StringAttr getSeedAttrName() { + return getAttributeNameForIndex(9); + } + + static ::mlir::StringAttr getSeedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 9); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo_gpu.fMHABackward"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getBmm1GradGemm1Rhs(); + ::mlir::TypedValue<::mlir::MemRefType> getBmm1GradGemm2Rhs(); + ::mlir::TypedValue<::mlir::MemRefType> getBmm2GradGemm2Rhs(); + ::mlir::TypedValue<::mlir::MemRefType> getBmm2GradGemm1Lhs(); + ::mlir::TypedValue<::mlir::MemRefType> getDOutput(); + ::mlir::TypedValue<::mlir::MemRefType> getMask(); + ::mlir::TypedValue<::mlir::MemRefType> getDBmm1Lhs(); + ::mlir::TypedValue<::mlir::MemRefType> getDBmm1Rhs(); + ::mlir::TypedValue<::mlir::MemRefType> getDBmm2Rhs(); + ::mlir::TypedValue<::mlir::MemRefType> getD_S(); + ::mlir::TypedValue<::mlir::MemRefType> getScratch(); + ::mlir::TypedValue<::mlir::MemRefType> getDBias(); + ::mlir::OpOperand &getBmm1GradGemm1RhsMutable(); + ::mlir::OpOperand &getBmm1GradGemm2RhsMutable(); + ::mlir::OpOperand &getBmm2GradGemm2RhsMutable(); + ::mlir::OpOperand &getBmm2GradGemm1LhsMutable(); + ::mlir::OpOperand &getDOutputMutable(); + ::mlir::MutableOperandRange getMaskMutable(); + ::mlir::OpOperand &getDBmm1LhsMutable(); + ::mlir::OpOperand &getDBmm1RhsMutable(); + ::mlir::OpOperand &getDBmm2RhsMutable(); + ::mlir::OpOperand &getD_SMutable(); + ::mlir::OpOperand &getScratchMutable(); + ::mlir::MutableOperandRange getDBiasMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::mhlo::DotDimensionNumbersAttr getBmm1GradGemm1DotDimensionNumbersAttr(); + ::mlir::mhlo::DotDimensionNumbersAttr getBmm1GradGemm1DotDimensionNumbers(); + ::mlir::mhlo::DotDimensionNumbersAttr getBmm1GradGemm2DotDimensionNumbersAttr(); + ::mlir::mhlo::DotDimensionNumbersAttr getBmm1GradGemm2DotDimensionNumbers(); + ::mlir::mhlo::DotDimensionNumbersAttr getBmm2GradGemm1DotDimensionNumbersAttr(); + ::mlir::mhlo::DotDimensionNumbersAttr getBmm2GradGemm1DotDimensionNumbers(); + ::mlir::mhlo::DotDimensionNumbersAttr getBmm2GradGemm2DotDimensionNumbersAttr(); + ::mlir::mhlo::DotDimensionNumbersAttr getBmm2GradGemm2DotDimensionNumbers(); + ::mlir::FloatAttr getFmhaScaleAttr(); + ::llvm::APFloat getFmhaScale(); + ::mlir::lmhlo_gpu::FusedMhaBackwardDagSignatureAttr getFusedMhaDagAttr(); + ::mlir::lmhlo_gpu::FusedMhaBackwardDagSignature getFusedMhaDag(); + ::mlir::lmhlo_gpu::FusedMHAAlgorithmConfigAttr getAlgorithmConfigAttr(); + ::mlir::lmhlo_gpu::FusedMHAAlgorithmConfigAttr getAlgorithmConfig(); + ::mlir::FloatAttr getDropoutRateAttr(); + ::std::optional< ::llvm::APFloat > getDropoutRate(); + ::mlir::IntegerAttr getSeedAttr(); + ::std::optional getSeed(); + void setBmm1GradGemm1DotDimensionNumbersAttr(::mlir::mhlo::DotDimensionNumbersAttr attr); + void setBmm1GradGemm2DotDimensionNumbersAttr(::mlir::mhlo::DotDimensionNumbersAttr attr); + void setBmm2GradGemm1DotDimensionNumbersAttr(::mlir::mhlo::DotDimensionNumbersAttr attr); + void setBmm2GradGemm2DotDimensionNumbersAttr(::mlir::mhlo::DotDimensionNumbersAttr attr); + void setFmhaScaleAttr(::mlir::FloatAttr attr); + void setFmhaScale(::llvm::APFloat attrValue); + void setFusedMhaDagAttr(::mlir::lmhlo_gpu::FusedMhaBackwardDagSignatureAttr attr); + void setFusedMhaDag(::mlir::lmhlo_gpu::FusedMhaBackwardDagSignature attrValue); + void setAlgorithmConfigAttr(::mlir::lmhlo_gpu::FusedMHAAlgorithmConfigAttr attr); + void setDropoutRateAttr(::mlir::FloatAttr attr); + void setDropoutRate(::std::optional<::llvm::APFloat> attrValue); + void setSeedAttr(::mlir::IntegerAttr attr); + void setSeed(::std::optional attrValue); + ::mlir::Attribute removeDropoutRateAttr(); + ::mlir::Attribute removeSeedAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value bmm1_grad_gemm1_rhs, ::mlir::Value bmm1_grad_gemm2_rhs, ::mlir::Value bmm2_grad_gemm2_rhs, ::mlir::Value bmm2_grad_gemm1_lhs, ::mlir::Value d_output, /*optional*/::mlir::Value mask, ::mlir::Value d_bmm1_lhs, ::mlir::Value d_bmm1_rhs, ::mlir::Value d_bmm2_rhs, ::mlir::Value d_S, ::mlir::Value scratch, /*optional*/::mlir::Value d_bias, ::mlir::mhlo::DotDimensionNumbersAttr bmm1_grad_gemm1_dot_dimension_numbers, ::mlir::mhlo::DotDimensionNumbersAttr bmm1_grad_gemm2_dot_dimension_numbers, ::mlir::mhlo::DotDimensionNumbersAttr bmm2_grad_gemm1_dot_dimension_numbers, ::mlir::mhlo::DotDimensionNumbersAttr bmm2_grad_gemm2_dot_dimension_numbers, ::mlir::FloatAttr fmha_scale, ::mlir::lmhlo_gpu::FusedMhaBackwardDagSignatureAttr fused_mha_dag, ::mlir::lmhlo_gpu::FusedMHAAlgorithmConfigAttr algorithm_config, /*optional*/::mlir::FloatAttr dropout_rate, /*optional*/::mlir::IntegerAttr seed); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value bmm1_grad_gemm1_rhs, ::mlir::Value bmm1_grad_gemm2_rhs, ::mlir::Value bmm2_grad_gemm2_rhs, ::mlir::Value bmm2_grad_gemm1_lhs, ::mlir::Value d_output, /*optional*/::mlir::Value mask, ::mlir::Value d_bmm1_lhs, ::mlir::Value d_bmm1_rhs, ::mlir::Value d_bmm2_rhs, ::mlir::Value d_S, ::mlir::Value scratch, /*optional*/::mlir::Value d_bias, ::mlir::mhlo::DotDimensionNumbersAttr bmm1_grad_gemm1_dot_dimension_numbers, ::mlir::mhlo::DotDimensionNumbersAttr bmm1_grad_gemm2_dot_dimension_numbers, ::mlir::mhlo::DotDimensionNumbersAttr bmm2_grad_gemm1_dot_dimension_numbers, ::mlir::mhlo::DotDimensionNumbersAttr bmm2_grad_gemm2_dot_dimension_numbers, ::mlir::FloatAttr fmha_scale, ::mlir::lmhlo_gpu::FusedMhaBackwardDagSignatureAttr fused_mha_dag, ::mlir::lmhlo_gpu::FusedMHAAlgorithmConfigAttr algorithm_config, /*optional*/::mlir::FloatAttr dropout_rate, /*optional*/::mlir::IntegerAttr seed); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value bmm1_grad_gemm1_rhs, ::mlir::Value bmm1_grad_gemm2_rhs, ::mlir::Value bmm2_grad_gemm2_rhs, ::mlir::Value bmm2_grad_gemm1_lhs, ::mlir::Value d_output, /*optional*/::mlir::Value mask, ::mlir::Value d_bmm1_lhs, ::mlir::Value d_bmm1_rhs, ::mlir::Value d_bmm2_rhs, ::mlir::Value d_S, ::mlir::Value scratch, /*optional*/::mlir::Value d_bias, ::mlir::mhlo::DotDimensionNumbersAttr bmm1_grad_gemm1_dot_dimension_numbers, ::mlir::mhlo::DotDimensionNumbersAttr bmm1_grad_gemm2_dot_dimension_numbers, ::mlir::mhlo::DotDimensionNumbersAttr bmm2_grad_gemm1_dot_dimension_numbers, ::mlir::mhlo::DotDimensionNumbersAttr bmm2_grad_gemm2_dot_dimension_numbers, ::llvm::APFloat fmha_scale, ::mlir::lmhlo_gpu::FusedMhaBackwardDagSignature fused_mha_dag, ::mlir::lmhlo_gpu::FusedMHAAlgorithmConfigAttr algorithm_config, /*optional*/::mlir::FloatAttr dropout_rate, /*optional*/::mlir::IntegerAttr seed); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value bmm1_grad_gemm1_rhs, ::mlir::Value bmm1_grad_gemm2_rhs, ::mlir::Value bmm2_grad_gemm2_rhs, ::mlir::Value bmm2_grad_gemm1_lhs, ::mlir::Value d_output, /*optional*/::mlir::Value mask, ::mlir::Value d_bmm1_lhs, ::mlir::Value d_bmm1_rhs, ::mlir::Value d_bmm2_rhs, ::mlir::Value d_S, ::mlir::Value scratch, /*optional*/::mlir::Value d_bias, ::mlir::mhlo::DotDimensionNumbersAttr bmm1_grad_gemm1_dot_dimension_numbers, ::mlir::mhlo::DotDimensionNumbersAttr bmm1_grad_gemm2_dot_dimension_numbers, ::mlir::mhlo::DotDimensionNumbersAttr bmm2_grad_gemm1_dot_dimension_numbers, ::mlir::mhlo::DotDimensionNumbersAttr bmm2_grad_gemm2_dot_dimension_numbers, ::llvm::APFloat fmha_scale, ::mlir::lmhlo_gpu::FusedMhaBackwardDagSignature fused_mha_dag, ::mlir::lmhlo_gpu::FusedMHAAlgorithmConfigAttr algorithm_config, /*optional*/::mlir::FloatAttr dropout_rate, /*optional*/::mlir::IntegerAttr seed); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 10 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo_gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo_gpu::fusedMHABackwardOp) + +namespace mlir { +namespace lmhlo_gpu { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo_gpu::fusedMHAOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class fusedMHAOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + fusedMHAOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + fusedMHAOpGenericAdaptorBase(fusedMHAOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::mhlo::DotDimensionNumbersAttr getBmm1DotDimensionNumbersAttr(); + ::mlir::mhlo::DotDimensionNumbersAttr getBmm1DotDimensionNumbers(); + ::mlir::mhlo::DotDimensionNumbersAttr getBmm2DotDimensionNumbersAttr(); + ::mlir::mhlo::DotDimensionNumbersAttr getBmm2DotDimensionNumbers(); + ::mlir::ArrayAttr getIntermediateTensorDimensionsAttr(); + ::mlir::ArrayAttr getIntermediateTensorDimensions(); + ::mlir::ArrayAttr getIntermediateTensorLayoutAttr(); + ::mlir::ArrayAttr getIntermediateTensorLayout(); + ::mlir::FloatAttr getFmhaScaleAttr(); + ::llvm::APFloat getFmhaScale(); + ::mlir::lmhlo_gpu::FusedMhaDagSignatureAttr getFusedMhaDagAttr(); + ::mlir::lmhlo_gpu::FusedMhaDagSignature getFusedMhaDag(); + ::mlir::lmhlo_gpu::FusedMHAAlgorithmConfigAttr getAlgorithmConfigAttr(); + ::mlir::lmhlo_gpu::FusedMHAAlgorithmConfigAttr getAlgorithmConfig(); + ::mlir::FloatAttr getDropoutRateAttr(); + ::std::optional< ::llvm::APFloat > getDropoutRate(); + ::mlir::IntegerAttr getSeedAttr(); + ::std::optional getSeed(); +}; +} // namespace detail +template +class fusedMHAOpGenericAdaptor : public detail::fusedMHAOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::fusedMHAOpGenericAdaptorBase; +public: + fusedMHAOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + fusedMHAOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : fusedMHAOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + fusedMHAOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhsBmm1() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhsBmm1() { + return (*getODSOperands(1).begin()); + } + + ValueT getRhsBmm2() { + return (*getODSOperands(2).begin()); + } + + ValueT getMask() { + auto operands = getODSOperands(3); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + ValueT getBias() { + auto operands = getODSOperands(4); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + ValueT getOutput() { + return (*getODSOperands(5).begin()); + } + + ValueT getScratch() { + return (*getODSOperands(6).begin()); + } + + ValueT getActivation() { + auto operands = getODSOperands(7); + return operands.empty() ? ValueT{} : (*operands.begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class fusedMHAOpAdaptor : public fusedMHAOpGenericAdaptor<::mlir::ValueRange> { +public: + using fusedMHAOpGenericAdaptor::fusedMHAOpGenericAdaptor; + fusedMHAOpAdaptor(fusedMHAOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class fusedMHAOp : public ::mlir::Op::Impl, ::mlir::OpTrait::AttrSizedOperandSegments, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = fusedMHAOpAdaptor; + template + using GenericAdaptor = fusedMHAOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("algorithm_config"), ::llvm::StringRef("bmm1_dot_dimension_numbers"), ::llvm::StringRef("bmm2_dot_dimension_numbers"), ::llvm::StringRef("dropout_rate"), ::llvm::StringRef("fmha_scale"), ::llvm::StringRef("fused_mha_dag"), ::llvm::StringRef("intermediate_tensor_dimensions"), ::llvm::StringRef("intermediate_tensor_layout"), ::llvm::StringRef("operandSegmentSizes"), ::llvm::StringRef("seed")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getAlgorithmConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getAlgorithmConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getBmm1DotDimensionNumbersAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getBmm1DotDimensionNumbersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getBmm2DotDimensionNumbersAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getBmm2DotDimensionNumbersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getDropoutRateAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getDropoutRateAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getFmhaScaleAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getFmhaScaleAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getFusedMhaDagAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getFusedMhaDagAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getIntermediateTensorDimensionsAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getIntermediateTensorDimensionsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getIntermediateTensorLayoutAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getIntermediateTensorLayoutAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return getAttributeNameForIndex(8); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 8); + } + + ::mlir::StringAttr getSeedAttrName() { + return getAttributeNameForIndex(9); + } + + static ::mlir::StringAttr getSeedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 9); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo_gpu.fMHA"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getLhsBmm1(); + ::mlir::TypedValue<::mlir::MemRefType> getRhsBmm1(); + ::mlir::TypedValue<::mlir::MemRefType> getRhsBmm2(); + ::mlir::TypedValue<::mlir::MemRefType> getMask(); + ::mlir::TypedValue<::mlir::MemRefType> getBias(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::TypedValue<::mlir::MemRefType> getScratch(); + ::mlir::TypedValue<::mlir::MemRefType> getActivation(); + ::mlir::OpOperand &getLhsBmm1Mutable(); + ::mlir::OpOperand &getRhsBmm1Mutable(); + ::mlir::OpOperand &getRhsBmm2Mutable(); + ::mlir::MutableOperandRange getMaskMutable(); + ::mlir::MutableOperandRange getBiasMutable(); + ::mlir::OpOperand &getOutputMutable(); + ::mlir::OpOperand &getScratchMutable(); + ::mlir::MutableOperandRange getActivationMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::mhlo::DotDimensionNumbersAttr getBmm1DotDimensionNumbersAttr(); + ::mlir::mhlo::DotDimensionNumbersAttr getBmm1DotDimensionNumbers(); + ::mlir::mhlo::DotDimensionNumbersAttr getBmm2DotDimensionNumbersAttr(); + ::mlir::mhlo::DotDimensionNumbersAttr getBmm2DotDimensionNumbers(); + ::mlir::ArrayAttr getIntermediateTensorDimensionsAttr(); + ::mlir::ArrayAttr getIntermediateTensorDimensions(); + ::mlir::ArrayAttr getIntermediateTensorLayoutAttr(); + ::mlir::ArrayAttr getIntermediateTensorLayout(); + ::mlir::FloatAttr getFmhaScaleAttr(); + ::llvm::APFloat getFmhaScale(); + ::mlir::lmhlo_gpu::FusedMhaDagSignatureAttr getFusedMhaDagAttr(); + ::mlir::lmhlo_gpu::FusedMhaDagSignature getFusedMhaDag(); + ::mlir::lmhlo_gpu::FusedMHAAlgorithmConfigAttr getAlgorithmConfigAttr(); + ::mlir::lmhlo_gpu::FusedMHAAlgorithmConfigAttr getAlgorithmConfig(); + ::mlir::FloatAttr getDropoutRateAttr(); + ::std::optional< ::llvm::APFloat > getDropoutRate(); + ::mlir::IntegerAttr getSeedAttr(); + ::std::optional getSeed(); + void setBmm1DotDimensionNumbersAttr(::mlir::mhlo::DotDimensionNumbersAttr attr); + void setBmm2DotDimensionNumbersAttr(::mlir::mhlo::DotDimensionNumbersAttr attr); + void setIntermediateTensorDimensionsAttr(::mlir::ArrayAttr attr); + void setIntermediateTensorLayoutAttr(::mlir::ArrayAttr attr); + void setFmhaScaleAttr(::mlir::FloatAttr attr); + void setFmhaScale(::llvm::APFloat attrValue); + void setFusedMhaDagAttr(::mlir::lmhlo_gpu::FusedMhaDagSignatureAttr attr); + void setFusedMhaDag(::mlir::lmhlo_gpu::FusedMhaDagSignature attrValue); + void setAlgorithmConfigAttr(::mlir::lmhlo_gpu::FusedMHAAlgorithmConfigAttr attr); + void setDropoutRateAttr(::mlir::FloatAttr attr); + void setDropoutRate(::std::optional<::llvm::APFloat> attrValue); + void setSeedAttr(::mlir::IntegerAttr attr); + void setSeed(::std::optional attrValue); + ::mlir::Attribute removeDropoutRateAttr(); + ::mlir::Attribute removeSeedAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs_bmm1, ::mlir::Value rhs_bmm1, ::mlir::Value rhs_bmm2, /*optional*/::mlir::Value mask, /*optional*/::mlir::Value bias, ::mlir::Value output, ::mlir::Value scratch, /*optional*/::mlir::Value activation, ::mlir::mhlo::DotDimensionNumbersAttr bmm1_dot_dimension_numbers, ::mlir::mhlo::DotDimensionNumbersAttr bmm2_dot_dimension_numbers, ::mlir::ArrayAttr intermediate_tensor_dimensions, ::mlir::ArrayAttr intermediate_tensor_layout, ::mlir::FloatAttr fmha_scale, ::mlir::lmhlo_gpu::FusedMhaDagSignatureAttr fused_mha_dag, ::mlir::lmhlo_gpu::FusedMHAAlgorithmConfigAttr algorithm_config, /*optional*/::mlir::FloatAttr dropout_rate, /*optional*/::mlir::IntegerAttr seed); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs_bmm1, ::mlir::Value rhs_bmm1, ::mlir::Value rhs_bmm2, /*optional*/::mlir::Value mask, /*optional*/::mlir::Value bias, ::mlir::Value output, ::mlir::Value scratch, /*optional*/::mlir::Value activation, ::mlir::mhlo::DotDimensionNumbersAttr bmm1_dot_dimension_numbers, ::mlir::mhlo::DotDimensionNumbersAttr bmm2_dot_dimension_numbers, ::mlir::ArrayAttr intermediate_tensor_dimensions, ::mlir::ArrayAttr intermediate_tensor_layout, ::mlir::FloatAttr fmha_scale, ::mlir::lmhlo_gpu::FusedMhaDagSignatureAttr fused_mha_dag, ::mlir::lmhlo_gpu::FusedMHAAlgorithmConfigAttr algorithm_config, /*optional*/::mlir::FloatAttr dropout_rate, /*optional*/::mlir::IntegerAttr seed); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs_bmm1, ::mlir::Value rhs_bmm1, ::mlir::Value rhs_bmm2, /*optional*/::mlir::Value mask, /*optional*/::mlir::Value bias, ::mlir::Value output, ::mlir::Value scratch, /*optional*/::mlir::Value activation, ::mlir::mhlo::DotDimensionNumbersAttr bmm1_dot_dimension_numbers, ::mlir::mhlo::DotDimensionNumbersAttr bmm2_dot_dimension_numbers, ::mlir::ArrayAttr intermediate_tensor_dimensions, ::mlir::ArrayAttr intermediate_tensor_layout, ::llvm::APFloat fmha_scale, ::mlir::lmhlo_gpu::FusedMhaDagSignature fused_mha_dag, ::mlir::lmhlo_gpu::FusedMHAAlgorithmConfigAttr algorithm_config, /*optional*/::mlir::FloatAttr dropout_rate, /*optional*/::mlir::IntegerAttr seed); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs_bmm1, ::mlir::Value rhs_bmm1, ::mlir::Value rhs_bmm2, /*optional*/::mlir::Value mask, /*optional*/::mlir::Value bias, ::mlir::Value output, ::mlir::Value scratch, /*optional*/::mlir::Value activation, ::mlir::mhlo::DotDimensionNumbersAttr bmm1_dot_dimension_numbers, ::mlir::mhlo::DotDimensionNumbersAttr bmm2_dot_dimension_numbers, ::mlir::ArrayAttr intermediate_tensor_dimensions, ::mlir::ArrayAttr intermediate_tensor_layout, ::llvm::APFloat fmha_scale, ::mlir::lmhlo_gpu::FusedMhaDagSignature fused_mha_dag, ::mlir::lmhlo_gpu::FusedMHAAlgorithmConfigAttr algorithm_config, /*optional*/::mlir::FloatAttr dropout_rate, /*optional*/::mlir::IntegerAttr seed); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 10 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo_gpu +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo_gpu::fusedMHAOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/lhlo_ops_inc_gen/lhlo/IR/lhlo_ops.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/lhlo_ops_inc_gen/lhlo/IR/lhlo_ops.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..3981e3098c2b7a01b548b2925addaa16a31e9400 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/lhlo_ops_inc_gen/lhlo/IR/lhlo_ops.h.inc @@ -0,0 +1,13398 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Op Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* From: lhlo_ops.td *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#if defined(GET_OP_CLASSES) || defined(GET_OP_FWD_DEFINES) +#undef GET_OP_FWD_DEFINES +namespace mlir { +namespace lmhlo { +class FusionOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class AbsOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class AddOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class AndOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class Atan2Op; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class BatchNormGradOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class BatchNormInferenceOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class BatchNormTrainingOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class BitcastConvertOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class BitcastOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class BroadcastInDimOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class BroadcastOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class CaseOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class CbrtOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class CeilOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class CholeskyOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class ClampOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class ClzOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class CompareOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class ComplexOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class ConcatenateOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class ConstantOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class ConvertOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class ConvolutionOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class CopyOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class CosineOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class CustomCallOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class DivOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class DotGeneralOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class DotOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class DynamicBitcastOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class DynamicBroadcastInDimOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class DynamicConvOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class DynamicGatherOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class DynamicIotaOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class DynamicPadOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class DynamicReshapeOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class DynamicSliceOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class DynamicUpdateSliceOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class ExpOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class Expm1Op; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class FftOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class FloorOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class GatherOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class ImagOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class InfeedOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class IotaOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class IsFiniteOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class Log1pOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class LogOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class LogisticOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class MapOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class MaxOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class MinOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class MulOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class NegOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class NotOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class OrOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class OutfeedOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class PadOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class PartitionIdOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class PopulationCountOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class PowOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class RealDynamicSliceOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class RealOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class RecvDoneOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class RecvOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class ReduceOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class ReducePrecisionOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class ReduceWindowOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class RemOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class ReplicaIdOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class ReshapeOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class ReverseOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class RngGetAndUpdateStateOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class RoundNearestEvenOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class RoundOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class RsqrtOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class ScatterOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class SelectAndScatterOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class SelectOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class SendDoneOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class SendOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class ShiftLeftOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class ShiftRightArithmeticOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class ShiftRightLogicalOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class SignOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class SineOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class SliceOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class SortOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class SqrtOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class SubtractOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class TanOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class TanhOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class TransposeOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class TriangularSolveOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class WhileOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class XorOp; +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +class TerminatorOp; +} // namespace lmhlo +} // namespace mlir +#endif + +#ifdef GET_OP_CLASSES +#undef GET_OP_CLASSES + + +//===----------------------------------------------------------------------===// +// Local Utility Method Definitions +//===----------------------------------------------------------------------===// + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::FusionOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FusionOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FusionOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FusionOpGenericAdaptorBase(FusionOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::Attribute getBackendConfigAttr(); + ::std::optional<::mlir::Attribute> getBackendConfig(); + ::mlir::Region &getRegion(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class FusionOpGenericAdaptor : public detail::FusionOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FusionOpGenericAdaptorBase; +public: + FusionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FusionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FusionOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FusionOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FusionOpAdaptor : public FusionOpGenericAdaptor<::mlir::ValueRange> { +public: + using FusionOpGenericAdaptor::FusionOpGenericAdaptor; + FusionOpAdaptor(FusionOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FusionOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait, ::mlir::RegionBranchOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FusionOpAdaptor; + template + using GenericAdaptor = FusionOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("backend_config")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBackendConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBackendConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.fusion"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getRegion(); + ::mlir::Attribute getBackendConfigAttr(); + ::std::optional<::mlir::Attribute> getBackendConfig(); + void setBackendConfigAttr(::mlir::Attribute attr); + ::mlir::Attribute removeBackendConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ArrayRef attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getSuccessorRegions(::mlir::RegionBranchPoint point, ::llvm::SmallVectorImpl<::mlir::RegionSuccessor> ®ions); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + SmallVector getInputBuffers() { + SmallVector buffers; + for (auto load : getRegion().front().getOps()) { + buffers.push_back(load.getMemref()); + } + return buffers; + } + + SmallVector getOutputBuffers() { + SmallVector buffers; + for (auto store : getRegion().front().getOps()) { + buffers.push_back(store.getMemref()); + } + return buffers; + } + + SmallVector getFusionParameters() { + SmallVector buffers; + for (auto load : getRegion().front().getOps()) { + buffers.push_back(load); + } + return buffers; + } + + SmallVector getFusionResults() { + SmallVector buffers; + for (auto store : getRegion().front().getOps()) { + buffers.push_back(store.getTensor()); + } + return buffers; + } + + SmallVector getFusionRoots() { + SmallVector roots; + for (auto value : getFusionResults()) { + Operation* op = value.getDefiningOp(); + if (roots.empty() || roots.back() != op) { + roots.push_back(op); + } + } + return roots; + } +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::FusionOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::AbsOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AbsOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AbsOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AbsOpGenericAdaptorBase(AbsOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class AbsOpGenericAdaptor : public detail::AbsOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AbsOpGenericAdaptorBase; +public: + AbsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AbsOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AbsOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AbsOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AbsOpAdaptor : public AbsOpGenericAdaptor<::mlir::ValueRange> { +public: + using AbsOpGenericAdaptor::AbsOpGenericAdaptor; + AbsOpAdaptor(AbsOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AbsOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait, ::mlir::OpTrait::SameOperandsShape> { +public: + using Op::Op; + using Op::print; + using Adaptor = AbsOpAdaptor; + template + using GenericAdaptor = AbsOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.abs"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getInput(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value output); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::AbsOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::AddOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AddOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AddOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AddOpGenericAdaptorBase(AddOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getBroadcastDimensionsAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getBroadcastDimensions(); +}; +} // namespace detail +template +class AddOpGenericAdaptor : public detail::AddOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AddOpGenericAdaptorBase; +public: + AddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AddOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AddOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AddOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + ValueT getOut() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AddOpAdaptor : public AddOpGenericAdaptor<::mlir::ValueRange> { +public: + using AddOpGenericAdaptor::AddOpGenericAdaptor; + AddOpAdaptor(AddOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AddOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait, ::mlir::OpTrait::SameTypeOperands, ::mlir::OpTrait::Elementwise> { +public: + using Op::Op; + using Op::print; + using Adaptor = AddOpAdaptor; + template + using GenericAdaptor = AddOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("broadcast_dimensions")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBroadcastDimensionsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBroadcastDimensionsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.add"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getLhs(); + ::mlir::TypedValue<::mlir::MemRefType> getRhs(); + ::mlir::TypedValue<::mlir::MemRefType> getOut(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + ::mlir::OpOperand &getOutMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::DenseIntElementsAttr getBroadcastDimensionsAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getBroadcastDimensions(); + void setBroadcastDimensionsAttr(::mlir::DenseIntElementsAttr attr); + ::mlir::Attribute removeBroadcastDimensionsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value out, /*optional*/::mlir::DenseIntElementsAttr broadcast_dimensions); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value out, /*optional*/::mlir::DenseIntElementsAttr broadcast_dimensions); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::AddOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::AndOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class AndOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + AndOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + AndOpGenericAdaptorBase(AndOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getBroadcastDimensionsAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getBroadcastDimensions(); +}; +} // namespace detail +template +class AndOpGenericAdaptor : public detail::AndOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::AndOpGenericAdaptorBase; +public: + AndOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + AndOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : AndOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + AndOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + ValueT getOut() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class AndOpAdaptor : public AndOpGenericAdaptor<::mlir::ValueRange> { +public: + using AndOpGenericAdaptor::AndOpGenericAdaptor; + AndOpAdaptor(AndOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class AndOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait, ::mlir::OpTrait::SameTypeOperands, ::mlir::OpTrait::Elementwise> { +public: + using Op::Op; + using Op::print; + using Adaptor = AndOpAdaptor; + template + using GenericAdaptor = AndOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("broadcast_dimensions")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBroadcastDimensionsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBroadcastDimensionsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.and"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getLhs(); + ::mlir::TypedValue<::mlir::MemRefType> getRhs(); + ::mlir::TypedValue<::mlir::MemRefType> getOut(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + ::mlir::OpOperand &getOutMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::DenseIntElementsAttr getBroadcastDimensionsAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getBroadcastDimensions(); + void setBroadcastDimensionsAttr(::mlir::DenseIntElementsAttr attr); + ::mlir::Attribute removeBroadcastDimensionsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value out, /*optional*/::mlir::DenseIntElementsAttr broadcast_dimensions); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value out, /*optional*/::mlir::DenseIntElementsAttr broadcast_dimensions); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::AndOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::Atan2Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Atan2OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + Atan2OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + Atan2OpGenericAdaptorBase(Atan2Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getBroadcastDimensionsAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getBroadcastDimensions(); +}; +} // namespace detail +template +class Atan2OpGenericAdaptor : public detail::Atan2OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Atan2OpGenericAdaptorBase; +public: + Atan2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Atan2OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Atan2OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + Atan2OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + ValueT getOut() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Atan2OpAdaptor : public Atan2OpGenericAdaptor<::mlir::ValueRange> { +public: + using Atan2OpGenericAdaptor::Atan2OpGenericAdaptor; + Atan2OpAdaptor(Atan2Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Atan2Op : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait, ::mlir::OpTrait::SameTypeOperands, ::mlir::OpTrait::Elementwise> { +public: + using Op::Op; + using Op::print; + using Adaptor = Atan2OpAdaptor; + template + using GenericAdaptor = Atan2OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("broadcast_dimensions")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBroadcastDimensionsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBroadcastDimensionsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.atan2"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getLhs(); + ::mlir::TypedValue<::mlir::MemRefType> getRhs(); + ::mlir::TypedValue<::mlir::MemRefType> getOut(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + ::mlir::OpOperand &getOutMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::DenseIntElementsAttr getBroadcastDimensionsAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getBroadcastDimensions(); + void setBroadcastDimensionsAttr(::mlir::DenseIntElementsAttr attr); + ::mlir::Attribute removeBroadcastDimensionsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value out, /*optional*/::mlir::DenseIntElementsAttr broadcast_dimensions); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value out, /*optional*/::mlir::DenseIntElementsAttr broadcast_dimensions); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::Atan2Op) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::BatchNormGradOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BatchNormGradOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BatchNormGradOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BatchNormGradOpGenericAdaptorBase(BatchNormGradOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::IntegerAttr getFeatureIndexAttr(); + uint64_t getFeatureIndex(); +}; +} // namespace detail +template +class BatchNormGradOpGenericAdaptor : public detail::BatchNormGradOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BatchNormGradOpGenericAdaptorBase; +public: + BatchNormGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BatchNormGradOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BatchNormGradOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BatchNormGradOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + ValueT getScale() { + return (*getODSOperands(1).begin()); + } + + ValueT getMean() { + return (*getODSOperands(2).begin()); + } + + ValueT getVariance() { + return (*getODSOperands(3).begin()); + } + + ValueT getGradOutput() { + return (*getODSOperands(4).begin()); + } + + ValueT getGradOperand() { + return (*getODSOperands(5).begin()); + } + + ValueT getGradScale() { + return (*getODSOperands(6).begin()); + } + + ValueT getGradOffset() { + return (*getODSOperands(7).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BatchNormGradOpAdaptor : public BatchNormGradOpGenericAdaptor<::mlir::ValueRange> { +public: + using BatchNormGradOpGenericAdaptor::BatchNormGradOpGenericAdaptor; + BatchNormGradOpAdaptor(BatchNormGradOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BatchNormGradOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BatchNormGradOpAdaptor; + template + using GenericAdaptor = BatchNormGradOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("epsilon"), ::llvm::StringRef("feature_index")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getEpsilonAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getEpsilonAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getFeatureIndexAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getFeatureIndexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.batch_norm_grad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getOperand(); + ::mlir::TypedValue<::mlir::MemRefType> getScale(); + ::mlir::TypedValue<::mlir::MemRefType> getMean(); + ::mlir::TypedValue<::mlir::MemRefType> getVariance(); + ::mlir::TypedValue<::mlir::MemRefType> getGradOutput(); + ::mlir::TypedValue<::mlir::MemRefType> getGradOperand(); + ::mlir::TypedValue<::mlir::MemRefType> getGradScale(); + ::mlir::TypedValue<::mlir::MemRefType> getGradOffset(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::OpOperand &getScaleMutable(); + ::mlir::OpOperand &getMeanMutable(); + ::mlir::OpOperand &getVarianceMutable(); + ::mlir::OpOperand &getGradOutputMutable(); + ::mlir::OpOperand &getGradOperandMutable(); + ::mlir::OpOperand &getGradScaleMutable(); + ::mlir::OpOperand &getGradOffsetMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::IntegerAttr getFeatureIndexAttr(); + uint64_t getFeatureIndex(); + void setEpsilonAttr(::mlir::FloatAttr attr); + void setEpsilon(::llvm::APFloat attrValue); + void setFeatureIndexAttr(::mlir::IntegerAttr attr); + void setFeatureIndex(uint64_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::Value scale, ::mlir::Value mean, ::mlir::Value variance, ::mlir::Value grad_output, ::mlir::Value grad_operand, ::mlir::Value grad_scale, ::mlir::Value grad_offset, ::mlir::FloatAttr epsilon, ::mlir::IntegerAttr feature_index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value scale, ::mlir::Value mean, ::mlir::Value variance, ::mlir::Value grad_output, ::mlir::Value grad_operand, ::mlir::Value grad_scale, ::mlir::Value grad_offset, ::mlir::FloatAttr epsilon, ::mlir::IntegerAttr feature_index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::Value scale, ::mlir::Value mean, ::mlir::Value variance, ::mlir::Value grad_output, ::mlir::Value grad_operand, ::mlir::Value grad_scale, ::mlir::Value grad_offset, ::llvm::APFloat epsilon, uint64_t feature_index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value scale, ::mlir::Value mean, ::mlir::Value variance, ::mlir::Value grad_output, ::mlir::Value grad_operand, ::mlir::Value grad_scale, ::mlir::Value grad_offset, ::llvm::APFloat epsilon, uint64_t feature_index); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::BatchNormGradOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::BatchNormInferenceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BatchNormInferenceOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BatchNormInferenceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BatchNormInferenceOpGenericAdaptorBase(BatchNormInferenceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::IntegerAttr getFeatureIndexAttr(); + uint64_t getFeatureIndex(); +}; +} // namespace detail +template +class BatchNormInferenceOpGenericAdaptor : public detail::BatchNormInferenceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BatchNormInferenceOpGenericAdaptorBase; +public: + BatchNormInferenceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BatchNormInferenceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BatchNormInferenceOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BatchNormInferenceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + ValueT getScale() { + return (*getODSOperands(1).begin()); + } + + ValueT getOffset() { + return (*getODSOperands(2).begin()); + } + + ValueT getMean() { + return (*getODSOperands(3).begin()); + } + + ValueT getVariance() { + return (*getODSOperands(4).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(5).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BatchNormInferenceOpAdaptor : public BatchNormInferenceOpGenericAdaptor<::mlir::ValueRange> { +public: + using BatchNormInferenceOpGenericAdaptor::BatchNormInferenceOpGenericAdaptor; + BatchNormInferenceOpAdaptor(BatchNormInferenceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BatchNormInferenceOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BatchNormInferenceOpAdaptor; + template + using GenericAdaptor = BatchNormInferenceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("epsilon"), ::llvm::StringRef("feature_index")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getEpsilonAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getEpsilonAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getFeatureIndexAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getFeatureIndexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.batch_norm_inference"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getOperand(); + ::mlir::TypedValue<::mlir::MemRefType> getScale(); + ::mlir::TypedValue<::mlir::MemRefType> getOffset(); + ::mlir::TypedValue<::mlir::MemRefType> getMean(); + ::mlir::TypedValue<::mlir::MemRefType> getVariance(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::OpOperand &getScaleMutable(); + ::mlir::OpOperand &getOffsetMutable(); + ::mlir::OpOperand &getMeanMutable(); + ::mlir::OpOperand &getVarianceMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::IntegerAttr getFeatureIndexAttr(); + uint64_t getFeatureIndex(); + void setEpsilonAttr(::mlir::FloatAttr attr); + void setEpsilon(::llvm::APFloat attrValue); + void setFeatureIndexAttr(::mlir::IntegerAttr attr); + void setFeatureIndex(uint64_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value mean, ::mlir::Value variance, ::mlir::Value output, ::mlir::FloatAttr epsilon, ::mlir::IntegerAttr feature_index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value mean, ::mlir::Value variance, ::mlir::Value output, ::mlir::FloatAttr epsilon, ::mlir::IntegerAttr feature_index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value mean, ::mlir::Value variance, ::mlir::Value output, ::llvm::APFloat epsilon, uint64_t feature_index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value mean, ::mlir::Value variance, ::mlir::Value output, ::llvm::APFloat epsilon, uint64_t feature_index); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::BatchNormInferenceOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::BatchNormTrainingOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BatchNormTrainingOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BatchNormTrainingOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BatchNormTrainingOpGenericAdaptorBase(BatchNormTrainingOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::IntegerAttr getFeatureIndexAttr(); + uint64_t getFeatureIndex(); +}; +} // namespace detail +template +class BatchNormTrainingOpGenericAdaptor : public detail::BatchNormTrainingOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BatchNormTrainingOpGenericAdaptorBase; +public: + BatchNormTrainingOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BatchNormTrainingOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BatchNormTrainingOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BatchNormTrainingOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + ValueT getScale() { + return (*getODSOperands(1).begin()); + } + + ValueT getOffset() { + return (*getODSOperands(2).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(3).begin()); + } + + ValueT getBatchMean() { + return (*getODSOperands(4).begin()); + } + + ValueT getBatchVar() { + return (*getODSOperands(5).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BatchNormTrainingOpAdaptor : public BatchNormTrainingOpGenericAdaptor<::mlir::ValueRange> { +public: + using BatchNormTrainingOpGenericAdaptor::BatchNormTrainingOpGenericAdaptor; + BatchNormTrainingOpAdaptor(BatchNormTrainingOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BatchNormTrainingOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BatchNormTrainingOpAdaptor; + template + using GenericAdaptor = BatchNormTrainingOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("epsilon"), ::llvm::StringRef("feature_index")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getEpsilonAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getEpsilonAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getFeatureIndexAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getFeatureIndexAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.batch_norm_training"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getOperand(); + ::mlir::TypedValue<::mlir::MemRefType> getScale(); + ::mlir::TypedValue<::mlir::MemRefType> getOffset(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::TypedValue<::mlir::MemRefType> getBatchMean(); + ::mlir::TypedValue<::mlir::MemRefType> getBatchVar(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::OpOperand &getScaleMutable(); + ::mlir::OpOperand &getOffsetMutable(); + ::mlir::OpOperand &getOutputMutable(); + ::mlir::OpOperand &getBatchMeanMutable(); + ::mlir::OpOperand &getBatchVarMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::FloatAttr getEpsilonAttr(); + ::llvm::APFloat getEpsilon(); + ::mlir::IntegerAttr getFeatureIndexAttr(); + uint64_t getFeatureIndex(); + void setEpsilonAttr(::mlir::FloatAttr attr); + void setEpsilon(::llvm::APFloat attrValue); + void setFeatureIndexAttr(::mlir::IntegerAttr attr); + void setFeatureIndex(uint64_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value output, ::mlir::Value batch_mean, ::mlir::Value batch_var, ::mlir::FloatAttr epsilon, ::mlir::IntegerAttr feature_index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value output, ::mlir::Value batch_mean, ::mlir::Value batch_var, ::mlir::FloatAttr epsilon, ::mlir::IntegerAttr feature_index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value output, ::mlir::Value batch_mean, ::mlir::Value batch_var, ::llvm::APFloat epsilon, uint64_t feature_index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value scale, ::mlir::Value offset, ::mlir::Value output, ::mlir::Value batch_mean, ::mlir::Value batch_var, ::llvm::APFloat epsilon, uint64_t feature_index); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::BatchNormTrainingOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::BitcastConvertOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BitcastConvertOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BitcastConvertOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BitcastConvertOpGenericAdaptorBase(BitcastConvertOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class BitcastConvertOpGenericAdaptor : public detail::BitcastConvertOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BitcastConvertOpGenericAdaptorBase; +public: + BitcastConvertOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BitcastConvertOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BitcastConvertOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BitcastConvertOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BitcastConvertOpAdaptor : public BitcastConvertOpGenericAdaptor<::mlir::ValueRange> { +public: + using BitcastConvertOpGenericAdaptor::BitcastConvertOpGenericAdaptor; + BitcastConvertOpAdaptor(BitcastConvertOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BitcastConvertOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait, ::mlir::OpTrait::SameOperandsShape> { +public: + using Op::Op; + using Op::print; + using Adaptor = BitcastConvertOpAdaptor; + template + using GenericAdaptor = BitcastConvertOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.bitcast_convert"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getInput(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value output); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::BitcastConvertOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::BitcastOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BitcastOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BitcastOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BitcastOpGenericAdaptorBase(BitcastOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class BitcastOpGenericAdaptor : public detail::BitcastOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BitcastOpGenericAdaptorBase; +public: + BitcastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BitcastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BitcastOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BitcastOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BitcastOpAdaptor : public BitcastOpGenericAdaptor<::mlir::ValueRange> { +public: + using BitcastOpGenericAdaptor::BitcastOpGenericAdaptor; + BitcastOpAdaptor(BitcastOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BitcastOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BitcastOpAdaptor; + template + using GenericAdaptor = BitcastOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.bitcast"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getOperand(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::Value output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value output); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::BitcastOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::BroadcastInDimOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BroadcastInDimOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BroadcastInDimOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BroadcastInDimOpGenericAdaptorBase(BroadcastInDimOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getBroadcastDimensionsAttr(); + ::mlir::DenseIntElementsAttr getBroadcastDimensions(); +}; +} // namespace detail +template +class BroadcastInDimOpGenericAdaptor : public detail::BroadcastInDimOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BroadcastInDimOpGenericAdaptorBase; +public: + BroadcastInDimOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BroadcastInDimOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BroadcastInDimOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BroadcastInDimOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BroadcastInDimOpAdaptor : public BroadcastInDimOpGenericAdaptor<::mlir::ValueRange> { +public: + using BroadcastInDimOpGenericAdaptor::BroadcastInDimOpGenericAdaptor; + BroadcastInDimOpAdaptor(BroadcastInDimOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BroadcastInDimOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BroadcastInDimOpAdaptor; + template + using GenericAdaptor = BroadcastInDimOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("broadcast_dimensions")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBroadcastDimensionsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBroadcastDimensionsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.broadcast_in_dim"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getOperand(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::DenseIntElementsAttr getBroadcastDimensionsAttr(); + ::mlir::DenseIntElementsAttr getBroadcastDimensions(); + void setBroadcastDimensionsAttr(::mlir::DenseIntElementsAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::Value output, ::mlir::DenseIntElementsAttr broadcast_dimensions); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value output, ::mlir::DenseIntElementsAttr broadcast_dimensions); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::BroadcastInDimOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::BroadcastOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class BroadcastOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + BroadcastOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + BroadcastOpGenericAdaptorBase(BroadcastOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getBroadcastSizesAttr(); + ::mlir::DenseIntElementsAttr getBroadcastSizes(); +}; +} // namespace detail +template +class BroadcastOpGenericAdaptor : public detail::BroadcastOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::BroadcastOpGenericAdaptorBase; +public: + BroadcastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + BroadcastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : BroadcastOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + BroadcastOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class BroadcastOpAdaptor : public BroadcastOpGenericAdaptor<::mlir::ValueRange> { +public: + using BroadcastOpGenericAdaptor::BroadcastOpGenericAdaptor; + BroadcastOpAdaptor(BroadcastOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class BroadcastOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = BroadcastOpAdaptor; + template + using GenericAdaptor = BroadcastOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("broadcast_sizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBroadcastSizesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBroadcastSizesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.broadcast"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getOperand(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::DenseIntElementsAttr getBroadcastSizesAttr(); + ::mlir::DenseIntElementsAttr getBroadcastSizes(); + void setBroadcastSizesAttr(::mlir::DenseIntElementsAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::Value output, ::mlir::DenseIntElementsAttr broadcast_sizes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value output, ::mlir::DenseIntElementsAttr broadcast_sizes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::BroadcastOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::CaseOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CaseOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CaseOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CaseOpGenericAdaptorBase(CaseOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::RegionRange getBranches(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class CaseOpGenericAdaptor : public detail::CaseOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CaseOpGenericAdaptorBase; +public: + CaseOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CaseOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CaseOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CaseOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getIndex() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CaseOpAdaptor : public CaseOpGenericAdaptor<::mlir::ValueRange> { +public: + using CaseOpGenericAdaptor::CaseOpGenericAdaptor; + CaseOpAdaptor(CaseOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CaseOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait, ::mlir::RegionBranchOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CaseOpAdaptor; + template + using GenericAdaptor = CaseOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.case"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getIndex(); + ::mlir::OpOperand &getIndexMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::MutableArrayRef<::mlir::Region> getBranches(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value index, unsigned branchesCount); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value index, unsigned branchesCount); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes, unsigned numRegions); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getSuccessorRegions(::mlir::RegionBranchPoint point, ::llvm::SmallVectorImpl<::mlir::RegionSuccessor> ®ions); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::CaseOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::CbrtOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CbrtOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CbrtOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CbrtOpGenericAdaptorBase(CbrtOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CbrtOpGenericAdaptor : public detail::CbrtOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CbrtOpGenericAdaptorBase; +public: + CbrtOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CbrtOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CbrtOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CbrtOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CbrtOpAdaptor : public CbrtOpGenericAdaptor<::mlir::ValueRange> { +public: + using CbrtOpGenericAdaptor::CbrtOpGenericAdaptor; + CbrtOpAdaptor(CbrtOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CbrtOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait, ::mlir::OpTrait::SameTypeOperands, ::mlir::OpTrait::Elementwise> { +public: + using Op::Op; + using Op::print; + using Adaptor = CbrtOpAdaptor; + template + using GenericAdaptor = CbrtOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.cbrt"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getInput(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value output); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::CbrtOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::CeilOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CeilOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CeilOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CeilOpGenericAdaptorBase(CeilOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CeilOpGenericAdaptor : public detail::CeilOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CeilOpGenericAdaptorBase; +public: + CeilOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CeilOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CeilOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CeilOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CeilOpAdaptor : public CeilOpGenericAdaptor<::mlir::ValueRange> { +public: + using CeilOpGenericAdaptor::CeilOpGenericAdaptor; + CeilOpAdaptor(CeilOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CeilOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait, ::mlir::OpTrait::SameTypeOperands, ::mlir::OpTrait::Elementwise> { +public: + using Op::Op; + using Op::print; + using Adaptor = CeilOpAdaptor; + template + using GenericAdaptor = CeilOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.ceil"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getInput(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value output); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::CeilOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::CholeskyOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CholeskyOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CholeskyOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CholeskyOpGenericAdaptorBase(CholeskyOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getLowerAttr(); + bool getLower(); +}; +} // namespace detail +template +class CholeskyOpGenericAdaptor : public detail::CholeskyOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CholeskyOpGenericAdaptorBase; +public: + CholeskyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CholeskyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CholeskyOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CholeskyOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CholeskyOpAdaptor : public CholeskyOpGenericAdaptor<::mlir::ValueRange> { +public: + using CholeskyOpGenericAdaptor::CholeskyOpGenericAdaptor; + CholeskyOpAdaptor(CholeskyOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CholeskyOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait, ::mlir::OpTrait::SameOperandsElementType> { +public: + using Op::Op; + using Op::print; + using Adaptor = CholeskyOpAdaptor; + template + using GenericAdaptor = CholeskyOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("lower")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getLowerAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getLowerAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.cholesky"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getA(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getAMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::BoolAttr getLowerAttr(); + bool getLower(); + void setLowerAttr(::mlir::BoolAttr attr); + void setLower(::std::optional attrValue); + ::mlir::Attribute removeLowerAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value output, /*optional*/::mlir::BoolAttr lower); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value output, /*optional*/::mlir::BoolAttr lower); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value output, /*optional*/bool lower = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value output, /*optional*/bool lower = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::CholeskyOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::ClampOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ClampOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ClampOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ClampOpGenericAdaptorBase(ClampOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ClampOpGenericAdaptor : public detail::ClampOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ClampOpGenericAdaptorBase; +public: + ClampOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ClampOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ClampOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ClampOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getMin() { + return (*getODSOperands(0).begin()); + } + + ValueT getOperand() { + return (*getODSOperands(1).begin()); + } + + ValueT getMax() { + return (*getODSOperands(2).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ClampOpAdaptor : public ClampOpGenericAdaptor<::mlir::ValueRange> { +public: + using ClampOpGenericAdaptor::ClampOpGenericAdaptor; + ClampOpAdaptor(ClampOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ClampOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ClampOpAdaptor; + template + using GenericAdaptor = ClampOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.clamp"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getMin(); + ::mlir::TypedValue<::mlir::MemRefType> getOperand(); + ::mlir::TypedValue<::mlir::MemRefType> getMax(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getMinMutable(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::OpOperand &getMaxMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value min, ::mlir::Value operand, ::mlir::Value max, ::mlir::Value output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value min, ::mlir::Value operand, ::mlir::Value max, ::mlir::Value output); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::ClampOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::ClzOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ClzOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ClzOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ClzOpGenericAdaptorBase(ClzOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ClzOpGenericAdaptor : public detail::ClzOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ClzOpGenericAdaptorBase; +public: + ClzOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ClzOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ClzOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ClzOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ClzOpAdaptor : public ClzOpGenericAdaptor<::mlir::ValueRange> { +public: + using ClzOpGenericAdaptor::ClzOpGenericAdaptor; + ClzOpAdaptor(ClzOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ClzOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait, ::mlir::OpTrait::SameTypeOperands, ::mlir::OpTrait::Elementwise> { +public: + using Op::Op; + using Op::print; + using Adaptor = ClzOpAdaptor; + template + using GenericAdaptor = ClzOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.count_leading_zeros"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getInput(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value output); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::ClzOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::CompareOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CompareOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CompareOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CompareOpGenericAdaptorBase(CompareOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getBroadcastDimensionsAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getBroadcastDimensions(); + ::mlir::mhlo::ComparisonDirectionAttr getComparisonDirectionAttr(); + ::mlir::mhlo::ComparisonDirection getComparisonDirection(); + ::mlir::mhlo::ComparisonTypeAttr getCompareTypeAttr(); + ::std::optional<::mlir::mhlo::ComparisonType> getCompareType(); +}; +} // namespace detail +template +class CompareOpGenericAdaptor : public detail::CompareOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CompareOpGenericAdaptorBase; +public: + CompareOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CompareOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CompareOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CompareOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + ValueT getOut() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CompareOpAdaptor : public CompareOpGenericAdaptor<::mlir::ValueRange> { +public: + using CompareOpGenericAdaptor::CompareOpGenericAdaptor; + CompareOpAdaptor(CompareOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CompareOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CompareOpAdaptor; + template + using GenericAdaptor = CompareOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("broadcast_dimensions"), ::llvm::StringRef("compare_type"), ::llvm::StringRef("comparison_direction")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBroadcastDimensionsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBroadcastDimensionsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getCompareTypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getCompareTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getComparisonDirectionAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getComparisonDirectionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.compare"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getLhs(); + ::mlir::TypedValue<::mlir::MemRefType> getRhs(); + ::mlir::TypedValue<::mlir::MemRefType> getOut(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + ::mlir::OpOperand &getOutMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::DenseIntElementsAttr getBroadcastDimensionsAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getBroadcastDimensions(); + ::mlir::mhlo::ComparisonDirectionAttr getComparisonDirectionAttr(); + ::mlir::mhlo::ComparisonDirection getComparisonDirection(); + ::mlir::mhlo::ComparisonTypeAttr getCompareTypeAttr(); + ::std::optional<::mlir::mhlo::ComparisonType> getCompareType(); + void setBroadcastDimensionsAttr(::mlir::DenseIntElementsAttr attr); + void setComparisonDirectionAttr(::mlir::mhlo::ComparisonDirectionAttr attr); + void setComparisonDirection(::mlir::mhlo::ComparisonDirection attrValue); + void setCompareTypeAttr(::mlir::mhlo::ComparisonTypeAttr attr); + void setCompareType(::std::optional<::mlir::mhlo::ComparisonType> attrValue); + ::mlir::Attribute removeBroadcastDimensionsAttr(); + ::mlir::Attribute removeCompareTypeAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value out, /*optional*/::mlir::DenseIntElementsAttr broadcast_dimensions, ::mlir::mhlo::ComparisonDirectionAttr comparison_direction, /*optional*/::mlir::mhlo::ComparisonTypeAttr compare_type); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value out, /*optional*/::mlir::DenseIntElementsAttr broadcast_dimensions, ::mlir::mhlo::ComparisonDirectionAttr comparison_direction, /*optional*/::mlir::mhlo::ComparisonTypeAttr compare_type); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value out, /*optional*/::mlir::DenseIntElementsAttr broadcast_dimensions, ::mlir::mhlo::ComparisonDirection comparison_direction, /*optional*/::mlir::mhlo::ComparisonTypeAttr compare_type); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value out, /*optional*/::mlir::DenseIntElementsAttr broadcast_dimensions, ::mlir::mhlo::ComparisonDirection comparison_direction, /*optional*/::mlir::mhlo::ComparisonTypeAttr compare_type); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::CompareOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::ComplexOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ComplexOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ComplexOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ComplexOpGenericAdaptorBase(ComplexOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getBroadcastDimensionsAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getBroadcastDimensions(); +}; +} // namespace detail +template +class ComplexOpGenericAdaptor : public detail::ComplexOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ComplexOpGenericAdaptorBase; +public: + ComplexOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ComplexOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ComplexOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ComplexOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ComplexOpAdaptor : public ComplexOpGenericAdaptor<::mlir::ValueRange> { +public: + using ComplexOpGenericAdaptor::ComplexOpGenericAdaptor; + ComplexOpAdaptor(ComplexOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ComplexOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait, ::mlir::OpTrait::SameOperandsShape> { +public: + using Op::Op; + using Op::print; + using Adaptor = ComplexOpAdaptor; + template + using GenericAdaptor = ComplexOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("broadcast_dimensions")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBroadcastDimensionsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBroadcastDimensionsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.complex"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getLhs(); + ::mlir::TypedValue<::mlir::MemRefType> getRhs(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::DenseIntElementsAttr getBroadcastDimensionsAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getBroadcastDimensions(); + void setBroadcastDimensionsAttr(::mlir::DenseIntElementsAttr attr); + ::mlir::Attribute removeBroadcastDimensionsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value output, /*optional*/::mlir::DenseIntElementsAttr broadcast_dimensions); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value output, /*optional*/::mlir::DenseIntElementsAttr broadcast_dimensions); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::ComplexOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::ConcatenateOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConcatenateOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ConcatenateOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ConcatenateOpGenericAdaptorBase(ConcatenateOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getDimensionAttr(); + uint64_t getDimension(); +}; +} // namespace detail +template +class ConcatenateOpGenericAdaptor : public detail::ConcatenateOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConcatenateOpGenericAdaptorBase; +public: + ConcatenateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConcatenateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConcatenateOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ConcatenateOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getVal() { + return getODSOperands(0); + } + + ValueT getOutput() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConcatenateOpAdaptor : public ConcatenateOpGenericAdaptor<::mlir::ValueRange> { +public: + using ConcatenateOpGenericAdaptor::ConcatenateOpGenericAdaptor; + ConcatenateOpAdaptor(ConcatenateOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConcatenateOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ConcatenateOpAdaptor; + template + using GenericAdaptor = ConcatenateOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dimension")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDimensionAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDimensionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.concatenate"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getVal(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::MutableOperandRange getValMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getDimensionAttr(); + uint64_t getDimension(); + void setDimensionAttr(::mlir::IntegerAttr attr); + void setDimension(uint64_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange val, ::mlir::Value output, ::mlir::IntegerAttr dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange val, ::mlir::Value output, ::mlir::IntegerAttr dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange val, ::mlir::Value output, uint64_t dimension); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange val, ::mlir::Value output, uint64_t dimension); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::ConcatenateOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::ConstantOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConstantOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ConstantOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ConstantOpGenericAdaptorBase(ConstantOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::ElementsAttr getValueAttr(); + ::mlir::ElementsAttr getValue(); +}; +} // namespace detail +template +class ConstantOpGenericAdaptor : public detail::ConstantOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConstantOpGenericAdaptorBase; +public: + ConstantOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConstantOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConstantOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ConstantOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOutput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConstantOpAdaptor : public ConstantOpGenericAdaptor<::mlir::ValueRange> { +public: + using ConstantOpGenericAdaptor::ConstantOpGenericAdaptor; + ConstantOpAdaptor(ConstantOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConstantOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = ConstantOpAdaptor; + template + using GenericAdaptor = ConstantOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("value")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getValueAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getValueAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.constant"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::ElementsAttr getValueAttr(); + ::mlir::ElementsAttr getValue(); + void setValueAttr(::mlir::ElementsAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ElementsAttr value, ::mlir::Value output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ElementsAttr value, ::mlir::Value output); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::ConstantOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::ConvertOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConvertOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ConvertOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ConvertOpGenericAdaptorBase(ConvertOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ConvertOpGenericAdaptor : public detail::ConvertOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConvertOpGenericAdaptorBase; +public: + ConvertOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConvertOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConvertOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ConvertOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConvertOpAdaptor : public ConvertOpGenericAdaptor<::mlir::ValueRange> { +public: + using ConvertOpGenericAdaptor::ConvertOpGenericAdaptor; + ConvertOpAdaptor(ConvertOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConvertOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait, ::mlir::OpTrait::SameOperandsShape> { +public: + using Op::Op; + using Op::print; + using Adaptor = ConvertOpAdaptor; + template + using GenericAdaptor = ConvertOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.convert"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getInput(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value output); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::ConvertOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::ConvolutionOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ConvolutionOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ConvolutionOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ConvolutionOpGenericAdaptorBase(ConvolutionOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getWindowStridesAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getWindowStrides(); + ::mlir::DenseIntElementsAttr getPaddingAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getPadding(); + ::mlir::DenseIntElementsAttr getLhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getLhsDilation(); + ::mlir::DenseIntElementsAttr getRhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getRhsDilation(); + ::mlir::DenseElementsAttr getWindowReversalAttr(); + ::std::optional< ::mlir::DenseElementsAttr > getWindowReversal(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbersAttr(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbers(); + ::mlir::IntegerAttr getFeatureGroupCountAttr(); + uint64_t getFeatureGroupCount(); + ::mlir::IntegerAttr getBatchGroupCountAttr(); + uint64_t getBatchGroupCount(); + ::mlir::ArrayAttr getPrecisionConfigAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrecisionConfig(); +}; +} // namespace detail +template +class ConvolutionOpGenericAdaptor : public detail::ConvolutionOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ConvolutionOpGenericAdaptorBase; +public: + ConvolutionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ConvolutionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ConvolutionOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ConvolutionOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ConvolutionOpAdaptor : public ConvolutionOpGenericAdaptor<::mlir::ValueRange> { +public: + using ConvolutionOpGenericAdaptor::ConvolutionOpGenericAdaptor; + ConvolutionOpAdaptor(ConvolutionOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ConvolutionOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ConvolutionOpAdaptor; + template + using GenericAdaptor = ConvolutionOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("batch_group_count"), ::llvm::StringRef("dimension_numbers"), ::llvm::StringRef("feature_group_count"), ::llvm::StringRef("lhs_dilation"), ::llvm::StringRef("padding"), ::llvm::StringRef("precision_config"), ::llvm::StringRef("rhs_dilation"), ::llvm::StringRef("window_reversal"), ::llvm::StringRef("window_strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBatchGroupCountAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBatchGroupCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDimensionNumbersAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDimensionNumbersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getFeatureGroupCountAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getFeatureGroupCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getLhsDilationAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getLhsDilationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getPrecisionConfigAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getPrecisionConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getRhsDilationAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getRhsDilationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getWindowReversalAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getWindowReversalAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getWindowStridesAttrName() { + return getAttributeNameForIndex(8); + } + + static ::mlir::StringAttr getWindowStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 8); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.convolution"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getLhs(); + ::mlir::TypedValue<::mlir::MemRefType> getRhs(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::DenseIntElementsAttr getWindowStridesAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getWindowStrides(); + ::mlir::DenseIntElementsAttr getPaddingAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getPadding(); + ::mlir::DenseIntElementsAttr getLhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getLhsDilation(); + ::mlir::DenseIntElementsAttr getRhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getRhsDilation(); + ::mlir::DenseElementsAttr getWindowReversalAttr(); + ::std::optional< ::mlir::DenseElementsAttr > getWindowReversal(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbersAttr(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbers(); + ::mlir::IntegerAttr getFeatureGroupCountAttr(); + uint64_t getFeatureGroupCount(); + ::mlir::IntegerAttr getBatchGroupCountAttr(); + uint64_t getBatchGroupCount(); + ::mlir::ArrayAttr getPrecisionConfigAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrecisionConfig(); + void setWindowStridesAttr(::mlir::DenseIntElementsAttr attr); + void setPaddingAttr(::mlir::DenseIntElementsAttr attr); + void setLhsDilationAttr(::mlir::DenseIntElementsAttr attr); + void setRhsDilationAttr(::mlir::DenseIntElementsAttr attr); + void setWindowReversalAttr(::mlir::DenseElementsAttr attr); + void setDimensionNumbersAttr(::mlir::mhlo::ConvDimensionNumbersAttr attr); + void setFeatureGroupCountAttr(::mlir::IntegerAttr attr); + void setFeatureGroupCount(uint64_t attrValue); + void setBatchGroupCountAttr(::mlir::IntegerAttr attr); + void setBatchGroupCount(uint64_t attrValue); + void setPrecisionConfigAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeWindowStridesAttr(); + ::mlir::Attribute removePaddingAttr(); + ::mlir::Attribute removeLhsDilationAttr(); + ::mlir::Attribute removeRhsDilationAttr(); + ::mlir::Attribute removeWindowReversalAttr(); + ::mlir::Attribute removePrecisionConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value output, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, ::mlir::IntegerAttr feature_group_count, ::mlir::IntegerAttr batch_group_count, /*optional*/::mlir::ArrayAttr precision_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value output, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, ::mlir::IntegerAttr feature_group_count, ::mlir::IntegerAttr batch_group_count, /*optional*/::mlir::ArrayAttr precision_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value output, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, uint64_t feature_group_count, uint64_t batch_group_count, /*optional*/::mlir::ArrayAttr precision_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value output, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, uint64_t feature_group_count, uint64_t batch_group_count, /*optional*/::mlir::ArrayAttr precision_config); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static ::mlir::ParseResult parse(::mlir::OpAsmParser &parser, ::mlir::OperationState &result); + void print(::mlir::OpAsmPrinter &_odsPrinter); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 9 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: + bool hasWindowReversal() { + auto reversal = getWindowReversalAttr(); + return reversal && llvm::any_of(reversal.getValues(), + [](bool v) { return v; }); + } +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::ConvolutionOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::CopyOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CopyOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CopyOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CopyOpGenericAdaptorBase(CopyOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CopyOpGenericAdaptor : public detail::CopyOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CopyOpGenericAdaptorBase; +public: + CopyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CopyOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CopyOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CopyOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CopyOpAdaptor : public CopyOpGenericAdaptor<::mlir::ValueRange> { +public: + using CopyOpGenericAdaptor::CopyOpGenericAdaptor; + CopyOpAdaptor(CopyOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CopyOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait, ::mlir::CopyOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = CopyOpAdaptor; + template + using GenericAdaptor = CopyOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.copy"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getOperand(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::Value output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value output); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: + Value getSource() { return getOperand();} + Value getTarget() { return getOutput(); } +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::CopyOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::CosineOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CosineOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CosineOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CosineOpGenericAdaptorBase(CosineOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class CosineOpGenericAdaptor : public detail::CosineOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CosineOpGenericAdaptorBase; +public: + CosineOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CosineOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CosineOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CosineOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CosineOpAdaptor : public CosineOpGenericAdaptor<::mlir::ValueRange> { +public: + using CosineOpGenericAdaptor::CosineOpGenericAdaptor; + CosineOpAdaptor(CosineOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CosineOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait, ::mlir::OpTrait::SameTypeOperands, ::mlir::OpTrait::Elementwise> { +public: + using Op::Op; + using Op::print; + using Adaptor = CosineOpAdaptor; + template + using GenericAdaptor = CosineOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.cosine"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getInput(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value output); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::CosineOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::CustomCallOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class CustomCallOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + CustomCallOpGenericAdaptorBase(::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + CustomCallOpGenericAdaptorBase(CustomCallOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getCallTargetNameAttr(); + ::llvm::StringRef getCallTargetName(); + ::mlir::BoolAttr getHasSideEffectAttr(); + bool getHasSideEffect(); + ::mlir::Attribute getBackendConfigAttr(); + ::std::optional<::mlir::Attribute> getBackendConfig(); + ::mlir::mhlo::CustomCallApiVersionAttr getApiVersionAttr(); + ::mlir::mhlo::CustomCallApiVersion getApiVersion(); + ::mlir::lmhlo::CustomCallTargetArgMappingAttr getTargetArgMappingAttr(); + ::std::optional<::mlir::lmhlo::CustomCallTargetArgMappingAttr> getTargetArgMapping(); + ::mlir::Region &getCalledComputation(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class CustomCallOpGenericAdaptor : public detail::CustomCallOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::CustomCallOpGenericAdaptorBase; +public: + CustomCallOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + CustomCallOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : CustomCallOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + CustomCallOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getArgs() { + return getODSOperands(0); + } + + RangeT getOutput() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class CustomCallOpAdaptor : public CustomCallOpGenericAdaptor<::mlir::ValueRange> { +public: + using CustomCallOpGenericAdaptor::CustomCallOpGenericAdaptor; + CustomCallOpAdaptor(CustomCallOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class CustomCallOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = CustomCallOpAdaptor; + template + using GenericAdaptor = CustomCallOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("api_version"), ::llvm::StringRef("backend_config"), ::llvm::StringRef("call_target_name"), ::llvm::StringRef("has_side_effect"), ::llvm::StringRef("operandSegmentSizes"), ::llvm::StringRef("target_arg_mapping")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getApiVersionAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getApiVersionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getBackendConfigAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getBackendConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getCallTargetNameAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getCallTargetNameAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getHasSideEffectAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getHasSideEffectAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getOperandSegmentSizesAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getOperandSegmentSizesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getTargetArgMappingAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getTargetArgMappingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.custom_call"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getArgs(); + ::mlir::Operation::operand_range getOutput(); + ::mlir::MutableOperandRange getArgsMutable(); + ::mlir::MutableOperandRange getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getCalledComputation(); + ::mlir::StringAttr getCallTargetNameAttr(); + ::llvm::StringRef getCallTargetName(); + ::mlir::BoolAttr getHasSideEffectAttr(); + bool getHasSideEffect(); + ::mlir::Attribute getBackendConfigAttr(); + ::std::optional<::mlir::Attribute> getBackendConfig(); + ::mlir::mhlo::CustomCallApiVersionAttr getApiVersionAttr(); + ::mlir::mhlo::CustomCallApiVersion getApiVersion(); + ::mlir::lmhlo::CustomCallTargetArgMappingAttr getTargetArgMappingAttr(); + ::std::optional<::mlir::lmhlo::CustomCallTargetArgMappingAttr> getTargetArgMapping(); + void setCallTargetNameAttr(::mlir::StringAttr attr); + void setCallTargetName(::llvm::StringRef attrValue); + void setHasSideEffectAttr(::mlir::BoolAttr attr); + void setHasSideEffect(::std::optional attrValue); + void setBackendConfigAttr(::mlir::Attribute attr); + void setApiVersionAttr(::mlir::mhlo::CustomCallApiVersionAttr attr); + void setApiVersion(::std::optional<::mlir::mhlo::CustomCallApiVersion> attrValue); + void setTargetArgMappingAttr(::mlir::lmhlo::CustomCallTargetArgMappingAttr attr); + ::mlir::Attribute removeHasSideEffectAttr(); + ::mlir::Attribute removeBackendConfigAttr(); + ::mlir::Attribute removeApiVersionAttr(); + ::mlir::Attribute removeTargetArgMappingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange args, ::mlir::ValueRange output, ::mlir::StringAttr call_target_name, /*optional*/::mlir::BoolAttr has_side_effect, /*optional*/::mlir::Attribute backend_config, /*optional*/::mlir::mhlo::CustomCallApiVersionAttr api_version, /*optional*/::mlir::lmhlo::CustomCallTargetArgMappingAttr target_arg_mapping); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange args, ::mlir::ValueRange output, ::mlir::StringAttr call_target_name, /*optional*/::mlir::BoolAttr has_side_effect, /*optional*/::mlir::Attribute backend_config, /*optional*/::mlir::mhlo::CustomCallApiVersionAttr api_version, /*optional*/::mlir::lmhlo::CustomCallTargetArgMappingAttr target_arg_mapping); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange args, ::mlir::ValueRange output, ::llvm::StringRef call_target_name, /*optional*/bool has_side_effect, /*optional*/::mlir::Attribute backend_config, /*optional*/::mlir::mhlo::CustomCallApiVersion api_version, /*optional*/::mlir::lmhlo::CustomCallTargetArgMappingAttr target_arg_mapping); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange args, ::mlir::ValueRange output, ::llvm::StringRef call_target_name, /*optional*/bool has_side_effect, /*optional*/::mlir::Attribute backend_config, /*optional*/::mlir::mhlo::CustomCallApiVersion api_version, /*optional*/::mlir::lmhlo::CustomCallTargetArgMappingAttr target_arg_mapping); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 6 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::CustomCallOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::DivOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DivOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DivOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DivOpGenericAdaptorBase(DivOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getBroadcastDimensionsAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getBroadcastDimensions(); +}; +} // namespace detail +template +class DivOpGenericAdaptor : public detail::DivOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DivOpGenericAdaptorBase; +public: + DivOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DivOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DivOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DivOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + ValueT getOut() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DivOpAdaptor : public DivOpGenericAdaptor<::mlir::ValueRange> { +public: + using DivOpGenericAdaptor::DivOpGenericAdaptor; + DivOpAdaptor(DivOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DivOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait, ::mlir::OpTrait::SameTypeOperands, ::mlir::OpTrait::Elementwise> { +public: + using Op::Op; + using Op::print; + using Adaptor = DivOpAdaptor; + template + using GenericAdaptor = DivOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("broadcast_dimensions")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBroadcastDimensionsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBroadcastDimensionsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.divide"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getLhs(); + ::mlir::TypedValue<::mlir::MemRefType> getRhs(); + ::mlir::TypedValue<::mlir::MemRefType> getOut(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + ::mlir::OpOperand &getOutMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::DenseIntElementsAttr getBroadcastDimensionsAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getBroadcastDimensions(); + void setBroadcastDimensionsAttr(::mlir::DenseIntElementsAttr attr); + ::mlir::Attribute removeBroadcastDimensionsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value out, /*optional*/::mlir::DenseIntElementsAttr broadcast_dimensions); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value out, /*optional*/::mlir::DenseIntElementsAttr broadcast_dimensions); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::DivOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::DotGeneralOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DotGeneralOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DotGeneralOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DotGeneralOpGenericAdaptorBase(DotGeneralOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::mhlo::DotDimensionNumbersAttr getDotDimensionNumbersAttr(); + ::mlir::mhlo::DotDimensionNumbersAttr getDotDimensionNumbers(); + ::mlir::ArrayAttr getPrecisionConfigAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrecisionConfig(); +}; +} // namespace detail +template +class DotGeneralOpGenericAdaptor : public detail::DotGeneralOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DotGeneralOpGenericAdaptorBase; +public: + DotGeneralOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DotGeneralOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DotGeneralOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DotGeneralOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DotGeneralOpAdaptor : public DotGeneralOpGenericAdaptor<::mlir::ValueRange> { +public: + using DotGeneralOpGenericAdaptor::DotGeneralOpGenericAdaptor; + DotGeneralOpAdaptor(DotGeneralOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DotGeneralOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DotGeneralOpAdaptor; + template + using GenericAdaptor = DotGeneralOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dot_dimension_numbers"), ::llvm::StringRef("precision_config")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDotDimensionNumbersAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDotDimensionNumbersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getPrecisionConfigAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getPrecisionConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.dot_general"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getLhs(); + ::mlir::TypedValue<::mlir::MemRefType> getRhs(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::mhlo::DotDimensionNumbersAttr getDotDimensionNumbersAttr(); + ::mlir::mhlo::DotDimensionNumbersAttr getDotDimensionNumbers(); + ::mlir::ArrayAttr getPrecisionConfigAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrecisionConfig(); + void setDotDimensionNumbersAttr(::mlir::mhlo::DotDimensionNumbersAttr attr); + void setPrecisionConfigAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removePrecisionConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::mhlo::DotDimensionNumbersAttr dot_dimension_numbers, /*optional*/::mlir::ArrayAttr precision_config, ::mlir::Value output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::mhlo::DotDimensionNumbersAttr dot_dimension_numbers, /*optional*/::mlir::ArrayAttr precision_config, ::mlir::Value output); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::DotGeneralOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::DotOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DotOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DotOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DotOpGenericAdaptorBase(DotOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::mhlo::DotDimensionNumbersAttr getDotDimensionNumbersAttr(); + ::mlir::mhlo::DotDimensionNumbersAttr getDotDimensionNumbers(); + ::mlir::ArrayAttr getPrecisionConfigAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrecisionConfig(); +}; +} // namespace detail +template +class DotOpGenericAdaptor : public detail::DotOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DotOpGenericAdaptorBase; +public: + DotOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DotOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DotOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DotOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DotOpAdaptor : public DotOpGenericAdaptor<::mlir::ValueRange> { +public: + using DotOpGenericAdaptor::DotOpGenericAdaptor; + DotOpAdaptor(DotOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DotOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DotOpAdaptor; + template + using GenericAdaptor = DotOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dot_dimension_numbers"), ::llvm::StringRef("precision_config")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDotDimensionNumbersAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDotDimensionNumbersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getPrecisionConfigAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getPrecisionConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.dot"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getLhs(); + ::mlir::TypedValue<::mlir::MemRefType> getRhs(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::mhlo::DotDimensionNumbersAttr getDotDimensionNumbersAttr(); + ::mlir::mhlo::DotDimensionNumbersAttr getDotDimensionNumbers(); + ::mlir::ArrayAttr getPrecisionConfigAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrecisionConfig(); + void setDotDimensionNumbersAttr(::mlir::mhlo::DotDimensionNumbersAttr attr); + void setPrecisionConfigAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removePrecisionConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::mhlo::DotDimensionNumbersAttr dot_dimension_numbers, /*optional*/::mlir::ArrayAttr precision_config, ::mlir::Value output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::mhlo::DotDimensionNumbersAttr dot_dimension_numbers, /*optional*/::mlir::ArrayAttr precision_config, ::mlir::Value output); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::DotOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::DynamicBitcastOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DynamicBitcastOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DynamicBitcastOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DynamicBitcastOpGenericAdaptorBase(DynamicBitcastOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DynamicBitcastOpGenericAdaptor : public detail::DynamicBitcastOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DynamicBitcastOpGenericAdaptorBase; +public: + DynamicBitcastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DynamicBitcastOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DynamicBitcastOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DynamicBitcastOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + ValueT getShape() { + return (*getODSOperands(1).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DynamicBitcastOpAdaptor : public DynamicBitcastOpGenericAdaptor<::mlir::ValueRange> { +public: + using DynamicBitcastOpGenericAdaptor::DynamicBitcastOpGenericAdaptor; + DynamicBitcastOpAdaptor(DynamicBitcastOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DynamicBitcastOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DynamicBitcastOpAdaptor; + template + using GenericAdaptor = DynamicBitcastOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.dynamic_bitcast"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getOperand(); + ::mlir::TypedValue<::mlir::MemRefType> getShape(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::OpOperand &getShapeMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::Value shape, ::mlir::Value output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value shape, ::mlir::Value output); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::DynamicBitcastOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::DynamicBroadcastInDimOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DynamicBroadcastInDimOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DynamicBroadcastInDimOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DynamicBroadcastInDimOpGenericAdaptorBase(DynamicBroadcastInDimOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getBroadcastDimensionsAttr(); + ::mlir::DenseIntElementsAttr getBroadcastDimensions(); +}; +} // namespace detail +template +class DynamicBroadcastInDimOpGenericAdaptor : public detail::DynamicBroadcastInDimOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DynamicBroadcastInDimOpGenericAdaptorBase; +public: + DynamicBroadcastInDimOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DynamicBroadcastInDimOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DynamicBroadcastInDimOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DynamicBroadcastInDimOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + ValueT getOutputDimensions() { + return (*getODSOperands(1).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DynamicBroadcastInDimOpAdaptor : public DynamicBroadcastInDimOpGenericAdaptor<::mlir::ValueRange> { +public: + using DynamicBroadcastInDimOpGenericAdaptor::DynamicBroadcastInDimOpGenericAdaptor; + DynamicBroadcastInDimOpAdaptor(DynamicBroadcastInDimOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DynamicBroadcastInDimOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DynamicBroadcastInDimOpAdaptor; + template + using GenericAdaptor = DynamicBroadcastInDimOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("broadcast_dimensions")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBroadcastDimensionsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBroadcastDimensionsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.dynamic_broadcast_in_dim"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getOperand(); + ::mlir::TypedValue<::mlir::MemRefType> getOutputDimensions(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::OpOperand &getOutputDimensionsMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::DenseIntElementsAttr getBroadcastDimensionsAttr(); + ::mlir::DenseIntElementsAttr getBroadcastDimensions(); + void setBroadcastDimensionsAttr(::mlir::DenseIntElementsAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::Value output_dimensions, ::mlir::Value output, ::mlir::DenseIntElementsAttr broadcast_dimensions); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value output_dimensions, ::mlir::Value output, ::mlir::DenseIntElementsAttr broadcast_dimensions); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::DynamicBroadcastInDimOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::DynamicConvOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DynamicConvOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DynamicConvOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DynamicConvOpGenericAdaptorBase(DynamicConvOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getWindowStridesAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getWindowStrides(); + ::mlir::DenseIntElementsAttr getPaddingAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getPadding(); + ::mlir::DenseIntElementsAttr getLhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getLhsDilation(); + ::mlir::DenseIntElementsAttr getRhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getRhsDilation(); + ::mlir::DenseElementsAttr getWindowReversalAttr(); + ::std::optional< ::mlir::DenseElementsAttr > getWindowReversal(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbersAttr(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbers(); + ::mlir::IntegerAttr getFeatureGroupCountAttr(); + uint64_t getFeatureGroupCount(); + ::mlir::IntegerAttr getBatchGroupCountAttr(); + uint64_t getBatchGroupCount(); + ::mlir::ArrayAttr getPrecisionConfigAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrecisionConfig(); +}; +} // namespace detail +template +class DynamicConvOpGenericAdaptor : public detail::DynamicConvOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DynamicConvOpGenericAdaptorBase; +public: + DynamicConvOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DynamicConvOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DynamicConvOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DynamicConvOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + ValueT getDPadding() { + return (*getODSOperands(2).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DynamicConvOpAdaptor : public DynamicConvOpGenericAdaptor<::mlir::ValueRange> { +public: + using DynamicConvOpGenericAdaptor::DynamicConvOpGenericAdaptor; + DynamicConvOpAdaptor(DynamicConvOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DynamicConvOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DynamicConvOpAdaptor; + template + using GenericAdaptor = DynamicConvOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("batch_group_count"), ::llvm::StringRef("dimension_numbers"), ::llvm::StringRef("feature_group_count"), ::llvm::StringRef("lhs_dilation"), ::llvm::StringRef("padding"), ::llvm::StringRef("precision_config"), ::llvm::StringRef("rhs_dilation"), ::llvm::StringRef("window_reversal"), ::llvm::StringRef("window_strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBatchGroupCountAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBatchGroupCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getDimensionNumbersAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getDimensionNumbersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getFeatureGroupCountAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getFeatureGroupCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getLhsDilationAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getLhsDilationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getPrecisionConfigAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getPrecisionConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getRhsDilationAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getRhsDilationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + ::mlir::StringAttr getWindowReversalAttrName() { + return getAttributeNameForIndex(7); + } + + static ::mlir::StringAttr getWindowReversalAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 7); + } + + ::mlir::StringAttr getWindowStridesAttrName() { + return getAttributeNameForIndex(8); + } + + static ::mlir::StringAttr getWindowStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 8); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.dynamic_conv"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getLhs(); + ::mlir::TypedValue<::mlir::MemRefType> getRhs(); + ::mlir::TypedValue<::mlir::MemRefType> getDPadding(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + ::mlir::OpOperand &getDPaddingMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::DenseIntElementsAttr getWindowStridesAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getWindowStrides(); + ::mlir::DenseIntElementsAttr getPaddingAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getPadding(); + ::mlir::DenseIntElementsAttr getLhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getLhsDilation(); + ::mlir::DenseIntElementsAttr getRhsDilationAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getRhsDilation(); + ::mlir::DenseElementsAttr getWindowReversalAttr(); + ::std::optional< ::mlir::DenseElementsAttr > getWindowReversal(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbersAttr(); + ::mlir::mhlo::ConvDimensionNumbersAttr getDimensionNumbers(); + ::mlir::IntegerAttr getFeatureGroupCountAttr(); + uint64_t getFeatureGroupCount(); + ::mlir::IntegerAttr getBatchGroupCountAttr(); + uint64_t getBatchGroupCount(); + ::mlir::ArrayAttr getPrecisionConfigAttr(); + ::std::optional< ::mlir::ArrayAttr > getPrecisionConfig(); + void setWindowStridesAttr(::mlir::DenseIntElementsAttr attr); + void setPaddingAttr(::mlir::DenseIntElementsAttr attr); + void setLhsDilationAttr(::mlir::DenseIntElementsAttr attr); + void setRhsDilationAttr(::mlir::DenseIntElementsAttr attr); + void setWindowReversalAttr(::mlir::DenseElementsAttr attr); + void setDimensionNumbersAttr(::mlir::mhlo::ConvDimensionNumbersAttr attr); + void setFeatureGroupCountAttr(::mlir::IntegerAttr attr); + void setFeatureGroupCount(uint64_t attrValue); + void setBatchGroupCountAttr(::mlir::IntegerAttr attr); + void setBatchGroupCount(uint64_t attrValue); + void setPrecisionConfigAttr(::mlir::ArrayAttr attr); + ::mlir::Attribute removeWindowStridesAttr(); + ::mlir::Attribute removePaddingAttr(); + ::mlir::Attribute removeLhsDilationAttr(); + ::mlir::Attribute removeRhsDilationAttr(); + ::mlir::Attribute removeWindowReversalAttr(); + ::mlir::Attribute removePrecisionConfigAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value d_padding, ::mlir::Value output, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, ::mlir::IntegerAttr feature_group_count, ::mlir::IntegerAttr batch_group_count, /*optional*/::mlir::ArrayAttr precision_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value d_padding, ::mlir::Value output, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, ::mlir::IntegerAttr feature_group_count, ::mlir::IntegerAttr batch_group_count, /*optional*/::mlir::ArrayAttr precision_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value d_padding, ::mlir::Value output, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, uint64_t feature_group_count, uint64_t batch_group_count, /*optional*/::mlir::ArrayAttr precision_config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value d_padding, ::mlir::Value output, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding, /*optional*/::mlir::DenseIntElementsAttr lhs_dilation, /*optional*/::mlir::DenseIntElementsAttr rhs_dilation, /*optional*/::mlir::DenseElementsAttr window_reversal, ::mlir::mhlo::ConvDimensionNumbersAttr dimension_numbers, uint64_t feature_group_count, uint64_t batch_group_count, /*optional*/::mlir::ArrayAttr precision_config); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 9 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::DynamicConvOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::DynamicGatherOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DynamicGatherOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DynamicGatherOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DynamicGatherOpGenericAdaptorBase(DynamicGatherOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::mhlo::GatherDimensionNumbersAttr getDimensionNumbersAttr(); + ::mlir::mhlo::GatherDimensionNumbersAttr getDimensionNumbers(); +}; +} // namespace detail +template +class DynamicGatherOpGenericAdaptor : public detail::DynamicGatherOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DynamicGatherOpGenericAdaptorBase; +public: + DynamicGatherOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DynamicGatherOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DynamicGatherOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DynamicGatherOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + ValueT getStartIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getSliceSizes() { + return (*getODSOperands(2).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DynamicGatherOpAdaptor : public DynamicGatherOpGenericAdaptor<::mlir::ValueRange> { +public: + using DynamicGatherOpGenericAdaptor::DynamicGatherOpGenericAdaptor; + DynamicGatherOpAdaptor(DynamicGatherOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DynamicGatherOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DynamicGatherOpAdaptor; + template + using GenericAdaptor = DynamicGatherOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dimension_numbers")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDimensionNumbersAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDimensionNumbersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.dynamic_gather"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getOperand(); + ::mlir::TypedValue<::mlir::MemRefType> getStartIndices(); + ::mlir::TypedValue<::mlir::MemRefType> getSliceSizes(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::OpOperand &getStartIndicesMutable(); + ::mlir::OpOperand &getSliceSizesMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::mhlo::GatherDimensionNumbersAttr getDimensionNumbersAttr(); + ::mlir::mhlo::GatherDimensionNumbersAttr getDimensionNumbers(); + void setDimensionNumbersAttr(::mlir::mhlo::GatherDimensionNumbersAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::Value start_indices, ::mlir::Value slice_sizes, ::mlir::mhlo::GatherDimensionNumbersAttr dimension_numbers, ::mlir::Value output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value start_indices, ::mlir::Value slice_sizes, ::mlir::mhlo::GatherDimensionNumbersAttr dimension_numbers, ::mlir::Value output); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::DynamicGatherOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::DynamicIotaOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DynamicIotaOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DynamicIotaOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DynamicIotaOpGenericAdaptorBase(DynamicIotaOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getIotaDimensionAttr(); + uint64_t getIotaDimension(); +}; +} // namespace detail +template +class DynamicIotaOpGenericAdaptor : public detail::DynamicIotaOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DynamicIotaOpGenericAdaptorBase; +public: + DynamicIotaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DynamicIotaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DynamicIotaOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DynamicIotaOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getShape() { + return (*getODSOperands(0).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DynamicIotaOpAdaptor : public DynamicIotaOpGenericAdaptor<::mlir::ValueRange> { +public: + using DynamicIotaOpGenericAdaptor::DynamicIotaOpGenericAdaptor; + DynamicIotaOpAdaptor(DynamicIotaOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DynamicIotaOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DynamicIotaOpAdaptor; + template + using GenericAdaptor = DynamicIotaOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("iota_dimension")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getIotaDimensionAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getIotaDimensionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.dynamic_iota"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getShape(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getShapeMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getIotaDimensionAttr(); + uint64_t getIotaDimension(); + void setIotaDimensionAttr(::mlir::IntegerAttr attr); + void setIotaDimension(uint64_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value shape, ::mlir::IntegerAttr iota_dimension, ::mlir::Value output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, ::mlir::IntegerAttr iota_dimension, ::mlir::Value output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value shape, uint64_t iota_dimension, ::mlir::Value output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value shape, uint64_t iota_dimension, ::mlir::Value output); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::DynamicIotaOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::DynamicPadOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DynamicPadOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DynamicPadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DynamicPadOpGenericAdaptorBase(DynamicPadOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DynamicPadOpGenericAdaptor : public detail::DynamicPadOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DynamicPadOpGenericAdaptorBase; +public: + DynamicPadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DynamicPadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DynamicPadOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DynamicPadOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + ValueT getPaddingValue() { + return (*getODSOperands(1).begin()); + } + + ValueT getEdgePaddingLow() { + return (*getODSOperands(2).begin()); + } + + ValueT getEdgePaddingHigh() { + return (*getODSOperands(3).begin()); + } + + ValueT getInteriorPadding() { + return (*getODSOperands(4).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(5).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DynamicPadOpAdaptor : public DynamicPadOpGenericAdaptor<::mlir::ValueRange> { +public: + using DynamicPadOpGenericAdaptor::DynamicPadOpGenericAdaptor; + DynamicPadOpAdaptor(DynamicPadOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DynamicPadOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DynamicPadOpAdaptor; + template + using GenericAdaptor = DynamicPadOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.dynamic_pad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getOperand(); + ::mlir::TypedValue<::mlir::MemRefType> getPaddingValue(); + ::mlir::TypedValue<::mlir::MemRefType> getEdgePaddingLow(); + ::mlir::TypedValue<::mlir::MemRefType> getEdgePaddingHigh(); + ::mlir::TypedValue<::mlir::MemRefType> getInteriorPadding(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::OpOperand &getPaddingValueMutable(); + ::mlir::OpOperand &getEdgePaddingLowMutable(); + ::mlir::OpOperand &getEdgePaddingHighMutable(); + ::mlir::OpOperand &getInteriorPaddingMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::Value padding_value, ::mlir::Value edge_padding_low, ::mlir::Value edge_padding_high, ::mlir::Value interior_padding, ::mlir::Value output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value padding_value, ::mlir::Value edge_padding_low, ::mlir::Value edge_padding_high, ::mlir::Value interior_padding, ::mlir::Value output); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::DynamicPadOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::DynamicReshapeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DynamicReshapeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DynamicReshapeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DynamicReshapeOpGenericAdaptorBase(DynamicReshapeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DynamicReshapeOpGenericAdaptor : public detail::DynamicReshapeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DynamicReshapeOpGenericAdaptorBase; +public: + DynamicReshapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DynamicReshapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DynamicReshapeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DynamicReshapeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + ValueT getShape() { + return (*getODSOperands(1).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DynamicReshapeOpAdaptor : public DynamicReshapeOpGenericAdaptor<::mlir::ValueRange> { +public: + using DynamicReshapeOpGenericAdaptor::DynamicReshapeOpGenericAdaptor; + DynamicReshapeOpAdaptor(DynamicReshapeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DynamicReshapeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DynamicReshapeOpAdaptor; + template + using GenericAdaptor = DynamicReshapeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.dynamic_reshape"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getOperand(); + ::mlir::TypedValue<::mlir::MemRefType> getShape(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::OpOperand &getShapeMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::Value shape, ::mlir::Value output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value shape, ::mlir::Value output); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::DynamicReshapeOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::DynamicSliceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DynamicSliceOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DynamicSliceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DynamicSliceOpGenericAdaptorBase(DynamicSliceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getSliceSizesAttr(); + ::mlir::DenseIntElementsAttr getSliceSizes(); +}; +} // namespace detail +template +class DynamicSliceOpGenericAdaptor : public detail::DynamicSliceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DynamicSliceOpGenericAdaptorBase; +public: + DynamicSliceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DynamicSliceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DynamicSliceOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DynamicSliceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + RangeT getStartIndices() { + return getODSOperands(1); + } + + ValueT getOutput() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DynamicSliceOpAdaptor : public DynamicSliceOpGenericAdaptor<::mlir::ValueRange> { +public: + using DynamicSliceOpGenericAdaptor::DynamicSliceOpGenericAdaptor; + DynamicSliceOpAdaptor(DynamicSliceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DynamicSliceOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DynamicSliceOpAdaptor; + template + using GenericAdaptor = DynamicSliceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("slice_sizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getSliceSizesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getSliceSizesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.dynamic_slice"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getOperand(); + ::mlir::Operation::operand_range getStartIndices(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::MutableOperandRange getStartIndicesMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::DenseIntElementsAttr getSliceSizesAttr(); + ::mlir::DenseIntElementsAttr getSliceSizes(); + void setSliceSizesAttr(::mlir::DenseIntElementsAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::ValueRange start_indices, ::mlir::Value output, ::mlir::DenseIntElementsAttr slice_sizes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::ValueRange start_indices, ::mlir::Value output, ::mlir::DenseIntElementsAttr slice_sizes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::DynamicSliceOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::DynamicUpdateSliceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class DynamicUpdateSliceOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + DynamicUpdateSliceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + DynamicUpdateSliceOpGenericAdaptorBase(DynamicUpdateSliceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class DynamicUpdateSliceOpGenericAdaptor : public detail::DynamicUpdateSliceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::DynamicUpdateSliceOpGenericAdaptorBase; +public: + DynamicUpdateSliceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + DynamicUpdateSliceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : DynamicUpdateSliceOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + DynamicUpdateSliceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + ValueT getUpdate() { + return (*getODSOperands(1).begin()); + } + + RangeT getStartIndices() { + return getODSOperands(2); + } + + ValueT getOutput() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class DynamicUpdateSliceOpAdaptor : public DynamicUpdateSliceOpGenericAdaptor<::mlir::ValueRange> { +public: + using DynamicUpdateSliceOpGenericAdaptor::DynamicUpdateSliceOpGenericAdaptor; + DynamicUpdateSliceOpAdaptor(DynamicUpdateSliceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class DynamicUpdateSliceOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = DynamicUpdateSliceOpAdaptor; + template + using GenericAdaptor = DynamicUpdateSliceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.dynamic-update-slice"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getOperand(); + ::mlir::TypedValue<::mlir::MemRefType> getUpdate(); + ::mlir::Operation::operand_range getStartIndices(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::OpOperand &getUpdateMutable(); + ::mlir::MutableOperandRange getStartIndicesMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::Value update, ::mlir::ValueRange start_indices, ::mlir::Value output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value update, ::mlir::ValueRange start_indices, ::mlir::Value output); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::DynamicUpdateSliceOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::ExpOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ExpOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ExpOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ExpOpGenericAdaptorBase(ExpOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ExpOpGenericAdaptor : public detail::ExpOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ExpOpGenericAdaptorBase; +public: + ExpOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ExpOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ExpOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ExpOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ExpOpAdaptor : public ExpOpGenericAdaptor<::mlir::ValueRange> { +public: + using ExpOpGenericAdaptor::ExpOpGenericAdaptor; + ExpOpAdaptor(ExpOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ExpOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait, ::mlir::OpTrait::SameTypeOperands, ::mlir::OpTrait::Elementwise> { +public: + using Op::Op; + using Op::print; + using Adaptor = ExpOpAdaptor; + template + using GenericAdaptor = ExpOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.exponential"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getInput(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value output); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::ExpOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::Expm1Op declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Expm1OpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + Expm1OpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + Expm1OpGenericAdaptorBase(Expm1Op op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class Expm1OpGenericAdaptor : public detail::Expm1OpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Expm1OpGenericAdaptorBase; +public: + Expm1OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Expm1OpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Expm1OpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + Expm1OpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Expm1OpAdaptor : public Expm1OpGenericAdaptor<::mlir::ValueRange> { +public: + using Expm1OpGenericAdaptor::Expm1OpGenericAdaptor; + Expm1OpAdaptor(Expm1Op op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Expm1Op : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait, ::mlir::OpTrait::SameTypeOperands, ::mlir::OpTrait::Elementwise> { +public: + using Op::Op; + using Op::print; + using Adaptor = Expm1OpAdaptor; + template + using GenericAdaptor = Expm1OpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.exponential_minus_one"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getInput(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value output); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::Expm1Op) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::FftOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FftOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FftOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FftOpGenericAdaptorBase(FftOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::mhlo::FftTypeAttr getFftTypeAttr(); + ::mlir::mhlo::FftType getFftType(); + ::mlir::DenseIntElementsAttr getFftLengthAttr(); + ::mlir::DenseIntElementsAttr getFftLength(); +}; +} // namespace detail +template +class FftOpGenericAdaptor : public detail::FftOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FftOpGenericAdaptorBase; +public: + FftOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FftOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FftOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FftOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FftOpAdaptor : public FftOpGenericAdaptor<::mlir::ValueRange> { +public: + using FftOpGenericAdaptor::FftOpGenericAdaptor; + FftOpAdaptor(FftOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FftOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = FftOpAdaptor; + template + using GenericAdaptor = FftOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("fft_length"), ::llvm::StringRef("fft_type")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getFftLengthAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getFftLengthAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getFftTypeAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getFftTypeAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.fft"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getOperand(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::mhlo::FftTypeAttr getFftTypeAttr(); + ::mlir::mhlo::FftType getFftType(); + ::mlir::DenseIntElementsAttr getFftLengthAttr(); + ::mlir::DenseIntElementsAttr getFftLength(); + void setFftTypeAttr(::mlir::mhlo::FftTypeAttr attr); + void setFftType(::mlir::mhlo::FftType attrValue); + void setFftLengthAttr(::mlir::DenseIntElementsAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::Value output, ::mlir::mhlo::FftTypeAttr fft_type, ::mlir::DenseIntElementsAttr fft_length); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value output, ::mlir::mhlo::FftTypeAttr fft_type, ::mlir::DenseIntElementsAttr fft_length); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::Value output, ::mlir::mhlo::FftType fft_type, ::mlir::DenseIntElementsAttr fft_length); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value output, ::mlir::mhlo::FftType fft_type, ::mlir::DenseIntElementsAttr fft_length); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::FftOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::FloorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class FloorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + FloorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + FloorOpGenericAdaptorBase(FloorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class FloorOpGenericAdaptor : public detail::FloorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::FloorOpGenericAdaptorBase; +public: + FloorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + FloorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : FloorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + FloorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class FloorOpAdaptor : public FloorOpGenericAdaptor<::mlir::ValueRange> { +public: + using FloorOpGenericAdaptor::FloorOpGenericAdaptor; + FloorOpAdaptor(FloorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class FloorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait, ::mlir::OpTrait::SameTypeOperands, ::mlir::OpTrait::Elementwise> { +public: + using Op::Op; + using Op::print; + using Adaptor = FloorOpAdaptor; + template + using GenericAdaptor = FloorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.floor"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getInput(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value output); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::FloorOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::GatherOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class GatherOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + GatherOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + GatherOpGenericAdaptorBase(GatherOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::mhlo::GatherDimensionNumbersAttr getDimensionNumbersAttr(); + ::mlir::mhlo::GatherDimensionNumbersAttr getDimensionNumbers(); + ::mlir::DenseIntElementsAttr getSliceSizesAttr(); + ::mlir::DenseIntElementsAttr getSliceSizes(); +}; +} // namespace detail +template +class GatherOpGenericAdaptor : public detail::GatherOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::GatherOpGenericAdaptorBase; +public: + GatherOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + GatherOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : GatherOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + GatherOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + ValueT getStartIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class GatherOpAdaptor : public GatherOpGenericAdaptor<::mlir::ValueRange> { +public: + using GatherOpGenericAdaptor::GatherOpGenericAdaptor; + GatherOpAdaptor(GatherOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class GatherOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = GatherOpAdaptor; + template + using GenericAdaptor = GatherOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dimension_numbers"), ::llvm::StringRef("slice_sizes")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDimensionNumbersAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDimensionNumbersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getSliceSizesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getSliceSizesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.gather"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getOperand(); + ::mlir::TypedValue<::mlir::MemRefType> getStartIndices(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::OpOperand &getStartIndicesMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::mhlo::GatherDimensionNumbersAttr getDimensionNumbersAttr(); + ::mlir::mhlo::GatherDimensionNumbersAttr getDimensionNumbers(); + ::mlir::DenseIntElementsAttr getSliceSizesAttr(); + ::mlir::DenseIntElementsAttr getSliceSizes(); + void setDimensionNumbersAttr(::mlir::mhlo::GatherDimensionNumbersAttr attr); + void setSliceSizesAttr(::mlir::DenseIntElementsAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::Value start_indices, ::mlir::mhlo::GatherDimensionNumbersAttr dimension_numbers, ::mlir::DenseIntElementsAttr slice_sizes, ::mlir::Value output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value start_indices, ::mlir::mhlo::GatherDimensionNumbersAttr dimension_numbers, ::mlir::DenseIntElementsAttr slice_sizes, ::mlir::Value output); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::GatherOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::ImagOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ImagOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ImagOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ImagOpGenericAdaptorBase(ImagOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ImagOpGenericAdaptor : public detail::ImagOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ImagOpGenericAdaptorBase; +public: + ImagOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ImagOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ImagOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ImagOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ImagOpAdaptor : public ImagOpGenericAdaptor<::mlir::ValueRange> { +public: + using ImagOpGenericAdaptor::ImagOpGenericAdaptor; + ImagOpAdaptor(ImagOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ImagOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait, ::mlir::OpTrait::SameOperandsShape> { +public: + using Op::Op; + using Op::print; + using Adaptor = ImagOpAdaptor; + template + using GenericAdaptor = ImagOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.imag"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getInput(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value output); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::ImagOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::InfeedOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class InfeedOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + InfeedOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + InfeedOpGenericAdaptorBase(InfeedOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class InfeedOpGenericAdaptor : public detail::InfeedOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::InfeedOpGenericAdaptorBase; +public: + InfeedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + InfeedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : InfeedOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + InfeedOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOutputs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class InfeedOpAdaptor : public InfeedOpGenericAdaptor<::mlir::ValueRange> { +public: + using InfeedOpGenericAdaptor::InfeedOpGenericAdaptor; + InfeedOpAdaptor(InfeedOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class InfeedOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = InfeedOpAdaptor; + template + using GenericAdaptor = InfeedOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.infeed"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange outputs, ::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange outputs, ::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange outputs, ::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange outputs, ::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultAttrs(const ::mlir::OperationName &opName, ::mlir::NamedAttrList &attributes); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::InfeedOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::IotaOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IotaOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IotaOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IotaOpGenericAdaptorBase(IotaOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getIotaDimensionAttr(); + uint64_t getIotaDimension(); +}; +} // namespace detail +template +class IotaOpGenericAdaptor : public detail::IotaOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IotaOpGenericAdaptorBase; +public: + IotaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IotaOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IotaOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IotaOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOutput() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IotaOpAdaptor : public IotaOpGenericAdaptor<::mlir::ValueRange> { +public: + using IotaOpGenericAdaptor::IotaOpGenericAdaptor; + IotaOpAdaptor(IotaOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IotaOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = IotaOpAdaptor; + template + using GenericAdaptor = IotaOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("iota_dimension")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getIotaDimensionAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getIotaDimensionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.iota"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getIotaDimensionAttr(); + uint64_t getIotaDimension(); + void setIotaDimensionAttr(::mlir::IntegerAttr attr); + void setIotaDimension(uint64_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::IntegerAttr iota_dimension, ::mlir::Value output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::IntegerAttr iota_dimension, ::mlir::Value output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, uint64_t iota_dimension, ::mlir::Value output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, uint64_t iota_dimension, ::mlir::Value output); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::IotaOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::IsFiniteOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class IsFiniteOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + IsFiniteOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + IsFiniteOpGenericAdaptorBase(IsFiniteOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class IsFiniteOpGenericAdaptor : public detail::IsFiniteOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::IsFiniteOpGenericAdaptorBase; +public: + IsFiniteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + IsFiniteOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : IsFiniteOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + IsFiniteOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class IsFiniteOpAdaptor : public IsFiniteOpGenericAdaptor<::mlir::ValueRange> { +public: + using IsFiniteOpGenericAdaptor::IsFiniteOpGenericAdaptor; + IsFiniteOpAdaptor(IsFiniteOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class IsFiniteOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait, ::mlir::OpTrait::SameOperandsShape> { +public: + using Op::Op; + using Op::print; + using Adaptor = IsFiniteOpAdaptor; + template + using GenericAdaptor = IsFiniteOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.is_finite"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getInput(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value output); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::IsFiniteOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::Log1pOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class Log1pOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + Log1pOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + Log1pOpGenericAdaptorBase(Log1pOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class Log1pOpGenericAdaptor : public detail::Log1pOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::Log1pOpGenericAdaptorBase; +public: + Log1pOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + Log1pOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : Log1pOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + Log1pOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class Log1pOpAdaptor : public Log1pOpGenericAdaptor<::mlir::ValueRange> { +public: + using Log1pOpGenericAdaptor::Log1pOpGenericAdaptor; + Log1pOpAdaptor(Log1pOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class Log1pOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait, ::mlir::OpTrait::SameTypeOperands, ::mlir::OpTrait::Elementwise> { +public: + using Op::Op; + using Op::print; + using Adaptor = Log1pOpAdaptor; + template + using GenericAdaptor = Log1pOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.log_plus_one"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getInput(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value output); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::Log1pOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::LogOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LogOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LogOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LogOpGenericAdaptorBase(LogOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class LogOpGenericAdaptor : public detail::LogOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LogOpGenericAdaptorBase; +public: + LogOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LogOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LogOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LogOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LogOpAdaptor : public LogOpGenericAdaptor<::mlir::ValueRange> { +public: + using LogOpGenericAdaptor::LogOpGenericAdaptor; + LogOpAdaptor(LogOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LogOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait, ::mlir::OpTrait::SameTypeOperands, ::mlir::OpTrait::Elementwise> { +public: + using Op::Op; + using Op::print; + using Adaptor = LogOpAdaptor; + template + using GenericAdaptor = LogOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.log"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getInput(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value output); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::LogOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::LogisticOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class LogisticOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + LogisticOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + LogisticOpGenericAdaptorBase(LogisticOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class LogisticOpGenericAdaptor : public detail::LogisticOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::LogisticOpGenericAdaptorBase; +public: + LogisticOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + LogisticOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : LogisticOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + LogisticOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class LogisticOpAdaptor : public LogisticOpGenericAdaptor<::mlir::ValueRange> { +public: + using LogisticOpGenericAdaptor::LogisticOpGenericAdaptor; + LogisticOpAdaptor(LogisticOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class LogisticOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait, ::mlir::OpTrait::SameTypeOperands, ::mlir::OpTrait::Elementwise> { +public: + using Op::Op; + using Op::print; + using Adaptor = LogisticOpAdaptor; + template + using GenericAdaptor = LogisticOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.logistic"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getInput(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value output); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::LogisticOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::MapOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MapOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MapOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MapOpGenericAdaptorBase(MapOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getDimensionsAttr(); + ::mlir::DenseIntElementsAttr getDimensions(); + ::mlir::Region &getComputation(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class MapOpGenericAdaptor : public detail::MapOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MapOpGenericAdaptorBase; +public: + MapOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MapOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MapOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MapOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + ValueT getOutput() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MapOpAdaptor : public MapOpGenericAdaptor<::mlir::ValueRange> { +public: + using MapOpGenericAdaptor::MapOpGenericAdaptor; + MapOpAdaptor(MapOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MapOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait, ::mlir::OpTrait::SameOperandsShape> { +public: + using Op::Op; + using Op::print; + using Adaptor = MapOpAdaptor; + template + using GenericAdaptor = MapOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dimensions")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDimensionsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDimensionsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.map"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getComputation(); + ::mlir::DenseIntElementsAttr getDimensionsAttr(); + ::mlir::DenseIntElementsAttr getDimensions(); + void setDimensionsAttr(::mlir::DenseIntElementsAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange inputs, ::mlir::Value output, ::mlir::DenseIntElementsAttr dimensions); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::mlir::Value output, ::mlir::DenseIntElementsAttr dimensions); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::MapOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::MaxOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MaxOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MaxOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MaxOpGenericAdaptorBase(MaxOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getBroadcastDimensionsAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getBroadcastDimensions(); +}; +} // namespace detail +template +class MaxOpGenericAdaptor : public detail::MaxOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MaxOpGenericAdaptorBase; +public: + MaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MaxOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MaxOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MaxOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + ValueT getOut() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MaxOpAdaptor : public MaxOpGenericAdaptor<::mlir::ValueRange> { +public: + using MaxOpGenericAdaptor::MaxOpGenericAdaptor; + MaxOpAdaptor(MaxOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MaxOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait, ::mlir::OpTrait::SameTypeOperands, ::mlir::OpTrait::Elementwise> { +public: + using Op::Op; + using Op::print; + using Adaptor = MaxOpAdaptor; + template + using GenericAdaptor = MaxOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("broadcast_dimensions")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBroadcastDimensionsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBroadcastDimensionsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.maximum"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getLhs(); + ::mlir::TypedValue<::mlir::MemRefType> getRhs(); + ::mlir::TypedValue<::mlir::MemRefType> getOut(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + ::mlir::OpOperand &getOutMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::DenseIntElementsAttr getBroadcastDimensionsAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getBroadcastDimensions(); + void setBroadcastDimensionsAttr(::mlir::DenseIntElementsAttr attr); + ::mlir::Attribute removeBroadcastDimensionsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value out, /*optional*/::mlir::DenseIntElementsAttr broadcast_dimensions); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value out, /*optional*/::mlir::DenseIntElementsAttr broadcast_dimensions); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::MaxOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::MinOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MinOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MinOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MinOpGenericAdaptorBase(MinOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getBroadcastDimensionsAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getBroadcastDimensions(); +}; +} // namespace detail +template +class MinOpGenericAdaptor : public detail::MinOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MinOpGenericAdaptorBase; +public: + MinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MinOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MinOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MinOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + ValueT getOut() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MinOpAdaptor : public MinOpGenericAdaptor<::mlir::ValueRange> { +public: + using MinOpGenericAdaptor::MinOpGenericAdaptor; + MinOpAdaptor(MinOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MinOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait, ::mlir::OpTrait::SameTypeOperands, ::mlir::OpTrait::Elementwise> { +public: + using Op::Op; + using Op::print; + using Adaptor = MinOpAdaptor; + template + using GenericAdaptor = MinOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("broadcast_dimensions")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBroadcastDimensionsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBroadcastDimensionsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.minimum"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getLhs(); + ::mlir::TypedValue<::mlir::MemRefType> getRhs(); + ::mlir::TypedValue<::mlir::MemRefType> getOut(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + ::mlir::OpOperand &getOutMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::DenseIntElementsAttr getBroadcastDimensionsAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getBroadcastDimensions(); + void setBroadcastDimensionsAttr(::mlir::DenseIntElementsAttr attr); + ::mlir::Attribute removeBroadcastDimensionsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value out, /*optional*/::mlir::DenseIntElementsAttr broadcast_dimensions); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value out, /*optional*/::mlir::DenseIntElementsAttr broadcast_dimensions); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::MinOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::MulOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class MulOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + MulOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + MulOpGenericAdaptorBase(MulOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getBroadcastDimensionsAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getBroadcastDimensions(); +}; +} // namespace detail +template +class MulOpGenericAdaptor : public detail::MulOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::MulOpGenericAdaptorBase; +public: + MulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + MulOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : MulOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + MulOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + ValueT getOut() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class MulOpAdaptor : public MulOpGenericAdaptor<::mlir::ValueRange> { +public: + using MulOpGenericAdaptor::MulOpGenericAdaptor; + MulOpAdaptor(MulOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class MulOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait, ::mlir::OpTrait::SameTypeOperands, ::mlir::OpTrait::Elementwise> { +public: + using Op::Op; + using Op::print; + using Adaptor = MulOpAdaptor; + template + using GenericAdaptor = MulOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("broadcast_dimensions")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBroadcastDimensionsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBroadcastDimensionsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.multiply"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getLhs(); + ::mlir::TypedValue<::mlir::MemRefType> getRhs(); + ::mlir::TypedValue<::mlir::MemRefType> getOut(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + ::mlir::OpOperand &getOutMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::DenseIntElementsAttr getBroadcastDimensionsAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getBroadcastDimensions(); + void setBroadcastDimensionsAttr(::mlir::DenseIntElementsAttr attr); + ::mlir::Attribute removeBroadcastDimensionsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value out, /*optional*/::mlir::DenseIntElementsAttr broadcast_dimensions); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value out, /*optional*/::mlir::DenseIntElementsAttr broadcast_dimensions); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::MulOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::NegOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class NegOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + NegOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + NegOpGenericAdaptorBase(NegOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class NegOpGenericAdaptor : public detail::NegOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::NegOpGenericAdaptorBase; +public: + NegOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + NegOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : NegOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + NegOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class NegOpAdaptor : public NegOpGenericAdaptor<::mlir::ValueRange> { +public: + using NegOpGenericAdaptor::NegOpGenericAdaptor; + NegOpAdaptor(NegOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class NegOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait, ::mlir::OpTrait::SameTypeOperands, ::mlir::OpTrait::Elementwise> { +public: + using Op::Op; + using Op::print; + using Adaptor = NegOpAdaptor; + template + using GenericAdaptor = NegOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.negate"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getInput(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value output); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::NegOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::NotOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class NotOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + NotOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + NotOpGenericAdaptorBase(NotOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class NotOpGenericAdaptor : public detail::NotOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::NotOpGenericAdaptorBase; +public: + NotOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + NotOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : NotOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + NotOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class NotOpAdaptor : public NotOpGenericAdaptor<::mlir::ValueRange> { +public: + using NotOpGenericAdaptor::NotOpGenericAdaptor; + NotOpAdaptor(NotOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class NotOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait, ::mlir::OpTrait::SameTypeOperands, ::mlir::OpTrait::Elementwise> { +public: + using Op::Op; + using Op::print; + using Adaptor = NotOpAdaptor; + template + using GenericAdaptor = NotOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.not"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getInput(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value output); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::NotOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::OrOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class OrOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + OrOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + OrOpGenericAdaptorBase(OrOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getBroadcastDimensionsAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getBroadcastDimensions(); +}; +} // namespace detail +template +class OrOpGenericAdaptor : public detail::OrOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::OrOpGenericAdaptorBase; +public: + OrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + OrOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : OrOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + OrOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + ValueT getOut() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class OrOpAdaptor : public OrOpGenericAdaptor<::mlir::ValueRange> { +public: + using OrOpGenericAdaptor::OrOpGenericAdaptor; + OrOpAdaptor(OrOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class OrOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait, ::mlir::OpTrait::SameTypeOperands, ::mlir::OpTrait::Elementwise> { +public: + using Op::Op; + using Op::print; + using Adaptor = OrOpAdaptor; + template + using GenericAdaptor = OrOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("broadcast_dimensions")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBroadcastDimensionsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBroadcastDimensionsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.or"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getLhs(); + ::mlir::TypedValue<::mlir::MemRefType> getRhs(); + ::mlir::TypedValue<::mlir::MemRefType> getOut(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + ::mlir::OpOperand &getOutMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::DenseIntElementsAttr getBroadcastDimensionsAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getBroadcastDimensions(); + void setBroadcastDimensionsAttr(::mlir::DenseIntElementsAttr attr); + ::mlir::Attribute removeBroadcastDimensionsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value out, /*optional*/::mlir::DenseIntElementsAttr broadcast_dimensions); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value out, /*optional*/::mlir::DenseIntElementsAttr broadcast_dimensions); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::OrOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::OutfeedOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class OutfeedOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + OutfeedOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + OutfeedOpGenericAdaptorBase(OutfeedOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); +}; +} // namespace detail +template +class OutfeedOpGenericAdaptor : public detail::OutfeedOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::OutfeedOpGenericAdaptorBase; +public: + OutfeedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + OutfeedOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : OutfeedOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + OutfeedOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class OutfeedOpAdaptor : public OutfeedOpGenericAdaptor<::mlir::ValueRange> { +public: + using OutfeedOpGenericAdaptor::OutfeedOpGenericAdaptor; + OutfeedOpAdaptor(OutfeedOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class OutfeedOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = OutfeedOpAdaptor; + template + using GenericAdaptor = OutfeedOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("config")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getConfigAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getConfigAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.outfeed"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::MutableOperandRange getInputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::StringAttr getConfigAttr(); + ::llvm::StringRef getConfig(); + void setConfigAttr(::mlir::StringAttr attr); + void setConfig(::llvm::StringRef attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange inputs, ::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::mlir::StringAttr config); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange inputs, ::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::llvm::StringRef config = ""); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + static void populateDefaultAttrs(const ::mlir::OperationName &opName, ::mlir::NamedAttrList &attributes); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::OutfeedOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::PadOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PadOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + PadOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + PadOpGenericAdaptorBase(PadOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getEdgePaddingLowAttr(); + ::mlir::DenseIntElementsAttr getEdgePaddingLow(); + ::mlir::DenseIntElementsAttr getEdgePaddingHighAttr(); + ::mlir::DenseIntElementsAttr getEdgePaddingHigh(); + ::mlir::DenseIntElementsAttr getInteriorPaddingAttr(); + ::mlir::DenseIntElementsAttr getInteriorPadding(); +}; +} // namespace detail +template +class PadOpGenericAdaptor : public detail::PadOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PadOpGenericAdaptorBase; +public: + PadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PadOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PadOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + PadOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + ValueT getPaddingValue() { + return (*getODSOperands(1).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PadOpAdaptor : public PadOpGenericAdaptor<::mlir::ValueRange> { +public: + using PadOpGenericAdaptor::PadOpGenericAdaptor; + PadOpAdaptor(PadOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PadOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = PadOpAdaptor; + template + using GenericAdaptor = PadOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("edge_padding_high"), ::llvm::StringRef("edge_padding_low"), ::llvm::StringRef("interior_padding")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getEdgePaddingHighAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getEdgePaddingHighAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getEdgePaddingLowAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getEdgePaddingLowAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getInteriorPaddingAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getInteriorPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.pad"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getOperand(); + ::mlir::TypedValue<::mlir::MemRefType> getPaddingValue(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::OpOperand &getPaddingValueMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::DenseIntElementsAttr getEdgePaddingLowAttr(); + ::mlir::DenseIntElementsAttr getEdgePaddingLow(); + ::mlir::DenseIntElementsAttr getEdgePaddingHighAttr(); + ::mlir::DenseIntElementsAttr getEdgePaddingHigh(); + ::mlir::DenseIntElementsAttr getInteriorPaddingAttr(); + ::mlir::DenseIntElementsAttr getInteriorPadding(); + void setEdgePaddingLowAttr(::mlir::DenseIntElementsAttr attr); + void setEdgePaddingHighAttr(::mlir::DenseIntElementsAttr attr); + void setInteriorPaddingAttr(::mlir::DenseIntElementsAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::Value padding_value, ::mlir::DenseIntElementsAttr edge_padding_low, ::mlir::DenseIntElementsAttr edge_padding_high, ::mlir::DenseIntElementsAttr interior_padding, ::mlir::Value output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value padding_value, ::mlir::DenseIntElementsAttr edge_padding_low, ::mlir::DenseIntElementsAttr edge_padding_high, ::mlir::DenseIntElementsAttr interior_padding, ::mlir::Value output); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::PadOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::PartitionIdOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PartitionIdOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + PartitionIdOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + PartitionIdOpGenericAdaptorBase(PartitionIdOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class PartitionIdOpGenericAdaptor : public detail::PartitionIdOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PartitionIdOpGenericAdaptorBase; +public: + PartitionIdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PartitionIdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PartitionIdOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + PartitionIdOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PartitionIdOpAdaptor : public PartitionIdOpGenericAdaptor<::mlir::ValueRange> { +public: + using PartitionIdOpGenericAdaptor::PartitionIdOpGenericAdaptor; + PartitionIdOpAdaptor(PartitionIdOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PartitionIdOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = PartitionIdOpAdaptor; + template + using GenericAdaptor = PartitionIdOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.partition_id"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::PartitionIdOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::PopulationCountOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PopulationCountOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + PopulationCountOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + PopulationCountOpGenericAdaptorBase(PopulationCountOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class PopulationCountOpGenericAdaptor : public detail::PopulationCountOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PopulationCountOpGenericAdaptorBase; +public: + PopulationCountOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PopulationCountOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PopulationCountOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + PopulationCountOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PopulationCountOpAdaptor : public PopulationCountOpGenericAdaptor<::mlir::ValueRange> { +public: + using PopulationCountOpGenericAdaptor::PopulationCountOpGenericAdaptor; + PopulationCountOpAdaptor(PopulationCountOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PopulationCountOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait, ::mlir::OpTrait::SameTypeOperands, ::mlir::OpTrait::Elementwise> { +public: + using Op::Op; + using Op::print; + using Adaptor = PopulationCountOpAdaptor; + template + using GenericAdaptor = PopulationCountOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.popcnt"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getInput(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value output); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::PopulationCountOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::PowOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class PowOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + PowOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + PowOpGenericAdaptorBase(PowOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getBroadcastDimensionsAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getBroadcastDimensions(); +}; +} // namespace detail +template +class PowOpGenericAdaptor : public detail::PowOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::PowOpGenericAdaptorBase; +public: + PowOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + PowOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : PowOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + PowOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + ValueT getOut() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class PowOpAdaptor : public PowOpGenericAdaptor<::mlir::ValueRange> { +public: + using PowOpGenericAdaptor::PowOpGenericAdaptor; + PowOpAdaptor(PowOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class PowOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait, ::mlir::OpTrait::SameTypeOperands, ::mlir::OpTrait::Elementwise> { +public: + using Op::Op; + using Op::print; + using Adaptor = PowOpAdaptor; + template + using GenericAdaptor = PowOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("broadcast_dimensions")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBroadcastDimensionsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBroadcastDimensionsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.power"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getLhs(); + ::mlir::TypedValue<::mlir::MemRefType> getRhs(); + ::mlir::TypedValue<::mlir::MemRefType> getOut(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + ::mlir::OpOperand &getOutMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::DenseIntElementsAttr getBroadcastDimensionsAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getBroadcastDimensions(); + void setBroadcastDimensionsAttr(::mlir::DenseIntElementsAttr attr); + ::mlir::Attribute removeBroadcastDimensionsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value out, /*optional*/::mlir::DenseIntElementsAttr broadcast_dimensions); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value out, /*optional*/::mlir::DenseIntElementsAttr broadcast_dimensions); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::PowOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::RealDynamicSliceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RealDynamicSliceOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RealDynamicSliceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RealDynamicSliceOpGenericAdaptorBase(RealDynamicSliceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RealDynamicSliceOpGenericAdaptor : public detail::RealDynamicSliceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RealDynamicSliceOpGenericAdaptorBase; +public: + RealDynamicSliceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RealDynamicSliceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RealDynamicSliceOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RealDynamicSliceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + ValueT getStartIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getLimitIndices() { + return (*getODSOperands(2).begin()); + } + + ValueT getStrides() { + return (*getODSOperands(3).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(4).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RealDynamicSliceOpAdaptor : public RealDynamicSliceOpGenericAdaptor<::mlir::ValueRange> { +public: + using RealDynamicSliceOpGenericAdaptor::RealDynamicSliceOpGenericAdaptor; + RealDynamicSliceOpAdaptor(RealDynamicSliceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RealDynamicSliceOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RealDynamicSliceOpAdaptor; + template + using GenericAdaptor = RealDynamicSliceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.real_dynamic_slice"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getOperand(); + ::mlir::TypedValue<::mlir::MemRefType> getStartIndices(); + ::mlir::TypedValue<::mlir::MemRefType> getLimitIndices(); + ::mlir::TypedValue<::mlir::MemRefType> getStrides(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::OpOperand &getStartIndicesMutable(); + ::mlir::OpOperand &getLimitIndicesMutable(); + ::mlir::OpOperand &getStridesMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::Value start_indices, ::mlir::Value limit_indices, ::mlir::Value strides, ::mlir::Value output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value start_indices, ::mlir::Value limit_indices, ::mlir::Value strides, ::mlir::Value output); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::RealDynamicSliceOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::RealOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RealOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RealOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RealOpGenericAdaptorBase(RealOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RealOpGenericAdaptor : public detail::RealOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RealOpGenericAdaptorBase; +public: + RealOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RealOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RealOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RealOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RealOpAdaptor : public RealOpGenericAdaptor<::mlir::ValueRange> { +public: + using RealOpGenericAdaptor::RealOpGenericAdaptor; + RealOpAdaptor(RealOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RealOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait, ::mlir::OpTrait::SameOperandsShape> { +public: + using Op::Op; + using Op::print; + using Adaptor = RealOpAdaptor; + template + using GenericAdaptor = RealOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.real"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getInput(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value output); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::RealOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::RecvDoneOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RecvDoneOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RecvDoneOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RecvDoneOpGenericAdaptorBase(RecvDoneOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::mhlo::ChannelHandleAttr getChannelHandleAttr(); + ::mlir::mhlo::ChannelHandleAttr getChannelHandle(); + ::mlir::BoolAttr getIsHostTransferAttr(); + bool getIsHostTransfer(); +}; +} // namespace detail +template +class RecvDoneOpGenericAdaptor : public detail::RecvDoneOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RecvDoneOpGenericAdaptorBase; +public: + RecvDoneOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RecvDoneOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RecvDoneOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RecvDoneOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getToken() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RecvDoneOpAdaptor : public RecvDoneOpGenericAdaptor<::mlir::ValueRange> { +public: + using RecvDoneOpGenericAdaptor::RecvDoneOpGenericAdaptor; + RecvDoneOpAdaptor(RecvDoneOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RecvDoneOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = RecvDoneOpAdaptor; + template + using GenericAdaptor = RecvDoneOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("channel_handle"), ::llvm::StringRef("is_host_transfer")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getChannelHandleAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getChannelHandleAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getIsHostTransferAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getIsHostTransferAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.recv_done"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getToken(); + ::mlir::OpOperand &getTokenMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::mhlo::ChannelHandleAttr getChannelHandleAttr(); + ::mlir::mhlo::ChannelHandleAttr getChannelHandle(); + ::mlir::BoolAttr getIsHostTransferAttr(); + bool getIsHostTransfer(); + void setChannelHandleAttr(::mlir::mhlo::ChannelHandleAttr attr); + void setIsHostTransferAttr(::mlir::BoolAttr attr); + void setIsHostTransfer(::std::optional attrValue); + ::mlir::Attribute removeIsHostTransferAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value token, ::mlir::mhlo::ChannelHandleAttr channel_handle, /*optional*/::mlir::BoolAttr is_host_transfer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value token, ::mlir::mhlo::ChannelHandleAttr channel_handle, /*optional*/::mlir::BoolAttr is_host_transfer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value token, ::mlir::mhlo::ChannelHandleAttr channel_handle, /*optional*/bool is_host_transfer = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value token, ::mlir::mhlo::ChannelHandleAttr channel_handle, /*optional*/bool is_host_transfer = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::RecvDoneOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::RecvOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RecvOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RecvOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RecvOpGenericAdaptorBase(RecvOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::mhlo::ChannelHandleAttr getChannelHandleAttr(); + ::mlir::mhlo::ChannelHandleAttr getChannelHandle(); + ::mlir::BoolAttr getIsHostTransferAttr(); + bool getIsHostTransfer(); + ::mlir::DictionaryAttr getFrontendAttributesAttr(); + ::mlir::DictionaryAttr getFrontendAttributes(); +}; +} // namespace detail +template +class RecvOpGenericAdaptor : public detail::RecvOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RecvOpGenericAdaptorBase; +public: + RecvOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RecvOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RecvOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RecvOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOutputs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RecvOpAdaptor : public RecvOpGenericAdaptor<::mlir::ValueRange> { +public: + using RecvOpGenericAdaptor::RecvOpGenericAdaptor; + RecvOpAdaptor(RecvOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RecvOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = RecvOpAdaptor; + template + using GenericAdaptor = RecvOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("channel_handle"), ::llvm::StringRef("frontend_attributes"), ::llvm::StringRef("is_host_transfer")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getChannelHandleAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getChannelHandleAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getFrontendAttributesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getFrontendAttributesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getIsHostTransferAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getIsHostTransferAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.recv"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getOutputs(); + ::mlir::MutableOperandRange getOutputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getToken(); + ::mlir::mhlo::ChannelHandleAttr getChannelHandleAttr(); + ::mlir::mhlo::ChannelHandleAttr getChannelHandle(); + ::mlir::BoolAttr getIsHostTransferAttr(); + bool getIsHostTransfer(); + ::mlir::DictionaryAttr getFrontendAttributesAttr(); + ::mlir::DictionaryAttr getFrontendAttributes(); + void setChannelHandleAttr(::mlir::mhlo::ChannelHandleAttr attr); + void setIsHostTransferAttr(::mlir::BoolAttr attr); + void setIsHostTransfer(::std::optional attrValue); + void setFrontendAttributesAttr(::mlir::DictionaryAttr attr); + ::mlir::Attribute removeIsHostTransferAttr(); + ::mlir::Attribute removeFrontendAttributesAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type token, ::mlir::ValueRange outputs, ::mlir::mhlo::ChannelHandleAttr channel_handle, /*optional*/::mlir::BoolAttr is_host_transfer, /*optional*/::mlir::DictionaryAttr frontend_attributes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange outputs, ::mlir::mhlo::ChannelHandleAttr channel_handle, /*optional*/::mlir::BoolAttr is_host_transfer, /*optional*/::mlir::DictionaryAttr frontend_attributes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type token, ::mlir::ValueRange outputs, ::mlir::mhlo::ChannelHandleAttr channel_handle, /*optional*/bool is_host_transfer, /*optional*/::mlir::DictionaryAttr frontend_attributes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange outputs, ::mlir::mhlo::ChannelHandleAttr channel_handle, /*optional*/bool is_host_transfer, /*optional*/::mlir::DictionaryAttr frontend_attributes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::RecvOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::ReduceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReduceOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ReduceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ReduceOpGenericAdaptorBase(ReduceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getDimensionsAttr(); + ::mlir::DenseIntElementsAttr getDimensions(); + ::mlir::Region &getBody(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class ReduceOpGenericAdaptor : public detail::ReduceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReduceOpGenericAdaptorBase; +public: + ReduceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReduceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReduceOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ReduceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getInitValues() { + return getODSOperands(1); + } + + RangeT getOut() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ReduceOpAdaptor : public ReduceOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReduceOpGenericAdaptor::ReduceOpGenericAdaptor; + ReduceOpAdaptor(ReduceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReduceOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = ReduceOpAdaptor; + template + using GenericAdaptor = ReduceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dimensions")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDimensionsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDimensionsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.reduce"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getInitValues(); + ::mlir::Operation::operand_range getOut(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getInitValuesMutable(); + ::mlir::MutableOperandRange getOutMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getBody(); + ::mlir::DenseIntElementsAttr getDimensionsAttr(); + ::mlir::DenseIntElementsAttr getDimensions(); + void setDimensionsAttr(::mlir::DenseIntElementsAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange inputs, ::mlir::ValueRange init_values, ::mlir::ValueRange out, ::mlir::DenseIntElementsAttr dimensions); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::mlir::ValueRange init_values, ::mlir::ValueRange out, ::mlir::DenseIntElementsAttr dimensions); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + static void getCanonicalizationPatterns(::mlir::RewritePatternSet &results, ::mlir::MLIRContext *context); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::ReduceOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::ReducePrecisionOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReducePrecisionOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ReducePrecisionOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ReducePrecisionOpGenericAdaptorBase(ReducePrecisionOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getExponentBitsAttr(); + uint32_t getExponentBits(); + ::mlir::IntegerAttr getMantissaBitsAttr(); + uint32_t getMantissaBits(); +}; +} // namespace detail +template +class ReducePrecisionOpGenericAdaptor : public detail::ReducePrecisionOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReducePrecisionOpGenericAdaptorBase; +public: + ReducePrecisionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReducePrecisionOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReducePrecisionOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ReducePrecisionOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ReducePrecisionOpAdaptor : public ReducePrecisionOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReducePrecisionOpGenericAdaptor::ReducePrecisionOpGenericAdaptor; + ReducePrecisionOpAdaptor(ReducePrecisionOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReducePrecisionOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait, ::mlir::OpTrait::SameTypeOperands> { +public: + using Op::Op; + using Op::print; + using Adaptor = ReducePrecisionOpAdaptor; + template + using GenericAdaptor = ReducePrecisionOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("exponent_bits"), ::llvm::StringRef("mantissa_bits")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getExponentBitsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getExponentBitsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getMantissaBitsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getMantissaBitsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.reduce_precision"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getOperand(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getExponentBitsAttr(); + uint32_t getExponentBits(); + ::mlir::IntegerAttr getMantissaBitsAttr(); + uint32_t getMantissaBits(); + void setExponentBitsAttr(::mlir::IntegerAttr attr); + void setExponentBits(uint32_t attrValue); + void setMantissaBitsAttr(::mlir::IntegerAttr attr); + void setMantissaBits(uint32_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::Value output, ::mlir::IntegerAttr exponent_bits, ::mlir::IntegerAttr mantissa_bits); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value output, ::mlir::IntegerAttr exponent_bits, ::mlir::IntegerAttr mantissa_bits); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::Value output, uint32_t exponent_bits, uint32_t mantissa_bits); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value output, uint32_t exponent_bits, uint32_t mantissa_bits); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::ReducePrecisionOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::ReduceWindowOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReduceWindowOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ReduceWindowOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ReduceWindowOpGenericAdaptorBase(ReduceWindowOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getWindowDimensionsAttr(); + ::mlir::DenseIntElementsAttr getWindowDimensions(); + ::mlir::DenseIntElementsAttr getWindowStridesAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getWindowStrides(); + ::mlir::DenseIntElementsAttr getBaseDilationsAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getBaseDilations(); + ::mlir::DenseIntElementsAttr getWindowDilationsAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getWindowDilations(); + ::mlir::DenseIntElementsAttr getPaddingAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getPadding(); + ::mlir::Region &getBody(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class ReduceWindowOpGenericAdaptor : public detail::ReduceWindowOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReduceWindowOpGenericAdaptorBase; +public: + ReduceWindowOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReduceWindowOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReduceWindowOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ReduceWindowOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getInitValues() { + return getODSOperands(1); + } + + RangeT getOut() { + return getODSOperands(2); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ReduceWindowOpAdaptor : public ReduceWindowOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReduceWindowOpGenericAdaptor::ReduceWindowOpGenericAdaptor; + ReduceWindowOpAdaptor(ReduceWindowOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReduceWindowOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = ReduceWindowOpAdaptor; + template + using GenericAdaptor = ReduceWindowOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("base_dilations"), ::llvm::StringRef("padding"), ::llvm::StringRef("window_dilations"), ::llvm::StringRef("window_dimensions"), ::llvm::StringRef("window_strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBaseDilationsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBaseDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getWindowDilationsAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getWindowDilationsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getWindowDimensionsAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getWindowDimensionsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getWindowStridesAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getWindowStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.reduce_window"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getInitValues(); + ::mlir::Operation::operand_range getOut(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getInitValuesMutable(); + ::mlir::MutableOperandRange getOutMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getBody(); + ::mlir::DenseIntElementsAttr getWindowDimensionsAttr(); + ::mlir::DenseIntElementsAttr getWindowDimensions(); + ::mlir::DenseIntElementsAttr getWindowStridesAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getWindowStrides(); + ::mlir::DenseIntElementsAttr getBaseDilationsAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getBaseDilations(); + ::mlir::DenseIntElementsAttr getWindowDilationsAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getWindowDilations(); + ::mlir::DenseIntElementsAttr getPaddingAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getPadding(); + void setWindowDimensionsAttr(::mlir::DenseIntElementsAttr attr); + void setWindowStridesAttr(::mlir::DenseIntElementsAttr attr); + void setBaseDilationsAttr(::mlir::DenseIntElementsAttr attr); + void setWindowDilationsAttr(::mlir::DenseIntElementsAttr attr); + void setPaddingAttr(::mlir::DenseIntElementsAttr attr); + ::mlir::Attribute removeWindowStridesAttr(); + ::mlir::Attribute removeBaseDilationsAttr(); + ::mlir::Attribute removeWindowDilationsAttr(); + ::mlir::Attribute removePaddingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange inputs, ::mlir::ValueRange init_values, ::mlir::ValueRange out, ::mlir::DenseIntElementsAttr window_dimensions, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr base_dilations, /*optional*/::mlir::DenseIntElementsAttr window_dilations, /*optional*/::mlir::DenseIntElementsAttr padding); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::mlir::ValueRange init_values, ::mlir::ValueRange out, ::mlir::DenseIntElementsAttr window_dimensions, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr base_dilations, /*optional*/::mlir::DenseIntElementsAttr window_dilations, /*optional*/::mlir::DenseIntElementsAttr padding); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::LogicalResult verify(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 5 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::ReduceWindowOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::RemOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RemOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RemOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RemOpGenericAdaptorBase(RemOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getBroadcastDimensionsAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getBroadcastDimensions(); +}; +} // namespace detail +template +class RemOpGenericAdaptor : public detail::RemOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RemOpGenericAdaptorBase; +public: + RemOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RemOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RemOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RemOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + ValueT getOut() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RemOpAdaptor : public RemOpGenericAdaptor<::mlir::ValueRange> { +public: + using RemOpGenericAdaptor::RemOpGenericAdaptor; + RemOpAdaptor(RemOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RemOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait, ::mlir::OpTrait::SameTypeOperands, ::mlir::OpTrait::Elementwise> { +public: + using Op::Op; + using Op::print; + using Adaptor = RemOpAdaptor; + template + using GenericAdaptor = RemOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("broadcast_dimensions")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBroadcastDimensionsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBroadcastDimensionsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.remainder"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getLhs(); + ::mlir::TypedValue<::mlir::MemRefType> getRhs(); + ::mlir::TypedValue<::mlir::MemRefType> getOut(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + ::mlir::OpOperand &getOutMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::DenseIntElementsAttr getBroadcastDimensionsAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getBroadcastDimensions(); + void setBroadcastDimensionsAttr(::mlir::DenseIntElementsAttr attr); + ::mlir::Attribute removeBroadcastDimensionsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value out, /*optional*/::mlir::DenseIntElementsAttr broadcast_dimensions); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value out, /*optional*/::mlir::DenseIntElementsAttr broadcast_dimensions); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::RemOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::ReplicaIdOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReplicaIdOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ReplicaIdOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ReplicaIdOpGenericAdaptorBase(ReplicaIdOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ReplicaIdOpGenericAdaptor : public detail::ReplicaIdOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReplicaIdOpGenericAdaptorBase; +public: + ReplicaIdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReplicaIdOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReplicaIdOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ReplicaIdOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ReplicaIdOpAdaptor : public ReplicaIdOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReplicaIdOpGenericAdaptor::ReplicaIdOpGenericAdaptor; + ReplicaIdOpAdaptor(ReplicaIdOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReplicaIdOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = ReplicaIdOpAdaptor; + template + using GenericAdaptor = ReplicaIdOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.replica_id"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value odsArg_0); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value odsArg_0); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::ReplicaIdOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::ReshapeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReshapeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ReshapeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ReshapeOpGenericAdaptorBase(ReshapeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class ReshapeOpGenericAdaptor : public detail::ReshapeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReshapeOpGenericAdaptorBase; +public: + ReshapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReshapeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReshapeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ReshapeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ReshapeOpAdaptor : public ReshapeOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReshapeOpGenericAdaptor::ReshapeOpGenericAdaptor; + ReshapeOpAdaptor(ReshapeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReshapeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ReshapeOpAdaptor; + template + using GenericAdaptor = ReshapeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.reshape"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getOperand(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::Value output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value output); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::ReshapeOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::ReverseOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ReverseOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ReverseOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ReverseOpGenericAdaptorBase(ReverseOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getDimensionsAttr(); + ::mlir::DenseIntElementsAttr getDimensions(); +}; +} // namespace detail +template +class ReverseOpGenericAdaptor : public detail::ReverseOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ReverseOpGenericAdaptorBase; +public: + ReverseOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ReverseOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ReverseOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ReverseOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ReverseOpAdaptor : public ReverseOpGenericAdaptor<::mlir::ValueRange> { +public: + using ReverseOpGenericAdaptor::ReverseOpGenericAdaptor; + ReverseOpAdaptor(ReverseOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ReverseOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ReverseOpAdaptor; + template + using GenericAdaptor = ReverseOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dimensions")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDimensionsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDimensionsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.reverse"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getOperand(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::DenseIntElementsAttr getDimensionsAttr(); + ::mlir::DenseIntElementsAttr getDimensions(); + void setDimensionsAttr(::mlir::DenseIntElementsAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::DenseIntElementsAttr dimensions, ::mlir::Value output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::DenseIntElementsAttr dimensions, ::mlir::Value output); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::ReverseOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::RngGetAndUpdateStateOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RngGetAndUpdateStateOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RngGetAndUpdateStateOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RngGetAndUpdateStateOpGenericAdaptorBase(RngGetAndUpdateStateOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getDeltaAttr(); + uint64_t getDelta(); +}; +} // namespace detail +template +class RngGetAndUpdateStateOpGenericAdaptor : public detail::RngGetAndUpdateStateOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RngGetAndUpdateStateOpGenericAdaptorBase; +public: + RngGetAndUpdateStateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RngGetAndUpdateStateOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RngGetAndUpdateStateOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RngGetAndUpdateStateOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getState() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RngGetAndUpdateStateOpAdaptor : public RngGetAndUpdateStateOpGenericAdaptor<::mlir::ValueRange> { +public: + using RngGetAndUpdateStateOpGenericAdaptor::RngGetAndUpdateStateOpGenericAdaptor; + RngGetAndUpdateStateOpAdaptor(RngGetAndUpdateStateOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RngGetAndUpdateStateOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = RngGetAndUpdateStateOpAdaptor; + template + using GenericAdaptor = RngGetAndUpdateStateOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("delta")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDeltaAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDeltaAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.rng_get_and_update_state"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getState(); + ::mlir::OpOperand &getStateMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::IntegerAttr getDeltaAttr(); + uint64_t getDelta(); + void setDeltaAttr(::mlir::IntegerAttr attr); + void setDelta(uint64_t attrValue); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value state, ::mlir::IntegerAttr delta); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value state, ::mlir::IntegerAttr delta); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value state, uint64_t delta); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value state, uint64_t delta); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::RngGetAndUpdateStateOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::RoundNearestEvenOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RoundNearestEvenOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RoundNearestEvenOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RoundNearestEvenOpGenericAdaptorBase(RoundNearestEvenOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RoundNearestEvenOpGenericAdaptor : public detail::RoundNearestEvenOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RoundNearestEvenOpGenericAdaptorBase; +public: + RoundNearestEvenOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RoundNearestEvenOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RoundNearestEvenOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RoundNearestEvenOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RoundNearestEvenOpAdaptor : public RoundNearestEvenOpGenericAdaptor<::mlir::ValueRange> { +public: + using RoundNearestEvenOpGenericAdaptor::RoundNearestEvenOpGenericAdaptor; + RoundNearestEvenOpAdaptor(RoundNearestEvenOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RoundNearestEvenOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait, ::mlir::OpTrait::SameTypeOperands, ::mlir::OpTrait::Elementwise> { +public: + using Op::Op; + using Op::print; + using Adaptor = RoundNearestEvenOpAdaptor; + template + using GenericAdaptor = RoundNearestEvenOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.round_nearest_even"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getInput(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value output); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::RoundNearestEvenOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::RoundOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RoundOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RoundOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RoundOpGenericAdaptorBase(RoundOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RoundOpGenericAdaptor : public detail::RoundOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RoundOpGenericAdaptorBase; +public: + RoundOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RoundOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RoundOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RoundOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RoundOpAdaptor : public RoundOpGenericAdaptor<::mlir::ValueRange> { +public: + using RoundOpGenericAdaptor::RoundOpGenericAdaptor; + RoundOpAdaptor(RoundOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RoundOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait, ::mlir::OpTrait::SameTypeOperands, ::mlir::OpTrait::Elementwise> { +public: + using Op::Op; + using Op::print; + using Adaptor = RoundOpAdaptor; + template + using GenericAdaptor = RoundOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.round_nearest_afz"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getInput(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value output); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::RoundOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::RsqrtOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class RsqrtOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + RsqrtOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + RsqrtOpGenericAdaptorBase(RsqrtOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class RsqrtOpGenericAdaptor : public detail::RsqrtOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::RsqrtOpGenericAdaptorBase; +public: + RsqrtOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + RsqrtOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : RsqrtOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + RsqrtOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class RsqrtOpAdaptor : public RsqrtOpGenericAdaptor<::mlir::ValueRange> { +public: + using RsqrtOpGenericAdaptor::RsqrtOpGenericAdaptor; + RsqrtOpAdaptor(RsqrtOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class RsqrtOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait, ::mlir::OpTrait::SameTypeOperands, ::mlir::OpTrait::Elementwise> { +public: + using Op::Op; + using Op::print; + using Adaptor = RsqrtOpAdaptor; + template + using GenericAdaptor = RsqrtOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.rsqrt"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getInput(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value output); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::RsqrtOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::ScatterOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ScatterOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ScatterOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ScatterOpGenericAdaptorBase(ScatterOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::mhlo::ScatterDimensionNumbersAttr getScatterDimensionNumbersAttr(); + ::mlir::mhlo::ScatterDimensionNumbersAttr getScatterDimensionNumbers(); + ::mlir::BoolAttr getIndicesAreSortedAttr(); + bool getIndicesAreSorted(); + ::mlir::BoolAttr getUniqueIndicesAttr(); + bool getUniqueIndices(); + ::mlir::Region &getUpdateComputation(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class ScatterOpGenericAdaptor : public detail::ScatterOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ScatterOpGenericAdaptorBase; +public: + ScatterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ScatterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ScatterOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ScatterOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + ValueT getScatterIndices() { + return (*getODSOperands(1).begin()); + } + + ValueT getUpdates() { + return (*getODSOperands(2).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ScatterOpAdaptor : public ScatterOpGenericAdaptor<::mlir::ValueRange> { +public: + using ScatterOpGenericAdaptor::ScatterOpGenericAdaptor; + ScatterOpAdaptor(ScatterOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ScatterOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = ScatterOpAdaptor; + template + using GenericAdaptor = ScatterOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("indices_are_sorted"), ::llvm::StringRef("scatter_dimension_numbers"), ::llvm::StringRef("unique_indices")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getIndicesAreSortedAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getIndicesAreSortedAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getScatterDimensionNumbersAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getScatterDimensionNumbersAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getUniqueIndicesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getUniqueIndicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.scatter"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getOperand(); + ::mlir::TypedValue<::mlir::MemRefType> getScatterIndices(); + ::mlir::TypedValue<::mlir::MemRefType> getUpdates(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::OpOperand &getScatterIndicesMutable(); + ::mlir::OpOperand &getUpdatesMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getUpdateComputation(); + ::mlir::mhlo::ScatterDimensionNumbersAttr getScatterDimensionNumbersAttr(); + ::mlir::mhlo::ScatterDimensionNumbersAttr getScatterDimensionNumbers(); + ::mlir::BoolAttr getIndicesAreSortedAttr(); + bool getIndicesAreSorted(); + ::mlir::BoolAttr getUniqueIndicesAttr(); + bool getUniqueIndices(); + void setScatterDimensionNumbersAttr(::mlir::mhlo::ScatterDimensionNumbersAttr attr); + void setIndicesAreSortedAttr(::mlir::BoolAttr attr); + void setIndicesAreSorted(::std::optional attrValue); + void setUniqueIndicesAttr(::mlir::BoolAttr attr); + void setUniqueIndices(::std::optional attrValue); + ::mlir::Attribute removeIndicesAreSortedAttr(); + ::mlir::Attribute removeUniqueIndicesAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::Value scatter_indices, ::mlir::Value updates, ::mlir::Value output, ::mlir::mhlo::ScatterDimensionNumbersAttr scatter_dimension_numbers, /*optional*/::mlir::BoolAttr indices_are_sorted, /*optional*/::mlir::BoolAttr unique_indices); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value scatter_indices, ::mlir::Value updates, ::mlir::Value output, ::mlir::mhlo::ScatterDimensionNumbersAttr scatter_dimension_numbers, /*optional*/::mlir::BoolAttr indices_are_sorted, /*optional*/::mlir::BoolAttr unique_indices); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::Value scatter_indices, ::mlir::Value updates, ::mlir::Value output, ::mlir::mhlo::ScatterDimensionNumbersAttr scatter_dimension_numbers, /*optional*/bool indices_are_sorted = false, /*optional*/bool unique_indices = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value scatter_indices, ::mlir::Value updates, ::mlir::Value output, ::mlir::mhlo::ScatterDimensionNumbersAttr scatter_dimension_numbers, /*optional*/bool indices_are_sorted = false, /*optional*/bool unique_indices = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::ScatterOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::SelectAndScatterOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SelectAndScatterOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SelectAndScatterOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SelectAndScatterOpGenericAdaptorBase(SelectAndScatterOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getWindowDimensionsAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getWindowDimensions(); + ::mlir::DenseIntElementsAttr getWindowStridesAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getWindowStrides(); + ::mlir::DenseIntElementsAttr getPaddingAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getPadding(); + ::mlir::Region &getSelect(); + ::mlir::Region &getScatter(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class SelectAndScatterOpGenericAdaptor : public detail::SelectAndScatterOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SelectAndScatterOpGenericAdaptorBase; +public: + SelectAndScatterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SelectAndScatterOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SelectAndScatterOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SelectAndScatterOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + ValueT getSource() { + return (*getODSOperands(1).begin()); + } + + ValueT getInitValue() { + return (*getODSOperands(2).begin()); + } + + ValueT getOut() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SelectAndScatterOpAdaptor : public SelectAndScatterOpGenericAdaptor<::mlir::ValueRange> { +public: + using SelectAndScatterOpGenericAdaptor::SelectAndScatterOpGenericAdaptor; + SelectAndScatterOpAdaptor(SelectAndScatterOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SelectAndScatterOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::NOperands<4>::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SelectAndScatterOpAdaptor; + template + using GenericAdaptor = SelectAndScatterOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("padding"), ::llvm::StringRef("window_dimensions"), ::llvm::StringRef("window_strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getPaddingAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getPaddingAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getWindowDimensionsAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getWindowDimensionsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getWindowStridesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getWindowStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.select_and_scatter"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getOperand(); + ::mlir::TypedValue<::mlir::MemRefType> getSource(); + ::mlir::TypedValue<::mlir::MemRefType> getInitValue(); + ::mlir::TypedValue<::mlir::MemRefType> getOut(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::OpOperand &getSourceMutable(); + ::mlir::OpOperand &getInitValueMutable(); + ::mlir::OpOperand &getOutMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getSelect(); + ::mlir::Region &getScatter(); + ::mlir::DenseIntElementsAttr getWindowDimensionsAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getWindowDimensions(); + ::mlir::DenseIntElementsAttr getWindowStridesAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getWindowStrides(); + ::mlir::DenseIntElementsAttr getPaddingAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getPadding(); + void setWindowDimensionsAttr(::mlir::DenseIntElementsAttr attr); + void setWindowStridesAttr(::mlir::DenseIntElementsAttr attr); + void setPaddingAttr(::mlir::DenseIntElementsAttr attr); + ::mlir::Attribute removeWindowDimensionsAttr(); + ::mlir::Attribute removeWindowStridesAttr(); + ::mlir::Attribute removePaddingAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::Value source, ::mlir::Value init_value, ::mlir::Value out, /*optional*/::mlir::DenseIntElementsAttr window_dimensions, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value source, ::mlir::Value init_value, ::mlir::Value out, /*optional*/::mlir::DenseIntElementsAttr window_dimensions, /*optional*/::mlir::DenseIntElementsAttr window_strides, /*optional*/::mlir::DenseIntElementsAttr padding); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::SelectAndScatterOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::SelectOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SelectOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SelectOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SelectOpGenericAdaptorBase(SelectOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SelectOpGenericAdaptor : public detail::SelectOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SelectOpGenericAdaptorBase; +public: + SelectOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SelectOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SelectOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SelectOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getPred() { + return (*getODSOperands(0).begin()); + } + + ValueT getOnTrue() { + return (*getODSOperands(1).begin()); + } + + ValueT getOnFalse() { + return (*getODSOperands(2).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(3).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SelectOpAdaptor : public SelectOpGenericAdaptor<::mlir::ValueRange> { +public: + using SelectOpGenericAdaptor::SelectOpGenericAdaptor; + SelectOpAdaptor(SelectOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SelectOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait, ::mlir::OpTrait::Elementwise> { +public: + using Op::Op; + using Op::print; + using Adaptor = SelectOpAdaptor; + template + using GenericAdaptor = SelectOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.select"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getPred(); + ::mlir::TypedValue<::mlir::MemRefType> getOnTrue(); + ::mlir::TypedValue<::mlir::MemRefType> getOnFalse(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getPredMutable(); + ::mlir::OpOperand &getOnTrueMutable(); + ::mlir::OpOperand &getOnFalseMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value pred, ::mlir::Value on_true, ::mlir::Value on_false, ::mlir::Value output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value pred, ::mlir::Value on_true, ::mlir::Value on_false, ::mlir::Value output); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::SelectOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::SendDoneOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SendDoneOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SendDoneOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SendDoneOpGenericAdaptorBase(SendDoneOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::mhlo::ChannelHandleAttr getChannelHandleAttr(); + ::mlir::mhlo::ChannelHandleAttr getChannelHandle(); + ::mlir::BoolAttr getIsHostTransferAttr(); + bool getIsHostTransfer(); +}; +} // namespace detail +template +class SendDoneOpGenericAdaptor : public detail::SendDoneOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SendDoneOpGenericAdaptorBase; +public: + SendDoneOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SendDoneOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SendDoneOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SendDoneOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getToken() { + return (*getODSOperands(0).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SendDoneOpAdaptor : public SendDoneOpGenericAdaptor<::mlir::ValueRange> { +public: + using SendDoneOpGenericAdaptor::SendDoneOpGenericAdaptor; + SendDoneOpAdaptor(SendDoneOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SendDoneOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = SendDoneOpAdaptor; + template + using GenericAdaptor = SendDoneOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("channel_handle"), ::llvm::StringRef("is_host_transfer")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getChannelHandleAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getChannelHandleAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getIsHostTransferAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getIsHostTransferAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.send_done"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Value getToken(); + ::mlir::OpOperand &getTokenMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::mhlo::ChannelHandleAttr getChannelHandleAttr(); + ::mlir::mhlo::ChannelHandleAttr getChannelHandle(); + ::mlir::BoolAttr getIsHostTransferAttr(); + bool getIsHostTransfer(); + void setChannelHandleAttr(::mlir::mhlo::ChannelHandleAttr attr); + void setIsHostTransferAttr(::mlir::BoolAttr attr); + void setIsHostTransfer(::std::optional attrValue); + ::mlir::Attribute removeIsHostTransferAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value token, ::mlir::mhlo::ChannelHandleAttr channel_handle, /*optional*/::mlir::BoolAttr is_host_transfer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value token, ::mlir::mhlo::ChannelHandleAttr channel_handle, /*optional*/::mlir::BoolAttr is_host_transfer); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value token, ::mlir::mhlo::ChannelHandleAttr channel_handle, /*optional*/bool is_host_transfer = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value token, ::mlir::mhlo::ChannelHandleAttr channel_handle, /*optional*/bool is_host_transfer = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::SendDoneOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::SendOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SendOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SendOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SendOpGenericAdaptorBase(SendOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::mhlo::ChannelHandleAttr getChannelHandleAttr(); + ::mlir::mhlo::ChannelHandleAttr getChannelHandle(); + ::mlir::BoolAttr getIsHostTransferAttr(); + bool getIsHostTransfer(); + ::mlir::DictionaryAttr getFrontendAttributesAttr(); + ::mlir::DictionaryAttr getFrontendAttributes(); +}; +} // namespace detail +template +class SendOpGenericAdaptor : public detail::SendOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SendOpGenericAdaptorBase; +public: + SendOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SendOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SendOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SendOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SendOpAdaptor : public SendOpGenericAdaptor<::mlir::ValueRange> { +public: + using SendOpGenericAdaptor::SendOpGenericAdaptor; + SendOpAdaptor(SendOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SendOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SendOpAdaptor; + template + using GenericAdaptor = SendOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("channel_handle"), ::llvm::StringRef("frontend_attributes"), ::llvm::StringRef("is_host_transfer")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getChannelHandleAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getChannelHandleAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getFrontendAttributesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getFrontendAttributesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getIsHostTransferAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getIsHostTransferAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.send"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::MutableOperandRange getInputsMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Value getToken(); + ::mlir::mhlo::ChannelHandleAttr getChannelHandleAttr(); + ::mlir::mhlo::ChannelHandleAttr getChannelHandle(); + ::mlir::BoolAttr getIsHostTransferAttr(); + bool getIsHostTransfer(); + ::mlir::DictionaryAttr getFrontendAttributesAttr(); + ::mlir::DictionaryAttr getFrontendAttributes(); + void setChannelHandleAttr(::mlir::mhlo::ChannelHandleAttr attr); + void setIsHostTransferAttr(::mlir::BoolAttr attr); + void setIsHostTransfer(::std::optional attrValue); + void setFrontendAttributesAttr(::mlir::DictionaryAttr attr); + ::mlir::Attribute removeIsHostTransferAttr(); + ::mlir::Attribute removeFrontendAttributesAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type token, ::mlir::ValueRange inputs, ::mlir::mhlo::ChannelHandleAttr channel_handle, /*optional*/::mlir::BoolAttr is_host_transfer, /*optional*/::mlir::DictionaryAttr frontend_attributes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::mlir::mhlo::ChannelHandleAttr channel_handle, /*optional*/::mlir::BoolAttr is_host_transfer, /*optional*/::mlir::DictionaryAttr frontend_attributes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Type token, ::mlir::ValueRange inputs, ::mlir::mhlo::ChannelHandleAttr channel_handle, /*optional*/bool is_host_transfer, /*optional*/::mlir::DictionaryAttr frontend_attributes); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::mlir::mhlo::ChannelHandleAttr channel_handle, /*optional*/bool is_host_transfer, /*optional*/::mlir::DictionaryAttr frontend_attributes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::SendOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::ShiftLeftOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ShiftLeftOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ShiftLeftOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ShiftLeftOpGenericAdaptorBase(ShiftLeftOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getBroadcastDimensionsAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getBroadcastDimensions(); +}; +} // namespace detail +template +class ShiftLeftOpGenericAdaptor : public detail::ShiftLeftOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ShiftLeftOpGenericAdaptorBase; +public: + ShiftLeftOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ShiftLeftOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ShiftLeftOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ShiftLeftOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + ValueT getOut() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ShiftLeftOpAdaptor : public ShiftLeftOpGenericAdaptor<::mlir::ValueRange> { +public: + using ShiftLeftOpGenericAdaptor::ShiftLeftOpGenericAdaptor; + ShiftLeftOpAdaptor(ShiftLeftOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ShiftLeftOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait, ::mlir::OpTrait::SameTypeOperands, ::mlir::OpTrait::Elementwise> { +public: + using Op::Op; + using Op::print; + using Adaptor = ShiftLeftOpAdaptor; + template + using GenericAdaptor = ShiftLeftOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("broadcast_dimensions")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBroadcastDimensionsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBroadcastDimensionsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.shift_left"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getLhs(); + ::mlir::TypedValue<::mlir::MemRefType> getRhs(); + ::mlir::TypedValue<::mlir::MemRefType> getOut(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + ::mlir::OpOperand &getOutMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::DenseIntElementsAttr getBroadcastDimensionsAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getBroadcastDimensions(); + void setBroadcastDimensionsAttr(::mlir::DenseIntElementsAttr attr); + ::mlir::Attribute removeBroadcastDimensionsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value out, /*optional*/::mlir::DenseIntElementsAttr broadcast_dimensions); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value out, /*optional*/::mlir::DenseIntElementsAttr broadcast_dimensions); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::ShiftLeftOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::ShiftRightArithmeticOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ShiftRightArithmeticOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ShiftRightArithmeticOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ShiftRightArithmeticOpGenericAdaptorBase(ShiftRightArithmeticOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getBroadcastDimensionsAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getBroadcastDimensions(); +}; +} // namespace detail +template +class ShiftRightArithmeticOpGenericAdaptor : public detail::ShiftRightArithmeticOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ShiftRightArithmeticOpGenericAdaptorBase; +public: + ShiftRightArithmeticOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ShiftRightArithmeticOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ShiftRightArithmeticOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ShiftRightArithmeticOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + ValueT getOut() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ShiftRightArithmeticOpAdaptor : public ShiftRightArithmeticOpGenericAdaptor<::mlir::ValueRange> { +public: + using ShiftRightArithmeticOpGenericAdaptor::ShiftRightArithmeticOpGenericAdaptor; + ShiftRightArithmeticOpAdaptor(ShiftRightArithmeticOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ShiftRightArithmeticOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait, ::mlir::OpTrait::SameTypeOperands, ::mlir::OpTrait::Elementwise> { +public: + using Op::Op; + using Op::print; + using Adaptor = ShiftRightArithmeticOpAdaptor; + template + using GenericAdaptor = ShiftRightArithmeticOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("broadcast_dimensions")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBroadcastDimensionsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBroadcastDimensionsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.shift_right_arithmetic"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getLhs(); + ::mlir::TypedValue<::mlir::MemRefType> getRhs(); + ::mlir::TypedValue<::mlir::MemRefType> getOut(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + ::mlir::OpOperand &getOutMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::DenseIntElementsAttr getBroadcastDimensionsAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getBroadcastDimensions(); + void setBroadcastDimensionsAttr(::mlir::DenseIntElementsAttr attr); + ::mlir::Attribute removeBroadcastDimensionsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value out, /*optional*/::mlir::DenseIntElementsAttr broadcast_dimensions); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value out, /*optional*/::mlir::DenseIntElementsAttr broadcast_dimensions); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::ShiftRightArithmeticOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::ShiftRightLogicalOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class ShiftRightLogicalOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + ShiftRightLogicalOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + ShiftRightLogicalOpGenericAdaptorBase(ShiftRightLogicalOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getBroadcastDimensionsAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getBroadcastDimensions(); +}; +} // namespace detail +template +class ShiftRightLogicalOpGenericAdaptor : public detail::ShiftRightLogicalOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::ShiftRightLogicalOpGenericAdaptorBase; +public: + ShiftRightLogicalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + ShiftRightLogicalOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : ShiftRightLogicalOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + ShiftRightLogicalOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + ValueT getOut() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class ShiftRightLogicalOpAdaptor : public ShiftRightLogicalOpGenericAdaptor<::mlir::ValueRange> { +public: + using ShiftRightLogicalOpGenericAdaptor::ShiftRightLogicalOpGenericAdaptor; + ShiftRightLogicalOpAdaptor(ShiftRightLogicalOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class ShiftRightLogicalOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait, ::mlir::OpTrait::SameTypeOperands, ::mlir::OpTrait::Elementwise> { +public: + using Op::Op; + using Op::print; + using Adaptor = ShiftRightLogicalOpAdaptor; + template + using GenericAdaptor = ShiftRightLogicalOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("broadcast_dimensions")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBroadcastDimensionsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBroadcastDimensionsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.shift_right_logical"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getLhs(); + ::mlir::TypedValue<::mlir::MemRefType> getRhs(); + ::mlir::TypedValue<::mlir::MemRefType> getOut(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + ::mlir::OpOperand &getOutMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::DenseIntElementsAttr getBroadcastDimensionsAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getBroadcastDimensions(); + void setBroadcastDimensionsAttr(::mlir::DenseIntElementsAttr attr); + ::mlir::Attribute removeBroadcastDimensionsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value out, /*optional*/::mlir::DenseIntElementsAttr broadcast_dimensions); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value out, /*optional*/::mlir::DenseIntElementsAttr broadcast_dimensions); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::ShiftRightLogicalOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::SignOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SignOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SignOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SignOpGenericAdaptorBase(SignOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SignOpGenericAdaptor : public detail::SignOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SignOpGenericAdaptorBase; +public: + SignOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SignOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SignOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SignOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SignOpAdaptor : public SignOpGenericAdaptor<::mlir::ValueRange> { +public: + using SignOpGenericAdaptor::SignOpGenericAdaptor; + SignOpAdaptor(SignOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SignOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait, ::mlir::OpTrait::SameTypeOperands, ::mlir::OpTrait::Elementwise> { +public: + using Op::Op; + using Op::print; + using Adaptor = SignOpAdaptor; + template + using GenericAdaptor = SignOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.sign"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getInput(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value output); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::SignOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::SineOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SineOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SineOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SineOpGenericAdaptorBase(SineOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SineOpGenericAdaptor : public detail::SineOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SineOpGenericAdaptorBase; +public: + SineOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SineOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SineOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SineOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SineOpAdaptor : public SineOpGenericAdaptor<::mlir::ValueRange> { +public: + using SineOpGenericAdaptor::SineOpGenericAdaptor; + SineOpAdaptor(SineOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SineOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait, ::mlir::OpTrait::SameTypeOperands, ::mlir::OpTrait::Elementwise> { +public: + using Op::Op; + using Op::print; + using Adaptor = SineOpAdaptor; + template + using GenericAdaptor = SineOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.sine"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getInput(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value output); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::SineOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::SliceOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SliceOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SliceOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SliceOpGenericAdaptorBase(SliceOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getStartIndicesAttr(); + ::mlir::DenseIntElementsAttr getStartIndices(); + ::mlir::DenseIntElementsAttr getLimitIndicesAttr(); + ::mlir::DenseIntElementsAttr getLimitIndices(); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); +}; +} // namespace detail +template +class SliceOpGenericAdaptor : public detail::SliceOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SliceOpGenericAdaptorBase; +public: + SliceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SliceOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SliceOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SliceOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SliceOpAdaptor : public SliceOpGenericAdaptor<::mlir::ValueRange> { +public: + using SliceOpGenericAdaptor::SliceOpGenericAdaptor; + SliceOpAdaptor(SliceOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SliceOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = SliceOpAdaptor; + template + using GenericAdaptor = SliceOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("limit_indices"), ::llvm::StringRef("start_indices"), ::llvm::StringRef("strides")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getLimitIndicesAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getLimitIndicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getStartIndicesAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getStartIndicesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getStridesAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getStridesAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.slice"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getOperand(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::DenseIntElementsAttr getStartIndicesAttr(); + ::mlir::DenseIntElementsAttr getStartIndices(); + ::mlir::DenseIntElementsAttr getLimitIndicesAttr(); + ::mlir::DenseIntElementsAttr getLimitIndices(); + ::mlir::DenseIntElementsAttr getStridesAttr(); + ::mlir::DenseIntElementsAttr getStrides(); + void setStartIndicesAttr(::mlir::DenseIntElementsAttr attr); + void setLimitIndicesAttr(::mlir::DenseIntElementsAttr attr); + void setStridesAttr(::mlir::DenseIntElementsAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::Value output, ::mlir::DenseIntElementsAttr start_indices, ::mlir::DenseIntElementsAttr limit_indices, ::mlir::DenseIntElementsAttr strides); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::Value output, ::mlir::DenseIntElementsAttr start_indices, ::mlir::DenseIntElementsAttr limit_indices, ::mlir::DenseIntElementsAttr strides); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 3 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::SliceOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::SortOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SortOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SortOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SortOpGenericAdaptorBase(SortOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getDimensionAttr(); + uint64_t getDimension(); + ::mlir::BoolAttr getIsStableAttr(); + bool getIsStable(); + ::mlir::Region &getComparator(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class SortOpGenericAdaptor : public detail::SortOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SortOpGenericAdaptorBase; +public: + SortOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SortOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SortOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SortOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getInputs() { + return getODSOperands(0); + } + + RangeT getOutput() { + return getODSOperands(1); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SortOpAdaptor : public SortOpGenericAdaptor<::mlir::ValueRange> { +public: + using SortOpGenericAdaptor::SortOpGenericAdaptor; + SortOpAdaptor(SortOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SortOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = SortOpAdaptor; + template + using GenericAdaptor = SortOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("dimension"), ::llvm::StringRef("is_stable")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getDimensionAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getDimensionAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getIsStableAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getIsStableAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.sort"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getInputs(); + ::mlir::Operation::operand_range getOutput(); + ::mlir::MutableOperandRange getInputsMutable(); + ::mlir::MutableOperandRange getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getComparator(); + ::mlir::IntegerAttr getDimensionAttr(); + uint64_t getDimension(); + ::mlir::BoolAttr getIsStableAttr(); + bool getIsStable(); + void setDimensionAttr(::mlir::IntegerAttr attr); + void setDimension(::std::optional attrValue); + void setIsStableAttr(::mlir::BoolAttr attr); + void setIsStable(::std::optional attrValue); + ::mlir::Attribute removeDimensionAttr(); + ::mlir::Attribute removeIsStableAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange inputs, ::mlir::ValueRange output, /*optional*/::mlir::IntegerAttr dimension, /*optional*/::mlir::BoolAttr is_stable); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::mlir::ValueRange output, /*optional*/::mlir::IntegerAttr dimension, /*optional*/::mlir::BoolAttr is_stable); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange inputs, ::mlir::ValueRange output, /*optional*/uint64_t dimension = -1, /*optional*/bool is_stable = false); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange inputs, ::mlir::ValueRange output, /*optional*/uint64_t dimension = -1, /*optional*/bool is_stable = false); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 2 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::SortOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::SqrtOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SqrtOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SqrtOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SqrtOpGenericAdaptorBase(SqrtOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class SqrtOpGenericAdaptor : public detail::SqrtOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SqrtOpGenericAdaptorBase; +public: + SqrtOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SqrtOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SqrtOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SqrtOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SqrtOpAdaptor : public SqrtOpGenericAdaptor<::mlir::ValueRange> { +public: + using SqrtOpGenericAdaptor::SqrtOpGenericAdaptor; + SqrtOpAdaptor(SqrtOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SqrtOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait, ::mlir::OpTrait::SameTypeOperands, ::mlir::OpTrait::Elementwise> { +public: + using Op::Op; + using Op::print; + using Adaptor = SqrtOpAdaptor; + template + using GenericAdaptor = SqrtOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.sqrt"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getInput(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value output); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::SqrtOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::SubtractOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class SubtractOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + SubtractOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + SubtractOpGenericAdaptorBase(SubtractOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getBroadcastDimensionsAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getBroadcastDimensions(); +}; +} // namespace detail +template +class SubtractOpGenericAdaptor : public detail::SubtractOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::SubtractOpGenericAdaptorBase; +public: + SubtractOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + SubtractOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : SubtractOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + SubtractOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + ValueT getOut() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class SubtractOpAdaptor : public SubtractOpGenericAdaptor<::mlir::ValueRange> { +public: + using SubtractOpGenericAdaptor::SubtractOpGenericAdaptor; + SubtractOpAdaptor(SubtractOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class SubtractOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait, ::mlir::OpTrait::SameTypeOperands, ::mlir::OpTrait::Elementwise> { +public: + using Op::Op; + using Op::print; + using Adaptor = SubtractOpAdaptor; + template + using GenericAdaptor = SubtractOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("broadcast_dimensions")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBroadcastDimensionsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBroadcastDimensionsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.subtract"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getLhs(); + ::mlir::TypedValue<::mlir::MemRefType> getRhs(); + ::mlir::TypedValue<::mlir::MemRefType> getOut(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + ::mlir::OpOperand &getOutMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::DenseIntElementsAttr getBroadcastDimensionsAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getBroadcastDimensions(); + void setBroadcastDimensionsAttr(::mlir::DenseIntElementsAttr attr); + ::mlir::Attribute removeBroadcastDimensionsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value out, /*optional*/::mlir::DenseIntElementsAttr broadcast_dimensions); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value out, /*optional*/::mlir::DenseIntElementsAttr broadcast_dimensions); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::SubtractOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::TanOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TanOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TanOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TanOpGenericAdaptorBase(TanOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TanOpGenericAdaptor : public detail::TanOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TanOpGenericAdaptorBase; +public: + TanOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TanOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TanOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TanOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TanOpAdaptor : public TanOpGenericAdaptor<::mlir::ValueRange> { +public: + using TanOpGenericAdaptor::TanOpGenericAdaptor; + TanOpAdaptor(TanOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TanOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait, ::mlir::OpTrait::SameTypeOperands, ::mlir::OpTrait::Elementwise> { +public: + using Op::Op; + using Op::print; + using Adaptor = TanOpAdaptor; + template + using GenericAdaptor = TanOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.tan"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getInput(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value output); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::TanOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::TanhOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TanhOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TanhOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TanhOpGenericAdaptorBase(TanhOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TanhOpGenericAdaptor : public detail::TanhOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TanhOpGenericAdaptorBase; +public: + TanhOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TanhOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TanhOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TanhOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getInput() { + return (*getODSOperands(0).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TanhOpAdaptor : public TanhOpGenericAdaptor<::mlir::ValueRange> { +public: + using TanhOpGenericAdaptor::TanhOpGenericAdaptor; + TanhOpAdaptor(TanhOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TanhOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait, ::mlir::OpTrait::SameTypeOperands, ::mlir::OpTrait::Elementwise> { +public: + using Op::Op; + using Op::print; + using Adaptor = TanhOpAdaptor; + template + using GenericAdaptor = TanhOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.tanh"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getInput(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getInputMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value input, ::mlir::Value output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value input, ::mlir::Value output); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::TanhOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::TransposeOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TransposeOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TransposeOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TransposeOpGenericAdaptorBase(TransposeOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getPermutationAttr(); + ::mlir::DenseIntElementsAttr getPermutation(); +}; +} // namespace detail +template +class TransposeOpGenericAdaptor : public detail::TransposeOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TransposeOpGenericAdaptorBase; +public: + TransposeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TransposeOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TransposeOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TransposeOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getOperand() { + return (*getODSOperands(0).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(1).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TransposeOpAdaptor : public TransposeOpGenericAdaptor<::mlir::ValueRange> { +public: + using TransposeOpGenericAdaptor::TransposeOpGenericAdaptor; + TransposeOpAdaptor(TransposeOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TransposeOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = TransposeOpAdaptor; + template + using GenericAdaptor = TransposeOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("permutation")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getPermutationAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getPermutationAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.transpose"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getOperand(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getOperandMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::DenseIntElementsAttr getPermutationAttr(); + ::mlir::DenseIntElementsAttr getPermutation(); + void setPermutationAttr(::mlir::DenseIntElementsAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value operand, ::mlir::DenseIntElementsAttr permutation, ::mlir::Value output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value operand, ::mlir::DenseIntElementsAttr permutation, ::mlir::Value output); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::TransposeOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::TriangularSolveOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TriangularSolveOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TriangularSolveOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TriangularSolveOpGenericAdaptorBase(TriangularSolveOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::BoolAttr getLeftSideAttr(); + bool getLeftSide(); + ::mlir::BoolAttr getLowerAttr(); + bool getLower(); + ::mlir::BoolAttr getUnitDiagonalAttr(); + bool getUnitDiagonal(); + ::mlir::mhlo::TransposeAttr getTransposeAAttr(); + ::mlir::mhlo::Transpose getTransposeA(); + ::mlir::DenseIntElementsAttr getLayoutAAttr(); + ::mlir::DenseIntElementsAttr getLayoutA(); + ::mlir::DenseIntElementsAttr getLayoutBAttr(); + ::mlir::DenseIntElementsAttr getLayoutB(); + ::mlir::DenseIntElementsAttr getLayoutOutputAttr(); + ::mlir::DenseIntElementsAttr getLayoutOutput(); +}; +} // namespace detail +template +class TriangularSolveOpGenericAdaptor : public detail::TriangularSolveOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TriangularSolveOpGenericAdaptorBase; +public: + TriangularSolveOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TriangularSolveOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TriangularSolveOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TriangularSolveOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getA() { + return (*getODSOperands(0).begin()); + } + + ValueT getB() { + return (*getODSOperands(1).begin()); + } + + ValueT getOutput() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TriangularSolveOpAdaptor : public TriangularSolveOpGenericAdaptor<::mlir::ValueRange> { +public: + using TriangularSolveOpGenericAdaptor::TriangularSolveOpGenericAdaptor; + TriangularSolveOpAdaptor(TriangularSolveOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TriangularSolveOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait, ::mlir::OpTrait::SameOperandsElementType> { +public: + using Op::Op; + using Op::print; + using Adaptor = TriangularSolveOpAdaptor; + template + using GenericAdaptor = TriangularSolveOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("layout_a"), ::llvm::StringRef("layout_b"), ::llvm::StringRef("layout_output"), ::llvm::StringRef("left_side"), ::llvm::StringRef("lower"), ::llvm::StringRef("transpose_a"), ::llvm::StringRef("unit_diagonal")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getLayoutAAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getLayoutAAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + ::mlir::StringAttr getLayoutBAttrName() { + return getAttributeNameForIndex(1); + } + + static ::mlir::StringAttr getLayoutBAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 1); + } + + ::mlir::StringAttr getLayoutOutputAttrName() { + return getAttributeNameForIndex(2); + } + + static ::mlir::StringAttr getLayoutOutputAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 2); + } + + ::mlir::StringAttr getLeftSideAttrName() { + return getAttributeNameForIndex(3); + } + + static ::mlir::StringAttr getLeftSideAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 3); + } + + ::mlir::StringAttr getLowerAttrName() { + return getAttributeNameForIndex(4); + } + + static ::mlir::StringAttr getLowerAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 4); + } + + ::mlir::StringAttr getTransposeAAttrName() { + return getAttributeNameForIndex(5); + } + + static ::mlir::StringAttr getTransposeAAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 5); + } + + ::mlir::StringAttr getUnitDiagonalAttrName() { + return getAttributeNameForIndex(6); + } + + static ::mlir::StringAttr getUnitDiagonalAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 6); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.triangular_solve"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getA(); + ::mlir::TypedValue<::mlir::MemRefType> getB(); + ::mlir::TypedValue<::mlir::MemRefType> getOutput(); + ::mlir::OpOperand &getAMutable(); + ::mlir::OpOperand &getBMutable(); + ::mlir::OpOperand &getOutputMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::BoolAttr getLeftSideAttr(); + bool getLeftSide(); + ::mlir::BoolAttr getLowerAttr(); + bool getLower(); + ::mlir::BoolAttr getUnitDiagonalAttr(); + bool getUnitDiagonal(); + ::mlir::mhlo::TransposeAttr getTransposeAAttr(); + ::mlir::mhlo::Transpose getTransposeA(); + ::mlir::DenseIntElementsAttr getLayoutAAttr(); + ::mlir::DenseIntElementsAttr getLayoutA(); + ::mlir::DenseIntElementsAttr getLayoutBAttr(); + ::mlir::DenseIntElementsAttr getLayoutB(); + ::mlir::DenseIntElementsAttr getLayoutOutputAttr(); + ::mlir::DenseIntElementsAttr getLayoutOutput(); + void setLeftSideAttr(::mlir::BoolAttr attr); + void setLeftSide(bool attrValue); + void setLowerAttr(::mlir::BoolAttr attr); + void setLower(bool attrValue); + void setUnitDiagonalAttr(::mlir::BoolAttr attr); + void setUnitDiagonal(bool attrValue); + void setTransposeAAttr(::mlir::mhlo::TransposeAttr attr); + void setTransposeA(::mlir::mhlo::Transpose attrValue); + void setLayoutAAttr(::mlir::DenseIntElementsAttr attr); + void setLayoutBAttr(::mlir::DenseIntElementsAttr attr); + void setLayoutOutputAttr(::mlir::DenseIntElementsAttr attr); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, ::mlir::Value output, ::mlir::BoolAttr left_side, ::mlir::BoolAttr lower, ::mlir::BoolAttr unit_diagonal, ::mlir::mhlo::TransposeAttr transpose_a, ::mlir::DenseIntElementsAttr layout_a, ::mlir::DenseIntElementsAttr layout_b, ::mlir::DenseIntElementsAttr layout_output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::Value output, ::mlir::BoolAttr left_side, ::mlir::BoolAttr lower, ::mlir::BoolAttr unit_diagonal, ::mlir::mhlo::TransposeAttr transpose_a, ::mlir::DenseIntElementsAttr layout_a, ::mlir::DenseIntElementsAttr layout_b, ::mlir::DenseIntElementsAttr layout_output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value a, ::mlir::Value b, ::mlir::Value output, bool left_side, bool lower, bool unit_diagonal, ::mlir::mhlo::Transpose transpose_a, ::mlir::DenseIntElementsAttr layout_a, ::mlir::DenseIntElementsAttr layout_b, ::mlir::DenseIntElementsAttr layout_output); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value a, ::mlir::Value b, ::mlir::Value output, bool left_side, bool lower, bool unit_diagonal, ::mlir::mhlo::Transpose transpose_a, ::mlir::DenseIntElementsAttr layout_a, ::mlir::DenseIntElementsAttr layout_b, ::mlir::DenseIntElementsAttr layout_output); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 7 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::TriangularSolveOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::WhileOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class WhileOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + WhileOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + WhileOpGenericAdaptorBase(WhileOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::IntegerAttr getTripCountAttr(); + ::std::optional getTripCount(); + ::mlir::Region &getCond(); + ::mlir::Region &getBody(); + ::mlir::RegionRange getRegions(); +}; +} // namespace detail +template +class WhileOpGenericAdaptor : public detail::WhileOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::WhileOpGenericAdaptorBase; +public: + WhileOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + WhileOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : WhileOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + WhileOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getCondVal() { + return getODSOperands(0); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class WhileOpAdaptor : public WhileOpGenericAdaptor<::mlir::ValueRange> { +public: + using WhileOpGenericAdaptor::WhileOpGenericAdaptor; + WhileOpAdaptor(WhileOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class WhileOp : public ::mlir::Op::Impl, ::mlir::OpTrait::ZeroResults, ::mlir::OpTrait::ZeroSuccessors, ::mlir::OpTrait::VariadicOperands, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait, ::mlir::RegionBranchOpInterface::Trait, ::mlir::LoopLikeOpInterface::Trait> { +public: + using Op::Op; + using Op::print; + using Adaptor = WhileOpAdaptor; + template + using GenericAdaptor = WhileOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("trip_count")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getTripCountAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getTripCountAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.while"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::Operation::operand_range getCondVal(); + ::mlir::MutableOperandRange getCondValMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::Region &getCond(); + ::mlir::Region &getBody(); + ::mlir::IntegerAttr getTripCountAttr(); + ::std::optional getTripCount(); + void setTripCountAttr(::mlir::IntegerAttr attr); + void setTripCount(::std::optional attrValue); + ::mlir::Attribute removeTripCountAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::ValueRange cond_val, /*optional*/::mlir::IntegerAttr trip_count); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange cond_val, /*optional*/::mlir::IntegerAttr trip_count); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getSuccessorRegions(::mlir::RegionBranchPoint point, ::llvm::SmallVectorImpl<::mlir::RegionSuccessor> ®ions); + ::llvm::SmallVector<::mlir::Region *> getLoopRegions(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::WhileOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::XorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class XorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + XorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + XorOpGenericAdaptorBase(XorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); + ::mlir::DenseIntElementsAttr getBroadcastDimensionsAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getBroadcastDimensions(); +}; +} // namespace detail +template +class XorOpGenericAdaptor : public detail::XorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::XorOpGenericAdaptorBase; +public: + XorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + XorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : XorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + XorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + ValueT getLhs() { + return (*getODSOperands(0).begin()); + } + + ValueT getRhs() { + return (*getODSOperands(1).begin()); + } + + ValueT getOut() { + return (*getODSOperands(2).begin()); + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class XorOpAdaptor : public XorOpGenericAdaptor<::mlir::ValueRange> { +public: + using XorOpGenericAdaptor::XorOpGenericAdaptor; + XorOpAdaptor(XorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class XorOp : public ::mlir::Op::Impl, ::mlir::OpTrait::OpInvariants, ::mlir::MemoryEffectOpInterface::Trait, ::mlir::lmhlo::LmhloOp::Trait, ::mlir::OpTrait::SameTypeOperands, ::mlir::OpTrait::Elementwise> { +public: + using Op::Op; + using Op::print; + using Adaptor = XorOpAdaptor; + template + using GenericAdaptor = XorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + static ::llvm::StringRef attrNames[] = {::llvm::StringRef("broadcast_dimensions")}; + return ::llvm::ArrayRef(attrNames); + } + + ::mlir::StringAttr getBroadcastDimensionsAttrName() { + return getAttributeNameForIndex(0); + } + + static ::mlir::StringAttr getBroadcastDimensionsAttrName(::mlir::OperationName name) { + return getAttributeNameForIndex(name, 0); + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.xor"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + ::mlir::TypedValue<::mlir::MemRefType> getLhs(); + ::mlir::TypedValue<::mlir::MemRefType> getRhs(); + ::mlir::TypedValue<::mlir::MemRefType> getOut(); + ::mlir::OpOperand &getLhsMutable(); + ::mlir::OpOperand &getRhsMutable(); + ::mlir::OpOperand &getOutMutable(); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + ::mlir::DenseIntElementsAttr getBroadcastDimensionsAttr(); + ::std::optional< ::mlir::DenseIntElementsAttr > getBroadcastDimensions(); + void setBroadcastDimensionsAttr(::mlir::DenseIntElementsAttr attr); + ::mlir::Attribute removeBroadcastDimensionsAttr(); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value out, /*optional*/::mlir::DenseIntElementsAttr broadcast_dimensions); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::Value lhs, ::mlir::Value rhs, ::mlir::Value out, /*optional*/::mlir::DenseIntElementsAttr broadcast_dimensions); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +private: + ::mlir::StringAttr getAttributeNameForIndex(unsigned index) { + return getAttributeNameForIndex((*this)->getName(), index); + } + + static ::mlir::StringAttr getAttributeNameForIndex(::mlir::OperationName name, unsigned index) { + assert(index < 1 && "invalid attribute index"); + assert(name.getStringRef() == getOperationName() && "invalid operation name"); + return name.getAttributeNames()[index]; + } + +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::XorOp) + +namespace mlir { +namespace lmhlo { + +//===----------------------------------------------------------------------===// +// ::mlir::lmhlo::TerminatorOp declarations +//===----------------------------------------------------------------------===// + +namespace detail { +class TerminatorOpGenericAdaptorBase { +public: +protected: + ::mlir::DictionaryAttr odsAttrs; + ::std::optional<::mlir::OperationName> odsOpName; + ::mlir::RegionRange odsRegions; +public: + TerminatorOpGenericAdaptorBase(::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}); + + TerminatorOpGenericAdaptorBase(TerminatorOp op); + + std::pair getODSOperandIndexAndLength(unsigned index, unsigned odsOperandsSize); + ::mlir::DictionaryAttr getAttributes(); +}; +} // namespace detail +template +class TerminatorOpGenericAdaptor : public detail::TerminatorOpGenericAdaptorBase { + using ValueT = ::llvm::detail::ValueOfRange; + using Base = detail::TerminatorOpGenericAdaptorBase; +public: + TerminatorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs = nullptr, const ::mlir::EmptyProperties &properties = {}, ::mlir::RegionRange regions = {}) : Base(attrs, properties, regions), odsOperands(values) {} + + TerminatorOpGenericAdaptor(RangeT values, ::mlir::DictionaryAttr attrs, ::mlir::OpaqueProperties properties, ::mlir::RegionRange regions = {}) : TerminatorOpGenericAdaptor(values, attrs, (properties ? *properties.as<::mlir::EmptyProperties *>() : ::mlir::EmptyProperties{}), regions) {} + + template >> + TerminatorOpGenericAdaptor(RangeT values, LateInst op) : Base(op), odsOperands(values) {} + + std::pair getODSOperandIndexAndLength(unsigned index) { + return Base::getODSOperandIndexAndLength(index, odsOperands.size()); + } + + RangeT getODSOperands(unsigned index) { + auto valueRange = getODSOperandIndexAndLength(index); + return {std::next(odsOperands.begin(), valueRange.first), + std::next(odsOperands.begin(), valueRange.first + valueRange.second)}; + } + + RangeT getOperands() { + return odsOperands; + } + +private: + RangeT odsOperands; +}; +class TerminatorOpAdaptor : public TerminatorOpGenericAdaptor<::mlir::ValueRange> { +public: + using TerminatorOpGenericAdaptor::TerminatorOpGenericAdaptor; + TerminatorOpAdaptor(TerminatorOp op); + + ::mlir::LogicalResult verify(::mlir::Location loc); +}; +class TerminatorOp : public ::mlir::Op { +public: + using Op::Op; + using Op::print; + using Adaptor = TerminatorOpAdaptor; + template + using GenericAdaptor = TerminatorOpGenericAdaptor; + using FoldAdaptor = GenericAdaptor<::llvm::ArrayRef<::mlir::Attribute>>; + static ::llvm::ArrayRef<::llvm::StringRef> getAttributeNames() { + return {}; + } + + static constexpr ::llvm::StringLiteral getOperationName() { + return ::llvm::StringLiteral("lmhlo.terminator"); + } + + std::pair getODSOperandIndexAndLength(unsigned index); + ::mlir::Operation::operand_range getODSOperands(unsigned index); + std::pair getODSResultIndexAndLength(unsigned index); + ::mlir::Operation::result_range getODSResults(unsigned index); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ValueRange operands); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState); + static void build(::mlir::OpBuilder &odsBuilder, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes); + static void build(::mlir::OpBuilder &, ::mlir::OperationState &odsState, ::mlir::TypeRange resultTypes, ::mlir::ValueRange operands, ::llvm::ArrayRef<::mlir::NamedAttribute> attributes = {}); + ::mlir::LogicalResult verifyInvariantsImpl(); + ::mlir::LogicalResult verifyInvariants(); + ::mlir::MutableOperandRange getMutableSuccessorOperands(::mlir::RegionBranchPoint point); + void getEffects(::llvm::SmallVectorImpl<::mlir::SideEffects::EffectInstance<::mlir::MemoryEffects::Effect>> &effects); +public: +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::TerminatorOp) + + +#endif // GET_OP_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/lhlo_ops_structs_inc_gen/lhlo/IR/lhlo_ops_structs.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/lhlo_ops_structs_inc_gen/lhlo/IR/lhlo_ops_structs.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..1529694778e92851208cfa2ffac1b942b73aec20 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/lhlo_ops_structs_inc_gen/lhlo/IR/lhlo_ops_structs.h.inc @@ -0,0 +1,43 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* AttrDef Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifdef GET_ATTRDEF_CLASSES +#undef GET_ATTRDEF_CLASSES + + +namespace mlir { +class AsmParser; +class AsmPrinter; +} // namespace mlir +namespace mlir { +namespace lmhlo { +class CustomCallTargetArgMappingAttr; +namespace detail { +struct CustomCallTargetArgMappingAttrStorage; +} // namespace detail +class CustomCallTargetArgMappingAttr : public ::mlir::Attribute::AttrBase { +public: + using Base::Base; + static CustomCallTargetArgMappingAttr get(::mlir::MLIRContext *context, int64_t num_args, int64_t num_results, ::llvm::ArrayRef args_to_target_args, ::llvm::ArrayRef results_to_target_results); + static constexpr ::llvm::StringLiteral getMnemonic() { + return {"custom_call_target_arg_mapping"}; + } + + static ::mlir::Attribute parse(::mlir::AsmParser &odsParser, ::mlir::Type odsType); + void print(::mlir::AsmPrinter &odsPrinter) const; + int64_t getNumArgs() const; + int64_t getNumResults() const; + ::llvm::ArrayRef getArgsToTargetArgs() const; + ::llvm::ArrayRef getResultsToTargetResults() const; +}; +} // namespace lmhlo +} // namespace mlir +MLIR_DECLARE_EXPLICIT_TYPE_ID(::mlir::lmhlo::CustomCallTargetArgMappingAttr) + +#endif // GET_ATTRDEF_CLASSES + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/lhlo_structured_interface/lhlo/IR/lhlo_structured_interface.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/lhlo_structured_interface/lhlo/IR/lhlo_structured_interface.h new file mode 100644 index 0000000000000000000000000000000000000000..0a584db58c4021d9b7563b67bf0d8b067dd451fc --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/lhlo_structured_interface/lhlo/IR/lhlo_structured_interface.h @@ -0,0 +1,24 @@ +/* Copyright 2021 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef MLIR_HLO_LHLO_IR_LHLO_STRUCTURED_INTERFACE_H +#define MLIR_HLO_LHLO_IR_LHLO_STRUCTURED_INTERFACE_H + +#include "mlir/IR/OpDefinition.h" + +/// Include the generated interface declarations. +#include "lhlo/IR/lhlo_structured_interface.h.inc" + +#endif // MLIR_HLO_LHLO_IR_LHLO_STRUCTURED_INTERFACE_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/lhlo_structured_interface/lhlo/IR/lhlo_structured_interface.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/lhlo_structured_interface/lhlo/IR/lhlo_structured_interface.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..462e1f007c66b5735c0d40a29437255ddd4fbea8 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/lhlo_structured_interface/lhlo/IR/lhlo_structured_interface.h.inc @@ -0,0 +1,88 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Interface Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace lmhlo { +class LmhloOp; +namespace detail { +struct LmhloOpInterfaceTraits { + struct Concept { + /// The methods defined by the interface. + Value (*getResultBuffer)(const Concept *impl, ::mlir::Operation *); + }; + template + class Model : public Concept { + public: + using Interface = ::mlir::lmhlo::LmhloOp; + Model() : Concept{getResultBuffer} {} + + static inline Value getResultBuffer(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + }; + template + class FallbackModel : public Concept { + public: + using Interface = ::mlir::lmhlo::LmhloOp; + FallbackModel() : Concept{getResultBuffer} {} + + static inline Value getResultBuffer(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + }; + template + class ExternalModel : public FallbackModel { + public: + using ConcreteEntity = ConcreteOp; + Value getResultBuffer(::mlir::Operation *tablegen_opaque_val) const; + }; +};template +struct LmhloOpTrait; + +} // namespace detail +class LmhloOp : public ::mlir::OpInterface { +public: + using ::mlir::OpInterface::OpInterface; + template + struct Trait : public detail::LmhloOpTrait {}; + /// Return the operand that is the output buffer + Value getResultBuffer(); +}; +namespace detail { + template + struct LmhloOpTrait : public ::mlir::OpInterface::Trait { + /// Return the operand that is the output buffer + Value getResultBuffer() { + /// By default, the result buffer is the last operand + unsigned num_operands = this->getOperation()->getNumOperands(); + if (num_operands > 1) { + return this->getOperation()->getOperand(num_operands - 1); + } + return nullptr; + } + }; +}// namespace detail +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +template +Value detail::LmhloOpInterfaceTraits::Model::getResultBuffer(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getResultBuffer(); +} +template +Value detail::LmhloOpInterfaceTraits::FallbackModel::getResultBuffer(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getResultBuffer(tablegen_opaque_val); +} +template +Value detail::LmhloOpInterfaceTraits::ExternalModel::getResultBuffer(::mlir::Operation *tablegen_opaque_val) const { +/// By default, the result buffer is the last operand + unsigned num_operands = this->getOperation()->getNumOperands(); + if (num_operands > 1) { + return this->getOperation()->getOperand(num_operands - 1); + } + return nullptr; +} +} // namespace lmhlo +} // namespace mlir diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/lhlo_structured_interface_inc_gen/lhlo/IR/lhlo_structured_interface.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/lhlo_structured_interface_inc_gen/lhlo/IR/lhlo_structured_interface.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..462e1f007c66b5735c0d40a29437255ddd4fbea8 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/lhlo_structured_interface_inc_gen/lhlo/IR/lhlo_structured_interface.h.inc @@ -0,0 +1,88 @@ +/*===- TableGen'erated file -------------------------------------*- C++ -*-===*\ +|* *| +|* Interface Declarations *| +|* *| +|* Automatically generated file, do not edit! *| +|* *| +\*===----------------------------------------------------------------------===*/ + +namespace mlir { +namespace lmhlo { +class LmhloOp; +namespace detail { +struct LmhloOpInterfaceTraits { + struct Concept { + /// The methods defined by the interface. + Value (*getResultBuffer)(const Concept *impl, ::mlir::Operation *); + }; + template + class Model : public Concept { + public: + using Interface = ::mlir::lmhlo::LmhloOp; + Model() : Concept{getResultBuffer} {} + + static inline Value getResultBuffer(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + }; + template + class FallbackModel : public Concept { + public: + using Interface = ::mlir::lmhlo::LmhloOp; + FallbackModel() : Concept{getResultBuffer} {} + + static inline Value getResultBuffer(const Concept *impl, ::mlir::Operation *tablegen_opaque_val); + }; + template + class ExternalModel : public FallbackModel { + public: + using ConcreteEntity = ConcreteOp; + Value getResultBuffer(::mlir::Operation *tablegen_opaque_val) const; + }; +};template +struct LmhloOpTrait; + +} // namespace detail +class LmhloOp : public ::mlir::OpInterface { +public: + using ::mlir::OpInterface::OpInterface; + template + struct Trait : public detail::LmhloOpTrait {}; + /// Return the operand that is the output buffer + Value getResultBuffer(); +}; +namespace detail { + template + struct LmhloOpTrait : public ::mlir::OpInterface::Trait { + /// Return the operand that is the output buffer + Value getResultBuffer() { + /// By default, the result buffer is the last operand + unsigned num_operands = this->getOperation()->getNumOperands(); + if (num_operands > 1) { + return this->getOperation()->getOperand(num_operands - 1); + } + return nullptr; + } + }; +}// namespace detail +} // namespace lmhlo +} // namespace mlir +namespace mlir { +namespace lmhlo { +template +Value detail::LmhloOpInterfaceTraits::Model::getResultBuffer(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return (llvm::cast(tablegen_opaque_val)).getResultBuffer(); +} +template +Value detail::LmhloOpInterfaceTraits::FallbackModel::getResultBuffer(const Concept *impl, ::mlir::Operation *tablegen_opaque_val) { + return static_cast(impl)->getResultBuffer(tablegen_opaque_val); +} +template +Value detail::LmhloOpInterfaceTraits::ExternalModel::getResultBuffer(::mlir::Operation *tablegen_opaque_val) const { +/// By default, the result buffer is the last operand + unsigned num_operands = this->getOperation()->getNumOperands(); + if (num_operands > 1) { + return this->getOperation()->getOperand(num_operands - 1); + } + return nullptr; +} +} // namespace lmhlo +} // namespace mlir diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/lmhlo_pass_inc_gen/lhlo/transforms/lmhlo_passes.h.inc b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/lmhlo_pass_inc_gen/lhlo/transforms/lmhlo_passes.h.inc new file mode 100644 index 0000000000000000000000000000000000000000..7a5454433185f17337ad5d9d064bec68a0a90748 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/lmhlo_pass_inc_gen/lhlo/transforms/lmhlo_passes.h.inc @@ -0,0 +1,508 @@ +/* Autogenerated by mlir-tblgen; don't manually edit */ + +#ifdef GEN_PASS_DECL +// Generate declarations for all passes. +#define GEN_PASS_DECL_LEGALIZETOTENSOROPPASS +#define GEN_PASS_DECL_LHLOLEGALIZETOAFFINEPASS +#define GEN_PASS_DECL_LHLOLEGALIZETOGPUPASS +#define GEN_PASS_DECL_LHLOLEGALIZETOPARALLELLOOPSPASS +#undef GEN_PASS_DECL +#endif // GEN_PASS_DECL + +//===----------------------------------------------------------------------===// +// LegalizeToTensorOpPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_LEGALIZETOTENSOROPPASS +#undef GEN_PASS_DECL_LEGALIZETOTENSOROPPASS +#endif // GEN_PASS_DECL_LEGALIZETOTENSOROPPASS +#ifdef GEN_PASS_DEF_LEGALIZETOTENSOROPPASS +namespace impl { + +template +class LegalizeToTensorOpPassBase : public ::mlir::OperationPass { +public: + using Base = LegalizeToTensorOpPassBase; + + LegalizeToTensorOpPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + LegalizeToTensorOpPassBase(const LegalizeToTensorOpPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("lhlo-legalize-to-tensor-op"); + } + ::llvm::StringRef getArgument() const override { return "lhlo-legalize-to-tensor-op"; } + + ::llvm::StringRef getDescription() const override { return "Legalize bufferization.to_tensor ops inserted during mhlo to lmhlo conversion."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LegalizeToTensorOpPass"); + } + ::llvm::StringRef getName() const override { return "LegalizeToTensorOpPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LegalizeToTensorOpPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_LEGALIZETOTENSOROPPASS +#endif // GEN_PASS_DEF_LEGALIZETOTENSOROPPASS + +//===----------------------------------------------------------------------===// +// LhloLegalizeToAffinePass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_LHLOLEGALIZETOAFFINEPASS +#undef GEN_PASS_DECL_LHLOLEGALIZETOAFFINEPASS +#endif // GEN_PASS_DECL_LHLOLEGALIZETOAFFINEPASS +#ifdef GEN_PASS_DEF_LHLOLEGALIZETOAFFINEPASS +namespace impl { + +template +class LhloLegalizeToAffinePassBase : public ::mlir::OperationPass { +public: + using Base = LhloLegalizeToAffinePassBase; + + LhloLegalizeToAffinePassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + LhloLegalizeToAffinePassBase(const LhloLegalizeToAffinePassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("lhlo-legalize-to-affine"); + } + ::llvm::StringRef getArgument() const override { return "lhlo-legalize-to-affine"; } + + ::llvm::StringRef getDescription() const override { return "Legalize from LHLO dialect to affine dialect."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LhloLegalizeToAffinePass"); + } + ::llvm::StringRef getName() const override { return "LhloLegalizeToAffinePass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LhloLegalizeToAffinePassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_LHLOLEGALIZETOAFFINEPASS +#endif // GEN_PASS_DEF_LHLOLEGALIZETOAFFINEPASS + +//===----------------------------------------------------------------------===// +// LhloLegalizeToGpuPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_LHLOLEGALIZETOGPUPASS +#undef GEN_PASS_DECL_LHLOLEGALIZETOGPUPASS +#endif // GEN_PASS_DECL_LHLOLEGALIZETOGPUPASS +#ifdef GEN_PASS_DEF_LHLOLEGALIZETOGPUPASS +namespace impl { + +template +class LhloLegalizeToGpuPassBase : public ::mlir::OperationPass { +public: + using Base = LhloLegalizeToGpuPassBase; + + LhloLegalizeToGpuPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + LhloLegalizeToGpuPassBase(const LhloLegalizeToGpuPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("lhlo-legalize-to-gpu"); + } + ::llvm::StringRef getArgument() const override { return "lhlo-legalize-to-gpu"; } + + ::llvm::StringRef getDescription() const override { return "Legalize from LHLO dialect to GPU dialect."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LhloLegalizeToGpuPass"); + } + ::llvm::StringRef getName() const override { return "LhloLegalizeToGpuPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LhloLegalizeToGpuPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_LHLOLEGALIZETOGPUPASS +#endif // GEN_PASS_DEF_LHLOLEGALIZETOGPUPASS + +//===----------------------------------------------------------------------===// +// LhloLegalizeToParallelLoopsPass +//===----------------------------------------------------------------------===// +#ifdef GEN_PASS_DECL_LHLOLEGALIZETOPARALLELLOOPSPASS +#undef GEN_PASS_DECL_LHLOLEGALIZETOPARALLELLOOPSPASS +#endif // GEN_PASS_DECL_LHLOLEGALIZETOPARALLELLOOPSPASS +#ifdef GEN_PASS_DEF_LHLOLEGALIZETOPARALLELLOOPSPASS +namespace impl { + +template +class LhloLegalizeToParallelLoopsPassBase : public ::mlir::OperationPass { +public: + using Base = LhloLegalizeToParallelLoopsPassBase; + + LhloLegalizeToParallelLoopsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + LhloLegalizeToParallelLoopsPassBase(const LhloLegalizeToParallelLoopsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("lhlo-legalize-to-parallel-loops"); + } + ::llvm::StringRef getArgument() const override { return "lhlo-legalize-to-parallel-loops"; } + + ::llvm::StringRef getDescription() const override { return "Legalize from LHLO dialect to parallel loops."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LhloLegalizeToParallelLoopsPass"); + } + ::llvm::StringRef getName() const override { return "LhloLegalizeToParallelLoopsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LhloLegalizeToParallelLoopsPassBase) + +protected: +private: +}; +} // namespace impl +#undef GEN_PASS_DEF_LHLOLEGALIZETOPARALLELLOOPSPASS +#endif // GEN_PASS_DEF_LHLOLEGALIZETOPARALLELLOOPSPASS +#ifdef GEN_PASS_REGISTRATION + +//===----------------------------------------------------------------------===// +// LegalizeToTensorOpPass Registration +//===----------------------------------------------------------------------===// + +inline void registerLegalizeToTensorOpPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createLegalizeToTensorOpPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerLegalizeToTensorOpPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createLegalizeToTensorOpPass(); + }); +} + +//===----------------------------------------------------------------------===// +// LhloLegalizeToAffinePass Registration +//===----------------------------------------------------------------------===// + +inline void registerLhloLegalizeToAffinePass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createLhloLegalizeToAffinePass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerLhloLegalizeToAffinePassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createLhloLegalizeToAffinePass(); + }); +} + +//===----------------------------------------------------------------------===// +// LhloLegalizeToGpuPass Registration +//===----------------------------------------------------------------------===// + +inline void registerLhloLegalizeToGpuPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createLegalizeToGpuPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerLhloLegalizeToGpuPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createLegalizeToGpuPass(); + }); +} + +//===----------------------------------------------------------------------===// +// LhloLegalizeToParallelLoopsPass Registration +//===----------------------------------------------------------------------===// + +inline void registerLhloLegalizeToParallelLoopsPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createLegalizeLhloToParallelLoopsPass(); + }); +} + +// Old registration code, kept for temporary backwards compatibility. +inline void registerLhloLegalizeToParallelLoopsPassPass() { + ::mlir::registerPass([]() -> std::unique_ptr<::mlir::Pass> { + return createLegalizeLhloToParallelLoopsPass(); + }); +} + +//===----------------------------------------------------------------------===// +// AllLmhlo Registration +//===----------------------------------------------------------------------===// + +inline void registerAllLmhloPasses() { + registerLegalizeToTensorOpPass(); + registerLhloLegalizeToAffinePass(); + registerLhloLegalizeToGpuPass(); + registerLhloLegalizeToParallelLoopsPass(); +} +#undef GEN_PASS_REGISTRATION +#endif // GEN_PASS_REGISTRATION +// Deprecated. Please use the new per-pass macros. +#ifdef GEN_PASS_CLASSES + +template +class LegalizeToTensorOpPassBase : public ::mlir::OperationPass { +public: + using Base = LegalizeToTensorOpPassBase; + + LegalizeToTensorOpPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + LegalizeToTensorOpPassBase(const LegalizeToTensorOpPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("lhlo-legalize-to-tensor-op"); + } + ::llvm::StringRef getArgument() const override { return "lhlo-legalize-to-tensor-op"; } + + ::llvm::StringRef getDescription() const override { return "Legalize bufferization.to_tensor ops inserted during mhlo to lmhlo conversion."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LegalizeToTensorOpPass"); + } + ::llvm::StringRef getName() const override { return "LegalizeToTensorOpPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LegalizeToTensorOpPassBase) + +protected: +}; + +template +class LhloLegalizeToAffinePassBase : public ::mlir::OperationPass { +public: + using Base = LhloLegalizeToAffinePassBase; + + LhloLegalizeToAffinePassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + LhloLegalizeToAffinePassBase(const LhloLegalizeToAffinePassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("lhlo-legalize-to-affine"); + } + ::llvm::StringRef getArgument() const override { return "lhlo-legalize-to-affine"; } + + ::llvm::StringRef getDescription() const override { return "Legalize from LHLO dialect to affine dialect."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LhloLegalizeToAffinePass"); + } + ::llvm::StringRef getName() const override { return "LhloLegalizeToAffinePass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LhloLegalizeToAffinePassBase) + +protected: +}; + +template +class LhloLegalizeToGpuPassBase : public ::mlir::OperationPass { +public: + using Base = LhloLegalizeToGpuPassBase; + + LhloLegalizeToGpuPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + LhloLegalizeToGpuPassBase(const LhloLegalizeToGpuPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("lhlo-legalize-to-gpu"); + } + ::llvm::StringRef getArgument() const override { return "lhlo-legalize-to-gpu"; } + + ::llvm::StringRef getDescription() const override { return "Legalize from LHLO dialect to GPU dialect."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LhloLegalizeToGpuPass"); + } + ::llvm::StringRef getName() const override { return "LhloLegalizeToGpuPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LhloLegalizeToGpuPassBase) + +protected: +}; + +template +class LhloLegalizeToParallelLoopsPassBase : public ::mlir::OperationPass { +public: + using Base = LhloLegalizeToParallelLoopsPassBase; + + LhloLegalizeToParallelLoopsPassBase() : ::mlir::OperationPass(::mlir::TypeID::get()) {} + LhloLegalizeToParallelLoopsPassBase(const LhloLegalizeToParallelLoopsPassBase &other) : ::mlir::OperationPass(other) {} + + /// Returns the command-line argument attached to this pass. + static constexpr ::llvm::StringLiteral getArgumentName() { + return ::llvm::StringLiteral("lhlo-legalize-to-parallel-loops"); + } + ::llvm::StringRef getArgument() const override { return "lhlo-legalize-to-parallel-loops"; } + + ::llvm::StringRef getDescription() const override { return "Legalize from LHLO dialect to parallel loops."; } + + /// Returns the derived pass name. + static constexpr ::llvm::StringLiteral getPassName() { + return ::llvm::StringLiteral("LhloLegalizeToParallelLoopsPass"); + } + ::llvm::StringRef getName() const override { return "LhloLegalizeToParallelLoopsPass"; } + + /// Support isa/dyn_cast functionality for the derived pass class. + static bool classof(const ::mlir::Pass *pass) { + return pass->getTypeID() == ::mlir::TypeID::get(); + } + + /// A clone method to create a copy of this pass. + std::unique_ptr<::mlir::Pass> clonePass() const override { + return std::make_unique(*static_cast(this)); + } + + /// Return the dialect that must be loaded in the context before this pass. + void getDependentDialects(::mlir::DialectRegistry ®istry) const override { + + } + + /// Explicitly declare the TypeID for this class. We declare an explicit private + /// instantiation because Pass classes should only be visible by the current + /// library. + MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(LhloLegalizeToParallelLoopsPassBase) + +protected: +}; +#undef GEN_PASS_CLASSES +#endif // GEN_PASS_CLASSES diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/lmhlo_passes/lhlo/transforms/passes.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/lmhlo_passes/lhlo/transforms/passes.h new file mode 100644 index 0000000000000000000000000000000000000000..8225dfa238ccf23fd62df4da5e2c812033a29a3c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/lmhlo_passes/lhlo/transforms/passes.h @@ -0,0 +1,65 @@ +/* Copyright 2019 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef MLIR_HLO_LHLO_TRANSFORMS_PASSES_H +#define MLIR_HLO_LHLO_TRANSFORMS_PASSES_H + +#include + +#include "llvm/ADT/ArrayRef.h" +#include "mlir/Pass/Pass.h" + +namespace mlir { + +class ModuleOp; +class Operation; +template +class OperationPass; +class Pass; +namespace func { +class FuncOp; +} // namespace func +namespace lmhlo { +class FusionOp; +} // namespace lmhlo + +namespace lmhlo { + +#define GEN_PASS_DECL +#include "lhlo/transforms/lmhlo_passes.h.inc" + +// Lowers from LHLO dialect to Affine dialect. +std::unique_ptr> createLhloLegalizeToAffinePass(); + +// Lowers from LHLO dialect to GPU dialect. +std::unique_ptr> createLegalizeToGpuPass(); + +// Lowers from LHLO dialect to parallel loops. +std::unique_ptr> +createLegalizeLhloToParallelLoopsPass(); + +// Legalizes tensor load ops that are inserted during mhlo to lmhlo conversion. +std::unique_ptr> createLegalizeToTensorOpPass(); + +// Input inline fusion pass for fusion codegen +std::unique_ptr> createInputInlineFusionPass(); + +#define GEN_PASS_REGISTRATION +#include "lhlo/transforms/lmhlo_passes.h.inc" + +} // namespace lmhlo +} // namespace mlir + +#endif // MLIR_HLO_LHLO_TRANSFORMS_PASSES_H diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/map_chlo_to_hlo_op/mhlo/transforms/map_chlo_to_hlo_op.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/map_chlo_to_hlo_op/mhlo/transforms/map_chlo_to_hlo_op.h new file mode 100644 index 0000000000000000000000000000000000000000..5ba277bc4dbccf61eb801b20010907b3d1f9e2c4 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/tensorflow/include/tensorflow/compiler/xla/mlir_hlo/_virtual_includes/map_chlo_to_hlo_op/mhlo/transforms/map_chlo_to_hlo_op.h @@ -0,0 +1,137 @@ +/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +==============================================================================*/ + +#ifndef MLIR_HLO_MHLO_TRANSFORMS_MAP_CHLO_TO_HLO_OP_H +#define MLIR_HLO_MHLO_TRANSFORMS_MAP_CHLO_TO_HLO_OP_H + +#include +#include + +#include "mhlo/IR/hlo_ops.h" +#include "mlir/IR/PatternMatch.h" +#include "stablehlo/dialect/ChloOps.h" + +namespace mlir { +namespace chlo { + +template +struct HloNaryElementwiseAdaptor { + static ToOpTy createOp(FromOpTy fromOp, Type resultType, + ValueRange broadcastedOperands, OpBuilder &builder) { + return builder.create(fromOp.getLoc(), resultType, + broadcastedOperands); + } +}; + +inline std::optional mhloComparisonDirection( + chlo::ComparisonDirection value) { + switch (value) { + case chlo::ComparisonDirection::EQ: + return mhlo::ComparisonDirection::EQ; + case chlo::ComparisonDirection::NE: + return mhlo::ComparisonDirection::NE; + case chlo::ComparisonDirection::GE: + return mhlo::ComparisonDirection::GE; + case chlo::ComparisonDirection::GT: + return mhlo::ComparisonDirection::GT; + case chlo::ComparisonDirection::LE: + return mhlo::ComparisonDirection::LE; + case chlo::ComparisonDirection::LT: + return mhlo::ComparisonDirection::LT; + } + return {}; +} + +inline std::optional mhloComparisonType( + chlo::ComparisonType value) { + switch (value) { + case chlo::ComparisonType::NOTYPE: + return mhlo::ComparisonType::NOTYPE; + case chlo::ComparisonType::FLOAT: + return mhlo::ComparisonType::FLOAT; + case chlo::ComparisonType::TOTALORDER: + return mhlo::ComparisonType::TOTALORDER; + case chlo::ComparisonType::SIGNED: + return mhlo::ComparisonType::SIGNED; + case chlo::ComparisonType::UNSIGNED: + return mhlo::ComparisonType::UNSIGNED; + } + return {}; +} + +struct HloCompareAdaptor { + static mhlo::CompareOp createOp(BroadcastCompareOp fromOp, Type resultType, + ValueRange broadcastedOperands, + OpBuilder &builder) { + auto chloDirection = fromOp.getComparisonDirection(); + auto mhloDirection = mhloComparisonDirection(chloDirection); + if (!mhloDirection) return nullptr; + auto chloType = fromOp.getCompareType().value_or(ComparisonType::NOTYPE); + auto mhloType = mhloComparisonType(chloType); + if (!mhloType) return nullptr; + auto mhloTypeAttr = + fromOp.getCompareType() + ? mhlo::ComparisonTypeAttr::get(builder.getContext(), *mhloType) + : nullptr; + return builder.create( + fromOp.getLoc(), resultType, broadcastedOperands[0], + broadcastedOperands[1], *mhloDirection, mhloTypeAttr); + } +}; + +// Populate a pattern for each Broadcasting CHlo op. This requires the pattern +// to take a ChloOpTy, NonBroadcastingOpTy, and an Adaptor as templated values. +template